Blame SOURCES/0154-scsi-scsi-qla2xxx-Added-support-for-MPI-and-PEP-regi.patch

3c6e85
From 24f2b9e89af864a9a7fb53678ec046383e37db31 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Mon, 16 Dec 2019 17:58:32 -0500
3c6e85
Subject: [PATCH 154/155] [scsi] scsi: qla2xxx: Added support for MPI and PEP
3c6e85
 regions for ISP28XX
3c6e85
3c6e85
Message-id: <20191216175833.14530-3-hmadhani@redhat.com>
3c6e85
Patchwork-id: 292027
3c6e85
Patchwork-instance: patchwork
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 2/3] scsi: qla2xxx: Added support for MPI and PEP regions for ISP28XX
3c6e85
Bugzilla: 1783016
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
RH-Acked-by: Ewan Milne <emilne@redhat.com>
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
3c6e85
From: Michael Hernandez <mhernandez@marvell.com>
3c6e85
3c6e85
Bugzilla 1783016
3c6e85
3c6e85
This patch adds support for MPI/PEP region updates which is required with
3c6e85
secure flash updates for ISP28XX.
3c6e85
3c6e85
Fixes: 3f006ac342c0 ("scsi: qla2xxx: Secure flash update support for ISP28XX")
3c6e85
Cc: stable@vger.kernel.org
3c6e85
Link: https://lore.kernel.org/r/20191203223657.22109-3-hmadhani@marvell.com
3c6e85
Signed-off-by: Michael Hernandez <mhernandez@marvell.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 a530bf691f0e4691214562c165e6c8889dc51e57)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_fw.h  |  4 ++++
3c6e85
 drivers/scsi/qla2xxx/qla_sup.c | 27 ++++++++++++++++++++++-----
3c6e85
 2 files changed, 26 insertions(+), 5 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
3c6e85
index d2bf3a7fd643..f0bb335aa91a 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_fw.h
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_fw.h
3c6e85
@@ -1526,6 +1526,10 @@ struct qla_flt_header {
3c6e85
 #define FLT_REG_NVRAM_SEC_28XX_1	0x10F
3c6e85
 #define FLT_REG_NVRAM_SEC_28XX_2	0x111
3c6e85
 #define FLT_REG_NVRAM_SEC_28XX_3	0x113
3c6e85
+#define FLT_REG_MPI_PRI_28XX		0xD3
3c6e85
+#define FLT_REG_MPI_SEC_28XX		0xF0
3c6e85
+#define FLT_REG_PEP_PRI_28XX		0xD1
3c6e85
+#define FLT_REG_PEP_SEC_28XX		0xF1
3c6e85
 
3c6e85
 struct qla_flt_region {
3c6e85
 	uint16_t code;
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
3c6e85
index a7d69a0b3436..d65a34007271 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_sup.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_sup.c
3c6e85
@@ -2723,8 +2723,11 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
3c6e85
 		ql_log(ql_log_warn + ql_dbg_verbose, vha, 0xffff,
3c6e85
 		    "Region %x is secure\n", region.code);
3c6e85
 
3c6e85
-		if (region.code == FLT_REG_FW ||
3c6e85
-		    region.code == FLT_REG_FW_SEC_27XX) {
3c6e85
+		switch (region.code) {
3c6e85
+		case FLT_REG_FW:
3c6e85
+		case FLT_REG_FW_SEC_27XX:
3c6e85
+		case FLT_REG_MPI_PRI_28XX:
3c6e85
+		case FLT_REG_MPI_SEC_28XX:
3c6e85
 			fw_array = dwptr;
3c6e85
 
3c6e85
 			/* 1st fw array */
3c6e85
@@ -2755,9 +2758,23 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
3c6e85
 				buf_size_without_sfub += risc_size;
3c6e85
 				fw_array += risc_size;
3c6e85
 			}
3c6e85
-		} else {
3c6e85
-			ql_log(ql_log_warn + ql_dbg_verbose, vha, 0xffff,
3c6e85
-			    "Secure region %x not supported\n",
3c6e85
+			break;
3c6e85
+
3c6e85
+		case FLT_REG_PEP_PRI_28XX:
3c6e85
+		case FLT_REG_PEP_SEC_28XX:
3c6e85
+			fw_array = dwptr;
3c6e85
+
3c6e85
+			/* 1st fw array */
3c6e85
+			risc_size = be32_to_cpu(fw_array[3]);
3c6e85
+			risc_attr = be32_to_cpu(fw_array[9]);
3c6e85
+
3c6e85
+			buf_size_without_sfub = risc_size;
3c6e85
+			fw_array += risc_size;
3c6e85
+			break;
3c6e85
+
3c6e85
+		default:
3c6e85
+			ql_log(ql_log_warn + ql_dbg_verbose, vha,
3c6e85
+			    0xffff, "Secure region %x not supported\n",
3c6e85
 			    region.code);
3c6e85
 			rval = QLA_COMMAND_ERROR;
3c6e85
 			goto done;
3c6e85
-- 
3c6e85
2.13.6
3c6e85