x86: move LOAPIC driver to device model/init system
Change the LOAPIC driver to be initialized directly from the init system. The function signature of _loapic_init() function is updated accordingly. Change-Id: I5ed26d53524c8526d413a05ac9a7a58dd4264c5a Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
This commit is contained in:
parent
1bcb7a339a
commit
be1b1a4e35
|
@ -42,20 +42,9 @@ for the ia32 platform.
|
||||||
#include <drivers/pic.h>
|
#include <drivers/pic.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
#include <loapic.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_LOAPIC
|
|
||||||
#include <drivers/loapic.h>
|
|
||||||
static inline void loapic_init(void)
|
|
||||||
{
|
|
||||||
_loapic_init();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define loapic_init() \
|
|
||||||
do {/* nothing */ \
|
|
||||||
} while ((0))
|
|
||||||
#endif /* CONFIG_LOAPIC */
|
|
||||||
|
|
||||||
#ifdef CONFIG_IOAPIC
|
#ifdef CONFIG_IOAPIC
|
||||||
#include <drivers/ioapic.h>
|
#include <drivers/ioapic.h>
|
||||||
static inline void ioapic_init(void)
|
static inline void ioapic_init(void)
|
||||||
|
@ -108,14 +97,18 @@ static int ia32_init(struct device *arg)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(arg);
|
ARG_UNUSED(arg);
|
||||||
|
|
||||||
loapic_init(); /* NOP if not needed */
|
|
||||||
|
|
||||||
ioapic_init(); /* NOP if not needed */
|
ioapic_init(); /* NOP if not needed */
|
||||||
hpet_irq_set(); /* NOP if not needed */
|
hpet_irq_set(); /* NOP if not needed */
|
||||||
console_irq_set(); /* NOP if not needed */
|
console_irq_set(); /* NOP if not needed */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_LOAPIC
|
||||||
|
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
|
||||||
|
pure_early_init(loapic_0, NULL);
|
||||||
|
|
||||||
|
#endif /* CONFIG_LOAPIC */
|
||||||
|
|
||||||
#if defined(CONFIG_PIC_DISABLE)
|
#if defined(CONFIG_PIC_DISABLE)
|
||||||
|
|
||||||
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
|
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
|
||||||
|
|
|
@ -50,19 +50,8 @@ Handlers for the secondary serial port have not been added.
|
||||||
#include <drivers/pic.h>
|
#include <drivers/pic.h>
|
||||||
#include <drivers/pci/pci.h>
|
#include <drivers/pci/pci.h>
|
||||||
#include <drivers/pci/pci_mgr.h>
|
#include <drivers/pci/pci_mgr.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_LOAPIC
|
|
||||||
#include <drivers/loapic.h>
|
#include <drivers/loapic.h>
|
||||||
static inline void loapic_init(void)
|
|
||||||
{
|
|
||||||
_loapic_init();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define loapic_init() \
|
|
||||||
do { /* nothing */ \
|
|
||||||
} while ((0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_IOAPIC
|
#ifdef CONFIG_IOAPIC
|
||||||
#include <drivers/ioapic.h>
|
#include <drivers/ioapic.h>
|
||||||
|
@ -143,7 +132,6 @@ static int ia32_pci_init(struct device *arg)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(arg);
|
ARG_UNUSED(arg);
|
||||||
|
|
||||||
loapic_init(); /* NOP if not needed */
|
|
||||||
ioapic_init(); /* NOP if not needed */
|
ioapic_init(); /* NOP if not needed */
|
||||||
hpet_irq_set(); /* NOP if not needed */
|
hpet_irq_set(); /* NOP if not needed */
|
||||||
console_irq_set(); /* NOP if not needed */
|
console_irq_set(); /* NOP if not needed */
|
||||||
|
@ -172,6 +160,12 @@ static int ia32_pci_init(struct device *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_LOAPIC
|
||||||
|
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
|
||||||
|
pure_early_init(loapic_0, NULL);
|
||||||
|
|
||||||
|
#endif /* CONFIG_LOAPIC */
|
||||||
|
|
||||||
#if defined(CONFIG_PIC_DISABLE)
|
#if defined(CONFIG_PIC_DISABLE)
|
||||||
|
|
||||||
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
|
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
|
||||||
|
|
|
@ -205,8 +205,9 @@ INCLUDE FILES: loapic.h
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _loapic_init(void)
|
int _loapic_init(struct device *unused)
|
||||||
{
|
{
|
||||||
|
ARG_UNUSED(unused);
|
||||||
int32_t loApicMaxLvt; /* local APIC Max LVT */
|
int32_t loApicMaxLvt; /* local APIC Max LVT */
|
||||||
|
|
||||||
/* enable the Local APIC */
|
/* enable the Local APIC */
|
||||||
|
@ -259,6 +260,7 @@ void _loapic_init(void)
|
||||||
/* discard a pending interrupt if any */
|
/* discard a pending interrupt if any */
|
||||||
|
|
||||||
*(volatile int *)(CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_EOI) = 0;
|
*(volatile int *)(CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_EOI) = 0;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -83,7 +83,7 @@ SECTION_FUNC(TEXT, _\()\device\()_\()\isr\()_stub)
|
||||||
jmp _IntExit /* Inform kernel interrupt is done */
|
jmp _IntExit /* Inform kernel interrupt is done */
|
||||||
.endm
|
.endm
|
||||||
#else /* _ASMLANGUAGE */
|
#else /* _ASMLANGUAGE */
|
||||||
extern void _loapic_init(void);
|
extern int _loapic_init(struct device *unused);
|
||||||
extern void _loapic_eoi(unsigned int irq);
|
extern void _loapic_eoi(unsigned int irq);
|
||||||
extern void _loapic_int_vec_set(unsigned int irq, unsigned int vector);
|
extern void _loapic_int_vec_set(unsigned int irq, unsigned int vector);
|
||||||
extern void _loapic_irq_enable(unsigned int irq);
|
extern void _loapic_irq_enable(unsigned int irq);
|
||||||
|
|
Loading…
Reference in a new issue