]> err.no Git - linux-2.6/commitdiff
b43: Add debugfs firmware debugging knob
authorMichael Buesch <mb@bu3sch.de>
Fri, 20 Jun 2008 16:02:08 +0000 (18:02 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Jun 2008 13:09:16 +0000 (09:09 -0400)
This adds a firmware debugging knob to debugfs.
With this knob it's possible to enable advanced runtime firmware
checks.
For now it only implements one sanity check for the mac-suspend.
In future there'll probably be more.
If CONFIG_B43_DEBUG is disabled, these checks will collapse to nothing.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/debugfs.c
drivers/net/wireless/b43/debugfs.h
drivers/net/wireless/b43/main.c

index 24854c3e89cd2015fcbbd896a5c7b2d59b7af8e9..29851bc1101ff7a849e35362b4a0804738d15db8 100644 (file)
@@ -801,6 +801,7 @@ static void b43_add_dynamic_debug(struct b43_wldev *dev)
        add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0);
        add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0);
        add_dyn_dbg("debug_lo", B43_DBG_LO, 0);
+       add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0);
 
 #undef add_dyn_dbg
 }
index 132c81f2f98df49335e010927fd89f85d5808638..22ffd02ba554806a8625319b5c2fd2aeae1cdcba 100644 (file)
@@ -11,6 +11,7 @@ enum b43_dyndbg {             /* Dynamic debugging features */
        B43_DBG_PWORK_FAST,
        B43_DBG_PWORK_STOP,
        B43_DBG_LO,
+       B43_DBG_FIRMWARE,
        __B43_NR_DYNDBG,
 };
 
index c14d522d69e3a5976284d1ba7714a5964b7a5a6a..82cca19137f4b52d4c9cf54e34366dce0db215f3 100644 (file)
@@ -2487,6 +2487,19 @@ static void b43_gpio_cleanup(struct b43_wldev *dev)
 /* http://bcm-specs.sipsolutions.net/EnableMac */
 void b43_mac_enable(struct b43_wldev *dev)
 {
+       if (b43_debug(dev, B43_DBG_FIRMWARE)) {
+               u16 fwstate;
+
+               fwstate = b43_shm_read16(dev, B43_SHM_SHARED,
+                                        B43_SHM_SH_UCODESTAT);
+               if ((fwstate != B43_SHM_SH_UCODESTAT_SUSP) &&
+                   (fwstate != B43_SHM_SH_UCODESTAT_SLEEP)) {
+                       b43err(dev->wl, "b43_mac_enable(): The firmware "
+                              "should be suspended, but current state is %u\n",
+                              fwstate);
+               }
+       }
+
        dev->mac_suspended--;
        B43_WARN_ON(dev->mac_suspended < 0);
        if (dev->mac_suspended == 0) {