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:
Dmitry Kravkov 2011-11-15 12:07:33 +00:00 committed by David S. Miller
parent eccab1ec87
commit eb2afd4a62
2 changed files with 35 additions and 30 deletions

View File

@ -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);

View File

@ -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