From ac8ebd0e73774c83bfa5cb3dd460c662000e0d19 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Mon, 20 Aug 2018 11:14:44 -0600 Subject: libpayload/arch/x86: Add support for initializing the APIC This is just the bare minimum required to initialize the APIC. I only support xAPIC and chose not to support x2APIC. We can add that functionality later when it's required. I also made the exception dispatcher call apic_eoi so that the callbacks won't forget to call it. BUG=b:109749762 TEST=Booted grunt and verified that depthcharge continued to function and that linux booted correctly. Also verified GDB still works. Change-Id: I420a4eadae84df088525e727b481089ef615183f Signed-off-by: Raul E Rangel Reviewed-on: https://review.coreboot.org/28241 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- payloads/libpayload/arch/x86/exception.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'payloads/libpayload/arch/x86/exception.c') diff --git a/payloads/libpayload/arch/x86/exception.c b/payloads/libpayload/arch/x86/exception.c index d70d942a05..2691c85329 100644 --- a/payloads/libpayload/arch/x86/exception.c +++ b/payloads/libpayload/arch/x86/exception.c @@ -31,8 +31,16 @@ #include #include #include +#include #define IF_FLAG (1 << 9) +/* + * Local and I/O APICs support 240 vectors (in the range of 16 to 255) as valid + * interrupts. The Intel 64 and IA-32 architectures reserve vectors 16 + * through 31 for predefined interrupts, exceptions, and Intel-reserved + * encodings. +*/ +#define FIRST_USER_DEFINED_VECTOR 32 u32 exception_stack[0x400] __attribute__((aligned(8))); @@ -171,6 +179,9 @@ void exception_dispatch(void) if (handlers[vec]) { handlers[vec](vec); + if (IS_ENABLED(CONFIG_LP_ENABLE_APIC) + && vec >= FIRST_USER_DEFINED_VECTOR) + apic_eoi(); return; } -- cgit v1.2.3