diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-11 22:47:22 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-12 01:17:17 -0400 |
commit | 295b54c4902c52cd00d7c837d50a86e39e26caec (patch) | |
tree | 53eda6f30c1e0f655da536e6217f6957ae0d2357 /drivers/net/sky2.c | |
parent | e86908614f2c7fec401827e5cefd7a6ea9407f85 (diff) |
[SKY2]: ethtool register reserved area blackout
Make sure and not dump reserved areas of device space.
Touching some of these causes machine check exceptions on boards
like D-Link DGE-550SX.
Coding note, used a complex switch statement rather than bitmap
because it is easier to relate the block values to the documentation
rather than looking at a encoded bitmask.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 0a3203465415..4832f6403721 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3569,20 +3569,64 @@ static void sky2_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
3569 | { | 3569 | { |
3570 | const struct sky2_port *sky2 = netdev_priv(dev); | 3570 | const struct sky2_port *sky2 = netdev_priv(dev); |
3571 | const void __iomem *io = sky2->hw->regs; | 3571 | const void __iomem *io = sky2->hw->regs; |
3572 | unsigned int b; | ||
3572 | 3573 | ||
3573 | regs->version = 1; | 3574 | regs->version = 1; |
3574 | memset(p, 0, regs->len); | ||
3575 | 3575 | ||
3576 | memcpy_fromio(p, io, B3_RAM_ADDR); | 3576 | for (b = 0; b < 128; b++) { |
3577 | 3577 | /* This complicated switch statement is to make sure and | |
3578 | /* skip diagnostic ram region */ | 3578 | * only access regions that are unreserved. |
3579 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, 0x2000 - B3_RI_WTO_R1); | 3579 | * Some blocks are only valid on dual port cards. |
3580 | * and block 3 has some special diagnostic registers that | ||
3581 | * are poison. | ||
3582 | */ | ||
3583 | switch (b) { | ||
3584 | case 3: | ||
3585 | /* skip diagnostic ram region */ | ||
3586 | memcpy_fromio(p + 0x10, io + 0x10, 128 - 0x10); | ||
3587 | break; | ||
3580 | 3588 | ||
3581 | /* copy GMAC registers */ | 3589 | /* dual port cards only */ |
3582 | memcpy_fromio(p + BASE_GMAC_1, io + BASE_GMAC_1, 0x1000); | 3590 | case 5: /* Tx Arbiter 2 */ |
3583 | if (sky2->hw->ports > 1) | 3591 | case 9: /* RX2 */ |
3584 | memcpy_fromio(p + BASE_GMAC_2, io + BASE_GMAC_2, 0x1000); | 3592 | case 14 ... 15: /* TX2 */ |
3593 | case 17: case 19: /* Ram Buffer 2 */ | ||
3594 | case 22 ... 23: /* Tx Ram Buffer 2 */ | ||
3595 | case 25: /* Rx MAC Fifo 1 */ | ||
3596 | case 27: /* Tx MAC Fifo 2 */ | ||
3597 | case 31: /* GPHY 2 */ | ||
3598 | case 40 ... 47: /* Pattern Ram 2 */ | ||
3599 | case 52: case 54: /* TCP Segmentation 2 */ | ||
3600 | case 112 ... 116: /* GMAC 2 */ | ||
3601 | if (sky2->hw->ports == 1) | ||
3602 | goto reserved; | ||
3603 | /* fall through */ | ||
3604 | case 0: /* Control */ | ||
3605 | case 2: /* Mac address */ | ||
3606 | case 4: /* Tx Arbiter 1 */ | ||
3607 | case 7: /* PCI express reg */ | ||
3608 | case 8: /* RX1 */ | ||
3609 | case 12 ... 13: /* TX1 */ | ||
3610 | case 16: case 18:/* Rx Ram Buffer 1 */ | ||
3611 | case 20 ... 21: /* Tx Ram Buffer 1 */ | ||
3612 | case 24: /* Rx MAC Fifo 1 */ | ||
3613 | case 26: /* Tx MAC Fifo 1 */ | ||
3614 | case 28 ... 29: /* Descriptor and status unit */ | ||
3615 | case 30: /* GPHY 1*/ | ||
3616 | case 32 ... 39: /* Pattern Ram 1 */ | ||
3617 | case 48: case 50: /* TCP Segmentation 1 */ | ||
3618 | case 56 ... 60: /* PCI space */ | ||
3619 | case 80 ... 84: /* GMAC 1 */ | ||
3620 | memcpy_fromio(p, io, 128); | ||
3621 | break; | ||
3622 | default: | ||
3623 | reserved: | ||
3624 | memset(p, 0, 128); | ||
3625 | } | ||
3585 | 3626 | ||
3627 | p += 128; | ||
3628 | io += 128; | ||
3629 | } | ||
3586 | } | 3630 | } |
3587 | 3631 | ||
3588 | /* In order to do Jumbo packets on these chips, need to turn off the | 3632 | /* In order to do Jumbo packets on these chips, need to turn off the |