Use the streaming functions for reading/writing the BAP fields on wi(4). This

fixes wi(4) device access on big endian architectures.

PR:		kern/164499
Reviewed by:	adrian
Obtained from:	NetBSD
This commit is contained in:
Justin Hibbits 2013-07-29 05:39:20 +00:00
parent 4b5ef056f1
commit 3e506f5f8c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253756

View file

@ -1905,8 +1905,7 @@ wi_seek_bap(struct wi_softc *sc, int id, int off)
static int
wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
{
u_int16_t *ptr;
int i, error, cnt;
int error, cnt;
if (buflen == 0)
return 0;
@ -1915,9 +1914,7 @@ wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
return error;
}
cnt = (buflen + 1) / 2;
ptr = (u_int16_t *)buf;
for (i = 0; i < cnt; i++)
*ptr++ = CSR_READ_2(sc, WI_DATA0);
CSR_READ_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt);
sc->sc_bap_off += cnt * 2;
return 0;
}
@ -1925,8 +1922,7 @@ wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
static int
wi_write_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
{
u_int16_t *ptr;
int i, error, cnt;
int error, cnt;
if (buflen == 0)
return 0;
@ -1936,9 +1932,7 @@ wi_write_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
return error;
}
cnt = (buflen + 1) / 2;
ptr = (u_int16_t *)buf;
for (i = 0; i < cnt; i++)
CSR_WRITE_2(sc, WI_DATA0, ptr[i]);
CSR_WRITE_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt);
sc->sc_bap_off += cnt * 2;
return 0;