Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: Allow processor to be declared with the Device() instead of Processor()

Allow processor to be declered with the Device(), such as:
Device(CPU1234) {
Name(_HID, "ACPI007")
Name(_UID, 1234)
}

Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Alexey Starikovskiy and committed by
Len Brown
11bf04c4 f18c5a08

+33 -22
+32 -21
drivers/acpi/processor_core.c
··· 377 377 /* Use the acpiid in MADT to map cpus in case of SMP */ 378 378 379 379 #ifndef CONFIG_SMP 380 - #define convert_acpiid_to_cpu(acpi_id) (-1) 380 + static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;} 381 381 #else 382 382 383 383 static struct acpi_table_madt *madt; ··· 483 483 return apic_id; 484 484 } 485 485 486 - static int get_apic_id(acpi_handle handle, u32 acpi_id) 486 + static int get_cpu_id(acpi_handle handle, u32 acpi_id) 487 487 { 488 488 int i; 489 489 int apic_id = -1; ··· 506 506 Driver Interface 507 507 -------------------------------------------------------------------------- */ 508 508 509 - static int acpi_processor_get_info(struct acpi_processor *pr) 509 + static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) 510 510 { 511 511 acpi_status status = 0; 512 512 union acpi_object object = { 0 }; ··· 535 535 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 536 536 "No bus mastering arbitration control\n")); 537 537 538 - /* 539 - * Evalute the processor object. Note that it is common on SMP to 540 - * have the first (boot) processor with a valid PBLK address while 541 - * all others have a NULL address. 542 - */ 543 - status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 544 - if (ACPI_FAILURE(status)) { 545 - printk(KERN_ERR PREFIX "Evaluating processor object\n"); 546 - return -ENODEV; 538 + /* Check if it is a Device with HID and UID */ 539 + if (has_uid) { 540 + unsigned long value; 541 + status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, 542 + NULL, &value); 543 + if (ACPI_FAILURE(status)) { 544 + printk(KERN_ERR PREFIX "Evaluating processor _UID\n"); 545 + return -ENODEV; 546 + } 547 + pr->acpi_id = value; 548 + } else { 549 + /* 550 + * Evalute the processor object. Note that it is common on SMP to 551 + * have the first (boot) processor with a valid PBLK address while 552 + * all others have a NULL address. 553 + */ 554 + status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 555 + if (ACPI_FAILURE(status)) { 556 + printk(KERN_ERR PREFIX "Evaluating processor object\n"); 557 + return -ENODEV; 558 + } 559 + 560 + /* 561 + * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. 562 + * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c 563 + */ 564 + pr->acpi_id = object.processor.proc_id; 547 565 } 548 - 549 - /* 550 - * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. 551 - * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c 552 - */ 553 - pr->acpi_id = object.processor.proc_id; 554 - 555 - cpu_index = get_apic_id(pr->handle, pr->acpi_id); 566 + cpu_index = get_cpu_id(pr->handle, pr->acpi_id); 556 567 557 568 /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 558 569 if (!cpu0_initialized && (cpu_index == -1) && ··· 632 621 633 622 pr = acpi_driver_data(device); 634 623 635 - result = acpi_processor_get_info(pr); 624 + result = acpi_processor_get_info(pr, device->flags.unique_id); 636 625 if (result) { 637 626 /* Processor is physically not present */ 638 627 return 0;
+1 -1
include/acpi/acpi_drivers.h
··· 37 37 /* _HID definitions */ 38 38 39 39 #define ACPI_POWER_HID "ACPI_PWR" 40 - #define ACPI_PROCESSOR_HID "ACPI_CPU" 40 + #define ACPI_PROCESSOR_HID "ACPI0007" 41 41 #define ACPI_SYSTEM_HID "ACPI_SYS" 42 42 #define ACPI_THERMAL_HID "ACPI_THM" 43 43 #define ACPI_BUTTON_HID_POWERF "ACPI_FPB"