From 8aba36d89675ff52f57410c8f5c42d37ef2ac8b4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 31 Jul 2015 09:31:32 -0600 Subject: x86: Tidy up a few minor issues with interrupts Fix a typo, remove an unused field and make sure to use existing #define constants instead of open-coded values. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/interrupts.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'arch/x86/cpu/interrupts.c') diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index 853c82f5a7..3a9c2d4783 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -46,7 +47,7 @@ static char *exceptions[] = { "Invalid TSS", "Segment Not Present", "Stack Segment Fault", - "Gerneral Protection", + "General Protection", "Page Fault", "Reserved", "x87 FPU Floating-Point Error", @@ -165,7 +166,6 @@ struct idt_entry { struct desc_ptr { unsigned short size; unsigned long address; - unsigned short segment; } __packed; struct idt_entry idt[256] __aligned(16); @@ -202,14 +202,13 @@ int cpu_init_interrupts(void) for (i = 0; i < 256; i++) { idt[i].access = 0x8e; idt[i].res = 0; - idt[i].selector = 0x10; + idt[i].selector = X86_GDT_ENTRY_32BIT_CS * X86_GDT_ENTRY_SIZE; set_vector(i, irq_entry); irq_entry += irq_entry_size; } - idt_ptr.size = 256 * 8; + idt_ptr.size = 256 * 8 - 1; idt_ptr.address = (unsigned long) idt; - idt_ptr.segment = 0x18; load_idt(&idt_ptr); -- cgit From 3dcdd17b43c5cfd3a216169948dfd08d6741c631 Mon Sep 17 00:00:00 2001 From: Ben Stoltz Date: Tue, 4 Aug 2015 12:33:46 -0600 Subject: x86: Add support for U-Boot as an EFI application Add the required x86 glue code. This includes the initial start-up, relocation and jumping to efi_main(). We also need to avoid fiddling with interrupts. Signed-off-by: Ben Stoltz Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/interrupts.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch/x86/cpu/interrupts.c') diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index 3a9c2d4783..a1129384e2 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -242,6 +242,11 @@ int disable_interrupts(void) int interrupt_init(void) { + /* + * When running as an EFI application we are not in control of + * interrupts and should leave them alone. + */ +#ifndef CONFIG_EFI_APP /* Just in case... */ disable_interrupts(); @@ -255,6 +260,7 @@ int interrupt_init(void) /* It is now safe to enable interrupts */ enable_interrupts(); +#endif return 0; } -- cgit From e49cceac61a0f56beff466f844fb9b3451d564eb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 4 Aug 2015 12:34:00 -0600 Subject: x86: Handle running as EFI payload When U-Boot runs as an EFI payload it needs to avoid setting up the CPU again. Also U-Boot currently does not handle interrupts for many devices, so run with interrupts disabled. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/interrupts.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'arch/x86/cpu/interrupts.c') diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index a1129384e2..9217307e4a 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -258,8 +258,14 @@ int interrupt_init(void) /* Initialize core interrupt and exception functionality of CPU */ cpu_init_interrupts(); - /* It is now safe to enable interrupts */ - enable_interrupts(); + /* + * It is now safe to enable interrupts. + * + * TODO(sjg@chromium.org): But we don't handle these correctly when + * booted from EFI. + */ + if (ll_boot_init()) + enable_interrupts(); #endif return 0; -- cgit