Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2014 06:03:36 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
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
Message-ID:  <201403100603.s2A63acI077029@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403100603.s2A63acI077029>