diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-03-25 13:04:46 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-25 23:42:07 -0400 |
commit | 5ea79631c0c47d28831a0635e8af9da539d449cd (patch) | |
tree | 3d653580fd3a52c600c0f7b02c45236b76a5ce24 | |
parent | 6ef2977d414cc196baba0fb53509c5f8cd9154b4 (diff) |
b44: Truncate PHY address
Some ROMs on embedded devices store incorrect values for
the PHY address of the ethernet device.
It looks like the number is sign-extended.
Truncate the value by applying the PHY-address mask to it.
The patch was tested on a bcm47xx embedded system (where the bug
triggers) and a bcm4400 PCI card.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/b44.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index ea2a2b548e3c..25f1337cd02c 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -2082,6 +2082,11 @@ static int __devinit b44_get_invariants(struct b44 *bp) | |||
2082 | addr = sdev->bus->sprom.et0mac; | 2082 | addr = sdev->bus->sprom.et0mac; |
2083 | bp->phy_addr = sdev->bus->sprom.et0phyaddr; | 2083 | bp->phy_addr = sdev->bus->sprom.et0phyaddr; |
2084 | } | 2084 | } |
2085 | /* Some ROMs have buggy PHY addresses with the high | ||
2086 | * bits set (sign extension?). Truncate them to a | ||
2087 | * valid PHY address. */ | ||
2088 | bp->phy_addr &= 0x1F; | ||
2089 | |||
2085 | memcpy(bp->dev->dev_addr, addr, 6); | 2090 | memcpy(bp->dev->dev_addr, addr, 6); |
2086 | 2091 | ||
2087 | if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ | 2092 | if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ |