From: <Shrishail.Patil@microchip.com>
To: <devel@edk2.groups.io>
Cc: <Supreeth.Venkatesh@arm.com>, <Jabir.M@microchip.com>,
<Anoop.PA@microchip.com>
Subject: [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT
Date: Mon, 17 Jun 2019 09:18:09 +0000 [thread overview]
Message-ID: <BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0@BN6PR1101MB2355.namprd11.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 279677 bytes --]
Hi Team,
Adding Firmware Management Protocol and HII Config Access Protocol into IHVSCT.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shrishail Patil <Shrishail.patil@microchip.com<mailto:Shrishail.patil@microchip.com>>
From: shrishailp <50140165+shrishailp@users.noreply.github.com>
Date: Fri, 10 May 2019 14:40:20 +0530
Subject: [PATCH] Adding FMP and HII Config Access protocol into IHVSCT
Added FMP and HII config access protocol into IHVSCT.
---
uefi-sct/SctPkg/CommonGenFramework.bat | 3 +-
uefi-sct/SctPkg/CommonGenFramework.sh | 3 +-
.../FirmwareManagementBBTestConformance.c | 3632 +++++++++++++++++
.../FirmwareManagementBBTestFunction.c | 891 ++++
.../FirmwareManagementBBTestMain.c | 228 ++
.../FirmwareManagementBBTestMain.h | 223 +
.../FirmwareManagement/BlackBoxTest/Guid.c | 63 +
.../FirmwareManagement/BlackBoxTest/Guid.h | 153 +
.../IhvFirmwareManagementBBTest.inf | 52 +
.../HIIConfigAccess/BlackBoxTest/Guid.c | 46 +
.../HIIConfigAccess/BlackBoxTest/Guid.h | 109 +
.../HIIConfigAccessBBTestConformance.c | 908 +++++
.../HIIConfigAccessBBTestFunction.c | 606 +++
.../BlackBoxTest/HIIConfigAccessBBTestMain.c | 655 +++
.../BlackBoxTest/HIIConfigAccessBBTestMain.h | 168 +
.../BlackBoxTest/IhvHIIConfigAccessBBTest.inf | 55 +
uefi-sct/SctPkg/UEFI/IHV_SCT.dsc | 2 +
17 files changed, 7795 insertions(+), 2 deletions(-)
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestFunction.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.h
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat
index 5c614eaa..f9d133fd 100644
--- a/uefi-sct/SctPkg/CommonGenFramework.bat
+++ b/uefi-sct/SctPkg/CommonGenFramework.bat
@@ -279,7 +279,8 @@ rem copy %ProcessorType%\IhvUsbHcTest.efi %Framework%\T
copy %ProcessorType%\IhvUsb2HcTest.efi %Framework%\Test\ > NUL
copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi %Framework%\Test\ > NUL
copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi %Framework%\Test\ > NUL
-
+ copy %ProcessorType%\IhvFirmwareManagementBBTest.efi %Framework%\Test\ > NUL
+ copy %ProcessorType%\IhvHIIConfigAccessBBTest.efi %Framework%\Test\ > NUL
rem *********************************************
rem Copy the UEFI 2.1 Test Cases for IHV
rem *********************************************
diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
index c422034a..6a944611 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -312,7 +312,8 @@ then
cp $ProcessorType/IhvUsb2HcTest.efi $Framework/Test/ > NUL
cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi $Framework/Test/ > NUL
cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi $Framework/Test/ > NUL
-
+ cp $ProcessorType/IhvFirmwareManagementBBTest.efi $Framework/Test/ > NUL
+ cp $ProcessorType/IhvHIIConfigAccessBBTest.efi $Framework/Test/ > NUL
# *********************************************
# Copy the UEFI 2.1 Test Cases for IHV
# *********************************************
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c
new file mode 100644
index 00000000..95d36dc7
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c
@@ -0,0 +1,3632 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+ FirmwareManagementBBTestConformance.c
+
+Abstract:
+ Firmware Management Protocol's conformance tests.
+
+--*/
+
+#define DEBUG_ALL 0
+#define DEBUG_GET_IMAGE_INFO 0
+#define DEBUG_GET_IMAGE 0
+#define DEBUG_SET_IMAGE 0
+#define DEBUG_CHECK_IMAGE 0
+#define DEBUG_SET_PACKAGE_INFO 0
+
+#include "SctLib.h"
+#include "FirmwareManagementBBTestMain.h"
+
+// ****************************************************************************
+// Support Routines
+// ****************************************************************************
+
+EFI_STATUS
+CheckForSupportGetImage (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+CheckForSupportSetImage (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+
+EFI_STATUS
+CheckForSupportCheckImage (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+CheckForSupportSetPackageInfo (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+// ****************************************************************************
+// Check Points
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetImageInfoConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageInfoConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetImageConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetImageConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetImageConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetImageConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestCheckImageConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestCheckImageConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+// ****************************************************************************
+// Support Routines
+//
+//
+// ****************************************************************************
+
+// ****************************************************************************
+// Support Routine: Progress
+// ****************************************************************************
+
+EFI_STATUS
+Progress (
+ IN UINTN Completion
+)
+{
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Support Routine: CheckForSupportGetImage
+// ****************************************************************************
+
+EFI_STATUS
+CheckForSupportGetImage (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+)
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+
+ UINT8 ImageIndex;
+ VOID *Image;
+ UINTN ImageSize;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceSupportGuid001;
+ ResultMessageLabel = L"GetImage, function support check";
+
+ ImageIndex = 0;
+ Image = NULL;
+ ImageSize = 0;
+
+ //
+ // Check if function is supported
+ //
+
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ &ImageSize
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Status == EFI_UNSUPPORTED) {
+ ResultMessageData = L"function is NOT supported";
+ } else {
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (Image);
+ }
+
+ if (Status == 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceSupportGuid002;
+ ResultMessageLabel = L"SetImage, function support check";
+
+ ImageIndex = 0;
+ Image = NULL;
+ ImageSize = 0;
+ AbortReason = NULL;
+
+ //
+ // Check if function is supported
+ //
+
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ Progress,
+ &AbortReason
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Status == EFI_UNSUPPORTED) {
+ ResultMessageData = L"function is NOT supported";
+ } else {
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (AbortReason);
+ }
+
+ if (Status == 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceSupportGuid003;
+ ResultMessageLabel = L"CheckImage, function support check";
+
+ ImageIndex = 0;
+ Image = NULL;
+ ImageSize = 0;
+
+ //
+ // Check if function is supported
+ //
+
+ Status = FirmwareManagement->CheckImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ ImageSize,
+ &ImageUpdatable
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Status == EFI_UNSUPPORTED) {
+ ResultMessageData = L"function is NOT supported";
+ } else {
+ ResultMessageData = 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 == 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceSupportGuid004;
+ ResultMessageLabel = L"SetPackageInfo, function support check";
+
+ Image = NULL;
+ ImageSize = 0;
+ VendorCode = NULL;
+ PackageVersion = 0;
+ PackageVersionName = NULL;
+
+ //
+ // Check if function is supported
+ //
+
+ Status = FirmwareManagement->SetPackageInfo (
+ FirmwareManagement,
+ Image,
+ ImageSize,
+ VendorCode,
+ PackageVersion,
+ PackageVersionName
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Status == EFI_UNSUPPORTED) {
+ ResultMessageData = L"function is NOT supported";
+ } else {
+ ResultMessageData = 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 == EFI_UNSUPPORTED) {
+ return EFI_UNSUPPORTED;
+ } else {
+ return EFI_SUCCESS;
+ }
+}
+
+// ****************************************************************************
+// Test Cases
+//
+//
+// ****************************************************************************
+
+/*
+EFI_STATUS
+BBTestUnitTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ return EFI_SUCCESS;
+}
+*/
+
+// ****************************************************************************
+// Test Case: GetImageInfo
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetImageInfoConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestGetImageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);
+ BBTestGetImageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Test Case: GetImage
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Check if function is supported
+ //
+
+ Status = CheckForSupportGetImage (StandardLib, FirmwareManagement);
+ if (Status == EFI_UNSUPPORTED) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestGetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);
+ BBTestGetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);
+ BBTestGetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);
+ BBTestGetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Test Case: SetImage
+// ****************************************************************************
+
+EFI_STATUS
+BBTestSetImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Check if function is supported
+ //
+
+ Status = CheckForSupportSetImage (StandardLib, FirmwareManagement);
+ if (Status == EFI_UNSUPPORTED) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestSetImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);
+ //BBTestSetImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);
+ BBTestSetImageConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);
+ BBTestSetImageConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);
+
+ return Status;
+}
+
+// ****************************************************************************
+// Test Case: CheckImage
+// ****************************************************************************
+
+EFI_STATUS
+BBTestCheckImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Check if function is supported
+ //
+
+ Status = CheckForSupportCheckImage (StandardLib, FirmwareManagement);
+ if (Status == EFI_UNSUPPORTED) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestCheckImageConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);
+ BBTestCheckImageConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);
+
+ return Status;
+}
+
+// ****************************************************************************
+// Test Case: SetPackageInfo
+// ****************************************************************************
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Check if function is supported
+ //
+
+ Status = CheckForSupportSetPackageInfo (StandardLib, FirmwareManagement);
+ if (Status == EFI_UNSUPPORTED) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestSetPackageInfoConformanceTestCheckpoint1 (StandardLib, FirmwareManagement);
+ BBTestSetPackageInfoConformanceTestCheckpoint2 (StandardLib, FirmwareManagement);
+ BBTestSetPackageInfoConformanceTestCheckpoint3 (StandardLib, FirmwareManagement);
+ BBTestSetPackageInfoConformanceTestCheckpoint4 (StandardLib, FirmwareManagement);
+
+ return Status;
+}
+
+// ****************************************************************************
+// Check Points
+//
+//
+// ****************************************************************************
+
+// ****************************************************************************
+// Checkpoint: GetImageInfo, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except ImageInfoSize = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid001;
+ ResultMessageLabel = L"GetImageInfo, conformance checkpoint #1";
+ ResultMessageData = L"correctly returned EFI_BUFFER_TOO_SMALL.";
+
+ ImageInfo = NULL;
+ PackageVersionName = NULL;
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ ImageInfoSize = 1;
+
+ //
+ // Check the data returned by the function
+ //
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+
+ if (Status != EFI_BUFFER_TOO_SMALL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_BUFFER_TOO_SMALL.";
+ goto Exit;
+ }
+ if (ImageInfoSize <= 1) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to update *ImageInfoSize.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (ImageInfo != NULL) {
+ gtBS->FreePool (ImageInfo);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImageInfo, 2
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except &ImageInfoSize = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid002;
+ ResultMessageLabel = L"GetImageInfo, conformance checkpoint #2";
+ ResultMessageData = L"correctly returned EFI_INVALID_PARAMETER.";
+
+ ImageInfo = NULL;
+ PackageVersionName = NULL;
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ NULL, // &ImageInfoSize
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+
+ if (Status != EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (ImageInfo != NULL) {
+ gtBS->FreePool (ImageInfo);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImage, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except ImageSize = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid003;
+ ResultMessageLabel = L"GetImage, conformance checkpoint #1";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+
+ ImageSize = 1;
+ FunctionTested++;
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ &ImageSize
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_BUFFER_TOO_SMALL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_BUFFER_TOO_SMALL.";
+ goto Exit;
+ }
+ if (ImageInfoSize <= 1) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to update *ImageSize.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImage, 2
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except Image = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid004;
+ ResultMessageLabel = L"GetImage, conformance checkpoint #2";
+
+ BufferImageInfo = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL.
+ ImageSize = p->Size * 2;
+ Image = NULL;
+ FunctionTested++;
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ &ImageSize
+ );
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImage, 3
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except ImageIndex = 0 or
+ ImageIndex = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid005;
+ ResultMessageLabel = L"GetImage, conformance checkpoint #3";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ // Dummy image so as to fail on Image = NULL
+ // Any size since the function should check for index before size
+ ImageSize = 64;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER or EFI_NOT_FOUND.";
+
+ ImageIndex = 0;
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ &ImageSize
+ );
+ if ((Status != EFI_INVALID_PARAMETER) && (Status != EFI_NOT_FOUND)) {
+ goto Exit;
+ }
+
+ if ((DescriptorCount + 1) != 0) {
+ ImageIndex = DescriptorCount + 1;
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ &ImageSize
+ );
+ if ((Status != EFI_INVALID_PARAMETER) && (Status != EFI_NOT_FOUND)) {
+ goto Exit;
+ }
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImage, 4
+// ****************************************************************************
+
+/**
+ This routine:
+ - The function requires authentication.
+ - Calls function with valid parameters, except Image has dummy
+ authentication data.
+ The function should return EFI_SECURITY_VIOLATION.
+**/
+
+EFI_STATUS
+BBTestGetImageConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo;
+ VOID *BufferImage;
+
+ UINTN ImageInfoSize;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
+ UINT32 DescriptorVersion;
+ UINT8 DescriptorCount;
+ UINTN DescriptorSize;
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ UINTN i;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *p;
+ UINTN FunctionTested;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid006;
+ ResultMessageLabel = L"GetImage, conformance checkpoint #4";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ // Use a sufficiently large buffer size to avoid EFI_BUFFER_TOO_SMALL.
+ ImageSize = p->Size * 2;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+
+ FunctionTested++;
+
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ &ImageSize
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetImage, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except Image = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid007;
+ ResultMessageLabel = L"SetImage, conformance checkpoint #1";
+
+ BufferImageInfo = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ AbortReason = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Image = NULL;
+ FunctionTested++;
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ Progress,
+ &AbortReason
+ );
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (AbortReason != 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid008;
+ ResultMessageLabel = L"SetImage, conformance checkpoint #2";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ AbortReason = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+ FunctionTested++;
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ Progress,
+ &AbortReason
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if ((Status != EFI_INVALID_PARAMETER) && (Status != EFI_ABORTED)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER or EFI_ABORTED.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+ if (AbortReason != NULL) {
+ gtBS->FreePool (AbortReason);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetImage, 3
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except ImageIndex = 0 or
+ ImageIndex = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid009;
+ ResultMessageLabel = L"SetImage, conformance checkpoint #3";
+
+ BufferImageInfo = NULL;
+ BufferImage=NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ AbortReason = NULL;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ // Dummy image so as to fail on Image = NULL
+ // Any size since the function should check for index before size
+ ImageSize = 64;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER or EFI_ABORTED.";
+
+ ImageIndex = 0;
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ Progress,
+ &AbortReason
+ );
+ if ((Status != EFI_INVALID_PARAMETER) && (Status != EFI_ABORTED)) {
+ goto Exit;
+ }
+
+ if ((DescriptorCount + 1) != 0) {
+ ImageIndex = DescriptorCount + 1;
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // Vendorcode
+ Progress,
+ &AbortReason
+ );
+ if ((Status != EFI_INVALID_PARAMETER) && (Status != EFI_ABORTED)) {
+ goto Exit;
+ }
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+ if (AbortReason != NULL) {
+ gtBS->FreePool (AbortReason);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetImage, 4
+// ****************************************************************************
+
+/**
+ This routine:
+ - The function requires authentication.
+ - Calls function with valid parameters, except Image has dummy
+ authentication data.
+ The function should return EFI_SECURITY_VIOLATION.
+**/
+
+EFI_STATUS
+BBTestSetImageConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo;
+ VOID *BufferImage;
+
+ UINTN ImageInfoSize;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
+ UINT32 DescriptorVersion;
+ UINT8 DescriptorCount;
+ UINTN DescriptorSize;
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+
+ CHAR16 *AbortReason;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ UINTN i;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *p;
+ UINTN FunctionTested;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid010;
+ ResultMessageLabel = L"SetImage, conformance checkpoint #4";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ AbortReason = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+ FunctionTested++;
+ Status = FirmwareManagement->SetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ Progress,
+ &AbortReason
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+ if (AbortReason != NULL) {
+ gtBS->FreePool (AbortReason);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: CheckImage, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with valid parameters, except Image = 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid011;
+ ResultMessageLabel = L"CheckImage, conformance checkpoint #1";
+
+ BufferImageInfo = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Image = NULL;
+ FunctionTested++;
+ Status = FirmwareManagement->CheckImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ ImageSize,
+ &ImageUpdatable
+ );
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: CheckImage, 2
+// ****************************************************************************
+
+/**
+ This routine:
+ - The function requires authentication.
+ - Calls function with valid parameters, except Image has dummy
+ authentication data.
+ The function should return EFI_SECURITY_VIOLATION.
+**/
+
+EFI_STATUS
+BBTestCheckImageConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo;
+ VOID *BufferImage;
+
+ UINTN ImageInfoSize;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
+ UINT32 DescriptorVersion;
+ UINT8 DescriptorCount;
+ UINTN DescriptorSize;
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+
+ UINT32 ImageUpdatable;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ UINTN i;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *p;
+ UINTN FunctionTested;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid012;
+ ResultMessageLabel = L"CheckImage, conformance checkpoint #2";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+ FunctionTested++;
+ Status = FirmwareManagement->CheckImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ ImageSize,
+ &ImageUpdatable
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if (Status != EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = 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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetPackageInfo, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Gets PackageVersionNameMaxLen.
+ - Calls function with valid parameters, except PackageVersionName is longer
+ than the value returned in PackageVersionNameLen.
+ The function should return EFI_INVALID_PARAMETER.
+**/
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+ UINT32 PackageVersionNameMaxLen;
+ UINT64 AttributesSupported;
+ UINT64 AttributesSetting;
+
+ CHAR16 *TestName;
+ UINT32 TestNameLength;
+
+ UINTN i;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid013;
+ ResultMessageLabel = L"SetPackageInfo, function checkpoint #1";
+
+ PackageVersionName = NULL;
+ TestName = NULL;
+
+ //
+ // Get PackageVersionNameMaxLen
+ //
+
+ Status = FirmwareManagement->GetPackageInfo (
+ FirmwareManagement,
+ &PackageVersion,
+ &PackageVersionName,
+ &PackageVersionNameMaxLen,
+ &AttributesSupported,
+ &AttributesSetting
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ if (PackageVersionNameMaxLen == 0) {
+ goto Exit;
+ }
+ if (((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ goto Exit;
+ }
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ gtBS->FreePool (PackageVersionName);
+ PackageVersionName = NULL;
+ TestNameLength = PackageVersionNameMaxLen + 1;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ TestNameLength * 2, // Unicode
+ (VOID **) &TestName
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ for (i = 0; i < (TestNameLength - 1); i++) {
+ TestName[i] = L' ';
+ }
+ TestName[i] = L'\0';
+ Status = FirmwareManagement->SetPackageInfo (
+ FirmwareManagement,
+ NULL, // Image
+ 0, // ImageSize
+ NULL, // VendorCode
+ 0x01010101, // Dummy PackageVersion
+ TestName
+ );
+
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_INVALID_PARAMETER.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_INVALID_PARAMETER.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (TestName != NULL) {
+ gtBS->FreePool (TestName);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetPackageInfo, 2
+// ****************************************************************************
+
+/**
+ This routine:
+ - The function requires authentication.
+ - Calls function with valid parameters, except Image is NULL.
+ The function should return EFI_SECURITY_VIOLATION.
+**/
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+ UINT32 PackageVersionNameMaxLen;
+ UINT64 AttributesSupported;
+ UINT64 AttributesSetting;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid014;
+ ResultMessageLabel = L"SetPackageInfo, function checkpoint #2";
+
+ PackageVersionName = NULL;
+
+ //
+ // Get PackageVersionNameMaxLen
+ //
+
+ Status = FirmwareManagement->GetPackageInfo (
+ FirmwareManagement,
+ &PackageVersion,
+ &PackageVersionName,
+ &PackageVersionNameMaxLen,
+ &AttributesSupported,
+ &AttributesSetting
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ Image = NULL;
+ ImageSize = 64; // Dummy
+ Status = FirmwareManagement->SetPackageInfo (
+ FirmwareManagement,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ PackageVersion,
+ PackageVersionName
+ );
+
+ if (Status == EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SECURITY_VIOLATION.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid015;
+ ResultMessageLabel = L"SetPackageInfo, function checkpoint #3";
+
+ PackageVersionName = NULL;
+ Image = NULL;
+
+ //
+ // Get PackageVersionNameMaxLen
+ //
+
+ Status = FirmwareManagement->GetPackageInfo (
+ FirmwareManagement,
+ &PackageVersion,
+ &PackageVersionName,
+ &PackageVersionNameMaxLen,
+ &AttributesSupported,
+ &AttributesSetting
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ 64, // Dummy
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ ImageSize = 0;
+ Status = FirmwareManagement->SetPackageInfo (
+ FirmwareManagement,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ PackageVersion,
+ PackageVersionName
+ );
+
+ if (Status == EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SECURITY_VIOLATION.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (Image != NULL) {
+ gtBS->FreePool (Image);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: SetPackageInfo, 4
+// ****************************************************************************
+
+/**
+ This routine:
+ - The function requires authentication.
+ - Calls function with valid parameters, except Image has a dummy
+ authentication data.
+ The function should return EFI_SECURITY_VIOLATION.
+**/
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+ UINT32 PackageVersionNameMaxLen;
+ UINT64 AttributesSupported;
+ UINT64 AttributesSetting;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestConformanceAssertionGuid016;
+ ResultMessageLabel = L"SetPackageInfo, function checkpoint #4";
+
+ PackageVersionName = NULL;
+ Image = NULL;
+ ImageSize = 64;
+
+ //
+ // Get PackageVersionNameMaxLen
+ //
+
+ Status = FirmwareManagement->GetPackageInfo (
+ FirmwareManagement,
+ &PackageVersion,
+ &PackageVersionName,
+ &PackageVersionNameMaxLen,
+ &AttributesSupported,
+ &AttributesSetting
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) != PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) {
+ goto Exit;
+ }
+ if ((AttributesSupported & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+ if ((AttributesSetting & PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) !=
+ PACKAGE_ATTRIBUTE_VERSION_UPDATABLE) {
+ goto Exit;
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->SetPackageInfo (
+ FirmwareManagement,
+ Image,
+ ImageSize,
+ NULL, // VendorCode
+ PackageVersion,
+ PackageVersionName
+ );
+
+ if (Status == EFI_SECURITY_VIOLATION) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SECURITY_VIOLATION.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SECURITY_VIOLATION.";
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (Image != 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/FirmwareManagementBBTestFunction.c
new file mode 100644
index 00000000..99a74aa5
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestFunction.c
@@ -0,0 +1,891 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+ FirmwareManagementBBTestFunction.c
+
+Abstract:
+ Firmware Management Protocol's function tests.
+
+--*/
+
+#define DEBUG_ALL 0
+#define DEBUG_GET_IMAGE_INFO 1
+#define DEBUG_GET_IMAGE 0
+#define DEBUG_GET_PACKAGE_INFO 1
+
+
+#include "SctLib.h"
+#include "FirmwareManagementBBTestMain.h"
+
+// ****************************************************************************
+// Check Points
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetImageInfoFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetImageFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+EFI_STATUS
+BBTestGetPackageInfoFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ );
+
+// ****************************************************************************
+// Test Cases
+//
+//
+// ****************************************************************************
+
+/*
+EFI_STATUS
+BBTestUnitTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ return EFI_SUCCESS;
+}
+*/
+
+// ****************************************************************************
+// Test Case: GetImageInfo
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetImageInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestGetImageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);
+
+ 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 = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestGetImageFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Test Case: GetPackageInfo
+// ****************************************************************************
+
+EFI_STATUS
+BBTestGetPackageInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement;
+
+ //
+ // Init
+ //
+
+ FirmwareManagement = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL*)ClientInterface;
+
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Call check point(s)
+ //
+
+ BBTestGetPackageInfoFunctionTestCheckpoint1 (StandardLib, FirmwareManagement);
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Check Points
+//
+//
+// ****************************************************************************
+
+// ****************************************************************************
+// Checkpoint: GetImageInfo, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with all valid parameters.
+ The function should return EFI_SUCCESS.
+ - Checks DescriptorSize is 0.
+ - Checks (DescriptorCount * DescriptorSize) is <= ImageInfoSize.
+ - Checks DescriptorVersion is == 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 = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestFunctionAssertionGuid001;
+ ResultMessageLabel = L"GetImageInfo, function checkpoint #1";
+
+ BufferImageInfo = NULL;
+ ImageInfo = NULL;
+ PackageVersionName = NULL;
+
+ Attribute[0] = L"Image Updatable";
+ Attribute[1] = L"Reset Required";
+ Attribute[2] = L"Authentication Required";
+ Attribute[3] = L"In Use";
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ BufferImageInfo = ImageInfo;
+
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SUCCESS.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SUCCESS.";
+ goto Exit;
+ }
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ if (DescriptorVersion != 1) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"*DescriptorVersion != 1.";
+ goto Exit;
+ }
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (p->ImageIndex > DescriptorCount) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"ImageIndex is beyond DescriptorCount.";
+ goto Exit;
+ }
+
+ if ((p->AttributesSupported & 0xFFFFFFFFFFFFFFF0) != 0) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"AttributesSupported has bit(s) set beyond bit3.";
+ goto Exit;
+ }
+
+ if ((p->AttributesSetting & 0xFFFFFFFFFFFFFFF0) != 0) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"AttributesSetting has bit(s) set beyond bit3.";
+ goto Exit;
+ }
+
+ if ((p->Compatibilities & 0x000000000000FFFE) !=0) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"Compatibilities have bit(s) set between bit1 and bit15.";
+ goto Exit;
+ }
+ }
+
+#if (DEBUG_ALL || DEBUG_GET_IMAGE_INFO)
+
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L"Firmware Image Info Header: \n"
+ L" - *ImageInfoSize = %x\n"
+ L" - *DescriptorVersion = %x\n"
+ L" - *DescriptorCount = %x\n"
+ L" - *DescriptorSzie = %x\n"
+ L" - *PackageVersion = %08x\n"
+ L" - **PackageVersionName = %s\n",
+ ImageInfoSize,
+ DescriptorVersion,
+ DescriptorCount,
+ DescriptorSize,
+ PackageVersion,
+ PackageVersionName
+ );
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L"Descriptor Index = %x:\n"
+ L" - ImageTypeId = %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x",
+ p->ImageIndex,
+ p->ImageTypeId.Data1,
+ p->ImageTypeId.Data2,
+ p->ImageTypeId.Data3,
+ p->ImageTypeId.Data4[0],
+ p->ImageTypeId.Data4[1],
+ p->ImageTypeId.Data4[2],
+ p->ImageTypeId.Data4[3],
+ p->ImageTypeId.Data4[4],
+ p->ImageTypeId.Data4[5],
+ p->ImageTypeId.Data4[6],
+ p->ImageTypeId.Data4[7]
+ );
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - ImageId = %016X\n"
+ L" - *ImageIdName = %s\n"
+ L" - Version = %08x\n"
+ L" - *VersionName = %s\n"
+ L" - Size = %x",
+ p->ImageId,
+ p->ImageIdName,
+ p->Version,
+ p->VersionName,
+ p->Size
+ );
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - AttributesSupported = %016x\n"
+ L" - AttributesSetting = %016x",
+ p->AttributesSupported,
+ p->AttributesSetting
+ );
+ for (j = 1, k = 0; j <= IMAGE_ATTRIBUTE_IN_USE; j = SctLShiftU64(j, 1), k++) {
+ BitField = Attribute[k];
+ if ((p->AttributesSupported & j) != j) {
+ BitSetting = L"Not Supported";
+ } else if ((p->AttributesSetting & j) == j) {
+ BitSetting = L"Yes";
+ } else {
+ BitSetting = L"No";
+ }
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - %s = %s",
+ BitField,
+ BitSetting
+ );
+ }
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - Compatibilities = %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 != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetImage, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with all valid parameters.
+ The function should return EFI_SUCCESS or EFI_UNSUPPORTED.
+**/
+
+EFI_STATUS
+BBTestGetImageFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *BufferImageInfo;
+ VOID *BufferImage;
+
+ UINTN ImageInfoSize;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo;
+ UINT32 DescriptorVersion;
+ UINT8 DescriptorCount;
+ UINTN DescriptorSize;
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+
+ VOID *Image;
+ UINTN ImageSize;
+
+ UINTN i;
+ EFI_FIRMWARE_IMAGE_DESCRIPTOR *p;
+ UINTN FunctionTested;
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestFunctionAssertionGuid002;
+ ResultMessageLabel = L"GetImage, function checkpoint #1";
+
+ BufferImageInfo = NULL;
+ BufferImage = NULL;
+ ImageInfo = NULL;
+ Image = NULL;
+ PackageVersionName = NULL;
+ FunctionTested = 0;
+
+ // Use a sufficiently large buffer to obtain EFI_SUCCESS,
+ // since some implementation does NOT correctly return EFI_BUFFER_TOO_SMALL.
+ // Check for EFI_BUFFER_TOO_SMALL in another conformance test.
+
+ ImageInfoSize = (sizeof (EFI_FIRMWARE_IMAGE_DESCRIPTOR)) * 20;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (ImageInfo);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageInfoSize,
+ (VOID **) &ImageInfo
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ Status = FirmwareManagement->GetImageInfo (
+ FirmwareManagement,
+ &ImageInfoSize,
+ ImageInfo,
+ &DescriptorVersion,
+ &DescriptorCount,
+ &DescriptorSize,
+ &PackageVersion,
+ &PackageVersionName
+ );
+ if (Status != EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ BufferImageInfo = ImageInfo;
+ goto Exit;
+ }
+ }
+ BufferImageInfo = ImageInfo;
+
+ if (DescriptorSize == 0) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"*DescriptorSize is 0.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+ if ((DescriptorCount * DescriptorSize) > ImageInfoSize) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"((*DescriptorCount) * (*DescriptorSize)) > *ImageInfoSize.";
+ goto Exit; // Note the Status = EFI_SUCCESS
+ }
+
+ //
+ // Check the data returned by the function
+ //
+
+ for (i = 0; i < DescriptorCount; i++) {
+ p = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *) (((UINT8 *) ImageInfo) + (i * DescriptorSize));
+
+ if (((p->AttributesSupported & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) &&
+ ((p->AttributesSetting & IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED) ==
+ IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED)) {
+ continue;
+ }
+ if (p->Size == 0) {
+ continue;
+ }
+ if ((p->AttributesSupported & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+ if ((p->AttributesSetting & IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) != IMAGE_ATTRIBUTE_IMAGE_UPDATABLE) {
+ continue;
+ }
+
+ ImageSize = p->Size;
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ BufferImage = Image;
+
+ FunctionTested++;
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ &ImageSize
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gtBS->FreePool (Image);
+ Status = gtBS->AllocatePool (
+ EfiBootServicesData,
+ ImageSize,
+ (VOID **) &Image
+ );
+ if (EFI_ERROR (Status)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"test case initialization failure.";
+ goto Exit;
+ }
+ }
+ BufferImage = Image;
+
+ Status = FirmwareManagement->GetImage (
+ FirmwareManagement,
+ p->ImageIndex,
+ Image,
+ &ImageSize
+ );
+ gtBS->FreePool (BufferImage);
+ BufferImage = NULL;
+ Image = NULL;
+
+ //
+ // Report the checkpoint result
+ //
+
+ if ((Status != EFI_SUCCESS) && (Status != EFI_UNSUPPORTED)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SUCCESS or EFI_UNSUPPORTED.";
+ goto Exit;
+ }
+ }
+
+ if (FunctionTested == 0) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"test skipped - test case does not apply.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SUCCESS or EFI_UNSUPPORTED.";
+ }
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != NULL) {
+ gtBS->FreePool (PackageVersionName);
+ }
+ if (BufferImageInfo != NULL) {
+ gtBS->FreePool (BufferImageInfo);
+ }
+ if (BufferImage != NULL) {
+ gtBS->FreePool (BufferImage);
+ }
+
+ return EFI_SUCCESS;
+}
+
+// ****************************************************************************
+// Checkpoint: GetPackageInfo, 1
+// ****************************************************************************
+
+/**
+ This routine:
+ - Calls function with all valid parameters.
+ The function should return EFI_SUCCESS or EFI_UNSUPPORTED.
+ - Checks AttributesSupported has no bits set beyond bit2.
+ - Checks AttributesSetting has no bits set beyond bit2.
+**/
+
+EFI_STATUS
+BBTestGetPackageInfoFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *FirmwareManagement
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+ EFI_GUID TestGuid;
+ CHAR16 *ResultMessageLabel;
+ CHAR16 *ResultMessageData;
+
+ UINT32 PackageVersion;
+ CHAR16 *PackageVersionName;
+ UINT32 PackageVersionNameMaxLen;
+ UINT64 AttributesSupported;
+ UINT64 AttributesSetting;
+
+ CHAR16* Attribute[3];
+
+#if (DEBUG_ALL || DEBUG_GET_PACKAGE_INFO)
+
+ CHAR16 *BitField;
+ CHAR16 *BitSetting;
+
+ UINT64 j;
+ UINTN k;
+
+#endif
+
+ //
+ // Init
+ //
+
+ Status = EFI_SUCCESS;
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ TestGuid = gFirmwareManagementBBTestFunctionAssertionGuid003;
+ ResultMessageLabel = L"GetPackageInfo, function checkpoint #1";
+
+ PackageVersionName = NULL;
+
+ Attribute[0] = L"Version Updatable";
+ Attribute[1] = L"Reset Required";
+ Attribute[2] = L"Authentication Required";
+
+ //
+ // Check the data returned by the function
+ //
+
+ Status = FirmwareManagement->GetPackageInfo (
+ FirmwareManagement,
+ &PackageVersion,
+ &PackageVersionName,
+ &PackageVersionNameMaxLen,
+ &AttributesSupported,
+ &AttributesSetting
+ );
+
+ if ((Status == EFI_SUCCESS) || (Status == EFI_UNSUPPORTED)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ ResultMessageData = L"correctly returned EFI_SUCCESS or EFI_UNSUPPORTED.";
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ ResultMessageData = L"failed to return EFI_SUCCESS or EFI_UNSUPPORTED.";
+ goto Exit;
+ }
+
+#if (DEBUG_ALL || DEBUG_GET_PACKAGE_INFO)
+
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L"Firmware Package Info: \n"
+ L" - *PackageVersion = %08x\n"
+ L" - **PackageVersionName = %s\n"
+ L" - *PackageVersionNameMaxLen = %08x",
+ PackageVersion,
+ PackageVersionName,
+ PackageVersionNameMaxLen
+ );
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - *AttributesSupported = %016x\n"
+ L" - *AttributesSetting = %016x",
+ AttributesSupported,
+ AttributesSetting
+ );
+ for (j = 1, k = 0; j <= PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED; j = SctLShiftU64(j, 1), k++) {
+ BitField = Attribute[k];
+ if ((AttributesSupported & j) != j) {
+ BitSetting = L"Not Supported";
+ } else if ((AttributesSetting & j) == j) {
+ BitSetting = L"Yes";
+ } else {
+ BitSetting = L"No";
+ }
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_QUIET,
+ L" - %s = %s",
+ BitField,
+ BitSetting
+ );
+ }
+
+#endif
+
+ if ((AttributesSupported & 0xFFFFFFFFFFFFFFF8) != 0) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"*AttributesSupported has bit(s) set beyond bit2.";
+ goto Exit;
+ }
+
+ if ((AttributesSetting & 0xFFFFFFFFFFFFFFF8) != 0) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ ResultMessageData = L"*AttributesSetting has bit(s) set beyond bit2.";
+ goto Exit;
+ }
+
+ //
+ // Report the checkpoint result
+ //
+
+Exit:
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ TestGuid,
+ ResultMessageLabel,
+ L"Result - %s\n%a:%d: Status - %r",
+ ResultMessageData,
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ if (PackageVersionName != 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/BlackBoxTest/FirmwareManagementBBTestMain.c
@@ -0,0 +1,228 @@
+/** @file
+
+ Copyright 2006 - 2017 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+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 = {
+ 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[] = {
+ EFI_STANDARD_TEST_LIBRARY_GUID,
+ EFI_NULL_GUID
+};
+
+EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
+ /*
+ //Use for unit test only
+ {
+ { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0xb0, 0x6d } },
+ L"Unit Test Only",
+ L"Verify the Assistant Function",
+ EFI_TEST_LEVEL_DEFAULT,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestUnitTest
+ },
+ */
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0101,
+ L"Function_Test-GetImageInfo",
+ L"Function auto test for Firmware Management Protocol GetImageInfo().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestGetImageInfoFunctionTest
+ },
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0102,
+ L"Function_Test-GetImage",
+ L"Function auto test for Firmware Management Protocol GetImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestGetImageFunctionTest
+ },
+/*++
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0103,
+ L"Function Test - SetImage",
+ L"Function auto test for Firmware Management Protocol SetImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestSetImageFunctionTest
+ },
+--*/
+/*++
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0104,
+ L"Function Test - CheckImage",
+ L"Function auto test for Firmware Management Protocol CheckImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestCheckImageFunctionTest
+ },
+--*/
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0105,
+ L"Function_Test-GetPackageInfo",
+ L"Function auto test for Firmware Management Protocol GetPackageInfo().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestGetPackageInfoFunctionTest
+ },
+/*++
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0106,
+ L"Function Test - SetPackageInfo",
+ L"Function auto test for Firmware Management Protocol SetPackageInfo().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestSetPackageInfoFunctionTest
+ },
+--*/
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0201,
+ L"Conformance_Test-GetImageInfo",
+ L"Conformance auto test for Firmware Management Protocol GetImageInfo().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestGetImageInfoConformanceTest
+ },
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0202,
+ L"Conformance_Test-GetImage",
+ L"Conformance auto test for Firmware Management Protocol GetImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestGetImageConformanceTest
+ },
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203,
+ L"Conformance_Test-SetImage",
+ L"Conformance auto test for Firmware Management Protocol SetImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestSetImageConformanceTest
+ },
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204,
+ L"Conformance_Test-CheckImage",
+ L"Conformance auto test for Firmware Management Protocol CheckImage().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestCheckImageConformanceTest
+ },
+/*++
+ {
+ EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205,
+ L"Conformance Test - GetPackageInfo",
+ L"Conformance auto test for Firmware Management Protocol GetPackageInfo().",
+ 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 SetPackageInfo().",
+ 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 = 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/BlackBoxTest/FirmwareManagementBBTestMain.h
@@ -0,0 +1,223 @@
+/** @file
+
+ Copyright 2006 - 2017 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2017, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+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 <Library/EfiTestLib.h>
+
+#include <UEFI/Protocol/FirmwareManagement.h>
+
+#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, 0xcf } }
+
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0203 \
+{ 0x12834a23, 0x6cef, 0x478e, { 0xaf, 0x48, 0x44, 0xe5, 0x93, 0x40, 0xab, 0xe8 } }
+
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0204 \
+{ 0xc6dc94b1, 0xb81b, 0x4b85, { 0x8b, 0x7d, 0x8f, 0xbf, 0xa6, 0x8e, 0xf3, 0xe5 } }
+
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0205 \
+{ 0x3d13f23d, 0x8306, 0x49d4, { 0xa0, 0xe0, 0x9a, 0x9b, 0xf6, 0x89, 0x40, 0x3c } }
+
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_TEST_ENTRY_GUID0206 \
+{ 0x24cf9ac2, 0x9abc, 0x4f5c, { 0x9c, 0x7a, 0xbc, 0x22, 0x29, 0xc3, 0x2, 0x7f } }
+
+// ****************************************************************************
+// Initializaiton and Unload functions
+// ****************************************************************************
+
+EFI_STATUS
+EFIAPI
+InitializeFirmwareManagementBBTest (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+EFI_STATUS
+EFIAPI
+UnloadFirmwareManagementBBTest (
+ IN EFI_HANDLE ImageHandle
+ );
+
+//
+// Test Cases - Unit Test
+//
+
+/*
+EFI_STATUS
+BBTestUnitTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+*/
+
+//
+// Test Cases - Function
+//
+
+EFI_STATUS
+BBTestGetImageInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestGetImageFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestSetImageFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestCheckImageFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestGetPackageInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+//
+// Test Cases - Conformance
+//
+
+EFI_STATUS
+BBTestGetImageInfoConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestGetImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestSetImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestCheckImageConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestGetPackageInfoConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestSetPackageInfoConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+// ****************************************************************************
+// Support functions
+// ****************************************************************************
+
+#endif
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c
new file mode 100644
index 00000000..c33d5b79
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c
@@ -0,0 +1,63 @@
+/** @file
+
+ Copyright 2006 - 2012 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+ Module Name:
+
+ Guid.c
+
+ Abstract:
+
+ GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+#include "Efi.h"
+#include "Guid.h"
+
+// ****************************************************************************
+// Function
+// ****************************************************************************
+
+EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001=EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_001_GUID;
+EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002=EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID;
+EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003=EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID;
+
+// ****************************************************************************
+// Conformance
+// ****************************************************************************
+
+EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID;
+
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID;
+EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016=EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h
new file mode 100644
index 00000000..d2b2e51d
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h
@@ -0,0 +1,153 @@
+/** @file
+
+ Copyright 2006 - 2010 Unified EFI, Inc.<BR>
+ Copyright (c) 2010, Dell Inc. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+ 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, 0x31 } }
+
+extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid001;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_002_GUID \
+{ 0xff704c46, 0x3999, 0x4a28, { 0xa3, 0x6e, 0x76, 0x8a, 0xb6, 0xad, 0x89, 0xd8 } }
+
+extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid002;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTFUNCTION_ASSERTION_003_GUID \
+{ 0x70884539, 0x9a34, 0x4146, { 0x83, 0x3a, 0x4d, 0x89, 0x8b, 0x9c, 0x7e, 0xa4 } }
+
+extern EFI_GUID gFirmwareManagementBBTestFunctionAssertionGuid003;
+
+// ****************************************************************************
+// Conformance - Function Support Check
+// ****************************************************************************
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_001_GUID \
+{ 0xd9c7d018, 0x60ba, 0x448d, { 0xb1, 0x3b, 0x88, 0x8b, 0x41, 0xd9, 0xdc, 0x9 } };
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid001;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_002_GUID \
+{ 0x28310f16, 0x690e, 0x44a5, { 0x93, 0x98, 0xe1, 0xcd, 0x6a, 0xb3, 0xe1, 0x61 } };
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid002;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_003_GUID \
+{ 0x92cc940a, 0xdcf8, 0x42a0, { 0x81, 0xa1, 0xd7, 0xdd, 0x43, 0x87, 0xbf, 0x6d } };
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid003;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_SUPPORT_004_GUID \
+{ 0x3f910041, 0xcd4d, 0x4b36, { 0xb2, 0x23, 0xfb, 0x16, 0x4e, 0x7e, 0x6a, 0x8c } };
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceSupportGuid004;
+
+// ****************************************************************************
+// Conformance - Assertion
+// ****************************************************************************
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_001_GUID \
+{ 0x3789b80e, 0xab70, 0x4dc9, { 0xbb, 0xbd, 0x70, 0x63, 0x76, 0x36, 0xab, 0x52 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid001;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_002_GUID \
+{ 0xca1d7706, 0x256b, 0x464e, { 0xb6, 0xee, 0x50, 0x34, 0x1e, 0xec, 0x3c, 0x83 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid002;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_003_GUID \
+{ 0x3c8d87b2, 0x6a89, 0x4a6c, { 0xbc, 0x75, 0xe6, 0x86, 0xa1, 0x49, 0x13, 0xf0 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid003;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_004_GUID \
+{ 0x88031c96, 0x99bf, 0x4d2c, { 0x9f, 0x57, 0xa7, 0x2, 0x6a, 0xbc, 0xd3, 0x51 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid004;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_005_GUID \
+{ 0x7a386361, 0x3a5d, 0x4e58, { 0x8a, 0x51, 0x4d, 0x93, 0xb6, 0x55, 0x95, 0xf4 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid005;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_006_GUID \
+{ 0xd6a77629, 0x5afd, 0x4854, { 0x87, 0xc8, 0xee, 0x9f, 0xc5, 0x3d, 0xbe, 0x3d } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid006;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_007_GUID \
+{ 0x4ea24764, 0xa6b1, 0x43b5, { 0xb8, 0xa0, 0xd3, 0x3f, 0xdc, 0x8b, 0xc6, 0xe4 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid007;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_008_GUID \
+{ 0x712ce1e9, 0x80d1, 0x4168, { 0xb8, 0xd0, 0x74, 0xd1, 0x72, 0x7a, 0x2f, 0x25 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid008;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_009_GUID \
+{ 0xc82d1373, 0x1f87, 0x45f4, { 0xaf, 0xfc, 0x10, 0xa7, 0xf7, 0xb0, 0x9c, 0xb0 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid009;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_010_GUID \
+{ 0x2410a859, 0xdf6f, 0x4857, { 0x92, 0x4a, 0x26, 0x37, 0x7, 0x11, 0xf, 0x1c } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid010;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_011_GUID \
+{ 0x3987172c, 0xe6a0, 0x4099, { 0xb1, 0x2b, 0xd8, 0xef, 0xf2, 0x62, 0x75, 0x93 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid011;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_012_GUID \
+{ 0xd6dad28e, 0x7f0f, 0x4f56, { 0x9a, 0x93, 0x14, 0x7d, 0xb3, 0x74, 0x0, 0xc9 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid012;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_013_GUID \
+{ 0xb5288fc3, 0xe906, 0x4468, { 0x83, 0x3d, 0xd4, 0xa6, 0x58, 0xa5, 0x4f, 0xbd } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid013;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_014_GUID \
+{ 0x57355301, 0x1343, 0x497f, { 0xbe, 0xe0, 0x8e, 0x5c, 0x27, 0xd2, 0x40, 0x25 } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid014;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_015_GUID \
+{ 0xadeab82d, 0x7592, 0x40fe, { 0x87, 0xa8, 0x93, 0x2b, 0xad, 0x97, 0xff, 0x5e } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid015;
+
+#define EFI_TEST_FIRMWAREMANAGEMENTBBTESTCONFORMANCE_ASSERTION_016_GUID \
+{ 0x9be658d2, 0x1312, 0x4254, { 0x91, 0x10, 0x59, 0x0, 0xd5, 0xfd, 0x6c, 0x6c } }
+
+extern EFI_GUID gFirmwareManagementBBTestConformanceAssertionGuid016;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
new file mode 100644
index 00000000..7566a044
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
@@ -0,0 +1,52 @@
+## @file
+#
+# Copyright 2006 - 2012 Unified EFI, Inc.<BR>
+# Copyright (c) 2010 - 2012, Dell Inc. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+#/*++
+#
+# Module Name:
+#
+# FirmwareManagementBBTest.inf
+#
+# Abstract:
+#
+# Component description file for IHV Firmware Management Protocol Black-Box Test.
+#
+#--*/
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IhvFirmwareManagementBBTest
+ FILE_GUID = DB0E842F-201B-4D47-BA74-88602A41C9D2
+ MODULE_TYPE = UEFI_DRIVER
+ COMPONENT_TYPE = BS_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFirmwareManagementBBTest
+
+[sources.common]
+ FirmwareManagementBBTestConformance.c
+ FirmwareManagementBBTestFunction.c
+ FirmwareManagementBBTestMain.c
+ Guid.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ SctPkg/SctPkg.dec
+ SctPkg/UEFI/UEFI.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ SctLib
+ EfiTestLib
+
+[Protocols]
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
new file mode 100644
index 00000000..6a6d4e60
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
@@ -0,0 +1,46 @@
+/** @file
+
+ Copyright 2006 - 2012 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+ Module Name:
+
+ Guid.c
+
+ Abstract:
+
+ GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+#include "HIIConfigAccessBBTestMain.h"
+
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid003=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid004=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid005=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid006=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID;
+/*
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid008=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid009=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0010=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0011=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID;
+EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0012=EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID;
+*/
+EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid001=EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID;
+EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid002=EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID;
+EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid003=EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID;
+EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid004=EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
new file mode 100644
index 00000000..b7003028
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
@@ -0,0 +1,109 @@
+/** @file
+
+ Copyright 2006 - 2011 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+ Module Name:
+
+ Guid.h
+
+ Abstract:
+
+ GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID \
+{ 0xa7173eb5, 0xf76a, 0x4ea1, { 0x95, 0xd, 0x14, 0x91, 0x1e, 0x49, 0x86, 0xc1 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \
+{ 0xfa5973e2, 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, 0x76 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid002;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_003_GUID \
+{ 0x6f6d1dd, 0x49b8, 0x488a, { 0xa7, 0x75, 0xde, 0xbc, 0xc7, 0x60, 0xfd, 0x28 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid003;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_004_GUID \
+{ 0x28652613, 0x6bf4, 0x4f42, { 0xab, 0xe2, 0x84, 0x4f, 0x2f, 0x77, 0xec, 0x2f } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid004;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_005_GUID \
+{ 0xebba197a, 0x467f, 0x4736, { 0x92, 0xf2, 0x11, 0xb1, 0x91, 0x2e, 0xe9, 0x90 } }
+
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid005;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_006_GUID \
+{ 0x341fe3e0, 0xf688, 0x45f2, { 0x91, 0x56, 0xc7, 0xae, 0x9f, 0x2c, 0xcb, 0xb0 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid006;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_007_GUID \
+{ 0x1f99ebc8, 0x253, 0x455f, { 0x88, 0xac, 0x9e, 0x2b, 0xa6, 0xdc, 0xd7, 0x29 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid007;
+/*
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_008_GUID \
+{ 0xbdec5b08, 0x423, 0x482b, { 0xb7, 0xdf, 0xde, 0xac, 0xab, 0xf7, 0x13, 0x11 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid008;
+
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_009_GUID \
+{ 0x5fed024d, 0x85f3, 0x45bf, { 0xbe, 0xb1, 0xe4, 0xf4, 0xcc, 0x86, 0xe5, 0x61 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid009;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0010_GUID \
+{ 0x22ee938e, 0xa9ad, 0x4cb9, { 0x8d, 0x6d, 0x6, 0xe4, 0xfa, 0xb3, 0x72, 0xe7 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0010;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0011_GUID \
+{ 0x2053d3e0, 0xeebe, 0x4391, { 0x84, 0x7d, 0xf4, 0x60, 0x1b, 0x30, 0x4e, 0x3 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0011;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_0012_GUID \
+{ 0x81c5d7b7, 0x7ebe, 0x44e1, { 0x8a, 0x1f, 0xcc, 0x47, 0x9c, 0x2d, 0xfe, 0x4f } }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid0012;
+*/
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_001_GUID \
+{ 0x24dcf8bf, 0xbfbf, 0x4588, { 0xba, 0xf, 0x77, 0x1e, 0x24, 0x4e, 0x3e, 0x8 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid001;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_002_GUID \
+{ 0x961a5268, 0x1998, 0x4a7e, { 0x9d, 0x9d, 0xce, 0xdc, 0x67, 0xfb, 0xcc, 0x77 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid002;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_003_GUID \
+{ 0x603e52f0, 0x2ce3, 0x4e7a, { 0xa7, 0x2e, 0xdf, 0x8c, 0xa3, 0xfd, 0xb2, 0xd } }
+
+extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid003;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTFUNCTION_ASSERTION_004_GUID \
+{ 0xab163674, 0x6c27, 0x4169, { 0xa6, 0xa9, 0xe1, 0x9c, 0x88, 0x14, 0x94, 0x96 } }
+
+extern EFI_GUID gHIIConfigAccessBBTestFunctionAssertionGuid004;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
new file mode 100644
index 00000000..c8b35003
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
@@ -0,0 +1,908 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+ HIIConfigAccessBBTestConformance.c
+
+Abstract:
+ for EFI Driver HII Configuration Access Protocol's conformance Test
+
+--*/
+
+#include "HIIConfigAccessBBTestMain.h"
+
+EFI_BROWSER_ACTION EFI_BROWSER_ACTION_UNSUPPORTED = 2;
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+/*
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+*/
+
+EFI_STATUS
+BBTestExtractConfigConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Config Routing Protocol Interface
+ //
+ Status = GetHIIConfigRoutingInterface( &HIIConfigRouting );
+ if ( EFI_ERROR(Status) ) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestExtractConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );
+ BBTestExtractConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HIIConfigAccess );
+ BBTestExtractConfigConformanceTestCheckpoint3( StandardLib, HIIConfigRouting, HIIConfigAccess );
+ BBTestExtractConfigConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestRouteConfigConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Config Routing Protocol Interface
+ //
+ Status = GetHIIConfigRoutingInterface( &HIIConfigRouting );
+ if ( EFI_ERROR(Status) ) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestRouteConfigConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );
+ BBTestRouteConfigConformanceTestCheckpoint2( StandardLib, HIIConfigRouting, HIIConfigAccess );
+ BBTestRouteConfigConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+
+/*
+EFI_STATUS
+BBTestCallBackConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestCallBackConformanceTestCheckpoint1( StandardLib, HIIConfigAccess );
+ BBTestCallBackConformanceTestCheckpoint2( StandardLib, HIIConfigAccess );
+ BBTestCallBackConformanceTestCheckpoint3( StandardLib, HIIConfigAccess );
+ BBTestCallBackConformanceTestCheckpoint4( StandardLib, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+*/
+
+//
+//Check Points
+//
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Progress = NULL;
+ EFI_STRING Results = NULL;
+ EFI_STRING ResultsPtr = NULL;
+ UINTN Len = 0;
+ CHAR16* Pointer = NULL;
+ UINT8 IfMulti = 0;
+
+ EFI_STRING Request = NULL;
+ //
+ // Call ExtractConfig with Request been <MultiConfigRequest>
+ //
+ Status = HIIConfigAccess->ExtractConfig (
+ HIIConfigAccess,
+ NULL,
+ &Progress,
+ &Results
+ );
+
+ if ( Status == EFI_SUCCESS ) {
+ Len = SctStrLen (Results);
+ //
+ // Make sure the size of Request is enough to hold <MultiConfigRequest>
+ // if original Results is not Multi
+ //
+ Request = (EFI_STRING) SctAllocateZeroPool ( 2 * Len + 2 + 256);
+ if (Request == NULL) {
+ SctFreePool (Results);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ } else {
+ return Status;
+ }
+
+ Status = MultiAltRespToMultiReq (Results, Request);
+ ResultsPtr = Request;
+
+ SctFreePool (Results);
+ Results = NULL;
+
+ if ( SctStrStr (Request, L"GUID=") != NULL ) {
+ Pointer = SctStrStr (Request, L"GUID=");
+ Pointer++;
+ if ( SctStrStr (Pointer, L"GUID=") != NULL )
+ IfMulti = 1;
+ }
+
+ if ( IfMulti == 0 ) {
+ SctStrCat ( Request, L"&GUID=970eb94aa0d449f7b980bdaa47d42527&NAME=006a0069006e0039&PATH=000acf&grag&star");
+ }
+
+ Status = HIIConfigAccess->ExtractConfig (
+ HIIConfigAccess,
+ Request,
+ &Progress,
+ &Results
+ );
+
+ if ( (EFI_INVALID_PARAMETER != Status) || (SctStrnCmp (Progress, L"&GUID=", 6) != 0) ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid001,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER with Request been <MultiConfigRequest>.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ SctFreePool (Request);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Request = NULL;
+ EFI_STRING Results = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+ EFI_STRING DevicePath = NULL;
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ return Status;
+ }
+
+ Request = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (Request == NULL) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+ return Status;
+ }
+
+ //
+ // Call ExtractConfig with Progress been NULL
+ //
+ Status = HIIConfigAccess->ExtractConfig (
+ HIIConfigAccess,
+ Request,
+ NULL,
+ &Results
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid002,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER with Progress been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Request = NULL;
+ EFI_STRING Progress = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+ EFI_STRING DevicePath = NULL;
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ return Status;
+ }
+
+ Request = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (Request == NULL) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+ return Status;
+ }
+ //
+ // Call ExtractConfig with Results been NULL
+ //
+ Status = HIIConfigAccess->ExtractConfig (
+ HIIConfigAccess,
+ Request,
+ &Progress,
+ NULL
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid003,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER with Results been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+BBTestExtractConfigConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Request;
+ EFI_STRING Progress = NULL;
+ EFI_STRING Results = NULL;
+
+ //init the Request
+ Request = L"GUID=71e430fb2e8849779d7a33ef1139e7ed&NAME=006a0069006e0039&PATH=000acf&Jack&Rons&Nash&Mary";
+
+ //
+ // Call ExtractConfig with unknown name
+ //
+ Status = HIIConfigAccess->ExtractConfig (
+ HIIConfigAccess,
+ Request,
+ &Progress,
+ &Results
+ );
+
+ if ( ((EFI_INVALID_PARAMETER == Status) && (SctStrnCmp (Progress, L"&Jack&Rons&Nash&Mary", 20) == 0)) ||
+ ((EFI_NOT_FOUND == Status) && (Progress == Request)) ) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid004,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() returns EFI_INVALID_PARAMETER/EFI_NOT_FOUND with invalid input.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+ }
+
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Progress = NULL;
+
+
+ //
+ // Call RouteConfig with Configuration been NULL
+ //
+ Status = HIIConfigAccess->RouteConfig (
+ HIIConfigAccess,
+ NULL,
+ &Progress
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid005,
+ L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() returns EFI_INVALID_PARAMETER with Configuration been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+ }
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Config = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+ EFI_STRING DevicePath = NULL;
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ return Status;
+ }
+
+ Config = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (Config == NULL) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetCorrespondingResp (MultiConfigAltResp, DevicePath, Config);
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Config);
+ return Status;
+ }
+
+ //
+ // Call RouteConfig with Progress been NULL
+ //
+ Status = HIIConfigAccess->RouteConfig (
+ HIIConfigAccess,
+ Config,
+ NULL
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid006,
+ L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() returns EFI_INVALID_PARAMETER with Progress been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Config);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestRouteConfigConformanceTestCheckpoint3 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Configuration;
+ EFI_STRING Progress = NULL;
+
+ //init the Configuration
+ Configuration=L"GUID=71e430fb2e8849779d7a33ef1139e7ed&NAME=006a0069006e0039&PATH=0acf&OFFSET=2&WIDTH=3VALUE=45AF";
+
+ //
+ // Call RouteConfig with no found target for the routing data
+ //
+ Status = HIIConfigAccess->RouteConfig (
+ HIIConfigAccess,
+ Configuration,
+ &Progress
+ );
+
+ if ( EFI_NOT_FOUND != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid007,
+ L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig - RouteConfig() returns EFI_NOT_FOUND with no found target for the routing data.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ return EFI_SUCCESS;
+}
+
+/*
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_QUESTION_ID QuestionId;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
+ //init the parameter
+ QuestionId=0x1234;
+ Type=EFI_IFR_TYPE_NUM_SIZE_8;
+
+
+ //
+ // Call CallBack with the Action been NULL
+ //
+ Status = HIIConfigAccess->CallBack (
+ HIIConfigAccess,
+ NULL,
+ QuestionId,
+ Type,
+ &Value,
+ &ActionRequest
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ //check the output ActionRequest
+ if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != ActionRequest)
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid009,
+ L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Action been NULL .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+
+}
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_BROWSER_ACTION *Action;
+ EFI_QUESTION_ID QuestionId;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+
+
+ //init the parameter
+ Action=EFI_BROWSER_ACTION_REQUEST_CHANGING;
+ QuestionId=0x1234;
+ Type=EFI_IFR_TYPE_NUM_SIZE_8;
+
+
+ //
+ // Call CallBack with the ActionRequest been NULL
+ //
+ Status = HIIConfigAccess->CallBack (
+ HIIConfigAccess,
+ Action,
+ QuestionId,
+ Type,
+ &Value,
+ NULL
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid0010,
+ L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with QuestionId been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+
+}
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint3(
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_BROWSER_ACTION *Action;
+ EFI_QUESTION_ID QuestionId;
+ UINT8 Type;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
+ //init the parameter
+ Action = EFI_BROWSER_ACTION_REQUEST_CHANGING;
+ QuestionId = 0x1234;
+ Type = EFI_IFR_TYPE_NUM_SIZE_8;
+
+
+ //
+ // Call CallBack with the Value been NULL
+ //
+ Status = HIIConfigAccess->CallBack (
+ HIIConfigAccess,
+ Action,
+ QuestionId,
+ Type,
+ NULL,
+ &ActionRequest
+ );
+
+ if ( EFI_INVALID_PARAMETER != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ //check the output ActionRequest
+ if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != ActionRequest)
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid0011,
+ L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_INVALID_PARAMETER with Value been NULL.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+
+}
+
+EFI_STATUS
+BBTestCallBackConformanceTestCheckpoint4 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_BROWSER_ACTION *Action;
+ EFI_QUESTION_ID QuestionId;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
+ //init the parameter
+ Action=&EFI_BROWSER_ACTION_UNSUPPORTED;
+ QuestionId=0x1234;
+ Type=EFI_IFR_TYPE_NUM_SIZE_8;
+
+
+ //
+ // Call CallBack with the specified action not supported by the callback
+ //
+ Status = HIIConfigAccess->CallBack (
+ HIIConfigAccess,
+ Action,
+ QuestionId,
+ Type,
+ &Value,
+ &ActionRequest
+ );
+
+ if ( EFI_UNSUPPORTED != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ //check the output ActionRequest
+ if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != ActionRequest)
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestConformanceAssertionGuid0012,
+ L"HII_CONFIG_ACCESS_PROTOCOL.CallBack - CallBack() returns EFI_ UNSUPPORTED with the specified action not supported by the callback .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+
+}
+*/
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
new file mode 100644
index 00000000..14cc5684
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
@@ -0,0 +1,606 @@
+/** @file
+
+ Copyright 2006 - 2017 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+ HIIConfigAccessBBTestFunction.c
+
+Abstract:
+ for EFI Driver HII Configuration Access Protocol's function Test
+
+--*/
+
+#include "HIIConfigAccessBBTestMain.h"
+
+
+EFI_STATUS
+BBTestExtractConfigFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestExtractConfigFunctionTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+
+EFI_STATUS
+BBTestRouteConfigFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+/*
+EFI_STATUS
+BBTestCallBackFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ );
+*/
+
+//
+//Test Cases
+//
+/*
+EFI_STATUS
+BBTestUnitTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+ EFI_STRING DevicePath = NULL;
+ EFI_STRING Request = NULL;
+ EFI_STRING Resp = NULL;
+ EFI_STRING MultiConfigAltResp = L"GUID=970eb94aa0d449f7b980bdaa47d42527&NAME=ft894&PATH=000acf&OFFSET=3&WIDTH=4&VALUE=aabbccdd&OFFSET=1&WIDTH=2&VALUE=eeff&GUID=970eb94aa0d449f7b980bdaa47d42527&NAME=ft894&PATH=000acf&ALTCFG=0037&A000=abcd&B000=efef&GUID=970eb94aa0d449f7b980bdaa47d42528&NAME=ft894&PATH=0104180035170b0fa0879341b266538c38af48ce000000007fff0400&A000=abcd&B000=efef&GUID=970eb94aa0d449f7b980bdaa47d42528&NAME=ft894&PATH=0104180035170b0fa0879341b266538c38af48ce000000007fff0400&ALTCFG=0037&OFFSET=3&WIDTH=4&VALUE=aabbccdd&OFFSET=1&WIDTH=2&VALUE=eeff";;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ Request = (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) + 2);
+ if (Request == NULL)
+ return EFI_OUT_OF_RESOURCES;
+
+ Resp = (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (MultiConfigAltResp) + 2);
+ if (Resp == NULL) {
+ gtBS->FreePool (Request);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (Resp);
+ gtBS->FreePool (Request);
+ return Status;
+ }
+
+ Status = GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);
+
+ Status = GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);
+
+ gtBS->FreePool (Request);
+ gtBS->FreePool (Resp);
+ gtBS->FreePool (DevicePath);
+
+ return EFI_SUCCESS;
+}
+*/
+
+EFI_STATUS
+BBTestExtractConfigFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Config Routing Protocol Interface
+ //
+ Status = GetHIIConfigRoutingInterface( &HIIConfigRouting );
+ if ( EFI_ERROR(Status) ) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestExtractConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIIConfigAccess );
+ BBTestExtractConfigFunctionTestCheckpoint2( StandardLib, HIIConfigRouting, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+BBTestRouteConfigFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Config Routing Protocol Interface
+ //
+ Status = GetHIIConfigRoutingInterface( &HIIConfigRouting );
+ if ( EFI_ERROR(Status) ) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestRouteConfigFunctionTestCheckpoint1( StandardLib, HIIConfigRouting, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+
+/*
+EFI_STATUS
+BBTestCallBackFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ )
+{
+ EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess;
+
+ //
+ // init
+ //
+ HIIConfigAccess = (EFI_HII_CONFIG_ACCESS_PROTOCOL*)ClientInterface;
+
+ //
+ // Get the Standard Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ //Call check points
+ //
+ BBTestCallBackFunctionTestCheckpoint1( StandardLib, HIIConfigAccess );
+
+ return EFI_SUCCESS;
+}
+*/
+
+//
+//Check Points
+//
+EFI_STATUS
+BBTestExtractConfigFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Request = NULL;
+ EFI_STRING ConfigHdr = NULL;
+ EFI_STRING Progress = NULL;
+ EFI_STRING Results = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+ EFI_STRING DevicePath = NULL;
+
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ return Status;
+ }
+
+ Request = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (Request == NULL) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetCorrespondingRequest (MultiConfigAltResp, DevicePath, Request);
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+ return Status;
+ }
+
+ //
+ // Call ExtractConfig with valid parameters
+ //
+ Status = HIIConfigAccess->ExtractConfig(
+ HIIConfigAccess,
+ Request,
+ &Progress,
+ &Results
+ );
+
+ if ( (EFI_SUCCESS == Status) && (Progress == (Request + SctStrLen (Request))) ) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Results == NULL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ gtBS->FreePool (Results);
+ }
+ } else if (EFI_OUT_OF_RESOURCES == Status) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ }else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestFunctionAssertionGuid001,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS and vaild Results with valid parameters .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ //
+ // Change the Request to ConfigHdr
+ //
+ ConfigHdr = Request;
+ while (*Request) {
+ if (*Request == L'&') {
+ if (SctStrnCmp (Request, L"&NAME=", 6) == 0) {
+ Request = Request + 6;
+ } else if (SctStrnCmp (Request, L"&PATH=", 6) == 0) {
+ Request = Request + 6;
+ } else {
+ *Request = 0;
+ }
+ } else {
+ Request++;
+ }
+ }
+ Request = ConfigHdr;
+
+ //
+ // Call ExtractConfig when Request is ConfigHdr
+ //
+ Progress = NULL;
+ Results = NULL;
+ Status = HIIConfigAccess->ExtractConfig(
+ HIIConfigAccess,
+ Request,
+ &Progress,
+ &Results
+ );
+
+ if ( (EFI_SUCCESS == Status) && (Progress == (Request + SctStrLen (Request))) ) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Results == NULL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ if (NULL == SctStrStr (Results, Request)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ gtBS->FreePool (Results);
+ }
+ } else if (EFI_OUT_OF_RESOURCES == Status) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ }else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestFunctionAssertionGuid002,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS and vaild Results with valid parameters .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Request);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+BBTestExtractConfigFunctionTestCheckpoint2 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Request = NULL;
+ EFI_STRING Progress = NULL;
+ EFI_STRING Results = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Call ExtractConfig with valid parameters
+ //
+ Status = HIIConfigAccess->ExtractConfig(
+ HIIConfigAccess,
+ NULL,
+ &Progress,
+ &Results
+ );
+
+ if (EFI_OUT_OF_RESOURCES == Status) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ } else if ((EFI_NOT_FOUND == Status) && (Progress == NULL) && (Results == NULL)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else if ( EFI_SUCCESS != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (Results != NULL) {
+ gtBS->FreePool (Results);
+ }
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (Results == NULL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestFunctionAssertionGuid003,
+ L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS or EFI_NOT_FOUND with Request been NULL .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+
+ if ( NULL != MultiConfigAltResp ){
+ gtBS->FreePool (MultiConfigAltResp);
+ }
+
+ if ( NULL !=Results ) {
+ gtBS->FreePool (Results);
+ }
+
+ if (NULL != Request) {
+ gtBS->FreePool (Request);
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+BBTestRouteConfigFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ROUTING_PROTOCOL *HIIConfigRouting,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_STRING Resp = NULL;
+ EFI_STRING Progress = NULL;
+ EFI_STRING MultiConfigAltResp = NULL;
+ EFI_STRING DevicePath = NULL;
+
+ //init the Request
+ Status = HIIConfigRouting->ExportConfig(
+ HIIConfigRouting,
+ &MultiConfigAltResp
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = GetDevicePath ( HIIConfigAccess, &DevicePath );
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ return Status;
+ }
+
+ Resp = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (Resp == NULL) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = GetCorrespondingResp (MultiConfigAltResp, DevicePath, Resp);
+ if (EFI_ERROR(Status)) {
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Resp);
+ return Status;
+ }
+
+ //
+ // Call RouteConfig with valid parameters
+ //
+ Status = HIIConfigAccess->RouteConfig(
+ HIIConfigAccess,
+ Resp,
+ &Progress
+ );
+ if ( (EFI_SUCCESS == Status) && (Progress == Resp + SctStrLen (Resp)) ) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else if ( EFI_OUT_OF_RESOURCES == Status ) {
+ AssertionType = EFI_TEST_ASSERTION_WARNING;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestFunctionAssertionGuid003,
+ L"HII_CONFIG_ACCESS_PROTOCOL.RouteConfig- RouteConfig() returns EFI_SUCCESS with valid parameters .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ gtBS->FreePool (MultiConfigAltResp);
+ gtBS->FreePool (DevicePath);
+ gtBS->FreePool (Resp);
+
+ return EFI_SUCCESS;
+}
+
+/*
+EFI_STATUS
+BBTestCallBackFunctionTestCheckpoint1 (
+ IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *HIIConfigAccess
+ )
+{
+ EFI_STATUS Status;
+ EFI_TEST_ASSERTION AssertionType;
+
+ EFI_BROWSER_ACTION *Action;
+ EFI_QUESTION_ID QuestionId;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
+ //init the paremeters
+ Action=EFI_BROWSER_ACTION_REQUEST_CHANGING;
+ QuestionId=0x1234;
+ Type=EFI_IFR_TYPE_NUM_SIZE_8;
+
+
+ //
+ // Call CallBack with valid parameters
+ //
+ Status = HIIConfigAccess->CallBack(
+ HIIConfigAccess,
+ Action,
+ QuestionId,
+ Type,
+ &Value,
+ &ActionRequest
+ );
+ if ( EFI_SUCCESS != Status ) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ //check the output ActionRequest
+ if ((EFI_BROWSER_ACTION_REQUEST_NONE || EFI_BROWSER_ACTION_REQUEST_RESET || EFI_BROWSER_ACTION_REQUEST_SUBMIT || EFI_BROWSER_ACTION_REQUEST_EXIT) != ActionRequest)
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+ }
+
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gHIIConfigAccessBBTestFunctionAssertionGuid003,
+ L"HII_CONFIG_ACCESS_PROTOCOL.CallBack- CallBack() returns EFI_SUCCESS with valid parameters .",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return EFI_SUCCESS;
+}
+*/
+
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c
new file mode 100644
index 00000000..29c793e2
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c
@@ -0,0 +1,655 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+
+ HIIConfigAccessBBTestMain.c
+
+Abstract:
+
+ Test Driver of HII Configuration Access Protocol
+
+--*/
+
+#include "HIIConfigAccessBBTestMain.h"
+
+//
+// Global variables
+//
+EFI_HANDLE mImageHandle;
+
+EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
+
+EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_REVISION,
+ IHV_EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID,
+ L"HII Configuration Access Protocol Test",
+ L"UEFI HII Configuration Access Protocol Black-Box Test"
+};
+
+EFI_GUID gSupportProtocolGuid[] = {
+ EFI_STANDARD_TEST_LIBRARY_GUID,
+ EFI_NULL_GUID
+};
+
+EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
+ /*
+ //Use for unit test only
+ {
+ { 0x8cdda816, 0x3f97, 0x4155, { 0xa6, 0x73, 0x86, 0x93, 0x79, 0x8f, 0xb0, 0x6d } },
+ L"Unit Test Only",
+ L"Verify the Assistant Function",
+ EFI_TEST_LEVEL_DEFAULT,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestUnitTest
+ },
+ */
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101,
+ L"ExtractConfigFunction",
+ L"Function auto test for HII Configuration Access Protocol ExtractConfig().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestExtractConfigFunctionTest
+ },
+
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102,
+ L"RouteConfigFunction",
+ L"Function auto test for HII Configuration Access Protocol RouteConfig().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestRouteConfigFunctionTest
+ },
+ /*
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0103,
+ L"CallBackFunction",
+ L"Function auto test for HII Configuration Access Protocol CallBack().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestCallBackFunctionTest
+ },
+ */
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201,
+ L"ExtractConfigConformance",
+ L"Conformance auto test for HII Configuration Access Protocol ExtractConfig().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestExtractConfigConformanceTest
+ },
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202,
+ L"RouteConfigConformance",
+ L"Conformance auto test for HII Configuration Access Protocol RouteConfig().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestRouteConfigConformanceTest
+ },
+ /*
+ {
+ EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0203,
+ L"CallBackConformance",
+ L"Conformance auto test for HII Configuration Access Protocol CallBack().",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestCallBackConformanceTest
+ },
+ */
+ 0
+};
+
+
+
+
+EFI_STATUS
+InitializeHIIConfigAccessBBTest (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EfiInitializeTestLib (ImageHandle, SystemTable);
+
+ //
+ // initialize test utility lib
+ //
+
+ SctInitializeLib (ImageHandle, SystemTable);
+
+ mImageHandle = ImageHandle;
+
+ return EfiInitAndInstallIHVBBTestInterface (
+ &ImageHandle,
+ &gBBTestProtocolField,
+ gBBTestEntryField,
+ UnloadHIIConfigAccessBBTest,
+ &gBBTestProtocolInterface
+ );
+}
+
+
+EFI_STATUS
+UnloadHIIConfigAccessBBTest (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ return EfiUninstallAndFreeIHVBBTestInterface (
+ ImageHandle,
+ gBBTestProtocolInterface
+ );
+}
+
+
+// Assistance Function
+UINTN
+EfiDevicePathSize (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+/*++
+
+Routine Description:
+
+ Calculate the space size of a device path.
+
+Arguments:
+
+ DevicePath - A specified device path
+
+Returns:
+
+ The size.
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *Start;
+
+ if (DevicePath == NULL) {
+ return 0;
+ }
+
+ //
+ // Search for the end of the device path structure
+ //
+ Start = DevicePath;
+ while (!SctIsDevicePathEnd (DevicePath)) {
+ DevicePath = SctNextDevicePathNode (DevicePath);
+ }
+
+ //
+ // Compute the size and add back in the size of the end device path structure
+ //
+ return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
+}
+
+
+STATIC
+CHAR16
+NibbleToHexCharPrivate (
+ IN UINT8 Nibble
+ )
+/*++
+
+ Routine Description:
+ Converts the low nibble of a byte to hex unicode character.
+
+ Arguments:
+ Nibble - lower nibble of a byte.
+
+ Returns:
+ Hex unicode character between L'0' to L'f'.
+
+--*/
+{
+ Nibble &= 0x0F;
+
+ if (Nibble <= 0x9) {
+ return (CHAR16)(Nibble + L'0');
+ }
+
+ return (CHAR16)(Nibble - 0xA + L'a');
+}
+
+
+STATIC
+EFI_STATUS
+BufToHexStringPrivate (
+ IN OUT CHAR16 *Str,
+ IN OUT UINTN *HexStringBufferLength,
+ IN UINT8 *Buf,
+ IN UINTN Len,
+ IN BOOLEAN Flag
+ )
+/*++
+
+ Routine Description:
+ Converts binary buffer to Unicode string.
+ At a minimum, any blob of data could be represented as a hex string.
+
+ Arguments:
+ Str - Pointer to the string.
+ HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.
+ If routine return with EFI_SUCCESS, containing length of hex string buffer.
+ If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.
+ Buf - Buffer to be converted from.
+ Len - Length in bytes of the buffer to be converted.
+ Flag - If TRUE, encode the data in the same order as the it
+ resides in the Buf. Else encode it in the reverse direction.
+
+ Returns:
+ EFI_SUCCESS - Routine success.
+ EFI_BUFFER_TOO_SMALL - The hex string buffer is too small.
+
+--*/
+{
+ UINTN Idx;
+ UINT8 Byte;
+ UINTN StrLen;
+
+ //
+ // Make sure string is either passed or allocate enough.
+ // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
+ // Plus the Unicode termination character.
+ //
+ StrLen = Len * 2;
+ if ((*HexStringBufferLength) < (StrLen + 1) * sizeof (CHAR16)) {
+ *HexStringBufferLength = (StrLen + 1) * sizeof (CHAR16);
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *HexStringBufferLength = (StrLen + 1) * sizeof (CHAR16);
+
+ //
+ // Ends the string.
+ //
+ Str[StrLen] = 0;
+
+ for (Idx = 0; Idx < Len; Idx++) {
+
+ Byte = Buf[Idx];
+ if (Flag) {
+ Str[Idx * 2] = NibbleToHexCharPrivate ((UINT8)(Byte >> 4));
+ Str[Idx * 2 + 1] = NibbleToHexCharPrivate (Byte);
+ } else {
+ Str[StrLen - 1 - Idx * 2] = NibbleToHexCharPrivate (Byte);
+ Str[StrLen - 2 - Idx * 2] = NibbleToHexCharPrivate ((UINT8)(Byte >> 4));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetDevicePath (
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
+ OUT EFI_STRING *DevicePathStr
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN NoHandles;
+ EFI_HANDLE *HandleBuffer;
+ EFI_HANDLE ConfigAccessHandle = NULL;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *TestedConfigAccess;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN Length;
+ UINTN PathHdrSize;
+
+ //
+ // locate all Hii Configuration Access Protocol Instances
+ //
+ Status = gtBS->LocateHandleBuffer (
+ ByProtocol,
+ &gBlackBoxEfiHIIConfigAccessProtocolGuid,
+ NULL,
+ &NoHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR(Status) || (NoHandles == 0)) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // scan for the handle that matched with the Hii Configuration Access Protocol that
+ // passed in by the test framework
+ //
+ for (Index = 0; Index < NoHandles; Index++) {
+ Status = gtBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gBlackBoxEfiHIIConfigAccessProtocolGuid,
+ (VOID **) &TestedConfigAccess
+ );
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ if (TestedConfigAccess == ConfigAccess) {
+ ConfigAccessHandle = HandleBuffer[Index];
+ break;
+ }
+ }
+
+ gtBS->FreePool (HandleBuffer);
+
+ if (ConfigAccessHandle == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // find controller handles managed by the component name handle.
+ //
+ Status = gtBS->HandleProtocol (
+ ConfigAccessHandle,
+ &gBlackBoxEfiDevicePathProtocolGuid,
+ (void **)&DevicePath
+ );
+
+ //
+ // Convert the device path binary to hex UNICODE %02x bytes in the same order
+ // as the device path resides in RAM memory.
+ //
+ Length = EfiDevicePathSize (DevicePath);
+ PathHdrSize = (Length * 2 + 1) * sizeof (CHAR16);
+ *DevicePathStr = (EFI_STRING) SctAllocateZeroPool (PathHdrSize);
+ if (*DevicePathStr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Status = BufToHexStringPrivate (*DevicePathStr, &PathHdrSize, (UINT8 *) DevicePath, Length, TRUE);
+
+ return Status;
+}
+
+
+EFI_STATUS
+GetCorrespondingRequest (
+ IN EFI_STRING MultiConfigAltResp,
+ IN EFI_STRING DevicePath,
+ IN OUT EFI_STRING Request
+ )
+{
+ EFI_STRING RespPtr;
+ EFI_STRING ReqPtr;
+ EFI_STRING SingleResp;
+ EFI_STRING SingleRespPtr;
+ UINTN Len;
+
+ ReqPtr = Request;
+ RespPtr = MultiConfigAltResp;
+
+ Len = SctStrLen (MultiConfigAltResp);
+
+ if (SctStrnCmp (MultiConfigAltResp, L"GUID=", 5) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (SctStrStr (MultiConfigAltResp, DevicePath) == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ SingleResp = (EFI_STRING) SctAllocateZeroPool ( 2 * SctStrLen (MultiConfigAltResp) + 2 );
+ if (SingleResp == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SingleRespPtr = SingleResp;
+
+ while (*MultiConfigAltResp != 0) {
+ while ((*MultiConfigAltResp != 0) && (SctStrnCmp (MultiConfigAltResp, L"&GUID=", 6) != 0)) {
+ *(SingleResp++) = *(MultiConfigAltResp++);
+ }
+ SingleResp = SingleRespPtr;
+ if (SctStrStr (SingleResp, DevicePath) != NULL)
+ break;
+ SctZeroMem (SingleRespPtr, 2 * Len + 2);
+ if (*MultiConfigAltResp != 0)
+ MultiConfigAltResp++;
+ }
+
+ if (SctStrStr (SingleResp, DevicePath) == NULL)
+ return EFI_NOT_FOUND;
+
+ if (SctStrStr (SingleResp, L"VALUE=") == NULL){
+ while (*SingleResp != 0) {
+ while ((*SingleResp != 0) && (SctStrnCmp (SingleResp, L"&PATH=", 6) != 0)) {
+ *(Request++) = *(SingleResp++);
+ }
+ *(Request++) = *(SingleResp++);
+ while ((*SingleResp != 0) && (*SingleResp != L'&')) {
+ *(Request++) = *(SingleResp++);
+ }
+ while (*SingleResp != 0){
+ if (*SingleResp != L'=') {
+ *(Request++) = *(SingleResp++);
+ } else {
+ while ((*SingleResp != 0) && (*SingleResp != L'&')) {
+ SingleResp++;
+ }
+ }
+ }
+ }
+ } else {
+ while (*SingleResp != 0) {
+ while ((*SingleResp != 0) && (SctStrnCmp (SingleResp, L"&VALUE=", 7)) != 0) {
+ *(Request++) = *(SingleResp++);
+ }
+ SingleResp++;
+ while ((*SingleResp != 0) && (*SingleResp != L'&'))
+ SingleResp++;
+ }
+
+ }
+
+ *Request = 0;
+
+ gtBS->FreePool (SingleRespPtr);
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+GetCorrespondingResp (
+ IN EFI_STRING MultiConfigAltResp,
+ IN EFI_STRING DevicePath,
+ IN OUT EFI_STRING Resp
+ )
+{
+ EFI_STRING RespPtr;
+ EFI_STRING ReqPtr;
+ UINTN Len;
+
+ ReqPtr = Resp;
+ RespPtr = MultiConfigAltResp;
+
+ Len = SctStrLen (MultiConfigAltResp);
+
+ if (SctStrnCmp (MultiConfigAltResp, L"GUID=", 5) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (SctStrStr (MultiConfigAltResp, DevicePath) == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ while (*MultiConfigAltResp != 0) {
+ while ((*MultiConfigAltResp != 0) && (SctStrnCmp (MultiConfigAltResp, L"&GUID=", 6) != 0)) {
+ *(Resp++) = *(MultiConfigAltResp++);
+ }
+ Resp = ReqPtr;
+ if (SctStrStr (Resp, DevicePath) != NULL)
+ break;
+ SctZeroMem (ReqPtr, 2 * Len + 2);
+ if (*MultiConfigAltResp != 0)
+ MultiConfigAltResp++;
+ }
+
+ if (SctStrStr (Resp, DevicePath) == NULL)
+ return EFI_NOT_FOUND;
+
+ return EFI_SUCCESS;
+}
+
+
+
+EFI_STATUS
+GetHIIConfigRoutingInterface (
+ OUT EFI_HII_CONFIG_ROUTING_PROTOCOL **HIIConfigRouting
+ )
+{
+ UINTN NoHandles;
+ EFI_HANDLE *HandleBuffer;
+ EFI_STATUS Status;
+
+ //
+ // Get the HII Database Protocol interface
+ //
+ Status = gtBS->LocateHandleBuffer (
+ ByProtocol,
+ &gBlackBoxEfiHIIConfigRoutingProtocolGuid,
+ NULL,
+ &NoHandles,
+ &HandleBuffer
+ );
+ if ( EFI_ERROR(Status) ) {
+ return Status;
+ }
+
+ if ( NoHandles <= 0 ) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = gtBS->HandleProtocol (
+ HandleBuffer[0],
+ &gBlackBoxEfiHIIConfigRoutingProtocolGuid,
+ (VOID **) HIIConfigRouting
+ );
+ if ( EFI_ERROR(Status) ) {
+ gtBS->FreePool ( HandleBuffer );
+ return Status;
+ }
+
+ gtBS->FreePool ( HandleBuffer );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+MultiAltRespToMultiReq (
+ IN EFI_STRING Resp,
+ IN OUT EFI_STRING Req
+ )
+{
+ EFI_STRING Pointer1 = Resp;
+ EFI_STRING Pointer2 = NULL;
+ EFI_STRING Pointer3 = Req;
+ EFI_STRING CfgHdr = NULL;
+ EFI_STRING FreePtr = NULL;
+ CHAR8 Flag = 0;
+
+ if (SctStrnCmp (Pointer1, L"GUID=", 5) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Pointer2 = (EFI_STRING) SctAllocateZeroPool (2 * SctStrLen (Resp) + 2);
+ if (Pointer2 == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ FreePtr = Pointer2;
+
+ while (*Pointer1) {
+ if (SctStrnCmp (Pointer1, L"GUID=", 5) == 0) {
+ CfgHdr = Pointer2;
+ *(Pointer2++) = *(Pointer1++);
+ while (*Pointer1 != L'&') {
+ *(Pointer2++) = *(Pointer1++);
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&GUID=", 6) == 0) {
+ *(Pointer2++) = *(Pointer1++);
+ CfgHdr = Pointer2;
+ while (*Pointer1 != L'&') {
+ *(Pointer2++) = *(Pointer1++);
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&NAME=", 6) == 0) {
+ *(Pointer2++) = *(Pointer1++);
+ while (*Pointer1 != L'&') {
+ *(Pointer2++) = *(Pointer1++);
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&PATH=", 6) == 0) {
+ *(Pointer2++) = *(Pointer1++);
+ while (*Pointer1 != L'&') {
+ *(Pointer2++) = *(Pointer1++);
+ }
+ if (NULL == SctStrStr (Req, CfgHdr)){
+ if (*Req == L'G')
+ *(Pointer3++) = L'&';
+ SctStrCat (Req, CfgHdr);
+ Pointer3 += SctStrLen (CfgHdr);
+ Flag = 1;
+ } else {
+ Flag = 0;
+ }
+ }
+ while ((Flag == 1) && (SctStrnCmp (Pointer1, L"&GUID=", 6) != 0) && *Pointer1) {
+ if (SctStrnCmp (Pointer1, L"&OFFSET=", 8) == 0) {
+ *(Pointer3++) = *(Pointer1++);
+ while (*Pointer1 != L'&') {
+ *(Pointer3++) = *(Pointer1++);
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&WIDTH=", 7) == 0) {
+ *(Pointer3++) = *(Pointer1++);
+ while (*Pointer1 != L'&') {
+ *(Pointer3++) = *(Pointer1++);
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&VALUE=", 7) == 0) {
+ Pointer1 += 7;
+ while (*Pointer1 != L'&' && *Pointer1) {
+ Pointer1++;
+ }
+ }
+ if (SctStrnCmp (Pointer1, L"&ALTCFG=", 8) == 0) {
+ Pointer1 += 8;
+ while (*Pointer1 != L'&' && *Pointer1) {
+ Pointer1++;
+ }
+ }
+ if ((*Pointer1 == L'&') && (SctStrnCmp (Pointer1, L"&GUID=", 6) != 0) &&
+ (SctStrnCmp (Pointer1, L"&OFFSET=", 8) != 0) && (SctStrnCmp (Pointer1, L"&WIDTH=", 7) != 0)) {
+ *(Pointer3++) = *(Pointer1++);
+ while (*Pointer1 != L'=') {
+ *(Pointer3++) = *(Pointer1++);
+ }
+ while (*Pointer1 != L'&' && *Pointer1) {
+ Pointer1++;
+ }
+ }
+ }
+ Pointer1++;
+ }
+
+ SctFreePool (FreePtr);
+
+ return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
new file mode 100644
index 00000000..c81a00ca
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
@@ -0,0 +1,168 @@
+/** @file
+
+ Copyright 2006 - 2013 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+Module Name:
+
+ HIIConfigAccessBBTestMain.h
+
+Abstract:
+
+ Test Driver of HII Configuration Access Protocol header file
+
+--*/
+
+#ifndef _HII_CONFIG_ACCESS_BB_TEST_MAIN
+#define _HII_CONFIG_ACCESS_BB_TEST_MAIN
+
+#define __UEFI_INTERNAL_FORMREPRESENTATION_H__
+#include <Base.h>
+#include "SctLib.h"
+#include "Guid.h"
+#include <Library/EfiTestLib.h>
+#include <UEFI/Protocol/Hii.h>
+#include <UEFI/Protocol/HIIConfigAccess.h>
+#include <UEFI/Protocol/HIIConfigRouting.h>
+
+
+#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_REVISION 0x00010000
+#define IHV_EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID \
+{ 0x68820884, 0x4be3, 0x4ca9, { 0x83, 0x81, 0x9e, 0x98, 0xf3, 0xf4, 0x8d, 0xaf } }
+//
+// Entry GUIDs for Func Test
+//
+#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0101 \
+{ 0x2a85387e, 0xdcf9, 0x45e9, { 0xb3, 0x8f, 0x5d, 0xa1, 0x75, 0x41, 0xcf, 0x1a } }
+
+#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0102 \
+{ 0x1a15df85, 0x6cc1, 0x43f2, { 0x9b, 0x86, 0x21, 0x8b, 0xd5, 0xfd, 0xf4, 0xa0 } }
+
+
+//
+// Entry GUIDs for Conf Test
+//
+#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0201 \
+{ 0xe2c3b0fe, 0xfbe9, 0x46a9, { 0xa3, 0x1b, 0xa3, 0xf3, 0x82, 0xd, 0xcf, 0x4 } }
+
+#define EFI_HII_CONFIG_ACCESS_PROTOCOL_TEST_ENTRY_GUID0202 \
+{ 0x495c99f3, 0x231, 0x45a5, { 0xaf, 0xfa, 0xd2, 0x5c, 0x6f, 0x9a, 0x19, 0x1c } }
+
+
+
+EFI_STATUS
+InitializeHIIConfigAccessBBTest (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+
+EFI_STATUS
+UnloadHIIConfigAccessBBTest (
+ IN EFI_HANDLE ImageHandle
+ );
+
+
+//
+//Test Cases
+//
+/*
+EFI_STATUS
+BBTestUnitTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+*/
+EFI_STATUS
+BBTestExtractConfigConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestRouteConfigConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+/*
+EFI_STATUS
+BBTestCallBackConformanceTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+*/
+EFI_STATUS
+BBTestExtractConfigFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+EFI_STATUS
+BBTestRouteConfigFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+/*
+EFI_STATUS
+BBTestCallBackFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+*/
+EFI_STATUS
+GetDevicePath (
+ IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
+ OUT EFI_STRING *DevicePathStr
+ );
+
+EFI_STATUS
+GetCorrespondingRequest (
+ IN EFI_STRING MultiConfigAltResp,
+ IN EFI_STRING DevicePath,
+ IN OUT EFI_STRING Request
+ );
+
+EFI_STATUS
+GetCorrespondingResp (
+ IN EFI_STRING MultiConfigAltResp,
+ IN EFI_STRING DevicePath,
+ IN OUT EFI_STRING Resp
+ );
+
+EFI_STATUS
+GetHIIConfigRoutingInterface (
+ OUT EFI_HII_CONFIG_ROUTING_PROTOCOL **HIIConfigRouting
+ );
+
+EFI_STATUS
+MultiAltRespToMultiReq (
+ IN EFI_STRING Resp,
+ IN OUT EFI_STRING Req
+ );
+
+#endif
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
new file mode 100644
index 00000000..1168986b
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
@@ -0,0 +1,55 @@
+## @file
+#
+# Copyright 2006 - 2012 Unified EFI, Inc.<BR>
+# Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+#/*++
+#
+# Module Name:
+#
+# HIIConfigAccessBBTest.inf
+#
+# Abstract:
+#
+# Component description file for IHV HII Config Access Protocol Black-Box Test.
+#
+#--*/
+
+[defines]
+INF_VERSION = 0x00010005
+BASE_NAME = IhvHIIConfigAccessBBTest
+FILE_GUID = D39F2A3B-72BF-40F5-86BF-2E1E96D15EA3
+MODULE_TYPE = UEFI_DRIVER
+VERSION_STRING = 1.0
+ENTRY_POINT = InitializeHIIConfigAccessBBTest
+
+[sources.common]
+ HIIConfigAccessBBTestConformance.c
+ HIIConfigAccessBBTestFunction.c
+ HIIConfigAccessBBTestMain.c
+ Guid.c
+
+[Packages]
+ SctPkg/SctPkg.dec
+ SctPkg/UEFI/UEFI.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ SctLib
+ EfiTestLib
+
+[Protocols]
+ gBlackBoxEfiHIIConfigAccessProtocolGuid
+ gBlackBoxEfiHIIConfigRoutingProtocolGuid
+ gBlackBoxEfiDevicePathProtocolGuid
diff --git a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
index 83396f1a..c3afdbdd 100644
--- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
@@ -210,9 +210,11 @@ SctPkg/TestCase/UEFI/IHV/Protocol/UsbIo/BlackBoxTest/IhvUsbIoTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsOutputBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiPassThruBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf
+SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiInitiatorNameBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolutePointerBBTest.inf
+SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvStorageSecurityCommandBBTest.inf
SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoBBTest.inf
--
2.22.0.windows.1
[-- Attachment #2: Type: text/html, Size: 1208047 bytes --]
next reply other threads:[~2019-06-17 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 9:18 Shrishail.Patil [this message]
2019-06-17 23:53 ` [edk2-test][Patch v1] uefi-sct/SctPkg: Adding FMP and HII Config Access protocol into IHVSCT Supreeth Venkatesh
2019-06-21 15:41 ` [edk2-devel] " Eric Jin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN6PR1101MB2355EA56D2A95A73D1A5F2F7ECEB0@BN6PR1101MB2355.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox