Module Name:    src
Committed By:   tsutsui
Date:           Wed Feb 24 13:10:26 UTC 2010

Modified Files:
        src/sys/dev/ic: dp8390.c

Log Message:
Fix a wrong calculation bug around RX ring buffer memory address
slipped in about sixteen years ago.  Fortunately, it had been working
for ages because some devices used address zero and other devices
ignored wrong higher bits.

Tested on we(4) (SMC Elite Ultra) and ne(4) (NE2000 compatible
named UL0001) on ISA.
Note FreeBSD also uses the same correct value in their ed(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/ic/dp8390.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/dp8390.c
diff -u src/sys/dev/ic/dp8390.c:1.73 src/sys/dev/ic/dp8390.c:1.74
--- src/sys/dev/ic/dp8390.c:1.73	Tue Jan 19 22:06:24 2010
+++ src/sys/dev/ic/dp8390.c	Wed Feb 24 13:10:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp8390.c,v 1.73 2010/01/19 22:06:24 pooka Exp $	*/
+/*	$NetBSD: dp8390.c,v 1.74 2010/02/24 13:10:26 tsutsui Exp $	*/
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.73 2010/01/19 22:06:24 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.74 2010/02/24 13:10:26 tsutsui Exp $");
 
 #include "opt_ipkdb.h"
 #include "opt_inet.h"
@@ -114,7 +114,8 @@
 	sc->tx_page_start = sc->mem_start >> ED_PAGE_SHIFT;
 	sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
 	sc->rec_page_stop = sc->tx_page_start + (sc->mem_size >> ED_PAGE_SHIFT);
-	sc->mem_ring = sc->mem_start + (sc->rec_page_start << ED_PAGE_SHIFT);
+	sc->mem_ring = sc->mem_start +
+	    ((sc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
 	sc->mem_end = sc->mem_start + sc->mem_size;
 
 	/* Now zero memory and verify that it is clear. */

Reply via email to