From d5f2f6c0be6eb025bfcb033beae8281fc6a8315b Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 15 May 2010 15:28:10 +0000 Subject: Repair identification of P4 bwtwo on 4/330 and 4/370 models, which got broken in 1.36. --- sys/arch/sparc/dev/bwtwo.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'sys/arch/sparc/dev') 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 *) -- cgit v1.2.3