diff options
-rw-r--r-- | sys/dev/ic/if_wireg.h | 48 | ||||
-rw-r--r-- | sys/dev/ic/if_wivar.h | 3 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_wi_pcmcia.c | 3 |
3 files changed, 21 insertions, 33 deletions
diff --git a/sys/dev/ic/if_wireg.h b/sys/dev/ic/if_wireg.h index 447ee535091..5956c1e0bee 100644 --- a/sys/dev/ic/if_wireg.h +++ b/sys/dev/ic/if_wireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wireg.h,v 1.20 2002/06/21 03:02:00 fgsch Exp $ */ +/* $OpenBSD: if_wireg.h,v 1.21 2002/06/22 22:10:38 fgsch Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -83,50 +83,36 @@ */ #if defined(__sparc__) +#define WI_IS_BE (sc->wi_flags & WI_FLAGS_BUS_PCMCIA) +#else +#define WI_IS_BE 0 +#endif #define CSR_WRITE_4(sc, reg, val) \ bus_space_write_4(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), htole32(val)) + sc->sc_pci ? reg * 2: reg), WI_IS_BE ? htole32(val) : (val)) #define CSR_WRITE_2(sc, reg, val) \ bus_space_write_2(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), htole16(val)) + (sc->sc_pci ? reg * 2: reg), WI_IS_BE ? htole16(val) : (val)) #define CSR_WRITE_1(sc, reg, val) \ bus_space_write_1(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), val) + (sc->sc_pci ? reg * 2: reg), val) #define CSR_READ_4(sc, reg) \ + (WI_IS_BE ? \ letoh32(bus_space_read_4(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg))) + (sc->sc_pci ? reg * 2: reg))) : \ + bus_space_read_4(sc->wi_btag, sc->wi_bhandle, \ + (sc->sc_pci ? reg * 2: reg))) #define CSR_READ_2(sc, reg) \ + (WI_IS_BE ? \ letoh16(bus_space_read_2(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg))) -#define CSR_READ_1(sc, reg) \ - bus_space_read_1(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg)) - -#else - -#define CSR_WRITE_4(sc, reg, val) \ - bus_space_write_4(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), val) -#define CSR_WRITE_2(sc, reg, val) \ - bus_space_write_2(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), val) -#define CSR_WRITE_1(sc, reg, val) \ - bus_space_write_1(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg), val) - -#define CSR_READ_4(sc, reg) \ - bus_space_read_4(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg)) -#define CSR_READ_2(sc, reg) \ - bus_space_read_2(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg)) + (sc->sc_pci ? reg * 2: reg))) : \ + bus_space_read_2(sc->wi_btag, sc->wi_bhandle, \ + (sc->sc_pci ? reg * 2: reg))) #define CSR_READ_1(sc, reg) \ bus_space_read_1(sc->wi_btag, sc->wi_bhandle, \ - (sc->sc_pci? reg * 2: reg)) - -#endif + (sc->sc_pci ? reg * 2: reg)) #define CSR_READ_RAW_2(sc, ba, dst, sz) \ bus_space_read_raw_multi_2((sc)->wi_btag, (sc)->wi_bhandle, \ diff --git a/sys/dev/ic/if_wivar.h b/sys/dev/ic/if_wivar.h index 3003da045bc..f9d5ab3d4f7 100644 --- a/sys/dev/ic/if_wivar.h +++ b/sys/dev/ic/if_wivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wivar.h,v 1.16 2002/06/22 16:41:43 millert Exp $ */ +/* $OpenBSD: if_wivar.h,v 1.17 2002/06/22 22:10:38 fgsch Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -119,6 +119,7 @@ struct wi_softc { #define WI_FLAGS_HAS_ROAMING 0x0040 #define WI_FLAGS_HAS_DIVERSITY 0x0080 #define WI_FLAGS_HAS_HOSTAP 0x0100 +#define WI_FLAGS_BUS_PCMCIA 0x0200 /* Firmware types */ #define WI_LUCENT 0 diff --git a/sys/dev/pcmcia/if_wi_pcmcia.c b/sys/dev/pcmcia/if_wi_pcmcia.c index 8b6df8d40d7..6f9be168f23 100644 --- a/sys/dev/pcmcia/if_wi_pcmcia.c +++ b/sys/dev/pcmcia/if_wi_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_pcmcia.c,v 1.34 2002/06/21 08:31:09 henning Exp $ */ +/* $OpenBSD: if_wi_pcmcia.c,v 1.35 2002/06/22 22:10:38 fgsch Exp $ */ /* $NetBSD: if_wi_pcmcia.c,v 1.14 2001/11/26 04:34:56 ichiro Exp $ */ /* @@ -368,6 +368,7 @@ wi_pcmcia_attach(parent, self, aux) sc->wi_ltag = sc->wi_btag = psc->sc_pcioh.iot; sc->wi_lhandle = sc->wi_bhandle = psc->sc_pcioh.ioh; sc->wi_cor_offset = WI_COR_OFFSET; + sc->wi_flags |= WI_FLAGS_BUS_PCMCIA; /* Make sure interrupts are disabled. */ CSR_WRITE_2(sc, WI_INT_EN, 0); |