summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-05-06 22:45:33 +0000
committerattilio <attilio@FreeBSD.org>2011-05-06 22:45:33 +0000
commita0b51ba62fa86f5faf7bbd81e0b91ba497fec05a (patch)
treeb6f763bb2e3a9eaf32a3ee9adca98cc9e867998c /sys/x86
parent8534b0c2951283889da00ca8a244058185638240 (diff)
downloadFreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.zip
FreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.tar.gz
MFC
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/isa/isa.c22
-rw-r--r--sys/x86/x86/local_apic.c38
2 files changed, 13 insertions, 47 deletions
diff --git a/sys/x86/isa/isa.c b/sys/x86/isa/isa.c
index 7b2982a..1a57137 100644
--- a/sys/x86/isa/isa.c
+++ b/sys/x86/isa/isa.c
@@ -238,28 +238,6 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
}
/*
- * We can't use the bus_generic_* versions of these methods because those
- * methods always pass the bus param as the requesting device, and we need
- * to pass the child (the i386 nexus knows about this and is prepared to
- * deal).
- */
-int
-isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
- driver_filter_t *filter, void (*ihand)(void *), void *arg,
- void **cookiep)
-{
- return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags,
- filter, ihand, arg, cookiep));
-}
-
-int
-isa_teardown_intr(device_t bus, device_t child, struct resource *r,
- void *cookie)
-{
- return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie));
-}
-
-/*
* On this platform, isa can also attach to the legacy bus.
*/
DRIVER_MODULE(isa, legacy, isa_driver, isa_devclass, 0, 0);
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index e81d2fe..dfef3a7 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -159,9 +159,8 @@ static struct eventtimer lapic_et;
static void lapic_enable(void);
static void lapic_resume(struct pic *pic);
-static void lapic_timer_enable_intr(void);
-static void lapic_timer_oneshot(u_int count);
-static void lapic_timer_periodic(u_int count);
+static void lapic_timer_oneshot(u_int count, int enable_int);
+static void lapic_timer_periodic(u_int count, int enable_int);
static void lapic_timer_stop(void);
static void lapic_timer_set_divisor(u_int divisor);
static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value);
@@ -379,13 +378,11 @@ 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);
+ lapic_timer_periodic(la->la_timer_period, 1);
else
- lapic_timer_oneshot(la->la_timer_period);
+ lapic_timer_oneshot(la->la_timer_period, 1);
}
/* Program error LVT and clear any existing errors. */
@@ -496,7 +493,7 @@ lapic_et_start(struct eventtimer *et,
/* Try to calibrate the local APIC timer. */
do {
lapic_timer_set_divisor(lapic_timer_divisor);
- lapic_timer_oneshot(APIC_TIMER_MAX_COUNT);
+ lapic_timer_oneshot(APIC_TIMER_MAX_COUNT, 0);
DELAY(1000000);
value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer;
if (value != APIC_TIMER_MAX_COUNT)
@@ -516,9 +513,7 @@ lapic_et_start(struct eventtimer *et,
et->et_max_period.frac =
((0xfffffffeLLU << 32) / et->et_frequency) << 32;
}
- 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;
@@ -526,14 +521,14 @@ lapic_et_start(struct eventtimer *et,
(et->et_frequency * (period->frac >> 32)) >> 32;
if (period->sec != 0)
la->la_timer_period += et->et_frequency * period->sec;
- lapic_timer_periodic(la->la_timer_period);
+ lapic_timer_periodic(la->la_timer_period, 1);
} else {
la->la_timer_mode = 2;
la->la_timer_period =
(et->et_frequency * (first->frac >> 32)) >> 32;
if (first->sec != 0)
la->la_timer_period += et->et_frequency * first->sec;
- lapic_timer_oneshot(la->la_timer_period);
+ lapic_timer_oneshot(la->la_timer_period, 1);
}
return (0);
}
@@ -838,25 +833,29 @@ lapic_timer_set_divisor(u_int divisor)
}
static void
-lapic_timer_oneshot(u_int count)
+lapic_timer_oneshot(u_int count, int enable_int)
{
u_int32_t value;
value = lapic->lvt_timer;
value &= ~APIC_LVTT_TM;
value |= APIC_LVTT_TM_ONE_SHOT;
+ if (enable_int)
+ value &= ~APIC_LVT_M;
lapic->lvt_timer = value;
lapic->icr_timer = count;
}
static void
-lapic_timer_periodic(u_int count)
+lapic_timer_periodic(u_int count, int enable_int)
{
u_int32_t value;
value = lapic->lvt_timer;
value &= ~APIC_LVTT_TM;
value |= APIC_LVTT_TM_PERIODIC;
+ if (enable_int)
+ value &= ~APIC_LVT_M;
lapic->lvt_timer = value;
lapic->icr_timer = count;
}
@@ -870,17 +869,6 @@ lapic_timer_stop(void)
value &= ~APIC_LVTT_TM;
value |= APIC_LVT_M;
lapic->lvt_timer = value;
- lapic->icr_timer = 0;
-}
-
-static void
-lapic_timer_enable_intr(void)
-{
- u_int32_t value;
-
- value = lapic->lvt_timer;
- value &= ~APIC_LVT_M;
- lapic->lvt_timer = value;
}
void
OpenPOWER on IntegriCloud