summaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2006-01-23 16:11:42 -0800
committerDavid S. Miller <davem@davemloft.net>2006-01-23 16:11:42 -0800
commit1122db717ab5443ca9043fc0d23c1e862cfb3a61 (patch)
tree360da4ec3f5a29c5d3a3aa1e1677072e3852f26d /drivers/net/bnx2.c
parent1269a8a64a37c8a06af672f4cff4fed16a478734 (diff)
[BNX2]: Fix nvram sizing
Add code to correctly determine nvram size. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 7b99cf26a12..4f613b0be14 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -2724,9 +2724,16 @@ bnx2_init_nvram(struct bnx2 *bp)
if (j == entry_count) {
bp->flash_info = NULL;
printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n");
- rc = -ENODEV;
+ return -ENODEV;
}
+ val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2);
+ val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK;
+ if (val)
+ bp->flash_size = val;
+ else
+ bp->flash_size = bp->flash_info->total_size;
+
return rc;
}
@@ -4809,10 +4816,10 @@ bnx2_get_eeprom_len(struct net_device *dev)
{
struct bnx2 *bp = dev->priv;
- if (bp->flash_info == 0)
+ if (bp->flash_info == NULL)
return 0;
- return (int) bp->flash_info->total_size;
+ return (int) bp->flash_size;
}
static int