aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel Elior <ariele@broadcom.com>2012-01-26 01:01:49 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-26 13:39:51 -0500
commitd1e2d9660e6bca2f06606b4bc65ea669bf669b0a (patch)
treebba02575b85901407510c63d0d5de667c7e86423
parent89db4ad830fbdde9c2d990b88bbac8245718177d (diff)
bnx2x: Loaded Firmware Version Validation
In a virtualized environment it is possible for a loading driver to discover that Firmware is already loaded to the device, and that this FW does not match its own. This can happen for example if different Physical Functions are Assigned to different VMs in which different driver versions are loaded. The code in this patch ensures that only drivers with matching FW are loaded over the device, and that in the case described above where the Firmware version doesn't match the driver load is aborted. Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 03f3935fd8c2..b75c8eab095c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -1783,6 +1783,29 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1783 rc = -EBUSY; /* other port in diagnostic mode */ 1783 rc = -EBUSY; /* other port in diagnostic mode */
1784 LOAD_ERROR_EXIT(bp, load_error1); 1784 LOAD_ERROR_EXIT(bp, load_error1);
1785 } 1785 }
1786 if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
1787 load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
1788 /* build FW version dword */
1789 u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) +
1790 (BCM_5710_FW_MINOR_VERSION << 8) +
1791 (BCM_5710_FW_REVISION_VERSION << 16) +
1792 (BCM_5710_FW_ENGINEERING_VERSION << 24);
1793
1794 /* read loaded FW from chip */
1795 u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
1796
1797 DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x",
1798 loaded_fw, my_fw);
1799
1800 /* abort nic load if version mismatch */
1801 if (my_fw != loaded_fw) {
1802 BNX2X_ERR("bnx2x with FW %x already loaded, "
1803 "which mismatches my %x FW. aborting",
1804 loaded_fw, my_fw);
1805 rc = -EBUSY;
1806 LOAD_ERROR_EXIT(bp, load_error2);
1807 }
1808 }
1786 1809
1787 } else { 1810 } else {
1788 int path = BP_PATH(bp); 1811 int path = BP_PATH(bp);