x86: move IOAPIC driver to device model/init system

Change the IOAPIC driver to be initialized directly from the init
system. The function signature of _ioapic_init() function is updated
accordingly.

Change-Id: I2f824ac745926966eebb23f60445a41e1df9eb8f
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
parent be1b1a4e35
commit 25c9d021a5
4 changed files with 16 additions and 28 deletions

View file

@ -43,19 +43,7 @@ for the ia32 platform.
#include <device.h>
#include <init.h>
#include <loapic.h>
#ifdef CONFIG_IOAPIC
#include <drivers/ioapic.h>
static inline void ioapic_init(void)
{
_ioapic_init();
}
#else
#define ioapic_init(mask) \
do {/* nothing */ \
} while ((0))
#endif /* CONFIG_IOAPIC */
#ifdef CONFIG_HPET_TIMER
#include <drivers/hpet.h>
@ -97,12 +85,17 @@ static int ia32_init(struct device *arg)
{
ARG_UNUSED(arg);
ioapic_init(); /* NOP if not needed */
hpet_irq_set(); /* NOP if not needed */
console_irq_set(); /* NOP if not needed */
return 0;
}
#ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pure_early_init(ioapic_0, NULL);
#endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pure_early_init(loapic_0, NULL);

View file

@ -51,19 +51,7 @@ Handlers for the secondary serial port have not been added.
#include <drivers/pci/pci.h>
#include <drivers/pci/pci_mgr.h>
#include <drivers/loapic.h>
#ifdef CONFIG_IOAPIC
#include <drivers/ioapic.h>
static inline void ioapic_init(void)
{
_ioapic_init();
}
#else
#define ioapic_init() \
do { /* nothing */ \
} while ((0))
#endif
#ifdef CONFIG_HPET_TIMER
#include <drivers/hpet.h>
@ -132,7 +120,6 @@ static int ia32_pci_init(struct device *arg)
{
ARG_UNUSED(arg);
ioapic_init(); /* NOP if not needed */
hpet_irq_set(); /* NOP if not needed */
console_irq_set(); /* NOP if not needed */
gpio_irq_set(); /* NOP if not needed */
@ -160,6 +147,12 @@ static int ia32_pci_init(struct device *arg)
return 0;
}
#ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pure_early_init(ioapic_0, NULL);
#endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pure_early_init(loapic_0, NULL);

View file

@ -216,8 +216,9 @@ static void _IoApicRedUpdateLo(unsigned int irq, uint32_t value,
*
* @return N/A
*/
void _ioapic_init(void)
int _ioapic_init(struct device *unused)
{
ARG_UNUSED(unused);
int32_t ix; /* redirection table index */
uint32_t rteValue; /* value to copy into redirection table entry */
@ -250,6 +251,7 @@ void _ioapic_init(void)
ioApicRedSetHi(ix, 0);
ioApicRedSetLo(ix, rteValue);
}
return 0;
}
/**

View file

@ -73,7 +73,7 @@ SECTION_FUNC(TEXT, _\()\device\()_\()\isr\()_stub)
jmp _IntExit /* Inform kernel interrupt is done */
.endm
#else /* _ASMLANGUAGE */
void _ioapic_init(void);
int _ioapic_init(struct device *unused);
void _ioapic_eoi(unsigned int irq);
void *_ioapic_eoi_get(unsigned int irq, char *argRequired, void **arg);
void _ioapic_irq_enable(unsigned int irq);