diff options
author | jhay <jhay@FreeBSD.org> | 1999-09-23 06:02:30 +0000 |
---|---|---|
committer | jhay <jhay@FreeBSD.org> | 1999-09-23 06:02:30 +0000 |
commit | dd86ea74f15404acf8066b6a96eba861ad960625 (patch) | |
tree | 553daf93c2f8172f32b1f12c7b5b20c2950a1741 | |
parent | fd1d2c9a38b07a9d16225468f89ed9df7518bac5 (diff) | |
download | FreeBSD-src-dd86ea74f15404acf8066b6a96eba861ad960625.zip FreeBSD-src-dd86ea74f15404acf8066b6a96eba861ad960625.tar.gz |
Make the frequency tuneable via a sysctl.
Reviewed by: phk
-rw-r--r-- | sys/i386/i386/mp_clock.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/i386/i386/mp_clock.c b/sys/i386/i386/mp_clock.c index b60e80d..096af99 100644 --- a/sys/i386/i386/mp_clock.c +++ b/sys/i386/i386/mp_clock.c @@ -27,18 +27,40 @@ static unsigned piix_get_timecount(struct timecounter *tc); static u_int32_t piix_timecounter_address; +static u_int piix_freq = 14318182/4; static struct timecounter piix_timecounter = { piix_get_timecount, 0, 0xffffff, - 14318182/4, + 0, "PIIX" }; SYSCTL_OPAQUE(_debug, OID_AUTO, piix_timecounter, CTLFLAG_RD, &piix_timecounter, sizeof(piix_timecounter), "S,timecounter", ""); +static int +sysctl_machdep_piix_freq SYSCTL_HANDLER_ARGS +{ + int error; + u_int freq; + + if (piix_timecounter.tc_frequency == 0) + return (EOPNOTSUPP); + freq = piix_freq; + error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + if (error == 0 && req->newptr != NULL) { + piix_freq = freq; + piix_timecounter.tc_frequency = piix_freq; + update_timecounter(&piix_timecounter); + } + return (error); +} + +SYSCTL_PROC(_machdep, OID_AUTO, piix_freq, CTLTYPE_INT | CTLFLAG_RW, + 0, sizeof(u_int), sysctl_machdep_piix_freq, "I", ""); + static unsigned piix_get_timecount(struct timecounter *tc) { @@ -57,6 +79,7 @@ piix_probe (device_t dev) return 0; /* IO space not mapped */ d = pci_read_config(dev, 0x40, 4); piix_timecounter_address = (d & 0xffc0) + 8; + piix_timecounter.tc_frequency = piix_freq; init_timecounter(&piix_timecounter); return (ENXIO); }; |