Use the standard timer (interrupt) frequency while calibrating the clocks.

Testing with the high frequency of 20000 Hz (to find problems) only found
the problem that this frequency is too high for slow i386's.

Disable interrupts while setting the timer frequency.  This was unnecessary
before rev.1.57 and forgotten in rev.1.57.  The critical (i8254) interrupts
are disabled in another way at boot time but not in the sysctl to change
the frequency.
This commit is contained in:
Bruce Evans 1996-07-01 18:00:47 +00:00
parent f441029838
commit d2700ee639
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16874
5 changed files with 20 additions and 35 deletions

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
* $Id: clock.c,v 1.61 1996/06/17 12:50:22 bde Exp $
*/
/*
@ -520,9 +520,10 @@ calibrate_clocks(void)
static void
set_timer_freq(u_int freq, int intr_freq)
{
u_long ef;
u_long ef;
ef = read_eflags();
disable_intr();
timer_freq = freq;
timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT;
@ -544,11 +545,7 @@ startrtclock()
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
/*
* Temporarily calibrate with a high intr_freq to get a low
* timer0_max_count to help detect bogus i8254 counts.
*/
set_timer_freq(timer_freq, 20000);
set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
* $Id: clock.c,v 1.61 1996/06/17 12:50:22 bde Exp $
*/
/*
@ -520,9 +520,10 @@ calibrate_clocks(void)
static void
set_timer_freq(u_int freq, int intr_freq)
{
u_long ef;
u_long ef;
ef = read_eflags();
disable_intr();
timer_freq = freq;
timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT;
@ -544,11 +545,7 @@ startrtclock()
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
/*
* Temporarily calibrate with a high intr_freq to get a low
* timer0_max_count to help detect bogus i8254 counts.
*/
set_timer_freq(timer_freq, 20000);
set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
* $Id: clock.c,v 1.61 1996/06/17 12:50:22 bde Exp $
*/
/*
@ -520,9 +520,10 @@ calibrate_clocks(void)
static void
set_timer_freq(u_int freq, int intr_freq)
{
u_long ef;
u_long ef;
ef = read_eflags();
disable_intr();
timer_freq = freq;
timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT;
@ -544,11 +545,7 @@ startrtclock()
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
/*
* Temporarily calibrate with a high intr_freq to get a low
* timer0_max_count to help detect bogus i8254 counts.
*/
set_timer_freq(timer_freq, 20000);
set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
* $Id: clock.c,v 1.61 1996/06/17 12:50:22 bde Exp $
*/
/*
@ -520,9 +520,10 @@ calibrate_clocks(void)
static void
set_timer_freq(u_int freq, int intr_freq)
{
u_long ef;
u_long ef;
ef = read_eflags();
disable_intr();
timer_freq = freq;
timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT;
@ -544,11 +545,7 @@ startrtclock()
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
/*
* Temporarily calibrate with a high intr_freq to get a low
* timer0_max_count to help detect bogus i8254 counts.
*/
set_timer_freq(timer_freq, 20000);
set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
* $Id: clock.c,v 1.61 1996/06/17 12:50:22 bde Exp $
*/
/*
@ -520,9 +520,10 @@ calibrate_clocks(void)
static void
set_timer_freq(u_int freq, int intr_freq)
{
u_long ef;
u_long ef;
ef = read_eflags();
disable_intr();
timer_freq = freq;
timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT;
@ -544,11 +545,7 @@ startrtclock()
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
/*
* Temporarily calibrate with a high intr_freq to get a low
* timer0_max_count to help detect bogus i8254 counts.
*/
set_timer_freq(timer_freq, 20000);
set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {