Commit eb2afd4a authored by Dmitry Kravkov's avatar Dmitry Kravkov Committed by David S. Miller

bnx2x: cache-in compressed fw image

Re-request fw from fs may fail for different reasons, once the fw was
loaded we won't release it until driver is removed.

This also resolves the boot problem when initial fw is located on initrd,
but rootfs is still unavailable, in this case device reset will fail due
to absence of fw files.
Signed-off-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eccab1ec
......@@ -10548,10 +10548,13 @@ do { \
int bnx2x_init_firmware(struct bnx2x *bp)
{
const char *fw_file_name;
struct bnx2x_fw_file_hdr *fw_hdr;
int rc;
if (!bp->firmware) {
const char *fw_file_name;
if (CHIP_IS_E1(bp))
fw_file_name = FW_FILE_NAME_E1;
else if (CHIP_IS_E1H(bp))
......@@ -10562,12 +10565,13 @@ int bnx2x_init_firmware(struct bnx2x *bp)
BNX2X_ERR("Unsupported chip revision\n");
return -EINVAL;
}
BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev);
rc = request_firmware(&bp->firmware, fw_file_name,
&bp->pdev->dev);
if (rc) {
BNX2X_ERR("Can't load firmware file %s\n", fw_file_name);
BNX2X_ERR("Can't load firmware file %s\n",
fw_file_name);
goto request_firmware_exit;
}
......@@ -10576,6 +10580,7 @@ int bnx2x_init_firmware(struct bnx2x *bp)
BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name);
goto request_firmware_exit;
}
}
fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data;
......@@ -10630,6 +10635,7 @@ static void bnx2x_release_firmware(struct bnx2x *bp)
kfree(bp->init_ops);
kfree(bp->init_data);
release_firmware(bp->firmware);
bp->firmware = NULL;
}
......@@ -10925,6 +10931,8 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
if (bp->doorbells)
iounmap(bp->doorbells);
bnx2x_release_firmware(bp);
bnx2x_free_mem_bp(bp);
free_netdev(dev);
......
......@@ -5380,7 +5380,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
rc = drv->init_fw(bp);
if (rc) {
BNX2X_ERR("Error loading firmware\n");
goto fw_init_err;
goto init_err;
}
/* Handle the beginning of COMMON_XXX pases separatelly... */
......@@ -5388,25 +5388,25 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP:
rc = bnx2x_func_init_cmn_chip(bp, drv);
if (rc)
goto init_hw_err;
goto init_err;
break;
case FW_MSG_CODE_DRV_LOAD_COMMON:
rc = bnx2x_func_init_cmn(bp, drv);
if (rc)
goto init_hw_err;
goto init_err;
break;
case FW_MSG_CODE_DRV_LOAD_PORT:
rc = bnx2x_func_init_port(bp, drv);
if (rc)
goto init_hw_err;
goto init_err;
break;
case FW_MSG_CODE_DRV_LOAD_FUNCTION:
rc = bnx2x_func_init_func(bp, drv);
if (rc)
goto init_hw_err;
goto init_err;
break;
default:
......@@ -5414,10 +5414,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp,
rc = -EINVAL;
}
init_hw_err:
drv->release_fw(bp);
fw_init_err:
init_err:
drv->gunzip_end(bp);
/* In case of success, complete the comand immediatelly: no ramrods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment