summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-24 10:16:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-24 10:16:50 +0000
commit2d52ee0dde490079425bf1980fcd8e8d600c2073 (patch)
tree8d1300b445e69ef0267326200c00830745038d2b /sys/arch
parent978548ddeb7b97fe47229240a9efd7dda0b2a408 (diff)
pfour bwtwo blanking control
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/dev/bwtwo.c41
-rw-r--r--sys/arch/sparc/dev/pfour.c32
2 files changed, 54 insertions, 19 deletions
diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c
index a7d03a8b39d..76d14e39401 100644
--- a/sys/arch/sparc/dev/bwtwo.c
+++ b/sys/arch/sparc/dev/bwtwo.c
@@ -72,6 +72,7 @@
#include <sparc/dev/bwtworeg.h>
#include <sparc/dev/pfourreg.h>
#include <sparc/dev/sbusvar.h>
+#include "pfour.h"
/* per-display variables */
struct bwtwo_softc {
@@ -124,7 +125,7 @@ bwtwomatch(parent, vcf, aux)
return (0);
if (ca->ca_bustype == BUS_SBUS)
return(1);
-#ifdef SUN4
+#if NPFOUR > 0
if (ca->ca_bustype == BUS_PFOUR &&
PFOUR_ID(ra->ra_pfour) == PFOUR_ID_BW)
return (1);
@@ -154,6 +155,7 @@ bwtwoattach(parent, self, args)
sc->sc_bustype = ca->ca_bustype;
switch (ca->ca_bustype) {
#if defined(SUN4)
+#if NPFOUR > 0
case BUS_PFOUR:
node = 0;
pfour_reset();
@@ -163,6 +165,7 @@ bwtwoattach(parent, self, args)
sc->sc_fb.fb_linebytes = sc->sc_fb.fb_type.fb_width / 8;
nam = "bwtwo";
break;
+#endif
case BUS_OBIO:
node = 0;
nam = "bwtwo";
@@ -330,15 +333,17 @@ int
bwtwostatus(sc)
struct bwtwo_softc *sc;
{
- int on;
-
#ifdef SUN4
- if (cputyp == CPU_SUN4 && sc->sc_bustype == BUS_OBIO)
- on = lduba(AC_SYSENABLE, ASI_CONTROL) & SYSEN_VIDEO;
- else
+#if NPFOUR > 0
+ if (sc->sc_bustype == BUS_PFOUR)
+ return pfourstatus();
+#endif
+ if (sc->sc_bustype == BUS_OBIO)
+ return (lduba(AC_SYSENABLE, ASI_CONTROL) & SYSEN_VIDEO);
+#endif
+#if defined(SUN4C) || defined(SUN4M)
+ return (sc->sc_reg->bw_ctl & CTL_VE);
#endif
- on = sc->sc_reg->bw_ctl & CTL_VE;
- return (on);
}
void
@@ -346,21 +351,29 @@ bwtwoenable(sc, on)
struct bwtwo_softc *sc;
int on;
{
+#if NPFOUR > 0
+ if (sc->sc_bustype == BUS_PFOUR) {
+ pfourenable(on);
+ return;
+ }
+#endif
if (on) {
#ifdef SUN4
- if (cputyp == CPU_SUN4 && sc->sc_bustype == BUS_OBIO)
+ if (sc->sc_bustype == BUS_OBIO) {
stba(AC_SYSENABLE, ASI_CONTROL,
lduba(AC_SYSENABLE, ASI_CONTROL) | SYSEN_VIDEO);
- else
+ return;
+ }
#endif
- sc->sc_reg->bw_ctl |= CTL_VE;
+ sc->sc_reg->bw_ctl |= CTL_VE;
} else {
#ifdef SUN4
- if (cputyp == CPU_SUN4 && sc->sc_bustype == BUS_OBIO)
+ if (sc->sc_bustype == BUS_OBIO) {
stba(AC_SYSENABLE, ASI_CONTROL,
lduba(AC_SYSENABLE, ASI_CONTROL) & ~SYSEN_VIDEO);
- else
+ return;
+ }
#endif
- sc->sc_reg->bw_ctl &= ~CTL_VE;
+ sc->sc_reg->bw_ctl &= ~CTL_VE;
}
}
diff --git a/sys/arch/sparc/dev/pfour.c b/sys/arch/sparc/dev/pfour.c
index 78c3ccb722d..48d555b3773 100644
--- a/sys/arch/sparc/dev/pfour.c
+++ b/sys/arch/sparc/dev/pfour.c
@@ -50,10 +50,9 @@
#include <sparc/sparc/vaddrs.h>
#include <sparc/dev/pfourreg.h>
-volatile int *pfour_vaddr; /* pfour register */
-
struct pfour_softc {
struct device sc_dev; /* base device */
+ volatile u_long *sc_vaddr; /* pfour register */
int nothing;
};
@@ -106,7 +105,7 @@ pfourattach(parent, self, args)
return;
}
- pfour_vaddr = mapiodev((caddr_t)(ca->ca_ra.ra_paddr + PFOUR_REG),
+ sc->sc_vaddr = mapiodev((caddr_t)(ca->ca_ra.ra_paddr + PFOUR_REG),
NBPG, ca->ca_bustype);
printf(": cardtype 0x%02x\n", PFOUR_FBTYPE(val));
@@ -140,8 +139,11 @@ pfourattach(parent, self, args)
void
pfour_reset()
{
- *pfour_vaddr = PFOUR_REG_VIDEO | PFOUR_REG_RESET;
- *pfour_vaddr = PFOUR_REG_VIDEO;
+ struct pfour_softc *sc = pfourcd.cd_devs[0];
+
+ *sc->sc_vaddr = PFOUR_REG_VIDEO | PFOUR_REG_RESET;
+ delay(1);
+ *sc->sc_vaddr = PFOUR_REG_VIDEO;
}
int
@@ -187,3 +189,23 @@ pfour_videosize(reg, xp, yp)
}
return (0);
}
+
+void
+pfourenable(on)
+ int on;
+{
+ struct pfour_softc *sc = pfourcd.cd_devs[0];
+
+ if (on)
+ *sc->sc_vaddr |= PFOUR_REG_VIDEO;
+ else
+ *sc->sc_vaddr &= ~PFOUR_REG_VIDEO;
+}
+
+int
+pfourstatus()
+{
+ struct pfour_softc *sc = pfourcd.cd_devs[0];
+
+ return (*sc->sc_vaddr & PFOUR_REG_VIDEO);
+}