From patchwork Thu Dec 21 17:34:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10128103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48A1160390 for ; Thu, 21 Dec 2017 17:35:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 359DB29CE3 for ; Thu, 21 Dec 2017 17:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2891929D37; Thu, 21 Dec 2017 17:35:01 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 70CA929CE3 for ; Thu, 21 Dec 2017 17:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753961AbdLURe5 (ORCPT ); Thu, 21 Dec 2017 12:34:57 -0500 Received: from mail-bl2nam02on0061.outbound.protection.outlook.com ([104.47.38.61]:37408 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753926AbdLURei (ORCPT ); Thu, 21 Dec 2017 12:34:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1v3ROy2Jj08DUuJ6seNjPYPc9vbxxCBtJUZ4zE77dJc=; b=UP27EHt8u5qtrDGRjCbw8DDE27E5H9hJnGFwdb6WhFmeveB+d17SZZlkX7ktXmFSDCa491VEhOgjmRxnRnnrg0k/r/ho0vNnAbKiXbiPLwGrjMqCkq3OR3TiESo7TvicEF6N8q2tIFJ51H8LOL8OfIcFSm+SsbAC51bQjjpXL5Q= Received: from MWHPR0201CA0065.namprd02.prod.outlook.com (10.167.160.42) by CY1PR0201MB1836.namprd02.prod.outlook.com (10.163.55.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Thu, 21 Dec 2017 17:34:36 +0000 Received: from BN1BFFO11FD012.protection.gbl (2a01:111:f400:7c10::1:173) by MWHPR0201CA0065.outlook.office365.com (2603:10b6:301:73::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Thu, 21 Dec 2017 17:34:36 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; linux.vnet.ibm.com; dkim=none (message not signed) header.d=none; linux.vnet.ibm.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1BFFO11FD012.mail.protection.outlook.com (10.58.144.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Thu, 21 Dec 2017 17:34:22 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 21 Dec 2017 09:34:23 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 09/29] scsi: aacraid: Create bmic submission function from bmic identify Date: Thu, 21 Dec 2017 09:34:00 -0800 Message-ID: <20171221173420.8213-10-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(39860400002)(396003)(2980300002)(438002)(199004)(189003)(59450400001)(51416003)(76176011)(50226002)(2201001)(69596002)(36756003)(53936002)(57986006)(76506005)(48376002)(50466002)(1076002)(4326008)(104016004)(356003)(106466001)(81166006)(81156014)(8676002)(8936002)(47776003)(106002)(97736004)(305945005)(68736007)(575784001)(72206003)(2906002)(316002)(86362001)(6666003)(16586007)(2950100002)(5660300001)(77096006)(110136005)(478600001)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1836; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD012; 1:XJzVz1OcLZIQAsSvEz/N1gNdyuF3E7euT47Qw/ix+Lw/hfJvzgUkJqZ/nJXsPI2kiPyviuRSDxYQrDp0zaeayjMfjgmiyLnOLQ0zPI82HrZ25xios5JI1f7CkegES0yJ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81a31193-9b6e-46ac-3be8-08d5489912d9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CY1PR0201MB1836; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB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M0+VwCF23xokyZ/DMrrePKkba7u8QqykRA2bgWktZ7loCiOjjCNELCg1LN4CBLFUg8jCG2z8hXNcFzZyB0WUTOcNqZXoN+9gOrKT+hli2pbNlOuJXGa9WFPKWharVyn2HUc3s/KuHcNXuu0QDEMVHjDmFvFrcXURpaW+x5x67UoeGy9KeA/ap5YwRJtIDD1zxNFAPio7g6d1MXJRChky84abSuIaj85c7b+b0d7+lV00uGIcehoGlVkwnyTmCgIaB8Q5v/rYSBVc2qXNtnuFeA2AmyHsR94kF86KsCOZ+nCcqrSr/T8ubJ7/bk8XDBT6vyJPgMbpmOmLKzJjNFhAfyN+C6s/2ire2ndv3tN6R8NhK/I5U63TYM5Vtzd061ZPyJCh0wMTb87mpQg5HPJBsjEcrbla3qqMdX8Xk7MFapJ6hddkHfx6jBnynsYXW/9bk9+iYEPnVg+3HYEJzy+yInav3xMWfhZ/7arE1tIYeLGUUxnyElfvzkL4XVNAVAy3dJzcjTKEVwJGozBJYVcDQYL/ESYZbOugx2k45Z6dLnkakId1Czfm2n2EHLhmGSc4js= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93004095)(3231023)(10201501046)(3002001)(6055026)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:CY1PR0201MB1836; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0201MB1836; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1836; 4:NVxGZo3xhQuD2LIIU+jY84tjJmyXS0l9QXvRl4HLl3zF4ZYgHAQ7ynvZsleO6RKMGfY4hUA12mJ9nrdJt08FxfEbMgE2tbMOBUfkO2/kbY1u0uh3bt1Jqz6gZJu4qAKaWa2BC3Ro554HoLeQQmo4RMp1ylUflkrrBlJStNrYTEKFbabOi7+/ki6jH8dYdEGvzogXx6/BUEY126dlqZhSpFvdveAiPS/sTPJAlhotM5d8wJNR4Fhi6KyDcojc9Jk16VVrmA6Jc4dKWCwMA5aaeroL2MDHACC5IiqlwFH3HkTI+h3WoWuBAK+YiaivOrbc X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0201MB1836; 23:sN0dHhDjOKuM8zP4vRVM+3DhgXYpe9ABqAWFUL+?= =?us-ascii?Q?N+kCdxavLjhp/o4bK9ROjyB+fssDHHtu3ykO5sS/B05tbdMrUZPUa++zCLvn?= =?us-ascii?Q?mNTJ1ZfVjDB3QGKD+bJhSiJcs6ybDTIR+IIVHEsxOZ0FeHMiSimsAVpfDGeh?= =?us-ascii?Q?X0nQSm8HwoMkACeNbcA4ccgAsswHUjymB3/Z/a/AGrAm2QljBRRS4/0c8e5B?= =?us-ascii?Q?9o5tQPHrGnMYmNazDrAcZCQLZc0IWmC7XilLxxhLX6t1w1/XrCiKx0MxMNHk?= =?us-ascii?Q?Tk4kNNyJW60rgaa5Lkq2y5JbAPJo/pujvBPt8ksDC/fTqUytHXfb6BiR18vQ?= =?us-ascii?Q?y/ZTZHLq+Nn1r1t4v71c2SUp3SkoieCA2CI51uFn5HecuiGFlnFabTs5K0Iw?= =?us-ascii?Q?9dqBHpdbCF21oKDwddEFLazxBq+Pdg1TWCT43CnIofAEXwmwtCEwN/hy+221?= =?us-ascii?Q?qrP62YCoKNieVEmFp40rNtj2AsDkAcc15DCeI/GXVukSls2gXzX7I3cm7sZH?= =?us-ascii?Q?8MnamcYEZemMFHF7j9jL7AOwqGivfAQZ1OTkxdE87ujSSIkPhBZfb1VgvKQv?= =?us-ascii?Q?wjSm0vMKtnJ/ipCXy6tEydCKh6gyC5h2pqmZ/21nkVhPUHYbWK2JIa3Tjrgj?= =?us-ascii?Q?swLJqpLAMBu5c9H5LEokfNMzuxjqKU3mnD1MG65syq5Bq97re3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g1nq2LfWIqkxIVdrvC8+72g35puwuuQFatlTAFYqY7PFj3XgdKu9pu0jtB9y+1AShvTR4q46KbfLsphiyM=; 24:san6FZWFzJgPOT9sabehpL6ZA4K9e68HrhbAgYU6j6WSb2FT8rPE3OBN8cOMTzdQr0GcYjXRdcnVFLPgiAKvzNmrCV9gamws2Ki8AW7J7FA=; 7:9hJg/defaAPjU94jZ+8MwKBAXP9eoxdh9wZyrpvI/osn1uErxMZMaig1PX7zvKGW04Dd4/JxLTPOHy4KVCDwgt9/iRsV5luoiT8T2Z8aYpNdkLlhco6OwdTbxfjyMceWLL8Xt8rjXv+RivuZZeGk5P0luQ6Kju38T2gjdI7UyPmyeitKdunKVNLMQ9jChhuvA9XW+872qzNspgcnPzi//8U5w8dS6no9F85aBvvP/KFfpkMEckdESq5IRGVor9X9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:22.2783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81a31193-9b6e-46ac-3be8-08d5489912d9 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1836 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 safw command submission is duplicated across many functions. Move the safw submission code from bmic identify into its own function for common use Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/aachba.c | 147 +++++++++++++++++++++++++++-------------- drivers/scsi/aacraid/aacraid.h | 7 +- 2 files changed, 105 insertions(+), 49 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index f264515..8d119e1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1670,60 +1670,116 @@ static int aac_adapter_hba(struct fib *fib, struct scsi_cmnd *cmd) (void *) cmd); } -int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) +static int aac_send_safw_bmic_cmd(struct aac_dev *dev, + struct aac_srb_unit *srbu, void *xfer_buf, int xfer_len) { - struct fib *fibptr; - struct aac_srb *srbcmd; - struct sgmap64 *sg64; - struct aac_ciss_identify_pd *identify_resp; - dma_addr_t addr; - u32 vbus, vid; - u16 fibsize, datasize; - int rcode = -ENOMEM; - + struct fib *fibptr; + dma_addr_t addr; + int rcode; + int fibsize; + struct aac_srb *srb; + struct aac_srb_reply *srb_reply; + struct sgmap64 *sg64; + u32 vbus; + u32 vid; + + if (!dev->sa_firmware) + return 0; + /* allocate FIB */ fibptr = aac_fib_alloc(dev); if (!fibptr) - goto out; + return -ENOMEM; - fibsize = sizeof(struct aac_srb) - - sizeof(struct sgentry) + sizeof(struct sgentry64); - datasize = sizeof(struct aac_ciss_identify_pd); + aac_fib_init(fibptr); + fibptr->hw_fib_va->header.XferState &= + ~cpu_to_le32(FastResponseCapable); - identify_resp = dma_alloc_coherent(&dev->pdev->dev, datasize, &addr, - GFP_KERNEL); - if (!identify_resp) - goto fib_free_ptr; + fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) + + sizeof(struct sgentry64); - vbus = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_bus); - vid = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_target); + /* allocate DMA buffer for response */ + addr = dma_map_single(&dev->pdev->dev, xfer_buf, xfer_len, + DMA_BIDIRECTIONAL); + if (dma_mapping_error(&dev->pdev->dev, addr)) { + rcode = -ENOMEM; + goto fib_error; + } - aac_fib_init(fibptr); + srb = fib_data(fibptr); + memcpy(srb, &srbu->srb, sizeof(struct aac_srb)); - srbcmd = (struct aac_srb *) fib_data(fibptr); - srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); - srbcmd->channel = cpu_to_le32(vbus); - srbcmd->id = cpu_to_le32(vid); - srbcmd->lun = 0; - srbcmd->flags = cpu_to_le32(SRB_DataIn); - srbcmd->timeout = cpu_to_le32(10); - srbcmd->retry_limit = 0; - srbcmd->cdb_size = cpu_to_le32(12); - srbcmd->count = cpu_to_le32(datasize); + vbus = (u32)le16_to_cpu( + dev->supplement_adapter_info.virt_device_bus); + vid = (u32)le16_to_cpu( + dev->supplement_adapter_info.virt_device_target); - memset(srbcmd->cdb, 0, sizeof(srbcmd->cdb)); - srbcmd->cdb[0] = 0x26; - srbcmd->cdb[2] = (u8)((AAC_MAX_LUN + target) & 0x00FF); - srbcmd->cdb[6] = CISS_IDENTIFY_PHYSICAL_DEVICE; + /* set the common request fields */ + srb->channel = cpu_to_le32(vbus); + srb->id = cpu_to_le32(vid); + srb->lun = 0; + srb->function = cpu_to_le32(SRBF_ExecuteScsi); + srb->timeout = 0; + srb->retry_limit = 0; + srb->cdb_size = cpu_to_le32(16); + srb->count = cpu_to_le32(xfer_len); + + sg64 = (struct sgmap64 *)&srb->sg; + sg64->count = cpu_to_le32(1); + sg64->sg[0].addr[1] = cpu_to_le32(upper_32_bits(addr)); + sg64->sg[0].addr[0] = cpu_to_le32(lower_32_bits(addr)); + sg64->sg[0].count = cpu_to_le32(xfer_len); - sg64 = (struct sgmap64 *)&srbcmd->sg; - sg64->count = cpu_to_le32(1); - sg64->sg[0].addr[1] = cpu_to_le32((u32)(((addr) >> 16) >> 16)); - sg64->sg[0].addr[0] = cpu_to_le32((u32)(addr & 0xffffffff)); - sg64->sg[0].count = cpu_to_le32(datasize); + /* + * Copy the updated data for other dumping or other usage if needed + */ + memcpy(&srbu->srb, srb, sizeof(struct aac_srb)); + + /* issue request to the controller */ + rcode = aac_fib_send(ScsiPortCommand64, fibptr, fibsize, FsaNormal, + 1, 1, NULL, NULL); + + if (rcode == -ERESTARTSYS) + rcode = -ERESTART; + + if (unlikely(rcode < 0)) + goto bmic_error; + + srb_reply = (struct aac_srb_reply *)fib_data(fibptr); + memcpy(&srbu->srb_reply, srb_reply, sizeof(struct aac_srb_reply)); + +bmic_error: + dma_unmap_single(&dev->pdev->dev, addr, xfer_len, DMA_BIDIRECTIONAL); +fib_error: + aac_fib_complete(fibptr); + aac_fib_free(fibptr); + return rcode; +} + +static int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) +{ + int rcode = -ENOMEM; + u16 datasize; + struct aac_srb_unit srbu; + struct aac_srb *srbcmd; + struct aac_ciss_identify_pd *identify_resp; + + datasize = sizeof(struct aac_ciss_identify_pd); + identify_resp = kmalloc(datasize, GFP_KERNEL); + if (!identify_resp) + goto out; + + memset(&srbu, 0, sizeof(struct aac_srb_unit)); - rcode = aac_fib_send(ScsiPortCommand64, - fibptr, fibsize, FsaNormal, 1, 1, NULL, NULL); + srbcmd = &srbu.srb; + srbcmd->flags = cpu_to_le32(SRB_DataIn); + srbcmd->cdb[0] = 0x26; + srbcmd->cdb[2] = (u8)((AAC_MAX_LUN + target) & 0x00FF); + srbcmd->cdb[6] = CISS_IDENTIFY_PHYSICAL_DEVICE; + + rcode = aac_send_safw_bmic_cmd(dev, &srbu, identify_resp, datasize); + if (unlikely(rcode < 0)) + goto out; if (identify_resp->current_queue_depth_limit <= 0 || identify_resp->current_queue_depth_limit > 32) @@ -1732,12 +1788,7 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target) dev->hba_map[bus][target].qd_limit = identify_resp->current_queue_depth_limit; - dma_free_coherent(&dev->pdev->dev, datasize, identify_resp, addr); - - aac_fib_complete(fibptr); - -fib_free_ptr: - aac_fib_free(fibptr); + kfree(identify_resp); out: return rcode; } diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 403a639..bc2a0bc 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2021,6 +2021,12 @@ struct aac_srb_reply __le32 sense_data_size; u8 sense_data[AAC_SENSE_BUFFERSIZE]; // Can this be SCSI_SENSE_BUFFERSIZE }; + +struct aac_srb_unit { + struct aac_srb srb; + struct aac_srb_reply srb_reply; +}; + /* * SRB Flags */ @@ -2634,7 +2640,6 @@ static inline int aac_adapter_check_health(struct aac_dev *dev) int aac_acquire_irq(struct aac_dev *dev); void aac_free_irq(struct aac_dev *dev); int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan); -int aac_issue_bmic_identify(struct aac_dev *dev, u32 bus, u32 target); const char *aac_driverinfo(struct Scsi_Host *); void aac_fib_vector_assign(struct aac_dev *dev); struct fib *aac_fib_alloc(struct aac_dev *dev);