aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNate Williams <nate@FreeBSD.org>1996-04-22 19:40:28 +0000
committerNate Williams <nate@FreeBSD.org>1996-04-22 19:40:28 +0000
commite597b4972e665d578f46823da2bfa77346b2e338 (patch)
tree741690a9594b4c514b3873326f1166df1f184550 /sys
parent003aaef883db5f18fd43cfb6cc019383d681221b (diff)
downloadsrc-e597b4972e665d578f46823da2bfa77346b2e338.tar.gz
src-e597b4972e665d578f46823da2bfa77346b2e338.zip
- add apm to the GENERIC kernel (disabled by default), and add some comments
regarding apm to LINT - Disabled the statistics clock on machines which have an APM BIOS and have the options "APM_BROKEN_STATCLOCK" enabled (which is default in GENERIC now) - move around some of the code in clock.c dealing with the rtc to make it more obvios the effects of disabling the statistics clock Reviewed by: bde
Notes
Notes: svn path=/head/; revision=15345
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/tsc.c28
-rw-r--r--sys/amd64/conf/GENERIC8
-rw-r--r--sys/amd64/include/clock.h3
-rw-r--r--sys/amd64/isa/clock.c28
-rw-r--r--sys/conf/NOTES11
-rw-r--r--sys/i386/apm/apm.c5
-rw-r--r--sys/i386/bios/apm.c5
-rw-r--r--sys/i386/conf/GENERIC8
-rw-r--r--sys/i386/conf/LINT11
-rw-r--r--sys/i386/conf/NOTES11
-rw-r--r--sys/i386/i386/tsc.c28
-rw-r--r--sys/i386/include/clock.h3
-rw-r--r--sys/i386/isa/clock.c28
-rw-r--r--sys/isa/atrtc.c28
14 files changed, 171 insertions, 34 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 75fbcee39be5..d26b30c7eca1 100644
--- a/sys/amd64/amd64/tsc.c
+++ b/sys/amd64/amd64/tsc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.55 1996/04/05 03:36:31 ache Exp $
+ * $Id: clock.c,v 1.56 1996/04/05 18:56:10 ache Exp $
*/
/*
@@ -103,6 +103,7 @@ long long i586_ctr_bias;
long long i586_last_tick;
unsigned long i586_avg_tick;
#endif
+int statclock_disable;
u_int stat_imask = SWI_CLOCK_MASK;
int timer0_max_count;
u_int timer0_overflow_threshold;
@@ -123,6 +124,7 @@ static u_int hardclock_max_count;
static void (*new_function) __P((struct clockframe *frame));
static u_int new_rate;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
static char timer0_state = 0;
static char timer2_state = 0;
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
@@ -559,7 +561,7 @@ resettodr()
writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
/* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
/*
@@ -570,8 +572,20 @@ cpu_initclocks()
{
int diag;
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
+ if (statclock_disable) {
+ /*
+ * The stat interrupt mask is different without the
+ * statistics clock. Also, don't set the interrupt
+ * flag which would normally cause the RTC to generate
+ * interrupts.
+ */
+ stat_imask = HWI_MASK | SWI_MASK;
+ rtc_statusb = RTCSB_24HR;
+ } else {
+ /* Setting stathz to nonzero early helps avoid races. */
+ stathz = RTC_NOPROFRATE;
+ profhz = RTC_PROFRATE;
+ }
/* Finish initializing 8253 timer 0. */
register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
@@ -591,6 +605,10 @@ cpu_initclocks()
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
+
+ /* Don't bother enabling the statistics clock. */
+ if (statclock_disable)
+ return;
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -598,7 +616,7 @@ cpu_initclocks()
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
void
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 350cdd79dce9..7239d911aacd 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -1,7 +1,7 @@
#
# GENERIC -- Generic machine with WD/AHx/NCR/BTx family disks
#
-# $Id: GENERIC,v 1.65 1996/04/10 23:03:36 jkh Exp $
+# $Id: GENERIC,v 1.66 1996/04/18 04:02:30 nate Exp $
#
machine "i386"
@@ -92,6 +92,12 @@ device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
# Mandatory, don't remove
device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
+#
+# Laptop support (see LINT for more options)
+#
+device apm0 at isa? disable # Advanced Power Management
+options APM_BROKEN_STATCLOCK # Workaround some buggy APM BIOS
+
device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
diff --git a/sys/amd64/include/clock.h b/sys/amd64/include/clock.h
index e3904155e6a3..b624a616ce69 100644
--- a/sys/amd64/include/clock.h
+++ b/sys/amd64/include/clock.h
@@ -3,7 +3,7 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
- * $Id: clock.h,v 1.10 1996/03/31 04:05:17 bde Exp $
+ * $Id: clock.h,v 1.11 1996/04/05 03:36:20 ache Exp $
*/
#ifndef _MACHINE_CLOCK_H_
@@ -54,6 +54,7 @@
*/
extern int adjkerntz;
extern int disable_rtc_set;
+extern int statclock_disable;
extern int wall_cmos_clock;
#if defined(I586_CPU) || defined(I686_CPU)
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 75fbcee39be5..d26b30c7eca1 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.55 1996/04/05 03:36:31 ache Exp $
+ * $Id: clock.c,v 1.56 1996/04/05 18:56:10 ache Exp $
*/
/*
@@ -103,6 +103,7 @@ long long i586_ctr_bias;
long long i586_last_tick;
unsigned long i586_avg_tick;
#endif
+int statclock_disable;
u_int stat_imask = SWI_CLOCK_MASK;
int timer0_max_count;
u_int timer0_overflow_threshold;
@@ -123,6 +124,7 @@ static u_int hardclock_max_count;
static void (*new_function) __P((struct clockframe *frame));
static u_int new_rate;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
static char timer0_state = 0;
static char timer2_state = 0;
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
@@ -559,7 +561,7 @@ resettodr()
writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
/* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
/*
@@ -570,8 +572,20 @@ cpu_initclocks()
{
int diag;
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
+ if (statclock_disable) {
+ /*
+ * The stat interrupt mask is different without the
+ * statistics clock. Also, don't set the interrupt
+ * flag which would normally cause the RTC to generate
+ * interrupts.
+ */
+ stat_imask = HWI_MASK | SWI_MASK;
+ rtc_statusb = RTCSB_24HR;
+ } else {
+ /* Setting stathz to nonzero early helps avoid races. */
+ stathz = RTC_NOPROFRATE;
+ profhz = RTC_PROFRATE;
+ }
/* Finish initializing 8253 timer 0. */
register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
@@ -591,6 +605,10 @@ cpu_initclocks()
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
+
+ /* Don't bother enabling the statistics clock. */
+ if (statclock_disable)
+ return;
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -598,7 +616,7 @@ cpu_initclocks()
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
void
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 0eaf65c277c8..7d0e9039f7c9 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.248 1996/04/03 00:28:40 gpalmer Exp $
+# $Id: LINT,v 1.249 1996/04/11 06:19:44 scrappy Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -740,6 +740,14 @@ device pca0 at isa? port IO_TIMER1 tty
# si: Specialix SI/XIO 4-32 port terminal multiplexor
#
+# Notes on APM
+# Some APM implementations will not work with the `statistics clock'
+# enabled, so it's disabled by default if the APM driver is enabled.
+# However, this is not true for all laptops. Try removing the option
+# APM_BROKEN_STATCLOCK and see if suspend/resume work
+#
+
+#
# Notes on the spigot:
# The video spigot is at 0xad6. This port address can not be changed.
# The irq values may only be 10, 11, or 15
@@ -775,6 +783,7 @@ device ctx0 at isa? port 0x230 iomem 0xd0000
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
device qcam0 at isa? port "IO_LPT3" tty
device apm0 at isa?
+options APM_BROKEN_STATCLOCK
device gp0 at isa? port 0x2c0 tty
device gsc0 at isa? port "IO_GSC1" tty drq 3
device joy0 at isa? port "IO_GAME"
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c
index 6ff4766fdd22..f6b490ba06f3 100644
--- a/sys/i386/apm/apm.c
+++ b/sys/i386/apm/apm.c
@@ -14,7 +14,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.37 1996/03/28 14:28:00 scrappy Exp $
+ * $Id: apm.c,v 1.38 1996/04/18 19:21:47 nate Exp $
*/
#include "apm.h"
@@ -617,6 +617,9 @@ apmprobe(struct isa_device *dvp)
printf("apm: 32-bit connection error.\n");
return 0;
}
+#ifdef APM_BROKEN_STATCLOCK
+ statclock_disable = 1;
+#endif
return -1;
}
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index 6ff4766fdd22..f6b490ba06f3 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -14,7 +14,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.37 1996/03/28 14:28:00 scrappy Exp $
+ * $Id: apm.c,v 1.38 1996/04/18 19:21:47 nate Exp $
*/
#include "apm.h"
@@ -617,6 +617,9 @@ apmprobe(struct isa_device *dvp)
printf("apm: 32-bit connection error.\n");
return 0;
}
+#ifdef APM_BROKEN_STATCLOCK
+ statclock_disable = 1;
+#endif
return -1;
}
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 350cdd79dce9..7239d911aacd 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -1,7 +1,7 @@
#
# GENERIC -- Generic machine with WD/AHx/NCR/BTx family disks
#
-# $Id: GENERIC,v 1.65 1996/04/10 23:03:36 jkh Exp $
+# $Id: GENERIC,v 1.66 1996/04/18 04:02:30 nate Exp $
#
machine "i386"
@@ -92,6 +92,12 @@ device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
# Mandatory, don't remove
device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
+#
+# Laptop support (see LINT for more options)
+#
+device apm0 at isa? disable # Advanced Power Management
+options APM_BROKEN_STATCLOCK # Workaround some buggy APM BIOS
+
device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr
device sio2 at isa? port "IO_COM3" tty irq 5 vector siointr
diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT
index 0eaf65c277c8..7d0e9039f7c9 100644
--- a/sys/i386/conf/LINT
+++ b/sys/i386/conf/LINT
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.248 1996/04/03 00:28:40 gpalmer Exp $
+# $Id: LINT,v 1.249 1996/04/11 06:19:44 scrappy Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -740,6 +740,14 @@ device pca0 at isa? port IO_TIMER1 tty
# si: Specialix SI/XIO 4-32 port terminal multiplexor
#
+# Notes on APM
+# Some APM implementations will not work with the `statistics clock'
+# enabled, so it's disabled by default if the APM driver is enabled.
+# However, this is not true for all laptops. Try removing the option
+# APM_BROKEN_STATCLOCK and see if suspend/resume work
+#
+
+#
# Notes on the spigot:
# The video spigot is at 0xad6. This port address can not be changed.
# The irq values may only be 10, 11, or 15
@@ -775,6 +783,7 @@ device ctx0 at isa? port 0x230 iomem 0xd0000
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
device qcam0 at isa? port "IO_LPT3" tty
device apm0 at isa?
+options APM_BROKEN_STATCLOCK
device gp0 at isa? port 0x2c0 tty
device gsc0 at isa? port "IO_GSC1" tty drq 3
device joy0 at isa? port "IO_GAME"
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 0eaf65c277c8..7d0e9039f7c9 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.248 1996/04/03 00:28:40 gpalmer Exp $
+# $Id: LINT,v 1.249 1996/04/11 06:19:44 scrappy Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -740,6 +740,14 @@ device pca0 at isa? port IO_TIMER1 tty
# si: Specialix SI/XIO 4-32 port terminal multiplexor
#
+# Notes on APM
+# Some APM implementations will not work with the `statistics clock'
+# enabled, so it's disabled by default if the APM driver is enabled.
+# However, this is not true for all laptops. Try removing the option
+# APM_BROKEN_STATCLOCK and see if suspend/resume work
+#
+
+#
# Notes on the spigot:
# The video spigot is at 0xad6. This port address can not be changed.
# The irq values may only be 10, 11, or 15
@@ -775,6 +783,7 @@ device ctx0 at isa? port 0x230 iomem 0xd0000
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000 vector spigintr
device qcam0 at isa? port "IO_LPT3" tty
device apm0 at isa?
+options APM_BROKEN_STATCLOCK
device gp0 at isa? port 0x2c0 tty
device gsc0 at isa? port "IO_GSC1" tty drq 3
device joy0 at isa? port "IO_GAME"
diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c
index 75fbcee39be5..d26b30c7eca1 100644
--- a/sys/i386/i386/tsc.c
+++ b/sys/i386/i386/tsc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.55 1996/04/05 03:36:31 ache Exp $
+ * $Id: clock.c,v 1.56 1996/04/05 18:56:10 ache Exp $
*/
/*
@@ -103,6 +103,7 @@ long long i586_ctr_bias;
long long i586_last_tick;
unsigned long i586_avg_tick;
#endif
+int statclock_disable;
u_int stat_imask = SWI_CLOCK_MASK;
int timer0_max_count;
u_int timer0_overflow_threshold;
@@ -123,6 +124,7 @@ static u_int hardclock_max_count;
static void (*new_function) __P((struct clockframe *frame));
static u_int new_rate;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
static char timer0_state = 0;
static char timer2_state = 0;
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
@@ -559,7 +561,7 @@ resettodr()
writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
/* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
/*
@@ -570,8 +572,20 @@ cpu_initclocks()
{
int diag;
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
+ if (statclock_disable) {
+ /*
+ * The stat interrupt mask is different without the
+ * statistics clock. Also, don't set the interrupt
+ * flag which would normally cause the RTC to generate
+ * interrupts.
+ */
+ stat_imask = HWI_MASK | SWI_MASK;
+ rtc_statusb = RTCSB_24HR;
+ } else {
+ /* Setting stathz to nonzero early helps avoid races. */
+ stathz = RTC_NOPROFRATE;
+ profhz = RTC_PROFRATE;
+ }
/* Finish initializing 8253 timer 0. */
register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
@@ -591,6 +605,10 @@ cpu_initclocks()
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
+
+ /* Don't bother enabling the statistics clock. */
+ if (statclock_disable)
+ return;
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -598,7 +616,7 @@ cpu_initclocks()
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
void
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index e3904155e6a3..b624a616ce69 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -3,7 +3,7 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
- * $Id: clock.h,v 1.10 1996/03/31 04:05:17 bde Exp $
+ * $Id: clock.h,v 1.11 1996/04/05 03:36:20 ache Exp $
*/
#ifndef _MACHINE_CLOCK_H_
@@ -54,6 +54,7 @@
*/
extern int adjkerntz;
extern int disable_rtc_set;
+extern int statclock_disable;
extern int wall_cmos_clock;
#if defined(I586_CPU) || defined(I686_CPU)
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 75fbcee39be5..d26b30c7eca1 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.55 1996/04/05 03:36:31 ache Exp $
+ * $Id: clock.c,v 1.56 1996/04/05 18:56:10 ache Exp $
*/
/*
@@ -103,6 +103,7 @@ long long i586_ctr_bias;
long long i586_last_tick;
unsigned long i586_avg_tick;
#endif
+int statclock_disable;
u_int stat_imask = SWI_CLOCK_MASK;
int timer0_max_count;
u_int timer0_overflow_threshold;
@@ -123,6 +124,7 @@ static u_int hardclock_max_count;
static void (*new_function) __P((struct clockframe *frame));
static u_int new_rate;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
static char timer0_state = 0;
static char timer2_state = 0;
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
@@ -559,7 +561,7 @@ resettodr()
writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
/* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
/*
@@ -570,8 +572,20 @@ cpu_initclocks()
{
int diag;
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
+ if (statclock_disable) {
+ /*
+ * The stat interrupt mask is different without the
+ * statistics clock. Also, don't set the interrupt
+ * flag which would normally cause the RTC to generate
+ * interrupts.
+ */
+ stat_imask = HWI_MASK | SWI_MASK;
+ rtc_statusb = RTCSB_24HR;
+ } else {
+ /* Setting stathz to nonzero early helps avoid races. */
+ stathz = RTC_NOPROFRATE;
+ profhz = RTC_PROFRATE;
+ }
/* Finish initializing 8253 timer 0. */
register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
@@ -591,6 +605,10 @@ cpu_initclocks()
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
+
+ /* Don't bother enabling the statistics clock. */
+ if (statclock_disable)
+ return;
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -598,7 +616,7 @@ cpu_initclocks()
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
void
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 75fbcee39be5..d26b30c7eca1 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.55 1996/04/05 03:36:31 ache Exp $
+ * $Id: clock.c,v 1.56 1996/04/05 18:56:10 ache Exp $
*/
/*
@@ -103,6 +103,7 @@ long long i586_ctr_bias;
long long i586_last_tick;
unsigned long i586_avg_tick;
#endif
+int statclock_disable;
u_int stat_imask = SWI_CLOCK_MASK;
int timer0_max_count;
u_int timer0_overflow_threshold;
@@ -123,6 +124,7 @@ static u_int hardclock_max_count;
static void (*new_function) __P((struct clockframe *frame));
static u_int new_rate;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
static char timer0_state = 0;
static char timer2_state = 0;
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
@@ -559,7 +561,7 @@ resettodr()
writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
/* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
/*
@@ -570,8 +572,20 @@ cpu_initclocks()
{
int diag;
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
+ if (statclock_disable) {
+ /*
+ * The stat interrupt mask is different without the
+ * statistics clock. Also, don't set the interrupt
+ * flag which would normally cause the RTC to generate
+ * interrupts.
+ */
+ stat_imask = HWI_MASK | SWI_MASK;
+ rtc_statusb = RTCSB_24HR;
+ } else {
+ /* Setting stathz to nonzero early helps avoid races. */
+ stathz = RTC_NOPROFRATE;
+ profhz = RTC_PROFRATE;
+ }
/* Finish initializing 8253 timer 0. */
register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
@@ -591,6 +605,10 @@ cpu_initclocks()
/* Initialize RTC. */
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
+
+ /* Don't bother enabling the statistics clock. */
+ if (statclock_disable)
+ return;
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -598,7 +616,7 @@ cpu_initclocks()
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
- writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR);
+ writertc(RTC_STATUSB, rtc_statusb);
}
void