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.
This commit is contained in:
parent
50d6b5faf4
commit
3b4605608b
@ -313,6 +313,7 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -765,6 +765,7 @@ ar9300_Stub_ProcRxDesc(struct ath_hal *ah, struct ath_desc *desc0,
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -128,6 +128,7 @@ extern HAL_STATUS ar9300_Stub_ProcRxDesc(struct ath_hal *ah, struct ath_desc *,
|
||||
|
||||
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 *);
|
||||
|
@ -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,
|
||||
|
@ -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 *);
|
||||
|
@ -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]))
|
||||
|
@ -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 *);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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),
|
||||
|
@ -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) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user