aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2020-05-25 22:31:45 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2020-05-25 22:31:45 +0000
commit8c01c3dc46a4ce7c5e5a91e510f2b82dbda9445c (patch)
tree8464d3e72fdac1897f00a4b7c42ff95112fc63df /sys/dev/ath
parenta639f9379b90e2f0e7e96cd33b43ad1cd24d062d (diff)
Notes
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416.h3
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_reset.c14
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9130_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar9001/ar9160_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9280_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9285_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9287_attach.c2
-rw-r--r--sys/dev/ath/if_ath.c21
-rw-r--r--sys/dev/ath/if_ath_misc.h3
-rw-r--r--sys/dev/ath/if_ath_sysctl.c8
11 files changed, 40 insertions, 21 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h
index 7e167709fa7a..3f0787ec17c3 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h
@@ -306,7 +306,8 @@ extern HAL_BOOL ar5416PhyDisable(struct ath_hal *ah);
extern HAL_RFGAIN ar5416GetRfgain(struct ath_hal *ah);
extern HAL_BOOL ar5416Disable(struct ath_hal *ah);
extern HAL_BOOL ar5416ChipReset(struct ath_hal *ah,
- const struct ieee80211_channel *);
+ const struct ieee80211_channel *,
+ HAL_RESET_TYPE);
extern int ar5416GetRegChainOffset(struct ath_hal *ah, int i);
extern HAL_BOOL ar5416SetBoardValues(struct ath_hal *,
const struct ieee80211_channel *);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index 8957dedb39dc..6d8dfd3b8567 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -376,7 +376,7 @@ ar5416Attach(uint16_t devid, HAL_SOFTC sc,
if (ecode != HAL_OK)
goto bad;
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n",
__func__);
ecode = HAL_EIO;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
index 6c5cf53c325b..7501885be6f5 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
@@ -170,13 +170,15 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
if (AR_SREV_HOWL(ah) ||
(AR_SREV_MERLIN(ah) &&
ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) ||
+ (resetType == HAL_RESET_FORCE_COLD) ||
+ (resetType == HAL_RESET_BBPANIC) ||
(ah->ah_config.ah_force_full_reset))
tsf = ar5416GetTsf64(ah);
/* Mark PHY as inactive; marked active in ar5416InitBB() */
ar5416MarkPhyInactive(ah);
- if (!ar5416ChipReset(ah, chan)) {
+ if (!ar5416ChipReset(ah, chan, resetType)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
FAIL(HAL_EIO);
}
@@ -775,7 +777,8 @@ ar5416SetRfMode(struct ath_hal *ah, const struct ieee80211_channel *chan)
* Places the hardware into reset and then pulls it out of reset
*/
HAL_BOOL
-ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan)
+ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan,
+ HAL_RESET_TYPE resetType)
{
OS_MARK(ah, AH_MARK_CHIPRESET, chan ? chan->ic_freq : 0);
/*
@@ -788,6 +791,13 @@ ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan)
} else if (ah->ah_config.ah_force_full_reset) {
if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON))
return AH_FALSE;
+ } else if ((resetType == HAL_RESET_FORCE_COLD) ||
+ (resetType == HAL_RESET_BBPANIC)) {
+ HALDEBUG(ah, HAL_DEBUG_RESET,
+ "%s: full reset; resetType=%d\n",
+ __func__, resetType);
+ if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON))
+ return AH_FALSE;
} else {
if (!ar5416SetResetReg(ah, HAL_RESET_WARM))
return AH_FALSE;
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
index 1d78b053c372..85389792219e 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
@@ -173,7 +173,7 @@ ar9130Attach(uint16_t devid, HAL_SOFTC sc,
if (ecode != HAL_OK)
goto bad;
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
ecode = HAL_EIO;
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
index f74da22d1e7c..b67699358aab 100644
--- a/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
+++ b/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
@@ -200,7 +200,7 @@ ar9160Attach(uint16_t devid, HAL_SOFTC sc,
HAL_INI_INIT(&AH5416(ah)->ah_ini_pcieserdes, ar9160PciePhy, 2);
ar5416AttachPCIE(ah);
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
ecode = HAL_EIO;
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
index 92479214e5a5..d6336bef734c 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
@@ -259,7 +259,7 @@ ar9280Attach(uint16_t devid, HAL_SOFTC sc,
if (ecode != HAL_OK)
goto bad;
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
ecode = HAL_EIO;
goto bad;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
index 5c140b98dbb1..718a89995df3 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
@@ -249,7 +249,7 @@ ar9285Attach(uint16_t devid, HAL_SOFTC sc,
if (ecode != HAL_OK)
goto bad;
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n",
__func__);
ecode = HAL_EIO;
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
index 8341535bdb97..b5173dab309e 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c
@@ -242,7 +242,7 @@ ar9287Attach(uint16_t devid, HAL_SOFTC sc,
if (ecode != HAL_OK)
goto bad;
- if (!ar5416ChipReset(ah, AH_NULL)) { /* reset chip */
+ if (!ar5416ChipReset(ah, AH_NULL, HAL_RESET_NORMAL)) { /* reset chip */
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
ecode = HAL_EIO;
goto bad;
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 7cadbfd3b110..660547f32701 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2380,7 +2380,7 @@ ath_fatal_proc(void *arg, int pending)
"0x%08x 0x%08x 0x%08x, 0x%08x 0x%08x 0x%08x\n", state[0],
state[1] , state[2], state[3], state[4], state[5]);
}
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_FORCE_COLD);
}
static void
@@ -2491,11 +2491,11 @@ ath_bmiss_proc(void *arg, int pending)
* to clear.
*/
if (ath_hal_gethangstate(sc->sc_ah, 0xff, &hangs) && hangs != 0) {
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_BBPANIC);
device_printf(sc->sc_dev,
"bb hang detected (0x%x), resetting\n", hangs);
} else {
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_FORCE_COLD);
ieee80211_beacon_miss(&sc->sc_ic);
}
@@ -2894,7 +2894,8 @@ ath_reset_grablock(struct ath_softc *sc, int dowait)
* to reset or reload hardware state.
*/
int
-ath_reset(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
+ath_reset(struct ath_softc *sc, ATH_RESET_TYPE reset_type,
+ HAL_RESET_TYPE ah_reset_type)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
@@ -2962,7 +2963,7 @@ ath_reset(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
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,
- HAL_RESET_NORMAL, &status))
+ ah_reset_type, &status))
device_printf(sc->sc_dev,
"%s: unable to reset hardware; hal status %u\n",
__func__, status);
@@ -3098,7 +3099,7 @@ ath_reset_vap(struct ieee80211vap *vap, u_long cmd)
return 0;
}
/* XXX? Full or NOLOSS? */
- return ath_reset(sc, ATH_RESET_FULL);
+ return ath_reset(sc, ATH_RESET_FULL, HAL_RESET_NORMAL);
}
struct ath_buf *
@@ -3778,7 +3779,7 @@ ath_reset_proc(void *arg, int pending)
#if 0
device_printf(sc->sc_dev, "%s: resetting\n", __func__);
#endif
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_FORCE_COLD);
}
/*
@@ -3805,7 +3806,7 @@ ath_bstuck_proc(void *arg, int pending)
* This assumes that there's no simultaneous channel mode change
* occurring.
*/
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_FORCE_COLD);
}
static int
@@ -5460,6 +5461,10 @@ ath_calibrate(void *arg)
* infinite NIC restart. Ideally we'd not restart if we
* failed the first NF cal - that /can/ fail sometimes in
* a noisy environment.
+ *
+ * Instead, we should likely temporarily shorten the longCal
+ * period to happen pretty quickly and if a subsequent one
+ * fails, do a full reset.
*/
if (shortCal)
sc->sc_lastshortcal = ticks;
diff --git a/sys/dev/ath/if_ath_misc.h b/sys/dev/ath/if_ath_misc.h
index d3e6b3ad313b..b108c29bab4b 100644
--- a/sys/dev/ath/if_ath_misc.h
+++ b/sys/dev/ath/if_ath_misc.h
@@ -58,7 +58,8 @@ extern void ath_freebuf(struct ath_softc *sc, struct ath_buf *bf);
extern void ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf);
extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf);
-extern int ath_reset(struct ath_softc *, ATH_RESET_TYPE);
+extern int ath_reset(struct ath_softc *, ATH_RESET_TYPE,
+ HAL_RESET_TYPE ah_reset_type);
extern void ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf,
int fail);
extern void ath_tx_update_ratectrl(struct ath_softc *sc,
diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c
index 662aa77008a3..03a61b3a841e 100644
--- a/sys/dev/ath/if_ath_sysctl.c
+++ b/sys/dev/ath/if_ath_sysctl.c
@@ -382,7 +382,8 @@ ath_sysctl_tpscale(SYSCTL_HANDLER_ARGS)
goto finish;
error = !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL :
- (sc->sc_running) ? ath_reset(sc, ATH_RESET_NOLOSS) : 0;
+ (sc->sc_running) ? ath_reset(sc, ATH_RESET_NOLOSS,
+ HAL_RESET_NORMAL) : 0;
finish:
ATH_LOCK(sc);
@@ -443,7 +444,8 @@ ath_sysctl_rfkill(SYSCTL_HANDLER_ARGS)
error = EINVAL;
goto finish;
}
- error = sc->sc_running ? ath_reset(sc, ATH_RESET_FULL) : 0;
+ error = sc->sc_running ? ath_reset(sc, ATH_RESET_FULL,
+ HAL_RESET_NORMAL) : 0;
finish:
ATH_LOCK(sc);
@@ -670,7 +672,7 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS)
* things in an inconsistent state.
*/
if (sc->sc_running)
- ath_reset(sc, ATH_RESET_NOLOSS);
+ ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_NORMAL);
error = 0;