aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2011-12-12 20:36:03 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-25 20:24:59 -0500
commit68e6689b9b35c8a2fa73e00947238d2c5cb0387c (patch)
tree1a25d95e681074d2e507326a0e06a3e9dfd67ab0
parent55bd02eb4c6e40c2870aee19c5e36d1a85713be8 (diff)
ACPI: processor: fix acpi_get_cpuid for UP processor
commit d640113fe80e45ebd4a5b420b220d3f6bf37f682 upstream. For UP processor, it is likely that no _MAT method or MADT table defined. So currently acpi_get_cpuid(...) always return -1 for UP processor. This is wrong. It should return valid value for CPU0. In the other hand, BIOS may define multiple CPU handles even for UP processor, for example Scope (_PR) { Processor (CPU0, 0x00, 0x00000410, 0x06) {} Processor (CPU1, 0x01, 0x00000410, 0x06) {} Processor (CPU2, 0x02, 0x00000410, 0x06) {} Processor (CPU3, 0x03, 0x00000410, 0x06) {} } We should only return valid value for CPU0's acpi handle. And return invalid value for others. http://marc.info/?t=132329819900003&r=1&w=2 Reported-and-tested-by: wallak@free.fr Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/acpi/processor_core.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 02d2a4c9084..0c0669fb1cc 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -172,8 +172,30 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
172 apic_id = map_mat_entry(handle, type, acpi_id); 172 apic_id = map_mat_entry(handle, type, acpi_id);
173 if (apic_id == -1) 173 if (apic_id == -1)
174 apic_id = map_madt_entry(type, acpi_id); 174 apic_id = map_madt_entry(type, acpi_id);
175 if (apic_id == -1) 175 if (apic_id == -1) {
176 return apic_id; 176 /*
177 * On UP processor, there is no _MAT or MADT table.
178 * So above apic_id is always set to -1.
179 *
180 * BIOS may define multiple CPU handles even for UP processor.
181 * For example,
182 *
183 * Scope (_PR)
184 * {
185 * Processor (CPU0, 0x00, 0x00000410, 0x06) {}
186 * Processor (CPU1, 0x01, 0x00000410, 0x06) {}
187 * Processor (CPU2, 0x02, 0x00000410, 0x06) {}
188 * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
189 * }
190 *
191 * Ignores apic_id and always return 0 for CPU0's handle.
192 * Return -1 for other CPU's handle.
193 */
194 if (acpi_id == 0)
195 return acpi_id;
196 else
197 return apic_id;
198 }
177 199
178#ifdef CONFIG_SMP 200#ifdef CONFIG_SMP
179 for_each_possible_cpu(i) { 201 for_each_possible_cpu(i) {