aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/processor_core.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 40d4e624414e..421792562642 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -400,7 +400,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
400 400
401/* Use the acpiid in MADT to map cpus in case of SMP */ 401/* Use the acpiid in MADT to map cpus in case of SMP */
402#ifndef CONFIG_SMP 402#ifndef CONFIG_SMP
403#define convert_acpiid_to_cpu(acpi_id, cpu_indexp) (0xff) 403#define convert_acpiid_to_cpu(acpi_id) (0xff)
404#else 404#else
405 405
406#ifdef CONFIG_IA64 406#ifdef CONFIG_IA64
@@ -413,20 +413,18 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
413#define ARCH_BAD_APICID (0xff) 413#define ARCH_BAD_APICID (0xff)
414#endif 414#endif
415 415
416static int convert_acpiid_to_cpu(u8 acpi_id, unsigned int *cpu_index) 416static u8 convert_acpiid_to_cpu(u8 acpi_id)
417{ 417{
418 u16 apic_id; 418 u16 apic_id;
419 unsigned int i; 419 int i;
420 420
421 apic_id = arch_acpiid_to_apicid[acpi_id]; 421 apic_id = arch_acpiid_to_apicid[acpi_id];
422 if (apic_id == ARCH_BAD_APICID) 422 if (apic_id == ARCH_BAD_APICID)
423 return -1; 423 return -1;
424 424
425 for (i = 0; i < NR_CPUS; i++) { 425 for (i = 0; i < NR_CPUS; i++) {
426 if (arch_cpu_to_apicid[i] == apic_id) { 426 if (arch_cpu_to_apicid[i] == apic_id)
427 *cpu_index = i; 427 return i;
428 return 0;
429 }
430 } 428 }
431 return -1; 429 return -1;
432} 430}
@@ -441,8 +439,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
441 acpi_status status = 0; 439 acpi_status status = 0;
442 union acpi_object object = { 0 }; 440 union acpi_object object = { 0 };
443 struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; 441 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
444 unsigned int cpu_index; 442 u8 cpu_index;
445 int retval;
446 static int cpu0_initialized; 443 static int cpu0_initialized;
447 444
448 ACPI_FUNCTION_TRACE("acpi_processor_get_info"); 445 ACPI_FUNCTION_TRACE("acpi_processor_get_info");
@@ -485,10 +482,10 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
485 */ 482 */
486 pr->acpi_id = object.processor.proc_id; 483 pr->acpi_id = object.processor.proc_id;
487 484
488 retval = convert_acpiid_to_cpu(pr->acpi_id, &cpu_index); 485 cpu_index = convert_acpiid_to_cpu(pr->acpi_id);
489 486
490 /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 487 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
491 if (!cpu0_initialized && retval && 488 if (!cpu0_initialized && (cpu_index == 0xff) &&
492 (num_online_cpus() == 1)) { 489 (num_online_cpus() == 1)) {
493 cpu_index = 0; 490 cpu_index = 0;
494 } 491 }
@@ -502,10 +499,10 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
502 * less than the max # of CPUs. They should be ignored _iff 499 * less than the max # of CPUs. They should be ignored _iff
503 * they are physically not present. 500 * they are physically not present.
504 */ 501 */
505 if (retval) { 502 if (cpu_index >= NR_CPUS) {
506 if (ACPI_FAILURE 503 if (ACPI_FAILURE
507 (acpi_processor_hotadd_init(pr->handle, &pr->id))) { 504 (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
508 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 505 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
509 "Error getting cpuindex for acpiid 0x%x\n", 506 "Error getting cpuindex for acpiid 0x%x\n",
510 pr->acpi_id)); 507 pr->acpi_id));
511 return_VALUE(-ENODEV); 508 return_VALUE(-ENODEV);