scsi: qla2xxx: Remove FW default template
authorJoe Carnuccio <joe.carnuccio@cavium.com>
Tue, 12 Mar 2019 18:08:11 +0000 (11:08 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 19 Mar 2019 16:22:54 +0000 (12:22 -0400)
This patch removes FW default template as there will never be case where
the default template would be invoked.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_tmpl.c

index 4eefe69..0fa0342 100644 (file)
@@ -613,8 +613,6 @@ extern void qla27xx_fwdump(scsi_qla_host_t *, int);
 extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *);
 extern int qla27xx_fwdt_template_valid(void *);
 extern ulong qla27xx_fwdt_template_size(void *);
-extern const void *qla27xx_fwdt_template_default(void);
-extern ulong qla27xx_fwdt_template_default_size(void);
 
 extern void qla2x00_dump_regs(scsi_qla_host_t *);
 extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
index 4200451..4008b97 100644 (file)
@@ -7387,7 +7387,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
        ql_dbg(ql_dbg_init, vha, 0x0162,
            "-> array size %x dwords\n", risc_size);
        if (risc_size == 0 || risc_size == ~0)
-               goto default_template;
+               goto failed;
 
        dlen = (risc_size - 8) * sizeof(*dcode);
        ql_dbg(ql_dbg_init, vha, 0x0163,
@@ -7396,7 +7396,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
        if (!ha->fw_dump_template) {
                ql_log(ql_log_warn, vha, 0x0164,
                    "Failed fwdump template allocate %x bytes.\n", risc_size);
-               goto default_template;
+               goto failed;
        }
 
        faddr += 7;
@@ -7409,7 +7409,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
        if (!qla27xx_fwdt_template_valid(dcode)) {
                ql_log(ql_log_warn, vha, 0x0165,
                    "Failed fwdump template validate\n");
-               goto default_template;
+               goto failed;
        }
 
        dlen = qla27xx_fwdt_template_size(dcode);
@@ -7419,48 +7419,13 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
                ql_log(ql_log_warn, vha, 0x0167,
                    "Failed fwdump template exceeds array by %zx bytes\n",
                    (size_t)(dlen - risc_size * sizeof(*dcode)));
-               goto default_template;
-       }
-       ha->fw_dump_template_len = dlen;
-       return rval;
-
-default_template:
-       ql_log(ql_log_warn, vha, 0x0168, "Using default fwdump template\n");
-       if (ha->fw_dump_template)
-               vfree(ha->fw_dump_template);
-       ha->fw_dump_template = NULL;
-       ha->fw_dump_template_len = 0;
-
-       dlen = qla27xx_fwdt_template_default_size();
-       ql_dbg(ql_dbg_init, vha, 0x0169,
-           "-> template allocating %x bytes...\n", dlen);
-       ha->fw_dump_template = vmalloc(dlen);
-       if (!ha->fw_dump_template) {
-               ql_log(ql_log_warn, vha, 0x016a,
-                   "Failed fwdump template allocate %x bytes.\n", risc_size);
-               goto failed_template;
-       }
-
-       dcode = ha->fw_dump_template;
-       risc_size = dlen / sizeof(*dcode);
-       memcpy(dcode, qla27xx_fwdt_template_default(), dlen);
-       for (i = 0; i < risc_size; i++)
-               dcode[i] = be32_to_cpu(dcode[i]);
-
-       if (!qla27xx_fwdt_template_valid(ha->fw_dump_template)) {
-               ql_log(ql_log_warn, vha, 0x016b,
-                   "Failed fwdump template validate\n");
-               goto failed_template;
+               goto failed;
        }
-
-       dlen = qla27xx_fwdt_template_size(ha->fw_dump_template);
-       ql_dbg(ql_dbg_init, vha, 0x016c,
-           "-> template size %x bytes\n", dlen);
        ha->fw_dump_template_len = dlen;
        return rval;
 
-failed_template:
-       ql_log(ql_log_warn, vha, 0x016d, "Failed default fwdump template\n");
+failed:
+       ql_log(ql_log_warn, vha, 0x016d, "Failed fwdump template\n");
        if (ha->fw_dump_template)
                vfree(ha->fw_dump_template);
        ha->fw_dump_template = NULL;
@@ -7690,7 +7655,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        ql_dbg(ql_dbg_init, vha, 0x172,
            "-> array size %x dwords\n", risc_size);
        if (risc_size == 0 || risc_size == ~0)
-               goto default_template;
+               goto failed;
 
        dlen = (risc_size - 8) * sizeof(*fwcode);
        ql_dbg(ql_dbg_init, vha, 0x0173,
@@ -7699,7 +7664,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        if (!ha->fw_dump_template) {
                ql_log(ql_log_warn, vha, 0x0174,
                    "Failed fwdump template allocate %x bytes.\n", risc_size);
-               goto default_template;
+               goto failed;
        }
 
        fwcode += 7;
@@ -7711,7 +7676,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        if (!qla27xx_fwdt_template_valid(dcode)) {
                ql_log(ql_log_warn, vha, 0x0175,
                    "Failed fwdump template validate\n");
-               goto default_template;
+               goto failed;
        }
 
        dlen = qla27xx_fwdt_template_size(dcode);
@@ -7721,48 +7686,13 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                ql_log(ql_log_warn, vha, 0x0177,
                    "Failed fwdump template exceeds array by %zx bytes\n",
                    (size_t)(dlen - risc_size * sizeof(*fwcode)));
-               goto default_template;
-       }
-       ha->fw_dump_template_len = dlen;
-       return rval;
-
-default_template:
-       ql_log(ql_log_warn, vha, 0x0178, "Using default fwdump template\n");
-       if (ha->fw_dump_template)
-               vfree(ha->fw_dump_template);
-       ha->fw_dump_template = NULL;
-       ha->fw_dump_template_len = 0;
-
-       dlen = qla27xx_fwdt_template_default_size();
-       ql_dbg(ql_dbg_init, vha, 0x0179,
-           "-> template allocating %x bytes...\n", dlen);
-       ha->fw_dump_template = vmalloc(dlen);
-       if (!ha->fw_dump_template) {
-               ql_log(ql_log_warn, vha, 0x017a,
-                   "Failed fwdump template allocate %x bytes.\n", risc_size);
-               goto failed_template;
-       }
-
-       dcode = ha->fw_dump_template;
-       risc_size = dlen / sizeof(*fwcode);
-       fwcode = qla27xx_fwdt_template_default();
-       for (i = 0; i < risc_size; i++)
-               dcode[i] = be32_to_cpu(fwcode[i]);
-
-       if (!qla27xx_fwdt_template_valid(ha->fw_dump_template)) {
-               ql_log(ql_log_warn, vha, 0x017b,
-                   "Failed fwdump template validate\n");
-               goto failed_template;
+               goto failed;
        }
-
-       dlen = qla27xx_fwdt_template_size(ha->fw_dump_template);
-       ql_dbg(ql_dbg_init, vha, 0x017c,
-           "-> template size %x bytes\n", dlen);
        ha->fw_dump_template_len = dlen;
        return rval;
 
-failed_template:
-       ql_log(ql_log_warn, vha, 0x017d, "Failed default fwdump template\n");
+failed:
+       ql_log(ql_log_warn, vha, 0x017d, "Failed fwdump template\n");
        if (ha->fw_dump_template)
                vfree(ha->fw_dump_template);
        ha->fw_dump_template = NULL;
index 9e52500..70f227f 100644 (file)
@@ -7,97 +7,7 @@
 #include "qla_def.h"
 #include "qla_tmpl.h"
 
-/* note default template is in big endian */
-static const uint32_t ql27xx_fwdt_default_template[] = {
-       0x63000000, 0xa4000000, 0x7c050000, 0x00000000,
-       0x30000000, 0x01000000, 0x00000000, 0xc0406eb4,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x00000000, 0x00000000, 0x00000000,
-       0x00000000, 0x04010000, 0x14000000, 0x00000000,
-       0x02000000, 0x44000000, 0x09010000, 0x10000000,
-       0x00000000, 0x02000000, 0x01010000, 0x1c000000,
-       0x00000000, 0x02000000, 0x00600000, 0x00000000,
-       0xc0000000, 0x01010000, 0x1c000000, 0x00000000,
-       0x02000000, 0x00600000, 0x00000000, 0xcc000000,
-       0x01010000, 0x1c000000, 0x00000000, 0x02000000,
-       0x10600000, 0x00000000, 0xd4000000, 0x01010000,
-       0x1c000000, 0x00000000, 0x02000000, 0x700f0000,
-       0x00000060, 0xf0000000, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x00700000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x10700000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x40700000, 0x041000c0,
-       0x01010000, 0x1c000000, 0x00000000, 0x02000000,
-       0x007c0000, 0x01000000, 0xc0000000, 0x00010000,
-       0x18000000, 0x00000000, 0x02000000, 0x007c0000,
-       0x040300c4, 0x00010000, 0x18000000, 0x00000000,
-       0x02000000, 0x007c0000, 0x040100c0, 0x01010000,
-       0x1c000000, 0x00000000, 0x02000000, 0x007c0000,
-       0x00000000, 0xc0000000, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x007c0000, 0x04200000,
-       0x0b010000, 0x18000000, 0x00000000, 0x02000000,
-       0x0c000000, 0x00000000, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000000b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000010b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000020b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000030b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000040b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000050b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000060b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000070b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000080b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x000090b0, 0x02010000, 0x20000000,
-       0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
-       0xf0000000, 0x0000a0b0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x0a000000, 0x040100c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x0a000000, 0x04200080, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x00be0000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x10be0000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x20be0000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x30be0000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x00b00000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x10b00000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x20b00000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x30b00000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x00300000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x10300000, 0x041000c0, 0x00010000, 0x18000000,
-       0x00000000, 0x02000000, 0x20300000, 0x041000c0,
-       0x00010000, 0x18000000, 0x00000000, 0x02000000,
-       0x30300000, 0x041000c0, 0x0a010000, 0x10000000,
-       0x00000000, 0x02000000, 0x06010000, 0x1c000000,
-       0x00000000, 0x02000000, 0x01000000, 0x00000200,
-       0xff230200, 0x06010000, 0x1c000000, 0x00000000,
-       0x02000000, 0x02000000, 0x00001000, 0x00000000,
-       0x07010000, 0x18000000, 0x00000000, 0x02000000,
-       0x00000000, 0x01000000, 0x07010000, 0x18000000,
-       0x00000000, 0x02000000, 0x00000000, 0x02000000,
-       0x07010000, 0x18000000, 0x00000000, 0x02000000,
-       0x00000000, 0x03000000, 0x0d010000, 0x14000000,
-       0x00000000, 0x02000000, 0x00000000, 0xff000000,
-       0x10000000, 0x00000000, 0x00000080,
-};
+#define IOBASE(reg)    offsetof(typeof(*reg), iobase_addr)
 
 static inline void __iomem *
 qla27xx_isp_reg(struct scsi_qla_host *vha)
@@ -1032,18 +942,6 @@ qla27xx_fwdt_template_size(void *p)
        return tmp->template_size;
 }
 
-ulong
-qla27xx_fwdt_template_default_size(void)
-{
-       return sizeof(ql27xx_fwdt_default_template);
-}
-
-const void *
-qla27xx_fwdt_template_default(void)
-{
-       return ql27xx_fwdt_default_template;
-}
-
 int
 qla27xx_fwdt_template_valid(void *p)
 {