Commit 8c8cb30f authored by Dou Liyang's avatar Dou Liyang Committed by Thomas Gleixner

acpi/processor: Implement DEVICE operator for processor enumeration

ACPI allows to declare processors either with the PROCESSOR or with the
DEVICE operator. The current implementation handles only the PROCESSOR
operator.

On a system which uses the DEVICE operator for processor enumeration the
evaluation fails.

Check for the ACPI type of the ACPI handle and evaluate PROCESSOR and
DEVICE types separately.
Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
Tested-by: default avatarXiaolong Ye <xiaolong.ye@intel.com>
Cc: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org
Cc: guzheng1@huawei.com
Cc: izumi.taku@jp.fujitsu.com
Cc: lenb@kernel.org
Link: http://lkml.kernel.org/r/1488528147-2279-5-git-send-email-douly.fnst@cn.fujitsu.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2b85b3d2
...@@ -633,25 +633,50 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle, ...@@ -633,25 +633,50 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle,
void **rv) void **rv)
{ {
acpi_status status; acpi_status status;
acpi_object_type acpi_type;
unsigned long long uid;
union acpi_object object = { 0 }; union acpi_object object = { 0 };
struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
status = acpi_evaluate_object(handle, NULL, NULL, &buffer); status = acpi_get_type(handle, &acpi_type);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
acpi_handle_info(handle, "Not get the processor object\n"); return false;
else
processor_validated_ids_update(object.processor.proc_id); switch (acpi_type) {
case ACPI_TYPE_PROCESSOR:
status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status))
goto err;
uid = object.processor.proc_id;
break;
case ACPI_TYPE_DEVICE:
status = acpi_evaluate_integer(handle, "_UID", NULL, &uid);
if (ACPI_FAILURE(status))
goto err;
break;
default:
goto err;
}
processor_validated_ids_update(uid);
return true;
err:
acpi_handle_info(handle, "Invalid processor object\n");
return false;
return AE_OK;
} }
static void __init acpi_processor_check_duplicates(void) void __init acpi_processor_check_duplicates(void)
{ {
/* Search all processor nodes in ACPI namespace */ /* check the correctness for all processors in ACPI namespace */
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_UINT32_MAX,
acpi_processor_ids_walk, acpi_processor_ids_walk,
NULL, NULL, NULL); NULL, NULL, NULL);
acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk,
NULL, NULL);
} }
bool __init acpi_processor_validate_proc_id(int proc_id) bool __init acpi_processor_validate_proc_id(int proc_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment