Blame SOURCES/0030-scsi-scsi-qla2xxx-Remove-FW-default-template.patch

3c6e85
From 8ad749d26ba00eaa30c27d4890851620516eb510 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:54:50 -0400
3c6e85
Subject: [PATCH 030/124] [scsi] scsi: qla2xxx: Remove FW default template
3c6e85
3c6e85
Message-id: <20190801155618.12650-31-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267802
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 030/118] scsi: qla2xxx: Remove FW default template
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Joe Carnuccio <joe.carnuccio@cavium.com>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
This patch removes FW default template as there will never be case where
3c6e85
the default template would be invoked.
3c6e85
3c6e85
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 2ff6ae85d5eea54640f10db869302759d5376948)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_gbl.h  |   2 -
3c6e85
 drivers/scsi/qla2xxx/qla_init.c |  94 +++++-------------------------------
3c6e85
 drivers/scsi/qla2xxx/qla_tmpl.c | 104 +---------------------------------------
3c6e85
 3 files changed, 13 insertions(+), 187 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
index 3b97724d27ec..aede9e5a31f7 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
@@ -612,8 +612,6 @@ extern void qla27xx_fwdump(scsi_qla_host_t *, int);
3c6e85
 extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *);
3c6e85
 extern int qla27xx_fwdt_template_valid(void *);
3c6e85
 extern ulong qla27xx_fwdt_template_size(void *);
3c6e85
-extern const void *qla27xx_fwdt_template_default(void);
3c6e85
-extern ulong qla27xx_fwdt_template_default_size(void);
3c6e85
 
3c6e85
 extern void qla2x00_dump_regs(scsi_qla_host_t *);
3c6e85
 extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
3c6e85
index 29eb7174a719..934799598702 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_init.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_init.c
3c6e85
@@ -7401,7 +7401,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
3c6e85
 	ql_dbg(ql_dbg_init, vha, 0x0162,
3c6e85
 	    "-> array size %x dwords\n", risc_size);
3c6e85
 	if (risc_size == 0 || risc_size == ~0)
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 
3c6e85
 	dlen = (risc_size - 8) * sizeof(*dcode);
3c6e85
 	ql_dbg(ql_dbg_init, vha, 0x0163,
3c6e85
@@ -7410,7 +7410,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
3c6e85
 	if (!ha->fw_dump_template) {
3c6e85
 		ql_log(ql_log_warn, vha, 0x0164,
3c6e85
 		    "Failed fwdump template allocate %x bytes.\n", risc_size);
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
 
3c6e85
 	faddr += 7;
3c6e85
@@ -7423,7 +7423,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
3c6e85
 	if (!qla27xx_fwdt_template_valid(dcode)) {
3c6e85
 		ql_log(ql_log_warn, vha, 0x0165,
3c6e85
 		    "Failed fwdump template validate\n");
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
 
3c6e85
 	dlen = qla27xx_fwdt_template_size(dcode);
3c6e85
@@ -7433,48 +7433,13 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
3c6e85
 		ql_log(ql_log_warn, vha, 0x0167,
3c6e85
 		    "Failed fwdump template exceeds array by %zx bytes\n",
3c6e85
 		    (size_t)(dlen - risc_size * sizeof(*dcode)));
3c6e85
-		goto default_template;
3c6e85
-	}
3c6e85
-	ha->fw_dump_template_len = dlen;
3c6e85
-	return rval;
3c6e85
-
3c6e85
-default_template:
3c6e85
-	ql_log(ql_log_warn, vha, 0x0168, "Using default fwdump template\n");
3c6e85
-	if (ha->fw_dump_template)
3c6e85
-		vfree(ha->fw_dump_template);
3c6e85
-	ha->fw_dump_template = NULL;
3c6e85
-	ha->fw_dump_template_len = 0;
3c6e85
-
3c6e85
-	dlen = qla27xx_fwdt_template_default_size();
3c6e85
-	ql_dbg(ql_dbg_init, vha, 0x0169,
3c6e85
-	    "-> template allocating %x bytes...\n", dlen);
3c6e85
-	ha->fw_dump_template = vmalloc(dlen);
3c6e85
-	if (!ha->fw_dump_template) {
3c6e85
-		ql_log(ql_log_warn, vha, 0x016a,
3c6e85
-		    "Failed fwdump template allocate %x bytes.\n", risc_size);
3c6e85
-		goto failed_template;
3c6e85
-	}
3c6e85
-
3c6e85
-	dcode = ha->fw_dump_template;
3c6e85
-	risc_size = dlen / sizeof(*dcode);
3c6e85
-	memcpy(dcode, qla27xx_fwdt_template_default(), dlen);
3c6e85
-	for (i = 0; i < risc_size; i++)
3c6e85
-		dcode[i] = be32_to_cpu(dcode[i]);
3c6e85
-
3c6e85
-	if (!qla27xx_fwdt_template_valid(ha->fw_dump_template)) {
3c6e85
-		ql_log(ql_log_warn, vha, 0x016b,
3c6e85
-		    "Failed fwdump template validate\n");
3c6e85
-		goto failed_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
-
3c6e85
-	dlen = qla27xx_fwdt_template_size(ha->fw_dump_template);
3c6e85
-	ql_dbg(ql_dbg_init, vha, 0x016c,
3c6e85
-	    "-> template size %x bytes\n", dlen);
3c6e85
 	ha->fw_dump_template_len = dlen;
3c6e85
 	return rval;
3c6e85
 
3c6e85
-failed_template:
3c6e85
-	ql_log(ql_log_warn, vha, 0x016d, "Failed default fwdump template\n");
3c6e85
+failed:
3c6e85
+	ql_log(ql_log_warn, vha, 0x016d, "Failed fwdump template\n");
3c6e85
 	if (ha->fw_dump_template)
3c6e85
 		vfree(ha->fw_dump_template);
3c6e85
 	ha->fw_dump_template = NULL;
3c6e85
@@ -7704,7 +7669,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
3c6e85
 	ql_dbg(ql_dbg_init, vha, 0x172,
3c6e85
 	    "-> array size %x dwords\n", risc_size);
3c6e85
 	if (risc_size == 0 || risc_size == ~0)
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 
3c6e85
 	dlen = (risc_size - 8) * sizeof(*fwcode);
3c6e85
 	ql_dbg(ql_dbg_init, vha, 0x0173,
3c6e85
@@ -7713,7 +7678,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
3c6e85
 	if (!ha->fw_dump_template) {
3c6e85
 		ql_log(ql_log_warn, vha, 0x0174,
3c6e85
 		    "Failed fwdump template allocate %x bytes.\n", risc_size);
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
 
3c6e85
 	fwcode += 7;
3c6e85
@@ -7725,7 +7690,7 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
3c6e85
 	if (!qla27xx_fwdt_template_valid(dcode)) {
3c6e85
 		ql_log(ql_log_warn, vha, 0x0175,
3c6e85
 		    "Failed fwdump template validate\n");
3c6e85
-		goto default_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
 
3c6e85
 	dlen = qla27xx_fwdt_template_size(dcode);
3c6e85
@@ -7735,48 +7700,13 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
3c6e85
 		ql_log(ql_log_warn, vha, 0x0177,
3c6e85
 		    "Failed fwdump template exceeds array by %zx bytes\n",
3c6e85
 		    (size_t)(dlen - risc_size * sizeof(*fwcode)));
3c6e85
-		goto default_template;
3c6e85
-	}
3c6e85
-	ha->fw_dump_template_len = dlen;
3c6e85
-	return rval;
3c6e85
-
3c6e85
-default_template:
3c6e85
-	ql_log(ql_log_warn, vha, 0x0178, "Using default fwdump template\n");
3c6e85
-	if (ha->fw_dump_template)
3c6e85
-		vfree(ha->fw_dump_template);
3c6e85
-	ha->fw_dump_template = NULL;
3c6e85
-	ha->fw_dump_template_len = 0;
3c6e85
-
3c6e85
-	dlen = qla27xx_fwdt_template_default_size();
3c6e85
-	ql_dbg(ql_dbg_init, vha, 0x0179,
3c6e85
-	    "-> template allocating %x bytes...\n", dlen);
3c6e85
-	ha->fw_dump_template = vmalloc(dlen);
3c6e85
-	if (!ha->fw_dump_template) {
3c6e85
-		ql_log(ql_log_warn, vha, 0x017a,
3c6e85
-		    "Failed fwdump template allocate %x bytes.\n", risc_size);
3c6e85
-		goto failed_template;
3c6e85
-	}
3c6e85
-
3c6e85
-	dcode = ha->fw_dump_template;
3c6e85
-	risc_size = dlen / sizeof(*fwcode);
3c6e85
-	fwcode = qla27xx_fwdt_template_default();
3c6e85
-	for (i = 0; i < risc_size; i++)
3c6e85
-		dcode[i] = be32_to_cpu(fwcode[i]);
3c6e85
-
3c6e85
-	if (!qla27xx_fwdt_template_valid(ha->fw_dump_template)) {
3c6e85
-		ql_log(ql_log_warn, vha, 0x017b,
3c6e85
-		    "Failed fwdump template validate\n");
3c6e85
-		goto failed_template;
3c6e85
+		goto failed;
3c6e85
 	}
3c6e85
-
3c6e85
-	dlen = qla27xx_fwdt_template_size(ha->fw_dump_template);
3c6e85
-	ql_dbg(ql_dbg_init, vha, 0x017c,
3c6e85
-	    "-> template size %x bytes\n", dlen);
3c6e85
 	ha->fw_dump_template_len = dlen;
3c6e85
 	return rval;
3c6e85
 
3c6e85
-failed_template:
3c6e85
-	ql_log(ql_log_warn, vha, 0x017d, "Failed default fwdump template\n");
3c6e85
+failed:
3c6e85
+	ql_log(ql_log_warn, vha, 0x017d, "Failed fwdump template\n");
3c6e85
 	if (ha->fw_dump_template)
3c6e85
 		vfree(ha->fw_dump_template);
3c6e85
 	ha->fw_dump_template = NULL;
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
3c6e85
index 6a0e94da4598..8e1a825aed39 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
3c6e85
@@ -7,97 +7,7 @@
3c6e85
 #include "qla_def.h"
3c6e85
 #include "qla_tmpl.h"
3c6e85
 
3c6e85
-/* note default template is in big endian */
3c6e85
-static const uint32_t ql27xx_fwdt_default_template[] = {
3c6e85
-	0x63000000, 0xa4000000, 0x7c050000, 0x00000000,
3c6e85
-	0x30000000, 0x01000000, 0x00000000, 0xc0406eb4,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
3c6e85
-	0x00000000, 0x04010000, 0x14000000, 0x00000000,
3c6e85
-	0x02000000, 0x44000000, 0x09010000, 0x10000000,
3c6e85
-	0x00000000, 0x02000000, 0x01010000, 0x1c000000,
3c6e85
-	0x00000000, 0x02000000, 0x00600000, 0x00000000,
3c6e85
-	0xc0000000, 0x01010000, 0x1c000000, 0x00000000,
3c6e85
-	0x02000000, 0x00600000, 0x00000000, 0xcc000000,
3c6e85
-	0x01010000, 0x1c000000, 0x00000000, 0x02000000,
3c6e85
-	0x10600000, 0x00000000, 0xd4000000, 0x01010000,
3c6e85
-	0x1c000000, 0x00000000, 0x02000000, 0x700f0000,
3c6e85
-	0x00000060, 0xf0000000, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x00700000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x10700000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x40700000, 0x041000c0,
3c6e85
-	0x01010000, 0x1c000000, 0x00000000, 0x02000000,
3c6e85
-	0x007c0000, 0x01000000, 0xc0000000, 0x00010000,
3c6e85
-	0x18000000, 0x00000000, 0x02000000, 0x007c0000,
3c6e85
-	0x040300c4, 0x00010000, 0x18000000, 0x00000000,
3c6e85
-	0x02000000, 0x007c0000, 0x040100c0, 0x01010000,
3c6e85
-	0x1c000000, 0x00000000, 0x02000000, 0x007c0000,
3c6e85
-	0x00000000, 0xc0000000, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x007c0000, 0x04200000,
3c6e85
-	0x0b010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x0c000000, 0x00000000, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000000b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000010b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000020b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000030b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000040b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000050b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000060b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000070b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000080b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x000090b0, 0x02010000, 0x20000000,
3c6e85
-	0x00000000, 0x02000000, 0x700f0000, 0x040100fc,
3c6e85
-	0xf0000000, 0x0000a0b0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x0a000000, 0x040100c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x0a000000, 0x04200080, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x00be0000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x10be0000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x20be0000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x30be0000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x00b00000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x10b00000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x20b00000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x30b00000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x00300000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x10300000, 0x041000c0, 0x00010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x20300000, 0x041000c0,
3c6e85
-	0x00010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x30300000, 0x041000c0, 0x0a010000, 0x10000000,
3c6e85
-	0x00000000, 0x02000000, 0x06010000, 0x1c000000,
3c6e85
-	0x00000000, 0x02000000, 0x01000000, 0x00000200,
3c6e85
-	0xff230200, 0x06010000, 0x1c000000, 0x00000000,
3c6e85
-	0x02000000, 0x02000000, 0x00001000, 0x00000000,
3c6e85
-	0x07010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x00000000, 0x01000000, 0x07010000, 0x18000000,
3c6e85
-	0x00000000, 0x02000000, 0x00000000, 0x02000000,
3c6e85
-	0x07010000, 0x18000000, 0x00000000, 0x02000000,
3c6e85
-	0x00000000, 0x03000000, 0x0d010000, 0x14000000,
3c6e85
-	0x00000000, 0x02000000, 0x00000000, 0xff000000,
3c6e85
-	0x10000000, 0x00000000, 0x00000080,
3c6e85
-};
3c6e85
+#define IOBASE(reg)	offsetof(typeof(*reg), iobase_addr)
3c6e85
 
3c6e85
 static inline void __iomem *
3c6e85
 qla27xx_isp_reg(struct scsi_qla_host *vha)
3c6e85
@@ -1032,18 +942,6 @@ qla27xx_fwdt_template_size(void *p)
3c6e85
 	return tmp->template_size;
3c6e85
 }
3c6e85
 
3c6e85
-ulong
3c6e85
-qla27xx_fwdt_template_default_size(void)
3c6e85
-{
3c6e85
-	return sizeof(ql27xx_fwdt_default_template);
3c6e85
-}
3c6e85
-
3c6e85
-const void *
3c6e85
-qla27xx_fwdt_template_default(void)
3c6e85
-{
3c6e85
-	return ql27xx_fwdt_default_template;
3c6e85
-}
3c6e85
-
3c6e85
 int
3c6e85
 qla27xx_fwdt_template_valid(void *p)
3c6e85
 {
3c6e85
-- 
3c6e85
2.13.6
3c6e85