From nobody Tue Feb 10 12:40:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95636+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95636+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666862364624955.7108207648904; Thu, 27 Oct 2022 02:19:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id X1H2YY1788612xiNyehwclav; Thu, 27 Oct 2022 02:19:24 -0700 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.59]) by mx.groups.io with SMTP id smtpd.web11.3823.1666854411514186982 for ; Thu, 27 Oct 2022 00:06:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljU7wHQ6CKgZ0l1nHb/+guDWIW/bi6GtzoHIGlH9vKosCHNiQVXmNP0BkYoDr9z2yxPGQY2T0J5z9ulh+/GGPOR4O/mksy8UppqPuehVv/PEnhyC1tcyZ/mWibqJ1e8cW8yBF7YXoVMtQXa6g0z4spsLGP/d646B5ay3g2QfVX6cA7oK5ZYUAczYNYOFny8PQL6DMwCoJ914ItCG1LcYiISJjjjRNGOlSpJQGUVs54Qe880ZVuwhsTnHxcIQWIT4gSL9YbCH0kDvFnSgaDUHkZy8LOMzdxaJXWoWN9zc91Gon7Cf6Wp2jDrzVmBDcIMgCP3XqCnebnFGn08iSDX0vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z+hJsZ3mDLOeTtBIcYT30tbEjFIjlFGbCBEudDb7Xck=; b=eZPSJAjPOJ+BRybuyvM7FhFC+svgXym0ImUZDZXd7Id8MtvygiDKaTokeVSvRJiPUoXbhTRtroERVP1A9BiJwzXCAHqoM4wVLOjxy1L8UvEuMsBifspDsgVz5hxNKedKnaoaWaWtldHK4JHfG+jFV33CJhWIw82kkCzKBaUmhEOScE1ayvMwZPLy53O9bR+RruI9m4INrRAXokWQCC/ajeErdL36iw38+Gbe0D9U/+bs995oDHSyecLoMPd4y05JJu6NP7hjOEFfwfdYtA0VuMOS7O3AL2Re/6QioVCV2FbHCgFkRquOmW1WBaOMNlxykgtLgnNOf29TRTJAvZRSYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none X-Received: from BL0PR10MB2898.namprd10.prod.outlook.com (2603:10b6:208:75::14) by CH2PR10MB4198.namprd10.prod.outlook.com (2603:10b6:610:ab::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Thu, 27 Oct 2022 07:06:47 +0000 X-Received: from BL0PR10MB2898.namprd10.prod.outlook.com ([fe80::240a:f9da:e95d:c7f9]) by BL0PR10MB2898.namprd10.prod.outlook.com ([fe80::240a:f9da:e95d:c7f9%6]) with mapi id 15.20.5746.028; Thu, 27 Oct 2022 07:06:47 +0000 From: "Cheripally Gopi via groups.io" To: "devel@edk2.groups.io" CC: Sundaresan S , Vasudevan S , Cheripally Gopi Subject: [edk2-devel] [PATCH v2] MdeModulePkg/ScsiDiskDxe: Update proper device name for ScsiDisk drive Thread-Topic: [PATCH v2] MdeModulePkg/ScsiDiskDxe: Update proper device name for ScsiDisk drive Thread-Index: AQHY6dKt1c9zfKSYBUOqrMMgdLVtQA== Date: Thu, 27 Oct 2022 07:06:47 +0000 Message-ID: <57ad249a7bf55fc175b6206ec91c597a969a06d5.1666851664.git.gopic@ami.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BL0PR10MB2898:EE_|CH2PR10MB4198:EE_ x-ms-office365-filtering-correlation-id: 160405af-ea9a-48a1-0618-08dab7e9d048 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: mXJYR2sjFaHGn6JAwZbRSMSIRJ3q43It0wice0UKxC1uwkq1f46CPsfMwJBZcdIJPr82YMFT4lDoDR8nmxpfh5dGhVhOC8sgHk6BjUWnTN/iyTa9eFdknDhWcbYBTSwxjld34UROSJnGC9lv0zA/6PdsBdxpR5016fMG9j+mkVXbkQRyL4nyzRx4Ijf1EWkY6/AcN0bsrFv3K4XqUzRlv2JRulW9fMzCR4f3FNHaXOb1sXdBTCtkf9ihrvSsTqEaWfbJdi6HL6pVKjbQtteeNON/kKbKl3vuTuyyPDM+yVOese1MOlkGzkKf8cHRq22dUGVepwXgjowxj9PJHm72J0OhFNPAKaVg3dZYGQy6maXTN1ecbdcK8uln2RvEAn7NhtJXIDoa2dLuy/5GH6AcR99BHfEVFwVDoyoU52VwkVW6HkvinPke7Zy756Vfacc6qxBCfvMS1IbGxbkoH50eOqnnU59P1DFCNs8vn0+2b7QvuTKu0D5B0f0Pj0wTtceqKGBN0GxnO4mvDHLaKwO87gyUs6AfwllurQjkzd7Wa4BPX209CLVKtP2EH0k1A1eklCtlpOWKikg3H/Z1mTVvaDLTXybJ28938KIcrLu3I1atUfp13hHm5Grv1T4s7umCgLqGJkQZWurpsSMYXhWUQCfEx7YIQx3jdCrx3s77nP/3QzA5na5o4MmwfjswoG8WnVOx5haCu+qyiOg54bvVm7m+/feqhkq76VKTsGe111H6qqPHdhT3Ap4f8xu9+4ga1YD1VmQrl4CdfpgYF/qOHg== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?7xozlkgM9PJNuiTzGYW0g+Uyl35GOllUd0liZQzZJl7/WY3BPquLW4qjXP?= =?iso-8859-1?Q?nKifuVuwCOB4HmqzdU2G1GFyRYQjVC8pr1nsLQ/4lixbvoa8VO8HrGMCqp?= =?iso-8859-1?Q?TfVwaYdaf70qKiurPuRhtoE8McOFTkz2OsKe9CSvIVnIoYG1tmSTFehzB0?= =?iso-8859-1?Q?8lkbzYBShw+c0+3uaPvY47Ac7a100O50CXaBSckJuy/FLvZrxbIOX/pM/d?= =?iso-8859-1?Q?L1WYN/U8arbmf+nvk9s7l+uBd+BmGHEyPKu49DOInQgb9dOsDGL/M5gLJc?= =?iso-8859-1?Q?RZlkXDQPOTxfYYaBeSL1xLDBvrv9/9uLECWWvWrXhWUa/Qc+CopGetiam1?= =?iso-8859-1?Q?PlCs/+l4OiGiCKQD+FFYVo+Qt7pd6tkelofERJRJaoQvm4wHvJJqV23ysI?= =?iso-8859-1?Q?pde8kcW2Bk4HN0KUbOZbVv1QlSjc0eGtkVWF9n3fioPNlxbcT1YIkxiFsJ?= =?iso-8859-1?Q?/PDHeTmBQKTFygQ8mcB0GmTAb23Cp1GiHJCFYtxBqtXvq03YUJGGyV4U6F?= =?iso-8859-1?Q?keclst6y4y9gMTnIIBq5POg2alMsdxQRZ8lYtn50i+RClshc63JtBZGFeA?= =?iso-8859-1?Q?EY0MPNjVK2cZA6yuxJjXXKWq2zBL93SJ3B0SFuLN9XG4fUuMkUlfx86GX9?= =?iso-8859-1?Q?A7nkE4XDwWRNrSYS8M1CNCcp0Qz8/jxiBIVm4fBWZe09OE1Oxtlip2Dg71?= =?iso-8859-1?Q?o9XdnT1ae4k+O4m4Cod9nTkaU5JeT3vk46BZn1u2dMVgCw0ojeZLA0qIkw?= =?iso-8859-1?Q?v0fYPV00buBHyKIwH5yorfe73X7QJ1Yyye3sFxOgei+zU+PcG/38iuPJQy?= =?iso-8859-1?Q?//RuLGjnluJZKKRA+6Kps6+ytY/F1iutomfcEfLHdwTVKbCoK5Y++G/eBo?= =?iso-8859-1?Q?laivHG9+sAn2+yTOykzmnqGFUNKPm4hNLgL+5nUc1qGdYO+ymWtErP0BTe?= =?iso-8859-1?Q?zMGvPmQa1u1xuANJe5iDmMKCB69Vn7YyZw5UC8LZ1VLtf9UzimgNJaPpMB?= =?iso-8859-1?Q?WIkXarphYtyrH/1TvjNMJw3arObYcN7+m/KOLxEJM2wRqAeewUE6ac4Zzl?= =?iso-8859-1?Q?S1LIQprPHPJeAkBVc2Sen5ZNDFni+f4WQxKY0clCDuO8i6CiOUdlKa7uaF?= =?iso-8859-1?Q?AGsgxYZXT/FPUNM6ERi1EU1pQOn+An4w3H+dsGxzzZX8juhb0LHMWuUSeW?= =?iso-8859-1?Q?KmMQpiRH7622kfp0NxLQq15CxZvYJvfU05UFc4krShoLZazxUGsEJyVVwx?= =?iso-8859-1?Q?Wdvo1weOR7wiHq2NEFclJL+pAPoZiE9sYgSvrrMH+xCBr1ki2pNHC1/ud+?= =?iso-8859-1?Q?PEGGlDErXlOttfSrS6O9uFlzz2q/2HHEtNdpP97gp73Rf15bvNBr6iwWa1?= =?iso-8859-1?Q?vpChQajfg9GNv892wIxE+g8pfuHSj4BLFxNUufTRt7qU61wGemayXy+vVK?= =?iso-8859-1?Q?sy7DwU47dooD5HNaIeT7RjurYYUUd30qpdffeZgxxKDI2wqGwX7Ppi2HbG?= =?iso-8859-1?Q?VK1vlruXM6XHfeVsV/vN8f40/YtLyP5Vw2v2kpq7LytS+DVvgrr4gShPqH?= =?iso-8859-1?Q?oYvJgiSSomnJQ75+EprHTF6nrbi62jjEwytYHLW2W8WVEDv7bkpfnktlvb?= =?iso-8859-1?Q?liO5+NLXq6lRs=3D?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR10MB2898.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 160405af-ea9a-48a1-0618-08dab7e9d048 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Oct 2022 07:06:47.5521 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vRmZI6+YmVhJozDU5cxJHs8WujHov3WcM971YgG9NkhPIIsLRKrkdUdUuqgzz6+W X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4198 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gopic@ami.com X-Gm-Message-State: YdgZ7oqydIJmN7mHw12TALClx1787277AA= Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666862364; bh=rTFyNNTSLnPo4kxbkhQM8wJSip6IQpc6/79vzX8rKUg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=g7HlrS0/O9PaG6vbWuOSZKoLMH4B6Xsc8udc1SH2uIFYUvZZs1pmdIxSqf9tx9m0awJ UwMVyBnIkaTCJlCeu6T4Lq6aIbZwAT2zy05/9GogYtMHsY+9Khes93dDrhUXmVW0+zqXx +HjlfA7u8/7Nt2W1oeywRhajNY1RUUlm5wA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666862366763100006 Content-Type: text/plain; charset="utf-8" ScsiDiskDxe driver updates ControllerNameTable with common string "SCSI Disk Device" for all SCSI disks. Due to this, when multiple SCSI disk devices connected, facing difficulty in identifying correct SCSI disk device. As per SCSI spec, standard Inquiry Data is having the fields to know Vendor and Product information. Updated "ControllerNameTable" with Vendor and Product information. So that, device specific name can be retrieved using ComponentName protocol. Cc: Vasudevan Sambandan Cc: Sundaresan Selvaraj Signed-off-by: Cheripally Gopi Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 53 ++++++++++++++++++- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 9 ++++ .../Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf | 2 + 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bu= s/Scsi/ScsiDiskDxe/ScsiDisk.c index 98e84b4ea8..0928605dc4 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -2,6 +2,7 @@ SCSI disk driver that layers on every SCSI IO protocol in the system. Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 1985 - 2022, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -67,6 +68,33 @@ FreeAlignedBuffer ( } } +/** + Remove trailing spaces from the string. + + @param String The ASCII string to remove the trailing spaces. + + @retval the new length of the string. +**/ +UINTN +RemoveTrailingSpaces ( + IN OUT CHAR8 *String + ) +{ + UINTN Length; + + Length =3D AsciiStrLen (String); + if (Length =3D=3D 0) { + return 0; + } + + while ((Length > 0) && (String[Length-1] =3D=3D ' ')) { + Length--; + } + + String[Length] =3D '\0'; + return Length; +} + /** The user Entry Point for module ScsiDisk. @@ -203,6 +231,9 @@ ScsiDiskDriverBindingStart ( UINT8 MaxRetry; BOOLEAN NeedRetry; BOOLEAN MustReadCapacity; + CHAR8 VendorStr[VENDOR_IDENTIFICATION_LENGTH + 1]; + CHAR8 ProductStr[PRODUCT_IDENTIFICATION_LENGTH + 1]; + CHAR16 DeviceStr[VENDOR_IDENTIFICATION_LENGTH + PRODUCT_I= DENTIFICATION_LENGTH + 2]; MustReadCapacity =3D TRUE; @@ -354,19 +385,37 @@ ScsiDiskDriverBindingStart ( } } + CopyMem ( + VendorStr, + &ScsiDiskDevice->InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION= _OFFSET], + VENDOR_IDENTIFICATION_LENGTH + ); + VendorStr[VENDOR_IDENTIFICATION_LENGTH] =3D 0; + RemoveTrailingSpaces (VendorStr); + + CopyMem ( + ProductStr, + &ScsiDiskDevice->InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATIO= N_OFFSET], + PRODUCT_IDENTIFICATION_LENGTH + ); + ProductStr[PRODUCT_IDENTIFICATION_LENGTH] =3D 0; + RemoveTrailingSpaces (ProductStr); + + UnicodeSPrint (DeviceStr, sizeof (DeviceStr), L"%a %a", VendorStr,= ProductStr); + ScsiDiskDevice->ControllerNameTable =3D NULL; AddUnicodeString2 ( "eng", gScsiDiskComponentName.SupportedLanguages, &ScsiDiskDevice->ControllerNameTable, - L"SCSI Disk Device", + DeviceStr, TRUE ); AddUnicodeString2 ( "en", gScsiDiskComponentName2.SupportedLanguages, &ScsiDiskDevice->ControllerNameTable, - L"SCSI Disk Device", + DeviceStr, FALSE ); return EFI_SUCCESS; diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h b/MdeModulePkg/Bu= s/Scsi/ScsiDiskDxe/ScsiDisk.h index d54282df5f..5b4047e1db 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h @@ -2,6 +2,7 @@ Header file for SCSI Disk Driver. Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 1985 - 2022, American Megatrends International LLC.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -30,6 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include @@ -179,6 +181,13 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponen= tName2; #define SCSI_COMMAND_VERSION_2 0x02 #define SCSI_COMMAND_VERSION_3 0x03 +// Per SCSI spec, EFI_SCSI_INQUIRY_DATA.Reserved_5_95[3 - 10] has the Vend= or identification +// EFI_SCSI_INQUIRY_DATA.Reserved_5_95[11 - 26] has the product identifica= tion +#define VENDOR_IDENTIFICATION_OFFSET 3 +#define VENDOR_IDENTIFICATION_LENGTH 8 +#define PRODUCT_IDENTIFICATION_OFFSET 11 +#define PRODUCT_IDENTIFICATION_LENGTH 16 + // // SCSI Disk Timeout Experience Value // diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf b/MdeModuleP= kg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf index 40818e669b..26227132e8 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf @@ -4,6 +4,7 @@ # the device handle. # # Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 1985 - 2022, American Megatrends International LLC.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -46,6 +47,7 @@ UefiDriverEntryPoint DebugLib DevicePathLib + PrintLib [Protocols] gEfiDiskInfoProtocolGuid ## BY_START -- 2.33.0.windows.2 -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95636): https://edk2.groups.io/g/devel/message/95636 Mute This Topic: https://groups.io/mt/94600311/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-