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>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-2--886735953
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

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

--Apple-Mail-2--886735953
Content-Disposition: attachment;
	filename=wi.diff
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="wi.diff"
Content-Transfer-Encoding: 7bit

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;

--Apple-Mail-2--886735953
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed
Content-Transfer-Encoding: 7bit



--Apple-Mail-2--886735953--



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