diff --git a/arch/x86/platforms/ia32/system.c b/arch/x86/platforms/ia32/system.c index 8e54d58a0c..bafb2e9232 100644 --- a/arch/x86/platforms/ia32/system.c +++ b/arch/x86/platforms/ia32/system.c @@ -42,20 +42,9 @@ for the ia32 platform. #include #include #include +#include -#ifdef CONFIG_LOAPIC -#include -static inline void loapic_init(void) -{ - _loapic_init(); -} -#else -#define loapic_init() \ - do {/* nothing */ \ - } while ((0)) -#endif /* CONFIG_LOAPIC */ - #ifdef CONFIG_IOAPIC #include static inline void ioapic_init(void) @@ -108,14 +97,18 @@ static int ia32_init(struct device *arg) { ARG_UNUSED(arg); - loapic_init(); /* NOP if not needed */ - ioapic_init(); /* NOP if not needed */ hpet_irq_set(); /* NOP if not needed */ console_irq_set(); /* NOP if not needed */ 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) DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL); diff --git a/arch/x86/platforms/ia32_pci/system.c b/arch/x86/platforms/ia32_pci/system.c index ac9755b76e..7e28f37cbb 100644 --- a/arch/x86/platforms/ia32_pci/system.c +++ b/arch/x86/platforms/ia32_pci/system.c @@ -50,19 +50,8 @@ Handlers for the secondary serial port have not been added. #include #include #include - - -#ifdef CONFIG_LOAPIC #include -static inline void loapic_init(void) -{ - _loapic_init(); -} -#else -#define loapic_init() \ - do { /* nothing */ \ - } while ((0)) -#endif + #ifdef CONFIG_IOAPIC #include @@ -143,7 +132,6 @@ static int ia32_pci_init(struct device *arg) { ARG_UNUSED(arg); - loapic_init(); /* NOP if not needed */ ioapic_init(); /* NOP if not needed */ hpet_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; } +#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) DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL); diff --git a/drivers/interrupt_controller/loapic_intr.c b/drivers/interrupt_controller/loapic_intr.c index 2c146be876..ec2af5cd8e 100644 --- a/drivers/interrupt_controller/loapic_intr.c +++ b/drivers/interrupt_controller/loapic_intr.c @@ -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 */ /* enable the Local APIC */ @@ -259,6 +260,7 @@ void _loapic_init(void) /* discard a pending interrupt if any */ *(volatile int *)(CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_EOI) = 0; + return 0; } /** diff --git a/include/drivers/loapic.h b/include/drivers/loapic.h index 9b207e4acb..de70bf18d3 100644 --- a/include/drivers/loapic.h +++ b/include/drivers/loapic.h @@ -83,7 +83,7 @@ SECTION_FUNC(TEXT, _\()\device\()_\()\isr\()_stub) jmp _IntExit /* Inform kernel interrupt is done */ .endm #else /* _ASMLANGUAGE */ -extern void _loapic_init(void); +extern int _loapic_init(struct device *unused); extern void _loapic_eoi(unsigned int irq); extern void _loapic_int_vec_set(unsigned int irq, unsigned int vector); extern void _loapic_irq_enable(unsigned int irq);