aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2005-08-30 17:55:00 -0400
committerLen Brown <len.brown@intel.com>2005-09-03 01:01:37 -0400
commit9a31477a95d642dd42a1be7cc342f5902b56f584 (patch)
tree1cd6387a3ba5cb8e1d9706dc91b99f54264bb5f1
parentdbed12da5bb06b15c63930e9282b45daea566d7b (diff)
[ACPI] fix processor_core.c for NR_CPUS > 256
http://bugzilla.kernel.org/show_bug.cgi?id=5128 Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/processor_core.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 421792562642..ac2dfa63646c 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -413,18 +413,20 @@ 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 u8 convert_acpiid_to_cpu(u8 acpi_id) 416static int convert_acpiid_to_cpu(u8 acpi_id, unsigned int *cpu_index)
417{ 417{
418 u16 apic_id; 418 u16 apic_id;
419 int i; 419 unsigned 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 return i; 427 *cpu_index = i;
428 return 0;
429 }
428 } 430 }
429 return -1; 431 return -1;
430} 432}
@@ -439,7 +441,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
439 acpi_status status = 0; 441 acpi_status status = 0;
440 union acpi_object object = { 0 }; 442 union acpi_object object = { 0 };
441 struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; 443 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
442 u8 cpu_index; 444 unsigned int cpu_index;
445 int retval;
443 static int cpu0_initialized; 446 static int cpu0_initialized;
444 447
445 ACPI_FUNCTION_TRACE("acpi_processor_get_info"); 448 ACPI_FUNCTION_TRACE("acpi_processor_get_info");
@@ -482,10 +485,10 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
482 */ 485 */
483 pr->acpi_id = object.processor.proc_id; 486 pr->acpi_id = object.processor.proc_id;
484 487
485 cpu_index = convert_acpiid_to_cpu(pr->acpi_id); 488 retval = convert_acpiid_to_cpu(pr->acpi_id, &cpu_index);
486 489
487 /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 490 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
488 if (!cpu0_initialized && (cpu_index == 0xff) && 491 if (!cpu0_initialized && retval &&
489 (num_online_cpus() == 1)) { 492 (num_online_cpus() == 1)) {
490 cpu_index = 0; 493 cpu_index = 0;
491 } 494 }
@@ -499,10 +502,10 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
499 * less than the max # of CPUs. They should be ignored _iff 502 * less than the max # of CPUs. They should be ignored _iff
500 * they are physically not present. 503 * they are physically not present.
501 */ 504 */
502 if (cpu_index >= NR_CPUS) { 505 if (retval) {
503 if (ACPI_FAILURE 506 if (ACPI_FAILURE
504 (acpi_processor_hotadd_init(pr->handle, &pr->id))) { 507 (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
505 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 508 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
506 "Error getting cpuindex for acpiid 0x%x\n", 509 "Error getting cpuindex for acpiid 0x%x\n",
507 pr->acpi_id)); 510 pr->acpi_id));
508 return_VALUE(-ENODEV); 511 return_VALUE(-ENODEV);