Deleted Added
sdiff udiff text old ( 271823 ) new ( 271887 )
full compact
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath.c 271823 2014-09-18 20:47:39Z glebius $");
32
33/*
34 * Driver for the Atheros Wireless LAN controller.
35 *
36 * This software is derived from work of Atsushi Onoe; his contribution
37 * is greatly appreciated.
38 */
39

--- 1670 unchanged lines hidden (view full) ---

1710
1711 sc->sc_resume_up = (ifp->if_flags & IFF_UP) != 0;
1712
1713 ieee80211_suspend_all(ic);
1714 /*
1715 * NB: don't worry about putting the chip in low power
1716 * mode; pci will power off our socket on suspend and
1717 * CardBus detaches the device.
1718 */
1719
1720 /*
1721 * XXX ensure none of the taskqueues are running
1722 * XXX ensure sc_invalid is 1
1723 * XXX ensure the calibration callout is disabled
1724 */
1725
1726 /* Disable the PCIe PHY, complete with workarounds */
1727 ath_hal_enablepcie(sc->sc_ah, 1, 1);
1728}
1729
1730/*
1731 * Reset the key cache since some parts do not reset the

--- 74 unchanged lines hidden (view full) ---

1806 ath_power_setpower(sc, HAL_PM_AWAKE);
1807 ATH_UNLOCK(sc);
1808
1809 ath_hal_reset(ah, sc->sc_opmode,
1810 sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan,
1811 AH_FALSE, &status);
1812 ath_reset_keycache(sc);
1813
1814 /* Let DFS at it in case it's a DFS channel */
1815 ath_dfs_radar_enable(sc, ic->ic_curchan);
1816
1817 /* Let spectral at in case spectral is enabled */
1818 ath_spectral_enable(sc, ic->ic_curchan);
1819
1820 /*
1821 * Let bluetooth coexistence at in case it's needed for this channel

--- 188 unchanged lines hidden (view full) ---

2010 */
2011 sc->sc_rx.recv_sched(sc, 1);
2012#endif
2013 }
2014 }
2015 if (status & HAL_INT_RXEOL) {
2016 int imask;
2017 ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXEOL");
2018 ATH_PCU_LOCK(sc);
2019 /*
2020 * NB: the hardware should re-read the link when
2021 * RXE bit is written, but it doesn't work at
2022 * least on older hardware revs.
2023 */
2024 sc->sc_stats.ast_rxeol++;
2025 /*
2026 * Disable RXEOL/RXORN - prevent an interrupt
2027 * storm until the PCU logic can be reset.
2028 * In case the interface is reset some other
2029 * way before "sc_kickpcu" is called, don't
2030 * modify sc_imask - that way if it is reset
2031 * by a call to ath_reset() somehow, the
2032 * interrupt mask will be correctly reprogrammed.
2033 */
2034 imask = sc->sc_imask;
2035 imask &= ~(HAL_INT_RXEOL | HAL_INT_RXORN);
2036 ath_hal_intrset(ah, imask);
2037 /*
2038 * Only blank sc_rxlink if we've not yet kicked
2039 * the PCU.
2040 *
2041 * This isn't entirely correct - the correct solution
2042 * would be to have a PCU lock and engage that for
2043 * the duration of the PCU fiddling; which would include
2044 * running the RX process. Otherwise we could end up
2045 * messing up the RX descriptor chain and making the
2046 * RX desc list much shorter.
2047 */
2048 if (! sc->sc_kickpcu)
2049 sc->sc_rxlink = NULL;
2050 sc->sc_kickpcu = 1;
2051 ATH_PCU_UNLOCK(sc);
2052 /*
2053 * Enqueue an RX proc, to handled whatever
2054 * is in the RX queue.
2055 * This will then kick the PCU.
2056 */
2057 sc->sc_rx.recv_sched(sc, 1);
2058 }
2059 if (status & HAL_INT_TXURN) {
2060 sc->sc_stats.ast_txurn++;
2061 /* bump tx trigger level */
2062 ath_hal_updatetxtriglevel(ah, AH_TRUE);
2063 }

--- 279 unchanged lines hidden (view full) ---

2343 sc->sc_cur_rxchainmask);
2344
2345 if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_FALSE, &status)) {
2346 if_printf(ifp, "unable to reset hardware; hal status %u\n",
2347 status);
2348 ATH_UNLOCK(sc);
2349 return;
2350 }
2351 ath_chan_change(sc, ic->ic_curchan);
2352
2353 /* Let DFS at it in case it's a DFS channel */
2354 ath_dfs_radar_enable(sc, ic->ic_curchan);
2355
2356 /* Let spectral at in case spectral is enabled */
2357 ath_spectral_enable(sc, ic->ic_curchan);
2358

--- 42 unchanged lines hidden (view full) ---

2401 ATH_UNLOCK(sc);
2402 return;
2403 }
2404
2405 /*
2406 * Enable interrupts.
2407 */
2408 sc->sc_imask = HAL_INT_RX | HAL_INT_TX
2409 | HAL_INT_RXEOL | HAL_INT_RXORN
2410 | HAL_INT_TXURN
2411 | HAL_INT_FATAL | HAL_INT_GLOBAL;
2412
2413 /*
2414 * Enable RX EDMA bits. Note these overlap with
2415 * HAL_INT_RX and HAL_INT_RXDESC respectively.
2416 */
2417 if (sc->sc_isedma)
2418 sc->sc_imask |= (HAL_INT_RXHP | HAL_INT_RXLP);
2419
2420 /*
2421 * Enable MIB interrupts when there are hardware phy counters.
2422 * Note we only do this (at the moment) for station mode.
2423 */
2424 if (sc->sc_needmib && ic->ic_opmode == IEEE80211_M_STA)
2425 sc->sc_imask |= HAL_INT_MIB;
2426
2427 /*
2428 * XXX add capability for this.

--- 301 unchanged lines hidden (view full) ---

2730 ath_update_chainmasks(sc, ic->ic_curchan);
2731 ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask,
2732 sc->sc_cur_rxchainmask);
2733 if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_TRUE, &status))
2734 if_printf(ifp, "%s: unable to reset hardware; hal status %u\n",
2735 __func__, status);
2736 sc->sc_diversity = ath_hal_getdiversity(ah);
2737
2738 /* Let DFS at it in case it's a DFS channel */
2739 ath_dfs_radar_enable(sc, ic->ic_curchan);
2740
2741 /* Let spectral at in case spectral is enabled */
2742 ath_spectral_enable(sc, ic->ic_curchan);
2743
2744 /*
2745 * Let bluetooth coexistence at in case it's needed for this channel

--- 2582 unchanged lines hidden (view full) ---

5328 ATH_PCU_UNLOCK_ASSERT(sc);
5329 ATH_UNLOCK_ASSERT(sc);
5330
5331 /* (Try to) stop TX/RX from occuring */
5332 taskqueue_block(sc->sc_tq);
5333
5334 ATH_PCU_LOCK(sc);
5335
5336 /* Stop new RX/TX/interrupt completion */
5337 if (ath_reset_grablock(sc, 1) == 0) {
5338 device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n",
5339 __func__);
5340 }
5341
5342 ath_hal_intrset(ah, 0);
5343
5344 /* Stop pending RX/TX completion */
5345 ath_txrx_stop_locked(sc);
5346
5347 ATH_PCU_UNLOCK(sc);
5348
5349 DPRINTF(sc, ATH_DEBUG_RESET, "%s: %u (%u MHz, flags 0x%x)\n",
5350 __func__, ieee80211_chan2ieee(ic, chan),
5351 chan->ic_freq, chan->ic_flags);

--- 27 unchanged lines hidden (view full) ---

5379 "channel %u (%u MHz, flags 0x%x), hal status %u\n",
5380 __func__, ieee80211_chan2ieee(ic, chan),
5381 chan->ic_freq, chan->ic_flags, status);
5382 ret = EIO;
5383 goto finish;
5384 }
5385 sc->sc_diversity = ath_hal_getdiversity(ah);
5386
5387 /* Let DFS at it in case it's a DFS channel */
5388 ath_dfs_radar_enable(sc, chan);
5389
5390 /* Let spectral at in case spectral is enabled */
5391 ath_spectral_enable(sc, chan);
5392
5393 /*
5394 * Let bluetooth coexistence at in case it's needed for this

--- 1671 unchanged lines hidden ---