From d2895075336ade5d0e9f2337ab59d894b0be3cf1 Mon Sep 17 00:00:00 2001 From: sekiya Date: Sat, 28 Feb 2004 00:53:56 +0000 Subject: [PATCH] Blinkenlitzen for IP20 (Indigo). --- sys/arch/sgimips/hpc/hpc.c | 44 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/sys/arch/sgimips/hpc/hpc.c b/sys/arch/sgimips/hpc/hpc.c index c8695201b334..ba4a15957949 100644 --- a/sys/arch/sgimips/hpc/hpc.c +++ b/sys/arch/sgimips/hpc/hpc.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpc.c,v 1.25 2004/01/02 01:04:46 sekiya Exp $ */ +/* $NetBSD: hpc.c,v 1.26 2004/02/28 00:53:56 sekiya Exp $ */ /* * Copyright (c) 2000 Soren S. Jorvang @@ -35,12 +35,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.25 2004/01/02 01:04:46 sekiya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.26 2004/02/28 00:53:56 sekiya Exp $"); #include #include +#include #include #include +#include #include @@ -289,6 +291,11 @@ int hpc_submatch(struct device *, struct cfdata *, void *); int hpc_power_intr(void *); +#if defined(BLINK) +static struct callout hpc_blink_ch = CALLOUT_INITIALIZER; +static void hpc_blink(void *); +#endif + CFATTACH_DECL(hpc, sizeof(struct hpc_softc), hpc_match, hpc_attach, NULL, NULL); @@ -389,6 +396,11 @@ hpc_attach(struct device *parent, struct device *self, void *aux) cpu_intr_establish(9, IPL_NONE, hpc_power_intr, sc); powerintr_established++; } + +#if defined(BLINK) + if (mach_type == MACH_SGI_IP20) + hpc_blink(sc); +#endif } int @@ -431,3 +443,31 @@ hpc_power_intr(void *arg) return 1; } + +#if defined(BLINK) +static void +hpc_blink(void *self) +{ + struct hpc_softc *sc = (struct hpc_softc *) self; + register int s; + int value; + + s = splhigh(); + + value = *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(HPC1_AUX_REGS); + value ^= HPC1_AUX_CONSLED; + *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(HPC1_AUX_REGS) = value; + splx(s); + + /* + * Blink rate is: + * full cycle every second if completely idle (loadav = 0) + * full cycle every 2 seconds if loadav = 1 + * full cycle every 3 seconds if loadav = 2 + * etc. + */ + s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1)); + callout_reset(&hpc_blink_ch, s, hpc_blink, sc); +} +#endif +