- 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
This commit is contained in:
parent
c9be1bb2f8
commit
f9acc6410e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128695
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user