From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: eric.jin@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Fri, 21 Jun 2019 08:41:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2019 08:41:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,400,1557212400"; d="scan'208,217";a="162900964" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 21 Jun 2019 08:41:11 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 21 Jun 2019 08:41:11 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 21 Jun 2019 08:41:10 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.83]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.246]) with mapi id 14.03.0439.000; Fri, 21 Jun 2019 23:41:08 +0800 From: "Eric Jin" To: "devel@edk2.groups.io" , "supreeth.venkatesh@arm.com" , "Shrishail.Patil@microchip.com" CC: "Jabir.M@microchip.com" , "Anoop.PA@microchip.com" Subject: Re: [edk2-devel] [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT Thread-Topic: [edk2-devel] [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT Thread-Index: AdUk7G2z9ncw0MMHRSqPJqjCZwe8NwAe1T3wALfjItA= Date: Fri, 21 Jun 2019 15:41:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.jin@intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DA72DC7456565B47808A57108259571F637C3C92SHSMSX103ccrcor_" --_000_DA72DC7456565B47808A57108259571F637C3C92SHSMSX103ccrcor_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Shrishail, Could you re-send the patch with "git send-email" command again ? One suggestion is it is better to split the patch to 2 patches, one it for= FMP, and another is for HII Config Access. :) Thanks. Best Regards Eric From: devel@edk2.groups.io On Behalf Of Supreeth Ve= nkatesh Sent: Tuesday, June 18, 2019 7:53 AM To: Shrishail.Patil@microchip.com; devel@edk2.groups.io Cc: Jabir.M@microchip.com; Anoop.PA@microchip.com; Jin, Eric Subject: Re: [edk2-devel] [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FM= P and HII Config Access protocol into IHVSCT + Eric From: Shrishail.Patil@microchip.com = > Sent: Monday, June 17, 2019 4:18 AM To: devel@edk2.groups.io Cc: Supreeth Venkatesh >; Jabir.M@microchip.com; Anoop.PA= @microchip.com Subject: [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config = Access protocol into IHVSCT Hi Team, Adding Firmware Management Protocol and HII Config Access Protocol into IH= VSCT. 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/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/IhvFirmwareManagementBBTest.inf create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/HIIConfigAccessBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/HIIConfigAccessBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/HIIConfigAccessBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/HIIConfigAccessBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/Comm= onGenFramework.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 %Framewor= k%\Test\ > NUL copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi %Framewor= k%\Test\ > NUL copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi %Framewor= k%\Test\ > NUL - + copy %ProcessorType%\IhvFirmwareManagementBBTest.efi %Framewor= k%\Test\ > NUL + copy %ProcessorType%\IhvHIIConfigAccessBBTest.efi %Framewor= k%\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/Commo= nGenFramework.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/T= est/ > NUL cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi $Framework/T= est/ > NUL cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi $Framework/T= est/ > NUL - + cp $ProcessorType/IhvFirmwareManagementBBTest.efi $Framework/T= est/ > NUL + cp $ProcessorType/IhvHIIConfigAccessBBTest.efi $Framework/T= est/ > 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/TestC= ase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBT= estConformance.c new file mode 100644 index 00000000..95d36dc7 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + 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*)ClientInterfa= ce; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareMana= gement); + BBTestGetImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareMana= gement); + + 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*)ClientInterfa= ce; + + 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, FirmwareManageme= nt); + BBTestGetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManageme= nt); + BBTestGetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManageme= nt); + BBTestGetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManageme= nt); + + 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*)ClientInterfa= ce; + + 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, FirmwareManageme= nt); + //BBTestSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManage= ment); + BBTestSetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManageme= nt); + BBTestSetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManageme= nt); + + 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*)ClientInterfa= ce; + + 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, FirmwareManage= ment); + BBTestCheckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManage= ment); + + 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*)ClientInterfa= ce; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + // + + Status =3D CheckForSupportSetPackageInfo (StandardLib, FirmwareManageme= nt); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestSetPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareMa= nagement); + BBTestSetPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareMa= nagement); + BBTestSetPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareMa= nagement); + BBTestSetPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareMa= nagement); + + 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 NUL= L. + 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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_N= OT_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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 E= FI_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 E= FI_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_A= BORTED."; + + 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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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 = longer + 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/FirmwareManagementBBTest= Function.c new file mode 100644 index 00000000..99a74aa5 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + 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*)ClientInterfa= ce; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagem= ent); + + 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*)ClientInterfa= ce; + + 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*)ClientInterfa= ce; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManag= ement); + + 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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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 b= it3."; + goto Exit; + } + + if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"AttributesSetting has bit(s) set beyond bit= 3."; + goto Exit; + } + + if ((p->Compatibilities & 0x000000000000FFFE) !=3D0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"Compatibilities have bit(s) set between bit= 1 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%= 02x%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 SctLShift= U64(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_S= MALL. + // 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)) > *I= mageInfoSize."; + 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_REQUIRE= D) =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 I= MAGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMA= GE_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_UNSUPPO= RTED."; + 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_UNSUPPO= RTED."; + } + +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_UNSUPPO= RTED."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSUPPORT= ED."; + 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 bi= t2."; + 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/UEF= I/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain= .c new file mode 100644 index 00000000..3ce62795 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + + 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, 0= xb0, 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 GetPackageIn= fo().", + 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 SetPackageIn= fo().", + 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/UEF= I/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain= .h new file mode 100644 index 00000000..92ac3e45 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + + 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, 0= xcf } } + +#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, = 0x7f } } + +// **********************************************************************= ****** +// 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/FirmwareM= anagement/BlackBoxTest/Guid.c new file mode 100644 index 00000000..c33d5b79 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + + Guid.c + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +#include "Efi.h" +#include "Guid.h" + +// **********************************************************************= ****** +// Function +// **********************************************************************= ****** + +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID; + +// **********************************************************************= ****** +// Conformance +// **********************************************************************= ****** + +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001=3DEFI_TEST_FI= RMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002=3DEFI_TEST_FI= RMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003=3DEFI_TEST_FI= RMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004=3DEFI_TEST_FI= RMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID; + +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016=3DEFI_TEST_= FIRMWAREMANAGEMENTBBTESTCONFORMANCE_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/FirmwareM= anagement/BlackBoxTest/Guid.h new file mode 100644 index 00000000..d2b2e51d --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 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: + + 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, 0= x31 } } + +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, = 0x51 } } + +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, 0= x1c } } + +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, = 0xc9 } } + +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, = 0x6c } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement= /BlackBoxTest/IhvFirmwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UE= FI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest= .inf new file mode 100644 index 00000000..7566a044 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackB= oxTest/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 = BSD 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 I= MPLIED. +# +## +#/*++ +# +# 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/Bl= ackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/Guid.c new file mode 100644 index 00000000..6a6d4e60 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + + Guid.c + + Abstract: + + GUIDs auto-generated for EFI test assertion. + +--*/ + +#include "HIIConfigAccessBBTestMain.h" + +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid003=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid004=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid005=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid006=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID; +/* +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid008=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid009=3DEFI_TEST_HII= CONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0010=3DEFI_TEST_HI= ICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0011=3DEFI_TEST_HI= ICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID; +EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0012=3DEFI_TEST_HI= ICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID; +*/ +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid001=3DEFI_TEST_HIICON= FIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid002=3DEFI_TEST_HIICON= FIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid003=3DEFI_TEST_HIICON= FIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID; +EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid004=3DEFI_TEST_HIICON= FIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/Bl= ackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAcc= ess/BlackBoxTest/Guid.h new file mode 100644 index 00000000..b7003028 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + + 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, = 0xc1 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \ +{ 0xfa5973e2, 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, = 0x76 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002; + +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID \ +{ 0x6f6d1dd, 0x49b8, 0x488a, { 0xa7, 0x75, 0xde, 0xbc, 0xc7, 0x60, 0xfd, = 0x28 } } + +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, = 0x29 } } + +extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007; +/* +#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID \ +{ 0xbdec5b08, 0x423, 0x482b, { 0xb7, 0xdf, 0xde, 0xac, 0xab, 0xf7, 0x13, = 0x11 } } + +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, = 0xe7 } } + +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, = 0x8 } } + +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/Bl= ackBoxTest/HIIConfigAccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UE= FI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConforman= ce.c new file mode 100644 index 00000000..c8b35003 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + 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, HIIConfigAc= cess ); + BBTestExtractConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRo= uting, HIIConfigAccess ); + BBTestExtractConfigConformanceTestCheckpoint3( StandardLib, HIIConfigRo= uting, HIIConfigAccess ); + BBTestExtractConfigConformanceTestCheckpoint4( StandardLib, HIIConfigAc= cess ); + + 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, HIIConfigAcce= ss ); + BBTestRouteConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRout= ing, HIIConfigAccess ); + BBTestRouteConfigConformanceTestCheckpoint3( StandardLib, HIIConfigAcce= ss ); + + 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"&G= UID=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 - ExtractConf= ig() 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 (MultiConf= igAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Req= uest); + 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 - ExtractConf= ig() 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 (MultiConf= igAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Req= uest); + 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 - ExtractConf= ig() 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=3D006a006900= 6e0039&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() r= eturns 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() retur= ns 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 (MultiConfi= gAltResp) + 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=3D006a00= 69006e0039&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() retur= ns 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, + &ActionRe= quest + ); + + 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_RESE= T || 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, + &ActionRe= quest + ); + + 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_RESE= T || 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 callba= ck + // + Status =3D HIIConfigAccess->CallBack ( + HIIConfigAccess, + Action, + QuestionId, + Type, + &Value, + &ActionRe= quest + ); + + 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_RESE= T || 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/Bl= ackBoxTest/HIIConfigAccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/= IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c new file mode 100644 index 00000000..14cc5684 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + 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=3D970eb94aa0d449f7b980bdaa4= 7d42527&NAME=3Dft894&PATH=3D000acf&OFFSET=3D3&WIDTH=3D4&VALUE=3Daabbccdd&OF= FSET=3D1&WIDTH=3D2&VALUE=3Deeff&GUID=3D970eb94aa0d449f7b980bdaa47d42527&NAM= E=3Dft894&PATH=3D000acf&ALTCFG=3D0037&A000=3Dabcd&B000=3Defef&GUID=3D970eb9= 4aa0d449f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b266= 538c38af48ce000000007fff0400&A000=3Dabcd&B000=3Defef&GUID=3D970eb94aa0d449f= 7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b266538c38af4= 8ce000000007fff0400&ALTCFG=3D0037&OFFSET=3D3&WIDTH=3D4&VALUE=3Daabbccdd&OFF= SET=3D1&WIDTH=3D2&VALUE=3Deeff";; + + // + // init + // + HIIConfigAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface; + + Request =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfi= gAltResp) + 2); + if (Request =3D=3D NULL) + return EFI_OUT_OF_RESOURCES; + + Resp =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAl= tResp) + 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, Req= uest); + + 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, HIIConfigRouti= ng, HIIConfigAccess ); + BBTestExtractConfigFunctionTestCheckpoint2( StandardLib, HIIConfigRouti= ng, 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 (MultiConf= igAltResp) + 2 ); + if (Request =3D=3D NULL) { + gtBS->FreePool (MultiConfigAltResp); + gtBS->FreePool (DevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Req= uest); + 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 + SctStrL= en (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- ExtractConfi= g() 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 + SctStrL= en (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- ExtractConfi= g() 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) && (= Results =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- ExtractConfi= g() 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 (MultiConfigA= ltResp) + 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 (= Resp)) ) { + 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() return= s 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, + &ActionRequ= est + ); + 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_RESE= T || 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_= SUCCESS 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/Bl= ackBoxTest/HIIConfigAccessBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/= Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c new file mode 100644 index 00000000..29c793e2 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + + 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, 0= xb0, 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 ExtractCon= fig().", + 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 RouteConfi= g().", + 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 Extract= Config().", + 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 RouteCo= nfig().", + 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 CallBac= k().", + 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 str= ucture + // + return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_P= ROTOCOL); +} + + +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 str= ing. Includes tailing '\0' character. + If routine return with EFI_SUCCESS, containin= g length of hex string buffer. + If routine return with EFI_BUFFER_TOO_SMALL, = containg 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 rev= erse 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 b= inary 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 P= rotocol 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 (MultiC= onfigAltResp) + 2 ); + if (SingleResp =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + SingleRespPtr =3D SingleResp; + + while (*MultiConfigAltResp !=3D 0) { + while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConfigAltRes= p, 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 (MultiConfigAltRes= p, 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"&= GUID=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/Bl= ackBoxTest/HIIConfigAccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/= Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h new file mode 100644 index 00000000..c81a00ca --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxT= est/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 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: + + 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, = 0x4 } } + +#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202 \ +{ 0x495c99f3, 0x231, 0x45a5, { 0xaf, 0xfa, 0xd2, 0x5c, 0x6f, 0x9a, 0x19, = 0x1c } } + + + +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/Bl= ackBoxTest/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/BlackBoxT= est/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 = BSD 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 I= MPLIED. +# +## +#/*++ +# +# Module Name: +# +# HIIConfigAccessBBTest.inf +# +# Abstract: +# +# Component description file for IHV HII Config Access Protocol Black-B= ox 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_S= CT.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/= IhvUsbIoTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsO= utputBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiP= assThruBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf +SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConf= igAccessBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsi= InitiatorNameBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolut= ePointerBBTest.inf +SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirm= wareManagementBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvS= torageSecurityCommandBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfo= BBTest.inf -- 2.22.0.windows.1 IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in= any medium. Thank you. --_000_DA72DC7456565B47808A57108259571F637C3C92SHSMSX103ccrcor_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Shrishail,

 

Could you re-send the patch with “git send-em= ail” command again ?

One suggestion is it is better to split the patch t= o 2 patches, one it for FMP, and another is for HII Config Access. J Thanks.

 

Best Regards

Eric

 

From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of Supreeth Venkatesh
Sent: Tuesday, June 18, 2019 7:53 AM
To: Shrishail.Patil@microchip.com; devel@edk2.groups.io
Cc: Jabir.M@microchip.com; Anoop.PA@microchip.com; Jin, Eric <er= ic.jin@intel.com>
Subject: Re: [edk2-devel] [edk2-test][Patch v1] uefi-sct/SctPkg: Ad= ding FMP and HII Config Access protocol into IHVSCT

 

+ Eric

 

From: Shrishail.Patil@microchip.com <Shrishail.Patil@microchip.com>
Sent: Monday, June 17, 2019 4:18 AM
To: devel@edk2.groups.io
Cc: Supreeth Venkatesh <
Supreeth.Venkatesh@arm.com>; Jabir.M@microchip.com; Anoop.PA@microchip.com
Subject: [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII = Config Access protocol into IHVSCT

 

Hi Team,

 

Adding Firmware Management Protocol and HII Config = Access Protocol into IHVSCT.

 

Contributed-under: TianoCore Contribution Agreement= 1.1

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

 <= /span>

From: shrishailp &= lt;5014= 0165+shrishailp@users.noreply.github.com>

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

Subject: [PATCH] A= dding FMP and HII Config Access protocol into IHVSCT

 <= /span>

Added FMP and HII = config access protocol into IHVSCT.

---

uefi-sct/SctPkg/Co= mmonGenFramework.bat        |  = ;  3 +-

uefi-sct/SctPkg/Co= mmonGenFramework.sh         | =    3 +-

.../FirmwareManage= mentBBTestConformance.c     | 3632 ++++= +++++++++++++

.../FirmwareManage= mentBBTestFunction.c        |  891 = ++++

.../FirmwareManage= mentBBTestMain.c          = ;  |  228 ++

.../FirmwareManage= mentBBTestMain.h          = ;  |  223 +

.../FirmwareManage= ment/BlackBoxTest/Guid.c    |   63 +

.../FirmwareManage= ment/BlackBoxTest/Guid.h    |  153 +

.../IhvFirmwareMan= agementBBTest.inf         &nbs= p; |   52 +

.../HIIConfigAcces= s/BlackBoxTest/Guid.c       |   46 = +

.../HIIConfigAcces= s/BlackBoxTest/Guid.h       |  109 +=

.../HIIConfigAcces= sBBTestConformance.c        |  908 = +++++

.../HIIConfigAcces= sBBTestFunction.c         &nbs= p; |  606 +++

.../BlackBoxTest/H= IIConfigAccessBBTestMain.c  |  655 +++

.../BlackBoxTest/H= IIConfigAccessBBTestMain.h  |  168 +

.../BlackBoxTest/I= hvHIIConfigAccessBBTest.inf |   55 +

uefi-sct/SctPkg/UE= FI/IHV_SCT.dsc          &= nbsp;   |    2 +

17 files changed, = 7795 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/Gu= id.c

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

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

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

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

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

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

 <= /span>

diff --git a/uefi-= sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat<= o:p>

index 5c614eaa..f9= d133fd 100644

--- a/uefi-sct/Sct= Pkg/CommonGenFramework.bat

+++ b/= uefi-sct/SctPkg/CommonGenFramework.bat

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

   copy = %ProcessorType%\IhvUsb2HcTest.efi       =             &nb= sp;    %Framework%\Test\ > NUL

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

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

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

+  copy %= ProcessorType%\IhvHIIConfigAccessBBTest.efi     &n= bsp;       %Framework%\Test\ > NUL

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

   rem C= opy the UEFI 2.1 Test Cases for IHV

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

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

index c422034a..6a= 944611 100755

--- a/uefi-sct/Sct= Pkg/CommonGenFramework.sh

+++ b/= uefi-sct/SctPkg/CommonGenFramework.sh

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

   cp $P= rocessorType/IhvUsb2HcTest.efi       &nb= sp;            =     $Framework/Test/ > NUL

   cp $P= rocessorType/IhviScsiInitiatorNameBBTest.efi     &= nbsp;    $Framework/Test/ > NUL

   cp $P= rocessorType/IhvStorageSecurityCommandBBTest.efi    &nb= sp; $Framework/Test/ > NUL

-

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

+  cp $Pr= ocessorType/IhvHIIConfigAccessBBTest.efi      = ;       $Framework/Test/ > NUL<= /span>

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

   # Cop= y the UEFI 2.1 Test Cases for IHV

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

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmw= areManagementBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protoc= ol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c

new file mode 1006= 44

index 00000000..95= d36dc7

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestConformance.c

@@ -0,0 +1,363= 2 @@

+/** @file

+

+  Copyri= ght 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2016, 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+  &= nbsp; FirmwareManagementBBTestConformance.c

+

+Abstract:

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

+

+--*/

+

+#define DEBUG= _ALL            = ;            &n= bsp;       0

+#define DEBUG= _GET_IMAGE_INFO          =            0

+#define DEBUG= _GET_IMAGE           = ;            &n= bsp;  0

+#define DEBUG= _SET_IMAGE           &nbs= p;            &= nbsp; 0

+#define DEBUG= _CHECK_IMAGE          &nb= sp;            = 0

+#define DEBUG= _SET_PACKAGE_INFO         &nbs= p;         0

+

+#include &quo= t;SctLib.h"

+#include &quo= t;FirmwareManagementBBTestMain.h"

+

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

+//  = ; Support Routines

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

+

+EFI_STATUS

+CheckForSuppo= rtGetImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+CheckForSuppo= rtSetImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL        &nb= sp;   *FirmwareManagement

+  );

+

+

+EFI_STATUS

+CheckForSuppo= rtCheckImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+CheckForSuppo= rtSetPackageInfo (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

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

+//  = ; Check Points

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

+

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

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

+//  = ; Support Routines

+//

+//

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

+

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

+//  = ; Support Routine: Progress

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

+

+EFI_STATUS

+Progress (

+  IN UIN= TN            &= nbsp;           &nbs= p;            &= nbsp; Completion

+)<= /span>

+{<= /span>

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Support Routine: CheckForSupportGetImage

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

+

+EFI_STATUS

+CheckForSuppo= rtGetImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+)<= /span>

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageIndex;

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

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

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceSupportGuid001;

+  Result= MessageLabel =3D L"GetImage, function support check";<= /span>

+

+  ImageI= ndex =3D 0;

+  Image = = =3D NULL;

+  ImageS= ize =3D 0;

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D FirmwareManagement->GetImage (

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &ImageSize

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

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

+  } else= {

+  &= nbsp; ResultMessageData =3D L"function is supported.";=

+  }=

+

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Im= age !=3D NULL) {

+  &= nbsp; gtBS->FreePool (Image);

+  }=

+

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return EFI_UNSUPPORTED;

+  } else= {

+  &= nbsp; return EFI_SUCCESS;

+  }=

+}<= /span>

+

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

+//  = ; Support Routine: CheckForSupportSetImage

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

+

+EFI_STATUS

+CheckForSuppo= rtSetImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+)<= /span>

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageIndex;

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

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

+  CHAR16=             &nb= sp;            =             &nb= sp;   *AbortReason;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceSupportGuid002;

+  Result= MessageLabel =3D L"SetImage, function support check";<= /span>

+

+  ImageI= ndex =3D 0;

+  Image = = =3D NULL;

+  ImageS= ize =3D 0;

+  AbortR= eason =3D NULL;

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D FirmwareManagement->SetImage (

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

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

+  } else= {

+  &= nbsp; ResultMessageData =3D L"function is supported.";=

+  }=

+

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Ab= ortReason !=3D NULL) {

+  &= nbsp; gtBS->FreePool (AbortReason);

+  }=

+

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return EFI_UNSUPPORTED;

+  } else= {

+  &= nbsp; return EFI_SUCCESS;

+  }=

+}<= /span>

+

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

+//  = ; Support Routine: CheckForSupportCheckImage

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

+

+EFI_STATUS

+CheckForSuppo= rtCheckImage (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+)<= /span>

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageIndex;

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

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

+  UINT32=             &nb= sp;            =             &nb= sp;   ImageUpdatable;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceSupportGuid003;

+  Result= MessageLabel =3D L"CheckImage, function support check";

+

+  ImageI= ndex =3D 0;

+  Image = = =3D NULL;

+  ImageS= ize =3D 0;

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D FirmwareManagement->CheckImage (

+   =             &nb= sp;            =      FirmwareManagement,

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

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

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

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

+  &= nbsp;           &nbs= p;             =      );

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

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

+  } else= {

+  &= nbsp; ResultMessageData =3D L"function is supported.";=

+  }=

+

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return EFI_UNSUPPORTED;

+  } else= {

+  &= nbsp; return EFI_SUCCESS;

+  }=

+}<= /span>

+

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

+//  = ; Support Routine: CheckForSupportSetPackageInfo

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

+

+EFI_STATUS

+CheckForSuppo= rtSetPackageInfo (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+)<= /span>

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

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

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

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *VendorCode;

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceSupportGuid004;

+  Result= MessageLabel =3D L"SetPackageInfo, function support check";<= /o:p>

+

+  Image = = =3D NULL;

+  ImageS= ize =3D 0;

+  Vendor= Code =3D NULL;

+  Packag= eVersion =3D 0;

+  Packag= eVersionName =3D NULL;

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D FirmwareManagement->SetPackageInfo (

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

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

+  } else= {

+  &= nbsp; ResultMessageData =3D L"function is supported.";=

+  }=

+

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return EFI_UNSUPPORTED;

+  } else= {

+  &= nbsp; return EFI_SUCCESS;

+  }=

+}<= /span>

+

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

+//  = ; Test Cases

+//

+//

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

+

+/*=

+EFI_STATUS

+BBTestUnitTes= t (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  return= EFI_SUCCESS;

+}<= /span>

+*/=

+

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

+//  = ; Test Case: GetImageInfo

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

+ <= /span>

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

+  &= nbsp;            &nb= sp;   &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= GetImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);

+  BBTest= GetImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Test Case: GetImage

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

+

+EFI_STATUS

+BBTestGetImag= eConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            &nbs= p;            &= nbsp; *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D CheckForSupportGetImage (StandardLib, FirmwareManagement);<= /span>

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= GetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);<= /o:p>

+  BBTest= GetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);<= /o:p>

+  BBTest= GetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);<= /o:p>

+  BBTest= GetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);<= /o:p>

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Test Case: SetImage

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

+

+EFI_STATUS

+BBTestSetImag= eConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D CheckForSupportSetImage (StandardLib, FirmwareManagement);<= /span>

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= SetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);<= /o:p>

+  //BBTe= stSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);

+  BBTest= SetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);<= /o:p>

+  BBTest= SetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);<= /o:p>

<= /o:p>

+  return= Status;

+}<= /span>

+

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

+//  = ; Test Case: CheckImage

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

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Che= ck if function is supported

+  //

+

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

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= CheckImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);

+  BBTest= CheckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);

<= /o:p>

+  return= Status;

+}<= /span>

+

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

+//  = ; Test Case: SetPackageInfo

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

+ <= /span>

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Che= ck if function is supported

+  //

+

+  Status= =3D CheckForSupportSetPackageInfo (StandardLib, FirmwareManagement);<= /o:p>

+  if (St= atus =3D=3D EFI_UNSUPPORTED) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= SetPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);=

+  BBTest= SetPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);=

+  BBTest= SetPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);=

+  BBTest= SetPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);=

<= /o:p>

+  return= Status;

+}<= /span>

+

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

+//  = ; Check Points

+//

+//

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

+

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

+//  = ; Checkpoint: GetImageInfo, 1

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   The function should return EFI_BUFFER_TOO_SMALL and Image= InfoSize > 1.

+**/

+

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =              &n= bsp;  *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;             = ;            &n= bsp;  DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

+  CHAR16=              &n= bsp;            = ;            &n= bsp;  *PackageVersionName;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid001;

+  Result= MessageLabel =3D L"GetImageInfo, conformance checkpoint #1";=

+  Result= MessageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL.";=

+

+  ImageI= nfo =3D NULL;

+  Packag= eVersionName =3D NULL;

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  ImageI= nfoSize =3D 1;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus !=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_BUFFER_TOO_SMALL.&q= uot;;

+  &= nbsp; goto Exit;

+  }=

+  if (Im= ageInfoSize <=3D 1) {

+   =  AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to update *ImageInfoSize.";<= o:p>

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+ <= /span>

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Im= ageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: GetImageInfo, 2

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER.

+**/

+

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &n= bsp;  PackageVersion;

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

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid002;

+  Result= MessageLabel =3D L"GetImageInfo, conformance checkpoint #2";=

+  Result= MessageData =3D L"correctly returned EFI_INVALID_PARAMETER.";

+

+  ImageI= nfo =3D NULL;

+  Packag= eVersionName =3D NULL;

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Status= =3D FirmwareManagement->GetImageInfo (

+   =             &nb= sp;            =      FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL, // &ImageInfoSize=

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus !=3D EFI_INVALID_PARAMETER) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER.&= quot;;

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+ <= /span>

+Exit:

+  Standa= rdLib->RecordAssertion (

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

+  &= nbsp;            &nb= sp; AssertionType,

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;            &nb= sp; Status

+  &= nbsp;           &nbs= p;  );

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Im= ageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: GetImage, 1

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

+

+/**

+  This r= outine:

+  &= nbsp; - Calls function with valid parameters, except ImageSize =3D 1.<= /o:p>

+  &= nbsp;   The function should return EFI_BUFFER_TOO_SMALL and Image= Size > 1.

+**/

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;             = ;            &n= bsp;  *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

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

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

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid003;

+  Result= MessageLabel =3D L"GetImage, conformance checkpoint #1";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

+  &= nbsp;            &nb= sp;            =      &ImageInfoSize,

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

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

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

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

+  &= nbsp;            &nb= sp;            =      &PackageVersion,

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

+  &= nbsp;            &nb= sp;            =        &ImageInfoSize,

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

+   =             &nb= sp;            =        &PackageVersion,

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+

+  &= nbsp; ImageSize =3D 1;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_BUFFER_= TOO_SMALL.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to update *ImageSize.= ";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_BUFFER_TOO_SMALL.= ";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp;   gtBS->FreePool (BufferImage);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: GetImage, 2

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

+

+/**

+  This r= outine:

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

+   =    The function should return EFI_INVALID_PARAMETER.

+**/

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;   ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

+  UINTN&= nbsp;           &nbs= p;             =             &nb= sp;   DescriptorSize;

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

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

+  UINTN&= nbsp;           &nbs= p;             =             &nb= sp;   ImageSize;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid004;

+  Result= MessageLabel =3D L"GetImage, conformance checkpoint #2";

+

+  Buffer= ImageInfo =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

+  &= nbsp;            &nb= sp;            =      &DescriptorCount,

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

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

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

+  &= nbsp; Image =3D NULL;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_INVALID= _PARAMETER.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: GetImage, 3

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   ImageIndex =3D DescriptorCount + 1.=

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER or EFI_N= OT_FOUND.

+**/

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =              &n= bsp;  PackageVersion;

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

+

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

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

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;   ImageIndex;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid005;

+  Result= MessageLabel =3D L"GetImage, conformance checkpoint #3";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;            &nb= sp;   (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  // Dum= my image so as to fail on Image =3D NULL

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

+  ImageS= ize =3D 64;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &Image

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  Buffer= Image =3D Image;

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_FAILED;

+  Result= MessageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_NOT_FO= UND.";

+

+  ImageI= ndex =3D 0;

+  Status= =3D FirmwareManagement->GetImage (

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

+  &= nbsp;            &nb= sp;            =      ImageIndex,

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &ImageSize

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if ((S= tatus !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND)) {=

+  &= nbsp; goto Exit;

+  }=

+

+  if ((D= escriptorCount + 1) !=3D 0) {

+  &= nbsp; ImageIndex =3D DescriptorCount + 1;

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_N= OT_FOUND)) {

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_NOT_= FOUND.";

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

+  &= nbsp;            &nb= sp; AssertionType,

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;            &nb= sp; Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+   = if (BufferImage !=3D NULL) {

+  &= nbsp;   gtBS->FreePool (BufferImage);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: GetImage, 4

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

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

+  &= nbsp;   authentication data.    

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestGetImag= eConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;   DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

+  VOID&n= bsp;            = ;             &= nbsp;           &nbs= p;    *Image;

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

+ <= /span>

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid006;

+  Result= MessageLabel =3D L"GetImage, conformance checkpoint #4";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

<= /o:p>

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {<= /p>

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

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

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

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+

+  &= nbsp; FunctionTested++;

+

+   =  Status =3D FirmwareManagement->GetImage (

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;  

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_SECURIT= Y_VIOLATION.";

+  &= nbsp;   goto Exit; 

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImage);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetImage, 1

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER.

+**/

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *AbortReason;

+

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

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

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid007;

+  Result= MessageLabel =3D L"SetImage, conformance checkpoint #1";

+

+  Buffer= ImageInfo =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  AbortR= eason =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+   =    continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+   =    continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

+  &= nbsp; Image =3D NULL;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       NULL,  // VendorCode

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

+  &= nbsp;            &nb= sp;            =        &AbortReason

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_INVALID= _PARAMETER.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;            &nb= sp; );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Ab= ortReason !=3D NULL) {

+  &= nbsp; gtBS->FreePool (AbortReason);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetImage, 2

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

+

+/**

+  This r= outine:

+  &= nbsp; - Calls function with valid parameters, except Image is a dummy image= .

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER or EFI_A= BORTED.

+**/

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &n= bsp;  PackageVersion;

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

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *AbortReason;

+

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

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

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;             =             &nb= sp;   FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid008;

+  Result= MessageLabel =3D L"SetImage, conformance checkpoint #2";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  AbortR= eason =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

+  &= nbsp;            &nb= sp;            =      &ImageInfoSize,

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

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

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

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

+  &= nbsp;            &nb= sp;            =      &PackageVersion,

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

+  &= nbsp;            &nb= sp;            =        &ImageInfoSize,

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

+   =             &nb= sp;            =        &PackageVersion,

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;            &nb= sp;            =        p->ImageIndex,

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

+  &= nbsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_A= BORTED)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_INVALID= _PARAMETER or EFI_ABORTED.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER= or EFI_ABORTED.";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImage);

+  }=

+  if (Ab= ortReason !=3D NULL) {

+  &= nbsp; gtBS->FreePool (AbortReason);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetImage, 3

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   ImageIndex =3D DescriptorCount + 1.=

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER or EFI_A= BORTED.

+**/

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *AbortReason;

+

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

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;   ImageSize;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageIndex;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid009;

+  Result= MessageLabel =3D L"SetImage, conformance checkpoint #3";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image=3DNULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  AbortR= eason =3D NULL;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  // Dum= my image so as to fail on Image =3D NULL

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

+  ImageS= ize =3D 64;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;            &nb= sp;   (VOID **) &Image

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  Buffer= Image =3D Image;

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_FAILED;

+  Result= MessageData =3D L"failed to return EFI_INVALID_PARAMETER or EFI_ABORTE= D.";

+

+  ImageI= ndex =3D 0;

+  Status= =3D FirmwareManagement->SetImage (

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

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

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

+  &= nbsp;            &nb= sp;            =      );

+  if ((S= tatus !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) {

+  &= nbsp; goto Exit;

+  }=

+

+  if ((D= escriptorCount + 1) !=3D 0) {

+  &= nbsp; ImageIndex =3D DescriptorCount + 1;

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

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

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

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

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

+  &= nbsp;            &nb= sp;            =        NULL,  // Vendorcode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_A= BORTED)) {

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"correctly returned EFI_INVALID_PARAMETER or EFI_ABOR= TED.";

+

+Exit:

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;            &nb= sp; StandardLib,

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp;   gtBS->FreePool (BufferImage);

+  }=

+  if (Ab= ortReason !=3D NULL) {

+  &= nbsp; gtBS->FreePool (AbortReason);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetImage, 4

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

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

+  &= nbsp;   authentication data.    

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestSetImag= eConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID             =             &nb= sp;            =  TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            &nbs= p;            &= nbsp;           &nbs= p;    *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *AbortReason;

+

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

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

+ <= /span>

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid010;

+  Result= MessageLabel =3D L"SetImage, conformance checkpoint #4";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  AbortR= eason =3D NULL;

+  Functi= onTested =3D 0;

<= /o:p>

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

+  &= nbsp;            &nb= sp;   EfiBootServicesData,

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;            &nb= sp;            =      );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;            &nb= sp;            =        &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {<= /p>

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_SECURIT= Y_VIOLATION.";

+  &= nbsp;   goto Exit; 

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

+  &= nbsp;            &nb= sp; ResultMessageData,

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImage);

+  }=

+  if (Ab= ortReason !=3D NULL) {

+  &= nbsp; gtBS->FreePool (AbortReason);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: CheckImage, 1

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

+

+/**

+  This r= outine:

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

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER.

+**/

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;            &nb= sp;   DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+

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

+

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

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

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR         &nb= sp;        *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid011;

+  Result= MessageLabel =3D L"CheckImage, conformance checkpoint #1";

+

+  Buffer= ImageInfo =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

+   =             &nb= sp;            =      &PackageVersion,

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

+  &= nbsp;            &nb= sp;     EfiBootServicesData,

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

+  &= nbsp; Image =3D NULL;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

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

+  &= nbsp;            &nb= sp;            =        &ImageUpdatable

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_INVALID= _PARAMETER.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: CheckImage, 2

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

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

+  &= nbsp;   authentication data.    

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =              &n= bsp;  DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

+  CHAR16=             &nb= sp;             = ;            &n= bsp;  *PackageVersionName;

+

+  UINT32=             &nb= sp;            =             &nb= sp;   ImageUpdatable;

+

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

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

+

+  UINTN&= nbsp;           &nbs= p;             =             &nb= sp;   i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid012;

+  Result= MessageLabel =3D L"CheckImage, conformance checkpoint #2";

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

+  &= nbsp;            &nb= sp;            =      &DescriptorCount,

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

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

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

+

+  &= nbsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_R= EQUIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {<= /p>

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQ= UIRED) !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

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

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+  &= nbsp; FunctionTested++;

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

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

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

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

+  &= nbsp;            &nb= sp;            =        );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

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

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_SECURIT= Y_VIOLATION.";

+  &= nbsp;   goto Exit; 

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+   =             &nb= sp; Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImage);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetPackageInfo, 1

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

+

+/**

+  This r= outine:

+  &= nbsp; - Gets PackageVersionNameMaxLen.

+  &= nbsp; - Calls function with valid parameters, except PackageVersionName is = longer

+  &= nbsp;   than the value returned in PackageVersionNameLen.

+  &= nbsp;   The function should return EFI_INVALID_PARAMETER.

+**/

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL        &nb= sp;   *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =              &n= bsp;  *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+  UINT32=              &n= bsp;            = ;            &n= bsp;  PackageVersionNameMaxLen;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSupported;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSetting;

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *TestName;

+  UINT32=             &nb= sp;            =             &nb= sp;   TestNameLength;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid013;

+  Result= MessageLabel =3D L"SetPackageInfo, function checkpoint #1";<= /o:p>

+

+  Packag= eVersionName =3D NULL;

+  TestNa= me =3D NULL;

+

+  //

+  // Get= PackageVersionNameMaxLen

+  //

+

+  Status= =3D FirmwareManagement->GetPackageInfo (

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &AttributesSetting

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus !=3D EFI_SUCCESS) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"test skipped - test case does not apply.";=

+  if (Pa= ckageVersionNameMaxLen =3D=3D 0) {

+  &= nbsp; goto Exit;

+  }=

+  if (((= AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;     PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &a= mp;&

+  &= nbsp;   ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATIO= N_REQUIRED) =3D=3D

+  &= nbsp;     PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {=

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  gtBS-&= gt;FreePool (PackageVersionName);

+  Packag= eVersionName =3D NULL;

+  TestNa= meLength =3D PackageVersionNameMaxLen + 1;

+  Status= =3D gtBS->AllocatePool (

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

+  &= nbsp;            &nb= sp;  TestNameLength * 2,  // Unicode

+  &= nbsp;           &nbs= p;   (VOID **) &TestName

+  &= nbsp;           &nbs= p;   );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  for (i= =3D 0; i < (TestNameLength - 1); i++) {

+  &= nbsp; TestName[i] =3D L' ';

+  }=

+  TestNa= me[i] =3D L'\0';

+  Status= =3D FirmwareManagement->SetPackageInfo (

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // Image

+  &= nbsp;           &nbs= p;            &= nbsp;     0,  // ImageSize

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

+  &= nbsp;           &nbs= p;            &= nbsp;     0x01010101, // Dummy PackageVersion

+  &= nbsp;           &nbs= p;            &= nbsp;     TestName

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus =3D=3D EFI_INVALID_PARAMETER) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

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

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_INVALID_PARAMETER.&= quot;;

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+ <= /span>

+Exit:

+  Standa= rdLib->RecordAssertion (

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

+  &= nbsp;            &nb= sp; AssertionType,

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;            &nb= sp; Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Te= stName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (TestName);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetPackageInfo, 2

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

+  &= nbsp; - Calls function with valid parameters, except Image is NULL.

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;             =  TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersionNameMaxLen;

+  UINT64=             &nb= sp;            =              &n= bsp;  AttributesSupported;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSetting;

+

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

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

<= /o:p>

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid014;

+  Result= MessageLabel =3D L"SetPackageInfo, function checkpoint #2";<= /o:p>

+

+  Packag= eVersionName =3D NULL;

+

+  //

+  // Get= PackageVersionNameMaxLen

+  //

+

+  Status= =3D FirmwareManagement->GetPackageInfo (

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &AttributesSetting

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus !=3D EFI_SUCCESS) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"test skipped - test case does not apply.";=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PA= CKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACK= AGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Image = = =3D NULL;

+  ImageS= ize =3D 64;  // Dummy

+  Status= =3D FirmwareManagement->SetPackageInfo (

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus =3D=3D EFI_SECURITY_VIOLATION) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N.";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.= ";

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

+  &= nbsp;            &nb= sp; AssertionType,

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetPackageInfo, 3

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

+  &= nbsp; - Calls function with valid parameters, except ImageSize is 0.

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT32=             &nb= sp;            =              &n= bsp;  PackageVersion;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersionNameMaxLen;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSupported;

+  UINT64=              &n= bsp;            = ;            &n= bsp;  AttributesSetting;

+

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

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

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid015;

+  Result= MessageLabel =3D L"SetPackageInfo, function checkpoint #3";<= /o:p>

+

+  Packag= eVersionName =3D NULL;

+  Image = = =3D NULL;

+

+  //

+  // Get= PackageVersionNameMaxLen

+  //

+

+  Status= =3D FirmwareManagement->GetPackageInfo (

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

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

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

+   =             &nb= sp;            =      &PackageVersionNameMaxLen,

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &AttributesSetting

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus !=3D EFI_SUCCESS) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"test skipped - test case does not apply.";=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PA= CKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACK= AGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Status= =3D gtBS->AllocatePool (

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

+  &= nbsp;           &nbs= p; 64,  // Dummy

+  &= nbsp;           &nbs= p; (VOID **) &Image

+  &= nbsp;           &nbs= p; );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  ImageS= ize =3D 0;

+  Status= =3D FirmwareManagement->SetPackageInfo (

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus =3D=3D EFI_SECURITY_VIOLATION) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N.";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.= ";

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Im= age !=3D NULL) {

+  &= nbsp; gtBS->FreePool (Image);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Checkpoint: SetPackageInfo, 4

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

+

+/**

+  This r= outine:

+  &= nbsp; - The function requires authentication.

+  &= nbsp; - Calls function with valid parameters, except Image has a dummy

+  &= nbsp;   authentication data.

+  &= nbsp;   The function should return EFI_SECURITY_VIOLATION.

+**/

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

+  CHAR16=             &nb= sp;            =              &n= bsp;  *PackageVersionName;

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersionNameMaxLen;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSupported;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSetting;

+

+  VOID&n= bsp;            &nbs= p;            &= nbsp;           &nbs= p;    *Image;

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

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestConformanceAssertionGuid016;

+  Result= MessageLabel =3D L"SetPackageInfo, function checkpoint #4";<= /o:p>

+

+  Packag= eVersionName =3D NULL;

+  Image = = =3D NULL;

+  ImageS= ize =3D 64;

+

+  //

+  // Get= PackageVersionNameMaxLen

+  //

+

+  Status= =3D FirmwareManagement->GetPackageInfo (

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     &AttributesSetting

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus !=3D EFI_SUCCESS) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  Result= MessageData =3D L"test skipped - test case does not apply.";=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PA= CKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) !=3D PACK= AGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+  if ((A= ttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D

+  &= nbsp;    PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Status= =3D gtBS->AllocatePool (

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

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

+  &= nbsp;           &nbs= p; (VOID **) &Image

+  &= nbsp;           &nbs= p; );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+  Status= =3D FirmwareManagement->SetPackageInfo (

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     NULL,  // VendorCode

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if (St= atus =3D=3D EFI_SECURITY_VIOLATION) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SECURITY_VIOLATIO= N.";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_SECURITY_VIOLATION.= ";

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

+  &= nbsp;            &nb= sp; AssertionType,

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

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

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

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

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

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;            &nb= sp; Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Im= age !=3D NULL) {

+  &= nbsp; gtBS->FreePool (Image);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmw= areManagementBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/= FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestFunction.c

new file mode 1006= 44

index 00000000..99= a74aa5

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestFunction.c

@@ -0,0 +1,891= @@

+/** @file

+

+  Copyri= ght 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2016, 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+  &= nbsp; FirmwareManagementBBTestFunction.c

+

+Abstract:

+  &= nbsp; Firmware Management Protocol's function tests.

+

+--*/

+

+#define DEBUG= _ALL            = ;            &n= bsp;       0

+#define DEBUG= _GET_IMAGE_INFO          =            1

+#define DEBUG= _GET_IMAGE           = ;            &n= bsp;  0

+#define DEBUG= _GET_PACKAGE_INFO         &nbs= p;         1

+

+

+#include &quo= t;SctLib.h"

+#include &quo= t;FirmwareManagementBBTestMain.h"

+

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

+//  = ; Check Points

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

+

+EFI_STATUS

+BBTestGetImag= eInfoFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL        &= nbsp; *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetImag= eFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL        &nb= sp;   *FirmwareManagement

+  );

+

+EFI_STATUS

+BBTestGetPack= ageInfoFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  );

+

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

+//  = ; Test Cases

+//

+//

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

+

+/*=

+EFI_STATUS

+BBTestUnitTes= t (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE            &= nbsp;           &nbs= p;         SupportHandle<= /o:p>

+  )=

+{<= /span>

+  return= EFI_SUCCESS;

+}<= /span>

+*/=

+

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

+//  = ; Test Case: GetImageInfo

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

+

+EFI_STATUS

+BBTestGetImag= eInfoFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= GetImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);=

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+// Test Case:= GetImage

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

+

+EFI_STATUS

+BBTestGetImag= eFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= GetImageFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

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

+//  = ; Test Case: GetPackageInfo

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

+ <= /span>

+EFI_STATUS

+BBTestGetPack= ageInfoFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL         &nbs= p;            &= nbsp; *This,

+  IN VOI= D            &n= bsp;            = ;            &n= bsp;  *ClientInterface,

+  IN EFI= _TEST_LEVEL          &nbs= p;            &= nbsp;      TestLevel,

+  IN EFI= _HANDLE           &n= bsp;            = ;          SupportHandle<= /o:p>

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL        = ;     *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL        &= nbsp;      *FirmwareManagement;<= /p>

+

+  //

+  // Ini= t

+  //

+

+  Firmwa= reManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;

+

+  Status= =3D gtBS->HandleProtocol (

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

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

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Cal= l check point(s)

+  //

+

+  BBTest= GetPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

<= /o:p>

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

+//  = ; Check Points

+//=

+//

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

+

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

+//  = ; Checkpoint: GetImageInfo, 1

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

+

+/**

+  This r= outine:

+  &= nbsp; - Calls function with all valid parameters.

+  &= nbsp;   The function should return EFI_SUCCESS.=

+   =  - Checks DescriptorSize is 0.

+  &= nbsp; - Checks (DescriptorCount * DescriptorSize) is <=3D ImageInfoSize.

+  &= nbsp; - Checks DescriptorVersion is =3D=3D 1.

+  &= nbsp; - Checks ImageIndex is between 1 and DescriptorCount.

+  &= nbsp; - Checks AttributesSupported has no bits set beyond bit3.<= /span>

+  &= nbsp; - Checks AttribtuesSetting has no bits set beyond bit3.

+  &= nbsp; - Checks Compatibilities bit1 thru bit15 are 0s.

+**/

+

+EFI_STATUS

+BBTestGetImag= eInfoFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

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

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

+  CHAR16=             &nb= sp;            =              &n= bsp;  *PackageVersionName;

+

+  CHAR16= *            &n= bsp;            = ;            &n= bsp;  Attribute[4];

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+

+#if (DEBUG_AL= L || DEBUG_GET_IMAGE_INFO)

+

+  CHAR16=             &nb= sp;            =             &nb= sp;   *BitField;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *BitSetting;

+

+  UINT64=             &nb= sp;            =             &nb= sp;   j;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    k;

+

+#endif

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestFunctionAssertionGuid001;=

+  Result= MessageLabel =3D L"GetImageInfo, function checkpoint #1";

+

+  Buffer= ImageInfo =3D NULL;

+  ImageI= nfo =3D NULL;

+  Packag= eVersionName =3D NULL;

+

+  Attrib= ute[0] =3D L"Image Updatable";

+  Attrib= ute[1] =3D L"Reset Required";

+  Attrib= ute[2] =3D L"Authentication Required";

+  Attrib= ute[3] =3D L"In Use";

+

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

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

+  &= nbsp;            &nb= sp;   EfiBootServicesData,

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

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

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

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

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

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

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

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

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

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

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

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

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

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

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

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

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  }=

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (St= atus =3D=3D EFI_SUCCESS) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS.";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_SUCCESS.";

+  &= nbsp; goto Exit;

+  }=

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

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

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  if (De= scriptorVersion !=3D 1) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &= nbsp; ResultMessageData =3D L"*DescriptorVersion !=3D 1.";

+  &= nbsp; goto Exit;

+  }=

+

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

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

+

+  &= nbsp; if (p->ImageIndex > DescriptorCount) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;<= /span>

+  &= nbsp;   ResultMessageData =3D L"ImageIndex is beyond Descrip= torCount.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+ <= /span>

+  &= nbsp; if ((p->AttributesSupported & 0xFFFFFFFFFFFFFFF0) !=3D 0) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;<= /span>

+  &= nbsp;   ResultMessageData =3D L"AttributesSupported has bit(= s) set beyond bit3.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+

+  &= nbsp; if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) !=3D 0) {=

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;<= /span>

+  &= nbsp;   ResultMessageData =3D L"AttributesSetting has bit(s)= set beyond bit3.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+

+  &= nbsp; if ((p->Compatibilities & 0x000000000000FFFE) !=3D0) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_WARNING;<= /span>

+  &= nbsp;   ResultMessageData =3D L"Compatibilities have bit(s) = set between bit1 and bit15.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }=

+

+#if (DEBUG_AL= L || DEBUG_GET_IMAGE_INFO)

+

+  Standa= rdLib->RecordMessage (

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

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

+  &= nbsp;           &nbs= p;  L"Firmware Image Info Header: \n"

+  &= nbsp;           &nbs= p;  L"  - *ImageInfoSize =3D %x\n"

+  &= nbsp;           &nbs= p;  L"  - *DescriptorVersion =3D %x\n"

+  &= nbsp;           &nbs= p;  L"  - *DescriptorCount =3D %x\n"<= /p>

+  &= nbsp;           &nbs= p;  L"  - *DescriptorSzie =3D %x\n"

+  &= nbsp;           &nbs= p;  L"  - *PackageVersion =3D %08x\n"=

+  &= nbsp;           &nbs= p;  L"  - **PackageVersionName =3D %s\n",

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

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

+  &= nbsp;            &nb= sp; DescriptorCount,

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

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

+  &= nbsp;           &nbs= p;  PackageVersionName

+  &= nbsp;           &nbs= p;  );

+

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

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

+  &= nbsp; StandardLib->RecordMessage (

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

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

+  &= nbsp;           &nbs= p;    L"Descriptor Index =3D %x:\n"

+  &= nbsp;            &nb= sp;   L"  - ImageTypeId =3D %08x-%04x-%04x-%02x%02= x%02x%02x%02x%02x%02x%02x",

+  &= nbsp;           &nbs= p;    p->ImageIndex,

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data1,

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data2,

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data3,

+  &= nbsp;            &nb= sp;   p->ImageTypeId.Data4[0],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[1],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[2],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[3],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[4],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[5],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[6],

+  &= nbsp;           &nbs= p;    p->ImageTypeId.Data4[7]

+  &= nbsp;           &nbs= p;    );

+  &= nbsp; StandardLib->RecordMessage (

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

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

+  &= nbsp;           &nbs= p;    L"  - ImageId =3D %016X\n"

+  &= nbsp;           &nbs= p;    L"  - *ImageIdName =3D %s\n"=

+  &= nbsp;           &nbs= p;    L"  - Version =3D %08x\n"

+  &= nbsp;           &nbs= p;    L"  - *VersionName =3D %s\n"=

+  &= nbsp;           &nbs= p;    L"  - Size =3D %x",

+  &= nbsp;           &nbs= p;    p->ImageId,

+  &= nbsp;           &nbs= p;    p->ImageIdName,

+  &= nbsp;           &nbs= p;    p->Version,

+  &= nbsp;           &nbs= p;    p->VersionName,

+  &= nbsp;           &nbs= p;    p->Size

+  &= nbsp;           &nbs= p;    );

+  &= nbsp; StandardLib->RecordMessage (

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

+   =             &nb= sp;   EFI_VERBOSE_LEVEL_QUIET,

+  &= nbsp;           &nbs= p;    L"  - AttributesSupported =3D %016x\n"<= o:p>

+  &= nbsp;           &nbs= p;    L"  - AttributesSetting   =3D %016= x",

+  &= nbsp;           &nbs= p;    p->AttributesSupported,

+  &= nbsp;           &nbs= p;    p->AttributesSetting

+  &= nbsp;            &nb= sp;   );

+  &= nbsp; for (j =3D 1, k =3D 0; j <=3D IMAGE_ATTRIBUTE_IN_USE; j =3D SctLSh= iftU64(j, 1), k++) {

+  &= nbsp;   BitField =3D Attribute[k];

+  &= nbsp;   if ((p->AttributesSupported & j) !=3D j) {

+  &= nbsp;     BitSetting =3D L"Not Supported";

+  &= nbsp;   } else if ((p->AttributesSetting & j) =3D=3D j) {<= o:p>

+  &= nbsp;     BitSetting =3D L"Yes";

+  &= nbsp;   } else {

+  &= nbsp;     BitSetting =3D L"No";

+  &= nbsp;   }

+  &= nbsp;   StandardLib->RecordMessage (

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

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

+  &= nbsp;           &nbs= p;      L"    - %s =3D %s"= ;,

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

+  &= nbsp;           &nbs= p;      BitSetting

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; }

+  &= nbsp; StandardLib->RecordMessage (

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

+  &= nbsp;            &nb= sp;   EFI_VERBOSE_LEVEL_QUIET,

+  &= nbsp;           &nbs= p;    L"  - Compatibilities =3D %016x\n",

+  &= nbsp;           &nbs= p;    p->Compatibilities

+  &= nbsp;           &nbs= p;    );

+  }=

+

+#endif

+

+  //

+  // Rep= ort the checkpoint result

+  //

+

+

+Exit:

+  Standa= rdLib->RecordAssertion (

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

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

+  &= nbsp;           &nbs= p;  TestGuid,

+  &= nbsp;           &nbs= p;  ResultMessageLabel,

+  &= nbsp;           &nbs= p;  L"Result - %s\n%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  ResultMessageData,

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+

+  return= EFI_SUCCESS;

+} =

+

+// **********= ******************************************************************

+//  = ; Checkpoint: GetImage, 1

+// **********= ******************************************************************

+

+/**

+  This r= outine:

+  &= nbsp; - Calls function with all valid parameters.

+  &= nbsp;   The function should return EFI_SUCCESS or EFI_UNSUPPORTED= .

+**/

+

+EFI_STATUS

+BBTestGetImag= eFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *BufferImageInfo;

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *BufferImage;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageInfoSize;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *ImageInfo;

+  UINT32=             &nb= sp;            =             &nb= sp;   DescriptorVersion;

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorCount;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    DescriptorSize;

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersion;

+  CHAR16=             &nb= sp;            =              &n= bsp;  *PackageVersionName;

+

+  VOID&n= bsp;            = ;            &n= bsp;            = ;     *Image;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    ImageSize;

+

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    i;

+  EFI_FI= RMWARE_IMAGE_DESCRIPTOR        &nbs= p;         *p;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    FunctionTested;

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestFunctionAssertionGuid002;=

+  Result= MessageLabel =3D L"GetImage, function checkpoint #1";<= /span>

+

+  Buffer= ImageInfo =3D NULL;

+  Buffer= Image =3D NULL;

+  ImageI= nfo =3D NULL;

+  Image = = =3D NULL;

+  Packag= eVersionName =3D NULL;

+  Functi= onTested =3D 0;

+

+  // Use= a sufficiently large buffer to obtain EFI_SUCCESS,

+  // sin= ce some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.=

+  // Che= ck for EFI_BUFFER_TOO_SMALL in another conformance test.<= /p>

+

+  ImageI= nfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;

+  Status= =3D gtBS->AllocatePool (

+  &= nbsp;           &nbs= p;    EfiBootServicesData,

+  &= nbsp;           &nbs= p;    ImageInfoSize,

+  &= nbsp;           &nbs= p;    (VOID **) &ImageInfo

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR (Status)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"test case initialization failure.";=

+  &= nbsp; goto Exit;

+  }=

+

+  Status= =3D FirmwareManagement->GetImageInfo (

+  &= nbsp;           &nbs= p;            &= nbsp;     FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;     &ImageInfoSize,

+  &= nbsp;           &nbs= p;            &= nbsp;     ImageInfo,

+  &= nbsp;           &nbs= p;            &= nbsp;     &DescriptorVersion,

+  &= nbsp;           &nbs= p;            &= nbsp;     &DescriptorCount,

+  &= nbsp;           &nbs= p;            &= nbsp;     &DescriptorSize,

+   =             &nb= sp;            =      &PackageVersion,

+  &= nbsp;           &nbs= p;            &= nbsp;     &PackageVersionName

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+  if (St= atus =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp; gtBS->FreePool (ImageInfo);

+  &= nbsp; Status =3D gtBS->AllocatePool (

+  &= nbsp;            &nb= sp;     EfiBootServicesData,

+  &= nbsp;           &nbs= p;      ImageInfoSize,

+  &= nbsp;           &nbs= p;      (VOID **) &ImageInfo=

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; Status =3D FirmwareManagement->GetImageInfo (

+  &= nbsp;           &nbs= p;            &= nbsp;       FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageInfoSize,

+  &= nbsp;           &nbs= p;            &= nbsp;       ImageInfo,

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorVersion,

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorCount,<= /span>

+  &= nbsp;           &nbs= p;            &= nbsp;       &DescriptorSize,

+  &= nbsp;           &nbs= p;            &= nbsp;       &PackageVersion,

+  &= nbsp;           &nbs= p;            &= nbsp;       &PackageVersionName

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; if (Status !=3D EFI_SUCCESS) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   BufferImageInfo =3D ImageInfo;

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  }

+  Buffer= ImageInfo =3D ImageInfo;

+

+  if (De= scriptorSize =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"*DescriptorSize is 0.";<= /span>

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+  if ((D= escriptorCount * DescriptorSize) > ImageInfoSize) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize))= > *ImageInfoSize.";

+  &= nbsp; goto Exit;  // Note the Status =3D EFI_SUCCESS=

+  } = ;

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  for (i= =3D 0; i < DescriptorCount; i++) {

+  &= nbsp; p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + = (i * DescriptorSize));

+

+  &= nbsp; if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_= REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED) &&

+  &= nbsp;     ((p->AttributesSetting & IMAGE_ATTRIBU= TE_AUTHENTICATION_REQUIRED) =3D=3D

+  &= nbsp;       IMAGE_ATTRIBUTE_AUTHENTICATION_RE= QUIRED)) {

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if (p->Size =3D=3D 0) {

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE)= !=3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &= nbsp;   continue;

+  &= nbsp; }

+  &= nbsp; if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != = =3D IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; ImageSize =3D p->Size;

+  &= nbsp; Status =3D gtBS->AllocatePool (

+  &= nbsp;           &nbs= p;      EfiBootServicesData,

+  &= nbsp;           &nbs= p;      ImageSize,

+  &= nbsp;           &nbs= p;      (VOID **) &Image

+  &= nbsp;           &nbs= p;      );

+  &= nbsp; if (EFI_ERROR (Status)) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"test case initialization fai= lure.";

+  &= nbsp;   goto Exit;

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+

+  &= nbsp; FunctionTested++;

+  &= nbsp; Status =3D FirmwareManagement->GetImage (

+  &= nbsp;           &nbs= p;            &= nbsp;       FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

+  &= nbsp;           &nbs= p;            &= nbsp;       Image,

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+

+  &= nbsp; if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {

+  &= nbsp;   gtBS->FreePool (Image);

+  &= nbsp;   Status =3D gtBS->AllocatePool (

+  &= nbsp;           &nbs= p;        EfiBootServicesData,

+  &= nbsp;           &nbs= p;        ImageSize,

+  &= nbsp;           &nbs= p;        (VOID **) &Image

+  &= nbsp;           &nbs= p;        );

+  &= nbsp;   if (EFI_ERROR (Status)) {

+  &= nbsp;     AssertionType =3D EFI_TEST_ASSERTION_FAILED;<= o:p>

+  &= nbsp;     ResultMessageData =3D L"test case initia= lization failure.";

+  &= nbsp;     goto Exit;

+  &= nbsp;   }

+  &= nbsp; }

+  &= nbsp; BufferImage =3D Image;

+

+  &= nbsp; Status =3D FirmwareManagement->GetImage (

+  &= nbsp;            &nb= sp;            =        FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;       p->ImageIndex,

+  &= nbsp;           &nbs= p;            &= nbsp;       Image,

+  &= nbsp;           &nbs= p;            &= nbsp;       &ImageSize<= /p>

+  &= nbsp;           &nbs= p;            &= nbsp;       );

+  &= nbsp; gtBS->FreePool (BufferImage);

+  &= nbsp; BufferImage =3D NULL;

+  &= nbsp; Image =3D NULL;

+

+  &= nbsp; //

+  &= nbsp; // Report the checkpoint result

+  &= nbsp; //

+

+  &= nbsp; if ((Status !=3D EFI_SUCCESS) && (Status !=3D EFI_UNSUPPORTED= )) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;   ResultMessageData =3D L"failed to return EFI_SUCCESS= or EFI_UNSUPPORTED.";

+  &= nbsp;   goto Exit; 

+  &= nbsp; }

+  }=

+

+  if (Fu= nctionTested =3D=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"test skipped - test case does not apply.= ";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UN= SUPPORTED.";

+  }=

+

+Exit:

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;            &nb= sp; StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  TestGuid,

+  &= nbsp;           &nbs= p;  ResultMessageLabel,

+  &= nbsp;           &nbs= p;  L"Result - %s\n%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  ResultMessageData,

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+  if (Bu= fferImageInfo !=3D NULL) {

+  &= nbsp; gtBS->FreePool (BufferImageInfo);

+  }=

+  if (Bu= fferImage !=3D NULL) {

+  &= nbsp;   gtBS->FreePool (BufferImage);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

+// **********= ******************************************************************

+//  = ; Checkpoint: GetPackageInfo, 1

+// **********= ******************************************************************

+

+/**

+  This r= outine:

+  &= nbsp; - Calls function with all valid parameters.

+  &= nbsp;   The function should return EFI_SUCCESS or EFI_UNSUPPORTED= .

+  &= nbsp; - Checks AttributesSupported has no bits set beyond bit2.<= /span>

+  &= nbsp; - Checks AttributesSetting has no bits set beyond bit2.

+**/

+

+EFI_STATUS

+BBTestGetPack= ageInfoFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp;  *StandardLib,

+  IN EFI= _FIRMWARE_MANAGEMENT_PROTOCOL       &nbs= p;    *FirmwareManagement

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

+  EFI_GU= ID            &= nbsp;           &nbs= p;            &= nbsp; TestGuid;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageLabel;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *ResultMessageData;

+

+  UINT32=             &nb= sp;            =              &n= bsp;  PackageVersion;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *PackageVersionName;

+  UINT32=             &nb= sp;            =             &nb= sp;   PackageVersionNameMaxLen;

+  UINT64=             &nb= sp;            =             &nb= sp;   AttributesSupported;

+  UINT64=              &n= bsp;            = ;            &n= bsp;  AttributesSetting;

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p; 

+  CHAR16= *            &n= bsp;            = ;            &n= bsp;  Attribute[3];

+

+#if (DEBUG_AL= L || DEBUG_GET_PACKAGE_INFO)

+

+  CHAR16=             &nb= sp;             = ;            &n= bsp;  *BitField;

+  CHAR16=             &nb= sp;            =             &nb= sp;   *BitSetting;

+

+  UINT64=             &nb= sp;            =             &nb= sp;   j;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    k;

+

+#endif

+

+  //

+  // Ini= t

+  //

+

+  Status= =3D EFI_SUCCESS;

+  Assert= ionType =3D EFI_TEST_ASSERTION_PASSED;

+  TestGu= id =3D gFirmwareManagementBBTestFunctionAssertionGuid003;=

+  Result= MessageLabel =3D L"GetPackageInfo, function checkpoint #1";<= /o:p>

+

+  Packag= eVersionName =3D NULL;

+

+  Attrib= ute[0] =3D L"Version Updatable";

+  Attrib= ute[1] =3D L"Reset Required";

+  Attrib= ute[2] =3D L"Authentication Required";

+

+  //

+  // Che= ck the data returned by the function

+  //

+

+  Status= =3D FirmwareManagement->GetPackageInfo (

+  &= nbsp;           &nbs= p;            &= nbsp;     FirmwareManagement,

+  &= nbsp;           &nbs= p;            &= nbsp;     &PackageVersion,

+  &= nbsp;           &nbs= p;            &= nbsp;     &PackageVersionName,

+  &= nbsp;           &nbs= p;            &= nbsp;     &PackageVersionNameMaxLen,

+  &= nbsp;           &nbs= p;            &= nbsp;     &AttributesSupported,

+  &= nbsp;           &nbs= p;             =      &AttributesSetting

+  &= nbsp;           &nbs= p;            &= nbsp;     );

+

+  if ((S= tatus =3D=3D EFI_SUCCESS) || (Status =3D=3D EFI_UNSUPPORTED)) {<= /span>

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; ResultMessageData =3D L"correctly returned EFI_SUCCESS or EFI_UN= SUPPORTED.";

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSU= PPORTED.";

+  &= nbsp; goto Exit;

+  }=

+

+#if (DEBUG_AL= L || DEBUG_GET_PACKAGE_INFO)

+

+  Standa= rdLib->RecordMessage (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  EFI_VERBOSE_LEVEL_QUIET,

+  &= nbsp;           &nbs= p;  L"Firmware Package Info: \n"

+  &= nbsp;           &nbs= p;  L"  - *PackageVersion =3D %08x\n"=

+  &= nbsp;           &nbs= p;  L"  - **PackageVersionName =3D %s\n"

+  &= nbsp;           &nbs= p;  L"  - *PackageVersionNameMaxLen =3D %08x",

+  &= nbsp;           &nbs= p;  PackageVersion,

+  &= nbsp;           &nbs= p;  PackageVersionName,

+  &= nbsp;           &nbs= p;  PackageVersionNameMaxLen

+  &= nbsp;           &nbs= p; );

+  Standa= rdLib->RecordMessage (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  EFI_VERBOSE_LEVEL_QUIET,

+  &= nbsp;           &nbs= p;  L"  - *AttributesSupported =3D %016x\n"<= /span>

+  &= nbsp;           &nbs= p;  L"  - *AttributesSetting   =3D %016x",

+  &= nbsp;           &nbs= p;  AttributesSupported,

+  &= nbsp;           &nbs= p;  AttributesSetting

+  &= nbsp;           &nbs= p;  );

+  for (j= =3D 1, k =3D 0; j <=3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED; j =3D= SctLShiftU64(j, 1), k++) {

+  &= nbsp; BitField =3D Attribute[k];

+  &= nbsp; if ((AttributesSupported & j) !=3D j) {

+  &= nbsp;   BitSetting =3D L"Not Supported";

+  &= nbsp; } else if ((AttributesSetting & j) =3D=3D j) {<= /p>

+  &= nbsp;   BitSetting =3D L"Yes";

+  &= nbsp; } else {

+  &= nbsp;   BitSetting =3D L"No";

+  &= nbsp; }

+  &= nbsp; StandardLib->RecordMessage (

+  &= nbsp;           &nbs= p;    StandardLib,

+  &= nbsp;            &nb= sp;   EFI_VERBOSE_LEVEL_QUIET,

+  &= nbsp;           &nbs= p;    L"    - %s =3D %s",

+  &= nbsp;           &nbs= p;    BitField,

+  &= nbsp;           &nbs= p;    BitSetting

+  &= nbsp;           &nbs= p;    );

+  }=

+

+#endif

+

+  if ((A= ttributesSupported & 0xFFFFFFFFFFFFFFF8) !=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &= nbsp; ResultMessageData =3D L"*AttributesSupported has bit(s) set beyo= nd bit2.";

+  &= nbsp; goto Exit;

+  }=

+

+  if ((A= ttributesSetting & 0xFFFFFFFFFFFFFFF8) !=3D 0) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  &= nbsp; ResultMessageData =3D L"*AttributesSetting has bit(s) set beyond= bit2.";

+  &= nbsp; goto Exit;

+  }=

+

+  //

+  // Rep= ort the checkpoint result

+  //

+ <= /span>

+Exit:

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;            &nb= sp; StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  TestGuid,

+  &= nbsp;           &nbs= p;  ResultMessageLabel,

+  &= nbsp;           &nbs= p;  L"Result - %s\n%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  ResultMessageData,

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  if (Pa= ckageVersionName !=3D NULL) {

+  &= nbsp; gtBS->FreePool (PackageVersionName);

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmw= areManagementBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Firm= wareManagement/BlackBoxTest/FirmwareManagementBBTestMain.c

new file mode 1006= 44

index 00000000..3c= e62795

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestMain.c

@@ -0,0 +1,228= @@

+/** @file

+

+  Copyri= ght 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2017, 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+

+  Firmwa= reManagementBBTestMain.c

+

+Abstract:

+

+  Firmwa= re Management Protocol test driver.

+

+--*/

+

+#include &quo= t;SctLib.h"

+#include &quo= t;FirmwareManagementBBTestMain.h"

+

+// **********= ******************************************************************

+//  = ; Variables

+// **********= ******************************************************************

+

+EFI_HANDLE mI= mageHandle;

+

+EFI_BB_TEST_P= ROTOCOL *gBBTestProtocolInterface;

+

+EFI_BB_TEST_P= ROTOCOL_FIELD gBBTestProtocolField =3D {

+  EFI_FI= RMWARE_MANAGEMENT_PROTOCOL_TEST_REVISION,

+  IHV_EF= I_FIRMWARE_MANAGEMENT_PROTOCOL_GUID,

+  L"= ;Firmware Management Protocol Test",

+  L"= ;UEFI 2.3 Firmware Management Protocol Black-Box Test"

+};=

+

+EFI_GUID gSup= portProtocolGuid[] =3D {

+  EFI_ST= ANDARD_TEST_LIBRARY_GUID,

+  EFI_NU= LL_GUID

+};=

+

+EFI_BB_TEST_E= NTRY_FIELD gBBTestEntryField[] =3D {

+  /*

+  //Use = for unit test only

+  {=

+  &= nbsp; { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0= xb0, 0x6d } },

+  &= nbsp;           L"Un= it Test Only",

+  &= nbsp;           L"Ve= rify the Assistant Function",

+  &= nbsp; EFI_TEST_LEVEL_DEFAULT,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestUnitTest

+  },

+  */

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101,

+  &= nbsp; L"Function_Test-GetImageInfo",

+  &= nbsp; L"Function auto test for Firmware Management Protocol GetImageIn= fo().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetImageInfoFunctionTest

+  },

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102,

+  &= nbsp; L"Function_Test-GetImage",

+  &= nbsp; L"Function auto test for Firmware Management Protocol GetImage()= .",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetImageFunctionTest

+  },

+/*++<= o:p>

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103,

+  &= nbsp; L"Function Test - SetImage",

+  &= nbsp; L"Function auto test for Firmware Management Protocol SetImage()= .",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestSetImageFunctionTest

+  },

+--*/

+/*++<= o:p>

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104,

+  &= nbsp; L"Function Test - CheckImage",

+  &= nbsp; L"Function auto test for Firmware Management Protocol CheckImage= ().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestCheckImageFunctionTest

+  },

+--*/

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105,

+  &= nbsp; L"Function_Test-GetPackageInfo",

+  &= nbsp; L"Function auto test for Firmware Management Protocol GetPackage= Info().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetPackageInfoFunctionTest

+  },

+/*++<= o:p>

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106,

+  &= nbsp; L"Function Test - SetPackageInfo",

+  &= nbsp; L"Function auto test for Firmware Management Protocol SetPackage= Info().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestSetPackageInfoFunctionTest

+  },

+--*/ 

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201,

+  &= nbsp; L"Conformance_Test-GetImageInfo",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol GetImag= eInfo().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetImageInfoConformanceTest

+  },

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202,

+  &= nbsp; L"Conformance_Test-GetImage",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol GetImag= e().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetImageConformanceTest

+  },

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203,

+  &= nbsp; L"Conformance_Test-SetImage",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol SetImag= e().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestSetImageConformanceTest

+  },

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204,

+  &= nbsp; L"Conformance_Test-CheckImage",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol CheckIm= age().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestCheckImageConformanceTest

+  },

+/*++<= o:p>

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205,

+  &= nbsp; L"Conformance Test - GetPackageInfo",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol GetPack= ageInfo().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestGetPackageInfoConformanceTest

+  },

+--*/

+  {=

+  &= nbsp; EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206,

+  &= nbsp; L"Conformance_Test-SetPackageInfo",

+  &= nbsp; L"Conformance auto test for Firmware Management Protocol SetPack= ageInfo().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestSetPackageInfoConformanceTest

+  },

+  0=

+};=

+

+// **********= ******************************************************************

+//  = ; Initialization and Unload functions

+// **********= ******************************************************************

+

+

+EFI_STATUS

+EFIAPI

+InitializeFir= mwareManagementBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle,

+  IN EFI= _SYSTEM_TABLE          &n= bsp;  *SystemTable

+  )=

+{<= /span>

+  EfiIni= tializeTestLib (ImageHandle, SystemTable);

+

+  //

+  // ini= tialize test utility lib

+  //

+

+  SctIni= tializeLib (ImageHandle, SystemTable);

+

+  mImage= Handle =3D ImageHandle;

+

+  return= EfiInitAndInstallIHVBBTestInterface (

+  &= nbsp;        &ImageHandle,

+  &= nbsp;        &gBBTestProtocolField,<= o:p>

+  &= nbsp;        gBBTestEntryField,

+  &= nbsp;        UnloadFirmwareManagementBBT= est,

+  &= nbsp;        &gBBTestProtocolInterfa= ce

+  &= nbsp;        );

+}<= /span>

+

+EFI_STATUS

+EFIAPI

+UnloadFirmwar= eManagementBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle

+  )=

+{<= /span>

+  return= EfiUninstallAndFreeIHVBBTestInterface (

+  &= nbsp;        ImageHandle,

+  &= nbsp;        gBBTestProtocolInterface

+  &= nbsp;        );

+}<= /span>

+

+// **********= ******************************************************************

+//  = ; Support functions

+// **********= ******************************************************************

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Firmw= areManagementBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Firm= wareManagement/BlackBoxTest/FirmwareManagementBBTestMain.h

new file mode 1006= 44

index 00000000..92= ac3e45

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= FirmwareManagementBBTestMain.h

@@ -0,0 +1,223= @@

+/** @file

+

+  Copyri= ght 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2017, 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+

+  Firmwa= reManagementBBTestMain.h

+

+Abstract:

+

+  Header= file for Firmware Management Protocol test driver.

+

+--*/

+

+#ifndef _FIRM= WARE_MANAGEMENT_BB_TEST_MAIN

+#define _FIRM= WARE_MANAGEMENT_BB_TEST_MAIN

+

+#include &quo= t;Efi.h"

+#include &quo= t;Guid.h"

+#include <= Library/EfiTestLib.h>

+

+#include <= UEFI/Protocol/FirmwareManagement.h>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_REVISION    0x00010000=

+

+#define IHV_E= FI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \

+{ 0x941d02a8,= 0x49ad, 0x4bda, { 0x9f, 0xae, 0x0a, 0x69, 0x24, 0x54, 0x1c, 0x88 } }<= /o:p>

+// **********= ******************************************************************

+//  = ; Entry GUIDs for Function Test

+// **********= ******************************************************************

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101 \

+{ 0x7ddddd57,= 0x68ff, 0x460e, { 0x90, 0xad, 0xa9, 0xd5, 0xf1, 0xf0, 0xa0, 0x87 } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102 \

+{ 0x5b4c24b2,= 0x852d, 0x418a, { 0x82, 0x34, 0xc2, 0xc8, 0x63, 0x5e, 0x9a, 0x2a } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103 \

+{ 0x84062e44,= 0xdaee, 0x41a5, { 0x94, 0xf8, 0x6d, 0xe0, 0x72, 0x9b, 0xfa, 0xb4 } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104 \

+{ 0xdeb26021,= 0xca4e, 0x4876, { 0x90, 0x99, 0xca, 0x7d, 0x77, 0x2c, 0x90, 0x1d } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105 \

+{ 0xaa160ecc,= 0xfc2f, 0x4f05, { 0xac, 0x20, 0x4c, 0xed, 0x45, 0xde, 0xda, 0xab } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106 \

+{ 0x7a9a2714,= 0xf32b, 0x4083, { 0x90, 0xf2, 0x12, 0x51, 0x1a, 0x87, 0x48, 0x1a } }<= /o:p>

+

+// **********= ******************************************************************

+//  = ; Entry GUIDs for Conformance Test

+// **********= ******************************************************************

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201 \

+{ 0x54ee347c,= 0x10a3, 0x4311, { 0x94, 0x27, 0xa8, 0x97, 0xbf, 0xdc, 0x98, 0x8 } }

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202 \

+{ 0x68aba93c,= 0x1d0c, 0x412f, { 0xb1, 0xe, 0xe3, 0xa4, 0x6, 0xbc, 0x42, 0xcf } }

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203 \

+{ 0x12834a23,= 0x6cef, 0x478e, { 0xaf, 0x48, 0x44, 0xe5, 0x93, 0x40, 0xab, 0xe8 } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204 \

+{ 0xc6dc94b1,= 0xb81b, 0x4b85, { 0x8b, 0x7d, 0x8f, 0xbf, 0xa6, 0x8e, 0xf3, 0xe5 } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205 \

+{ 0x3d13f23d,= 0x8306, 0x49d4, { 0xa0, 0xe0, 0x9a, 0x9b, 0xf6, 0x89, 0x40, 0x3c } }<= /o:p>

+

+#define EFI_F= IRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206 \

+{ 0x24cf9ac2,= 0x9abc, 0x4f5c, { 0x9c, 0x7a, 0xbc, 0x22, 0x29, 0xc3, 0x2, 0x7f } }

+

+// **********= ******************************************************************

+//  = ; Initializaiton and Unload functions

+// **********= ******************************************************************

+

+EFI_STATUS

+EFIAPI

+InitializeFir= mwareManagementBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle,

+  IN EFI= _SYSTEM_TABLE          &n= bsp;  *SystemTable

+  );

<= /o:p>

+EFI_STATUS

+EFIAPI

+UnloadFirmwar= eManagementBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle

+  );

<= /o:p>

+//=

+// Test Cases= - Unit Test

+//=

+

+/*=

+EFI_STATUS

+BBTestUnitTes= t (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+*/=

+

+//=

+// Test Cases= - Function

+//=

+

+EFI_STATUS

+BBTestGetImag= eInfoFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestGetImag= eFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestSetImag= eFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestCheckIm= ageFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE            &= nbsp;    SupportHandle

+  );

+

+EFI_STATUS

+BBTestGetPack= ageInfoFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+//=

+// Test Cases= - Conformance

+//=

+

+EFI_STATUS

+BBTestGetImag= eInfoConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestGetImag= eConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestSetImag= eConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestCheckIm= ageConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestGetPack= ageInfoConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+

+EFI_STATUS

+BBTestSetPack= ageInfoConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     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/FirmwareManagement/BlackBoxT= est/Guid.c

new file mode 1006= 44

index 00000000..c3= 3d5b79

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= Guid.c

@@ -0,0 +1,63 = @@

+/** @file

+

+  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>

+**/

+/*++<= o:p>

+

+ Module Name:=

+

+   = Guid.c

+

+ Abstract:

+

+   = GUIDs auto-generated for EFI test assertion.

+

+--*/

+

+#include &quo= t;Efi.h"

+#include &quo= t;Guid.h"

+

+// **********= ******************************************************************

+//  = ; Function

+// **********= ******************************************************************

+

+EFI_GUID gFir= mwareManagementBBTestFunctionAssertionGuid001=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTFUNCTION_ASSERTION_001_GUID;

+EFI_GUID gFir= mwareManagementBBTestFunctionAssertionGuid002=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTFUNCTION_ASSERTION_002_GUID;

+EFI_GUID gFir= mwareManagementBBTestFunctionAssertionGuid003=3DEFI_TEST_FIRMWAREMANAGEMENT= BBTESTFUNCTION_ASSERTION_003_GUID;

+

+// **********= ******************************************************************

+//  = ; Conformance

+// **********= ******************************************************************

+

+EFI_GUID gFir= mwareManagementBBTestConformanceSupportGuid001=3DEFI_TEST_FIRMWAREMANAGEMEN= TBBTESTCONFORMANCE_SUPPORT_001_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceSupportGuid002=3DEFI_TEST_FIRMWAREMANAGEMEN= TBBTESTCONFORMANCE_SUPPORT_002_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceSupportGuid003=3DEFI_TEST_FIRMWAREMANAGEMEN= TBBTESTCONFORMANCE_SUPPORT_003_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceSupportGuid004=3DEFI_TEST_FIRMWAREMANAGEMEN= TBBTESTCONFORMANCE_SUPPORT_004_GUID;

+

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid001=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_001_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid002=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_002_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid003=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_003_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid004=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_004_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid005=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_005_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid006=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_006_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid007=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_007_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid008=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_008_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid009=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_009_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid010=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_010_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid011=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_011_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid012=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_012_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid013=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_013_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid014=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_014_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid015=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_ASSERTION_015_GUID;

+EFI_GUID gFir= mwareManagementBBTestConformanceAssertionGuid016=3DEFI_TEST_FIRMWAREMANAGEM= ENTBBTESTCONFORMANCE_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/FirmwareManagement/BlackBoxT= est/Guid.h

new file mode 1006= 44

index 00000000..d2= b2e51d

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= Guid.h

@@ -0,0 +1,153= @@

+/** @file

+

+  Copyri= ght 2006 - 2010 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010, 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>

+**/

+/*++<= o:p>

+

+ Module Name:=

+

+   = Guid.h

+

+ Abstract:

+

+   = GUIDs auto-generated for EFI test assertion.

+

+--*/

+

+// **********= ******************************************************************

+//  = ; Function

+// **********= ******************************************************************

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID \=

+{ 0xd02b40ae,= 0x62f, 0x4155, { 0xbb, 0xdd, 0x4, 0x29, 0x18, 0x94, 0xea, 0x31 } }

+

+extern EFI_GU= ID gFirmwareManagementBBTestFunctionAssertionGuid001;

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID \=

+{ 0xff704c46,= 0x3999, 0x4a28, { 0xa3, 0x6e, 0x76, 0x8a, 0xb6, 0xad, 0x89, 0xd8 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestFunctionAssertionGuid002;

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID \=

+{ 0x70884539,= 0x9a34, 0x4146, { 0x83, 0x3a, 0x4d, 0x89, 0x8b, 0x9c, 0x7e, 0xa4 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestFunctionAssertionGuid003;

+

+// **********= ******************************************************************

+//  = ; Conformance - Function Support Check

+// **********= ******************************************************************

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID \

+{ 0xd9c7d018,= 0x60ba, 0x448d, { 0xb1, 0x3b, 0x88, 0x8b, 0x41, 0xd9, 0xdc, 0x9 } };<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceSupportGuid001;

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID \

+{ 0x28310f16,= 0x690e, 0x44a5, { 0x93, 0x98, 0xe1, 0xcd, 0x6a, 0xb3, 0xe1, 0x61 } };=

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceSupportGuid002;

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID \

+{ 0x92cc940a,= 0xdcf8, 0x42a0, { 0x81, 0xa1, 0xd7, 0xdd, 0x43, 0x87, 0xbf, 0x6d } };=

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceSupportGuid003;

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID \

+{ 0x3f910041,= 0xcd4d, 0x4b36, { 0xb2, 0x23, 0xfb, 0x16, 0x4e, 0x7e, 0x6a, 0x8c } };=

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceSupportGuid004;

+

+// **********= ******************************************************************

+//  = ; Conformance - Assertion

+// **********= ******************************************************************

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID \

+{ 0x3789b80e,= 0xab70, 0x4dc9, { 0xbb, 0xbd, 0x70, 0x63, 0x76, 0x36, 0xab, 0x52 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid001;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID \

+{ 0xca1d7706,= 0x256b, 0x464e, { 0xb6, 0xee, 0x50, 0x34, 0x1e, 0xec, 0x3c, 0x83 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid002;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID \

+{ 0x3c8d87b2,= 0x6a89, 0x4a6c, { 0xbc, 0x75, 0xe6, 0x86, 0xa1, 0x49, 0x13, 0xf0 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid003;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID \

+{ 0x88031c96,= 0x99bf, 0x4d2c, { 0x9f, 0x57, 0xa7, 0x2, 0x6a, 0xbc, 0xd3, 0x51 } }

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid004;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID \

+{ 0x7a386361,= 0x3a5d, 0x4e58, { 0x8a, 0x51, 0x4d, 0x93, 0xb6, 0x55, 0x95, 0xf4 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid005;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID \

+{ 0xd6a77629,= 0x5afd, 0x4854, { 0x87, 0xc8, 0xee, 0x9f, 0xc5, 0x3d, 0xbe, 0x3d } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid006;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID \

+{ 0x4ea24764,= 0xa6b1, 0x43b5, { 0xb8, 0xa0, 0xd3, 0x3f, 0xdc, 0x8b, 0xc6, 0xe4 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid007;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID \

+{ 0x712ce1e9,= 0x80d1, 0x4168, { 0xb8, 0xd0, 0x74, 0xd1, 0x72, 0x7a, 0x2f, 0x25 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid008;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID \

+{ 0xc82d1373,= 0x1f87, 0x45f4, { 0xaf, 0xfc, 0x10, 0xa7, 0xf7, 0xb0, 0x9c, 0xb0 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid009;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID \

+{ 0x2410a859,= 0xdf6f, 0x4857, { 0x92, 0x4a, 0x26, 0x37, 0x7, 0x11, 0xf, 0x1c } }

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid010;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID \

+{ 0x3987172c,= 0xe6a0, 0x4099, { 0xb1, 0x2b, 0xd8, 0xef, 0xf2, 0x62, 0x75, 0x93 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid011;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID \

+{ 0xd6dad28e,= 0x7f0f, 0x4f56, { 0x9a, 0x93, 0x14, 0x7d, 0xb3, 0x74, 0x0, 0xc9 } }

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid012;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID \

+{ 0xb5288fc3,= 0xe906, 0x4468, { 0x83, 0x3d, 0xd4, 0xa6, 0x58, 0xa5, 0x4f, 0xbd } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid013;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID \

+{ 0x57355301,= 0x1343, 0x497f, { 0xbe, 0xe0, 0x8e, 0x5c, 0x27, 0xd2, 0x40, 0x25 } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid014;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID \

+{ 0xadeab82d,= 0x7592, 0x40fe, { 0x87, 0xa8, 0x93, 0x2b, 0xad, 0x97, 0xff, 0x5e } }<= /o:p>

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid015;<= /p>

+

+#define EFI_T= EST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID \

+{ 0x9be658d2,= 0x1312, 0x4254, { 0x91, 0x10, 0x59, 0x0, 0xd5, 0xfd, 0x6c, 0x6c } }

+

+extern EFI_GU= ID gFirmwareManagementBBTestConformanceAssertionGuid016;<= /p>

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFi= rmwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/Fir= mwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf

new file mode 1006= 44

index 00000000..75= 66a044

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/= IhvFirmwareManagementBBTest.inf

@@ -0,0 +1,52 = @@

+## @file=

+#<= /span>

+#  Copyr= ight 2006 - 2012 Unified EFI, Inc.<BR>

+#  Copyr= ight (c) 2010 - 2012, Dell Inc.  All rights reserved.<BR>

+#<= /span>

+#  This = program and the accompanying materials

+#  are l= icensed and made available under the terms and conditions of the BSD Licens= e

+#  which= accompanies this distribution.  The full text of the license may be f= ound at

+#  http:= //opensource.org/licenses/bsd-license.php

+# =

+#  THE P= ROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,<= o:p>

+#  WITHO= UT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+# =

+##=

+#/*++=

+#<= /span>

+# Module Name= :

+#<= /span>

+#  = FirmwareManagementBBTest.inf

+#<= /span>

+# Abstract:

+#<= /span>

+#  = Component description file for IHV Firmware Management Protocol Black-Box = Test.

+#<= /span>

+#--*/

+

+[defines]

+  INF_VE= RSION          =3D 0x00010005<= o:p>

+  BASE_N= AME            =3D I= hvFirmwareManagementBBTest

+  FILE_G= UID            =3D D= B0E842F-201B-4D47-BA74-88602A41C9D2

+  MODULE= _TYPE          =3D UEFI_DRIVER=

+  COMPON= ENT_TYPE       =3D BS_DRIVER

+  VERSIO= N_STRING       =3D 1.0

+  ENTRY_= POINT          =3D InitializeF= irmwareManagementBBTest

+

+[sources.comm= on]

+  Firmwa= reManagementBBTestConformance.c

+  Firmwa= reManagementBBTestFunction.c

+  Firmwa= reManagementBBTestMain.c

+  Guid.c=

+

+[Packages]

+  MdePkg= /MdePkg.dec

+  SctPkg= /SctPkg.dec

+  SctPkg= /UEFI/UEFI.dec

+

+[LibraryClass= es]

+  UefiDr= iverEntryPoint

+  SctLib=

+  EfiTes= tLib

+

+[Protocols]

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c b= /uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gu= id.c

new file mode 1006= 44

index 00000000..6a= 6d4e60

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.c

@@ -0,0 +1,46 = @@

+/** @file

+

+  Copyri= ght 2006 - 2012 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2012, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+ Module Name:=

+

+   = Guid.c

+

+ Abstract:

+

+   = GUIDs auto-generated for EFI test assertion.

+

+--*/

+

+#include &quo= t;HIIConfigAccessBBTestMain.h"

+

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid001=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_001_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid002=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_002_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid003=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_003_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid004=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_004_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid005=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_005_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid006=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_006_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid007=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_007_GUID;

+/*=

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid008=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_008_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid009=3DEFI_TEST_HIICONFIGACCESSBBT= ESTCONFORMANCE_ASSERTION_009_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid0010=3DEFI_TEST_HIICONFIGACCESSBB= TESTCONFORMANCE_ASSERTION_0010_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid0011=3DEFI_TEST_HIICONFIGACCESSBB= TESTCONFORMANCE_ASSERTION_0011_GUID;

+EFI_GUID gHII= ConfigAccessBBTestConformanceAssertionGuid0012=3DEFI_TEST_HIICONFIGACCESSBB= TESTCONFORMANCE_ASSERTION_0012_GUID;

+*/=

+EFI_GUID gHII= ConfigAccessBBTestFunctionAssertionGuid001=3DEFI_TEST_HIICONFIGACCESSBBTEST= FUNCTION_ASSERTION_001_GUID;

+EFI_GUID gHII= ConfigAccessBBTestFunctionAssertionGuid002=3DEFI_TEST_HIICONFIGACCESSBBTEST= FUNCTION_ASSERTION_002_GUID;

+EFI_GUID gHII= ConfigAccessBBTestFunctionAssertionGuid003=3DEFI_TEST_HIICONFIGACCESSBBTEST= FUNCTION_ASSERTION_003_GUID;

+EFI_GUID gHII= ConfigAccessBBTestFunctionAssertionGuid004=3DEFI_TEST_HIICONFIGACCESSBBTEST= FUNCTION_ASSERTION_004_GUID;

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h b= /uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gu= id.h

new file mode 1006= 44

index 00000000..b7= 003028

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Gui= d.h

@@ -0,0 +1,109= @@

+/** @file

+

+  Copyri= ght 2006 - 2011 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2011, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+ Module Name:=

+

+   = Guid.h

+

+ Abstract:

+

+   = GUIDs auto-generated for EFI test assertion.

+

+--*/

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID \=

+{ 0xa7173eb5,= 0xf76a, 0x4ea1, { 0x95, 0xd, 0x14, 0x91, 0x1e, 0x49, 0x86, 0xc1 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid001;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \=

+{ 0xfa5973e2,= 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, 0x76 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid002;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID \=

+{ 0x6f6d1dd, = 0x49b8, 0x488a, { 0xa7, 0x75, 0xde, 0xbc, 0xc7, 0x60, 0xfd, 0x28 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid003;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID \=

+{ 0x28652613,= 0x6bf4, 0x4f42, { 0xab, 0xe2, 0x84, 0x4f, 0x2f, 0x77, 0xec, 0x2f } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid004;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID \=

+{ 0xebba197a,= 0x467f, 0x4736, { 0x92, 0xf2, 0x11, 0xb1, 0x91, 0x2e, 0xe9, 0x90 } }<= /o:p>

+

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid005;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID \=

+{ 0x341fe3e0,= 0xf688, 0x45f2, { 0x91, 0x56, 0xc7, 0xae, 0x9f, 0x2c, 0xcb, 0xb0 } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid006;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID \=

+{ 0x1f99ebc8,= 0x253, 0x455f, { 0x88, 0xac, 0x9e, 0x2b, 0xa6, 0xdc, 0xd7, 0x29 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid007;

+/*=

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID \=

+{ 0xbdec5b08,= 0x423, 0x482b, { 0xb7, 0xdf, 0xde, 0xac, 0xab, 0xf7, 0x13, 0x11 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid008;

+

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID \=

+{ 0x5fed024d,= 0x85f3, 0x45bf, { 0xbe, 0xb1, 0xe4, 0xf4, 0xcc, 0x86, 0xe5, 0x61 } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid009;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID \

+{ 0x22ee938e,= 0xa9ad, 0x4cb9, { 0x8d, 0x6d, 0x6, 0xe4, 0xfa, 0xb3, 0x72, 0xe7 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid0010;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID \

+{ 0x2053d3e0,= 0xeebe, 0x4391, { 0x84, 0x7d, 0xf4, 0x60, 0x1b, 0x30, 0x4e, 0x3 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid0011;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID \

+{ 0x81c5d7b7,= 0x7ebe, 0x44e1, { 0x8a, 0x1f, 0xcc, 0x47, 0x9c, 0x2d, 0xfe, 0x4f } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestConformanceAssertionGuid0012;

+*/=

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID \

+{ 0x24dcf8bf,= 0xbfbf, 0x4588, { 0xba, 0xf, 0x77, 0x1e, 0x24, 0x4e, 0x3e, 0x8 } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestFunctionAssertionGuid001;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID \

+{ 0x961a5268,= 0x1998, 0x4a7e, { 0x9d, 0x9d, 0xce, 0xdc, 0x67, 0xfb, 0xcc, 0x77 } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestFunctionAssertionGuid002;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID \

+{ 0x603e52f0,= 0x2ce3, 0x4e7a, { 0xa7, 0x2e, 0xdf, 0x8c, 0xa3, 0xfd, 0xb2, 0xd } }

+

+extern EFI_GU= ID gHIIConfigAccessBBTestFunctionAssertionGuid003;

+

+#define EFI_T= EST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID \

+{ 0xab163674,= 0x6c27, 0x4169, { 0xa6, 0xa9, 0xe1, 0x9c, 0x88, 0x14, 0x94, 0x96 } }<= /o:p>

+

+extern EFI_GU= ID gHIIConfigAccessBBTestFunctionAssertionGuid004;

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfi= gAccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HII= ConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c

new file mode 1006= 44

index 00000000..c8= b35003

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestConformance.c

@@ -0,0 +1,908= @@

+/** @file

+

+  Copyri= ght 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2016, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+  &= nbsp; HIIConfigAccessBBTestConformance.c

+

+Abstract:

+  &= nbsp; for EFI Driver HII Configuration Access Protocol's conformance Test

+

+--*/

+

+#include &quo= t;HIIConfigAccessBBTestMain.h"

+

+EFI_BROWSER_A= CTION  EFI_BROWSER_ACTION_UNSUPPORTED =3D 2;

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

<= /o:p>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

<= /o:p>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

<= /o:p>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  );

+/* 

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

<= /o:p>

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+*/=

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL    *This,

+  IN VOI= D            &n= bsp;       *ClientInterface,

+  IN EFI= _TEST_LEVEL          TestLevel= ,

+  IN EFI= _HANDLE           &n= bsp;  SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

+  EFI_HI= I_CONFIG_ROUTING_PROTOCOL       *HIIConfigRou= ting;

<= /o:p>

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;           &nbs= p;    &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Get= the Config Routing Protocol Interface

+  //

+  Status= =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  //Call= check points

+  //

+  BBTest= ExtractConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );

+  BBTest= ExtractConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HII= ConfigAccess );

+  BBTest= ExtractConfigConformanceTestCheckpoint3( StandardLib, HIIConfigRouting, HII= ConfigAccess );

+  BBTest= ExtractConfigConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL    *This,

+  IN VOI= D            &n= bsp;       *ClientInterface,

+  IN EFI= _TEST_LEVEL          TestLevel= ,

+  IN EFI= _HANDLE           &n= bsp;  SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

+  EFI_HI= I_CONFIG_ROUTING_PROTOCOL       *HIIConfigRou= ting;

<= /o:p>

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;            &nb= sp;   &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Get= the Config Routing Protocol Interface

+  //

+  Status= =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  //Call= check points

+  //

+  BBTest= RouteConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );=

+  BBTest= RouteConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HIICo= nfigAccess );

+  BBTest= RouteConfigConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );=

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

+/*=

+EFI_STATUS

+BBTestCallBac= kConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL    *This,

+  IN VOI= D            &n= bsp;       *ClientInterface,

+  IN EFI= _TEST_LEVEL          TestLevel= ,

+  IN EFI= _HANDLE           &n= bsp;  SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

<= /o:p>

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;           &nbs= p;    &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+   = //

+  //Call= check points

+  //

+  BBTest= CallBackConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );

+  BBTest= CallBackConformanceTestCheckpoint2( StandardLib, HIIConfigAccess );

+  BBTest= CallBackConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );

+  BBTest= CallBackConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+*/=

+

+//=

+//Check Point= s

+//=

+

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

+ <= /span>

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Resu= lts =3D NULL;

+  EFI_ST= RING            Resu= ltsPtr =3D NULL;

+  UINTN&= nbsp;           &nbs= p;    Len =3D 0;

+  CHAR16= *            &n= bsp;  Pointer =3D NULL;

+  UINT8&= nbsp;           &nbs= p;    IfMulti =3D 0;

<= /o:p>

+  EFI_ST= RING            Requ= est =3D NULL;

+  //

+  // Cal= l ExtractConfig with Request been <MultiConfigRequest>

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  NULL,

+  &= nbsp;           &nbs= p;             =   &Progress,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Results

+  &= nbsp;           &nbs= p;            &= nbsp;  );

+

+  if ( S= tatus =3D=3D EFI_SUCCESS ) {

+  &= nbsp; Len =3D SctStrLen (Results);

+  &= nbsp; //

+  &= nbsp; // Make sure the size of Request is enough to hold <MultiConfigReq= uest>

+  &= nbsp; // if original Results is not Multi

+  &= nbsp; //

+  &= nbsp; Request =3D (EFI_STRING) SctAllocateZeroPool ( 2 * Len + 2 + = 256);

+  &= nbsp; if (Request =3D=3D NULL) {

+   =              Sc= tFreePool (Results);

+   =    return EFI_OUT_OF_RESOURCES;

+  &= nbsp; }

+  } else= {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D MultiAltRespToMultiReq (Results, Request);

+  Result= sPtr =3D Request;

+

+  SctFre= ePool (Results);

+  Result= s =3D NULL;

+

+  if ( S= ctStrStr (Request, L"GUID=3D") !=3D NULL ) {

+  &= nbsp; Pointer =3D SctStrStr (Request, L"GUID=3D");

+  &= nbsp; Pointer++;

+  &= nbsp; if ( SctStrStr (Pointer, L"GUID=3D") !=3D NULL )=

+  &= nbsp;             If= Multi =3D 1;

+  }=

<= /o:p>

+  if ( I= fMulti =3D=3D 0 ) {

+  &= nbsp; SctStrCat ( Request, L"&GUID=3D970eb94aa0d449f7b980bdaa47d42= 527&NAME=3D006a0069006e0039&PATH=3D000acf&grag&star");=

+  }=

+

+  Status= =3D HIIConfigAccess->ExtractConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  Request,

+   =             &nb= sp;            =   &Progress,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Results

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( (= EFI_INVALID_PARAMETER !=3D Status) || (SctStrnCmp (Progress, L"&GU= ID=3D", 6) !=3D 0) ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestConformanceAssertionGuid001,

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() = returns EFI_INVALID_PARAMETER with Request been <MultiConfigRequest>.= ",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;        );

+  SctFre= ePool (Request);

+  return= EFI_SUCCESS;

+}<= /span>

+ <= /span>

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Requ= est =3D NULL;

+  EFI_ST= RING            Resu= lts =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+  EFI_ST= RING            Devi= cePath =3D NULL;

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;           &nbs= p;            &= nbsp;   HIIConfigRouting,

+   =             &nb= sp;            =    &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp; return Status;

+  }=

+

+  Reques= t =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp)= + 2 );

+  if (Re= quest =3D=3D NULL) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           return EF= I_OUT_OF_RESOURCES;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           gtBS->= FreePool (Request);

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Cal= l ExtractConfig with Progress been NULL

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  Request,

+  &= nbsp;            &nb= sp;            =   NULL,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Results

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestConformanceAssertionGuid002,

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() = returns EFI_INVALID_PARAMETER with Progress been NULL.",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;        );

+

+  gtBS-&= gt;FreePool (MultiConfigAltResp);

+  gtBS-&= gt;FreePool (DevicePath);

+  gtBS-&= gt;FreePool (Request);

+

+  return= EFI_SUCCESS;

+}<= /span>

+ <= /span>

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Requ= est =3D NULL;

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+  EFI_ST= RING            Devi= cePath =3D NULL;

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;            &nb= sp;            =    HIIConfigRouting,

+  &= nbsp;           &nbs= p;            &= nbsp;   &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp; return Status;

+  }=

+

+  Reques= t =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp)= + 2 );

+  if (Re= quest =3D=3D NULL) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           return EF= I_OUT_OF_RESOURCES;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           gtBS->= FreePool (Request);

+  &= nbsp; return Status;

+  }=

+  //

+  // Cal= l ExtractConfig with Results been NULL

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;             =   Request,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Progress,

+  &= nbsp;           &nbs= p;            &= nbsp;  NULL

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestConformanceAssertionGuid003,

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() = returns EFI_INVALID_PARAMETER with Results been NULL.",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  gtBS-&= gt;FreePool (MultiConfigAltResp);

+  gtBS-&= gt;FreePool (DevicePath);

+  gtBS-&= gt;FreePool (Request);

+

+  return= EFI_SUCCESS;

+}<= /span>

+

+ <= /span>

+EFI_STATUS

+BBTestExtract= ConfigConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Requ= est;

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Resu= lts =3D NULL;

<= /o:p>

+  //init= the Request

+  Reques= t =3D L"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a0069006= e0039&PATH=3D000acf&Jack&Rons&Nash&Mary"; 

<= /o:p>

+  //

+  // Cal= l ExtractConfig with unknown name

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  Request,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Progress,

+  &= nbsp;           &nbs= p;            &= nbsp;  &Results

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( (= (EFI_INVALID_PARAMETER =3D=3D Status) && (SctStrnCmp (Progress, L&q= uot;&Jack&Rons&Nash&Mary", 20) =3D=3D 0)) ||

+  &= nbsp; ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D Request)) = ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid004,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER/EFI_NO= T_FOUND with invalid input.",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

+ }=

+

+ <= /span>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;         Status;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =    AssertionType;

<= /o:p>

+  EFI_ST= RING            = ;            &n= bsp;         Progress =3D NULL;

+

<= /o:p>

+  //

+  // Cal= l RouteConfig with Configuration been NULL

+  //

+  Status= =3D HIIConfigAccess->RouteConfig (

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   NULL,

+  &= nbsp;           &nbs= p;   &Progress

+  &= nbsp;           &nbs= p;   );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid005,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.RouteConfig - RouteConfig() returns EFI_INVALID_PARAMETER with Confi= guration been NULL.",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

+ }=

+ <= /span>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib,<= /span>

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL       *HIIConfig= Routing,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        *HIIC= onfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Conf= ig =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+  EFI_ST= RING            Devi= cePath =3D NULL;

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;           &nbs= p;            &= nbsp;   HIIConfigRouting,

+  &= nbsp;           &nbs= p;            &= nbsp;   &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp; return Status;

+  }=

+

+  Config= =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) = + 2 );

+  if (Co= nfig =3D=3D NULL) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           return EF= I_OUT_OF_RESOURCES;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Config);

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           gtBS->= FreePool (Config);

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Cal= l RouteConfig with Progress been NULL

+  //

+  Status= =3D HIIConfigAccess->RouteConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  Config,

+  &= nbsp;           &nbs= p;            &= nbsp;  NULL

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestConformanceAssertionGuid006,

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() retu= rns EFI_INVALID_PARAMETER with Progress been NULL.",=

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  gtBS-&= gt;FreePool (MultiConfigAltResp);

+  gtBS-&= gt;FreePool (DevicePath);

+  gtBS-&= gt;FreePool (Config);

+

+  return= EFI_SUCCESS;

+}<= /span>

+ <= /span>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTestCheckpoint3 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;         Status;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =    AssertionType;

+  <= /o:p>

+  EFI_ST= RING            = ;            &n= bsp;         Configuration;

+  EFI_ST= RING            = ;            &n= bsp;         Progress =3D NULL;

<= /o:p>

+  //init= the Configuration

+  Config= uration=3DL"GUID=3D71e430fb2e8849779d7a33ef1139e7ed&NAME=3D006a006= 9006e0039&PATH=3D0acf&OFFSET=3D2&WIDTH=3D3VALUE=3D45AF";

<= /o:p>

+  //

+  // Cal= l RouteConfig with no found target for the routing data

+  //

+  Status= =3D HIIConfigAccess->RouteConfig (

+  &= nbsp;           &nbs= p;            &= nbsp;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;            &= nbsp;  Configuration,

+  &= nbsp;            &nb= sp;            =   &Progress

+  &= nbsp;           &nbs= p;            &= nbsp;  );

<= /o:p>

+  if ( E= FI_NOT_FOUND !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid007,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.RouteConfig - RouteConfig() returns EFI_NOT_FOUND with no found targ= et for the routing data.",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+

+  return= EFI_SUCCESS;

+}<= /span>

+

+/*=

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

<= /o:p>

+  EFI_QU= ESTION_ID           =             &nb= sp;        QuestionId;=

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    Type;

+  EFI_IF= R_TYPE_VALUE          &nb= sp;            =       Value;

+  EFI_BR= OWSER_ACTION_REQUEST         &= nbsp;           ActionReq= uest;

<= /o:p>

+  //init= the parameter

+  Questi= onId=3D0x1234;

+  Type= =3DEFI_IFR_TYPE_NUM_SIZE_8;

+

+ <= /span>

+  //

+  // Cal= l CallBack with the Action been NULL

+  //

+  Status= =3D HIIConfigAccess->CallBack (

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   NULL,

+  &= nbsp;            &nb= sp;  QuestionId,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           Type,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &Value,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &ActionReq= uest

+  &= nbsp;           &nbs= p;   );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+

+  &= nbsp;           //check t= he output ActionRequest

+  if ((E= FI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_B= ROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Actio= nRequest)

+  &= nbsp;           Assertion= Type =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;          

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid009,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Action been= NULL .",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

<= /o:p>

+}<= /span>

+

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

<= /o:p>

+  EFI_BR= OWSER_ACTION          &nb= sp;            =       *Action;

+  EFI_QU= ESTION_ID           =             &nb= sp;        QuestionId;=

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    Type;

+  EFI_IF= R_TYPE_VALUE          &nb= sp;            =       Value;

+

<= /o:p>

+  //init= the parameter

+  Action= = =3DEFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questi= onId=3D0x1234;

+  Type= =3DEFI_IFR_TYPE_NUM_SIZE_8;

+

+ <= /span>

+  //

+  // Cal= l CallBack with the ActionRequest been NULL

+  //

+  Status= =3D HIIConfigAccess->CallBack (

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   Action,

+  &= nbsp;           &nbs= p;   QuestionId,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           Type,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &Value,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           NULL

+  &= nbsp;           &nbs= p;   );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp;          

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid0010,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with QuestionId = been NULL.",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

<= /o:p>

+}<= /span>

+

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint3(

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL         = ;    *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

<= /o:p>

+  EFI_BR= OWSER_ACTION          &nb= sp;            =       *Action;

+  EFI_QU= ESTION_ID           =              &n= bsp;       QuestionId;=

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    Type;

+  EFI_BR= OWSER_ACTION_REQUEST         &= nbsp;           ActionReq= uest;

<= /o:p>

+  //init= the parameter

+  Action= =3D EFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questi= onId =3D 0x1234;

+  Type = =3D EFI_IFR_TYPE_NUM_SIZE_8;

+

+ <= /span>

+  //

+  // Cal= l CallBack with the Value been NULL

+  //

+  Status= =3D HIIConfigAccess->CallBack (

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   Action,

+  &= nbsp;           &nbs= p;   QuestionId,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           Type,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           NULL,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &ActionReq= uest

+  &= nbsp;           &nbs= p;   );

<= /o:p>

+  if ( E= FI_INVALID_PARAMETER !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp;          

+  &= nbsp;           //check t= he output ActionRequest

+  if ((E= FI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_B= ROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Actio= nRequest)

+  &= nbsp;           Assertion= Type =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;          

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid0011,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Value been = NULL.",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

<= /o:p>

+}<= /span>

+

+EFI_STATUS

+BBTestCallBac= kConformanceTestCheckpoint4 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

<= /o:p>

+  EFI_BR= OWSER_ACTION          &nb= sp;            =       *Action;

+  EFI_QU= ESTION_ID           =             &nb= sp;        QuestionId;=

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    Type;

+  EFI_IF= R_TYPE_VALUE          &nb= sp;            =       Value;

+  EFI_BR= OWSER_ACTION_REQUEST         &= nbsp;           ActionReq= uest;

<= /o:p>

+  //init= the parameter

+  Action= = =3D&EFI_BROWSER_ACTION_UNSUPPORTED;

+  Questi= onId=3D0x1234;

+  Type= =3DEFI_IFR_TYPE_NUM_SIZE_8;

+

<= /o:p>

+  //

+  // Cal= l CallBack with  the specified action not supported by the callback

+  //

+  Status= =3D HIIConfigAccess->CallBack (

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   Action,

+  &= nbsp;           &nbs= p;   QuestionId,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           Type,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &Value,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &ActionReq= uest

+  &= nbsp;           &nbs= p;   );

<= /o:p>

+  if ( E= FI_UNSUPPORTED !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp;          

+  &= nbsp;           //check t= he output ActionRequest

+  if ((E= FI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_B= ROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Actio= nRequest)

+  &= nbsp;           Assertion= Type =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;          

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestConfo= rmanceAssertionGuid0012,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.CallBack - CallBack() returns EFI_ UNSUPPORTED with  the specif= ied action not supported by the callback .",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+ return EFI_S= UCCESS;

<= /o:p>

+}<= /span>

+*/=

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfi= gAccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIICon= figAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c

new file mode 1006= 44

index 00000000..14= cc5684

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestFunction.c

@@ -0,0 +1,606= @@

+/** @file

+

+  Copyri= ght 2006 - 2017 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2018, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+  &= nbsp; HIIConfigAccessBBTestFunction.c

+

+Abstract:

+  &= nbsp; for EFI Driver HII Configuration Access Protocol's function Test=

+

+--*/

+

+#include &quo= t;HIIConfigAccessBBTestMain.h"

+

+

+EFI_STATUS

+BBTestExtract= ConfigFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+

+EFI_STATUS

+BBTestExtract= ConfigFunctionTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+

+EFI_STATUS

+BBTestRouteCo= nfigFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+/*=

+EFI_STATUS

+BBTestCallBac= kFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  );

+*/=

+

+//=

+//Test Cases<= o:p>

+//=

+/*=

+EFI_STATUS

+BBTestUnitTes= t (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL           &nb= sp; TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

+  EFI_ST= RING            = ;            &n= bsp;   DevicePath =3D NULL;

+  EFI_ST= RING    Request =3D NULL;

+  EFI_ST= RING    Resp =3D NULL;

+  EFI_ST= RING    MultiConfigAltResp =3D L"GUID=3D970eb94aa0d449f= 7b980bdaa47d42527&NAME=3Dft894&PATH=3D000acf&OFFSET=3D3&WID= TH=3D4&VALUE=3Daabbccdd&OFFSET=3D1&WIDTH=3D2&VALUE=3Deeff&a= mp;GUID=3D970eb94aa0d449f7b980bdaa47d42527&NAME=3Dft894&PATH=3D000a= cf&ALTCFG=3D0037&A000=3Dabcd&B000=3Defef&GUID=3D970eb94aa0d= 449f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b0fa0879341b= 266538c38af48ce000000007fff0400&A000=3Dabcd&B000=3Defef&GUID=3D= 970eb94aa0d449f7b980bdaa47d42528&NAME=3Dft894&PATH=3D0104180035170b= 0fa0879341b266538c38af48ce000000007fff0400&ALTCFG=3D0037&OFFSET=3D3= &WIDTH=3D4&VALUE=3Daabbccdd&OFFSET=3D1&WIDTH=3D2&VALUE= =3Deeff";;

+

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  Reques= t =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) = + 2);

+  if (Re= quest =3D=3D NULL)

+   =            return EFI_OUT= _OF_RESOURCES;

+

+  Resp = =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) &= #43; 2);

+  if (Re= sp =3D=3D NULL) {

+   =            gtBS->FreeP= ool (Request);

+   =            return EFI_OUT= _OF_RESOURCES;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; gtBS->FreePool (Resp); 

+   =            gtBS->FreeP= ool (Request);

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);

+

+  Status= =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);

+

+  gtBS-&= gt;FreePool (Request);

+  gtBS-&= gt;FreePool (Resp);

+  gtBS-&= gt;FreePool (DevicePath);

+

+  return= EFI_SUCCESS;

+}<= /span>

+*/=

+

+EFI_STATUS

+BBTestExtract= ConfigFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

+  EFI_HI= I_CONFIG_ROUTING_PROTOCOL       *HIIConfigRou= ting;

<= /o:p>

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;           &nbs= p;    &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  // Get= the Config Routing Protocol Interface

+  //

+  Status= =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; return Status;

+  }=

+

+  //

+  //Call= check points

+  //

+  BBTest= ExtractConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIICon= figAccess );

+  BBTest= ExtractConfigFunctionTestCheckpoint2( StandardLib, HIIConfigRouting, HIICon= figAccess );

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

<= /o:p>

+

+EFI_STATUS

+BBTestRouteCo= nfigFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

+  EFI_HI= I_CONFIG_ROUTING_PROTOCOL       *HIIConfigRou= ting;

+

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;           &nbs= p;    &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Get= the Config Routing Protocol Interface

+  //

+  Status= =3D GetHIIConfigRoutingInterface( &HIIConfigRouting );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  //Call= check points

+  //

+  BBTest= RouteConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIIConfi= gAccess );

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

+/*=

+EFI_STATUS

+BBTestCallBac= kFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  )=

+{<= /span>

+  EFI_ST= ANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL        *HIIConf= igAccess;

<= /o:p>

+  //

+  // ini= t

+  //

+  HIICon= figAccess =3D (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;<= /span>

+

+  //

+  // Get= the Standard Library Interface

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    SupportHandle,

+  &= nbsp;           &nbs= p;    &gEfiStandardTestLibraryGuid,

+  &= nbsp;           &nbs= p;    (VOID **) &StandardLib

+  &= nbsp;           &nbs= p;    );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  //Call= check points

+  //

+  BBTest= CallBackFunctionTestCheckpoint1( StandardLib, HIIConfigAccess );=

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+*/=

+

+//=

+//Check Point= s

+//=

+EFI_STATUS

+BBTestExtract= ConfigFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Requ= est =3D NULL;

+  EFI_ST= RING            Conf= igHdr =3D NULL;

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Resu= lts =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+  EFI_ST= RING            Devi= cePath =3D NULL;

+

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;           &nbs= p;            &= nbsp;   HIIConfigRouting,

+  &= nbsp;           &nbs= p;            &= nbsp;   &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp; return Status;

+  }=

+

+  Reques= t =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp)= + 2 );

+  if (Re= quest =3D=3D NULL) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp; gtBS->FreePool (DevicePath);

+  &= nbsp; return EFI_OUT_OF_RESOURCES;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp; gtBS->FreePool (DevicePath);

+  &= nbsp; gtBS->FreePool (Request);

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Cal= l ExtractConfig with valid parameters

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig(

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   Request,

+  &= nbsp;           &nbs= p;   &Progress,

+  &= nbsp;           &nbs= p;   &Results

+  &= nbsp;           &nbs= p;   );

+

+  if ( (= EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctSt= rLen (Request))) ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; if (Results =3D=3D NULL) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; } else {

+  &= nbsp;   gtBS->FreePool (Results);

+  &= nbsp; }

+  } else= if (EFI_OUT_OF_RESOURCES =3D=3D Status) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING; 

+  }else = {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestFunctionAssertionGuid001,<= /p>

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() r= eturns EFI_SUCCESS and vaild Results with valid parameters .",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+   =             &nb= sp; __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  //

+  // Cha= nge the Request to ConfigHdr

+  //

+  Config= Hdr =3D Request;

+  while = (*Request) {

+  &= nbsp; if (*Request =3D=3D L'&') {

+  &= nbsp;   if (SctStrnCmp (Request, L"&NAME=3D", 6) = =3D=3D 0) {

+  &= nbsp;     Request =3D Request + 6;

+  &= nbsp;   } else if (SctStrnCmp (Request, L"&PATH=3D"= , 6) =3D=3D 0) {

+  &= nbsp;     Request =3D Request + 6;

+  &= nbsp;   } else {

+  &= nbsp;     *Request =3D 0;

+  &= nbsp;   }

+  &= nbsp; } else {

+  &= nbsp;   Request++;

+  &= nbsp; }

+  }

+  Reques= t =3D ConfigHdr;

<= /o:p>

+  //

+  // Cal= l ExtractConfig when Request is ConfigHdr

+  //

+  Progre= ss =3D NULL;

+  Result= s =3D NULL;

+  Status= =3D HIIConfigAccess->ExtractConfig(

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   Request,

+  &= nbsp;            &nb= sp;  &Progress,

+  &= nbsp;           &nbs= p;   &Results

+  &= nbsp;           &nbs= p;   );

+

+  if ( (= EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D (Request + SctSt= rLen (Request))) ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; if (Results =3D=3D NULL) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; } else {

+  &= nbsp;   if (NULL =3D=3D SctStrStr (Results, Request)) {

+  &= nbsp;     AssertionType =3D EFI_TEST_ASSERTION_FAILED;<= o:p>

+  &= nbsp;   }

+  &= nbsp;   gtBS->FreePool (Results);

+  &= nbsp; }

+  } else= if (EFI_OUT_OF_RESOURCES =3D=3D Status) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING; 

+  }else = {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestFunctionAssertionGuid002,<= /p>

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() r= eturns EFI_SUCCESS and vaild Results with valid parameters .",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+

+  gtBS-&= gt;FreePool (MultiConfigAltResp);

+  gtBS-&= gt;FreePool (DevicePath);

+  gtBS-&= gt;FreePool (Request);

+

+  return= EFI_SUCCESS;

+} =

+

+

+EFI_STATUS

+BBTestExtract= ConfigFunctionTestCheckpoint2 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

+

+  EFI_ST= RING            Requ= est =3D NULL;

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Resu= lts =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;           &nbs= p;            &= nbsp;   HIIConfigRouting,

+  &= nbsp;           &nbs= p;            &= nbsp;   &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Cal= l ExtractConfig with valid parameters

+  //

+  Status= =3D HIIConfigAccess->ExtractConfig(

+  &= nbsp;           &nbs= p;   HIIConfigAccess,

+  &= nbsp;           &nbs= p;   NULL,

+  &= nbsp;           &nbs= p;   &Progress,

+  &= nbsp;           &nbs= p;   &Results

+  &= nbsp;           &nbs= p;   );

+

+  if (EF= I_OUT_OF_RESOURCES =3D=3D Status) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  } else= if ((EFI_NOT_FOUND =3D=3D Status) && (Progress =3D=3D NULL) &&= amp; (Results =3D=3D NULL)) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else= if ( EFI_SUCCESS !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; if (Results !=3D NULL) {

+  &= nbsp;   gtBS->FreePool (Results);

+  &= nbsp; }

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp; if (Results =3D=3D NULL) {

+  &= nbsp;   AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp; }

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;           &nbs= p;  StandardLib,

+  &= nbsp;           &nbs= p;  AssertionType,

+  &= nbsp;           &nbs= p;  gHIIConfigAccessBBTestFunctionAssertionGuid003,<= /p>

+  &= nbsp;           &nbs= p;  L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() r= eturns EFI_SUCCESS or EFI_NOT_FOUND with Request been NULL .",

+  &= nbsp;           &nbs= p;  L"%a:%d: Status - %r",

+  &= nbsp;           &nbs= p;  __FILE__,

+  &= nbsp;           &nbs= p;  (UINTN)__LINE__,

+  &= nbsp;           &nbs= p;  Status

+  &= nbsp;           &nbs= p;  );

+   =

+

+  if ( N= ULL !=3D MultiConfigAltResp ){

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  }=

+

+  if ( N= ULL !=3DResults ) {

+  &= nbsp; gtBS->FreePool (Results);

+  }=

+

+  if (NU= LL !=3D Request) {

+  &= nbsp; gtBS->FreePool (Request); 

+  }=

<= /o:p>

+  return= EFI_SUCCESS;

+} =

+

+

+EFI_STATUS

+BBTestRouteCo= nfigFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ROUTING_PROTOCOL        = ;    *HIIConfigRouting,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            Stat= us;

+  EFI_TE= ST_ASSERTION    AssertionType;

<= /o:p>

+  EFI_ST= RING            Resp= =3D NULL;

+  EFI_ST= RING            Prog= ress =3D NULL;

+  EFI_ST= RING            Mult= iConfigAltResp =3D NULL;

+  EFI_ST= RING            Devi= cePath =3D NULL;

<= /o:p>

+  //init= the Request

+  Status= =3D HIIConfigRouting->ExportConfig(

+  &= nbsp;           &nbs= p;            &= nbsp;   HIIConfigRouting,

+  &= nbsp;           &nbs= p;            &= nbsp;   &MultiConfigAltResp

+  &= nbsp;           &nbs= p;            &= nbsp;   );

+  if (EF= I_ERROR(Status)) {

+  &= nbsp; return Status;

+  }=

+

+  Status= =3D GetDevicePath ( HIIConfigAccess, &DevicePath );<= /p>

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp; return Status;

+  }=

+

+  Resp = =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) = + 2 );

+  if (Re= sp =3D=3D NULL) {

+  &= nbsp; gtBS->FreePool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           return EF= I_OUT_OF_RESOURCES;

+  }=

<= /o:p>

+  Status= =3D GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);

+  if (EF= I_ERROR(Status)) {

+   =            gtBS->FreeP= ool (MultiConfigAltResp);

+  &= nbsp;           gtBS->= FreePool (DevicePath);

+  &= nbsp;           gtBS->= FreePool (Resp);

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  //

+  // Cal= l RouteConfig with valid parameters

+  //

+  Status= =3D HIIConfigAccess->RouteConfig(

+  &= nbsp;           &nbs= p;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;  Resp,

+  &= nbsp;           &nbs= p;  &Progress

+  &= nbsp;           &nbs= p;  );

+  if ( (= EFI_SUCCESS =3D=3D Status) && (Progress =3D=3D Resp + SctStrLen= (Resp)) ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  } else= if ( EFI_OUT_OF_RESOURCES =3D=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_WARNING;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  }=

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestFunct= ionAssertionGuid003,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.RouteConfig- RouteConfig() returns EFI_SUCCESS with valid parameters= .",

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

<= /o:p>

+  gtBS-&= gt;FreePool (MultiConfigAltResp);

+  gtBS-&= gt;FreePool (DevicePath);

+  gtBS-&= gt;FreePool (Resp);

+

+  return= EFI_SUCCESS;

+} =

+

+/*=

+EFI_STATUS

+BBTestCallBac= kFunctionTestCheckpoint1 (

+  IN EFI= _STANDARD_TEST_LIBRARY_PROTOCOL       &n= bsp; *StandardLib,

+  IN EFI= _HII_CONFIG_ACCESS_PROTOCOL        =      *HIIConfigAccess

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            &n= bsp;            Stat= us;

+  EFI_TE= ST_ASSERTION          &nb= sp;            =       AssertionType;

<= /o:p>

+  EFI_BR= OWSER_ACTION          &nb= sp;            =       *Action;

+  EFI_QU= ESTION_ID           =             &nb= sp;        QuestionId;=

+  UINT8&= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    Type;

+  EFI_IF= R_TYPE_VALUE          &nb= sp;            =       Value;

+  EFI_BR= OWSER_ACTION_REQUEST         &= nbsp;           ActionReq= uest;

<= /o:p>

+  //init= the paremeters

+  Action= = =3DEFI_BROWSER_ACTION_REQUEST_CHANGING;

+  Questi= onId=3D0x1234;

+  Type= =3DEFI_IFR_TYPE_NUM_SIZE_8;

<= /o:p>

<= /o:p>

+  //

+  // Cal= l CallBack  with valid parameters

+  //

+  Status= =3D HIIConfigAccess->CallBack(

+  &= nbsp;           &nbs= p;  HIIConfigAccess,

+  &= nbsp;           &nbs= p;  Action,

+  &= nbsp;           &nbs= p;  QuestionId,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;         Type,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;         &Value,

+  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;         &ActionRequest

+  &= nbsp;           &nbs= p;  );

+  if ( E= FI_SUCCESS !=3D Status ) {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_FAILED;

+  } else= {

+  &= nbsp; AssertionType =3D EFI_TEST_ASSERTION_PASSED;

+  &= nbsp;          

+  &= nbsp;           //check t= he output ActionRequest

+  if ((E= FI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_B= ROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) !=3D Actio= nRequest)

+  &= nbsp;           Assertion= Type =3D EFI_TEST_ASSERTION_FAILED;

+  &= nbsp;

+  }=

<= /o:p>

+ <= /span>

+  Standa= rdLib->RecordAssertion (

+  &= nbsp;        StandardLib,

+  &= nbsp;        AssertionType,

+  &= nbsp;        gHIIConfigAccessBBTestFunct= ionAssertionGuid003,

+  &= nbsp;        L"HII_CONFIG_ACCESS_PR= OTOCOL.CallBack- CallBack() returns EFI_SUCCESS with valid parameters .&quo= t;,

+  &= nbsp;        L"%a:%d: Status - %r&q= uot;,

+  &= nbsp;        __FILE__,=

+  &= nbsp;        (UINTN)__LINE__,=

+  &= nbsp;        Status

+  &= nbsp;        );

+  return= EFI_SUCCESS;

+} =

+*/=

+

+

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfi= gAccessBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigA= ccess/BlackBoxTest/HIIConfigAccessBBTestMain.c

new file mode 1006= 44

index 00000000..29= c793e2

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestMain.c

@@ -0,0 +1,655= @@

+/** @file

+

+  Copyri= ght 2006 - 2016 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2016, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+

+  HIICon= figAccessBBTestMain.c

+

+Abstract:

+

+  Test D= river of HII Configuration Access Protocol

+

+--*/

+

+#include &quo= t;HIIConfigAccessBBTestMain.h"

+

+//=

+// Global var= iables

+//=

+EFI_HANDLE mI= mageHandle;

+

+EFI_BB_TEST_P= ROTOCOL *gBBTestProtocolInterface;

+

+EFI_BB_TEST_P= ROTOCOL_FIELD gBBTestProtocolField =3D {

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL_TEST_REVISION,

+  IHV_EF= I_HII_CONFIG_ACCESS_PROTOCOL_GUID,

+  L"= ;HII Configuration Access Protocol Test",

+  L"= ;UEFI HII Configuration Access  Protocol Black-Box Test"

+};=

+

+EFI_GUID gSup= portProtocolGuid[] =3D {

+  EFI_ST= ANDARD_TEST_LIBRARY_GUID,

+  EFI_NU= LL_GUID

+};=

+

+EFI_BB_TEST_E= NTRY_FIELD gBBTestEntryField[] =3D {

+  /*

+  //Use = for unit test only

+  {=

+  &= nbsp; { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0= xb0, 0x6d } },

+  &= nbsp;           L"Un= it Test Only",

+  &= nbsp;           L"Ve= rify the Assistant Function",

+  &= nbsp; EFI_TEST_LEVEL_DEFAULT,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestUnitTest

+  },

+  */

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101,=

+  &= nbsp; L"ExtractConfigFunction",

+  &= nbsp; L"Function auto test for HII Configuration Access Protocol Extra= ctConfig().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestExtractConfigFunctionTest

+  },

<= /o:p>

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102,=

+  &= nbsp; L"RouteConfigFunction",

+  &= nbsp; L"Function auto test for HII Configuration Access Protocol Route= Config().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestRouteConfigFunctionTest

+  },

+  /*

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0103,=

+  &= nbsp; L"CallBackFunction",

+  &= nbsp; L"Function auto test for HII Configuration Access Protocol CallB= ack().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestCallBackFunctionTest

+  },

+  */

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201,=

+  &= nbsp; L"ExtractConfigConformance",

+  &= nbsp; L"Conformance auto test for HII Configuration Access Protocol Ex= tractConfig().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestExtractConfigConformanceTest

+  },

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202,=

+  &= nbsp; L"RouteConfigConformance",

+  &= nbsp; L"Conformance auto test for HII Configuration Access Protocol Ro= uteConfig().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestRouteConfigConformanceTest

+  },

+  /*

+  {=

+  &= nbsp; EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0203,=

+  &= nbsp; L"CallBackConformance",

+  &= nbsp; L"Conformance auto test for HII Configuration Access Protocol Ca= llBack().",

+  &= nbsp; EFI_TEST_LEVEL_MINIMAL,

+  &= nbsp; gSupportProtocolGuid,

+  &= nbsp; EFI_TEST_CASE_AUTO,

+  &= nbsp; BBTestCallBackConformanceTest

+  },

+  */

+  0=

+};=

+

+

+

+

+EFI_STATUS

+InitializeHII= ConfigAccessBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle,

+  IN EFI= _SYSTEM_TABLE          &n= bsp;  *SystemTable

+  )=

+{<= /span>

+  EfiIni= tializeTestLib (ImageHandle, SystemTable);

+

+  //

+  // ini= tialize test utility lib

+  //

+

+  SctIni= tializeLib (ImageHandle, SystemTable);

+

+  mImage= Handle =3D ImageHandle;

+

+  return= EfiInitAndInstallIHVBBTestInterface (

+  &= nbsp;        &ImageHandle,

+  &= nbsp;        &gBBTestProtocolField,<= o:p>

+  &= nbsp;        gBBTestEntryField,

+  &= nbsp;        UnloadHIIConfigAccessBBTest= ,

+  &= nbsp;        &gBBTestProtocolInterfa= ce

+  &= nbsp;        );

+}<= /span>

+

+

+EFI_STATUS

+UnloadHIIConf= igAccessBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle

+  )=

+{<= /span>

+  return= EfiUninstallAndFreeIHVBBTestInterface (

+  &= nbsp;        ImageHandle,

+  &= nbsp;        gBBTestProtocolInterface

+  &= nbsp;        );

+}<= /span>

+

+

+// Assistance= Function

+UINTN

+EfiDevicePath= Size (

+  IN EFI= _DEVICE_PATH_PROTOCOL  *DevicePath

+  )=

+/*++<= o:p>

+

+Routine Descr= iption:

+

+  Calcul= ate the space size of a device path.

+

+Arguments:

+

+  Device= Path  - A specified device path

+

+Returns:=

+

+  The si= ze.

+

+--*/

+{<= /span>

+  EFI_DE= VICE_PATH_PROTOCOL  *Start;

+

+  if (De= vicePath =3D=3D NULL) {

+  &= nbsp; return 0;

+  }=

+

+  //

+  // Sea= rch for the end of the device path structure

+  //

+  Start = = =3D DevicePath;

+  while = (!SctIsDevicePathEnd (DevicePath)) {

+  &= nbsp; DevicePath =3D SctNextDevicePathNode (DevicePath);<= /p>

+  }=

+

+  //

+  // Com= pute the size and add back in the size of the end device path structure

+  //

+  return= ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCO= L);

+}<= /span>

+

+

+STATIC

+CHAR16

+NibbleToHexCh= arPrivate (

+  IN UIN= T8            &= nbsp;            Nib= ble

+  )=

+/*++<= o:p>

+

+  Routin= e Description:

+  &= nbsp; Converts the low nibble of a byte to hex unicode character.

+

+  Argume= nts:

+  &= nbsp; Nibble - lower nibble of a byte.

+

+  Return= s:

+  &= nbsp; Hex unicode character between L'0' to L'f'.

+

+--*/

+{<= /span>

+  Nibble= &=3D 0x0F;

+

+  if (Ni= bble <=3D 0x9) {

+  &= nbsp; return (CHAR16)(Nibble + L'0');

+  }=

+

+  return= (CHAR16)(Nibble - 0xA + L'a');

+}<= /span>

+

+

+STATIC

+EFI_STATUS

+BufToHexStrin= gPrivate (

+  IN OUT= CHAR16           &n= bsp;        *Str,

+  IN OUT= UINTN           &nb= sp;         *HexStringBufferLength,=

+  IN&nbs= p;    UINT8        &= nbsp;            *Bu= f,

+  IN&nbs= p;    UINTN         =             Len= ,

+  IN&nbs= p;    BOOLEAN        = ;           Flag

+  )=

+/*++<= o:p>

+

+  Routin= e Description:

+  &= nbsp; Converts binary buffer to Unicode string.

+  &= nbsp; At a minimum, any blob of data could be represented as a hex string.<= o:p>

+

+  Argume= nts:

+  &= nbsp; Str           =         - Pointer to the string.

+  &= nbsp; HexStringBufferLength - Length in bytes of buffer to hold the hex str= ing. Includes tailing '\0' character.

+  &= nbsp;           &nbs= p;             = If routine return with EFI_SUCCESS, containing length of hex string buffer.=

+  &= nbsp;           &nbs= p;             = If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string = buffer desired.

+  &= nbsp; Buf           =         - Buffer to be converted from.

+  &= nbsp; Len           =         - Length in bytes of the buffer = to be converted.

+  &= nbsp; Flag           = ;       - If TRUE, encode the data in the sam= e order as the it

+  &= nbsp;           &nbs= p;             = resides in the Buf. Else encode it in the reverse direction.

+

+  Return= s:

+  &= nbsp; EFI_SUCCESS         &nbs= p; - Routine  success.

+  &= nbsp; EFI_BUFFER_TOO_SMALL  - The hex string buffer is too small.=

+

+--*/

+{<= /span>

+  UINTN&= nbsp;      Idx;

+  UINT8&= nbsp;      Byte;

+  UINTN&= nbsp;      StrLen;

+

+  //

+  // Mak= e sure string is either passed or allocate enough.

+  // It = takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buff= er.

+  // Plu= s the Unicode termination character.

+  //

+  StrLen= =3D Len * 2;

+  if ((*= HexStringBufferLength) < (StrLen + 1) * sizeof (CHAR16)) {

+  &= nbsp; *HexStringBufferLength =3D (StrLen + 1) * sizeof (CHAR16);

+  &= nbsp; return EFI_BUFFER_TOO_SMALL;

+  }=

+

+  *HexSt= ringBufferLength =3D (StrLen + 1) * sizeof (CHAR16);<= /p>

<= /o:p>

+  //

+  // End= s the string.

+  //

+  Str[St= rLen] =3D 0;

+

+  for (I= dx =3D 0; Idx < Len; Idx++) {

+

+  &= nbsp; Byte =3D Buf[Idx];

+  &= nbsp; if (Flag) {

+  &= nbsp;   Str[Idx * 2]     =3D NibbleToHexCharP= rivate ((UINT8)(Byte >> 4));

+  &= nbsp;   Str[Idx * 2 + 1] =3D NibbleToHexCharPrivate (Byte);

+  &= nbsp; } else {

+  &= nbsp;   Str[StrLen - 1 - Idx * 2] =3D NibbleToHexCharPrivate (Byt= e);

+  &= nbsp;   Str[StrLen - 2 - Idx * 2] =3D NibbleToHexCharPrivate ((UI= NT8)(Byte >> 4));

+  &= nbsp; }

+  }=

+

+  return= EFI_SUCCESS;

+}<= /span>

+

+EFI_STATUS

+GetDevicePath= (

+  IN&nbs= p; EFI_HII_CONFIG_ACCESS_PROTOCOL    *ConfigAccess,

+  OUT EF= I_STRING           &= nbsp;            *De= vicePathStr

+  )=

+{<= /span>

+  EFI_ST= ATUS            = ;            Status;=

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;   Index;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;   NoHandles;

+  EFI_HA= NDLE            = ;            *Handle= Buffer;

+  EFI_HA= NDLE            = ;            ConfigA= ccessHandle =3D NULL;

+  EFI_HI= I_CONFIG_ACCESS_PROTOCOL    *TestedConfigAccess;<= /span>

+  EFI_DE= VICE_PATH_PROTOCOL          *D= evicePath;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;   Length;

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;   PathHdrSize;

+

+  //

+  // loc= ate all Hii Configuration Access Protocol Instances

+  //

+  Status= =3D gtBS->LocateHandleBuffer (

+  &= nbsp;           &nbs= p;    ByProtocol,

+  &= nbsp;           &nbs= p;    &gBlackBoxEfiHIIConfigAccessProtocolGuid,

+  &= nbsp;           &nbs= p;    NULL,

+  &= nbsp;           &nbs= p;    &NoHandles,

+  &= nbsp;           &nbs= p;    &HandleBuffer

+  &= nbsp;            &nb= sp;   );

+  if (EF= I_ERROR(Status) || (NoHandles =3D=3D 0)) {

+  &= nbsp; return EFI_NOT_FOUND;

+  }=

+

+  //

+  // sca= n for the handle that matched with the Hii Configuration Access Protocol th= at

+  // pas= sed in by the test framework

+  //

+  for (I= ndex =3D 0; Index < NoHandles; Index++) {

+  &= nbsp; Status =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;      HandleBuffer[Index],

+  &= nbsp;           &nbs= p;      &gBlackBoxEfiHIIConfigAccessProtocolGu= id,

+  &= nbsp;           &nbs= p;      (VOID **) &TestedConfigAccess

+  &= nbsp;            &nb= sp;     );

+  &= nbsp; if (EFI_ERROR(Status)) {

+  &= nbsp;   continue;

+  &= nbsp; }

+

+  &= nbsp; if (TestedConfigAccess =3D=3D ConfigAccess) {

+  &= nbsp;   ConfigAccessHandle =3D HandleBuffer[Index];

+  &= nbsp;   break;

+  &= nbsp; }

+  }=

+

+  gtBS-&= gt;FreePool (HandleBuffer);

+

+  if (Co= nfigAccessHandle =3D=3D NULL) {

+  &= nbsp; return EFI_NOT_FOUND;

+  }=

+

+  //

+  // fin= d controller handles managed by the component name handle.

+  //

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    ConfigAccessHandle,

+  &= nbsp;           &nbs= p;    &gBlackBoxEfiDevicePathProtocolGuid,

+  &= nbsp;           &nbs= p;    (void **)&DevicePath

+  &= nbsp;           &nbs= p;    );

+

+  //

+  // Con= vert 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);

+  PathHd= rSize =3D (Length * 2 + 1) * sizeof (CHAR16);

+  *Devic= ePathStr =3D (EFI_STRING) SctAllocateZeroPool (PathHdrSize);

+  if (*D= evicePathStr =3D=3D NULL) {

+  &= nbsp; return EFI_OUT_OF_RESOURCES;

+  }=

+  Status= =3D BufToHexStringPrivate (*DevicePathStr, &PathHdrSize, (UINT8 *) Dev= icePath, Length, TRUE);

+

+  return= Status;

+}<= /span>

+

+

+EFI_STATUS

+GetCorrespond= ingRequest (

+  IN&nbs= p;    EFI_STRING    MultiConfigAltResp,<= /o:p>

+  IN&nbs= p;    EFI_STRING    DevicePath,

+  IN OUT= EFI_STRING    Request

+  )=

+{<= /span>

+  EFI_ST= RING    RespPtr;

+  EFI_ST= RING    ReqPtr;

+  EFI_ST= RING    SingleResp;

+  EFI_ST= RING    SingleRespPtr;

+  UINTN&= nbsp;        Len;

<= /o:p>

+  ReqPtr= =3D Request;

+  RespPt= r =3D MultiConfigAltResp;

+

+  Len = =3D SctStrLen (MultiConfigAltResp);

<= /o:p>

+  if (Sc= tStrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) {=

+  &= nbsp; return EFI_INVALID_PARAMETER;

+  }=

<= /o:p>

+  if (Sc= tStrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) {

+  &= nbsp; return EFI_NOT_FOUND;

+  }=

+

+  Single= Resp =3D (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltRe= sp) + 2 );

+  if (Si= ngleResp =3D=3D NULL) {

+  &= nbsp;           return EF= I_OUT_OF_RESOURCES;

+  }=

+  Single= RespPtr =3D SingleResp;

+

+  while = (*MultiConfigAltResp !=3D 0) {

+  &= nbsp; while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConf= igAltResp, L"&GUID=3D", 6) !=3D 0)) {

+  &= nbsp;   *(SingleResp++) =3D *(MultiConfigAltResp++= ;);

+  &= nbsp; }

+  &= nbsp;           SingleRes= p =3D SingleRespPtr;

+  &= nbsp;           if (SctSt= rStr (SingleResp, DevicePath) !=3D NULL)

+  &= nbsp;   break;

+  &= nbsp;           SctZeroMe= m (SingleRespPtr, 2 * Len + 2);

+  &= nbsp;           if (*Mult= iConfigAltResp !=3D 0)

+  &= nbsp;   MultiConfigAltResp++;

+  }=

+

+  if (Sc= tStrStr (SingleResp, DevicePath) =3D=3D NULL)

+   =            return EFI_NOT= _FOUND;

+

+  if (Sc= tStrStr (SingleResp, L"VALUE=3D") =3D=3D NULL){=

+  &= nbsp; while (*SingleResp !=3D 0) {

+  &= nbsp;   while ((*SingleResp !=3D 0) && (SctStrnCmp (Singl= eResp, L"&PATH=3D", 6) !=3D 0)) {

+  &= nbsp;     *(Request++) =3D *(SingleResp+= 3;);

+  &= nbsp;             }<= o:p>

+  &= nbsp;             *(= Request++) =3D *(SingleResp++);

+  &= nbsp;             wh= ile ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&')) {

+  &= nbsp;     *(Request++) =3D *(SingleResp+= 3;);

+  &= nbsp;   }

+  &= nbsp;             wh= ile (*SingleResp !=3D 0){

+  &= nbsp;     if (*SingleResp !=3D L'=3D') {

+  &= nbsp;       *(Request++) =3D *(Single= Resp++);

+  &= nbsp;           &nbs= p;            &= nbsp;  } else {

+  &= nbsp;       while ((*SingleResp !=3D 0) &= & (*SingleResp !=3D L'&')) {

+  &= nbsp;         SingleResp++;=

+  &= nbsp;       }

+  &= nbsp;     }

+  &= nbsp;   }

+  &= nbsp; }

+  } else= {

+  &= nbsp; while (*SingleResp !=3D 0) {

+  &= nbsp;   while ((*SingleResp !=3D 0) && (SctStrnCmp (Singl= eResp, L"&VALUE=3D", 7)) !=3D 0) {

+  &= nbsp;     *(Request++) =3D *(SingleResp+= 3;);

+  &= nbsp;   }

+  &= nbsp;             Si= ngleResp++;

+  &= nbsp;             wh= ile ((*SingleResp !=3D 0) && (*SingleResp !=3D L'&'))

+  &= nbsp;     SingleResp++;

+  &= nbsp; }

+

+  }=

+

+  *Reque= st =3D 0;

+

+  gtBS-&= gt;FreePool (SingleRespPtr);

+  return= EFI_SUCCESS;

+}<= /span>

+

+

+EFI_STATUS

+GetCorrespond= ingResp (

+  IN&nbs= p;    EFI_STRING    MultiConfigAltResp,<= /o:p>

+  IN&nbs= p;    EFI_STRING    DevicePath,

+  IN OUT= EFI_STRING    Resp

+  )=

+{<= /span>

+  EFI_ST= RING    RespPtr;

+  EFI_ST= RING    ReqPtr;

+  UINTN&= nbsp;        Len;

<= /o:p>

+  ReqPtr= =3D Resp;

+  RespPt= r =3D MultiConfigAltResp;

+

+  Len = =3D SctStrLen (MultiConfigAltResp);

<= /o:p>

+  if (Sc= tStrnCmp (MultiConfigAltResp, L"GUID=3D", 5) !=3D 0) {=

+  &= nbsp; return EFI_INVALID_PARAMETER;

+  }=

<= /o:p>

+  if (Sc= tStrStr (MultiConfigAltResp, DevicePath) =3D=3D NULL) {

+  &= nbsp; return EFI_NOT_FOUND;

+  }=

+

+  while = (*MultiConfigAltResp !=3D 0) {

+  &= nbsp; while ((*MultiConfigAltResp !=3D 0) && (SctStrnCmp (MultiConf= igAltResp, L"&GUID=3D", 6) !=3D 0)) {

+  &= nbsp;   *(Resp++) =3D *(MultiConfigAltResp++);

+  &= nbsp; }

+  &= nbsp;           Resp =3D = ReqPtr;

+  &= nbsp;           if (SctSt= rStr (Resp, DevicePath) !=3D NULL)

+  &= nbsp;   break;

+  &= nbsp;           SctZeroMe= m (ReqPtr, 2 * Len + 2);

+  &= nbsp;           if (*Mult= iConfigAltResp !=3D 0)

+  &= nbsp;   MultiConfigAltResp++;

+  }=

+

+  if (Sc= tStrStr (Resp, DevicePath) =3D=3D NULL)

+   =            return EFI_NOT= _FOUND;

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

+

+

+EFI_STATUS

+GetHIIConfigR= outingInterface (

+  OUT EF= I_HII_CONFIG_ROUTING_PROTOCOL    **HIIConfigRouting

+  )=

+{<= /span>

+  UINTN&= nbsp;           &nbs= p;            &= nbsp;       NoHandles;

+  EFI_HA= NDLE            = ;            &n= bsp;   *HandleBuffer;

+  EFI_ST= ATUS            = ;            &n= bsp;   Status;

<= /o:p>

+  //

+  // Get= the HII Database Protocol interface

+  //

+  Status= =3D gtBS->LocateHandleBuffer (

+  &= nbsp;           &nbs= p;    ByProtocol,

+  &= nbsp;           &nbs= p;    &gBlackBoxEfiHIIConfigRoutingProtocolGuid,

+  &= nbsp;           &nbs= p;    NULL,

+  &= nbsp;           &nbs= p;    &NoHandles,

+  &= nbsp;           &nbs= p;    &HandleBuffer

+  &= nbsp;           &nbs= p;    );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  if ( N= oHandles <=3D 0 ) {

+  &= nbsp; return EFI_DEVICE_ERROR;

+  }=

<= /o:p>

+  Status= =3D gtBS->HandleProtocol (

+  &= nbsp;           &nbs= p;    HandleBuffer[0],

+  &= nbsp;           &nbs= p;    &gBlackBoxEfiHIIConfigRoutingProtocolGuid,

+  &= nbsp;           &nbs= p;    (VOID **) HIIConfigRouting

+  &= nbsp;           &nbs= p;    );

+  if ( E= FI_ERROR(Status) ) {

+  &= nbsp; gtBS->FreePool ( HandleBuffer );

+  &= nbsp; return Status;

+  }=

<= /o:p>

+  gtBS-&= gt;FreePool ( HandleBuffer );

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

+

+EFI_STATUS

+MultiAltRespT= oMultiReq (

+  IN&nbs= p;      EFI_STRING     &n= bsp;            = ;         Resp,

+  IN OUT=    EFI_STRING        &nbs= p;            &= nbsp;     Req

+  )=

+{<= /span>

+  EFI_ST= RING Pointer1 =3D Resp;     

+  EFI_ST= RING Pointer2 =3D NULL;

+  EFI_ST= RING Pointer3 =3D Req;

+  EFI_ST= RING CfgHdr =3D NULL;

+  EFI_ST= RING FreePtr =3D NULL;

+  CHAR8&= nbsp;     Flag =3D 0;

+

+  if (Sc= tStrnCmp (Pointer1, L"GUID=3D", 5) !=3D 0) {   

+  &= nbsp; return EFI_INVALID_PARAMETER;

+  }=

+

+  Pointe= r2 =3D (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (Resp) + 2);

+  if (Po= inter2 =3D=3D NULL) {

+  &= nbsp; return EFI_OUT_OF_RESOURCES;

+  }=

+  FreePt= r =3D Pointer2;

<= /o:p>

+  while = (*Pointer1) {

+  &= nbsp; if (SctStrnCmp (Pointer1, L"GUID=3D", 5) =3D=3D 0) {

+  &= nbsp;   CfgHdr =3D Pointer2;

+  &= nbsp;   *(Pointer2++) =3D *(Pointer1++);

+  &= nbsp;             wh= ile (*Pointer1 !=3D L'&') {

+  &= nbsp;     *(Pointer2++) =3D *(Pointer1++= ;);

+  &= nbsp;   }

+  &= nbsp; }

+  &= nbsp;           if (SctSt= rnCmp (Pointer1, L"&GUID=3D", 6) =3D=3D 0) {

+  &= nbsp;   *(Pointer2++) =3D *(Pointer1++);

+  &= nbsp;   CfgHdr =3D Pointer2;

+  &= nbsp;             wh= ile (*Pointer1 !=3D L'&') {

+  &= nbsp;     *(Pointer2++) =3D *(Pointer1++= ;);

+  &= nbsp;   }

+  &= nbsp;           }

+  &= nbsp;           if (SctSt= rnCmp (Pointer1, L"&NAME=3D", 6) =3D=3D 0) {

+  &= nbsp;   *(Pointer2++) =3D *(Pointer1++);

+  &= nbsp;             wh= ile (*Pointer1 !=3D L'&') {

+  &= nbsp;     *(Pointer2++) =3D *(Pointer1++= ;);

+  &= nbsp;   }

+  &= nbsp;           }

+  &= nbsp;           if (SctSt= rnCmp (Pointer1, L"&PATH=3D", 6) =3D=3D 0) {

+  &= nbsp;   *(Pointer2++) =3D *(Pointer1++);

+  &= nbsp;             wh= ile (*Pointer1 !=3D L'&') {

+  &= nbsp;     *(Pointer2++) =3D *(Pointer1++= ;);

+  &= nbsp;   }

+  &= nbsp;             if= (NULL =3D=3D SctStrStr (Req, CfgHdr)){

+  &= nbsp;           &nbs= p;            &= nbsp;  if (*Req =3D=3D L'G')

+  &= nbsp;       *(Pointer3++) =3D L'&= ';

+  &= nbsp;     SctStrCat (Req, CfgHdr);

+  &= nbsp;     Pointer3 +=3D SctStrLen (CfgHdr);

+  &= nbsp;           &nbs= p;            &= nbsp;  Flag =3D 1;

+  &= nbsp;             } = else {

+  &= nbsp;     Flag =3D 0;

+  &= nbsp;             }&= nbsp;

+  &= nbsp; }

+  &= nbsp; while ((Flag =3D=3D 1) && (SctStrnCmp (Pointer1, L"&= GUID=3D", 6) !=3D 0) && *Pointer1) {

+  &= nbsp;   if (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8)= =3D=3D 0) {

+  &= nbsp;     *(Pointer3++) =3D *(Pointer1++= ;);

+  &= nbsp;           while (*Pointe= r1 !=3D L'&') {

+  &= nbsp;       *(Pointer3++) =3D *(Point= er1++);

+  &= nbsp;     }

+  &= nbsp;   }

+   =    if (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) = = =3D=3D 0) {

+  &= nbsp;     *(Pointer3++) =3D *(Pointer1++= ;);

+  &= nbsp;            &nb= sp;  while (*Pointer1 !=3D L'&') {

+  &= nbsp;       *(Pointer3++) =3D *(Point= er1++);

+  &= nbsp;     }

+  &= nbsp;             }<= o:p>

+  &= nbsp;             if= (SctStrnCmp (Pointer1, L"&VALUE=3D", 7) =3D=3D 0) {

+  &= nbsp;     Pointer1 +=3D 7;

+  &= nbsp;            &nb= sp;  while (*Pointer1 !=3D L'&' && *Pointer1) {=

+  &= nbsp;            &nb= sp;    Pointer1++;

+  &= nbsp;            &nb= sp;  }

+  &= nbsp;             }<= o:p>

+  &= nbsp;             if= (SctStrnCmp (Pointer1, L"&ALTCFG=3D", 8) =3D=3D 0) {

+  &= nbsp;     Pointer1 +=3D 8;

+   =              &n= bsp; while (*Pointer1 !=3D L'&' && *Pointer1) {=

+  &= nbsp;            &nb= sp;    Pointer1++;

+  &= nbsp;            &nb= sp;  }

+  &= nbsp;             }<= o:p>

+  &= nbsp;             if= ((*Pointer1 =3D=3D L'&') && (SctStrnCmp (Pointer1, L"&= ;GUID=3D", 6) !=3D 0) &&

+  &= nbsp;           &nbs= p;            &= nbsp;    (SctStrnCmp (Pointer1, L"&OFFSET=3D", 8) != = =3D 0) && (SctStrnCmp (Pointer1, L"&WIDTH=3D", 7) != =3D 0)) {

+  &= nbsp;     *(Pointer3++) =3D *(Pointer1++= ;);

+  &= nbsp;            &nb= sp;  while (*Pointer1 !=3D L'=3D') {

+  &= nbsp;       *(Pointer3++) =3D *(Point= er1++);

+  &= nbsp;            &nb= sp;  }

+  &= nbsp;            &nb= sp;  while (*Pointer1 !=3D L'&' && *Pointer1) {=

+  &= nbsp;       Pointer1++;

+  &= nbsp;            &nb= sp;  }

+  &= nbsp;             }<= o:p>

+  &= nbsp;           }

+  &= nbsp;           Pointer1&= #43;+;

+  }=

+

+  SctFre= ePool (FreePtr);

<= /o:p>

+  return= EFI_SUCCESS;

+}<= /span>

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfi= gAccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigA= ccess/BlackBoxTest/HIIConfigAccessBBTestMain.h

new file mode 1006= 44

index 00000000..c8= 1a00ca

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HII= ConfigAccessBBTestMain.h

@@ -0,0 +1,168= @@

+/** @file

+

+  Copyri= ght 2006 - 2013 Unified EFI, Inc.<BR>

+  Copyri= ght (c) 2010 - 2013, Intel Corporation. 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>

+**/

+/*++<= o:p>

+

+Module Name:<= o:p>

+

+  HIICon= figAccessBBTestMain.h

+

+Abstract:

+

+  Test D= river of HII Configuration Access Protocol header file

+

+--*/

+

+#ifndef _HII_= CONFIG_ACCESS_BB_TEST_MAIN

+#define _HII_= CONFIG_ACCESS_BB_TEST_MAIN

+

+#define __UEF= I_INTERNAL_FORMREPRESENTATION_H__

+#include <= Base.h>

+#include &quo= t;SctLib.h"

+#include &quo= t;Guid.h"

+#include <= Library/EfiTestLib.h>

+#include <= UEFI/Protocol/Hii.h>

+#include <= UEFI/Protocol/HIIConfigAccess.h>

+#include <= UEFI/Protocol/HIIConfigRouting.h>

+

+

+#define EFI_H= II_CONFIG_ACCESS_PROTOCOL_TEST_REVISION    0x00010000

+#define IHV_E= FI_HII_CONFIG_ACCESS_PROTOCOL_GUID \

+{ 0x68820884,= 0x4be3, 0x4ca9, { 0x83, 0x81, 0x9e, 0x98, 0xf3, 0xf4, 0x8d, 0xaf } }<= /o:p>

+//=

+// Entry GUID= s for Func Test

+//=

+#define EFI_H= II_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101 \

+{ 0x2a85387e,= 0xdcf9, 0x45e9, { 0xb3, 0x8f, 0x5d, 0xa1, 0x75, 0x41, 0xcf, 0x1a } }<= /o:p>

+

+#define EFI_H= II_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102 \

+{ 0x1a15df85,= 0x6cc1, 0x43f2, { 0x9b, 0x86, 0x21, 0x8b, 0xd5, 0xfd, 0xf4, 0xa0 } }<= /o:p>

+

+

+//=

+// Entry GUID= s for Conf Test

+//=

+#define EFI_H= II_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201 \

+{ 0xe2c3b0fe,= 0xfbe9, 0x46a9, { 0xa3, 0x1b, 0xa3, 0xf3, 0x82, 0xd, 0xcf, 0x4 } }

+

+#define EFI_H= II_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202 \

+{ 0x495c99f3,= 0x231, 0x45a5, { 0xaf, 0xfa, 0xd2, 0x5c, 0x6f, 0x9a, 0x19, 0x1c } }

+

+

+

+EFI_STATUS

+InitializeHII= ConfigAccessBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle,

+  IN EFI= _SYSTEM_TABLE          &n= bsp;  *SystemTable

+  );

<= /o:p>

<= /o:p>

+EFI_STATUS

+UnloadHIIConf= igAccessBBTest (

+  IN EFI= _HANDLE           &n= bsp;       ImageHandle

+  );

<= /o:p>

<= /o:p>

+//=

+//Test Cases<= o:p>

+//=

+/*=

+EFI_STATUS

+BBTestUnitTes= t (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+*/=

+EFI_STATUS

+BBTestExtract= ConfigConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

<= /o:p>

+EFI_STATUS

+BBTestRouteCo= nfigConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+/* 

+EFI_STATUS

+BBTestCallBac= kConformanceTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+*/ 

+EFI_STATUS

+BBTestExtract= ConfigFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

<= /o:p>

+EFI_STATUS

+BBTestRouteCo= nfigFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+/*  = ;

+EFI_STATUS

+BBTestCallBac= kFunctionTest (

+  IN EFI= _BB_TEST_PROTOCOL       *This,

+  IN VOI= D            &n= bsp;          *ClientInterface= ,

+  IN EFI= _TEST_LEVEL          &nbs= p;  TestLevel,

+  IN EFI= _HANDLE           &n= bsp;     SupportHandle

+  );

+*/=

+EFI_STATUS

+GetDevicePath= (

+  IN&nbs= p; EFI_HII_CONFIG_ACCESS_PROTOCOL       *Conf= igAccess,

+  OUT EF= I_STRING           &= nbsp;           &nbs= p;   *DevicePathStr

+  );

+

+EFI_STATUS

+GetCorrespond= ingRequest (

+  IN&nbs= p;    EFI_STRING    MultiConfigAltResp,<= /o:p>

+  IN&nbs= p;    EFI_STRING    DevicePath,

+  IN OUT= EFI_STRING    Request

+  );

+

+EFI_STATUS

+GetCorrespond= ingResp (

+  IN&nbs= p;    EFI_STRING    MultiConfigAltResp,<= /o:p>

+  IN&nbs= p;    EFI_STRING    DevicePath,

+  IN OUT= EFI_STRING    Resp

+  );

+

+EFI_STATUS

+GetHIIConfigR= outingInterface (

+  OUT EF= I_HII_CONFIG_ROUTING_PROTOCOL    **HIIConfigRouting

+  );

+

+EFI_STATUS

+MultiAltRespT= oMultiReq (

+  IN&nbs= p;      EFI_STRING     &n= bsp;            = ;         Resp,

+  IN OUT=    EFI_STRING        &nbs= p;             =      Req

+  );

+

+#endif

diff --git a/uefi-= sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIICo= nfigAccessBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfig= Access/BlackBoxTest/IhvHIIConfigAccessBBTest.inf

new file mode 1006= 44

index 00000000..11= 68986b

--- /dev/null=

+++ b/= uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Ihv= HIIConfigAccessBBTest.inf

@@ -0,0 +1,55 = @@

+## @file=

+#<= /span>

+#  Copyr= ight 2006 - 2012 Unified EFI, Inc.<BR>

+#  Copyr= ight (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>

+#  Copyr= ight (c) 2019, ARM Ltd. All rights reserved.<BR>

+#<= /span>

+#  This = program and the accompanying materials

+#  are l= icensed and made available under the terms and conditions of the BSD Licens= e

+#  which= accompanies this distribution.  The full text of the license may be f= ound at

+#  http:= //opensource.org/licenses/bsd-license.php

+# =

+#  THE P= ROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,<= o:p>

+#  WITHO= UT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+# =

+##=

+#/*++=

+#<= /span>

+# Module Name= :

+#<= /span>

+#  = HIIConfigAccessBBTest.inf

+#<= /span>

+# Abstract:

+#<= /span>

+#  = Component description file for IHV HII Config Access Protocol Black-Box Te= st.

+#<= /span>

+#--*/

+

+[defines]

+INF_VERSION&n= bsp;         =3D 0x00010005

+BASE_NAME&nbs= p;           =3D IhvHIICo= nfigAccessBBTest

+FILE_GUID&nbs= p;           =3D D39F2A3B= -72BF-40F5-86BF-2E1E96D15EA3

+MODULE_TYPE&n= bsp;         =3D UEFI_DRIVER

+VERSION_STRIN= G       =3D 1.0

+ENTRY_POINT&n= bsp;         =3D InitializeHIIConfi= gAccessBBTest

+

+[sources.comm= on]

+  HIICon= figAccessBBTestConformance.c

+  HIICon= figAccessBBTestFunction.c

+  HIICon= figAccessBBTestMain.c

+  Guid.c=

+

+[Packages]

+  SctPkg= /SctPkg.dec

+  SctPkg= /UEFI/UEFI.dec

+  MdePkg= /MdePkg.dec

+

+[LibraryClass= es]

+  UefiDr= iverEntryPoint

+  SctLib=

+  EfiTes= tLib

+

+[Protocols]

+  gBlack= BoxEfiHIIConfigAccessProtocolGuid

+  gBlack= BoxEfiHIIConfigRoutingProtocolGuid

+  gBlack= BoxEfiDevicePathProtocolGuid

diff --git a/uefi-= sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc

index 83396f1a..c3= afdbdd 100644

--- a/uefi-sct/Sct= Pkg/UEFI/IHV_SCT.dsc

+++ b/= uefi-sct/SctPkg/UEFI/IHV_SCT.dsc

@@ -210,9 +210= ,11 @@ SctPkg/TestCase/UEFI/IHV/Protocol/UsbIo/BlackBoxTest/IhvUsbIoTest.in= f

SctPkg/TestCase/UE= FI/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsOutputBBTest.inf

SctPkg/TestCase/UE= FI/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiPassThruBBTest.inf

SctPkg/TestCase/UE= FI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf

+SctPkg/TestCa= se/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.= inf

SctPkg/TestCase/UE= FI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiInitiatorNameBBTest= .inf

 <= /span>

 SctPkg/TestC= ase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolutePointerBBTest= .inf

+SctPkg/TestCa= se/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementB= BTest.inf

SctPkg/TestCase/UE= FI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvStorageSecurityComma= ndBBTest.inf

 <= /span>

 SctPkg/TestC= ase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoBBTest.inf

--

2.22.0.windows.1

IMPORTANT NOTICE: The contents of this email and an= y attachments are confidential and may also be privileged. If you are not t= he intended recipient, please notify the sender immediately and do not disc= lose the contents to any other person, use it for any purpose, or store or copy the information in any medium. T= hank you.

--_000_DA72DC7456565B47808A57108259571F637C3C92SHSMSX103ccrcor_--