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
This commit is contained in:
Steven J. Magnani 2005-09-12 18:38:10 +00:00
parent e50570112f
commit a7c70bcb3a
1 changed files with 12 additions and 6 deletions

View File

@ -227,20 +227,26 @@ int start_cpu(device_t cpu)
} }
/* C entry point of secondary cpus */ /* 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) void secondary_cpu_init(void)
{ {
atomic_inc(&active_cpus); atomic_inc(&active_cpus);
#if SERIAL_CPU_INIT == 1 #if SERIAL_CPU_INIT == 1
#if CONFIG_MAX_CPUS>2 spin_lock(&secondary_cpu_lock);
spin_lock(&start_cpu_lock);
#endif
#endif #endif
cpu_initialize(); cpu_initialize();
#if SERIAL_CPU_INIT == 1 #if SERIAL_CPU_INIT == 1
#if CONFIG_MAX_CPUS>2 spin_unlock(&secondary_cpu_lock);
spin_unlock(&start_cpu_lock);
#endif
#endif #endif
atomic_dec(&active_cpus); atomic_dec(&active_cpus);
stop_this_cpu(); stop_this_cpu();
} }