summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-03-20 05:10:17 +0000
committeradrian <adrian@FreeBSD.org>2014-03-20 05:10:17 +0000
commit41d35ab20283515e91ccb55bd26b9cea24f75f8e (patch)
tree903d12817a06261ec943a7eb3e88f56cb9410c8b
parent91585205976a530182e788c76eb47eb581659281 (diff)
downloadFreeBSD-src-41d35ab20283515e91ccb55bd26b9cea24f75f8e.zip
FreeBSD-src-41d35ab20283515e91ccb55bd26b9cea24f75f8e.tar.gz
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
-rw-r--r--sys/dev/ath/ah_osdep.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index 043ebed..234ee42 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -253,6 +253,12 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
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_int32_t reg)
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_int32_t reg, u_int32_t val)
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_int32_t reg)
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);
OpenPOWER on IntegriCloud