From patchwork Tue Mar 12 18:08:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10849727 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 039F81850 for ; Tue, 12 Mar 2019 18:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E57FB2977C for ; Tue, 12 Mar 2019 18:10:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9BA3297A1; Tue, 12 Mar 2019 18:10:04 +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 49D4E2977C for ; Tue, 12 Mar 2019 18:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728528AbfCLSKD (ORCPT ); Tue, 12 Mar 2019 14:10:03 -0400 Received: from mail-eopbgr760082.outbound.protection.outlook.com ([40.107.76.82]:34243 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728848AbfCLSKB (ORCPT ); Tue, 12 Mar 2019 14:10:01 -0400 Received: from CO2PR07CA0078.namprd07.prod.outlook.com (2603:10b6:100::46) by BL0PR07MB4017.namprd07.prod.outlook.com (2603:10b6:207:4b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.20; Tue, 12 Mar 2019 18:09:57 +0000 Received: from DM3NAM05FT040.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::209) by CO2PR07CA0078.outlook.office365.com (2603:10b6:100::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.18 via Frontend Transport; Tue, 12 Mar 2019 18:09:57 +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 DM3NAM05FT040.mail.protection.outlook.com (10.152.98.154) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1709.11 via Frontend Transport; Tue, 12 Mar 2019 18:09:56 +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; Tue, 12 Mar 2019 11:08:52 -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 x2CI8qVP025706; Tue, 12 Mar 2019 11:08:52 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2CI8qHs025705; Tue, 12 Mar 2019 11:08:52 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v4 10/14] qla2xxx: Correction and improvement to fwdt processing Date: Tue, 12 Mar 2019 11:08:19 -0700 Message-ID: <20190312180823.25631-11-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190312180823.25631-1-hmadhani@marvell.com> References: <20190312180823.25631-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131968877968896198;(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)(396003)(346002)(136003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(2616005)(53936002)(476003)(8676002)(68736007)(126002)(85426001)(11346002)(97736004)(81156014)(50226002)(76176011)(486006)(81166006)(47776003)(316002)(36906005)(305945005)(6666004)(336012)(16586007)(26826003)(51416003)(498600001)(54906003)(87636003)(110136005)(356004)(42186006)(8936002)(2906002)(4326008)(50466002)(48376002)(105606002)(26005)(86362001)(106466001)(80596001)(69596002)(446003)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR07MB4017;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 953b62da-bc5d-4694-673c-08d6a715ef2d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:BL0PR07MB4017; X-MS-TrafficTypeDiagnostic: BL0PR07MB4017: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09749A275C X-Microsoft-Exchange-Diagnostics: 1;BL0PR07MB4017;23:ojoypZWDWmiAF+sbPJTl4UWp4WN73KasRrsxHV6D3BdXM3QMITI29Rh9+MWNIfKZl0W97LA4baNGWCtQnpsKhs20SbyfhGksj8unF5RRex63yP0UfuOpQNbrN15UAYH2cFJGN+7nngT2mCwwJwQBq8Cphhcw1HNZXr3PZS78i+Lv5oNDp/zVbD2wtKlQDkvDK4ddE9zXo4rUaplrYV1a38rk1yf02M57dXKvnFQIGhOeb0U1hFyKEcJV0+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AhqVnicbMD/MzlwfhWwjmdcJICYn2ijAhuVP1lDb18IAw9EcrME0J4yKFGbqTcEAH8guIFY2W/okIu7pEib8mOKmSu1fvO/knSazgjt9gLhyn8jFBUW4w5mpaQw7wfc4gdKYokUi6ZwlQujVdVR6z/A3LOQ+KBhpcqVov9KKE15+tMiKL6/0l+SzS3VDUqpUOCm0Nub7HnDAg45LzFJhmuuEcKEdybbRF5KNTjCHwuZ9XtxtvvVmPDd+16quTPQXeZ+PemF4PqsdUfEmAU292EEtZfExvwBlkOTtIq10PKdNBP3qp3rJrJDUZK5EEh1FJgptn25BsIEewPA2WGsDcYRsRZKgPLoJDd4nY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2019 18:09:56.4302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 953b62da-bc5d-4694-673c-08d6a715ef2d 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: BL0PR07MB4017 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 da1eb5644188..9f8a7a3d6726 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 = cpu_to_le32(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 6ce7fff014ee..d2a0014e8b21 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;