summaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/lapic/lapic.c24
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c24
2 files changed, 14 insertions, 34 deletions
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c
index 4c351f914b..ca0ff94c99 100644
--- a/src/cpu/x86/lapic/lapic.c
+++ b/src/cpu/x86/lapic/lapic.c
@@ -16,7 +16,7 @@
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
-void setup_lapic(void)
+void do_lapic_init(void)
{
/* this is so interrupts work. This is very limited scope --
* linux will do better later, we hope ...
@@ -26,18 +26,10 @@ void setup_lapic(void)
* see the Intel mp1.4 spec, page A-3
*/
-#if NEED_LAPIC == 1
- /* Only Pentium Pro and later have those MSR stuff */
- msr_t msr;
-
printk(BIOS_INFO, "Setting up local APIC...");
/* Enable the local APIC */
- msr = rdmsr(LAPIC_BASE_MSR);
- msr.lo |= LAPIC_BASE_MSR_ENABLE;
- msr.lo &= ~LAPIC_BASE_MSR_ADDR_MASK;
- msr.lo |= LAPIC_DEFAULT_BASE;
- wrmsr(LAPIC_BASE_MSR, msr);
+ enable_lapic();
/*
* Set Task Priority to 'accept all'.
@@ -69,17 +61,5 @@ void setup_lapic(void)
);
printk(BIOS_DEBUG, " apic_id: 0x%02lx ", lapicid());
-
-#else /* !NEED_LAPIC */
- /* Only Pentium Pro and later have those MSR stuff */
- msr_t msr;
-
- printk(BIOS_INFO, "Disabling local APIC...");
-
- msr = rdmsr(LAPIC_BASE_MSR);
- msr.lo &= ~LAPIC_BASE_MSR_ENABLE;
- wrmsr(LAPIC_BASE_MSR, msr);
-#endif /* !NEED_LAPIC */
printk(BIOS_INFO, "done.\n");
- post_code(0x9b);
}
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 83be53b22d..ce4d0f588e 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -541,18 +541,18 @@ void initialize_cpus(struct bus *cpu_bus)
/* Find the info struct for this CPU */
info = cpu_info();
-#if NEED_LAPIC == 1
- /* Ensure the local APIC is enabled */
- enable_lapic();
-
- /* Get the device path of the boot CPU */
- cpu_path.type = DEVICE_PATH_APIC;
- cpu_path.apic.apic_id = lapicid();
-#else
- /* Get the device path of the boot CPU */
- cpu_path.type = DEVICE_PATH_CPU;
- cpu_path.cpu.id = 0;
-#endif
+ if (need_lapic_init()) {
+ /* Ensure the local APIC is enabled */
+ enable_lapic();
+
+ /* Get the device path of the boot CPU */
+ cpu_path.type = DEVICE_PATH_APIC;
+ cpu_path.apic.apic_id = lapicid();
+ } else {
+ /* Get the device path of the boot CPU */
+ cpu_path.type = DEVICE_PATH_CPU;
+ cpu_path.cpu.id = 0;
+ }
/* Find the device structure for the boot CPU */
info->cpu = alloc_find_dev(cpu_bus, &cpu_path);