Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2012 21:58:18 -0500
From:      Justin Hibbits <jhibbits@freebsd.org>
To:        freebsd-wireless@freebsd.org
Subject:   if_wi patch
Message-ID:  <81F29D74-1AA1-4DA8-81A1-951DDFB22F2B@freebsd.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Can someone test this patch on x86?  The patch is needed to work  
properly on big-endian architectures (tested on ppc with my if_wi  
macio attachment, to be committed after wider testing).  Taken from  
the OpenBSD driver.

- Justin

[-- Attachment #2 --]
Index: sys/dev/wi/if_wi.c
===================================================================
--- sys/dev/wi/if_wi.c	(revision 230483)
+++ sys/dev/wi/if_wi.c	(working copy)
@@ -1898,8 +1898,7 @@
 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;
@@ -1908,9 +1907,7 @@
 			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;
 }
@@ -1918,8 +1915,7 @@
 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;
@@ -1929,9 +1925,7 @@
 			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;

[-- Attachment #3 --]

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?81F29D74-1AA1-4DA8-81A1-951DDFB22F2B>