diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-04-07 17:24:10 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-04-07 17:24:10 +0000 |
commit | c968169dce9f02ff2475f4875395e2abc0388218 (patch) | |
tree | 6a9af7aefcfa345b1779803513fd9147e62b8a3a /sys/arch | |
parent | 4f66c8f9866114bc66bbe90e373dc8f6a7b539ce (diff) |
enable viper touching again.
change the bitfield struct into just a word and
a bunch of defines and define the _BITS.
only program those that revision is 0 since otherwise it seems to
comatize the perhaps not so viper other ones (even on the same hpa).
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/dev/mem.c | 57 | ||||
-rw-r--r-- | sys/arch/hppa/dev/viper.h | 39 |
2 files changed, 53 insertions, 43 deletions
diff --git a/sys/arch/hppa/dev/mem.c b/sys/arch/hppa/dev/mem.c index 03c73ced3d5..3519b058b0a 100644 --- a/sys/arch/hppa/dev/mem.c +++ b/sys/arch/hppa/dev/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.18 2003/04/07 17:14:59 mickey Exp $ */ +/* $OpenBSD: mem.c,v 1.19 2003/04/07 17:24:08 mickey Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -141,8 +141,8 @@ memattach(parent, self, aux) void *aux; { struct pdc_iodc_minit pdc_minit PDC_ALIGNMENT; - register struct confargs *ca = aux; - register struct mem_softc *sc = (struct mem_softc *)self; + struct mem_softc *sc = (struct mem_softc *)self; + struct confargs *ca = aux; int err; printf (":"); @@ -153,25 +153,30 @@ memattach(parent, self, aux) sc->sc_vp = (struct vi_trs *) &((struct iomod *)ca->ca_hpa)->priv_trs; - printf(" viper rev %x,", sc->sc_vp->vi_status.hw_rev); -#if 0 - { + /* XXX other values seem to blow it up */ + if (sc->sc_vp->vi_status.hw_rev == 0) { + u_int32_t vic; int s; - printf(" ctrl %b", VI_CTRL, VIPER_BITS); - + printf(" viper rev %x,", sc->sc_vp->vi_status.hw_rev); +#ifdef DEBUG + printf(" ctrl %b", VI_CTRL, VI_CTRL_BITS); +#endif s = splhigh(); - VI_CTRL |= VI_CTRL_ANYDEN; - ((struct vi_ctrl *)&VI_CTRL)->core_den = 0; - ((struct vi_ctrl *)&VI_CTRL)->sgc0_den = 0; - ((struct vi_ctrl *)&VI_CTRL)->sgc1_den = 0; - ((struct vi_ctrl *)&VI_CTRL)->core_prf = 1; - sc->sc_vp->vi_control = VI_CTRL; + vic = VI_CTRL; + vic &= ~VI_CTRL_CORE_DEN; + vic &= ~VI_CTRL_SGC0_DEN; + vic &= ~VI_CTRL_SGC1_DEN; + vic |= VI_CTRL_CORE_PRF; + sc->sc_vp->vi_control = vic; + __asm __volatile("stwas %1, 0(%0)" + :: "r" (&VI_CTRL), "r" (vic) : "memory"); splx(s); - - printf (" >> %b,", VI_CTRL, VIPER_BITS); - } +#ifdef DEBUG + printf (" >> %b,", vic, VI_CTRL_BITS); #endif + } else + sc->sc_vp = NULL; } else sc->sc_vp = NULL; @@ -200,13 +205,21 @@ viper_setintrwnd(mask) void viper_eisa_en() { - register struct mem_softc *sc; + struct mem_softc *sc; sc = mem_cd.cd_devs[0]; -#if 0 - if (sc->sc_vp) - ((struct vi_ctrl *)&VI_CTRL)->eisa_den = 0; -#endif + if (sc->sc_vp) { + u_int32_t vic; + int s; + + s = splhigh(); + vic = VI_CTRL; + vic &= ~VI_CTRL_EISA_DEN; + sc->sc_vp->vi_control = vic; + __asm __volatile("stwas %1, 0(%0)" + :: "r" (&VI_CTRL), "r" (vic) : "memory"); + splx(s); + } } int diff --git a/sys/arch/hppa/dev/viper.h b/sys/arch/hppa/dev/viper.h index 2165ac35ed7..9c29f5d30b6 100644 --- a/sys/arch/hppa/dev/viper.h +++ b/sys/arch/hppa/dev/viper.h @@ -1,4 +1,4 @@ -/* $OpenBSD: viper.h,v 1.4 2002/03/14 01:26:31 millert Exp $ */ +/* $OpenBSD: viper.h,v 1.5 2003/04/07 17:24:09 mickey Exp $ */ /* * Copyright (c) 1991,1994 The University of Utah and @@ -34,29 +34,26 @@ * The macros V_CTRL_ANYPRF or V_CTRL_ANYDEN should be used to determine * if any preference or deny bits are set. */ -#define VIPER_BITS "\020\001eisa_den\002eisa_prf\003core_den\004core_prf" \ - "\005sgc1_den\006sgc1_prf\007sgc0_den\010sgc0_prf" \ - "\012cpu_prf\021lpmc_en\022ipref_en" -struct vi_ctrl { /* (WO) */ - u_int vsc_tout:13, /* VSC clocks to wait before buserr timeout */ - : 1, - ipref_en: 1, /* enable instruction prefetching */ - lpmc_en : 1, /* enable Low Priority Machine Checks */ - : 6, - cpu_prf : 1, /* CPU has arbitration preference */ - : 1, - sgc0_prf: 1, /* SGC0 has arbitration preference */ - sgc0_den: 1, /* SGC0 denied bus grants */ - sgc1_prf: 1, /* SGC1 has arbitration preference */ - sgc1_den: 1, /* SGC1 denied bus grants */ - core_prf: 1, /* CORE bus has arbitration preference */ - core_den: 1, /* CORE denied bus grants */ - eisa_prf: 1, /* EISA bus has arbitration preference */ - eisa_den: 1; /* EISA denied bus grants */ -}; + +#define VI_CTRL_EISA_DEN 0x00000001 /* EISA denied bus grants */ +#define VI_CTRL_EISA_PRF 0x00000002 /* EISA bus has arbitration preference */ +#define VI_CTRL_CORE_DEN 0x00000004 /* CORE denied bus grants */ +#define VI_CTRL_CORE_PRF 0x00000008 /* CORE bus has arbitration preference */ +#define VI_CTRL_SGC0_DEN 0x00000010 /* SGC0 denied bus grants */ +#define VI_CTRL_SGC0_PRF 0x00000020 /* SGC0 has arbitration preference */ +#define VI_CTRL_SGC1_DEN 0x00000040 /* SGC1 denied bus grants */ +#define VI_CTRL_SGC1_PRF 0x00000080 /* SGC1 has arbitration preference */ +#define VI_CTRL_CPU_PRF 0x00000200 /* CPU has arbitration preference */ +#define VI_CTRL_LPMC_EN 0x00010000 /* enable Low Priority Machine Checks */ +#define VI_CTRL_IPREF_EN 0x00020000 /* enable instruction prefetching */ +#define VI_CTRL_VSC_TOUT 0xfff80000 /* VSC clocks to wait before buserr tmo */ + #define VI_CTRL_ANYPRF 0x02AA #define VI_CTRL_ANYDEN 0x0055 #define VI_CTRL PAGE0->pz_Pdep.pd_Viper.v_Ctrlcpy +#define VI_CTRL_BITS "\020\001eisa_den\002eisa_prf\003core_den\004core_prf" \ + "\005sgc1_den\006sgc1_prf\007sgc0_den\010sgc0_prf" \ + "\012cpu_prf\021lpmc_en\022ipref_en" #define VI_STAT_BITS "\020\001grf_buserr\002cpu_buserr\003ven_tmo" \ "\004ven_buserr\005toc\006hardecc\007softecc\010cmdrst" |