diff options
author | adrian <adrian@FreeBSD.org> | 2015-11-09 15:59:42 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2015-11-09 15:59:42 +0000 |
commit | 3b4605608b04b3a91b69ea133f19fab2f8b38879 (patch) | |
tree | 27f89645c5020187ba7110c77132998f00d7ee1a /sys/dev/ath | |
parent | 50d6b5faf455d78f6829aa57523ff8fe0d7cb83e (diff) | |
download | FreeBSD-src-3b4605608b04b3a91b69ea133f19fab2f8b38879.zip FreeBSD-src-3b4605608b04b3a91b69ea133f19fab2f8b38879.tar.gz |
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.
Diffstat (limited to 'sys/dev/ath')
-rw-r--r-- | sys/dev/ath/ath_hal/ah.h | 15 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5210/ar5210.h | 3 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5210/ar5210_reset.c | 1 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5211/ar5211.h | 1 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5211/ar5211_reset.c | 1 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5212/ar5212.h | 2 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5212/ar5212_reset.c | 4 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5312/ar5312.h | 6 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5312/ar5312_reset.c | 4 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416.h | 6 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416_reset.c | 4 | ||||
-rw-r--r-- | sys/dev/ath/if_ath.c | 10 | ||||
-rw-r--r-- | sys/dev/ath/if_athvar.h | 5 |
13 files changed, 41 insertions, 21 deletions
diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h index facfceb1..76f37d6 100644 --- a/sys/dev/ath/ath_hal/ah.h +++ b/sys/dev/ath/ath_hal/ah.h @@ -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, diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210.h b/sys/dev/ath/ath_hal/ar5210/ar5210.h index 3e372f7..71d78b5 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210.h +++ b/sys/dev/ath/ath_hal/ar5210/ar5210.h @@ -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 *); diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c index 1dba729..6029bff 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c +++ b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c @@ -69,6 +69,7 @@ static void ar5210SetOperatingMode(struct ath_hal *, int opmode); 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])) diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211.h b/sys/dev/ath/ath_hal/ar5211/ar5211.h index 6f04624..cdc33e1 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211.h +++ b/sys/dev/ath/ath_hal/ar5211/ar5211.h @@ -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 *); diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c index 01e3967..14c2087 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c +++ b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c @@ -154,6 +154,7 @@ static void ar5211SetOperatingMode(struct ath_hal *, int opmode); 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; diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h index 938a68c..bab061d 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212.h +++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h @@ -553,7 +553,7 @@ extern HAL_STATUS ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *, 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); diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c index fd3b473..34c93eb 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c @@ -116,7 +116,9 @@ write_common(struct ath_hal *ah, const HAL_INI_ARRAY *ia, 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) diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312.h b/sys/dev/ath/ath_hal/ar5312/ar5312.h index 0fb9b75..d729356 100644 --- a/sys/dev/ath/ath_hal/ar5312/ar5312.h +++ b/sys/dev/ath/ath_hal/ar5312/ar5312.h @@ -62,8 +62,10 @@ extern void ar5312SetupClock(struct ath_hal *ah, HAL_OPMODE opmode); 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, diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c b/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c index fdba35d..1f1f6cf 100644 --- a/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c +++ b/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c @@ -88,7 +88,9 @@ write_common(struct ath_hal *ah, const HAL_INI_ARRAY *ia, 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) diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index a631aad..31c1113 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -193,7 +193,7 @@ extern void ar5416RxMonitor(struct ath_hal *, const HAL_NODE_STATS *, 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(struct ath_hal *ah, struct ath_desc *, 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); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c index baf0ccc..6abb7b4 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c @@ -75,7 +75,9 @@ static void ar5416SetIFSTiming(struct ath_hal *ah, 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) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 26b1060..c05db5c 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -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_RESET_TYPE reset_type) 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, struct ieee80211_channel *chan) 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), diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index e3d414b..30763a2 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -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) \ |