mirror of https://gitee.com/openkylin/linux.git
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: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
eccab1ec87
commit
eb2afd4a62
|
@ -10548,33 +10548,38 @@ do { \
|
|||
|
||||
int bnx2x_init_firmware(struct bnx2x *bp)
|
||||
{
|
||||
const char *fw_file_name;
|
||||
struct bnx2x_fw_file_hdr *fw_hdr;
|
||||
int rc;
|
||||
|
||||
if (CHIP_IS_E1(bp))
|
||||
fw_file_name = FW_FILE_NAME_E1;
|
||||
else if (CHIP_IS_E1H(bp))
|
||||
fw_file_name = FW_FILE_NAME_E1H;
|
||||
else if (!CHIP_IS_E1x(bp))
|
||||
fw_file_name = FW_FILE_NAME_E2;
|
||||
else {
|
||||
BNX2X_ERR("Unsupported chip revision\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
|
||||
if (!bp->firmware) {
|
||||
const char *fw_file_name;
|
||||
|
||||
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);
|
||||
goto request_firmware_exit;
|
||||
}
|
||||
if (CHIP_IS_E1(bp))
|
||||
fw_file_name = FW_FILE_NAME_E1;
|
||||
else if (CHIP_IS_E1H(bp))
|
||||
fw_file_name = FW_FILE_NAME_E1H;
|
||||
else if (!CHIP_IS_E1x(bp))
|
||||
fw_file_name = FW_FILE_NAME_E2;
|
||||
else {
|
||||
BNX2X_ERR("Unsupported chip revision\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
|
||||
|
||||
rc = bnx2x_check_firmware(bp);
|
||||
if (rc) {
|
||||
BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name);
|
||||
goto request_firmware_exit;
|
||||
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);
|
||||
goto request_firmware_exit;
|
||||
}
|
||||
|
||||
rc = bnx2x_check_firmware(bp);
|
||||
if (rc) {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue