diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2000-02-15 13:47:53 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2000-02-15 13:47:53 +0000 |
commit | 466697f56471c53de84ecd24e001a71151458f5f (patch) | |
tree | 64b6a457fa6814b539ff445bf7ad4da0dde5a5cf /sys/dev | |
parent | 92d6a6bea701999372b94d74581ef7d0e8017b26 (diff) |
sync with FreeBSD:
o issue an RX reset in xl_init() for non-mii cards
o keep driver and receiver in sync
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_xl.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/sys/dev/pci/if_xl.c b/sys/dev/pci/if_xl.c index 6654da81cd9..a06904cbfb8 100644 --- a/sys/dev/pci/if_xl.c +++ b/sys/dev/pci/if_xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl.c,v 1.37 2000/02/15 02:28:15 jason Exp $ */ +/* $OpenBSD: if_xl.c,v 1.38 2000/02/15 13:47:52 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_xl.c,v 1.57 1999/09/15 07:20:59 wpaul Exp $ + * $FreeBSD: if_xl.c,v 1.72 2000/01/09 21:12:59 wpaul Exp $ */ /* @@ -158,6 +158,7 @@ int xl_encap __P((struct xl_softc *, struct xl_chain *, int xl_encap_90xB __P((struct xl_softc *, struct xl_chain *, struct mbuf * )); void xl_rxeof __P((struct xl_softc *)); +int xl_rx_resync __P((struct xl_softc *)); void xl_txeof __P((struct xl_softc *)); void xl_txeof_90xB __P((struct xl_softc *)); void xl_txeoc __P((struct xl_softc *)); @@ -1162,6 +1163,28 @@ int xl_newbuf(sc, c) return(0); } +int xl_rx_resync(sc) + struct xl_softc *sc; +{ + struct xl_chain_onefrag *pos; + int i; + + pos = sc->xl_cdata.xl_rx_head; + + for (i = 0; i < XL_RX_LIST_CNT; i++) { + if (pos->xl_ptr->xl_status) + break; + pos = pos->xl_next; + } + + if (i == XL_RX_LIST_CNT) + return (0); + + sc->xl_cdata.xl_rx_head = pos; + + return (EAGAIN); +} + /* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. @@ -1443,8 +1466,16 @@ int xl_intr(arg) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|(status & XL_INTRS)); - if (status & XL_STAT_UP_COMPLETE) + if (status & XL_STAT_UP_COMPLETE) { + int curpkts; + + curpkts = ifp->if_ipackets; xl_rxeof(sc); + if (curpkts == ifp->if_ipackets) { + while (xl_rx_resync(sc)) + xl_rxeof(sc); + } + } if (status & XL_STAT_DOWN_COMPLETE) { if (sc->xl_type == XL_TYPE_905B) @@ -1856,12 +1887,17 @@ void xl_init(xsc) */ xl_stop(sc); + if (sc->xl_hasmii) + mii = &sc->sc_mii; + + if (mii == NULL) { + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET); + xl_wait(sc); + } CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); DELAY(10000); - if (sc->xl_hasmii) - mii = &sc->sc_mii; /* Init our MAC address */ XL_SEL_WIN(2); @@ -2151,7 +2187,7 @@ xl_ioctl(ifp, command, data) caddr_t data; { struct xl_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; + struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; struct mii_data *mii = NULL; |