summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven J. Magnani <steve@digidescorp.com>2005-09-12 18:38:10 +0000
committerSteven J. Magnani <steve@digidescorp.com>2005-09-12 18:38:10 +0000
commita7c70bcb3ad77596870d6616388df43d28ec9685 (patch)
tree8108c03db6184df4476830df41c32249fe20ec94
parente50570112facc2e80d4456f0a21dbe3e85491453 (diff)
downloadcoreboot-a7c70bcb3ad77596870d6616388df43d28ec9685.tar.xz
Fix hang during secondary CPU sibling init caused by nested spinlocks.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2022 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 7c40f6a3c0..7f348790e5 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -227,20 +227,26 @@ int start_cpu(device_t cpu)
}
/* C entry point of secondary cpus */
+
+// secondary_cpu_lock is used to serialize initialization of secondary CPUs
+// This can be used to avoid interleaved debugging messages.
+
+static spinlock_t secondary_cpu_lock = SPIN_LOCK_UNLOCKED;
+
void secondary_cpu_init(void)
{
atomic_inc(&active_cpus);
+
#if SERIAL_CPU_INIT == 1
- #if CONFIG_MAX_CPUS>2
- spin_lock(&start_cpu_lock);
- #endif
+ spin_lock(&secondary_cpu_lock);
#endif
+
cpu_initialize();
+
#if SERIAL_CPU_INIT == 1
- #if CONFIG_MAX_CPUS>2
- spin_unlock(&start_cpu_lock);
- #endif
+ spin_unlock(&secondary_cpu_lock);
#endif
+
atomic_dec(&active_cpus);
stop_this_cpu();
}