diff mbox

acpi: handle ACPI0007 Device in acpi_early_set_pdc

Message ID 4C931714.2080905@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Yinghai Lu Sept. 17, 2010, 7:21 a.m. UTC
None
diff mbox

Patch

Index: linux-2.6/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.orig/drivers/acpi/processor_core.c
+++ linux-2.6/drivers/acpi/processor_core.c
@@ -189,7 +189,7 @@  int acpi_get_cpuid(acpi_handle handle, i
 EXPORT_SYMBOL_GPL(acpi_get_cpuid);
 #endif
 
-static bool processor_physically_present(acpi_handle handle)
+static bool is_processor_and_physically_present(acpi_handle handle)
 {
 	int cpuid, type;
 	u32 acpi_id;
@@ -211,6 +211,8 @@  static bool processor_physically_present
 		acpi_id = object.processor.proc_id;
 		break;
 	case ACPI_TYPE_DEVICE:
+		if (acpi_match_device_hid(handle, "ACPI0007") != AE_OK)
+			return false;
 		status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp);
 		if (ACPI_FAILURE(status))
 			return false;
@@ -334,7 +336,7 @@  EXPORT_SYMBOL_GPL(acpi_processor_set_pdc
 static acpi_status
 early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
-	if (processor_physically_present(handle) == false)
+	if (is_processor_and_physically_present(handle) == false)
 		return AE_OK;
 
 	acpi_processor_set_pdc(handle);
@@ -349,7 +351,7 @@  void __init acpi_early_processor_set_pdc
 	 */
 	dmi_check_system(processor_idle_dmi_table);
 
-	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
+	acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
 			    ACPI_UINT32_MAX,
 			    early_init_pdc, NULL, NULL, NULL);
 }
Index: linux-2.6/drivers/acpi/acpica/nsxfeval.c
===================================================================
--- linux-2.6.orig/drivers/acpi/acpica/nsxfeval.c
+++ linux-2.6/drivers/acpi/acpica/nsxfeval.c
@@ -642,6 +642,47 @@  acpi_ns_get_device_callback(acpi_handle
 	return (status);
 }
 
+static acpi_status
+acpi_match_device_hid_callback(acpi_handle obj_handle,
+			    u32 nesting_level,
+			    void *context, void **return_value)
+{
+	*return_value = (void *)0xff;
+
+	return AE_OK;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_match_device_hid
+ *
+ * PARAMETERS:  handle and HID to be compared
+ *
+ * RETURN:      AE_OK mean found match one
+ *
+ * DESCRIPTION: check if device coresponding to handle has HID
+ *
+ ******************************************************************************/
+acpi_status acpi_match_device_hid(acpi_handle obj_handle, const char *HID)
+{
+	struct acpi_get_devices_info info;
+	void *return_value = NULL;
+
+	ACPI_FUNCTION_TRACE(acpi_match_device_hid);
+
+	info.hid = HID;
+	info.context = NULL;
+	info.user_function = acpi_match_device_hid_callback;
+
+	acpi_ns_get_device_callback(obj_handle, ACPI_UINT32_MAX,
+				    &info, &return_value);
+
+	if (!return_value)
+		return AE_NOT_FOUND;
+
+	return AE_OK;
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_devices
Index: linux-2.6/include/acpi/acpixf.h
===================================================================
--- linux-2.6.orig/include/acpi/acpixf.h
+++ linux-2.6/include/acpi/acpixf.h
@@ -160,6 +160,8 @@  acpi_walk_namespace(acpi_object_type typ
 		    acpi_walk_callback post_order_visit,
 		    void *context, void **return_value);
 
+acpi_status acpi_match_device_hid(acpi_handle obj_handle, const char *HID);
+
 acpi_status
 acpi_get_devices(const char *HID,
 		 acpi_walk_callback user_function,