diff options
author | Michael Chan <mchan@broadcom.com> | 2007-07-08 01:52:02 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:18:38 -0400 |
commit | 58fc2ea4057511f84deaa182b1a3612327ecbf2d (patch) | |
tree | e618b9cb73831595a7bac9418497f8479ae2a790 | |
parent | df149d70e1f34ec4995c8a703dbde38071ff4a05 (diff) |
[BNX2]: Print management firmware version.
Add management firmware version for ethtool -i.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bnx2.c | 38 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 12 |
2 files changed, 42 insertions, 8 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index e7551040b096..406b2e16052e 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -5546,11 +5546,7 @@ bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
5546 | strcpy(info->driver, DRV_MODULE_NAME); | 5546 | strcpy(info->driver, DRV_MODULE_NAME); |
5547 | strcpy(info->version, DRV_MODULE_VERSION); | 5547 | strcpy(info->version, DRV_MODULE_VERSION); |
5548 | strcpy(info->bus_info, pci_name(bp->pdev)); | 5548 | strcpy(info->bus_info, pci_name(bp->pdev)); |
5549 | info->fw_version[0] = ((bp->fw_ver & 0xff000000) >> 24) + '0'; | 5549 | strcpy(info->fw_version, bp->fw_version); |
5550 | info->fw_version[2] = ((bp->fw_ver & 0xff0000) >> 16) + '0'; | ||
5551 | info->fw_version[4] = ((bp->fw_ver & 0xff00) >> 8) + '0'; | ||
5552 | info->fw_version[1] = info->fw_version[3] = '.'; | ||
5553 | info->fw_version[5] = 0; | ||
5554 | } | 5550 | } |
5555 | 5551 | ||
5556 | #define BNX2_REGDUMP_LEN (32 * 1024) | 5552 | #define BNX2_REGDUMP_LEN (32 * 1024) |
@@ -6462,7 +6458,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
6462 | { | 6458 | { |
6463 | struct bnx2 *bp; | 6459 | struct bnx2 *bp; |
6464 | unsigned long mem_len; | 6460 | unsigned long mem_len; |
6465 | int rc; | 6461 | int rc, i, j; |
6466 | u32 reg; | 6462 | u32 reg; |
6467 | u64 dma_mask, persist_dma_mask; | 6463 | u64 dma_mask, persist_dma_mask; |
6468 | 6464 | ||
@@ -6619,7 +6615,35 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
6619 | goto err_out_unmap; | 6615 | goto err_out_unmap; |
6620 | } | 6616 | } |
6621 | 6617 | ||
6622 | bp->fw_ver = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_BC_REV); | 6618 | reg = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_BC_REV); |
6619 | for (i = 0, j = 0; i < 3; i++) { | ||
6620 | u8 num, k, skip0; | ||
6621 | |||
6622 | num = (u8) (reg >> (24 - (i * 8))); | ||
6623 | for (k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) { | ||
6624 | if (num >= k || !skip0 || k == 1) { | ||
6625 | bp->fw_version[j++] = (num / k) + '0'; | ||
6626 | skip0 = 0; | ||
6627 | } | ||
6628 | } | ||
6629 | if (i != 2) | ||
6630 | bp->fw_version[j++] = '.'; | ||
6631 | } | ||
6632 | reg = REG_RD_IND(bp, bp->shmem_base + BNX2_BC_STATE_CONDITION); | ||
6633 | reg &= BNX2_CONDITION_MFW_RUN_MASK; | ||
6634 | if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && | ||
6635 | reg != BNX2_CONDITION_MFW_RUN_NONE) { | ||
6636 | int i; | ||
6637 | u32 addr = REG_RD_IND(bp, bp->shmem_base + BNX2_MFW_VER_PTR); | ||
6638 | |||
6639 | bp->fw_version[j++] = ' '; | ||
6640 | for (i = 0; i < 3; i++) { | ||
6641 | reg = REG_RD_IND(bp, addr + i * 4); | ||
6642 | reg = swab32(reg); | ||
6643 | memcpy(&bp->fw_version[j], ®, 4); | ||
6644 | j += 4; | ||
6645 | } | ||
6646 | } | ||
6623 | 6647 | ||
6624 | reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_UPPER); | 6648 | reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_UPPER); |
6625 | bp->mac_addr[0] = (u8) (reg >> 8); | 6649 | bp->mac_addr[0] = (u8) (reg >> 8); |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 6dca333855a1..d8cd1afeb23d 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6660,7 +6660,7 @@ struct bnx2 { | |||
6660 | 6660 | ||
6661 | u32 shmem_base; | 6661 | u32 shmem_base; |
6662 | 6662 | ||
6663 | u32 fw_ver; | 6663 | char fw_version[32]; |
6664 | 6664 | ||
6665 | int pm_cap; | 6665 | int pm_cap; |
6666 | int pcix_cap; | 6666 | int pcix_cap; |
@@ -7036,6 +7036,8 @@ struct fw_info { | |||
7036 | #define BNX2_PORT_FEATURE_MBA_VLAN_TAG_MASK 0xffff | 7036 | #define BNX2_PORT_FEATURE_MBA_VLAN_TAG_MASK 0xffff |
7037 | #define BNX2_PORT_FEATURE_MBA_VLAN_ENABLE 0x10000 | 7037 | #define BNX2_PORT_FEATURE_MBA_VLAN_ENABLE 0x10000 |
7038 | 7038 | ||
7039 | #define BNX2_MFW_VER_PTR 0x00000014c | ||
7040 | |||
7039 | #define BNX2_BC_STATE_RESET_TYPE 0x000001c0 | 7041 | #define BNX2_BC_STATE_RESET_TYPE 0x000001c0 |
7040 | #define BNX2_BC_STATE_RESET_TYPE_SIG 0x00005254 | 7042 | #define BNX2_BC_STATE_RESET_TYPE_SIG 0x00005254 |
7041 | #define BNX2_BC_STATE_RESET_TYPE_SIG_MASK 0x0000ffff | 7043 | #define BNX2_BC_STATE_RESET_TYPE_SIG_MASK 0x0000ffff |
@@ -7089,6 +7091,14 @@ struct fw_info { | |||
7089 | #define BNX2_BC_STATE_ERR_NO_RXP (BNX2_BC_STATE_SIGN | 0x0600) | 7091 | #define BNX2_BC_STATE_ERR_NO_RXP (BNX2_BC_STATE_SIGN | 0x0600) |
7090 | #define BNX2_BC_STATE_ERR_TOO_MANY_RBUF (BNX2_BC_STATE_SIGN | 0x0700) | 7092 | #define BNX2_BC_STATE_ERR_TOO_MANY_RBUF (BNX2_BC_STATE_SIGN | 0x0700) |
7091 | 7093 | ||
7094 | #define BNX2_BC_STATE_CONDITION 0x000001c8 | ||
7095 | #define BNX2_CONDITION_MFW_RUN_UNKNOWN 0x00000000 | ||
7096 | #define BNX2_CONDITION_MFW_RUN_IPMI 0x00002000 | ||
7097 | #define BNX2_CONDITION_MFW_RUN_UMP 0x00004000 | ||
7098 | #define BNX2_CONDITION_MFW_RUN_NCSI 0x00006000 | ||
7099 | #define BNX2_CONDITION_MFW_RUN_NONE 0x0000e000 | ||
7100 | #define BNX2_CONDITION_MFW_RUN_MASK 0x0000e000 | ||
7101 | |||
7092 | #define BNX2_BC_STATE_DEBUG_CMD 0x1dc | 7102 | #define BNX2_BC_STATE_DEBUG_CMD 0x1dc |
7093 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 | 7103 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 |
7094 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE_MASK 0xffff0000 | 7104 | #define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE_MASK 0xffff0000 |