init the ECC for BSP and AP at the same time. So reduce init cpus time

from 2.1x to 1.1x or from 4x(SERIAL_CPU_INIT) to 1.1x  


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2309 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Yinghai Lu 2006-05-18 17:02:17 +00:00
parent 2b396cdcf2
commit 9a8e36da2d
1 changed files with 32 additions and 8 deletions

View File

@ -123,8 +123,6 @@ static int lapic_start_cpu(unsigned long apicid)
start_eip = (unsigned long)_secondary_start; start_eip = (unsigned long)_secondary_start;
#endif #endif
printk_debug("start_eip=0x%08lx\n", start_eip);
num_starts = 2; num_starts = 2;
/* /*
@ -299,9 +297,8 @@ void secondary_cpu_init(void)
stop_this_cpu(); stop_this_cpu();
} }
static void initialize_other_cpus(struct bus *cpu_bus) static void start_other_cpus(struct bus *cpu_bus, device_t bsp_cpu)
{ {
int old_active_count, active_count;
device_t cpu; device_t cpu;
/* Loop through the cpus once getting them started */ /* Loop through the cpus once getting them started */
@ -309,6 +306,11 @@ static void initialize_other_cpus(struct bus *cpu_bus)
if (cpu->path.type != DEVICE_PATH_APIC) { if (cpu->path.type != DEVICE_PATH_APIC) {
continue; continue;
} }
#if SERIAL_CPU_INIT == 0
if(cpu==bsp_cpu) {
continue;
}
#endif
if (!cpu->enabled) { if (!cpu->enabled) {
continue; continue;
@ -330,6 +332,12 @@ static void initialize_other_cpus(struct bus *cpu_bus)
#endif #endif
} }
}
static void wait_other_cpus_stop(struct bus *cpu_bus)
{
device_t cpu;
int old_active_count, active_count;
/* Now loop until the other cpus have finished initializing */ /* Now loop until the other cpus have finished initializing */
old_active_count = 1; old_active_count = 1;
active_count = atomic_read(&active_cpus); active_count = atomic_read(&active_cpus);
@ -386,10 +394,26 @@ void initialize_cpus(struct bus *cpu_bus)
copy_secondary_start_to_1m_below(); // why here? In case some day we can start core1 in amd_sibling_init copy_secondary_start_to_1m_below(); // why here? In case some day we can start core1 in amd_sibling_init
#endif #endif
/* Initialize the bootstrap processor */ #if CONFIG_SMP == 1
cpu_initialize(); #if SERIAL_CPU_INIT == 0
/* start all aps at first, so we can init ECC all together */
start_other_cpus(cpu_bus, info->cpu);
#endif
#endif
/* Initialize the bootstrap processor */
cpu_initialize();
#if CONFIG_SMP == 1
#if SERIAL_CPU_INIT == 1
/* start all aps */
start_other_cpus(cpu_bus, info->cpu);
#endif
/* Now wait the rest of the cpus stop*/
wait_other_cpus_stop(cpu_bus);
#endif
/* Now initialize the rest of the cpus */
initialize_other_cpus(cpu_bus);
} }