|
|
3c6e85 |
From 521a49b3f4e78aa417e2df40d24dfbc467e0e0ee Mon Sep 17 00:00:00 2001
|
|
|
3c6e85 |
From: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Date: Thu, 1 Aug 2019 15:54:58 -0400
|
|
|
3c6e85 |
Subject: [PATCH 038/124] [scsi] scsi: qla2xxx: Correction and improvement to
|
|
|
3c6e85 |
fwdt processing
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Message-id: <20190801155618.12650-39-hmadhani@redhat.com>
|
|
|
3c6e85 |
Patchwork-id: 267813
|
|
|
3c6e85 |
O-Subject: [RHEL 7.8 e-stor PATCH 038/118] scsi: qla2xxx: Correction and improvement to fwdt processing
|
|
|
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 cleans up and fixes firmware dump template processing. These
|
|
|
3c6e85 |
changes are added to support newer features for ISP27XX/ISP28XX.
|
|
|
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 2ff0167151f50f38c103c2e8e08e542cd8727441)
|
|
|
3c6e85 |
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
|
3c6e85 |
---
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_tmpl.c | 43 +++++++++++++++++++++++------------------
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_tmpl.h | 2 +-
|
|
|
3c6e85 |
2 files changed, 25 insertions(+), 20 deletions(-)
|
|
|
3c6e85 |
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
|
|
|
3c6e85 |
index 97525263b457..122ed68add12 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
|
|
|
3c6e85 |
@@ -99,9 +99,9 @@ static inline void
|
|
|
3c6e85 |
qla27xx_write_reg(__iomem struct device_reg_24xx *reg,
|
|
|
3c6e85 |
uint offset, uint32_t data, void *buf)
|
|
|
3c6e85 |
{
|
|
|
3c6e85 |
- __iomem void *window = (void __iomem *)reg + offset;
|
|
|
3c6e85 |
-
|
|
|
3c6e85 |
if (buf) {
|
|
|
3c6e85 |
+ void __iomem *window = (void __iomem *)reg + offset;
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
WRT_REG_DWORD(window, data);
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
@@ -709,10 +709,10 @@ qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha,
|
|
|
3c6e85 |
goto done;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
if (offset + length > size) {
|
|
|
3c6e85 |
+ length = size - offset;
|
|
|
3c6e85 |
ql_dbg(ql_dbg_misc, vha, 0xd030,
|
|
|
3c6e85 |
- "%s: buffer overflow\n", __func__);
|
|
|
3c6e85 |
- qla27xx_skip_entry(ent, buf);
|
|
|
3c6e85 |
- goto done;
|
|
|
3c6e85 |
+ "%s: buffer overflow, truncate [%lx]\n", __func__, length);
|
|
|
3c6e85 |
+ ent->t275.length = cpu_to_le32(length);
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
qla27xx_insertbuf(buffer, length, buf, len);
|
|
|
3c6e85 |
@@ -724,17 +724,22 @@ static struct qla27xx_fwdt_entry *
|
|
|
3c6e85 |
qla27xx_fwdt_entry_t276(struct scsi_qla_host *vha,
|
|
|
3c6e85 |
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
|
|
|
3c6e85 |
{
|
|
|
3c6e85 |
- ulong cond1 = le32_to_cpu(ent->t276.cond1);
|
|
|
3c6e85 |
- ulong cond2 = le32_to_cpu(ent->t276.cond2);
|
|
|
3c6e85 |
- uint type = vha->hw->pdev->device >> 4 & 0xf;
|
|
|
3c6e85 |
- uint func = vha->hw->port_no & 0x3;
|
|
|
3c6e85 |
-
|
|
|
3c6e85 |
ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd214,
|
|
|
3c6e85 |
"%s: cond [%lx]\n", __func__, *len);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
- if (type != cond1 || func != cond2) {
|
|
|
3c6e85 |
- ent = qla27xx_next_entry(ent);
|
|
|
3c6e85 |
- qla27xx_skip_entry(ent, buf);
|
|
|
3c6e85 |
+ if (buf) {
|
|
|
3c6e85 |
+ ulong cond1 = le32_to_cpu(ent->t276.cond1);
|
|
|
3c6e85 |
+ ulong cond2 = le32_to_cpu(ent->t276.cond2);
|
|
|
3c6e85 |
+ uint type = vha->hw->pdev->device >> 4 & 0xf;
|
|
|
3c6e85 |
+ uint func = vha->hw->port_no & 0x3;
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
+ if (type != cond1 || func != cond2) {
|
|
|
3c6e85 |
+ struct qla27xx_fwdt_template *tmp = buf;
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
+ tmp->count--;
|
|
|
3c6e85 |
+ ent = qla27xx_next_entry(ent);
|
|
|
3c6e85 |
+ qla27xx_skip_entry(ent, buf);
|
|
|
3c6e85 |
+ }
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
return qla27xx_next_entry(ent);
|
|
|
3c6e85 |
@@ -840,21 +845,21 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
|
|
|
3c6e85 |
{
|
|
|
3c6e85 |
struct qla27xx_fwdt_entry *ent = (void *)tmp +
|
|
|
3c6e85 |
le32_to_cpu(tmp->entry_offset);
|
|
|
3c6e85 |
- ulong count = le32_to_cpu(tmp->entry_count);
|
|
|
3c6e85 |
- ulong type = 0;
|
|
|
3c6e85 |
+ ulong type;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
+ tmp->count = le32_to_cpu(tmp->entry_count);
|
|
|
3c6e85 |
ql_dbg(ql_dbg_misc, vha, 0xd01a,
|
|
|
3c6e85 |
- "%s: entry count %lx\n", __func__, count);
|
|
|
3c6e85 |
- while (count--) {
|
|
|
3c6e85 |
+ "%s: entry count %u\n", __func__, tmp->count);
|
|
|
3c6e85 |
+ while (ent && tmp->count--) {
|
|
|
3c6e85 |
type = le32_to_cpu(ent->hdr.type);
|
|
|
3c6e85 |
ent = qla27xx_find_entry(type)(vha, ent, buf, len);
|
|
|
3c6e85 |
if (!ent)
|
|
|
3c6e85 |
break;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
- if (count)
|
|
|
3c6e85 |
+ if (tmp->count)
|
|
|
3c6e85 |
ql_dbg(ql_dbg_misc, vha, 0xd018,
|
|
|
3c6e85 |
- "%s: entry count residual=+%lu\n", __func__, count);
|
|
|
3c6e85 |
+ "%s: entry count residual=+%u\n", __func__, tmp->count);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
if (ent)
|
|
|
3c6e85 |
ql_dbg(ql_dbg_misc, vha, 0xd019,
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.h b/drivers/scsi/qla2xxx/qla_tmpl.h
|
|
|
3c6e85 |
index 036194234430..723b9d537c62 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_tmpl.h
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_tmpl.h
|
|
|
3c6e85 |
@@ -14,7 +14,7 @@ struct __packed qla27xx_fwdt_template {
|
|
|
3c6e85 |
__le32 template_type;
|
|
|
3c6e85 |
__le32 entry_offset;
|
|
|
3c6e85 |
uint32_t template_size;
|
|
|
3c6e85 |
- uint32_t reserved_1;
|
|
|
3c6e85 |
+ uint32_t count; /* borrow field for running/residual count */
|
|
|
3c6e85 |
|
|
|
3c6e85 |
__le32 entry_count;
|
|
|
3c6e85 |
uint32_t template_version;
|
|
|
3c6e85 |
--
|
|
|
3c6e85 |
2.13.6
|
|
|
3c6e85 |
|