summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-04-27 20:03:26 +0000
committerjhb <jhb@FreeBSD.org>2004-04-27 20:03:26 +0000
commit5b2742dec23b23e74fb86a9994892cfe1ffad420 (patch)
tree9f3002ea91b9bb88d609503fd8f7b6bf61e451a5
parentccbc6f1994d9c3d6017abad3b1f1c335ea2b75d4 (diff)
downloadFreeBSD-src-5b2742dec23b23e74fb86a9994892cfe1ffad420.zip
FreeBSD-src-5b2742dec23b23e74fb86a9994892cfe1ffad420.tar.gz
- The i8254 uses IRQ 0, not IRQ 8. Correct i8254_intsrc to reference the
correct interrupt source. - Cache a pointer to the i8254_intsrc's pending method to avoid several pointer indirections in i8254_get_timecount(). Reported by: bde
-rw-r--r--sys/i386/isa/clock.c10
-rw-r--r--sys/isa/atrtc.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index d6e42ee..e7c3d26 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -131,10 +131,11 @@ struct mtx clock_lock;
static int beeping = 0;
static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
static u_int hardclock_max_count;
+static struct intsrc *i8254_intsrc;
static u_int32_t i8254_lastcount;
static u_int32_t i8254_offset;
+static int (*i8254_pending)(struct intsrc *);
static int i8254_ticked;
-static struct intsrc *i8254_intsrc;
#ifndef BURN_BRIDGES
/*
* XXX new_function and timer_func should not handle clockframes, but
@@ -934,6 +935,9 @@ cpu_initclocks()
/* Finish initializing 8254 timer 0. */
intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
+ i8254_intsrc = intr_lookup_source(0);
+ if (i8254_intsrc != NULL)
+ i8254_pending = i8254_intsrc->is_pic->pic_source_pending;
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
@@ -947,7 +951,6 @@ cpu_initclocks()
intr_add_handler("rtc", 8, (driver_intr_t *)rtcintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
- i8254_intsrc = intr_lookup_source(8);
writertc(RTC_STATUSB, rtc_statusb);
}
@@ -1018,8 +1021,7 @@ i8254_get_timecount(struct timecounter *tc)
if (count < i8254_lastcount ||
(!i8254_ticked && (clkintr_pending ||
((count < 20 || (!(eflags & PSL_I) && count < timer0_max_count / 2u)) &&
- i8254_intsrc != NULL &&
- i8254_intsrc->is_pic->pic_source_pending(i8254_intsrc))))) {
+ i8254_pending != NULL && i8254_pending(i8254_intsrc))))) {
i8254_ticked = 1;
i8254_offset += timer0_max_count;
}
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index d6e42ee..e7c3d26 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -131,10 +131,11 @@ struct mtx clock_lock;
static int beeping = 0;
static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
static u_int hardclock_max_count;
+static struct intsrc *i8254_intsrc;
static u_int32_t i8254_lastcount;
static u_int32_t i8254_offset;
+static int (*i8254_pending)(struct intsrc *);
static int i8254_ticked;
-static struct intsrc *i8254_intsrc;
#ifndef BURN_BRIDGES
/*
* XXX new_function and timer_func should not handle clockframes, but
@@ -934,6 +935,9 @@ cpu_initclocks()
/* Finish initializing 8254 timer 0. */
intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
+ i8254_intsrc = intr_lookup_source(0);
+ if (i8254_intsrc != NULL)
+ i8254_pending = i8254_intsrc->is_pic->pic_source_pending;
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
@@ -947,7 +951,6 @@ cpu_initclocks()
intr_add_handler("rtc", 8, (driver_intr_t *)rtcintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
- i8254_intsrc = intr_lookup_source(8);
writertc(RTC_STATUSB, rtc_statusb);
}
@@ -1018,8 +1021,7 @@ i8254_get_timecount(struct timecounter *tc)
if (count < i8254_lastcount ||
(!i8254_ticked && (clkintr_pending ||
((count < 20 || (!(eflags & PSL_I) && count < timer0_max_count / 2u)) &&
- i8254_intsrc != NULL &&
- i8254_intsrc->is_pic->pic_source_pending(i8254_intsrc))))) {
+ i8254_pending != NULL && i8254_pending(i8254_intsrc))))) {
i8254_ticked = 1;
i8254_offset += timer0_max_count;
}
OpenPOWER on IntegriCloud