From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: microchip.com, ip: 216.71.154.253, mailfrom: shrishail.patil@microchip.com) Received: from esa6.microchip.iphmx.com (esa6.microchip.iphmx.com [216.71.154.253]) by groups.io with SMTP; Tue, 16 Jul 2019 20:11:58 -0700 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Shrishail.Patil@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Shrishail.Patil@microchip.com"; x-sender="Shrishail.Patil@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Shrishail.Patil@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=Shrishail.Patil@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: HJQf0Gcok0hs0pZ/2zD3ySdnSfESQTdYfdeSQc2e7trLH4kkWRUAxCCxyuYgiWTSFeqxAa/JrR lp5L4mOyipoYpKdbfZhmPe066H2rQ8I9+mf6JVfiLuz/m2yT4U3BNd7jsIZvwL7NU3q5PwfaNf +keiTBq926NcUuoqJuLweGwgfxUa8pNn93QpWiswF+BQ+WpSJ2jFSB7ttIzdGrxEzP521GEC0w cVfiLMJrFQEJlEHHKu0VRReXvJvVk/KFAQUgDe70N8Hegic70UJlavg7xBVkGWRU1OJ3yw7VMP gv0= X-IronPort-AV: E=Sophos;i="5.64,272,1559545200"; d="scan'208";a="38557799" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jul 2019 20:11:57 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 16 Jul 2019 20:11:56 -0700 Received: from INB-LT-I31184A.mchp-main.com (10.10.85.251) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 16 Jul 2019 20:11:55 -0700 From: shrishail.patil@microchip.com To: CC: shrishailp <50140165+shrishailp@users.noreply.github.com> Subject: [edk2-test][PATCH] Adding FMP to IHVSCT. Date: Wed, 17 Jul 2019 08:41:45 +0530 Message-ID: <20190717031145.765-1-shrishail.patil@microchip.com> X-Mailer: git-send-email 2.22.0.windows.1 MIME-Version: 1.0 Return-Path: shrishail.patil@microchip.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestConformance.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestFunction.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestMain.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/FirmwareManagementBBTestMain.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/Guid.c create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/Guid.h create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMana= gement/BlackBoxTest/IhvFirmwareManagementBBTest.inf diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/Commo= nGenFramework.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 %Framework= %\Test\ > NUL=0D copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi %Framework= %\Test\ > NUL=0D copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi %Framework= %\Test\ > NUL=0D - =0D + copy %ProcessorType%\IhvFirmwareManagementBBTest.efi %Framework= %\Test\ > NUL=0D rem *********************************************=0D rem Copy the UEFI 2.1 Test Cases for IHV=0D rem *********************************************=0D diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/Common= GenFramework.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/Te= st/ > NUL cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi $Framework/Te= st/ > NUL cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi $Framework/Te= st/ > NUL - + cp $ProcessorType/IhvFirmwareManagementBBTest.efi $Framework/Te= st/ > NUL # ********************************************* # Copy the UEFI 2.1 Test Cases for IHV # ********************************************* diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-sct/SctPkg/Con= fig/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 =0D [Category Data]=0D Revision =3D 0x00010000=0D +CategoryGuid =3D 941D02A8-49AD-4BDA-9FAE-0A6924541C88=0D +InterfaceGuid =3D 86C77A67-0B97-4633-A187-49104D0685C7=0D +Name =3D IHV\FirmwareManagementTest\FirmwareManagementProtocol=0D +Description =3D FirmwareManagement Protocol Test=0D +=0D +[Category Data] =0D +Revision =3D 0x00010000=0D CategoryGuid =3D 3F10CFD2-6CB6-4A2B-919A-B63B839A0363=0D InterfaceGuid =3D 59324945-EC44-4C0D-B1CD-9DB139DF070C=0D Name =3D IHV\ISCSIBootTest\ISCSIInitiatorNameProtocol=0D diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestConformance.c b/uefi-sct/SctPkg/TestCa= se/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTe= stConformance.c new file mode 100644 index 00000000..95d36dc7 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestConformance.c @@ -0,0 +1,3632 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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,=20=20 + 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*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManag= ement); + BBTestGetImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManag= ement); + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: GetImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + //=20 + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + //=20 + + Status =3D CheckForSupportGetImage (StandardLib, FirmwareManagement); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagemen= t); + BBTestGetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagemen= t); +=20=20 + 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*)ClientInterfac= e; + + 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, FirmwareManagemen= t); + //BBTestSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagem= ent); + BBTestSetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagemen= t); + BBTestSetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagemen= t); +=20=20 + 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*)ClientInterfac= e; + + 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, FirmwareManagem= ent); + BBTestCheckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagem= ent); +=20=20 + 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*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Check if function is supported + //=20 + + Status =3D CheckForSupportSetPackageInfo (StandardLib, FirmwareManagemen= t); + if (Status =3D=3D EFI_UNSUPPORTED) { + return Status; + } + + // + // Call check point(s) + // + + BBTestSetPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareMan= agement); + BBTestSetPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareMan= agement); +=20=20 + 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 NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestGetImageInfoConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid002; + ResultMessageLabel =3D L"GetImageInfo, conformance checkpoint #2"; + ResultMessageData =3D L"correctly returned EFI_INVALID_PARAMETER."; + + ImageInfo =3D NULL; + PackageVersionName =3D NULL; + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + // + // Check the data returned by the function + // + + Status =3D FirmwareManagement->GetImageInfo (=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit;=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL. + ImageSize =3D p->Size * 2; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->GetImage (=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // 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_NO= T_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=20=20=20=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; +=20=20 + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL. + ImageSize =3D p->Size * 2; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit;=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=20=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;=20=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_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image =3D NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid007; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #1"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->SetImage (=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->SetImage (=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 EF= I_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 EF= I_ABORTED."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetImage, 3 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except ImageIndex =3D 0 or + ImageIndex =3D DescriptorCount + 1. + The function should return EFI_INVALID_PARAMETER or EFI_ABORTED. +**/ + +EFI_STATUS +BBTestSetImageConformanceTestCheckpoint3 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + VOID *BufferImage; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + CHAR16 *AbortReason; + + VOID *Image; + UINTN ImageSize; + UINT8 ImageIndex; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid009; + ResultMessageLabel =3D L"SetImage, conformance checkpoint #3"; + + BufferImageInfo =3D NULL; + BufferImage=3DNULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + AbortReason =3D NULL; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // 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_AB= ORTED."; + + 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=20=20=20=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; +=20=20 + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->SetImage (=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;=20=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_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + if (AbortReason !=3D NULL) { + gtBS->FreePool (AbortReason); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: CheckImage, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with valid parameters, except Image =3D NULL. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestCheckImageConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo; + + UINTN ImageInfoSize; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo; + UINT32 DescriptorVersion; + UINT8 DescriptorCount; + UINTN DescriptorSize; + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + + UINT32 ImageUpdatable; + + VOID *Image; + UINTN ImageSize; + + UINTN i; + EFI_FIRMWARE_IMAGE_DESCRIPTOR *p; + UINTN FunctionTested; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid011; + ResultMessageLabel =3D L"CheckImage, conformance checkpoint #1"; + + BufferImageInfo =3D NULL; + ImageInfo =3D NULL; + Image =3D NULL; + PackageVersionName =3D NULL; + FunctionTested =3D 0; + + // Use a sufficiently large buffer to obtain EFI_SUCCESS, + // since some implementation does NOT correctly return EFI_BUFFER_TOO_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Image =3D NULL; + FunctionTested++; + Status =3D FirmwareManagement->CheckImage (=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=20=20=20=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)= !=3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != =3D IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) { + continue; + } + if (p->Size =3D=3D 0) { + continue; + } + if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + BufferImage =3D Image; + FunctionTested++; + Status =3D FirmwareManagement->CheckImage (=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;=20=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_SECURITY_VIOLATION"; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: SetPackageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Gets PackageVersionNameMaxLen. + - Calls function with valid parameters, except PackageVersionName is l= onger + than the value returned in PackageVersionNameLen. + The function should return EFI_INVALID_PARAMETER. +**/ + +EFI_STATUS +BBTestSetPackageInfoConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; + + CHAR16 *TestName; + UINT32 TestNameLength; + + UINTN i; + + // + // Init + // + + Status =3D EFI_SUCCESS; + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + TestGuid =3D gFirmwareManagementBBTestConformanceAssertionGuid013; + ResultMessageLabel =3D L"SetPackageInfo, function checkpoint #1"; + + PackageVersionName =3D NULL; + TestName =3D NULL; + + // + // Get PackageVersionNameMaxLen + // + + Status =3D FirmwareManagement->GetPackageInfo ( + FirmwareManagement, + &PackageVersion, + &PackageVersionName, + &PackageVersionNameMaxLen, + &AttributesSupported, + &AttributesSetting + ); + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + ResultMessageData =3D L"test skipped - test case does not apply."; + if (PackageVersionNameMaxLen =3D=3D 0) { + goto Exit; + } + if (((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) = =3D=3D=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; +=20=20 + // + // 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,=20=20 + 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,=20=20 + 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/FirmwareManagementBBTestF= unction.c new file mode 100644 index 00000000..99a74aa5 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestFunction.c @@ -0,0 +1,891 @@ +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManageme= nt); +=20=20 + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Test Case: GetImage +// ***********************************************************************= ***** + +EFI_STATUS +BBTestGetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement; + + // + // Init + // + + FirmwareManagement =3D (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetImageFunctionTestCheckpoint1 (StandardLib, FirmwareManagement); +=20=20 + 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*)ClientInterfac= e; + + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Call check point(s) + // + + BBTestGetPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManage= ment); +=20=20 + return EFI_SUCCESS; +} +=20=20 +// ***********************************************************************= ***** +// 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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + 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 bi= t3."; + goto Exit;=20 + } + + if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"AttributesSetting has bit(s) set beyond bit3= ."; + goto Exit;=20 + } + + if ((p->Compatibilities & 0x000000000000FFFE) !=3D0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"Compatibilities have bit(s) set between bit1= and bit15."; + goto Exit;=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%0= 2x%02x%02x%02x", + p->ImageIndex, + p->ImageTypeId.Data1, + p->ImageTypeId.Data2, + p->ImageTypeId.Data3, + p->ImageTypeId.Data4[0], + p->ImageTypeId.Data4[1], + p->ImageTypeId.Data4[2], + p->ImageTypeId.Data4[3], + p->ImageTypeId.Data4[4], + p->ImageTypeId.Data4[5], + p->ImageTypeId.Data4[6], + p->ImageTypeId.Data4[7] + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - ImageId =3D %016X\n" + L" - *ImageIdName =3D %s\n" + L" - Version =3D %08x\n" + L" - *VersionName =3D %s\n" + L" - Size =3D %x", + p->ImageId, + p->ImageIdName, + p->Version, + p->VersionName, + p->Size + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - AttributesSupported =3D %016x\n" + L" - AttributesSetting =3D %016x", + p->AttributesSupported, + p->AttributesSetting + ); + for (j =3D 1, k =3D 0; j <=3D IMAGE_ATTRIBUTE_IN_USE; j =3D SctLShiftU= 64(j, 1), k++) { + BitField =3D Attribute[k]; + if ((p->AttributesSupported & j) !=3D j) { + BitSetting =3D L"Not Supported"; + } else if ((p->AttributesSetting & j) =3D=3D j) { + BitSetting =3D L"Yes"; + } else { + BitSetting =3D L"No"; + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - %s =3D %s", + BitField, + BitSetting + ); + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - Compatibilities =3D %016x\n", + p->Compatibilities + ); + } + +#endif + + // + // Report the checkpoint result + // + + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + + return EFI_SUCCESS; +}=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_SM= ALL. + // Check for EFI_BUFFER_TOO_SMALL in another conformance test. + + ImageInfoSize =3D (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageInfoSize, + (VOID **) &ImageInfo + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit; + } + + Status =3D FirmwareManagement->GetImageInfo (=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 + }=20=20 + if ((DescriptorCount * DescriptorSize) > ImageInfoSize) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"((*DescriptorCount) * (*DescriptorSize)) > *Im= ageInfoSize."; + goto Exit; // Note the Status =3D EFI_SUCCESS + }=20=20 + + // + // Check the data returned by the function + // + + for (i =3D 0; i < DescriptorCount; i++) { + p =3D (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * = DescriptorSize)); + + if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED= ) =3D=3D=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 IM= AGE_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) !=3D IMAG= E_ATTRIBUTE_IMAGE_UPDATABLE) { + continue; + } + + ImageSize =3D p->Size; + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + ImageSize, + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"test case initialization failure."; + goto Exit;=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_UNSUPPOR= TED."; + goto Exit;=20=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_SUCCESS or EFI_UNSUPPOR= TED."; + } + +Exit: + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + TestGuid, + ResultMessageLabel, + L"Result - %s\n%a:%d: Status - %r", + ResultMessageData, + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (PackageVersionName !=3D NULL) { + gtBS->FreePool (PackageVersionName); + } + if (BufferImageInfo !=3D NULL) { + gtBS->FreePool (BufferImageInfo); + } + if (BufferImage !=3D NULL) { + gtBS->FreePool (BufferImage); + } + + return EFI_SUCCESS; +} + +// ***********************************************************************= ***** +// Checkpoint: GetPackageInfo, 1 +// ***********************************************************************= ***** + +/** + This routine: + - Calls function with all valid parameters. + The function should return EFI_SUCCESS or EFI_UNSUPPORTED. + - Checks AttributesSupported has no bits set beyond bit2. + - Checks AttributesSetting has no bits set beyond bit2. +**/ + +EFI_STATUS +BBTestGetPackageInfoFunctionTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement + ) +{ + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_GUID TestGuid; + CHAR16 *ResultMessageLabel; + CHAR16 *ResultMessageData; + + UINT32 PackageVersion; + CHAR16 *PackageVersionName; + UINT32 PackageVersionNameMaxLen; + UINT64 AttributesSupported; + UINT64 AttributesSetting; +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=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_UNSUPPOR= TED."; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + ResultMessageData =3D L"failed to return EFI_SUCCESS or EFI_UNSUPPORTE= D."; + goto Exit; + } + +#if (DEBUG_ALL || DEBUG_GET_PACKAGE_INFO) + + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L"Firmware Package Info: \n" + L" - *PackageVersion =3D %08x\n" + L" - **PackageVersionName =3D %s\n" + L" - *PackageVersionNameMaxLen =3D %08x", + PackageVersion, + PackageVersionName, + PackageVersionNameMaxLen + ); + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - *AttributesSupported =3D %016x\n" + L" - *AttributesSetting =3D %016x", + AttributesSupported, + AttributesSetting + ); + for (j =3D 1, k =3D 0; j <=3D PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED;= j =3D SctLShiftU64(j, 1), k++) { + BitField =3D Attribute[k]; + if ((AttributesSupported & j) !=3D j) { + BitSetting =3D L"Not Supported"; + } else if ((AttributesSetting & j) =3D=3D j) { + BitSetting =3D L"Yes"; + } else { + BitSetting =3D L"No"; + } + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_QUIET, + L" - %s =3D %s", + BitField, + BitSetting + ); + } + +#endif + + if ((AttributesSupported & 0xFFFFFFFFFFFFFFF8) !=3D 0) { + AssertionType =3D EFI_TEST_ASSERTION_WARNING; + ResultMessageData =3D L"*AttributesSupported has bit(s) set beyond bit= 2."; + goto Exit;=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/UEFI= /IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.c new file mode 100644 index 00000000..3ce62795 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestMain.c @@ -0,0 +1,228 @@ +/** @file + + Copyright 2006 - 2017 Unified EFI, Inc.
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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, 0x= b0, 0x6d } }, + L"Unit Test Only", + L"Verify the Assistant Function", + EFI_TEST_LEVEL_DEFAULT, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestUnitTest + }, + */ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101, + L"Function_Test-GetImageInfo", + L"Function auto test for Firmware Management Protocol GetImageInfo().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageInfoFunctionTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102, + L"Function_Test-GetImage", + L"Function auto test for Firmware Management Protocol GetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageFunctionTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103, + L"Function Test - SetImage", + L"Function auto test for Firmware Management Protocol SetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetImageFunctionTest + }, +--*/ +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104, + L"Function Test - CheckImage", + L"Function auto test for Firmware Management Protocol CheckImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCheckImageFunctionTest + }, +--*/ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105, + L"Function_Test-GetPackageInfo", + L"Function auto test for Firmware Management Protocol GetPackageInfo()= .", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetPackageInfoFunctionTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106, + L"Function Test - SetPackageInfo", + L"Function auto test for Firmware Management Protocol SetPackageInfo()= .", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetPackageInfoFunctionTest + }, +--*/=20=20 + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201, + L"Conformance_Test-GetImageInfo", + L"Conformance auto test for Firmware Management Protocol GetImageInfo(= ).", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageInfoConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202, + L"Conformance_Test-GetImage", + L"Conformance auto test for Firmware Management Protocol GetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetImageConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203, + L"Conformance_Test-SetImage", + L"Conformance auto test for Firmware Management Protocol SetImage().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetImageConformanceTest + }, + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204, + L"Conformance_Test-CheckImage", + L"Conformance auto test for Firmware Management Protocol CheckImage().= ", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestCheckImageConformanceTest + }, +/*++ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205, + L"Conformance Test - GetPackageInfo", + L"Conformance auto test for Firmware Management Protocol GetPackageInf= o().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestGetPackageInfoConformanceTest + }, +--*/ + { + EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206, + L"Conformance_Test-SetPackageInfo", + L"Conformance auto test for Firmware Management Protocol SetPackageInf= o().", + EFI_TEST_LEVEL_MINIMAL, + gSupportProtocolGuid, + EFI_TEST_CASE_AUTO, + BBTestSetPackageInfoConformanceTest + }, + 0 +}; + +// ***********************************************************************= ***** +// Initialization and Unload functions +// ***********************************************************************= ***** + + +EFI_STATUS +EFIAPI +InitializeFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EfiInitializeTestLib (ImageHandle, SystemTable); + + // + // initialize test utility lib + // + + SctInitializeLib (ImageHandle, SystemTable); + + mImageHandle =3D ImageHandle; + + return EfiInitAndInstallIHVBBTestInterface ( + &ImageHandle, + &gBBTestProtocolField, + gBBTestEntryField, + UnloadFirmwareManagementBBTest, + &gBBTestProtocolInterface + ); +} + +EFI_STATUS +EFIAPI +UnloadFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle + ) +{ + return EfiUninstallAndFreeIHVBBTestInterface ( + ImageHandle, + gBBTestProtocolInterface + ); +} + +// ***********************************************************************= ***** +// Support functions +// ***********************************************************************= ***** + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/FirmwareManagementBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI= /IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.h new file mode 100644 index 00000000..92ac3e45 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/FirmwareManagementBBTestMain.h @@ -0,0 +1,223 @@ +/** @file + + Copyright 2006 - 2017 Unified EFI, Inc.
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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, 0x= cf } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203 \ +{ 0x12834a23, 0x6cef, 0x478e, { 0xaf, 0x48, 0x44, 0xe5, 0x93, 0x40, 0xab, = 0xe8 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204 \ +{ 0xc6dc94b1, 0xb81b, 0x4b85, { 0x8b, 0x7d, 0x8f, 0xbf, 0xa6, 0x8e, 0xf3, = 0xe5 } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205 \ +{ 0x3d13f23d, 0x8306, 0x49d4, { 0xa0, 0xe0, 0x9a, 0x9b, 0xf6, 0x89, 0x40, = 0x3c } } + +#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206 \ +{ 0x24cf9ac2, 0x9abc, 0x4f5c, { 0x9c, 0x7a, 0xbc, 0x22, 0x29, 0xc3, 0x2, 0= x7f } } + +// ***********************************************************************= ***** +// Initializaiton and Unload functions +// ***********************************************************************= ***** + +EFI_STATUS +EFIAPI +InitializeFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +=20=20 +EFI_STATUS +EFIAPI +UnloadFirmwareManagementBBTest ( + IN EFI_HANDLE ImageHandle + ); +=20=20 +// +// Test Cases - Unit Test +// + +/* +EFI_STATUS +BBTestUnitTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); +*/ + +// +// Test Cases - Function +// + +EFI_STATUS +BBTestGetImageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestCheckImageFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetPackageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetPackageInfoFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +// +// Test Cases - Conformance +// + +EFI_STATUS +BBTestGetImageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestCheckImageConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestGetPackageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +EFI_STATUS +BBTestSetPackageInfoConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +// ***********************************************************************= ***** +// Support functions +// ***********************************************************************= ***** + +#endif diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMa= nagement/BlackBoxTest/Guid.c new file mode 100644 index 00000000..c33d5b79 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/Guid.c @@ -0,0 +1,63 @@ +/** @file + + Copyright 2006 - 2012 Unified EFI, Inc.
+ Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002=3DEFI_TEST_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003=3DEFI_TEST_FIRM= WAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID; + +// ***********************************************************************= ***** +// Conformance +// ***********************************************************************= ***** + +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004=3DEFI_TEST_FIR= MWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID; + +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID; +EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016=3DEFI_TEST_F= IRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareMa= nagement/BlackBoxTest/Guid.h new file mode 100644 index 00000000..d2b2e51d --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/Guid.h @@ -0,0 +1,153 @@ +/** @file + + Copyright 2006 - 2010 Unified EFI, Inc.
+ Copyright (c) 2010, Dell Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at=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 IMP= LIED. +=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, 0x= 31 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID \ +{ 0xff704c46, 0x3999, 0x4a28, { 0xa3, 0x6e, 0x76, 0x8a, 0xb6, 0xad, 0x89, = 0xd8 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID \ +{ 0x70884539, 0x9a34, 0x4146, { 0x83, 0x3a, 0x4d, 0x89, 0x8b, 0x9c, 0x7e, = 0xa4 } } + +extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003; + +// ***********************************************************************= ***** +// Conformance - Function Support Check +// ***********************************************************************= ***** + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID \ +{ 0xd9c7d018, 0x60ba, 0x448d, { 0xb1, 0x3b, 0x88, 0x8b, 0x41, 0xd9, 0xdc, = 0x9 } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID \ +{ 0x28310f16, 0x690e, 0x44a5, { 0x93, 0x98, 0xe1, 0xcd, 0x6a, 0xb3, 0xe1, = 0x61 } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID \ +{ 0x92cc940a, 0xdcf8, 0x42a0, { 0x81, 0xa1, 0xd7, 0xdd, 0x43, 0x87, 0xbf, = 0x6d } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID \ +{ 0x3f910041, 0xcd4d, 0x4b36, { 0xb2, 0x23, 0xfb, 0x16, 0x4e, 0x7e, 0x6a, = 0x8c } }; + +extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004; + +// ***********************************************************************= ***** +// Conformance - Assertion +// ***********************************************************************= ***** + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID \ +{ 0x3789b80e, 0xab70, 0x4dc9, { 0xbb, 0xbd, 0x70, 0x63, 0x76, 0x36, 0xab, = 0x52 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID \ +{ 0xca1d7706, 0x256b, 0x464e, { 0xb6, 0xee, 0x50, 0x34, 0x1e, 0xec, 0x3c, = 0x83 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID \ +{ 0x3c8d87b2, 0x6a89, 0x4a6c, { 0xbc, 0x75, 0xe6, 0x86, 0xa1, 0x49, 0x13, = 0xf0 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID \ +{ 0x88031c96, 0x99bf, 0x4d2c, { 0x9f, 0x57, 0xa7, 0x2, 0x6a, 0xbc, 0xd3, 0= x51 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID \ +{ 0x7a386361, 0x3a5d, 0x4e58, { 0x8a, 0x51, 0x4d, 0x93, 0xb6, 0x55, 0x95, = 0xf4 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID \ +{ 0xd6a77629, 0x5afd, 0x4854, { 0x87, 0xc8, 0xee, 0x9f, 0xc5, 0x3d, 0xbe, = 0x3d } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID \ +{ 0x4ea24764, 0xa6b1, 0x43b5, { 0xb8, 0xa0, 0xd3, 0x3f, 0xdc, 0x8b, 0xc6, = 0xe4 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID \ +{ 0x712ce1e9, 0x80d1, 0x4168, { 0xb8, 0xd0, 0x74, 0xd1, 0x72, 0x7a, 0x2f, = 0x25 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID \ +{ 0xc82d1373, 0x1f87, 0x45f4, { 0xaf, 0xfc, 0x10, 0xa7, 0xf7, 0xb0, 0x9c, = 0xb0 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID \ +{ 0x2410a859, 0xdf6f, 0x4857, { 0x92, 0x4a, 0x26, 0x37, 0x7, 0x11, 0xf, 0x= 1c } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID \ +{ 0x3987172c, 0xe6a0, 0x4099, { 0xb1, 0x2b, 0xd8, 0xef, 0xf2, 0x62, 0x75, = 0x93 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID \ +{ 0xd6dad28e, 0x7f0f, 0x4f56, { 0x9a, 0x93, 0x14, 0x7d, 0xb3, 0x74, 0x0, 0= xc9 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID \ +{ 0xb5288fc3, 0xe906, 0x4468, { 0x83, 0x3d, 0xd4, 0xa6, 0x58, 0xa5, 0x4f, = 0xbd } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID \ +{ 0x57355301, 0x1343, 0x497f, { 0xbe, 0xe0, 0x8e, 0x5c, 0x27, 0xd2, 0x40, = 0x25 } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID \ +{ 0xadeab82d, 0x7592, 0x40fe, { 0x87, 0xa8, 0x93, 0x2b, 0xad, 0x97, 0xff, = 0x5e } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015; + +#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID \ +{ 0x9be658d2, 0x1312, 0x4254, { 0x91, 0x10, 0x59, 0x0, 0xd5, 0xfd, 0x6c, 0= x6c } } + +extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/= BlackBoxTest/IhvFirmwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UEF= I/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.= inf new file mode 100644 index 00000000..7566a044 --- /dev/null +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBo= xTest/IhvFirmwareManagementBBTest.inf @@ -0,0 +1,52 @@ +## @file +# +# Copyright 2006 - 2012 Unified EFI, Inc.
+# Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at=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: +# +# 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_SC= T.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/I= hvScsiIoBBTest.inf SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsi= InitiatorNameBBTest.inf=0D =0D SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolute= PointerBBTest.inf=0D +SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmw= areManagementBBTest.inf=0D SctPkg/TestCase/UEFI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvS= torageSecurityCommandBBTest.inf=0D =0D SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoB= BTest.inf=0D --=20 2.22.0.windows.1