From patchwork Wed Jun 10 10:22:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Saxena X-Patchwork-Id: 6578441 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D92449F74F for ; Wed, 10 Jun 2015 10:25:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6F07205DF for ; Wed, 10 Jun 2015 10:25:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82EAB2058C for ; Wed, 10 Jun 2015 10:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753512AbbFJKZO (ORCPT ); Wed, 10 Jun 2015 06:25:14 -0400 Received: from dns-bn1lp0143.outbound.protection.outlook.com ([207.46.163.143]:60400 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753763AbbFJKZN (ORCPT ); Wed, 10 Jun 2015 06:25:13 -0400 Received: from BY2PR07CA065.namprd07.prod.outlook.com (10.141.251.40) by BN1PR07MB359.namprd07.prod.outlook.com (10.141.60.145) with Microsoft SMTP Server (TLS) id 15.1.172.22; Wed, 10 Jun 2015 10:25:11 +0000 Received: from BL2FFO11FD045.protection.gbl (2a01:111:f400:7c09::130) by BY2PR07CA065.outlook.office365.com (2a01:111:e400:2c61::40) with Microsoft SMTP Server (TLS) id 15.1.190.14 via Frontend Transport; Wed, 10 Jun 2015 10:25:10 +0000 Authentication-Results: spf=softfail (sender IP is 192.19.192.197) smtp.mailfrom=avagotech.com; parallels.com; dkim=none (message not signed) header.d=none; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning avagotech.com discourages use of 192.19.192.197 as permitted sender) Received: from PALEXCH12.lsi.com (192.19.192.197) by BL2FFO11FD045.mail.protection.outlook.com (10.173.161.207) with Microsoft SMTP Server (TLS) id 15.1.190.9 via Frontend Transport; Wed, 10 Jun 2015 10:25:09 +0000 Received: from palmhbs0.lsi.com (128.94.222.181) by PALEXCH12-EXT.lsi.com (128.94.222.103) with Microsoft SMTP Server id 14.3.158.1; Wed, 10 Jun 2015 06:25:09 -0400 Received: from localhost (dhcp-135-24-192-124.lsi.com [135.24.192.124]) by palmhbs0.lsi.com (8.13.8/8.12.11) with ESMTP id t5AASaRN030984; Wed, 10 Jun 2015 06:28:38 -0400 From: Message-ID: <201506101028.t5AASaRN030984@palmhbs0.lsi.com> Date: Wed, 10 Jun 2015 15:52:55 +0530 To: Subject: [PATCH] megaraid_sas : Pass driver version to firmware inside IOC init frame CC: , , , , , User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD045; 1:K07tFFaaZsb2mQ1aI6dLaXGTuAbjVJlN0KfI2b3exBNncYnMPfIQ6Y3mvPnWLj3ZHctnh3R320OqlUUyGPVb/G2D3TNXBaeLW5qjL0RjsoAmdgqwwpSOaplkQ1WYCGBJddsvybW2Spn6F/r6ckiF/V07Pt/rOLIIenyO4ziqaYA0BP67vBwMcr70/Pep7fLS8V/0LZeQPxWHutZce/kwfcZp2gkZm7cCMVd1sHob8vZ9DxYikWIcRvk+/kGh6o3akqihhTg5NVyAdEKAZ1+5E7WXQWNVcCNL007pPrhCISEZbuPbJKU+CbWav41r6YJX X-Forefront-Antispam-Report: CIP:192.19.192.197; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(189998001)(16796002)(46102003)(50466002)(54356999)(19580395003)(86362001)(4001350100001)(57986006)(77156002)(50986999)(6806004)(2351001)(23726002)(87936001)(76506005)(2220100001)(106466001)(6550400002)(5001920100001)(229853001)(19580405001)(97756001)(47776003)(83506001)(107886002)(110136002)(92566002)(46406003)(105596002)(62966003)(86152002)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR07MB359; H:PALEXCH12.lsi.com; FPR:; SPF:SoftFail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR07MB359; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(520003)(3002001); SRVR:BN1PR07MB359; BCL:0; PCL:0; RULEID:; SRVR:BN1PR07MB359; X-Forefront-PRVS: 06036BD506 X-OriginatorOrg: lsicorp.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2015 10:25:09.6185 (UTC) X-MS-Exchange-CrossTenant-Id: 33102e38-078a-4484-9fb5-731e8b59db69 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=33102e38-078a-4484-9fb5-731e8b59db69; Ip=[192.19.192.197]; Helo=[PALEXCH12.lsi.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR07MB359 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas.h | 10 +++++++--- drivers/scsi/megaraid/megaraid_sas_base.c | 18 ++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 20c3754..5bd4d30 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1038,6 +1038,7 @@ struct megasas_ctrl_info { #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ MEGASAS_MAX_DEV_PER_CHANNEL) +#define MEGASAS_MAX_NAME 32 #define MEGASAS_MAX_SECTORS (2*1024) #define MEGASAS_MAX_SECTORS_IEEE (2*128) #define MEGASAS_DBG_LVL 1 @@ -1264,17 +1265,18 @@ struct megasas_init_frame { __le32 pad_0; /*0Ch */ __le16 flags; /*10h */ - __le16 reserved_3; /*12h */ + __le16 reserved_2; /*12h */ __le32 data_xfer_len; /*14h */ __le32 queue_info_new_phys_addr_lo; /*18h */ __le32 queue_info_new_phys_addr_hi; /*1Ch */ __le32 queue_info_old_phys_addr_lo; /*20h */ __le32 queue_info_old_phys_addr_hi; /*24h */ - __le32 reserved_4[2]; /*28h */ + __le32 driver_ver_lo; /*28h */ + __le32 driver_ver_hi; /*2Ch */ __le32 system_info_lo; /*30h */ __le32 system_info_hi; /*34h */ - __le32 reserved_5[2]; /*38h */ + __le32 reserved_3[2]; /*38h */ } __attribute__ ((packed)); @@ -1665,6 +1667,8 @@ struct megasas_instance { dma_addr_t producer_h; __le32 *consumer; dma_addr_t consumer_h; + __le32 *verbuf; + dma_addr_t verbuf_h; struct MR_DRV_SYSTEM_INFO *system_info_buf; dma_addr_t system_info_h; struct MR_LD_VF_AFFILIATION *vf_affiliation; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index a022c39..6bfb3eb 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4252,6 +4252,14 @@ megasas_issue_init_mfi(struct megasas_instance *instance) init_frame->cmd = MFI_CMD_INIT; init_frame->cmd_status = MFI_STAT_INVALID_STATUS; + + if (instance->verbuf) { + snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n", + MEGASAS_VERSION); + init_frame->driver_ver_lo = cpu_to_le32(instance->verbuf_h); + init_frame->driver_ver_hi = 0; + } + init_frame->queue_info_new_phys_addr_lo = cpu_to_le32(lower_32_bits(initq_info_h)); init_frame->queue_info_new_phys_addr_hi = @@ -5257,6 +5265,12 @@ static int megasas_probe_one(struct pci_dev *pdev, break; } + instance->verbuf = pci_alloc_consistent(pdev, + MEGASAS_MAX_NAME * sizeof(u32), + &instance->verbuf_h); + if (!instance->verbuf) + dev_info(&instance->pdev->dev, "Can't allocate version buffer\n"); + instance->system_info_buf = pci_zalloc_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO), &instance->system_info_h); @@ -5838,6 +5852,10 @@ static void megasas_detach_one(struct pci_dev *pdev) pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO), instance->system_info_buf, instance->system_info_h); + if (instance->verbuf) + pci_free_consistent(pdev, MEGASAS_MAX_NAME * sizeof(u32), + instance->verbuf, instance->verbuf_h); + scsi_host_put(host); pci_disable_device(pdev); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 0637f42..359d605 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -671,6 +671,13 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) /* Convert capability to LE32 */ cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities); + if (instance->verbuf) { + snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n", + MEGASAS_VERSION); + init_frame->driver_ver_lo = cpu_to_le32(instance->verbuf_h); + init_frame->driver_ver_hi = 0; + } + sys_info = dmi_get_system_info(DMI_PRODUCT_UUID); if (instance->system_info_buf && sys_info) { memcpy(instance->system_info_buf->systemId, sys_info,