Commit c77a2fa3 authored by Nilesh Javali's avatar Nilesh Javali Committed by Martin K. Petersen

scsi: qedi: Add the CRC size within iSCSI NVM image

The QED driver commit, 1ac4329a ("qed: Add configuration information
to register dump and debug data"), removes the CRC length validation
causing nvm_get_image failure while loading qedi driver:

[qed_mcp_get_nvm_image:2700(host_10-0)]Image [0] is too big - 00006008 bytes
where only 00006004 are available
[qedi_get_boot_info:2253]:10: Could not get NVM image. ret = -12

Hence add and adjust the CRC size to iSCSI NVM image to read boot info at
qedi load time.
Signed-off-by: default avatarNilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 05a86e78
...@@ -77,6 +77,11 @@ enum qedi_nvm_tgts { ...@@ -77,6 +77,11 @@ enum qedi_nvm_tgts {
QEDI_NVM_TGT_SEC, QEDI_NVM_TGT_SEC,
}; };
struct qedi_nvm_iscsi_image {
struct nvm_iscsi_cfg iscsi_cfg;
u32 crc;
};
struct qedi_uio_ctrl { struct qedi_uio_ctrl {
/* meta data */ /* meta data */
u32 uio_hsi_version; u32 uio_hsi_version;
...@@ -294,7 +299,7 @@ struct qedi_ctx { ...@@ -294,7 +299,7 @@ struct qedi_ctx {
void *bdq_pbl_list; void *bdq_pbl_list;
dma_addr_t bdq_pbl_list_dma; dma_addr_t bdq_pbl_list_dma;
u8 bdq_pbl_list_num_entries; u8 bdq_pbl_list_num_entries;
struct nvm_iscsi_cfg *iscsi_cfg; struct qedi_nvm_iscsi_image *iscsi_image;
dma_addr_t nvm_buf_dma; dma_addr_t nvm_buf_dma;
void __iomem *bdq_primary_prod; void __iomem *bdq_primary_prod;
void __iomem *bdq_secondary_prod; void __iomem *bdq_secondary_prod;
......
...@@ -1346,23 +1346,26 @@ static int qedi_setup_int(struct qedi_ctx *qedi) ...@@ -1346,23 +1346,26 @@ static int qedi_setup_int(struct qedi_ctx *qedi)
static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi) static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi)
{ {
if (qedi->iscsi_cfg) if (qedi->iscsi_image)
dma_free_coherent(&qedi->pdev->dev, dma_free_coherent(&qedi->pdev->dev,
sizeof(struct nvm_iscsi_cfg), sizeof(struct qedi_nvm_iscsi_image),
qedi->iscsi_cfg, qedi->nvm_buf_dma); qedi->iscsi_image, qedi->nvm_buf_dma);
} }
static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi) static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
{ {
qedi->iscsi_cfg = dma_zalloc_coherent(&qedi->pdev->dev, struct qedi_nvm_iscsi_image nvm_image;
sizeof(struct nvm_iscsi_cfg),
&qedi->nvm_buf_dma, GFP_KERNEL); qedi->iscsi_image = dma_zalloc_coherent(&qedi->pdev->dev,
if (!qedi->iscsi_cfg) { sizeof(nvm_image),
&qedi->nvm_buf_dma,
GFP_KERNEL);
if (!qedi->iscsi_image) {
QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n"); QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
return -ENOMEM; return -ENOMEM;
} }
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
"NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_cfg, "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_image,
qedi->nvm_buf_dma); qedi->nvm_buf_dma);
return 0; return 0;
...@@ -1905,7 +1908,7 @@ qedi_get_nvram_block(struct qedi_ctx *qedi) ...@@ -1905,7 +1908,7 @@ qedi_get_nvram_block(struct qedi_ctx *qedi)
struct nvm_iscsi_block *block; struct nvm_iscsi_block *block;
pf = qedi->dev_info.common.abs_pf_id; pf = qedi->dev_info.common.abs_pf_id;
block = &qedi->iscsi_cfg->block[0]; block = &qedi->iscsi_image->iscsi_cfg.block[0];
for (i = 0; i < NUM_OF_ISCSI_PF_SUPPORTED; i++, block++) { for (i = 0; i < NUM_OF_ISCSI_PF_SUPPORTED; i++, block++) {
flags = ((block->id) & NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK) >> flags = ((block->id) & NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK) >>
NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET; NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET;
...@@ -2194,15 +2197,14 @@ static void qedi_boot_release(void *data) ...@@ -2194,15 +2197,14 @@ static void qedi_boot_release(void *data)
static int qedi_get_boot_info(struct qedi_ctx *qedi) static int qedi_get_boot_info(struct qedi_ctx *qedi)
{ {
int ret = 1; int ret = 1;
u16 len; struct qedi_nvm_iscsi_image nvm_image;
len = sizeof(struct nvm_iscsi_cfg);
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
"Get NVM iSCSI CFG image\n"); "Get NVM iSCSI CFG image\n");
ret = qedi_ops->common->nvm_get_image(qedi->cdev, ret = qedi_ops->common->nvm_get_image(qedi->cdev,
QED_NVM_IMAGE_ISCSI_CFG, QED_NVM_IMAGE_ISCSI_CFG,
(char *)qedi->iscsi_cfg, len); (char *)qedi->iscsi_image,
sizeof(nvm_image));
if (ret) if (ret)
QEDI_ERR(&qedi->dbg_ctx, QEDI_ERR(&qedi->dbg_ctx,
"Could not get NVM image. ret = %d\n", ret); "Could not get NVM image. ret = %d\n", ret);
......
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