From patchwork Mon Mar 11 18:03:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10847955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1715D139A for ; Mon, 11 Mar 2019 18:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036CE29291 for ; Mon, 11 Mar 2019 18:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB061292C2; Mon, 11 Mar 2019 18:05:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 680E929291 for ; Mon, 11 Mar 2019 18:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727847AbfCKSFn (ORCPT ); Mon, 11 Mar 2019 14:05:43 -0400 Received: from mail-eopbgr770053.outbound.protection.outlook.com ([40.107.77.53]:18041 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728037AbfCKSFm (ORCPT ); Mon, 11 Mar 2019 14:05:42 -0400 Received: from BYAPR07CA0010.namprd07.prod.outlook.com (2603:10b6:a02:bc::23) by MW2PR07MB4028.namprd07.prod.outlook.com (2603:10b6:907:6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.19; Mon, 11 Mar 2019 18:05:38 +0000 Received: from DM3NAM05FT010.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by BYAPR07CA0010.outlook.office365.com (2603:10b6:a02:bc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Mon, 11 Mar 2019 18:05:38 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by DM3NAM05FT010.mail.protection.outlook.com (10.152.98.117) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1709.11 via Frontend Transport; Mon, 11 Mar 2019 18:05:37 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Mon, 11 Mar 2019 11:04:30 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x2BI4Tem030355; Mon, 11 Mar 2019 11:04:29 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2BI4Sue030354; Mon, 11 Mar 2019 11:04:28 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 10/14] qla2xxx: Correction and improvement to fwdt processing Date: Mon, 11 Mar 2019 11:03:55 -0700 Message-ID: <20190311180359.30276-11-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190311180359.30276-1-hmadhani@marvell.com> References: <20190311180359.30276-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131968011380007339;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(396003)(346002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(97736004)(316002)(53936002)(48376002)(6666004)(356004)(26005)(36906005)(81156014)(5660300002)(50466002)(36756003)(69596002)(80596001)(85426001)(76176011)(81166006)(8676002)(51416003)(8936002)(50226002)(26826003)(1076003)(47776003)(498600001)(106466001)(305945005)(11346002)(486006)(87636003)(476003)(446003)(105606002)(126002)(86362001)(2616005)(68736007)(4326008)(16586007)(42186006)(336012)(110136005)(54906003)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR07MB4028;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a7aa5b9-e3e5-45ca-d37a-08d6a64c2a7b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:MW2PR07MB4028; X-MS-TrafficTypeDiagnostic: MW2PR07MB4028: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09730BD177 X-Microsoft-Exchange-Diagnostics: 1;MW2PR07MB4028;23:XmnM/EOAuybkoH471ookIHq3qSxtzUZbAh9Dt0QmGSaW8uxgsV6lY2I+e9Qk6f9JI0b8DEvotxLtyRUuNASgbz+/LkwD6qUilF2IXRfJNjGGcA1zQLCnNffeFhFgWhUJ2ZRyH9sghz+Io2+j/0iM0v7Z5tit9AoSwPic3aWMw0XOqqh/sT5y2u2w03Aj0rCnDmF7XwKgFIRKlkkUZWmqCKWR6CAdJ3LH0G8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VY88py76qsJ/Fdi3F8tFMqNBgt10rk2fmjUH4lwewaVbrK9O/Wdcncy2Vj1vrwCeqNA4VesZ7YFR+40Hk6cMnZ0Vj/6XwSZJHBTnA4p3YOZxSuvjXL/3xOuoQE5J+Kg1jFXfpJ95PtrkP+ap1rzrQhM6eYa0h6x0SmHcxEi0zOhzdJoZeDwU+MUN2fP9iPdWWtbmNM4hSYOSywIGdudcuZcFhPpaI7R/v5kjf+KfKFLoZKmudbKnVhQLHP43djnbWeBJi4v00CjV3YhnD5rJAe7IIbpOeIfUZkGE9YZMW8oUJcNjuRuDCZBh+Bhix4+BgSeJZDn79z2J7QBIuR0HusDLSU+iQd26zYiuuSAKJlCH8ZhrsWTuPudcfYiDI2gtMD4/Dv5158EpMynw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2019 18:05:37.6614 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a7aa5b9-e3e5-45ca-d37a-08d6a64c2a7b X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR07MB4028 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joe Carnuccio This patch cleans up and fixes firmware dump template processing. These changes are added to support newer features for ISP27XX/ISP28XX. Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_tmpl.c | 43 +++++++++++++++++++++++------------------ drivers/scsi/qla2xxx/qla_tmpl.h | 2 +- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 428d94614a23..4bc958f5bda3 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -99,9 +99,9 @@ static inline void qla27xx_write_reg(__iomem struct device_reg_24xx *reg, uint offset, uint32_t data, void *buf) { - __iomem void *window = (void __iomem *)reg + offset; - if (buf) { + void __iomem *window = (void __iomem *)reg + offset; + WRT_REG_DWORD(window, data); } } @@ -709,10 +709,10 @@ qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha, goto done; } if (offset + length > size) { + length = size - offset; ql_dbg(ql_dbg_misc, vha, 0xd030, - "%s: buffer overflow\n", __func__); - qla27xx_skip_entry(ent, buf); - goto done; + "%s: buffer overflow, truncate [%lx]\n", __func__, length); + ent->t275.length = length; } qla27xx_insertbuf(buffer, length, buf, len); @@ -724,17 +724,22 @@ static struct qla27xx_fwdt_entry * qla27xx_fwdt_entry_t276(struct scsi_qla_host *vha, struct qla27xx_fwdt_entry *ent, void *buf, ulong *len) { - ulong cond1 = le32_to_cpu(ent->t276.cond1); - ulong cond2 = le32_to_cpu(ent->t276.cond2); - uint type = vha->hw->pdev->device >> 4 & 0xf; - uint func = vha->hw->port_no & 0x3; - ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd214, "%s: cond [%lx]\n", __func__, *len); - if (type != cond1 || func != cond2) { - ent = qla27xx_next_entry(ent); - qla27xx_skip_entry(ent, buf); + if (buf) { + ulong cond1 = le32_to_cpu(ent->t276.cond1); + ulong cond2 = le32_to_cpu(ent->t276.cond2); + uint type = vha->hw->pdev->device >> 4 & 0xf; + uint func = vha->hw->port_no & 0x3; + + if (type != cond1 || func != cond2) { + struct qla27xx_fwdt_template *tmp = buf; + + tmp->count--; + ent = qla27xx_next_entry(ent); + qla27xx_skip_entry(ent, buf); + } } return qla27xx_next_entry(ent); @@ -840,21 +845,21 @@ qla27xx_walk_template(struct scsi_qla_host *vha, { struct qla27xx_fwdt_entry *ent = (void *)tmp + le32_to_cpu(tmp->entry_offset); - ulong count = le32_to_cpu(tmp->entry_count); - ulong type = 0; + ulong type; + tmp->count = le32_to_cpu(tmp->entry_count); ql_dbg(ql_dbg_misc, vha, 0xd01a, - "%s: entry count %lx\n", __func__, count); - while (count--) { + "%s: entry count %u\n", __func__, tmp->count); + while (ent && tmp->count--) { type = le32_to_cpu(ent->hdr.type); ent = qla27xx_find_entry(type)(vha, ent, buf, len); if (!ent) break; } - if (count) + if (tmp->count) ql_dbg(ql_dbg_misc, vha, 0xd018, - "%s: entry count residual=+%lu\n", __func__, count); + "%s: entry count residual=+%u\n", __func__, tmp->count); if (ent) ql_dbg(ql_dbg_misc, vha, 0xd019, diff --git a/drivers/scsi/qla2xxx/qla_tmpl.h b/drivers/scsi/qla2xxx/qla_tmpl.h index c8360812660c..5c72293cffeb 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.h +++ b/drivers/scsi/qla2xxx/qla_tmpl.h @@ -14,7 +14,7 @@ struct __packed qla27xx_fwdt_template { __le32 template_type; __le32 entry_offset; uint32_t template_size; - uint32_t reserved_1; + uint32_t count; /* borrow field for running/residual count */ __le32 entry_count; uint32_t template_version;