From owner-svn-src-all@FreeBSD.ORG Tue May 1 14:48:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DF8C106566C; Tue, 1 May 2012 14:48:52 +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 76AB88FC15; Tue, 1 May 2012 14:48:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q41EmqVZ029839; Tue, 1 May 2012 14:48:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q41Emp5t029823; Tue, 1 May 2012 14:48:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201205011448.q41Emp5t029823@svn.freebsd.org> From: Adrian Chadd Date: Tue, 1 May 2012 14:48:51 +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: r234873 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 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: Tue, 01 May 2012 14:48:52 -0000 Author: adrian Date: Tue May 1 14:48:51 2012 New Revision: 234873 URL: http://svn.freebsd.org/changeset/base/234873 Log: Change the MIB cycle count API to return HAL_BOOL, rather than uint32_t, to return whether it was successful. Add placeholder (blank) methods for previous chips, for both it and the 11n extension channel busy call. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c 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 head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ah.h Tue May 1 14:48:51 2012 (r234873) @@ -1034,8 +1034,8 @@ struct ath_hal { struct ath_desc *); void __ahdecl(*ah_set11nBurstDuration)(struct ath_hal *, struct ath_desc *, u_int); - uint32_t __ahdecl(*ah_get_mib_cycle_counts_pct) (struct ath_hal *, - uint32_t *, uint32_t *, uint32_t *, uint32_t *); + HAL_BOOL __ahdecl(*ah_getMibCycleCounts) (struct ath_hal *, + HAL_SURVEY_SAMPLE *); uint32_t __ahdecl(*ah_get11nExtBusy)(struct ath_hal *); void __ahdecl(*ah_set11nMac2040)(struct ath_hal *, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Tue May 1 14:48:51 2012 (r234873) @@ -249,6 +249,9 @@ extern HAL_BOOL ar5210SetCapability(stru extern HAL_BOOL ar5210GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); +extern uint32_t ar5210Get11nExtBusy(struct ath_hal *); +extern HAL_BOOL ar5210GetMibCycleCounts(struct ath_hal *, + HAL_SURVEY_SAMPLE *); extern u_int ar5210GetKeyCacheSize(struct ath_hal *); extern HAL_BOOL ar5210IsKeyCacheEntryValid(struct ath_hal *, uint16_t); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Tue May 1 14:48:51 2012 (r234873) @@ -129,8 +129,10 @@ static const struct ath_hal_private ar52 .ah_getAckCTSRate = ar5210GetAckCTSRate, .ah_setCTSTimeout = ar5210SetCTSTimeout, .ah_getCTSTimeout = ar5210GetCTSTimeout, - .ah_setDecompMask = ar5210SetDecompMask, - .ah_setCoverageClass = ar5210SetCoverageClass, + .ah_setDecompMask = ar5210SetDecompMask, + .ah_setCoverageClass = ar5210SetCoverageClass, + .ah_get11nExtBusy = ar5210Get11nExtBusy, + .ah_getMibCycleCounts = ar5210GetMibCycleCounts, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5210GetKeyCacheSize, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Tue May 1 14:48:51 2012 (r234873) @@ -646,3 +646,24 @@ ar5210GetDiagState(struct ath_hal *ah, i return ath_hal_getdiagstate(ah, request, args, argsize, result, resultsize); } + +/* + * Return what percentage of the extension channel is busy. + * This is always disabled for AR5210 series NICs. + */ +uint32_t +ar5210Get11nExtBusy(struct ath_hal *ah) +{ + + return (0); +} + +/* + * There's no channel survey support for the AR5210. + */ +HAL_BOOL +ar5210GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample) +{ + + return (AH_FALSE); +} Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Tue May 1 14:48:51 2012 (r234873) @@ -276,6 +276,9 @@ extern HAL_BOOL ar5211SetCapability(stru extern HAL_BOOL ar5211GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); +extern uint32_t ar5211Get11nExtBusy(struct ath_hal *); +extern HAL_BOOL ar5211GetMibCycleCounts(struct ath_hal *, + HAL_SURVEY_SAMPLE *); extern u_int ar5211GetKeyCacheSize(struct ath_hal *); extern HAL_BOOL ar5211IsKeyCacheEntryValid(struct ath_hal *, uint16_t); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Tue May 1 14:48:51 2012 (r234873) @@ -129,8 +129,10 @@ static const struct ath_hal_private ar52 .ah_getAckCTSRate = ar5211GetAckCTSRate, .ah_setCTSTimeout = ar5211SetCTSTimeout, .ah_getCTSTimeout = ar5211GetCTSTimeout, - .ah_setDecompMask = ar5211SetDecompMask, - .ah_setCoverageClass = ar5211SetCoverageClass, + .ah_setDecompMask = ar5211SetDecompMask, + .ah_setCoverageClass = ar5211SetCoverageClass, + .ah_get11nExtBusy = ar5211Get11nExtBusy, + .ah_getMibCycleCounts = ar5211GetMibCycleCounts, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5211GetKeyCacheSize, Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c Tue May 1 14:48:51 2012 (r234873) @@ -688,3 +688,24 @@ ar5211GetDiagState(struct ath_hal *ah, i } return AH_FALSE; } + +/* + * Return what percentage of the extension channel is busy. + * This is always disabled for AR5211 series NICs. + */ +uint32_t +ar5211Get11nExtBusy(struct ath_hal *ah) +{ + return (0); +} + + +/* + * There's no channel survey support for the AR5211. + */ +HAL_BOOL +ar5211GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample) +{ + + return (AH_FALSE); +} Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Tue May 1 14:48:51 2012 (r234873) @@ -511,6 +511,8 @@ extern HAL_BOOL ar5212GetDiagState(struc void **result, uint32_t *resultsize); extern HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period, uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); +extern HAL_BOOL ar5212GetMibCycleCounts(struct ath_hal *, + HAL_SURVEY_SAMPLE *); extern HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Tue May 1 14:48:51 2012 (r234873) @@ -125,9 +125,10 @@ static const struct ath_hal_private ar52 .ah_getAckCTSRate = ar5212GetAckCTSRate, .ah_setCTSTimeout = ar5212SetCTSTimeout, .ah_getCTSTimeout = ar5212GetCTSTimeout, - .ah_setDecompMask = ar5212SetDecompMask, - .ah_setCoverageClass = ar5212SetCoverageClass, + .ah_setDecompMask = ar5212SetDecompMask, + .ah_setCoverageClass = ar5212SetCoverageClass, .ah_setQuiet = ar5212SetQuiet, + .ah_getMibCycleCounts = ar5212GetMibCycleCounts, /* DFS Functions */ .ah_enableDfs = ar5212EnableDfs, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue May 1 14:48:51 2012 (r234873) @@ -1248,3 +1248,13 @@ ar5212Get11nExtBusy(struct ath_hal *ah) { return 0; } + +/* + * There's no channel survey support for the AR5211. + */ +HAL_BOOL +ar5212GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample) +{ + + return (AH_FALSE); +} Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue May 1 14:48:51 2012 (r234873) @@ -196,8 +196,8 @@ extern uint32_t ar5416GetCurRssi(struct extern HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING); extern HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int); extern void ar5416SetCoverageClass(struct ath_hal *, uint8_t, int); -extern uint32_t ar5416GetMibCycleCounts(struct ath_hal *ah, - HAL_SURVEY_SAMPLE *hsample); +extern HAL_BOOL ar5416GetMibCycleCounts(struct ath_hal *ah, + HAL_SURVEY_SAMPLE *hsample); extern uint32_t ar5416Get11nExtBusy(struct ath_hal *ah); extern void ar5416Set11nMac2040(struct ath_hal *ah, HAL_HT_MACMODE mode); extern HAL_HT_RXCLEAR ar5416Get11nRxClear(struct ath_hal *ah); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Tue May 1 14:48:51 2012 (r234873) @@ -847,7 +847,7 @@ ar5416AniGetListenTime(struct ath_hal *a if (ANI_ENA(ah)) aniState = ahp->ah_curani; - if (good == 0) { + if (good == AH_FALSE) { /* * Cycle counter wrap (or initial call); it's not possible * to accurately calculate a value because the registers Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue May 1 14:48:51 2012 (r234873) @@ -145,6 +145,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_setDecompMask = ar5416SetDecompMask; ah->ah_setCoverageClass = ar5416SetCoverageClass; ah->ah_setQuiet = ar5416SetQuiet; + ah->ah_getMibCycleCounts = ar5416GetMibCycleCounts; ah->ah_resetKeyCacheEntry = ar5416ResetKeyCacheEntry; ah->ah_setKeyCacheEntry = ar5416SetKeyCacheEntry; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue May 1 14:48:51 2012 (r234873) @@ -184,11 +184,11 @@ ar5416SetCoverageClass(struct ath_hal *a /* * Return the busy for rx_frame, rx_clear, and tx_frame */ -uint32_t +HAL_BOOL ar5416GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample) { struct ath_hal_5416 *ahp = AH5416(ah); - u_int32_t good = 1; + u_int32_t good = AH_TRUE; /* XXX freeze/unfreeze mib counters */ uint32_t rc = OS_REG_READ(ah, AR_RCCNT); @@ -205,7 +205,7 @@ ar5416GetMibCycleCounts(struct ath_hal * */ HALDEBUG(ah, HAL_DEBUG_ANY, "%s: cycle counter wrap. ExtBusy = 0\n", __func__); - good = 0; + good = AH_FALSE; } else { hsample->cycle_count = cc - ahp->ah_cycleCount; hsample->chan_busy = rc - ahp->ah_ctlBusy; @@ -224,7 +224,7 @@ ar5416GetMibCycleCounts(struct ath_hal * ahp->ah_txBusy = tf; ahp->ah_extBusy = ec; - return good; + return (good); } /* Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/if_athvar.h Tue May 1 14:48:51 2012 (r234873) @@ -1011,6 +1011,8 @@ void ath_intr(void *); ((*(_ah)->ah_isFastClockEnabled)((_ah))) #define ath_hal_radar_wait(_ah, _chan) \ ((*(_ah)->ah_radarWait)((_ah), (_chan))) +#define ath_hal_get_mib_cycle_counts(_ah, _sample) \ + ((*(_ah)->ah_getMibCycleCounts)((_ah), (_sample))) #define ath_hal_get_chan_ext_busy(_ah) \ ((*(_ah)->ah_get11nExtBusy)((_ah)))