aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2008-11-11 21:17:03 -0500
committerLen Brown <len.brown@intel.com>2008-11-11 21:17:03 -0500
commit547f7847472c097a54adf38e6576f95ab512e27c (patch)
treef52a5cc4ce033d50b161506bf1b7d929f301dde2
parentf398778aa336a2919ee04ba45d915007230c6957 (diff)
parent5b53ed69158eeff115004f246193d07a083445f6 (diff)
Merge branch 'processor-256' into release
-rw-r--r--drivers/acpi/processor_core.c86
-rw-r--r--drivers/acpi/scan.c2
-rw-r--r--include/acpi/acpi_drivers.h1
3 files changed, 51 insertions, 38 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 79df7465bff9..34948362f41d 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -88,6 +88,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr);
88 88
89 89
90static const struct acpi_device_id processor_device_ids[] = { 90static const struct acpi_device_id processor_device_ids[] = {
91 {ACPI_PROCESSOR_OBJECT_HID, 0},
91 {ACPI_PROCESSOR_HID, 0}, 92 {ACPI_PROCESSOR_HID, 0},
92 {"", 0}, 93 {"", 0},
93}; 94};
@@ -408,7 +409,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
408/* Use the acpiid in MADT to map cpus in case of SMP */ 409/* Use the acpiid in MADT to map cpus in case of SMP */
409 410
410#ifndef CONFIG_SMP 411#ifndef CONFIG_SMP
411static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;} 412static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; }
412#else 413#else
413 414
414static struct acpi_table_madt *madt; 415static struct acpi_table_madt *madt;
@@ -427,27 +428,35 @@ static int map_lapic_id(struct acpi_subtable_header *entry,
427} 428}
428 429
429static int map_lsapic_id(struct acpi_subtable_header *entry, 430static int map_lsapic_id(struct acpi_subtable_header *entry,
430 u32 acpi_id, int *apic_id) 431 int device_declaration, u32 acpi_id, int *apic_id)
431{ 432{
432 struct acpi_madt_local_sapic *lsapic = 433 struct acpi_madt_local_sapic *lsapic =
433 (struct acpi_madt_local_sapic *)entry; 434 (struct acpi_madt_local_sapic *)entry;
435 u32 tmp = (lsapic->id << 8) | lsapic->eid;
436
434 /* Only check enabled APICs*/ 437 /* Only check enabled APICs*/
435 if (lsapic->lapic_flags & ACPI_MADT_ENABLED) { 438 if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))
436 /* First check against id */ 439 return 0;
437 if (lsapic->processor_id == acpi_id) { 440
438 *apic_id = (lsapic->id << 8) | lsapic->eid; 441 /* Device statement declaration type */
439 return 1; 442 if (device_declaration) {
440 /* Check against optional uid */ 443 if (entry->length < 16)
441 } else if (entry->length >= 16 && 444 printk(KERN_ERR PREFIX
442 lsapic->uid == acpi_id) { 445 "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n",
443 *apic_id = lsapic->uid; 446 tmp);
444 return 1; 447 else if (lsapic->uid == acpi_id)
445 } 448 goto found;
446 } 449 /* Processor statement declaration type */
450 } else if (lsapic->processor_id == acpi_id)
451 goto found;
452
447 return 0; 453 return 0;
454found:
455 *apic_id = tmp;
456 return 1;
448} 457}
449 458
450static int map_madt_entry(u32 acpi_id) 459static int map_madt_entry(int type, u32 acpi_id)
451{ 460{
452 unsigned long madt_end, entry; 461 unsigned long madt_end, entry;
453 int apic_id = -1; 462 int apic_id = -1;
@@ -468,7 +477,7 @@ static int map_madt_entry(u32 acpi_id)
468 if (map_lapic_id(header, acpi_id, &apic_id)) 477 if (map_lapic_id(header, acpi_id, &apic_id))
469 break; 478 break;
470 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 479 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
471 if (map_lsapic_id(header, acpi_id, &apic_id)) 480 if (map_lsapic_id(header, type, acpi_id, &apic_id))
472 break; 481 break;
473 } 482 }
474 entry += header->length; 483 entry += header->length;
@@ -476,7 +485,7 @@ static int map_madt_entry(u32 acpi_id)
476 return apic_id; 485 return apic_id;
477} 486}
478 487
479static int map_mat_entry(acpi_handle handle, u32 acpi_id) 488static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
480{ 489{
481 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 490 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
482 union acpi_object *obj; 491 union acpi_object *obj;
@@ -499,7 +508,7 @@ static int map_mat_entry(acpi_handle handle, u32 acpi_id)
499 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { 508 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
500 map_lapic_id(header, acpi_id, &apic_id); 509 map_lapic_id(header, acpi_id, &apic_id);
501 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 510 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
502 map_lsapic_id(header, acpi_id, &apic_id); 511 map_lsapic_id(header, type, acpi_id, &apic_id);
503 } 512 }
504 513
505exit: 514exit:
@@ -508,14 +517,14 @@ exit:
508 return apic_id; 517 return apic_id;
509} 518}
510 519
511static int get_cpu_id(acpi_handle handle, u32 acpi_id) 520static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id)
512{ 521{
513 int i; 522 int i;
514 int apic_id = -1; 523 int apic_id = -1;
515 524
516 apic_id = map_mat_entry(handle, acpi_id); 525 apic_id = map_mat_entry(handle, type, acpi_id);
517 if (apic_id == -1) 526 if (apic_id == -1)
518 apic_id = map_madt_entry(acpi_id); 527 apic_id = map_madt_entry(type, acpi_id);
519 if (apic_id == -1) 528 if (apic_id == -1)
520 return apic_id; 529 return apic_id;
521 530
@@ -531,15 +540,16 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
531 Driver Interface 540 Driver Interface
532 -------------------------------------------------------------------------- */ 541 -------------------------------------------------------------------------- */
533 542
534static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) 543static int acpi_processor_get_info(struct acpi_device *device)
535{ 544{
536 acpi_status status = 0; 545 acpi_status status = 0;
537 union acpi_object object = { 0 }; 546 union acpi_object object = { 0 };
538 struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; 547 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
539 int cpu_index; 548 struct acpi_processor *pr;
549 int cpu_index, device_declaration = 0;
540 static int cpu0_initialized; 550 static int cpu0_initialized;
541 551
542 552 pr = acpi_driver_data(device);
543 if (!pr) 553 if (!pr)
544 return -EINVAL; 554 return -EINVAL;
545 555
@@ -560,22 +570,23 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
560 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 570 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
561 "No bus mastering arbitration control\n")); 571 "No bus mastering arbitration control\n"));
562 572
563 /* Check if it is a Device with HID and UID */ 573 if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) {
564 if (has_uid) { 574 /*
575 * Declared with "Device" statement; match _UID.
576 * Note that we don't handle string _UIDs yet.
577 */
565 unsigned long long value; 578 unsigned long long value;
566 status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, 579 status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
567 NULL, &value); 580 NULL, &value);
568 if (ACPI_FAILURE(status)) { 581 if (ACPI_FAILURE(status)) {
569 printk(KERN_ERR PREFIX "Evaluating processor _UID\n"); 582 printk(KERN_ERR PREFIX
583 "Evaluating processor _UID [%#x]\n", status);
570 return -ENODEV; 584 return -ENODEV;
571 } 585 }
586 device_declaration = 1;
572 pr->acpi_id = value; 587 pr->acpi_id = value;
573 } else { 588 } else {
574 /* 589 /* Declared with "Processor" statement; match ProcessorID */
575 * Evalute the processor object. Note that it is common on SMP to
576 * have the first (boot) processor with a valid PBLK address while
577 * all others have a NULL address.
578 */
579 status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); 590 status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
580 if (ACPI_FAILURE(status)) { 591 if (ACPI_FAILURE(status)) {
581 printk(KERN_ERR PREFIX "Evaluating processor object\n"); 592 printk(KERN_ERR PREFIX "Evaluating processor object\n");
@@ -583,12 +594,13 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
583 } 594 }
584 595
585 /* 596 /*
586 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. 597 * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
587 * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c 598 * >>> 'acpi_get_processor_id(acpi_id, &id)' in
588 */ 599 * arch/xxx/acpi.c
600 */
589 pr->acpi_id = object.processor.proc_id; 601 pr->acpi_id = object.processor.proc_id;
590 } 602 }
591 cpu_index = get_cpu_id(pr->handle, pr->acpi_id); 603 cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id);
592 604
593 /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 605 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
594 if (!cpu0_initialized && (cpu_index == -1) && 606 if (!cpu0_initialized && (cpu_index == -1) &&
@@ -660,7 +672,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
660 672
661 pr = acpi_driver_data(device); 673 pr = acpi_driver_data(device);
662 674
663 result = acpi_processor_get_info(pr, device->flags.unique_id); 675 result = acpi_processor_get_info(device);
664 if (result) { 676 if (result) {
665 /* Processor is physically not present */ 677 /* Processor is physically not present */
666 return 0; 678 return 0;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 71124b9a7073..bd5253ee5c85 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1013,7 +1013,7 @@ static void acpi_device_set_id(struct acpi_device *device,
1013 hid = ACPI_POWER_HID; 1013 hid = ACPI_POWER_HID;
1014 break; 1014 break;
1015 case ACPI_BUS_TYPE_PROCESSOR: 1015 case ACPI_BUS_TYPE_PROCESSOR:
1016 hid = ACPI_PROCESSOR_HID; 1016 hid = ACPI_PROCESSOR_OBJECT_HID;
1017 break; 1017 break;
1018 case ACPI_BUS_TYPE_SYSTEM: 1018 case ACPI_BUS_TYPE_SYSTEM:
1019 hid = ACPI_SYSTEM_HID; 1019 hid = ACPI_SYSTEM_HID;
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index e6e90208147b..5fc1bb0f4a90 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#define ACPI_POWER_HID "LNXPOWER" 59#define ACPI_POWER_HID "LNXPOWER"
60#define ACPI_PROCESSOR_OBJECT_HID "ACPI_CPU"
60#define ACPI_PROCESSOR_HID "ACPI0007" 61#define ACPI_PROCESSOR_HID "ACPI0007"
61#define ACPI_SYSTEM_HID "LNXSYSTM" 62#define ACPI_SYSTEM_HID "LNXSYSTM"
62#define ACPI_THERMAL_HID "LNXTHERM" 63#define ACPI_THERMAL_HID "LNXTHERM"