OSDN Git Service

scsi: lpfc: Enable fw download on if_type=6 devices
authorJames Smart <jsmart2021@gmail.com>
Thu, 22 Feb 2018 16:18:47 +0000 (08:18 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 23 Feb 2018 01:39:29 +0000 (20:39 -0500)
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>
drivers/scsi/lpfc/lpfc_hw4.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c

index dba724e..be8227d 100644 (file)
@@ -2241,6 +2241,7 @@ struct lpfc_mbx_redisc_fcf_tbl {
  * command.
  */
 #define ADD_STATUS_OPERATION_ALREADY_ACTIVE            0x67
+#define ADD_STATUS_FW_NOT_SUPPORTED                    0xEB
 
 struct lpfc_mbx_sli4_config {
        struct mbox_header header;
@@ -4603,10 +4604,6 @@ union lpfc_wqe128 {
        struct gen_req64_wqe gen_req;
 };
 
-#define LPFC_GROUP_OJECT_MAGIC_G5              0xfeaa0001
-#define LPFC_GROUP_OJECT_MAGIC_G6              0xfeaa0003
-#define LPFC_FILE_TYPE_GROUP                   0xf7
-#define LPFC_FILE_ID_GROUP                     0xa2
 struct lpfc_grp_hdr {
        uint32_t size;
        uint32_t magic_number;
index 96a37e4..af92c3c 100644 (file)
@@ -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) {
index 925a40d..8fc11ba 100644 (file)
@@ -18871,6 +18871,7 @@ lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list,
                                "status x%x add_status x%x, mbx status x%x\n",
                                shdr_status, shdr_add_status, rc);
                rc = -ENXIO;
+               *offset = shdr_add_status;
        } else
                *offset += wr_object->u.response.actual_write_length;
        return rc;