diff options
Diffstat (limited to 'RedfishPkg')
7 files changed, 262 insertions, 59 deletions
diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index a9665ff..c048e43 100644 --- a/RedfishPkg/RedfishPkg.dec +++ b/RedfishPkg/RedfishPkg.dec @@ -193,3 +193,18 @@ # 0x0000000000000001 RedfishPlatformConfigDxe driver debug enabled.
#
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0|UINT64|0x00001012
+ #
+ # Redfish RedfishPlatformConfigDxe Debug Properties
+ # 0x00000001 x-uefi-redfish string database message enabled
+ # 0x00000002 Debug Message for dumping formset
+ # 0x00000004 Debug Message for x-uefi-redfish searching result
+ # 0x00000008 Debug Message for x-uefi-redfish Regular Expression searching result
+ #
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigDebugProperty|0|UINT32|0x00001013
+ #
+ # RedfishPlatformConfigDxe feature enablement
+ # 0x00000001 Enable building Redfish Attribute Registry menu path.
+ # 0x00000002 Allow supressed HII option to be exposed on Redfish.
+ #
+ # Redfish RedfishPlatformConfigDxe feature Properties
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigFeatureProperty|0|UINT32|0x00001014
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c new file mode 100644 index 0000000..753c4d3 --- /dev/null +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c @@ -0,0 +1,58 @@ +/** @file
+ The implementation of EDKII Redfish Platform Config Capability.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "RedfishPlatformConfigDxe.h"
+#include "RedfishPlatformConfigImpl.h"
+
+/**
+ Check if the debug property is enabled or not.
+
+ @param[in] DebugType Debug enablement type
+
+ @retval TRUE, the debug property is enabled.
+ FALSE, the debug property is not enabled.
+
+**/
+BOOLEAN
+RedfishPlatformConfigDebugProp (
+ IN UINT64 DebugType
+ )
+{
+ UINT64 DebugProp;
+
+ DebugProp = FixedPcdGet64 (PcdRedfishPlatformConfigDebugProperty);
+ if ((DebugProp & DebugType) != 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Check if the Platform Configure feature is enabled or not.
+
+ @param[in] FeatureType Redfish platform config feature enablement
+
+ @retval TRUE, the feature is enabled.
+ FALSE, the feature is not enabled.
+
+**/
+BOOLEAN
+RedfishPlatformConfigFeatureProp (
+ IN UINT64 FeatureType
+ )
+{
+ UINT64 FeatureProp;
+
+ FeatureProp = FixedPcdGet64 (PcdRedfishPlatformConfigFeatureProperty);
+ if ((FeatureProp & FeatureType) != 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c index 0d1c96e..99e7827 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c @@ -315,7 +315,7 @@ DumpHiiStatementPrompt ( **/
CHAR8 *
-BuildMenPath (
+BuildMenuPath (
IN REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *StatementPrivate
)
{
@@ -345,7 +345,7 @@ BuildMenPath ( }
do {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "F(%d) <-", FormPrivate->Id));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "F(%d) <-", FormPrivate->Id));
FormPrivate = FindFormLinkToThis (FormPrivate);
if (FormPrivate == NULL) {
break;
@@ -387,7 +387,7 @@ BuildMenPath ( AsciiStrCatS (Buffer, OldBufferSize, "/");
AsciiStrCatS (Buffer, OldBufferSize, FormTitle);
FreePool (FormTitle);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, " %a\n", Buffer));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " %a\n", Buffer));
}
FormPrivate = (REDFISH_PLATFORM_CONFIG_FORM_PRIVATE *)PopRedfishStack (FormStack);
@@ -1061,12 +1061,12 @@ DumpOrderedListValue ( return;
}
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "Value.Type= 0x%x\n", OrderedListStatement->Value.Type));
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "Value.BufferValueType= 0x%x\n", OrderedListStatement->Value.BufferValueType));
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "Value.BufferLen= 0x%x\n", OrderedListStatement->Value.BufferLen));
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "Value.Buffer= 0x%x\n", OrderedListStatement->Value.Buffer));
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "Value.MaxContainers= 0x%x\n", OrderedListStatement->ExtraData.OrderListData.MaxContainers));
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "StorageWidth= 0x%x\n", OrderedListStatement->StorageWidth));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "Value.Type= 0x%x\n", OrderedListStatement->Value.Type));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "Value.BufferValueType= 0x%x\n", OrderedListStatement->Value.BufferValueType));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "Value.BufferLen= 0x%x\n", OrderedListStatement->Value.BufferLen));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "Value.Buffer= 0x%x\n", OrderedListStatement->Value.Buffer));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "Value.MaxContainers= 0x%x\n", OrderedListStatement->ExtraData.OrderListData.MaxContainers));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "StorageWidth= 0x%x\n", OrderedListStatement->StorageWidth));
if (OrderedListStatement->Value.Buffer == NULL) {
return;
@@ -1083,7 +1083,7 @@ DumpOrderedListValue ( Value8 = (UINT8 *)OrderedListStatement->Value.Buffer;
Count = OrderedListStatement->StorageWidth / sizeof (UINT8);
for (Index = 0; Index < Count; Index++) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%d ", Value8[Index]));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%d ", Value8[Index]));
}
break;
@@ -1091,7 +1091,7 @@ DumpOrderedListValue ( Value16 = (UINT16 *)OrderedListStatement->Value.Buffer;
Count = OrderedListStatement->StorageWidth / sizeof (UINT16);
for (Index = 0; Index < Count; Index++) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%d ", Value16[Index]));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%d ", Value16[Index]));
}
break;
@@ -1099,7 +1099,7 @@ DumpOrderedListValue ( Value32 = (UINT32 *)OrderedListStatement->Value.Buffer;
Count = OrderedListStatement->StorageWidth / sizeof (UINT32);
for (Index = 0; Index < Count; Index++) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%d ", Value32[Index]));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%d ", Value32[Index]));
}
break;
@@ -1107,7 +1107,7 @@ DumpOrderedListValue ( Value64 = (UINT64 *)OrderedListStatement->Value.Buffer;
Count = OrderedListStatement->StorageWidth / sizeof (UINT64);
for (Index = 0; Index < Count; Index++) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%d ", Value64[Index]));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%d ", Value64[Index]));
}
break;
@@ -1115,13 +1115,13 @@ DumpOrderedListValue ( Value8 = (UINT8 *)OrderedListStatement->Value.Buffer;
Count = OrderedListStatement->StorageWidth / sizeof (UINT8);
for (Index = 0; Index < Count; Index++) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%d ", Value8[Index]));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%d ", Value8[Index]));
}
break;
}
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "\n"));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "\n"));
}
/**
@@ -2013,6 +2013,8 @@ RedfishPlatformConfigProtocolGetConfigureLang ( UINTN Index;
CHAR8 *FullSchema;
+ DEBUG ((DEBUG_INFO, "%a: Harvest config language of %a_%a (Regex: %s).\n", __func__, Schema, Version, RegexPattern));
+
if ((This == NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || (Count == NULL) || (ConfigureLangList == NULL) || IS_EMPTY_STRING (RegexPattern)) {
return EFI_INVALID_PARAMETER;
}
@@ -2072,6 +2074,22 @@ RedfishPlatformConfigProtocolGetConfigureLang ( *Count = StatementList.Count;
*ConfigureLangList = TmpConfigureLangList;
+ DEBUG_REDFISH_THIS_MODULE (
+ REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_REGEX,
+ "%a: Number of configure language strings harvested: %d\n",
+ __func__,
+ StatementList.Count
+ );
+
+ DEBUG_REDFISH_THIS_MODULE_CODE (
+ REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_REGEX,
+ DEBUG_REDFISH (DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE, "%a: Number of configure language strings harvested: %d\n", __func__, StatementList.Count);
+ for (Index = 0; Index < *Count; Index++) {
+ DEBUG_REDFISH (DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE, " (%d) %s\n", Index, TmpConfigureLangList[Index]);
+ }
+
+ );
+
RELEASE_RESOURCE:
if (FullSchema != NULL) {
@@ -2082,6 +2100,7 @@ RELEASE_RESOURCE: ReleaseStatementList (&StatementList);
}
+ DEBUG ((DEBUG_INFO, "%a: exit.\n", __func__));
return Status;
}
@@ -2296,6 +2315,7 @@ RedfishPlatformConfigProtocolGetAttribute ( CHAR8 *FullSchema;
CHAR8 *Buffer;
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __func__));
if ((This == NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (AttributeValue == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -2337,9 +2357,11 @@ RedfishPlatformConfigProtocolGetAttribute ( //
// Build up menu path
//
- AttributeValue->MenuPath = BuildMenPath (TargetStatement);
- if (AttributeValue->MenuPath == NULL) {
- DEBUG ((DEBUG_ERROR, "%a: failed to build menu path for \"%a\"\n", __func__, AttributeValue->AttributeName));
+ if (RedfishPlatformConfigFeatureProp (REDFISH_PLATFORM_CONFIG_BUILD_MENU_PATH)) {
+ AttributeValue->MenuPath = BuildMenuPath (TargetStatement);
+ if (AttributeValue->MenuPath == NULL) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to build menu path for \"%a\"\n", __func__, AttributeValue->AttributeName));
+ }
}
//
@@ -2370,6 +2392,7 @@ RELEASE_RESOURCE: FreePool (FullSchema);
}
+ DEBUG ((DEBUG_INFO, "%a: Exit\n", __func__));
return Status;
}
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h index 38adea0..688f206 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h @@ -3,6 +3,7 @@ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -20,7 +21,9 @@ #include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
#include <Library/PrintLib.h>
+#include <Library/RedfishDebugLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
@@ -37,6 +40,41 @@ //
#include <Protocol/EdkIIRedfishPlatformConfig.h>
+//
+// Debug message in DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE scope.
+// To enable the debug message for this module, below PCDs must be set.
+//
+// 1. DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel.
+//
+// 2 RedfishPlatformConfigDxe debug enablement must be set in
+// PcdRedfishDebugCategory (defined in RedfishPkg.dec)
+//
+// 3. The suborinate debug enablement for RedfishPlatformConfigDxe
+// must be set in PcdRedfishPlatformConfigDebugPropert (defined
+// in RedfishPkg.dec).
+//
+#define DEBUG_REDFISH_THIS_MODULE(DebugSubordinate, ...) \
+ while (RedfishPlatformConfigDebugProp (DebugSubordinate)) { \
+ DEBUG_REDFISH(DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE, ##__VA_ARGS__); \
+ break; \
+ }
+
+#define DEBUG_REDFISH_THIS_MODULE_CODE_BEGIN(DebugSubordinate) \
+ if (RedfishPlatformConfigDebugProp (DebugSubordinate)) {
+
+#define DEBUG_REDFISH_THIS_MODULE_CODE_END() }
+
+#define DEBUG_REDFISH_THIS_MODULE_CODE(DebugSubordinate, Expression) \
+ DEBUG_REDFISH_THIS_MODULE_CODE_BEGIN(DebugSubordinate) \
+ Expression \
+ DEBUG_REDFISH_THIS_MODULE_CODE_END()
+
+// Subordinate debug property for DEBUG_REDFISH_PLATFORM_CONFIG_DXE
+#define REDFISH_PLATFORM_CONFIG_DEBUG_STRING_DATABASE 0x00000001
+#define REDFISH_PLATFORM_CONFIG_DEBUG_DUMP_FORMSET 0x00000002
+#define REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_SEARCH 0x00000004
+#define REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_REGEX 0x00000008
+
///
/// Definition of EDKII_REDFISH_PLATFORM_CONFIG_NOTIFY.
///
@@ -75,8 +113,12 @@ typedef struct { #define REGULAR_EXPRESSION_INCLUDE_ALL L".*"
#define CONFIGURE_LANGUAGE_PREFIX "x-uefi-redfish-"
#define REDFISH_PLATFORM_CONFIG_VERSION 0x00010000
-#define REDFISH_PLATFORM_CONFIG_DEBUG DEBUG_MANAGEABILITY
-#define REDFISH_MENU_PATH_SIZE 8
+
+#define REDFISH_MENU_PATH_SIZE 8
+
+// Definitions of Redfish platform config capbility
+#define REDFISH_PLATFORM_CONFIG_BUILD_MENU_PATH 0x000000001
+#define REDFISH_PLATFORM_CONFIG_ALLOW_SUPPRESSED 0x000000002
/**
Convert input unicode string to ascii string. It's caller's
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf index 5a249c8..2db47c2 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf @@ -3,6 +3,7 @@ #
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -23,6 +24,7 @@ RedfishPkg/RedfishPkg.dec
[Sources]
+ RedfishPlatformConfigCapability.c
RedfishPlatformConfigDxe.h
RedfishPlatformConfigDxe.c
RedfishPlatformConfigImpl.h
@@ -36,7 +38,9 @@ HiiLib
HiiUtilityLib
MemoryAllocationLib
+ PcdLib
PrintLib
+ RedfishDebugLib
UefiLib
UefiBootServicesTableLib
UefiRuntimeServicesTableLib
@@ -51,5 +55,9 @@ [Guids]
gEfiRegexSyntaxTypePerlGuid ## CONSUMED
+[FixedPcd]
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigFeatureProperty
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigDebugProperty
+
[Depex]
TRUE
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c index 36e5da2..03dcc8d 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c @@ -32,7 +32,7 @@ DumpHiiString ( EFI_STRING String;
if ((HiiHandle == NULL) || (StringId == 0)) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "???"));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "???"));
return EFI_INVALID_PARAMETER;
}
@@ -41,7 +41,7 @@ DumpHiiString ( return EFI_NOT_FOUND;
}
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%s", String));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%s", String));
FreePool (String);
return EFI_SUCCESS;
@@ -79,18 +79,18 @@ DumpFormset ( HiiFormPrivate = REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK (HiiFormLink);
HiiNextFormLink = GetNextNode (&FormsetPrivate->HiiFormList, HiiFormLink);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, " [%d] form: %d title: ", ++Index, HiiFormPrivate->Id));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " [%d] form: %d title: ", ++Index, HiiFormPrivate->Id));
DumpHiiString (FormsetPrivate->HiiHandle, HiiFormPrivate->Title);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "\n"));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "\n"));
HiiStatementLink = GetFirstNode (&HiiFormPrivate->StatementList);
while (!IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) {
HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
HiiNextStatementLink = GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, " QID: 0x%x Prompt: ", HiiStatementPrivate->QuestionId));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " QID: 0x%x Prompt: ", HiiStatementPrivate->QuestionId));
DumpHiiString (FormsetPrivate->HiiHandle, HiiStatementPrivate->Description);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "\n"));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "\n"));
HiiStatementLink = HiiNextStatementLink;
}
@@ -125,7 +125,7 @@ DumpFormsetList ( }
if (IsListEmpty (FormsetList)) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: Empty formset list\n", __func__));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: Empty formset list\n", __func__));
return EFI_SUCCESS;
}
@@ -135,7 +135,7 @@ DumpFormsetList ( HiiFormsetNextLink = GetNextNode (FormsetList, HiiFormsetLink);
HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "[%d] HII Handle: 0x%x formset: %g at %s\n", ++Index, HiiFormsetPrivate->HiiHandle, &HiiFormsetPrivate->Guid, HiiFormsetPrivate->DevicePathStr));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "[%d] HII Handle: 0x%x formset: %g at %s\n", ++Index, HiiFormsetPrivate->HiiHandle, &HiiFormsetPrivate->Guid, HiiFormsetPrivate->DevicePathStr));
DumpFormset (HiiFormsetPrivate);
HiiFormsetLink = HiiFormsetNextLink;
@@ -622,7 +622,9 @@ GetStatementPrivateByConfigureLangRegex ( HiiNextStatementLink = GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
- if ((HiiStatementPrivate->Description != 0) && !HiiStatementPrivate->Suppressed) {
+ if ((HiiStatementPrivate->Description != 0) &&
+ (RedfishPlatformConfigFeatureProp (REDFISH_PLATFORM_CONFIG_ALLOW_SUPPRESSED) || !HiiStatementPrivate->Suppressed))
+ {
TmpString = HiiStatementPrivate->XuefiRedfishStr;
if (TmpString != NULL) {
Status = RegularExpressionProtocol->MatchString (
@@ -698,6 +700,7 @@ GetStatementPrivateByConfigureLang ( LIST_ENTRY *HiiNextStatementLink;
REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE *HiiStatementPrivate;
EFI_STRING TmpString;
+ UINTN Index;
if ((FormsetList == NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (ConfigureLang)) {
return NULL;
@@ -707,6 +710,7 @@ GetStatementPrivateByConfigureLang ( return NULL;
}
+ Index = 0;
HiiFormsetLink = GetFirstNode (FormsetList);
while (!IsNull (FormsetList, HiiFormsetLink)) {
HiiFormsetNextLink = GetNextNode (FormsetList, HiiFormsetLink);
@@ -731,15 +735,22 @@ GetStatementPrivateByConfigureLang ( HiiNextStatementLink = GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
- DEBUG_CODE (
- STATIC UINTN Index = 0;
- Index++;
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: [%d] search %s in QID: 0x%x form: 0x%x formset: %g\n", __func__, Index, ConfigureLang, HiiStatementPrivate->QuestionId, HiiFormPrivate->Id, &HiiFormsetPrivate->Guid));
- );
-
- if (HiiStatementPrivate->Description != 0) {
+ if ((HiiStatementPrivate->Description != 0) &&
+ (RedfishPlatformConfigFeatureProp (REDFISH_PLATFORM_CONFIG_ALLOW_SUPPRESSED) || !HiiStatementPrivate->Suppressed))
+ {
TmpString = HiiStatementPrivate->XuefiRedfishStr;
if (TmpString != NULL) {
+ Index++;
+ DEBUG_REDFISH_THIS_MODULE (
+ REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_SEARCH,
+ "%a: [%d] check %s in QID: 0x%x form: 0x%x formset: %g\n",
+ __func__,
+ Index,
+ ConfigureLang,
+ HiiStatementPrivate->QuestionId,
+ HiiFormPrivate->Id,
+ &HiiFormsetPrivate->Guid
+ );
if (HiiStrCmp (TmpString, ConfigureLang) == 0) {
return HiiStatementPrivate;
}
@@ -1020,7 +1031,7 @@ NewRedfishXuefiStringArray ( **/
REDFISH_X_UEFI_STRING_DATABASE *
-GetExitOrCreateXuefiStringDatabase (
+GetExistOrCreateXuefiStringDatabase (
IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate,
IN EFI_HII_STRING_PACKAGE_HDR *HiiStringPackageHeader
)
@@ -1029,8 +1040,6 @@ GetExitOrCreateXuefiStringDatabase ( BOOLEAN CreateNewOne;
REDFISH_X_UEFI_STRING_DATABASE *XuefiRedfishStringDatabase;
- DEBUG ((DEBUG_INFO, "%a: Entry\n", __func__));
-
CreateNewOne = TRUE;
XuefiRedfishStringDatabase = NULL;
if (!IsListEmpty (&FormsetPrivate->XuefiRedfishStringDatabase)) {
@@ -1052,7 +1061,7 @@ GetExitOrCreateXuefiStringDatabase ( }
if (CreateNewOne) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, " Creating x-uefi-redfish (%a) string database...\n", HiiStringPackageHeader->Language));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " Creating x-uefi-redfish (%a) string database...\n", HiiStringPackageHeader->Language));
XuefiRedfishStringDatabase = (REDFISH_X_UEFI_STRING_DATABASE *)AllocateZeroPool (sizeof (REDFISH_X_UEFI_STRING_DATABASE));
if (XuefiRedfishStringDatabase == NULL) {
DEBUG ((DEBUG_ERROR, " Failed to allocate REDFISH_X_UEFI_STRING_DATABASE.\n"));
@@ -1071,7 +1080,7 @@ GetExitOrCreateXuefiStringDatabase ( }
DEBUG ((
- REDFISH_PLATFORM_CONFIG_DEBUG,
+ DEBUG_REDFISH_PLATFORM_CONFIG,
" x-uefi-redfish (%a):\n String array is added to XuefiRedfishStringDatabase, total %d arrays now.\n",
XuefiRedfishStringDatabase->XuefiRedfishLanguage,
XuefiRedfishStringDatabase->StringsArrayBlocks
@@ -1143,7 +1152,7 @@ RedfishXuefiStringInsertDatabase ( REDFISH_X_UEFI_STRING_DATABASE *XuefiRedfishStringDatabase;
REDFISH_X_UEFI_STRINGS_ARRAY *ThisArray;
- XuefiRedfishStringDatabase = GetExitOrCreateXuefiStringDatabase (FormsetPrivate, HiiStringPackageHeader);
+ XuefiRedfishStringDatabase = GetExistOrCreateXuefiStringDatabase (FormsetPrivate, HiiStringPackageHeader);
if (XuefiRedfishStringDatabase == NULL) {
DEBUG ((DEBUG_ERROR, "%a: Failed to get REDFISH_X_UEFI_STRING_DATABASE of x-uefi-redfish language %a.\n", __func__, HiiStringPackageHeader->Language));
ReleaseXuefiStringDatabase (FormsetPrivate);
@@ -1169,21 +1178,22 @@ RedfishXuefiStringInsertDatabase ( (ThisArray->ArrayEntryAddress + StringIdOffset)->StringId = StringId;
(ThisArray->ArrayEntryAddress + StringIdOffset)->UcsString = StringTextPtr;
- DEBUG ((
- REDFISH_PLATFORM_CONFIG_DEBUG,
+ DEBUG_REDFISH_THIS_MODULE (
+ REDFISH_PLATFORM_CONFIG_DEBUG_STRING_DATABASE,
" Insert string ID: (%d) to database\n x-uefi-string: \"%s\"\n Language: %a.\n",
StringId,
StringTextPtr,
HiiStringPackageHeader->Language
- ));
+ );
return EFI_SUCCESS;
}
/**
Get x-uefi-redfish string and language by string ID.
- @param[in] FormsetPrivate Pointer to HII form-set private instance.
- @param[in] HiiStringPackageHeader HII string package header.
+ @param[in] FormsetPrivate Pointer to HII form-set private instance.
+ @param[in] HiiStringPackageHeader HII string package header.
+ @param[out] TotalStringAdded Return the total strings added to database.
@retval TRUE x-uefi-redfish string and ID map is inserted to database.
FALSE Something is wrong when insert x-uefi-redfish string and ID map.
@@ -1191,8 +1201,9 @@ RedfishXuefiStringInsertDatabase ( **/
BOOLEAN
CreateXuefiLanguageStringIdMap (
- IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate,
- IN EFI_HII_STRING_PACKAGE_HDR *HiiStringPackageHeader
+ IN REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE *FormsetPrivate,
+ IN EFI_HII_STRING_PACKAGE_HDR *HiiStringPackageHeader,
+ OUT UINTN *TotalStringAdded
)
{
EFI_STATUS Status;
@@ -1208,6 +1219,9 @@ CreateXuefiLanguageStringIdMap ( EFI_HII_SIBT_EXT2_BLOCK Ext2;
UINT32 Length32;
UINT8 *StringBlockInfo;
+ UINTN StringsAdded;
+
+ StringsAdded = 0;
//
// Parse the string blocks to get the string text and font.
@@ -1279,6 +1293,8 @@ CreateXuefiLanguageStringIdMap ( DEBUG ((DEBUG_ERROR, "%a: Failed to insert x-uefi-redfish string %s.\n", __func__, StringTextPtr));
return FALSE;
}
+
+ StringsAdded++;
}
BlockSize += (Offset + HiiStrSize ((CHAR16 *)StringTextPtr));
@@ -1370,6 +1386,7 @@ CreateXuefiLanguageStringIdMap ( BlockHdr = (UINT8 *)(StringBlockInfo + BlockSize);
}
+ *TotalStringAdded = StringsAdded;
return TRUE;
}
@@ -1483,6 +1500,8 @@ BuildXUefiRedfishStringDatabase ( UINTN SupportedSchemaLangCount;
CHAR8 **SupportedSchemaLang;
BOOLEAN StringIdMapIsBuilt;
+ UINTN TotalStringsAdded;
+ UINTN NumberPackageStrings;
DEBUG ((DEBUG_INFO, "%a: Building x-uefi-redfish string database, HII Formset GUID - %g.\n", __func__, FormsetPrivate->Guid));
@@ -1514,6 +1533,7 @@ BuildXUefiRedfishStringDatabase ( return;
}
+ TotalStringsAdded = 0;
//
// Finding the string package.
//
@@ -1538,14 +1558,18 @@ BuildXUefiRedfishStringDatabase ( AsciiStrLen (HiiStringPackageHeader->Language)
) == 0)
{
- StringIdMapIsBuilt = CreateXuefiLanguageStringIdMap (FormsetPrivate, HiiStringPackageHeader);
+ StringIdMapIsBuilt = CreateXuefiLanguageStringIdMap (FormsetPrivate, HiiStringPackageHeader, &NumberPackageStrings);
+ if (StringIdMapIsBuilt) {
+ TotalStringsAdded += NumberPackageStrings;
+ }
+
break;
}
}
if (StringIdMapIsBuilt == FALSE) {
if (AsciiStrStr (HiiStringPackageHeader->Language, X_UEFI_SCHEMA_PREFIX) == NULL) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, " No need to build x-uefi-redfish string ID map for HII language %a\n", HiiStringPackageHeader->Language));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " No need to build x-uefi-redfish string ID map for HII language %a\n", HiiStringPackageHeader->Language));
} else {
DEBUG ((DEBUG_ERROR, " Failed to build x-uefi-redfish string ID map of HII language %a\n", HiiStringPackageHeader->Language));
}
@@ -1555,6 +1579,8 @@ BuildXUefiRedfishStringDatabase ( PackageHeader = (EFI_HII_PACKAGE_HEADER *)((UINTN)PackageHeader + PackageHeader->Length);
}
}
+
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, " Total %d x-uefi-redfish config language are added.\n", TotalStringsAdded));
}
/**
@@ -1620,7 +1646,7 @@ LoadFormset ( FormsetPrivate->DevicePathStr = ConvertDevicePathToText (HiiFormSet->DevicePath, FALSE, FALSE);
Status = GetSupportedSchema (FormsetPrivate->HiiHandle, &FormsetPrivate->SupportedSchema);
if (EFI_ERROR (Status)) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: No x-uefi-redfish configuration found on the formset - %g\n", __func__, FormsetPrivate->Guid));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: No x-uefi-redfish configuration found on the formset - %g\n", __func__, FormsetPrivate->Guid));
return EFI_UNSUPPORTED; // Can't build AttributeRegistry Meni path with returning EFI_UNSUPPORTED.
} else {
// Building x-uefi-redfish string database
@@ -1788,7 +1814,10 @@ LoadFormsetList ( InsertTailList (FormsetList, &FormsetPrivate->Link);
DEBUG_CODE (
+ if (RedfishPlatformConfigDebugProp (REDFISH_PLATFORM_CONFIG_DEBUG_DUMP_FORMSET)) {
DumpFormsetList (FormsetList);
+ }
+
);
return EFI_SUCCESS;
@@ -1908,7 +1937,7 @@ NotifyFormsetUpdate ( if (TargetPendingList != NULL) {
TargetPendingList->IsDeleted = FALSE;
DEBUG_CODE (
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: HII handle: 0x%x is updated\n", __func__, HiiHandle));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: HII handle: 0x%x is updated\n", __func__, HiiHandle));
);
return EFI_SUCCESS;
}
@@ -1924,7 +1953,7 @@ NotifyFormsetUpdate ( InsertTailList (PendingList, &TargetPendingList->Link);
DEBUG_CODE (
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: HII handle: 0x%x is created\n", __func__, HiiHandle));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: HII handle: 0x%x is created\n", __func__, HiiHandle));
);
return EFI_SUCCESS;
@@ -1961,7 +1990,7 @@ NotifyFormsetDeleted ( if (TargetPendingList != NULL) {
TargetPendingList->IsDeleted = TRUE;
DEBUG_CODE (
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: HII handle: 0x%x is updated and deleted\n", __func__, HiiHandle));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: HII handle: 0x%x is updated and deleted\n", __func__, HiiHandle));
);
return EFI_SUCCESS;
}
@@ -1977,7 +2006,7 @@ NotifyFormsetDeleted ( InsertTailList (PendingList, &TargetPendingList->Link);
DEBUG_CODE (
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: HII handle: 0x%x is deleted\n", __func__, HiiHandle));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: HII handle: 0x%x is deleted\n", __func__, HiiHandle));
);
return EFI_SUCCESS;
@@ -2026,12 +2055,12 @@ ProcessPendingList ( //
FormsetPrivate = GetFormsetPrivateByHiiHandle (Target->HiiHandle, FormsetList);
if (FormsetPrivate != NULL) {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: formset: %g is removed because driver release HII resource it already\n", __func__, FormsetPrivate->Guid));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: formset: %g is removed because driver release HII resource it already\n", __func__, FormsetPrivate->Guid));
RemoveEntryList (&FormsetPrivate->Link);
ReleaseFormset (FormsetPrivate);
FreePool (FormsetPrivate);
} else {
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: formset on HII handle 0x%x was removed already\n", __func__, Target->HiiHandle));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: formset on HII handle 0x%x was removed already\n", __func__, Target->HiiHandle));
}
} else {
//
@@ -2042,7 +2071,7 @@ ProcessPendingList ( //
// HII formset already exist, release it and query again.
//
- DEBUG ((REDFISH_PLATFORM_CONFIG_DEBUG, "%a: formset: %g is updated. Release current formset\n", __func__, &FormsetPrivate->Guid));
+ DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: formset: %g is updated. Release current formset\n", __func__, &FormsetPrivate->Guid));
RemoveEntryList (&FormsetPrivate->Link);
ReleaseFormset (FormsetPrivate);
FreePool (FormsetPrivate);
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h index 8b8c544..24a7dae 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h @@ -418,4 +418,32 @@ HiiStrSize ( IN CONST CHAR16 *String
);
+/**
+ Check if the debug property is enabled or not.
+
+ @param[in] DebugType Debug enablement type
+
+ @retval TRUE, the debug property is enabled.
+ FALSE, the debug property is not enabled.
+
+**/
+BOOLEAN
+RedfishPlatformConfigDebugProp (
+ IN UINT64 DebugProp
+ );
+
+/**
+ Check if the Platform Configure feature is enabled or not.
+
+ @param[in] FeatureType Redfish platform config feature enablement
+
+ @retval TRUE, the feature is enabled.
+ FALSE, the feature is not enabled.
+
+**/
+BOOLEAN
+RedfishPlatformConfigFeatureProp (
+ IN UINT64 FeatureProp
+ );
+
#endif
|