Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369354
b: refs/heads/master
c: 8564095
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Kravkov authored and David S. Miller committed Apr 22, 2013
1 parent 1c4b1ad commit 9c2fb60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 91b1c1aab2f70c30fa3efc0d42d63b2e25a6bd68
refs/heads/master: 85640952c5d76553a7ed543b355527e2b2b57b29
28 changes: 21 additions & 7 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,23 @@ static int bnx2x_nvram_read(struct bnx2x *bp, u32 offset, u8 *ret_buf,
return rc;
}

static int bnx2x_nvram_read32(struct bnx2x *bp, u32 offset, u32 *buf,
int buf_size)
{
int rc;

rc = bnx2x_nvram_read(bp, offset, (u8 *)buf, buf_size);

if (!rc) {
__be32 *be = (__be32 *)buf;

while ((buf_size -= 4) >= 0)
*buf++ = be32_to_cpu(*be++);
}

return rc;
}

static int bnx2x_get_eeprom(struct net_device *dev,
struct ethtool_eeprom *eeprom, u8 *eebuf)
{
Expand Down Expand Up @@ -2598,8 +2615,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
{ 0x708, 0x70 }, /* manuf_key_info */
{ 0, 0 }
};
__be32 *buf;
u8 *data;
u8 *buf;
int i, rc;
u32 magic, crc;

Expand All @@ -2612,16 +2628,14 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
rc = -ENOMEM;
goto test_nvram_exit;
}
data = (u8 *)buf;

rc = bnx2x_nvram_read(bp, 0, data, 4);
rc = bnx2x_nvram_read32(bp, 0, &magic, sizeof(magic));
if (rc) {
DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
"magic value read (rc %d)\n", rc);
goto test_nvram_exit;
}

magic = be32_to_cpu(buf[0]);
if (magic != 0x669955aa) {
DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
"wrong magic value (0x%08x)\n", magic);
Expand All @@ -2631,15 +2645,15 @@ static int bnx2x_test_nvram(struct bnx2x *bp)

for (i = 0; nvram_tbl[i].size; i++) {

rc = bnx2x_nvram_read(bp, nvram_tbl[i].offset, data,
rc = bnx2x_nvram_read(bp, nvram_tbl[i].offset, buf,
nvram_tbl[i].size);
if (rc) {
DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
"nvram_tbl[%d] read data (rc %d)\n", i, rc);
goto test_nvram_exit;
}

crc = ether_crc_le(nvram_tbl[i].size, data);
crc = ether_crc_le(nvram_tbl[i].size, buf);
if (crc != CRC32_RESIDUAL) {
DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
"nvram_tbl[%d] wrong crc value (0x%08x)\n", i, crc);
Expand Down

0 comments on commit 9c2fb60

Please sign in to comment.