Author: adrian
Date: Thu Mar 20 05:10:17 2014
New Revision: 263418
URL: http://svnweb.freebsd.org/changeset/base/263418

Log:
  Add some debugging code to print out if registers are touched whilst the
  device is asleep.
  
  This doesn't avoid logging errors for things that are actually OK to
  access whilst the chip is asleep (eg, the RTC registers (0x7000->0x70ff
  on the AR5416 and later.)
  
  But, this is a pretty good indicator if things are accessed incorrectly.
  
  Tested:
  
  * AR5416, STA

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

Modified: head/sys/dev/ath/ah_osdep.c
==============================================================================
--- head/sys/dev/ath/ah_osdep.c Thu Mar 20 05:08:31 2014        (r263417)
+++ head/sys/dev/ath/ah_osdep.c Thu Mar 20 05:10:17 2014        (r263418)
@@ -253,6 +253,12 @@ ath_hal_reg_write(struct ath_hal *ah, u_
        bus_space_tag_t tag = BUSTAG(ah);
        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) {
+               ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
+                   __func__, reg, val, ah->ah_powerMode);
+       }
+
        if (ath_hal_alq) {
                struct ale *ale = ath_hal_alq_get(ah);
                if (ale) {
@@ -278,6 +284,12 @@ ath_hal_reg_read(struct ath_hal *ah, u_i
        bus_space_handle_t h = ah->ah_sh;
        u_int32_t val;
 
+       /* Debug - complain if we haven't fully waken things up */
+       if (ah->ah_powerMode != HAL_PM_AWAKE) {
+               ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
+                   __func__, reg, ah->ah_powerMode);
+       }
+
        if (ah->ah_config.ah_serialise_reg_war)
                mtx_lock_spin(&ah_regser_mtx);
        val = bus_space_read_4(tag, h, reg);
@@ -330,6 +342,12 @@ ath_hal_reg_write(struct ath_hal *ah, u_
        bus_space_tag_t tag = BUSTAG(ah);
        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) {
+               ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
+                   __func__, reg, val, ah->ah_powerMode);
+       }
+
        if (ah->ah_config.ah_serialise_reg_war)
                mtx_lock_spin(&ah_regser_mtx);
        bus_space_write_4(tag, h, reg, val);
@@ -344,6 +362,12 @@ ath_hal_reg_read(struct ath_hal *ah, u_i
        bus_space_handle_t h = ah->ah_sh;
        u_int32_t val;
 
+       /* Debug - complain if we haven't fully waken things up */
+       if (ah->ah_powerMode != HAL_PM_AWAKE) {
+               ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
+                   __func__, reg, ah->ah_powerMode);
+       }
+
        if (ah->ah_config.ah_serialise_reg_war)
                mtx_lock_spin(&ah_regser_mtx);
        val = bus_space_read_4(tag, h, reg);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to