diff options
Diffstat (limited to 'drivers/acpi/acpi_processor.c')
-rw-r--r-- | drivers/acpi/acpi_processor.c | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 4467a8089ab8..0143135b3abe 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -182,11 +182,6 @@ int __weak arch_register_cpu(int cpu) | |||
182 | 182 | ||
183 | void __weak arch_unregister_cpu(int cpu) {} | 183 | void __weak arch_unregister_cpu(int cpu) {} |
184 | 184 | ||
185 | int __weak acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) | ||
186 | { | ||
187 | return -ENODEV; | ||
188 | } | ||
189 | |||
190 | static int acpi_processor_hotadd_init(struct acpi_processor *pr) | 185 | static int acpi_processor_hotadd_init(struct acpi_processor *pr) |
191 | { | 186 | { |
192 | unsigned long long sta; | 187 | unsigned long long sta; |
@@ -285,6 +280,13 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
285 | pr->acpi_id = value; | 280 | pr->acpi_id = value; |
286 | } | 281 | } |
287 | 282 | ||
283 | if (acpi_duplicate_processor_id(pr->acpi_id)) { | ||
284 | dev_err(&device->dev, | ||
285 | "Failed to get unique processor _UID (0x%x)\n", | ||
286 | pr->acpi_id); | ||
287 | return -ENODEV; | ||
288 | } | ||
289 | |||
288 | pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration, | 290 | pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration, |
289 | pr->acpi_id); | 291 | pr->acpi_id); |
290 | if (invalid_phys_cpuid(pr->phys_id)) | 292 | if (invalid_phys_cpuid(pr->phys_id)) |
@@ -585,7 +587,7 @@ static struct acpi_scan_handler processor_container_handler = { | |||
585 | static int nr_unique_ids __initdata; | 587 | static int nr_unique_ids __initdata; |
586 | 588 | ||
587 | /* The number of the duplicate processor IDs */ | 589 | /* The number of the duplicate processor IDs */ |
588 | static int nr_duplicate_ids __initdata; | 590 | static int nr_duplicate_ids; |
589 | 591 | ||
590 | /* Used to store the unique processor IDs */ | 592 | /* Used to store the unique processor IDs */ |
591 | static int unique_processor_ids[] __initdata = { | 593 | static int unique_processor_ids[] __initdata = { |
@@ -593,7 +595,7 @@ static int unique_processor_ids[] __initdata = { | |||
593 | }; | 595 | }; |
594 | 596 | ||
595 | /* Used to store the duplicate processor IDs */ | 597 | /* Used to store the duplicate processor IDs */ |
596 | static int duplicate_processor_ids[] __initdata = { | 598 | static int duplicate_processor_ids[] = { |
597 | [0 ... NR_CPUS - 1] = -1, | 599 | [0 ... NR_CPUS - 1] = -1, |
598 | }; | 600 | }; |
599 | 601 | ||
@@ -638,28 +640,53 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle, | |||
638 | void **rv) | 640 | void **rv) |
639 | { | 641 | { |
640 | acpi_status status; | 642 | acpi_status status; |
643 | acpi_object_type acpi_type; | ||
644 | unsigned long long uid; | ||
641 | union acpi_object object = { 0 }; | 645 | union acpi_object object = { 0 }; |
642 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 646 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
643 | 647 | ||
644 | status = acpi_evaluate_object(handle, NULL, NULL, &buffer); | 648 | status = acpi_get_type(handle, &acpi_type); |
645 | if (ACPI_FAILURE(status)) | 649 | if (ACPI_FAILURE(status)) |
646 | acpi_handle_info(handle, "Not get the processor object\n"); | 650 | return false; |
647 | else | 651 | |
648 | processor_validated_ids_update(object.processor.proc_id); | 652 | switch (acpi_type) { |
653 | case ACPI_TYPE_PROCESSOR: | ||
654 | status = acpi_evaluate_object(handle, NULL, NULL, &buffer); | ||
655 | if (ACPI_FAILURE(status)) | ||
656 | goto err; | ||
657 | uid = object.processor.proc_id; | ||
658 | break; | ||
659 | |||
660 | case ACPI_TYPE_DEVICE: | ||
661 | status = acpi_evaluate_integer(handle, "_UID", NULL, &uid); | ||
662 | if (ACPI_FAILURE(status)) | ||
663 | goto err; | ||
664 | break; | ||
665 | default: | ||
666 | goto err; | ||
667 | } | ||
668 | |||
669 | processor_validated_ids_update(uid); | ||
670 | return true; | ||
671 | |||
672 | err: | ||
673 | acpi_handle_info(handle, "Invalid processor object\n"); | ||
674 | return false; | ||
649 | 675 | ||
650 | return AE_OK; | ||
651 | } | 676 | } |
652 | 677 | ||
653 | static void __init acpi_processor_check_duplicates(void) | 678 | void __init acpi_processor_check_duplicates(void) |
654 | { | 679 | { |
655 | /* Search all processor nodes in ACPI namespace */ | 680 | /* check the correctness for all processors in ACPI namespace */ |
656 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 681 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
657 | ACPI_UINT32_MAX, | 682 | ACPI_UINT32_MAX, |
658 | acpi_processor_ids_walk, | 683 | acpi_processor_ids_walk, |
659 | NULL, NULL, NULL); | 684 | NULL, NULL, NULL); |
685 | acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk, | ||
686 | NULL, NULL); | ||
660 | } | 687 | } |
661 | 688 | ||
662 | bool __init acpi_processor_validate_proc_id(int proc_id) | 689 | bool acpi_duplicate_processor_id(int proc_id) |
663 | { | 690 | { |
664 | int i; | 691 | int i; |
665 | 692 | ||