* [RFC] b43: Fix regression from Bug #14538
@ 2009-11-23 19:55 Larry Finger
2009-11-23 20:01 ` Michael Buesch
2009-11-23 22:33 ` John W. Linville
0 siblings, 2 replies; 3+ messages in thread
From: Larry Finger @ 2009-11-23 19:55 UTC (permalink / raw)
To: John W Linville, Michael Buesch
Cc: casteyde.christian, bcm43xx-dev, linux-wireless
The routine b43_is_hw_radio_enabled() has long been a problem.
For PPC architecture with PHY Revision < 3, a read of the register
B43_MMIO_HWENABLED_LO will cause a CPU fault unless b43_status()
returns a value of 2 (B43_STAT_STARTED) (BUG 14181). Fixing that
results in Bug 14538 in which the driver is unable to reassociate
after resuming from hibernation because b43_status() returns 0.
The correct fix would be to determine why the status is 0; however,
I have not yet found why that happens. The correct value is found for
my device, which has PHY revision >= 3.
Returning TRUE when the PHY revision < 3 and b43_status() returns 0 fixes
the regression for 2.6.32.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Christian Casteyde <casteyde.christian@free.fr>
---
Index: wireless-testing/drivers/net/wireless/b43/rfkill.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43/rfkill.c
+++ wireless-testing/drivers/net/wireless/b43/rfkill.c
@@ -33,9 +33,16 @@ bool b43_is_hw_radio_enabled(struct b43_
& B43_MMIO_RADIO_HWENABLED_HI_MASK))
return 1;
} else {
- if (b43_status(dev) >= B43_STAT_STARTED &&
- b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
- & B43_MMIO_RADIO_HWENABLED_LO_MASK)
+ /* To prevent CPU fault on PPC, do not read a register
+ * unless the interface is started; however, on resume
+ * for hibernation, this routine is entered early. When
+ * that happens, unconditionally return TRUE.
+ */
+ if (b43_status(dev) >= B43_STAT_STARTED) {
+ if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
+ & B43_MMIO_RADIO_HWENABLED_LO_MASK)
+ return 1;
+ } else
return 1;
}
return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] b43: Fix regression from Bug #14538
2009-11-23 19:55 [RFC] b43: Fix regression from Bug #14538 Larry Finger
@ 2009-11-23 20:01 ` Michael Buesch
2009-11-23 22:33 ` John W. Linville
1 sibling, 0 replies; 3+ messages in thread
From: Michael Buesch @ 2009-11-23 20:01 UTC (permalink / raw)
To: bcm43xx-dev
Cc: Larry Finger, John W Linville, linux-wireless, casteyde.christian
On Monday 23 November 2009 20:55:06 Larry Finger wrote:
> The routine b43_is_hw_radio_enabled() has long been a problem.
> For PPC architecture with PHY Revision < 3, a read of the register
> B43_MMIO_HWENABLED_LO will cause a CPU fault unless b43_status()
> returns a value of 2 (B43_STAT_STARTED) (BUG 14181). Fixing that
> results in Bug 14538 in which the driver is unable to reassociate
> after resuming from hibernation because b43_status() returns 0.
>
> The correct fix would be to determine why the status is 0; however,
> I have not yet found why that happens. The correct value is found for
> my device, which has PHY revision >= 3.
>
> Returning TRUE when the PHY revision < 3 and b43_status() returns 0 fixes
> the regression for 2.6.32.
>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Tested-by: Christian Casteyde <casteyde.christian@free.fr>
> ---
>
> Index: wireless-testing/drivers/net/wireless/b43/rfkill.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/b43/rfkill.c
> +++ wireless-testing/drivers/net/wireless/b43/rfkill.c
> @@ -33,9 +33,16 @@ bool b43_is_hw_radio_enabled(struct b43_
> & B43_MMIO_RADIO_HWENABLED_HI_MASK))
> return 1;
> } else {
> - if (b43_status(dev) >= B43_STAT_STARTED &&
> - b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
> - & B43_MMIO_RADIO_HWENABLED_LO_MASK)
> + /* To prevent CPU fault on PPC, do not read a register
> + * unless the interface is started; however, on resume
> + * for hibernation, this routine is entered early. When
> + * that happens, unconditionally return TRUE.
> + */
> + if (b43_status(dev) >= B43_STAT_STARTED) {
> + if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
> + & B43_MMIO_RADIO_HWENABLED_LO_MASK)
> + return 1;
> + } else
> return 1;
> }
> return 0;
looks OK as quick workaround.
--
Greetings, Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] b43: Fix regression from Bug #14538
2009-11-23 19:55 [RFC] b43: Fix regression from Bug #14538 Larry Finger
2009-11-23 20:01 ` Michael Buesch
@ 2009-11-23 22:33 ` John W. Linville
1 sibling, 0 replies; 3+ messages in thread
From: John W. Linville @ 2009-11-23 22:33 UTC (permalink / raw)
To: Larry Finger
Cc: Michael Buesch, casteyde.christian, bcm43xx-dev, linux-wireless
On Mon, Nov 23, 2009 at 01:55:06PM -0600, Larry Finger wrote:
> The routine b43_is_hw_radio_enabled() has long been a problem.
> For PPC architecture with PHY Revision < 3, a read of the register
> B43_MMIO_HWENABLED_LO will cause a CPU fault unless b43_status()
> returns a value of 2 (B43_STAT_STARTED) (BUG 14181). Fixing that
> results in Bug 14538 in which the driver is unable to reassociate
> after resuming from hibernation because b43_status() returns 0.
>
> The correct fix would be to determine why the status is 0; however,
> I have not yet found why that happens. The correct value is found for
> my device, which has PHY revision >= 3.
>
> Returning TRUE when the PHY revision < 3 and b43_status() returns 0 fixes
> the regression for 2.6.32.
>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Tested-by: Christian Casteyde <casteyde.christian@free.fr>
> ---
>
> Index: wireless-testing/drivers/net/wireless/b43/rfkill.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/b43/rfkill.c
> +++ wireless-testing/drivers/net/wireless/b43/rfkill.c
> @@ -33,9 +33,16 @@ bool b43_is_hw_radio_enabled(struct b43_
> & B43_MMIO_RADIO_HWENABLED_HI_MASK))
> return 1;
> } else {
> - if (b43_status(dev) >= B43_STAT_STARTED &&
> - b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
> - & B43_MMIO_RADIO_HWENABLED_LO_MASK)
> + /* To prevent CPU fault on PPC, do not read a register
> + * unless the interface is started; however, on resume
> + * for hibernation, this routine is entered early. When
> + * that happens, unconditionally return TRUE.
> + */
> + if (b43_status(dev) >= B43_STAT_STARTED) {
> + if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
> + & B43_MMIO_RADIO_HWENABLED_LO_MASK)
> + return 1;
> + } else
> return 1;
> }
> return 0;
Maybe just me, but I think this version is easier to read (and especially to see the difference):
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index ffdce6f..ddc3c93 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -33,8 +33,14 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
& B43_MMIO_RADIO_HWENABLED_HI_MASK))
return 1;
} else {
- if (b43_status(dev) >= B43_STAT_STARTED &&
- b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
+ /* To prevent CPU fault on PPC, do not read a register
+ * unless the interface is started; however, on resume
+ * for hibernation, this routine is entered early. When
+ * that happens, unconditionally return TRUE.
+ */
+ if (b43_status(dev) < B43_STAT_STARTED)
+ return 1;
+ if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
& B43_MMIO_RADIO_HWENABLED_LO_MASK)
return 1;
}
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-23 22:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-23 19:55 [RFC] b43: Fix regression from Bug #14538 Larry Finger
2009-11-23 20:01 ` Michael Buesch
2009-11-23 22:33 ` John W. Linville
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).