summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/clock.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-07-18 15:19:29 +0000
committerbde <bde@FreeBSD.org>1999-07-18 15:19:29 +0000
commite871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a (patch)
tree4888031468dad73af57f3a7b1921e701a5a0010c /sys/i386/isa/clock.c
parent9ea61245a8fa724c231c6740852b5a8bc59549ac (diff)
downloadFreeBSD-src-e871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a.zip
FreeBSD-src-e871bb8dd7a2153c5cabea19b8bf1c7cb7d3ac7a.tar.gz
Don't let the machdep.tsc_freq sysctl proceed if the TSC is present
but broken, since tsc_timecounter is not initialised in that case, and updating an uninitialised timecounter is fatal. Fixed style bugs in the machdep.i8254_freq and machdep.tsc_freq sysctls. Reviewed by: phk
Diffstat (limited to 'sys/i386/isa/clock.c')
-rw-r--r--sys/i386/isa/clock.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 6f4ab12..1b2bb63 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.137 1999/06/24 03:48:25 green Exp $
+ * $Id: clock.c,v 1.138 1999/06/27 09:08:48 peter Exp $
*/
/*
@@ -1107,7 +1107,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
* is is too generic. Should use it everywhere.
*/
freq = timer_freq;
- error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
+ error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
if (error == 0 && req->newptr != NULL) {
if (timer0_state != RELEASED)
return (EBUSY); /* too much trouble to handle */
@@ -1119,7 +1119,7 @@ sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS
}
SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
- 0, sizeof(u_int), sysctl_machdep_i8254_freq, "I", "");
+ 0, sizeof(u_int), sysctl_machdep_i8254_freq, "I", "");
static int
sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
@@ -1127,10 +1127,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
int error;
u_int freq;
- if (!tsc_present)
+ if (tsc_timecounter.tc_frequency == 0)
return (EOPNOTSUPP);
freq = tsc_freq;
- error = sysctl_handle_opaque(oidp, &freq, sizeof freq, req);
+ error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
if (error == 0 && req->newptr != NULL) {
tsc_freq = freq;
tsc_timecounter.tc_frequency = tsc_freq;
@@ -1140,7 +1140,7 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
}
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
- 0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
+ 0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
static unsigned
i8254_get_timecount(struct timecounter *tc)
OpenPOWER on IntegriCloud