aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-06-06 22:56:41 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-10-15 12:19:33 +0000
commitff556ca9956689640503f33098f7fe3c03b475f1 (patch)
treeea18f3e9a73553e2c258a23b8b7b586d0a541d6a
parent05ae8f2ff31ba1d02aba15c99025df91588712e1 (diff)
cpu/x86/lapic: Split virtual_wire_mode_init()
Only the enable_lapic() part is required while doing SMP init. Also disable_lapic() must not be called if we rely on LAPIC for timer source. Change-Id: Ib5e37c1a0a91fa4e9542141aa74f1c1876fee94e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55261 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--src/cpu/x86/lapic/lapic.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c
index 9aac163d15..bd2fa67afd 100644
--- a/src/cpu/x86/lapic/lapic.c
+++ b/src/cpu/x86/lapic/lapic.c
@@ -10,12 +10,15 @@
void enable_lapic(void)
{
msr_t msr;
+
msr = rdmsr(LAPIC_BASE_MSR);
msr.hi &= 0xffffff00;
msr.lo &= ~LAPIC_BASE_MSR_ADDR_MASK;
msr.lo |= LAPIC_DEFAULT_BASE;
msr.lo |= LAPIC_BASE_MSR_ENABLE;
wrmsr(LAPIC_BASE_MSR, msr);
+
+ printk(BIOS_INFO, "Setting up local APIC 0x%x\n", lapicid());
}
void disable_lapic(void)
@@ -39,19 +42,6 @@ static int need_lapic_init(void)
static void lapic_virtual_wire_mode_init(void)
{
- /* this is so interrupts work. This is very limited scope --
- * linux will do better later, we hope ...
- */
- /* this is the first way we learned to do it. It fails on real SMP
- * stuff. So we have to do things differently ...
- * see the Intel mp1.4 spec, page A-3
- */
-
- printk(BIOS_INFO, "Setting up local APIC...\n");
-
- /* Enable the local APIC */
- enable_lapic();
-
/*
* Set Task Priority to 'accept all'.
*/
@@ -70,14 +60,18 @@ static void lapic_virtual_wire_mode_init(void)
lapic_update32(LAPIC_LVT1, ~mask, LAPIC_LVT_REMOTE_IRR | LAPIC_SEND_PENDING |
LAPIC_DELIVERY_MODE_NMI);
- printk(BIOS_DEBUG, " apic_id: 0x%x ", lapicid());
- printk(BIOS_INFO, "done.\n");
}
void setup_lapic(void)
{
+ /* Enable the local APIC */
if (need_lapic_init())
- lapic_virtual_wire_mode_init();
- else
+ 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();
}