1 /* 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * All advertising materials mentioning features or use of this software 10 * must display the following acknowledgement: 11 * This product includes software developed by the University of 12 * California, Lawrence Berkeley Laboratory. 13 * 14 * %sccs.include.redist.c% 15 * 16 * @(#)auxreg.c 7.4 (Berkeley) 04/20/93 17 * 18 * from: $Header: auxreg.c,v 1.11 92/11/26 03:04:44 torek Exp $ (LBL) 19 */ 20 21 #include <sys/param.h> 22 #include <sys/device.h> 23 #include <sys/kernel.h> 24 25 #include <machine/autoconf.h> 26 27 #include <sparc/sparc/vaddrs.h> 28 #include <sparc/sparc/auxreg.h> 29 30 static int auxregmatch __P((struct device *, struct cfdata *, void *)); 31 static void auxregattach __P((struct device *, struct device *, void *)); 32 struct cfdriver auxregcd = 33 { 0, "auxreg", auxregmatch, auxregattach, DV_DULL, sizeof(struct device) }; 34 35 #ifdef BLINK 36 static int 37 blink(zero) 38 void *zero; 39 { 40 register int s; 41 register fixpt_t lav; 42 43 s = splhigh(); 44 LED_FLIP; 45 splx(s); 46 /* 47 * Blink rate is: 48 * full cycle every second if completely idle (loadav = 0) 49 * full cycle every 2 seconds if loadav = 1 50 * full cycle every 3 seconds if loadav = 2 51 * etc. 52 */ 53 s = (((averunnable[0] + FSCALE) * hz) >> (FSHIFT + 1)); 54 timeout(blink, (caddr_t)0, s); 55 } 56 #endif 57 58 /* 59 * The OPENPROM calls this "auxiliary-io". 60 */ 61 static int 62 auxregmatch(parent, cf, aux) 63 struct device *parent; 64 struct cfdata *cf; 65 void *aux; 66 { 67 68 return (strcmp("auxiliary-io", ((struct romaux *)aux)->ra_name) == 0); 69 } 70 71 /* ARGSUSED */ 72 static void 73 auxregattach(parent, self, aux) 74 struct device *parent, *self; 75 void *aux; 76 { 77 struct romaux *ra = aux; 78 79 (void)mapdev(ra->ra_paddr, AUXREG_VA, sizeof(long)); 80 printf("\n"); 81 #ifdef BLINK 82 blink((caddr_t)0); 83 #endif 84 } 85