* [edk2-test][Patch 1/3] uefi-sct/SctPkg: Add HiiConfigAccess test source to IHVSCT
@ 2019-09-12 3:02 Eric Jin
0 siblings, 0 replies; only message in thread
From: Eric Jin @ 2019-09-12 3:02 UTC (permalink / raw)
To: devel; +Cc: shrishail patil, Supreeth Venkatesh
From: shrishail patil <shrishail.patil@microchip.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2187
Adding HiiConfigAccess Protocol to IHVSCT.
This patch contains source code which is copied from
UEFISCT and added into IHVSCT.
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Signed-off-by: shrishail patil <shrishail.patil@microchip.com>
---
.../BlackBoxTest/IhvHIIConfigAccessBBTest.inf | 56 ++
.../HIIConfigAccess/BlackBoxTest/Guid.h | 82 +++
.../BlackBoxTest/HIIConfigAccessBBTestMain.h | 145 ++++
.../HIIConfigAccess/BlackBoxTest/Guid.c | 50 ++
.../HIIConfigAccessBBTestConformance.c | 619 +++++++++++++++++
.../HIIConfigAccessBBTestFunction.c | 451 +++++++++++++
.../BlackBoxTest/HIIConfigAccessBBTestMain.c | 621 ++++++++++++++++++
7 files changed, 2024 insertions(+)
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
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/HIIConfigAccessBBTestMain.h
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/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
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 000000000000..81252d100841
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
@@ -0,0 +1,56 @@
+## @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>
+# Copyright (c) 2019,Microchip Technology Inc.<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/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 000000000000..0baaf4b72539
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
@@ -0,0 +1,82 @@
+/** @file
+
+ Copyright 2006 - 2011 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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_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/HIIConfigAccessBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
new file mode 100644
index 000000000000..acd0fabc7fc7
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
@@ -0,0 +1,145 @@
+/** @file
+
+ Copyright 2006 - 2013 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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
+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
+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
+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/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
new file mode 100644
index 000000000000..a5258eae0714
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
@@ -0,0 +1,50 @@
+/** @file
+
+ Copyright 2006 - 2012 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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 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/HIIConfigAccessBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
new file mode 100644
index 000000000000..917f5d3c41f5
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
@@ -0,0 +1,619 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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
+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;
+}
+
+//
+//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;
+}
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 000000000000..a17749a1a458
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
@@ -0,0 +1,451 @@
+/** @file
+
+ Copyright 2006 - 2017 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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
+ );
+
+//
+//Test Cases
+//
+
+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;
+}
+
+//
+//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;
+}
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 000000000000..92de424a496f
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c
@@ -0,0 +1,621 @@
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019,Microchip Technology Inc.<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[] = {
+ {
+ 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_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
+ },
+ 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;
+}
--
2.20.0.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-12 3:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-12 3:02 [edk2-test][Patch 1/3] uefi-sct/SctPkg: Add HiiConfigAccess test source to IHVSCT Eric Jin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox