diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-04-20 20:42:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-04-20 20:42:55 +0000 |
commit | 5afe4381d46759178e7417c854cb9b517bb23955 (patch) | |
tree | d357ba1af55c2be76d4fa93c4435d85644553721 /sys | |
parent | 40687d94e2168bf180a2ac0aff854e0249a11854 (diff) |
- Fix a calculation bug with the RX ring buffer memory address which
slipped into the original NetBSD code around sixteen years ago.
Although it has been working so far because some devices used
address zero and other devices ignored the wrong higher bits.
- Remove the mem_ring override in ne2000_attach() now that
dp8390_config() calculates mem_ring correctly.
From NetBSD, via brad
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/dp8390.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/ne2000.c | 9 |
2 files changed, 4 insertions, 10 deletions
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index 4c09d988ef2..8ec9d8f5ad9 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.41 2008/11/28 02:44:17 brad Exp $ */ +/* $OpenBSD: dp8390.c,v 1.42 2010/04/20 20:42:54 deraadt Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -106,7 +106,8 @@ dp8390_config(struct dp8390_softc *sc) 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. */ diff --git a/sys/dev/ic/ne2000.c b/sys/dev/ic/ne2000.c index 8eed327c636..7970b5e05fb 100644 --- a/sys/dev/ic/ne2000.c +++ b/sys/dev/ic/ne2000.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ne2000.c,v 1.24 2008/06/26 05:42:16 ray Exp $ */ +/* $OpenBSD: ne2000.c,v 1.25 2010/04/20 20:42:54 deraadt Exp $ */ /* $NetBSD: ne2000.c,v 1.12 1998/06/10 01:15:50 thorpej Exp $ */ /*- @@ -274,13 +274,6 @@ ne2000_attach(struct ne2000_softc *nsc, u_int8_t *myea) return (1); } - /* - * We need to compute mem_ring a bit differently; override the - * value set up in dp8390_config(). - */ - dsc->mem_ring = - dsc->mem_start + ((dsc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT); - return (0); } |