Skip to contentSkip to conversation

ACPI processor _HID cleanups

PATCH Applied Bjorn Helgaas 2 participants 5 messages Apr 27, 2009 – May 28, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ACPI processor _HID cleanups

---

Bjorn Helgaas (3):
ACPI: processor: move device _HID into driver
ACPI: processor: check for synthetic _HID, default to "Device" declaration
ACPI: use LNXCPU, not ACPI_CPU, for Linux-specific processor _HID

 drivers/acpi/processor_core.c |   32 ++++++++++++++++----------------
 include/acpi/acpi_drivers.h   |    3 +--
 2 files changed, 17 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/3 ACPI: use LNXCPU, not ACPI_CPU, for Linux-specific processor _HID

ACPI_PROCESSOR_OBJECT_HID is a synthetic _HID that Linux generates for "Processor" definitions. Unlike "Device" definitions, "Processor" definitions do not have a _HID in the namespace, so we generate a fake _HID. By convention, all these fake _HIDs begin with "LNX".

This does change the user-visible _HID for "Processor" objects -- previously, we used "ACPI_CPU" and this changes that to "LNXCPU", which starts with "LNX" as do all the other made-up _HIDs. This change is visible in processor filenames and "hid" files under /sys/devices/LNXSYSTM:00/.

---
 include/acpi/acpi_drivers.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpi_drivers.h +1 -1
index 0352c8f..c9922b3 100644
@@ -57,7 +57,7 @@
  */
 
 #define ACPI_POWER_HID			"LNXPOWER"
-#define ACPI_PROCESSOR_OBJECT_HID	"ACPI_CPU"
+#define ACPI_PROCESSOR_OBJECT_HID	"LNXCPU"
 #define ACPI_PROCESSOR_HID		"ACPI0007"
 #define ACPI_SYSTEM_HID			"LNXSYSTM"
 #define ACPI_THERMAL_HID		"LNXTHERM"
#2 lore raw

PATCH 2/3 ACPI: processor: check for synthetic _HID, default to "Device" declaration

In reply to Bjorn Helgaas

This patch inverts the logic that distinguishes "Processor" statements from "Device" statements, so we now check explicitly for "Processor" and default to "Device". This removes the only real use of ACPI_PROCESSOR_HID, so we can then remove the #define. It also has the theoretical advantage that if a new processor _HID were ever added, we wouldn't have to change the code here.

---
 drivers/acpi/processor_core.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
drivers/acpi/processor_core.c +15 -15
index 45ad328..cf627d6 100644
@@ -596,7 +596,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "No bus mastering arbitration control\n"));
 
-	if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) {
+	if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
+		/* Declared with "Processor" statement; match ProcessorID */
+		status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
+		if (ACPI_FAILURE(status)) {
+			printk(KERN_ERR PREFIX "Evaluating processor object\n");
+			return -ENODEV;
+		}
+
+		/*
+		 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
+		 *      >>> 'acpi_get_processor_id(acpi_id, &id)' in
+		 *      arch/xxx/acpi.c
+		 */
+		pr->acpi_id = object.processor.proc_id;
+	} else {
 		/*
 		 * Declared with "Device" statement; match _UID.
 		 * Note that we don't handle string _UIDs yet.
@@ -611,20 +625,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
 		}
 		device_declaration = 1;
 		pr->acpi_id = value;
-	} else {
-		/* Declared with "Processor" statement; match ProcessorID */
-		status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
-		if (ACPI_FAILURE(status)) {
-			printk(KERN_ERR PREFIX "Evaluating processor object\n");
-			return -ENODEV;
-		}
-
-		/*
-		 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
-		 *      >>> 'acpi_get_processor_id(acpi_id, &id)' in
-		 *      arch/xxx/acpi.c
-		 */
-		pr->acpi_id = object.processor.proc_id;
 	}
 	cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id);
 
#3 lore raw

PATCH 3/3 ACPI: processor: move device _HID into driver

In reply to Bjorn Helgaas

The ACPI0007 _HID used for processor "Device" objects in the namespace is not needed outside the processor driver, so move it there. Also, the #define is only used once, so just remove it and hard-code "ACPI0007".

---
 drivers/acpi/processor_core.c |    2 +-
 include/acpi/acpi_drivers.h   |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/acpi/processor_core.c +1 -1
index cf627d6..cabff4c 100644
@@ -89,7 +89,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr);
 
 static const struct acpi_device_id processor_device_ids[] = {
 	{ACPI_PROCESSOR_OBJECT_HID, 0},
-	{ACPI_PROCESSOR_HID, 0},
+	{"ACPI0007", 0},
 	{"", 0},
 };
 MODULE_DEVICE_TABLE(acpi, processor_device_ids);
include/acpi/acpi_drivers.h +0 -1
index c9922b3..5e8ed3a 100644
@@ -58,7 +58,6 @@
 
 #define ACPI_POWER_HID			"LNXPOWER"
 #define ACPI_PROCESSOR_OBJECT_HID	"LNXCPU"
-#define ACPI_PROCESSOR_HID		"ACPI0007"
 #define ACPI_SYSTEM_HID			"LNXSYSTM"
 #define ACPI_THERMAL_HID		"LNXTHERM"
 #define ACPI_BUTTON_HID_POWERF		"LNXPWRBN"
reviewer Applied
#4 lore raw
In reply to Bjorn Helgaas

applied

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 16 lines · Bjorn Helgaas

---

Bjorn Helgaas (3):
ACPI: processor: move device _HID into driver
ACPI: processor: check for synthetic _HID, default to "Device" declaration
ACPI: use LNXCPU, not ACPI_CPU, for Linux-specific processor _HID

 drivers/acpi/processor_core.c |   32 ++++++++++++++++----------------
 include/acpi/acpi_drivers.h   |    3 +--
 2 files changed, 17 insertions(+), 18 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html