1
0
Fork 0

[BNX2]: Add ethtool -d support

Add ETHTOOL_GREGS support.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Michael Chan 2006-03-20 17:48:46 -08:00 committed by David S. Miller
parent 6b39777c59
commit 244ac4f446
1 changed files with 60 additions and 0 deletions

View File

@ -4540,6 +4540,64 @@ bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
info->fw_version[5] = 0;
}
#define BNX2_REGDUMP_LEN (32 * 1024)
static int
bnx2_get_regs_len(struct net_device *dev)
{
return BNX2_REGDUMP_LEN;
}
static void
bnx2_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)
{
u32 *p = _p, i, offset;
u8 *orig_p = _p;
struct bnx2 *bp = netdev_priv(dev);
u32 reg_boundaries[] = { 0x0000, 0x0098, 0x0400, 0x045c,
0x0800, 0x0880, 0x0c00, 0x0c10,
0x0c30, 0x0d08, 0x1000, 0x101c,
0x1040, 0x1048, 0x1080, 0x10a4,
0x1400, 0x1490, 0x1498, 0x14f0,
0x1500, 0x155c, 0x1580, 0x15dc,
0x1600, 0x1658, 0x1680, 0x16d8,
0x1800, 0x1820, 0x1840, 0x1854,
0x1880, 0x1894, 0x1900, 0x1984,
0x1c00, 0x1c0c, 0x1c40, 0x1c54,
0x1c80, 0x1c94, 0x1d00, 0x1d84,
0x2000, 0x2030, 0x23c0, 0x2400,
0x2800, 0x2820, 0x2830, 0x2850,
0x2b40, 0x2c10, 0x2fc0, 0x3058,
0x3c00, 0x3c94, 0x4000, 0x4010,
0x4080, 0x4090, 0x43c0, 0x4458,
0x4c00, 0x4c18, 0x4c40, 0x4c54,
0x4fc0, 0x5010, 0x53c0, 0x5444,
0x5c00, 0x5c18, 0x5c80, 0x5c90,
0x5fc0, 0x6000, 0x6400, 0x6428,
0x6800, 0x6848, 0x684c, 0x6860,
0x6888, 0x6910, 0x8000 };
regs->version = 0;
memset(p, 0, BNX2_REGDUMP_LEN);
if (!netif_running(bp->dev))
return;
i = 0;
offset = reg_boundaries[0];
p += offset;
while (offset < BNX2_REGDUMP_LEN) {
*p++ = REG_RD(bp, offset);
offset += 4;
if (offset == reg_boundaries[i + 1]) {
offset = reg_boundaries[i + 2];
p = (u32 *) (orig_p + offset);
i += 2;
}
}
}
static void
bnx2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
@ -5106,6 +5164,8 @@ static struct ethtool_ops bnx2_ethtool_ops = {
.get_settings = bnx2_get_settings,
.set_settings = bnx2_set_settings,
.get_drvinfo = bnx2_get_drvinfo,
.get_regs_len = bnx2_get_regs_len,
.get_regs = bnx2_get_regs,
.get_wol = bnx2_get_wol,
.set_wol = bnx2_set_wol,
.nway_reset = bnx2_nway_reset,