scsi: lpfc: Enable fw download on if_type=6 devices
Current code is very explicit in what it allows to be downloaded. The driver checking prevented G7 firmware download. The driver checking is unnecessary as the device will validate what it receives. Revise the firmware download interface checking. Added a little debug support in case there is still a failure. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

parent
7365f6fdbb
commit
1feb8204a1
@@ -11297,6 +11297,27 @@ lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
|
||||
uint32_t magic_number, uint32_t ftype, uint32_t fid, uint32_t fsize,
|
||||
const struct firmware *fw)
|
||||
{
|
||||
if (offset == ADD_STATUS_FW_NOT_SUPPORTED)
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
"3030 This firmware version is not supported on "
|
||||
"this HBA model. Device:%x Magic:%x Type:%x "
|
||||
"ID:%x Size %d %zd\n",
|
||||
phba->pcidev->device, magic_number, ftype, fid,
|
||||
fsize, fw->size);
|
||||
else
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
"3022 FW Download failed. Device:%x Magic:%x Type:%x "
|
||||
"ID:%x Size %d %zd\n",
|
||||
phba->pcidev->device, magic_number, ftype, fid,
|
||||
fsize, fw->size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lpfc_write_firmware - attempt to write a firmware image to the port
|
||||
* @fw: pointer to firmware image returned from request_firmware.
|
||||
@@ -11324,20 +11345,10 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
|
||||
|
||||
magic_number = be32_to_cpu(image->magic_number);
|
||||
ftype = bf_get_be32(lpfc_grp_hdr_file_type, image);
|
||||
fid = bf_get_be32(lpfc_grp_hdr_id, image),
|
||||
fid = bf_get_be32(lpfc_grp_hdr_id, image);
|
||||
fsize = be32_to_cpu(image->size);
|
||||
|
||||
INIT_LIST_HEAD(&dma_buffer_list);
|
||||
if ((magic_number != LPFC_GROUP_OJECT_MAGIC_G5 &&
|
||||
magic_number != LPFC_GROUP_OJECT_MAGIC_G6) ||
|
||||
ftype != LPFC_FILE_TYPE_GROUP || fsize != fw->size) {
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
"3022 Invalid FW image found. "
|
||||
"Magic:%x Type:%x ID:%x Size %d %zd\n",
|
||||
magic_number, ftype, fid, fsize, fw->size);
|
||||
rc = -EINVAL;
|
||||
goto release_out;
|
||||
}
|
||||
lpfc_decode_firmware_rev(phba, fwrev, 1);
|
||||
if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) {
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
@@ -11378,11 +11389,18 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
|
||||
}
|
||||
rc = lpfc_wr_object(phba, &dma_buffer_list,
|
||||
(fw->size - offset), &offset);
|
||||
if (rc)
|
||||
if (rc) {
|
||||
lpfc_log_write_firmware_error(phba, offset,
|
||||
magic_number, ftype, fid, fsize, fw);
|
||||
goto release_out;
|
||||
}
|
||||
}
|
||||
rc = offset;
|
||||
}
|
||||
} else
|
||||
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
||||
"3029 Skipped Firmware update, Current "
|
||||
"Version:%s New Version:%s\n",
|
||||
fwrev, image->revision);
|
||||
|
||||
release_out:
|
||||
list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) {
|
||||
|
Reference in New Issue
Block a user