diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2001-06-25 18:04:24 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2001-06-25 18:04:24 +0000 |
commit | 4a4a95630baf72eaa83c2b55cab1590088413386 (patch) | |
tree | d6aa71f3e05565c3cd01c1664514b045686f9785 /sys/dev | |
parent | 49ba47c22c20238d111ded3e6147927a286bfdbe (diff) |
Add the missing endian pieces to wavelan driver.
ok, millert@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/if_wi.c | 38 | ||||
-rw-r--r-- | sys/dev/ic/if_wireg.h | 13 |
2 files changed, 28 insertions, 23 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 3ec898ea760..bcc84f5d00e 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.11 2001/06/23 22:54:17 fgsch Exp $ */ +/* $OpenBSD: if_wi.c,v 1.12 2001/06/25 18:04:22 drahn Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -120,7 +120,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.11 2001/06/23 22:54:17 fgsch Exp $"; + "$OpenBSD: if_wi.c,v 1.12 2001/06/25 18:04:22 drahn Exp $"; #endif /* lint */ #ifdef foo @@ -597,7 +597,7 @@ wi_read_record(sc, ltv) struct wi_softc *sc; struct wi_ltv_gen *ltv; { - u_int16_t *ptr; + u_int8_t *ptr; int i, len, code; struct wi_ltv_gen *oltv, p2ltv; @@ -641,9 +641,10 @@ wi_read_record(sc, ltv) ltv->wi_type = code; /* Now read the data. */ - ptr = <v->wi_val; - for (i = 0; i < ltv->wi_len - 1; i++) - ptr[i] = CSR_READ_2(sc, WI_DATA1); + ptr = (u_int8_t *)<v->wi_val; + if (ltv->wi_len > 1) { + CSR_READ_RAW_2(sc, WI_DATA1, ptr, (ltv->wi_len-1)*2); + } if (sc->sc_prism2) { int v; @@ -695,7 +696,7 @@ wi_write_record(sc, ltv) struct wi_softc *sc; struct wi_ltv_gen *ltv; { - u_int16_t *ptr; + u_int8_t *ptr; int i; struct wi_ltv_gen p2ltv; @@ -769,9 +770,10 @@ wi_write_record(sc, ltv) CSR_WRITE_2(sc, WI_DATA1, ltv->wi_len); CSR_WRITE_2(sc, WI_DATA1, ltv->wi_type); - ptr = <v->wi_val; - for (i = 0; i < ltv->wi_len - 1; i++) - CSR_WRITE_2(sc, WI_DATA1, ptr[i]); + ptr = (u_int8_t *)<v->wi_val; + if (ltv->wi_len > 1) { + CSR_WRITE_RAW_2(sc, WI_DATA1, ptr, (ltv->wi_len-1) *2); + } if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_WRITE, ltv->wi_type)) return(EIO); @@ -822,15 +824,13 @@ wi_read_data(sc, id, off, buf, len) caddr_t buf; int len; { - int i; - u_int16_t *ptr; + u_int8_t *ptr; if (wi_seek(sc, id, off, WI_BAP1)) return(EIO); - ptr = (u_int16_t *)buf; - for (i = 0; i < len / 2; i++) - ptr[i] = CSR_READ_2(sc, WI_DATA1); + ptr = (u_int8_t *)buf; + CSR_READ_RAW_2(sc, WI_DATA1, ptr, len); return(0); } @@ -854,8 +854,7 @@ wi_write_data(sc, id, off, buf, len) caddr_t buf; int len; { - int i; - u_int16_t *ptr; + u_int8_t *ptr; #ifdef WI_HERMES_AUTOINC_WAR again: @@ -864,9 +863,8 @@ again: if (wi_seek(sc, id, off, WI_BAP0)) return(EIO); - ptr = (u_int16_t *)buf; - for (i = 0; i < (len / 2); i++) - CSR_WRITE_2(sc, WI_DATA0, ptr[i]); + ptr = (u_int8_t *)buf; + CSR_WRITE_RAW_2(sc, WI_DATA0, ptr, len); #ifdef WI_HERMES_AUTOINC_WAR CSR_WRITE_2(sc, WI_DATA0, 0x1234); diff --git a/sys/dev/ic/if_wireg.h b/sys/dev/ic/if_wireg.h index be10328aadc..d89107047d8 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.4 2001/06/07 18:51:59 millert Exp $ */ +/* $OpenBSD: if_wireg.h,v 1.5 2001/06/25 18:04:23 drahn Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -91,6 +91,13 @@ #define CSR_READ_1(sc, reg) \ bus_space_read_1(sc->wi_btag, sc->wi_bhandle, reg) +#define CSR_READ_RAW_2(sc, ba, dst, sz) \ + bus_space_read_raw_multi_2((sc)->wi_btag, (sc)->wi_bhandle, (ba), \ + (dst), (sz)) +#define CSR_WRITE_RAW_2(sc, ba, dst, sz) \ + bus_space_write_raw_multi_2((sc)->wi_btag, (sc)->wi_bhandle, (ba), \ + (dst), (sz)) + /* * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent * calls 'Hermes.' In typical fashion, getting documentation about this @@ -283,7 +290,7 @@ struct wi_ltv_str { \ g.wi_len = 2; \ g.wi_type = recno; \ - g.wi_val = val; \ + g.wi_val = htole16(val); \ wi_write_record(sc, &g); \ } while (0) @@ -296,7 +303,7 @@ struct wi_ltv_str { bzero((char *)&s, sizeof(s)); \ s.wi_len = (l / 2) + 2; \ s.wi_type = recno; \ - s.wi_str[0] = strlen(str); \ + s.wi_str[0] = htole16(strlen(str)); \ bcopy(str, (char *)&s.wi_str[1], strlen(str)); \ wi_write_record(sc, (struct wi_ltv_gen *)&s); \ } while (0) |