public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
@ 2004-09-09  1:21 ` Keshavamurthy Anil S
  2004-09-09  1:24 ` [PATCH 2/6]ACPI " Keshavamurthy Anil S
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:21 UTC (permalink / raw)
  To: Keshavamurthy, Anil S, LHNS list, ACPI Developer


This is the core acpi enhancements to support any ACPI 
based physical hotplug especially to support physical removal.
---
Name:acpi_core.patch
Status: Tested on 2.6.9-rc1-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends: None	
Version: applies on 2.6.9-rc1-mm2	

Description:
This patch provides core hotplug support in acpi by providing
acpi_bus_trim(), acpi_bus_remove() and acpi_pci_unbind()
which does exactly reverse of acpi_bus_scan(), acpi_bus_add()
and acpi_pci_bind(). 
---

 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/acpi_ksyms.c   |    3 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/bus.c          |    4 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/pci_bind.c     |   45 ++++++
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/pci_irq.c      |   42 +++++
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/scan.c         |  109 +++++++++++++--
 linux-2.6.9-rc1-mm2-askeshav/include/acpi/acpi_bus.h     |    9 +
 linux-2.6.9-rc1-mm2-askeshav/include/acpi/acpi_drivers.h |    2 
 7 files changed, 196 insertions(+), 18 deletions(-)

diff -puN include/acpi/acpi_bus.h~acpi_core include/acpi/acpi_bus.h
--- linux-2.6.9-rc1-mm2/include/acpi/acpi_bus.h~acpi_core	2004-09-08 16:42:13.443282044 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/acpi/acpi_bus.h	2004-09-08 16:42:13.561446105 -0700
@@ -104,6 +104,7 @@ typedef int (*acpi_op_suspend)	(struct a
 typedef int (*acpi_op_resume)	(struct acpi_device *device, int state);
 typedef int (*acpi_op_scan)	(struct acpi_device *device);
 typedef int (*acpi_op_bind)	(struct acpi_device *device);
+typedef int (*acpi_op_unbind)	(struct acpi_device *device);
 
 struct acpi_device_ops {
 	acpi_op_add		add;
@@ -115,6 +116,7 @@ struct acpi_device_ops {
 	acpi_op_resume		resume;
 	acpi_op_scan		scan;
 	acpi_op_bind		bind;
+	acpi_op_unbind		unbind;
 };
 
 struct acpi_driver {
@@ -313,7 +315,8 @@ extern struct subsystem acpi_subsys;
  * External Functions
  */
 
-int acpi_bus_get_device(acpi_handle, struct acpi_device **device);
+int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
+void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context);
 int acpi_bus_get_status (struct acpi_device *device);
 int acpi_bus_get_power (acpi_handle handle, int *state);
 int acpi_bus_set_power (acpi_handle handle, int state);
@@ -325,6 +328,10 @@ int acpi_bus_unregister_driver (struct a
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
+int acpi_bus_scan (struct acpi_device *start);
+void acpi_bus_trim(struct acpi_device *start, int rmdevice);
+int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type);
+
 #endif /* CONFIG_ACPI */
 
 #endif /*__ACPI_BUS_H__*/
diff -puN drivers/acpi/acpi_ksyms.c~acpi_core drivers/acpi/acpi_ksyms.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/acpi_ksyms.c~acpi_core	2004-09-08 16:42:13.449141419 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/acpi_ksyms.c	2004-09-08 16:42:13.562422667 -0700
@@ -129,6 +129,9 @@ EXPORT_SYMBOL(acpi_bus_generate_event);
 EXPORT_SYMBOL(acpi_bus_receive_event);
 EXPORT_SYMBOL(acpi_bus_register_driver);
 EXPORT_SYMBOL(acpi_bus_unregister_driver);
+EXPORT_SYMBOL(acpi_bus_scan);
+EXPORT_SYMBOL(acpi_bus_trim);
+EXPORT_SYMBOL(acpi_bus_add);
 
 
 /* ACPI PCI Driver (pci_irq.c) */
diff -puN drivers/acpi/scan.c~acpi_core drivers/acpi/scan.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/scan.c~acpi_core	2004-09-08 16:42:13.454024231 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/scan.c	2004-09-08 16:42:13.564375792 -0700
@@ -57,6 +57,7 @@ static void acpi_device_register(struct 
 	INIT_LIST_HEAD(&device->children);
 	INIT_LIST_HEAD(&device->node);
 	INIT_LIST_HEAD(&device->g_list);
+	INIT_LIST_HEAD(&device->wakeup_list);
 
 	spin_lock(&acpi_device_lock);
 	if (device->parent) {
@@ -64,6 +65,8 @@ static void acpi_device_register(struct 
 		list_add_tail(&device->g_list,&device->parent->g_list);
 	} else
 		list_add_tail(&device->g_list,&acpi_device_list);
+	if (device->wakeup.flags.valid)
+		list_add_tail(&device->wakeup_list,&acpi_wakeup_device_list);
 	spin_unlock(&acpi_device_lock);
 
 	kobject_init(&device->kobj);
@@ -80,6 +83,20 @@ acpi_device_unregister (
 	struct acpi_device	*device, 
 	int			type)
 {
+	spin_lock(&acpi_device_lock);
+	if (device->parent) {
+		list_del(&device->node);
+		list_del(&device->g_list);
+	} else
+		list_del(&device->g_list);
+
+	if ((device->flags.wake_capable) &&
+	    (device->wakeup.flags.valid))
+		list_del(&device->wakeup_list);
+
+	spin_unlock(&acpi_device_lock);
+
+	acpi_detach_data(device->handle, acpi_bus_data_handler);
 	kobject_unregister(&device->kobj);
 	return 0;
 }
@@ -269,12 +286,6 @@ acpi_bus_get_wakeup_device_flags (
 	if (!acpi_match_ids(device, "PNP0C0D,PNP0C0C,PNP0C0E"))
 		device->wakeup.flags.run_wake = 1;
 
-	/* TBD: lock */
-	INIT_LIST_HEAD(&device->wakeup_list);
-	spin_lock(&acpi_device_lock);
-	list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);
-	spin_unlock(&acpi_device_lock);
-
 end:
 	if (ACPI_FAILURE(status))
 		device->flags.wake_capable = 0;
@@ -315,7 +326,6 @@ acpi_bus_match (
 	return acpi_match_ids(device, driver->ids);
 }
 
-
 /**
  * acpi_bus_driver_init 
  * --------------------
@@ -721,9 +731,10 @@ int acpi_device_set_context(struct acpi_
 void acpi_device_get_debug_info(struct acpi_device * device, acpi_handle handle, int type)
 {
 #ifdef CONFIG_ACPI_DEBUG_OUTPUT
+
 	char		*type_string = NULL;
 	char		name[80] = {'?','\0'};
-	acpi_buffer	buffer = {sizeof(name), name};
+	struct acpi_buffer	buffer = {sizeof(name), name};
 
 	switch (type) {
 	case ACPI_BUS_TYPE_DEVICE:
@@ -760,7 +771,56 @@ void acpi_device_get_debug_info(struct a
 #endif /*CONFIG_ACPI_DEBUG_OUTPUT*/
 }
 
-static int 
+
+int
+acpi_bus_remove (
+	struct acpi_device *dev,
+	int rmdevice)
+{
+	int 			result = 0;
+	struct acpi_driver	*driver;
+	
+	ACPI_FUNCTION_TRACE("acpi_bus_remove");
+
+	if (!dev)
+		return_VALUE(-EINVAL);
+
+	driver = dev->driver;
+
+	if ((driver) && (driver->ops.remove)) {
+
+		if (driver->ops.stop) {
+			result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT);
+			if (result)
+				return_VALUE(result);
+		}
+
+		result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT);
+		if (result) {
+			if (driver->ops.start)
+				driver->ops.start(dev);
+			return_VALUE(result);
+		}
+
+		atomic_dec(&dev->driver->references);
+		dev->driver = NULL;
+		acpi_driver_data(dev) = NULL;
+	}
+
+	if (!rmdevice)
+		return_VALUE(0);
+
+	if (dev->flags.bus_address) {
+		if ((dev->parent) && (dev->parent->ops.unbind))
+			dev->parent->ops.unbind(dev);
+	}
+	
+	acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
+
+	return_VALUE(0);
+}
+
+int
 acpi_bus_add (
 	struct acpi_device	**child,
 	struct acpi_device	*parent,
@@ -907,7 +967,7 @@ end:
 
 
 
-static int acpi_bus_scan (struct acpi_device	*start)
+int acpi_bus_scan (struct acpi_device	*start)
 {
 	acpi_status		status = AE_OK;
 	struct acpi_device	*parent = NULL;
@@ -1009,6 +1069,35 @@ static int acpi_bus_scan (struct acpi_de
 	return_VALUE(0);
 }
 
+void
+acpi_bus_trim(struct acpi_device	*start,
+		int rmdevice)
+{
+	acpi_status		status = AE_OK;
+	struct acpi_device	*parent = NULL;
+	struct acpi_device	*child = NULL;
+	acpi_handle		phandle = 0;
+	acpi_handle		chandle = 0;
+
+	parent  = start;
+	phandle = start->handle;
+
+	/*
+	 * NOTE: must be freed in a depth-first manner.
+	 */
+	while (1)	{
+		status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,
+			chandle, &chandle);
+		if (ACPI_SUCCESS(status) && chandle != NULL)	{
+			if (acpi_bus_get_device(chandle, &child) == 0)
+				acpi_bus_trim(child, 1);
+		} else {
+			/* this is a leaf */
+			acpi_bus_remove(parent, rmdevice);
+			break;
+		}
+	}
+}
 
 static int
 acpi_bus_scan_fixed (
diff -puN include/acpi/acpi_drivers.h~acpi_core include/acpi/acpi_drivers.h
--- linux-2.6.9-rc1-mm2/include/acpi/acpi_drivers.h~acpi_core	2004-09-08 16:42:13.460860168 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/acpi/acpi_drivers.h	2004-09-08 16:42:13.564375792 -0700
@@ -61,12 +61,14 @@ int acpi_pci_link_get_irq (acpi_handle h
 /* ACPI PCI Interrupt Routing (pci_irq.c) */
 
 int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
+void acpi_pci_irq_del_prt (int segment, int bus);
 
 /* ACPI PCI Device Binding (pci_bind.c) */
 
 struct pci_bus;
 
 int acpi_pci_bind (struct acpi_device *device);
+int acpi_pci_unbind (struct acpi_device *device);
 int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus);
 
 /* Arch-defined function to add a bus to the system */
diff -puN drivers/acpi/pci_irq.c~acpi_core drivers/acpi/pci_irq.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/pci_irq.c~acpi_core	2004-09-08 16:42:13.465742981 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/pci_irq.c	2004-09-08 16:42:13.565352355 -0700
@@ -43,7 +43,7 @@
 ACPI_MODULE_NAME		("pci_irq")
 
 struct acpi_prt_list		acpi_prt;
-
+spinlock_t acpi_prt_lock = SPIN_LOCK_UNLOCKED;
 
 /* --------------------------------------------------------------------------
                          PCI IRQ Routing Table (PRT) Support
@@ -68,18 +68,20 @@ acpi_pci_irq_find_prt_entry (
 	 * Parse through all PRT entries looking for a match on the specified
 	 * PCI device's segment, bus, device, and pin (don't care about func).
 	 *
-	 * TBD: Acquire/release lock
 	 */
+	spin_lock(&acpi_prt_lock);
 	list_for_each(node, &acpi_prt.entries) {
 		entry = list_entry(node, struct acpi_prt_entry, node);
 		if ((segment == entry->id.segment) 
 			&& (bus == entry->id.bus) 
 			&& (device == entry->id.device)
 			&& (pin == entry->pin)) {
+			spin_unlock(&acpi_prt_lock);
 			return_PTR(entry);
 		}
 	}
 
+	spin_unlock(&acpi_prt_lock);
 	return_PTR(NULL);
 }
 
@@ -141,14 +143,29 @@ acpi_pci_irq_add_entry (
 		entry->id.segment, entry->id.bus, entry->id.device, 
 		('A' + entry->pin), prt->source, entry->link.index));
 
-	/* TBD: Acquire/release lock */
+	spin_lock(&acpi_prt_lock);
 	list_add_tail(&entry->node, &acpi_prt.entries);
 	acpi_prt.count++;
+	spin_unlock(&acpi_prt_lock);
 
 	return_VALUE(0);
 }
 
 
+static void
+acpi_pci_irq_del_entry (
+	int				segment,
+	int				bus,
+	struct acpi_prt_entry		*entry)
+{
+	if (segment == entry->id.segment && bus == entry->id.bus){
+		acpi_prt.count--;
+		list_del(&entry->node);
+		kfree(entry);
+	}
+}
+
+
 int
 acpi_pci_irq_add_prt (
 	acpi_handle		handle,
@@ -222,7 +239,26 @@ acpi_pci_irq_add_prt (
 	return_VALUE(0);
 }
 
+void
+acpi_pci_irq_del_prt (int segment, int bus)
+{
+	struct list_head        *node = NULL, *n = NULL;
+	struct acpi_prt_entry   *entry = NULL;
+
+	if (!acpi_prt.count)    {
+		return;
+	}
 
+	printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n",
+		segment, bus);
+	spin_lock(&acpi_prt_lock);
+	list_for_each_safe(node, n, &acpi_prt.entries) {
+		entry = list_entry(node, struct acpi_prt_entry, node);
+
+		acpi_pci_irq_del_entry(segment, bus, entry);
+	}
+	spin_unlock(&acpi_prt_lock);
+}
 /* --------------------------------------------------------------------------
                           PCI Interrupt Routing Support
    -------------------------------------------------------------------------- */
diff -puN drivers/acpi/pci_bind.c~acpi_core drivers/acpi/pci_bind.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/pci_bind.c~acpi_core	2004-09-08 16:42:13.471602356 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/pci_bind.c	2004-09-08 16:42:13.566328917 -0700
@@ -214,6 +214,7 @@ acpi_pci_bind (
 			data->id.device, data->id.function));
 		data->bus = data->dev->subordinate;
 		device->ops.bind = acpi_pci_bind;
+		device->ops.unbind = acpi_pci_unbind;
 	}
 
 	/*
@@ -257,6 +258,49 @@ end:
 	return_VALUE(result);
 }
 
+int acpi_pci_unbind(
+	struct acpi_device      *device)
+{
+	int                     result = 0;
+	acpi_status             status = AE_OK;
+	struct acpi_pci_data    *data = NULL;
+	char                    pathname[ACPI_PATHNAME_MAX] = {0};
+	struct acpi_buffer      buffer = {ACPI_PATHNAME_MAX, pathname};
+
+	ACPI_FUNCTION_TRACE("acpi_pci_unbind");
+
+	if (!device || !device->parent)
+		return_VALUE(-EINVAL);
+
+	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
+		pathname));
+
+	status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"Unable to get data from device %s\n",
+			acpi_device_bid(device)));
+		result = -ENODEV;
+		goto end;
+	}
+
+	status = acpi_detach_data(device->handle, acpi_pci_data_handler);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"Unable to detach data from device %s\n",
+			acpi_device_bid(device)));
+		result = -ENODEV;
+		goto end;
+	}
+	if (data->dev->subordinate) {
+		acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
+	}
+	kfree(data);
+
+end:
+	return_VALUE(result);
+}
 
 int 
 acpi_pci_bind_root (
@@ -283,6 +327,7 @@ acpi_pci_bind_root (
 	data->id = *id;
 	data->bus = bus;
 	device->ops.bind = acpi_pci_bind;
+	device->ops.unbind = acpi_pci_unbind;
 
 	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
 
diff -puN drivers/acpi/bus.c~acpi_core drivers/acpi/bus.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/bus.c~acpi_core	2004-09-08 16:42:13.475508606 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/bus.c	2004-09-08 16:42:13.567305480 -0700
@@ -53,10 +53,6 @@ struct proc_dir_entry		*acpi_root_dir;
                                 Device Management
    -------------------------------------------------------------------------- */
 
-extern void acpi_bus_data_handler (
-	acpi_handle		handle,
-	u32			function,
-	void			*context);
 int
 acpi_bus_get_device (
 	acpi_handle		handle,
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
  2004-09-09  1:21 ` [PATCH 1/6]ACPI based Physical CPU hotplug Keshavamurthy Anil S
@ 2004-09-09  1:24 ` Keshavamurthy Anil S
  2004-09-09  1:35 ` [PATCH 3/6]ACPI " Keshavamurthy Anil S
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:24 UTC (permalink / raw)
  To: LHNS list, ACPI Developer; +Cc: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w


This is the core eject support interface required to support user mode
agent initiated hot-removal.

---
Name:acpi_core_eject.patch
Status: Tested on 2.6.9-rc2-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends:acpi_core
Version: applies on 2.6.9-rc1-mm2

This patch support /sys/firmware/acpi/eject interface where in 
the ACPI device say "LSB0" can be ejected by echoing "\_SB.LSB0" > 
/sys/firmware/acpi/eject

The kernel when it receives an hardware sci eject request it simply passes this
to user mode agent and the agent in turn will offline all the child devices and
then echo's the ACPI device name onto /sys/firware/acpi/eject file and then the
kernel will then actually remove the device.

---

 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/scan.c |  141 +++++++++++++++++++++++
 1 files changed, 141 insertions(+)

diff -puN drivers/acpi/scan.c~acpi_core_eject drivers/acpi/scan.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/scan.c~acpi_core_eject	2004-09-08 16:42:16.763594503 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/scan.c	2004-09-08 16:42:16.848555439 -0700
@@ -2,6 +2,7 @@
  * scan.c - support for transforming the ACPI namespace into individual objects
  */
 
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
 
@@ -293,6 +294,141 @@ end:
 }
 
 /* --------------------------------------------------------------------------
+                              ACPI hotplug Eject support
+   -------------------------------------------------------------------------- */
+static ssize_t acpi_eject_store(struct subsystem *subsys, const char *buf, size_t count);
+static struct subsys_attribute acpi_eject_attr =
+	__ATTR(eject,0200,NULL,acpi_eject_store);
+
+/*
+ * evaluate _EJ0, detach driver, and remove from ACPI bus
+ */
+static int
+eject_operation(acpi_handle handle, int lockable)
+{
+	struct acpi_object_list arg_list;
+	union acpi_object arg;
+	acpi_status status = AE_OK;
+
+	/*
+	 * TBD: evaluate _PS3?
+	 */
+
+	if (lockable) {
+		arg_list.count = 1;
+		arg_list.pointer = &arg;
+		arg.type = ACPI_TYPE_INTEGER;
+		arg.integer.value = 0;
+		acpi_evaluate_object(handle, "_LCK", &arg_list, NULL);
+	}
+
+	arg_list.count = 1;
+	arg_list.pointer = &arg;
+	arg.type = ACPI_TYPE_INTEGER;
+	arg.integer.value = 1;
+
+	/*
+	 * TBD: _EJD support.
+	 */
+
+	status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
+	if (ACPI_FAILURE(status)) {
+		return(-ENODEV);
+	}
+
+	return(0);
+}
+
+static ssize_t
+acpi_eject_store(struct subsystem *subsys, const char *buf, size_t count)
+{
+	acpi_status status;
+	acpi_handle hlsb;
+	struct acpi_device *device = NULL;
+	int result;
+	int ret = count;
+
+	char *acpi_name;
+	char *p;
+	int islockable;
+	acpi_object_type	type = 0;
+
+	if (!count) {
+		return -EINVAL;
+	}
+
+	acpi_name = kmalloc(count+1, GFP_KERNEL);
+	if (!acpi_name) {
+		return -ENOMEM;
+	}
+
+	acpi_name[count] = '\0';
+	strncpy(acpi_name, buf, count);
+
+	for (p = acpi_name+(count-1); p >= acpi_name; --p) {
+		if (isspace(*p))
+			*p = '\0';
+		else
+			break;
+	}
+
+	status = acpi_get_handle(NULL, acpi_name, &hlsb);
+	if(ACPI_FAILURE(status)) {
+		ret = -ENODEV;
+		goto err;
+	}
+
+	status = acpi_get_type(hlsb, &type);
+	if (ACPI_FAILURE(status)) {
+		ret = -ENODEV;
+		goto err;
+	}
+
+	result = acpi_bus_get_device(hlsb, &device);
+	if (result) {
+		ret = -ENODEV;
+		goto err;
+	}
+#ifndef FORCE_EJECT
+	if (device->driver == NULL) {
+		ret = -ENODEV;
+		goto err;
+	}
+#endif
+	if (!device->flags.ejectable) {
+		ret = -ENODEV;
+		goto err;
+	}
+
+	islockable = device->flags.lockable;
+
+	/*
+	 * remove from ACPI bus.
+	 */
+	if (type == ACPI_BUS_TYPE_PROCESSOR)
+		acpi_bus_trim(device, 0);
+	else
+		acpi_bus_trim(device, 1);
+		
+
+	result = eject_operation(hlsb, islockable);
+	if (result) {
+		ret = -EBUSY;
+	}
+err:
+	kfree(acpi_name);
+	return ret;
+}
+
+
+static int __init register_acpi_eject(void)
+{
+	subsys_create_file(&acpi_subsys, &acpi_eject_attr);
+	return 0;
+}
+
+
+/* --------------------------------------------------------------------------
                               Performance Management
    -------------------------------------------------------------------------- */
 
@@ -1155,6 +1291,11 @@ static int __init acpi_scan_init(void)
 	if (result)
 		acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
 
+	/*
+	 * Register hotplug eject interface
+	 */
+	register_acpi_eject();
+
  Done:
 	return_VALUE(result);
 }
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
  2004-09-09  1:21 ` [PATCH 1/6]ACPI based Physical CPU hotplug Keshavamurthy Anil S
  2004-09-09  1:24 ` [PATCH 2/6]ACPI " Keshavamurthy Anil S
@ 2004-09-09  1:35 ` Keshavamurthy Anil S
  2004-09-09  1:37 ` [PATCH 4/6]ACPI " Keshavamurthy Anil S
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:35 UTC (permalink / raw)
  To: LHNS list, ACPI Developer; +Cc: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w



---
Name:acpi_hotplug_arch.patch
Status: Tested on 2.6.9-rc1-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends:	
Version: applies on 2.6.9-rc1-mm2	
Description: 
This patch provides the architecture specifice support for mapping lsapic to cpu array.
Currently this supports just IA64. Support for IA32 and x86_64 is in progress
---

 linux-2.6.9-rc1-mm2-askeshav/arch/i386/kernel/acpi/boot.c |   22 ++
 linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/acpi.c      |  129 +++++++++++++-
 linux-2.6.9-rc1-mm2-askeshav/include/linux/acpi.h         |    6 
 3 files changed, 155 insertions(+), 2 deletions(-)

diff -puN include/linux/acpi.h~acpi_hotplug_arch include/linux/acpi.h
--- linux-2.6.9-rc1-mm2/include/linux/acpi.h~acpi_hotplug_arch	2004-09-08 16:42:19.810469466 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/linux/acpi.h	2004-09-08 16:42:19.907149152 -0700
@@ -396,6 +396,12 @@ void acpi_numa_processor_affinity_init (
 void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
 void acpi_numa_arch_fixup(void);
 
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+/* Arch dependent functions for cpu hotplug support */
+int acpi_map_lsapic(acpi_handle handle, int *pcpu);
+int acpi_unmap_lsapic(int cpu);
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
 extern int acpi_mp_config;
 
 extern u32 pci_mmcfg_base_addr;
diff -puN arch/ia64/kernel/acpi.c~acpi_hotplug_arch arch/ia64/kernel/acpi.c
--- linux-2.6.9-rc1-mm2/arch/ia64/kernel/acpi.c~acpi_hotplug_arch	2004-09-08 16:42:19.816328841 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/acpi.c	2004-09-08 16:42:19.909102277 -0700
@@ -354,11 +354,11 @@ acpi_parse_madt (unsigned long phys_addr
 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
 
 static int __initdata srat_num_cpus;			/* number of cpus */
-static u32 __initdata pxm_flag[PXM_FLAG_LEN];
+static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
 /* maps to convert between proximity domain and logical node ID */
-int __initdata pxm_to_nid_map[MAX_PXM_DOMAINS];
+int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
 int __initdata nid_to_pxm_map[MAX_NUMNODES];
 static struct acpi_table_slit __initdata *slit_table;
 
@@ -650,4 +650,129 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *
 	return 0;
 }
 
+
+
+/*
+ *  ACPI based hotplug support for CPU
+ */
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+static
+int
+acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
+{
+#ifdef CONFIG_ACPI_NUMA
+	int 			pxm_id = 0;
+	union acpi_object 	*obj;
+	struct acpi_buffer 	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+
+	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PXM", NULL, &buffer)))
+		goto pxm_id_0;
+
+	if ((!buffer.length) || (!buffer.pointer))
+		goto pxm_id_0;
+
+	obj = buffer.pointer;
+	if (obj->type != ACPI_TYPE_INTEGER) {
+		acpi_os_free(buffer.pointer);
+		goto pxm_id_0;
+	}
+
+	pxm_id = obj->integer.value;
+
+pxm_id_0:
+	/*
+	 * Assuming that the container driver would have set the proximity
+	 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+	 */
+
+	/* Return Error if proximity domain is not set */
+	if (!pxm_bit_test(pxm_id))
+		return -EINVAL;
+
+	node_cpuid[cpu].phys_id =  physid;
+	node_cpuid[cpu].nid = pxm_to_nid_map[pxm_id];
+
+#endif
+	return(0);
+}
+
+
+int
+acpi_map_lsapic(acpi_handle handle, int *pcpu)
+{
+	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	union acpi_object *obj;
+	struct acpi_table_lsapic *lsapic;
+	cpumask_t tmp_map;
+	long physid;
+	int cpu;
+ 
+	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
+		return -EINVAL;
+
+	if (!buffer.length ||  !buffer.pointer)
+		return -EINVAL;
+ 
+	obj = buffer.pointer;
+	if (obj->type != ACPI_TYPE_BUFFER ||
+	    obj->buffer.length < sizeof(*lsapic)) {
+		acpi_os_free(buffer.pointer);
+		return -EINVAL;
+	}
+
+	lsapic = (struct acpi_table_lsapic *)obj->buffer.pointer;
+
+	if ((lsapic->header.type != ACPI_MADT_LSAPIC) ||
+	    (!lsapic->flags.enabled)) {
+		acpi_os_free(buffer.pointer);
+		return -EINVAL;
+	}
+
+	physid = ((lsapic->id <<8) | (lsapic->eid));
+
+	acpi_os_free(buffer.pointer);
+	buffer.length = ACPI_ALLOCATE_BUFFER;
+	buffer.pointer = NULL;
+
+	cpus_complement(tmp_map, cpu_present_map);
+	cpu = first_cpu(tmp_map);
+	if(cpu >= NR_CPUS)
+		return -EINVAL;
+
+	if (ACPI_FAILURE(acpi_map_cpu2node(handle, cpu, physid)))
+	return -ENODEV;
+
+ 	cpu_set(cpu, cpu_present_map);
+	ia64_cpu_to_sapicid[cpu] = physid;
+	ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
+
+	*pcpu = cpu;
+	return(0);
+}
+EXPORT_SYMBOL(acpi_map_lsapic);
+
+
+int
+acpi_unmap_lsapic(int cpu)
+{
+	int i;
+
+	for (i=0; i<MAX_SAPICS; i++) {
+ 		if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
+ 			ia64_acpiid_to_sapicid[i] = -1;
+ 			break;
+ 		}
+ 	}
+ 	ia64_cpu_to_sapicid[cpu] = -1;
+	cpu_clear(cpu,cpu_present_map);
+
+#ifdef CONFIG_ACPI_NUMA
+	/* NUMA specific cleanup's */
+#endif
+
+	return(0);
+}
+EXPORT_SYMBOL(acpi_unmap_lsapic);
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+ 
 #endif /* CONFIG_ACPI */
diff -puN arch/i386/kernel/acpi/boot.c~acpi_hotplug_arch arch/i386/kernel/acpi/boot.c
--- linux-2.6.9-rc1-mm2/arch/i386/kernel/acpi/boot.c~acpi_hotplug_arch	2004-09-08 16:42:19.822188215 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/i386/kernel/acpi/boot.c	2004-09-08 16:42:19.910078839 -0700
@@ -475,6 +475,28 @@ unsigned int acpi_register_gsi(u32 gsi, 
 }
 EXPORT_SYMBOL(acpi_register_gsi);
 
+/*
+ *  ACPI based hotplug support for CPU
+ */
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+int
+acpi_map_lsapic(acpi_handle handle, int *pcpu)
+{
+	/* TBD */
+	return -EINVAL;
+}
+EXPORT_SYMBOL(acpi_map_lsapic);
+
+
+int
+acpi_unmap_lsapic(int cpu)
+{
+	/* TBD */
+	return -EINVAL;
+}
+EXPORT_SYMBOL(acpi_unmap_lsapic);
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
 static unsigned long __init
 acpi_scan_rsdp (
 	unsigned long		start,
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
                   ` (2 preceding siblings ...)
  2004-09-09  1:35 ` [PATCH 3/6]ACPI " Keshavamurthy Anil S
@ 2004-09-09  1:37 ` Keshavamurthy Anil S
  2004-09-09  1:40 ` [PATCH 5/6]ACPI " Keshavamurthy Anil S
  2004-09-09  1:41 ` [PATCH 6/6]ACPI " Keshavamurthy Anil S
  5 siblings, 0 replies; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:37 UTC (permalink / raw)
  To: LHNS list, ACPI Developer; +Cc: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w



---
Name:topology.patch
Status:Tested on 2.6.9-rc1-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends:	
Version: applies on 2.6.9-rc1-mm2	
Description:
Extends support for dynamic sysfs registration and unregistration of the cpu.
---

 /dev/null                                                      |   43 ----
 linux-2.6.9-rc1-mm2-askeshav/arch/i386/mach-default/topology.c |   31 +++
 linux-2.6.9-rc1-mm2-askeshav/arch/ia64/dig/Makefile            |    5 
 linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/Makefile         |    3 
 linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/topology.c       |   93 ++++++++++
 linux-2.6.9-rc1-mm2-askeshav/drivers/base/cpu.c                |   20 +-
 linux-2.6.9-rc1-mm2-askeshav/include/asm-i386/cpu.h            |   17 -
 linux-2.6.9-rc1-mm2-askeshav/include/asm-ia64/cpu.h            |    5 
 linux-2.6.9-rc1-mm2-askeshav/include/linux/cpu.h               |    3 
 9 files changed, 156 insertions(+), 64 deletions(-)

diff -puN arch/ia64/dig/Makefile~topology arch/ia64/dig/Makefile
--- linux-2.6.9-rc1-mm2/arch/ia64/dig/Makefile~topology	2004-09-08 16:42:23.214766299 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/ia64/dig/Makefile	2004-09-08 16:42:23.340742860 -0700
@@ -6,9 +6,4 @@
 #
 
 obj-y := setup.o
-
-ifndef CONFIG_NUMA
-obj-$(CONFIG_IA64_DIG) += topology.o
-endif
-
 obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff -L arch/ia64/dig/topology.c -puN arch/ia64/dig/topology.c~topology /dev/null
--- linux-2.6.9-rc1-mm2/arch/ia64/dig/topology.c
+++ /dev/null	2004-06-30 13:03:36.000000000 -0700
@@ -1,43 +0,0 @@
-/*
- * arch/ia64/dig/topology.c
- *	Popuate driverfs with topology information.
- *	Derived entirely from i386/mach-default.c
- *  Intel Corporation - Ashok Raj
- */
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <linux/cpumask.h>
-#include <linux/percpu.h>
-#include <linux/notifier.h>
-#include <linux/cpu.h>
-#include <asm/cpu.h>
-
-static DEFINE_PER_CPU(struct ia64_cpu, cpu_devices);
-
-/*
- * First Pass: simply borrowed code for now. Later should hook into
- * hotplug notification for node/cpu/memory as applicable
- */
-
-static int arch_register_cpu(int num)
-{
-	struct node *parent = NULL;
-
-#ifdef CONFIG_NUMA
-	//parent = &node_devices[cpu_to_node(num)].node;
-#endif
-
-	return register_cpu(&per_cpu(cpu_devices,num).cpu, num, parent);
-}
-
-static int __init topology_init(void)
-{
-    int i;
-
-    for_each_cpu(i) {
-        arch_register_cpu(i);
-	}
-    return 0;
-}
-
-subsys_initcall(topology_init);
diff -puN arch/ia64/kernel/Makefile~topology arch/ia64/kernel/Makefile
--- linux-2.6.9-rc1-mm2/arch/ia64/kernel/Makefile~topology	2004-09-08 16:42:23.227461611 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/Makefile	2004-09-08 16:42:23.349531922 -0700
@@ -6,7 +6,8 @@ extra-y	:= head.o init_task.o vmlinux.ld
 
 obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o	\
 	 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o		\
-	 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o unwind.o mca.o mca_asm.o
+	 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
+	 unwind.o mca.o mca_asm.o topology.o
 
 obj-$(CONFIG_IA64_BRL_EMU)	+= brl_emu.o
 obj-$(CONFIG_IA64_GENERIC)	+= acpi-ext.o
diff -puN include/linux/cpu.h~topology include/linux/cpu.h
--- linux-2.6.9-rc1-mm2/include/linux/cpu.h~topology	2004-09-08 16:42:23.231367861 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/linux/cpu.h	2004-09-08 16:42:23.350508485 -0700
@@ -32,6 +32,9 @@ struct cpu {
 };
 
 extern int register_cpu(struct cpu *, int, struct node *);
+#ifdef CONFIG_HOTPLUG_CPU
+extern void unregister_cpu(struct cpu *, struct node *);
+#endif
 struct notifier_block;
 
 #ifdef CONFIG_SMP
diff -puN include/asm-i386/cpu.h~topology include/asm-i386/cpu.h
--- linux-2.6.9-rc1-mm2/include/asm-i386/cpu.h~topology	2004-09-08 16:42:23.238203799 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/asm-i386/cpu.h	2004-09-08 16:42:23.351485047 -0700
@@ -13,19 +13,10 @@ struct i386_cpu {
 	struct cpu cpu;
 };
 extern struct i386_cpu cpu_devices[NR_CPUS];
-
-
-static inline int arch_register_cpu(int num){
-	struct node *parent = NULL;
-	
-#ifdef CONFIG_NUMA
-	int node = cpu_to_node(num);
-	if (node_online(node))
-		parent = &node_devices[node].node;
-#endif /* CONFIG_NUMA */
-
-	return register_cpu(&cpu_devices[num].cpu, num, parent);
-}
+extern int arch_register_cpu(int num);
+#ifdef CONFIG_HOTPLUG_CPU
+extern void arch_unregister_cpu(int);
+#endif
 
 DECLARE_PER_CPU(int, cpu_state);
 #endif /* _ASM_I386_CPU_H_ */
diff -puN include/asm-ia64/cpu.h~topology include/asm-ia64/cpu.h
--- linux-2.6.9-rc1-mm2/include/asm-ia64/cpu.h~topology	2004-09-08 16:42:23.244063174 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/asm-ia64/cpu.h	2004-09-08 16:42:23.351485047 -0700
@@ -14,4 +14,9 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_dev
 
 DECLARE_PER_CPU(int, cpu_state);
 
+extern int arch_register_cpu(int num);
+#ifdef CONFIG_HOTPLUG_CPU
+extern void arch_unregister_cpu(int);
+#endif
+
 #endif /* _ASM_IA64_CPU_H_ */
diff -puN /dev/null arch/ia64/kernel/topology.c
--- /dev/null	2004-06-30 13:03:36.000000000 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/ia64/kernel/topology.c	2004-09-08 16:42:23.352461610 -0700
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ *
+ * This file contains NUMA specific variables and functions which can
+ * be split away from DISCONTIGMEM and are used on NUMA machines with
+ * contiguous memory.
+ * 		2002/08/07 Erich Focht <efocht-+HQ0pkNQ8fyELgA04lAiVw@public.gmane.org>
+ * Populate cpu entries in sysfs for non-numa systems as well
+ *  	Intel Corporation - Ashok Raj
+ */
+
+#include <linux/config.h>
+#include <linux/cpu.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/node.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+#include <asm/mmzone.h>
+#include <asm/numa.h>
+#include <asm/cpu.h>
+
+#ifdef CONFIG_NUMA
+static struct node *sysfs_nodes;
+#endif
+static struct ia64_cpu *sysfs_cpus;
+
+int arch_register_cpu(int num)
+{
+	struct node *parent = NULL;
+	
+#ifdef CONFIG_NUMA
+	int node = cpu_to_node(num);
+	if (node_online(node))
+		parent = &sysfs_nodes[node];
+#endif /* CONFIG_NUMA */
+
+	return register_cpu(&sysfs_cpus[num].cpu, num, parent);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+void arch_unregister_cpu(int num)
+{
+	struct node *parent = NULL;
+
+#ifdef CONFIG_NUMA
+	int node = cpu_to_node(num);
+	if (node_online(node))
+		parent = &sysfs_nodes[node];
+#endif /* CONFIG_NUMA */
+
+	return unregister_cpu(&sysfs_cpus[num].cpu, parent);
+}
+EXPORT_SYMBOL(arch_register_cpu);
+EXPORT_SYMBOL(arch_unregister_cpu);
+#endif /*CONFIG_HOTPLUG_CPU*/
+
+
+static int __init topology_init(void)
+{
+	int i, err = 0;
+
+#ifdef CONFIG_NUMA
+	sysfs_nodes = kmalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL);
+	if (!sysfs_nodes) {
+		err = -ENOMEM;
+		goto out;
+	}
+	memset(sysfs_nodes, 0, sizeof(struct node) * MAX_NUMNODES);
+
+	for_each_online_node(i)
+		if ((err = register_node(&sysfs_nodes[i], i, 0)))
+			goto out;
+#endif
+
+	sysfs_cpus = kmalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
+	if (!sysfs_cpus) {
+		err = -ENOMEM;
+		goto out;
+	}
+	memset(sysfs_cpus, 0, sizeof(struct ia64_cpu) * NR_CPUS);
+
+	for_each_present_cpu(i)
+		if((err = arch_register_cpu(i)))
+			goto out;
+out:
+	return err;
+}
+
+__initcall(topology_init);
diff -puN arch/i386/mach-default/topology.c~topology arch/i386/mach-default/topology.c
--- linux-2.6.9-rc1-mm2/arch/i386/mach-default/topology.c~topology	2004-09-08 16:42:23.249922548 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/arch/i386/mach-default/topology.c	2004-09-08 16:42:23.353438172 -0700
@@ -32,6 +32,37 @@
 
 struct i386_cpu cpu_devices[NR_CPUS];
 
+int arch_register_cpu(int num){
+	struct node *parent = NULL;
+	
+#ifdef CONFIG_NUMA
+	int node = cpu_to_node(num);
+	if (node_online(node))
+		parent = &node_devices[node].node;
+#endif /* CONFIG_NUMA */
+
+	return register_cpu(&cpu_devices[num].cpu, num, parent);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+void arch_unregister_cpu(int num) {
+	struct node *parent = NULL;
+
+#ifdef CONFIG_NUMA
+	int node = cpu_to_node(num);
+	if (node_online(node))
+		parent = &node_devices[node].node;
+#endif /* CONFIG_NUMA */
+
+	return unregister_cpu(&cpu_devices[num].cpu, parent);
+}
+EXPORT_SYMBOL(arch_register_cpu);
+EXPORT_SYMBOL(arch_unregister_cpu);
+#endif /*CONFIG_HOTPLUG_CPU*/
+
+
+
 #ifdef CONFIG_NUMA
 #include <linux/mmzone.h>
 #include <asm/node.h>
diff -puN drivers/base/cpu.c~topology drivers/base/cpu.c
--- linux-2.6.9-rc1-mm2/drivers/base/cpu.c~topology	2004-09-08 16:42:23.256758486 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/base/cpu.c	2004-09-08 16:42:23.354414735 -0700
@@ -46,10 +46,23 @@ static ssize_t store_online(struct sys_d
 }
 static SYSDEV_ATTR(online, 0600, show_online, store_online);
 
-static void __init register_cpu_control(struct cpu *cpu)
+static void __devinit register_cpu_control(struct cpu *cpu)
 {
 	sysdev_create_file(&cpu->sysdev, &attr_online);
 }
+void unregister_cpu(struct cpu *cpu, struct node *root)
+{
+
+	if (root)
+		sysfs_remove_link(&root->sysdev.kobj,
+				  kobject_name(&cpu->sysdev.kobj));
+	sysdev_remove_file(&cpu->sysdev, &attr_online);
+
+	sysdev_unregister(&cpu->sysdev);
+
+	return;
+}
+EXPORT_SYMBOL(unregister_cpu);
 #else /* ... !CONFIG_HOTPLUG_CPU */
 static inline void register_cpu_control(struct cpu *cpu)
 {
@@ -64,7 +77,7 @@ static inline void register_cpu_control(
  *
  * Initialize and register the CPU device.
  */
-int __init register_cpu(struct cpu *cpu, int num, struct node *root)
+int __devinit register_cpu(struct cpu *cpu, int num, struct node *root)
 {
 	int error;
 
@@ -81,6 +94,9 @@ int __init register_cpu(struct cpu *cpu,
 		register_cpu_control(cpu);
 	return error;
 }
+#ifdef CONFIG_HOTPLUG_CPU
+EXPORT_SYMBOL(register_cpu);
+#endif
 
 
 
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
                   ` (3 preceding siblings ...)
  2004-09-09  1:37 ` [PATCH 4/6]ACPI " Keshavamurthy Anil S
@ 2004-09-09  1:40 ` Keshavamurthy Anil S
       [not found]   ` <20040908184011.C7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
  2004-09-09  1:41 ` [PATCH 6/6]ACPI " Keshavamurthy Anil S
  5 siblings, 1 reply; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:40 UTC (permalink / raw)
  To: LHNS list, ACPI Developer; +Cc: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w



---
Name:processor_drv.patch
Status:Tested on 2.6.9-rc1-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends:	
Version: applies on 2.6.9-rc1-mm2	
Description:
Extends the processor driver to support ACPI based Physical CPU hotplug.

---

 include/linux/cpu.h                                   |    0 
 kernel/cpu.c                                          |    0 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Kconfig     |    8 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/processor.c |  468 +++++++++++++++---
 4 files changed, 409 insertions(+), 67 deletions(-)

diff -puN drivers/acpi/Kconfig~processor_drv drivers/acpi/Kconfig
--- linux-2.6.9-rc1-mm2/drivers/acpi/Kconfig~processor_drv	2004-09-08 16:42:26.574141258 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Kconfig	2004-09-08 16:42:26.674727194 -0700
@@ -96,6 +96,14 @@ config ACPI_PROCESSOR
 	  ACPI C2 and C3 processor states to save power, on systems that
 	  support it.
 
+config ACPI_HOTPLUG_CPU
+	bool "Processor Hotplug (EXPERIMENTAL)"
+	depends on ACPI_PROCESSOR && HOTPLUG_CPU
+	depends on !IA64_SGI_SN
+	default n
+	 ---help---
+	 Select this option if your platform support physical CPU hotplug.
+
 config ACPI_THERMAL
 	tristate "Thermal Zone"
 	depends on ACPI_PROCESSOR
diff -puN include/linux/cpu.h~processor_drv include/linux/cpu.h
diff -puN kernel/cpu.c~processor_drv kernel/cpu.c
diff -puN drivers/acpi/processor.c~processor_drv drivers/acpi/processor.c
--- linux-2.6.9-rc1-mm2/drivers/acpi/processor.c~processor_drv	2004-09-08 16:42:26.590742820 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/processor.c	2004-09-08 16:42:26.678633444 -0700
@@ -4,6 +4,8 @@
  *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  *  Copyright (C) 2004       Dominik Brodowski <linux-JhLEnvuH02M@public.gmane.org>
+ *  Copyright (C) 2004  Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
+ *  			- Added processor hotplug support
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
@@ -37,11 +39,13 @@
 #include <linux/pci.h>
 #include <linux/pm.h>
 #include <linux/cpufreq.h>
+#include <linux/cpu.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
+#include <asm/cpu.h>
 #include <asm/delay.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
@@ -69,10 +73,11 @@
 #define C2_OVERHEAD			4	/* 1us (3.579 ticks per us) */
 #define C3_OVERHEAD			4	/* 1us (3.579 ticks per us) */
 
-
 #define ACPI_PROCESSOR_LIMIT_USER	0
 #define ACPI_PROCESSOR_LIMIT_THERMAL	1
 
+#define ACPI_STA_PRESENT 0x00000001
+
 #define _COMPONENT		ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME		("acpi_processor")
 
@@ -82,12 +87,15 @@ MODULE_LICENSE("GPL");
 
 
 static int acpi_processor_add (struct acpi_device *device);
+static int acpi_processor_start (struct acpi_device *device);
 static int acpi_processor_remove (struct acpi_device *device, int type);
 static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
 static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file);
 static int acpi_processor_power_open_fs(struct inode *inode, struct file *file);
 static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file);
 static int acpi_processor_get_limit_info(struct acpi_processor *pr);
+static void acpi_processor_notify ( acpi_handle	handle, u32 event, void *data);
+static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
 
 static struct acpi_driver acpi_processor_driver = {
 	.name =		ACPI_PROCESSOR_DRIVER_NAME,
@@ -96,9 +104,12 @@ static struct acpi_driver acpi_processor
 	.ops =		{
 				.add =		acpi_processor_add,
 				.remove =	acpi_processor_remove,
+				.start	= 	acpi_processor_start,
 			},
 };
 
+#define INSTALL_NOTIFY_HANDLER		1
+#define UNINSTALL_NOTIFY_HANDLER	2
 
 struct acpi_processor_errata {
 	u8			smp;
@@ -2242,23 +2253,30 @@ acpi_processor_get_info (
 
 	cpu_index = convert_acpiid_to_cpu(pr->acpi_id);
 
-	if ( !cpu0_initialized && (cpu_index == 0xff)) {
-		/* Handle UP system running SMP kernel, with no LAPIC in MADT */
-		cpu_index = 0;
-	} else if (cpu_index > num_online_cpus()) {
-		/*
-		 *  Extra Processor objects may be enumerated on MP systems with
-		 *  less than the max # of CPUs. They should be ignored.
-		 */
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error getting cpuindex for acpiid 0x%x\n",
-			pr->acpi_id));
-		return_VALUE(-ENODEV);
-	}
-	cpu0_initialized = 1;
-
-	pr->id = cpu_index;
-
+  	/* Handle UP system running SMP kernel, with no LAPIC in MADT */
+  	if ( !cpu0_initialized && (cpu_index == 0xff) &&
+  		       	(num_online_cpus() == 1)) {
+   		cpu_index = 0;
+   	}
+
+   	cpu0_initialized = 1;
+
+   	pr->id = cpu_index;
+
+  	/*
+  	 *  Extra Processor objects may be enumerated on MP systems with
+  	 *  less than the max # of CPUs. They should be ignored _iff
+  	 *  they are physically not present.
+  	 */
+   	if (cpu_index >=  NR_CPUS) {
+   		if (ACPI_FAILURE(acpi_processor_hotadd_init(pr->handle, &pr->id))) {
+   			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+   				"Error getting cpuindex for acpiid 0x%x\n",
+   				pr->acpi_id));
+   			return_VALUE(-ENODEV);
+   		}
+    	}
+ 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, 
 		pr->acpi_id));
 
@@ -2297,6 +2315,65 @@ acpi_processor_get_info (
 }
 
 
+static int
+acpi_processor_start(
+	struct acpi_device	*device)
+{
+	int			result = 0;
+	acpi_status		status = AE_OK;
+	u32			i = 0;
+	struct acpi_processor	*pr;
+
+	ACPI_FUNCTION_TRACE("acpi_processor_start");
+
+	pr = acpi_driver_data(device);
+
+	result = acpi_processor_get_info(pr);
+	if (result) {
+		/* Processor is physically not present */
+		return_VALUE(0);
+	}
+
+	BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
+
+	processors[pr->id] = pr;
+
+	result = acpi_processor_add_fs(device);
+	if (result)
+		goto end;
+
+	status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
+		acpi_processor_notify, pr);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"Error installing device notify handler\n"));
+	}
+
+	/*
+	 * Install the idle handler if processor power management is supported.
+	 * Note that the default idle handler (default_idle) will be used on
+	 * platforms that only support C1.
+	 */
+	if ((pr->id == 0) && (pr->flags.power)) {
+		pm_idle_save = pm_idle;
+		pm_idle = acpi_processor_idle;
+	}
+
+	printk(KERN_INFO PREFIX "%s [%s] (supports",
+		acpi_device_name(device), acpi_device_bid(device));
+	for (i=1; i<ACPI_C_STATE_COUNT; i++)
+		if (pr->power.states[i].valid)
+			printk(" C%d", i);
+	if (pr->flags.throttling)
+		printk(", %d throttling states", pr->throttling.state_count);
+	printk(")\n");
+end:
+
+	return_VALUE(result);
+}
+
+
+
 static void
 acpi_processor_notify (
 	acpi_handle		handle,
@@ -2338,10 +2415,7 @@ static int
 acpi_processor_add (
 	struct acpi_device	*device)
 {
-	int			result = 0;
-	acpi_status		status = AE_OK;
 	struct acpi_processor	*pr = NULL;
-	u32			i = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_processor_add");
 
@@ -2358,51 +2432,7 @@ acpi_processor_add (
 	strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
 	acpi_driver_data(device) = pr;
 
-	result = acpi_processor_get_info(pr);
-	if (result)
-		goto end;
-
-	result = acpi_processor_add_fs(device);
-	if (result)
-		goto end;
-
-	status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, 
-		acpi_processor_notify, pr);
-	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Error installing notify handler\n"));
-		result = -ENODEV;
-		goto end;
-	}
-
-	processors[pr->id] = pr;
-
-	/*
-	 * Install the idle handler if processor power management is supported.
-	 * Note that the default idle handler (default_idle) will be used on 
-	 * platforms that only support C1.
-	 */
-	if ((pr->id == 0) && (pr->flags.power)) {
-		pm_idle_save = pm_idle;
-		pm_idle = acpi_processor_idle;
-	}
-	
-	printk(KERN_INFO PREFIX "%s [%s] (supports",
-		acpi_device_name(device), acpi_device_bid(device));
-	for (i=1; i<ACPI_C_STATE_COUNT; i++)
-		if (pr->power.states[i].valid)
-			printk(" C%d", i);
-	if (pr->flags.throttling)
-		printk(", %d throttling states", pr->throttling.state_count);
-	printk(")\n");
-
-end:
-	if (result) {
-		acpi_processor_remove_fs(device);
-		kfree(pr);
-	}
-
-	return_VALUE(result);
+	return_VALUE(0);
 }
 
 
@@ -2421,6 +2451,21 @@ acpi_processor_remove (
 
 	pr = (struct acpi_processor *) acpi_driver_data(device);
 
+	if (pr->id >= NR_CPUS) {
+		kfree(pr);
+		return_VALUE(0);
+	}
+
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+	if (type == ACPI_BUS_REMOVAL_EJECT) {
+		if (cpu_online(pr->id)) {
+			return_VALUE(-EINVAL);
+		}
+		arch_unregister_cpu(pr->id);
+		acpi_unmap_lsapic(pr->id);
+	}
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
 	/* Unregister the idle handler when processor #0 is removed. */
 	if (pr->id == 0) {
 		pm_idle = pm_idle_save;
@@ -2431,7 +2476,7 @@ acpi_processor_remove (
 		acpi_processor_notify);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-			"Error removing notify handler\n"));
+			"Error removing device notify handler\n"));
 	}
 
 	acpi_processor_remove_fs(device);
@@ -2444,6 +2489,291 @@ acpi_processor_remove (
 }
 
 
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+/****************************************************************************
+ * 	Acpi processor hotplug support 				       	    *
+ ****************************************************************************/
+
+static int is_processor_present(acpi_handle handle);
+
+static int
+processor_run_sbin_hotplug(struct acpi_device *device,
+	       int cpu, char *action)
+{
+	char *argv[3], *envp[7], action_str[32], cpu_str[15];
+	int i, ret;
+	int len;
+	char pathname[ACPI_PATHNAME_MAX] = {0};
+	acpi_status status;
+	char *processor_str;
+	struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
+
+	ACPI_FUNCTION_TRACE("processor_run_sbin_hotplug");
+
+
+	status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
+	if (ACPI_FAILURE(status)) {
+		return(-ENODEV);
+	}
+
+	len = strlen("PROCESSOR=") + strlen(pathname) + 1;
+	processor_str = kmalloc(len, GFP_KERNEL);
+	if (!processor_str)
+		return(-ENOMEM);
+
+	sprintf(processor_str, "PROCESSOR=%s",pathname);
+	sprintf(action_str, "ACTION=%s", action);
+	sprintf(cpu_str, "CPU=%d", cpu);
+
+	i = 0;
+	argv[i++] = hotplug_path;
+	argv[i++] = "cpu";
+	argv[i] = NULL;
+
+	i = 0;
+	envp[i++] = "HOME=/";
+	envp[i++] = "PATH=/sbin;/bin;/usr/sbin;/usr/bin";
+	envp[i++] = action_str;
+	envp[i++] = processor_str;
+	envp[i++] = cpu_str;
+	envp[i++] = "PLATFORM=ACPI";
+	envp[i] = NULL;
+
+	ret = call_usermodehelper(argv[0], argv, envp, 0);
+
+	kfree(processor_str);
+	return_VALUE(ret);
+}
+
+
+static int
+is_processor_present(
+	acpi_handle handle)
+{
+	acpi_status 		status;
+	unsigned long		sta = 0;
+
+	ACPI_FUNCTION_TRACE("is_processor_present");
+
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"Processor Device is not present\n"));
+		return_VALUE(0);
+	}
+	return_VALUE(1);
+}
+
+
+static
+int acpi_processor_device_add(
+	acpi_handle	handle,
+	struct acpi_device **device)
+{
+	acpi_handle		phandle;
+	struct acpi_device 	*pdev;
+	struct acpi_processor	*pr;
+
+	ACPI_FUNCTION_TRACE("acpi_processor_device_add");
+
+	if (acpi_get_parent(handle, &phandle)) {
+		return_VALUE(-ENODEV);
+	}
+
+	if (acpi_bus_get_device(phandle, &pdev)) {
+		return_VALUE(-ENODEV);
+	}
+
+	if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) {
+		return_VALUE(-ENODEV);
+	}
+
+	acpi_bus_scan(*device);
+
+	pr = acpi_driver_data(*device);
+	if (!pr)
+		return_VALUE(-ENODEV);
+
+	if ((pr->id >=0) && (pr->id < NR_CPUS)) {
+		processor_run_sbin_hotplug(*device, pr->id, "add");
+	}
+	return_VALUE(0);
+}
+
+
+static void
+acpi_processor_hotplug_notify (
+	acpi_handle		handle,
+	u32			event,
+	void			*data)
+{
+	struct acpi_processor	*pr;
+	struct acpi_device	*device = NULL;
+	int result;
+
+	ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify");
+
+	switch (event) {
+	case ACPI_NOTIFY_BUS_CHECK:
+	case ACPI_NOTIFY_DEVICE_CHECK:
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			"received %s\n", (event==ACPI_NOTIFY_BUS_CHECK)?
+			"ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK"));
+
+		if (!is_processor_present(handle))
+			break;
+
+		if (acpi_bus_get_device(handle, &device)) {
+			result = acpi_processor_device_add(handle, &device);
+			if (result)
+				ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					"Unable to add the device\n"));
+			break;
+		}
+
+		pr = acpi_driver_data(device);
+		if (!pr) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				"Driver data is NULL\n"));
+			break;
+		}
+		
+		if (pr->id >= 0 && (pr->id < NR_CPUS)) {
+			processor_run_sbin_hotplug(device, pr->id, "remove");
+			break;
+		}
+
+		result = acpi_processor_start(device);
+		if ((!result) && ((pr->id >=0) && (pr->id < NR_CPUS))) {
+			processor_run_sbin_hotplug(device, pr->id, "add");
+		} else {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				"Device [%s] failed to start\n",
+				acpi_device_bid(device)));
+		}
+	break;
+	case ACPI_NOTIFY_EJECT_REQUEST:
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,"received ACPI_NOTIFY_EJECT_REQUEST\n"));
+
+		if (acpi_bus_get_device(handle, &device)) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Device don't exist, dropping EJECT\n"));
+			break;
+		}
+		pr = acpi_driver_data(device);
+		if (!pr) {
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Driver data is NULL, dropping EJECT\n"));
+			return_VOID;
+		}
+
+		if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
+			processor_run_sbin_hotplug(device, pr->id, "remove");
+		break;
+	default:
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+			"Unsupported event [0x%x]\n", event));
+		break;
+	}
+
+	return_VOID;
+}
+
+static acpi_status
+processor_walk_namespace_cb(acpi_handle handle,
+	u32 lvl,
+	void *context,
+	void **rv)
+{
+	acpi_status 			status;
+	int *action = context;
+	acpi_object_type	type = 0;
+
+	status = acpi_get_type(handle, &type);
+	if (ACPI_FAILURE(status))
+		return(AE_OK);
+
+	if (type != ACPI_TYPE_PROCESSOR)
+		return(AE_OK);
+
+	switch(*action) {
+	case INSTALL_NOTIFY_HANDLER:
+		acpi_install_notify_handler(handle,
+			ACPI_SYSTEM_NOTIFY,
+			acpi_processor_hotplug_notify,
+			NULL);
+		break;
+	case UNINSTALL_NOTIFY_HANDLER:
+		acpi_remove_notify_handler(handle,
+			ACPI_SYSTEM_NOTIFY,
+			acpi_processor_hotplug_notify);
+		break;
+	default:
+		break;
+	}
+
+	return(AE_OK);
+}
+
+
+static acpi_status
+acpi_processor_hotadd_init(
+	acpi_handle		handle,
+	int			*p_cpu)
+{
+	ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init");
+	
+	if (!is_processor_present(handle)) {
+		return_VALUE(AE_ERROR);
+	}
+
+	if (acpi_map_lsapic(handle, p_cpu))
+		return_VALUE(AE_ERROR);
+
+	if (arch_register_cpu(*p_cpu)) {
+		acpi_unmap_lsapic(*p_cpu);
+		return_VALUE(AE_ERROR);
+	}
+
+	return_VALUE(AE_OK);
+}
+#else
+static acpi_status
+acpi_processor_hotadd_init(
+	acpi_handle		handle,
+	int			*p_cpu)
+{
+	return AE_ERROR;
+}
+#endif
+
+
+static
+void acpi_processor_install_hotplug_notify(void)
+{
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+	int action = INSTALL_NOTIFY_HANDLER;
+	acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
+				     ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX,
+				     processor_walk_namespace_cb,
+				     &action, NULL);
+#endif
+}
+
+
+static
+void acpi_processor_uninstall_hotplug_notify(void)
+{
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+	int action = UNINSTALL_NOTIFY_HANDLER;
+	acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
+				     ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX,
+				     processor_walk_namespace_cb,
+				     &action, NULL);
+#endif
+}
+
+
 static int __init
 acpi_processor_init (void)
 {
@@ -2465,6 +2795,8 @@ acpi_processor_init (void)
 		return_VALUE(-ENODEV);
 	}
 
+	acpi_processor_install_hotplug_notify();
+
 	acpi_thermal_cpufreq_init();
 
 	acpi_processor_ppc_init();
@@ -2482,6 +2814,8 @@ acpi_processor_exit (void)
 
 	acpi_thermal_cpufreq_exit();
 
+	acpi_processor_uninstall_hotplug_notify();
+
 	acpi_bus_unregister_driver(&acpi_processor_driver);
 
 	remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 6/6]ACPI based Physical CPU hotplug
       [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
                   ` (4 preceding siblings ...)
  2004-09-09  1:40 ` [PATCH 5/6]ACPI " Keshavamurthy Anil S
@ 2004-09-09  1:41 ` Keshavamurthy Anil S
       [not found]   ` <20040908184152.D7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
  5 siblings, 1 reply; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09  1:41 UTC (permalink / raw)
  To: ACPI Developer, LHNS list; +Cc: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w



---
Name:container_drv.patch
Status: Tested on 2.6.9-rc1-mm2
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Depends:	
Version: applies on 2.6.9-rc1-mm2
Description:
This is the very early version on the Container driver which supports
hotplug notifications on ACPI004, PNP0A05 and PNP0A06 devices.
---

 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Kconfig     |   10 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Makefile    |    1 
 linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/container.c |  341 ++++++++++++++++++
 linux-2.6.9-rc1-mm2-askeshav/include/acpi/container.h |   13 
 4 files changed, 364 insertions(+), 1 deletion(-)

diff -puN drivers/acpi/Kconfig~container_drv drivers/acpi/Kconfig
--- linux-2.6.9-rc1-mm2/drivers/acpi/Kconfig~container_drv	2004-09-08 16:42:29.741133406 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Kconfig	2004-09-08 16:42:29.832930280 -0700
@@ -100,6 +100,7 @@ config ACPI_HOTPLUG_CPU
 	bool "Processor Hotplug (EXPERIMENTAL)"
 	depends on ACPI_PROCESSOR && HOTPLUG_CPU
 	depends on !IA64_SGI_SN
+	select ACPI_CONTAINER
 	default n
 	 ---help---
 	 Select this option if your platform support physical CPU hotplug.
@@ -224,5 +225,12 @@ config X86_PM_TIMER
 	  kernel logs, and/or you are using this on a notebook which
 	  does not yet have an HPET, you should say "Y" here.
 
-endmenu
+config ACPI_CONTAINER
+	tristate "ACPI004,PNP0A05 and PNP0A06 Container Driver"
+	depends on (ACPI)
+	default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
+	 ---help---
+	 	This is the ACPI generic container driver which supports
+		ACPI004, PNP0A05 and PNP0A06 devices
 
+endmenu
diff -puN drivers/acpi/Makefile~container_drv drivers/acpi/Makefile
--- linux-2.6.9-rc1-mm2/drivers/acpi/Makefile~container_drv	2004-09-08 16:42:29.745039656 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/Makefile	2004-09-08 16:42:29.832930280 -0700
@@ -41,6 +41,7 @@ obj-$(CONFIG_ACPI_FAN)		+= fan.o
 obj-$(CONFIG_ACPI_PCI)		+= pci_root.o pci_link.o pci_irq.o pci_bind.o
 obj-y				+= power.o
 obj-$(CONFIG_ACPI_PROCESSOR)	+= processor.o
+obj-$(CONFIG_ACPI_CONTAINER)	+= container.o
 obj-$(CONFIG_ACPI_THERMAL)	+= thermal.o
 obj-$(CONFIG_ACPI_DEBUG)	+= system.o
 obj-y				+= event.o
diff -puN /dev/null include/acpi/container.h
--- /dev/null	2004-06-30 13:03:36.000000000 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/include/acpi/container.h	2004-09-08 16:42:29.833906843 -0700
@@ -0,0 +1,13 @@
+#ifndef __ACPI_CONTAINER_H
+#define __ACPI_CONTAINER_H
+
+#include <linux/kernel.h>
+
+struct acpi_container {
+	acpi_handle handle;
+	unsigned long sun;
+	int state;
+};
+
+#endif /* __ACPI_CONTAINER_H */
+
diff -puN /dev/null drivers/acpi/container.c
--- /dev/null	2004-06-30 13:03:36.000000000 -0700
+++ linux-2.6.9-rc1-mm2-askeshav/drivers/acpi/container.c	2004-09-08 16:42:29.835859968 -0700
@@ -0,0 +1,341 @@
+/*
+ * acpi_container.c  - ACPI Generic Container Driver
+ * ($Revision: )
+ *
+ * Copyright (C) 2004 Anil S Keshavamurthy (anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org)
+ * Copyright (C) 2004 Keiichiro Tokunaga (tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org)
+ * Copyright (C) 2004 Motoyuki Ito (motoyuki-tPnzhWqfZ96MLkP6nYsO9A@public.gmane.org)
+ * Copyright (C) 2004 Intel Corp.
+ * Copyright (C) 2004 FUJITSU LIMITED
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/acpi.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_drivers.h>
+#include <acpi/container.h>
+
+#define ACPI_CONTAINER_DRIVER_NAME	"ACPI container driver"
+#define ACPI_CONTAINER_DEVICE_NAME	"ACPI container device"
+#define ACPI_CONTAINER_CLASS		"container"
+
+#define INSTALL_NOTIFY_HANDLER		1
+#define UNINSTALL_NOTIFY_HANDLER	2
+
+#define ACPI_CONTAINER_COMPONENT	0x01000000
+#define _COMPONENT			ACPI_CONTAINER_COMPONENT
+ACPI_MODULE_NAME			("acpi_container")
+
+MODULE_AUTHOR("Anil S Keshavamurthy");
+MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
+MODULE_LICENSE("GPL");
+
+#define ACPI_STA_PRESENT		(0x00000001)
+
+static int acpi_container_add(struct acpi_device *device);
+static int acpi_container_remove(struct acpi_device *device, int type);
+
+static struct acpi_driver acpi_container_driver = {
+	.name =		ACPI_CONTAINER_DRIVER_NAME,
+	.class =	ACPI_CONTAINER_CLASS,
+	.ids =		"ACPI004,PNP0A05,PNP0A06",
+	.ops =		{
+				.add =		acpi_container_add,
+				.remove =	acpi_container_remove,
+			},
+};
+
+
+/*******************************************************************/
+
+static int
+is_device_present(acpi_handle handle)
+{
+	acpi_handle		temp;
+	acpi_status		status;
+	unsigned long	sta;
+
+	ACPI_FUNCTION_TRACE("is_device_present");
+
+	status = acpi_get_handle(handle, "_STA", &temp);
+	if (ACPI_FAILURE(status))
+		return_VALUE(1); /* _STA not found, assmue device present */
+
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status))
+		return_VALUE(0); /* Firmware error */
+
+	return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
+}
+
+/*******************************************************************/
+static int
+acpi_container_add(struct acpi_device *device)
+{
+	struct acpi_container *container;
+
+	ACPI_FUNCTION_TRACE("acpi_container_add");
+
+	if (!device) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n"));
+		return_VALUE(-EINVAL);
+	}
+
+	container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
+	if(!container)
+		return_VALUE(-ENOMEM);
+	
+	memset(container, 0, sizeof(struct acpi_container));
+	container->handle = device->handle;
+	strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
+	acpi_driver_data(device) = container;
+
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",	\
+		acpi_device_name(device), acpi_device_bid(device)));
+
+
+	return_VALUE(0);
+}
+
+static int
+acpi_container_remove(struct acpi_device *device, int type)
+{
+	acpi_status		status = AE_OK;
+	struct acpi_container	*pc = NULL;
+	pc = (struct acpi_container*) acpi_driver_data(device);
+
+	if (pc)
+		kfree(pc);
+
+	return status;
+}
+
+
+static int
+container_run_sbin_hotplug(struct acpi_device *device, char *action)
+{
+	char *argv[3], *envp[6], action_str[32];
+	int i, ret;
+	int len;
+	char pathname[ACPI_PATHNAME_MAX] = {0};
+	acpi_status status;
+	char *container_str;
+	struct acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
+
+	ACPI_FUNCTION_TRACE("container_run_sbin_hotplug");
+
+
+	status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
+	if (ACPI_FAILURE(status)) {
+		return(-ENODEV);
+	}
+
+	len = strlen("CONTAINER=") + strlen(pathname) + 1;
+	container_str = kmalloc(len, GFP_KERNEL);
+	if (!container_str)
+		return(-ENOMEM);
+
+	sprintf(container_str, "CONTAINER=%s",pathname);
+	sprintf(action_str, "ACTION=%s", action);
+
+	i = 0;
+	argv[i++] = hotplug_path;
+	argv[i++] = "container";
+	argv[i] = NULL;
+
+	i = 0;
+	envp[i++] = "HOME=/";
+	envp[i++] = "PATH=/sbin;/bin;/usr/sbin;/usr/bin";
+	envp[i++] = action_str;
+	envp[i++] = container_str;
+	envp[i++] = "PLATFORM=ACPI";
+	envp[i] = NULL;
+
+	ret = call_usermodehelper(argv[0], argv, envp, 0);
+
+	kfree(container_str);
+	return_VALUE(ret);
+}
+
+static int
+container_device_add(struct acpi_device **device, acpi_handle handle)
+{
+	acpi_handle phandle;
+	struct acpi_device *pdev;
+	int result;
+
+	ACPI_FUNCTION_TRACE("container_device_add");
+
+	if (acpi_get_parent(handle, &phandle)) {
+		return_VALUE(-ENODEV);
+	}
+
+	if (acpi_bus_get_device(phandle, &pdev)) {
+		return_VALUE(-ENODEV);
+	}
+
+	if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
+		return_VALUE(-ENODEV);
+	}
+
+	result = acpi_bus_scan(*device);
+
+	return_VALUE(result);
+}
+
+static void
+container_notify_cb(acpi_handle handle, u32 type, void *context)
+{
+	struct acpi_device		*device = NULL;
+	int result;
+	int present;
+	acpi_status status;
+
+	ACPI_FUNCTION_TRACE("container_notify_cb");
+
+	present = is_device_present(handle);
+	
+	switch (type) {
+	case ACPI_NOTIFY_BUS_CHECK:
+		/* Fall through */
+	case ACPI_NOTIFY_DEVICE_CHECK:
+		if (present) {
+			status = acpi_bus_get_device(handle, &device);
+			if (ACPI_FAILURE(status) || !device) {
+				result = container_device_add(&device, handle);
+				if (!result)
+					container_run_sbin_hotplug(device, "add");
+			} else {
+				/* device exist and this is a remove request */
+				container_run_sbin_hotplug(device, "remove");
+			}
+		}
+		break;
+	case ACPI_NOTIFY_EJECT_REQUEST:
+		if (!acpi_bus_get_device(handle, &device) && device) {
+			container_run_sbin_hotplug(device, "remove");
+		}
+		break;
+	default:
+		break;
+	}
+	return_VOID;
+}
+
+static acpi_status
+container_walk_namespace_cb(acpi_handle handle,
+	u32 lvl,
+	void *context,
+	void **rv)
+{
+	char 				*hid = NULL;
+	struct acpi_buffer 		buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_device_info 	*info;
+	acpi_status 			status;
+	int 				*action = context;
+
+	ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
+
+	status = acpi_get_object_info(handle, &buffer);
+	if (ACPI_FAILURE(status) || !buffer.pointer) {
+		return_ACPI_STATUS(AE_OK);
+	}
+
+	info = buffer.pointer;
+	if (info->valid & ACPI_VALID_HID)
+		hid = info->hardware_id.value;
+
+	if (hid == NULL) {
+		goto end;
+	}
+
+	if (strcmp(hid, "ACPI004") && strcmp(hid, "PNP0A05") &&
+			strcmp(hid, "PNP0A06")) {
+		goto end;
+	}
+
+	switch(*action) {
+	case INSTALL_NOTIFY_HANDLER:
+		acpi_install_notify_handler(handle,
+			ACPI_SYSTEM_NOTIFY,
+			container_notify_cb,
+			NULL);
+		break;
+	case UNINSTALL_NOTIFY_HANDLER:
+		acpi_remove_notify_handler(handle,
+			ACPI_SYSTEM_NOTIFY,
+			container_notify_cb);
+		break;
+	default:
+		break;
+	}
+
+end:
+	acpi_os_free(buffer.pointer);
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+int __init
+acpi_container_init(void)
+{
+	int	result = 0;
+	int	action = INSTALL_NOTIFY_HANDLER;
+
+	result = acpi_bus_register_driver(&acpi_container_driver);
+	if (result < 0) {
+		return(result);
+	}
+
+	/* register notify handler to every container device */
+	acpi_walk_namespace(ACPI_TYPE_DEVICE,
+				     ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX,
+				     container_walk_namespace_cb,
+				     &action, NULL);
+
+	return(0);
+}
+
+void __exit
+acpi_container_exit(void)
+{
+	int			action = UNINSTALL_NOTIFY_HANDLER;
+
+	ACPI_FUNCTION_TRACE("acpi_container_exit");
+
+	acpi_walk_namespace(ACPI_TYPE_DEVICE,
+				     ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX,
+				     container_walk_namespace_cb,
+				     &action, NULL);
+
+	acpi_bus_unregister_driver(&acpi_container_driver);
+
+	return_VOID;
+}
+
+module_init(acpi_container_init);
+module_exit(acpi_container_exit);
_


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH 5/6]ACPI based Physical CPU hotplug
       [not found]   ` <20040908184011.C7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
@ 2004-09-09 20:40     ` Mika Penttilä
       [not found]       ` <4140BFA3.1070508-9Aww8k/80nUxHbG02/KK1g@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Penttilä @ 2004-09-09 20:40 UTC (permalink / raw)
  To: Keshavamurthy Anil S; +Cc: LHNS list, ACPI Developer

I don't see how the acpi_processor_start() stuff (which was formerly in 
acpi_processor_add()) gets executed in the plain non-hotplug case. It's 
only called from the hotplug notifications.

--Mika



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH 5/6]ACPI based Physical CPU hotplug
       [not found]       ` <4140BFA3.1070508-9Aww8k/80nUxHbG02/KK1g@public.gmane.org>
@ 2004-09-09 21:18         ` Keshavamurthy Anil S
  0 siblings, 0 replies; 10+ messages in thread
From: Keshavamurthy Anil S @ 2004-09-09 21:18 UTC (permalink / raw)
  To: Mika Penttil?; +Cc: Keshavamurthy Anil S, LHNS list, ACPI Developer

On Thu, Sep 09, 2004 at 11:40:03PM +0300, Mika Penttil? wrote:
> I don't see how the acpi_processor_start() stuff (which was formerly in 
> acpi_processor_add()) gets executed in the plain non-hotplug case. It's 
> only called from the hotplug notifications.
Hi Mika,
	Firstly thanks for your time looking at the code and let me clarify you concerns.
If you look at acpi_bus_driver_init() function from where the ops.add() is getting called, 
once the ops.add() gets passed, and if the driver has .start function defined 
then ops.start() is called. In our case the processor driver is setting
.start to acpi_processor_start function in its acpi_processor_driver structure.

Let me know if you have any other concerns.

Thanks,
Anil Keshavamurthy



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Lhns-devel] Re: [PATCH 6/6]ACPI based Physical CPU hotplug
       [not found]   ` <20040908184152.D7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
@ 2004-09-13  1:18     ` Keiichiro Tokunaga
       [not found]       ` <20040913101834.65490902.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Keiichiro Tokunaga @ 2004-09-13  1:18 UTC (permalink / raw)
  To: Keshavamurthy Anil S
  Cc: tokunaga.keiich-+CUm20s59erQFUHtdCDX3A,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	lhns-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Wed, 08 Sep 2004 18:41:52 -0700 Keshavamurthy Anil S wrote:
> ---
> Name:container_drv.patch
> Status: Tested on 2.6.9-rc1-mm2
> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Depends:	
> Version: applies on 2.6.9-rc1-mm2
> Description:
> This is the very early version on the Container driver which supports
> hotplug notifications on ACPI004, PNP0A05 and PNP0A06 devices.

Here is a typo fix.  The HID 'ACPI004' should be 'ACPI0004':)

Thanks,
Keiichiro Tokunaga


Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

---

 linux-2.6.9-rc1-mm3-kei/drivers/acpi/container.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/acpi/container.c~fix-acpi0004 drivers/acpi/container.c
--- linux-2.6.9-rc1-mm3/drivers/acpi/container.c~fix-acpi0004	2004-09-13 10:04:42.183606664 +0900
+++ linux-2.6.9-rc1-mm3-kei/drivers/acpi/container.c	2004-09-13 10:05:02.951325835 +0900
@@ -58,7 +58,7 @@ static int acpi_container_remove(struct 
 static struct acpi_driver acpi_container_driver = {
 	.name =		ACPI_CONTAINER_DRIVER_NAME,
 	.class =	ACPI_CONTAINER_CLASS,
-	.ids =		"ACPI004,PNP0A05,PNP0A06",
+	.ids =		"ACPI0004,PNP0A05,PNP0A06",
 	.ops =		{
 				.add =		acpi_container_add,
 				.remove =	acpi_container_remove,
@@ -270,7 +270,7 @@ container_walk_namespace_cb(acpi_handle 
 		goto end;
 	}
 
-	if (strcmp(hid, "ACPI004") && strcmp(hid, "PNP0A05") &&
+	if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
 			strcmp(hid, "PNP0A06")) {
 		goto end;
 	}

_


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Lhns-devel] Re: [PATCH 6/6]ACPI based Physical CPU hotplug
       [not found]       ` <20040913101834.65490902.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
@ 2004-09-14  7:57         ` Keiichiro Tokunaga
  0 siblings, 0 replies; 10+ messages in thread
From: Keiichiro Tokunaga @ 2004-09-14  7:57 UTC (permalink / raw)
  To: anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w
  Cc: tokunaga.keiich-+CUm20s59erQFUHtdCDX3A,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	lhns-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, 13 Sep 2004 10:18:34 +0900 Keiichiro Tokunaga wrote:
> On Wed, 08 Sep 2004 18:41:52 -0700 Keshavamurthy Anil S wrote:
> > ---
> > Name:container_drv.patch
> > Status: Tested on 2.6.9-rc1-mm2
> > Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Depends:	
> > Version: applies on 2.6.9-rc1-mm2
> > Description:
> > This is the very early version on the Container driver which supports
> > hotplug notifications on ACPI004, PNP0A05 and PNP0A06 devices.
> 
> Here is a typo fix.  The HID 'ACPI004' should be 'ACPI0004':)

I found two more typos in drivers/acpi/Kconfig:)  Here is an
updated patch.

Thanks,
Keiichiro Tokunaga


Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

---

 linux-2.6.9-rc1-mm3-kei/drivers/acpi/Kconfig     |    4 ++--
 linux-2.6.9-rc1-mm3-kei/drivers/acpi/container.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -puN drivers/acpi/container.c~fix-acpi0004 drivers/acpi/container.c
--- linux-2.6.9-rc1-mm3/drivers/acpi/container.c~fix-acpi0004	2004-09-14 09:21:44.105042495 +0900
+++ linux-2.6.9-rc1-mm3-kei/drivers/acpi/container.c	2004-09-14 09:21:44.106019063 +0900
@@ -58,7 +58,7 @@ static int acpi_container_remove(struct 
 static struct acpi_driver acpi_container_driver = {
 	.name =		ACPI_CONTAINER_DRIVER_NAME,
 	.class =	ACPI_CONTAINER_CLASS,
-	.ids =		"ACPI004,PNP0A05,PNP0A06",
+	.ids =		"ACPI0004,PNP0A05,PNP0A06",
 	.ops =		{
 				.add =		acpi_container_add,
 				.remove =	acpi_container_remove,
@@ -270,7 +270,7 @@ container_walk_namespace_cb(acpi_handle 
 		goto end;
 	}
 
-	if (strcmp(hid, "ACPI004") && strcmp(hid, "PNP0A05") &&
+	if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
 			strcmp(hid, "PNP0A06")) {
 		goto end;
 	}
diff -puN drivers/acpi/Kconfig~fix-acpi0004 drivers/acpi/Kconfig
--- linux-2.6.9-rc1-mm3/drivers/acpi/Kconfig~fix-acpi0004	2004-09-14 16:03:54.646284767 +0900
+++ linux-2.6.9-rc1-mm3-kei/drivers/acpi/Kconfig	2004-09-14 16:04:19.225512452 +0900
@@ -317,11 +317,11 @@ config ACPI_SCI_EMULATE
 	  device object name).
 
 config ACPI_CONTAINER
-	tristate "ACPI004,PNP0A05 and PNP0A06 Container Driver"
+	tristate "ACPI0004, PNP0A05 and PNP0A06 Container Driver"
 	depends on (ACPI)
 	default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
 	 ---help---
 	 	This is the ACPI generic container driver which supports
-		ACPI004, PNP0A05 and PNP0A06 devices
+		ACPI0004, PNP0A05 and PNP0A06 devices
 
 endmenu

_


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-09-14  7:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <44BDAFB888F59F408FAE3CC35AB47041B17999@orsmsx409>
2004-09-09  1:21 ` [PATCH 1/6]ACPI based Physical CPU hotplug Keshavamurthy Anil S
2004-09-09  1:24 ` [PATCH 2/6]ACPI " Keshavamurthy Anil S
2004-09-09  1:35 ` [PATCH 3/6]ACPI " Keshavamurthy Anil S
2004-09-09  1:37 ` [PATCH 4/6]ACPI " Keshavamurthy Anil S
2004-09-09  1:40 ` [PATCH 5/6]ACPI " Keshavamurthy Anil S
     [not found]   ` <20040908184011.C7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2004-09-09 20:40     ` Mika Penttilä
     [not found]       ` <4140BFA3.1070508-9Aww8k/80nUxHbG02/KK1g@public.gmane.org>
2004-09-09 21:18         ` Keshavamurthy Anil S
2004-09-09  1:41 ` [PATCH 6/6]ACPI " Keshavamurthy Anil S
     [not found]   ` <20040908184152.D7384-39QZ/XbsZ5/mO6KZMuUCQVaTQe2KTcn/@public.gmane.org>
2004-09-13  1:18     ` [Lhns-devel] " Keiichiro Tokunaga
     [not found]       ` <20040913101834.65490902.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-14  7:57         ` Keiichiro Tokunaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox