From owner-svn-src-all@FreeBSD.ORG Mon Mar 10 06:03:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 390C3418; Mon, 10 Mar 2014 06:03:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 22AAD8B4; Mon, 10 Mar 2014 06:03:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2A63bEu077039; Mon, 10 Mar 2014 06:03:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2A63acI077029; Mon, 10 Mar 2014 06:03:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201403100603.s2A63acI077029@svn.freebsd.org> From: Adrian Chadd Date: Mon, 10 Mar 2014 06:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262969 - in head/sys/dev/ath/ath_hal: . ar5210 ar5211 ar5212 ar5312 ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Mon, 10 Mar 2014 06:03:38 -0000 Author: adrian Date: Mon Mar 10 06:03:35 2014 New Revision: 262969 URL: http://svnweb.freebsd.org/changeset/base/262969 Log: Migrate the chip power mode status to public ath_hal, rather than the private per-chip HAL. This allows the ah_osdep.[ch] code to check whether the power state is valid for doing chip programming. It should be a no-op for normal driver work but it does require a clean kernel/module rebuild, as the size of HAL structures have changed. Now, this doesn't track whether the hardware is ACTUALLY awake, as NETWORK_SLEEP wakes the chip up for a short period when traffic is received. This doesn't actually set the power mode to AWAKE, so we have to be careful about how we touch things. But it's enough to start down the path of implementing station mode chipset power savings, as a large part of the silliness is making sure the chip is awake during periodic calibration / ANI and random places where transmit may be occuring. I'd rather not a repeat of debugging power save on ath9k, where races with calibration and transmit path stuff took a couple years to shake out. Tested: * AR5416, STA mode 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_power.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c head/sys/dev/ath/ath_hal/ar5312/ar5312_power.c head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ah.h Mon Mar 10 06:03:35 2014 (r262969) @@ -1297,6 +1297,9 @@ struct ath_hal { uint32_t ah_intrstate[8]; /* last int state */ uint32_t ah_syncstate; /* last sync intr state */ + /* Current powerstate from HAL calls */ + HAL_POWER_MODE ah_powerMode; + HAL_OPS_CONFIG ah_config; const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *, u_int mode); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Mon Mar 10 06:03:35 2014 (r262969) @@ -108,7 +108,6 @@ struct ath_hal_5210 { uint32_t ah_txDescInterruptMask; uint32_t ah_txEolInterruptMask; uint32_t ah_txUrnInterruptMask; - HAL_POWER_MODE ah_powerMode; uint8_t ah_bssid[IEEE80211_ADDR_LEN]; HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES]; /* beacon+cab+data */ /* Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Mar 10 06:03:35 2014 (r262969) @@ -219,7 +219,7 @@ ar5210Attach(uint16_t devid, HAL_SOFTC s AH_PRIVATE(ah)->ah_powerLimit = AR5210_MAX_RATE_POWER; AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */ - ahp->ah_powerMode = HAL_PM_UNDEFINED; + ah->ah_powerMode = HAL_PM_UNDEFINED; ahp->ah_staId1Defaults = 0; ahp->ah_rssiThr = INIT_RSSI_THR; ahp->ah_sifstime = (u_int) -1; Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c Mon Mar 10 06:03:35 2014 (r262969) @@ -93,7 +93,6 @@ ar5210SetPowerModeSleep(struct ath_hal * HAL_BOOL ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) { - struct ath_hal_5210 *ahp = AH5210(ah); #ifdef AH_DEBUG static const char* modes[] = { "AWAKE", @@ -105,7 +104,7 @@ ar5210SetPowerMode(struct ath_hal *ah, H int status = AH_TRUE; HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, - modes[ahp->ah_powerMode], modes[mode], + modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : ""); switch (mode) { case HAL_PM_AWAKE: @@ -122,7 +121,7 @@ ar5210SetPowerMode(struct ath_hal *ah, H __func__, mode); return AH_FALSE; } - ahp->ah_powerMode = mode; + ah->ah_powerMode = mode; return status; } Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Mon Mar 10 06:03:35 2014 (r262969) @@ -119,7 +119,6 @@ struct ath_hal_5211 { uint32_t ah_txEolInterruptMask; uint32_t ah_txUrnInterruptMask; HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES]; - HAL_POWER_MODE ah_powerMode; HAL_ANT_SETTING ah_diversityControl; /* antenna setting */ uint32_t ah_calibrationTime; HAL_BOOL ah_bIQCalibration; Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c Mon Mar 10 06:03:35 2014 (r262969) @@ -95,7 +95,6 @@ ar5211SetPowerModeNetworkSleep(struct at HAL_BOOL ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) { - struct ath_hal_5211 *ahp = AH5211(ah); #ifdef AH_DEBUG static const char* modes[] = { "AWAKE", @@ -107,7 +106,7 @@ ar5211SetPowerMode(struct ath_hal *ah, H int status = AH_TRUE; HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, - modes[ahp->ah_powerMode], modes[mode], + modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : ""); switch (mode) { case HAL_PM_AWAKE: @@ -124,7 +123,7 @@ ar5211SetPowerMode(struct ath_hal *ah, H __func__, mode); return AH_FALSE; } - ahp->ah_powerMode = mode; + ah->ah_powerMode = mode; return status; } Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Mon Mar 10 06:03:35 2014 (r262969) @@ -270,7 +270,6 @@ struct ath_hal_5212 { uint32_t ah_intrTxqs; /* tx q interrupt state */ /* decomp mask array */ uint8_t ah_decompMask[HAL_DECOMP_MASK_SIZE]; - HAL_POWER_MODE ah_powerMode; HAL_ANT_SETTING ah_antControl; /* antenna setting */ HAL_BOOL ah_diversity; /* fast diversity setting */ enum { Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c Mon Mar 10 06:03:35 2014 (r262969) @@ -119,7 +119,6 @@ ar5212SetPowerModeNetworkSleep(struct at HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) { - struct ath_hal_5212 *ahp = AH5212(ah); #ifdef AH_DEBUG static const char* modes[] = { "AWAKE", @@ -131,7 +130,7 @@ ar5212SetPowerMode(struct ath_hal *ah, H int status = AH_TRUE; HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, - modes[ahp->ah_powerMode], modes[mode], + modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : ""); switch (mode) { case HAL_PM_AWAKE: @@ -148,7 +147,7 @@ ar5212SetPowerMode(struct ath_hal *ah, H __func__, mode); return AH_FALSE; } - ahp->ah_powerMode = mode; + ah->ah_powerMode = mode; return status; } Modified: head/sys/dev/ath/ath_hal/ar5312/ar5312_power.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5312/ar5312_power.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5312/ar5312_power.c Mon Mar 10 06:03:35 2014 (r262969) @@ -71,7 +71,6 @@ ar5312SetPowerModeNetworkSleep(struct at HAL_BOOL ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) { - struct ath_hal_5212 *ahp = AH5212(ah); #ifdef AH_DEBUG static const char* modes[] = { "AWAKE", @@ -83,7 +82,7 @@ ar5312SetPowerMode(struct ath_hal *ah, H int status = AH_TRUE; HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, - modes[ahp->ah_powerMode], modes[mode], + modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : ""); switch (mode) { case HAL_PM_AWAKE: @@ -100,7 +99,7 @@ ar5312SetPowerMode(struct ath_hal *ah, H __func__, mode); return AH_FALSE; } - ahp->ah_powerMode = mode; + ah->ah_powerMode = mode; return status; } Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c Mon Mar 10 02:38:41 2014 (r262968) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c Mon Mar 10 06:03:35 2014 (r262969) @@ -124,7 +124,6 @@ ar5416SetPowerModeNetworkSleep(struct at HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip) { - struct ath_hal_5212 *ahp = AH5212(ah); #ifdef AH_DEBUG static const char* modes[] = { "AWAKE", @@ -138,7 +137,7 @@ ar5416SetPowerMode(struct ath_hal *ah, H return AH_TRUE; HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__, - modes[ahp->ah_powerMode], modes[mode], setChip ? "set chip " : ""); + modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : ""); switch (mode) { case HAL_PM_AWAKE: status = ar5416SetPowerModeAwake(ah, setChip); @@ -154,7 +153,7 @@ ar5416SetPowerMode(struct ath_hal *ah, H __func__, mode); return AH_FALSE; } - ahp->ah_powerMode = mode; + ah->ah_powerMode = mode; return status; }