ACPI: Rename ACPI processor device bus ID
authorZhao Yakui <yakui.zhao@intel.com>
Wed, 24 Jun 2009 03:46:44 +0000 (11:46 +0800)
committerLen Brown <len.brown@intel.com>
Wed, 24 Jun 2009 05:18:04 +0000 (01:18 -0400)
Some BIOS re-use the same processor bus id
in different scope:

\_SB.SCK0.CPU0
\_SB.SCK1.CPU0

But the (deprecated) /proc/acpi/ interface
assumes the bus-id's are unique, resulting in an OOPS
when the processor driver is loaded:

WARNING: at fs/proc/generic.c:590 proc_register+0x148/0x180()
Hardware name: Sunrise Ridge
proc_dir_entry 'processor/CPU0' already registered
Call Trace:
 [<ffffffff8023f7ef>] warn_slowpath+0xb1/0xe5
 [<ffffffff8036243b>] ? ida_get_new_above+0x190/0x1b1
 [<ffffffff803625a8>] ? idr_pre_get+0x5f/0x75
 [<ffffffff8030b2f6>] proc_register+0x148/0x180
 [<ffffffff8030b4ff>] proc_mkdir_mode+0x3d/0x52
 [<ffffffff8030b525>] proc_mkdir+0x11/0x13
 [<ffffffffa0014b89>] acpi_processor_start+0x755/0x9bc [processor]

Rename the processor device bus id. And the new bus id will be
generated as the following format:
CPU+ CPU ID

For example: If the cpu ID is 5, then the bus ID will be "CPU5".
If the CPU ID is 10, then the bus ID will be "CPUA".

Yes, this will change the directory names seen
in /proc/acpi/processor/* on some systems.
Before this patch, those directory names where
totally arbitrary strings based on the interal AML device strings.

http://bugzilla.kernel.org/show_bug.cgi?id=13612

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/processor_core.c

index 23f0fb8..105562e 100644 (file)
@@ -649,7 +649,16 @@ static int acpi_processor_get_info(struct acpi_device *device)
                        return -ENODEV;
                }
        }
                        return -ENODEV;
                }
        }
-
+       /*
+        * On some boxes several processors use the same processor bus id.
+        * But they are located in different scope. For example:
+        * \_SB.SCK0.CPU0
+        * \_SB.SCK1.CPU0
+        * Rename the processor device bus id. And the new bus id will be
+        * generated as the following format:
+        * CPU+CPU ID.
+        */
+       sprintf(acpi_device_bid(device), "CPU%X", pr->id);
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
                          pr->acpi_id));
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
                          pr->acpi_id));