svn commit: r264292 - head/sys/dev/ath

Adrian Chadd adrian at FreeBSD.org
Wed Apr 9 03:51:06 UTC 2014


Author: adrian
Date: Wed Apr  9 03:51:05 2014
New Revision: 264292
URL: http://svnweb.freebsd.org/changeset/base/264292

Log:
  Add a function to check whether the given register can be accessed whilst
  the chip is asleep.
  
  It's AR5416 and later specific; I'll add a HAL method to generalise it
  later.
  
  Tested:
  
  * AR5416, STA mode

Modified:
  head/sys/dev/ath/ah_osdep.c

Modified: head/sys/dev/ath/ah_osdep.c
==============================================================================
--- head/sys/dev/ath/ah_osdep.c	Wed Apr  9 03:46:04 2014	(r264291)
+++ head/sys/dev/ath/ah_osdep.c	Wed Apr  9 03:51:05 2014	(r264292)
@@ -138,6 +138,24 @@ ath_hal_ether_sprintf(const u_int8_t *ma
 
 #ifdef AH_DEBUG
 
+/*
+ * XXX This is highly relevant only for the AR5416 and later
+ * PCI/PCIe NICs.  It'll need adjustment for other hardware
+ * variations.
+ */
+static int
+ath_hal_reg_whilst_asleep(struct ath_hal *ah, uint32_t reg)
+{
+
+	if (reg >= 0x4000 && reg < 0x5000)
+		return (1);
+	if (reg >= 0x6000 && reg < 0x7000)
+		return (1);
+	if (reg >= 0x7000 && reg < 0x8000)
+		return (1);
+	return (0);
+}
+
 void
 DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
 {
@@ -254,7 +272,8 @@ ath_hal_reg_write(struct ath_hal *ah, u_
 	bus_space_handle_t h = ah->ah_sh;
 
 	/* Debug - complain if we haven't fully waken things up */
-	if (ah->ah_powerMode != HAL_PM_AWAKE) {
+	if (! ath_hal_reg_whilst_asleep(ah, reg) &&
+	    ah->ah_powerMode != HAL_PM_AWAKE) {
 		ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
 		    __func__, reg, val, ah->ah_powerMode);
 	}
@@ -285,7 +304,8 @@ ath_hal_reg_read(struct ath_hal *ah, u_i
 	u_int32_t val;
 
 	/* Debug - complain if we haven't fully waken things up */
-	if (ah->ah_powerMode != HAL_PM_AWAKE) {
+	if (! ath_hal_reg_whilst_asleep(ah, reg) &&
+	    ah->ah_powerMode != HAL_PM_AWAKE) {
 		ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
 		    __func__, reg, ah->ah_powerMode);
 	}
@@ -343,7 +363,8 @@ ath_hal_reg_write(struct ath_hal *ah, u_
 	bus_space_handle_t h = ah->ah_sh;
 
 	/* Debug - complain if we haven't fully waken things up */
-	if (ah->ah_powerMode != HAL_PM_AWAKE) {
+	if (! ath_hal_reg_whilst_asleep(ah, reg) &&
+	    ah->ah_powerMode != HAL_PM_AWAKE) {
 		ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
 		    __func__, reg, val, ah->ah_powerMode);
 	}
@@ -363,7 +384,8 @@ ath_hal_reg_read(struct ath_hal *ah, u_i
 	u_int32_t val;
 
 	/* Debug - complain if we haven't fully waken things up */
-	if (ah->ah_powerMode != HAL_PM_AWAKE) {
+	if (! ath_hal_reg_whilst_asleep(ah, reg) &&
+	    ah->ah_powerMode != HAL_PM_AWAKE) {
 		ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
 		    __func__, reg, ah->ah_powerMode);
 	}


More information about the svn-src-head mailing list