From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@microchiptechnology.onmicrosoft.com header.s=selector1-microchiptechnology-onmicrosoft-com header.b=EtKrrfky; spf=pass (domain: microchip.com, ip: 68.232.153.233, mailfrom: shrishail.patil@microchip.com) Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) by groups.io with SMTP; Mon, 17 Jun 2019 02:18:40 -0700 Received-SPF: Pass (esa3.microchip.iphmx.com: domain of Shrishail.Patil@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Shrishail.Patil@microchip.com"; x-sender="Shrishail.Patil@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa3.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Shrishail.Patil@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa3.microchip.iphmx.com; spf=Pass smtp.mailfrom=Shrishail.Patil@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,384,1557212400"; d="scan'208,217";a="37826164" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Jun 2019 02:18:35 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex04.mchp-main.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 17 Jun 2019 02:18:21 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 17 Jun 2019 02:18:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SJWS5TD3zPg0GyhOkFtxjWYN/aS7lXw8z8JcM9IkW3g=; b=EtKrrfkyRwoG/ieXHhe71CG9KJvw2Ktrhy/dtqdB7aG+oUcIdVrKpkOe7f4CnbXNdYTJ46BYNAO5ZZzHrNM99bWwyesdiULf5fWmBNp/yZggOlAfzOPBn9N88PicZkh2xoeKx4QXwam2L4ABBOuhMTNfHVtadlbnA7jjFgX0uH0= Received: from BN6PR1101MB2355.namprd11.prod.outlook.com (10.173.200.19) by BN6PR1101MB2193.namprd11.prod.outlook.com (10.174.112.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.11; Mon, 17 Jun 2019 09:18:10 +0000 Received: from BN6PR1101MB2355.namprd11.prod.outlook.com ([fe80::cc59:73d2:30ab:704c]) by BN6PR1101MB2355.namprd11.prod.outlook.com ([fe80::cc59:73d2:30ab:704c%4]) with mapi id 15.20.1987.014; Mon, 17 Jun 2019 09:18:10 +0000 From: To: CC: , , Subject: [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT Thread-Topic: [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT Thread-Index: AdUk7G2z9ncw0MMHRSqPJqjCZwe8Nw== Date: Mon, 17 Jun 2019 09:18:09 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [121.244.27.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 64921c2f-9979-44cc-4b82-08d6f304b77f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BN6PR1101MB2193; x-ms-traffictypediagnostic: BN6PR1101MB2193: x-ms-exchange-purlcount: 3 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0071BFA85B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(53376002)(107886003)(66476007)(33656002)(6506007)(53546011)(66574012)(9326002)(2351001)(6916009)(102836004)(7696005)(99286004)(7736002)(15188155005)(6116002)(3846002)(790700001)(54906003)(53936002)(476003)(6306002)(54896002)(316002)(14454004)(186003)(8936002)(4326008)(2906002)(5640700003)(8676002)(486006)(6436002)(66066001)(55016002)(16799955002)(1730700003)(81156014)(30864003)(25786009)(74316002)(53946003)(236005)(81166006)(9686003)(68736007)(256004)(64756008)(14444005)(66446008)(2501003)(478600001)(966005)(5660300002)(66556008)(26005)(76116006)(52536014)(72206003)(73956011)(71190400001)(71200400001)(19627235002)(86362001)(66946007)(569006);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR1101MB2193;H:BN6PR1101MB2355.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 0BfTzNOSOlXxRuuPx71+U2g/TYjTrGUtkQQ1GdAuFaRDC9vhJxcCmUBY53FMZZ33fjrnKn3Dk9WPepc8XGvx0jsp1MosOvENfFH7qSuGzKDkmktveZoIUPmwD3N61aGCSFuz2WNYwK/i5bo7qULJvd2diS0wybbmr1mDPmR63VzDvxBLpuuTZ0dqI9fAQ4122ErRVt+bcCsTqnpaEPL4kqJIl/n6Hj/xyGuhp3hmy7v34jGykiFaOSGFhLnYAFCBSxO1rqmJgkMdtKRsxrENzAHOZoIOlYPycFdc22UyTNLsmV++P8H3uP+9V+B6DdGlq4lo/3T4A+trXb9Yy7vUc/QjLtUZMPKdry6vcIDYJCYoJPTwi4c5lW/1fOFonEQXOUd4njhPQeAHw87KscMuVPAWA4EWMEDdVzZE9ghYVIs= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 64921c2f-9979-44cc-4b82-08d6f304b77f X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jun 2019 09:18:09.9352 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Shrishail.Patil@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2193 Return-Path: Shrishail.Patil@microchip.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0BN6PR1101MB2355_" --_000_BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0BN6PR1101MB2355_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Team, Adding Firmware Management Protocol and HII Config Access Protocol into IHV= SCT. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shrishail Patil > From: shrishailp <50140165+shrishailp@users.noreply.github.com> Date: Fri, 10 May 2019 14:40:20 +0530 Subject: [PATCH] Adding FMP and HII Config Access protocol into IHVSCT Added FMP and HII config access protocol into IHVSCT. --- uefi-sct/SctPkg/CommonGenFramework.bat | 3 +- uefi-sct/SctPkg/CommonGenFramework.sh | 3 +- .../FirmwareManagementBBTestConformance.c | 3632 +++++++++++++++++ .../FirmwareManagementBBTestFunction.c | 891 ++++ .../FirmwareManagementBBTestMain.c | 228 ++ .../FirmwareManagementBBTestMain.h | 223 + .../FirmwareManagement/BlackBoxTest/Guid.c | 63 + .../FirmwareManagement/BlackBoxTest/Guid.h | 153 + .../IhvFirmwareManagementBBTest.inf | 52 + .../HIIConfigAccess/BlackBoxTest/Guid.c | 46 + .../HIIConfigAccess/BlackBoxTest/Guid.h | 109 + .../HIIConfigAccessBBTestConformance.c | 908 +++++ .../HIIConfigAccessBBTestFunction.c | 606 +++ .../BlackBoxTest/HIIConfigAccessBBTestMain.c | 655 +++ .../BlackBoxTest/HIIConfigAccessBBTestMain.h | 168 + .../BlackBoxTest/IhvHIIConfigAccessBBTest.inf | 55 + uefi-sct/SctPkg/UEFI/IHV_SCT.dsc | 2 + 17 files changed, 7795 insertions(+), 2 deletions(-) create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/FirmwareManagementBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/FirmwareManagementBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/FirmwareManagementBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/FirmwareManagementBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManag= ement/BlackBoxTest/IhvFirmwareManagementBBTest.inf create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/HIIConfigAccessBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/HIIConfigAccessBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/HIIConfigAccessBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/HIIConfigAccessBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/IhvHIIConfigAccessBBTest.inf diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/Commo= nGenFramework.bat index 5c614eaa..f9d133fd 100644 --- a/uefi-sct/SctPkg/CommonGenFramework.bat +++ b/uefi-sct/SctPkg/CommonGenFramework.bat @@ -279,7 +279,8 @@ rem copy %ProcessorType%\IhvUsbHcTest.efi = %Framework%\T copy %ProcessorType%\IhvUsb2HcTest.efi %Framework= %\Test\ > NUL copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi %Framework= %\Test\ > NUL copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi %Framework= %\Test\ > NUL - + copy %ProcessorType%\IhvFirmwareManagementBBTest.efi %Framework= %\Test\ > NUL + copy %ProcessorType%\IhvHIIConfigAccessBBTest.efi %Framework= %\Test\ > NUL rem ********************************************* rem Copy the UEFI 2.1 Test Cases for IHV rem ********************************************* diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/Common= GenFramework.sh index c422034a..6a944611 100755 --- a/uefi-sct/SctPkg/CommonGenFramework.sh +++ b/uefi-sct/SctPkg/CommonGenFramework.sh @@ -312,7 +312,8 @@ then cp $ProcessorType/IhvUsb2HcTest.efi $Framework/Te= st/ > NUL cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi $Framework/Te= st/ > NUL cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi $Framework/Te= st/ > NUL - + cp $ProcessorType/IhvFirmwareManagementBBTest.efi $Framework/Te= st/ > NUL + cp $ProcessorType/IhvHIIConfigAccessBBTest.efi $Framework/Te= st/ > NUL # ********************************************* # Copy the UEFI 2.1 Test Cases for IHV # ********************************************* diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestConformance.c b/uefi-sct/SctPkg/TestCa= se/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTe= stConformance.c new file mode 100644 index 00000000..95d36dc7 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestConformance.c @@ -0,0 +1,3632 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + FirmwareManagementBBTestConformance.c + +Abstract: + Firmware Management Protocol's conformance tests. + +--*/ + +#define DEBUG_ALL 0 +#define DEBUG_GET_IMAGE_INFO 0 +#define DEBUG_GET_IMAGE 0 +#define DEBUG_SET_IMAGE 0 +#define DEBUG_CHECK_IMAGE 0 +#define DEBUG_SET_PACKAGE_INFO 0 + +#include "SctLib.h" +#include "FirmwareManagementBBTestMain.h" + +// ***********************************************************************= ***** +// Support Routines +// ***********************************************************************= ***** + +EFI_STATUS +CheckForSupportGetImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +CheckForSupportSetImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + + +EFI_STATUS +CheckForSupportCheckImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +CheckForSupportSetPackageInfo ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +// ***********************************************************************= ***** +// Check Points +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageInfoConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageInfoConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestCheckImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestCheckImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +// ***********************************************************************= ***** +// Support Routines +// +// +// ***********************************************************************= ***** + +// ***********************************************************************= ***** +// Support Routine: Progress +// ***********************************************************************= ***** + +EFI_STATUS +Progress ( + IN UINTN Completion +) +{ + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Support Routine: CheckForSupportGetImage +// ***********************************************************************= ***** + +EFI_STATUS +CheckForSupportGetImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement +) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT8 ImageIndex; + VOID *Image; + UINTN ImageSize; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceSupportGuid001; + ResultMessageLabel =3D L"GetImage, function support check"; + + ImageIndex =3D 0; + Image =3D NULL; + ImageSize =3D 0; + + // + // Check if function is supported + // + + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + ImageIndex, + Image, + &ImageSize + ); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Status =3D=3D EFI_UNSUPPORTED) { + ResultMessageData =3D L"function is NOT supported"; + } else { + ResultMessageData =3D L"function is supported."; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (Image !=3D NULL) { + gtBS->FreePool (Image); + } + + if (Status =3D=3D EFI_UNSUPPORTED) { + return EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } +} + +// ***********************************************************************= ***** +// Support Routine: CheckForSupportSetImage +// ***********************************************************************= ***** + +EFI_STATUS +CheckForSupportSetImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement +) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT8 ImageIndex; + VOID *Image; + UINTN ImageSize; + CHAR16 *AbortReason; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceSupportGuid002; + ResultMessageLabel =3D L"SetImage, function support check"; + + ImageIndex =3D 0; + Image =3D NULL; + ImageSize =3D 0; + AbortReason =3D NULL; + + // + // Check if function is supported + // + + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Status =3D=3D EFI_UNSUPPORTED) { + ResultMessageData =3D L"function is NOT supported"; + } else { + ResultMessageData =3D L"function is supported."; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + if (Status =3D=3D EFI_UNSUPPORTED) { + return EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } +} + +// ***********************************************************************= ***** +// Support Routine: CheckForSupportCheckImage +// ***********************************************************************= ***** + +EFI_STATUS +CheckForSupportCheckImage ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement +) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT8 ImageIndex; + VOID *Image; + UINTN ImageSize; + UINT32 ImageUpdatable; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceSupportGuid003; + ResultMessageLabel =3D L"CheckImage, function support check"; + + ImageIndex =3D 0; + Image =3D NULL; + ImageSize =3D 0; + + // + // Check if function is supported + // + + Status =3D FirmwareManagement->CheckImage ( + FirmwareManagement, + ImageIndex, + Image, + ImageSize, + &ImageUpdatable + ); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Status =3D=3D EFI_UNSUPPORTED) { + ResultMessageData =3D L"function is NOT supported"; + } else { + ResultMessageData =3D L"function is supported."; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (Status =3D=3D EFI_UNSUPPORTED) { + return EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } +} + +// ***********************************************************************= ***** +// Support Routine: CheckForSupportSetPackageInfo +// ***********************************************************************= ***** + +EFI_STATUS +CheckForSupportSetPackageInfo ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement +) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + VOID *Image; + UINTN ImageSize; + VOID *VendorCode; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceSupportGuid004; + ResultMessageLabel =3D L"SetPackageInfo, function support check"; + + Image =3D NULL; + ImageSize =3D 0; + VendorCode =3D NULL; + PackageVersion =3D 0; + PackageVersionName =3D NULL; + + // + // Check if function is supported + // + + Status =3D FirmwareManagement->SetPackageInfo ( + FirmwareManagement, + Image, + ImageSize, + VendorCode, + PackageVersion, + PackageVersionName + ); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Status =3D=3D EFI_UNSUPPORTED) { + ResultMessageData =3D L"function is NOT supported"; + } else { + ResultMessageData =3D L"function is supported."; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (Status =3D=3D EFI_UNSUPPORTED) { + return EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } +} + +// ***********************************************************************= ***** +// Test Cases +// +// +// ***********************************************************************= ***** + +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + return EFI_SUCCESS; +} +*/ + +// ***********************************************************************= ***** +// Test Case: GetImageInfo +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManag= ement); + BBTestGetImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManag= ement); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: GetImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + // + + Status =3D CheckForSupportGetImage (StandardLib, FirmwareManagement); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagemen= t); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: SetImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestSetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + // + + Status =3D CheckForSupportSetImage (StandardLib, FirmwareManagement); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestSetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagemen= t); + //BBTestSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagem= ent); + BBTestSetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagemen= t); + BBTestSetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagemen= t); + + return Status; +} + +// ***********************************************************************= ***** +// Test Case: CheckImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestCheckImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + // + + Status =3D CheckForSupportCheckImage (StandardLib, FirmwareManagement); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestCheckImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagem= ent); + BBTestCheckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagem= ent); + + return Status; +} + +// ***********************************************************************= ***** +// Test Case: SetPackageInfo +// ***********************************************************************= ***** + +EFI_STATUS +BBTestSetPackageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + // + + Status =3D CheckForSupportSetPackageInfo (StandardLib, FirmwareManagemen= t); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestSetPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareMan= agement); + + return Status; +} + +// ***********************************************************************= ***** +// Check Points +// +// +// ***********************************************************************= ***** + +// ***********************************************************************= ***** +// Checkpoint: GetImageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except ImageInfoSize =3D 1. + The function should return EFI_BUFFER_TOO_SMALL and ImageInfoSize > = 1. +**/ + +EFI_STATUS +BBTestGetImageInfoConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid001; + ResultMessageLabel =3D L"GetImageInfo, conformance checkpoint #1"; + ResultMessageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL."; + + ImageInfo =3D NULL; + PackageVersionName =3D NULL; + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + ImageInfoSize =3D 1; + + // + // Check the data returned by the function + // + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + + if (Status !=3D EFI_BUFFER_TOO_SMALL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_BUFFER_TOO_SMALL."; + goto Exit; + } + if (ImageInfoSize <=3D 1) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to update *ImageInfoSize."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (ImageInfo !=3D NULL) { + gtBS->FreePool (ImageInfo); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImageInfo, 2 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except &ImageInfoSize =3D NULL= . + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestGetImageInfoConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid002; + ResultMessageLabel =3D L"GetImageInfo, conformance checkpoint #2"; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + + ImageInfo =3D NULL; + PackageVersionName =3D NULL; + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + // + // Check the data returned by the function + // + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + NULL, // &ImageInfoSize + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + + if (Status !=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (ImageInfo !=3D NULL) { + gtBS->FreePool (ImageInfo); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except ImageSize =3D 1. + The function should return EFI_BUFFER_TOO_SMALL and ImageSize > 1. +**/ + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid003; + ResultMessageLabel =3D L"GetImage, conformance checkpoint #1"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + + ImageSize =3D 1; + FunctionTested++; + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_BUFFER_TOO_SMALL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_BUFFER_TOO_SMALL."; + goto Exit; + } + if (ImageInfoSize <=3D 1) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to update *ImageSize."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImage, 2 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image =3D NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid004; + ResultMessageLabel =3D L"GetImage, conformance checkpoint #2"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL. + ImageSize =3D p->Size * 2; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImage, 3 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except ImageIndex =3D 0 or + ImageIndex =3D DescriptorCount + 1. + The function should return EFI_INVALID_PARAMETER or EFI_NOT_FOUND. +**/ + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + VOID *Image; + UINTN ImageSize; + UINT8 ImageIndex; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid005; + ResultMessageLabel =3D L"GetImage, conformance checkpoint #3"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + // Dummy image so as to fail on Image =3D NULL + // Any size since the function should check for index before size + ImageSize =3D 64; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_NO= T_FOUND."; + + ImageIndex =3D 0; + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + ImageIndex, + Image, + &ImageSize + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND)) = { + goto Exit; + } + + if ((DescriptorCount + 1) !=3D 0) { + ImageIndex =3D DescriptorCount + 1; + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + ImageIndex, + Image, + &ImageSize + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND)= ) { + goto Exit; + } + } + + // + // Report the checkpoint result + // + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_= NOT_FOUND."; + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImage, 4 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except Image has dummy + authentication data. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestGetImageConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid006; + ResultMessageLabel =3D L"GetImage, conformance checkpoint #4"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL. + ImageSize =3D p->Size * 2; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + + FunctionTested++; + + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image =3D NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid007; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #1"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 2 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image is a dummy image. + The function should return EFI_INVALID_PARAMETER or EFI_ABORTED. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid008; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #2"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) = { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER or EF= I_ABORTED."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER or EF= I_ABORTED."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 3 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except ImageIndex =3D 0 or + ImageIndex =3D DescriptorCount + 1. + The function should return EFI_INVALID_PARAMETER or EFI_ABORTED. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + UINT8 ImageIndex; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid009; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #3"; + + BufferImageInfo =3D NULL; + BufferImage=3DNULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + // Dummy image so as to fail on Image =3D NULL + // Any size since the function should check for index before size + ImageSize =3D 64; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_AB= ORTED."; + + ImageIndex =3D 0; + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) { + goto Exit; + } + + if ((DescriptorCount + 1) !=3D 0) { + ImageIndex =3D DescriptorCount + 1; + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + ImageIndex, + Image, + ImageSize, + NULL, // Vendorcode + Progress, + &AbortReason + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) = { + goto Exit; + } + } + + // + // Report the checkpoint result + // + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_= ABORTED."; + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 4 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except Image has dummy + authentication data. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid010; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #4"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->SetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: CheckImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image =3D NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestCheckImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + UINT32 ImageUpdatable; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid011; + ResultMessageLabel =3D L"CheckImage, conformance checkpoint #1"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->CheckImage ( + FirmwareManagement, + p->ImageIndex, + Image, + ImageSize, + &ImageUpdatable + ); + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: CheckImage, 2 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except Image has dummy + authentication data. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestCheckImageConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + UINT32 ImageUpdatable; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid012; + ResultMessageLabel =3D L"CheckImage, conformance checkpoint #2"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->CheckImage ( + FirmwareManagement, + p->ImageIndex, + Image, + ImageSize, + &ImageUpdatable + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if (Status !=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetPackageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Gets PackageVersionNameMaxLen. + - Calls function with valid parameters, except PackageVersionName is l= onger + than the value returned in PackageVersionNameLen. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + CHAR16 *TestName; + UINT32 TestNameLength; + + UINTN i; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid013; + ResultMessageLabel =3D L"SetPackageInfo, function checkpoint #1"; + + PackageVersionName =3D NULL; + TestName =3D NULL; + + // + // Get PackageVersionNameMaxLen + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + if (PackageVersionNameMaxLen =3D=3D 0) { + goto Exit; + } + if (((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) =3D= =3D + PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + goto Exit; + } + if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + + // + // Check the data returned by the function + // + + gtBS->FreePool (PackageVersionName); + PackageVersionName =3D NULL; + TestNameLength =3D PackageVersionNameMaxLen + 1; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + TestNameLength * 2, // Unicode + (VOID **) &TestName + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + for (i =3D 0; i < (TestNameLength - 1); i++) { + TestName[i] =3D L' '; + } + TestName[i] =3D L'\0'; + Status =3D FirmwareManagement->SetPackageInfo ( + FirmwareManagement, + NULL, // Image + 0, // ImageSize + NULL, // VendorCode + 0x01010101, // Dummy PackageVersion + TestName + ); + + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (TestName !=3D NULL) { + gtBS->FreePool (TestName); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetPackageInfo, 2 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except Image is NULL. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + VOID *Image; + UINTN ImageSize; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid014; + ResultMessageLabel =3D L"SetPackageInfo, function checkpoint #2"; + + PackageVersionName =3D NULL; + + // + // Get PackageVersionNameMaxLen + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D= PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + + // + // Check the data returned by the function + // + + Image =3D NULL; + ImageSize =3D 64; // Dummy + Status =3D FirmwareManagement->SetPackageInfo ( + FirmwareManagement, + Image, + ImageSize, + NULL, // VendorCode + PackageVersion, + PackageVersionName + ); + + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetPackageInfo, 3 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except ImageSize is 0. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + VOID *Image; + UINTN ImageSize; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid015; + ResultMessageLabel =3D L"SetPackageInfo, function checkpoint #3"; + + PackageVersionName =3D NULL; + Image =3D NULL; + + // + // Get PackageVersionNameMaxLen + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D= PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + + // + // Check the data returned by the function + // + + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + 64, // Dummy + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + ImageSize =3D 0; + Status =3D FirmwareManagement->SetPackageInfo ( + FirmwareManagement, + Image, + ImageSize, + NULL, // VendorCode + PackageVersion, + PackageVersionName + ); + + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (Image !=3D NULL) { + gtBS->FreePool (Image); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetPackageInfo, 4 +// ***********************************************************************= ***** + +/** + This routine: + - The function requires authentication. + - Calls function with valid parameters, except Image has a dummy + authentication data. + The function should return EFI_SECURITY_VIOLATION. +**/ + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + VOID *Image; + UINTN ImageSize; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid016; + ResultMessageLabel =3D L"SetPackageInfo, function checkpoint #4"; + + PackageVersionName =3D NULL; + Image =3D NULL; + ImageSize =3D 64; + + // + // Get PackageVersionNameMaxLen + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D= PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + goto Exit; + } + if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + + // + // Check the data returned by the function + // + + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->SetPackageInfo ( + FirmwareManagement, + Image, + ImageSize, + NULL, // VendorCode + PackageVersion, + PackageVersionName + ); + + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION."; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (Image !=3D NULL) { + gtBS->FreePool (Image); + } + + return EFI_SUCCESS; +} + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestFunction.c b/uefi-sct/SctPkg/TestCase/= UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestF= unction.c new file mode 100644 index 00000000..99a74aa5 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestFunction.c @@ -0,0 +1,891 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + FirmwareManagementBBTestFunction.c + +Abstract: + Firmware Management Protocol's function tests. + +--*/ + +#define DEBUG_ALL 0 +#define DEBUG_GET_IMAGE_INFO 1 +#define DEBUG_GET_IMAGE 0 +#define DEBUG_GET_PACKAGE_INFO 1 + + +#include "SctLib.h" +#include "FirmwareManagementBBTestMain.h" + +// ***********************************************************************= ***** +// Check Points +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageInfoFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetImageFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +EFI_STATUS +BBTestGetPackageInfoFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ); + +// ***********************************************************************= ***** +// Test Cases +// +// +// ***********************************************************************= ***** + +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + return EFI_SUCCESS; +} +*/ + +// ***********************************************************************= ***** +// Test Case: GetImageInfo +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManageme= nt); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: GetImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageFunctionTestCheckpoint1 (StandardLib, FirmwareManagement); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: GetPackageInfo +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetPackageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManage= ment); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Check Points +// +// +// ***********************************************************************= ***** + +// ***********************************************************************= ***** +// Checkpoint: GetImageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with all valid parameters. + The function should return EFI_SUCCESS. + - Checks DescriptorSize is 0. + - Checks (DescriptorCount * DescriptorSize) is <=3D ImageInfoSize. + - Checks DescriptorVersion is =3D=3D 1. + - Checks ImageIndex is between 1 and DescriptorCount. + - Checks AttributesSupported has no bits set beyond bit3. + - Checks AttribtuesSetting has no bits set beyond bit3. + - Checks Compatibilities bit1 thru bit15 are 0s. +**/ + +EFI_STATUS +BBTestGetImageInfoFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16* Attribute[4]; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + +#if (DEBUG_ALL || DEBUG_GET_IMAGE_INFO) + + CHAR16 *BitField; + CHAR16 *BitSetting; + + UINT64 j; + UINTN k; + +#endif + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestFunctionAssertionGuid001; + ResultMessageLabel =3D L"GetImageInfo, function checkpoint #1"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + PackageVersionName =3D NULL; + + Attribute[0] =3D L"Image Updatable"; + Attribute[1] =3D L"Reset Required"; + Attribute[2] =3D L"Authentication Required"; + Attribute[3] =3D L"In Use"; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + } + + // + // Check the data returned by the function + // + + BufferImageInfo =3D ImageInfo; + + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SUCCESS."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SUCCESS."; + goto Exit; + } + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + if (DescriptorVersion !=3D 1) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"*DescriptorVersion !=3D 1."; + goto Exit; + } + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (p->ImageIndex > DescriptorCount) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"ImageIndex is beyond DescriptorCount."; + goto Exit; + } + + if ((p->AttributesSupported & 0xFFFFFFFFFFFFFFF0) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"AttributesSupported has bit(s) set beyond bi= t3."; + goto Exit; + } + + if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"AttributesSetting has bit(s) set beyond bit3= ."; + goto Exit; + } + + if ((p->Compatibilities & 0x000000000000FFFE) !=3D0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"Compatibilities have bit(s) set between bit1= and bit15."; + goto Exit; + } + } + +#if (DEBUG_ALL || DEBUG_GET_IMAGE_INFO) + + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L"Firmware Image Info Header: \n" + L" - *ImageInfoSize =3D %x\n" + L" - *DescriptorVersion =3D %x\n" + L" - *DescriptorCount =3D %x\n" + L" - *DescriptorSzie =3D %x\n" + L" - *PackageVersion =3D %08x\n" + L" - **PackageVersionName =3D %s\n", + ImageInfoSize, + DescriptorVersion, + DescriptorCount, + DescriptorSize, + PackageVersion, + PackageVersionName + ); + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L"Descriptor Index =3D %x:\n" + L" - ImageTypeId =3D %08x-%04x-%04x-%02x%02x%02x%02x%0= 2x%02x%02x%02x", + p->ImageIndex, + p->ImageTypeId.Data1, + p->ImageTypeId.Data2, + p->ImageTypeId.Data3, + p->ImageTypeId.Data4[0], + p->ImageTypeId.Data4[1], + p->ImageTypeId.Data4[2], + p->ImageTypeId.Data4[3], + p->ImageTypeId.Data4[4], + p->ImageTypeId.Data4[5], + p->ImageTypeId.Data4[6], + p->ImageTypeId.Data4[7] + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - ImageId =3D %016X\n" + L" - *ImageIdName =3D %s\n" + L" - Version =3D %08x\n" + L" - *VersionName =3D %s\n" + L" - Size =3D %x", + p->ImageId, + p->ImageIdName, + p->Version, + p->VersionName, + p->Size + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - AttributesSupported =3D %016x\n" + L" - AttributesSetting =3D %016x", + p->AttributesSupported, + p->AttributesSetting + ); + for (j =3D 1, k =3D 0; j <=3D IMAGE_ATTRIBUTE_IN_USE; j =3D SctLShiftU= 64(j, 1), k++) { + BitField =3D Attribute[k]; + if ((p->AttributesSupported & j) !=3D j) { + BitSetting =3D L"Not Supported"; + } else if ((p->AttributesSetting & j) =3D=3D j) { + BitSetting =3D L"Yes"; + } else { + BitSetting =3D L"No"; + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - %s =3D %s", + BitField, + BitSetting + ); + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - Compatibilities =3D %016x\n", + p->Compatibilities + ); + } + +#endif + + // + // Report the checkpoint result + // + + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with all valid parameters. + The function should return EFI_SUCCESS or EFI_UNSUPPORTED. +**/ + +EFI_STATUS +BBTestGetImageFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestFunctionAssertionGuid002; + ResultMessageLabel =3D L"GetImage, function checkpoint #1"; + + BufferImageInfo =3D NULL; + BufferImage =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (ImageInfo); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + Status =3D FirmwareManagement->GetImageInfo ( + FirmwareManagement, + &ImageInfoSize, + ImageInfo, + &DescriptorVersion, + &DescriptorCount, + &DescriptorSize, + &PackageVersion, + &PackageVersionName + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + BufferImageInfo =3D ImageInfo; + goto Exit; + } + } + BufferImageInfo =3D ImageInfo; + + if (DescriptorSize =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"*DescriptorSize is 0."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + } + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + + FunctionTested++; + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + gtBS->FreePool (Image); + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + } + BufferImage =3D Image; + + Status =3D FirmwareManagement->GetImage ( + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; + + // + // Report the checkpoint result + // + + if ((Status !=3D EFI_SUCCESS) && (Status !=3D EFI_UNSUPPORTED)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSUPPOR= TED."; + goto Exit; + } + } + + if (FunctionTested =3D=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UNSUPPOR= TED."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetPackageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with all valid parameters. + The function should return EFI_SUCCESS or EFI_UNSUPPORTED. + - Checks AttributesSupported has no bits set beyond bit2. + - Checks AttributesSetting has no bits set beyond bit2. +**/ + +EFI_STATUS +BBTestGetPackageInfoFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + CHAR16* Attribute[3]; + +#if (DEBUG_ALL || DEBUG_GET_PACKAGE_INFO) + + CHAR16 *BitField; + CHAR16 *BitSetting; + + UINT64 j; + UINTN k; + +#endif + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestFunctionAssertionGuid003; + ResultMessageLabel =3D L"GetPackageInfo, function checkpoint #1"; + + PackageVersionName =3D NULL; + + Attribute[0] =3D L"Version Updatable"; + Attribute[1] =3D L"Reset Required"; + Attribute[2] =3D L"Authentication Required"; + + // + // Check the data returned by the function + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + + if ((Status =3D=3D EFI_SUCCESS) || (Status =3D=3D EFI_UNSUPPORTED)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UNSUPPOR= TED."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSUPPORTE= D."; + goto Exit; + } + +#if (DEBUG_ALL || DEBUG_GET_PACKAGE_INFO) + + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L"Firmware Package Info: \n" + L" - *PackageVersion =3D %08x\n" + L" - **PackageVersionName =3D %s\n" + L" - *PackageVersionNameMaxLen =3D %08x", + PackageVersion, + PackageVersionName, + PackageVersionNameMaxLen + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - *AttributesSupported =3D %016x\n" + L" - *AttributesSetting =3D %016x", + AttributesSupported, + AttributesSetting + ); + for (j =3D 1, k =3D 0; j <=3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED;= j =3D SctLShiftU64(j, 1), k++) { + BitField =3D Attribute[k]; + if ((AttributesSupported & j) !=3D j) { + BitSetting =3D L"Not Supported"; + } else if ((AttributesSetting & j) =3D=3D j) { + BitSetting =3D L"Yes"; + } else { + BitSetting =3D L"No"; + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - %s =3D %s", + BitField, + BitSetting + ); + } + +#endif + + if ((AttributesSupported & 0xFFFFFFFFFFFFFFF8) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"*AttributesSupported has bit(s) set beyond bit= 2."; + goto Exit; + } + + if ((AttributesSetting & 0xFFFFFFFFFFFFFFF8) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"*AttributesSetting has bit(s) set beyond bit2.= "; + goto Exit; + } + + // + // Report the checkpoint result + // + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + + return EFI_SUCCESS; +} + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI= /IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.= c new file mode 100644 index 00000000..3ce62795 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestMain.c @@ -0,0 +1,228 @@ +/** @file + + Copyright 2006 - 2017 Unified EFI, Inc.
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + + FirmwareManagementBBTestMain.c + +Abstract: + + Firmware Management Protocol test driver. + +--*/ + +#include "SctLib.h" +#include "FirmwareManagementBBTestMain.h" + +// ***********************************************************************= ***** +// Variables +// ***********************************************************************= ***** + +EFI_HANDLE mImageHandle; + +EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface; + +EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField =3D { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_REVISION, + IHV_EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID, + L"Firmware Management Protocol Test", + L"UEFI 2.3 Firmware Management Protocol Black-Box Test" +}; + +EFI_GUID gSupportProtocolGuid[] =3D { + EFI_STANDARD_TEST_LIBRARY_GUID, + EFI_NULL_GUID +}; + +EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] =3D { + /* + //Use for unit test only + { + { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0x= b0, 0x6d } }, + L"Unit Test Only", + L"Verify the Assistant Function", + EFI_TEST_LEVEL_DEFAULT, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestUnitTest + }, + */ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101, + L"Function_Test-GetImageInfo", + L"Function auto test for Firmware Management Protocol GetImageInfo()."= , + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageInfoFunctionTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102, + L"Function_Test-GetImage", + L"Function auto test for Firmware Management Protocol GetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageFunctionTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103, + L"Function Test - SetImage", + L"Function auto test for Firmware Management Protocol SetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetImageFunctionTest + }, +--*/ +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104, + L"Function Test - CheckImage", + L"Function auto test for Firmware Management Protocol CheckImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCheckImageFunctionTest + }, +--*/ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105, + L"Function_Test-GetPackageInfo", + L"Function auto test for Firmware Management Protocol GetPackageInfo()= .", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetPackageInfoFunctionTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106, + L"Function Test - SetPackageInfo", + L"Function auto test for Firmware Management Protocol SetPackageInfo()= .", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetPackageInfoFunctionTest + }, +--*/ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201, + L"Conformance_Test-GetImageInfo", + L"Conformance auto test for Firmware Management Protocol GetImageInfo(= ).", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageInfoConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202, + L"Conformance_Test-GetImage", + L"Conformance auto test for Firmware Management Protocol GetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203, + L"Conformance_Test-SetImage", + L"Conformance auto test for Firmware Management Protocol SetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetImageConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204, + L"Conformance_Test-CheckImage", + L"Conformance auto test for Firmware Management Protocol CheckImage().= ", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCheckImageConformanceTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205, + L"Conformance Test - GetPackageInfo", + L"Conformance auto test for Firmware Management Protocol GetPackageInf= o().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetPackageInfoConformanceTest + }, +--*/ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206, + L"Conformance_Test-SetPackageInfo", + L"Conformance auto test for Firmware Management Protocol SetPackageInf= o().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetPackageInfoConformanceTest + }, + 0 +}; + +// ***********************************************************************= ***** +// Initialization and Unload functions +// ***********************************************************************= ***** + + +EFI_STATUS +EFIAPI +InitializeFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EfiInitializeTestLib (ImageHandle, SystemTable); + + // + // initialize test utility lib + // + + SctInitializeLib (ImageHandle, SystemTable); + + mImageHandle =3D ImageHandle; + + return EfiInitAndInstallIHVBBTestInterface ( + &ImageHandle, + &gBBTestProtocolField, + gBBTestEntryField, + UnloadFirmwareManagementBBTest, + &gBBTestProtocolInterface + ); +} + +EFI_STATUS +EFIAPI +UnloadFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle + ) +{ + return EfiUninstallAndFreeIHVBBTestInterface ( + ImageHandle, + gBBTestProtocolInterface + ); +} + +// ***********************************************************************= ***** +// Support functions +// ***********************************************************************= ***** + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI= /IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.= h new file mode 100644 index 00000000..92ac3e45 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestMain.h @@ -0,0 +1,223 @@ +/** @file + + Copyright 2006 - 2017 Unified EFI, Inc.
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + + FirmwareManagementBBTestMain.h + +Abstract: + + Header file for Firmware Management Protocol test driver. + +--*/ + +#ifndef _FIRMWARE_MANAGEMENT_BB_TEST_MAIN +#define _FIRMWARE_MANAGEMENT_BB_TEST_MAIN + +#include "Efi.h" +#include "Guid.h" +#include + +#include + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_REVISION 0x00010000 + +#define IHV_EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \ +{ 0x941d02a8, 0x49ad, 0x4bda, { 0x9f, 0xae, 0x0a, 0x69, 0x24, 0x54, 0x1c, = 0x88 } } +// ***********************************************************************= ***** +// Entry GUIDs for Function Test +// ***********************************************************************= ***** + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101 \ +{ 0x7ddddd57, 0x68ff, 0x460e, { 0x90, 0xad, 0xa9, 0xd5, 0xf1, 0xf0, 0xa0, = 0x87 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102 \ +{ 0x5b4c24b2, 0x852d, 0x418a, { 0x82, 0x34, 0xc2, 0xc8, 0x63, 0x5e, 0x9a, = 0x2a } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103 \ +{ 0x84062e44, 0xdaee, 0x41a5, { 0x94, 0xf8, 0x6d, 0xe0, 0x72, 0x9b, 0xfa, = 0xb4 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104 \ +{ 0xdeb26021, 0xca4e, 0x4876, { 0x90, 0x99, 0xca, 0x7d, 0x77, 0x2c, 0x90, = 0x1d } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105 \ +{ 0xaa160ecc, 0xfc2f, 0x4f05, { 0xac, 0x20, 0x4c, 0xed, 0x45, 0xde, 0xda, = 0xab } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106 \ +{ 0x7a9a2714, 0xf32b, 0x4083, { 0x90, 0xf2, 0x12, 0x51, 0x1a, 0x87, 0x48, = 0x1a } } + +// ***********************************************************************= ***** +// Entry GUIDs for Conformance Test +// ***********************************************************************= ***** + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201 \ +{ 0x54ee347c, 0x10a3, 0x4311, { 0x94, 0x27, 0xa8, 0x97, 0xbf, 0xdc, 0x98, = 0x8 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202 \ +{ 0x68aba93c, 0x1d0c, 0x412f, { 0xb1, 0xe, 0xe3, 0xa4, 0x6, 0xbc, 0x42, 0x= cf } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203 \ +{ 0x12834a23, 0x6cef, 0x478e, { 0xaf, 0x48, 0x44, 0xe5, 0x93, 0x40, 0xab, = 0xe8 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204 \ +{ 0xc6dc94b1, 0xb81b, 0x4b85, { 0x8b, 0x7d, 0x8f, 0xbf, 0xa6, 0x8e, 0xf3, = 0xe5 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205 \ +{ 0x3d13f23d, 0x8306, 0x49d4, { 0xa0, 0xe0, 0x9a, 0x9b, 0xf6, 0x89, 0x40, = 0x3c } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206 \ +{ 0x24cf9ac2, 0x9abc, 0x4f5c, { 0x9c, 0x7a, 0xbc, 0x22, 0x29, 0xc3, 0x2, 0= x7f } } + +// ***********************************************************************= ***** +// Initializaiton and Unload functions +// ***********************************************************************= ***** + +EFI_STATUS +EFIAPI +InitializeFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + +EFI_STATUS +EFIAPI +UnloadFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle + ); + +// +// Test Cases - Unit Test +// + +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +*/ + +// +// Test Cases - Function +// + +EFI_STATUS +BBTestGetImageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestCheckImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetPackageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetPackageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +// +// Test Cases - Conformance +// + +EFI_STATUS +BBTestGetImageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestCheckImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetPackageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +// ***********************************************************************= ***** +// Support functions +// ***********************************************************************= ***** + +#endif diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMa= nagement/BlackBoxTest/Guid.c new file mode 100644 index 00000000..c33d5b79 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/Guid.c @@ -0,0 +1,63 @@ +/** @file + + Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + + Module Name: + + Guid.c + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +#include "Efi.h" +#include "Guid.h" + +// ***********************************************************************= ***** +// Function +// ***********************************************************************= ***** + +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001=3DEFI_TEST_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002=3DEFI_TEST_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003=3DEFI_TEST_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID; + +// ***********************************************************************= ***** +// Conformance +// ***********************************************************************= ***** + +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID; + +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMa= nagement/BlackBoxTest/Guid.h new file mode 100644 index 00000000..d2b2e51d --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/Guid.h @@ -0,0 +1,153 @@ +/** @file + + Copyright 2006 - 2010 Unified EFI, Inc.
+ Copyright (c) 2010, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + + Module Name: + + Guid.h + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +// ***********************************************************************= ***** +// Function +// ***********************************************************************= ***** + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID \ +{ 0xd02b40ae, 0x62f, 0x4155, { 0xbb, 0xdd, 0x4, 0x29, 0x18, 0x94, 0xea, 0x= 31 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID \ +{ 0xff704c46, 0x3999, 0x4a28, { 0xa3, 0x6e, 0x76, 0x8a, 0xb6, 0xad, 0x89, = 0xd8 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID \ +{ 0x70884539, 0x9a34, 0x4146, { 0x83, 0x3a, 0x4d, 0x89, 0x8b, 0x9c, 0x7e, = 0xa4 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003; + +// ***********************************************************************= ***** +// Conformance - Function Support Check +// ***********************************************************************= ***** + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID \ +{ 0xd9c7d018, 0x60ba, 0x448d, { 0xb1, 0x3b, 0x88, 0x8b, 0x41, 0xd9, 0xdc, = 0x9 } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID \ +{ 0x28310f16, 0x690e, 0x44a5, { 0x93, 0x98, 0xe1, 0xcd, 0x6a, 0xb3, 0xe1, = 0x61 } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID \ +{ 0x92cc940a, 0xdcf8, 0x42a0, { 0x81, 0xa1, 0xd7, 0xdd, 0x43, 0x87, 0xbf, = 0x6d } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID \ +{ 0x3f910041, 0xcd4d, 0x4b36, { 0xb2, 0x23, 0xfb, 0x16, 0x4e, 0x7e, 0x6a, = 0x8c } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004; + +// ***********************************************************************= ***** +// Conformance - Assertion +// ***********************************************************************= ***** + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID \ +{ 0x3789b80e, 0xab70, 0x4dc9, { 0xbb, 0xbd, 0x70, 0x63, 0x76, 0x36, 0xab, = 0x52 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID \ +{ 0xca1d7706, 0x256b, 0x464e, { 0xb6, 0xee, 0x50, 0x34, 0x1e, 0xec, 0x3c, = 0x83 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID \ +{ 0x3c8d87b2, 0x6a89, 0x4a6c, { 0xbc, 0x75, 0xe6, 0x86, 0xa1, 0x49, 0x13, = 0xf0 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID \ +{ 0x88031c96, 0x99bf, 0x4d2c, { 0x9f, 0x57, 0xa7, 0x2, 0x6a, 0xbc, 0xd3, 0= x51 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID \ +{ 0x7a386361, 0x3a5d, 0x4e58, { 0x8a, 0x51, 0x4d, 0x93, 0xb6, 0x55, 0x95, = 0xf4 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID \ +{ 0xd6a77629, 0x5afd, 0x4854, { 0x87, 0xc8, 0xee, 0x9f, 0xc5, 0x3d, 0xbe, = 0x3d } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID \ +{ 0x4ea24764, 0xa6b1, 0x43b5, { 0xb8, 0xa0, 0xd3, 0x3f, 0xdc, 0x8b, 0xc6, = 0xe4 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID \ +{ 0x712ce1e9, 0x80d1, 0x4168, { 0xb8, 0xd0, 0x74, 0xd1, 0x72, 0x7a, 0x2f, = 0x25 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID \ +{ 0xc82d1373, 0x1f87, 0x45f4, { 0xaf, 0xfc, 0x10, 0xa7, 0xf7, 0xb0, 0x9c, = 0xb0 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID \ +{ 0x2410a859, 0xdf6f, 0x4857, { 0x92, 0x4a, 0x26, 0x37, 0x7, 0x11, 0xf, 0x= 1c } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID \ +{ 0x3987172c, 0xe6a0, 0x4099, { 0xb1, 0x2b, 0xd8, 0xef, 0xf2, 0x62, 0x75, = 0x93 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID \ +{ 0xd6dad28e, 0x7f0f, 0x4f56, { 0x9a, 0x93, 0x14, 0x7d, 0xb3, 0x74, 0x0, 0= xc9 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID \ +{ 0xb5288fc3, 0xe906, 0x4468, { 0x83, 0x3d, 0xd4, 0xa6, 0x58, 0xa5, 0x4f, = 0xbd } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID \ +{ 0x57355301, 0x1343, 0x497f, { 0xbe, 0xe0, 0x8e, 0x5c, 0x27, 0xd2, 0x40, = 0x25 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID \ +{ 0xadeab82d, 0x7592, 0x40fe, { 0x87, 0xa8, 0x93, 0x2b, 0xad, 0x97, 0xff, = 0x5e } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID \ +{ 0x9be658d2, 0x1312, 0x4254, { 0x91, 0x10, 0x59, 0x0, 0xd5, 0xfd, 0x6c, 0= x6c } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/IhvFirmwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UEF= I/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.= inf new file mode 100644 index 00000000..7566a044 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/IhvFirmwareManagementBBTest.inf @@ -0,0 +1,52 @@ +## @file +# +# Copyright 2006 - 2012 Unified EFI, Inc.
+# Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +## +#/*++ +# +# Module Name: +# +# FirmwareManagementBBTest.inf +# +# Abstract: +# +# Component description file for IHV Firmware Management Protocol Black-= Box Test. +# +#--*/ + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D IhvFirmwareManagementBBTest + FILE_GUID =3D DB0E842F-201B-4D47-BA74-88602A41C9D2 + MODULE_TYPE =3D UEFI_DRIVER + COMPONENT_TYPE =3D BS_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeFirmwareManagementBBTest + +[sources.common] + FirmwareManagementBBTestConformance.c + FirmwareManagementBBTestFunction.c + FirmwareManagementBBTestMain.c + Guid.c + +[Packages] + MdePkg/MdePkg.dec + SctPkg/SctPkg.dec + SctPkg/UEFI/UEFI.dec + +[LibraryClasses] + UefiDriverEntryPoint + SctLib + EfiTestLib + +[Protocols] diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/Guid.c new file mode 100644 index 00000000..6a6d4e60 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/Guid.c @@ -0,0 +1,46 @@ +/** @file + + Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c) 2010 - 2012, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + + Module Name: + + Guid.c + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +#include "HIIConfigAccessBBTestMain.h" + +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid003=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid004=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid005=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid006=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID; +/* +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid008=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid009=3DEFI_TEST_HIIC= ONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0010=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0011=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0012=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID; +*/ +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid001=3DEFI_TEST_HIICONF= IGACCESSBBTESTFUNCTION_ASSERTION_001_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid002=3DEFI_TEST_HIICONF= IGACCESSBBTESTFUNCTION_ASSERTION_002_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid003=3DEFI_TEST_HIICONF= IGACCESSBBTESTFUNCTION_ASSERTION_003_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid004=3DEFI_TEST_HIICONF= IGACCESSBBTESTFUNCTION_ASSERTION_004_GUID; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcce= ss/BlackBoxTest/Guid.h new file mode 100644 index 00000000..b7003028 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/Guid.h @@ -0,0 +1,109 @@ +/** @file + + Copyright 2006 - 2011 Unified EFI, Inc.
+ Copyright (c) 2010 - 2011, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + + Module Name: + + Guid.h + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID \ +{ 0xa7173eb5, 0xf76a, 0x4ea1, { 0x95, 0xd, 0x14, 0x91, 0x1e, 0x49, 0x86, 0= xc1 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \ +{ 0xfa5973e2, 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, 0= x76 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID \ +{ 0x6f6d1dd, 0x49b8, 0x488a, { 0xa7, 0x75, 0xde, 0xbc, 0xc7, 0x60, 0xfd, 0= x28 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid003; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID \ +{ 0x28652613, 0x6bf4, 0x4f42, { 0xab, 0xe2, 0x84, 0x4f, 0x2f, 0x77, 0xec, = 0x2f } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid004; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID \ +{ 0xebba197a, 0x467f, 0x4736, { 0x92, 0xf2, 0x11, 0xb1, 0x91, 0x2e, 0xe9, = 0x90 } } + + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid005; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID \ +{ 0x341fe3e0, 0xf688, 0x45f2, { 0x91, 0x56, 0xc7, 0xae, 0x9f, 0x2c, 0xcb, = 0xb0 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid006; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID \ +{ 0x1f99ebc8, 0x253, 0x455f, { 0x88, 0xac, 0x9e, 0x2b, 0xa6, 0xdc, 0xd7, 0= x29 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007; +/* +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID \ +{ 0xbdec5b08, 0x423, 0x482b, { 0xb7, 0xdf, 0xde, 0xac, 0xab, 0xf7, 0x13, 0= x11 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid008; + + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID \ +{ 0x5fed024d, 0x85f3, 0x45bf, { 0xbe, 0xb1, 0xe4, 0xf4, 0xcc, 0x86, 0xe5, = 0x61 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid009; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID \ +{ 0x22ee938e, 0xa9ad, 0x4cb9, { 0x8d, 0x6d, 0x6, 0xe4, 0xfa, 0xb3, 0x72, 0= xe7 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0010; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID \ +{ 0x2053d3e0, 0xeebe, 0x4391, { 0x84, 0x7d, 0xf4, 0x60, 0x1b, 0x30, 0x4e, = 0x3 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0011; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID \ +{ 0x81c5d7b7, 0x7ebe, 0x44e1, { 0x8a, 0x1f, 0xcc, 0x47, 0x9c, 0x2d, 0xfe, = 0x4f } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0012; +*/ + +#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID \ +{ 0x24dcf8bf, 0xbfbf, 0x4588, { 0xba, 0xf, 0x77, 0x1e, 0x24, 0x4e, 0x3e, 0= x8 } } + +extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid001; + +#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID \ +{ 0x961a5268, 0x1998, 0x4a7e, { 0x9d, 0x9d, 0xce, 0xdc, 0x67, 0xfb, 0xcc, = 0x77 } } + +extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid002; + +#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID \ +{ 0x603e52f0, 0x2ce3, 0x4e7a, { 0xa7, 0x2e, 0xdf, 0x8c, 0xa3, 0xfd, 0xb2, = 0xd } } + +extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid003; + +#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID \ +{ 0xab163674, 0x6c27, 0x4169, { 0xa6, 0xa9, 0xe1, 0x9c, 0x88, 0x14, 0x94, = 0x96 } } + +extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid004; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/HIIConfigAccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEF= I/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformanc= e.c new file mode 100644 index 00000000..c8b35003 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/HIIConfigAccessBBTestConformance.c @@ -0,0 +1,908 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + HIIConfigAccessBBTestConformance.c + +Abstract: + for EFI Driver HII Configuration Access Protocol's conformance Test + +--*/ + +#include "HIIConfigAccessBBTestMain.h" + +EFI_BROWSER_ACTION EFI_BROWSER_ACTION_UNSUPPORTED =3D 2; + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); +/* +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); +*/ + +EFI_STATUS +BBTestExtractConfigConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Config Routing Protocol Interface + // + Status =3D GetHIIConfigRoutingInterface( &HIIConfigRouting ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + //Call check points + // + BBTestExtractConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAcc= ess ); + BBTestExtractConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRou= ting, HIIConfigAccess ); + BBTestExtractConfigConformanceTestCheckpoint3( StandardLib, HIIConfigRou= ting, HIIConfigAccess ); + BBTestExtractConfigConformanceTestCheckpoint4( StandardLib, HIIConfigAcc= ess ); + + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestRouteConfigConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Config Routing Protocol Interface + // + Status =3D GetHIIConfigRoutingInterface( &HIIConfigRouting ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + //Call check points + // + BBTestRouteConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAcces= s ); + BBTestRouteConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouti= ng, HIIConfigAccess ); + BBTestRouteConfigConformanceTestCheckpoint3( StandardLib, HIIConfigAcces= s ); + + return EFI_SUCCESS; +} + +/* +EFI_STATUS +BBTestCallBackConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + //Call check points + // + BBTestCallBackConformanceTestCheckpoint1( StandardLib, HIIConfigAccess )= ; + BBTestCallBackConformanceTestCheckpoint2( StandardLib, HIIConfigAccess )= ; + BBTestCallBackConformanceTestCheckpoint3( StandardLib, HIIConfigAccess )= ; + BBTestCallBackConformanceTestCheckpoint4( StandardLib, HIIConfigAccess )= ; + + return EFI_SUCCESS; +} +*/ + +// +//Check Points +// + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Progress =3D NULL; + EFI_STRING Results =3D NULL; + EFI_STRING ResultsPtr =3D NULL; + UINTN Len =3D 0; + CHAR16* Pointer =3D NULL; + UINT8 IfMulti =3D 0; + + EFI_STRING Request =3D NULL; + // + // Call ExtractConfig with Request been + // + Status =3D HIIConfigAccess->ExtractConfig ( + HIIConfigAccess, + NULL, + &Progress, + &Results + ); + + if ( Status =3D=3D EFI_SUCCESS ) { + Len =3D SctStrLen (Results); + // + // Make sure the size of Request is enough to hold + // if original Results is not Multi + // + Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * Len + 2 + 256); + if (Request =3D=3D NULL) { + SctFreePool (Results); + return EFI_OUT_OF_RESOURCES; + } + } else { + return Status; + } + + Status =3D MultiAltRespToMultiReq (Results, Request); + ResultsPtr =3D Request; + + SctFreePool (Results); + Results =3D NULL; + + if ( SctStrStr (Request, L"GUID=3D") !=3D NULL ) { + Pointer =3D SctStrStr (Request, L"GUID=3D"); + Pointer++; + if ( SctStrStr (Pointer, L"GUID=3D") !=3D NULL ) + IfMulti =3D 1; + } + + if ( IfMulti =3D=3D 0 ) { + SctStrCat ( Request, L"&GUID=3D970eb94aa0d449f7b980bdaa47d42527&NAME= =3D006a0069006e0039&PATH=3D000acf&grag&star"); + } + + Status =3D HIIConfigAccess->ExtractConfig ( + HIIConfigAccess, + Request, + &Progress, + &Results + ); + + if ( (EFI_INVALID_PARAMETER !=3D Status) || (SctStrnCmp (Progress, L"&GU= ID=3D", 6) !=3D 0) ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid001, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfi= g() returns EFI_INVALID_PARAMETER with Request been .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + SctFreePool (Request); + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Request =3D NULL; + EFI_STRING Results =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + EFI_STRING DevicePath =3D NULL; + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + return Status; + } + + Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfi= gAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Requ= est); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + return Status; + } + + // + // Call ExtractConfig with Progress been NULL + // + Status =3D HIIConfigAccess->ExtractConfig ( + HIIConfigAccess, + Request, + NULL, + &Results + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid002, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfi= g() returns EFI_INVALID_PARAMETER with Progress been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Request =3D NULL; + EFI_STRING Progress =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + EFI_STRING DevicePath =3D NULL; + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + return Status; + } + + Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfi= gAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Requ= est); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + return Status; + } + // + // Call ExtractConfig with Results been NULL + // + Status =3D HIIConfigAccess->ExtractConfig ( + HIIConfigAccess, + Request, + &Progress, + NULL + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid003, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfi= g() returns EFI_INVALID_PARAMETER with Results been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + + return EFI_SUCCESS; +} + + +EFI_STATUS +BBTestExtractConfigConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Request; + EFI_STRING Progress =3D NULL; + EFI_STRING Results =3D NULL; + + //init the Request + Request =3D L"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a0069006= e0039&PATH=3D000acf&Jack&Rons&Nash&Mary"; + + // + // Call ExtractConfig with unknown name + // + Status =3D HIIConfigAccess->ExtractConfig ( + HIIConfigAccess, + Request, + &Progress, + &Results + ); + + if ( ((EFI_INVALID_PARAMETER =3D=3D Status) && (SctStrnCmp (Progress, L"= &Jack&Rons&Nash&Mary", 20) =3D=3D 0)) || + ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D Request)) ) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid004, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() re= turns EFI_INVALID_PARAMETER/EFI_NOT_FOUND with invalid input.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + } + + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Progress =3D NULL; + + + // + // Call RouteConfig with Configuration been NULL + // + Status =3D HIIConfigAccess->RouteConfig ( + HIIConfigAccess, + NULL, + &Progress + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid005, + L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() return= s EFI_INVALID_PARAMETER with Configuration been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + } + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Config =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + EFI_STRING DevicePath =3D NULL; + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + return Status; + } + + Config =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfig= AltResp) + 2 ); + if (Config =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Config)= ; + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Config); + return Status; + } + + // + // Call RouteConfig with Progress been NULL + // + Status =3D HIIConfigAccess->RouteConfig ( + HIIConfigAccess, + Config, + NULL + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid006, + L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() = returns EFI_INVALID_PARAMETER with Progress been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Config); + + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestRouteConfigConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Configuration; + EFI_STRING Progress =3D NULL; + + //init the Configuration + Configuration=3DL"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a006= 9006e0039&PATH=3D0acf&OFFSET=3D2&WIDTH=3D3VALUE=3D45AF"; + + // + // Call RouteConfig with no found target for the routing data + // + Status =3D HIIConfigAccess->RouteConfig ( + HIIConfigAccess, + Configuration, + &Progress + ); + + if ( EFI_NOT_FOUND !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid007, + L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() return= s EFI_NOT_FOUND with no found target for the routing data.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + return EFI_SUCCESS; +} + +/* +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_QUESTION_ID QuestionId; + UINT8 Type; + EFI_IFR_TYPE_VALUE Value; + EFI_BROWSER_ACTION_REQUEST ActionRequest; + + //init the parameter + QuestionId=3D0x1234; + Type=3DEFI_IFR_TYPE_NUM_SIZE_8; + + + // + // Call CallBack with the Action been NULL + // + Status =3D HIIConfigAccess->CallBack ( + HIIConfigAccess, + NULL, + QuestionId, + Type, + &Value, + &ActionReq= uest + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + + //check the output ActionRequest + if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET= || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != =3D ActionRequest) + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid009, + L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_= INVALID_PARAMETER with Action been NULL .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + +} + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_BROWSER_ACTION *Action; + EFI_QUESTION_ID QuestionId; + UINT8 Type; + EFI_IFR_TYPE_VALUE Value; + + + //init the parameter + Action=3DEFI_BROWSER_ACTION_REQUEST_CHANGING; + QuestionId=3D0x1234; + Type=3DEFI_IFR_TYPE_NUM_SIZE_8; + + + // + // Call CallBack with the ActionRequest been NULL + // + Status =3D HIIConfigAccess->CallBack ( + HIIConfigAccess, + Action, + QuestionId, + Type, + &Value, + NULL + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid0010, + L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_= INVALID_PARAMETER with QuestionId been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + +} + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint3( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_BROWSER_ACTION *Action; + EFI_QUESTION_ID QuestionId; + UINT8 Type; + EFI_BROWSER_ACTION_REQUEST ActionRequest; + + //init the parameter + Action =3D EFI_BROWSER_ACTION_REQUEST_CHANGING; + QuestionId =3D 0x1234; + Type =3D EFI_IFR_TYPE_NUM_SIZE_8; + + + // + // Call CallBack with the Value been NULL + // + Status =3D HIIConfigAccess->CallBack ( + HIIConfigAccess, + Action, + QuestionId, + Type, + NULL, + &ActionReq= uest + ); + + if ( EFI_INVALID_PARAMETER !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + + //check the output ActionRequest + if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET= || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != =3D ActionRequest) + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid0011, + L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_= INVALID_PARAMETER with Value been NULL.", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + +} + +EFI_STATUS +BBTestCallBackConformanceTestCheckpoint4 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_BROWSER_ACTION *Action; + EFI_QUESTION_ID QuestionId; + UINT8 Type; + EFI_IFR_TYPE_VALUE Value; + EFI_BROWSER_ACTION_REQUEST ActionRequest; + + //init the parameter + Action=3D&EFI_BROWSER_ACTION_UNSUPPORTED; + QuestionId=3D0x1234; + Type=3DEFI_IFR_TYPE_NUM_SIZE_8; + + + // + // Call CallBack with the specified action not supported by the callbac= k + // + Status =3D HIIConfigAccess->CallBack ( + HIIConfigAccess, + Action, + QuestionId, + Type, + &Value, + &ActionReq= uest + ); + + if ( EFI_UNSUPPORTED !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + + //check the output ActionRequest + if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET= || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != =3D ActionRequest) + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestConformanceAssertionGuid0012, + L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_= UNSUPPORTED with the specified action not supported by the callback .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; + +} +*/ diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/HIIConfigAccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/I= HV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c new file mode 100644 index 00000000..14cc5684 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/HIIConfigAccessBBTestFunction.c @@ -0,0 +1,606 @@ +/** @file + + Copyright 2006 - 2017 Unified EFI, Inc.
+ Copyright (c) 2010 - 2018, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + HIIConfigAccessBBTestFunction.c + +Abstract: + for EFI Driver HII Configuration Access Protocol's function Test + +--*/ + +#include "HIIConfigAccessBBTestMain.h" + + +EFI_STATUS +BBTestExtractConfigFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestExtractConfigFunctionTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); + +EFI_STATUS +BBTestRouteConfigFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); +/* +EFI_STATUS +BBTestCallBackFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ); +*/ + +// +//Test Cases +// +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + EFI_STRING DevicePath =3D NULL; + EFI_STRING Request =3D NULL; + EFI_STRING Resp =3D NULL; + EFI_STRING MultiConfigAltResp =3D L"GUID=3D970eb94aa0d449f7b980bdaa47= d42527&NAME=3Dft894&PATH=3D000acf&OFFSET=3D3&WIDTH=3D4&VALUE=3Daabbccdd&OFF= SET=3D1&WIDTH=3D2&VALUE=3Deeff&GUID=3D970eb94aa0d449f7b980bdaa47d42527&NAME= =3Dft894&PATH=3D000acf&ALTCFG=3D0037&A000=3Dabcd&B000=3Defef&GUID=3D970eb94= aa0d449f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b2665= 38c38af48ce000000007fff0400&A000=3Dabcd&B000=3Defef&GUID=3D970eb94aa0d449f7= b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b266538c38af48= ce000000007fff0400&ALTCFG=3D0037&OFFSET=3D3&WIDTH=3D4&VALUE=3Daabbccdd&OFFS= ET=3D1&WIDTH=3D2&VALUE=3Deeff";; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + Request =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfig= AltResp) + 2); + if (Request =3D=3D NULL) + return EFI_OUT_OF_RESOURCES; + + Resp =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAlt= Resp) + 2); + if (Resp =3D=3D NULL) { + gtBS->FreePool (Request); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (Resp); + gtBS->FreePool (Request); + return Status; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Requ= est); + + Status =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp); + + gtBS->FreePool (Request); + gtBS->FreePool (Resp); + gtBS->FreePool (DevicePath); + + return EFI_SUCCESS; +} +*/ + +EFI_STATUS +BBTestExtractConfigFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Config Routing Protocol Interface + // + Status =3D GetHIIConfigRoutingInterface( &HIIConfigRouting ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + //Call check points + // + BBTestExtractConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRoutin= g, HIIConfigAccess ); + BBTestExtractConfigFunctionTestCheckpoint2( StandardLib, HIIConfigRoutin= g, HIIConfigAccess ); + + return EFI_SUCCESS; +} + + +EFI_STATUS +BBTestRouteConfigFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Config Routing Protocol Interface + // + Status =3D GetHIIConfigRoutingInterface( &HIIConfigRouting ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + //Call check points + // + BBTestRouteConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting,= HIIConfigAccess ); + + return EFI_SUCCESS; +} + +/* +EFI_STATUS +BBTestCallBackFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + //Call check points + // + BBTestCallBackFunctionTestCheckpoint1( StandardLib, HIIConfigAccess ); + + return EFI_SUCCESS; +} +*/ + +// +//Check Points +// +EFI_STATUS +BBTestExtractConfigFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Request =3D NULL; + EFI_STRING ConfigHdr =3D NULL; + EFI_STRING Progress =3D NULL; + EFI_STRING Results =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + EFI_STRING DevicePath =3D NULL; + + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + return Status; + } + + Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfi= gAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Requ= est); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + return Status; + } + + // + // Call ExtractConfig with valid parameters + // + Status =3D HIIConfigAccess->ExtractConfig( + HIIConfigAccess, + Request, + &Progress, + &Results + ); + + if ( (EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctStrLe= n (Request))) ) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Results =3D=3D NULL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + gtBS->FreePool (Results); + } + } else if (EFI_OUT_OF_RESOURCES =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + }else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestFunctionAssertionGuid001, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig= () returns EFI_SUCCESS and vaild Results with valid parameters .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Change the Request to ConfigHdr + // + ConfigHdr =3D Request; + while (*Request) { + if (*Request =3D=3D L'&') { + if (SctStrnCmp (Request, L"&NAME=3D", 6) =3D=3D 0) { + Request =3D Request + 6; + } else if (SctStrnCmp (Request, L"&PATH=3D", 6) =3D=3D 0) { + Request =3D Request + 6; + } else { + *Request =3D 0; + } + } else { + Request++; + } + } + Request =3D ConfigHdr; + + // + // Call ExtractConfig when Request is ConfigHdr + // + Progress =3D NULL; + Results =3D NULL; + Status =3D HIIConfigAccess->ExtractConfig( + HIIConfigAccess, + Request, + &Progress, + &Results + ); + + if ( (EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctStrLe= n (Request))) ) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Results =3D=3D NULL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + if (NULL =3D=3D SctStrStr (Results, Request)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + gtBS->FreePool (Results); + } + } else if (EFI_OUT_OF_RESOURCES =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + }else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestFunctionAssertionGuid002, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig= () returns EFI_SUCCESS and vaild Results with valid parameters .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Request); + + return EFI_SUCCESS; +} + + +EFI_STATUS +BBTestExtractConfigFunctionTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Request =3D NULL; + EFI_STRING Progress =3D NULL; + EFI_STRING Results =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call ExtractConfig with valid parameters + // + Status =3D HIIConfigAccess->ExtractConfig( + HIIConfigAccess, + NULL, + &Progress, + &Results + ); + + if (EFI_OUT_OF_RESOURCES =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + } else if ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D NULL) && (R= esults =3D=3D NULL)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else if ( EFI_SUCCESS !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (Results !=3D NULL) { + gtBS->FreePool (Results); + } + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (Results =3D=3D NULL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestFunctionAssertionGuid003, + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig= () returns EFI_SUCCESS or EFI_NOT_FOUND with Request been NULL .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + + if ( NULL !=3D MultiConfigAltResp ){ + gtBS->FreePool (MultiConfigAltResp); + } + + if ( NULL !=3DResults ) { + gtBS->FreePool (Results); + } + + if (NULL !=3D Request) { + gtBS->FreePool (Request); + } + + return EFI_SUCCESS; +} + + +EFI_STATUS +BBTestRouteConfigFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_STRING Resp =3D NULL; + EFI_STRING Progress =3D NULL; + EFI_STRING MultiConfigAltResp =3D NULL; + EFI_STRING DevicePath =3D NULL; + + //init the Request + Status =3D HIIConfigRouting->ExportConfig( + HIIConfigRouting, + &MultiConfigAltResp + ); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D GetDevicePath ( HIIConfigAccess, &DevicePath ); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + return Status; + } + + Resp =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAl= tResp) + 2 ); + if (Resp =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp); + if (EFI_ERROR(Status)) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Resp); + return Status; + } + + // + // Call RouteConfig with valid parameters + // + Status =3D HIIConfigAccess->RouteConfig( + HIIConfigAccess, + Resp, + &Progress + ); + if ( (EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D Resp + SctStrLen (R= esp)) ) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else if ( EFI_OUT_OF_RESOURCES =3D=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestFunctionAssertionGuid003, + L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig- RouteConfig() returns= EFI_SUCCESS with valid parameters .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + gtBS->FreePool (Resp); + + return EFI_SUCCESS; +} + +/* +EFI_STATUS +BBTestCallBackFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + + EFI_BROWSER_ACTION *Action; + EFI_QUESTION_ID QuestionId; + UINT8 Type; + EFI_IFR_TYPE_VALUE Value; + EFI_BROWSER_ACTION_REQUEST ActionRequest; + + //init the paremeters + Action=3DEFI_BROWSER_ACTION_REQUEST_CHANGING; + QuestionId=3D0x1234; + Type=3DEFI_IFR_TYPE_NUM_SIZE_8; + + + // + // Call CallBack with valid parameters + // + Status =3D HIIConfigAccess->CallBack( + HIIConfigAccess, + Action, + QuestionId, + Type, + &Value, + &ActionReque= st + ); + if ( EFI_SUCCESS !=3D Status ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + + //check the output ActionRequest + if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET= || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != =3D ActionRequest) + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + + } + + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gHIIConfigAccessBBTestFunctionAssertionGuid003, + L"HII_CONFIG_ACCESS_PROTOCOL.CallBack- CallBack() returns EFI_S= UCCESS with valid parameters .", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return EFI_SUCCESS; +} +*/ + + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/HIIConfigAccessBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/P= rotocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c new file mode 100644 index 00000000..29c793e2 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/HIIConfigAccessBBTestMain.c @@ -0,0 +1,655 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + + HIIConfigAccessBBTestMain.c + +Abstract: + + Test Driver of HII Configuration Access Protocol + +--*/ + +#include "HIIConfigAccessBBTestMain.h" + +// +// Global variables +// +EFI_HANDLE mImageHandle; + +EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface; + +EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField =3D { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_REVISION, + IHV_EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID, + L"HII Configuration Access Protocol Test", + L"UEFI HII Configuration Access Protocol Black-Box Test" +}; + +EFI_GUID gSupportProtocolGuid[] =3D { + EFI_STANDARD_TEST_LIBRARY_GUID, + EFI_NULL_GUID +}; + +EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] =3D { + /* + //Use for unit test only + { + { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0x= b0, 0x6d } }, + L"Unit Test Only", + L"Verify the Assistant Function", + EFI_TEST_LEVEL_DEFAULT, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestUnitTest + }, + */ + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101, + L"ExtractConfigFunction", + L"Function auto test for HII Configuration Access Protocol ExtractConf= ig().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestExtractConfigFunctionTest + }, + + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102, + L"RouteConfigFunction", + L"Function auto test for HII Configuration Access Protocol RouteConfig= ().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestRouteConfigFunctionTest + }, + /* + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0103, + L"CallBackFunction", + L"Function auto test for HII Configuration Access Protocol CallBack().= ", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCallBackFunctionTest + }, + */ + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201, + L"ExtractConfigConformance", + L"Conformance auto test for HII Configuration Access Protocol ExtractC= onfig().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestExtractConfigConformanceTest + }, + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202, + L"RouteConfigConformance", + L"Conformance auto test for HII Configuration Access Protocol RouteCon= fig().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestRouteConfigConformanceTest + }, + /* + { + EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0203, + L"CallBackConformance", + L"Conformance auto test for HII Configuration Access Protocol CallBack= ().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCallBackConformanceTest + }, + */ + 0 +}; + + + + +EFI_STATUS +InitializeHIIConfigAccessBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EfiInitializeTestLib (ImageHandle, SystemTable); + + // + // initialize test utility lib + // + + SctInitializeLib (ImageHandle, SystemTable); + + mImageHandle =3D ImageHandle; + + return EfiInitAndInstallIHVBBTestInterface ( + &ImageHandle, + &gBBTestProtocolField, + gBBTestEntryField, + UnloadHIIConfigAccessBBTest, + &gBBTestProtocolInterface + ); +} + + +EFI_STATUS +UnloadHIIConfigAccessBBTest ( + IN EFI_HANDLE ImageHandle + ) +{ + return EfiUninstallAndFreeIHVBBTestInterface ( + ImageHandle, + gBBTestProtocolInterface + ); +} + + +// Assistance Function +UINTN +EfiDevicePathSize ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +/*++ + +Routine Description: + + Calculate the space size of a device path. + +Arguments: + + DevicePath - A specified device path + +Returns: + + The size. + +--*/ +{ + EFI_DEVICE_PATH_PROTOCOL *Start; + + if (DevicePath =3D=3D NULL) { + return 0; + } + + // + // Search for the end of the device path structure + // + Start =3D DevicePath; + while (!SctIsDevicePathEnd (DevicePath)) { + DevicePath =3D SctNextDevicePathNode (DevicePath); + } + + // + // Compute the size and add back in the size of the end device path stru= cture + // + return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PR= OTOCOL); +} + + +STATIC +CHAR16 +NibbleToHexCharPrivate ( + IN UINT8 Nibble + ) +/*++ + + Routine Description: + Converts the low nibble of a byte to hex unicode character. + + Arguments: + Nibble - lower nibble of a byte. + + Returns: + Hex unicode character between L'0' to L'f'. + +--*/ +{ + Nibble &=3D 0x0F; + + if (Nibble <=3D 0x9) { + return (CHAR16)(Nibble + L'0'); + } + + return (CHAR16)(Nibble - 0xA + L'a'); +} + + +STATIC +EFI_STATUS +BufToHexStringPrivate ( + IN OUT CHAR16 *Str, + IN OUT UINTN *HexStringBufferLength, + IN UINT8 *Buf, + IN UINTN Len, + IN BOOLEAN Flag + ) +/*++ + + Routine Description: + Converts binary buffer to Unicode string. + At a minimum, any blob of data could be represented as a hex string. + + Arguments: + Str - Pointer to the string. + HexStringBufferLength - Length in bytes of buffer to hold the hex stri= ng. Includes tailing '\0' character. + If routine return with EFI_SUCCESS, containing= length of hex string buffer. + If routine return with EFI_BUFFER_TOO_SMALL, c= ontaing length of hex string buffer desired. + Buf - Buffer to be converted from. + Len - Length in bytes of the buffer to be converted. + Flag - If TRUE, encode the data in the same order as = the it + resides in the Buf. Else encode it in the reve= rse direction. + + Returns: + EFI_SUCCESS - Routine success. + EFI_BUFFER_TOO_SMALL - The hex string buffer is too small. + +--*/ +{ + UINTN Idx; + UINT8 Byte; + UINTN StrLen; + + // + // Make sure string is either passed or allocate enough. + // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the bi= nary buffer. + // Plus the Unicode termination character. + // + StrLen =3D Len * 2; + if ((*HexStringBufferLength) < (StrLen + 1) * sizeof (CHAR16)) { + *HexStringBufferLength =3D (StrLen + 1) * sizeof (CHAR16); + return EFI_BUFFER_TOO_SMALL; + } + + *HexStringBufferLength =3D (StrLen + 1) * sizeof (CHAR16); + + // + // Ends the string. + // + Str[StrLen] =3D 0; + + for (Idx =3D 0; Idx < Len; Idx++) { + + Byte =3D Buf[Idx]; + if (Flag) { + Str[Idx * 2] =3D NibbleToHexCharPrivate ((UINT8)(Byte >> 4)); + Str[Idx * 2 + 1] =3D NibbleToHexCharPrivate (Byte); + } else { + Str[StrLen - 1 - Idx * 2] =3D NibbleToHexCharPrivate (Byte); + Str[StrLen - 2 - Idx * 2] =3D NibbleToHexCharPrivate ((UINT8)(Byte >= > 4)); + } + } + + return EFI_SUCCESS; +} + +EFI_STATUS +GetDevicePath ( + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess, + OUT EFI_STRING *DevicePathStr + ) +{ + EFI_STATUS Status; + UINTN Index; + UINTN NoHandles; + EFI_HANDLE *HandleBuffer; + EFI_HANDLE ConfigAccessHandle =3D NULL; + EFI_HII_CONFIG_ACCESS_PROTOCOL *TestedConfigAccess; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + UINTN Length; + UINTN PathHdrSize; + + // + // locate all Hii Configuration Access Protocol Instances + // + Status =3D gtBS->LocateHandleBuffer ( + ByProtocol, + &gBlackBoxEfiHIIConfigAccessProtocolGuid, + NULL, + &NoHandles, + &HandleBuffer + ); + if (EFI_ERROR(Status) || (NoHandles =3D=3D 0)) { + return EFI_NOT_FOUND; + } + + // + // scan for the handle that matched with the Hii Configuration Access Pr= otocol that + // passed in by the test framework + // + for (Index =3D 0; Index < NoHandles; Index++) { + Status =3D gtBS->HandleProtocol ( + HandleBuffer[Index], + &gBlackBoxEfiHIIConfigAccessProtocolGuid, + (VOID **) &TestedConfigAccess + ); + if (EFI_ERROR(Status)) { + continue; + } + + if (TestedConfigAccess =3D=3D ConfigAccess) { + ConfigAccessHandle =3D HandleBuffer[Index]; + break; + } + } + + gtBS->FreePool (HandleBuffer); + + if (ConfigAccessHandle =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + // + // find controller handles managed by the component name handle. + // + Status =3D gtBS->HandleProtocol ( + ConfigAccessHandle, + &gBlackBoxEfiDevicePathProtocolGuid, + (void **)&DevicePath + ); + + // + // Convert the device path binary to hex UNICODE %02x bytes in the same = order + // as the device path resides in RAM memory. + // + Length =3D EfiDevicePathSize (DevicePath); + PathHdrSize =3D (Length * 2 + 1) * sizeof (CHAR16); + *DevicePathStr =3D (EFI_STRING) SctAllocateZeroPool (PathHdrSize); + if (*DevicePathStr =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + Status =3D BufToHexStringPrivate (*DevicePathStr, &PathHdrSize, (UINT8 *= ) DevicePath, Length, TRUE); + + return Status; +} + + +EFI_STATUS +GetCorrespondingRequest ( + IN EFI_STRING MultiConfigAltResp, + IN EFI_STRING DevicePath, + IN OUT EFI_STRING Request + ) +{ + EFI_STRING RespPtr; + EFI_STRING ReqPtr; + EFI_STRING SingleResp; + EFI_STRING SingleRespPtr; + UINTN Len; + + ReqPtr =3D Request; + RespPtr =3D MultiConfigAltResp; + + Len =3D SctStrLen (MultiConfigAltResp); + + if (SctStrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) { + return EFI_INVALID_PARAMETER; + } + + if (SctStrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + SingleResp =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiCo= nfigAltResp) + 2 ); + if (SingleResp =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + SingleRespPtr =3D SingleResp; + + while (*MultiConfigAltResp !=3D 0) { + while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConfigAltResp= , L"&GUID=3D", 6) !=3D 0)) { + *(SingleResp++) =3D *(MultiConfigAltResp++); + } + SingleResp =3D SingleRespPtr; + if (SctStrStr (SingleResp, DevicePath) !=3D NULL) + break; + SctZeroMem (SingleRespPtr, 2 * Len + 2); + if (*MultiConfigAltResp !=3D 0) + MultiConfigAltResp++; + } + + if (SctStrStr (SingleResp, DevicePath) =3D=3D NULL) + return EFI_NOT_FOUND; + + if (SctStrStr (SingleResp, L"VALUE=3D") =3D=3D NULL){ + while (*SingleResp !=3D 0) { + while ((*SingleResp !=3D 0) && (SctStrnCmp (SingleResp, L"&PATH=3D",= 6) !=3D 0)) { + *(Request++) =3D *(SingleResp++); + } + *(Request++) =3D *(SingleResp++); + while ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&')) { + *(Request++) =3D *(SingleResp++); + } + while (*SingleResp !=3D 0){ + if (*SingleResp !=3D L'=3D') { + *(Request++) =3D *(SingleResp++); + } else { + while ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&')) { + SingleResp++; + } + } + } + } + } else { + while (*SingleResp !=3D 0) { + while ((*SingleResp !=3D 0) && (SctStrnCmp (SingleResp, L"&VALUE=3D"= , 7)) !=3D 0) { + *(Request++) =3D *(SingleResp++); + } + SingleResp++; + while ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&')) + SingleResp++; + } + + } + + *Request =3D 0; + + gtBS->FreePool (SingleRespPtr); + return EFI_SUCCESS; +} + + +EFI_STATUS +GetCorrespondingResp ( + IN EFI_STRING MultiConfigAltResp, + IN EFI_STRING DevicePath, + IN OUT EFI_STRING Resp + ) +{ + EFI_STRING RespPtr; + EFI_STRING ReqPtr; + UINTN Len; + + ReqPtr =3D Resp; + RespPtr =3D MultiConfigAltResp; + + Len =3D SctStrLen (MultiConfigAltResp); + + if (SctStrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) { + return EFI_INVALID_PARAMETER; + } + + if (SctStrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + while (*MultiConfigAltResp !=3D 0) { + while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConfigAltResp= , L"&GUID=3D", 6) !=3D 0)) { + *(Resp++) =3D *(MultiConfigAltResp++); + } + Resp =3D ReqPtr; + if (SctStrStr (Resp, DevicePath) !=3D NULL) + break; + SctZeroMem (ReqPtr, 2 * Len + 2); + if (*MultiConfigAltResp !=3D 0) + MultiConfigAltResp++; + } + + if (SctStrStr (Resp, DevicePath) =3D=3D NULL) + return EFI_NOT_FOUND; + + return EFI_SUCCESS; +} + + + +EFI_STATUS +GetHIIConfigRoutingInterface ( + OUT EFI_HII_CONFIG_ROUTING_PROTOCOL **HIIConfigRouting + ) +{ + UINTN NoHandles; + EFI_HANDLE *HandleBuffer; + EFI_STATUS Status; + + // + // Get the HII Database Protocol interface + // + Status =3D gtBS->LocateHandleBuffer ( + ByProtocol, + &gBlackBoxEfiHIIConfigRoutingProtocolGuid, + NULL, + &NoHandles, + &HandleBuffer + ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + if ( NoHandles <=3D 0 ) { + return EFI_DEVICE_ERROR; + } + + Status =3D gtBS->HandleProtocol ( + HandleBuffer[0], + &gBlackBoxEfiHIIConfigRoutingProtocolGuid, + (VOID **) HIIConfigRouting + ); + if ( EFI_ERROR(Status) ) { + gtBS->FreePool ( HandleBuffer ); + return Status; + } + + gtBS->FreePool ( HandleBuffer ); + + return EFI_SUCCESS; +} + +EFI_STATUS +MultiAltRespToMultiReq ( + IN EFI_STRING Resp, + IN OUT EFI_STRING Req + ) +{ + EFI_STRING Pointer1 =3D Resp; + EFI_STRING Pointer2 =3D NULL; + EFI_STRING Pointer3 =3D Req; + EFI_STRING CfgHdr =3D NULL; + EFI_STRING FreePtr =3D NULL; + CHAR8 Flag =3D 0; + + if (SctStrnCmp (Pointer1, L"GUID=3D", 5) !=3D 0) { + return EFI_INVALID_PARAMETER; + } + + Pointer2 =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (Resp) + 2)= ; + if (Pointer2 =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + FreePtr =3D Pointer2; + + while (*Pointer1) { + if (SctStrnCmp (Pointer1, L"GUID=3D", 5) =3D=3D 0) { + CfgHdr =3D Pointer2; + *(Pointer2++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'&') { + *(Pointer2++) =3D *(Pointer1++); + } + } + if (SctStrnCmp (Pointer1, L"&GUID=3D", 6) =3D=3D 0) { + *(Pointer2++) =3D *(Pointer1++); + CfgHdr =3D Pointer2; + while (*Pointer1 !=3D L'&') { + *(Pointer2++) =3D *(Pointer1++); + } + } + if (SctStrnCmp (Pointer1, L"&NAME=3D", 6) =3D=3D 0) { + *(Pointer2++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'&') { + *(Pointer2++) =3D *(Pointer1++); + } + } + if (SctStrnCmp (Pointer1, L"&PATH=3D", 6) =3D=3D 0) { + *(Pointer2++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'&') { + *(Pointer2++) =3D *(Pointer1++); + } + if (NULL =3D=3D SctStrStr (Req, CfgHdr)){ + if (*Req =3D=3D L'G') + *(Pointer3++) =3D L'&'; + SctStrCat (Req, CfgHdr); + Pointer3 +=3D SctStrLen (CfgHdr); + Flag =3D 1; + } else { + Flag =3D 0; + } + } + while ((Flag =3D=3D 1) && (SctStrnCmp (Pointer1, L"&GUID=3D", 6) !=3D = 0) && *Pointer1) { + if (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8) =3D=3D 0) { + *(Pointer3++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'&') { + *(Pointer3++) =3D *(Pointer1++); + } + } + if (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) =3D=3D 0) { + *(Pointer3++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'&') { + *(Pointer3++) =3D *(Pointer1++); + } + } + if (SctStrnCmp (Pointer1, L"&VALUE=3D", 7) =3D=3D 0) { + Pointer1 +=3D 7; + while (*Pointer1 !=3D L'&' && *Pointer1) { + Pointer1++; + } + } + if (SctStrnCmp (Pointer1, L"&ALTCFG=3D", 8) =3D=3D 0) { + Pointer1 +=3D 8; + while (*Pointer1 !=3D L'&' && *Pointer1) { + Pointer1++; + } + } + if ((*Pointer1 =3D=3D L'&') && (SctStrnCmp (Pointer1, L"&G= UID=3D", 6) !=3D 0) && + (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8) != =3D 0) && (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) !=3D 0)) { + *(Pointer3++) =3D *(Pointer1++); + while (*Pointer1 !=3D L'=3D') { + *(Pointer3++) =3D *(Pointer1++); + } + while (*Pointer1 !=3D L'&' && *Pointer1) { + Pointer1++; + } + } + } + Pointer1++; + } + + SctFreePool (FreePtr); + + return EFI_SUCCESS; +} diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/HIIConfigAccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/P= rotocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h new file mode 100644 index 00000000..c81a00ca --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/HIIConfigAccessBBTestMain.h @@ -0,0 +1,168 @@ +/** @file + + Copyright 2006 - 2013 Unified EFI, Inc.
+ Copyright (c) 2010 - 2013, 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 + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + + HIIConfigAccessBBTestMain.h + +Abstract: + + Test Driver of HII Configuration Access Protocol header file + +--*/ + +#ifndef _HII_CONFIG_ACCESS_BB_TEST_MAIN +#define _HII_CONFIG_ACCESS_BB_TEST_MAIN + +#define __UEFI_INTERNAL_FORMREPRESENTATION_H__ +#include +#include "SctLib.h" +#include "Guid.h" +#include +#include +#include +#include + + +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_REVISION 0x00010000 +#define IHV_EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID \ +{ 0x68820884, 0x4be3, 0x4ca9, { 0x83, 0x81, 0x9e, 0x98, 0xf3, 0xf4, 0x8d, = 0xaf } } +// +// Entry GUIDs for Func Test +// +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101 \ +{ 0x2a85387e, 0xdcf9, 0x45e9, { 0xb3, 0x8f, 0x5d, 0xa1, 0x75, 0x41, 0xcf, = 0x1a } } + +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102 \ +{ 0x1a15df85, 0x6cc1, 0x43f2, { 0x9b, 0x86, 0x21, 0x8b, 0xd5, 0xfd, 0xf4, = 0xa0 } } + + +// +// Entry GUIDs for Conf Test +// +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201 \ +{ 0xe2c3b0fe, 0xfbe9, 0x46a9, { 0xa3, 0x1b, 0xa3, 0xf3, 0x82, 0xd, 0xcf, 0= x4 } } + +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202 \ +{ 0x495c99f3, 0x231, 0x45a5, { 0xaf, 0xfa, 0xd2, 0x5c, 0x6f, 0x9a, 0x19, 0= x1c } } + + + +EFI_STATUS +InitializeHIIConfigAccessBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + + +EFI_STATUS +UnloadHIIConfigAccessBBTest ( + IN EFI_HANDLE ImageHandle + ); + + +// +//Test Cases +// +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +*/ +EFI_STATUS +BBTestExtractConfigConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestRouteConfigConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +/* +EFI_STATUS +BBTestCallBackConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +*/ +EFI_STATUS +BBTestExtractConfigFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestRouteConfigFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +/* +EFI_STATUS +BBTestCallBackFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +*/ +EFI_STATUS +GetDevicePath ( + IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess, + OUT EFI_STRING *DevicePathStr + ); + +EFI_STATUS +GetCorrespondingRequest ( + IN EFI_STRING MultiConfigAltResp, + IN EFI_STRING DevicePath, + IN OUT EFI_STRING Request + ); + +EFI_STATUS +GetCorrespondingResp ( + IN EFI_STRING MultiConfigAltResp, + IN EFI_STRING DevicePath, + IN OUT EFI_STRING Resp + ); + +EFI_STATUS +GetHIIConfigRoutingInterface ( + OUT EFI_HII_CONFIG_ROUTING_PROTOCOL **HIIConfigRouting + ); + +EFI_STATUS +MultiAltRespToMultiReq ( + IN EFI_STRING Resp, + IN OUT EFI_STRING Req + ); + +#endif diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bla= ckBoxTest/IhvHIIConfigAccessBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/= Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf new file mode 100644 index 00000000..1168986b --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTe= st/IhvHIIConfigAccessBBTest.inf @@ -0,0 +1,55 @@ +## @file +# +# Copyright 2006 - 2012 Unified EFI, Inc.
+# Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2019, ARM Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +## +#/*++ +# +# Module Name: +# +# HIIConfigAccessBBTest.inf +# +# Abstract: +# +# Component description file for IHV HII Config Access Protocol Black-Bo= x Test. +# +#--*/ + +[defines] +INF_VERSION =3D 0x00010005 +BASE_NAME =3D IhvHIIConfigAccessBBTest +FILE_GUID =3D D39F2A3B-72BF-40F5-86BF-2E1E96D15EA3 +MODULE_TYPE =3D UEFI_DRIVER +VERSION_STRING =3D 1.0 +ENTRY_POINT =3D InitializeHIIConfigAccessBBTest + +[sources.common] + HIIConfigAccessBBTestConformance.c + HIIConfigAccessBBTestFunction.c + HIIConfigAccessBBTestMain.c + Guid.c + +[Packages] + SctPkg/SctPkg.dec + SctPkg/UEFI/UEFI.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + SctLib + EfiTestLib + +[Protocols] + gBlackBoxEfiHIIConfigAccessProtocolGuid + gBlackBoxEfiHIIConfigRoutingProtocolGuid + gBlackBoxEfiDevicePathProtocolGuid diff --git a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SC= T.dsc index 83396f1a..c3afdbdd 100644 --- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc +++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc @@ -210,9 +210,11 @@ SctPkg/TestCase/UEFI/IHV/Protocol/UsbIo/BlackBoxTest/I= hvUsbIoTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsOu= tputBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiPa= ssThruBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf +SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfi= gAccessBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiI= nitiatorNameBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolute= PointerBBTest.inf +SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmw= areManagementBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvSt= orageSecurityCommandBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoB= BTest.inf -- 2.22.0.windows.1 --_000_BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0BN6PR1101MB2355_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Team,

 

Adding Firmware Management Protocol and HII Config A= ccess Protocol into IHVSCT.

Contributed-under: TianoCore Contribution Agreement = 1.1

Signed-off-by: Shrishail Patil <Shrishail.patil@microchip.com><= /o:p>

 

From: shrishailp &l= t;50140165+shrishailp@users.noreply.github.com>

Date: Fri, 10 May 2= 019 14:40:20 +0530

Subject: [PATCH] Ad= ding FMP and HII Config Access protocol into IHVSCT

 

Added FMP and HII c= onfig access protocol into IHVSCT.

---

uefi-sct/SctPkg/Com= monGenFramework.bat        |  =   3 +-

uefi-sct/SctPkg/Com= monGenFramework.sh         | &= nbsp;  3 +-

.../FirmwareManagem= entBBTestConformance.c     | 3632 ++++&= #43;++++++++++++=

.../FirmwareManagem= entBBTestFunction.c        |  891 &= #43;+++

.../FirmwareManagem= entBBTestMain.c          =   |  228 ++

.../FirmwareManagem= entBBTestMain.h          =   |  223 +

.../FirmwareManagem= ent/BlackBoxTest/Guid.c    |   63 +=

.../FirmwareManagem= ent/BlackBoxTest/Guid.h    |  153 +

.../IhvFirmwareMana= gementBBTest.inf          = ; |   52 +

.../HIIConfigAccess= /BlackBoxTest/Guid.c       |   46 &= #43;

.../HIIConfigAccess= /BlackBoxTest/Guid.h       |  109 +<= o:p>

.../HIIConfigAccess= BBTestConformance.c        |  908 &= #43;++++

.../HIIConfigAccess= BBTestFunction.c          = ; |  606 +++

.../BlackBoxTest/HI= IConfigAccessBBTestMain.c  |  655 +++

.../BlackBoxTest/HI= IConfigAccessBBTestMain.h  |  168 +

.../BlackBoxTest/Ih= vHIIConfigAccessBBTest.inf |   55 +

uefi-sct/SctPkg/UEF= I/IHV_SCT.dsc          &n= bsp;   |    2 +

17 files changed, 7= 795 insertions(+), 2 deletions(-)

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestConformance.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestFunction.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestMain.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestMain.h

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= Guid.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= Guid.h

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= IhvFirmwareManagementBBTest.inf

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.h

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestConformance.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestFunction.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestMain.c

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestMain.h

create mode 100644 = uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Ihv= HIIConfigAccessBBTest.inf

 

diff --git a/uefi-s= ct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat

index 5c614eaa..f9d= 133fd 100644

--- a/uefi-sct/SctP= kg/CommonGenFramework.bat

+++ b/u= efi-sct/SctPkg/CommonGenFramework.bat

@@ -279,7 +279,= 8 @@ rem  copy %ProcessorType%\IhvUsbHcTest.efi    = ;            &n= bsp;        %Framework%\T

   copy %= ProcessorType%\IhvUsb2HcTest.efi       &= nbsp;           &nbs= p;    %Framework%\Test\ > NUL

   copy %= ProcessorType%\IhviScsiInitiatorNameBBTest.efi     = ;     %Framework%\Test\ > NUL

   copy %= ProcessorType%\IhvStorageSecurityCommandBBTest.efi    &= nbsp; %Framework%\Test\ > NUL

=

+  copy %P= rocessorType%\IhvFirmwareManagementBBTest.efi     =      %Framework%\Test\ > NUL

+  copy %P= rocessorType%\IhvHIIConfigAccessBBTest.efi     &nb= sp;       %Framework%\Test\ > NUL

   rem **= *******************************************

   rem Co= py the UEFI 2.1 Test Cases for IHV

   rem **= *******************************************

diff --git a/uefi-s= ct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh

index c422034a..6a9= 44611 100755

--- a/uefi-sct/SctP= kg/CommonGenFramework.sh

+++ b/u= efi-sct/SctPkg/CommonGenFramework.sh

@@ -312,7 +312,= 8 @@ then

   cp $Pr= ocessorType/IhvUsb2HcTest.efi       &nbs= p;            &= nbsp;   $Framework/Test/ > NUL

   cp $Pr= ocessorType/IhviScsiInitiatorNameBBTest.efi     &n= bsp;    $Framework/Test/ > NUL

   cp $Pr= ocessorType/IhvStorageSecurityCommandBBTest.efi    &nbs= p; $Framework/Test/ > NUL

-=

+  cp $Pro= cessorType/IhvFirmwareManagementBBTest.efi     &nb= sp;    $Framework/Test/ > NUL

+  cp $Pro= cessorType/IhvHIIConfigAccessBBTest.efi      =        $Framework/Test/ > NUL

   # ****= *****************************************

   # Copy= the UEFI 2.1 Test Cases for IHV

   # ****= *****************************************

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmwa= reManagementBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protoco= l/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c

new file mode 10064= 4

index 00000000..95d= 36dc7

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/F= irmwareManagementBBTestConformance.c

@@ -0,0 +1,3632= @@

+/** @file=

+

+  Copyrig= ht 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2016, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+  &n= bsp; FirmwareManagementBBTestConformance.c

+

+Abstract:=

+  &n= bsp; Firmware Management Protocol's conformance tests.

+

+--*/

+

+#define DEBUG_= ALL            =             &nb= sp;       0

+#define DEBUG_= GET_IMAGE_INFO          &= nbsp;          0

+#define DEBUG_= GET_IMAGE           =             &nb= sp;  0

+#define DEBUG_= SET_IMAGE            = ;            &n= bsp; 0

+#define DEBUG_= CHECK_IMAGE          &nbs= p;             = 0

+#define DEBUG_= SET_PACKAGE_INFO          = ;         0

+

+#include "= ;SctLib.h"

+#include "= ;FirmwareManagementBBTestMain.h"

+

+// ***********= *****************************************************************

+//  = Support Routines

+// ***********= *****************************************************************

+

+EFI_STATUS

+CheckForSuppor= tGetImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+CheckForSuppor= tSetImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        &nbs= p;   *FirmwareManagement

+  );=

+

+

+EFI_STATUS

+CheckForSuppor= tCheckImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+CheckForSuppor= tSetPackageInfo (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+// ***********= *****************************************************************

+//  = Check Points

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+// ***********= *****************************************************************

+//  = Support Routines

+// =

+// =

+// ***********= *****************************************************************

+

+// ***********= *****************************************************************

+//  = Support Routine: Progress

+// ***********= *****************************************************************

+

+EFI_STATUS

+Progress (

+  IN UINT= N            &n= bsp;            = ;            &n= bsp; Completion

+)

+{

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Support Routine: CheckForSupportGetImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+CheckForSuppor= tGetImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+)

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    ImageIndex;

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceSupportGuid001;=

+  ResultM= essageLabel =3D L"GetImage, function support check";

+

+  ImageIn= dex =3D 0;

+  Image = =3D NULL;

+  ImageSi= ze =3D 0;

+

+  //=

+  // Chec= k if function is supported

+  //=

+

+  Status = =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     ImageIndex,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     &ImageSize

+  &n= bsp;            = ;            &n= bsp;     );

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; ResultMessageData =3D L"function is NOT supported";

+  } else = {

+  &n= bsp; ResultMessageData =3D L"function is supported.";<= /span>

+  }<= /o:p>

+

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Ima= ge !=3D NULL) {

+  &n= bsp; gtBS->FreePool (Image);

+  }<= /o:p>

+

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return EFI_UNSUPPORTED;

+  } else = {

+  &n= bsp; return EFI_SUCCESS;

+  }<= /o:p>

+}

+

+// ***********= *****************************************************************

+//  = Support Routine: CheckForSupportSetImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+CheckForSuppor= tSetImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+)

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    ImageIndex;

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *AbortReason;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceSupportGuid002;=

+  ResultM= essageLabel =3D L"SetImage, function support check";

+

+  ImageIn= dex =3D 0;

+  Image = =3D NULL;

+  ImageSi= ze =3D 0;

+  AbortRe= ason =3D NULL;

+

+  //=

+  // Chec= k if function is supported

+  //=

+

+  Status = =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     ImageIndex,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     Progress,

+  &n= bsp;            = ;             &= nbsp;    &AbortReason

+  &n= bsp;            = ;            &n= bsp;     );

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; ResultMessageData =3D L"function is NOT supported";

+  } else = {

+  &n= bsp; ResultMessageData =3D L"function is supported.";<= /span>

+  }<= /o:p>

+

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Abo= rtReason !=3D NULL) {

+  &n= bsp; gtBS->FreePool (AbortReason);

+  }<= /o:p>

+

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return EFI_UNSUPPORTED;

+  } else = {

+  &n= bsp; return EFI_SUCCESS;

+  }<= /o:p>

+}

+

+// ***********= *****************************************************************

+//  = Support Routine: CheckForSupportCheckImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+CheckForSuppor= tCheckImage (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+)

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    ImageIndex;

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   ImageUpdatable;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceSupportGuid003;=

+  ResultM= essageLabel =3D L"CheckImage, function support check";=

+

+  ImageIn= dex =3D 0;

+  Image = =3D NULL;

+  ImageSi= ze =3D 0;

+

+  //=

+  // Chec= k if function is supported

+  //=

+

+  Status = =3D FirmwareManagement->CheckImage (

+   &= nbsp;           &nbs= p;            &= nbsp;    FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     ImageIndex,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     &ImageUpdatable

+  &n= bsp;            = ;             &= nbsp;    );

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; ResultMessageData =3D L"function is NOT supported";

+  } else = {

+  &n= bsp; ResultMessageData =3D L"function is supported.";<= /span>

+  }<= /o:p>

+

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return EFI_UNSUPPORTED;

+  } else = {

+  &n= bsp; return EFI_SUCCESS;

+  }<= /o:p>

+}

+

+// ***********= *****************************************************************

+//  = Support Routine: CheckForSupportSetPackageInfo

+// ***********= *****************************************************************

+

+EFI_STATUS

+CheckForSuppor= tSetPackageInfo (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+)

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+  VOID&nb= sp;            =             &nb= sp;            =      *VendorCode;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceSupportGuid004;=

+  ResultM= essageLabel =3D L"SetPackageInfo, function support check";

+

+  Image = =3D NULL;

+  ImageSi= ze =3D 0;

+  VendorC= ode =3D NULL;

+  Package= Version =3D 0;

+  Package= VersionName =3D NULL;

+

+  //=

+  // Chec= k if function is supported

+  //=

+

+  Status = =3D FirmwareManagement->SetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     Image, 

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     VendorCode,

+  &n= bsp;            = ;             &= nbsp;    PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; ResultMessageData =3D L"function is NOT supported";

+  } else = {

+  &n= bsp; ResultMessageData =3D L"function is supported.";<= /span>

+  }<= /o:p>

+

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return EFI_UNSUPPORTED;

+  } else = {

+  &n= bsp; return EFI_SUCCESS;

+  }<= /o:p>

+}

+

+// ***********= *****************************************************************

+//  = Test Cases

+// =

+// =

+// ***********= *****************************************************************

+

+/*<= /span>

+EFI_STATUS

+BBTestUnitTest= (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  return = EFI_SUCCESS;

+}

+*/<= /span>

+

+// ***********= *****************************************************************

+//  = Test Case: GetImageInfo

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            &nbs= p;   &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestG= etImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);

+  BBTestG= etImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Test Case: GetImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;             = ;            &n= bsp; *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Chec= k if function is supported

+  //

+

+  Status = =3D CheckForSupportGetImage (StandardLib, FirmwareManagement);

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestG= etImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);

+  BBTestG= etImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);

+  BBTestG= etImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);

+  BBTestG= etImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Test Case: SetImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestSetImage= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Chec= k if function is supported

+  //

+

+  Status = =3D CheckForSupportSetImage (StandardLib, FirmwareManagement);

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestS= etImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);

+  //BBTes= tSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);=

+  BBTestS= etImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);

+  BBTestS= etImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);

+  return = Status;

+}

+

+// ***********= *****************************************************************

+//  = Test Case: CheckImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Chec= k if function is supported

+  //

+

+  Status = =3D CheckForSupportCheckImage (StandardLib, FirmwareManagement);=

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestC= heckImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);=

+  BBTestC= heckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);=

+  return = Status;

+}

+

+// ***********= *****************************************************************

+//  = Test Case: SetPackageInfo

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Chec= k if function is supported

+  //

+

+  Status = =3D CheckForSupportSetPackageInfo (StandardLib, FirmwareManagement);

+  if (Sta= tus =3D=3D EFI_UNSUPPORTED) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestS= etPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);<= o:p>

+  BBTestS= etPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);<= o:p>

+  BBTestS= etPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);<= o:p>

+  BBTestS= etPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);<= o:p>

+  return = Status;

+}

+

+// ***********= *****************************************************************

+//  = Check Points

+// =

+// =

+// ***********= *****************************************************************

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImageInfo, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except ImageInfoSize =3D 1.

+  &n= bsp;   The function should return EFI_BUFFER_TOO_SMALL and ImageI= nfoSize > 1.

+**/=

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;             =             &nb= sp;  DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;            &nb= sp;            =             &nb= sp;  *PackageVersionName;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid001;

+  ResultM= essageLabel =3D L"GetImageInfo, conformance checkpoint #1";<= /o:p>

+  ResultM= essageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL.";<= /o:p>

+

+  ImageIn= fo =3D NULL;

+  Package= VersionName =3D NULL;

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  ImageIn= foSize =3D 1;

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus !=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_BUFFER_TOO_SMALL.&qu= ot;;

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if (Ima= geInfoSize <=3D 1) {

+   &= nbsp;AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to update *ImageInfoSize.";

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Ima= geInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImageInfo, 2

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except &ImageInfoSize =3D = NULL.

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER.

+**/=

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;             =             &nb= sp;  PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid002;

+  ResultM= essageLabel =3D L"GetImageInfo, conformance checkpoint #2";<= /o:p>

+  ResultM= essageData =3D L"correctly returned EFI_INVALID_PARAMETER.";=

+

+  ImageIn= fo =3D NULL;

+  Package= VersionName =3D NULL;

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+   &= nbsp;           &nbs= p;            &= nbsp;    FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     NULL, // &ImageInfoSize<= /p>

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus !=3D EFI_INVALID_PARAMETER) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER.&q= uot;;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            &nbs= p; AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            &nbs= p; Status

+  &n= bsp;            = ;  );

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Ima= geInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImage, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except ImageSize =3D 1.

+  &n= bsp;   The function should return EFI_BUFFER_TOO_SMALL and ImageS= ize > 1.

+**/=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;             =             &nb= sp;  *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid003;

+  ResultM= essageLabel =3D L"GetImage, conformance checkpoint #1";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;    &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            &nbs= p;            &= nbsp;    &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;      &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+   &= nbsp;           &nbs= p;            &= nbsp;      &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+

+  &n= bsp; ImageSize =3D 1;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_BUFFER_T= OO_SMALL.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; if (ImageInfoSize <=3D 1) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to update *ImageSize.&= quot;;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL.&= quot;;

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp;   gtBS->FreePool (BufferImage);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImage, 2

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except Image =3D NULL.

+   &= nbsp;  The function should return EFI_INVALID_PARAMETER.

+**/=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            &nbs= p;   ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;             &= nbsp;           &nbs= p;   DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;             &= nbsp;           &nbs= p;   ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid004;

+  ResultM= essageLabel =3D L"GetImage, conformance checkpoint #2";

+

+  BufferI= mageInfo =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            &nbs= p;            &= nbsp;    &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL.=

+  &n= bsp; ImageSize =3D p->Size * 2;

+  &n= bsp; Image =3D NULL;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;             &= nbsp;      Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_INVALID_PARAMETER) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_INVALID_= PARAMETER.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER.= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImage, 3

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except ImageIndex =3D 0 or

+  &n= bsp;   ImageIndex =3D DescriptorCount + 1.<= /p>

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER or EFI_NO= T_FOUND.

+**/=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+  UINT8&n= bsp;            = ;            &n= bsp;            &nbs= p;   ImageIndex;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid005;

+  ResultM= essageLabel =3D L"GetImage, conformance checkpoint #3";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            &nbs= p;   (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;             &= nbsp;      &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  // Dumm= y image so as to fail on Image =3D NULL

+  // Any = size since the function should check for index before size

+  ImageSi= ze =3D 64;

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageSize,

+  &n= bsp;            = ;    (VOID **) &Image

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  BufferI= mage =3D Image;

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_FAILED;

+  ResultM= essageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_NOT_FOU= ND.";

+

+  ImageIn= dex =3D 0;

+  Status = =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;    ImageIndex,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     &ImageSize

+  &n= bsp;            = ;            &n= bsp;     );

+  if ((St= atus !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND)) {<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  if ((De= scriptorCount + 1) !=3D 0) {

+  &n= bsp; ImageIndex =3D DescriptorCount + 1;

+  &n= bsp; Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       ImageIndex,

+  &n= bsp;            = ;             &= nbsp;      Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NO= T_FOUND)) {

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //=

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_NOT_F= OUND.";

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            &nbs= p; AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            &nbs= p; Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+   i= f (BufferImage !=3D NULL) {

+  &n= bsp;   gtBS->FreePool (BufferImage);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImage, 4

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except Image has dummy

+  &n= bsp;   authentication data.    

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            &nbs= p;   DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  VOID&nb= sp;            =              &n= bsp;            = ;    *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid006;

+  ResultM= essageLabel =3D L"GetImage, conformance checkpoint #4";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQU= IRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL.=

+  &n= bsp; ImageSize =3D p->Size * 2;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+

+  &n= bsp; FunctionTested++;

+

+   &= nbsp;Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;  

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_SECURITY= _VIOLATION.";

+  &n= bsp;   goto Exit; 

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImage);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetImage, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except Image =3D NULL.

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER.

+**/=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *AbortReason;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid007;

+  ResultM= essageLabel =3D L"SetImage, conformance checkpoint #1";

+

+  BufferI= mageInfo =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  AbortRe= ason =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+   &= nbsp;  continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+   &= nbsp;  continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Image =3D NULL;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            = ;            &n= bsp;       NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;       Progress,

+  &n= bsp;            &nbs= p;            &= nbsp;      &AbortReason=

+  &n= bsp;            = ;            &n= bsp;       );

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_INVALID_PARAMETER) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_INVALID_= PARAMETER.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER.= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            &nbs= p; );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Abo= rtReason !=3D NULL) {

+  &n= bsp; gtBS->FreePool (AbortReason);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetImage, 2

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except Image is a dummy image.=

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER or EFI_AB= ORTED.

+**/=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;             =             &nb= sp;  PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *AbortReason;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;             &= nbsp;           &nbs= p;   FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid008;

+  ResultM= essageLabel =3D L"SetImage, conformance checkpoint #2";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  AbortRe= ason =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;    &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            &nbs= p;            &= nbsp;    &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;      &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+   &= nbsp;           &nbs= p;            &= nbsp;      &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            &nbs= p;            &= nbsp;      p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            = ;            &n= bsp;       NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;       Progress,

+  &n= bsp;            = ;             &= nbsp;      &AbortReason=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_AB= ORTED)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_INVALID_= PARAMETER or EFI_ABORTED.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER = or EFI_ABORTED.";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImage);

+  }<= /o:p>

+  if (Abo= rtReason !=3D NULL) {

+  &n= bsp; gtBS->FreePool (AbortReason);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetImage, 3

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except ImageIndex =3D 0 or

+  &n= bsp;   ImageIndex =3D DescriptorCount + 1.<= /p>

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER or EFI_AB= ORTED.

+**/=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *AbortReason;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            &nbs= p;   ImageSize;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    ImageIndex;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid009;

+  ResultM= essageLabel =3D L"SetImage, conformance checkpoint #3";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage=3DNULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  AbortRe= ason =3D NULL;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  // Dumm= y image so as to fail on Image =3D NULL

+  // Any = size since the function should check for index before size

+  ImageSi= ze =3D 64;

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageSize,

+  &n= bsp;            &nbs= p;   (VOID **) &Image

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  BufferI= mage =3D Image;

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_FAILED;

+  ResultM= essageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_ABORTED= .";

+

+  ImageIn= dex =3D 0;

+  Status = =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     ImageIndex,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     Progress,

+  &n= bsp;            = ;            &n= bsp;     &AbortReason

+  &n= bsp;            &nbs= p;            &= nbsp;    );

+  if ((St= atus !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  if ((De= scriptorCount + 1) !=3D 0) {

+  &n= bsp; ImageIndex =3D DescriptorCount + 1;

+  &n= bsp; Status =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            &nbs= p;            &= nbsp;      NULL,  // Vendorcode

+  &n= bsp;            = ;            &n= bsp;       Progress,

+  &n= bsp;            = ;            &n= bsp;       &AbortReason=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_AB= ORTED)) {

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //=

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_ABORT= ED.";

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            &nbs= p; StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp;   gtBS->FreePool (BufferImage);

+  }<= /o:p>

+  if (Abo= rtReason !=3D NULL) {

+  &n= bsp; gtBS->FreePool (AbortReason);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetImage, 4

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except Image has dummy

+  &n= bsp;   authentication data.    

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D             &= nbsp;           &nbs= p;            &= nbsp;TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;             = ;            &n= bsp;            = ;    *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *AbortReason;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid010;

+  ResultM= essageLabel =3D L"SetImage, conformance checkpoint #4";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  AbortRe= ason =3D NULL;

+  Functio= nTested =3D 0;

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            &nbs= p;   EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;             &= nbsp;    &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            &nbs= p;            &= nbsp;    );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            &nbs= p;            &= nbsp;      &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQU= IRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->SetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            = ;            &n= bsp;       NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;       Progress,

+  &n= bsp;            = ;            &n= bsp;       &AbortReason=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_SECURITY= _VIOLATION.";

+  &n= bsp;   goto Exit; 

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            &nbs= p; ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImage);

+  }<= /o:p>

+  if (Abo= rtReason !=3D NULL) {

+  &n= bsp; gtBS->FreePool (AbortReason);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: CheckImage, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with valid parameters, except Image =3D NULL.

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER.

+**/=

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            &nbs= p;   DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+

+  UINT32&= nbsp;            &nb= sp;            =             &nb= sp;  ImageUpdatable;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         &nbs= p;        *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid011;

+  ResultM= essageLabel =3D L"CheckImage, conformance checkpoint #1";

+

+  BufferI= mageInfo =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+   &= nbsp;           &nbs= p;            &= nbsp;    &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            &nbs= p;     EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Image =3D NULL;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->CheckImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            &nbs= p;            &= nbsp;      &ImageUpdatable

+  &n= bsp;            = ;            &n= bsp;       );

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_INVALID_PARAMETER) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_INVALID_= PARAMETER.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER.= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: CheckImage, 2

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except Image has dummy

+  &n= bsp;   authentication data.    

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;             =             &nb= sp;  *PackageVersionName;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   ImageUpdatable;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;             &= nbsp;           &nbs= p;   i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid012;

+  ResultM= essageLabel =3D L"CheckImage, conformance checkpoint #2";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            &nbs= p;            &= nbsp;    &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQU= IRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->CheckImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       ImageSize,

+  &n= bsp;            = ;            &n= bsp;       &ImageUpdatable

+  &n= bsp;            &nbs= p;            &= nbsp;      );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if (Status !=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_SECURITY= _VIOLATION.";

+  &n= bsp;   goto Exit; 

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= ";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+   &= nbsp;           &nbs= p; Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImage);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetPackageInfo, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Gets PackageVersionNameMaxLen.

+  &n= bsp; - Calls function with valid parameters, except PackageVersionName is l= onger

+  &n= bsp;   than the value returned in PackageVersionNameLen.

+  &n= bsp;   The function should return EFI_INVALID_PARAMETER.

+**/=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        &nbs= p;   *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+  UINT32&= nbsp;            &nb= sp;            =             &nb= sp;  PackageVersionNameMaxLen;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSupported;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSetting;

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *TestName;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   TestNameLength;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid013;

+  ResultM= essageLabel =3D L"SetPackageInfo, function checkpoint #1";

+

+  Package= VersionName =3D NULL;

+  TestNam= e =3D NULL;

+

+  //=

+  // Get = PackageVersionNameMaxLen

+  //=

+

+  Status = =3D FirmwareManagement->GetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;             &= nbsp;    &PackageVersionName,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionNameMaxLen,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSupported,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSetting

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus !=3D EFI_SUCCESS) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"test skipped - test case does not apply.";<= /o:p>

+  if (Pac= kageVersionNameMaxLen =3D=3D 0) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if (((A= ttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;     PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &am= p;&

+  &n= bsp;   ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION= _REQUIRED) =3D=3D

+  &n= bsp;     PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  gtBS-&g= t;FreePool (PackageVersionName);

+  Package= VersionName =3D NULL;

+  TestNam= eLength =3D PackageVersionNameMaxLen + 1;

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;   EfiBootServicesData,

+  &n= bsp;            &nbs= p;  TestNameLength * 2,  // Unicode

+  &n= bsp;            = ;   (VOID **) &TestName

+  &n= bsp;            = ;   );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  for (i = =3D 0; i < (TestNameLength - 1); i++) {

+  &n= bsp; TestName[i] =3D L' ';

+  }<= /o:p>

+  TestNam= e[i] =3D L'\0';

+  Status = =3D FirmwareManagement->SetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // Image

+  &n= bsp;            = ;            &n= bsp;     0,  // ImageSize

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     0x01010101, // Dummy PackageVersion=

+  &n= bsp;            = ;            &n= bsp;     TestName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus =3D=3D EFI_INVALID_PARAMETER) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER.= ";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER.&q= uot;;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            &nbs= p; AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            &nbs= p; Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Tes= tName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (TestName);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetPackageInfo, 2

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except Image is NULL.

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;             &= nbsp;TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersionNameMaxLen;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  AttributesSupported;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSetting;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid014;

+  ResultM= essageLabel =3D L"SetPackageInfo, function checkpoint #2";

+

+  Package= VersionName =3D NULL;

+

+  //=

+  // Get = PackageVersionNameMaxLen

+  //=

+

+  Status = =3D FirmwareManagement->GetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionNameMaxLen,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSupported,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSetting

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus !=3D EFI_SUCCESS) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"test skipped - test case does not apply.";<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PAC= KAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACKA= GE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Image = =3D NULL;

+  ImageSi= ze =3D 64;  // Dummy

+  Status = =3D FirmwareManagement->SetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     Image,

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     PackageVersion,

+  &n= bsp;            &nbs= p;            &= nbsp;    PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus =3D=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= .";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.&= quot;;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            &nbs= p; AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetPackageInfo, 3

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except ImageSize is 0.

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersionNameMaxLen;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSupported;

+  UINT64&= nbsp;            &nb= sp;            =             &nb= sp;  AttributesSetting;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid015;

+  ResultM= essageLabel =3D L"SetPackageInfo, function checkpoint #3";

+

+  Package= VersionName =3D NULL;

+  Image = =3D NULL;

+

+  //=

+  // Get = PackageVersionNameMaxLen

+  //=

+

+  Status = =3D FirmwareManagement->GetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName,

+   &= nbsp;           &nbs= p;            &= nbsp;    &PackageVersionNameMaxLen,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSupported,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSetting

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus !=3D EFI_SUCCESS) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"test skipped - test case does not apply.";<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PAC= KAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACKA= GE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ; EfiBootServicesData,

+  &n= bsp;            = ; 64,  // Dummy

+  &n= bsp;            = ; (VOID **) &Image

+  &n= bsp;            = ; );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  ImageSi= ze =3D 0;

+  Status = =3D FirmwareManagement->SetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     Image, 

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus =3D=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= .";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.&= quot;;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Ima= ge !=3D NULL) {

+  &n= bsp; gtBS->FreePool (Image);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: SetPackageInfo, 4

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - The function requires authentication.

+  &n= bsp; - Calls function with valid parameters, except Image has a dummy

+  &n= bsp;   authentication data.

+  &n= bsp;   The function should return EFI_SECURITY_VIOLATION.

+**/=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  *PackageVersionName;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersionNameMaxLen;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSupported;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSetting;

+

+  VOID&nb= sp;             = ;            &n= bsp;            = ;    *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestConformanceAssertionGuid016;

+  ResultM= essageLabel =3D L"SetPackageInfo, function checkpoint #4";

+

+  Package= VersionName =3D NULL;

+  Image = =3D NULL;

+  ImageSi= ze =3D 64;

+

+  //=

+  // Get = PackageVersionNameMaxLen

+  //=

+

+  Status = =3D FirmwareManagement->GetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionNameMaxLen,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSupported,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSetting

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus !=3D EFI_SUCCESS) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  ResultM= essageData =3D L"test skipped - test case does not apply.";<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PAC= KAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACKA= GE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  if ((At= tributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &n= bsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ; EfiBootServicesData,

+  &n= bsp;            = ; ImageSize,

+  &n= bsp;            = ; (VOID **) &Image

+  &n= bsp;            = ; );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+  Status = =3D FirmwareManagement->SetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     Image,  

+  &n= bsp;            = ;            &n= bsp;     ImageSize,

+  &n= bsp;            = ;            &n= bsp;     NULL,  // VendorCode

+  &n= bsp;            = ;            &n= bsp;     PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if (Sta= tus =3D=3D EFI_SECURITY_VIOLATION) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATION= .";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.&= quot;;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            &nbs= p; AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            &nbs= p; Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Ima= ge !=3D NULL) {

+  &n= bsp; gtBS->FreePool (Image);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmwa= reManagementBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/F= irmwareManagement/BlackBoxTest/FirmwareManagementBBTestFunction.c

new file mode 10064= 4

index 00000000..99a= 74aa5

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/F= irmwareManagementBBTestFunction.c

@@ -0,0 +1,891 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2016, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+  &n= bsp; FirmwareManagementBBTestFunction.c

+

+Abstract:=

+  &n= bsp; Firmware Management Protocol's function tests.

+

+--*/

+

+#define DEBUG_= ALL            =             &nb= sp;       0

+#define DEBUG_= GET_IMAGE_INFO          &= nbsp;          1

+#define DEBUG_= GET_IMAGE           =             &nb= sp;  0

+#define DEBUG_= GET_PACKAGE_INFO          = ;         1

+

+

+#include "= ;SctLib.h"

+#include "= ;FirmwareManagementBBTestMain.h"

+

+// ***********= *****************************************************************

+//  = Check Points

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= InfoFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL        &n= bsp; *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetImage= FunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        &nbs= p;   *FirmwareManagement

+  );=

+

+EFI_STATUS

+BBTestGetPacka= geInfoFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  );=

+

+// ***********= *****************************************************************

+//  = Test Cases

+// =

+// =

+// ***********= *****************************************************************

+

+/*<= /span>

+EFI_STATUS

+BBTestUnitTest= (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE            &n= bsp;            = ;         SupportHandle

+  )<= /o:p>

+{

+  return = EFI_SUCCESS;

+}

+*/<= /span>

+

+// ***********= *****************************************************************

+//  = Test Case: GetImageInfo

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= InfoFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestG= etImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);<= /o:p>

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+// Test Case: = GetImage

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetImage= FunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //=

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestG= etImageFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Test Case: GetPackageInfo

+// ***********= *****************************************************************

+

+EFI_STATUS

+BBTestGetPacka= geInfoFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL          = ;            &n= bsp; *This,

+  IN VOID=             &nb= sp;            =             &nb= sp;  *ClientInterface,

+  IN EFI_= TEST_LEVEL           = ;            &n= bsp;      TestLevel,

+  IN EFI_= HANDLE           &nb= sp;            =           SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL        =      *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL        &n= bsp;      *FirmwareManagement;

+

+  //=

+  // Init=

+  //=

+

+  Firmwar= eManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Call= check point(s)

+  //=

+

+  BBTestG= etPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);

+  return = EFI_SUCCESS;

+}

+// ***********= *****************************************************************

+//  = Check Points

+//<= /span>

+// =

+// ***********= *****************************************************************

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImageInfo, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with all valid parameters.

+  &n= bsp;   The function should return EFI_SUCCESS.<= /p>

+   &= nbsp;- Checks DescriptorSize is 0.

+  &n= bsp; - Checks (DescriptorCount * DescriptorSize) is <=3D ImageInfoSize.

+  &n= bsp; - Checks DescriptorVersion is =3D=3D 1.

+  &n= bsp; - Checks ImageIndex is between 1 and DescriptorCount.

+  &n= bsp; - Checks AttributesSupported has no bits set beyond bit3.

+  &n= bsp; - Checks AttribtuesSetting has no bits set beyond bit3.

+  &n= bsp; - Checks Compatibilities bit1 thru bit15 are 0s.

+**/=

+

+EFI_STATUS

+BBTestGetImage= InfoFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  *PackageVersionName;

+

+  CHAR16*=             &nb= sp;            =             &nb= sp;  Attribute[4];

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+

+#if (DEBUG_ALL= || DEBUG_GET_IMAGE_INFO)

+

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *BitField;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *BitSetting;

+

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   j;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    k;

+

+#endif

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestFunctionAssertionGuid001;<= /p>

+  ResultM= essageLabel =3D L"GetImageInfo, function checkpoint #1";

+

+  BufferI= mageInfo =3D NULL;

+  ImageIn= fo =3D NULL;

+  Package= VersionName =3D NULL;

+

+  Attribu= te[0] =3D L"Image Updatable";

+  Attribu= te[1] =3D L"Reset Required";

+  Attribu= te[2] =3D L"Authentication Required";

+  Attribu= te[3] =3D L"In Use";

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            &nbs= p;   EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;             &= nbsp;    &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+  &n= bsp;            = ;             &= nbsp;    &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  }<= /o:p>

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Sta= tus =3D=3D EFI_SUCCESS) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS.";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_SUCCESS.";=

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  if (Des= criptorVersion !=3D 1) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp; ResultMessageData =3D L"*DescriptorVersion !=3D 1.";

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (p->ImageIndex > DescriptorCount) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp;   ResultMessageData =3D L"ImageIndex is beyond Descript= orCount.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+

+  &n= bsp; if ((p->AttributesSupported & 0xFFFFFFFFFFFFFFF0) !=3D 0) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp;   ResultMessageData =3D L"AttributesSupported has bit(s= ) set beyond bit3.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+

+  &n= bsp; if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) !=3D 0) {<= /o:p>

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp;   ResultMessageData =3D L"AttributesSetting has bit(s) = set beyond bit3.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+

+  &n= bsp; if ((p->Compatibilities & 0x000000000000FFFE) !=3D0) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp;   ResultMessageData =3D L"Compatibilities have bit(s) s= et between bit1 and bit15.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  }<= /o:p>

+

+#if (DEBUG_ALL= || DEBUG_GET_IMAGE_INFO)

+

+  Standar= dLib->RecordMessage (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;  L"Firmware Image Info Header: \n"

+  &n= bsp;            = ;  L"  - *ImageInfoSize =3D %x\n"

+  &n= bsp;            = ;  L"  - *DescriptorVersion =3D %x\n"=

+  &n= bsp;            = ;  L"  - *DescriptorCount =3D %x\n"

+  &n= bsp;            = ;  L"  - *DescriptorSzie =3D %x\n"

+  &n= bsp;            = ;  L"  - *PackageVersion =3D %08x\n"<= /p>

+  &n= bsp;            = ;  L"  - **PackageVersionName =3D %s\n",

+  &n= bsp;            = ;  ImageInfoSize,

+  &n= bsp;            = ;  DescriptorVersion,

+  &n= bsp;            &nbs= p; DescriptorCount,

+  &n= bsp;            = ;  DescriptorSize,

+  &n= bsp;            = ;  PackageVersion,

+  &n= bsp;            = ;  PackageVersionName

+  &n= bsp;            = ;  );

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+  &n= bsp; StandardLib->RecordMessage (

+  &n= bsp;            = ;    StandardLib,

+  &n= bsp;            = ;    EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;    L"Descriptor Index =3D %x:\n"

+  &n= bsp;            &nbs= p;   L"  - ImageTypeId =3D %08x-%04x-%04x-%02x%02x= %02x%02x%02x%02x%02x%02x",

+  &n= bsp;            = ;    p->ImageIndex,

+  &n= bsp;            = ;    p->ImageTypeId.Data1,

+  &n= bsp;            = ;    p->ImageTypeId.Data2,

+  &n= bsp;            = ;    p->ImageTypeId.Data3,

+  &n= bsp;            &nbs= p;   p->ImageTypeId.Data4[0],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[1],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[2],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[3],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[4],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[5],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[6],

+  &n= bsp;            = ;    p->ImageTypeId.Data4[7]

+  &n= bsp;            = ;    );

+  &n= bsp; StandardLib->RecordMessage (

+  &n= bsp;            = ;    StandardLib,

+  &n= bsp;            = ;    EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;    L"  - ImageId =3D %016X\n"

+  &n= bsp;            = ;    L"  - *ImageIdName =3D %s\n"<= /span>

+  &n= bsp;            = ;    L"  - Version =3D %08x\n"

+  &n= bsp;            = ;    L"  - *VersionName =3D %s\n"<= /span>

+  &n= bsp;            = ;    L"  - Size =3D %x",

+  &n= bsp;            = ;    p->ImageId,

+  &n= bsp;            = ;    p->ImageIdName,

+  &n= bsp;            = ;    p->Version,

+  &n= bsp;            = ;    p->VersionName,

+  &n= bsp;            = ;    p->Size

+  &n= bsp;            = ;    );

+  &n= bsp; StandardLib->RecordMessage (

+  &n= bsp;            = ;    StandardLib,

+   &= nbsp;           &nbs= p;   EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;    L"  - AttributesSupported =3D %016x\n"

+  &n= bsp;            = ;    L"  - AttributesSetting   =3D %016x= ",

+  &n= bsp;            = ;    p->AttributesSupported,

+  &n= bsp;            = ;    p->AttributesSetting

+  &n= bsp;            &nbs= p;   );

+  &n= bsp; for (j =3D 1, k =3D 0; j <=3D IMAGE_ATTRIBUTE_IN_USE; j =3D SctLShi= ftU64(j, 1), k++) {

+  &n= bsp;   BitField =3D Attribute[k];

+  &n= bsp;   if ((p->AttributesSupported & j) !=3D j) {

+  &n= bsp;     BitSetting =3D L"Not Supported";

+  &n= bsp;   } else if ((p->AttributesSetting & j) =3D=3D j) {

+  &n= bsp;     BitSetting =3D L"Yes";

+  &n= bsp;   } else {

+  &n= bsp;     BitSetting =3D L"No";

+  &n= bsp;   }

+  &n= bsp;   StandardLib->RecordMessage (

+  &n= bsp;            = ;      StandardLib,

+  &n= bsp;            = ;      EFI_VERBOSE_LEVEL_QUIET,<= /p>

+  &n= bsp;            = ;      L"    - %s =3D %s"= ,

+  &n= bsp;            = ;      BitField,

+  &n= bsp;            = ;      BitSetting

+  &n= bsp;            = ;      );

+  &n= bsp; }

+  &n= bsp; StandardLib->RecordMessage (

+  &n= bsp;            = ;    StandardLib,

+  &n= bsp;            &nbs= p;   EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;    L"  - Compatibilities =3D %016x\n",=

+  &n= bsp;            = ;    p->Compatibilities

+  &n= bsp;            = ;    );

+  }<= /o:p>

+

+#endif

+

+  //=

+  // Repo= rt the checkpoint result

+  //=

+

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+} <= /span>

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetImage, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with all valid parameters.

+  &n= bsp;   The function should return EFI_SUCCESS or EFI_UNSUPPORTED.=

+**/=

+

+EFI_STATUS

+BBTestGetImage= FunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *BufferImageInfo;

+  VOID&nb= sp;            =             &nb= sp;            =      *BufferImage;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageInfoSize;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *ImageInfo;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   DescriptorVersion;

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    DescriptorCount;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    DescriptorSize;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  *PackageVersionName;

+

+  VOID&nb= sp;            =             &nb= sp;            =      *Image;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    ImageSize;

+

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    i;

+  EFI_FIR= MWARE_IMAGE_DESCRIPTOR         = ;         *p;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    FunctionTested;

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestFunctionAssertionGuid002;<= /p>

+  ResultM= essageLabel =3D L"GetImage, function checkpoint #1";

+

+  BufferI= mageInfo =3D NULL;

+  BufferI= mage =3D NULL;

+  ImageIn= fo =3D NULL;

+  Image = =3D NULL;

+  Package= VersionName =3D NULL;

+  Functio= nTested =3D 0;

+

+  // Use = a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sinc= e some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.<= /o:p>

+  // Chec= k for EFI_BUFFER_TOO_SMALL in another conformance test.

+

+  ImageIn= foSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;=

+  Status = =3D gtBS->AllocatePool (

+  &n= bsp;            = ;    EfiBootServicesData,

+  &n= bsp;            = ;    ImageInfoSize,

+  &n= bsp;            = ;    (VOID **) &ImageInfo

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR (Status)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"test case initialization failure.";<= o:p>

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  Status = =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;     ImageInfo,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorVersion,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;     &DescriptorSize,

+   &= nbsp;           &nbs= p;            &= nbsp;    &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName

+  &n= bsp;            = ;            &n= bsp;     );

+  if (Sta= tus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp; gtBS->FreePool (ImageInfo);

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            &nbs= p;     EfiBootServicesData,

+  &n= bsp;            = ;      ImageInfoSize,

+  &n= bsp;            = ;      (VOID **) &ImageInfo<= /p>

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; Status =3D FirmwareManagement->GetImageInfo (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       &ImageInfoSize,

+  &n= bsp;            = ;            &n= bsp;       ImageInfo,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorVersion,=

+  &n= bsp;            = ;            &n= bsp;       &DescriptorCount,

+  &n= bsp;            = ;            &n= bsp;       &DescriptorSize,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;       &PackageVersionName=

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; if (Status !=3D EFI_SUCCESS) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   BufferImageInfo =3D ImageInfo;

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  } =

+  BufferI= mageInfo =3D ImageInfo;

+

+  if (Des= criptorSize =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"*DescriptorSize is 0.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+  if ((De= scriptorCount * DescriptorSize) > ImageInfoSize) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) = > *ImageInfoSize.";

+  &n= bsp; goto Exit;  // Note the Status =3D EFI_SUCCESS<= /p>

+  } =

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  for (i = =3D 0; i < DescriptorCount; i++) {

+  &n= bsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (= i * DescriptorSize));

+

+  &n= bsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) &&

+  &n= bsp;     ((p->AttributesSetting & IMAGE_ATTRIBUT= E_AUTHENTICATION_REQUIRED) =3D=3D

+  &n= bsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if (p->Size =3D=3D 0) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) = !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+  &n= bsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; ImageSize =3D p->Size;

+  &n= bsp; Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;      EfiBootServicesData,

+  &n= bsp;            = ;      ImageSize,

+  &n= bsp;            = ;      (VOID **) &Image

+  &n= bsp;            = ;      );

+  &n= bsp; if (EFI_ERROR (Status)) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"test case initialization fail= ure.";

+  &n= bsp;   goto Exit;

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+

+  &n= bsp; FunctionTested++;

+  &n= bsp; Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            = ;            &n= bsp;       FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+

+  &n= bsp; if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &n= bsp;   gtBS->FreePool (Image);

+  &n= bsp;   Status =3D gtBS->AllocatePool (

+  &n= bsp;            = ;        EfiBootServicesData,=

+  &n= bsp;            = ;        ImageSize,

+  &n= bsp;            = ;        (VOID **) &Image=

+  &n= bsp;            = ;        );

+  &n= bsp;   if (EFI_ERROR (Status)) {

+  &n= bsp;     AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;     ResultMessageData =3D L"test case initial= ization failure.";

+  &n= bsp;     goto Exit;

+  &n= bsp;   }

+  &n= bsp; }

+  &n= bsp; BufferImage =3D Image;

+

+  &n= bsp; Status =3D FirmwareManagement->GetImage (

+  &n= bsp;            &nbs= p;            &= nbsp;      FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;       p->ImageIndex,

+  &n= bsp;            = ;            &n= bsp;       Image,

+  &n= bsp;            = ;            &n= bsp;       &ImageSize

+  &n= bsp;            = ;            &n= bsp;       );

+  &n= bsp; gtBS->FreePool (BufferImage);

+  &n= bsp; BufferImage =3D NULL;

+  &n= bsp; Image =3D NULL;

+

+  &n= bsp; //

+  &n= bsp; // Report the checkpoint result

+  &n= bsp; //

+

+  &n= bsp; if ((Status !=3D EFI_SUCCESS) && (Status !=3D EFI_UNSUPPORTED)= ) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   ResultMessageData =3D L"failed to return EFI_SUCCESS = or EFI_UNSUPPORTED.";

+  &n= bsp;   goto Exit; 

+  &n= bsp; }

+  }<= /o:p>

+

+  if (Fun= ctionTested =3D=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"test skipped - test case does not apply.&= quot;;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UNS= UPPORTED.";

+  }<= /o:p>

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            &nbs= p; StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+  if (Buf= ferImageInfo !=3D NULL) {

+  &n= bsp; gtBS->FreePool (BufferImageInfo);

+  }<= /o:p>

+  if (Buf= ferImage !=3D NULL) {

+  &n= bsp;   gtBS->FreePool (BufferImage);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+// ***********= *****************************************************************

+//  = Checkpoint: GetPackageInfo, 1

+// ***********= *****************************************************************

+

+/**=

+  This ro= utine:

+  &n= bsp; - Calls function with all valid parameters.

+  &n= bsp;   The function should return EFI_SUCCESS or EFI_UNSUPPORTED.=

+  &n= bsp; - Checks AttributesSupported has no bits set beyond bit2.

+  &n= bsp; - Checks AttributesSetting has no bits set beyond bit2.

+**/=

+

+EFI_STATUS

+BBTestGetPacka= geInfoFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp;  *StandardLib,

+  IN EFI_= FIRMWARE_MANAGEMENT_PROTOCOL        = ;    *FirmwareManagement

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_GUI= D            &n= bsp;            = ;            &n= bsp; TestGuid;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageLabel;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *ResultMessageData;

+

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;  PackageVersion;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *PackageVersionName;

+  UINT32&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   PackageVersionNameMaxLen;

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   AttributesSupported;

+  UINT64&= nbsp;            &nb= sp;            =             &nb= sp;  AttributesSetting;

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;            = ; 

+  CHAR16*=             &nb= sp;            =             &nb= sp;  Attribute[3];

+

+#if (DEBUG_ALL= || DEBUG_GET_PACKAGE_INFO)

+

+  CHAR16&= nbsp;           &nbs= p;             =             &nb= sp;  *BitField;

+  CHAR16&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   *BitSetting;

+

+  UINT64&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;   j;

+  UINTN&n= bsp;            = ;            &n= bsp;            = ;    k;

+

+#endif

+

+  //=

+  // Init=

+  //=

+

+  Status = =3D EFI_SUCCESS;

+  Asserti= onType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGui= d =3D gFirmwareManagementBBTestFunctionAssertionGuid003;<= /p>

+  ResultM= essageLabel =3D L"GetPackageInfo, function checkpoint #1";

+

+  Package= VersionName =3D NULL;

+

+  Attribu= te[0] =3D L"Version Updatable";

+  Attribu= te[1] =3D L"Reset Required";

+  Attribu= te[2] =3D L"Authentication Required";

+

+  //=

+  // Chec= k the data returned by the function

+  //=

+

+  Status = =3D FirmwareManagement->GetPackageInfo (

+  &n= bsp;            = ;            &n= bsp;     FirmwareManagement,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersion,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionName,

+  &n= bsp;            = ;            &n= bsp;     &PackageVersionNameMaxLen,

+  &n= bsp;            = ;            &n= bsp;     &AttributesSupported,

+  &n= bsp;            = ;             &= nbsp;    &AttributesSetting

+  &n= bsp;            = ;            &n= bsp;     );

+

+  if ((St= atus =3D=3D EFI_SUCCESS) || (Status =3D=3D EFI_UNSUPPORTED)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UNS= UPPORTED.";

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSUP= PORTED.";

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+#if (DEBUG_ALL= || DEBUG_GET_PACKAGE_INFO)

+

+  Standar= dLib->RecordMessage (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;  L"Firmware Package Info: \n"

+  &n= bsp;            = ;  L"  - *PackageVersion =3D %08x\n"<= /p>

+  &n= bsp;            = ;  L"  - **PackageVersionName =3D %s\n"

+  &n= bsp;            = ;  L"  - *PackageVersionNameMaxLen =3D %08x",

+  &n= bsp;            = ;  PackageVersion,

+  &n= bsp;            = ;  PackageVersionName,

+  &n= bsp;            = ;  PackageVersionNameMaxLen

+  &n= bsp;            = ; );

+  Standar= dLib->RecordMessage (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;  L"  - *AttributesSupported =3D %016x\n"

+  &n= bsp;            = ;  L"  - *AttributesSetting   =3D %016x",

+  &n= bsp;            = ;  AttributesSupported,

+  &n= bsp;            = ;  AttributesSetting

+  &n= bsp;            = ;  );

+  for (j = =3D 1, k =3D 0; j <=3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED; j =3D = SctLShiftU64(j, 1), k++) {

+  &n= bsp; BitField =3D Attribute[k];

+  &n= bsp; if ((AttributesSupported & j) !=3D j) {

+  &n= bsp;   BitSetting =3D L"Not Supported";

+  &n= bsp; } else if ((AttributesSetting & j) =3D=3D j) {

+  &n= bsp;   BitSetting =3D L"Yes";

+  &n= bsp; } else {

+  &n= bsp;   BitSetting =3D L"No";

+  &n= bsp; }

+  &n= bsp; StandardLib->RecordMessage (

+  &n= bsp;            = ;    StandardLib,

+  &n= bsp;            &nbs= p;   EFI_VERBOSE_LEVEL_QUIET,

+  &n= bsp;            = ;    L"    - %s =3D %s",=

+  &n= bsp;            = ;    BitField,

+  &n= bsp;            = ;    BitSetting

+  &n= bsp;            = ;    );

+  }<= /o:p>

+

+#endif

+

+  if ((At= tributesSupported & 0xFFFFFFFFFFFFFFF8) !=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp; ResultMessageData =3D L"*AttributesSupported has bit(s) set beyon= d bit2.";

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  if ((At= tributesSetting & 0xFFFFFFFFFFFFFFF8) !=3D 0) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &n= bsp; ResultMessageData =3D L"*AttributesSetting has bit(s) set beyond = bit2.";

+  &n= bsp; goto Exit;

+  }<= /o:p>

+

+  //=

+  // Repo= rt the checkpoint result

+  //

+

+Exit:

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            &nbs= p; StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  TestGuid,

+  &n= bsp;            = ;  ResultMessageLabel,

+  &n= bsp;            = ;  L"Result - %s\n%a:%d: Status - %r",

+  &n= bsp;            = ;  ResultMessageData,

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  if (Pac= kageVersionName !=3D NULL) {

+  &n= bsp; gtBS->FreePool (PackageVersionName);

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmwa= reManagementBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Firmw= areManagement/BlackBoxTest/FirmwareManagementBBTestMain.c=

new file mode 10064= 4

index 00000000..3ce= 62795

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/F= irmwareManagementBBTestMain.c

@@ -0,0 +1,228 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2017, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+

+  Firmwar= eManagementBBTestMain.c

+

+Abstract:=

+

+  Firmwar= e Management Protocol test driver.

+

+--*/

+

+#include "= ;SctLib.h"

+#include "= ;FirmwareManagementBBTestMain.h"

+

+// ***********= *****************************************************************

+//  = Variables

+// ***********= *****************************************************************

+

+EFI_HANDLE mIm= ageHandle;

+

+EFI_BB_TEST_PR= OTOCOL *gBBTestProtocolInterface;

+

+EFI_BB_TEST_PR= OTOCOL_FIELD gBBTestProtocolField =3D {

+  EFI_FIR= MWARE_MANAGEMENT_PROTOCOL_TEST_REVISION,

+  IHV_EFI= _FIRMWARE_MANAGEMENT_PROTOCOL_GUID,

+  L"= Firmware Management Protocol Test",

+  L"= UEFI 2.3 Firmware Management Protocol Black-Box Test"

+};<= /span>

+

+EFI_GUID gSupp= ortProtocolGuid[] =3D {

+  EFI_STA= NDARD_TEST_LIBRARY_GUID,

+  EFI_NUL= L_GUID

+};<= /span>

+

+EFI_BB_TEST_EN= TRY_FIELD gBBTestEntryField[] =3D {

+  /*=

+  //Use f= or unit test only

+  {<= /o:p>

+  &n= bsp; { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0x= b0, 0x6d } },

+  &n= bsp;           L"Uni= t Test Only",

+  &n= bsp;           L"Ver= ify the Assistant Function",

+  &n= bsp; EFI_TEST_LEVEL_DEFAULT,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestUnitTest

+  },=

+  */=

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101,

+  &n= bsp; L"Function_Test-GetImageInfo",

+  &n= bsp; L"Function auto test for Firmware Management Protocol GetImageInf= o().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetImageInfoFunctionTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102,

+  &n= bsp; L"Function_Test-GetImage",

+  &n= bsp; L"Function auto test for Firmware Management Protocol GetImage().= ",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetImageFunctionTest

+  },=

+/*++

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103,

+  &n= bsp; L"Function Test - SetImage",

+  &n= bsp; L"Function auto test for Firmware Management Protocol SetImage().= ",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestSetImageFunctionTest

+  },=

+--*/

+/*++

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104,

+  &n= bsp; L"Function Test - CheckImage",

+  &n= bsp; L"Function auto test for Firmware Management Protocol CheckImage(= ).",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestCheckImageFunctionTest

+  },=

+--*/

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105,

+  &n= bsp; L"Function_Test-GetPackageInfo",

+  &n= bsp; L"Function auto test for Firmware Management Protocol GetPackageI= nfo().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetPackageInfoFunctionTest

+  },=

+/*++

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106,

+  &n= bsp; L"Function Test - SetPackageInfo",

+  &n= bsp; L"Function auto test for Firmware Management Protocol SetPackageI= nfo().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestSetPackageInfoFunctionTest

+  },=

+--*/ 

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201,

+  &n= bsp; L"Conformance_Test-GetImageInfo",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol GetImage= Info().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetImageInfoConformanceTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202,

+  &n= bsp; L"Conformance_Test-GetImage",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol GetImage= ().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetImageConformanceTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203,

+  &n= bsp; L"Conformance_Test-SetImage",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol SetImage= ().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestSetImageConformanceTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204,

+  &n= bsp; L"Conformance_Test-CheckImage",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol CheckIma= ge().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestCheckImageConformanceTest

+  },=

+/*++

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205,

+  &n= bsp; L"Conformance Test - GetPackageInfo",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol GetPacka= geInfo().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestGetPackageInfoConformanceTest

+  },=

+--*/

+  {<= /o:p>

+  &n= bsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206,

+  &n= bsp; L"Conformance_Test-SetPackageInfo",

+  &n= bsp; L"Conformance auto test for Firmware Management Protocol SetPacka= geInfo().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestSetPackageInfoConformanceTest

+  },=

+  0<= /o:p>

+};<= /span>

+

+// ***********= *****************************************************************

+//  = Initialization and Unload functions

+// ***********= *****************************************************************

+

+

+EFI_STATUS

+EFIAPI

+InitializeFirm= wareManagementBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle,

+  IN EFI_= SYSTEM_TABLE          &nb= sp;  *SystemTable

+  )<= /o:p>

+{

+  EfiInit= ializeTestLib (ImageHandle, SystemTable);

+

+  //=

+  // init= ialize test utility lib

+  //=

+

+  SctInit= ializeLib (ImageHandle, SystemTable);

+

+  mImageH= andle =3D ImageHandle;

+

+  return = EfiInitAndInstallIHVBBTestInterface (

+  &n= bsp;        &ImageHandle,=

+  &n= bsp;        &gBBTestProtocolField,

+  &n= bsp;        gBBTestEntryField,

+  &n= bsp;        UnloadFirmwareManagementBBTe= st,

+  &n= bsp;        &gBBTestProtocolInterfac= e

+  &n= bsp;        );

+}

+

+EFI_STATUS

+EFIAPI

+UnloadFirmware= ManagementBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle

+  )<= /o:p>

+{

+  return = EfiUninstallAndFreeIHVBBTestInterface (

+  &n= bsp;        ImageHandle,

+  &n= bsp;        gBBTestProtocolInterface

+  &n= bsp;        );

+}

+

+// ***********= *****************************************************************

+//  = Support functions

+// ***********= *****************************************************************

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmwa= reManagementBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Firmw= areManagement/BlackBoxTest/FirmwareManagementBBTestMain.h=

new file mode 10064= 4

index 00000000..92a= c3e45

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/F= irmwareManagementBBTestMain.h

@@ -0,0 +1,223 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2017, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+

+  Firmwar= eManagementBBTestMain.h

+

+Abstract:=

+

+  Header = file for Firmware Management Protocol test driver.

+

+--*/

+

+#ifndef _FIRMW= ARE_MANAGEMENT_BB_TEST_MAIN

+#define _FIRMW= ARE_MANAGEMENT_BB_TEST_MAIN

+

+#include "= ;Efi.h"

+#include "= ;Guid.h"

+#include <L= ibrary/EfiTestLib.h>

+

+#include <U= EFI/Protocol/FirmwareManagement.h>

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_REVISION    0x00010000<= /o:p>

+

+#define IHV_EF= I_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \

+{ 0x941d02a8, = 0x49ad, 0x4bda, { 0x9f, 0xae, 0x0a, 0x69, 0x24, 0x54, 0x1c, 0x88 } }

+// ***********= *****************************************************************

+//  = Entry GUIDs for Function Test

+// ***********= *****************************************************************

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101 \

+{ 0x7ddddd57, = 0x68ff, 0x460e, { 0x90, 0xad, 0xa9, 0xd5, 0xf1, 0xf0, 0xa0, 0x87 } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102 \

+{ 0x5b4c24b2, = 0x852d, 0x418a, { 0x82, 0x34, 0xc2, 0xc8, 0x63, 0x5e, 0x9a, 0x2a } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103 \

+{ 0x84062e44, = 0xdaee, 0x41a5, { 0x94, 0xf8, 0x6d, 0xe0, 0x72, 0x9b, 0xfa, 0xb4 } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104 \

+{ 0xdeb26021, = 0xca4e, 0x4876, { 0x90, 0x99, 0xca, 0x7d, 0x77, 0x2c, 0x90, 0x1d } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105 \

+{ 0xaa160ecc, = 0xfc2f, 0x4f05, { 0xac, 0x20, 0x4c, 0xed, 0x45, 0xde, 0xda, 0xab } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106 \

+{ 0x7a9a2714, = 0xf32b, 0x4083, { 0x90, 0xf2, 0x12, 0x51, 0x1a, 0x87, 0x48, 0x1a } }

+

+// ***********= *****************************************************************

+//  = Entry GUIDs for Conformance Test

+// ***********= *****************************************************************

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201 \

+{ 0x54ee347c, = 0x10a3, 0x4311, { 0x94, 0x27, 0xa8, 0x97, 0xbf, 0xdc, 0x98, 0x8 } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202 \

+{ 0x68aba93c, = 0x1d0c, 0x412f, { 0xb1, 0xe, 0xe3, 0xa4, 0x6, 0xbc, 0x42, 0xcf } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203 \

+{ 0x12834a23, = 0x6cef, 0x478e, { 0xaf, 0x48, 0x44, 0xe5, 0x93, 0x40, 0xab, 0xe8 } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204 \

+{ 0xc6dc94b1, = 0xb81b, 0x4b85, { 0x8b, 0x7d, 0x8f, 0xbf, 0xa6, 0x8e, 0xf3, 0xe5 } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205 \

+{ 0x3d13f23d, = 0x8306, 0x49d4, { 0xa0, 0xe0, 0x9a, 0x9b, 0xf6, 0x89, 0x40, 0x3c } }

+

+#define EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206 \

+{ 0x24cf9ac2, = 0x9abc, 0x4f5c, { 0x9c, 0x7a, 0xbc, 0x22, 0x29, 0xc3, 0x2, 0x7f } }

+

+// ***********= *****************************************************************

+//  = Initializaiton and Unload functions

+// ***********= *****************************************************************

+

+EFI_STATUS

+EFIAPI

+InitializeFirm= wareManagementBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle,

+  IN EFI_= SYSTEM_TABLE          &nb= sp;  *SystemTable

+  );=

+EFI_STATUS

+EFIAPI

+UnloadFirmware= ManagementBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle

+  );=

+//<= /span>

+// Test Cases = - Unit Test

+//<= /span>

+

+/*<= /span>

+EFI_STATUS

+BBTestUnitTest= (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+*/<= /span>

+

+//<= /span>

+// Test Cases = - Function

+//<= /span>

+

+EFI_STATUS

+BBTestGetImage= InfoFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestGetImage= FunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestSetImage= FunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestCheckIma= geFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE            &n= bsp;    SupportHandle

+  );=

+

+EFI_STATUS

+BBTestGetPacka= geInfoFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+//<= /span>

+// Test Cases = - Conformance

+//<= /span>

+

+EFI_STATUS

+BBTestGetImage= InfoConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestGetImage= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestSetImage= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestCheckIma= geConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestGetPacka= geInfoConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+EFI_STATUS

+BBTestSetPacka= geInfoConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+

+// ***********= *****************************************************************

+//  = Support functions

+// ***********= *****************************************************************

+

+#endif

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c= b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTe= st/Guid.c

new file mode 10064= 4

index 00000000..c33= d5b79

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/G= uid.c

@@ -0,0 +1,63 @= @

+/** @file=

+

+  Copyrig= ht 2006 - 2012 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2012, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+ Module Name:<= o:p>

+

+   G= uid.c

+

+ Abstract:

+

+   G= UIDs auto-generated for EFI test assertion.

+

+--*/

+

+#include "= ;Efi.h"

+#include "= ;Guid.h"

+

+// ***********= *****************************************************************

+//  = Function

+// ***********= *****************************************************************

+

+EFI_GUID gFirm= wareManagementBBTestFunctionAssertionGuid001=3DEFI_TEST_FIRMWAREMANAGEMENTB= BTESTFUNCTION_ASSERTION_001_GUID;

+EFI_GUID gFirm= wareManagementBBTestFunctionAssertionGuid002=3DEFI_TEST_FIRMWAREMANAGEMENTB= BTESTFUNCTION_ASSERTION_002_GUID;

+EFI_GUID gFirm= wareManagementBBTestFunctionAssertionGuid003=3DEFI_TEST_FIRMWAREMANAGEMENTB= BTESTFUNCTION_ASSERTION_003_GUID;

+

+// ***********= *****************************************************************

+//  = Conformance

+// ***********= *****************************************************************

+

+EFI_GUID gFirm= wareManagementBBTestConformanceSupportGuid001=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTCONFORMANCE_SUPPORT_001_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceSupportGuid002=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTCONFORMANCE_SUPPORT_002_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceSupportGuid003=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTCONFORMANCE_SUPPORT_003_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceSupportGuid004=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTCONFORMANCE_SUPPORT_004_GUID;

+

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid001=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_001_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid002=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_002_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid003=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_003_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid004=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_004_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid005=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_005_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid006=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_006_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid007=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_007_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid008=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_008_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid009=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_009_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid010=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_010_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid011=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_011_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid012=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_012_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid013=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_013_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid014=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_014_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid015=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_015_GUID;

+EFI_GUID gFirm= wareManagementBBTestConformanceAssertionGuid016=3DEFI_TEST_FIRMWAREMANAGEME= NTBBTESTCONFORMANCE_ASSERTION_016_GUID;

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h= b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTe= st/Guid.h

new file mode 10064= 4

index 00000000..d2b= 2e51d

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/G= uid.h

@@ -0,0 +1,153 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2010 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010, Dell Inc. All rights reserved.<BR>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+ Module Name:<= o:p>

+

+   G= uid.h

+

+ Abstract:

+

+   G= UIDs auto-generated for EFI test assertion.

+

+--*/

+

+// ***********= *****************************************************************

+//  = Function

+// ***********= *****************************************************************

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID \<= /p>

+{ 0xd02b40ae, = 0x62f, 0x4155, { 0xbb, 0xdd, 0x4, 0x29, 0x18, 0x94, 0xea, 0x31 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestFunctionAssertionGuid001;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID \<= /p>

+{ 0xff704c46, = 0x3999, 0x4a28, { 0xa3, 0x6e, 0x76, 0x8a, 0xb6, 0xad, 0x89, 0xd8 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestFunctionAssertionGuid002;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID \<= /p>

+{ 0x70884539, = 0x9a34, 0x4146, { 0x83, 0x3a, 0x4d, 0x89, 0x8b, 0x9c, 0x7e, 0xa4 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestFunctionAssertionGuid003;

+

+// ***********= *****************************************************************

+//  = Conformance - Function Support Check

+// ***********= *****************************************************************

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID \=

+{ 0xd9c7d018, = 0x60ba, 0x448d, { 0xb1, 0x3b, 0x88, 0x8b, 0x41, 0xd9, 0xdc, 0x9 } };

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceSupportGuid001;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID \=

+{ 0x28310f16, = 0x690e, 0x44a5, { 0x93, 0x98, 0xe1, 0xcd, 0x6a, 0xb3, 0xe1, 0x61 } };<= /o:p>

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceSupportGuid002;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID \=

+{ 0x92cc940a, = 0xdcf8, 0x42a0, { 0x81, 0xa1, 0xd7, 0xdd, 0x43, 0x87, 0xbf, 0x6d } };<= /o:p>

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceSupportGuid003;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID \=

+{ 0x3f910041, = 0xcd4d, 0x4b36, { 0xb2, 0x23, 0xfb, 0x16, 0x4e, 0x7e, 0x6a, 0x8c } };<= /o:p>

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceSupportGuid004;

+

+// ***********= *****************************************************************

+//  = Conformance - Assertion

+// ***********= *****************************************************************

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID \

+{ 0x3789b80e, = 0xab70, 0x4dc9, { 0xbb, 0xbd, 0x70, 0x63, 0x76, 0x36, 0xab, 0x52 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid001;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID \

+{ 0xca1d7706, = 0x256b, 0x464e, { 0xb6, 0xee, 0x50, 0x34, 0x1e, 0xec, 0x3c, 0x83 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid002;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID \

+{ 0x3c8d87b2, = 0x6a89, 0x4a6c, { 0xbc, 0x75, 0xe6, 0x86, 0xa1, 0x49, 0x13, 0xf0 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid003;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID \

+{ 0x88031c96, = 0x99bf, 0x4d2c, { 0x9f, 0x57, 0xa7, 0x2, 0x6a, 0xbc, 0xd3, 0x51 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid004;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID \

+{ 0x7a386361, = 0x3a5d, 0x4e58, { 0x8a, 0x51, 0x4d, 0x93, 0xb6, 0x55, 0x95, 0xf4 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid005;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID \

+{ 0xd6a77629, = 0x5afd, 0x4854, { 0x87, 0xc8, 0xee, 0x9f, 0xc5, 0x3d, 0xbe, 0x3d } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid006;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID \

+{ 0x4ea24764, = 0xa6b1, 0x43b5, { 0xb8, 0xa0, 0xd3, 0x3f, 0xdc, 0x8b, 0xc6, 0xe4 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid007;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID \

+{ 0x712ce1e9, = 0x80d1, 0x4168, { 0xb8, 0xd0, 0x74, 0xd1, 0x72, 0x7a, 0x2f, 0x25 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid008;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID \

+{ 0xc82d1373, = 0x1f87, 0x45f4, { 0xaf, 0xfc, 0x10, 0xa7, 0xf7, 0xb0, 0x9c, 0xb0 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid009;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID \

+{ 0x2410a859, = 0xdf6f, 0x4857, { 0x92, 0x4a, 0x26, 0x37, 0x7, 0x11, 0xf, 0x1c } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid010;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID \

+{ 0x3987172c, = 0xe6a0, 0x4099, { 0xb1, 0x2b, 0xd8, 0xef, 0xf2, 0x62, 0x75, 0x93 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid011;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID \

+{ 0xd6dad28e, = 0x7f0f, 0x4f56, { 0x9a, 0x93, 0x14, 0x7d, 0xb3, 0x74, 0x0, 0xc9 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid012;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID \

+{ 0xb5288fc3, = 0xe906, 0x4468, { 0x83, 0x3d, 0xd4, 0xa6, 0x58, 0xa5, 0x4f, 0xbd } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid013;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID \

+{ 0x57355301, = 0x1343, 0x497f, { 0xbe, 0xe0, 0x8e, 0x5c, 0x27, 0xd2, 0x40, 0x25 } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid014;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID \

+{ 0xadeab82d, = 0x7592, 0x40fe, { 0x87, 0xa8, 0x93, 0x2b, 0xad, 0x97, 0xff, 0x5e } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid015;

+

+#define EFI_TE= ST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID \

+{ 0x9be658d2, = 0x1312, 0x4254, { 0x91, 0x10, 0x59, 0x0, 0xd5, 0xfd, 0x6c, 0x6c } }

+

+extern EFI_GUI= D gFirmwareManagementBBTestConformanceAssertionGuid016;

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFir= mwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Firm= wareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf

new file mode 10064= 4

index 00000000..756= 6a044

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/I= hvFirmwareManagementBBTest.inf

@@ -0,0 +1,52 @= @

+## @file<= /o:p>

+#

+#  Copyri= ght 2006 - 2012 Unified EFI, Inc.<BR>

+#  Copyri= ght (c) 2010 - 2012, Dell Inc.  All rights reserved.<BR>

+#

+#  This p= rogram and the accompanying materials

+#  are li= censed and made available under the terms and conditions of the BSD License=

+#  which = accompanies this distribution.  The full text of the license may be fo= und at

+#  http:/= /opensource.org/licenses/bsd-license.php

+# <= /span>

+#  THE PR= OGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOU= T WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+# <= /span>

+##<= /span>

+#/*++<= o:p>

+#

+# Module Name:=

+#

+#   = FirmwareManagementBBTest.inf

+#

+# Abstract:

+#

+#   = Component description file for IHV Firmware Management Protocol Black-Box T= est.

+#

+#--*/

+

+[defines]=

+  INF_VER= SION          =3D 0x00010005

+  BASE_NA= ME            =3D Ih= vFirmwareManagementBBTest

+  FILE_GU= ID            =3D DB= 0E842F-201B-4D47-BA74-88602A41C9D2

+  MODULE_= TYPE          =3D UEFI_DRIVER<= o:p>

+  COMPONE= NT_TYPE       =3D BS_DRIVER=

+  VERSION= _STRING       =3D 1.0

+  ENTRY_P= OINT          =3D InitializeFi= rmwareManagementBBTest

+

+[sources.commo= n]

+  Firmwar= eManagementBBTestConformance.c

+  Firmwar= eManagementBBTestFunction.c

+  Firmwar= eManagementBBTestMain.c

+  Guid.c<= o:p>

+

+[Packages]

+  MdePkg/= MdePkg.dec

+  SctPkg/= SctPkg.dec

+  SctPkg/= UEFI/UEFI.dec

+

+[LibraryClasse= s]

+  UefiDri= verEntryPoint

+  SctLib<= o:p>

+  EfiTest= Lib

+

+[Protocols]

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.c

new file mode 10064= 4

index 00000000..6a6= d4e60

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid= .c

@@ -0,0 +1,46 @= @

+/** @file=

+

+  Copyrig= ht 2006 - 2012 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+ Module Name:<= o:p>

+

+   G= uid.c

+

+ Abstract:

+

+   G= UIDs auto-generated for EFI test assertion.

+

+--*/

+

+#include "= ;HIIConfigAccessBBTestMain.h"

+

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid001=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_001_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid002=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_002_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid003=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_003_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid004=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_004_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid005=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_005_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid006=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_006_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid007=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_007_GUID;

+/*<= /span>

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid008=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_008_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid009=3DEFI_TEST_HIICONFIGACCESSBBTE= STCONFORMANCE_ASSERTION_009_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid0010=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_0010_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid0011=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_0011_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestConformanceAssertionGuid0012=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_0012_GUID;

+*/<= /span>

+EFI_GUID gHIIC= onfigAccessBBTestFunctionAssertionGuid001=3DEFI_TEST_HIICONFIGACCESSBBTESTF= UNCTION_ASSERTION_001_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestFunctionAssertionGuid002=3DEFI_TEST_HIICONFIGACCESSBBTESTF= UNCTION_ASSERTION_002_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestFunctionAssertionGuid003=3DEFI_TEST_HIICONFIGACCESSBBTESTF= UNCTION_ASSERTION_003_GUID;

+EFI_GUID gHIIC= onfigAccessBBTestFunctionAssertionGuid004=3DEFI_TEST_HIICONFIGACCESSBBTESTF= UNCTION_ASSERTION_004_GUID;

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.h

new file mode 10064= 4

index 00000000..b70= 03028

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid= .h

@@ -0,0 +1,109 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2011 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+ Module Name:<= o:p>

+

+   G= uid.h

+

+ Abstract:

+

+   G= UIDs auto-generated for EFI test assertion.

+

+--*/

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID \<= /p>

+{ 0xa7173eb5, = 0xf76a, 0x4ea1, { 0x95, 0xd, 0x14, 0x91, 0x1e, 0x49, 0x86, 0xc1 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid001;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \<= /p>

+{ 0xfa5973e2, = 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, 0x76 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid002;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID \<= /p>

+{ 0x6f6d1dd, 0= x49b8, 0x488a, { 0xa7, 0x75, 0xde, 0xbc, 0xc7, 0x60, 0xfd, 0x28 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid003;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID \<= /p>

+{ 0x28652613, = 0x6bf4, 0x4f42, { 0xab, 0xe2, 0x84, 0x4f, 0x2f, 0x77, 0xec, 0x2f } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid004;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID \<= /p>

+{ 0xebba197a, = 0x467f, 0x4736, { 0x92, 0xf2, 0x11, 0xb1, 0x91, 0x2e, 0xe9, 0x90 } }

+

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid005;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID \<= /p>

+{ 0x341fe3e0, = 0xf688, 0x45f2, { 0x91, 0x56, 0xc7, 0xae, 0x9f, 0x2c, 0xcb, 0xb0 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid006;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID \<= /p>

+{ 0x1f99ebc8, = 0x253, 0x455f, { 0x88, 0xac, 0x9e, 0x2b, 0xa6, 0xdc, 0xd7, 0x29 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid007;

+/*<= /span>

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID \<= /p>

+{ 0xbdec5b08, = 0x423, 0x482b, { 0xb7, 0xdf, 0xde, 0xac, 0xab, 0xf7, 0x13, 0x11 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid008;

+

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID \<= /p>

+{ 0x5fed024d, = 0x85f3, 0x45bf, { 0xbe, 0xb1, 0xe4, 0xf4, 0xcc, 0x86, 0xe5, 0x61 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid009;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID \=

+{ 0x22ee938e, = 0xa9ad, 0x4cb9, { 0x8d, 0x6d, 0x6, 0xe4, 0xfa, 0xb3, 0x72, 0xe7 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid0010;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID \=

+{ 0x2053d3e0, = 0xeebe, 0x4391, { 0x84, 0x7d, 0xf4, 0x60, 0x1b, 0x30, 0x4e, 0x3 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid0011;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID \=

+{ 0x81c5d7b7, = 0x7ebe, 0x44e1, { 0x8a, 0x1f, 0xcc, 0x47, 0x9c, 0x2d, 0xfe, 0x4f } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestConformanceAssertionGuid0012;

+*/<= /span>

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID \

+{ 0x24dcf8bf, = 0xbfbf, 0x4588, { 0xba, 0xf, 0x77, 0x1e, 0x24, 0x4e, 0x3e, 0x8 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestFunctionAssertionGuid001;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID \

+{ 0x961a5268, = 0x1998, 0x4a7e, { 0x9d, 0x9d, 0xce, 0xdc, 0x67, 0xfb, 0xcc, 0x77 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestFunctionAssertionGuid002;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID \

+{ 0x603e52f0, = 0x2ce3, 0x4e7a, { 0xa7, 0x2e, 0xdf, 0x8c, 0xa3, 0xfd, 0xb2, 0xd } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestFunctionAssertionGuid003;

+

+#define EFI_TE= ST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID \

+{ 0xab163674, = 0x6c27, 0x4169, { 0xa6, 0xa9, 0xe1, 0x9c, 0x88, 0x14, 0x94, 0x96 } }

+

+extern EFI_GUI= D gHIIConfigAccessBBTestFunctionAssertionGuid004;

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfig= AccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIC= onfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c

new file mode 10064= 4

index 00000000..c8b= 35003

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIC= onfigAccessBBTestConformance.c

@@ -0,0 +1,908 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+  &n= bsp; HIIConfigAccessBBTestConformance.c

+

+Abstract:=

+  &n= bsp; for EFI Driver HII Configuration Access Protocol's conformance Test

+

+--*/

+

+#include "= ;HIIConfigAccessBBTestMain.h"

+

+EFI_BROWSER_AC= TION  EFI_BROWSER_ACTION_UNSUPPORTED =3D 2;

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  );=

+/*  =

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+*/<= /span>

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL    *This,

+  IN VOID=             &nb= sp;       *ClientInterface,=

+  IN EFI_= TEST_LEVEL          TestLevel,=

+  IN EFI_= HANDLE           &nb= sp;  SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  EFI_HII= _CONFIG_ROUTING_PROTOCOL       *HIIConfigRout= ing;

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Get = the Config Routing Protocol Interface

+  //=

+  Status = =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  //Call = check points

+  //=

+  BBTestE= xtractConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );

+  BBTestE= xtractConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HIIC= onfigAccess );

+  BBTestE= xtractConfigConformanceTestCheckpoint3( StandardLib, HIIConfigRouting, HIIC= onfigAccess );

+  BBTestE= xtractConfigConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+BBTestRouteCon= figConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL    *This,

+  IN VOID=             &nb= sp;       *ClientInterface,=

+  IN EFI_= TEST_LEVEL          TestLevel,=

+  IN EFI_= HANDLE           &nb= sp;  SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  EFI_HII= _CONFIG_ROUTING_PROTOCOL       *HIIConfigRout= ing;

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            &nbs= p;   &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Get = the Config Routing Protocol Interface

+  //=

+  Status = =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  //Call = check points

+  //=

+  BBTestR= outeConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );<= /o:p>

+  BBTestR= outeConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HIICon= figAccess );

+  BBTestR= outeConfigConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );<= /o:p>

+  return = EFI_SUCCESS;

+}

+

+/*<= /span>

+EFI_STATUS

+BBTestCallBack= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL    *This,

+  IN VOID=             &nb= sp;       *ClientInterface,=

+  IN EFI_= TEST_LEVEL          TestLevel,=

+  IN EFI_= HANDLE           &nb= sp;  SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+   /= /

+  //Call = check points

+  //=

+  BBTestC= allBackConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );

+  BBTestC= allBackConformanceTestCheckpoint2( StandardLib, HIIConfigAccess );

+  BBTestC= allBackConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );

+  BBTestC= allBackConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );

+  return = EFI_SUCCESS;

+}

+*/<= /span>

+

+//<= /span>

+//Check Points=

+//<= /span>

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Resul= ts =3D NULL;

+  EFI_STR= ING            Resul= tsPtr =3D NULL;

+  UINTN&n= bsp;            = ;    Len =3D 0;

+  CHAR16*=             &nb= sp;  Pointer =3D NULL;

+  UINT8&n= bsp;            = ;    IfMulti =3D 0;

+  EFI_STR= ING            Reque= st =3D NULL;

+  //=

+  // Call= ExtractConfig with Request been <MultiConfigRequest>

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  NULL,

+  &n= bsp;            = ;             &= nbsp; &Progress,

+  &n= bsp;            = ;            &n= bsp;  &Results

+  &n= bsp;            = ;            &n= bsp;  );

+

+  if ( St= atus =3D=3D EFI_SUCCESS ) {

+  &n= bsp; Len =3D SctStrLen (Results);

+  &n= bsp; //

+  &n= bsp; // Make sure the size of Request is enough to hold <MultiConfigRequ= est>

+  &n= bsp; // if original Results is not Multi

+  &n= bsp; //

+  &n= bsp; Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * Len + 2 + 2= 56);

+  &n= bsp; if (Request =3D=3D NULL) {

+   &= nbsp;            Sct= FreePool (Results);

+   &= nbsp;  return EFI_OUT_OF_RESOURCES;

+  &n= bsp; }

+  } else = {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D MultiAltRespToMultiReq (Results, Request);

+  Results= Ptr =3D Request;

+

+  SctFree= Pool (Results);

+  Results= =3D NULL;

+

+  if ( Sc= tStrStr (Request, L"GUID=3D") !=3D NULL ) {

+  &n= bsp; Pointer =3D SctStrStr (Request, L"GUID=3D");

+  &n= bsp; Pointer++;

+  &n= bsp; if ( SctStrStr (Pointer, L"GUID=3D") !=3D NULL )<= /span>

+  &n= bsp;             IfM= ulti =3D 1;

+  }<= /o:p>

+  if ( If= Multi =3D=3D 0 ) {

+  &n= bsp; SctStrCat ( Request, L"&GUID=3D970eb94aa0d449f7b980bdaa47d425= 27&NAME=3D006a0069006e0039&PATH=3D000acf&grag&star");<= o:p>

+  }<= /o:p>

+

+  Status = =3D HIIConfigAccess->ExtractConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  Request,

+   &= nbsp;           &nbs= p;            &= nbsp; &Progress,

+  &n= bsp;            = ;            &n= bsp;  &Results

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( (E= FI_INVALID_PARAMETER !=3D Status) || (SctStrnCmp (Progress, L"&GUI= D=3D", 6) !=3D 0) ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestConformanceAssertionGuid001,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() r= eturns EFI_INVALID_PARAMETER with Request been <MultiConfigRequest>.&= quot;,

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;        );

+  SctFree= Pool (Request);

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Reque= st =3D NULL;

+  EFI_STR= ING            Resul= ts =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+  EFI_STR= ING            Devic= ePath =3D NULL;

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            = ;            &n= bsp;   HIIConfigRouting,

+   &= nbsp;           &nbs= p;            &= nbsp;  &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Request= =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) = + 2 );

+  if (Req= uest =3D=3D NULL) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           return EFI= _OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);=

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           gtBS->F= reePool (Request);

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= ExtractConfig with Progress been NULL

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  Request,

+  &n= bsp;            &nbs= p;            &= nbsp; NULL,

+  &n= bsp;            = ;            &n= bsp;  &Results

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestConformanceAssertionGuid002,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() r= eturns EFI_INVALID_PARAMETER with Progress been NULL.",

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;        );

+

+  gtBS-&g= t;FreePool (MultiConfigAltResp);

+  gtBS-&g= t;FreePool (DevicePath);

+  gtBS-&g= t;FreePool (Request);

+

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Reque= st =3D NULL;

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+  EFI_STR= ING            Devic= ePath =3D NULL;

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            &nbs= p;            &= nbsp;  HIIConfigRouting,

+  &n= bsp;            = ;            &n= bsp;   &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Request= =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) = + 2 );

+  if (Req= uest =3D=3D NULL) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           return EFI= _OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);=

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           gtBS->F= reePool (Request);

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= ExtractConfig with Results been NULL

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;             &= nbsp; Request,

+  &n= bsp;            = ;            &n= bsp;  &Progress,

+  &n= bsp;            = ;            &n= bsp;  NULL

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestConformanceAssertionGuid003,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() r= eturns EFI_INVALID_PARAMETER with Results been NULL.",

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  gtBS-&g= t;FreePool (MultiConfigAltResp);

+  gtBS-&g= t;FreePool (DevicePath);

+  gtBS-&g= t;FreePool (Request);

+

+  return = EFI_SUCCESS;

+}

+

+

+EFI_STATUS

+BBTestExtractC= onfigConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Reque= st;

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Resul= ts =3D NULL;

+  //init = the Request

+  Request= =3D L"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a0069006e= 0039&PATH=3D000acf&Jack&Rons&Nash&Mary"; 

+  //=

+  // Call= ExtractConfig with unknown name

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  Request,

+  &n= bsp;            = ;            &n= bsp;  &Progress,

+  &n= bsp;            = ;            &n= bsp;  &Results

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( ((= EFI_INVALID_PARAMETER =3D=3D Status) && (SctStrnCmp (Progress, L&qu= ot;&Jack&Rons&Nash&Mary", 20) =3D=3D 0)) ||=

+  &n= bsp; ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D Request)) )= {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid004,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER/EFI_NOT= _FOUND with invalid input.",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+ }<= /span>

+

+

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;         Status;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;  AssertionType;

+  EFI_STR= ING            =             &nb= sp;         Progress =3D NULL;=

+

+  //=

+  // Call= RouteConfig with Configuration been NULL

+  //=

+  Status = =3D HIIConfigAccess->RouteConfig (

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   NULL,

+  &n= bsp;            = ;   &Progress

+  &n= bsp;            = ;   );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid005,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.RouteConfig - RouteConfig() returns EFI_INVALID_PARAMETER with Config= uration been NULL.",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+ }<= /span>

+

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL       *HIIConfigR= outing,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        *HIICo= nfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Confi= g =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+  EFI_STR= ING            Devic= ePath =3D NULL;

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            = ;            &n= bsp;   HIIConfigRouting,

+  &n= bsp;            = ;            &n= bsp;   &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Config = =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) &= #43; 2 );

+  if (Con= fig =3D=3D NULL) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           return EFI= _OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Config);

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           gtBS->F= reePool (Config);

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= RouteConfig with Progress been NULL

+  //=

+  Status = =3D HIIConfigAccess->RouteConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  Config,

+  &n= bsp;            = ;            &n= bsp;  NULL

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestConformanceAssertionGuid006,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() retur= ns EFI_INVALID_PARAMETER with Progress been NULL.",<= /p>

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  gtBS-&g= t;FreePool (MultiConfigAltResp);

+  gtBS-&g= t;FreePool (DevicePath);

+  gtBS-&g= t;FreePool (Config);

+

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+BBTestRouteCon= figConformanceTestCheckpoint3 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;         Status;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;  AssertionType;

+  

+  EFI_STR= ING            =             &nb= sp;         Configuration;

+  EFI_STR= ING            =             &nb= sp;         Progress =3D NULL;=

+  //init = the Configuration

+  Configu= ration=3DL"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a0069= 006e0039&PATH=3D0acf&OFFSET=3D2&WIDTH=3D3VALUE=3D45AF";

+  //=

+  // Call= RouteConfig with no found target for the routing data

+  //=

+  Status = =3D HIIConfigAccess->RouteConfig (

+  &n= bsp;            = ;            &n= bsp;  HIIConfigAccess,

+  &n= bsp;            = ;            &n= bsp;  Configuration,

+  &n= bsp;            &nbs= p;            &= nbsp; &Progress

+  &n= bsp;            = ;            &n= bsp;  );

+  if ( EF= I_NOT_FOUND !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid007,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.RouteConfig - RouteConfig() returns EFI_NOT_FOUND with no found targe= t for the routing data.",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+

+  return = EFI_SUCCESS;

+}

+

+/*<= /span>

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_QUE= STION_ID           &= nbsp;           &nbs= p;        QuestionId;<= /p>

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    Type;

+  EFI_IFR= _TYPE_VALUE          &nbs= p;            &= nbsp;     Value;

+  EFI_BRO= WSER_ACTION_REQUEST         &n= bsp;           ActionRequ= est;

+  //init = the parameter

+  Questio= nId=3D0x1234;

+  Type=3D= EFI_IFR_TYPE_NUM_SIZE_8;

+

+

+  //=

+  // Call= CallBack with the Action been NULL

+  //=

+  Status = =3D HIIConfigAccess->CallBack (

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   NULL,

+  &n= bsp;            &nbs= p;  QuestionId,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           Type,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &Value,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &ActionRequ= est

+  &n= bsp;            = ;   );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+

+  &n= bsp;           //check th= e output ActionRequest

+  if ((EF= I_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BR= OWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Action= Request)

+  &n= bsp;           AssertionT= ype =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;          

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid009,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Action been = NULL .",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+}

+

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_BRO= WSER_ACTION          &nbs= p;            &= nbsp;     *Action;

+  EFI_QUE= STION_ID           &= nbsp;           &nbs= p;        QuestionId;<= /p>

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    Type;

+  EFI_IFR= _TYPE_VALUE          &nbs= p;            &= nbsp;     Value;

+

+  //init = the parameter

+  Action= =3DEFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questio= nId=3D0x1234;

+  Type=3D= EFI_IFR_TYPE_NUM_SIZE_8;

+

+

+  //=

+  // Call= CallBack with the ActionRequest been NULL

+  //=

+  Status = =3D HIIConfigAccess->CallBack (

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   Action,

+  &n= bsp;            = ;   QuestionId,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           Type,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &Value,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           NULL=

+  &n= bsp;            = ;   );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp;          

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid0010,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with QuestionId b= een NULL.",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+}

+

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint3(

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL         =     *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_BRO= WSER_ACTION          &nbs= p;            &= nbsp;     *Action;

+  EFI_QUE= STION_ID           &= nbsp;            &nb= sp;       QuestionId;<= /p>

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    Type;

+  EFI_BRO= WSER_ACTION_REQUEST         &n= bsp;           ActionRequ= est;

+  //init = the parameter

+  Action = =3D EFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questio= nId =3D 0x1234;

+  Type = =3D EFI_IFR_TYPE_NUM_SIZE_8;

+

+

+  //=

+  // Call= CallBack with the Value been NULL

+  //=

+  Status = =3D HIIConfigAccess->CallBack (

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   Action,

+  &n= bsp;            = ;   QuestionId,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           Type,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           NULL,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &ActionRequ= est

+  &n= bsp;            = ;   );

+  if ( EF= I_INVALID_PARAMETER !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp;          

+  &n= bsp;           //check th= e output ActionRequest

+  if ((EF= I_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BR= OWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Action= Request)

+  &n= bsp;           AssertionT= ype =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;          

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid0011,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Value been N= ULL.",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+}

+

+EFI_STATUS

+BBTestCallBack= ConformanceTestCheckpoint4 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_BRO= WSER_ACTION          &nbs= p;            &= nbsp;     *Action;

+  EFI_QUE= STION_ID           &= nbsp;           &nbs= p;        QuestionId;<= /p>

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    Type;

+  EFI_IFR= _TYPE_VALUE          &nbs= p;            &= nbsp;     Value;

+  EFI_BRO= WSER_ACTION_REQUEST         &n= bsp;           ActionRequ= est;

+  //init = the parameter

+  Action= =3D&EFI_BROWSER_ACTION_UNSUPPORTED;

+  Questio= nId=3D0x1234;

+  Type=3D= EFI_IFR_TYPE_NUM_SIZE_8;

+

+  //=

+  // Call= CallBack with  the specified action not supported by the callback

+  //=

+  Status = =3D HIIConfigAccess->CallBack (

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   Action,

+  &n= bsp;            = ;   QuestionId,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           Type,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &Value,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;           &ActionRequ= est

+  &n= bsp;            = ;   );

+  if ( EF= I_UNSUPPORTED !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp;          

+  &n= bsp;           //check th= e output ActionRequest

+  if ((EF= I_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BR= OWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Action= Request)

+  &n= bsp;           AssertionT= ype =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;          

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestConfor= manceAssertionGuid0012,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.CallBack - CallBack() returns EFI_ UNSUPPORTED with  the specifi= ed action not supported by the callback .",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+ return EFI_SU= CCESS;

+}

+*/<= /span>

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfig= AccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConf= igAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c

new file mode 10064= 4

index 00000000..14c= c5684

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIC= onfigAccessBBTestFunction.c

@@ -0,0 +1,606 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+  &n= bsp; HIIConfigAccessBBTestFunction.c

+

+Abstract:=

+  &n= bsp; for EFI Driver HII Configuration Access Protocol's function Test<= /o:p>

+

+--*/

+

+#include "= ;HIIConfigAccessBBTestMain.h"

+

+

+EFI_STATUS

+BBTestExtractC= onfigFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+

+EFI_STATUS

+BBTestExtractC= onfigFunctionTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+

+EFI_STATUS

+BBTestRouteCon= figFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+/*<= /span>

+EFI_STATUS

+BBTestCallBack= FunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  );=

+*/<= /span>

+

+//<= /span>

+//Test Cases

+//<= /span>

+/*<= /span>

+EFI_STATUS

+BBTestUnitTest= (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           &nbs= p; TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  EFI_STR= ING            =             &nb= sp;   DevicePath =3D NULL;

+  EFI_STR= ING    Request =3D NULL;

+  EFI_STR= ING    Resp =3D NULL;

+  EFI_STR= ING    MultiConfigAltResp =3D L"GUID=3D970eb94aa0d449f7= b980bdaa47d42527&NAME=3Dft894&PATH=3D000acf&OFFSET=3D3&WIDT= H=3D4&VALUE=3Daabbccdd&OFFSET=3D1&WIDTH=3D2&VALUE=3Deeff&am= p;GUID=3D970eb94aa0d449f7b980bdaa47d42527&NAME=3Dft894&PATH=3D000ac= f&ALTCFG=3D0037&A000=3Dabcd&B000=3Defef&GUID=3D970eb94aa0d4= 49f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b2= 66538c38af48ce000000007fff0400&A000=3Dabcd&B000=3Defef&GUID=3D9= 70eb94aa0d449f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0= fa0879341b266538c38af48ce000000007fff0400&ALTCFG=3D0037&OFFSET=3D3&= amp;WIDTH=3D4&VALUE=3Daabbccdd&OFFSET=3D1&WIDTH=3D2&VALUE= =3Deeff";;

+

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  Request= =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) &= #43; 2);

+  if (Req= uest =3D=3D NULL)

+   &= nbsp;          return EFI_OUT_= OF_RESOURCES;

+

+  Resp = =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) &#= 43; 2);

+  if (Res= p =3D=3D NULL) {

+   &= nbsp;          gtBS->FreePo= ol (Request);

+   &= nbsp;          return EFI_OUT_= OF_RESOURCES;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; gtBS->FreePool (Resp); 

+   &= nbsp;          gtBS->FreePo= ol (Request);

+  &n= bsp; return Status;

+  }<= /o:p>

+  Status = =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);=

+

+  Status = =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);=

+

+  gtBS-&g= t;FreePool (Request);

+  gtBS-&g= t;FreePool (Resp);

+  gtBS-&g= t;FreePool (DevicePath);

+

+  return = EFI_SUCCESS;

+}

+*/<= /span>

+

+EFI_STATUS

+BBTestExtractC= onfigFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  EFI_HII= _CONFIG_ROUTING_PROTOCOL       *HIIConfigRout= ing;

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  // Get = the Config Routing Protocol Interface

+  //=

+  Status = =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  //=

+  //Call = check points

+  //=

+  BBTestE= xtractConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIIConf= igAccess );

+  BBTestE= xtractConfigFunctionTestCheckpoint2( StandardLib, HIIConfigRouting, HIIConf= igAccess );

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+BBTestRouteCon= figFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  EFI_HII= _CONFIG_ROUTING_PROTOCOL       *HIIConfigRout= ing;

+

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Get = the Config Routing Protocol Interface

+  //=

+  Status = =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  //Call = check points

+  //=

+  BBTestR= outeConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIIConfig= Access );

+  return = EFI_SUCCESS;

+}

+

+/*<= /span>

+EFI_STATUS

+BBTestCallBack= FunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  )<= /o:p>

+{

+  EFI_STA= NDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL        *HIIConfi= gAccess;

+  //=

+  // init=

+  //=

+  HIIConf= igAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;

+

+  //=

+  // Get = the Standard Library Interface

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    SupportHandle,

+  &n= bsp;            = ;    &gEfiStandardTestLibraryGuid,

+  &n= bsp;            = ;    (VOID **) &StandardLib

+  &n= bsp;            = ;    );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  //Call = check points

+  //=

+  BBTestC= allBackFunctionTestCheckpoint1( StandardLib, HIIConfigAccess );<= /span>

+  return = EFI_SUCCESS;

+}

+*/<= /span>

+

+//<= /span>

+//Check Points=

+//<= /span>

+EFI_STATUS

+BBTestExtractC= onfigFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Reque= st =3D NULL;

+  EFI_STR= ING            Confi= gHdr =3D NULL;

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Resul= ts =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+  EFI_STR= ING            Devic= ePath =3D NULL;

+

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            = ;            &n= bsp;   HIIConfigRouting,

+  &n= bsp;            = ;            &n= bsp;   &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Request= =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) = + 2 );

+  if (Req= uest =3D=3D NULL) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp; gtBS->FreePool (DevicePath);

+  &n= bsp; return EFI_OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);=

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp; gtBS->FreePool (DevicePath);

+  &n= bsp; gtBS->FreePool (Request);

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= ExtractConfig with valid parameters

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig(

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   Request,

+  &n= bsp;            = ;   &Progress,

+  &n= bsp;            = ;   &Results

+  &n= bsp;            = ;   );

+

+  if ( (E= FI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctStr= Len (Request))) ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; if (Results =3D=3D NULL) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; } else {

+  &n= bsp;   gtBS->FreePool (Results);

+  &n= bsp; }

+  } else = if (EFI_OUT_OF_RESOURCES =3D=3D Status) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING; 

+  }else {=

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestFunctionAssertionGuid001,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() re= turns EFI_SUCCESS and vaild Results with valid parameters .",

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+   &= nbsp;           &nbs= p; __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  //=

+  // Chan= ge the Request to ConfigHdr

+  //=

+  ConfigH= dr =3D Request;

+  while (= *Request) {

+  &n= bsp; if (*Request =3D=3D L'&') {

+  &n= bsp;   if (SctStrnCmp (Request, L"&NAME=3D", 6) =3D= =3D 0) {

+  &n= bsp;     Request =3D Request + 6;=

+  &n= bsp;   } else if (SctStrnCmp (Request, L"&PATH=3D",= 6) =3D=3D 0) {

+  &n= bsp;     Request =3D Request + 6;

+  &n= bsp;   } else {

+  &n= bsp;     *Request =3D 0;

+  &n= bsp;   }

+  &n= bsp; } else {

+  &n= bsp;   Request++;

+  &n= bsp; }

+  } =

+  Request= =3D ConfigHdr;

+  //=

+  // Call= ExtractConfig when Request is ConfigHdr

+  //=

+  Progres= s =3D NULL;

+  Results= =3D NULL;

+  Status = =3D HIIConfigAccess->ExtractConfig(

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   Request,

+  &n= bsp;            &nbs= p;  &Progress,

+  &n= bsp;            = ;   &Results

+  &n= bsp;            = ;   );

+

+  if ( (E= FI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctStr= Len (Request))) ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; if (Results =3D=3D NULL) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; } else {

+  &n= bsp;   if (NULL =3D=3D SctStrStr (Results, Request)) {=

+  &n= bsp;     AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;   }

+  &n= bsp;   gtBS->FreePool (Results);

+  &n= bsp; }

+  } else = if (EFI_OUT_OF_RESOURCES =3D=3D Status) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING; 

+  }else {=

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestFunctionAssertionGuid002,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() re= turns EFI_SUCCESS and vaild Results with valid parameters .",

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+

+  gtBS-&g= t;FreePool (MultiConfigAltResp);

+  gtBS-&g= t;FreePool (DevicePath);

+  gtBS-&g= t;FreePool (Request);

+

+  return = EFI_SUCCESS;

+} <= /span>

+

+

+EFI_STATUS

+BBTestExtractC= onfigFunctionTestCheckpoint2 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+

+  EFI_STR= ING            Reque= st =3D NULL;

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Resul= ts =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            = ;            &n= bsp;   HIIConfigRouting,

+  &n= bsp;            = ;            &n= bsp;   &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= ExtractConfig with valid parameters

+  //=

+  Status = =3D HIIConfigAccess->ExtractConfig(

+  &n= bsp;            = ;   HIIConfigAccess,

+  &n= bsp;            = ;   NULL,

+  &n= bsp;            = ;   &Progress,

+  &n= bsp;            = ;   &Results

+  &n= bsp;            = ;   );

+

+  if (EFI= _OUT_OF_RESOURCES =3D=3D Status) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  } else = if ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D NULL) &&a= mp; (Results =3D=3D NULL)) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else = if ( EFI_SUCCESS !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; if (Results !=3D NULL) {

+  &n= bsp;   gtBS->FreePool (Results);

+  &n= bsp; }

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp; if (Results =3D=3D NULL) {

+  &n= bsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp; }

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;            = ;  StandardLib,

+  &n= bsp;            = ;  AssertionType,

+  &n= bsp;            = ;  gHIIConfigAccessBBTestFunctionAssertionGuid003,

+  &n= bsp;            = ;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() re= turns EFI_SUCCESS or EFI_NOT_FOUND with Request been NULL .",

+  &n= bsp;            = ;  L"%a:%d: Status - %r",

+  &n= bsp;            = ;  __FILE__,

+  &n= bsp;            = ;  (UINTN)__LINE__,

+  &n= bsp;            = ;  Status

+  &n= bsp;            = ;  );

+   <= o:p>

+

+  if ( NU= LL !=3D MultiConfigAltResp ){

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  }<= /o:p>

+

+  if ( NU= LL !=3DResults ) {

+  &n= bsp; gtBS->FreePool (Results);

+  }<= /o:p>

+

+  if (NUL= L !=3D Request) {

+  &n= bsp; gtBS->FreePool (Request); 

+  }<= /o:p>

+  return = EFI_SUCCESS;

+} <= /span>

+

+

+EFI_STATUS

+BBTestRouteCon= figFunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ROUTING_PROTOCOL        =     *HIIConfigRouting,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            Statu= s;

+  EFI_TES= T_ASSERTION    AssertionType;

+  EFI_STR= ING            Resp = =3D NULL;

+  EFI_STR= ING            Progr= ess =3D NULL;

+  EFI_STR= ING            Multi= ConfigAltResp =3D NULL;

+  EFI_STR= ING            Devic= ePath =3D NULL;

+  //init = the Request

+  Status = =3D HIIConfigRouting->ExportConfig(

+  &n= bsp;            = ;            &n= bsp;   HIIConfigRouting,

+  &n= bsp;            = ;            &n= bsp;   &MultiConfigAltResp

+  &n= bsp;            = ;            &n= bsp;   );

+  if (EFI= _ERROR(Status)) {

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Status = =3D GetDevicePath ( HIIConfigAccess, &DevicePath );

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp; return Status;

+  }<= /o:p>

+

+  Resp = =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) &= #43; 2 );

+  if (Res= p =3D=3D NULL) {

+  &n= bsp; gtBS->FreePool (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           return EFI= _OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);=

+  if (EFI= _ERROR(Status)) {

+   &= nbsp;          gtBS->FreePo= ol (MultiConfigAltResp);

+  &n= bsp;           gtBS->F= reePool (DevicePath);

+  &n= bsp;           gtBS->F= reePool (Resp);

+  &n= bsp; return Status;

+  }<= /o:p>

+  //=

+  // Call= RouteConfig with valid parameters

+  //=

+  Status = =3D HIIConfigAccess->RouteConfig(

+  &n= bsp;            = ;  HIIConfigAccess,

+  &n= bsp;            = ;  Resp,

+  &n= bsp;            = ;  &Progress

+  &n= bsp;            = ;  );

+  if ( (E= FI_SUCCESS =3D=3D Status) && (Progress =3D=3D Resp + SctStrLen = (Resp)) ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else = if ( EFI_OUT_OF_RESOURCES =3D=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }<= /o:p>

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestFuncti= onAssertionGuid003,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.RouteConfig- RouteConfig() returns EFI_SUCCESS with valid parameters = .",

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+  gtBS-&g= t;FreePool (MultiConfigAltResp);

+  gtBS-&g= t;FreePool (DevicePath);

+  gtBS-&g= t;FreePool (Resp);

+

+  return = EFI_SUCCESS;

+} <= /span>

+

+/*<= /span>

+EFI_STATUS

+BBTestCallBack= FunctionTestCheckpoint1 (

+  IN EFI_= STANDARD_TEST_LIBRARY_PROTOCOL       &nb= sp; *StandardLib,

+  IN EFI_= HII_CONFIG_ACCESS_PROTOCOL        &= nbsp;    *HIIConfigAccess

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             &nb= sp;            Statu= s;

+  EFI_TES= T_ASSERTION          &nbs= p;            &= nbsp;     AssertionType;

+  EFI_BRO= WSER_ACTION          &nbs= p;            &= nbsp;     *Action;

+  EFI_QUE= STION_ID           &= nbsp;           &nbs= p;        QuestionId;<= /p>

+  UINT8&n= bsp;            = ;            &n= bsp;            = ;    Type;

+  EFI_IFR= _TYPE_VALUE          &nbs= p;            &= nbsp;     Value;

+  EFI_BRO= WSER_ACTION_REQUEST         &n= bsp;           ActionRequ= est;

+  //init = the paremeters

+  Action= =3DEFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questio= nId=3D0x1234;

+  Type=3D= EFI_IFR_TYPE_NUM_SIZE_8;

+  //=

+  // Call= CallBack  with valid parameters

+  //=

+  Status = =3D HIIConfigAccess->CallBack(

+  &n= bsp;            = ;  HIIConfigAccess,

+  &n= bsp;            = ;  Action,

+  &n= bsp;            = ;  QuestionId,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;         Type,

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;         &Value,=

+  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;         &ActionRequest

+  &n= bsp;            = ;  );

+  if ( EF= I_SUCCESS !=3D Status ) {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else = {

+  &n= bsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &n= bsp;          

+  &n= bsp;           //check th= e output ActionRequest

+  if ((EF= I_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BR= OWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Action= Request)

+  &n= bsp;           AssertionT= ype =3D EFI_TEST_ASSERTION_FAILED;

+  &n= bsp;

+  }<= /o:p>

+

+  Standar= dLib->RecordAssertion (

+  &n= bsp;        StandardLib,

+  &n= bsp;        AssertionType,

+  &n= bsp;        gHIIConfigAccessBBTestFuncti= onAssertionGuid003,

+  &n= bsp;        L"HII_CONFIG_ACCESS_PRO= TOCOL.CallBack- CallBack() returns EFI_SUCCESS with valid parameters ."= ;,

+  &n= bsp;        L"%a:%d: Status - %r&qu= ot;,

+  &n= bsp;        __FILE__,<= /p>

+  &n= bsp;        (UINTN)__LINE__,<= /span>

+  &n= bsp;        Status

+  &n= bsp;        );

+  return = EFI_SUCCESS;

+} <= /span>

+*/<= /span>

+

+

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfig= AccessBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAc= cess/BlackBoxTest/HIIConfigAccessBBTestMain.c

new file mode 10064= 4

index 00000000..29c= 793e2

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIC= onfigAccessBBTestMain.c

@@ -0,0 +1,655 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+

+  HIIConf= igAccessBBTestMain.c

+

+Abstract:=

+

+  Test Dr= iver of HII Configuration Access Protocol

+

+--*/

+

+#include "= ;HIIConfigAccessBBTestMain.h"

+

+//<= /span>

+// Global vari= ables

+//<= /span>

+EFI_HANDLE mIm= ageHandle;

+

+EFI_BB_TEST_PR= OTOCOL *gBBTestProtocolInterface;

+

+EFI_BB_TEST_PR= OTOCOL_FIELD gBBTestProtocolField =3D {

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL_TEST_REVISION,

+  IHV_EFI= _HII_CONFIG_ACCESS_PROTOCOL_GUID,

+  L"= HII Configuration Access Protocol Test",

+  L"= UEFI HII Configuration Access  Protocol Black-Box Test"

+};<= /span>

+

+EFI_GUID gSupp= ortProtocolGuid[] =3D {

+  EFI_STA= NDARD_TEST_LIBRARY_GUID,

+  EFI_NUL= L_GUID

+};<= /span>

+

+EFI_BB_TEST_EN= TRY_FIELD gBBTestEntryField[] =3D {

+  /*=

+  //Use f= or unit test only

+  {<= /o:p>

+  &n= bsp; { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0x= b0, 0x6d } },

+  &n= bsp;           L"Uni= t Test Only",

+  &n= bsp;           L"Ver= ify the Assistant Function",

+  &n= bsp; EFI_TEST_LEVEL_DEFAULT,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestUnitTest

+  },=

+  */=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101,<= /p>

+  &n= bsp; L"ExtractConfigFunction",

+  &n= bsp; L"Function auto test for HII Configuration Access Protocol Extrac= tConfig().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestExtractConfigFunctionTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102,<= /p>

+  &n= bsp; L"RouteConfigFunction",

+  &n= bsp; L"Function auto test for HII Configuration Access Protocol RouteC= onfig().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestRouteConfigFunctionTest

+  },=

+  /*=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0103,<= /p>

+  &n= bsp; L"CallBackFunction",

+  &n= bsp; L"Function auto test for HII Configuration Access Protocol CallBa= ck().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestCallBackFunctionTest

+  },=

+  */=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201,<= /p>

+  &n= bsp; L"ExtractConfigConformance",

+  &n= bsp; L"Conformance auto test for HII Configuration Access Protocol Ext= ractConfig().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestExtractConfigConformanceTest

+  },=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202,<= /p>

+  &n= bsp; L"RouteConfigConformance",

+  &n= bsp; L"Conformance auto test for HII Configuration Access Protocol Rou= teConfig().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestRouteConfigConformanceTest

+  },=

+  /*=

+  {<= /o:p>

+  &n= bsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0203,<= /p>

+  &n= bsp; L"CallBackConformance",

+  &n= bsp; L"Conformance auto test for HII Configuration Access Protocol Cal= lBack().",

+  &n= bsp; EFI_TEST_LEVEL_MINIMAL,

+  &n= bsp; gSupportProtocolGuid,

+  &n= bsp; EFI_TEST_CASE_AUTO,

+  &n= bsp; BBTestCallBackConformanceTest

+  },=

+  */=

+  0<= /o:p>

+};<= /span>

+

+

+

+

+EFI_STATUS

+InitializeHIIC= onfigAccessBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle,

+  IN EFI_= SYSTEM_TABLE          &nb= sp;  *SystemTable

+  )<= /o:p>

+{

+  EfiInit= ializeTestLib (ImageHandle, SystemTable);

+

+  //=

+  // init= ialize test utility lib

+  //=

+

+  SctInit= ializeLib (ImageHandle, SystemTable);

+

+  mImageH= andle =3D ImageHandle;

+

+  return = EfiInitAndInstallIHVBBTestInterface (

+  &n= bsp;        &ImageHandle,=

+  &n= bsp;        &gBBTestProtocolField,

+  &n= bsp;        gBBTestEntryField,

+  &n= bsp;        UnloadHIIConfigAccessBBTest,=

+  &n= bsp;        &gBBTestProtocolInterfac= e

+  &n= bsp;        );

+}

+

+

+EFI_STATUS

+UnloadHIIConfi= gAccessBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle

+  )<= /o:p>

+{

+  return = EfiUninstallAndFreeIHVBBTestInterface (

+  &n= bsp;        ImageHandle,

+  &n= bsp;        gBBTestProtocolInterface

+  &n= bsp;        );

+}

+

+

+// Assistance = Function

+UINTN

+EfiDevicePathS= ize (

+  IN EFI_= DEVICE_PATH_PROTOCOL  *DevicePath

+  )<= /o:p>

+/*++

+

+Routine Descri= ption:

+

+  Calcula= te the space size of a device path.

+

+Arguments:

+

+  DeviceP= ath  - A specified device path

+

+Returns:<= /o:p>

+

+  The siz= e.

+

+--*/

+{

+  EFI_DEV= ICE_PATH_PROTOCOL  *Start;

+

+  if (Dev= icePath =3D=3D NULL) {

+  &n= bsp; return 0;

+  }<= /o:p>

+

+  //=

+  // Sear= ch for the end of the device path structure

+  //=

+  Start = =3D DevicePath;

+  while (= !SctIsDevicePathEnd (DevicePath)) {

+  &n= bsp; DevicePath =3D SctNextDevicePathNode (DevicePath);

+  }<= /o:p>

+

+  //=

+  // Comp= ute the size and add back in the size of the end device path structure=

+  //=

+  return = ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL= );

+}

+

+

+STATIC

+CHAR16

+NibbleToHexCha= rPrivate (

+  IN UINT= 8            &n= bsp;            Nibb= le

+  )<= /o:p>

+/*++

+

+  Routine= Description:

+  &n= bsp; Converts the low nibble of a byte to hex unicode character.=

+

+  Argumen= ts:

+  &n= bsp; Nibble - lower nibble of a byte.

+

+  Returns= :

+  &n= bsp; Hex unicode character between L'0' to L'f'.

+

+--*/

+{

+  Nibble = &=3D 0x0F;

+

+  if (Nib= ble <=3D 0x9) {

+  &n= bsp; return (CHAR16)(Nibble + L'0');

+  }<= /o:p>

+

+  return = (CHAR16)(Nibble - 0xA + L'a');

+}

+

+

+STATIC

+EFI_STATUS

+BufToHexString= Private (

+  IN OUT = CHAR16           &nb= sp;        *Str,

+  IN OUT = UINTN           &nbs= p;         *HexStringBufferLength,<= o:p>

+  IN = ;    UINT8        &n= bsp;            *Buf= ,

+  IN = ;    UINTN         &= nbsp;           Len,=

+  IN = ;    BOOLEAN        =            Flag

+  )<= /o:p>

+/*++

+

+  Routine= Description:

+  &n= bsp; Converts binary buffer to Unicode string.

+  &n= bsp; At a minimum, any blob of data could be represented as a hex string.

+

+  Argumen= ts:

+  &n= bsp; Str           &= nbsp;       - Pointer to the string.

+  &n= bsp; HexStringBufferLength - Length in bytes of buffer to hold the hex stri= ng. Includes tailing '\0' character.

+  &n= bsp;            = ;             I= f routine return with EFI_SUCCESS, containing length of hex string buffer.<= o:p>

+  &n= bsp;            = ;             I= f routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string b= uffer desired.

+  &n= bsp; Buf           &= nbsp;       - Buffer to be converted from.

+  &n= bsp; Len           &= nbsp;       - Length in bytes of the buffer t= o be converted.

+  &n= bsp; Flag           =        - If TRUE, encode the data in the same= order as the it

+  &n= bsp;            = ;             r= esides in the Buf. Else encode it in the reverse direction.

+

+  Returns= :

+  &n= bsp; EFI_SUCCESS          = ; - Routine  success.

+  &n= bsp; EFI_BUFFER_TOO_SMALL  - The hex string buffer is too small.<= /o:p>

+

+--*/

+{

+  UINTN&n= bsp;      Idx;

+  UINT8&n= bsp;      Byte;

+  UINTN&n= bsp;      StrLen;

+

+  //=

+  // Make= sure string is either passed or allocate enough.

+  // It t= akes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffe= r.

+  // Plus= the Unicode termination character.

+  //=

+  StrLen = =3D Len * 2;

+  if ((*H= exStringBufferLength) < (StrLen + 1) * sizeof (CHAR16)) {=

+  &n= bsp; *HexStringBufferLength =3D (StrLen + 1) * sizeof (CHAR16);

+  &n= bsp; return EFI_BUFFER_TOO_SMALL;

+  }<= /o:p>

+

+  *HexStr= ingBufferLength =3D (StrLen + 1) * sizeof (CHAR16);

+  //=

+  // Ends= the string.

+  //=

+  Str[Str= Len] =3D 0;

+

+  for (Id= x =3D 0; Idx < Len; Idx++) {

+

+  &n= bsp; Byte =3D Buf[Idx];

+  &n= bsp; if (Flag) {

+  &n= bsp;   Str[Idx * 2]     =3D NibbleToHexCharPr= ivate ((UINT8)(Byte >> 4));

+  &n= bsp;   Str[Idx * 2 + 1] =3D NibbleToHexCharPrivate (Byte);

+  &n= bsp; } else {

+  &n= bsp;   Str[StrLen - 1 - Idx * 2] =3D NibbleToHexCharPrivate (Byte= );

+  &n= bsp;   Str[StrLen - 2 - Idx * 2] =3D NibbleToHexCharPrivate ((UIN= T8)(Byte >> 4));

+  &n= bsp; }

+  }<= /o:p>

+

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+GetDevicePath = (

+  IN = ; EFI_HII_CONFIG_ACCESS_PROTOCOL    *ConfigAccess,

+  OUT EFI= _STRING           &n= bsp;            *Dev= icePathStr

+  )<= /o:p>

+{

+  EFI_STA= TUS            =             Status;<= o:p>

+  UINTN&n= bsp;            = ;            &n= bsp;   Index;

+  UINTN&n= bsp;            = ;            &n= bsp;   NoHandles;

+  EFI_HAN= DLE            =             *HandleB= uffer;

+  EFI_HAN= DLE            =             ConfigAc= cessHandle =3D NULL;

+  EFI_HII= _CONFIG_ACCESS_PROTOCOL    *TestedConfigAccess;

+  EFI_DEV= ICE_PATH_PROTOCOL          *De= vicePath;

+  UINTN&n= bsp;            = ;            &n= bsp;   Length;

+  UINTN&n= bsp;            = ;            &n= bsp;   PathHdrSize;

+

+  //=

+  // loca= te all Hii Configuration Access Protocol Instances

+  //=

+  Status = =3D gtBS->LocateHandleBuffer (

+  &n= bsp;            = ;    ByProtocol,

+  &n= bsp;            = ;    &gBlackBoxEfiHIIConfigAccessProtocolGuid,

+  &n= bsp;            = ;    NULL,

+  &n= bsp;            = ;    &NoHandles,

+  &n= bsp;            = ;    &HandleBuffer

+  &n= bsp;            &nbs= p;   );

+  if (EFI= _ERROR(Status) || (NoHandles =3D=3D 0)) {

+  &n= bsp; return EFI_NOT_FOUND;

+  }<= /o:p>

+

+  //=

+  // scan= for the handle that matched with the Hii Configuration Access Protocol tha= t

+  // pass= ed in by the test framework

+  //=

+  for (In= dex =3D 0; Index < NoHandles; Index++) {

+  &n= bsp; Status =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;      HandleBuffer[Index],

+  &n= bsp;            = ;      &gBlackBoxEfiHIIConfigAccessProtocolGui= d,

+  &n= bsp;            = ;      (VOID **) &TestedConfigAccess

+  &n= bsp;            &nbs= p;     );

+  &n= bsp; if (EFI_ERROR(Status)) {

+  &n= bsp;   continue;

+  &n= bsp; }

+

+  &n= bsp; if (TestedConfigAccess =3D=3D ConfigAccess) {

+  &n= bsp;   ConfigAccessHandle =3D HandleBuffer[Index];

+  &n= bsp;   break;

+  &n= bsp; }

+  }<= /o:p>

+

+  gtBS-&g= t;FreePool (HandleBuffer);

+

+  if (Con= figAccessHandle =3D=3D NULL) {

+  &n= bsp; return EFI_NOT_FOUND;

+  }<= /o:p>

+

+  //=

+  // find= controller handles managed by the component name handle.=

+  //=

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    ConfigAccessHandle,

+  &n= bsp;            = ;    &gBlackBoxEfiDevicePathProtocolGuid,

+  &n= bsp;            = ;    (void **)&DevicePath

+  &n= bsp;            = ;    );

+

+  //=

+  // Conv= ert the device path binary to hex UNICODE %02x bytes in the same order=

+  // as t= he device path resides in RAM memory.

+  //=

+  Length = =3D EfiDevicePathSize (DevicePath);

+  PathHdr= Size =3D (Length * 2 + 1) * sizeof (CHAR16);

+  *Device= PathStr =3D (EFI_STRING) SctAllocateZeroPool (PathHdrSize);

+  if (*De= vicePathStr =3D=3D NULL) {

+  &n= bsp; return EFI_OUT_OF_RESOURCES;

+  }<= /o:p>

+  Status = =3D BufToHexStringPrivate (*DevicePathStr, &PathHdrSize, (UINT8 *) Devi= cePath, Length, TRUE);

+

+  return = Status;

+}

+

+

+EFI_STATUS

+GetCorrespondi= ngRequest (

+  IN = ;    EFI_STRING    MultiConfigAltResp,

+  IN = ;    EFI_STRING    DevicePath,

+  IN OUT = EFI_STRING    Request

+  )<= /o:p>

+{

+  EFI_STR= ING    RespPtr;

+  EFI_STR= ING    ReqPtr;

+  EFI_STR= ING    SingleResp;

+  EFI_STR= ING    SingleRespPtr;

+  UINTN&n= bsp;        Len;

+  ReqPtr = =3D Request;

+  RespPtr= =3D MultiConfigAltResp;

+

+  Len =3D= SctStrLen (MultiConfigAltResp);

+  if (Sct= StrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) {<= /span>

+  &n= bsp; return EFI_INVALID_PARAMETER;

+  }<= /o:p>

+  if (Sct= StrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) {

+  &n= bsp; return EFI_NOT_FOUND;

+  }<= /o:p>

+

+  SingleR= esp =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltRes= p) + 2 );

+  if (Sin= gleResp =3D=3D NULL) {

+  &n= bsp;           return EFI= _OUT_OF_RESOURCES;

+  }<= /o:p>

+  SingleR= espPtr =3D SingleResp;

+

+  while (= *MultiConfigAltResp !=3D 0) {

+  &n= bsp; while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConfi= gAltResp, L"&GUID=3D", 6) !=3D 0)) {

+  &n= bsp;   *(SingleResp++) =3D *(MultiConfigAltResp++= );

+  &n= bsp; }

+  &n= bsp;           SingleResp= =3D SingleRespPtr;

+  &n= bsp;           if (SctStr= Str (SingleResp, DevicePath) !=3D NULL)

+  &n= bsp;   break;

+  &n= bsp;           SctZeroMem= (SingleRespPtr, 2 * Len + 2);

+  &n= bsp;           if (*Multi= ConfigAltResp !=3D 0)

+  &n= bsp;   MultiConfigAltResp++;

+  }<= /o:p>

+

+  if (Sct= StrStr (SingleResp, DevicePath) =3D=3D NULL)

+   &= nbsp;          return EFI_NOT_= FOUND;

+

+  if (Sct= StrStr (SingleResp, L"VALUE=3D") =3D=3D NULL){<= /p>

+  &n= bsp; while (*SingleResp !=3D 0) {

+  &n= bsp;   while ((*SingleResp !=3D 0) && (SctStrnCmp (Single= Resp, L"&PATH=3D", 6) !=3D 0)) {

+  &n= bsp;     *(Request++) =3D *(SingleResp++= ;);

+  &n= bsp;             }

+  &n= bsp;             *(R= equest++) =3D *(SingleResp++);

+  &n= bsp;             whi= le ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&')) {

+  &n= bsp;     *(Request++) =3D *(SingleResp++= ;);

+  &n= bsp;   }

+  &n= bsp;             whi= le (*SingleResp !=3D 0){

+  &n= bsp;     if (*SingleResp !=3D L'=3D') {

+  &n= bsp;       *(Request++) =3D *(SingleR= esp++);

+  &n= bsp;            = ;            &n= bsp;  } else {

+  &n= bsp;       while ((*SingleResp !=3D 0) &&= amp; (*SingleResp !=3D L'&')) {

+  &n= bsp;         SingleResp++;<= o:p>

+  &n= bsp;       }

+  &n= bsp;     }

+  &n= bsp;   }

+  &n= bsp; }

+  } else = {

+  &n= bsp; while (*SingleResp !=3D 0) {

+  &n= bsp;   while ((*SingleResp !=3D 0) && (SctStrnCmp (Single= Resp, L"&VALUE=3D", 7)) !=3D 0) {

+  &n= bsp;     *(Request++) =3D *(SingleResp++= ;);

+  &n= bsp;   }

+  &n= bsp;             Sin= gleResp++;

+  &n= bsp;             whi= le ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&'))=

+  &n= bsp;     SingleResp++;

+  &n= bsp; }

+

+  }<= /o:p>

+

+  *Reques= t =3D 0;

+

+  gtBS-&g= t;FreePool (SingleRespPtr);

+  return = EFI_SUCCESS;

+}

+

+

+EFI_STATUS

+GetCorrespondi= ngResp (

+  IN = ;    EFI_STRING    MultiConfigAltResp,

+  IN = ;    EFI_STRING    DevicePath,

+  IN OUT = EFI_STRING    Resp

+  )<= /o:p>

+{

+  EFI_STR= ING    RespPtr;

+  EFI_STR= ING    ReqPtr;

+  UINTN&n= bsp;        Len;

+  ReqPtr = =3D Resp;

+  RespPtr= =3D MultiConfigAltResp;

+

+  Len =3D= SctStrLen (MultiConfigAltResp);

+  if (Sct= StrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) {<= /span>

+  &n= bsp; return EFI_INVALID_PARAMETER;

+  }<= /o:p>

+  if (Sct= StrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) {

+  &n= bsp; return EFI_NOT_FOUND;

+  }<= /o:p>

+

+  while (= *MultiConfigAltResp !=3D 0) {

+  &n= bsp; while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConfi= gAltResp, L"&GUID=3D", 6) !=3D 0)) {

+  &n= bsp;   *(Resp++) =3D *(MultiConfigAltResp++);

+  &n= bsp; }

+  &n= bsp;           Resp =3D R= eqPtr;

+  &n= bsp;           if (SctStr= Str (Resp, DevicePath) !=3D NULL)

+  &n= bsp;   break;

+  &n= bsp;           SctZeroMem= (ReqPtr, 2 * Len + 2);

+  &n= bsp;           if (*Multi= ConfigAltResp !=3D 0)

+  &n= bsp;   MultiConfigAltResp++;

+  }<= /o:p>

+

+  if (Sct= StrStr (Resp, DevicePath) =3D=3D NULL)

+   &= nbsp;          return EFI_NOT_= FOUND;

+  return = EFI_SUCCESS;

+}

+

+

+

+EFI_STATUS

+GetHIIConfigRo= utingInterface (

+  OUT EFI= _HII_CONFIG_ROUTING_PROTOCOL    **HIIConfigRouting

+  )<= /o:p>

+{

+  UINTN&n= bsp;            = ;            &n= bsp;       NoHandles;

+  EFI_HAN= DLE            =             &nb= sp;   *HandleBuffer;

+  EFI_STA= TUS            =             &nb= sp;   Status;

+  //=

+  // Get = the HII Database Protocol interface

+  //=

+  Status = =3D gtBS->LocateHandleBuffer (

+  &n= bsp;            = ;    ByProtocol,

+  &n= bsp;            = ;    &gBlackBoxEfiHIIConfigRoutingProtocolGuid,

+  &n= bsp;            = ;    NULL,

+  &n= bsp;            = ;    &NoHandles,

+  &n= bsp;            = ;    &HandleBuffer

+  &n= bsp;            = ;    );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; return Status;

+  }<= /o:p>

+  if ( No= Handles <=3D 0 ) {

+  &n= bsp; return EFI_DEVICE_ERROR;

+  }<= /o:p>

+  Status = =3D gtBS->HandleProtocol (

+  &n= bsp;            = ;    HandleBuffer[0],

+  &n= bsp;            = ;    &gBlackBoxEfiHIIConfigRoutingProtocolGuid,

+  &n= bsp;            = ;    (VOID **) HIIConfigRouting

+  &n= bsp;            = ;    );

+  if ( EF= I_ERROR(Status) ) {

+  &n= bsp; gtBS->FreePool ( HandleBuffer );

+  &n= bsp; return Status;

+  }<= /o:p>

+  gtBS-&g= t;FreePool ( HandleBuffer );

+  return = EFI_SUCCESS;

+}

+

+EFI_STATUS

+MultiAltRespTo= MultiReq (

+  IN = ;      EFI_STRING     &nb= sp;            =          Resp,

+  IN OUT&= nbsp;  EFI_STRING         = ;            &n= bsp;     Req

+  )<= /o:p>

+{

+  EFI_STR= ING Pointer1 =3D Resp;     

+  EFI_STR= ING Pointer2 =3D NULL;

+  EFI_STR= ING Pointer3 =3D Req;

+  EFI_STR= ING CfgHdr =3D NULL;

+  EFI_STR= ING FreePtr =3D NULL;

+  CHAR8&n= bsp;     Flag =3D 0;

+

+  if (Sct= StrnCmp (Pointer1, L"GUID=3D", 5) !=3D 0) {   

+  &n= bsp; return EFI_INVALID_PARAMETER;

+  }<= /o:p>

+

+  Pointer= 2 =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (Resp) + 2);=

+  if (Poi= nter2 =3D=3D NULL) {

+  &n= bsp; return EFI_OUT_OF_RESOURCES;

+  }<= /o:p>

+  FreePtr= =3D Pointer2;

+  while (= *Pointer1) {

+  &n= bsp; if (SctStrnCmp (Pointer1, L"GUID=3D", 5) =3D=3D 0) {

+  &n= bsp;   CfgHdr =3D Pointer2;

+  &n= bsp;   *(Pointer2++) =3D *(Pointer1++);

+  &n= bsp;             whi= le (*Pointer1 !=3D L'&') {

+  &n= bsp;     *(Pointer2++) =3D *(Pointer1++= );

+  &n= bsp;   }

+  &n= bsp; }

+  &n= bsp;           if (SctStr= nCmp (Pointer1, L"&GUID=3D", 6) =3D=3D 0) {=

+  &n= bsp;   *(Pointer2++) =3D *(Pointer1++);

+  &n= bsp;   CfgHdr =3D Pointer2;

+  &n= bsp;             whi= le (*Pointer1 !=3D L'&') {

+  &n= bsp;     *(Pointer2++) =3D *(Pointer1++= );

+  &n= bsp;   }

+  &n= bsp;           }

+  &n= bsp;           if (SctStr= nCmp (Pointer1, L"&NAME=3D", 6) =3D=3D 0) {=

+  &n= bsp;   *(Pointer2++) =3D *(Pointer1++);

+  &n= bsp;             whi= le (*Pointer1 !=3D L'&') {

+  &n= bsp;     *(Pointer2++) =3D *(Pointer1++= );

+  &n= bsp;   }

+  &n= bsp;           }

+  &n= bsp;           if (SctStr= nCmp (Pointer1, L"&PATH=3D", 6) =3D=3D 0) {=

+  &n= bsp;   *(Pointer2++) =3D *(Pointer1++);

+  &n= bsp;             whi= le (*Pointer1 !=3D L'&') {

+  &n= bsp;     *(Pointer2++) =3D *(Pointer1++= );

+  &n= bsp;   }

+  &n= bsp;             if = (NULL =3D=3D SctStrStr (Req, CfgHdr)){

+  &n= bsp;            = ;            &n= bsp;  if (*Req =3D=3D L'G')

+  &n= bsp;       *(Pointer3++) =3D L'&'= ;

+  &n= bsp;     SctStrCat (Req, CfgHdr);

+  &n= bsp;     Pointer3 +=3D SctStrLen (CfgHdr);

+  &n= bsp;            = ;            &n= bsp;  Flag =3D 1;

+  &n= bsp;             } e= lse {

+  &n= bsp;     Flag =3D 0;

+  &n= bsp;             }&n= bsp;

+  &n= bsp; }

+  &n= bsp; while ((Flag =3D=3D 1) && (SctStrnCmp (Pointer1, L"&G= UID=3D", 6) !=3D 0) && *Pointer1) {

+  &n= bsp;   if (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8) = =3D=3D 0) {

+  &n= bsp;     *(Pointer3++) =3D *(Pointer1++= );

+  &n= bsp;           while (*Pointer= 1 !=3D L'&') {

+  &n= bsp;       *(Pointer3++) =3D *(Pointe= r1++);

+  &n= bsp;     }

+  &n= bsp;   }

+   &= nbsp;  if (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) = =3D=3D 0) {

+  &n= bsp;     *(Pointer3++) =3D *(Pointer1++= );

+  &n= bsp;            &nbs= p;  while (*Pointer1 !=3D L'&') {

+  &n= bsp;       *(Pointer3++) =3D *(Pointe= r1++);

+  &n= bsp;     }

+  &n= bsp;             }

+  &n= bsp;             if = (SctStrnCmp (Pointer1, L"&VALUE=3D", 7) =3D=3D 0) {

+  &n= bsp;     Pointer1 +=3D 7;

+  &n= bsp;            &nbs= p;  while (*Pointer1 !=3D L'&' && *Pointer1) {<= /span>

+  &n= bsp;            &nbs= p;    Pointer1++;

+  &n= bsp;            &nbs= p;  }

+  &n= bsp;             }

+  &n= bsp;             if = (SctStrnCmp (Pointer1, L"&ALTCFG=3D", 8) =3D=3D 0) {

+  &n= bsp;     Pointer1 +=3D 8;

+   &= nbsp;            &nb= sp; while (*Pointer1 !=3D L'&' && *Pointer1) {<= /span>

+  &n= bsp;            &nbs= p;    Pointer1++;

+  &n= bsp;            &nbs= p;  }

+  &n= bsp;             }

+  &n= bsp;             if = ((*Pointer1 =3D=3D L'&') && (SctStrnCmp (Pointer1, L"&= GUID=3D", 6) !=3D 0) &&

+  &n= bsp;            = ;            &n= bsp;    (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8) != =3D 0) && (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) != =3D 0)) {

+  &n= bsp;     *(Pointer3++) =3D *(Pointer1++= );

+  &n= bsp;            &nbs= p;  while (*Pointer1 !=3D L'=3D') {

+  &n= bsp;       *(Pointer3++) =3D *(Pointe= r1++);

+  &n= bsp;            &nbs= p;  }

+  &n= bsp;            &nbs= p;  while (*Pointer1 !=3D L'&' && *Pointer1) {<= /span>

+  &n= bsp;       Pointer1++;

+  &n= bsp;            &nbs= p;  }

+  &n= bsp;             }

+  &n= bsp;           }

+  &n= bsp;           Pointer1&#= 43;+;

+  }<= /o:p>

+

+  SctFree= Pool (FreePtr);

+  return = EFI_SUCCESS;

+}

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfig= AccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAc= cess/BlackBoxTest/HIIConfigAccessBBTestMain.h

new file mode 10064= 4

index 00000000..c81= a00ca

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIC= onfigAccessBBTestMain.h

@@ -0,0 +1,168 = @@

+/** @file=

+

+  Copyrig= ht 2006 - 2013 Unified EFI, Inc.<BR>

+  Copyrig= ht (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR><= /o:p>

+

+  This pr= ogram and the accompanying materials

+  are lic= ensed and made available under the terms and conditions of the BSD License<= o:p>

+  which a= ccompanies this distribution.  The full text of the license may be fou= nd at

+  http://= opensource.org/licenses/bsd-license.php

+

+  THE PRO= GRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+  WITHOUT= WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=

+

+**/=

+/*++

+

+Module Name:

+

+  HIIConf= igAccessBBTestMain.h

+

+Abstract:=

+

+  Test Dr= iver of HII Configuration Access Protocol header file

+

+--*/

+

+#ifndef _HII_C= ONFIG_ACCESS_BB_TEST_MAIN

+#define _HII_C= ONFIG_ACCESS_BB_TEST_MAIN

+

+#define __UEFI= _INTERNAL_FORMREPRESENTATION_H__

+#include <B= ase.h>

+#include "= ;SctLib.h"

+#include "= ;Guid.h"

+#include <L= ibrary/EfiTestLib.h>

+#include <U= EFI/Protocol/Hii.h>

+#include <U= EFI/Protocol/HIIConfigAccess.h>

+#include <U= EFI/Protocol/HIIConfigRouting.h>

+

+

+#define EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_REVISION    0x00010000

+#define IHV_EF= I_HII_CONFIG_ACCESS_PROTOCOL_GUID \

+{ 0x68820884, = 0x4be3, 0x4ca9, { 0x83, 0x81, 0x9e, 0x98, 0xf3, 0xf4, 0x8d, 0xaf } }

+//<= /span>

+// Entry GUIDs= for Func Test

+//<= /span>

+#define EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101 \

+{ 0x2a85387e, = 0xdcf9, 0x45e9, { 0xb3, 0x8f, 0x5d, 0xa1, 0x75, 0x41, 0xcf, 0x1a } }

+

+#define EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102 \

+{ 0x1a15df85, = 0x6cc1, 0x43f2, { 0x9b, 0x86, 0x21, 0x8b, 0xd5, 0xfd, 0xf4, 0xa0 } }

+

+

+//<= /span>

+// Entry GUIDs= for Conf Test

+//<= /span>

+#define EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201 \

+{ 0xe2c3b0fe, = 0xfbe9, 0x46a9, { 0xa3, 0x1b, 0xa3, 0xf3, 0x82, 0xd, 0xcf, 0x4 } }

+

+#define EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202 \

+{ 0x495c99f3, = 0x231, 0x45a5, { 0xaf, 0xfa, 0xd2, 0x5c, 0x6f, 0x9a, 0x19, 0x1c } }

+

+

+

+EFI_STATUS

+InitializeHIIC= onfigAccessBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle,

+  IN EFI_= SYSTEM_TABLE          &nb= sp;  *SystemTable

+  );=

+EFI_STATUS

+UnloadHIIConfi= gAccessBBTest (

+  IN EFI_= HANDLE           &nb= sp;       ImageHandle

+  );=

+//<= /span>

+//Test Cases

+//<= /span>

+/*<= /span>

+EFI_STATUS

+BBTestUnitTest= (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+*/<= /span>

+EFI_STATUS

+BBTestExtractC= onfigConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+EFI_STATUS

+BBTestRouteCon= figConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+/*  =

+EFI_STATUS

+BBTestCallBack= ConformanceTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+*/  =

+EFI_STATUS

+BBTestExtractC= onfigFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+EFI_STATUS

+BBTestRouteCon= figFunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );=

+/*  =

+EFI_STATUS

+BBTestCallBack= FunctionTest (

+  IN EFI_= BB_TEST_PROTOCOL       *This,

+  IN VOID=             &nb= sp;          *ClientInterface,=

+  IN EFI_= TEST_LEVEL           = ;  TestLevel,

+  IN EFI_= HANDLE           &nb= sp;     SupportHandle

+  );

+*/<= /span>

+EFI_STATUS

+GetDevicePath = (

+  IN = ; EFI_HII_CONFIG_ACCESS_PROTOCOL       *Confi= gAccess,

+  OUT EFI= _STRING           &n= bsp;            = ;   *DevicePathStr

+  );=

+

+EFI_STATUS

+GetCorrespondi= ngRequest (

+  IN = ;    EFI_STRING    MultiConfigAltResp,

+  IN = ;    EFI_STRING    DevicePath,

+  IN OUT = EFI_STRING    Request

+  );=

+

+EFI_STATUS

+GetCorrespondi= ngResp (

+  IN = ;    EFI_STRING    MultiConfigAltResp,

+  IN = ;    EFI_STRING    DevicePath,

+  IN OUT = EFI_STRING    Resp

+  );=

+

+EFI_STATUS

+GetHIIConfigRo= utingInterface (

+  OUT EFI= _HII_CONFIG_ROUTING_PROTOCOL    **HIIConfigRouting

+  );=

+

+EFI_STATUS

+MultiAltRespTo= MultiReq (

+  IN = ;      EFI_STRING     &nb= sp;            =          Resp,

+  IN OUT&= nbsp;  EFI_STRING         = ;             &= nbsp;    Req

+  );=

+

+#endif

diff --git a/uefi-s= ct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIICon= figAccessBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigA= ccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf

new file mode 10064= 4

index 00000000..116= 8986b

--- /dev/null<= /o:p>

+++ b/u= efi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvH= IIConfigAccessBBTest.inf

@@ -0,0 +1,55 @= @

+## @file<= /o:p>

+#

+#  Copyri= ght 2006 - 2012 Unified EFI, Inc.<BR>

+#  Copyri= ght (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>=

+#  Copyri= ght (c) 2019, ARM Ltd. All rights reserved.<BR>

+#

+#  This p= rogram and the accompanying materials

+#  are li= censed and made available under the terms and conditions of the BSD License=

+#  which = accompanies this distribution.  The full text of the license may be fo= und at

+#  http:/= /opensource.org/licenses/bsd-license.php

+# <= /span>

+#  THE PR= OGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

+#  WITHOU= T WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+# <= /span>

+##<= /span>

+#/*++<= o:p>

+#

+# Module Name:=

+#

+#   = HIIConfigAccessBBTest.inf

+#

+# Abstract:

+#

+#   = Component description file for IHV HII Config Access Protocol Black-Box Tes= t.

+#

+#--*/

+

+[defines]=

+INF_VERSION&nb= sp;         =3D 0x00010005

+BASE_NAME = ;           =3D IhvHIICon= figAccessBBTest

+FILE_GUID = ;           =3D D39F2A3B-= 72BF-40F5-86BF-2E1E96D15EA3

+MODULE_TYPE&nb= sp;         =3D UEFI_DRIVER

+VERSION_STRING=        =3D 1.0

+ENTRY_POINT&nb= sp;         =3D InitializeHIIConfig= AccessBBTest

+

+[sources.commo= n]

+  HIIConf= igAccessBBTestConformance.c

+  HIIConf= igAccessBBTestFunction.c

+  HIIConf= igAccessBBTestMain.c

+  Guid.c<= o:p>

+

+[Packages]

+  SctPkg/= SctPkg.dec

+  SctPkg/= UEFI/UEFI.dec

+  MdePkg/= MdePkg.dec

+

+[LibraryClasse= s]

+  UefiDri= verEntryPoint

+  SctLib<= o:p>

+  EfiTest= Lib

+

+[Protocols]

+  gBlackB= oxEfiHIIConfigAccessProtocolGuid

+  gBlackB= oxEfiHIIConfigRoutingProtocolGuid

+  gBlackB= oxEfiDevicePathProtocolGuid

diff --git a/uefi-s= ct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc

index 83396f1a..c3a= fdbdd 100644

--- a/uefi-sct/SctP= kg/UEFI/IHV_SCT.dsc

+++ b/u= efi-sct/SctPkg/UEFI/IHV_SCT.dsc

@@ -210,9 +210,= 11 @@ SctPkg/TestCase/UEFI/IHV/Protocol/UsbIo/BlackBoxTest/IhvUsbIoTest.inf=

SctPkg/TestCase/UEF= I/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsOutputBBTest.inf=

SctPkg/TestCase/UEF= I/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiPassThruBBTest.inf

SctPkg/TestCase/UEF= I/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf

+SctPkg/TestCas= e/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.i= nf

SctPkg/TestCase/UEF= I/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiInitiatorNameBBTest.= inf

<= /p>

 SctPkg/TestCa= se/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolutePointerBBTest.= inf

+SctPkg/TestCas= e/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBB= Test.inf

SctPkg/TestCase/UEF= I/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvStorageSecurityComman= dBBTest.inf

<= /p>

 SctPkg/TestCa= se/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoBBTest.inf=

--

2.22.0.windows.1

--_000_BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0BN6PR1101MB2355_--