summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorSteven J. Magnani <steve@digidescorp.com>2005-09-14 13:53:45 +0000
committerSteven J. Magnani <steve@digidescorp.com>2005-09-14 13:53:45 +0000
commiteccc357ea045d465411ea1fddb448c9c35a2149b (patch)
tree2c3866df644e38bad19e6425489f388ef841008a /src/arch
parent059182cc4fbdaff8c8548f28ee3b13326995dbf0 (diff)
downloadcoreboot-eccc357ea045d465411ea1fddb448c9c35a2149b.tar.xz
Abort cpu_initialize if we detect that we've lost a race.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2032 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/lib/cpu.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/arch/i386/lib/cpu.c b/src/arch/i386/lib/cpu.c
index 74db2e81f8..628bb79e91 100644
--- a/src/arch/i386/lib/cpu.c
+++ b/src/arch/i386/lib/cpu.c
@@ -231,22 +231,32 @@ void cpu_initialize(void)
die("CPU: missing cpu device structure");
}
- /* Find what type of cpu we are dealing with */
- identify_cpu(cpu);
- printk_debug("CPU: vendor %s device %x\n",
- cpu_vendor_name(cpu->vendor), cpu->device);
-
- /* Lookup the cpu's operations */
- set_cpu_ops(cpu);
-
- /* Initialize the cpu */
- if (cpu->ops && cpu->ops->init) {
- cpu->enabled = 1;
- cpu->initialized = 1;
- cpu->ops->init(cpu);
+ // Check that we haven't been passed bad information as the result of a race
+ // (i.e. BSP timed out while waiting for us to load secondary_stack)
+
+ if (cpu->path.u.apic.apic_id != lapicid()) {
+ printk_err("CPU #%d Initialization FAILED: APIC ID mismatch (%u != %u)\n",
+ info->index, cpu->path.u.apic.apic_id, lapicid());
+ // return without setting initialized flag
+ } else {
+ /* Find what type of cpu we are dealing with */
+ identify_cpu(cpu);
+ printk_debug("CPU: vendor %s device %x\n",
+ cpu_vendor_name(cpu->vendor), cpu->device);
+
+ /* Lookup the cpu's operations */
+ set_cpu_ops(cpu);
+
+ /* Initialize the cpu */
+ if (cpu->ops && cpu->ops->init) {
+ cpu->enabled = 1;
+ cpu->initialized = 1;
+ cpu->ops->init(cpu);
+ }
+
+ printk_info("CPU #%d Initialized\n", info->index);
}
- printk_info("CPU #%d Initialized\n", info->index);
return;
}