Skip to content

Commit 923fd70

Browse files
Michael Bueschlinvjw
authored andcommitted
b43: Add debugfs firmware debugging knob
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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 9b839a7 commit 923fd70

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

drivers/net/wireless/b43/debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ static void b43_add_dynamic_debug(struct b43_wldev *dev)
801801
add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0);
802802
add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0);
803803
add_dyn_dbg("debug_lo", B43_DBG_LO, 0);
804+
add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0);
804805

805806
#undef add_dyn_dbg
806807
}

drivers/net/wireless/b43/debugfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ enum b43_dyndbg { /* Dynamic debugging features */
1111
B43_DBG_PWORK_FAST,
1212
B43_DBG_PWORK_STOP,
1313
B43_DBG_LO,
14+
B43_DBG_FIRMWARE,
1415
__B43_NR_DYNDBG,
1516
};
1617

drivers/net/wireless/b43/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,19 @@ static void b43_gpio_cleanup(struct b43_wldev *dev)
24872487
/* http://bcm-specs.sipsolutions.net/EnableMac */
24882488
void b43_mac_enable(struct b43_wldev *dev)
24892489
{
2490+
if (b43_debug(dev, B43_DBG_FIRMWARE)) {
2491+
u16 fwstate;
2492+
2493+
fwstate = b43_shm_read16(dev, B43_SHM_SHARED,
2494+
B43_SHM_SH_UCODESTAT);
2495+
if ((fwstate != B43_SHM_SH_UCODESTAT_SUSP) &&
2496+
(fwstate != B43_SHM_SH_UCODESTAT_SLEEP)) {
2497+
b43err(dev->wl, "b43_mac_enable(): The firmware "
2498+
"should be suspended, but current state is %u\n",
2499+
fwstate);
2500+
}
2501+
}
2502+
24902503
dev->mac_suspended--;
24912504
B43_WARN_ON(dev->mac_suspended < 0);
24922505
if (dev->mac_suspended == 0) {

0 commit comments

Comments
 (0)