From owner-svn-src-head@freebsd.org Thu Jun 2 05:00:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3184DB67A59; Thu, 2 Jun 2016 05:00:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC15A1D42; Thu, 2 Jun 2016 05:00:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5250rFi008577; Thu, 2 Jun 2016 05:00:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5250rwE008576; Thu, 2 Jun 2016 05:00:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606020500.u5250rwE008576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 2 Jun 2016 05:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301191 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2016 05:00:54 -0000 Author: adrian Date: Thu Jun 2 05:00:52 2016 New Revision: 301191 URL: https://svnweb.freebsd.org/changeset/base/301191 Log: [iwm] Add bit-polling in Rx-DMA init code path. Taken-From: OpenBSD (if_iwm.c r1.80) Submitted by: Imre Vadasz Obtained from: DragonflyBSD ed35558754288911048cb607e57c688273ebd8d4 Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Jun 2 04:54:56 2016 (r301190) +++ head/sys/dev/iwm/if_iwm.c Thu Jun 2 05:00:52 2016 (r301191) @@ -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, (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);