From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.13.50; helo=eur01-he1-obe.outbound.protection.outlook.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130050.outbound.protection.outlook.com [40.107.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BCFB6211E0101 for ; Mon, 25 Mar 2019 06:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CE6Ay9vUqOyoEFJFoKnL88/0vHKhvIX8nzmscY16U64=; b=GY5P61PXlgxvta84Nb0LCGGrDr44NSE0Ze2wo25lcB2PvnL2wihoywcMnaGrUEUVsOo5X9RECescQik5rns3njaW/QUhYwpyBzpcD9w3annh4y+qC7D+LHCV3zKsrVGJJIeeXCS3EvFkQvYCxTqybihiI6tIwfsdujY4N88WzYk= Received: from AM4PR08MB2788.eurprd08.prod.outlook.com (10.170.126.27) by AM4PR08MB0788.eurprd08.prod.outlook.com (10.164.82.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19; Mon, 25 Mar 2019 13:12:21 +0000 Received: from AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::cc1a:f5ec:27c6:4136]) by AM4PR08MB2788.eurprd08.prod.outlook.com ([fe80::cc1a:f5ec:27c6:4136%3]) with mapi id 15.20.1730.019; Mon, 25 Mar 2019 13:12:21 +0000 From: Supreeth Venkatesh To: Eric Jin , "edk2-devel@lists.01.org" Thread-Topic: [edk2-test][Patch 1/1] uefi-sct/SctPkg:Implement iSCSI DevicePathToText Test Thread-Index: AQHU17Qz7CCoiOmO90it2wqGyEQ5g6YcaTfA Date: Mon, 25 Mar 2019 13:12:21 +0000 Message-ID: References: <20190311024315.4484-1-eric.jin@intel.com> In-Reply-To: <20190311024315.4484-1-eric.jin@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Supreeth.Venkatesh@arm.com; x-originating-ip: [99.185.131.209] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 073e342f-57a9-444e-4a47-08d6b12383d1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR08MB0788; x-ms-traffictypediagnostic: AM4PR08MB0788: x-microsoft-antispam-prvs: x-forefront-prvs: 0987ACA2E2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(376002)(39860400002)(396003)(366004)(346002)(136003)(13464003)(189003)(40434004)(199004)(6436002)(5660300002)(105586002)(2906002)(6246003)(106356001)(97736004)(6116002)(3846002)(53936002)(81166006)(81156014)(9686003)(8676002)(52536014)(110136005)(74316002)(86362001)(25786009)(71200400001)(71190400001)(30864003)(68736007)(8936002)(99286004)(33656002)(229853002)(316002)(55016002)(14454004)(102836004)(26005)(186003)(53546011)(6506007)(7696005)(256004)(14444005)(76176011)(5024004)(11346002)(486006)(19627235002)(476003)(478600001)(72206003)(66066001)(7736002)(305945005)(446003)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB0788; H:AM4PR08MB2788.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: WsLwUC1bzhzqnxBeufQktWDccsFuSNCdvaUTg5s0+KQaexek5AZTtEFuD+2Ekd0WKd0n7zUvS9+CSq7SXIQ4OHIkKb3ORVvsp+I2rNDS0Fi4VDHUgB8wdgCUfEkTzNzY0X3FP/ys2x3hE7qZ6SJZzh942FYYXcFLSvjluF2ZjTYNanEO7fz7uAKBG//uekvLonU2IZdL0WhSLUyRO7bYPj1PmHJGviqt5eWCXWqMZvqs5IY5YRxQCGLjyMrv8PbzazOA/v6WWerBGav7ARJQueRzmka3temiOOVZTo6C6SG8aSnYbCe8+ATNuECe3ZS/rHCjAbC9hiKFvhWR7iaCNYzI4pQiTNtalC+9OctGYzUVU81JVrg0sOwlq1ojHtdg107NJ2ouLPD51kLKVebOTVUrcJGTnMr6YwMemVnN/RA= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 073e342f-57a9-444e-4a47-08d6b12383d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2019 13:12:21.2446 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0788 Subject: Re: [edk2-test][Patch 1/1] uefi-sct/SctPkg:Implement iSCSI DevicePathToText Test X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Mar 2019 13:12:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Supreeth Venkatesh -----Original Message----- From: Eric Jin Sent: Sunday, March 10, 2019 9:43 PM To: edk2-devel@lists.01.org Cc: Supreeth Venkatesh Subject: [edk2-test][Patch 1/1] uefi-sct/SctPkg:Implement iSCSI DevicePathT= oText Test It is the new checkpoint of iSCSI DevicePathToText. The Lun display is to follow with the UEFI Spec that "The LUN is an 8 byte = array that is displayed in hexadecimal format with byte 0 first (i.e., on t= he left) and byte 7 last (i.e, on the right). Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/G= uid.h | 9 ++++++++- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/D= evicePathToTextBBTestCoverage.c | 53 ++++++++++++++++++++++++++++++++++++++= +++++++++++++-- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/D= evicePathToTextBBTestMain.c | 41 +++++++++++++++++++++++++++++++++-----= --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/G= uid.c | 3 ++- 4 files changed, 94 insertions(+), 12 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/Bl= ackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathTo= Text/BlackBoxTest/Guid.h index 41d2a8a837f5..b03903ca0971 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxT= est/Guid.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackB +++ oxTest/Guid.h @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -400,3 +400,10 @@ extern EFI_GUID gDevicePathToTextBBTestFunct= ionAssertionGuid133; } extern EFI_GUID gDevicePathToTextBBTestFunctionAssertionGuid134; + +#define EFI_TEST_DEVICEPATHTOTEXTBBTESTFUNCTION_ASSERTION_135_GUID \ + { \ + 0xbf73c00e, 0x5a62, 0x4a20, { 0xbe, 0x15, 0x4d, 0x83, 0x7e, 0xe5, +0x7d, 0xdf } \ + } +extern EFI_GUID gDevicePathToTextBBTestFunctionAssertionGuid135; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/Bl= ackBoxTest/DevicePathToTextBBTestCoverage.c b/uefi-sct/SctPkg/TestCase/UEFI= /EFI/Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestCoverage.= c index c30af4345158..ee91bdfb63d3 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxT= est/DevicePathToTextBBTestCoverage.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackB +++ oxTest/DevicePathToTextBBTestCoverage.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2017 Unified EFI, Inc.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -2202,7 +2202,56 @@ DevicePathToTextConvertDeviceNodeToTextCov= erageTest ( SctFreePool (Text); } - + // + // The stardand Text in spec is iSCSI(TargetName, PortalGroup, LUN, + HeaderDigest, DataDigest, Authentication, Protocol) // The test use + iSCSI(Name,0x12AB,0x0000005678000000,CRC32C,None,CHAP_BI,TCP) as the + input to check binary/text convertion // // sizeof + (ISCSI_DEVICE_PATH_WITH_NAME) + 4 is the length of iSCSI Device Path + Node plus Target Name // The Targat Name is "Name" in this case // + The default protocol used by iSCSI is TCP(0), and 1+ is reserved in + UEFI 2.7 spec // The combination of HeaderDigest, DataDigest and + Authentication in this case is 0002 // The Lun is 0x0000007856000000 in = this case to detect the possible display order issue // please refer to se= ction 10.3.5.21 and Table 102 of UEFI 2.7 Spec for detail. + // + pDeviceNode1 =3D DevicePathUtilities->CreateDeviceNode (0x3, 0x13, + sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + 4); + ((ISCSI_DEVICE_PATH_WITH_NAME *)pDeviceNode1)->NetworkProtocol =3D 0x0; + ((ISCSI_DEVICE_PATH_WITH_NAME *)pDeviceNode1)->LoginOption =3D 0x0002; + ((ISCSI_DEVICE_PATH_WITH_NAME *)pDeviceNode1)->Lun =3D + 0x0000007856000000; ((ISCSI_DEVICE_PATH_WITH_NAME + *)pDeviceNode1)->TargetPortalGroupTag =3D 0x12AB; + ((ISCSI_DEVICE_PATH_WITH_NAME *)pDeviceNode1)->iSCSITargetName[0] =3D + 'N'; ((ISCSI_DEVICE_PATH_WITH_NAME + *)pDeviceNode1)->iSCSITargetName[1] =3D 'a'; + ((ISCSI_DEVICE_PATH_WITH_NAME *)pDeviceNode1)->iSCSITargetName[2] =3D + 'm'; ((ISCSI_DEVICE_PATH_WITH_NAME + *)pDeviceNode1)->iSCSITargetName[3] =3D 'e'; + + Text =3D DevicePathToText->ConvertDeviceNodeToText (pDeviceNode1, + FALSE, FALSE); + pDeviceNode2 =3D SctConvertTextToDeviceNode(Text); + + if ((pDeviceNode2 !=3D NULL) && (SctCompareMem (pDeviceNode2, pDeviceNod= e1, SctDevicePathNodeLength(pDeviceNode1)) =3D=3D 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gDevicePathToTextBBTestFunctionAssertionGuid135, + L"EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL - ConvertDeviceNodeTo= Text must correctly recover the converting ConvertTextToDeviceNode has acte= d on the device node string", + L"%a:%d: Convert result: %s - Expected:iSCSI(MyTargetName,= 0x12AB,0x0000005678000000,CRC32C,None,CHAP_BI,TCP)", + __FILE__, + (UINTN)__LINE__, + Text + ); + if (pDeviceNode1 !=3D NULL) { + SctFreePool (pDeviceNode1); + } + if (pDeviceNode2 !=3D NULL) { + SctFreePool (pDeviceNode2); + } + if (Text !=3D NULL) { + SctFreePool (Text); + } + return EFI_SUCCESS; } diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/Bl= ackBoxTest/DevicePathToTextBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI= /Protocol/DevicePathToText/BlackBoxTest/DevicePathToTextBBTestMain.c index 41cf217b5f88..d08097769391 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxT= est/DevicePathToTextBBTestMain.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackB +++ oxTest/DevicePathToTextBBTestMain.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2017 Unified EFI, Inc.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -2437,34 +2437,40 @@ BuildiSCSIDeviceNode ( CHAR16 *LunStr; UINT16 Options; UINT64 LunNum; + UINT64 TempLunNum; Status =3D GetNextRequiredParam(&TextDeviceNode, L"TargetName", &ParamId= entifierStr, &ParamIdentifierVal); if ((!EFI_ERROR(Status)) && (ParamIdentifierVal !=3D NULL)) { NameStr =3D ParamIdentifierVal; } else { - return NULL; + return NULL; } Status =3D GetNextRequiredParam(&TextDeviceNode, L"PortalGroup", &ParamI= dentifierStr, &ParamIdentifierVal); if ((!EFI_ERROR(Status)) && (ParamIdentifierVal !=3D NULL)) { PortalGroupStr =3D ParamIdentifierVal; } else { - return NULL; + return NULL; } Status =3D GetNextRequiredParam(&TextDeviceNode, L"LUN", &ParamIdentifie= rStr, &ParamIdentifierVal); if ((!EFI_ERROR(Status)) && (ParamIdentifierVal !=3D NULL)) { LunStr =3D ParamIdentifierVal; } else { - return NULL; + return NULL; } - Length =3D sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + (UINT16) (SctStrLen (N= ameStr) * 2 + 2); + Length =3D sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + (UINT16) (SctStrLen + (NameStr)); iSCSI =3D (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (0x3, 0x13, L= ength); if (iSCSI =3D=3D NULL) { - return NULL; + return NULL; } + + // + // The iSCSI Device Node Options describe iSCSI login options for the + key values // Please refer to the section 10.3.5.21 of the UEFI 2.7 + spec for the detail // Options =3D 0x0000; for (OptionalParamIndex =3D 0;OptionalParamIndex < 5; OptionalParamIndex= ++) { @@ -2499,7 +2505,7 @@ BuildiSCSIDeviceNode ( if (SctStrCmp (ParamIdentifierVal, L"CRC32C") =3D=3D 0) { Options |=3D 0x0002; } -break; + break; case 1: // DataDigest if (SctStrCmp (ParamIdentifierVal, L"CRC32C") =3D=3D 0) { @@ -2514= ,6 +2520,9 @@ BuildiSCSIDeviceNode ( if (SctStrCmp (ParamIdentifierVal, L"CHAP_UNI") =3D=3D 0) { Options |=3D 0x1000; } + if (SctStrCmp (ParamIdentifierVal, L"CHAP_BI") =3D=3D 0) { + Options |=3D 0x0000; + } break; case 3: // Protocol @@ -2533,8 +2542,24 @@ BuildiSCSIDeviceNode ( SctUnicodeToAscii (iSCSI->iSCSITargetName, NameStr, SctStrLen (NameStr))= ; iSCSI->TargetPortalGroupTag =3D (UINT16) SctStrToUInt (PortalGroupStr); - SctStrToUInt64 (LunStr, &LunNum); + + // + // The LUN is an 8 byte array that is displayed in hexadecimal format + with byte // 0 first (i.e., on the left) and byte 7 last (i.e, on the ri= ght), and is required. + // + SctStrToUInt64 (LunStr, &TempLunNum); LunNum =3D 0; + + LunNum =3D SctLShiftU64((TempLunNum & 0x00000000000000FF), 56);; + LunNum =3D LunNum | SctLShiftU64((TempLunNum & 0x000000000000FF00), 40); + LunNum =3D LunNum | SctLShiftU64((TempLunNum & 0x0000000000FF0000), 24); + LunNum =3D LunNum | SctLShiftU64((TempLunNum & 0x00000000FF000000), 8); + LunNum =3D LunNum | SctRShiftU64((TempLunNum & 0x000000FF00000000), 8); + LunNum =3D LunNum | SctRShiftU64((TempLunNum & 0x0000FF0000000000), 24); + LunNum =3D LunNum | SctRShiftU64((TempLunNum & 0x00FF000000000000), 40); + LunNum =3D LunNum | SctRShiftU64((TempLunNum & 0xFF00000000000000), 56); iSCSI->Lun =3D LunNum; + iSCSI->LoginOption =3D (UINT16) Options; return (EFI_DEVICE_PATH_PROTOCOL *) iSCSI; diff --git a/uefi-sct/SctPkg/= TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/Guid.c b/uefi-sct/= SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxTest/Guid.c index 9cad8d31d384..1eeb3552093f 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackBoxT= est/Guid.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathToText/BlackB +++ oxTest/Guid.c @@ -1,7 +1,7 @@ /** @file Copyright 2006 - 2015 Unified EFI, Inc.
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -136,3 +136,4 @@ EFI_GUID gDevicePathToTextBBTestFunctionAsse= rtionGuid133 =3D EFI_TEST_DEVICEPATHT EFI_GUID gDevicePathToTextBBTestFunctionAssertionGuid134 =3D EFI_TEST_DEV= ICEPATHTOTEXTBBTESTFUNCTION_ASSERTION_134_GUID; +EFI_GUID gDevicePathToTextBBTestFunctionAssertionGuid135 =3D +EFI_TEST_DEVICEPATHTOTEXTBBTESTFUNCTION_ASSERTION_135_GUID; -- 2.20.0.windows.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.