summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2010-05-15 15:28:09 +0000
committermiod <miod@openbsd.org>2010-05-15 15:28:09 +0000
commit559d8cba3ccdc34ae5f0c3f4d13a479c35f05903 (patch)
tree1309b2c3104a254c190fa92c2e75268be0d94ef9
parentMake fb_pfour_id() take a volatile pointer as argument. (diff)
downloadwireguard-openbsd-559d8cba3ccdc34ae5f0c3f4d13a479c35f05903.tar.xz
wireguard-openbsd-559d8cba3ccdc34ae5f0c3f4d13a479c35f05903.zip
Repair identification of P4 bwtwo on 4/330 and 4/370 models, which got broken
in 1.36.
-rw-r--r--sys/arch/sparc/dev/bwtwo.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c
index 1a81df15709..7fbfc83e439 100644
--- a/sys/arch/sparc/dev/bwtwo.c
+++ b/sys/arch/sparc/dev/bwtwo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwtwo.c,v 1.35 2008/12/26 22:30:21 miod Exp $ */
+/* $OpenBSD: bwtwo.c,v 1.36 2010/05/15 15:28:09 miod Exp $ */
/* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */
/*
@@ -186,15 +186,27 @@ bwtwoattach(struct device *parent, struct device *self, void *args)
printf(": ");
/*
- * Map the control register.
+ * Check if this is a P4 attachment, and map the P4 control
+ * register if necessary.
*/
#if defined(SUN4)
- if (CPU_ISSUN4 && ca->ca_bustype == BUS_OBIO &&
- fb_pfour_id(ca->ca_ra.ra_vaddr) != PFOUR_NOTPFOUR) {
- SET(sc->sc_sunfb.sf_flags, FB_PFOUR);
+ if (CPU_ISSUN4 && ca->ca_bustype == BUS_OBIO) {
sc->sc_sunfb.sf_pfour = (volatile u_int32_t *)
mapiodev(ca->ca_ra.ra_reg, 0, sizeof(u_int32_t));
- } else
+ if (fb_pfour_id(sc->sc_sunfb.sf_pfour) != PFOUR_NOTPFOUR)
+ SET(sc->sc_sunfb.sf_flags, FB_PFOUR);
+ else {
+ /* XXX unmapiodev */
+ sc->sc_sunfb.sf_pfour = NULL;
+ }
+ }
+#endif
+
+ /*
+ * Map the control register (unless done above for a P4 device).
+ */
+#if defined(SUN4)
+ if (!CPU_ISSUN4 || !ISSET(sc->sc_sunfb.sf_flags, FB_PFOUR))
#endif
{
sc->sc_reg = (volatile struct fbcontrol *)