diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/dev/asp.c | 51 | ||||
-rw-r--r-- | sys/arch/hppa/dev/clock.c | 22 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/gscbus.c | 6 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 17 | ||||
-rw-r--r-- | sys/arch/hppa/include/cpufunc.h | 45 |
5 files changed, 94 insertions, 47 deletions
diff --git a/sys/arch/hppa/dev/asp.c b/sys/arch/hppa/dev/asp.c index 10402fe1258..54d6997711d 100644 --- a/sys/arch/hppa/dev/asp.c +++ b/sys/arch/hppa/dev/asp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asp.c,v 1.4 1999/11/26 17:59:55 mickey Exp $ */ +/* $OpenBSD: asp.c,v 1.5 2000/02/09 05:04:22 mickey Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -46,6 +46,7 @@ #include <machine/bus.h> #include <machine/iomod.h> #include <machine/autoconf.h> +#include <machine/cpufunc.h> #include <hppa/dev/cpudevs.h> #include <hppa/dev/viper.h> @@ -70,9 +71,6 @@ struct asp_trs { u_int32_t asp_iar; u_int32_t asp_resv[3]; u_int8_t asp_cled; -#define ASP_LEDDATA 1 -#define ASP_LEDSTROBE 2 -#define ASP_LEDPULSE 8 u_int8_t asp_resv1[3]; struct { u_int :20, @@ -103,18 +101,26 @@ struct asp_trs { #define asp_scsi _asp_ios.asp_scsi }; -static const char asp_spus[][12] = { - "Cobra", "Coral", "Bushmaster", "Hardball", "Scorpio", "Coral II", - "#6", "#7" +const struct asp_spus_tag { + char name[12]; + int ledword; +} asp_spus[] = { + { "Cobra", 0 }, + { "Coral", 0 }, + { "Bushmaster", 0 }, + { "Hardball", 1 }, + { "Scorpio", 0 }, + { "Coral II", 1 }, + { "#6", 0 }, + { "#7", 0 } }; struct asp_softc { struct device sc_dev; struct gscbus_ic sc_ic; - struct asp_hwr volatile *sc_hw; - struct asp_trs volatile *sc_trs; - u_int8_t sc_leds; + volatile struct asp_hwr *sc_hw; + volatile struct asp_trs *sc_trs; }; /* ASP "Primary Controller" HPA */ @@ -175,7 +181,8 @@ aspattach(parent, self, aux) sc->sc_trs = (struct asp_trs *)ASP_CHPA; sc->sc_hw = (struct asp_hwr *)ca->ca_hpa; - sc->sc_leds = 0; + machine_ledaddr = &sc->sc_trs->asp_cled; + machine_ledword = asp_spus[sc->sc_trs->asp_spu].ledword; /* reset ASP */ /* sc->sc_hw->asp_reset = 1; */ @@ -189,8 +196,9 @@ aspattach(parent, self, aux) sc->sc_trs->asp_imr = 0; splx(s); - printf (": %s rev %d, lan %d scsi %d\n", asp_spus[sc->sc_trs->asp_spu], - sc->sc_hw->asp_version, sc->sc_trs->asp_lan, sc->sc_trs->asp_scsi); + printf (": %s rev %d, lan %d scsi %d\n", + asp_spus[sc->sc_trs->asp_spu].name, sc->sc_hw->asp_version, + sc->sc_trs->asp_lan, sc->sc_trs->asp_scsi); sc->sc_ic.gsc_type = gsc_asp; sc->sc_ic.gsc_dv = sc; @@ -205,23 +213,6 @@ aspattach(parent, self, aux) config_found(self, &ga, gscprint); } -#ifdef USELEDS -void -heartbeat(int on) -{ - register struct asp_softc *sc; - - sc = asp_cd.cd_devs[0]; - if (asp_cd.cd_ndevs && sc) { - register u_int8_t r = sc->sc_leds ^= ASP_LEDPULSE, b; - for (b = 0x80; b; b >>= 1) { - sc->sc_trs->asp_cled = (r & b)? 1 : 0; - sc->sc_trs->asp_cled = ASP_LEDSTROBE | (r & b)? 1 : 0; - } - } -} -#endif - void asp_intr_establish(v, mask) void *v; diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c index ea011c7be4f..356303b15f8 100644 --- a/sys/arch/hppa/dev/clock.c +++ b/sys/arch/hppa/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.6 1999/09/07 20:50:24 mickey Exp $ */ +/* $OpenBSD: clock.c,v 1.7 2000/02/09 05:04:22 mickey Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -23,8 +23,8 @@ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF MIND, + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -64,11 +64,15 @@ cpu_initclocks() #ifdef USELEDS static u_int hbcnt = 0; - if (!(hbcnt % 50)) { - register u_int r = (hbcnt / 50) % 6; + if (!(hbcnt % (hz / 8))) { + register u_int r = (hbcnt / (hz / 8)) & 7; - heartbeat(r < 4 && !(r % 2)); + if (r == 1 || r == 3) + ledctl(PALED_HEARTBEAT, 0, 0); + else + ledctl(0, PALED_HEARTBEAT, 0); } + hbcnt++; #endif /* Start the interval timer. */ mfctl(CR_ITMR, time_inval); @@ -109,7 +113,6 @@ inittodr(t) { struct pdc_tod tod PDC_ALIGNMENT; int tbad = 0; - long dt; if (t < 5*SECYR) { printf ("WARNING: preposterous time in file system"); @@ -124,10 +127,9 @@ inittodr(t) time.tv_usec = tod.usec; if (!tbad) { - dt = time.tv_sec - t; + u_long dt; - if (dt < 0) - dt = -dt; + dt = (time.tv_sec < t)? t - time.tv_sec : time.tv_sec - t; if (dt < 2 * SECDAY) return; diff --git a/sys/arch/hppa/gsc/gscbus.c b/sys/arch/hppa/gsc/gscbus.c index 87168df5712..f324c12d334 100644 --- a/sys/arch/hppa/gsc/gscbus.c +++ b/sys/arch/hppa/gsc/gscbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gscbus.c,v 1.8 1999/08/16 04:05:38 mickey Exp $ */ +/* $OpenBSD: gscbus.c,v 1.9 2000/02/09 05:04:22 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -81,6 +81,7 @@ #include <machine/iomod.h> #include <machine/autoconf.h> +#include <machine/cpufunc.h> #include <hppa/gsc/gscbusvar.h> @@ -140,6 +141,9 @@ gscattach(parent, self, aux) sc->sc_intrmask = 0; bzero(sc->sc_intrvs, sizeof(sc->sc_intrvs)); + if (machine_ledaddr) + printf(": %sleds", machine_ledword? "word" : ""); + printf ("\n"); sc->sc_ih = cpu_intr_establish(IPL_IO, ga->ga_irq, diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 4712ada1bd3..c500f75529c 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.20 2000/01/25 22:11:39 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.21 2000/02/09 05:04:22 mickey Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -127,6 +127,12 @@ int dcache_stride; int dcache_line_mask; /* + * things to not kill + */ +volatile u_int8_t *machine_ledaddr; +int machine_ledword, machine_leds; + +/* * CPU params (should be the same for all cpus in the system) */ struct pdc_cache pdc_cache PDC_ALIGNMENT; @@ -169,7 +175,7 @@ struct pdc_coherence pdc_coherence PDC_ALIGNMENT; #ifdef DEBUG int sigdebug = 0xff; -pid_t sigpid; +pid_t sigpid = 0; #define SDB_FOLLOW 0x01 #endif @@ -452,7 +458,8 @@ cpu_startup() UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_NORMAL, UVM_FLAG_FIXED)) != KERN_SUCCESS) - panic("cpu_startup: cannot allocate VM for graphics"); + printf("WARNING: don't have space for stinger @0x%x\n", + addr); } #endif @@ -853,10 +860,10 @@ dumpsys() maddr = NULL; blkno = dumplo + cpu_dumpsize(); dump = bdevsw[major(dumpdev)].d_dump; - /* TODO block map the whole memory */ + /* TODO block map the whole physical memory */ for (i = 0; i < bytes; i += n) { - /* Print out how many MBs we to go. */ + /* Print out how many MBs we are to go. */ n = bytes - i; if (n && (n % (1024*1024)) == 0) printf("%d ", n / (1024 * 1024)); diff --git a/sys/arch/hppa/include/cpufunc.h b/sys/arch/hppa/include/cpufunc.h index cb1171706ad..53555a5c2a9 100644 --- a/sys/arch/hppa/include/cpufunc.h +++ b/sys/arch/hppa/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.12 1999/12/18 08:52:05 mickey Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.13 2000/02/09 05:04:22 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -210,6 +210,49 @@ pdtlbe(pa_space_t sp, vaddr_t va) __asm volatile("pdtlbe %%r0(%%sr1, %0)":: "r" (va)); } +#ifdef USELEDS +#define PALED_NETOUT 0x01 +#define PALED_NETIN 0x02 +#define PALED_DISK 0x04 +#define PALED_HEARTBEAT 0x08 +#define PALED_LOADMASK 0xf0 + +#define PALED_DATA 0x01 +#define PALED_STROBE 0x02 + +extern volatile u_int8_t *machine_ledaddr; +extern int machine_ledword, machine_leds; + +static __inline void +ledctl(int on, int off, int toggle) +{ + if (machine_ledaddr) { + int r; + + if (on) + machine_leds |= on; + if (off) + machine_leds &= ~off; + if (toggle) + machine_leds ^= toggle; + + r = ~machine_leds; /* it seems they should be reversed */ + + if (machine_ledword) + *machine_ledaddr = r; + else { + register int b; + for (b = 0x80; b; b >>= 1) { + *machine_ledaddr = (r & b)? PALED_DATA : 0; + DELAY(1); + *machine_ledaddr = ((r & b)? PALED_DATA : 0) | + PALED_STROBE; + } + } + } +} +#endif + #ifdef _KERNEL void fcacheall __P((void)); void ptlball __P((void)); |