From owner-svn-src-all@FreeBSD.ORG Thu Feb 17 05:52:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02D00106564A; Thu, 17 Feb 2011 05:52:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E50B28FC0C; Thu, 17 Feb 2011 05:52:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1H5qrlS096827; Thu, 17 Feb 2011 05:52:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1H5qrXd096822; Thu, 17 Feb 2011 05:52:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201102170552.p1H5qrXd096822@svn.freebsd.org> From: Adrian Chadd Date: Thu, 17 Feb 2011 05:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218763 - in head/sys/dev/ath/ath_hal: . ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 05:52:54 -0000 Author: adrian Date: Thu Feb 17 05:52:53 2011 New Revision: 218763 URL: http://svn.freebsd.org/changeset/base/218763 Log: Add a new parameter to selectively enable/disable the ANI operations. This was inspired by ath9k, which disables ANI anti-noise immunity parameter tweaking (but leaves the rest of the ANI operations alone.) Modified: head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 17 05:30:38 2011 (r218762) +++ head/sys/dev/ath/ath_hal/ah_internal.h Thu Feb 17 05:52:53 2011 (r218763) @@ -408,14 +408,15 @@ extern HAL_BOOL ath_hal_getTxQProps(stru HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi); typedef enum { - HAL_ANI_PRESENT, /* is ANI support present */ - HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */ - HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */ - HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */ - HAL_ANI_FIRSTEP_LEVEL, /* set level */ - HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */ - HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */ - HAL_ANI_PHYERR_RESET, /* reset phy error stats */ + HAL_ANI_PRESENT = 0x1, /* is ANI support present */ + HAL_ANI_NOISE_IMMUNITY_LEVEL = 0x2, /* set level */ + HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, /* enable/disable */ + HAL_ANI_CCK_WEAK_SIGNAL_THR = 0x8, /* enable/disable */ + HAL_ANI_FIRSTEP_LEVEL = 0x10, /* set level */ + HAL_ANI_SPUR_IMMUNITY_LEVEL = 0x20, /* set level */ + HAL_ANI_MODE = 0x40, /* 0 => manual, 1 => auto (XXX do not change) */ + HAL_ANI_PHYERR_RESET =0x80, /* reset phy error stats */ + HAL_ANI_ALL = 0xff } HAL_ANI_CMD; #define HAL_SPUR_VAL_MASK 0x3FFF Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Feb 17 05:30:38 2011 (r218762) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Feb 17 05:52:53 2011 (r218763) @@ -87,6 +87,8 @@ struct ath_hal_5416 { uint32_t ah_rx_chainmask; uint32_t ah_tx_chainmask; + HAL_ANI_CMD ah_ani_function; + struct ar5416PerCal ah_cal; /* periodic calibration state */ struct ar5416NfLimits nf_2g; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Thu Feb 17 05:30:38 2011 (r218762) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Thu Feb 17 05:52:53 2011 (r218763) @@ -177,7 +177,7 @@ ar5416AniControl(struct ath_hal *ah, HAL OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); - switch (cmd) { + switch (cmd & AH5416(ah)->ah_ani_function) { case HAL_ANI_NOISE_IMMUNITY_LEVEL: { u_int level = param; @@ -354,13 +354,15 @@ ar5416AniOfdmErrTrigger(struct ath_hal * aniState = ahp->ah_curani; params = aniState->params; /* First, raise noise immunity level, up to max */ - if (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel) { + if ((AH5416(ah)->ah_ani_function & HAL_ANI_NOISE_IMMUNITY_LEVEL) && + (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) { ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel + 1); return; } /* then, raise spur immunity level, up to max */ - if (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel) { + if ((AH5416(ah)->ah_ani_function & HAL_ANI_SPUR_IMMUNITY_LEVEL) && + (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel)) { ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL, aniState->spurImmunityLevel + 1); return; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Feb 17 05:30:38 2011 (r218762) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Feb 17 05:52:53 2011 (r218763) @@ -168,6 +168,9 @@ ar5416InitState(struct ath_hal_5416 *ahp */ AH5416(ah)->ah_rx_chainmask = AR5416_DEFAULT_RXCHAINMASK; AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK; + + /* Enable all ANI functions to begin with */ + AH5416(ah)->ah_ani_function = HAL_ANI_ALL; } uint32_t