// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2006 Fabrice Bellard
//
-// This file may be distributed under the terms of the GNU GPLv3 license.
+// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
+#include "cmos.h" // CMOS_BIOS_SMP_COUNT
#define CPUID_APIC (1 << 9)
return *(volatile const u8 *)addr;
}
+u32 smp_cpus VAR16_32;
extern void smp_ap_boot_code();
-extern u32 smp_cpus;
-#if MODE16
-u32 smp_cpus VISIBLE16;
-asm(
+ASM16(
" .global smp_ap_boot_code\n"
"smp_ap_boot_code:\n"
// Increment the cpu counter
// Halt the processor.
" jmp permanent_halt\n"
);
-#endif
/* find the number of CPUs by launching a SIPI to them */
int
writel(APIC_ICR_LOW, 0x000C4600 | sipi_vector);
// Wait for other CPUs to process the SIPI.
- mdelay(10);
+ if (CONFIG_COREBOOT)
+ mdelay(10);
+ else
+ while (inb_cmos(CMOS_BIOS_SMP_COUNT) + 1 != readl(&smp_cpus))
+ ;
// Restore memory.
- writel(APIC_SVR, val);
*(u64*)BUILD_AP_BOOT_ADDR = old;
u32 count = readl(&smp_cpus);