arch/x86: drivers/loapic_intr.c: move local APIC initialization

In the general case, the local APIC can't be treated as a normal device
with a single boot-time initialization - on SMP systems, each CPU must
initialize its own. Hence the initialization proper is separated from
the device-driver initialization, and said initialization is called
from the early startup-assembly code when appropriate.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-28 16:58:22 -04:00 committed by Anas Nashif
commit a981f51fe6
4 changed files with 24 additions and 8 deletions

View file

@ -66,18 +66,13 @@ static u32_t loapic_device_power_state = DEVICE_PM_ACTIVE_STATE;
#endif
/**
* @brief Enable and initialize the local APIC.
*
* @brief Initialize the Local APIC or xAPIC
*
* This routine initializes Local APIC or xAPIC.
*
* @return N/A
*
* Called from early assembly layer (e.g., crt0.S).
*/
static int loapic_init(struct device *unused)
void z_loapic_enable(void)
{
ARG_UNUSED(unused);
s32_t loApicMaxLvt; /* local APIC Max LVT */
/*
@ -150,7 +145,19 @@ static int loapic_init(struct device *unused)
/* discard a pending interrupt if any */
x86_write_loapic(LOAPIC_EOI, 0);
}
/**
*
* @brief Dummy initialization function.
*
* The local APIC is initialized via z_loapic_enable() long before the
* kernel runs through its device initializations, so this is unneeded.
*/
static int loapic_init(struct device *unused)
{
ARG_UNUSED(unused);
return 0;
}