Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/local_apic.c
Show First 20 Lines • Show All 1,446 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Inter Processor Interrupt functions. The lapic_ipi_*() functions are | * Inter Processor Interrupt functions. The lapic_ipi_*() functions are | ||||
* private to the MD code. The public interface for the rest of the | * private to the MD code. The public interface for the rest of the | ||||
* kernel is defined in mp_machdep.c. | * kernel is defined in mp_machdep.c. | ||||
*/ | */ | ||||
static int | static int | ||||
native_lapic_ipi_wait(int delay) | native_lapic_ipi_wait(int delay) | ||||
{ | { | ||||
int x, incr; | int x; | ||||
/* | /* | ||||
* Wait delay loops for IPI to be sent. This is highly bogus | * Wait delay microseconds for IPI to be sent. If delay is | ||||
* since this is sensitive to CPU clock speed. If delay is | |||||
* -1, we wait forever. | * -1, we wait forever. | ||||
*/ | */ | ||||
if (delay == -1) { | if (delay == -1) { | ||||
incr = 0; | while ((lapic->icr_lo & APIC_DELSTAT_MASK) != APIC_DELSTAT_IDLE) | ||||
delay = 1; | ia32_pause(); | ||||
} else | return (1); | ||||
incr = 1; | } | ||||
for (x = 0; x < delay; x += incr) { | |||||
for (x = 0; x < delay; x += 5) { | |||||
if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) | if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) | ||||
return (1); | return (1); | ||||
ia32_pause(); | DELAY(5); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
native_lapic_ipi_raw(register_t icrlo, u_int dest) | native_lapic_ipi_raw(register_t icrlo, u_int dest) | ||||
{ | { | ||||
register_t value, saveintr; | register_t value, saveintr; | ||||
Show All 17 Lines | native_lapic_ipi_raw(register_t icrlo, u_int dest) | ||||
/* Program the contents of the IPI and dispatch it. */ | /* Program the contents of the IPI and dispatch it. */ | ||||
value = lapic->icr_lo; | value = lapic->icr_lo; | ||||
value &= APIC_ICRLO_RESV_MASK; | value &= APIC_ICRLO_RESV_MASK; | ||||
value |= icrlo; | value |= icrlo; | ||||
lapic->icr_lo = value; | lapic->icr_lo = value; | ||||
intr_restore(saveintr); | intr_restore(saveintr); | ||||
} | } | ||||
#define BEFORE_SPIN 1000000 | #define BEFORE_SPIN 50000 | ||||
#ifdef DETECT_DEADLOCK | #ifdef DETECT_DEADLOCK | ||||
#define AFTER_SPIN 1000 | #define AFTER_SPIN 50 | ||||
#endif | #endif | ||||
static void | static void | ||||
native_lapic_ipi_vectored(u_int vector, int dest) | native_lapic_ipi_vectored(u_int vector, int dest) | ||||
{ | { | ||||
register_t icrlo, destfield; | register_t icrlo, destfield; | ||||
KASSERT((vector & ~APIC_VECTOR_MASK) == 0, | KASSERT((vector & ~APIC_VECTOR_MASK) == 0, | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |