summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-08-24 16:08:01 +0000
committermav <mav@FreeBSD.org>2010-08-24 16:08:01 +0000
commit7d99c51342a411a4c0811b2bcb6db8a8355365b4 (patch)
tree65a3319efdb0967e6d94e0d6210620e29c3fc904
parente94d012481f51b1c96ec6db586b9c5d154b19f91 (diff)
downloadFreeBSD-src-7d99c51342a411a4c0811b2bcb6db8a8355365b4.zip
FreeBSD-src-7d99c51342a411a4c0811b2bcb6db8a8355365b4.tar.gz
Enable timer interrupt before starting timer. This allows to handle very
short periods without interrupt loss.
-rw-r--r--sys/x86/x86/local_apic.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 7d19ec1..a05abe4 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -369,12 +369,13 @@ lapic_setup(int boot)
if (la->la_timer_mode != 0) {
KASSERT(la->la_timer_period != 0, ("lapic%u: zero divisor",
lapic_id()));
+ lapic_timer_stop();
lapic_timer_set_divisor(lapic_timer_divisor);
+ lapic_timer_enable_intr();
if (la->la_timer_mode == 1)
lapic_timer_periodic(la->la_timer_period);
else
lapic_timer_oneshot(la->la_timer_period);
- lapic_timer_enable_intr();
}
/* Program error LVT and clear any existing errors. */
@@ -505,12 +506,10 @@ lapic_et_start(struct eventtimer *et,
et->et_max_period.frac =
((0xfffffffeLLU << 32) / et->et_frequency) << 32;
}
- la = &lapics[lapic_id()];
- /*
- * Start up the timer on the BSP. The APs will kick off their
- * timer during lapic_setup().
- */
+ lapic_timer_stop();
lapic_timer_set_divisor(lapic_timer_divisor);
+ lapic_timer_enable_intr();
+ la = &lapics[lapic_id()];
if (period != NULL) {
la->la_timer_mode = 1;
la->la_timer_period =
@@ -526,7 +525,6 @@ lapic_et_start(struct eventtimer *et,
la->la_timer_period += et->et_frequency * first->sec;
lapic_timer_oneshot(la->la_timer_period);
}
- lapic_timer_enable_intr();
return (0);
}
@@ -862,8 +860,9 @@ lapic_timer_stop(void)
value = lapic->lvt_timer;
value &= ~APIC_LVTT_TM;
- value &= ~APIC_LVT_M;
+ value |= APIC_LVT_M;
lapic->lvt_timer = value;
+ lapic->icr_timer = 0;
}
static void
OpenPOWER on IntegriCloud