diff options
author | adrian <adrian@FreeBSD.org> | 2016-06-02 05:00:52 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2016-06-02 05:00:52 +0000 |
commit | fc563e2554b6ac6664ae7627f9d2693b4662f8e6 (patch) | |
tree | 7b0166ee641a1d92062b38cb9c448a7a3f2f7a82 /sys/dev/iwm/if_iwm.c | |
parent | f04552e518b391e753b2c2cd286d363fcad26ba6 (diff) | |
download | FreeBSD-src-fc563e2554b6ac6664ae7627f9d2693b4662f8e6.zip FreeBSD-src-fc563e2554b6ac6664ae7627f9d2693b4662f8e6.tar.gz |
[iwm] Add bit-polling in Rx-DMA init code path.
Taken-From: OpenBSD (if_iwm.c r1.80)
Submitted by: Imre Vadasz <imre@vdsz.com>
Obtained from: DragonflyBSD ed35558754288911048cb607e57c688273ebd8d4
Diffstat (limited to 'sys/dev/iwm/if_iwm.c')
-rw-r--r-- | sys/dev/iwm/if_iwm.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index a13987c..56397b1 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -225,6 +225,7 @@ static void iwm_free_kw(struct iwm_softc *); static int iwm_alloc_ict(struct iwm_softc *); static void iwm_free_ict(struct iwm_softc *); static int iwm_alloc_rx_ring(struct iwm_softc *, struct iwm_rx_ring *); +static void iwm_disable_rx_dma(struct iwm_softc *); static void iwm_reset_rx_ring(struct iwm_softc *, struct iwm_rx_ring *); static void iwm_free_rx_ring(struct iwm_softc *, struct iwm_rx_ring *); static int iwm_alloc_tx_ring(struct iwm_softc *, struct iwm_tx_ring *, @@ -881,7 +882,7 @@ fail: iwm_free_rx_ring(sc, ring); } static void -iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) +iwm_disable_rx_dma(struct iwm_softc *sc) { /* XXX print out if we can't lock the NIC? */ @@ -890,6 +891,11 @@ iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) (void) iwm_pcie_rx_stop(sc); iwm_nic_unlock(sc); } +} + +static void +iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) +{ /* Reset the ring state */ ring->cur = 0; memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); @@ -1152,6 +1158,7 @@ iwm_stop_device(struct iwm_softc *sc) } iwm_nic_unlock(sc); } + iwm_disable_rx_dma(sc); /* Stop RX ring. */ iwm_reset_rx_ring(sc, &sc->rxq); @@ -1241,7 +1248,7 @@ iwm_nic_rx_init(struct iwm_softc *sc) memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); /* stop DMA */ - IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + iwm_disable_rx_dma(sc); IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_RBDCB_WPTR, 0); IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ, 0); IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_RDPTR, 0); |