Date: Mon, 9 Nov 2015 15:59:42 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290612 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal... Message-ID: <201511091559.tA9FxgB1046943@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Mon Nov 9 15:59:42 2015 New Revision: 290612 URL: https://svnweb.freebsd.org/changeset/base/290612 Log: ath(4): begin fleshing out a "reset type" extension to force cold/warn resets. Right now the only way to force a cold reset is: * The HAL itself detects it's needed, or * The sysctl, setting all resets to be cold. Trouble is, cold resets take quite a bit longer than warm resets. However, there are situations where a cold reset would be nice. Specifically, after a stuck beacon, BB/MAC hang, stuck calibration results, etc. The vendor HAL has a separate method to set the reset reason (which is how HAL_RESET_BBPANIC gets set) which informs the HAL during the reset path why it occured. This is almost but not quite the same; I may eventually unify both approaches in the future. This commit just extends HAL_RESET_TYPE to include both status (eg BBPANIC) and type (eg do COLD.) None of the HAL code uses it yet though; that'll come later. It also is a big no-op in each HAL - I need to go teach each of the HALs about cold/warm reset through this path. Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.h head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c head/sys/dev/ath/ath_hal/ar5312/ar5312.h head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c Mon Nov 9 15:59:42 2015 (r290612) @@ -313,6 +313,7 @@ ar9300_attach_freebsd_ops(struct ath_hal HAL_BOOL ar9300_reset_freebsd(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, HAL_STATUS *status) { HAL_BOOL r; Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.h ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.h Mon Nov 9 15:59:42 2015 (r290612) @@ -4,7 +4,7 @@ extern void ar9300_attach_freebsd_ops(struct ath_hal *ah); extern HAL_BOOL ar9300_reset_freebsd(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, - HAL_STATUS *status); + HAL_RESET_TYPE resetType, HAL_STATUS *status); extern void ar9300_config_pcie_freebsd(struct ath_hal *, HAL_BOOL, HAL_BOOL); extern HAL_STATUS ar9300_eeprom_get_freebsd(struct ath_hal *, int param, void *val); Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c Mon Nov 9 15:59:42 2015 (r290612) @@ -765,6 +765,7 @@ ar9300_Stub_ProcRxDesc(struct ath_hal *a HAL_BOOL ar9300_Stub_Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, HAL_STATUS *status) { Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.h Mon Nov 9 15:59:42 2015 (r290612) @@ -128,6 +128,7 @@ extern HAL_STATUS ar9300_Stub_ProcRxDesc extern HAL_BOOL ar9300_Stub_Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, HAL_STATUS *status); extern HAL_BOOL ar9300_Stub_SetChannel(struct ath_hal *, const struct ieee80211_channel *); Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ah.h Mon Nov 9 15:59:42 2015 (r290612) @@ -753,6 +753,12 @@ typedef enum { HAL_M_MONITOR = 8 /* Monitor mode */ } HAL_OPMODE; +typedef enum { + HAL_RESET_NORMAL = 0, /* Do normal reset */ + HAL_RESET_BBPANIC = 1, /* Reset because of BB panic */ + HAL_RESET_FORCE_COLD = 2, /* Force full reset */ +} HAL_RESET_TYPE; + typedef struct { uint8_t kv_type; /* one of HAL_CIPHER */ uint8_t kv_apsd; /* Mask for APSD enabled ACs */ @@ -1088,11 +1094,6 @@ typedef enum { HAL_GEN_TIMER_TSF_ANY } HAL_GEN_TIMER_DOMAIN; -typedef enum { - HAL_RESET_NONE = 0x0, - HAL_RESET_BBPANIC = 0x1, -} HAL_RESET_TYPE; - /* * BT Co-existence definitions */ @@ -1354,7 +1355,9 @@ struct ath_hal { /* Reset functions */ HAL_BOOL __ahdecl(*ah_reset)(struct ath_hal *, HAL_OPMODE, struct ieee80211_channel *, - HAL_BOOL bChannelChange, HAL_STATUS *status); + HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, + HAL_STATUS *status); HAL_BOOL __ahdecl(*ah_phyDisable)(struct ath_hal *); HAL_BOOL __ahdecl(*ah_disable)(struct ath_hal *); void __ahdecl(*ah_configPCIE)(struct ath_hal *, HAL_BOOL restore, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Nov 9 15:59:42 2015 (r290612) @@ -129,7 +129,8 @@ struct ath_hal; extern void ar5210Detach(struct ath_hal *ah); extern HAL_BOOL ar5210Reset(struct ath_hal *, HAL_OPMODE, - struct ieee80211_channel *, HAL_BOOL bChannelChange, HAL_STATUS *); + struct ieee80211_channel *, HAL_BOOL bChannelChange, + HAL_RESET_TYPE, HAL_STATUS *); extern void ar5210SetPCUConfig(struct ath_hal *); extern HAL_BOOL ar5210PhyDisable(struct ath_hal *); extern HAL_BOOL ar5210Disable(struct ath_hal *); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c Mon Nov 9 15:59:42 2015 (r290612) @@ -69,6 +69,7 @@ static void ar5210SetOperatingMode(struc HAL_BOOL ar5210Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, HAL_STATUS *status) { #define N(a) (sizeof (a) /sizeof (a[0])) Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Nov 9 15:59:42 2015 (r290612) @@ -147,6 +147,7 @@ extern void ar5211Detach(struct ath_hal extern HAL_BOOL ar5211Reset(struct ath_hal *, HAL_OPMODE, struct ieee80211_channel *, HAL_BOOL bChannelChange, + HAL_RESET_TYPE, HAL_STATUS *); extern HAL_BOOL ar5211PhyDisable(struct ath_hal *); extern HAL_BOOL ar5211Disable(struct ath_hal *); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c Mon Nov 9 15:59:42 2015 (r290612) @@ -154,6 +154,7 @@ static void ar5211SetOperatingMode(struc HAL_BOOL ar5211Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, HAL_STATUS *status) { uint32_t softLedCfg, softLedState; Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Nov 9 15:59:42 2015 (r290612) @@ -553,7 +553,7 @@ extern HAL_STATUS ar5212ProcRxDesc(struc extern HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, HAL_BOOL bChannelChange, - HAL_STATUS *status); + HAL_RESET_TYPE, HAL_STATUS *status); extern HAL_BOOL ar5212SetChannel(struct ath_hal *, const struct ieee80211_channel *); extern void ar5212SetOperatingMode(struct ath_hal *ah, int opmode); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Mon Nov 9 15:59:42 2015 (r290612) @@ -116,7 +116,9 @@ write_common(struct ath_hal *ah, const H HAL_BOOL ar5212Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, - HAL_BOOL bChannelChange, HAL_STATUS *status) + HAL_BOOL bChannelChange, + HAL_RESET_TYPE, resetType, + HAL_STATUS *status) { #define N(a) (sizeof (a) / sizeof (a[0])) #define FAIL(_code) do { ecode = _code; goto bad; } while (0) Modified: head/sys/dev/ath/ath_hal/ar5312/ar5312.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5312/ar5312.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5312/ar5312.h Mon Nov 9 15:59:42 2015 (r290612) @@ -62,8 +62,10 @@ extern void ar5312SetupClock(struct ath extern void ar5312RestoreClock(struct ath_hal *ah, HAL_OPMODE opmode); extern void ar5312DumpState(struct ath_hal *ah); extern HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, - struct ieee80211_channel *chan, - HAL_BOOL bChannelChange, HAL_STATUS *status); + struct ieee80211_channel *chan, + HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, + HAL_STATUS *status); extern HAL_BOOL ar5312ChipReset(struct ath_hal *ah, struct ieee80211_channel *chan); extern HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, Modified: head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c Mon Nov 9 15:59:42 2015 (r290612) @@ -88,7 +88,9 @@ write_common(struct ath_hal *ah, const H HAL_BOOL ar5312Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, - HAL_BOOL bChannelChange, HAL_STATUS *status) + HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, + HAL_STATUS *status) { #define N(a) (sizeof (a) / sizeof (a[0])) #define FAIL(_code) do { ecode = _code; goto bad; } while (0) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Nov 9 15:59:42 2015 (r290612) @@ -193,7 +193,7 @@ extern void ar5416RxMonitor(struct ath_h const struct ieee80211_channel *); extern void ar5416AniPoll(struct ath_hal *, const struct ieee80211_channel *); extern void ar5416AniReset(struct ath_hal *, const struct ieee80211_channel *, - HAL_OPMODE, int); + HAL_OPMODE, HAL_RESET_TYPE, int); extern void ar5416SetBeaconTimers(struct ath_hal *, const HAL_BEACON_TIMERS *); extern void ar5416BeaconInit(struct ath_hal *ah, @@ -303,7 +303,9 @@ extern HAL_STATUS ar5416ProcRxDesc(struc extern HAL_BOOL ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, - HAL_BOOL bChannelChange, HAL_STATUS *status); + HAL_BOOL bChannelChange, + HAL_RESET_TYPE, + HAL_STATUS *status); extern HAL_BOOL ar5416PhyDisable(struct ath_hal *ah); extern HAL_RFGAIN ar5416GetRfgain(struct ath_hal *ah); extern HAL_BOOL ar5416Disable(struct ath_hal *ah); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon Nov 9 15:59:42 2015 (r290612) @@ -75,7 +75,9 @@ static void ar5416SetIFSTiming(struct at HAL_BOOL ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode, struct ieee80211_channel *chan, - HAL_BOOL bChannelChange, HAL_STATUS *status) + HAL_BOOL bChannelChange, + HAL_RESET_TYPE resetType, + HAL_STATUS *status) { #define N(a) (sizeof (a) / sizeof (a[0])) #define FAIL(_code) do { ecode = _code; goto bad; } while (0) Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/if_ath.c Mon Nov 9 15:59:42 2015 (r290612) @@ -1916,7 +1916,7 @@ ath_resume(struct ath_softc *sc) ath_hal_reset(ah, sc->sc_opmode, sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan, - AH_FALSE, &status); + AH_FALSE, HAL_RESET_NORMAL, &status); ath_reset_keycache(sc); ATH_RX_LOCK(sc); @@ -2449,7 +2449,7 @@ ath_init(struct ath_softc *sc) sc->sc_cur_rxchainmask); if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_FALSE, - &status)) { + HAL_RESET_NORMAL, &status)) { device_printf(sc->sc_dev, "unable to reset hardware; hal status %u\n", status); return (ENODEV); @@ -2823,7 +2823,8 @@ ath_reset(struct ath_softc *sc, ATH_RESE ath_update_chainmasks(sc, ic->ic_curchan); ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, sc->sc_cur_rxchainmask); - if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_TRUE, &status)) + if (!ath_hal_reset(ah, sc->sc_opmode, ic->ic_curchan, AH_TRUE, + HAL_RESET_NORMAL, &status)) device_printf(sc->sc_dev, "%s: unable to reset hardware; hal status %u\n", __func__, status); @@ -5423,7 +5424,8 @@ ath_chan_set(struct ath_softc *sc, struc ath_update_chainmasks(sc, chan); ath_hal_setchainmasks(sc->sc_ah, sc->sc_cur_txchainmask, sc->sc_cur_rxchainmask); - if (!ath_hal_reset(ah, sc->sc_opmode, chan, AH_TRUE, &status)) { + if (!ath_hal_reset(ah, sc->sc_opmode, chan, AH_TRUE, + HAL_RESET_NORMAL, &status)) { device_printf(sc->sc_dev, "%s: unable to reset " "channel %u (%u MHz, flags 0x%x), hal status %u\n", __func__, ieee80211_chan2ieee(ic, chan), Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Nov 9 12:22:44 2015 (r290611) +++ head/sys/dev/ath/if_athvar.h Mon Nov 9 15:59:42 2015 (r290612) @@ -1035,8 +1035,9 @@ void ath_intr(void *); */ #define ath_hal_detach(_ah) \ ((*(_ah)->ah_detach)((_ah))) -#define ath_hal_reset(_ah, _opmode, _chan, _fullreset, _pstatus) \ - ((*(_ah)->ah_reset)((_ah), (_opmode), (_chan), (_fullreset), (_pstatus))) +#define ath_hal_reset(_ah, _opmode, _chan, _fullreset, _resettype, _pstatus) \ + ((*(_ah)->ah_reset)((_ah), (_opmode), (_chan), (_fullreset), \ + (_resettype), (_pstatus))) #define ath_hal_macversion(_ah) \ (((_ah)->ah_macVersion << 4) | ((_ah)->ah_macRev)) #define ath_hal_getratetable(_ah, _mode) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511091559.tA9FxgB1046943>