summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerhard <gerhard@openbsd.org>2013-04-17 18:35:47 +0000
committergerhard <gerhard@openbsd.org>2013-04-17 18:35:47 +0000
commit4237b50834326f1368c1d71412cbd2d2b806eb54 (patch)
treeb803f36fc0af68948d13c3d6cf1c5a6f2c3826fc
parentuvm_extern.h not uvm.h (diff)
downloadwireguard-openbsd-4237b50834326f1368c1d71412cbd2d2b806eb54.tar.xz
wireguard-openbsd-4237b50834326f1368c1d71412cbd2d2b806eb54.zip
Don't set the frequency of the statclock if we don't have one.
Prevents strange hang-ups during reboot. Joint work with hshoexer@. ok mikeb@, mlarkin@, miod@, deraadt@
-rw-r--r--sys/arch/amd64/isa/clock.c14
-rw-r--r--sys/arch/i386/isa/clock.c14
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/arch/amd64/isa/clock.c b/sys/arch/amd64/isa/clock.c
index 7a6aa095b97..b2f3017cb79 100644
--- a/sys/arch/amd64/isa/clock.c
+++ b/sys/arch/amd64/isa/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.19 2011/07/05 17:11:07 oga Exp $ */
+/* $OpenBSD: clock.c,v 1.20 2013/04/17 18:35:47 gerhard Exp $ */
/* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*-
@@ -603,10 +603,14 @@ resettodr(void)
void
setstatclockrate(int arg)
{
- if (arg == stathz)
- mc146818_write(NULL, MC_REGA, MC_BASE_32_KHz | MC_RATE_128_Hz);
- else
- mc146818_write(NULL, MC_REGA, MC_BASE_32_KHz | MC_RATE_1024_Hz);
+ if (initclock_func == i8254_initclocks) {
+ if (arg == stathz)
+ mc146818_write(NULL, MC_REGA,
+ MC_BASE_32_KHz | MC_RATE_128_Hz);
+ else
+ mc146818_write(NULL, MC_REGA,
+ MC_BASE_32_KHz | MC_RATE_1024_Hz);
+ }
}
void
diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c
index 8e674950b6d..2517de57f7b 100644
--- a/sys/arch/i386/isa/clock.c
+++ b/sys/arch/i386/isa/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.47 2012/11/10 09:45:05 mglocker Exp $ */
+/* $OpenBSD: clock.c,v 1.48 2013/04/17 18:35:47 gerhard Exp $ */
/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */
/*-
@@ -693,10 +693,14 @@ resettodr(void)
void
setstatclockrate(int arg)
{
- if (arg == stathz)
- mc146818_write(NULL, MC_REGA, MC_BASE_32_KHz | MC_RATE_128_Hz);
- else
- mc146818_write(NULL, MC_REGA, MC_BASE_32_KHz | MC_RATE_1024_Hz);
+ if (initclock_func == i8254_initclocks) {
+ if (arg == stathz)
+ mc146818_write(NULL, MC_REGA,
+ MC_BASE_32_KHz | MC_RATE_128_Hz);
+ else
+ mc146818_write(NULL, MC_REGA,
+ MC_BASE_32_KHz | MC_RATE_1024_Hz);
+ }
}
void