From 6aedb6ff1a898a1a832e86880de5eb5733b9c085 Mon Sep 17 00:00:00 2001 From: "Charles E. Youse" Date: Tue, 4 Jun 2019 09:39:59 -0700 Subject: [PATCH] arch/x86: disable i8259 in crt0.S drivers/interrupt_controller/i8259.c is not a driver; it exists solely to disable the i8259s when the configuration calls for it. The six-byte sequence to mask the controllers is moved to crt0.S and the pseudo-driver is removed. Signed-off-by: Charles E. Youse --- arch/x86/core/crt0.S | 11 +++++ drivers/interrupt_controller/CMakeLists.txt | 1 - drivers/interrupt_controller/i8259.c | 53 --------------------- 3 files changed, 11 insertions(+), 54 deletions(-) delete mode 100644 drivers/interrupt_controller/i8259.c diff --git a/arch/x86/core/crt0.S b/arch/x86/core/crt0.S index 0419e0502de..8b4d273bb1b 100644 --- a/arch/x86/core/crt0.S +++ b/arch/x86/core/crt0.S @@ -415,6 +415,17 @@ __csSet: 1: #endif +#if defined(CONFIG_PIC_DISABLE) + /* + * "Disable" legacy i8259 interrupt controllers. Note that we + * can't actually disable them, but we mask all their interrupt + * sources which is effectively the same thing (almost). + */ + movb $0xff, %al /* all bits set = mask all interrupts */ + outb %al, $0x21 /* set i8259 master mask (IRQs 0-7) */ + outb %al, $0xA1 /* set i8259 slave mask (IRQs 8-15) */ +#endif + /* Jump to C portion of kernel initialization and never return */ jmp z_cstart diff --git a/drivers/interrupt_controller/CMakeLists.txt b/drivers/interrupt_controller/CMakeLists.txt index 4188ed84c08..d7f8ba5eadb 100644 --- a/drivers/interrupt_controller/CMakeLists.txt +++ b/drivers/interrupt_controller/CMakeLists.txt @@ -5,7 +5,6 @@ zephyr_sources_ifdef(CONFIG_IOAPIC ioapic_intr.c) zephyr_sources_ifdef(CONFIG_LOAPIC loapic_intr.c system_apic.c) zephyr_sources_ifdef(CONFIG_LOAPIC_SPURIOUS_VECTOR loapic_spurious.S) zephyr_sources_ifdef(CONFIG_MVIC mvic.c) -zephyr_sources_ifdef(CONFIG_PIC_DISABLE i8259.c) zephyr_sources_ifdef(CONFIG_PLIC plic.c) zephyr_sources_ifdef(CONFIG_SHARED_IRQ shared_irq.c) zephyr_sources_ifdef(CONFIG_EXTI_STM32 exti_stm32.c) diff --git a/drivers/interrupt_controller/i8259.c b/drivers/interrupt_controller/i8259.c deleted file mode 100644 index 75f10eae787..00000000000 --- a/drivers/interrupt_controller/i8259.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010-2015 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Disable Intel 8259A PIC (Programmable Interrupt Controller) - * - * This module disables the Intel 8259A PIC (Programmable Interrupt Controller) - * to prevent it from generating spurious interrupts. - */ - - -#include -#include -#include -#include -#include -#include - -/* programmable interrupt controller info (pair of cascaded 8259A devices) */ -#define PIC_MASTER_BASE_ADRS 0x20 -#define PIC_SLAVE_BASE_ADRS 0xa0 -#define PIC_REG_ADDR_INTERVAL 1 - -/* register definitions */ -#define PIC_ADRS(baseAdrs, reg) (baseAdrs + (reg * PIC_REG_ADDR_INTERVAL)) - -#define PIC_PORT2(base) PIC_ADRS(base, 0x01) /* port 2 */ - -#define PIC_DISABLE 0xff /* Disable PIC command */ - -/** - * - * @brief Initialize the Intel 8259A PIC device driver - * - * This routine disables the 8259A PIC device to prevent it from - * generating spurious interrupts. - * - * @return N/A - */ - -int _i8259_init(struct device *unused) -{ - ARG_UNUSED(unused); - sys_out8(PIC_DISABLE, PIC_PORT2(PIC_SLAVE_BASE_ADRS)); - sys_out8(PIC_DISABLE, PIC_PORT2(PIC_MASTER_BASE_ADRS)); - return 0; -} - -SYS_INIT(_i8259_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);