You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branches 'release', 'acpica', 'bugzilla-10224', 'bugzilla-9772', 'bugzilla-9916', 'ec', 'eeepc', 'idle', 'misc', 'pm-legacy', 'sysfs-links-2.6.26', 'thermal', 'thinkpad' and 'video' into release
This commit is contained in:
+65
-1
@@ -22,6 +22,39 @@ config ATMEL_PWM
|
||||
purposes including software controlled power-efficent backlights
|
||||
on LCD displays, motor control, and waveform generation.
|
||||
|
||||
config ATMEL_TCLIB
|
||||
bool "Atmel AT32/AT91 Timer/Counter Library"
|
||||
depends on (AVR32 || ARCH_AT91)
|
||||
help
|
||||
Select this if you want a library to allocate the Timer/Counter
|
||||
blocks found on many Atmel processors. This facilitates using
|
||||
these blocks by different drivers despite processor differences.
|
||||
|
||||
config ATMEL_TCB_CLKSRC
|
||||
bool "TC Block Clocksource"
|
||||
depends on ATMEL_TCLIB && GENERIC_TIME
|
||||
default y
|
||||
help
|
||||
Select this to get a high precision clocksource based on a
|
||||
TC block with a 5+ MHz base clock rate. Two timer channels
|
||||
are combined to make a single 32-bit timer.
|
||||
|
||||
When GENERIC_CLOCKEVENTS is defined, the third timer channel
|
||||
may be used as a clock event device supporting oneshot mode
|
||||
(delays of up to two seconds) based on the 32 KiHz clock.
|
||||
|
||||
config ATMEL_TCB_CLKSRC_BLOCK
|
||||
int
|
||||
depends on ATMEL_TCB_CLKSRC
|
||||
prompt "TC Block" if ARCH_AT91RM9200 || ARCH_AT91SAM9260 || CPU_AT32AP700X
|
||||
default 0
|
||||
range 0 1
|
||||
help
|
||||
Some chips provide more than one TC block, so you have the
|
||||
choice of which one to use for the clock framework. The other
|
||||
TC can be used for other purposes, such as PWM generation and
|
||||
interval timing.
|
||||
|
||||
config IBM_ASM
|
||||
tristate "Device driver for IBM RSA service processor"
|
||||
depends on X86 && PCI && INPUT && EXPERIMENTAL
|
||||
@@ -107,6 +140,7 @@ config ACER_WMI
|
||||
depends on EXPERIMENTAL
|
||||
depends on ACPI
|
||||
depends on LEDS_CLASS
|
||||
depends on NEW_LEDS
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
depends on SERIO_I8042
|
||||
select ACPI_WMI
|
||||
@@ -127,6 +161,7 @@ config ASUS_LAPTOP
|
||||
depends on ACPI
|
||||
depends on EXPERIMENTAL && !ACPI_ASUS
|
||||
depends on LEDS_CLASS
|
||||
depends on NEW_LEDS
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
---help---
|
||||
This is the new Linux driver for Asus laptops. It may also support some
|
||||
@@ -208,10 +243,13 @@ config SONYPI_COMPAT
|
||||
config THINKPAD_ACPI
|
||||
tristate "ThinkPad ACPI Laptop Extras"
|
||||
depends on X86 && ACPI
|
||||
select BACKLIGHT_LCD_SUPPORT
|
||||
select BACKLIGHT_CLASS_DEVICE
|
||||
select HWMON
|
||||
select NVRAM
|
||||
depends on INPUT
|
||||
select INPUT
|
||||
select NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
---help---
|
||||
This is a driver for the IBM and Lenovo ThinkPad laptops. It adds
|
||||
support for Fn-Fx key combinations, Bluetooth control, video
|
||||
@@ -311,6 +349,7 @@ config ATMEL_SSC
|
||||
config INTEL_MENLOW
|
||||
tristate "Thermal Management driver for Intel menlow platform"
|
||||
depends on ACPI_THERMAL
|
||||
select THERMAL
|
||||
depends on X86
|
||||
---help---
|
||||
ACPI thermal management enhancement driver on
|
||||
@@ -318,6 +357,19 @@ config INTEL_MENLOW
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config EEEPC_LAPTOP
|
||||
tristate "Eee PC Hotkey Driver (EXPERIMENTAL)"
|
||||
depends on X86
|
||||
depends on ACPI
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
depends on HWMON
|
||||
depends on EXPERIMENTAL
|
||||
---help---
|
||||
This driver supports the Fn-Fx keys on Eee PC laptops.
|
||||
It also adds the ability to switch camera/wlan on/off.
|
||||
|
||||
If you have an Eee PC laptop, say Y or M here.
|
||||
|
||||
config ENCLOSURE_SERVICES
|
||||
tristate "Enclosure Services"
|
||||
default n
|
||||
@@ -327,4 +379,16 @@ config ENCLOSURE_SERVICES
|
||||
driver (SCSI/ATA) which supports enclosures
|
||||
or a SCSI enclosure device (SES) to use these services.
|
||||
|
||||
config SGI_XP
|
||||
tristate "Support communication between SGI SSIs"
|
||||
depends on IA64_GENERIC || IA64_SGI_SN2
|
||||
select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
|
||||
select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
|
||||
---help---
|
||||
An SGI machine can be divided into multiple Single System
|
||||
Images which act independently of each other and have
|
||||
hardware based memory protection from the others. Enabling
|
||||
this feature will allow for direct communication between SSIs
|
||||
based on a network adapter and DMA messaging.
|
||||
|
||||
endif # MISC_DEVICES
|
||||
|
||||
@@ -7,9 +7,11 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/
|
||||
obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/
|
||||
obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
|
||||
obj-$(CONFIG_ACER_WMI) += acer-wmi.o
|
||||
obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
|
||||
obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
|
||||
obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
|
||||
obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
|
||||
obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
|
||||
obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
|
||||
obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
|
||||
obj-$(CONFIG_LKDTM) += lkdtm.o
|
||||
obj-$(CONFIG_TIFM_CORE) += tifm_core.o
|
||||
@@ -22,3 +24,5 @@ obj-$(CONFIG_FUJITSU_LAPTOP) += fujitsu-laptop.o
|
||||
obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
|
||||
obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
|
||||
obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
|
||||
obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
|
||||
obj-$(CONFIG_SGI_XP) += sgi-xp/
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
#include <linux/atmel_tc.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
/* Number of bytes to reserve for the iomem resource */
|
||||
#define ATMEL_TC_IOMEM_SIZE 256
|
||||
|
||||
|
||||
/*
|
||||
* This is a thin library to solve the problem of how to portably allocate
|
||||
* one of the TC blocks. For simplicity, it doesn't currently expect to
|
||||
* share individual timers between different drivers.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_AVR32)
|
||||
/* AVR32 has these divide PBB */
|
||||
const u8 atmel_tc_divisors[5] = { 0, 4, 8, 16, 32, };
|
||||
EXPORT_SYMBOL(atmel_tc_divisors);
|
||||
|
||||
#elif defined(CONFIG_ARCH_AT91)
|
||||
/* AT91 has these divide MCK */
|
||||
const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
|
||||
EXPORT_SYMBOL(atmel_tc_divisors);
|
||||
|
||||
#endif
|
||||
|
||||
static DEFINE_SPINLOCK(tc_list_lock);
|
||||
static LIST_HEAD(tc_list);
|
||||
|
||||
/**
|
||||
* atmel_tc_alloc - allocate a specified TC block
|
||||
* @block: which block to allocate
|
||||
* @name: name to be associated with the iomem resource
|
||||
*
|
||||
* Caller allocates a block. If it is available, a pointer to a
|
||||
* pre-initialized struct atmel_tc is returned. The caller can access
|
||||
* the registers directly through the "regs" field.
|
||||
*/
|
||||
struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
|
||||
{
|
||||
struct atmel_tc *tc;
|
||||
struct platform_device *pdev = NULL;
|
||||
struct resource *r;
|
||||
|
||||
spin_lock(&tc_list_lock);
|
||||
list_for_each_entry(tc, &tc_list, node) {
|
||||
if (tc->pdev->id == block) {
|
||||
pdev = tc->pdev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pdev || tc->iomem)
|
||||
goto fail;
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
r = request_mem_region(r->start, ATMEL_TC_IOMEM_SIZE, name);
|
||||
if (!r)
|
||||
goto fail;
|
||||
|
||||
tc->regs = ioremap(r->start, ATMEL_TC_IOMEM_SIZE);
|
||||
if (!tc->regs)
|
||||
goto fail_ioremap;
|
||||
|
||||
tc->iomem = r;
|
||||
|
||||
out:
|
||||
spin_unlock(&tc_list_lock);
|
||||
return tc;
|
||||
|
||||
fail_ioremap:
|
||||
release_resource(r);
|
||||
fail:
|
||||
tc = NULL;
|
||||
goto out;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(atmel_tc_alloc);
|
||||
|
||||
/**
|
||||
* atmel_tc_free - release a specified TC block
|
||||
* @tc: Timer/counter block that was returned by atmel_tc_alloc()
|
||||
*
|
||||
* This reverses the effect of atmel_tc_alloc(), unmapping the I/O
|
||||
* registers, invalidating the resource returned by that routine and
|
||||
* making the TC available to other drivers.
|
||||
*/
|
||||
void atmel_tc_free(struct atmel_tc *tc)
|
||||
{
|
||||
spin_lock(&tc_list_lock);
|
||||
if (tc->regs) {
|
||||
iounmap(tc->regs);
|
||||
release_resource(tc->iomem);
|
||||
tc->regs = NULL;
|
||||
tc->iomem = NULL;
|
||||
}
|
||||
spin_unlock(&tc_list_lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(atmel_tc_free);
|
||||
|
||||
static int __init tc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct atmel_tc *tc;
|
||||
struct clk *clk;
|
||||
int irq;
|
||||
|
||||
if (!platform_get_resource(pdev, IORESOURCE_MEM, 0))
|
||||
return -EINVAL;
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0)
|
||||
return -EINVAL;
|
||||
|
||||
tc = kzalloc(sizeof(struct atmel_tc), GFP_KERNEL);
|
||||
if (!tc)
|
||||
return -ENOMEM;
|
||||
|
||||
tc->pdev = pdev;
|
||||
|
||||
clk = clk_get(&pdev->dev, "t0_clk");
|
||||
if (IS_ERR(clk)) {
|
||||
kfree(tc);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tc->clk[0] = clk;
|
||||
tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
|
||||
if (IS_ERR(tc->clk[1]))
|
||||
tc->clk[1] = clk;
|
||||
tc->clk[2] = clk_get(&pdev->dev, "t2_clk");
|
||||
if (IS_ERR(tc->clk[2]))
|
||||
tc->clk[2] = clk;
|
||||
|
||||
tc->irq[0] = irq;
|
||||
tc->irq[1] = platform_get_irq(pdev, 1);
|
||||
if (tc->irq[1] < 0)
|
||||
tc->irq[1] = irq;
|
||||
tc->irq[2] = platform_get_irq(pdev, 2);
|
||||
if (tc->irq[2] < 0)
|
||||
tc->irq[2] = irq;
|
||||
|
||||
spin_lock(&tc_list_lock);
|
||||
list_add_tail(&tc->node, &tc_list);
|
||||
spin_unlock(&tc_list_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver tc_driver = {
|
||||
.driver.name = "atmel_tcb",
|
||||
};
|
||||
|
||||
static int __init tc_init(void)
|
||||
{
|
||||
return platform_driver_probe(&tc_driver, tc_probe);
|
||||
}
|
||||
arch_initcall(tc_init);
|
||||
File diff suppressed because it is too large
Load Diff
+127
-75
@@ -31,7 +31,6 @@
|
||||
static LIST_HEAD(container_list);
|
||||
static DEFINE_MUTEX(container_list_lock);
|
||||
static struct class enclosure_class;
|
||||
static struct class enclosure_component_class;
|
||||
|
||||
/**
|
||||
* enclosure_find - find an enclosure given a device
|
||||
@@ -40,16 +39,16 @@ static struct class enclosure_component_class;
|
||||
* Looks through the list of registered enclosures to see
|
||||
* if it can find a match for a device. Returns NULL if no
|
||||
* enclosure is found. Obtains a reference to the enclosure class
|
||||
* device which must be released with class_device_put().
|
||||
* device which must be released with device_put().
|
||||
*/
|
||||
struct enclosure_device *enclosure_find(struct device *dev)
|
||||
{
|
||||
struct enclosure_device *edev = NULL;
|
||||
struct enclosure_device *edev;
|
||||
|
||||
mutex_lock(&container_list_lock);
|
||||
list_for_each_entry(edev, &container_list, node) {
|
||||
if (edev->cdev.dev == dev) {
|
||||
class_device_get(&edev->cdev);
|
||||
if (edev->edev.parent == dev) {
|
||||
get_device(&edev->edev);
|
||||
mutex_unlock(&container_list_lock);
|
||||
return edev;
|
||||
}
|
||||
@@ -117,11 +116,11 @@ enclosure_register(struct device *dev, const char *name, int components,
|
||||
|
||||
edev->components = components;
|
||||
|
||||
edev->cdev.class = &enclosure_class;
|
||||
edev->cdev.dev = get_device(dev);
|
||||
edev->edev.class = &enclosure_class;
|
||||
edev->edev.parent = get_device(dev);
|
||||
edev->cb = cb;
|
||||
snprintf(edev->cdev.class_id, BUS_ID_SIZE, "%s", name);
|
||||
err = class_device_register(&edev->cdev);
|
||||
snprintf(edev->edev.bus_id, BUS_ID_SIZE, "%s", name);
|
||||
err = device_register(&edev->edev);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
@@ -135,7 +134,7 @@ enclosure_register(struct device *dev, const char *name, int components,
|
||||
return edev;
|
||||
|
||||
err:
|
||||
put_device(edev->cdev.dev);
|
||||
put_device(edev->edev.parent);
|
||||
kfree(edev);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -158,29 +157,69 @@ void enclosure_unregister(struct enclosure_device *edev)
|
||||
|
||||
for (i = 0; i < edev->components; i++)
|
||||
if (edev->component[i].number != -1)
|
||||
class_device_unregister(&edev->component[i].cdev);
|
||||
device_unregister(&edev->component[i].cdev);
|
||||
|
||||
/* prevent any callbacks into service user */
|
||||
edev->cb = &enclosure_null_callbacks;
|
||||
class_device_unregister(&edev->cdev);
|
||||
device_unregister(&edev->edev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_unregister);
|
||||
|
||||
static void enclosure_release(struct class_device *cdev)
|
||||
#define ENCLOSURE_NAME_SIZE 64
|
||||
|
||||
static void enclosure_link_name(struct enclosure_component *cdev, char *name)
|
||||
{
|
||||
strcpy(name, "enclosure_device:");
|
||||
strcat(name, cdev->cdev.bus_id);
|
||||
}
|
||||
|
||||
static void enclosure_remove_links(struct enclosure_component *cdev)
|
||||
{
|
||||
char name[ENCLOSURE_NAME_SIZE];
|
||||
|
||||
enclosure_link_name(cdev, name);
|
||||
sysfs_remove_link(&cdev->dev->kobj, name);
|
||||
sysfs_remove_link(&cdev->cdev.kobj, "device");
|
||||
}
|
||||
|
||||
static int enclosure_add_links(struct enclosure_component *cdev)
|
||||
{
|
||||
int error;
|
||||
char name[ENCLOSURE_NAME_SIZE];
|
||||
|
||||
error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device");
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
enclosure_link_name(cdev, name);
|
||||
error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name);
|
||||
if (error)
|
||||
sysfs_remove_link(&cdev->cdev.kobj, "device");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void enclosure_release(struct device *cdev)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev);
|
||||
|
||||
put_device(cdev->dev);
|
||||
put_device(cdev->parent);
|
||||
kfree(edev);
|
||||
}
|
||||
|
||||
static void enclosure_component_release(struct class_device *cdev)
|
||||
static void enclosure_component_release(struct device *dev)
|
||||
{
|
||||
if (cdev->dev)
|
||||
struct enclosure_component *cdev = to_enclosure_component(dev);
|
||||
|
||||
if (cdev->dev) {
|
||||
enclosure_remove_links(cdev);
|
||||
put_device(cdev->dev);
|
||||
class_device_put(cdev->parent);
|
||||
}
|
||||
put_device(dev->parent);
|
||||
}
|
||||
|
||||
static struct attribute_group *enclosure_groups[];
|
||||
|
||||
/**
|
||||
* enclosure_component_register - add a particular component to an enclosure
|
||||
* @edev: the enclosure to add the component
|
||||
@@ -201,7 +240,7 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
const char *name)
|
||||
{
|
||||
struct enclosure_component *ecomp;
|
||||
struct class_device *cdev;
|
||||
struct device *cdev;
|
||||
int err;
|
||||
|
||||
if (number >= edev->components)
|
||||
@@ -215,14 +254,16 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
ecomp->type = type;
|
||||
ecomp->number = number;
|
||||
cdev = &ecomp->cdev;
|
||||
cdev->parent = class_device_get(&edev->cdev);
|
||||
cdev->class = &enclosure_component_class;
|
||||
cdev->parent = get_device(&edev->edev);
|
||||
if (name)
|
||||
snprintf(cdev->class_id, BUS_ID_SIZE, "%s", name);
|
||||
snprintf(cdev->bus_id, BUS_ID_SIZE, "%s", name);
|
||||
else
|
||||
snprintf(cdev->class_id, BUS_ID_SIZE, "%u", number);
|
||||
snprintf(cdev->bus_id, BUS_ID_SIZE, "%u", number);
|
||||
|
||||
err = class_device_register(cdev);
|
||||
cdev->release = enclosure_component_release;
|
||||
cdev->groups = enclosure_groups;
|
||||
|
||||
err = device_register(cdev);
|
||||
if (err)
|
||||
ERR_PTR(err);
|
||||
|
||||
@@ -247,18 +288,19 @@ EXPORT_SYMBOL_GPL(enclosure_component_register);
|
||||
int enclosure_add_device(struct enclosure_device *edev, int component,
|
||||
struct device *dev)
|
||||
{
|
||||
struct class_device *cdev;
|
||||
struct enclosure_component *cdev;
|
||||
|
||||
if (!edev || component >= edev->components)
|
||||
return -EINVAL;
|
||||
|
||||
cdev = &edev->component[component].cdev;
|
||||
cdev = &edev->component[component];
|
||||
|
||||
class_device_del(cdev);
|
||||
if (cdev->dev)
|
||||
put_device(cdev->dev);
|
||||
enclosure_remove_links(cdev);
|
||||
|
||||
put_device(cdev->dev);
|
||||
cdev->dev = get_device(dev);
|
||||
return class_device_add(cdev);
|
||||
return enclosure_add_links(cdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_add_device);
|
||||
|
||||
@@ -272,18 +314,17 @@ EXPORT_SYMBOL_GPL(enclosure_add_device);
|
||||
*/
|
||||
int enclosure_remove_device(struct enclosure_device *edev, int component)
|
||||
{
|
||||
struct class_device *cdev;
|
||||
struct enclosure_component *cdev;
|
||||
|
||||
if (!edev || component >= edev->components)
|
||||
return -EINVAL;
|
||||
|
||||
cdev = &edev->component[component].cdev;
|
||||
cdev = &edev->component[component];
|
||||
|
||||
class_device_del(cdev);
|
||||
if (cdev->dev)
|
||||
put_device(cdev->dev);
|
||||
device_del(&cdev->cdev);
|
||||
put_device(cdev->dev);
|
||||
cdev->dev = NULL;
|
||||
return class_device_add(cdev);
|
||||
return device_add(&cdev->cdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
||||
|
||||
@@ -291,14 +332,16 @@ EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
||||
* sysfs pieces below
|
||||
*/
|
||||
|
||||
static ssize_t enclosure_show_components(struct class_device *cdev, char *buf)
|
||||
static ssize_t enclosure_show_components(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev);
|
||||
|
||||
return snprintf(buf, 40, "%d\n", edev->components);
|
||||
}
|
||||
|
||||
static struct class_device_attribute enclosure_attrs[] = {
|
||||
static struct device_attribute enclosure_attrs[] = {
|
||||
__ATTR(components, S_IRUGO, enclosure_show_components, NULL),
|
||||
__ATTR_NULL
|
||||
};
|
||||
@@ -306,8 +349,8 @@ static struct class_device_attribute enclosure_attrs[] = {
|
||||
static struct class enclosure_class = {
|
||||
.name = "enclosure",
|
||||
.owner = THIS_MODULE,
|
||||
.release = enclosure_release,
|
||||
.class_dev_attrs = enclosure_attrs,
|
||||
.dev_release = enclosure_release,
|
||||
.dev_attrs = enclosure_attrs,
|
||||
};
|
||||
|
||||
static const char *const enclosure_status [] = {
|
||||
@@ -326,7 +369,8 @@ static const char *const enclosure_type [] = {
|
||||
[ENCLOSURE_COMPONENT_ARRAY_DEVICE] = "array device",
|
||||
};
|
||||
|
||||
static ssize_t get_component_fault(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_fault(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -336,8 +380,9 @@ static ssize_t get_component_fault(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->fault);
|
||||
}
|
||||
|
||||
static ssize_t set_component_fault(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_fault(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -348,7 +393,8 @@ static ssize_t set_component_fault(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_status(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_status(struct device *cdev,
|
||||
struct device_attribute *attr,char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -358,8 +404,9 @@ static ssize_t get_component_status(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%s\n", enclosure_status[ecomp->status]);
|
||||
}
|
||||
|
||||
static ssize_t set_component_status(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_status(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -380,7 +427,8 @@ static ssize_t set_component_status(struct class_device *cdev, const char *buf,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static ssize_t get_component_active(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_active(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -390,8 +438,9 @@ static ssize_t get_component_active(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->active);
|
||||
}
|
||||
|
||||
static ssize_t set_component_active(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_active(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -402,7 +451,8 @@ static ssize_t set_component_active(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_locate(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_locate(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -412,8 +462,9 @@ static ssize_t get_component_locate(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->locate);
|
||||
}
|
||||
|
||||
static ssize_t set_component_locate(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_locate(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -424,7 +475,8 @@ static ssize_t set_component_locate(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_type(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_type(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
|
||||
@@ -432,24 +484,32 @@ static ssize_t get_component_type(struct class_device *cdev, char *buf)
|
||||
}
|
||||
|
||||
|
||||
static struct class_device_attribute enclosure_component_attrs[] = {
|
||||
__ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault,
|
||||
set_component_fault),
|
||||
__ATTR(status, S_IRUGO | S_IWUSR, get_component_status,
|
||||
set_component_status),
|
||||
__ATTR(active, S_IRUGO | S_IWUSR, get_component_active,
|
||||
set_component_active),
|
||||
__ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate,
|
||||
set_component_locate),
|
||||
__ATTR(type, S_IRUGO, get_component_type, NULL),
|
||||
__ATTR_NULL
|
||||
static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault,
|
||||
set_component_fault);
|
||||
static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status,
|
||||
set_component_status);
|
||||
static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active,
|
||||
set_component_active);
|
||||
static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate,
|
||||
set_component_locate);
|
||||
static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL);
|
||||
|
||||
static struct attribute *enclosure_component_attrs[] = {
|
||||
&dev_attr_fault.attr,
|
||||
&dev_attr_status.attr,
|
||||
&dev_attr_active.attr,
|
||||
&dev_attr_locate.attr,
|
||||
&dev_attr_type.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct class enclosure_component_class = {
|
||||
.name = "enclosure_component",
|
||||
.owner = THIS_MODULE,
|
||||
.class_dev_attrs = enclosure_component_attrs,
|
||||
.release = enclosure_component_release,
|
||||
static struct attribute_group enclosure_group = {
|
||||
.attrs = enclosure_component_attrs,
|
||||
};
|
||||
|
||||
static struct attribute_group *enclosure_groups[] = {
|
||||
&enclosure_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int __init enclosure_init(void)
|
||||
@@ -459,20 +519,12 @@ static int __init enclosure_init(void)
|
||||
err = class_register(&enclosure_class);
|
||||
if (err)
|
||||
return err;
|
||||
err = class_register(&enclosure_component_class);
|
||||
if (err)
|
||||
goto err_out;
|
||||
|
||||
return 0;
|
||||
err_out:
|
||||
class_unregister(&enclosure_class);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit enclosure_exit(void)
|
||||
{
|
||||
class_unregister(&enclosure_component_class);
|
||||
class_unregister(&enclosure_class);
|
||||
}
|
||||
|
||||
|
||||
+10
-20
@@ -175,28 +175,18 @@ static int intel_menlow_memory_add(struct acpi_device *device)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (cdev) {
|
||||
acpi_driver_data(device) = cdev;
|
||||
result = sysfs_create_link(&device->dev.kobj,
|
||||
&cdev->device.kobj, "thermal_cooling");
|
||||
if (result)
|
||||
goto unregister;
|
||||
|
||||
result = sysfs_create_link(&cdev->device.kobj,
|
||||
&device->dev.kobj, "device");
|
||||
if (result) {
|
||||
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
|
||||
goto unregister;
|
||||
}
|
||||
}
|
||||
acpi_driver_data(device) = cdev;
|
||||
result = sysfs_create_link(&device->dev.kobj,
|
||||
&cdev->device.kobj, "thermal_cooling");
|
||||
if (result)
|
||||
printk(KERN_ERR PREFIX "Create sysfs link\n");
|
||||
result = sysfs_create_link(&cdev->device.kobj,
|
||||
&device->dev.kobj, "device");
|
||||
if (result)
|
||||
printk(KERN_ERR PREFIX "Create sysfs link\n");
|
||||
|
||||
end:
|
||||
return result;
|
||||
|
||||
unregister:
|
||||
thermal_cooling_device_unregister(cdev);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
static int intel_menlow_memory_remove(struct acpi_device *device, int type)
|
||||
@@ -213,7 +203,7 @@ static int intel_menlow_memory_remove(struct acpi_device *device, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const static struct acpi_device_id intel_menlow_memory_ids[] = {
|
||||
static const struct acpi_device_id intel_menlow_memory_ids[] = {
|
||||
{"INT0002", 0},
|
||||
{"", 0},
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Makefile for SGI's XP devices.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_SGI_XP) += xp.o
|
||||
xp-y := xp_main.o xp_nofault.o
|
||||
|
||||
obj-$(CONFIG_SGI_XP) += xpc.o
|
||||
xpc-y := xpc_main.o xpc_channel.o xpc_partition.o
|
||||
|
||||
obj-$(CONFIG_SGI_XP) += xpnet.o
|
||||
@@ -0,0 +1,463 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* External Cross Partition (XP) structures and defines.
|
||||
*/
|
||||
|
||||
#ifndef _DRIVERS_MISC_SGIXP_XP_H
|
||||
#define _DRIVERS_MISC_SGIXP_XP_H
|
||||
|
||||
#include <linux/cache.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <asm/sn/types.h>
|
||||
#include <asm/sn/bte.h>
|
||||
|
||||
#ifdef USE_DBUG_ON
|
||||
#define DBUG_ON(condition) BUG_ON(condition)
|
||||
#else
|
||||
#define DBUG_ON(condition)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the maximum number of logically defined partitions the system
|
||||
* can support. It is constrained by the maximum number of hardware
|
||||
* partitionable regions. The term 'region' in this context refers to the
|
||||
* minimum number of nodes that can comprise an access protection grouping.
|
||||
* The access protection is in regards to memory, IPI and IOI.
|
||||
*
|
||||
* The maximum number of hardware partitionable regions is equal to the
|
||||
* maximum number of nodes in the entire system divided by the minimum number
|
||||
* of nodes that comprise an access protection grouping.
|
||||
*/
|
||||
#define XP_MAX_PARTITIONS 64
|
||||
|
||||
/*
|
||||
* Define the number of u64s required to represent all the C-brick nasids
|
||||
* as a bitmap. The cross-partition kernel modules deal only with
|
||||
* C-brick nasids, thus the need for bitmaps which don't account for
|
||||
* odd-numbered (non C-brick) nasids.
|
||||
*/
|
||||
#define XP_MAX_PHYSNODE_ID (MAX_NUMALINK_NODES / 2)
|
||||
#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8)
|
||||
#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64)
|
||||
|
||||
/*
|
||||
* Wrapper for bte_copy() that should it return a failure status will retry
|
||||
* the bte_copy() once in the hope that the failure was due to a temporary
|
||||
* aberration (i.e., the link going down temporarily).
|
||||
*
|
||||
* src - physical address of the source of the transfer.
|
||||
* vdst - virtual address of the destination of the transfer.
|
||||
* len - number of bytes to transfer from source to destination.
|
||||
* mode - see bte_copy() for definition.
|
||||
* notification - see bte_copy() for definition.
|
||||
*
|
||||
* Note: xp_bte_copy() should never be called while holding a spinlock.
|
||||
*/
|
||||
static inline bte_result_t
|
||||
xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
|
||||
{
|
||||
bte_result_t ret;
|
||||
u64 pdst = ia64_tpa(vdst);
|
||||
|
||||
/*
|
||||
* Ensure that the physically mapped memory is contiguous.
|
||||
*
|
||||
* We do this by ensuring that the memory is from region 7 only.
|
||||
* If the need should arise to use memory from one of the other
|
||||
* regions, then modify the BUG_ON() statement to ensure that the
|
||||
* memory from that region is always physically contiguous.
|
||||
*/
|
||||
BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
|
||||
|
||||
ret = bte_copy(src, pdst, len, mode, notification);
|
||||
if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
|
||||
if (!in_interrupt())
|
||||
cond_resched();
|
||||
|
||||
ret = bte_copy(src, pdst, len, mode, notification);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPC establishes channel connections between the local partition and any
|
||||
* other partition that is currently up. Over these channels, kernel-level
|
||||
* `users' can communicate with their counterparts on the other partitions.
|
||||
*
|
||||
* The maxinum number of channels is limited to eight. For performance reasons,
|
||||
* the internal cross partition structures require sixteen bytes per channel,
|
||||
* and eight allows all of this interface-shared info to fit in one cache line.
|
||||
*
|
||||
* XPC_NCHANNELS reflects the total number of channels currently defined.
|
||||
* If the need for additional channels arises, one can simply increase
|
||||
* XPC_NCHANNELS accordingly. If the day should come where that number
|
||||
* exceeds the MAXIMUM number of channels allowed (eight), then one will need
|
||||
* to make changes to the XPC code to allow for this.
|
||||
*/
|
||||
#define XPC_MEM_CHANNEL 0 /* memory channel number */
|
||||
#define XPC_NET_CHANNEL 1 /* network channel number */
|
||||
|
||||
#define XPC_NCHANNELS 2 /* #of defined channels */
|
||||
#define XPC_MAX_NCHANNELS 8 /* max #of channels allowed */
|
||||
|
||||
#if XPC_NCHANNELS > XPC_MAX_NCHANNELS
|
||||
#error XPC_NCHANNELS exceeds MAXIMUM allowed.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The format of an XPC message is as follows:
|
||||
*
|
||||
* +-------+--------------------------------+
|
||||
* | flags |////////////////////////////////|
|
||||
* +-------+--------------------------------+
|
||||
* | message # |
|
||||
* +----------------------------------------+
|
||||
* | payload (user-defined message) |
|
||||
* | |
|
||||
* :
|
||||
* | |
|
||||
* +----------------------------------------+
|
||||
*
|
||||
* The size of the payload is defined by the user via xpc_connect(). A user-
|
||||
* defined message resides in the payload area.
|
||||
*
|
||||
* The user should have no dealings with the message header, but only the
|
||||
* message's payload. When a message entry is allocated (via xpc_allocate())
|
||||
* a pointer to the payload area is returned and not the actual beginning of
|
||||
* the XPC message. The user then constructs a message in the payload area
|
||||
* and passes that pointer as an argument on xpc_send() or xpc_send_notify().
|
||||
*
|
||||
* The size of a message entry (within a message queue) must be a cacheline
|
||||
* sized multiple in order to facilitate the BTE transfer of messages from one
|
||||
* message queue to another. A macro, XPC_MSG_SIZE(), is provided for the user
|
||||
* that wants to fit as many msg entries as possible in a given memory size
|
||||
* (e.g. a memory page).
|
||||
*/
|
||||
struct xpc_msg {
|
||||
u8 flags; /* FOR XPC INTERNAL USE ONLY */
|
||||
u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */
|
||||
s64 number; /* FOR XPC INTERNAL USE ONLY */
|
||||
|
||||
u64 payload; /* user defined portion of message */
|
||||
};
|
||||
|
||||
#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)
|
||||
#define XPC_MSG_SIZE(_payload_size) \
|
||||
L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))
|
||||
|
||||
/*
|
||||
* Define the return values and values passed to user's callout functions.
|
||||
* (It is important to add new value codes at the end just preceding
|
||||
* xpcUnknownReason, which must have the highest numerical value.)
|
||||
*/
|
||||
enum xpc_retval {
|
||||
xpcSuccess = 0,
|
||||
|
||||
xpcNotConnected, /* 1: channel is not connected */
|
||||
xpcConnected, /* 2: channel connected (opened) */
|
||||
xpcRETIRED1, /* 3: (formerly xpcDisconnected) */
|
||||
|
||||
xpcMsgReceived, /* 4: message received */
|
||||
xpcMsgDelivered, /* 5: message delivered and acknowledged */
|
||||
|
||||
xpcRETIRED2, /* 6: (formerly xpcTransferFailed) */
|
||||
|
||||
xpcNoWait, /* 7: operation would require wait */
|
||||
xpcRetry, /* 8: retry operation */
|
||||
xpcTimeout, /* 9: timeout in xpc_allocate_msg_wait() */
|
||||
xpcInterrupted, /* 10: interrupted wait */
|
||||
|
||||
xpcUnequalMsgSizes, /* 11: message size disparity between sides */
|
||||
xpcInvalidAddress, /* 12: invalid address */
|
||||
|
||||
xpcNoMemory, /* 13: no memory available for XPC structures */
|
||||
xpcLackOfResources, /* 14: insufficient resources for operation */
|
||||
xpcUnregistered, /* 15: channel is not registered */
|
||||
xpcAlreadyRegistered, /* 16: channel is already registered */
|
||||
|
||||
xpcPartitionDown, /* 17: remote partition is down */
|
||||
xpcNotLoaded, /* 18: XPC module is not loaded */
|
||||
xpcUnloading, /* 19: this side is unloading XPC module */
|
||||
|
||||
xpcBadMagic, /* 20: XPC MAGIC string not found */
|
||||
|
||||
xpcReactivating, /* 21: remote partition was reactivated */
|
||||
|
||||
xpcUnregistering, /* 22: this side is unregistering channel */
|
||||
xpcOtherUnregistering, /* 23: other side is unregistering channel */
|
||||
|
||||
xpcCloneKThread, /* 24: cloning kernel thread */
|
||||
xpcCloneKThreadFailed, /* 25: cloning kernel thread failed */
|
||||
|
||||
xpcNoHeartbeat, /* 26: remote partition has no heartbeat */
|
||||
|
||||
xpcPioReadError, /* 27: PIO read error */
|
||||
xpcPhysAddrRegFailed, /* 28: registration of phys addr range failed */
|
||||
|
||||
xpcBteDirectoryError, /* 29: maps to BTEFAIL_DIR */
|
||||
xpcBtePoisonError, /* 30: maps to BTEFAIL_POISON */
|
||||
xpcBteWriteError, /* 31: maps to BTEFAIL_WERR */
|
||||
xpcBteAccessError, /* 32: maps to BTEFAIL_ACCESS */
|
||||
xpcBtePWriteError, /* 33: maps to BTEFAIL_PWERR */
|
||||
xpcBtePReadError, /* 34: maps to BTEFAIL_PRERR */
|
||||
xpcBteTimeOutError, /* 35: maps to BTEFAIL_TOUT */
|
||||
xpcBteXtalkError, /* 36: maps to BTEFAIL_XTERR */
|
||||
xpcBteNotAvailable, /* 37: maps to BTEFAIL_NOTAVAIL */
|
||||
xpcBteUnmappedError, /* 38: unmapped BTEFAIL_ error */
|
||||
|
||||
xpcBadVersion, /* 39: bad version number */
|
||||
xpcVarsNotSet, /* 40: the XPC variables are not set up */
|
||||
xpcNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */
|
||||
xpcInvalidPartid, /* 42: invalid partition ID */
|
||||
xpcLocalPartid, /* 43: local partition ID */
|
||||
|
||||
xpcOtherGoingDown, /* 44: other side going down, reason unknown */
|
||||
xpcSystemGoingDown, /* 45: system is going down, reason unknown */
|
||||
xpcSystemHalt, /* 46: system is being halted */
|
||||
xpcSystemReboot, /* 47: system is being rebooted */
|
||||
xpcSystemPoweroff, /* 48: system is being powered off */
|
||||
|
||||
xpcDisconnecting, /* 49: channel disconnecting (closing) */
|
||||
|
||||
xpcOpenCloseError, /* 50: channel open/close protocol error */
|
||||
|
||||
xpcDisconnected, /* 51: channel disconnected (closed) */
|
||||
|
||||
xpcBteSh2Start, /* 52: BTE CRB timeout */
|
||||
|
||||
/* 53: 0x1 BTE Error Response Short */
|
||||
xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT,
|
||||
|
||||
/* 54: 0x2 BTE Error Response Long */
|
||||
xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG,
|
||||
|
||||
/* 56: 0x4 BTE Error Response DSB */
|
||||
xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP,
|
||||
|
||||
/* 60: 0x8 BTE Error Response Access */
|
||||
xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS,
|
||||
|
||||
/* 68: 0x10 BTE Error CRB timeout */
|
||||
xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO,
|
||||
|
||||
/* 84: 0x20 BTE Error NACK limit */
|
||||
xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT,
|
||||
|
||||
/* 115: BTE end */
|
||||
xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
|
||||
|
||||
xpcUnknownReason /* 116: unknown reason - must be last in enum */
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the callout function types used by XPC to update the user on
|
||||
* connection activity and state changes (via the user function registered by
|
||||
* xpc_connect()) and to notify them of messages received and delivered (via
|
||||
* the user function registered by xpc_send_notify()).
|
||||
*
|
||||
* The two function types are xpc_channel_func and xpc_notify_func and
|
||||
* both share the following arguments, with the exception of "data", which
|
||||
* only xpc_channel_func has.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* reason - reason code. (See following table.)
|
||||
* partid - partition ID associated with condition.
|
||||
* ch_number - channel # associated with condition.
|
||||
* data - pointer to optional data. (See following table.)
|
||||
* key - pointer to optional user-defined value provided as the "key"
|
||||
* argument to xpc_connect() or xpc_send_notify().
|
||||
*
|
||||
* In the following table the "Optional Data" column applies to callouts made
|
||||
* to functions registered by xpc_connect(). A "NA" in that column indicates
|
||||
* that this reason code can be passed to functions registered by
|
||||
* xpc_send_notify() (i.e. they don't have data arguments).
|
||||
*
|
||||
* Also, the first three reason codes in the following table indicate
|
||||
* success, whereas the others indicate failure. When a failure reason code
|
||||
* is received, one can assume that the channel is not connected.
|
||||
*
|
||||
*
|
||||
* Reason Code | Cause | Optional Data
|
||||
* =====================+================================+=====================
|
||||
* xpcConnected | connection has been established| max #of entries
|
||||
* | to the specified partition on | allowed in message
|
||||
* | the specified channel | queue
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcMsgReceived | an XPC message arrived from | address of payload
|
||||
* | the specified partition on the |
|
||||
* | specified channel | [the user must call
|
||||
* | | xpc_received() when
|
||||
* | | finished with the
|
||||
* | | payload]
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcMsgDelivered | notification that the message | NA
|
||||
* | was delivered to the intended |
|
||||
* | recipient and that they have |
|
||||
* | acknowledged its receipt by |
|
||||
* | calling xpc_received() |
|
||||
* =====================+================================+=====================
|
||||
* xpcUnequalMsgSizes | can't connect to the specified | NULL
|
||||
* | partition on the specified |
|
||||
* | channel because of mismatched |
|
||||
* | message sizes |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcNoMemory | insufficient memory avaiable | NULL
|
||||
* | to allocate message queue |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcLackOfResources | lack of resources to create | NULL
|
||||
* | the necessary kthreads to |
|
||||
* | support the channel |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcUnregistering | this side's user has | NULL or NA
|
||||
* | unregistered by calling |
|
||||
* | xpc_disconnect() |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcOtherUnregistering| the other side's user has | NULL or NA
|
||||
* | unregistered by calling |
|
||||
* | xpc_disconnect() |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcNoHeartbeat | the other side's XPC is no | NULL or NA
|
||||
* | longer heartbeating |
|
||||
* | |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcUnloading | this side's XPC module is | NULL or NA
|
||||
* | being unloaded |
|
||||
* | |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcOtherUnloading | the other side's XPC module is | NULL or NA
|
||||
* | is being unloaded |
|
||||
* | |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcPioReadError | xp_nofault_PIOR() returned an | NULL or NA
|
||||
* | error while sending an IPI |
|
||||
* | |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcInvalidAddress | the address either received or | NULL or NA
|
||||
* | sent by the specified partition|
|
||||
* | is invalid |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcBteNotAvailable | attempt to pull data from the | NULL or NA
|
||||
* xpcBtePoisonError | specified partition over the |
|
||||
* xpcBteWriteError | specified channel via a |
|
||||
* xpcBteAccessError | bte_copy() failed |
|
||||
* xpcBteTimeOutError | |
|
||||
* xpcBteXtalkError | |
|
||||
* xpcBteDirectoryError | |
|
||||
* xpcBteGenericError | |
|
||||
* xpcBteUnmappedError | |
|
||||
* ---------------------+--------------------------------+---------------------
|
||||
* xpcUnknownReason | the specified channel to the | NULL or NA
|
||||
* | specified partition was |
|
||||
* | unavailable for unknown reasons|
|
||||
* =====================+================================+=====================
|
||||
*/
|
||||
|
||||
typedef void (*xpc_channel_func) (enum xpc_retval reason, partid_t partid,
|
||||
int ch_number, void *data, void *key);
|
||||
|
||||
typedef void (*xpc_notify_func) (enum xpc_retval reason, partid_t partid,
|
||||
int ch_number, void *key);
|
||||
|
||||
/*
|
||||
* The following is a registration entry. There is a global array of these,
|
||||
* one per channel. It is used to record the connection registration made
|
||||
* by the users of XPC. As long as a registration entry exists, for any
|
||||
* partition that comes up, XPC will attempt to establish a connection on
|
||||
* that channel. Notification that a connection has been made will occur via
|
||||
* the xpc_channel_func function.
|
||||
*
|
||||
* The 'func' field points to the function to call when aynchronous
|
||||
* notification is required for such events as: a connection established/lost,
|
||||
* or an incoming message received, or an error condition encountered. A
|
||||
* non-NULL 'func' field indicates that there is an active registration for
|
||||
* the channel.
|
||||
*/
|
||||
struct xpc_registration {
|
||||
struct mutex mutex;
|
||||
xpc_channel_func func; /* function to call */
|
||||
void *key; /* pointer to user's key */
|
||||
u16 nentries; /* #of msg entries in local msg queue */
|
||||
u16 msg_size; /* message queue's message size */
|
||||
u32 assigned_limit; /* limit on #of assigned kthreads */
|
||||
u32 idle_limit; /* limit on #of idle kthreads */
|
||||
} ____cacheline_aligned;
|
||||
|
||||
#define XPC_CHANNEL_REGISTERED(_c) (xpc_registrations[_c].func != NULL)
|
||||
|
||||
/* the following are valid xpc_allocate() flags */
|
||||
#define XPC_WAIT 0 /* wait flag */
|
||||
#define XPC_NOWAIT 1 /* no wait flag */
|
||||
|
||||
struct xpc_interface {
|
||||
void (*connect) (int);
|
||||
void (*disconnect) (int);
|
||||
enum xpc_retval (*allocate) (partid_t, int, u32, void **);
|
||||
enum xpc_retval (*send) (partid_t, int, void *);
|
||||
enum xpc_retval (*send_notify) (partid_t, int, void *,
|
||||
xpc_notify_func, void *);
|
||||
void (*received) (partid_t, int, void *);
|
||||
enum xpc_retval (*partid_to_nasids) (partid_t, void *);
|
||||
};
|
||||
|
||||
extern struct xpc_interface xpc_interface;
|
||||
|
||||
extern void xpc_set_interface(void (*)(int),
|
||||
void (*)(int),
|
||||
enum xpc_retval (*)(partid_t, int, u32, void **),
|
||||
enum xpc_retval (*)(partid_t, int, void *),
|
||||
enum xpc_retval (*)(partid_t, int, void *,
|
||||
xpc_notify_func, void *),
|
||||
void (*)(partid_t, int, void *),
|
||||
enum xpc_retval (*)(partid_t, void *));
|
||||
extern void xpc_clear_interface(void);
|
||||
|
||||
extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16,
|
||||
u16, u32, u32);
|
||||
extern void xpc_disconnect(int);
|
||||
|
||||
static inline enum xpc_retval
|
||||
xpc_allocate(partid_t partid, int ch_number, u32 flags, void **payload)
|
||||
{
|
||||
return xpc_interface.allocate(partid, ch_number, flags, payload);
|
||||
}
|
||||
|
||||
static inline enum xpc_retval
|
||||
xpc_send(partid_t partid, int ch_number, void *payload)
|
||||
{
|
||||
return xpc_interface.send(partid, ch_number, payload);
|
||||
}
|
||||
|
||||
static inline enum xpc_retval
|
||||
xpc_send_notify(partid_t partid, int ch_number, void *payload,
|
||||
xpc_notify_func func, void *key)
|
||||
{
|
||||
return xpc_interface.send_notify(partid, ch_number, payload, func, key);
|
||||
}
|
||||
|
||||
static inline void
|
||||
xpc_received(partid_t partid, int ch_number, void *payload)
|
||||
{
|
||||
return xpc_interface.received(partid, ch_number, payload);
|
||||
}
|
||||
|
||||
static inline enum xpc_retval
|
||||
xpc_partid_to_nasids(partid_t partid, void *nasids)
|
||||
{
|
||||
return xpc_interface.partid_to_nasids(partid, nasids);
|
||||
}
|
||||
|
||||
extern u64 xp_nofault_PIOR_target;
|
||||
extern int xp_nofault_PIOR(void *);
|
||||
extern int xp_error_PIOR(void);
|
||||
|
||||
#endif /* _DRIVERS_MISC_SGIXP_XP_H */
|
||||
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Cross Partition (XP) base.
|
||||
*
|
||||
* XP provides a base from which its users can interact
|
||||
* with XPC, yet not be dependent on XPC.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <asm/sn/intr.h>
|
||||
#include <asm/sn/sn_sal.h>
|
||||
#include "xp.h"
|
||||
|
||||
/*
|
||||
* The export of xp_nofault_PIOR needs to happen here since it is defined
|
||||
* in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is
|
||||
* defined here.
|
||||
*/
|
||||
EXPORT_SYMBOL_GPL(xp_nofault_PIOR);
|
||||
|
||||
u64 xp_nofault_PIOR_target;
|
||||
EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target);
|
||||
|
||||
/*
|
||||
* xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
|
||||
* users of XPC.
|
||||
*/
|
||||
struct xpc_registration xpc_registrations[XPC_NCHANNELS];
|
||||
EXPORT_SYMBOL_GPL(xpc_registrations);
|
||||
|
||||
/*
|
||||
* Initialize the XPC interface to indicate that XPC isn't loaded.
|
||||
*/
|
||||
static enum xpc_retval
|
||||
xpc_notloaded(void)
|
||||
{
|
||||
return xpcNotLoaded;
|
||||
}
|
||||
|
||||
struct xpc_interface xpc_interface = {
|
||||
(void (*)(int))xpc_notloaded,
|
||||
(void (*)(int))xpc_notloaded,
|
||||
(enum xpc_retval(*)(partid_t, int, u32, void **))xpc_notloaded,
|
||||
(enum xpc_retval(*)(partid_t, int, void *))xpc_notloaded,
|
||||
(enum xpc_retval(*)(partid_t, int, void *, xpc_notify_func, void *))
|
||||
xpc_notloaded,
|
||||
(void (*)(partid_t, int, void *))xpc_notloaded,
|
||||
(enum xpc_retval(*)(partid_t, void *))xpc_notloaded
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(xpc_interface);
|
||||
|
||||
/*
|
||||
* XPC calls this when it (the XPC module) has been loaded.
|
||||
*/
|
||||
void
|
||||
xpc_set_interface(void (*connect) (int),
|
||||
void (*disconnect) (int),
|
||||
enum xpc_retval (*allocate) (partid_t, int, u32, void **),
|
||||
enum xpc_retval (*send) (partid_t, int, void *),
|
||||
enum xpc_retval (*send_notify) (partid_t, int, void *,
|
||||
xpc_notify_func, void *),
|
||||
void (*received) (partid_t, int, void *),
|
||||
enum xpc_retval (*partid_to_nasids) (partid_t, void *))
|
||||
{
|
||||
xpc_interface.connect = connect;
|
||||
xpc_interface.disconnect = disconnect;
|
||||
xpc_interface.allocate = allocate;
|
||||
xpc_interface.send = send;
|
||||
xpc_interface.send_notify = send_notify;
|
||||
xpc_interface.received = received;
|
||||
xpc_interface.partid_to_nasids = partid_to_nasids;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xpc_set_interface);
|
||||
|
||||
/*
|
||||
* XPC calls this when it (the XPC module) is being unloaded.
|
||||
*/
|
||||
void
|
||||
xpc_clear_interface(void)
|
||||
{
|
||||
xpc_interface.connect = (void (*)(int))xpc_notloaded;
|
||||
xpc_interface.disconnect = (void (*)(int))xpc_notloaded;
|
||||
xpc_interface.allocate = (enum xpc_retval(*)(partid_t, int, u32,
|
||||
void **))xpc_notloaded;
|
||||
xpc_interface.send = (enum xpc_retval(*)(partid_t, int, void *))
|
||||
xpc_notloaded;
|
||||
xpc_interface.send_notify = (enum xpc_retval(*)(partid_t, int, void *,
|
||||
xpc_notify_func,
|
||||
void *))xpc_notloaded;
|
||||
xpc_interface.received = (void (*)(partid_t, int, void *))
|
||||
xpc_notloaded;
|
||||
xpc_interface.partid_to_nasids = (enum xpc_retval(*)(partid_t, void *))
|
||||
xpc_notloaded;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xpc_clear_interface);
|
||||
|
||||
/*
|
||||
* Register for automatic establishment of a channel connection whenever
|
||||
* a partition comes up.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* ch_number - channel # to register for connection.
|
||||
* func - function to call for asynchronous notification of channel
|
||||
* state changes (i.e., connection, disconnection, error) and
|
||||
* the arrival of incoming messages.
|
||||
* key - pointer to optional user-defined value that gets passed back
|
||||
* to the user on any callouts made to func.
|
||||
* payload_size - size in bytes of the XPC message's payload area which
|
||||
* contains a user-defined message. The user should make
|
||||
* this large enough to hold their largest message.
|
||||
* nentries - max #of XPC message entries a message queue can contain.
|
||||
* The actual number, which is determined when a connection
|
||||
* is established and may be less then requested, will be
|
||||
* passed to the user via the xpcConnected callout.
|
||||
* assigned_limit - max number of kthreads allowed to be processing
|
||||
* messages (per connection) at any given instant.
|
||||
* idle_limit - max number of kthreads allowed to be idle at any given
|
||||
* instant.
|
||||
*/
|
||||
enum xpc_retval
|
||||
xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
|
||||
u16 nentries, u32 assigned_limit, u32 idle_limit)
|
||||
{
|
||||
struct xpc_registration *registration;
|
||||
|
||||
DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
|
||||
DBUG_ON(payload_size == 0 || nentries == 0);
|
||||
DBUG_ON(func == NULL);
|
||||
DBUG_ON(assigned_limit == 0 || idle_limit > assigned_limit);
|
||||
|
||||
registration = &xpc_registrations[ch_number];
|
||||
|
||||
if (mutex_lock_interruptible(®istration->mutex) != 0)
|
||||
return xpcInterrupted;
|
||||
|
||||
/* if XPC_CHANNEL_REGISTERED(ch_number) */
|
||||
if (registration->func != NULL) {
|
||||
mutex_unlock(®istration->mutex);
|
||||
return xpcAlreadyRegistered;
|
||||
}
|
||||
|
||||
/* register the channel for connection */
|
||||
registration->msg_size = XPC_MSG_SIZE(payload_size);
|
||||
registration->nentries = nentries;
|
||||
registration->assigned_limit = assigned_limit;
|
||||
registration->idle_limit = idle_limit;
|
||||
registration->key = key;
|
||||
registration->func = func;
|
||||
|
||||
mutex_unlock(®istration->mutex);
|
||||
|
||||
xpc_interface.connect(ch_number);
|
||||
|
||||
return xpcSuccess;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xpc_connect);
|
||||
|
||||
/*
|
||||
* Remove the registration for automatic connection of the specified channel
|
||||
* when a partition comes up.
|
||||
*
|
||||
* Before returning this xpc_disconnect() will wait for all connections on the
|
||||
* specified channel have been closed/torndown. So the caller can be assured
|
||||
* that they will not be receiving any more callouts from XPC to their
|
||||
* function registered via xpc_connect().
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* ch_number - channel # to unregister.
|
||||
*/
|
||||
void
|
||||
xpc_disconnect(int ch_number)
|
||||
{
|
||||
struct xpc_registration *registration;
|
||||
|
||||
DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
|
||||
|
||||
registration = &xpc_registrations[ch_number];
|
||||
|
||||
/*
|
||||
* We've decided not to make this a down_interruptible(), since we
|
||||
* figured XPC's users will just turn around and call xpc_disconnect()
|
||||
* again anyways, so we might as well wait, if need be.
|
||||
*/
|
||||
mutex_lock(®istration->mutex);
|
||||
|
||||
/* if !XPC_CHANNEL_REGISTERED(ch_number) */
|
||||
if (registration->func == NULL) {
|
||||
mutex_unlock(®istration->mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* remove the connection registration for the specified channel */
|
||||
registration->func = NULL;
|
||||
registration->key = NULL;
|
||||
registration->nentries = 0;
|
||||
registration->msg_size = 0;
|
||||
registration->assigned_limit = 0;
|
||||
registration->idle_limit = 0;
|
||||
|
||||
xpc_interface.disconnect(ch_number);
|
||||
|
||||
mutex_unlock(®istration->mutex);
|
||||
|
||||
return;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xpc_disconnect);
|
||||
|
||||
int __init
|
||||
xp_init(void)
|
||||
{
|
||||
int ret, ch_number;
|
||||
u64 func_addr = *(u64 *)xp_nofault_PIOR;
|
||||
u64 err_func_addr = *(u64 *)xp_error_PIOR;
|
||||
|
||||
if (!ia64_platform_is("sn2"))
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
* Register a nofault code region which performs a cross-partition
|
||||
* PIO read. If the PIO read times out, the MCA handler will consume
|
||||
* the error and return to a kernel-provided instruction to indicate
|
||||
* an error. This PIO read exists because it is guaranteed to timeout
|
||||
* if the destination is down (AMO operations do not timeout on at
|
||||
* least some CPUs on Shubs <= v1.2, which unfortunately we have to
|
||||
* work around).
|
||||
*/
|
||||
ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
|
||||
1, 1);
|
||||
if (ret != 0) {
|
||||
printk(KERN_ERR "XP: can't register nofault code, error=%d\n",
|
||||
ret);
|
||||
}
|
||||
/*
|
||||
* Setup the nofault PIO read target. (There is no special reason why
|
||||
* SH_IPI_ACCESS was selected.)
|
||||
*/
|
||||
if (is_shub2())
|
||||
xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
|
||||
else
|
||||
xp_nofault_PIOR_target = SH1_IPI_ACCESS;
|
||||
|
||||
/* initialize the connection registration mutex */
|
||||
for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++)
|
||||
mutex_init(&xpc_registrations[ch_number].mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(xp_init);
|
||||
|
||||
void __exit
|
||||
xp_exit(void)
|
||||
{
|
||||
u64 func_addr = *(u64 *)xp_nofault_PIOR;
|
||||
u64 err_func_addr = *(u64 *)xp_error_PIOR;
|
||||
|
||||
/* unregister the PIO read nofault code region */
|
||||
(void)sn_register_nofault_code(func_addr, err_func_addr,
|
||||
err_func_addr, 1, 0);
|
||||
}
|
||||
|
||||
module_exit(xp_exit);
|
||||
|
||||
MODULE_AUTHOR("Silicon Graphics, Inc.");
|
||||
MODULE_DESCRIPTION("Cross Partition (XP) base");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The xp_nofault_PIOR function takes a pointer to a remote PIO register
|
||||
* and attempts to load and consume a value from it. This function
|
||||
* will be registered as a nofault code block. In the event that the
|
||||
* PIO read fails, the MCA handler will force the error to look
|
||||
* corrected and vector to the xp_error_PIOR which will return an error.
|
||||
*
|
||||
* The definition of "consumption" and the time it takes for an MCA
|
||||
* to surface is processor implementation specific. This code
|
||||
* is sufficient on Itanium through the Montvale processor family.
|
||||
* It may need to be adjusted for future processor implementations.
|
||||
*
|
||||
* extern int xp_nofault_PIOR(void *remote_register);
|
||||
*/
|
||||
|
||||
.global xp_nofault_PIOR
|
||||
xp_nofault_PIOR:
|
||||
mov r8=r0 // Stage a success return value
|
||||
ld8.acq r9=[r32];; // PIO Read the specified register
|
||||
adds r9=1,r9;; // Add to force consumption
|
||||
srlz.i;; // Allow time for MCA to surface
|
||||
br.ret.sptk.many b0;; // Return success
|
||||
|
||||
.global xp_error_PIOR
|
||||
xp_error_PIOR:
|
||||
mov r8=1 // Return value of 1
|
||||
br.ret.sptk.many b0;; // Return failure
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+572
-193
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user