summaryrefslogtreecommitdiff
path: root/src/cpu/x86/lapic
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-10-17 08:34:31 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-02-05 07:59:04 +0000
commit9ec7227c9b43df97e3422877b2539db21d47741b (patch)
tree1caed1fb7bfd69ed47c505c199570cf124e26439 /src/cpu/x86/lapic
parent7261b5ade5c2035da026837afdb20a7ec1252b19 (diff)
cpu/x86/lapic: Move LAPIC configuration to MP init
Implementation for setup_lapic() did two things -- call enable_lapic() and virtual_wire_mode_init(). In PARALLEL_MP case enable_lapic() was redundant as it was already executed prior to initialize_cpu() call. For the !PARALLEL_MP case enable_lapic() is added to AP CPUs. Change-Id: I5caf94315776a499e9cf8f007251b61f51292dc5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58387 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/cpu/x86/lapic')
-rw-r--r--src/cpu/x86/lapic/lapic.c22
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c9
2 files changed, 9 insertions, 22 deletions
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c
index 9003534485..76f2d89db9 100644
--- a/src/cpu/x86/lapic/lapic.c
+++ b/src/cpu/x86/lapic/lapic.c
@@ -65,13 +65,7 @@ uintptr_t cpu_get_lapic_addr(void)
return LAPIC_DEFAULT_BASE;
}
-/* See if I need to initialize the local APIC */
-static int need_lapic_init(void)
-{
- return CONFIG(SMP) || CONFIG(IOAPIC);
-}
-
-static void lapic_virtual_wire_mode_init(void)
+void setup_lapic_interrupts(void)
{
/*
* Set Task Priority to 'accept all'.
@@ -94,17 +88,3 @@ static void lapic_virtual_wire_mode_init(void)
lapic_update32(LAPIC_LVT1, ~mask, LAPIC_DELIVERY_MODE_NMI);
}
-
-void setup_lapic(void)
-{
- /* Enable the local APIC */
- if (need_lapic_init())
- enable_lapic();
- else if (!CONFIG(UDELAY_LAPIC))
- disable_lapic();
-
- /* This programming is for PIC mode i8259 interrupts to be delivered to CPU
- while LAPIC is enabled. */
- if (need_lapic_init())
- lapic_virtual_wire_mode_init();
-}
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 7780be26ec..837d32f3b6 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -298,6 +298,11 @@ asmlinkage void secondary_cpu_init(unsigned int index)
cr4_val |= (CR4_OSFXSR | CR4_OSXMMEXCPT);
write_cr4(cr4_val);
#endif
+
+ /* Ensure the local APIC is enabled */
+ enable_lapic();
+ setup_lapic_interrupts();
+
cpu_initialize(index);
spin_unlock(&start_cpu_lock);
@@ -376,8 +381,10 @@ void initialize_cpus(struct bus *cpu_bus)
info = cpu_info();
/* Ensure the local APIC is enabled */
- if (is_smp_boot())
+ if (is_smp_boot()) {
enable_lapic();
+ setup_lapic_interrupts();
+ }
/* Get the device path of the boot CPU */
cpu_path.type = DEVICE_PATH_APIC;