2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2015 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-12-04 23:09:39 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Disable Intel 8259A PIC (Programmable Interrupt Controller)
|
|
|
|
*
|
2015-10-21 00:42:33 +08:00
|
|
|
* This module disables the Intel 8259A PIC (Programmable Interrupt Controller)
|
|
|
|
* to prevent it from generating spurious interrupts.
|
|
|
|
*/
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
|
2016-12-05 04:59:37 +08:00
|
|
|
#include <kernel.h>
|
2015-05-29 01:56:47 +08:00
|
|
|
#include <arch/cpu.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
#include <toolchain.h>
|
|
|
|
#include <sections.h>
|
2015-09-16 00:17:38 +08:00
|
|
|
#include <device.h>
|
2015-12-09 03:17:56 +08:00
|
|
|
#include <init.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#include <board.h>
|
|
|
|
|
2015-12-09 03:17:56 +08:00
|
|
|
/* 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 */
|
|
|
|
|
2015-07-25 01:46:21 +08:00
|
|
|
#define PIC_DISABLE 0xff /* Disable PIC command */
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2015-07-25 01:46:21 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2015-09-16 00:17:38 +08:00
|
|
|
int _i8259_init(struct device *unused)
|
2015-07-25 01:46:21 +08:00
|
|
|
{
|
2015-09-16 00:17:38 +08:00
|
|
|
ARG_UNUSED(unused);
|
2015-09-10 23:37:53 +08:00
|
|
|
sys_out8(PIC_DISABLE, PIC_PORT2(PIC_SLAVE_BASE_ADRS));
|
|
|
|
sys_out8(PIC_DISABLE, PIC_PORT2(PIC_MASTER_BASE_ADRS));
|
2015-09-16 00:17:38 +08:00
|
|
|
return 0;
|
2015-07-25 01:46:21 +08:00
|
|
|
}
|
2015-12-09 03:17:56 +08:00
|
|
|
|
2016-11-09 03:06:55 +08:00
|
|
|
SYS_INIT(_i8259_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|