summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-03-29 23:11:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-03-29 23:11:13 +0000
commitcb7f31e4b594ddaeae40b91d6f3ea2042a507a3e (patch)
treefcb6b4800b4ecd7c7b4aba208b703297c10a1db6 /sys/arch/hppa
parent4457056abe1cbb0568c76aa8763a6a91662c0f85 (diff)
timeout-driven heartbeat.
right thing would be to pass beat count as an argument to timeout routine (casted to (void *)) avoiding static counter, but doing timeout_set() every timeout_add() sounds kinda uncool. well, pondering in the struct timeout guts would be even more ugly.
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/dev/clock.c9
-rw-r--r--sys/arch/hppa/hppa/autoconf.c51
-rw-r--r--sys/arch/hppa/include/cpufunc.h3
3 files changed, 50 insertions, 13 deletions
diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c
index b5d8cb20539..fe429828ea8 100644
--- a/sys/arch/hppa/dev/clock.c
+++ b/sys/arch/hppa/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.8 2000/02/09 05:51:21 mickey Exp $ */
+/* $OpenBSD: clock.c,v 1.9 2000/03/29 23:11:06 mickey Exp $ */
/*
* Copyright (c) 1998,1999 Michael Shalayeff
@@ -72,13 +72,6 @@ clock_intr (v)
void *v;
{
struct trapframe *frame = v;
-#ifdef USELEDS
- static u_int hbcnt = 0;
-
- if (!(hbcnt % (hz / 8)) && ((hbcnt / (hz / 8)) & 7) < 4)
- ledctl(0, 0, PALED_HEARTBEAT);
- hbcnt++;
-#endif
/* printf ("clock int 0x%x @ 0x%x for %p\n", t,
frame->tf_iioq_head, curproc); */
diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c
index fd6fe095c2f..9f54f415159 100644
--- a/sys/arch/hppa/hppa/autoconf.c
+++ b/sys/arch/hppa/hppa/autoconf.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: autoconf.c,v 1.7 1999/11/25 18:31:53 mickey Exp $ */
+/* $OpenBSD: autoconf.c,v 1.8 2000/03/29 23:11:12 mickey Exp $ */
/*
- * Copyright (c) 1998 Michael Shalayeff
+ * Copyright (c) 1998-2000 Michael Shalayeff
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -52,6 +52,7 @@
#include <sys/conf.h>
#include <sys/reboot.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/iomod.h>
#include <machine/autoconf.h>
@@ -71,6 +72,15 @@ void (*cold_hook) __P((void)); /* see below */
register_t kpsw = PSW_Q | PSW_P | PSW_C | PSW_D;
/*
+ * LED blinking thing
+ */
+#ifdef USELEDS
+struct timeout heartbeat_tmo;
+void heartbeat __P((void *));
+extern int hz;
+#endif
+
+/*
* configure:
* called at boot time, configure all devices on system
*/
@@ -94,8 +104,43 @@ configure()
cold = 0;
if (cold_hook)
(*cold_hook)();
+
+#ifdef USELEDS
+ timeout_set(&heartbeat_tmo, heartbeat, NULL);
+ timeout_add(&heartbeat_tmo, hz / 8);
+#endif
}
+#ifdef USELEDS
+/*
+ * turn the heartbeat alive.
+ * right thing would be to pass counter to each subsequent timeout
+ * as an argument to heartbeat() incrementing every turn,
+ * i.e. avoiding the static hbcnt, but doing timeout_set() on each
+ * timeout_add() sounds ugly, guts of struct timeout looks ugly
+ * to ponder in even more.
+ */
+void
+heartbeat(v)
+ void *v;
+{
+ static u_int hbcnt = 0;
+
+ /*
+ * do this:
+ *
+ * |~| |~|
+ * _| |_| |_,_,_,_
+ * 0 1 2 3 4 6 7
+ */
+ if (hbcnt % 8 < 4)
+ ledctl(0, 0, PALED_HEARTBEAT);
+ hbcnt++;
+
+ timeout_add(&heartbeat_tmo, hz / 8);
+}
+#endif
+
/*
* Configure swap space and related parameters.
*/
@@ -144,7 +189,7 @@ dumpconf()
if (nblks <= ctod(1))
goto bad;
dumpblks = cpu_dumpsize();
- if (dumpblks < 0)
+ if (dumpblks < 0)
goto bad;
dumpblks += ctod(physmem);
diff --git a/sys/arch/hppa/include/cpufunc.h b/sys/arch/hppa/include/cpufunc.h
index 4533d86af5e..9832f01e9a7 100644
--- a/sys/arch/hppa/include/cpufunc.h
+++ b/sys/arch/hppa/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.14 2000/02/09 05:10:10 mickey Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.15 2000/03/29 23:11:12 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -259,7 +259,6 @@ void ptlball __P((void));
int btlb_insert __P((pa_space_t space, vaddr_t va, paddr_t pa,
vsize_t *lenp, u_int prot));
hppa_hpa_t cpu_gethpa __P((int n));
-void heartbeat __P((int on));
#endif
#endif /* _MACHINE_CPUFUNC_H_ */