diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-02-03 15:01:03 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-02-03 15:01:03 +0000 |
commit | e49b0eb8493c3cd1be8e15b5736169109186251a (patch) | |
tree | 99d5f26a322b9fd05f44ed721b7b24bd4178a123 /sys/arch/sparc64/dev | |
parent | 3c3d1ea932b6b011edaf0488dce38c34acc5ab80 (diff) |
Map windows little-endian like the MI pcmcia code expects.
"Diff looks correct and appears to work as intended" miod@
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r-- | sys/arch/sparc64/dev/stp_sbus.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/arch/sparc64/dev/stp_sbus.c b/sys/arch/sparc64/dev/stp_sbus.c index 224834a9bc4..0ca98f632a1 100644 --- a/sys/arch/sparc64/dev/stp_sbus.c +++ b/sys/arch/sparc64/dev/stp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stp_sbus.c,v 1.8 2007/05/29 09:54:19 sobrado Exp $ */ +/* $OpenBSD: stp_sbus.c,v 1.9 2008/02/03 15:01:02 kettenis Exp $ */ /* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */ /*- @@ -65,6 +65,7 @@ struct stp4020_sbus_softc { struct stp4020_softc stp; + struct sparc_bus_space_tag *sc_bustag_le; }; int stpmatch(struct device *, void *, void *); @@ -94,13 +95,22 @@ stpattach(parent, self, aux) void *aux; { struct sbus_attach_args *sa = aux; + struct stp4020_sbus_softc *ssc = (void *)self; struct stp4020_softc *sc = (void *)self; int node; int i; + bus_space_tag_t bt; bus_space_handle_t bh; node = sa->sa_node; + /* Allocate little-endian bus tag */ + ssc->sc_bustag_le = malloc(sizeof(*sa->sa_bustag), M_DEVBUF, M_NOWAIT); + if (ssc->sc_bustag_le == NULL) + panic("could not allocate stp bus tag"); + *ssc->sc_bustag_le = *sa->sa_bustag; + ssc->sc_bustag_le->asi = ASI_PRIMARY_LITTLE; + /* Transfer bus tags */ sc->sc_bustag = sa->sa_bustag; @@ -135,7 +145,12 @@ stpattach(parent, self, aux) /* Skip the PROM */ continue; - if (sbus_bus_map(sa->sa_bustag, sa->sa_reg[i].sbr_slot, + if (i == STP4020_BANK_CTRL) + bt = sc->sc_bustag; + else + bt = ssc->sc_bustag_le; + + if (sbus_bus_map(bt, sa->sa_reg[i].sbr_slot, sa->sa_reg[i].sbr_offset, sa->sa_reg[i].sbr_size, 0, 0, &bh) != 0) { printf(": attach: cannot map registers\n"); @@ -151,11 +166,11 @@ stpattach(parent, self, aux) } else if (i < STP4020_BANK_CTRL) { /* banks 1-3 */ sc->sc_socks[0].windows[i-1].winaddr = bh; - sc->sc_socks[0].wintag = sc->sc_bustag; + sc->sc_socks[0].wintag = bt; } else { /* banks 5-7 */ sc->sc_socks[1].windows[i-5].winaddr = bh; - sc->sc_socks[1].wintag = sc->sc_bustag; + sc->sc_socks[1].wintag = bt; } } |