summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-01-13 05:50:22 +0000
committersam <sam@FreeBSD.org>2009-01-13 05:50:22 +0000
commit044ff6b386a70ff2cacd1c70ced4fa91e3beffe7 (patch)
treee911a7a18368b1dedc4a08ac3d52dfe2a304e120
parentbbd91baa0811e56a7f0350781dafdf966fff47dc (diff)
downloadFreeBSD-src-044ff6b386a70ff2cacd1c70ced4fa91e3beffe7.zip
FreeBSD-src-044ff6b386a70ff2cacd1c70ced4fa91e3beffe7.tar.gz
On some platforms touching the bb registers when the phy is powered
down will cause a fault. Check the phy power state before possibly reading from the bb, this can happen as ar5212Reset intentionally calls ar5212GetRfgain before bringing the bb out of reset (but we do it here and not in the caller to guard against other possible uses).
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
index 8448ed7..4d17eef 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: ar5212_rfgain.c,v 1.2 2008/11/19 21:23:01 sam Exp $
+ * $FreeBSD$
*/
#include "opt_ah.h"
@@ -280,7 +280,8 @@ ar5212GetRfgain(struct ath_hal *ah)
GAIN_VALUES *gv = &ahp->ah_gainValues;
uint32_t rddata, probeType;
- if (!gv->active)
+ /* NB: beware of touching the BB when PHY is powered down */
+ if (!gv->active || !ahp->ah_phyPowerOn)
return HAL_RFGAIN_INACTIVE;
if (ahp->ah_rfgainState == HAL_RFGAIN_READ_REQUESTED) {
OpenPOWER on IntegriCloud