Commit 547f7847472c097a54adf38e6576f95ab512e27c
Exists in
master
and in
7 other branches
Merge branch 'processor-256' into release
Showing 3 changed files Side-by-side Diff
drivers/acpi/processor_core.c
... | ... | @@ -88,6 +88,7 @@ |
88 | 88 | |
89 | 89 | |
90 | 90 | static const struct acpi_device_id processor_device_ids[] = { |
91 | + {ACPI_PROCESSOR_OBJECT_HID, 0}, | |
91 | 92 | {ACPI_PROCESSOR_HID, 0}, |
92 | 93 | {"", 0}, |
93 | 94 | }; |
... | ... | @@ -408,7 +409,7 @@ |
408 | 409 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
409 | 410 | |
410 | 411 | #ifndef CONFIG_SMP |
411 | -static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;} | |
412 | +static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; } | |
412 | 413 | #else |
413 | 414 | |
414 | 415 | static struct acpi_table_madt *madt; |
415 | 416 | |
416 | 417 | |
417 | 418 | |
418 | 419 | |
... | ... | @@ -427,27 +428,35 @@ |
427 | 428 | } |
428 | 429 | |
429 | 430 | static 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 | 433 | struct acpi_madt_local_sapic *lsapic = |
433 | 434 | (struct acpi_madt_local_sapic *)entry; |
435 | + u32 tmp = (lsapic->id << 8) | lsapic->eid; | |
436 | + | |
434 | 437 | /* Only check enabled APICs*/ |
435 | - if (lsapic->lapic_flags & ACPI_MADT_ENABLED) { | |
436 | - /* First check against id */ | |
437 | - if (lsapic->processor_id == acpi_id) { | |
438 | - *apic_id = (lsapic->id << 8) | lsapic->eid; | |
439 | - return 1; | |
440 | - /* Check against optional uid */ | |
441 | - } else if (entry->length >= 16 && | |
442 | - lsapic->uid == acpi_id) { | |
443 | - *apic_id = lsapic->uid; | |
444 | - return 1; | |
445 | - } | |
446 | - } | |
438 | + if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) | |
439 | + return 0; | |
440 | + | |
441 | + /* Device statement declaration type */ | |
442 | + if (device_declaration) { | |
443 | + if (entry->length < 16) | |
444 | + printk(KERN_ERR PREFIX | |
445 | + "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n", | |
446 | + tmp); | |
447 | + else if (lsapic->uid == acpi_id) | |
448 | + goto found; | |
449 | + /* Processor statement declaration type */ | |
450 | + } else if (lsapic->processor_id == acpi_id) | |
451 | + goto found; | |
452 | + | |
447 | 453 | return 0; |
454 | +found: | |
455 | + *apic_id = tmp; | |
456 | + return 1; | |
448 | 457 | } |
449 | 458 | |
450 | -static int map_madt_entry(u32 acpi_id) | |
459 | +static int map_madt_entry(int type, u32 acpi_id) | |
451 | 460 | { |
452 | 461 | unsigned long madt_end, entry; |
453 | 462 | int apic_id = -1; |
... | ... | @@ -468,7 +477,7 @@ |
468 | 477 | if (map_lapic_id(header, acpi_id, &apic_id)) |
469 | 478 | break; |
470 | 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 | 481 | break; |
473 | 482 | } |
474 | 483 | entry += header->length; |
... | ... | @@ -476,7 +485,7 @@ |
476 | 485 | return apic_id; |
477 | 486 | } |
478 | 487 | |
479 | -static int map_mat_entry(acpi_handle handle, u32 acpi_id) | |
488 | +static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | |
480 | 489 | { |
481 | 490 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
482 | 491 | union acpi_object *obj; |
... | ... | @@ -499,7 +508,7 @@ |
499 | 508 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
500 | 509 | map_lapic_id(header, acpi_id, &apic_id); |
501 | 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 | |
505 | 514 | exit: |
506 | 515 | |
507 | 516 | |
... | ... | @@ -508,14 +517,14 @@ |
508 | 517 | return apic_id; |
509 | 518 | } |
510 | 519 | |
511 | -static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |
520 | +static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) | |
512 | 521 | { |
513 | 522 | int i; |
514 | 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 | 526 | if (apic_id == -1) |
518 | - apic_id = map_madt_entry(acpi_id); | |
527 | + apic_id = map_madt_entry(type, acpi_id); | |
519 | 528 | if (apic_id == -1) |
520 | 529 | return apic_id; |
521 | 530 | |
522 | 531 | |
523 | 532 | |
... | ... | @@ -531,15 +540,16 @@ |
531 | 540 | Driver Interface |
532 | 541 | -------------------------------------------------------------------------- */ |
533 | 542 | |
534 | -static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |
543 | +static int acpi_processor_get_info(struct acpi_device *device) | |
535 | 544 | { |
536 | 545 | acpi_status status = 0; |
537 | 546 | union acpi_object object = { 0 }; |
538 | 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 | 550 | static int cpu0_initialized; |
541 | 551 | |
542 | - | |
552 | + pr = acpi_driver_data(device); | |
543 | 553 | if (!pr) |
544 | 554 | return -EINVAL; |
545 | 555 | |
546 | 556 | |
547 | 557 | |
548 | 558 | |
... | ... | @@ -560,22 +570,23 @@ |
560 | 570 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
561 | 571 | "No bus mastering arbitration control\n")); |
562 | 572 | |
563 | - /* Check if it is a Device with HID and UID */ | |
564 | - if (has_uid) { | |
573 | + if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) { | |
574 | + /* | |
575 | + * Declared with "Device" statement; match _UID. | |
576 | + * Note that we don't handle string _UIDs yet. | |
577 | + */ | |
565 | 578 | unsigned long long value; |
566 | 579 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, |
567 | 580 | NULL, &value); |
568 | 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 | 584 | return -ENODEV; |
571 | 585 | } |
586 | + device_declaration = 1; | |
572 | 587 | pr->acpi_id = value; |
573 | 588 | } else { |
574 | - /* | |
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 | - */ | |
589 | + /* Declared with "Processor" statement; match ProcessorID */ | |
579 | 590 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); |
580 | 591 | if (ACPI_FAILURE(status)) { |
581 | 592 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); |
582 | 593 | |
... | ... | @@ -583,12 +594,13 @@ |
583 | 594 | } |
584 | 595 | |
585 | 596 | /* |
586 | - * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | |
587 | - * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c | |
588 | - */ | |
597 | + * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | |
598 | + * >>> 'acpi_get_processor_id(acpi_id, &id)' in | |
599 | + * arch/xxx/acpi.c | |
600 | + */ | |
589 | 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 | 605 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
594 | 606 | if (!cpu0_initialized && (cpu_index == -1) && |
... | ... | @@ -660,7 +672,7 @@ |
660 | 672 | |
661 | 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 | 676 | if (result) { |
665 | 677 | /* Processor is physically not present */ |
666 | 678 | return 0; |
drivers/acpi/scan.c
include/acpi/acpi_drivers.h