Subject: Possible bug in ne2000.c (bus_space_barrier)
To: None <tech-kern@netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: tech-kern
Date: 12/02/2000 10:54:13
I was studying the NE2000 Ethernet driver and noticed the following
possible oversight.  It appears that read/write bus space barriers
are being set that extend beyond the space mapped by the driver.
I've included a patch that should fix this.  Can someone who
understands better please take a look?

	Thanks,

     -- Johnny C. Lam <lamj@stat.cmu.edu>
        Department of Statistics, Carnegie Mellon University
        http://www.stat.cmu.edu/~lamj/

--- sys/dev/ic/ne2000.c.orig	Wed Mar 22 15:58:28 2000
+++ sys/dev/ic/ne2000.c	Wed Nov 22 02:51:53 2000
@@ -314,12 +314,12 @@
 	/* Reset the board. */
 #ifdef GWETHER
 	bus_space_write_1(asict, asich, NE2000_ASIC_RESET, 0);
-	bus_space_barrier(asict, asich, 0, NE2000_NPORTS,
+	bus_space_barrier(asict, asich, 0, NE2000_ASIC_NPORTS,
 			  BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 	delay(200);
 #endif /* GWETHER */
 	tmp = bus_space_read_1(asict, asich, NE2000_ASIC_RESET);
-	bus_space_barrier(asict, asich, 0, NE2000_NPORTS,
+	bus_space_barrier(asict, asich, 0, NE2000_ASIC_NPORTS,
 			  BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 	delay(10000);
 
@@ -332,7 +332,7 @@
 	 * the invasive thing for now.  Yuck.]
 	 */
 	bus_space_write_1(asict, asich, NE2000_ASIC_RESET, tmp);
-	bus_space_barrier(asict, asich, 0, NE2000_NPORTS,
+	bus_space_barrier(asict, asich, 0, NE2000_ASIC_NPORTS,
 			  BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 	delay(5000);