x86: Move PIC driver to device model/init system

Change the PIC driver to be initialized by the init system. To be
initialized by the init system the function signature of the
_i8259_init() function needs to be changed to the standard *_init()
function signature specified by the device model.

Change-Id: I63bf1cd0ce78920fa20da94f5966e5aab4bf41b2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
This commit is contained in:
Dirk Brandewie 2015-09-15 09:17:38 -07:00 committed by Anas Nashif
commit 1bcb7a339a
4 changed files with 19 additions and 18 deletions

View file

@ -43,13 +43,6 @@ for the ia32 platform.
#include <device.h>
#include <init.h>
#if defined(CONFIG_PIC_DISABLE)
#define pic_init() _i8259_init()
#else
#define pic_init() \
do {/* nothing */ \
} while ((0))
#endif /* CONFIG_PIC_DISABLE */
#ifdef CONFIG_LOAPIC
#include <drivers/loapic.h>
@ -115,7 +108,6 @@ static int ia32_init(struct device *arg)
{
ARG_UNUSED(arg);
pic_init(); /* NOP if not needed */
loapic_init(); /* NOP if not needed */
ioapic_init(); /* NOP if not needed */
@ -124,5 +116,12 @@ static int ia32_init(struct device *arg)
return 0;
}
#if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pure_early_init(pic_0, NULL);
#endif /* CONFIG_PIC_DISABLE */
DECLARE_DEVICE_INIT_CONFIG(ia32_0, "", ia32_init, NULL);
pure_early_init(ia32_0, NULL);

View file

@ -51,13 +51,6 @@ Handlers for the secondary serial port have not been added.
#include <drivers/pci/pci.h>
#include <drivers/pci/pci_mgr.h>
#if defined(CONFIG_SHUTOFF_PIC)
#define pic_init() _i8259_init()
#else
#define pic_init() \
do {/* nothing */ \
} while ((0))
#endif /* CONFIG_SHUTOFF_PIC */
#ifdef CONFIG_LOAPIC
#include <drivers/loapic.h>
@ -150,7 +143,6 @@ static int ia32_pci_init(struct device *arg)
{
ARG_UNUSED(arg);
pic_init(); /* NOP if not needed */
loapic_init(); /* NOP if not needed */
ioapic_init(); /* NOP if not needed */
hpet_irq_set(); /* NOP if not needed */
@ -180,5 +172,12 @@ static int ia32_pci_init(struct device *arg)
return 0;
}
#if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pure_early_init(pic_0, NULL);
#endif /* CONFIG_PIC_DISABLE */
DECLARE_DEVICE_INIT_CONFIG(ia32_pci_0, "", ia32_pci_init, NULL);
pure_early_init(ia32_pci_0, NULL);

View file

@ -41,6 +41,7 @@ to prevent it from generating spurious interrupts.
#include <arch/cpu.h>
#include <toolchain.h>
#include <sections.h>
#include <device.h>
#include <drivers/pic.h>
#include <board.h>
@ -57,8 +58,10 @@ to prevent it from generating spurious interrupts.
* @return N/A
*/
void _i8259_init(void)
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;
}

View file

@ -52,7 +52,7 @@ extern "C" {
#ifndef _ASMLANGUAGE
extern void _i8259_init(void);
extern int _i8259_init(struct device *unused);
#endif /* _ASMLANGUAGE */