Commit 6aedb6ff authored by Charles E. Youse's avatar Charles E. Youse Committed by Anas Nashif
Browse files

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: default avatarCharles E. Youse <charles.youse@intel.com>
parent a348c8c6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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)
+0 −53
Original line number Diff line number Diff line
/*
 * 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 <kernel.h>
#include <arch/cpu.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <device.h>
#include <init.h>

/* 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);