diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/socppc/dev/if_tsec.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/arch/socppc/dev/if_tsec.c b/sys/arch/socppc/dev/if_tsec.c index a372c4819ed..5003cb33c6a 100644 --- a/sys/arch/socppc/dev/if_tsec.c +++ b/sys/arch/socppc/dev/if_tsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tsec.c,v 1.7 2008/05/25 16:23:58 kettenis Exp $ */ +/* $OpenBSD: if_tsec.c,v 1.8 2008/05/26 20:22:35 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -826,6 +826,9 @@ tsec_up(struct tsec_softc *sc) (TSEC_NTXDESC - 1) * sizeof(*txd), sizeof(*txd), BUS_DMASYNC_PREWRITE); + sc->sc_tx_prod = sc->sc_tx_cons = 0; + sc->sc_tx_cnt = 0; + tsec_write(sc, TSEC_TBASE, TSEC_DMA_DVA(sc->sc_txring)); /* Allocate Rx descriptor ring. */ @@ -854,6 +857,8 @@ tsec_up(struct tsec_softc *sc) bus_dmamap_sync(sc->sc_dmat, TSEC_DMA_MAP(sc->sc_rxring), 0, TSEC_DMA_LEN(sc->sc_rxring), BUS_DMASYNC_PREWRITE); + sc->sc_rx_nextidx = 0; + tsec_write(sc, TSEC_MRBLR, MCLBYTES); tsec_write(sc, TSEC_RBASE, TSEC_DMA_DVA(sc->sc_rxring)); @@ -930,14 +935,22 @@ void tsec_down(struct tsec_softc *sc) { struct ifnet *ifp = &sc->sc_ac.ac_if; + uint32_t maccfg1; timeout_del(&sc->sc_tick); ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_timer = 0; tsec_stop_dma(sc); + maccfg1 = tsec_read(sc, TSEC_MACCFG1); + maccfg1 &= ~TSEC_MACCFG1_TXEN; + maccfg1 &= ~TSEC_MACCFG1_RXEN; + tsec_write(sc, TSEC_MACCFG1, maccfg1); + tsec_dmamem_free(sc, sc->sc_txring); + free (sc->sc_txbuf, M_DEVBUF); } void |