summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/dev
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-01-09 19:37:52 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-01-09 19:37:52 +0000
commit6171f9558dbab24fb58884bf6ad6c18a8b7455a8 (patch)
tree9625bcbe5d7a5a210d88c9441889b7ef2bf4420a /sys/arch/hppa/dev
parent9da3bcf5e34674821c9fd8ad15b758bc50b1548d (diff)
Check in resettodr() if inittodr() has been called, otherwise we end up
resetting the clock when we don't need to. Found out with booting hppa64 kernels, and the problem also exists on hppa when booting with '-a' and hitting 'exit' when asked for the root filesystem. help & ok jsing@ also ok kettenis@ (who suggested naming the variable like amd64/i386 to prevent creating yet another variant of this code)
Diffstat (limited to 'sys/arch/hppa/dev')
-rw-r--r--sys/arch/hppa/dev/clock.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c
index d498fadb726..07f4abc9480 100644
--- a/sys/arch/hppa/dev/clock.c
+++ b/sys/arch/hppa/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.27 2011/01/05 16:30:50 jasper Exp $ */
+/* $OpenBSD: clock.c,v 1.28 2011/01/09 19:37:51 jasper Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -42,6 +42,7 @@
#include <machine/autoconf.h>
u_long cpu_hzticks;
+int timeset;
int cpu_hardclock(void *);
u_int itmr_get_timecount(struct timecounter *);
@@ -150,6 +151,7 @@ inittodr(time_t t)
ts.tv_sec = tod.sec;
ts.tv_nsec = tod.usec * 1000;
tc_setclock(&ts);
+ timeset = 1;
if (!tbad) {
u_long dt;
@@ -174,6 +176,13 @@ resettodr()
struct timeval tv;
int error;
+ /*
+ * We might have been called by boot() due to a crash early
+ * on. Don't reset the clock chip in this case.
+ */
+ if (!timeset)
+ return;
+
microtime(&tv);
if ((error = pdc_call((iodcio_t)pdc, 1, PDC_TOD, PDC_TOD_WRITE,