diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-06-09 01:39:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-10 04:04:08 -0400 |
commit | cfec0cbc92cdcec5a540bf340c5a9fb8c89e5af1 (patch) | |
tree | 8ddab4c01ca308c04988d305a3bbd3ee158c7d64 /drivers/net/qlge | |
parent | 0808dc80939b08ec215f472e17a5d8f6b148037e (diff) |
qlge: Add support for retrieving firmware version.
This is used by driver banner and ethtool info.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r-- | drivers/net/qlge/qlge.h | 2 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_ethtool.c | 5 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 7 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 34 |
4 files changed, 47 insertions, 1 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index e18607124f41..258ef449ea88 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1430,6 +1430,7 @@ struct ql_adapter { | |||
1430 | 1430 | ||
1431 | /* Hardware information */ | 1431 | /* Hardware information */ |
1432 | u32 chip_rev_id; | 1432 | u32 chip_rev_id; |
1433 | u32 fw_rev_id; | ||
1433 | u32 func; /* PCI function for this adapter */ | 1434 | u32 func; /* PCI function for this adapter */ |
1434 | 1435 | ||
1435 | spinlock_t adapter_lock; | 1436 | spinlock_t adapter_lock; |
@@ -1580,6 +1581,7 @@ void ql_mpi_idc_work(struct work_struct *work); | |||
1580 | void ql_mpi_port_cfg_work(struct work_struct *work); | 1581 | void ql_mpi_port_cfg_work(struct work_struct *work); |
1581 | int ql_mb_get_fw_state(struct ql_adapter *qdev); | 1582 | int ql_mb_get_fw_state(struct ql_adapter *qdev); |
1582 | int ql_cam_route_initialize(struct ql_adapter *qdev); | 1583 | int ql_cam_route_initialize(struct ql_adapter *qdev); |
1584 | int ql_mb_about_fw(struct ql_adapter *qdev); | ||
1583 | 1585 | ||
1584 | #if 1 | 1586 | #if 1 |
1585 | #define QL_ALL_DUMP | 1587 | #define QL_ALL_DUMP |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 913b2a5fafc9..ea0216361101 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -293,7 +293,10 @@ static void ql_get_drvinfo(struct net_device *ndev, | |||
293 | struct ql_adapter *qdev = netdev_priv(ndev); | 293 | struct ql_adapter *qdev = netdev_priv(ndev); |
294 | strncpy(drvinfo->driver, qlge_driver_name, 32); | 294 | strncpy(drvinfo->driver, qlge_driver_name, 32); |
295 | strncpy(drvinfo->version, qlge_driver_version, 32); | 295 | strncpy(drvinfo->version, qlge_driver_version, 32); |
296 | strncpy(drvinfo->fw_version, "N/A", 32); | 296 | snprintf(drvinfo->fw_version, 32, "v%d.%d.%d", |
297 | (qdev->fw_rev_id & 0x00ff0000) >> 16, | ||
298 | (qdev->fw_rev_id & 0x0000ff00) >> 8, | ||
299 | (qdev->fw_rev_id & 0x000000ff)); | ||
297 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); | 300 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); |
298 | drvinfo->n_stats = 0; | 301 | drvinfo->n_stats = 0; |
299 | drvinfo->testinfo_len = 0; | 302 | drvinfo->testinfo_len = 0; |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 0b0778d9919c..5fb875d60d00 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -837,6 +837,13 @@ exit: | |||
837 | static int ql_8000_port_initialize(struct ql_adapter *qdev) | 837 | static int ql_8000_port_initialize(struct ql_adapter *qdev) |
838 | { | 838 | { |
839 | int status; | 839 | int status; |
840 | /* | ||
841 | * Get MPI firmware version for driver banner | ||
842 | * and ethool info. | ||
843 | */ | ||
844 | status = ql_mb_about_fw(qdev); | ||
845 | if (status) | ||
846 | goto exit; | ||
840 | status = ql_mb_get_fw_state(qdev); | 847 | status = ql_mb_get_fw_state(qdev); |
841 | if (status) | 848 | if (status) |
842 | goto exit; | 849 | goto exit; |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 3bd60a4f5d71..a67c14a7befd 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -547,6 +547,40 @@ end: | |||
547 | return status; | 547 | return status; |
548 | } | 548 | } |
549 | 549 | ||
550 | |||
551 | /* Get MPI firmware version. This will be used for | ||
552 | * driver banner and for ethtool info. | ||
553 | * Returns zero on success. | ||
554 | */ | ||
555 | int ql_mb_about_fw(struct ql_adapter *qdev) | ||
556 | { | ||
557 | struct mbox_params mbc; | ||
558 | struct mbox_params *mbcp = &mbc; | ||
559 | int status = 0; | ||
560 | |||
561 | memset(mbcp, 0, sizeof(struct mbox_params)); | ||
562 | |||
563 | mbcp->in_count = 1; | ||
564 | mbcp->out_count = 3; | ||
565 | |||
566 | mbcp->mbox_in[0] = MB_CMD_ABOUT_FW; | ||
567 | |||
568 | status = ql_mailbox_command(qdev, mbcp); | ||
569 | if (status) | ||
570 | return status; | ||
571 | |||
572 | if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { | ||
573 | QPRINTK(qdev, DRV, ERR, | ||
574 | "Failed about firmware command\n"); | ||
575 | status = -EIO; | ||
576 | } | ||
577 | |||
578 | /* Store the firmware version */ | ||
579 | qdev->fw_rev_id = mbcp->mbox_out[1]; | ||
580 | |||
581 | return status; | ||
582 | } | ||
583 | |||
550 | /* Get functional state for MPI firmware. | 584 | /* Get functional state for MPI firmware. |
551 | * Returns zero on success. | 585 | * Returns zero on success. |
552 | */ | 586 | */ |