Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/local_apic.c
Context not available. | |||||
volatile char *lapic_map; | volatile char *lapic_map; | ||||
vm_paddr_t lapic_paddr; | vm_paddr_t lapic_paddr; | ||||
int x2apic_mode; | int x2apic_mode; | ||||
int lapic_eoi_suppression; | |||||
static u_long lapic_timer_divisor; | static u_long lapic_timer_divisor; | ||||
static struct eventtimer lapic_et; | static struct eventtimer lapic_et; | ||||
SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options"); | SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options"); | ||||
SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, &x2apic_mode, 0, ""); | SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, &x2apic_mode, 0, ""); | ||||
SYSCTL_INT(_hw_apic, OID_AUTO, eoi_suppression, CTLFLAG_RD, | |||||
&lapic_eoi_suppression, 0, ""); | |||||
static uint32_t | static uint32_t | ||||
lapic_read32(enum LAPIC_REGISTERS reg) | lapic_read32(enum LAPIC_REGISTERS reg) | ||||
Context not available. | |||||
static void | static void | ||||
native_lapic_init(vm_paddr_t addr) | native_lapic_init(vm_paddr_t addr) | ||||
{ | { | ||||
uint32_t ver; | |||||
u_int regs[4]; | u_int regs[4]; | ||||
int i, arat; | int i, arat; | ||||
Context not available. | |||||
lapic_et.et_priv = NULL; | lapic_et.et_priv = NULL; | ||||
et_register(&lapic_et); | et_register(&lapic_et); | ||||
} | } | ||||
/* | |||||
* Set lapic_eoi_suppression after lapic_enable(), to not | |||||
* enable suppression in the hardware prematurely. Note that | |||||
* we by default enable suppression even when system only has | |||||
* one IO-APIC, since EOI is broadcasted to all APIC agents, | |||||
* including CPUs, otherwise. | |||||
*/ | |||||
ver = lapic_read32(LAPIC_VERSION); | |||||
if ((ver & APIC_VER_EOI_SUPPRESSION) != 0) { | |||||
lapic_eoi_suppression = 1; | |||||
TUNABLE_INT_FETCH("hw.lapic_eoi_suppression", | |||||
&lapic_eoi_suppression); | |||||
} | |||||
} | } | ||||
/* | /* | ||||
Context not available. | |||||
value = lapic_read32(LAPIC_SVR); | value = lapic_read32(LAPIC_SVR); | ||||
value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); | value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); | ||||
value |= APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT; | value |= APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT; | ||||
if (lapic_eoi_suppression) | |||||
value |= APIC_SVR_EOI_SUPPRESSION; | |||||
lapic_write32(LAPIC_SVR, value); | lapic_write32(LAPIC_SVR, value); | ||||
} | } | ||||
Context not available. | |||||
return; | return; | ||||
#endif | #endif | ||||
/* | /* | ||||
* Finish setting up the local APIC on the BSP once we know how to | * Finish setting up the local APIC on the BSP once we know | ||||
* properly program the LINT pins. | * how to properly program the LINT pins. In particular, this | ||||
* enables the EOI suppression mode, if LAPIC support it and | |||||
* user did not disabled the mode. | |||||
*/ | */ | ||||
lapic_setup(1); | lapic_setup(1); | ||||
if (bootverbose) | if (bootverbose) | ||||
Context not available. |