From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: eric.jin@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Tue, 16 Jul 2019 19:58:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2019 19:58:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,272,1559545200"; d="scan'208";a="366870683" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 16 Jul 2019 19:58:22 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 16 Jul 2019 19:58:22 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 16 Jul 2019 19:58:21 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.109]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.60]) with mapi id 14.03.0439.000; Wed, 17 Jul 2019 10:58:19 +0800 From: "Eric Jin" To: "devel@edk2.groups.io" , "Jin, Eric" , shrishail CC: "supreeth.venkatesh@arm.com" , "Jeff.Booher-Kaeding@arm.com" Subject: [edk2-test][PATCH] Adding FMP to IHVSCT. Thread-Topic: [edk2-test][PATCH] Adding FMP to IHVSCT. Thread-Index: AdU8S3VP90rf6hGOR7KnhBMjBfty/g== Date: Wed, 17 Jul 2019 02:58:19 +0000 Message-ID: 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Add subject prefix [edk2-test] for better sorting -----Original Message----- From: devel@edk2.groups.io On Behalf Of Eric Jin Sent: Wednesday, July 17, 2019 10:54 AM To: shrishail ; devel@edk2.groups.io Cc: supreeth.venkatesh@arm.com; Jeff.Booher-Kaeding@arm.com Subject: [edk2-devel] FW: [PATCH] Adding FMP to IHVSCT. Forward to devel@edk2.groups.io with public review. -----Original Message----- From: shrishail =20 Sent: Friday, July 12, 2019 5:49 PM To: Jin, Eric Cc: shrishailp <50140165+shrishailp@users.noreply.github.com> Subject: [PATCH] Adding FMP to IHVSCT. From: shrishailp <50140165+shrishailp@users.noreply.github.com> Adding FMP to IHVSCT. --- uefi-sct/SctPkg/CommonGenFramework.bat | 2 +- uefi-sct/SctPkg/CommonGenFramework.sh | 2 +- uefi-sct/SctPkg/Config/Data/Category.ini | 7 + .../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 + uefi-sct/SctPkg/UEFI/IHV_SCT.dsc | 1 + 11 files changed, 5252 insertions(+), 2 deletions(-) create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/FirmwareManagementBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/FirmwareManagementBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/FirmwareManagementBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/FirmwareManagementBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMan= agement/BlackBoxTest/IhvFirmwareManagementBBTest.inf diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/Comm= onGenFramework.bat index 5c614eaa..a4302699 100644 --- a/uefi-sct/SctPkg/CommonGenFramework.bat +++ b/uefi-sct/SctPkg/CommonGenFramework.bat @@ -279,7 +279,7 @@ 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 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..d0759885 100755 --- a/uefi-sct/SctPkg/CommonGenFramework.sh +++ b/uefi-sct/SctPkg/CommonGenFramework.sh @@ -312,7 +312,7 @@ 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 # ********************************************* # Copy the UEFI 2.1 Test Cases for IHV # ********************************************* diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-sct/SctPkg/Co= nfig/Data/Category.ini index 3e9f5e52..9985381a 100644 --- a/uefi-sct/SctPkg/Config/Data/Category.ini +++ b/uefi-sct/SctPkg/Config/Data/Category.ini @@ -740,6 +740,13 @@ Description =3D FirmwareManagement Protocol Test =20 [Category Data] Revision =3D 0x00010000 +CategoryGuid =3D 941D02A8-49AD-4BDA-9FAE-0A6924541C88 +InterfaceGuid =3D 86C77A67-0B97-4633-A187-49104D0685C7 +Name =3D IHV\FirmwareManagementTest\FirmwareManagementProtocol +Description =3D FirmwareManagement Protocol Test + +[Category Data]=20 +Revision =3D 0x00010000 CategoryGuid =3D 3F10CFD2-6CB6-4A2B-919A-B63B839A0363 InterfaceGuid =3D 59324945-EC44-4C0D-B1CD-9DB139DF070C Name =3D IHV\ISCSIBootTest\ISCSIInitiatorNameProtocol 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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + +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 +//=20 +//=20 +// **********************************************************************= ****** + +// **********************************************************************= ****** +// 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 (=20 + 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 (=20 + 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 (=20 + 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 +//=20 +//=20 +// **********************************************************************= ****** + +/* +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 +// **********************************************************************= ****** +=20 +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; + + //=20 + // 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; + + //=20 + // 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 + //=20 + + 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; + + //=20 + // 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 + //=20 + + 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; + + //=20 + // 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 + //=20 + + 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 +// **********************************************************************= ****** +=20 +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; + + //=20 + // 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 + //=20 + + 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 +//=20 +//=20 +// **********************************************************************= ****** + +// **********************************************************************= ****** +// 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 (=20 + 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 + //=20 +=20 +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 (=20 + 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 + //=20 +=20 +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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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;=20 + } + BufferImage =3D Image; + + ImageSize =3D 1; + FunctionTested++; + Status =3D FirmwareManagement->GetImage (=20 + 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;=20 + } + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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 (=20 + 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;=20 + } + } + + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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;=20 + } + 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 (=20 + FirmwareManagement, + ImageIndex, + Image, + &ImageSize + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND))= { + goto Exit;=20 + } + + if ((DescriptorCount + 1) !=3D 0) { + ImageIndex =3D DescriptorCount + 1; + Status =3D FirmwareManagement->GetImage (=20 + FirmwareManagement, + ImageIndex,=20 + Image, + &ImageSize + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_NOT_FOUND= )) { + goto Exit;=20 + } + } + + // + // 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=20 + authentication data. =20 + 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; +=20 + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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;=20 + } + BufferImage =3D Image; + + FunctionTested++; + + Status =3D FirmwareManagement->GetImage (=20 + FirmwareManagement, + p->ImageIndex, + Image, + &ImageSize + ); + gtBS->FreePool (BufferImage); + BufferImage =3D NULL; + Image =3D NULL; =20 + + // + // 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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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 (=20 + 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;=20 + } + } + + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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 (=20 + 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;=20 + } + } + + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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;=20 + } + 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 (=20 + FirmwareManagement, + ImageIndex, + Image, + ImageSize, + NULL, // VendorCode + Progress, + &AbortReason + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED)) { + goto Exit;=20 + } + + if ((DescriptorCount + 1) !=3D 0) { + ImageIndex =3D DescriptorCount + 1; + Status =3D FirmwareManagement->SetImage (=20 + FirmwareManagement, + ImageIndex,=20 + Image, + ImageSize, + NULL, // Vendorcode + Progress, + &AbortReason + ); + if ((Status !=3D EFI_INVALID_PARAMETER) && (Status !=3D EFI_ABORTED))= { + goto Exit;=20 + } + } + + // + // 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=20 + authentication data. =20 + 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; +=20 + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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 (=20 + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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 (=20 + 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;=20 + } + } + + 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=20 + authentication data. =20 + 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 (=20 + 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 (=20 + 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; + } + }=20 + 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 (=20 + 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=20 + PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) && + ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D + PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) { + goto Exit; + } + if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D=20 + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D=20 + 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 + //=20 +=20 +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=20 + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D=20 + 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 + //=20 + +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=20 + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D=20 + 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 + //=20 + +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=20 + 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=20 + PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) { + goto Exit; + } + if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=3D=20 + 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 + //=20 + +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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + +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 +//=20 +//=20 +// **********************************************************************= ****** + +/* +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; + + //=20 + // 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 +// **********************************************************************= ****** +=20 +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 +// +//=20 +// **********************************************************************= ****** + +// **********************************************************************= ****** +// 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.=20 + - 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 (=20 + 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 (=20 + 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;=20 + } +=20 + 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;=20 + } + + 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;=20 + } + + 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;=20 + } + } + +#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; +}=20 + +// **********************************************************************= ****** +// 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 (=20 + 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 (=20 + 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; + } + }=20 + 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=20 + 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;=20 + } + BufferImage =3D Image; + + FunctionTested++; + Status =3D FirmwareManagement->GetImage (=20 + 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;=20 + } + } + BufferImage =3D Image; + + Status =3D FirmwareManagement->GetImage (=20 + 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; + =20 + 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;=20 + } + + if ((AttributesSetting & 0xFFFFFFFFFFFFFFF8) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"*AttributesSetting has bit(s) set beyond bit2= ."; + goto Exit;=20 + } + + // + // Report the checkpoint result + //=20 +=20 +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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + +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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + +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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + + 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=20 + http://opensource.org/licenses/bsd-license.php +=20 + 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. +=20 +**/ +/*++ + + 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=20 +# http://opensource.org/licenses/bsd-license.php +#=20 +# 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. +#=20 +## +#/*++ +# +# 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/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_S= CT.dsc index 83396f1a..a62e5634 100644 --- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc +++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc @@ -213,6 +213,7 @@ SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/= IhvScsiIoBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScs= iInitiatorNameBBTest.inf =20 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/Ihv= StorageSecurityCommandBBTest.inf =20 SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfo= BBTest.inf --=20 2.22.0.windows.1