* [edk2-staging][PATCH v2 1/1] RedfishClientPkg: Add mechanism to reboot system if config is changed
@ 2023-03-01 13:15 Nickle Wang
2023-03-01 13:25 ` Chang, Abner
0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang @ 2023-03-01 13:15 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez
When system configuration is updated from RESTful interface, we need a
system reboot so that the changes can be applied. Introduce PCD
"PcdSystemRebootRequired" to RedfishClientPkg. RedfishFeatureUtility
library will enable this flag when system config is updated.
RedfishFeatureCore driver will check this flag and perform cold reboot
after all Redfish operations are finished. PCD "PcdSystemRebootTimeout"
is used to specify how many second BIOS will wait before reboot system.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
.../Library/RedfishFeatureUtilityLib.h | 240 ++--
.../RedfishFeatureUtilityLib.c | 1111 +++++++++--------
.../RedfishFeatureUtilityLib.inf | 3 +
RedfishClientPkg/RedfishClientPkg.dec | 8 +-
.../RedfishFeatureCoreDxe.c | 315 +++--
.../RedfishFeatureCoreDxe.h | 3 +
.../RedfishFeatureCoreDxe.inf | 5 +
7 files changed, 935 insertions(+), 750 deletions(-)
diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index 1325976d8c..1429643272 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -2,6 +2,7 @@
This file defines the Redfish Feature Utility Library interface.
(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -14,20 +15,22 @@
#include <Protocol/EdkIIRedfishPlatformConfig.h>
#include <RedfishJsonStructure/RedfishCsCommon.h>
+#define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemRebootRequired, TRUE)
+
//
// Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG
//
typedef struct {
- UINTN Index;
- EFI_STRING ConfigureLang;
+ UINTN Index;
+ EFI_STRING ConfigureLang;
} REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG;
//
// Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
//
typedef struct {
- UINTN Count;
- REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *List;
+ UINTN Count;
+ REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *List;
} REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST;
/**
@@ -44,9 +47,9 @@ typedef struct {
**/
EFI_STATUS
GetResourceByUri (
- IN REDFISH_SERVICE *Service,
- IN EFI_STRING ResourceUri,
- OUT REDFISH_RESPONSE *Response
+ IN REDFISH_SERVICE *Service,
+ IN EFI_STRING ResourceUri,
+ OUT REDFISH_RESPONSE *Response
);
/**
@@ -66,9 +69,9 @@ GetResourceByUri (
**/
EFI_STATUS
IsRedpathArray (
- IN EFI_STRING ConfigureLang,
- OUT EFI_STRING *ArraySignatureOpen,
- OUT EFI_STRING *ArraySignatureClose
+ IN EFI_STRING ConfigureLang,
+ OUT EFI_STRING *ArraySignatureOpen,
+ OUT EFI_STRING *ArraySignatureClose
);
/**
@@ -106,8 +109,8 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
**/
EFI_STATUS
CopyConfiglanguageList (
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *SourceConfigureLangList,
- OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *DestConfigureLangList
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *SourceConfigureLangList,
+ OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *DestConfigureLangList
);
/**
@@ -121,7 +124,7 @@ CopyConfiglanguageList (
**/
UINTN
GetNumberOfRedpathNodes (
- IN EFI_STRING NodeString
+ IN EFI_STRING NodeString
);
/**
@@ -138,9 +141,9 @@ GetNumberOfRedpathNodes (
**/
EFI_STRING
GetRedpathNodeByIndex (
- IN EFI_STRING NodeString,
- IN UINTN Index,
- OUT EFI_STRING *EndOfNodePtr OPTIONAL
+ IN EFI_STRING NodeString,
+ IN UINTN Index,
+ OUT EFI_STRING *EndOfNodePtr OPTIONAL
);
/**
@@ -159,9 +162,9 @@ GetRedpathNodeByIndex (
**/
EFI_STATUS
GetArrayIndexFromArrayTypeConfigureLang (
- IN CHAR16 *ConfigureLang,
- OUT CHAR16 **UnifiedConfigureLang,
- OUT UINTN *Index
+ IN CHAR16 *ConfigureLang,
+ OUT CHAR16 **UnifiedConfigureLang,
+ OUT UINTN *Index
);
/**
@@ -175,7 +178,7 @@ GetArrayIndexFromArrayTypeConfigureLang (
**/
UINTN
ConfiglanguageGetInstanceIndex (
- IN EFI_STRING ConfigureLang
+ IN EFI_STRING ConfigureLang
);
/**
@@ -191,7 +194,7 @@ ConfiglanguageGetInstanceIndex (
**/
EFI_STATUS
DestroyConfiglanguageList (
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigureLangList
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigureLangList
);
/**
@@ -211,9 +214,9 @@ DestroyConfiglanguageList (
**/
EFI_STATUS
SetResourceConfigLangMemberInstance (
- IN EFI_STRING *DestConfigLang,
- IN UINTN MaxtLengthConfigLang,
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
+ IN EFI_STRING *DestConfigLang,
+ IN UINTN MaxtLengthConfigLang,
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
);
/**
@@ -229,8 +232,8 @@ SetResourceConfigLangMemberInstance (
**/
EFI_STATUS
GetArraykeyFromUri (
- IN CHAR8 *Uri,
- OUT CHAR8 **ArrayKey
+ IN CHAR8 *Uri,
+ OUT CHAR8 **ArrayKey
);
/**
@@ -248,10 +251,10 @@ GetArraykeyFromUri (
**/
EFI_STATUS
ApplyFeatureSettingsStringType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN CHAR8 *FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN CHAR8 *FeatureValue
);
/**
@@ -269,10 +272,10 @@ ApplyFeatureSettingsStringType (
**/
EFI_STATUS
ApplyFeatureSettingsNumericType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN INTN FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN INTN FeatureValue
);
/**
@@ -290,10 +293,10 @@ ApplyFeatureSettingsNumericType (
**/
EFI_STATUS
ApplyFeatureSettingsBooleanType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN BOOLEAN FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN BOOLEAN FeatureValue
);
/**
@@ -312,11 +315,11 @@ ApplyFeatureSettingsBooleanType (
**/
EFI_STATUS
ApplyFeatureSettingsVagueType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
- IN UINT32 NumberOfVagueValues
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
+ IN UINT32 NumberOfVagueValues
);
/**
@@ -355,9 +358,9 @@ ApplyFeatureSettingsStringArrayType (
**/
EFI_STATUS
ApplyFeatureSettingsNumericArrayType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
IN RedfishCS_int64_Array *ArrayHead
);
@@ -398,11 +401,11 @@ ApplyFeatureSettingsBooleanArrayType (
**/
EFI_STATUS
CreatePayloadToPostResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT EFI_STRING *Location,
- OUT CHAR8 **Etag
+ IN REDFISH_SERVICE *Service,
+ IN REDFISH_PAYLOAD *TargetPayload,
+ IN CHAR8 *Json,
+ OUT EFI_STRING *Location,
+ OUT CHAR8 **Etag
);
/**
@@ -420,10 +423,10 @@ CreatePayloadToPostResource (
**/
EFI_STATUS
CreatePayloadToPatchResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT CHAR8 **Etag
+ IN REDFISH_SERVICE *Service,
+ IN REDFISH_PAYLOAD *TargetPayload,
+ IN CHAR8 *Json,
+ OUT CHAR8 **Etag
);
/**
@@ -456,8 +459,8 @@ RedfisSetRedfishUri (
**/
EFI_STRING
GetPropertyFromConfigureLang (
- IN EFI_STRING ResourceUri,
- IN EFI_STRING ConfigureLang
+ IN EFI_STRING ResourceUri,
+ IN EFI_STRING ConfigureLang
);
/**
@@ -475,10 +478,10 @@ GetPropertyFromConfigureLang (
**/
CHAR8 *
GetPropertyStringValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
);
/**
@@ -496,10 +499,10 @@ GetPropertyStringValue (
**/
INT64 *
GetPropertyNumericValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
);
/**
@@ -516,10 +519,10 @@ GetPropertyNumericValue (
**/
BOOLEAN *
GetPropertyBooleanValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
);
/**
@@ -535,8 +538,8 @@ GetPropertyBooleanValue (
**/
BOOLEAN
PropertyChecker (
- IN VOID *PropertyBuffer,
- IN BOOLEAN ProvisionMode
+ IN VOID *PropertyBuffer,
+ IN BOOLEAN ProvisionMode
);
/**
@@ -583,7 +586,7 @@ GetEtagWithUri (
**/
EFI_STRING
GetOdataId (
- IN REDFISH_PAYLOAD *Payload
+ IN REDFISH_PAYLOAD *Payload
);
/**
@@ -599,8 +602,8 @@ GetOdataId (
**/
EFI_STRING
GetConfigureLang (
- IN CHAR8 *Uri,
- IN CHAR8 *PropertyName OPTIONAL
+ IN CHAR8 *Uri,
+ IN CHAR8 *PropertyName OPTIONAL
);
/**
@@ -615,7 +618,7 @@ GetConfigureLang (
**/
EFI_STRING
RedfishGetUri (
- IN EFI_STRING ConfigLang
+ IN EFI_STRING ConfigLang
);
/**
@@ -630,7 +633,7 @@ RedfishGetUri (
**/
EFI_STRING
RedfishGetConfigLanguage (
- IN EFI_STRING Uri
+ IN EFI_STRING Uri
);
/**
@@ -645,7 +648,7 @@ RedfishGetConfigLanguage (
**/
CHAR8 *
StrUnicodeToAscii (
- IN EFI_STRING UnicodeStr
+ IN EFI_STRING UnicodeStr
);
/**
@@ -677,9 +680,9 @@ StrAsciiToUnicode (
**/
BOOLEAN
CheckEtag (
- IN EFI_STRING Uri,
- IN CHAR8 *EtagInHeader,
- IN CHAR8 *EtagInJson
+ IN EFI_STRING Uri,
+ IN CHAR8 *EtagInHeader,
+ IN CHAR8 *EtagInJson
);
/**
@@ -697,11 +700,11 @@ CheckEtag (
**/
CHAR8 **
GetPropertyStringArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
);
/**
@@ -719,11 +722,11 @@ GetPropertyStringArrayValue (
**/
INT64 *
GetPropertyNumericArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
);
/**
@@ -741,11 +744,11 @@ GetPropertyNumericArrayValue (
**/
BOOLEAN *
GetPropertyBooleanArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
);
/**
@@ -764,11 +767,11 @@ GetPropertyBooleanArrayValue (
**/
RedfishCS_EmptyProp_KeyValue *
GetPropertyVagueValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINT32 *NumberOfValues
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINT32 *NumberOfValues
);
/**
@@ -780,7 +783,7 @@ GetPropertyVagueValue (
**/
VOID
FreeEmptyPropKeyValueList (
- RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
+ RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
);
/**
@@ -798,7 +801,7 @@ BOOLEAN
MatchPropertyWithJsonContext (
IN EFI_STRING Property,
IN CHAR8 *Json
-);
+ );
/**
@@ -814,7 +817,7 @@ MatchPropertyWithJsonContext (
**/
EFI_STATUS
AddRedfishCharArray (
- IN OUT RedfishCS_char_Array **Head,
+ IN OUT RedfishCS_char_Array **Head,
IN CHAR8 **StringArray,
IN UINTN ArraySize
);
@@ -833,9 +836,9 @@ AddRedfishCharArray (
**/
EFI_STATUS
AddRedfishNumericArray (
- IN OUT RedfishCS_int64_Array **Head,
- IN INT64 *NumericArray,
- IN UINTN ArraySize
+ IN OUT RedfishCS_int64_Array **Head,
+ IN INT64 *NumericArray,
+ IN UINTN ArraySize
);
/**
@@ -856,6 +859,7 @@ AddRedfishBooleanArray (
IN BOOLEAN *BooleanArray,
IN UINTN ArraySize
);
+
/**
Check and see if value in Redfish string array are all the same as the one
@@ -872,9 +876,9 @@ AddRedfishBooleanArray (
**/
BOOLEAN
CompareRedfishStringArrayValues (
- IN RedfishCS_char_Array *Head,
- IN CHAR8 **StringArray,
- IN UINTN ArraySize
+ IN RedfishCS_char_Array *Head,
+ IN CHAR8 **StringArray,
+ IN UINTN ArraySize
);
/**
@@ -893,9 +897,9 @@ CompareRedfishStringArrayValues (
**/
BOOLEAN
CompareRedfishNumericArrayValues (
- IN RedfishCS_int64_Array *Head,
- IN INT64 *NumericArray,
- IN UINTN ArraySize
+ IN RedfishCS_int64_Array *Head,
+ IN INT64 *NumericArray,
+ IN UINTN ArraySize
);
/**
@@ -935,10 +939,10 @@ CompareRedfishBooleanArrayValues (
**/
BOOLEAN
CompareRedfishPropertyVagueValues (
- IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
- IN UINT32 RedfishVagueKeyValueNumber,
- IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
- IN UINT32 ConfigVagueKeyValueNumber
+ IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
+ IN UINT32 RedfishVagueKeyValueNumber,
+ IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
+ IN UINT32 ConfigVagueKeyValueNumber
);
/**
@@ -955,8 +959,8 @@ CompareRedfishPropertyVagueValues (
**/
EFI_STATUS
GetEtagAndLocation (
- IN REDFISH_RESPONSE *Response,
- OUT CHAR8 **Etag, OPTIONAL
+ IN REDFISH_RESPONSE *Response,
+ OUT CHAR8 **Etag, OPTIONAL
OUT EFI_STRING *Location OPTIONAL
);
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index bfd6fff2a7..ed8a021cf2 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -2,7 +2,7 @@
Redfish feature utility library implementation
(C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
- Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,7 +10,7 @@
#include "RedfishFeatureUtilityInternal.h"
-EDKII_REDFISH_ETAG_PROTOCOL *mEtagProtocol = NULL;
+EDKII_REDFISH_ETAG_PROTOCOL *mEtagProtocol = NULL;
EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL *mConfigLangMapProtocol = NULL;
/**
@@ -33,7 +33,7 @@ RedfishLocateProtocol (
{
EFI_STATUS Status;
- if (ProtocolInstance == NULL || ProtocolGuid == NULL) {
+ if ((ProtocolInstance == NULL) || (ProtocolGuid == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -62,14 +62,14 @@ RedfishLocateProtocol (
**/
EFI_STATUS
GetArraykeyFromUri (
- IN CHAR8 *Uri,
- OUT CHAR8 **ArrayKey
+ IN CHAR8 *Uri,
+ OUT CHAR8 **ArrayKey
)
{
- CHAR8 *LeftBracket;
- UINTN Index;
+ CHAR8 *LeftBracket;
+ UINTN Index;
- if (IS_EMPTY_STRING (Uri) || ArrayKey == NULL) {
+ if (IS_EMPTY_STRING (Uri) || (ArrayKey == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -207,19 +207,19 @@ GetEtagWithUri (
**/
CHAR8 *
StrUnicodeToAscii (
- IN EFI_STRING UnicodeStr
+ IN EFI_STRING UnicodeStr
)
{
- CHAR8 *AsciiStr;
- UINTN AsciiStrSize;
- EFI_STATUS Status;
+ CHAR8 *AsciiStr;
+ UINTN AsciiStrSize;
+ EFI_STATUS Status;
if (IS_EMPTY_STRING (UnicodeStr)) {
return NULL;
}
AsciiStrSize = StrLen (UnicodeStr) + 1;
- AsciiStr = AllocatePool (AsciiStrSize);
+ AsciiStr = AllocatePool (AsciiStrSize);
if (AsciiStr == NULL) {
return NULL;
}
@@ -258,7 +258,7 @@ StrAsciiToUnicode (
}
UnicodeStrSize = (AsciiStrLen (AsciiStr) + 1) * sizeof (CHAR16);
- UnicodeStr = AllocatePool (UnicodeStrSize);
+ UnicodeStr = AllocatePool (UnicodeStrSize);
if (UnicodeStr == NULL) {
return NULL;
}
@@ -288,16 +288,16 @@ StrAsciiToUnicode (
**/
EFI_STATUS
ApplyFeatureSettingsStringType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN CHAR8 *FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN CHAR8 *FeatureValue
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || FeatureValue == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (FeatureValue == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -308,9 +308,8 @@ ApplyFeatureSettingsStringType (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_STRING) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
}
@@ -324,7 +323,12 @@ ApplyFeatureSettingsStringType (
RedfishValue.Value.Buffer = FeatureValue;
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s to %s failed: %r\n", __FUNCTION__, ConfigureLang, FeatureValue, Status));
}
} else {
@@ -350,14 +354,14 @@ ApplyFeatureSettingsStringType (
**/
EFI_STATUS
ApplyFeatureSettingsNumericType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN INTN FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN INTN FeatureValue
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang)) {
return EFI_INVALID_PARAMETER;
@@ -368,11 +372,10 @@ ApplyFeatureSettingsNumericType (
//
Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_INTEGER) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
}
@@ -385,7 +388,12 @@ ApplyFeatureSettingsNumericType (
RedfishValue.Value.Integer = (INT64)FeatureValue;
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __FUNCTION__, ConfigureLang, FeatureValue, Status));
}
} else {
@@ -411,14 +419,14 @@ ApplyFeatureSettingsNumericType (
**/
EFI_STATUS
ApplyFeatureSettingsBooleanType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN BOOLEAN FeatureValue
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN BOOLEAN FeatureValue
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang)) {
return EFI_INVALID_PARAMETER;
@@ -429,11 +437,10 @@ ApplyFeatureSettingsBooleanType (
//
Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_BOOLEAN) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
}
@@ -446,7 +453,12 @@ ApplyFeatureSettingsBooleanType (
RedfishValue.Value.Boolean = FeatureValue;
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __FUNCTION__, ConfigureLang, (FeatureValue ? "True" : "False"), Status));
}
} else {
@@ -473,23 +485,23 @@ ApplyFeatureSettingsBooleanType (
**/
EFI_STATUS
ApplyFeatureSettingsVagueType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
- IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
- IN UINT32 NumberOfVagueValues
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
+ IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
+ IN UINT32 NumberOfVagueValues
)
{
- EFI_STATUS Status;
- UINTN StrSize;
- CHAR8 *ConfigureLangAscii;
- CHAR8 *ConfigureLangKeyAscii;
- EFI_STRING ConfigureKeyLang;
- EDKII_REDFISH_VALUE RedfishValue;
- EDKII_REDFISH_VALUE_TYPES PropertyDatatype;
- RedfishCS_EmptyProp_KeyValue *CurrentVagueValuePtr;
-
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || VagueValuePtr == NULL || NumberOfVagueValues == 0) {
+ EFI_STATUS Status;
+ UINTN StrSize;
+ CHAR8 *ConfigureLangAscii;
+ CHAR8 *ConfigureLangKeyAscii;
+ EFI_STRING ConfigureKeyLang;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EDKII_REDFISH_VALUE_TYPES PropertyDatatype;
+ RedfishCS_EmptyProp_KeyValue *CurrentVagueValuePtr;
+
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (VagueValuePtr == NULL) || (NumberOfVagueValues == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -499,6 +511,7 @@ ApplyFeatureSettingsVagueType (
DEBUG ((DEBUG_ERROR, "%a, Allocate memory for generate ConfigureLang of vague key of %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
return Status;
}
+
Status = UnicodeStrToAsciiStrS (ConfigureLang, ConfigureLangAscii, StrLen (ConfigureLang) + 1);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, Convert the configureLang of vague key of %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
@@ -510,18 +523,19 @@ ApplyFeatureSettingsVagueType (
//
// Generate ConfigureLang with the key name
//
- //ConfigureKeyLang = GetConfigureLang (ConfigureLangAscii, CurrentVagueValuePtr->KeyNamePtr);
- StrSize = AsciiStrLen (ConfigureLangAscii) + AsciiStrLen (CurrentVagueValuePtr->KeyNamePtr) + 2;
+ // ConfigureKeyLang = GetConfigureLang (ConfigureLangAscii, CurrentVagueValuePtr->KeyNamePtr);
+ StrSize = AsciiStrLen (ConfigureLangAscii) + AsciiStrLen (CurrentVagueValuePtr->KeyNamePtr) + 2;
ConfigureLangKeyAscii = AllocateZeroPool (StrSize);
- ConfigureKeyLang = AllocateZeroPool (StrSize * sizeof (CHAR16));
- if (ConfigureLangKeyAscii == NULL || ConfigureKeyLang == NULL) {
- DEBUG ((DEBUG_ERROR, "%a, Generate ConfigureLang of vague key of %a.%a %s %a failed!\n", __FUNCTION__, Schema, Version, ConfigureLang, CurrentVagueValuePtr->KeyNamePtr));
- goto ErrorContinue;
+ ConfigureKeyLang = AllocateZeroPool (StrSize * sizeof (CHAR16));
+ if ((ConfigureLangKeyAscii == NULL) || (ConfigureKeyLang == NULL)) {
+ DEBUG ((DEBUG_ERROR, "%a, Generate ConfigureLang of vague key of %a.%a %s %a failed!\n", __FUNCTION__, Schema, Version, ConfigureLang, CurrentVagueValuePtr->KeyNamePtr));
+ goto ErrorContinue;
}
- AsciiStrCatS(ConfigureLangKeyAscii, StrSize, ConfigureLangAscii);
- AsciiStrCatS(ConfigureLangKeyAscii, StrSize, "/");
- AsciiStrCatS(ConfigureLangKeyAscii, StrSize, CurrentVagueValuePtr->KeyNamePtr);
- AsciiStrToUnicodeStrS(ConfigureLangKeyAscii, ConfigureKeyLang, StrSize);
+
+ AsciiStrCatS (ConfigureLangKeyAscii, StrSize, ConfigureLangAscii);
+ AsciiStrCatS (ConfigureLangKeyAscii, StrSize, "/");
+ AsciiStrCatS (ConfigureLangKeyAscii, StrSize, CurrentVagueValuePtr->KeyNamePtr);
+ AsciiStrToUnicodeStrS (ConfigureLangKeyAscii, ConfigureKeyLang, StrSize);
FreePool (ConfigureLangKeyAscii);
ConfigureLangKeyAscii = NULL;
//
@@ -534,7 +548,7 @@ ApplyFeatureSettingsVagueType (
} else if (CurrentVagueValuePtr->Value->DataType == RedfishCS_Vague_DataType_Int64) {
PropertyDatatype = REDFISH_VALUE_TYPE_INTEGER;
} else {
- DEBUG((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
goto ErrorContinue;
}
@@ -546,9 +560,10 @@ ApplyFeatureSettingsVagueType (
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureKeyLang, Status));
} else {
if (RedfishValue.Type != PropertyDatatype) {
- DEBUG((DEBUG_ERROR, "%a, %a.%a %s mismatched data type\n", __FUNCTION__, Schema, Version, ConfigureKeyLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s mismatched data type\n", __FUNCTION__, Schema, Version, ConfigureKeyLang));
goto ErrorContinue;
}
+
if (PropertyDatatype == REDFISH_VALUE_TYPE_STRING) {
//
// This is a string property.
@@ -560,8 +575,13 @@ ApplyFeatureSettingsVagueType (
DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from %a to %a\n", __FUNCTION__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Buffer, CurrentVagueValuePtr->Value->DataValue.CharPtr));
FreePool (RedfishValue.Value.Buffer);
RedfishValue.Value.Buffer = CurrentVagueValuePtr->Value->DataValue.CharPtr;
- Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %a to %a failed: %r\n", __FUNCTION__, ConfigureKeyLang, CurrentVagueValuePtr->Value->DataValue.CharPtr, Status));
}
} else {
@@ -575,17 +595,25 @@ ApplyFeatureSettingsVagueType (
//
// Apply settings from redfish
//
- DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from %a to %a\n",
- __FUNCTION__,
- Schema,
- Version,
- ConfigureKeyLang,
- (RedfishValue.Value.Boolean ? "True" : "False"),
- (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" : "False")));
+ DEBUG ((
+ DEBUG_INFO,
+ "%a, %a.%a apply %s from %a to %a\n",
+ __FUNCTION__,
+ Schema,
+ Version,
+ ConfigureKeyLang,
+ (RedfishValue.Value.Boolean ? "True" : "False"),
+ (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" : "False")
+ ));
RedfishValue.Value.Boolean = (BOOLEAN)*CurrentVagueValuePtr->Value->DataValue.BoolPtr;
- Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __FUNCTION__, ConfigureKeyLang, (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" : "False"), Status));
}
} else {
@@ -602,15 +630,20 @@ ApplyFeatureSettingsVagueType (
DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from 0x%x to 0x%x\n", __FUNCTION__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr));
RedfishValue.Value.Integer = (INT64)*CurrentVagueValuePtr->Value->DataValue.Int64Ptr;
- Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __FUNCTION__, ConfigureKeyLang, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr, Status));
}
} else {
DEBUG ((DEBUG_INFO, "%a, %a.%a %s value is: 0x%x\n", __FUNCTION__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer, Status));
}
} else {
- DEBUG((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
goto ErrorContinue;
}
}
@@ -620,22 +653,27 @@ ErrorContinue:;
FreePool (ConfigureLangKeyAscii);
ConfigureLangKeyAscii = NULL;
}
+
if (ConfigureKeyLang != NULL) {
FreePool (ConfigureKeyLang);
ConfigureKeyLang = NULL;
}
+
CurrentVagueValuePtr = CurrentVagueValuePtr->NextKeyValuePtr;
- };
+ }
if (ConfigureLangAscii != NULL) {
FreePool (ConfigureLangAscii);
}
+
if (ConfigureLangKeyAscii != NULL) {
FreePool (ConfigureLangKeyAscii);
}
+
if (ConfigureKeyLang != NULL) {
FreePool (ConfigureKeyLang);
}
+
return EFI_SUCCESS;
}
@@ -648,16 +686,16 @@ ErrorContinue:;
**/
VOID
FreeArrayTypeRedfishValue (
- EDKII_REDFISH_VALUE *RedfishValue
+ EDKII_REDFISH_VALUE *RedfishValue
)
{
- UINTN Index;
+ UINTN Index;
if (RedfishValue == NULL) {
return;
}
- if (RedfishValue->Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY && RedfishValue->Type != REDFISH_VALUE_TYPE_STRING_ARRAY) {
+ if ((RedfishValue->Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY) && (RedfishValue->Type != REDFISH_VALUE_TYPE_STRING_ARRAY)) {
return;
}
@@ -666,6 +704,7 @@ FreeArrayTypeRedfishValue (
for (Index = 0; Index < RedfishValue->ArrayCount; Index++) {
FreePool (RedfishValue->Value.StringArray[Index]);
}
+
FreePool (RedfishValue->Value.StringArray);
RedfishValue->Value.StringArray = NULL;
break;
@@ -687,7 +726,6 @@ FreeArrayTypeRedfishValue (
RedfishValue->ArrayCount = 0;
}
-
/**
Apply property value to UEFI HII database in string array type.
@@ -714,7 +752,7 @@ ApplyFeatureSettingsStringArrayType (
UINTN Index;
RedfishCS_char_Array *Buffer;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -725,9 +763,8 @@ ApplyFeatureSettingsStringArrayType (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_STRING_ARRAY) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __FUNCTION__, Schema, Version, ConfigureLang));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
}
@@ -745,10 +782,10 @@ ApplyFeatureSettingsStringArrayType (
// Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE
//
RedfishValue.ArrayCount = 0;
- Buffer = ArrayHead;
+ Buffer = ArrayHead;
while (Buffer != NULL) {
RedfishValue.ArrayCount += 1;
- Buffer = Buffer->Next;
+ Buffer = Buffer->Next;
}
//
@@ -761,13 +798,14 @@ ApplyFeatureSettingsStringArrayType (
}
Buffer = ArrayHead;
- Index = 0;
+ Index = 0;
while (Buffer != NULL) {
RedfishValue.Value.StringArray[Index] = AllocateCopyPool (AsciiStrSize (Buffer->ArrayValue), Buffer->ArrayValue);
if (RedfishValue.Value.StringArray[Index] == NULL) {
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
+
Buffer = Buffer->Next;
Index++;
}
@@ -775,7 +813,12 @@ ApplyFeatureSettingsStringArrayType (
ASSERT (Index <= RedfishValue.ArrayCount);
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION__, ConfigureLang, Status));
}
} else {
@@ -801,18 +844,18 @@ ApplyFeatureSettingsStringArrayType (
**/
EFI_STATUS
ApplyFeatureSettingsNumericArrayType (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING ConfigureLang,
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING ConfigureLang,
IN RedfishCS_int64_Array *ArrayHead
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- UINTN Index;
- RedfishCS_int64_Array *Buffer;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ UINTN Index;
+ RedfishCS_int64_Array *Buffer;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -823,7 +866,6 @@ ApplyFeatureSettingsNumericArrayType (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
@@ -843,10 +885,10 @@ ApplyFeatureSettingsNumericArrayType (
// Convert array from RedfishCS_int64_Array to EDKII_REDFISH_VALUE
//
RedfishValue.ArrayCount = 0;
- Buffer = ArrayHead;
+ Buffer = ArrayHead;
while (Buffer != NULL) {
RedfishValue.ArrayCount += 1;
- Buffer = Buffer->Next;
+ Buffer = Buffer->Next;
}
//
@@ -859,17 +901,22 @@ ApplyFeatureSettingsNumericArrayType (
}
Buffer = ArrayHead;
- Index = 0;
+ Index = 0;
while (Buffer != NULL) {
RedfishValue.Value.IntegerArray[Index] = (INT64)*Buffer->ArrayValue;
- Buffer = Buffer->Next;
+ Buffer = Buffer->Next;
Index++;
}
ASSERT (Index <= RedfishValue.ArrayCount);
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION__, ConfigureLang, Status));
}
} else {
@@ -904,9 +951,9 @@ ApplyFeatureSettingsBooleanArrayType (
EFI_STATUS Status;
EDKII_REDFISH_VALUE RedfishValue;
UINTN Index;
- RedfishCS_bool_Array *Buffer;
+ RedfishCS_bool_Array *Buffer;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -917,7 +964,6 @@ ApplyFeatureSettingsBooleanArrayType (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang, Status));
} else {
-
if (RedfishValue.Type != REDFISH_VALUE_TYPE_BOOLEAN_ARRAY) {
DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __FUNCTION__, Schema, Version, ConfigureLang));
return EFI_DEVICE_ERROR;
@@ -937,10 +983,10 @@ ApplyFeatureSettingsBooleanArrayType (
// Convert array from RedfishCS_int64_Array to EDKII_REDFISH_VALUE
//
RedfishValue.ArrayCount = 0;
- Buffer = ArrayHead;
+ Buffer = ArrayHead;
while (Buffer != NULL) {
RedfishValue.ArrayCount += 1;
- Buffer = Buffer->Next;
+ Buffer = Buffer->Next;
}
//
@@ -953,17 +999,22 @@ ApplyFeatureSettingsBooleanArrayType (
}
Buffer = ArrayHead;
- Index = 0;
+ Index = 0;
while (Buffer != NULL) {
RedfishValue.Value.BooleanArray[Index] = (BOOLEAN)*Buffer->ArrayValue;
- Buffer = Buffer->Next;
+ Buffer = Buffer->Next;
Index++;
}
ASSERT (Index <= RedfishValue.ArrayCount);
Status = RedfishPlatformConfigSetValue (Schema, Version, ConfigureLang, RedfishValue);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ //
+ // Configuration changed. Enable system reboot flag.
+ //
+ REDFISH_ENABLE_SYSTEM_REBOOT ();
+ } else {
DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION__, ConfigureLang, Status));
}
} else {
@@ -988,15 +1039,15 @@ ApplyFeatureSettingsBooleanArrayType (
**/
EFI_STATUS
GetResourceByUri (
- IN REDFISH_SERVICE *Service,
- IN EFI_STRING ResourceUri,
- OUT REDFISH_RESPONSE *Response
+ IN REDFISH_SERVICE *Service,
+ IN EFI_STRING ResourceUri,
+ OUT REDFISH_RESPONSE *Response
)
{
EFI_STATUS Status;
CHAR8 *AsciiResourceUri;
- if (Service == NULL || Response == NULL || IS_EMPTY_STRING (ResourceUri)) {
+ if ((Service == NULL) || (Response == NULL) || IS_EMPTY_STRING (ResourceUri)) {
return EFI_INVALID_PARAMETER;
}
@@ -1051,9 +1102,9 @@ GetResourceByUri (
**/
EFI_STATUS
IsRedpathArray (
- IN EFI_STRING ConfigureLang,
- OUT EFI_STRING *ArraySignatureOpen OPTIONAL,
- OUT EFI_STRING *ArraySignatureClose OPTIONAL
+ IN EFI_STRING ConfigureLang,
+ OUT EFI_STRING *ArraySignatureOpen OPTIONAL,
+ OUT EFI_STRING *ArraySignatureClose OPTIONAL
)
{
CHAR16 *IndexString;
@@ -1061,9 +1112,11 @@ IsRedpathArray (
if (ConfigureLang == NULL) {
return EFI_INVALID_PARAMETER;
}
+
if (ArraySignatureOpen != NULL) {
*ArraySignatureOpen = NULL;
}
+
if (ArraySignatureClose != NULL) {
*ArraySignatureClose = NULL;
}
@@ -1076,6 +1129,7 @@ IsRedpathArray (
if (ArraySignatureOpen != NULL) {
*ArraySignatureOpen = IndexString;
}
+
//
// Skip "{"
//
@@ -1087,11 +1141,14 @@ IsRedpathArray (
if (IndexString == NULL) {
return EFI_INVALID_PARAMETER;
}
+
if (ArraySignatureClose != NULL) {
*ArraySignatureClose = IndexString;
}
+
return EFI_SUCCESS;
}
+
return EFI_NOT_FOUND;
}
@@ -1106,23 +1163,25 @@ IsRedpathArray (
**/
UINTN
GetNumberOfRedpathNodes (
- IN EFI_STRING NodeString
+ IN EFI_STRING NodeString
)
{
- UINTN Index;
- UINTN NumberNodes;
- UINTN StringLen;
+ UINTN Index;
+ UINTN NumberNodes;
+ UINTN StringLen;
NumberNodes = 0;
- StringLen = StrLen (NodeString);
- Index = 1; // ConfigLang always starts with '/'.
+ StringLen = StrLen (NodeString);
+ Index = 1; // ConfigLang always starts with '/'.
while (Index < StringLen) {
if (*(NodeString + Index) == L'/') {
- NumberNodes ++;
+ NumberNodes++;
}
- Index ++;
- };
- NumberNodes ++;
+
+ Index++;
+ }
+
+ NumberNodes++;
return (NumberNodes);
}
@@ -1141,24 +1200,25 @@ GetNumberOfRedpathNodes (
**/
EFI_STRING
GetRedpathNodeByIndex (
- IN EFI_STRING NodeString,
- IN UINTN Index,
- OUT EFI_STRING *EndOfNodePtr OPTIONAL
+ IN EFI_STRING NodeString,
+ IN UINTN Index,
+ OUT EFI_STRING *EndOfNodePtr OPTIONAL
)
{
- UINTN NumberNodes;
- UINTN StringLen;
- UINTN StringIndex;
- EFI_STRING NodeStart;
- EFI_STRING NodeEnd;
+ UINTN NumberNodes;
+ UINTN StringLen;
+ UINTN StringIndex;
+ EFI_STRING NodeStart;
+ EFI_STRING NodeEnd;
NumberNodes = 0;
- StringLen = StrLen (NodeString);
+ StringLen = StrLen (NodeString);
StringIndex = 1; // ConfigLang always starts with '/'.
- NodeStart = NodeString;
+ NodeStart = NodeString;
if (EndOfNodePtr != NULL) {
*EndOfNodePtr = NULL;
}
+
while (StringIndex < StringLen) {
if (*(NodeString + StringIndex) == L'/') {
NodeEnd = NodeString + StringIndex - 1;
@@ -1166,14 +1226,17 @@ GetRedpathNodeByIndex (
if (EndOfNodePtr != NULL) {
*EndOfNodePtr = NodeEnd;
}
+
return NodeStart;
} else {
NodeStart = NodeString + StringIndex + 1;
}
}
- StringIndex ++;
- };
- return (NULL);
+
+ StringIndex++;
+ }
+
+ return (NULL);
}
/**
@@ -1192,18 +1255,18 @@ GetRedpathNodeByIndex (
**/
EFI_STATUS
GetArrayIndexFromArrayTypeConfigureLang (
- IN CHAR16 *ConfigureLang,
- OUT CHAR16 **UnifiedConfigureLang,
- OUT UINTN *Index
+ IN CHAR16 *ConfigureLang,
+ OUT CHAR16 **UnifiedConfigureLang,
+ OUT UINTN *Index
)
{
- EFI_STATUS Status;
- CHAR16 *TmpConfigureLang;
- CHAR16 *ArrayOpenStr;
- CHAR16 *ArrayCloseStr;
- INTN StringIndex;
+ EFI_STATUS Status;
+ CHAR16 *TmpConfigureLang;
+ CHAR16 *ArrayOpenStr;
+ CHAR16 *ArrayCloseStr;
+ INTN StringIndex;
- if (ConfigureLang == NULL || UnifiedConfigureLang == NULL || Index == NULL) {
+ if ((ConfigureLang == NULL) || (UnifiedConfigureLang == NULL) || (Index == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1227,28 +1290,30 @@ GetArrayIndexFromArrayTypeConfigureLang (
//
// Resotre the '}' character and remove rest of string.
//
- ArrayCloseStr[0] = L'}';
- ArrayCloseStr[1] = '\0';
+ ArrayCloseStr[0] = L'}';
+ ArrayCloseStr[1] = '\0';
*UnifiedConfigureLang = TmpConfigureLang;
} else {
if (Status == EFI_NOT_FOUND) {
//
// This is not the redpath array. Search "/" for the parent root.
//
- *Index = 0;
+ *Index = 0;
StringIndex = StrLen (TmpConfigureLang) - 1;
while (StringIndex >= 0 && *(TmpConfigureLang + StringIndex) != '/') {
- StringIndex --;
- };
+ StringIndex--;
+ }
+
if (StringIndex >= 0 ) {
*(TmpConfigureLang + StringIndex) = '\0';
- *UnifiedConfigureLang = TmpConfigureLang;
- Status = EFI_SUCCESS;
+ *UnifiedConfigureLang = TmpConfigureLang;
+ Status = EFI_SUCCESS;
} else {
Status = EFI_INVALID_PARAMETER;
}
}
}
+
return Status;
}
@@ -1265,27 +1330,30 @@ GetArrayIndexFromArrayTypeConfigureLang (
**/
EFI_STATUS
CopyConfiglanguageList (
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *SourceConfigureLangList,
- OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *DestConfigureLangList
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *SourceConfigureLangList,
+ OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *DestConfigureLangList
)
{
- UINTN Index;
+ UINTN Index;
- if (SourceConfigureLangList == NULL || DestConfigureLangList == NULL) {
+ if ((SourceConfigureLangList == NULL) || (DestConfigureLangList == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
DestConfigureLangList->Count = SourceConfigureLangList->Count;
- DestConfigureLangList->List =
- (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *)AllocateZeroPool (sizeof (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG) * DestConfigureLangList->Count);
+ DestConfigureLangList->List =
+ (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *)AllocateZeroPool (sizeof (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG) * DestConfigureLangList->Count);
if (DestConfigureLangList->List == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __FUNCTION__));
return EFI_OUT_OF_RESOURCES;
}
+
for (Index = 0; Index < SourceConfigureLangList->Count; Index++) {
- DestConfigureLangList->List [Index].Index = SourceConfigureLangList->List[Index].Index;
- DestConfigureLangList->List [Index].ConfigureLang =
- (EFI_STRING)AllocateCopyPool(StrSize(SourceConfigureLangList->List[Index].ConfigureLang), (VOID *)SourceConfigureLangList->List[Index].ConfigureLang);
+ DestConfigureLangList->List[Index].Index = SourceConfigureLangList->List[Index].Index;
+ DestConfigureLangList->List[Index].ConfigureLang =
+ (EFI_STRING)AllocateCopyPool (StrSize (SourceConfigureLangList->List[Index].ConfigureLang), (VOID *)SourceConfigureLangList->List[Index].ConfigureLang);
}
+
return EFI_SUCCESS;
}
@@ -1300,39 +1368,45 @@ CopyConfiglanguageList (
**/
UINTN
ConfiglanguageGetInstanceIndex (
- IN EFI_STRING ConfigureLang
+ IN EFI_STRING ConfigureLang
)
{
- INTN LeftBracketIndex;
- INTN RightBracketIndex;
- INTN Index;
- UINT64 Instance;
- EFI_STATUS Status;
+ INTN LeftBracketIndex;
+ INTN RightBracketIndex;
+ INTN Index;
+ UINT64 Instance;
+ EFI_STATUS Status;
if (ConfigureLang == NULL) {
return 0;
}
- LeftBracketIndex = 0;
+
+ LeftBracketIndex = 0;
RightBracketIndex = 0;
- Index = StrLen (ConfigureLang) - 1;
+ Index = StrLen (ConfigureLang) - 1;
while (Index >= 0) {
if (*(ConfigureLang + Index) == L'{') {
LeftBracketIndex = Index;
break;
}
+
if (*(ConfigureLang + Index) == L'}') {
RightBracketIndex = Index;
}
- Index --;
- };
+
+ Index--;
+ }
+
if ((RightBracketIndex - LeftBracketIndex) <= 1) {
return 0;
}
+
*(ConfigureLang + RightBracketIndex) = 0;
- Status = StrDecimalToUint64S (ConfigureLang + LeftBracketIndex + 1, NULL, &Instance);
- if (EFI_ERROR(Status)) {
+ Status = StrDecimalToUint64S (ConfigureLang + LeftBracketIndex + 1, NULL, &Instance);
+ if (EFI_ERROR (Status)) {
Instance = 0;
}
+
//
// Restore right curly bracket.
//
@@ -1353,20 +1427,22 @@ ConfiglanguageGetInstanceIndex (
**/
EFI_STATUS
DestroyConfiglanguageList (
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigureLangList
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigureLangList
)
{
- UINTN Index;
+ UINTN Index;
if (ConfigureLangList == NULL) {
return EFI_INVALID_PARAMETER;
}
+
if (ConfigureLangList->List != NULL) {
for (Index = 0; Index < ConfigureLangList->Count; Index++) {
- if (ConfigureLangList->List [Index].ConfigureLang != NULL) {
- FreePool (ConfigureLangList->List [Index].ConfigureLang);
+ if (ConfigureLangList->List[Index].ConfigureLang != NULL) {
+ FreePool (ConfigureLangList->List[Index].ConfigureLang);
}
}
+
FreePool (ConfigureLangList->List);
ConfigureLangList->List = NULL;
}
@@ -1391,56 +1467,60 @@ DestroyConfiglanguageList (
**/
EFI_STATUS
SetResourceConfigLangMemberInstance (
- IN EFI_STRING *DestConfigLang,
- IN UINTN MaxtLengthConfigLang,
- IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
+ IN EFI_STRING *DestConfigLang,
+ IN UINTN MaxtLengthConfigLang,
+ IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
)
{
- EFI_STRING ThisConfigLang;
- EFI_STRING NewConfigLang;
- CHAR16 InstanceStr [10];
- INTN Index;
- UINTN Length;
- UINTN MaxStrLength;
-
- if (DestConfigLang == NULL || ConfigLangInstance == NULL) {
+ EFI_STRING ThisConfigLang;
+ EFI_STRING NewConfigLang;
+ CHAR16 InstanceStr[10];
+ INTN Index;
+ UINTN Length;
+ UINTN MaxStrLength;
+
+ if ((DestConfigLang == NULL) || (ConfigLangInstance == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
UnicodeSPrint ((CHAR16 *)&InstanceStr, 10, L"%d", ConfigLangInstance->Index);
ThisConfigLang = *DestConfigLang;
- if (ThisConfigLang [0] == 0) {
+ if (ThisConfigLang[0] == 0) {
//
// Return ConfigLangInstance->ConfigureLang
//
if (ConfigLangInstance->ConfigureLang == NULL) {
return EFI_INVALID_PARAMETER;
} else {
- StrCatS(*DestConfigLang, MaxtLengthConfigLang, ConfigLangInstance->ConfigureLang);
+ StrCatS (*DestConfigLang, MaxtLengthConfigLang, ConfigLangInstance->ConfigureLang);
return EFI_SUCCESS;
}
}
- MaxStrLength = StrSize (ThisConfigLang) + StrSize ((EFI_STRING)&InstanceStr);
+ MaxStrLength = StrSize (ThisConfigLang) + StrSize ((EFI_STRING)&InstanceStr);
NewConfigLang = ThisConfigLang;
if (MaxtLengthConfigLang < MaxStrLength) {
- NewConfigLang = (EFI_STRING)AllocateZeroPool(MaxStrLength);
+ NewConfigLang = (EFI_STRING)AllocateZeroPool (MaxStrLength);
if (NewConfigLang == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for NewConfigLang.\n", __FUNCTION__));
return EFI_OUT_OF_RESOURCES;
}
}
+
//
// Search the last "{"
//
Index = StrLen (ThisConfigLang) - 1;
while ((ThisConfigLang[Index] != '{') && (Index >= 0)) {
- Index --;
- };
+ Index--;
+ }
+
if (Index == -1) {
if (NewConfigLang != ThisConfigLang) {
- FreePool(NewConfigLang);
+ FreePool (NewConfigLang);
}
+
return EFI_NOT_FOUND;
}
@@ -1449,15 +1529,17 @@ SetResourceConfigLangMemberInstance (
//
Length = 0;
while (Index >= 0) {
- NewConfigLang [Index] = ThisConfigLang[Index];
- Index --;
- Length ++;
- };
+ NewConfigLang[Index] = ThisConfigLang[Index];
+ Index--;
+ Length++;
+ }
+
UnicodeSPrint ((CHAR16 *)(NewConfigLang + Length), MaxStrLength, L"%d", ConfigLangInstance->Index);
StrCatS (NewConfigLang, MaxStrLength, L"}");
if (NewConfigLang != ThisConfigLang) {
FreePool (ThisConfigLang);
}
+
*DestConfigLang = NewConfigLang;
return EFI_SUCCESS;
}
@@ -1478,28 +1560,28 @@ SetResourceConfigLangMemberInstance (
**/
EFI_STATUS
RedfishFeatureGetUnifiedArrayTypeConfigureLang (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING Pattern, OPTIONAL
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING Pattern, OPTIONAL
OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *UnifiedConfigureLangList
)
{
- EFI_STATUS Status;
- EFI_STRING *ConfigureLangList;
- UINTN Count;
- UINTN Index;
- UINTN Index2;
- UINTN ArrayIndex;
- EFI_STRING UnifiedConfigureLang;
- BOOLEAN Duplicated;
- REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG UnifiedConfigureLangPool[BIOS_CONFIG_TO_REDFISH_REDPATH_POOL_SIZE];
-
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || UnifiedConfigureLangList == NULL) {
+ EFI_STATUS Status;
+ EFI_STRING *ConfigureLangList;
+ UINTN Count;
+ UINTN Index;
+ UINTN Index2;
+ UINTN ArrayIndex;
+ EFI_STRING UnifiedConfigureLang;
+ BOOLEAN Duplicated;
+ REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG UnifiedConfigureLangPool[BIOS_CONFIG_TO_REDFISH_REDPATH_POOL_SIZE];
+
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || (UnifiedConfigureLangList == NULL)) {
return EFI_INVALID_PARAMETER;
}
UnifiedConfigureLangList->Count = 0;
- UnifiedConfigureLangList->List = NULL;
+ UnifiedConfigureLangList->List = NULL;
ZeroMem (UnifiedConfigureLangPool, sizeof (UnifiedConfigureLangPool));
Status = RedfishPlatformConfigGetConfigureLang (Schema, Version, Pattern, &ConfigureLangList, &Count);
@@ -1514,7 +1596,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
for (Index = 0; Index < Count; Index++) {
Status = GetArrayIndexFromArrayTypeConfigureLang (ConfigureLangList[Index], &UnifiedConfigureLang, &ArrayIndex);
- if (EFI_ERROR (Status) && Status == EFI_INVALID_PARAMETER) {
+ if (EFI_ERROR (Status) && (Status == EFI_INVALID_PARAMETER)) {
ASSERT (FALSE);
continue;
}
@@ -1550,7 +1632,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
//
UnifiedConfigureLangPool[UnifiedConfigureLangList->Count].ConfigureLang = UnifiedConfigureLang;
- UnifiedConfigureLangPool[UnifiedConfigureLangList->Count].Index = ArrayIndex;
+ UnifiedConfigureLangPool[UnifiedConfigureLangList->Count].Index = ArrayIndex;
++UnifiedConfigureLangList->Count;
}
@@ -1578,23 +1660,23 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
**/
EFI_STATUS
GetEtagAndLocation (
- IN REDFISH_RESPONSE *Response,
- OUT CHAR8 **Etag, OPTIONAL
+ IN REDFISH_RESPONSE *Response,
+ OUT CHAR8 **Etag, OPTIONAL
OUT EFI_STRING *Location OPTIONAL
)
{
- EDKII_JSON_VALUE JsonValue;
- EDKII_JSON_VALUE OdataValue;
- CHAR8 *OdataString;
- CHAR8 *AsciiLocation;
- EFI_HTTP_HEADER *Header;
- EFI_STATUS Status;
+ EDKII_JSON_VALUE JsonValue;
+ EDKII_JSON_VALUE OdataValue;
+ CHAR8 *OdataString;
+ CHAR8 *AsciiLocation;
+ EFI_HTTP_HEADER *Header;
+ EFI_STATUS Status;
if (Response == NULL) {
return EFI_INVALID_PARAMETER;
}
- if (Etag == NULL && Location == NULL) {
+ if ((Etag == NULL) && (Location == NULL)) {
return EFI_SUCCESS;
}
@@ -1614,7 +1696,7 @@ GetEtagAndLocation (
//
// No header is returned. Search payload for location.
//
- if (*Etag == NULL && Response->Payload != NULL) {
+ if ((*Etag == NULL) && (Response->Payload != NULL)) {
JsonValue = RedfishJsonInPayload (Response->Payload);
if (JsonValue != NULL) {
OdataValue = JsonObjectGetValue (JsonValueGetObject (JsonValue), "@odata.etag");
@@ -1649,7 +1731,7 @@ GetEtagAndLocation (
//
// No header is returned. Search payload for location.
//
- if (*Location == NULL && Response->Payload != NULL) {
+ if ((*Location == NULL) && (Response->Payload != NULL)) {
JsonValue = RedfishJsonInPayload (Response->Payload);
if (JsonValue != NULL) {
OdataValue = JsonObjectGetValue (JsonValueGetObject (JsonValue), "@odata.id");
@@ -1675,6 +1757,7 @@ GetEtagAndLocation (
return Status;
}
+
/**
Create HTTP payload and send them to redfish service with PATCH method.
@@ -1690,25 +1773,25 @@ GetEtagAndLocation (
**/
EFI_STATUS
CreatePayloadToPatchResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT CHAR8 **Etag
+ IN REDFISH_SERVICE *Service,
+ IN REDFISH_PAYLOAD *TargetPayload,
+ IN CHAR8 *Json,
+ OUT CHAR8 **Etag
)
{
- REDFISH_PAYLOAD Payload;
- EDKII_JSON_VALUE ResourceJsonValue;
- REDFISH_RESPONSE PostResponse;
- EFI_STATUS Status;
+ REDFISH_PAYLOAD Payload;
+ EDKII_JSON_VALUE ResourceJsonValue;
+ REDFISH_RESPONSE PostResponse;
+ EFI_STATUS Status;
- if (Service == NULL || TargetPayload == NULL || IS_EMPTY_STRING (Json) || Etag == NULL) {
+ if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING (Json) || (Etag == NULL)) {
return EFI_INVALID_PARAMETER;
}
ResourceJsonValue = JsonLoadString (Json, 0, NULL);
- Payload = RedfishCreatePayload (ResourceJsonValue, Service);
+ Payload = RedfishCreatePayload (ResourceJsonValue, Service);
if (Payload == NULL) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n",__FUNCTION__, __LINE__));
+ DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n", __FUNCTION__, __LINE__));
Status = EFI_DEVICE_ERROR;
goto EXIT_FREE_JSON_VALUE;
}
@@ -1716,7 +1799,7 @@ CreatePayloadToPatchResource (
ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
Status = RedfishPatchToPayload (TargetPayload, Payload, &PostResponse);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish service.\n",__FUNCTION__, __LINE__));
+ DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish service.\n", __FUNCTION__, __LINE__));
goto EXIT_FREE_JSON_VALUE;
}
@@ -1761,26 +1844,26 @@ EXIT_FREE_JSON_VALUE:
**/
EFI_STATUS
CreatePayloadToPostResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT EFI_STRING *Location,
- OUT CHAR8 **Etag
+ IN REDFISH_SERVICE *Service,
+ IN REDFISH_PAYLOAD *TargetPayload,
+ IN CHAR8 *Json,
+ OUT EFI_STRING *Location,
+ OUT CHAR8 **Etag
)
{
- REDFISH_PAYLOAD Payload;
- EDKII_JSON_VALUE ResourceJsonValue;
- REDFISH_RESPONSE PostResponse;
- EFI_STATUS Status;
+ REDFISH_PAYLOAD Payload;
+ EDKII_JSON_VALUE ResourceJsonValue;
+ REDFISH_RESPONSE PostResponse;
+ EFI_STATUS Status;
- if (Service == NULL || TargetPayload == NULL || IS_EMPTY_STRING (Json) || Location == NULL || Etag == NULL) {
+ if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING (Json) || (Location == NULL) || (Etag == NULL)) {
return EFI_INVALID_PARAMETER;
}
ResourceJsonValue = JsonLoadString (Json, 0, NULL);
- Payload = RedfishCreatePayload (ResourceJsonValue, Service);
+ Payload = RedfishCreatePayload (ResourceJsonValue, Service);
if (Payload == NULL) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n",__FUNCTION__, __LINE__));
+ DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n", __FUNCTION__, __LINE__));
Status = EFI_DEVICE_ERROR;
goto EXIT_FREE_JSON_VALUE;
}
@@ -1788,7 +1871,7 @@ CreatePayloadToPostResource (
ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
Status = RedfishPostToPayload (TargetPayload, Payload, &PostResponse);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST Attribute Registry to Redfish service.\n",__FUNCTION__, __LINE__));
+ DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST Attribute Registry to Redfish service.\n", __FUNCTION__, __LINE__));
goto EXIT_FREE_JSON_VALUE;
}
@@ -1827,19 +1910,19 @@ EXIT_FREE_JSON_VALUE:
**/
EFI_STRING
RedfishGetUri (
- IN EFI_STRING ConfigLang
+ IN EFI_STRING ConfigLang
)
{
- EFI_STATUS Status;
- EFI_STRING Target;
- EFI_STRING Found;
- EFI_STRING TempStr;
- EFI_STRING ResultStr;
- EFI_STRING Head;
- EFI_STRING CloseBracket;
- UINTN TempStrSize;
- UINTN RemainingLen;
- UINTN ConfigLangLen;
+ EFI_STATUS Status;
+ EFI_STRING Target;
+ EFI_STRING Found;
+ EFI_STRING TempStr;
+ EFI_STRING ResultStr;
+ EFI_STRING Head;
+ EFI_STRING CloseBracket;
+ UINTN TempStrSize;
+ UINTN RemainingLen;
+ UINTN ConfigLangLen;
Status = RedfishLocateProtocol ((VOID **)&mConfigLangMapProtocol, &gEdkIIRedfishConfigLangMapProtocolGuid);
if (EFI_ERROR (Status)) {
@@ -1875,7 +1958,7 @@ RedfishGetUri (
//
do {
ConfigLangLen = StrLen (Head);
- Target = CloseBracket;
+ Target = CloseBracket;
//
// Look for next ConfigLang
@@ -1895,13 +1978,14 @@ RedfishGetUri (
//
// Copy current ConfigLang to temporary string and do a query
//
- Target += 1;
+ Target += 1;
RemainingLen = StrLen (Target);
- TempStrSize = (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16);
- TempStr = AllocateCopyPool (TempStrSize, Head);
+ TempStrSize = (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16);
+ TempStr = AllocateCopyPool (TempStrSize, Head);
if (TempStr == NULL) {
return NULL;
}
+
TempStr[ConfigLangLen - RemainingLen] = '\0';
Status = mConfigLangMapProtocol->Get (
@@ -1926,7 +2010,7 @@ RedfishGetUri (
//
// Prepare for next ConfigLang
//
- Head = Target;
+ Head = Target;
CloseBracket = StrStr (Head, L"{");
} while (CloseBracket != NULL);
@@ -1954,7 +2038,7 @@ RedfishGetUri (
**/
EFI_STRING
RedfishGetConfigLanguage (
- IN EFI_STRING Uri
+ IN EFI_STRING Uri
)
{
EFI_STATUS Status;
@@ -1973,13 +2057,12 @@ RedfishGetConfigLanguage (
}
ConfigLang = NULL;
- Status = mConfigLangMapProtocol->Get (
- mConfigLangMapProtocol,
- RedfishGetTypeUri,
- Uri,
- &ConfigLang
- );
-
+ Status = mConfigLangMapProtocol->Get (
+ mConfigLangMapProtocol,
+ RedfishGetTypeUri,
+ Uri,
+ &ConfigLang
+ );
return ConfigLang;
}
@@ -1997,8 +2080,8 @@ RedfishGetConfigLanguage (
**/
EFI_STRING
GetConfigureLang (
- IN CHAR8 *Uri,
- IN CHAR8 *PropertyName OPTIONAL
+ IN CHAR8 *Uri,
+ IN CHAR8 *PropertyName OPTIONAL
)
{
EFI_STRING ConfigLang;
@@ -2032,7 +2115,7 @@ GetConfigureLang (
}
StringSize = StrSize (ConfigLang) + ((AsciiStrLen (PropertyName) + 1) * sizeof (CHAR16));
- ResultStr = AllocatePool (StringSize);
+ ResultStr = AllocatePool (StringSize);
if (ResultStr == NULL) {
return NULL;
}
@@ -2059,7 +2142,7 @@ RedfisSetRedfishUri (
IN EFI_STRING Uri
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (IS_EMPTY_STRING (ConfigLang) || IS_EMPTY_STRING (Uri)) {
return EFI_INVALID_PARAMETER;
@@ -2088,12 +2171,12 @@ RedfisSetRedfishUri (
**/
EFI_STRING
GetOdataId (
- IN REDFISH_PAYLOAD *Payload
+ IN REDFISH_PAYLOAD *Payload
)
{
- EDKII_JSON_VALUE *JsonValue;
- EDKII_JSON_VALUE *OdataId;
- EFI_STRING OdataIdString;
+ EDKII_JSON_VALUE *JsonValue;
+ EDKII_JSON_VALUE *OdataId;
+ EFI_STRING OdataIdString;
if (Payload == NULL) {
return NULL;
@@ -2117,7 +2200,6 @@ GetOdataId (
return AllocateCopyPool (StrSize (OdataIdString), OdataIdString);
}
-
/**
Get the property name by given Configure Langauge.
@@ -2131,25 +2213,27 @@ GetOdataId (
**/
EFI_STRING
GetPropertyFromConfigureLang (
- IN EFI_STRING ResourceUri,
- IN EFI_STRING ConfigureLang
+ IN EFI_STRING ResourceUri,
+ IN EFI_STRING ConfigureLang
)
{
EFI_STATUS Status;
EFI_STRING TempString;
- if (ConfigureLang == NULL || ResourceUri == NULL) {
+ if ((ConfigureLang == NULL) || (ResourceUri == NULL)) {
return NULL;
}
Status = IsRedpathArray (ConfigureLang, NULL, &TempString);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
TempString += 2; // Advance two characters for '}' and '/'
return TempString;
}
+
if (Status != EFI_NOT_FOUND) {
return NULL;
}
+
//
// The ConigLang has no '{}'
//
@@ -2160,6 +2244,7 @@ GetPropertyFromConfigureLang (
if (GetRedpathNodeByIndex (ConfigureLang, 0, &TempString) == NULL) {
return NULL;
}
+
//
// Advance two characters to the starting
// pointer of next node.
@@ -2182,17 +2267,17 @@ GetPropertyFromConfigureLang (
**/
CHAR8 *
GetPropertyStringValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- CHAR8 *AsciiStringValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ CHAR8 *AsciiStringValue;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
return NULL;
@@ -2201,7 +2286,7 @@ GetPropertyStringValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
return NULL;
@@ -2240,17 +2325,17 @@ GetPropertyStringValue (
**/
INT64 *
GetPropertyNumericValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- INT64 *ResultValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ INT64 *ResultValue;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
return NULL;
@@ -2259,7 +2344,7 @@ GetPropertyNumericValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
return NULL;
@@ -2302,17 +2387,17 @@ GetPropertyNumericValue (
**/
BOOLEAN *
GetPropertyBooleanValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- BOOLEAN *ResultValue;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ BOOLEAN *ResultValue;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
return NULL;
@@ -2321,7 +2406,7 @@ GetPropertyBooleanValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
return NULL;
@@ -2366,8 +2451,8 @@ GetAttributeNameFromConfigLanguage (
IN EFI_STRING ConfigureLanguage
)
{
- UINTN StringLen;
- UINTN Index;
+ UINTN StringLen;
+ UINTN Index;
if (IS_EMPTY_STRING (ConfigureLanguage)) {
return NULL;
@@ -2398,21 +2483,21 @@ GetAttributeNameFromConfigLanguage (
**/
CHAR8 **
GetPropertyStringArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- CHAR8 **StringArray;
- UINTN Index;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ CHAR8 **StringArray;
+ UINTN Index;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || ArraySize == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || (ArraySize == NULL)) {
return NULL;
}
@@ -2421,7 +2506,7 @@ GetPropertyStringArrayValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
@@ -2469,21 +2554,21 @@ GetPropertyStringArrayValue (
**/
INT64 *
GetPropertyNumericArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- INT64 *IntegerArray;
- UINTN Index;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ INT64 *IntegerArray;
+ UINTN Index;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || ArraySize == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || (ArraySize == NULL)) {
return NULL;
}
@@ -2492,7 +2577,7 @@ GetPropertyNumericArrayValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
@@ -2540,21 +2625,21 @@ GetPropertyNumericArrayValue (
**/
BOOLEAN *
GetPropertyBooleanArrayValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINTN *ArraySize
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINTN *ArraySize
)
{
- EFI_STATUS Status;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- UINTN BufferSize;
- BOOLEAN *BooleanArray;
- UINTN Index;
+ EFI_STATUS Status;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ UINTN BufferSize;
+ BOOLEAN *BooleanArray;
+ UINTN Index;
- if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || ArraySize == NULL) {
+ if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName) || (ArraySize == NULL)) {
return NULL;
}
@@ -2563,7 +2648,7 @@ GetPropertyBooleanArrayValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
@@ -2605,25 +2690,28 @@ GetPropertyBooleanArrayValue (
**/
VOID
FreeEmptyPropKeyValueList (
- RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
+ RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
)
{
- RedfishCS_EmptyProp_KeyValue *NextEmptyPropKeyValueList;
+ RedfishCS_EmptyProp_KeyValue *NextEmptyPropKeyValueList;
while (EmptyPropKeyValueListHead != NULL) {
NextEmptyPropKeyValueList = EmptyPropKeyValueListHead->NextKeyValuePtr;
if (EmptyPropKeyValueListHead->Value->DataValue.CharPtr != NULL) {
- FreePool(EmptyPropKeyValueListHead->Value->DataValue.CharPtr);
+ FreePool (EmptyPropKeyValueListHead->Value->DataValue.CharPtr);
}
+
if (EmptyPropKeyValueListHead->Value != NULL) {
- FreePool(EmptyPropKeyValueListHead->Value);
+ FreePool (EmptyPropKeyValueListHead->Value);
}
+
if (EmptyPropKeyValueListHead->KeyNamePtr != NULL) {
- FreePool(EmptyPropKeyValueListHead->KeyNamePtr);
+ FreePool (EmptyPropKeyValueListHead->KeyNamePtr);
}
+
FreePool (EmptyPropKeyValueListHead);
EmptyPropKeyValueListHead = NextEmptyPropKeyValueList;
- };
+ }
}
/**
@@ -2640,26 +2728,28 @@ FreeEmptyPropKeyValueList (
RedfishCS_EmptyProp_KeyValue *
NewEmptyPropKeyValueFromRedfishValue (
IN EFI_STRING KeyName,
- IN EDKII_REDFISH_VALUE *RedfishValue
+ IN EDKII_REDFISH_VALUE *RedfishValue
)
{
- RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValue;
- RedfishCS_Vague *VagueValue;
- RedfishCS_char *KeyNameChar;
- VOID *Data;
- UINTN DataSize;
- INT32 Bool32;
-
- KeyNameChar = StrUnicodeToAscii(KeyName);
+ RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValue;
+ RedfishCS_Vague *VagueValue;
+ RedfishCS_char *KeyNameChar;
+ VOID *Data;
+ UINTN DataSize;
+ INT32 Bool32;
+
+ KeyNameChar = StrUnicodeToAscii (KeyName);
if (KeyNameChar == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to convert unicode to ASCII.\n", __FUNCTION__));
return NULL;
}
+
EmptyPropKeyValue = (RedfishCS_EmptyProp_KeyValue *)AllocateZeroPool (sizeof (RedfishCS_EmptyProp_KeyValue));
if (EmptyPropKeyValue == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for EmptyPropKeyValue\n", __FUNCTION__));
return NULL;
}
+
VagueValue = (RedfishCS_Vague *)AllocateZeroPool (sizeof (RedfishCS_Vague));
if (VagueValue == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for VagueValue\n", __FUNCTION__));
@@ -2669,29 +2759,30 @@ NewEmptyPropKeyValueFromRedfishValue (
if (RedfishValue->Type == REDFISH_VALUE_TYPE_BOOLEAN) {
VagueValue->DataType = RedfishCS_Vague_DataType_Bool;
- DataSize = sizeof (BOOLEAN);
+ DataSize = sizeof (BOOLEAN);
//
// Redfish JSON to C strcuture converter uses
// "int" for the BOOLEAN.
//
Bool32 = (INT32)RedfishValue->Value.Boolean;
- Data = (VOID *)&Bool32;
+ Data = (VOID *)&Bool32;
} else if (RedfishValue->Type == REDFISH_VALUE_TYPE_INTEGER) {
VagueValue->DataType = RedfishCS_Vague_DataType_Int64;
- DataSize = sizeof (INT64);
- Data = (VOID *)&RedfishValue->Value.Integer;
+ DataSize = sizeof (INT64);
+ Data = (VOID *)&RedfishValue->Value.Integer;
} else if (RedfishValue->Type == REDFISH_VALUE_TYPE_STRING) {
VagueValue->DataType = RedfishCS_Vague_DataType_String;
- DataSize = AsciiStrSize(RedfishValue->Value.Buffer);
- Data = (VOID *)RedfishValue->Value.Buffer;
+ DataSize = AsciiStrSize (RedfishValue->Value.Buffer);
+ Data = (VOID *)RedfishValue->Value.Buffer;
} else {
DEBUG ((DEBUG_ERROR, "%a, wrong type of RedfishValue: %x\n", __FUNCTION__, RedfishValue->Type));
FreePool (VagueValue);
FreePool (EmptyPropKeyValue);
return NULL;
}
- VagueValue->DataValue.CharPtr = (RedfishCS_char *)AllocateCopyPool(DataSize, Data);
- EmptyPropKeyValue->Value = VagueValue;
+
+ VagueValue->DataValue.CharPtr = (RedfishCS_char *)AllocateCopyPool (DataSize, Data);
+ EmptyPropKeyValue->Value = VagueValue;
EmptyPropKeyValue->KeyNamePtr = KeyNameChar;
return EmptyPropKeyValue;
}
@@ -2712,25 +2803,25 @@ NewEmptyPropKeyValueFromRedfishValue (
**/
RedfishCS_EmptyProp_KeyValue *
GetPropertyVagueValue (
- IN CHAR8 *Schema,
- IN CHAR8 *Version,
- IN EFI_STRING PropertyName,
- IN EFI_STRING ConfigureLang,
- OUT UINT32 *NumberOfValues
+ IN CHAR8 *Schema,
+ IN CHAR8 *Version,
+ IN EFI_STRING PropertyName,
+ IN EFI_STRING ConfigureLang,
+ OUT UINT32 *NumberOfValues
)
{
- EFI_STATUS Status;
- RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueList;
- RedfishCS_EmptyProp_KeyValue *PreEmptyPropKeyValueList;
- RedfishCS_EmptyProp_KeyValue *FirstEmptyPropKeyValueList;
- EDKII_REDFISH_VALUE RedfishValue;
- EFI_STRING ConfigureLangBuffer;
- EFI_STRING KeyName;
- EFI_STRING *ConfigureLangList;
- EFI_STRING SearchPattern;
- UINTN BufferSize;
- UINTN ConfigListCount;
- UINTN ConfigListCountIndex;
+ EFI_STATUS Status;
+ RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueList;
+ RedfishCS_EmptyProp_KeyValue *PreEmptyPropKeyValueList;
+ RedfishCS_EmptyProp_KeyValue *FirstEmptyPropKeyValueList;
+ EDKII_REDFISH_VALUE RedfishValue;
+ EFI_STRING ConfigureLangBuffer;
+ EFI_STRING KeyName;
+ EFI_STRING *ConfigureLangList;
+ EFI_STRING SearchPattern;
+ UINTN BufferSize;
+ UINTN ConfigListCount;
+ UINTN ConfigListCountIndex;
if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
return NULL;
@@ -2739,24 +2830,26 @@ GetPropertyVagueValue (
//
// Configure Language buffer.
//
- BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
+ BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
ConfigureLangBuffer = AllocatePool (BufferSize);
if (ConfigureLangBuffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for ConfigureLangBuffer\n", __FUNCTION__));
return NULL;
}
+
UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
//
// Initial search pattern
//
- BufferSize = (StrLen (ConfigureLangBuffer) + StrLen (L"/.*") + 1) * sizeof (CHAR16); // Increase one for the NULL terminator.
+ BufferSize = (StrLen (ConfigureLangBuffer) + StrLen (L"/.*") + 1) * sizeof (CHAR16); // Increase one for the NULL terminator.
SearchPattern = AllocatePool (BufferSize);
if (SearchPattern == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for SearchPattern\n", __FUNCTION__));
FreePool (ConfigureLangBuffer);
return NULL;
}
+
BufferSize = BufferSize / sizeof (CHAR16);
StrCpyS (SearchPattern, BufferSize, ConfigureLangBuffer);
StrCatS (SearchPattern, BufferSize, L"/.*");
@@ -2769,28 +2862,30 @@ GetPropertyVagueValue (
//
// Build up the list of RedfishCS_EmptyProp_KeyValue.
//
- ConfigListCountIndex = 0;
- PreEmptyPropKeyValueList = NULL;
+ ConfigListCountIndex = 0;
+ PreEmptyPropKeyValueList = NULL;
FirstEmptyPropKeyValueList = NULL;
while (ConfigListCountIndex < ConfigListCount) {
- Status = RedfishPlatformConfigGetValue(Schema, Version, ConfigureLangList [ConfigListCountIndex], &RedfishValue);
+ Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangList[ConfigListCountIndex], &RedfishValue);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLangList [ConfigListCountIndex], Status));
+ DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLangList[ConfigListCountIndex], Status));
goto ErrorLeave;
}
+
//
// Get the key name.
//
- KeyName = GetAttributeNameFromConfigLanguage (ConfigureLangList [ConfigListCountIndex]);
+ KeyName = GetAttributeNameFromConfigLanguage (ConfigureLangList[ConfigListCountIndex]);
//
// Create an entry of RedfishCS_EmptyProp_KeyValue.
//
EmptyPropKeyValueList = NewEmptyPropKeyValueFromRedfishValue (KeyName, &RedfishValue);
if (EmptyPropKeyValueList == NULL) {
DEBUG ((DEBUG_ERROR, "%a, Failed to create an entry of EmptyPropKeyValueList\n", __FUNCTION__));
- ConfigListCountIndex ++;
+ ConfigListCountIndex++;
continue;
}
+
//
// Link the RedfishCS_EmptyProp_KeyValue list.
//
@@ -2799,24 +2894,29 @@ GetPropertyVagueValue (
} else {
FirstEmptyPropKeyValueList = EmptyPropKeyValueList;
}
+
PreEmptyPropKeyValueList = EmptyPropKeyValueList;
- ConfigListCountIndex ++;
- };
+ ConfigListCountIndex++;
+ }
+
goto LeaveFunction;
ErrorLeave:;
if (FirstEmptyPropKeyValueList != NULL) {
FreeEmptyPropKeyValueList (FirstEmptyPropKeyValueList);
}
+
FirstEmptyPropKeyValueList = NULL;
LeaveFunction:
if (SearchPattern != NULL) {
FreePool (SearchPattern);
}
+
if (ConfigureLangBuffer != NULL) {
FreePool (ConfigureLangBuffer);
}
+
FreePool (ConfigureLangList);
*NumberOfValues = (UINT32)ConfigListCount;
@@ -2836,15 +2936,15 @@ LeaveFunction:
**/
BOOLEAN
PropertyChecker (
- IN VOID *PropertyBuffer,
- IN BOOLEAN ProvisionMode
+ IN VOID *PropertyBuffer,
+ IN BOOLEAN ProvisionMode
)
{
if (ProvisionMode) {
return TRUE;
}
- if (!ProvisionMode && PropertyBuffer != NULL) {
+ if (!ProvisionMode && (PropertyBuffer != NULL)) {
return TRUE;
}
@@ -2865,12 +2965,12 @@ PropertyChecker (
**/
BOOLEAN
CheckEtag (
- IN EFI_STRING Uri,
- IN CHAR8 *EtagInHeader,
- IN CHAR8 *EtagInJson
+ IN EFI_STRING Uri,
+ IN CHAR8 *EtagInHeader,
+ IN CHAR8 *EtagInJson
)
{
- CHAR8 *EtagInDb;
+ CHAR8 *EtagInDb;
if (IS_EMPTY_STRING (Uri)) {
return FALSE;
@@ -2920,15 +3020,15 @@ CheckEtag (
**/
EDKII_JSON_VALUE *
MatchJsonObject (
- IN EDKII_JSON_VALUE *JsonObj,
- IN CHAR8 *ObjectName
+ IN EDKII_JSON_VALUE *JsonObj,
+ IN CHAR8 *ObjectName
)
{
EDKII_JSON_VALUE N;
CHAR8 *Key;
EDKII_JSON_VALUE Value;
- if (JsonObj == NULL || IS_EMPTY_STRING (ObjectName)) {
+ if ((JsonObj == NULL) || IS_EMPTY_STRING (ObjectName)) {
return NULL;
}
@@ -2962,11 +3062,11 @@ MatchPropertyWithJsonContext (
IN CHAR8 *Json
)
{
- CHAR8 *AsciiProperty;
- CHAR8 *PropertyNode;
- UINTN Index;
- EDKII_JSON_VALUE *JsonObj;
- EDKII_JSON_VALUE *MatchObj;
+ CHAR8 *AsciiProperty;
+ CHAR8 *PropertyNode;
+ UINTN Index;
+ EDKII_JSON_VALUE *JsonObj;
+ EDKII_JSON_VALUE *MatchObj;
EDKII_JSON_TYPE JsonType;
if (IS_EMPTY_STRING (Property) || IS_EMPTY_STRING (Json)) {
@@ -2974,7 +3074,7 @@ MatchPropertyWithJsonContext (
}
JsonObj = JsonLoadString (Json, 0, NULL);
- if (JsonObj == NULL || !JsonValueIsObject (JsonObj)) {
+ if ((JsonObj == NULL) || !JsonValueIsObject (JsonObj)) {
return FALSE;
}
@@ -2983,18 +3083,17 @@ MatchPropertyWithJsonContext (
return FALSE;
}
- Index = 0;
+ Index = 0;
PropertyNode = AsciiProperty;
- MatchObj = JsonObj;
+ MatchObj = JsonObj;
//
// Walk through property and find corresponding object in JSON input
//
while (AsciiProperty[Index] != '\0') {
-
if (AsciiProperty[Index] == '/') {
AsciiProperty[Index] = '\0';
- MatchObj = MatchJsonObject (MatchObj, PropertyNode);
+ MatchObj = MatchJsonObject (MatchObj, PropertyNode);
if (MatchObj == NULL) {
PropertyNode = NULL;
break;
@@ -3023,16 +3122,19 @@ MatchPropertyWithJsonContext (
if (JsonValueIsNull (MatchObj)) {
MatchObj = NULL;
}
+
break;
case EdkiiJsonTypeArray:
if (JsonArrayCount (MatchObj) == 0) {
MatchObj = NULL;
}
+
break;
case EdkiiJsonTypeString:
if (IS_EMPTY_STRING (JsonValueGetString (MatchObj))) {
MatchObj = NULL;
}
+
break;
case EdkiiJsonTypeNull:
MatchObj = NULL;
@@ -3061,16 +3163,16 @@ MatchPropertyWithJsonContext (
**/
EFI_STATUS
AddRedfishCharArray (
- IN OUT RedfishCS_char_Array **Head,
+ IN OUT RedfishCS_char_Array **Head,
IN CHAR8 **StringArray,
IN UINTN ArraySize
)
{
- UINTN Index;
- RedfishCS_char_Array *CharArrayBuffer;
- RedfishCS_char_Array *PreArrayBuffer;
+ UINTN Index;
+ RedfishCS_char_Array *CharArrayBuffer;
+ RedfishCS_char_Array *PreArrayBuffer;
- if (Head == NULL || StringArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (StringArray == NULL) || (ArraySize == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -3083,14 +3185,15 @@ AddRedfishCharArray (
}
if (Index == 0) {
- *Head = CharArrayBuffer;
+ *Head = CharArrayBuffer;
}
CharArrayBuffer->ArrayValue = StringArray[Index];
- CharArrayBuffer->Next = NULL;
+ CharArrayBuffer->Next = NULL;
if (PreArrayBuffer != NULL) {
PreArrayBuffer->Next = CharArrayBuffer;
}
+
PreArrayBuffer = CharArrayBuffer;
}
@@ -3111,16 +3214,16 @@ AddRedfishCharArray (
**/
EFI_STATUS
AddRedfishNumericArray (
- IN OUT RedfishCS_int64_Array **Head,
- IN INT64 *NumericArray,
- IN UINTN ArraySize
+ IN OUT RedfishCS_int64_Array **Head,
+ IN INT64 *NumericArray,
+ IN UINTN ArraySize
)
{
- UINTN Index;
- RedfishCS_int64_Array *NumericArrayBuffer;
- RedfishCS_int64_Array *PreArrayBuffer;
+ UINTN Index;
+ RedfishCS_int64_Array *NumericArrayBuffer;
+ RedfishCS_int64_Array *PreArrayBuffer;
- if (Head == NULL || NumericArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (NumericArray == NULL) || (ArraySize == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -3133,18 +3236,21 @@ AddRedfishNumericArray (
}
if (Index == 0) {
- *Head = NumericArrayBuffer;
+ *Head = NumericArrayBuffer;
}
+
NumericArrayBuffer->ArrayValue = AllocatePool (sizeof (RedfishCS_int64));
if (NumericArrayBuffer->ArrayValue == NULL) {
ASSERT (NumericArrayBuffer->ArrayValue != NULL);
continue;
}
+
*NumericArrayBuffer->ArrayValue = NumericArray[Index];
- NumericArrayBuffer->Next = NULL;
+ NumericArrayBuffer->Next = NULL;
if (PreArrayBuffer != NULL) {
PreArrayBuffer->Next = NumericArrayBuffer;
}
+
PreArrayBuffer = NumericArrayBuffer;
}
@@ -3170,11 +3276,11 @@ AddRedfishBooleanArray (
IN UINTN ArraySize
)
{
- UINTN Index;
- RedfishCS_bool_Array *BooleanArrayBuffer;
- RedfishCS_bool_Array *PreArrayBuffer;
+ UINTN Index;
+ RedfishCS_bool_Array *BooleanArrayBuffer;
+ RedfishCS_bool_Array *PreArrayBuffer;
- if (Head == NULL || BooleanArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (BooleanArray == NULL) || (ArraySize == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -3187,7 +3293,7 @@ AddRedfishBooleanArray (
}
if (Index == 0) {
- *Head = BooleanArrayBuffer;
+ *Head = BooleanArrayBuffer;
}
BooleanArrayBuffer->ArrayValue = AllocatePool (sizeof (RedfishCS_bool));
@@ -3195,11 +3301,13 @@ AddRedfishBooleanArray (
ASSERT (BooleanArrayBuffer->ArrayValue != NULL);
continue;
}
+
*BooleanArrayBuffer->ArrayValue = BooleanArray[Index];
- BooleanArrayBuffer->Next = NULL;
+ BooleanArrayBuffer->Next = NULL;
if (PreArrayBuffer != NULL) {
PreArrayBuffer->Next = BooleanArrayBuffer;
}
+
PreArrayBuffer = BooleanArrayBuffer;
}
@@ -3222,22 +3330,21 @@ AddRedfishBooleanArray (
**/
BOOLEAN
CompareRedfishStringArrayValues (
- IN RedfishCS_char_Array *Head,
- IN CHAR8 **StringArray,
- IN UINTN ArraySize
+ IN RedfishCS_char_Array *Head,
+ IN CHAR8 **StringArray,
+ IN UINTN ArraySize
)
{
UINTN Index;
RedfishCS_char_Array *CharArrayBuffer;
- if (Head == NULL || StringArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (StringArray == NULL) || (ArraySize == 0)) {
return FALSE;
}
CharArrayBuffer = Head;
- Index = 0;
+ Index = 0;
while (CharArrayBuffer != NULL && Index < ArraySize) {
-
if (AsciiStrCmp (StringArray[Index], CharArrayBuffer->ArrayValue) != 0) {
break;
}
@@ -3246,7 +3353,7 @@ CompareRedfishStringArrayValues (
CharArrayBuffer = CharArrayBuffer->Next;
}
- if (CharArrayBuffer != NULL || Index < ArraySize) {
+ if ((CharArrayBuffer != NULL) || (Index < ArraySize)) {
return FALSE;
}
@@ -3269,20 +3376,20 @@ CompareRedfishStringArrayValues (
**/
BOOLEAN
CompareRedfishNumericArrayValues (
- IN RedfishCS_int64_Array *Head,
- IN INT64 *NumericArray,
- IN UINTN ArraySize
+ IN RedfishCS_int64_Array *Head,
+ IN INT64 *NumericArray,
+ IN UINTN ArraySize
)
{
UINTN Index;
RedfishCS_int64_Array *NumericArrayBuffer;
- if (Head == NULL || NumericArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (NumericArray == NULL) || (ArraySize == 0)) {
return FALSE;
}
NumericArrayBuffer = Head;
- Index = 0;
+ Index = 0;
while (NumericArrayBuffer != NULL && Index < ArraySize) {
if (NumericArray[Index] != *NumericArrayBuffer->ArrayValue) {
break;
@@ -3292,7 +3399,7 @@ CompareRedfishNumericArrayValues (
NumericArrayBuffer = NumericArrayBuffer->Next;
}
- if (NumericArrayBuffer != NULL || Index < ArraySize) {
+ if ((NumericArrayBuffer != NULL) || (Index < ArraySize)) {
return FALSE;
}
@@ -3320,15 +3427,15 @@ CompareRedfishBooleanArrayValues (
IN UINTN ArraySize
)
{
- UINTN Index;
+ UINTN Index;
RedfishCS_bool_Array *BooleanArrayBuffer;
- if (Head == NULL || BooleanArray == NULL || ArraySize == 0) {
+ if ((Head == NULL) || (BooleanArray == NULL) || (ArraySize == 0)) {
return FALSE;
}
BooleanArrayBuffer = Head;
- Index = 0;
+ Index = 0;
while (BooleanArrayBuffer != NULL && Index < ArraySize) {
if (BooleanArray[Index] != *BooleanArrayBuffer->ArrayValue) {
break;
@@ -3338,7 +3445,7 @@ CompareRedfishBooleanArrayValues (
BooleanArrayBuffer = BooleanArrayBuffer->Next;
}
- if (BooleanArrayBuffer != NULL || Index < ArraySize) {
+ if ((BooleanArrayBuffer != NULL) || (Index < ArraySize)) {
return FALSE;
}
@@ -3361,12 +3468,12 @@ CompareRedfishBooleanArrayValues (
**/
BOOLEAN
CompareRedfishPropertyVagueValues (
- IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
- IN UINT32 RedfishVagueKeyValueNumber,
- IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
- IN UINT32 ConfigVagueKeyValueNumber
+ IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
+ IN UINT32 RedfishVagueKeyValueNumber,
+ IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
+ IN UINT32 ConfigVagueKeyValueNumber
)
- {
+{
RedfishCS_EmptyProp_KeyValue *ThisConfigVagueKeyValuePtr;
RedfishCS_EmptyProp_KeyValue *ThisRedfishVagueKeyValuePtr;
@@ -3384,13 +3491,14 @@ CompareRedfishPropertyVagueValues (
// Loop through all key/value on Redfish service..
//
while (ThisRedfishVagueKeyValuePtr != NULL) {
- if (AsciiStrCmp(ThisConfigVagueKeyValuePtr->KeyNamePtr, ThisRedfishVagueKeyValuePtr->KeyNamePtr) == 0) {
+ if (AsciiStrCmp (ThisConfigVagueKeyValuePtr->KeyNamePtr, ThisRedfishVagueKeyValuePtr->KeyNamePtr) == 0) {
//
// Check the type of value.
//
if (ThisConfigVagueKeyValuePtr->Value->DataType != ThisRedfishVagueKeyValuePtr->Value->DataType) {
return FALSE;
}
+
//
// Check the value.
//
@@ -3398,11 +3506,13 @@ CompareRedfishPropertyVagueValues (
//
// Is the string identical?
//
- if (AsciiStrCmp (ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr,
- ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
- ) == 0) {
+ if (AsciiStrCmp (
+ ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr,
+ ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
+ ) == 0)
+ {
break;
- } else{
+ } else {
return FALSE;
}
} else if (ThisConfigVagueKeyValuePtr->Value->DataType == RedfishCS_Vague_DataType_Int64) {
@@ -3421,16 +3531,20 @@ CompareRedfishPropertyVagueValues (
return FALSE;
}
}
+
ThisRedfishVagueKeyValuePtr = ThisRedfishVagueKeyValuePtr->NextKeyValuePtr;
- };
+ }
+
if (ThisRedfishVagueKeyValuePtr == NULL) {
//
// No matched key name. Threat these two vague value set is different.
//
return FALSE;
}
+
ThisConfigVagueKeyValuePtr = ThisConfigVagueKeyValuePtr->NextKeyValuePtr;
- };
+ }
+
return TRUE;
}
@@ -3448,11 +3562,10 @@ CompareRedfishPropertyVagueValues (
EFI_STATUS
EFIAPI
RedfishFeatureUtilityLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
-
return EFI_SUCCESS;
}
@@ -3468,8 +3581,8 @@ RedfishFeatureUtilityLibConstructor (
EFI_STATUS
EFIAPI
RedfishFeatureUtilityLibDestructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
index 84f338e680..66d5dce6c2 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
@@ -1,6 +1,8 @@
## @file
+# INF for Redfish feature utility library.
#
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -49,6 +51,7 @@
gEdkIIRedfishConfigLangMapProtocolGuid ## CONSUMED ##
[Pcd]
+ gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
[Guids]
diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index d3c97ecf68..c0ab30ab8b 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -2,7 +2,7 @@
# Redfish Client Package
#
# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
-# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -65,3 +65,9 @@
gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEventGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8, 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x10000003
## Default Redfish version string
gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID*|0x10000004
+ ## The number of seconds that the firmware will wait before system reboot
+ gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|UINT16|0x20000002
+
+[PcdsDynamicEx]
+ ## The flag used to indicate that system reboot is required due to system configuration change
+ gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired|FALSE|BOOLEAN|0x20000001
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index 3414f0c942..5a3a9e4c5a 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -3,6 +3,7 @@
for EDK2 Redfish Feature driver registration.
(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,10 +11,10 @@
#include <RedfishFeatureCoreDxe.h>
-EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent;
-REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext;
-REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList;
-RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
+EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent;
+REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext;
+REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList;
+RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
/**
Setup the information to deliver to child feature/collection driver.
@@ -24,19 +25,21 @@ RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
**/
EFI_STATUS
SetupExchangeInformationInfo (
- IN REDFISH_FEATURE_INTERNAL_DATA *ThisList,
- IN EFI_STRING ParentConfgLanguageUri
+ IN REDFISH_FEATURE_INTERNAL_DATA *ThisList,
+ IN EFI_STRING ParentConfgLanguageUri
)
{
ThisList->InformationExchange->SendInformation.ParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
if (ThisList->InformationExchange->SendInformation.ParentUri == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- ThisList->InformationExchange->SendInformation.PropertyName = (EFI_STRING)AllocateZeroPool(MaxNodeNameLength * sizeof (CHAR16));
+
+ ThisList->InformationExchange->SendInformation.PropertyName = (EFI_STRING)AllocateZeroPool (MaxNodeNameLength * sizeof (CHAR16));
if (ThisList->InformationExchange->SendInformation.PropertyName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- ThisList->InformationExchange->SendInformation.FullUri = (EFI_STRING)AllocateZeroPool(MaxParentUriLength * sizeof (CHAR16));
+
+ ThisList->InformationExchange->SendInformation.FullUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
if (ThisList->InformationExchange->SendInformation.FullUri == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -54,13 +57,15 @@ SetupExchangeInformationInfo (
//
// Full config language URI
//
- StrCpyS (ThisList->InformationExchange->SendInformation.FullUri,
- MaxParentUriLength,
- ThisList->InformationExchange->SendInformation.ParentUri
- );
+ StrCpyS (
+ ThisList->InformationExchange->SendInformation.FullUri,
+ MaxParentUriLength,
+ ThisList->InformationExchange->SendInformation.ParentUri
+ );
if (StrLen (ThisList->InformationExchange->SendInformation.FullUri) != 0) {
StrCatS (ThisList->InformationExchange->SendInformation.FullUri, MaxParentUriLength, L"/");
}
+
StrCatS (ThisList->InformationExchange->SendInformation.FullUri, MaxParentUriLength, ThisList->InformationExchange->SendInformation.PropertyName);
return EFI_SUCCESS;
}
@@ -73,20 +78,21 @@ SetupExchangeInformationInfo (
**/
EFI_STATUS
DestroryExchangeInformation (
- IN REDFISH_FEATURE_INTERNAL_DATA *ThisList
+ IN REDFISH_FEATURE_INTERNAL_DATA *ThisList
)
{
-
if (ThisList->InformationExchange != NULL) {
if (ThisList->InformationExchange->SendInformation.Type == InformationTypeCollectionMemberUri) {
if (ThisList->InformationExchange->SendInformation.ParentUri != NULL) {
FreePool (ThisList->InformationExchange->SendInformation.ParentUri);
ThisList->InformationExchange->SendInformation.ParentUri = NULL;
}
+
if (ThisList->InformationExchange->SendInformation.PropertyName != NULL) {
FreePool (ThisList->InformationExchange->SendInformation.PropertyName);
ThisList->InformationExchange->SendInformation.PropertyName = NULL;
}
+
if (ThisList->InformationExchange->SendInformation.FullUri != NULL) {
FreePool (ThisList->InformationExchange->SendInformation.FullUri);
ThisList->InformationExchange->SendInformation.FullUri = NULL;
@@ -97,10 +103,10 @@ DestroryExchangeInformation (
DestroyConfiglanguageList (&ThisList->InformationExchange->ReturnedInformation.ConfigureLanguageList);
}
- ThisList->InformationExchange->SendInformation.Type = InformationTypeNone;
+ ThisList->InformationExchange->SendInformation.Type = InformationTypeNone;
ThisList->InformationExchange->ReturnedInformation.Type = InformationTypeNone;
-
}
+
return EFI_SUCCESS;
}
@@ -114,44 +120,47 @@ DestroryExchangeInformation (
**/
VOID
StartUpFeatureDriver (
- IN REDFISH_FEATURE_INTERNAL_DATA *ThisFeatureDriverList,
- IN EFI_STRING CurrentConfigLanguageUri,
- IN REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext
-)
+ IN REDFISH_FEATURE_INTERNAL_DATA *ThisFeatureDriverList,
+ IN EFI_STRING CurrentConfigLanguageUri,
+ IN REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext
+ )
{
- EFI_STATUS Status;
- UINTN Index;
- REDFISH_FEATURE_INTERNAL_DATA *ThisList;
- REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList;
- EFI_STRING NextParentUri;
+ EFI_STATUS Status;
+ UINTN Index;
+ REDFISH_FEATURE_INTERNAL_DATA *ThisList;
+ REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList;
+ EFI_STRING NextParentUri;
NextParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
if (NextParentUri == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure language.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure language.\n", __FUNCTION__));
return;
}
+
if (CurrentConfigLanguageUri != NULL) {
- StrCpyS(NextParentUri, MaxParentUriLength, CurrentConfigLanguageUri);
+ StrCpyS (NextParentUri, MaxParentUriLength, CurrentConfigLanguageUri);
}
ThisList = ThisFeatureDriverList;
while (TRUE) {
if (ThisList->Callback != NULL) {
ThisList->InformationExchange = mInformationExchange;
- Status = SetupExchangeInformationInfo (ThisList, NextParentUri);
+ Status = SetupExchangeInformationInfo (ThisList, NextParentUri);
if (!EFI_ERROR (Status)) {
- Status = ThisList->Callback(
- StartupContext->This,
- StartupContext->Action,
- ThisList->Context,
- ThisList->InformationExchange
- );
+ Status = ThisList->Callback (
+ StartupContext->This,
+ StartupContext->Action,
+ ThisList->Context,
+ ThisList->InformationExchange
+ );
}
+
if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature driver fail: %s.\n", __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
+ DEBUG ((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature driver fail: %s.\n", __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
}
}
- if (!EFI_ERROR (Status) && ThisList->Callback != NULL && ThisList->ChildList != NULL) {
+
+ if (!EFI_ERROR (Status) && (ThisList->Callback != NULL) && (ThisList->ChildList != NULL)) {
//
// Go through child list only when the parent node is managed by feature driver.
//
@@ -165,52 +174,56 @@ StartUpFeatureDriver (
// Copy RESOURCE_INFORMATION_RETURNED then destroy the exchange information.
//
CopyConfiglanguageList (&ThisList->InformationExchange->ReturnedInformation.ConfigureLanguageList, &ConfigLangList);
- DestroryExchangeInformation(ThisList);
+ DestroryExchangeInformation (ThisList);
//
// Modify the collection instance according to the returned InformationTypeCollectionMemberConfigLanguage.
//
- for (Index = 0; Index < ConfigLangList.Count; Index ++) {
+ for (Index = 0; Index < ConfigLangList.Count; Index++) {
StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeName);
StrCatS (NextParentUri, MaxParentUriLength, NodeIsCollectionSymbol);
SetResourceConfigLangMemberInstance (&NextParentUri, MaxParentUriLength, (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *)&ConfigLangList.List[Index]);
- StartUpFeatureDriver(ThisList->ChildList, NextParentUri, StartupContext);
+ StartUpFeatureDriver (ThisList->ChildList, NextParentUri, StartupContext);
}
+
DestroyConfiglanguageList (&ConfigLangList);
} else {
- DEBUG((DEBUG_ERROR, "%a: No InformationTypeCollectionMemberConfigLanguage of %s returned.\n", __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
- DEBUG((DEBUG_ERROR, "%a: Redfish service maybe not connected or the network has problems.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: No InformationTypeCollectionMemberConfigLanguage of %s returned.\n", __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
+ DEBUG ((DEBUG_ERROR, "%a: Redfish service maybe not connected or the network has problems.\n", __FUNCTION__));
return;
}
} else {
StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeName);
- StartUpFeatureDriver(ThisList->ChildList, NextParentUri, StartupContext);
+ StartUpFeatureDriver (ThisList->ChildList, NextParentUri, StartupContext);
}
+
//
// Restore the parent configure language URI for this level.
//
if (CurrentConfigLanguageUri != NULL) {
- StrCpyS(NextParentUri, MaxParentUriLength, CurrentConfigLanguageUri);
- } else{
- NextParentUri [0] = 0;
+ StrCpyS (NextParentUri, MaxParentUriLength, CurrentConfigLanguageUri);
+ } else {
+ NextParentUri[0] = 0;
}
} else {
DestroryExchangeInformation (ThisList);
}
+
//
// Check sibling Redfish feature driver.
//
if (ThisList->SiblingList == NULL) {
break;
}
+
//
// Go next sibling Redfish feature driver.
//
ThisList = ThisList->SiblingList;
- };
+ }
+
if (NextParentUri != NULL) {
FreePool (NextParentUri);
}
-
}
/**
@@ -224,14 +237,16 @@ StartUpFeatureDriver (
**/
VOID
EFIAPI
-RedfishFeatureDriverStartup(
- IN EFI_EVENT Event,
- IN VOID *Context
+RedfishFeatureDriverStartup (
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext;
+ REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext;
+ UINT16 RebootTimeout;
StartupContext = (REDFISH_FEATURE_STARTUP_CONTEXT *)Context;
+ RebootTimeout = PcdGet16 (PcdRedfishSystemRebootTimeout);
//
// Invoke EDK2 Redfish feature driver callback to start up
// the Redfish operations.
@@ -245,10 +260,15 @@ RedfishFeatureDriverStartup(
//
mInformationExchange = (RESOURCE_INFORMATION_EXCHANGE *)AllocateZeroPool (sizeof (RESOURCE_INFORMATION_EXCHANGE));
if (mInformationExchange == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for exchange information.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for exchange information.\n", __FUNCTION__));
return;
}
+ //
+ // Reset PcdRedfishSystemRebootRequired flag
+ //
+ PcdSetBoolS (PcdRedfishSystemRebootRequired, FALSE);
+
//
// Signal event before doing provisioning
//
@@ -263,6 +283,16 @@ RedfishFeatureDriverStartup(
// Signal event after provisioning finished
//
SignalAfterProvisioningEvent ();
+
+ //
+ // If system configuration is changed, reboot system.
+ //
+ if (PcdGetBool (PcdRedfishSystemRebootRequired)) {
+ Print (L"System configuration is changed from RESTful interface. Reboot system in %d seconds...\n", RebootTimeout);
+ gBS->Stall (RebootTimeout * 1000000U);
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ CpuDeadLoop ();
+ }
}
/**
@@ -281,31 +311,33 @@ RedfishFeatureDriverStartup(
**/
EFI_STATUS
NewInternalInstance (
- IN OUT REDFISH_FEATURE_INTERNAL_DATA **PtrToNewInternalData,
- IN EFI_STRING NodeName,
- IN BOOLEAN NodeIsCollection
+ IN OUT REDFISH_FEATURE_INTERNAL_DATA **PtrToNewInternalData,
+ IN EFI_STRING NodeName,
+ IN BOOLEAN NodeIsCollection
)
{
- REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
+ REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
- if (PtrToNewInternalData == NULL || NodeName == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Inproper given parameters\n", __FUNCTION__));
+ if ((PtrToNewInternalData == NULL) || (NodeName == NULL)) {
+ DEBUG ((DEBUG_ERROR, "%a: Inproper given parameters\n", __FUNCTION__));
return EFI_INVALID_PARAMETER;
}
*PtrToNewInternalData = NULL;
- NewInternalData = AllocateZeroPool (sizeof (REDFISH_FEATURE_INTERNAL_DATA));
+ NewInternalData = AllocateZeroPool (sizeof (REDFISH_FEATURE_INTERNAL_DATA));
if (NewInternalData == NULL) {
- DEBUG((DEBUG_ERROR, "%a: No memory for REDFISH_FEATURE_INTERNAL_DATA\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: No memory for REDFISH_FEATURE_INTERNAL_DATA\n", __FUNCTION__));
return EFI_OUT_OF_RESOURCES;
}
+
NewInternalData->NodeName = AllocateZeroPool (StrSize (NodeName));
StrnCpyS (NewInternalData->NodeName, StrSize (NodeName), (CONST CHAR16 *)NodeName, StrLen (NodeName));
NewInternalData->SiblingList = NULL;
- NewInternalData->ChildList = NULL;
+ NewInternalData->ChildList = NULL;
if (NodeIsCollection) {
NewInternalData->Flags |= REDFISH_FEATURE_INTERNAL_DATA_IS_COLLECTION;
}
+
*PtrToNewInternalData = NewInternalData;
return EFI_SUCCESS;
}
@@ -338,18 +370,19 @@ InsertRedfishFeatureUriNode (
OUT REDFISH_FEATURE_INTERNAL_DATA **MatchNodeEntry
)
{
- EFI_STATUS Status;
- REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
- REDFISH_FEATURE_INTERNAL_DATA *ThisInternalData;
- REDFISH_FEATURE_INTERNAL_DATA *SiblingList;
+ EFI_STATUS Status;
+ REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
+ REDFISH_FEATURE_INTERNAL_DATA *ThisInternalData;
+ REDFISH_FEATURE_INTERNAL_DATA *SiblingList;
*MatchNodeEntry = NULL;
if (NodeName == NULL) {
- DEBUG((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__));
return EFI_INVALID_PARAMETER;
}
+
if (NextNodeEntry == NULL) {
- DEBUG((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n", __FUNCTION__));
return EFI_INVALID_PARAMETER;
}
@@ -358,27 +391,31 @@ InsertRedfishFeatureUriNode (
if (EFI_ERROR (Status)) {
return Status;
}
- if (HeadEntryToInsert == NULL && ResourceUriNodeList == NULL) {
+
+ if ((HeadEntryToInsert == NULL) && (ResourceUriNodeList == NULL)) {
ResourceUriNodeList = NewInternalData;
} else {
(*PrevisouEntry)->ChildList = NewInternalData;
}
+
*PrevisouEntry = NewInternalData;
*NextNodeEntry = NewInternalData->ChildList;
return EFI_SUCCESS;
}
+
//
// Go through sibling list to find the entry.
//
ThisInternalData = HeadEntryToInsert;
- SiblingList = ThisInternalData->SiblingList;
+ SiblingList = ThisInternalData->SiblingList;
while (TRUE) {
- if (StrCmp((CONST CHAR16 *)ThisInternalData->NodeName, (CONST CHAR16 *)NodeName) == 0) {
+ if (StrCmp ((CONST CHAR16 *)ThisInternalData->NodeName, (CONST CHAR16 *)NodeName) == 0) {
*MatchNodeEntry = ThisInternalData;
- *NextNodeEntry = ThisInternalData->ChildList;
- *PrevisouEntry = ThisInternalData;
+ *NextNodeEntry = ThisInternalData->ChildList;
+ *PrevisouEntry = ThisInternalData;
return EFI_SUCCESS;
}
+
//
// If sibing exist?
//
@@ -387,14 +424,17 @@ InsertRedfishFeatureUriNode (
if (EFI_ERROR (Status)) {
return Status;
}
+
ThisInternalData->SiblingList = NewInternalData;
- *PrevisouEntry = NewInternalData;
- *NextNodeEntry = NewInternalData->ChildList;
+ *PrevisouEntry = NewInternalData;
+ *NextNodeEntry = NewInternalData->ChildList;
return EFI_SUCCESS;
}
+
ThisInternalData = SiblingList;
- SiblingList = ThisInternalData->SiblingList;
- };
+ SiblingList = ThisInternalData->SiblingList;
+ }
+
return EFI_SUCCESS;
}
@@ -432,66 +472,74 @@ RedfishFeatureRegister (
IN EFI_STRING FeatureManagedUri,
IN REDFISH_FEATURE_CALLBACK Callback,
IN VOID *Context
-)
+ )
{
- CHAR16 NodeName [MaxNodeNameLength];
- EFI_STATUS Status;
- UINTN Index;
- UINTN AnchorIndex;
- UINTN UriLength;
- BOOLEAN NewUri;
- REDFISH_FEATURE_INTERNAL_DATA *ThisUriNode;
- REDFISH_FEATURE_INTERNAL_DATA *PreUriNode;
- REDFISH_FEATURE_INTERNAL_DATA *NewUriNode;
- REDFISH_FEATURE_INTERNAL_DATA *MatchNodeEntry;
- BOOLEAN ItsCollection;
-
- if (FeatureManagedUri == NULL || Callback == NULL) {
- DEBUG((DEBUG_ERROR, "%a: The given parameter is invalid\n", __FUNCTION__));
+ CHAR16 NodeName[MaxNodeNameLength];
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN AnchorIndex;
+ UINTN UriLength;
+ BOOLEAN NewUri;
+ REDFISH_FEATURE_INTERNAL_DATA *ThisUriNode;
+ REDFISH_FEATURE_INTERNAL_DATA *PreUriNode;
+ REDFISH_FEATURE_INTERNAL_DATA *NewUriNode;
+ REDFISH_FEATURE_INTERNAL_DATA *MatchNodeEntry;
+ BOOLEAN ItsCollection;
+
+ if ((FeatureManagedUri == NULL) || (Callback == NULL)) {
+ DEBUG ((DEBUG_ERROR, "%a: The given parameter is invalid\n", __FUNCTION__));
return EFI_INVALID_PARAMETER;
}
+
//
// Walk through URI which managed by this EDK2 Redfish feature driver.
//
- UriLength = StrLen (FeatureManagedUri) + 1; // Add one NULL for the last node.
- Index = 0;
+ UriLength = StrLen (FeatureManagedUri) + 1; // Add one NULL for the last node.
+ Index = 0;
AnchorIndex = 0;
ThisUriNode = ResourceUriNodeList;
- PreUriNode = ResourceUriNodeList;
- NewUri = FALSE;
+ PreUriNode = ResourceUriNodeList;
+ NewUri = FALSE;
while ((Index < UriLength)) {
- if ((Index - AnchorIndex + 1) >= MaxNodeNameLength) { // Increase one for the NULL terminator
- DEBUG((DEBUG_ERROR, "%a: the length of node name is >= MaxNodeNameLength\n", __FUNCTION__));
+ if ((Index - AnchorIndex + 1) >= MaxNodeNameLength) {
+ // Increase one for the NULL terminator
+ DEBUG ((DEBUG_ERROR, "%a: the length of node name is >= MaxNodeNameLength\n", __FUNCTION__));
ASSERT (FALSE);
}
+
NodeName[Index - AnchorIndex] = *(FeatureManagedUri + Index);
- if (NodeName [Index - AnchorIndex] == NodeSeperator || NodeName [Index - AnchorIndex] == UriSeperator || NodeName [Index - AnchorIndex] == (CHAR16)0) {
- if (NodeName [Index - AnchorIndex] == UriSeperator) {
+ if ((NodeName[Index - AnchorIndex] == NodeSeperator) || (NodeName[Index - AnchorIndex] == UriSeperator) || (NodeName[Index - AnchorIndex] == (CHAR16)0)) {
+ if (NodeName[Index - AnchorIndex] == UriSeperator) {
NewUri = TRUE;
}
- NodeName [Index - AnchorIndex] = 0;
- AnchorIndex = Index + 1;
+
+ NodeName[Index - AnchorIndex] = 0;
+ AnchorIndex = Index + 1;
//
// Insert node
//
- if (StrLen(NodeName) != 0) {
+ if (StrLen (NodeName) != 0) {
ItsCollection = FALSE;
- if ((Index + StrLen(NodeIsCollectionSymbol)) < UriLength &&
- *(FeatureManagedUri + Index + 1) == NodeIsCollectionLeftBracket &&
- *(FeatureManagedUri + Index + 2) == NodeIsCollectionRightBracket) {
- Index += (StrLen(NodeIsCollectionSymbol));
- AnchorIndex += (StrLen(NodeIsCollectionSymbol));
+ if (((Index + StrLen (NodeIsCollectionSymbol)) < UriLength) &&
+ (*(FeatureManagedUri + Index + 1) == NodeIsCollectionLeftBracket) &&
+ (*(FeatureManagedUri + Index + 2) == NodeIsCollectionRightBracket))
+ {
+ Index += (StrLen (NodeIsCollectionSymbol));
+ AnchorIndex += (StrLen (NodeIsCollectionSymbol));
ItsCollection = TRUE;
if (*(FeatureManagedUri + Index) == UriSeperator) {
- NewUri = TRUE;;
+ NewUri = TRUE;
}
}
- Status = InsertRedfishFeatureUriNode(ThisUriNode, &PreUriNode, NodeName, ItsCollection, &NewUriNode, &MatchNodeEntry);
+
+ Status = InsertRedfishFeatureUriNode (ThisUriNode, &PreUriNode, NodeName, ItsCollection, &NewUriNode, &MatchNodeEntry);
if (EFI_ERROR (Status)) {
return Status;
}
+
ThisUriNode = NewUriNode;
}
+
if (NewUri || ((Index + 1) >= UriLength)) {
//
// Setup the callabck and restart the searching for the
@@ -499,28 +547,31 @@ RedfishFeatureRegister (
//
if (MatchNodeEntry != NULL) {
MatchNodeEntry->Callback = Callback;
- MatchNodeEntry->Context = Context;
- MatchNodeEntry = NULL;
+ MatchNodeEntry->Context = Context;
+ MatchNodeEntry = NULL;
} else {
PreUriNode->Callback = Callback;
- PreUriNode->Context = Context;
+ PreUriNode->Context = Context;
}
- NewUri = FALSE;
+
+ NewUri = FALSE;
ThisUriNode = ResourceUriNodeList;
- Index ++;
+ Index++;
continue;
}
}
- Index ++;
- };
+
+ Index++;
+ }
if (ThisUriNode == NULL) {
//
// No URI node was created
//
- DEBUG((DEBUG_ERROR, "%a: No URI node is added\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: No URI node is added\n", __FUNCTION__));
return EFI_INVALID_PARAMETER;
}
+
return EFI_SUCCESS;
}
@@ -545,12 +596,12 @@ RedfishFeatureUnregister (
IN EDKII_REDFISH_FEATURE_PROTOCOL *This,
IN EFI_STRING FeatureManagedUri,
IN VOID *Context
-)
+ )
{
return EFI_UNSUPPORTED;
}
-EDKII_REDFISH_FEATURE_PROTOCOL mRedfishFeatureProtocol = {
+EDKII_REDFISH_FEATURE_PROTOCOL mRedfishFeatureProtocol = {
RedfishFeatureRegister,
RedfishFeatureUnregister
};
@@ -567,30 +618,30 @@ EDKII_REDFISH_FEATURE_PROTOCOL mRedfishFeatureProtocol = {
EFI_STATUS
EFIAPI
RedfishFeatureCoreEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
- EFI_GUID *EventGuid;
+ EFI_GUID *EventGuid;
- Handle = NULL;
+ Handle = NULL;
ResourceUriNodeList = NULL;
- EventGuid = (EFI_GUID *)PcdGetPtr (PcdEdkIIRedfishFeatureDriverStartupEventGuid);
+ EventGuid = (EFI_GUID *)PcdGetPtr (PcdEdkIIRedfishFeatureDriverStartupEventGuid);
ZeroMem ((VOID *)&mFeatureDriverStartupContext, sizeof (REDFISH_FEATURE_STARTUP_CONTEXT));
- mFeatureDriverStartupContext.This = &mRedfishFeatureProtocol;
+ mFeatureDriverStartupContext.This = &mRedfishFeatureProtocol;
mFeatureDriverStartupContext.Action = CallbackActionStartOperation;
Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- RedfishFeatureDriverStartup,
- (CONST VOID *)&mFeatureDriverStartupContext,
- EventGuid,
- &mEdkIIRedfishFeatureDriverStartupEvent
- );
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ RedfishFeatureDriverStartup,
+ (CONST VOID *)&mFeatureDriverStartupContext,
+ EventGuid,
+ &mEdkIIRedfishFeatureDriverStartupEvent
+ );
if (EFI_ERROR (Status)) {
return Status;
}
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
index 84b5e456d1..af274c01ca 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
@@ -2,6 +2,7 @@
Definitions of RedfishFeatureCoreDxe
(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -17,6 +18,8 @@
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/RedfishEventLib.h>
#include <Library/RedfishFeatureUtilityLib.h>
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
index ddcf991006..c67525eedd 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
@@ -4,6 +4,8 @@
# drivers for the registration.
#
# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -40,6 +42,7 @@
RedfishFeatureUtilityLib
UefiBootServicesTableLib
UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
UefiLib
[Protocols]
@@ -47,6 +50,8 @@
[Pcd]
gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEventGuid
+ gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
+ gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout
[Depex]
TRUE
--
2.39.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-staging][PATCH v2 1/1] RedfishClientPkg: Add mechanism to reboot system if config is changed
2023-03-01 13:15 [edk2-staging][PATCH v2 1/1] RedfishClientPkg: Add mechanism to reboot system if config is changed Nickle Wang
@ 2023-03-01 13:25 ` Chang, Abner
0 siblings, 0 replies; 2+ messages in thread
From: Chang, Abner @ 2023-03-01 13:25 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy, Nick Ramirez
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Wednesday, March 1, 2023 9:16 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-staging][PATCH v2 1/1] RedfishClientPkg: Add mechanism to
> reboot system if config is changed
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> When system configuration is updated from RESTful interface, we need a
> system reboot so that the changes can be applied. Introduce PCD
> "PcdSystemRebootRequired" to RedfishClientPkg. RedfishFeatureUtility
> library will enable this flag when system config is updated.
> RedfishFeatureCore driver will check this flag and perform cold reboot
> after all Redfish operations are finished. PCD "PcdSystemRebootTimeout"
> is used to specify how many second BIOS will wait before reboot system.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
> .../Library/RedfishFeatureUtilityLib.h | 240 ++--
> .../RedfishFeatureUtilityLib.c | 1111 +++++++++--------
> .../RedfishFeatureUtilityLib.inf | 3 +
> RedfishClientPkg/RedfishClientPkg.dec | 8 +-
> .../RedfishFeatureCoreDxe.c | 315 +++--
> .../RedfishFeatureCoreDxe.h | 3 +
> .../RedfishFeatureCoreDxe.inf | 5 +
> 7 files changed, 935 insertions(+), 750 deletions(-)
>
> diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> index 1325976d8c..1429643272 100644
> --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> @@ -2,6 +2,7 @@
> This file defines the Redfish Feature Utility Library interface.
>
> (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -14,20 +15,22 @@
> #include <Protocol/EdkIIRedfishPlatformConfig.h>
> #include <RedfishJsonStructure/RedfishCsCommon.h>
>
> +#define REDFISH_ENABLE_SYSTEM_REBOOT()
> PcdSetBoolS(PcdRedfishSystemRebootRequired, TRUE)
> +
> //
> // Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG
> //
> typedef struct {
> - UINTN Index;
> - EFI_STRING ConfigureLang;
> + UINTN Index;
> + EFI_STRING ConfigureLang;
> } REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG;
>
> //
> // Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> //
> typedef struct {
> - UINTN Count;
> - REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *List;
> + UINTN Count;
> + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *List;
> } REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST;
>
> /**
> @@ -44,9 +47,9 @@ typedef struct {
> **/
> EFI_STATUS
> GetResourceByUri (
> - IN REDFISH_SERVICE *Service,
> - IN EFI_STRING ResourceUri,
> - OUT REDFISH_RESPONSE *Response
> + IN REDFISH_SERVICE *Service,
> + IN EFI_STRING ResourceUri,
> + OUT REDFISH_RESPONSE *Response
> );
>
> /**
> @@ -66,9 +69,9 @@ GetResourceByUri (
> **/
> EFI_STATUS
> IsRedpathArray (
> - IN EFI_STRING ConfigureLang,
> - OUT EFI_STRING *ArraySignatureOpen,
> - OUT EFI_STRING *ArraySignatureClose
> + IN EFI_STRING ConfigureLang,
> + OUT EFI_STRING *ArraySignatureOpen,
> + OUT EFI_STRING *ArraySignatureClose
> );
>
> /**
> @@ -106,8 +109,8 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
> **/
> EFI_STATUS
> CopyConfiglanguageList (
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *SourceConfigureLangList,
> - OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *DestConfigureLangList
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *SourceConfigureLangList,
> + OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *DestConfigureLangList
> );
>
> /**
> @@ -121,7 +124,7 @@ CopyConfiglanguageList (
> **/
> UINTN
> GetNumberOfRedpathNodes (
> - IN EFI_STRING NodeString
> + IN EFI_STRING NodeString
> );
>
> /**
> @@ -138,9 +141,9 @@ GetNumberOfRedpathNodes (
> **/
> EFI_STRING
> GetRedpathNodeByIndex (
> - IN EFI_STRING NodeString,
> - IN UINTN Index,
> - OUT EFI_STRING *EndOfNodePtr OPTIONAL
> + IN EFI_STRING NodeString,
> + IN UINTN Index,
> + OUT EFI_STRING *EndOfNodePtr OPTIONAL
> );
>
> /**
> @@ -159,9 +162,9 @@ GetRedpathNodeByIndex (
> **/
> EFI_STATUS
> GetArrayIndexFromArrayTypeConfigureLang (
> - IN CHAR16 *ConfigureLang,
> - OUT CHAR16 **UnifiedConfigureLang,
> - OUT UINTN *Index
> + IN CHAR16 *ConfigureLang,
> + OUT CHAR16 **UnifiedConfigureLang,
> + OUT UINTN *Index
> );
>
> /**
> @@ -175,7 +178,7 @@ GetArrayIndexFromArrayTypeConfigureLang (
> **/
> UINTN
> ConfiglanguageGetInstanceIndex (
> - IN EFI_STRING ConfigureLang
> + IN EFI_STRING ConfigureLang
> );
>
> /**
> @@ -191,7 +194,7 @@ ConfiglanguageGetInstanceIndex (
> **/
> EFI_STATUS
> DestroyConfiglanguageList (
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *ConfigureLangList
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *ConfigureLangList
> );
>
> /**
> @@ -211,9 +214,9 @@ DestroyConfiglanguageList (
> **/
> EFI_STATUS
> SetResourceConfigLangMemberInstance (
> - IN EFI_STRING *DestConfigLang,
> - IN UINTN MaxtLengthConfigLang,
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
> + IN EFI_STRING *DestConfigLang,
> + IN UINTN MaxtLengthConfigLang,
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
> );
>
> /**
> @@ -229,8 +232,8 @@ SetResourceConfigLangMemberInstance (
> **/
> EFI_STATUS
> GetArraykeyFromUri (
> - IN CHAR8 *Uri,
> - OUT CHAR8 **ArrayKey
> + IN CHAR8 *Uri,
> + OUT CHAR8 **ArrayKey
> );
>
> /**
> @@ -248,10 +251,10 @@ GetArraykeyFromUri (
> **/
> EFI_STATUS
> ApplyFeatureSettingsStringType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN CHAR8 *FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN CHAR8 *FeatureValue
> );
>
> /**
> @@ -269,10 +272,10 @@ ApplyFeatureSettingsStringType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsNumericType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN INTN FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN INTN FeatureValue
> );
>
> /**
> @@ -290,10 +293,10 @@ ApplyFeatureSettingsNumericType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsBooleanType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN BOOLEAN FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN BOOLEAN FeatureValue
> );
>
> /**
> @@ -312,11 +315,11 @@ ApplyFeatureSettingsBooleanType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsVagueType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
> - IN UINT32 NumberOfVagueValues
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
> + IN UINT32 NumberOfVagueValues
> );
>
> /**
> @@ -355,9 +358,9 @@ ApplyFeatureSettingsStringArrayType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsNumericArrayType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> IN RedfishCS_int64_Array *ArrayHead
> );
>
> @@ -398,11 +401,11 @@ ApplyFeatureSettingsBooleanArrayType (
> **/
> EFI_STATUS
> CreatePayloadToPostResource (
> - IN REDFISH_SERVICE *Service,
> - IN REDFISH_PAYLOAD *TargetPayload,
> - IN CHAR8 *Json,
> - OUT EFI_STRING *Location,
> - OUT CHAR8 **Etag
> + IN REDFISH_SERVICE *Service,
> + IN REDFISH_PAYLOAD *TargetPayload,
> + IN CHAR8 *Json,
> + OUT EFI_STRING *Location,
> + OUT CHAR8 **Etag
> );
>
> /**
> @@ -420,10 +423,10 @@ CreatePayloadToPostResource (
> **/
> EFI_STATUS
> CreatePayloadToPatchResource (
> - IN REDFISH_SERVICE *Service,
> - IN REDFISH_PAYLOAD *TargetPayload,
> - IN CHAR8 *Json,
> - OUT CHAR8 **Etag
> + IN REDFISH_SERVICE *Service,
> + IN REDFISH_PAYLOAD *TargetPayload,
> + IN CHAR8 *Json,
> + OUT CHAR8 **Etag
> );
>
> /**
> @@ -456,8 +459,8 @@ RedfisSetRedfishUri (
> **/
> EFI_STRING
> GetPropertyFromConfigureLang (
> - IN EFI_STRING ResourceUri,
> - IN EFI_STRING ConfigureLang
> + IN EFI_STRING ResourceUri,
> + IN EFI_STRING ConfigureLang
> );
>
> /**
> @@ -475,10 +478,10 @@ GetPropertyFromConfigureLang (
> **/
> CHAR8 *
> GetPropertyStringValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> );
>
> /**
> @@ -496,10 +499,10 @@ GetPropertyStringValue (
> **/
> INT64 *
> GetPropertyNumericValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> );
>
> /**
> @@ -516,10 +519,10 @@ GetPropertyNumericValue (
> **/
> BOOLEAN *
> GetPropertyBooleanValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> );
>
> /**
> @@ -535,8 +538,8 @@ GetPropertyBooleanValue (
> **/
> BOOLEAN
> PropertyChecker (
> - IN VOID *PropertyBuffer,
> - IN BOOLEAN ProvisionMode
> + IN VOID *PropertyBuffer,
> + IN BOOLEAN ProvisionMode
> );
>
> /**
> @@ -583,7 +586,7 @@ GetEtagWithUri (
> **/
> EFI_STRING
> GetOdataId (
> - IN REDFISH_PAYLOAD *Payload
> + IN REDFISH_PAYLOAD *Payload
> );
>
> /**
> @@ -599,8 +602,8 @@ GetOdataId (
> **/
> EFI_STRING
> GetConfigureLang (
> - IN CHAR8 *Uri,
> - IN CHAR8 *PropertyName OPTIONAL
> + IN CHAR8 *Uri,
> + IN CHAR8 *PropertyName OPTIONAL
> );
>
> /**
> @@ -615,7 +618,7 @@ GetConfigureLang (
> **/
> EFI_STRING
> RedfishGetUri (
> - IN EFI_STRING ConfigLang
> + IN EFI_STRING ConfigLang
> );
>
> /**
> @@ -630,7 +633,7 @@ RedfishGetUri (
> **/
> EFI_STRING
> RedfishGetConfigLanguage (
> - IN EFI_STRING Uri
> + IN EFI_STRING Uri
> );
>
> /**
> @@ -645,7 +648,7 @@ RedfishGetConfigLanguage (
> **/
> CHAR8 *
> StrUnicodeToAscii (
> - IN EFI_STRING UnicodeStr
> + IN EFI_STRING UnicodeStr
> );
>
> /**
> @@ -677,9 +680,9 @@ StrAsciiToUnicode (
> **/
> BOOLEAN
> CheckEtag (
> - IN EFI_STRING Uri,
> - IN CHAR8 *EtagInHeader,
> - IN CHAR8 *EtagInJson
> + IN EFI_STRING Uri,
> + IN CHAR8 *EtagInHeader,
> + IN CHAR8 *EtagInJson
> );
>
> /**
> @@ -697,11 +700,11 @@ CheckEtag (
> **/
> CHAR8 **
> GetPropertyStringArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> );
>
> /**
> @@ -719,11 +722,11 @@ GetPropertyStringArrayValue (
> **/
> INT64 *
> GetPropertyNumericArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> );
>
> /**
> @@ -741,11 +744,11 @@ GetPropertyNumericArrayValue (
> **/
> BOOLEAN *
> GetPropertyBooleanArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> );
>
> /**
> @@ -764,11 +767,11 @@ GetPropertyBooleanArrayValue (
> **/
> RedfishCS_EmptyProp_KeyValue *
> GetPropertyVagueValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINT32 *NumberOfValues
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINT32 *NumberOfValues
> );
>
> /**
> @@ -780,7 +783,7 @@ GetPropertyVagueValue (
> **/
> VOID
> FreeEmptyPropKeyValueList (
> - RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
> + RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
> );
>
> /**
> @@ -798,7 +801,7 @@ BOOLEAN
> MatchPropertyWithJsonContext (
> IN EFI_STRING Property,
> IN CHAR8 *Json
> -);
> + );
>
> /**
>
> @@ -814,7 +817,7 @@ MatchPropertyWithJsonContext (
> **/
> EFI_STATUS
> AddRedfishCharArray (
> - IN OUT RedfishCS_char_Array **Head,
> + IN OUT RedfishCS_char_Array **Head,
> IN CHAR8 **StringArray,
> IN UINTN ArraySize
> );
> @@ -833,9 +836,9 @@ AddRedfishCharArray (
> **/
> EFI_STATUS
> AddRedfishNumericArray (
> - IN OUT RedfishCS_int64_Array **Head,
> - IN INT64 *NumericArray,
> - IN UINTN ArraySize
> + IN OUT RedfishCS_int64_Array **Head,
> + IN INT64 *NumericArray,
> + IN UINTN ArraySize
> );
>
> /**
> @@ -856,6 +859,7 @@ AddRedfishBooleanArray (
> IN BOOLEAN *BooleanArray,
> IN UINTN ArraySize
> );
> +
> /**
>
> Check and see if value in Redfish string array are all the same as the one
> @@ -872,9 +876,9 @@ AddRedfishBooleanArray (
> **/
> BOOLEAN
> CompareRedfishStringArrayValues (
> - IN RedfishCS_char_Array *Head,
> - IN CHAR8 **StringArray,
> - IN UINTN ArraySize
> + IN RedfishCS_char_Array *Head,
> + IN CHAR8 **StringArray,
> + IN UINTN ArraySize
> );
>
> /**
> @@ -893,9 +897,9 @@ CompareRedfishStringArrayValues (
> **/
> BOOLEAN
> CompareRedfishNumericArrayValues (
> - IN RedfishCS_int64_Array *Head,
> - IN INT64 *NumericArray,
> - IN UINTN ArraySize
> + IN RedfishCS_int64_Array *Head,
> + IN INT64 *NumericArray,
> + IN UINTN ArraySize
> );
>
> /**
> @@ -935,10 +939,10 @@ CompareRedfishBooleanArrayValues (
> **/
> BOOLEAN
> CompareRedfishPropertyVagueValues (
> - IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
> - IN UINT32 RedfishVagueKeyValueNumber,
> - IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
> - IN UINT32 ConfigVagueKeyValueNumber
> + IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
> + IN UINT32 RedfishVagueKeyValueNumber,
> + IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
> + IN UINT32 ConfigVagueKeyValueNumber
> );
>
> /**
> @@ -955,8 +959,8 @@ CompareRedfishPropertyVagueValues (
> **/
> EFI_STATUS
> GetEtagAndLocation (
> - IN REDFISH_RESPONSE *Response,
> - OUT CHAR8 **Etag, OPTIONAL
> + IN REDFISH_RESPONSE *Response,
> + OUT CHAR8 **Etag, OPTIONAL
> OUT EFI_STRING *Location OPTIONAL
> );
>
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .c
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .c
> index bfd6fff2a7..ed8a021cf2 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .c
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .c
> @@ -2,7 +2,7 @@
> Redfish feature utility library implementation
>
> (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
> - Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -10,7 +10,7 @@
>
> #include "RedfishFeatureUtilityInternal.h"
>
> -EDKII_REDFISH_ETAG_PROTOCOL *mEtagProtocol = NULL;
> +EDKII_REDFISH_ETAG_PROTOCOL *mEtagProtocol = NULL;
> EDKII_REDFISH_CONFIG_LANG_MAP_PROTOCOL
> *mConfigLangMapProtocol = NULL;
>
> /**
> @@ -33,7 +33,7 @@ RedfishLocateProtocol (
> {
> EFI_STATUS Status;
>
> - if (ProtocolInstance == NULL || ProtocolGuid == NULL) {
> + if ((ProtocolInstance == NULL) || (ProtocolGuid == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -62,14 +62,14 @@ RedfishLocateProtocol (
> **/
> EFI_STATUS
> GetArraykeyFromUri (
> - IN CHAR8 *Uri,
> - OUT CHAR8 **ArrayKey
> + IN CHAR8 *Uri,
> + OUT CHAR8 **ArrayKey
> )
> {
> - CHAR8 *LeftBracket;
> - UINTN Index;
> + CHAR8 *LeftBracket;
> + UINTN Index;
>
> - if (IS_EMPTY_STRING (Uri) || ArrayKey == NULL) {
> + if (IS_EMPTY_STRING (Uri) || (ArrayKey == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -207,19 +207,19 @@ GetEtagWithUri (
> **/
> CHAR8 *
> StrUnicodeToAscii (
> - IN EFI_STRING UnicodeStr
> + IN EFI_STRING UnicodeStr
> )
> {
> - CHAR8 *AsciiStr;
> - UINTN AsciiStrSize;
> - EFI_STATUS Status;
> + CHAR8 *AsciiStr;
> + UINTN AsciiStrSize;
> + EFI_STATUS Status;
>
> if (IS_EMPTY_STRING (UnicodeStr)) {
> return NULL;
> }
>
> AsciiStrSize = StrLen (UnicodeStr) + 1;
> - AsciiStr = AllocatePool (AsciiStrSize);
> + AsciiStr = AllocatePool (AsciiStrSize);
> if (AsciiStr == NULL) {
> return NULL;
> }
> @@ -258,7 +258,7 @@ StrAsciiToUnicode (
> }
>
> UnicodeStrSize = (AsciiStrLen (AsciiStr) + 1) * sizeof (CHAR16);
> - UnicodeStr = AllocatePool (UnicodeStrSize);
> + UnicodeStr = AllocatePool (UnicodeStrSize);
> if (UnicodeStr == NULL) {
> return NULL;
> }
> @@ -288,16 +288,16 @@ StrAsciiToUnicode (
> **/
> EFI_STATUS
> ApplyFeatureSettingsStringType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN CHAR8 *FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN CHAR8 *FeatureValue
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || FeatureValue == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || (FeatureValue == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -308,9 +308,8 @@ ApplyFeatureSettingsStringType (
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_STRING) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> }
>
> @@ -324,7 +323,12 @@ ApplyFeatureSettingsStringType (
> RedfishValue.Value.Buffer = FeatureValue;
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s to %s failed: %r\n",
> __FUNCTION__, ConfigureLang, FeatureValue, Status));
> }
> } else {
> @@ -350,14 +354,14 @@ ApplyFeatureSettingsStringType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsNumericType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN INTN FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN INTN FeatureValue
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang)) {
> return EFI_INVALID_PARAMETER;
> @@ -368,11 +372,10 @@ ApplyFeatureSettingsNumericType (
> //
> Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang,
> &RedfishValue);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_INTEGER) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> }
>
> @@ -385,7 +388,12 @@ ApplyFeatureSettingsNumericType (
> RedfishValue.Value.Integer = (INT64)FeatureValue;
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n",
> __FUNCTION__, ConfigureLang, FeatureValue, Status));
> }
> } else {
> @@ -411,14 +419,14 @@ ApplyFeatureSettingsNumericType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsBooleanType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN BOOLEAN FeatureValue
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN BOOLEAN FeatureValue
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang)) {
> return EFI_INVALID_PARAMETER;
> @@ -429,11 +437,10 @@ ApplyFeatureSettingsBooleanType (
> //
> Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang,
> &RedfishValue);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_BOOLEAN) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> }
>
> @@ -446,7 +453,12 @@ ApplyFeatureSettingsBooleanType (
> RedfishValue.Value.Boolean = FeatureValue;
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n",
> __FUNCTION__, ConfigureLang, (FeatureValue ? "True" : "False"), Status));
> }
> } else {
> @@ -473,23 +485,23 @@ ApplyFeatureSettingsBooleanType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsVagueType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> - IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
> - IN UINT32 NumberOfVagueValues
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> + IN RedfishCS_EmptyProp_KeyValue *VagueValuePtr,
> + IN UINT32 NumberOfVagueValues
> )
> {
> - EFI_STATUS Status;
> - UINTN StrSize;
> - CHAR8 *ConfigureLangAscii;
> - CHAR8 *ConfigureLangKeyAscii;
> - EFI_STRING ConfigureKeyLang;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EDKII_REDFISH_VALUE_TYPES PropertyDatatype;
> - RedfishCS_EmptyProp_KeyValue *CurrentVagueValuePtr;
> -
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || VagueValuePtr == NULL ||
> NumberOfVagueValues == 0) {
> + EFI_STATUS Status;
> + UINTN StrSize;
> + CHAR8 *ConfigureLangAscii;
> + CHAR8 *ConfigureLangKeyAscii;
> + EFI_STRING ConfigureKeyLang;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EDKII_REDFISH_VALUE_TYPES PropertyDatatype;
> + RedfishCS_EmptyProp_KeyValue *CurrentVagueValuePtr;
> +
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || (VagueValuePtr == NULL) ||
> (NumberOfVagueValues == 0)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -499,6 +511,7 @@ ApplyFeatureSettingsVagueType (
> DEBUG ((DEBUG_ERROR, "%a, Allocate memory for generate
> ConfigureLang of vague key of %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> return Status;
> }
> +
> Status = UnicodeStrToAsciiStrS (ConfigureLang, ConfigureLangAscii, StrLen
> (ConfigureLang) + 1);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, Convert the configureLang of vague key of
> %a.%a %s failed: %r\n", __FUNCTION__, Schema, Version, ConfigureLang,
> Status));
> @@ -510,18 +523,19 @@ ApplyFeatureSettingsVagueType (
> //
> // Generate ConfigureLang with the key name
> //
> - //ConfigureKeyLang = GetConfigureLang (ConfigureLangAscii,
> CurrentVagueValuePtr->KeyNamePtr);
> - StrSize = AsciiStrLen (ConfigureLangAscii) + AsciiStrLen
> (CurrentVagueValuePtr->KeyNamePtr) + 2;
> + // ConfigureKeyLang = GetConfigureLang (ConfigureLangAscii,
> CurrentVagueValuePtr->KeyNamePtr);
> + StrSize = AsciiStrLen (ConfigureLangAscii) + AsciiStrLen
> (CurrentVagueValuePtr->KeyNamePtr) + 2;
> ConfigureLangKeyAscii = AllocateZeroPool (StrSize);
> - ConfigureKeyLang = AllocateZeroPool (StrSize * sizeof (CHAR16));
> - if (ConfigureLangKeyAscii == NULL || ConfigureKeyLang == NULL) {
> - DEBUG ((DEBUG_ERROR, "%a, Generate ConfigureLang of vague key of
> %a.%a %s %a failed!\n", __FUNCTION__, Schema, Version, ConfigureLang,
> CurrentVagueValuePtr->KeyNamePtr));
> - goto ErrorContinue;
> + ConfigureKeyLang = AllocateZeroPool (StrSize * sizeof (CHAR16));
> + if ((ConfigureLangKeyAscii == NULL) || (ConfigureKeyLang == NULL)) {
> + DEBUG ((DEBUG_ERROR, "%a, Generate ConfigureLang of vague key of
> %a.%a %s %a failed!\n", __FUNCTION__, Schema, Version, ConfigureLang,
> CurrentVagueValuePtr->KeyNamePtr));
> + goto ErrorContinue;
> }
> - AsciiStrCatS(ConfigureLangKeyAscii, StrSize, ConfigureLangAscii);
> - AsciiStrCatS(ConfigureLangKeyAscii, StrSize, "/");
> - AsciiStrCatS(ConfigureLangKeyAscii, StrSize, CurrentVagueValuePtr-
> >KeyNamePtr);
> - AsciiStrToUnicodeStrS(ConfigureLangKeyAscii, ConfigureKeyLang, StrSize);
> +
> + AsciiStrCatS (ConfigureLangKeyAscii, StrSize, ConfigureLangAscii);
> + AsciiStrCatS (ConfigureLangKeyAscii, StrSize, "/");
> + AsciiStrCatS (ConfigureLangKeyAscii, StrSize, CurrentVagueValuePtr-
> >KeyNamePtr);
> + AsciiStrToUnicodeStrS (ConfigureLangKeyAscii, ConfigureKeyLang,
> StrSize);
> FreePool (ConfigureLangKeyAscii);
> ConfigureLangKeyAscii = NULL;
> //
> @@ -534,7 +548,7 @@ ApplyFeatureSettingsVagueType (
> } else if (CurrentVagueValuePtr->Value->DataType ==
> RedfishCS_Vague_DataType_Int64) {
> PropertyDatatype = REDFISH_VALUE_TYPE_INTEGER;
> } else {
> - DEBUG((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property
> data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property
> data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
> goto ErrorContinue;
> }
>
> @@ -546,9 +560,10 @@ ApplyFeatureSettingsVagueType (
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureKeyLang, Status));
> } else {
> if (RedfishValue.Type != PropertyDatatype) {
> - DEBUG((DEBUG_ERROR, "%a, %a.%a %s mismatched data type\n",
> __FUNCTION__, Schema, Version, ConfigureKeyLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s mismatched data type\n",
> __FUNCTION__, Schema, Version, ConfigureKeyLang));
> goto ErrorContinue;
> }
> +
> if (PropertyDatatype == REDFISH_VALUE_TYPE_STRING) {
> //
> // This is a string property.
> @@ -560,8 +575,13 @@ ApplyFeatureSettingsVagueType (
> DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from %a to %a\n",
> __FUNCTION__, Schema, Version, ConfigureKeyLang,
> RedfishValue.Value.Buffer, CurrentVagueValuePtr->Value-
> >DataValue.CharPtr));
> FreePool (RedfishValue.Value.Buffer);
> RedfishValue.Value.Buffer = CurrentVagueValuePtr->Value-
> >DataValue.CharPtr;
> - Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %a to %a failed: %r\n",
> __FUNCTION__, ConfigureKeyLang, CurrentVagueValuePtr->Value-
> >DataValue.CharPtr, Status));
> }
> } else {
> @@ -575,17 +595,25 @@ ApplyFeatureSettingsVagueType (
> //
> // Apply settings from redfish
> //
> - DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from %a to %a\n",
> - __FUNCTION__,
> - Schema,
> - Version,
> - ConfigureKeyLang,
> - (RedfishValue.Value.Boolean ? "True" : "False"),
> - (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" :
> "False")));
> + DEBUG ((
> + DEBUG_INFO,
> + "%a, %a.%a apply %s from %a to %a\n",
> + __FUNCTION__,
> + Schema,
> + Version,
> + ConfigureKeyLang,
> + (RedfishValue.Value.Boolean ? "True" : "False"),
> + (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" :
> "False")
> + ));
>
> RedfishValue.Value.Boolean = (BOOLEAN)*CurrentVagueValuePtr-
> >Value->DataValue.BoolPtr;
> - Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n",
> __FUNCTION__, ConfigureKeyLang, (*CurrentVagueValuePtr->Value-
> >DataValue.BoolPtr ? "True" : "False"), Status));
> }
> } else {
> @@ -602,15 +630,20 @@ ApplyFeatureSettingsVagueType (
> DEBUG ((DEBUG_INFO, "%a, %a.%a apply %s from 0x%x to 0x%x\n",
> __FUNCTION__, Schema, Version, ConfigureKeyLang,
> RedfishValue.Value.Integer, *CurrentVagueValuePtr->Value-
> >DataValue.Int64Ptr));
>
> RedfishValue.Value.Integer = (INT64)*CurrentVagueValuePtr->Value-
> >DataValue.Int64Ptr;
> - Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureKeyLang, RedfishValue);
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n",
> __FUNCTION__, ConfigureKeyLang, *CurrentVagueValuePtr->Value-
> >DataValue.Int64Ptr, Status));
> }
> } else {
> DEBUG ((DEBUG_INFO, "%a, %a.%a %s value is: 0x%x\n",
> __FUNCTION__, Schema, Version, ConfigureKeyLang,
> RedfishValue.Value.Integer, Status));
> }
> } else {
> - DEBUG((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property
> data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish
> property data type\n", __FUNCTION__, Schema, Version, ConfigureLang));
> goto ErrorContinue;
> }
> }
> @@ -620,22 +653,27 @@ ErrorContinue:;
> FreePool (ConfigureLangKeyAscii);
> ConfigureLangKeyAscii = NULL;
> }
> +
> if (ConfigureKeyLang != NULL) {
> FreePool (ConfigureKeyLang);
> ConfigureKeyLang = NULL;
> }
> +
> CurrentVagueValuePtr = CurrentVagueValuePtr->NextKeyValuePtr;
> - };
> + }
>
> if (ConfigureLangAscii != NULL) {
> FreePool (ConfigureLangAscii);
> }
> +
> if (ConfigureLangKeyAscii != NULL) {
> FreePool (ConfigureLangKeyAscii);
> }
> +
> if (ConfigureKeyLang != NULL) {
> FreePool (ConfigureKeyLang);
> }
> +
> return EFI_SUCCESS;
> }
>
> @@ -648,16 +686,16 @@ ErrorContinue:;
> **/
> VOID
> FreeArrayTypeRedfishValue (
> - EDKII_REDFISH_VALUE *RedfishValue
> + EDKII_REDFISH_VALUE *RedfishValue
> )
> {
> - UINTN Index;
> + UINTN Index;
>
> if (RedfishValue == NULL) {
> return;
> }
>
> - if (RedfishValue->Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY &&
> RedfishValue->Type != REDFISH_VALUE_TYPE_STRING_ARRAY) {
> + if ((RedfishValue->Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY) &&
> (RedfishValue->Type != REDFISH_VALUE_TYPE_STRING_ARRAY)) {
> return;
> }
>
> @@ -666,6 +704,7 @@ FreeArrayTypeRedfishValue (
> for (Index = 0; Index < RedfishValue->ArrayCount; Index++) {
> FreePool (RedfishValue->Value.StringArray[Index]);
> }
> +
> FreePool (RedfishValue->Value.StringArray);
> RedfishValue->Value.StringArray = NULL;
> break;
> @@ -687,7 +726,6 @@ FreeArrayTypeRedfishValue (
> RedfishValue->ArrayCount = 0;
> }
>
> -
> /**
>
> Apply property value to UEFI HII database in string array type.
> @@ -714,7 +752,7 @@ ApplyFeatureSettingsStringArrayType (
> UINTN Index;
> RedfishCS_char_Array *Buffer;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -725,9 +763,8 @@ ApplyFeatureSettingsStringArrayType (
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_STRING_ARRAY) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> }
>
> @@ -745,10 +782,10 @@ ApplyFeatureSettingsStringArrayType (
> // Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE
> //
> RedfishValue.ArrayCount = 0;
> - Buffer = ArrayHead;
> + Buffer = ArrayHead;
> while (Buffer != NULL) {
> RedfishValue.ArrayCount += 1;
> - Buffer = Buffer->Next;
> + Buffer = Buffer->Next;
> }
>
> //
> @@ -761,13 +798,14 @@ ApplyFeatureSettingsStringArrayType (
> }
>
> Buffer = ArrayHead;
> - Index = 0;
> + Index = 0;
> while (Buffer != NULL) {
> RedfishValue.Value.StringArray[Index] = AllocateCopyPool (AsciiStrSize
> (Buffer->ArrayValue), Buffer->ArrayValue);
> if (RedfishValue.Value.StringArray[Index] == NULL) {
> ASSERT (FALSE);
> return EFI_OUT_OF_RESOURCES;
> }
> +
> Buffer = Buffer->Next;
> Index++;
> }
> @@ -775,7 +813,12 @@ ApplyFeatureSettingsStringArrayType (
> ASSERT (Index <= RedfishValue.ArrayCount);
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n",
> __FUNCTION__, ConfigureLang, Status));
> }
> } else {
> @@ -801,18 +844,18 @@ ApplyFeatureSettingsStringArrayType (
> **/
> EFI_STATUS
> ApplyFeatureSettingsNumericArrayType (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING ConfigureLang,
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING ConfigureLang,
> IN RedfishCS_int64_Array *ArrayHead
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - UINTN Index;
> - RedfishCS_int64_Array *Buffer;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + UINTN Index;
> + RedfishCS_int64_Array *Buffer;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -823,7 +866,6 @@ ApplyFeatureSettingsNumericArrayType (
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_INTEGER_ARRAY) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> @@ -843,10 +885,10 @@ ApplyFeatureSettingsNumericArrayType (
> // Convert array from RedfishCS_int64_Array to EDKII_REDFISH_VALUE
> //
> RedfishValue.ArrayCount = 0;
> - Buffer = ArrayHead;
> + Buffer = ArrayHead;
> while (Buffer != NULL) {
> RedfishValue.ArrayCount += 1;
> - Buffer = Buffer->Next;
> + Buffer = Buffer->Next;
> }
>
> //
> @@ -859,17 +901,22 @@ ApplyFeatureSettingsNumericArrayType (
> }
>
> Buffer = ArrayHead;
> - Index = 0;
> + Index = 0;
> while (Buffer != NULL) {
> RedfishValue.Value.IntegerArray[Index] = (INT64)*Buffer->ArrayValue;
> - Buffer = Buffer->Next;
> + Buffer = Buffer->Next;
> Index++;
> }
>
> ASSERT (Index <= RedfishValue.ArrayCount);
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n",
> __FUNCTION__, ConfigureLang, Status));
> }
> } else {
> @@ -904,9 +951,9 @@ ApplyFeatureSettingsBooleanArrayType (
> EFI_STATUS Status;
> EDKII_REDFISH_VALUE RedfishValue;
> UINTN Index;
> - RedfishCS_bool_Array *Buffer;
> + RedfishCS_bool_Array *Buffer;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || ArrayHead == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || (ArrayHead == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -917,7 +964,6 @@ ApplyFeatureSettingsBooleanArrayType (
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __FUNCTION__,
> Schema, Version, ConfigureLang, Status));
> } else {
> -
> if (RedfishValue.Type != REDFISH_VALUE_TYPE_BOOLEAN_ARRAY) {
> DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n",
> __FUNCTION__, Schema, Version, ConfigureLang));
> return EFI_DEVICE_ERROR;
> @@ -937,10 +983,10 @@ ApplyFeatureSettingsBooleanArrayType (
> // Convert array from RedfishCS_int64_Array to EDKII_REDFISH_VALUE
> //
> RedfishValue.ArrayCount = 0;
> - Buffer = ArrayHead;
> + Buffer = ArrayHead;
> while (Buffer != NULL) {
> RedfishValue.ArrayCount += 1;
> - Buffer = Buffer->Next;
> + Buffer = Buffer->Next;
> }
>
> //
> @@ -953,17 +999,22 @@ ApplyFeatureSettingsBooleanArrayType (
> }
>
> Buffer = ArrayHead;
> - Index = 0;
> + Index = 0;
> while (Buffer != NULL) {
> RedfishValue.Value.BooleanArray[Index] = (BOOLEAN)*Buffer-
> >ArrayValue;
> - Buffer = Buffer->Next;
> + Buffer = Buffer->Next;
> Index++;
> }
>
> ASSERT (Index <= RedfishValue.ArrayCount);
>
> Status = RedfishPlatformConfigSetValue (Schema, Version,
> ConfigureLang, RedfishValue);
> - if (EFI_ERROR (Status)) {
> + if (!EFI_ERROR (Status)) {
> + //
> + // Configuration changed. Enable system reboot flag.
> + //
> + REDFISH_ENABLE_SYSTEM_REBOOT ();
> + } else {
> DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n",
> __FUNCTION__, ConfigureLang, Status));
> }
> } else {
> @@ -988,15 +1039,15 @@ ApplyFeatureSettingsBooleanArrayType (
> **/
> EFI_STATUS
> GetResourceByUri (
> - IN REDFISH_SERVICE *Service,
> - IN EFI_STRING ResourceUri,
> - OUT REDFISH_RESPONSE *Response
> + IN REDFISH_SERVICE *Service,
> + IN EFI_STRING ResourceUri,
> + OUT REDFISH_RESPONSE *Response
> )
> {
> EFI_STATUS Status;
> CHAR8 *AsciiResourceUri;
>
> - if (Service == NULL || Response == NULL || IS_EMPTY_STRING
> (ResourceUri)) {
> + if ((Service == NULL) || (Response == NULL) || IS_EMPTY_STRING
> (ResourceUri)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -1051,9 +1102,9 @@ GetResourceByUri (
> **/
> EFI_STATUS
> IsRedpathArray (
> - IN EFI_STRING ConfigureLang,
> - OUT EFI_STRING *ArraySignatureOpen OPTIONAL,
> - OUT EFI_STRING *ArraySignatureClose OPTIONAL
> + IN EFI_STRING ConfigureLang,
> + OUT EFI_STRING *ArraySignatureOpen OPTIONAL,
> + OUT EFI_STRING *ArraySignatureClose OPTIONAL
> )
> {
> CHAR16 *IndexString;
> @@ -1061,9 +1112,11 @@ IsRedpathArray (
> if (ConfigureLang == NULL) {
> return EFI_INVALID_PARAMETER;
> }
> +
> if (ArraySignatureOpen != NULL) {
> *ArraySignatureOpen = NULL;
> }
> +
> if (ArraySignatureClose != NULL) {
> *ArraySignatureClose = NULL;
> }
> @@ -1076,6 +1129,7 @@ IsRedpathArray (
> if (ArraySignatureOpen != NULL) {
> *ArraySignatureOpen = IndexString;
> }
> +
> //
> // Skip "{"
> //
> @@ -1087,11 +1141,14 @@ IsRedpathArray (
> if (IndexString == NULL) {
> return EFI_INVALID_PARAMETER;
> }
> +
> if (ArraySignatureClose != NULL) {
> *ArraySignatureClose = IndexString;
> }
> +
> return EFI_SUCCESS;
> }
> +
> return EFI_NOT_FOUND;
> }
>
> @@ -1106,23 +1163,25 @@ IsRedpathArray (
> **/
> UINTN
> GetNumberOfRedpathNodes (
> - IN EFI_STRING NodeString
> + IN EFI_STRING NodeString
> )
> {
> - UINTN Index;
> - UINTN NumberNodes;
> - UINTN StringLen;
> + UINTN Index;
> + UINTN NumberNodes;
> + UINTN StringLen;
>
> NumberNodes = 0;
> - StringLen = StrLen (NodeString);
> - Index = 1; // ConfigLang always starts with '/'.
> + StringLen = StrLen (NodeString);
> + Index = 1; // ConfigLang always starts with '/'.
> while (Index < StringLen) {
> if (*(NodeString + Index) == L'/') {
> - NumberNodes ++;
> + NumberNodes++;
> }
> - Index ++;
> - };
> - NumberNodes ++;
> +
> + Index++;
> + }
> +
> + NumberNodes++;
>
> return (NumberNodes);
> }
> @@ -1141,24 +1200,25 @@ GetNumberOfRedpathNodes (
> **/
> EFI_STRING
> GetRedpathNodeByIndex (
> - IN EFI_STRING NodeString,
> - IN UINTN Index,
> - OUT EFI_STRING *EndOfNodePtr OPTIONAL
> + IN EFI_STRING NodeString,
> + IN UINTN Index,
> + OUT EFI_STRING *EndOfNodePtr OPTIONAL
> )
> {
> - UINTN NumberNodes;
> - UINTN StringLen;
> - UINTN StringIndex;
> - EFI_STRING NodeStart;
> - EFI_STRING NodeEnd;
> + UINTN NumberNodes;
> + UINTN StringLen;
> + UINTN StringIndex;
> + EFI_STRING NodeStart;
> + EFI_STRING NodeEnd;
>
> NumberNodes = 0;
> - StringLen = StrLen (NodeString);
> + StringLen = StrLen (NodeString);
> StringIndex = 1; // ConfigLang always starts with '/'.
> - NodeStart = NodeString;
> + NodeStart = NodeString;
> if (EndOfNodePtr != NULL) {
> *EndOfNodePtr = NULL;
> }
> +
> while (StringIndex < StringLen) {
> if (*(NodeString + StringIndex) == L'/') {
> NodeEnd = NodeString + StringIndex - 1;
> @@ -1166,14 +1226,17 @@ GetRedpathNodeByIndex (
> if (EndOfNodePtr != NULL) {
> *EndOfNodePtr = NodeEnd;
> }
> +
> return NodeStart;
> } else {
> NodeStart = NodeString + StringIndex + 1;
> }
> }
> - StringIndex ++;
> - };
> - return (NULL);
> +
> + StringIndex++;
> + }
> +
> + return (NULL);
> }
>
> /**
> @@ -1192,18 +1255,18 @@ GetRedpathNodeByIndex (
> **/
> EFI_STATUS
> GetArrayIndexFromArrayTypeConfigureLang (
> - IN CHAR16 *ConfigureLang,
> - OUT CHAR16 **UnifiedConfigureLang,
> - OUT UINTN *Index
> + IN CHAR16 *ConfigureLang,
> + OUT CHAR16 **UnifiedConfigureLang,
> + OUT UINTN *Index
> )
> {
> - EFI_STATUS Status;
> - CHAR16 *TmpConfigureLang;
> - CHAR16 *ArrayOpenStr;
> - CHAR16 *ArrayCloseStr;
> - INTN StringIndex;
> + EFI_STATUS Status;
> + CHAR16 *TmpConfigureLang;
> + CHAR16 *ArrayOpenStr;
> + CHAR16 *ArrayCloseStr;
> + INTN StringIndex;
>
> - if (ConfigureLang == NULL || UnifiedConfigureLang == NULL || Index ==
> NULL) {
> + if ((ConfigureLang == NULL) || (UnifiedConfigureLang == NULL) || (Index
> == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -1227,28 +1290,30 @@ GetArrayIndexFromArrayTypeConfigureLang (
> //
> // Resotre the '}' character and remove rest of string.
> //
> - ArrayCloseStr[0] = L'}';
> - ArrayCloseStr[1] = '\0';
> + ArrayCloseStr[0] = L'}';
> + ArrayCloseStr[1] = '\0';
> *UnifiedConfigureLang = TmpConfigureLang;
> } else {
> if (Status == EFI_NOT_FOUND) {
> //
> // This is not the redpath array. Search "/" for the parent root.
> //
> - *Index = 0;
> + *Index = 0;
> StringIndex = StrLen (TmpConfigureLang) - 1;
> while (StringIndex >= 0 && *(TmpConfigureLang + StringIndex) != '/') {
> - StringIndex --;
> - };
> + StringIndex--;
> + }
> +
> if (StringIndex >= 0 ) {
> *(TmpConfigureLang + StringIndex) = '\0';
> - *UnifiedConfigureLang = TmpConfigureLang;
> - Status = EFI_SUCCESS;
> + *UnifiedConfigureLang = TmpConfigureLang;
> + Status = EFI_SUCCESS;
> } else {
> Status = EFI_INVALID_PARAMETER;
> }
> }
> }
> +
> return Status;
> }
>
> @@ -1265,27 +1330,30 @@ GetArrayIndexFromArrayTypeConfigureLang (
> **/
> EFI_STATUS
> CopyConfiglanguageList (
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *SourceConfigureLangList,
> - OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *DestConfigureLangList
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *SourceConfigureLangList,
> + OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *DestConfigureLangList
> )
> {
> - UINTN Index;
> + UINTN Index;
>
> - if (SourceConfigureLangList == NULL || DestConfigureLangList == NULL) {
> + if ((SourceConfigureLangList == NULL) || (DestConfigureLangList == NULL))
> {
> return EFI_INVALID_PARAMETER;
> }
> +
> DestConfigureLangList->Count = SourceConfigureLangList->Count;
> - DestConfigureLangList->List =
> - (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *)AllocateZeroPool
> (sizeof (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG) *
> DestConfigureLangList->Count);
> + DestConfigureLangList->List =
> + (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *)AllocateZeroPool
> (sizeof (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG) *
> DestConfigureLangList->Count);
> if (DestConfigureLangList->List == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for
> REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __FUNCTION__));
> return EFI_OUT_OF_RESOURCES;
> }
> +
> for (Index = 0; Index < SourceConfigureLangList->Count; Index++) {
> - DestConfigureLangList->List [Index].Index = SourceConfigureLangList-
> >List[Index].Index;
> - DestConfigureLangList->List [Index].ConfigureLang =
> - (EFI_STRING)AllocateCopyPool(StrSize(SourceConfigureLangList-
> >List[Index].ConfigureLang), (VOID *)SourceConfigureLangList-
> >List[Index].ConfigureLang);
> + DestConfigureLangList->List[Index].Index = SourceConfigureLangList-
> >List[Index].Index;
> + DestConfigureLangList->List[Index].ConfigureLang =
> + (EFI_STRING)AllocateCopyPool (StrSize (SourceConfigureLangList-
> >List[Index].ConfigureLang), (VOID *)SourceConfigureLangList-
> >List[Index].ConfigureLang);
> }
> +
> return EFI_SUCCESS;
> }
>
> @@ -1300,39 +1368,45 @@ CopyConfiglanguageList (
> **/
> UINTN
> ConfiglanguageGetInstanceIndex (
> - IN EFI_STRING ConfigureLang
> + IN EFI_STRING ConfigureLang
> )
> {
> - INTN LeftBracketIndex;
> - INTN RightBracketIndex;
> - INTN Index;
> - UINT64 Instance;
> - EFI_STATUS Status;
> + INTN LeftBracketIndex;
> + INTN RightBracketIndex;
> + INTN Index;
> + UINT64 Instance;
> + EFI_STATUS Status;
>
> if (ConfigureLang == NULL) {
> return 0;
> }
> - LeftBracketIndex = 0;
> +
> + LeftBracketIndex = 0;
> RightBracketIndex = 0;
> - Index = StrLen (ConfigureLang) - 1;
> + Index = StrLen (ConfigureLang) - 1;
> while (Index >= 0) {
> if (*(ConfigureLang + Index) == L'{') {
> LeftBracketIndex = Index;
> break;
> }
> +
> if (*(ConfigureLang + Index) == L'}') {
> RightBracketIndex = Index;
> }
> - Index --;
> - };
> +
> + Index--;
> + }
> +
> if ((RightBracketIndex - LeftBracketIndex) <= 1) {
> return 0;
> }
> +
> *(ConfigureLang + RightBracketIndex) = 0;
> - Status = StrDecimalToUint64S (ConfigureLang + LeftBracketIndex + 1, NULL,
> &Instance);
> - if (EFI_ERROR(Status)) {
> + Status = StrDecimalToUint64S (ConfigureLang +
> LeftBracketIndex + 1, NULL, &Instance);
> + if (EFI_ERROR (Status)) {
> Instance = 0;
> }
> +
> //
> // Restore right curly bracket.
> //
> @@ -1353,20 +1427,22 @@ ConfiglanguageGetInstanceIndex (
> **/
> EFI_STATUS
> DestroyConfiglanguageList (
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *ConfigureLangList
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *ConfigureLangList
> )
> {
> - UINTN Index;
> + UINTN Index;
>
> if (ConfigureLangList == NULL) {
> return EFI_INVALID_PARAMETER;
> }
> +
> if (ConfigureLangList->List != NULL) {
> for (Index = 0; Index < ConfigureLangList->Count; Index++) {
> - if (ConfigureLangList->List [Index].ConfigureLang != NULL) {
> - FreePool (ConfigureLangList->List [Index].ConfigureLang);
> + if (ConfigureLangList->List[Index].ConfigureLang != NULL) {
> + FreePool (ConfigureLangList->List[Index].ConfigureLang);
> }
> }
> +
> FreePool (ConfigureLangList->List);
> ConfigureLangList->List = NULL;
> }
> @@ -1391,56 +1467,60 @@ DestroyConfiglanguageList (
> **/
> EFI_STATUS
> SetResourceConfigLangMemberInstance (
> - IN EFI_STRING *DestConfigLang,
> - IN UINTN MaxtLengthConfigLang,
> - IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
> + IN EFI_STRING *DestConfigLang,
> + IN UINTN MaxtLengthConfigLang,
> + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG *ConfigLangInstance
> )
> {
> - EFI_STRING ThisConfigLang;
> - EFI_STRING NewConfigLang;
> - CHAR16 InstanceStr [10];
> - INTN Index;
> - UINTN Length;
> - UINTN MaxStrLength;
> -
> - if (DestConfigLang == NULL || ConfigLangInstance == NULL) {
> + EFI_STRING ThisConfigLang;
> + EFI_STRING NewConfigLang;
> + CHAR16 InstanceStr[10];
> + INTN Index;
> + UINTN Length;
> + UINTN MaxStrLength;
> +
> + if ((DestConfigLang == NULL) || (ConfigLangInstance == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
> +
> UnicodeSPrint ((CHAR16 *)&InstanceStr, 10, L"%d", ConfigLangInstance-
> >Index);
>
> ThisConfigLang = *DestConfigLang;
> - if (ThisConfigLang [0] == 0) {
> + if (ThisConfigLang[0] == 0) {
> //
> // Return ConfigLangInstance->ConfigureLang
> //
> if (ConfigLangInstance->ConfigureLang == NULL) {
> return EFI_INVALID_PARAMETER;
> } else {
> - StrCatS(*DestConfigLang, MaxtLengthConfigLang, ConfigLangInstance-
> >ConfigureLang);
> + StrCatS (*DestConfigLang, MaxtLengthConfigLang, ConfigLangInstance-
> >ConfigureLang);
> return EFI_SUCCESS;
> }
> }
>
> - MaxStrLength = StrSize (ThisConfigLang) + StrSize
> ((EFI_STRING)&InstanceStr);
> + MaxStrLength = StrSize (ThisConfigLang) + StrSize
> ((EFI_STRING)&InstanceStr);
> NewConfigLang = ThisConfigLang;
> if (MaxtLengthConfigLang < MaxStrLength) {
> - NewConfigLang = (EFI_STRING)AllocateZeroPool(MaxStrLength);
> + NewConfigLang = (EFI_STRING)AllocateZeroPool (MaxStrLength);
> if (NewConfigLang == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for
> NewConfigLang.\n", __FUNCTION__));
> return EFI_OUT_OF_RESOURCES;
> }
> }
> +
> //
> // Search the last "{"
> //
> Index = StrLen (ThisConfigLang) - 1;
> while ((ThisConfigLang[Index] != '{') && (Index >= 0)) {
> - Index --;
> - };
> + Index--;
> + }
> +
> if (Index == -1) {
> if (NewConfigLang != ThisConfigLang) {
> - FreePool(NewConfigLang);
> + FreePool (NewConfigLang);
> }
> +
> return EFI_NOT_FOUND;
> }
>
> @@ -1449,15 +1529,17 @@ SetResourceConfigLangMemberInstance (
> //
> Length = 0;
> while (Index >= 0) {
> - NewConfigLang [Index] = ThisConfigLang[Index];
> - Index --;
> - Length ++;
> - };
> + NewConfigLang[Index] = ThisConfigLang[Index];
> + Index--;
> + Length++;
> + }
> +
> UnicodeSPrint ((CHAR16 *)(NewConfigLang + Length), MaxStrLength,
> L"%d", ConfigLangInstance->Index);
> StrCatS (NewConfigLang, MaxStrLength, L"}");
> if (NewConfigLang != ThisConfigLang) {
> FreePool (ThisConfigLang);
> }
> +
> *DestConfigLang = NewConfigLang;
> return EFI_SUCCESS;
> }
> @@ -1478,28 +1560,28 @@ SetResourceConfigLangMemberInstance (
> **/
> EFI_STATUS
> RedfishFeatureGetUnifiedArrayTypeConfigureLang (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING Pattern, OPTIONAL
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING Pattern, OPTIONAL
> OUT REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST
> *UnifiedConfigureLangList
> )
> {
> - EFI_STATUS Status;
> - EFI_STRING *ConfigureLangList;
> - UINTN Count;
> - UINTN Index;
> - UINTN Index2;
> - UINTN ArrayIndex;
> - EFI_STRING UnifiedConfigureLang;
> - BOOLEAN Duplicated;
> - REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG
> UnifiedConfigureLangPool[BIOS_CONFIG_TO_REDFISH_REDPATH_POOL_SIZ
> E];
> -
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> UnifiedConfigureLangList == NULL) {
> + EFI_STATUS Status;
> + EFI_STRING *ConfigureLangList;
> + UINTN Count;
> + UINTN Index;
> + UINTN Index2;
> + UINTN ArrayIndex;
> + EFI_STRING UnifiedConfigureLang;
> + BOOLEAN Duplicated;
> + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG
> UnifiedConfigureLangPool[BIOS_CONFIG_TO_REDFISH_REDPATH_POOL_SIZ
> E];
> +
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> (UnifiedConfigureLangList == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> UnifiedConfigureLangList->Count = 0;
> - UnifiedConfigureLangList->List = NULL;
> + UnifiedConfigureLangList->List = NULL;
> ZeroMem (UnifiedConfigureLangPool, sizeof (UnifiedConfigureLangPool));
>
> Status = RedfishPlatformConfigGetConfigureLang (Schema, Version,
> Pattern, &ConfigureLangList, &Count);
> @@ -1514,7 +1596,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (
>
> for (Index = 0; Index < Count; Index++) {
> Status = GetArrayIndexFromArrayTypeConfigureLang
> (ConfigureLangList[Index], &UnifiedConfigureLang, &ArrayIndex);
> - if (EFI_ERROR (Status) && Status == EFI_INVALID_PARAMETER) {
> + if (EFI_ERROR (Status) && (Status == EFI_INVALID_PARAMETER)) {
> ASSERT (FALSE);
> continue;
> }
> @@ -1550,7 +1632,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang
> (
> //
>
> UnifiedConfigureLangPool[UnifiedConfigureLangList-
> >Count].ConfigureLang = UnifiedConfigureLang;
> - UnifiedConfigureLangPool[UnifiedConfigureLangList->Count].Index =
> ArrayIndex;
> + UnifiedConfigureLangPool[UnifiedConfigureLangList->Count].Index =
> ArrayIndex;
> ++UnifiedConfigureLangList->Count;
> }
>
> @@ -1578,23 +1660,23 @@
> RedfishFeatureGetUnifiedArrayTypeConfigureLang (
> **/
> EFI_STATUS
> GetEtagAndLocation (
> - IN REDFISH_RESPONSE *Response,
> - OUT CHAR8 **Etag, OPTIONAL
> + IN REDFISH_RESPONSE *Response,
> + OUT CHAR8 **Etag, OPTIONAL
> OUT EFI_STRING *Location OPTIONAL
> )
> {
> - EDKII_JSON_VALUE JsonValue;
> - EDKII_JSON_VALUE OdataValue;
> - CHAR8 *OdataString;
> - CHAR8 *AsciiLocation;
> - EFI_HTTP_HEADER *Header;
> - EFI_STATUS Status;
> + EDKII_JSON_VALUE JsonValue;
> + EDKII_JSON_VALUE OdataValue;
> + CHAR8 *OdataString;
> + CHAR8 *AsciiLocation;
> + EFI_HTTP_HEADER *Header;
> + EFI_STATUS Status;
>
> if (Response == NULL) {
> return EFI_INVALID_PARAMETER;
> }
>
> - if (Etag == NULL && Location == NULL) {
> + if ((Etag == NULL) && (Location == NULL)) {
> return EFI_SUCCESS;
> }
>
> @@ -1614,7 +1696,7 @@ GetEtagAndLocation (
> //
> // No header is returned. Search payload for location.
> //
> - if (*Etag == NULL && Response->Payload != NULL) {
> + if ((*Etag == NULL) && (Response->Payload != NULL)) {
> JsonValue = RedfishJsonInPayload (Response->Payload);
> if (JsonValue != NULL) {
> OdataValue = JsonObjectGetValue (JsonValueGetObject (JsonValue),
> "@odata.etag");
> @@ -1649,7 +1731,7 @@ GetEtagAndLocation (
> //
> // No header is returned. Search payload for location.
> //
> - if (*Location == NULL && Response->Payload != NULL) {
> + if ((*Location == NULL) && (Response->Payload != NULL)) {
> JsonValue = RedfishJsonInPayload (Response->Payload);
> if (JsonValue != NULL) {
> OdataValue = JsonObjectGetValue (JsonValueGetObject (JsonValue),
> "@odata.id");
> @@ -1675,6 +1757,7 @@ GetEtagAndLocation (
>
> return Status;
> }
> +
> /**
>
> Create HTTP payload and send them to redfish service with PATCH method.
> @@ -1690,25 +1773,25 @@ GetEtagAndLocation (
> **/
> EFI_STATUS
> CreatePayloadToPatchResource (
> - IN REDFISH_SERVICE *Service,
> - IN REDFISH_PAYLOAD *TargetPayload,
> - IN CHAR8 *Json,
> - OUT CHAR8 **Etag
> + IN REDFISH_SERVICE *Service,
> + IN REDFISH_PAYLOAD *TargetPayload,
> + IN CHAR8 *Json,
> + OUT CHAR8 **Etag
> )
> {
> - REDFISH_PAYLOAD Payload;
> - EDKII_JSON_VALUE ResourceJsonValue;
> - REDFISH_RESPONSE PostResponse;
> - EFI_STATUS Status;
> + REDFISH_PAYLOAD Payload;
> + EDKII_JSON_VALUE ResourceJsonValue;
> + REDFISH_RESPONSE PostResponse;
> + EFI_STATUS Status;
>
> - if (Service == NULL || TargetPayload == NULL || IS_EMPTY_STRING (Json)
> || Etag == NULL) {
> + if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING
> (Json) || (Etag == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> ResourceJsonValue = JsonLoadString (Json, 0, NULL);
> - Payload = RedfishCreatePayload (ResourceJsonValue, Service);
> + Payload = RedfishCreatePayload (ResourceJsonValue, Service);
> if (Payload == NULL) {
> - DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from
> JSON value!\n",__FUNCTION__, __LINE__));
> + DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from
> JSON value!\n", __FUNCTION__, __LINE__));
> Status = EFI_DEVICE_ERROR;
> goto EXIT_FREE_JSON_VALUE;
> }
> @@ -1716,7 +1799,7 @@ CreatePayloadToPatchResource (
> ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
> Status = RedfishPatchToPayload (TargetPayload, Payload, &PostResponse);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish
> service.\n",__FUNCTION__, __LINE__));
> + DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish
> service.\n", __FUNCTION__, __LINE__));
> goto EXIT_FREE_JSON_VALUE;
> }
>
> @@ -1761,26 +1844,26 @@ EXIT_FREE_JSON_VALUE:
> **/
> EFI_STATUS
> CreatePayloadToPostResource (
> - IN REDFISH_SERVICE *Service,
> - IN REDFISH_PAYLOAD *TargetPayload,
> - IN CHAR8 *Json,
> - OUT EFI_STRING *Location,
> - OUT CHAR8 **Etag
> + IN REDFISH_SERVICE *Service,
> + IN REDFISH_PAYLOAD *TargetPayload,
> + IN CHAR8 *Json,
> + OUT EFI_STRING *Location,
> + OUT CHAR8 **Etag
> )
> {
> - REDFISH_PAYLOAD Payload;
> - EDKII_JSON_VALUE ResourceJsonValue;
> - REDFISH_RESPONSE PostResponse;
> - EFI_STATUS Status;
> + REDFISH_PAYLOAD Payload;
> + EDKII_JSON_VALUE ResourceJsonValue;
> + REDFISH_RESPONSE PostResponse;
> + EFI_STATUS Status;
>
> - if (Service == NULL || TargetPayload == NULL || IS_EMPTY_STRING (Json)
> || Location == NULL || Etag == NULL) {
> + if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING
> (Json) || (Location == NULL) || (Etag == NULL)) {
> return EFI_INVALID_PARAMETER;
> }
>
> ResourceJsonValue = JsonLoadString (Json, 0, NULL);
> - Payload = RedfishCreatePayload (ResourceJsonValue, Service);
> + Payload = RedfishCreatePayload (ResourceJsonValue, Service);
> if (Payload == NULL) {
> - DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from
> JSON value!\n",__FUNCTION__, __LINE__));
> + DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from
> JSON value!\n", __FUNCTION__, __LINE__));
> Status = EFI_DEVICE_ERROR;
> goto EXIT_FREE_JSON_VALUE;
> }
> @@ -1788,7 +1871,7 @@ CreatePayloadToPostResource (
> ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
> Status = RedfishPostToPayload (TargetPayload, Payload, &PostResponse);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST Attribute Registry to
> Redfish service.\n",__FUNCTION__, __LINE__));
> + DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST Attribute Registry to
> Redfish service.\n", __FUNCTION__, __LINE__));
> goto EXIT_FREE_JSON_VALUE;
> }
>
> @@ -1827,19 +1910,19 @@ EXIT_FREE_JSON_VALUE:
> **/
> EFI_STRING
> RedfishGetUri (
> - IN EFI_STRING ConfigLang
> + IN EFI_STRING ConfigLang
> )
> {
> - EFI_STATUS Status;
> - EFI_STRING Target;
> - EFI_STRING Found;
> - EFI_STRING TempStr;
> - EFI_STRING ResultStr;
> - EFI_STRING Head;
> - EFI_STRING CloseBracket;
> - UINTN TempStrSize;
> - UINTN RemainingLen;
> - UINTN ConfigLangLen;
> + EFI_STATUS Status;
> + EFI_STRING Target;
> + EFI_STRING Found;
> + EFI_STRING TempStr;
> + EFI_STRING ResultStr;
> + EFI_STRING Head;
> + EFI_STRING CloseBracket;
> + UINTN TempStrSize;
> + UINTN RemainingLen;
> + UINTN ConfigLangLen;
>
> Status = RedfishLocateProtocol ((VOID **)&mConfigLangMapProtocol,
> &gEdkIIRedfishConfigLangMapProtocolGuid);
> if (EFI_ERROR (Status)) {
> @@ -1875,7 +1958,7 @@ RedfishGetUri (
> //
> do {
> ConfigLangLen = StrLen (Head);
> - Target = CloseBracket;
> + Target = CloseBracket;
>
> //
> // Look for next ConfigLang
> @@ -1895,13 +1978,14 @@ RedfishGetUri (
> //
> // Copy current ConfigLang to temporary string and do a query
> //
> - Target += 1;
> + Target += 1;
> RemainingLen = StrLen (Target);
> - TempStrSize = (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16);
> - TempStr = AllocateCopyPool (TempStrSize, Head);
> + TempStrSize = (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16);
> + TempStr = AllocateCopyPool (TempStrSize, Head);
> if (TempStr == NULL) {
> return NULL;
> }
> +
> TempStr[ConfigLangLen - RemainingLen] = '\0';
>
> Status = mConfigLangMapProtocol->Get (
> @@ -1926,7 +2010,7 @@ RedfishGetUri (
> //
> // Prepare for next ConfigLang
> //
> - Head = Target;
> + Head = Target;
> CloseBracket = StrStr (Head, L"{");
> } while (CloseBracket != NULL);
>
> @@ -1954,7 +2038,7 @@ RedfishGetUri (
> **/
> EFI_STRING
> RedfishGetConfigLanguage (
> - IN EFI_STRING Uri
> + IN EFI_STRING Uri
> )
> {
> EFI_STATUS Status;
> @@ -1973,13 +2057,12 @@ RedfishGetConfigLanguage (
> }
>
> ConfigLang = NULL;
> - Status = mConfigLangMapProtocol->Get (
> - mConfigLangMapProtocol,
> - RedfishGetTypeUri,
> - Uri,
> - &ConfigLang
> - );
> -
> + Status = mConfigLangMapProtocol->Get (
> + mConfigLangMapProtocol,
> + RedfishGetTypeUri,
> + Uri,
> + &ConfigLang
> + );
>
> return ConfigLang;
> }
> @@ -1997,8 +2080,8 @@ RedfishGetConfigLanguage (
> **/
> EFI_STRING
> GetConfigureLang (
> - IN CHAR8 *Uri,
> - IN CHAR8 *PropertyName OPTIONAL
> + IN CHAR8 *Uri,
> + IN CHAR8 *PropertyName OPTIONAL
> )
> {
> EFI_STRING ConfigLang;
> @@ -2032,7 +2115,7 @@ GetConfigureLang (
> }
>
> StringSize = StrSize (ConfigLang) + ((AsciiStrLen (PropertyName) + 1) *
> sizeof (CHAR16));
> - ResultStr = AllocatePool (StringSize);
> + ResultStr = AllocatePool (StringSize);
> if (ResultStr == NULL) {
> return NULL;
> }
> @@ -2059,7 +2142,7 @@ RedfisSetRedfishUri (
> IN EFI_STRING Uri
> )
> {
> - EFI_STATUS Status;
> + EFI_STATUS Status;
>
> if (IS_EMPTY_STRING (ConfigLang) || IS_EMPTY_STRING (Uri)) {
> return EFI_INVALID_PARAMETER;
> @@ -2088,12 +2171,12 @@ RedfisSetRedfishUri (
> **/
> EFI_STRING
> GetOdataId (
> - IN REDFISH_PAYLOAD *Payload
> + IN REDFISH_PAYLOAD *Payload
> )
> {
> - EDKII_JSON_VALUE *JsonValue;
> - EDKII_JSON_VALUE *OdataId;
> - EFI_STRING OdataIdString;
> + EDKII_JSON_VALUE *JsonValue;
> + EDKII_JSON_VALUE *OdataId;
> + EFI_STRING OdataIdString;
>
> if (Payload == NULL) {
> return NULL;
> @@ -2117,7 +2200,6 @@ GetOdataId (
> return AllocateCopyPool (StrSize (OdataIdString), OdataIdString);
> }
>
> -
> /**
>
> Get the property name by given Configure Langauge.
> @@ -2131,25 +2213,27 @@ GetOdataId (
> **/
> EFI_STRING
> GetPropertyFromConfigureLang (
> - IN EFI_STRING ResourceUri,
> - IN EFI_STRING ConfigureLang
> + IN EFI_STRING ResourceUri,
> + IN EFI_STRING ConfigureLang
> )
> {
> EFI_STATUS Status;
> EFI_STRING TempString;
>
> - if (ConfigureLang == NULL || ResourceUri == NULL) {
> + if ((ConfigureLang == NULL) || (ResourceUri == NULL)) {
> return NULL;
> }
>
> Status = IsRedpathArray (ConfigureLang, NULL, &TempString);
> - if (!EFI_ERROR(Status)) {
> + if (!EFI_ERROR (Status)) {
> TempString += 2; // Advance two characters for '}' and '/'
> return TempString;
> }
> +
> if (Status != EFI_NOT_FOUND) {
> return NULL;
> }
> +
> //
> // The ConigLang has no '{}'
> //
> @@ -2160,6 +2244,7 @@ GetPropertyFromConfigureLang (
> if (GetRedpathNodeByIndex (ConfigureLang, 0, &TempString) == NULL) {
> return NULL;
> }
> +
> //
> // Advance two characters to the starting
> // pointer of next node.
> @@ -2182,17 +2267,17 @@ GetPropertyFromConfigureLang (
> **/
> CHAR8 *
> GetPropertyStringValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - CHAR8 *AsciiStringValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + CHAR8 *AsciiStringValue;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
> return NULL;
> @@ -2201,7 +2286,7 @@ GetPropertyStringValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> return NULL;
> @@ -2240,17 +2325,17 @@ GetPropertyStringValue (
> **/
> INT64 *
> GetPropertyNumericValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - INT64 *ResultValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + INT64 *ResultValue;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
> return NULL;
> @@ -2259,7 +2344,7 @@ GetPropertyNumericValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> return NULL;
> @@ -2302,17 +2387,17 @@ GetPropertyNumericValue (
> **/
> BOOLEAN *
> GetPropertyBooleanValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - BOOLEAN *ResultValue;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + BOOLEAN *ResultValue;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
> return NULL;
> @@ -2321,7 +2406,7 @@ GetPropertyBooleanValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> return NULL;
> @@ -2366,8 +2451,8 @@ GetAttributeNameFromConfigLanguage (
> IN EFI_STRING ConfigureLanguage
> )
> {
> - UINTN StringLen;
> - UINTN Index;
> + UINTN StringLen;
> + UINTN Index;
>
> if (IS_EMPTY_STRING (ConfigureLanguage)) {
> return NULL;
> @@ -2398,21 +2483,21 @@ GetAttributeNameFromConfigLanguage (
> **/
> CHAR8 **
> GetPropertyStringArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - CHAR8 **StringArray;
> - UINTN Index;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + CHAR8 **StringArray;
> + UINTN Index;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || ArraySize == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || (ArraySize == NULL)) {
> return NULL;
> }
>
> @@ -2421,7 +2506,7 @@ GetPropertyStringArrayValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
> @@ -2469,21 +2554,21 @@ GetPropertyStringArrayValue (
> **/
> INT64 *
> GetPropertyNumericArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - INT64 *IntegerArray;
> - UINTN Index;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + INT64 *IntegerArray;
> + UINTN Index;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || ArraySize == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || (ArraySize == NULL)) {
> return NULL;
> }
>
> @@ -2492,7 +2577,7 @@ GetPropertyNumericArrayValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
> @@ -2540,21 +2625,21 @@ GetPropertyNumericArrayValue (
> **/
> BOOLEAN *
> GetPropertyBooleanArrayValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINTN *ArraySize
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINTN *ArraySize
> )
> {
> - EFI_STATUS Status;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - UINTN BufferSize;
> - BOOLEAN *BooleanArray;
> - UINTN Index;
> + EFI_STATUS Status;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + UINTN BufferSize;
> + BOOLEAN *BooleanArray;
> + UINTN Index;
>
> - if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || ArraySize == NULL) {
> + if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)
> || (ArraySize == NULL)) {
> return NULL;
> }
>
> @@ -2563,7 +2648,7 @@ GetPropertyBooleanArrayValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __FUNCTION__));
> @@ -2605,25 +2690,28 @@ GetPropertyBooleanArrayValue (
> **/
> VOID
> FreeEmptyPropKeyValueList (
> - RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
> + RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueListHead
> )
> {
> - RedfishCS_EmptyProp_KeyValue *NextEmptyPropKeyValueList;
> + RedfishCS_EmptyProp_KeyValue *NextEmptyPropKeyValueList;
>
> while (EmptyPropKeyValueListHead != NULL) {
> NextEmptyPropKeyValueList = EmptyPropKeyValueListHead-
> >NextKeyValuePtr;
> if (EmptyPropKeyValueListHead->Value->DataValue.CharPtr != NULL) {
> - FreePool(EmptyPropKeyValueListHead->Value->DataValue.CharPtr);
> + FreePool (EmptyPropKeyValueListHead->Value->DataValue.CharPtr);
> }
> +
> if (EmptyPropKeyValueListHead->Value != NULL) {
> - FreePool(EmptyPropKeyValueListHead->Value);
> + FreePool (EmptyPropKeyValueListHead->Value);
> }
> +
> if (EmptyPropKeyValueListHead->KeyNamePtr != NULL) {
> - FreePool(EmptyPropKeyValueListHead->KeyNamePtr);
> + FreePool (EmptyPropKeyValueListHead->KeyNamePtr);
> }
> +
> FreePool (EmptyPropKeyValueListHead);
> EmptyPropKeyValueListHead = NextEmptyPropKeyValueList;
> - };
> + }
> }
>
> /**
> @@ -2640,26 +2728,28 @@ FreeEmptyPropKeyValueList (
> RedfishCS_EmptyProp_KeyValue *
> NewEmptyPropKeyValueFromRedfishValue (
> IN EFI_STRING KeyName,
> - IN EDKII_REDFISH_VALUE *RedfishValue
> + IN EDKII_REDFISH_VALUE *RedfishValue
> )
> {
> - RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValue;
> - RedfishCS_Vague *VagueValue;
> - RedfishCS_char *KeyNameChar;
> - VOID *Data;
> - UINTN DataSize;
> - INT32 Bool32;
> -
> - KeyNameChar = StrUnicodeToAscii(KeyName);
> + RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValue;
> + RedfishCS_Vague *VagueValue;
> + RedfishCS_char *KeyNameChar;
> + VOID *Data;
> + UINTN DataSize;
> + INT32 Bool32;
> +
> + KeyNameChar = StrUnicodeToAscii (KeyName);
> if (KeyNameChar == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to convert unicode to ASCII.\n",
> __FUNCTION__));
> return NULL;
> }
> +
> EmptyPropKeyValue = (RedfishCS_EmptyProp_KeyValue
> *)AllocateZeroPool (sizeof (RedfishCS_EmptyProp_KeyValue));
> if (EmptyPropKeyValue == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for
> EmptyPropKeyValue\n", __FUNCTION__));
> return NULL;
> }
> +
> VagueValue = (RedfishCS_Vague *)AllocateZeroPool (sizeof
> (RedfishCS_Vague));
> if (VagueValue == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for
> VagueValue\n", __FUNCTION__));
> @@ -2669,29 +2759,30 @@ NewEmptyPropKeyValueFromRedfishValue (
>
> if (RedfishValue->Type == REDFISH_VALUE_TYPE_BOOLEAN) {
> VagueValue->DataType = RedfishCS_Vague_DataType_Bool;
> - DataSize = sizeof (BOOLEAN);
> + DataSize = sizeof (BOOLEAN);
> //
> // Redfish JSON to C strcuture converter uses
> // "int" for the BOOLEAN.
> //
> Bool32 = (INT32)RedfishValue->Value.Boolean;
> - Data = (VOID *)&Bool32;
> + Data = (VOID *)&Bool32;
> } else if (RedfishValue->Type == REDFISH_VALUE_TYPE_INTEGER) {
> VagueValue->DataType = RedfishCS_Vague_DataType_Int64;
> - DataSize = sizeof (INT64);
> - Data = (VOID *)&RedfishValue->Value.Integer;
> + DataSize = sizeof (INT64);
> + Data = (VOID *)&RedfishValue->Value.Integer;
> } else if (RedfishValue->Type == REDFISH_VALUE_TYPE_STRING) {
> VagueValue->DataType = RedfishCS_Vague_DataType_String;
> - DataSize = AsciiStrSize(RedfishValue->Value.Buffer);
> - Data = (VOID *)RedfishValue->Value.Buffer;
> + DataSize = AsciiStrSize (RedfishValue->Value.Buffer);
> + Data = (VOID *)RedfishValue->Value.Buffer;
> } else {
> DEBUG ((DEBUG_ERROR, "%a, wrong type of RedfishValue: %x\n",
> __FUNCTION__, RedfishValue->Type));
> FreePool (VagueValue);
> FreePool (EmptyPropKeyValue);
> return NULL;
> }
> - VagueValue->DataValue.CharPtr = (RedfishCS_char
> *)AllocateCopyPool(DataSize, Data);
> - EmptyPropKeyValue->Value = VagueValue;
> +
> + VagueValue->DataValue.CharPtr = (RedfishCS_char *)AllocateCopyPool
> (DataSize, Data);
> + EmptyPropKeyValue->Value = VagueValue;
> EmptyPropKeyValue->KeyNamePtr = KeyNameChar;
> return EmptyPropKeyValue;
> }
> @@ -2712,25 +2803,25 @@ NewEmptyPropKeyValueFromRedfishValue (
> **/
> RedfishCS_EmptyProp_KeyValue *
> GetPropertyVagueValue (
> - IN CHAR8 *Schema,
> - IN CHAR8 *Version,
> - IN EFI_STRING PropertyName,
> - IN EFI_STRING ConfigureLang,
> - OUT UINT32 *NumberOfValues
> + IN CHAR8 *Schema,
> + IN CHAR8 *Version,
> + IN EFI_STRING PropertyName,
> + IN EFI_STRING ConfigureLang,
> + OUT UINT32 *NumberOfValues
> )
> {
> - EFI_STATUS Status;
> - RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueList;
> - RedfishCS_EmptyProp_KeyValue *PreEmptyPropKeyValueList;
> - RedfishCS_EmptyProp_KeyValue *FirstEmptyPropKeyValueList;
> - EDKII_REDFISH_VALUE RedfishValue;
> - EFI_STRING ConfigureLangBuffer;
> - EFI_STRING KeyName;
> - EFI_STRING *ConfigureLangList;
> - EFI_STRING SearchPattern;
> - UINTN BufferSize;
> - UINTN ConfigListCount;
> - UINTN ConfigListCountIndex;
> + EFI_STATUS Status;
> + RedfishCS_EmptyProp_KeyValue *EmptyPropKeyValueList;
> + RedfishCS_EmptyProp_KeyValue *PreEmptyPropKeyValueList;
> + RedfishCS_EmptyProp_KeyValue *FirstEmptyPropKeyValueList;
> + EDKII_REDFISH_VALUE RedfishValue;
> + EFI_STRING ConfigureLangBuffer;
> + EFI_STRING KeyName;
> + EFI_STRING *ConfigureLangList;
> + EFI_STRING SearchPattern;
> + UINTN BufferSize;
> + UINTN ConfigListCount;
> + UINTN ConfigListCountIndex;
>
> if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) ||
> IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
> return NULL;
> @@ -2739,24 +2830,26 @@ GetPropertyVagueValue (
> //
> // Configure Language buffer.
> //
> - BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> + BufferSize = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
> ConfigureLangBuffer = AllocatePool (BufferSize);
> if (ConfigureLangBuffer == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for
> ConfigureLangBuffer\n", __FUNCTION__));
> return NULL;
> }
> +
> UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang,
> PropertyName);
>
> //
> // Initial search pattern
> //
> - BufferSize = (StrLen (ConfigureLangBuffer) + StrLen (L"/.*") + 1) * sizeof
> (CHAR16); // Increase one for the NULL terminator.
> + BufferSize = (StrLen (ConfigureLangBuffer) + StrLen (L"/.*") + 1) * sizeof
> (CHAR16); // Increase one for the NULL terminator.
> SearchPattern = AllocatePool (BufferSize);
> if (SearchPattern == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for
> SearchPattern\n", __FUNCTION__));
> FreePool (ConfigureLangBuffer);
> return NULL;
> }
> +
> BufferSize = BufferSize / sizeof (CHAR16);
> StrCpyS (SearchPattern, BufferSize, ConfigureLangBuffer);
> StrCatS (SearchPattern, BufferSize, L"/.*");
> @@ -2769,28 +2862,30 @@ GetPropertyVagueValue (
> //
> // Build up the list of RedfishCS_EmptyProp_KeyValue.
> //
> - ConfigListCountIndex = 0;
> - PreEmptyPropKeyValueList = NULL;
> + ConfigListCountIndex = 0;
> + PreEmptyPropKeyValueList = NULL;
> FirstEmptyPropKeyValueList = NULL;
> while (ConfigListCountIndex < ConfigListCount) {
> - Status = RedfishPlatformConfigGetValue(Schema, Version,
> ConfigureLangList [ConfigListCountIndex], &RedfishValue);
> + Status = RedfishPlatformConfigGetValue (Schema, Version,
> ConfigureLangList[ConfigListCountIndex], &RedfishValue);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed:
> %r\n", __FUNCTION__, Schema, Version, ConfigureLangList
> [ConfigListCountIndex], Status));
> + DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed:
> %r\n", __FUNCTION__, Schema, Version,
> ConfigureLangList[ConfigListCountIndex], Status));
> goto ErrorLeave;
> }
> +
> //
> // Get the key name.
> //
> - KeyName = GetAttributeNameFromConfigLanguage (ConfigureLangList
> [ConfigListCountIndex]);
> + KeyName = GetAttributeNameFromConfigLanguage
> (ConfigureLangList[ConfigListCountIndex]);
> //
> // Create an entry of RedfishCS_EmptyProp_KeyValue.
> //
> EmptyPropKeyValueList = NewEmptyPropKeyValueFromRedfishValue
> (KeyName, &RedfishValue);
> if (EmptyPropKeyValueList == NULL) {
> DEBUG ((DEBUG_ERROR, "%a, Failed to create an entry of
> EmptyPropKeyValueList\n", __FUNCTION__));
> - ConfigListCountIndex ++;
> + ConfigListCountIndex++;
> continue;
> }
> +
> //
> // Link the RedfishCS_EmptyProp_KeyValue list.
> //
> @@ -2799,24 +2894,29 @@ GetPropertyVagueValue (
> } else {
> FirstEmptyPropKeyValueList = EmptyPropKeyValueList;
> }
> +
> PreEmptyPropKeyValueList = EmptyPropKeyValueList;
> - ConfigListCountIndex ++;
> - };
> + ConfigListCountIndex++;
> + }
> +
> goto LeaveFunction;
>
> ErrorLeave:;
> if (FirstEmptyPropKeyValueList != NULL) {
> FreeEmptyPropKeyValueList (FirstEmptyPropKeyValueList);
> }
> +
> FirstEmptyPropKeyValueList = NULL;
>
> LeaveFunction:
> if (SearchPattern != NULL) {
> FreePool (SearchPattern);
> }
> +
> if (ConfigureLangBuffer != NULL) {
> FreePool (ConfigureLangBuffer);
> }
> +
> FreePool (ConfigureLangList);
>
> *NumberOfValues = (UINT32)ConfigListCount;
> @@ -2836,15 +2936,15 @@ LeaveFunction:
> **/
> BOOLEAN
> PropertyChecker (
> - IN VOID *PropertyBuffer,
> - IN BOOLEAN ProvisionMode
> + IN VOID *PropertyBuffer,
> + IN BOOLEAN ProvisionMode
> )
> {
> if (ProvisionMode) {
> return TRUE;
> }
>
> - if (!ProvisionMode && PropertyBuffer != NULL) {
> + if (!ProvisionMode && (PropertyBuffer != NULL)) {
> return TRUE;
> }
>
> @@ -2865,12 +2965,12 @@ PropertyChecker (
> **/
> BOOLEAN
> CheckEtag (
> - IN EFI_STRING Uri,
> - IN CHAR8 *EtagInHeader,
> - IN CHAR8 *EtagInJson
> + IN EFI_STRING Uri,
> + IN CHAR8 *EtagInHeader,
> + IN CHAR8 *EtagInJson
> )
> {
> - CHAR8 *EtagInDb;
> + CHAR8 *EtagInDb;
>
> if (IS_EMPTY_STRING (Uri)) {
> return FALSE;
> @@ -2920,15 +3020,15 @@ CheckEtag (
> **/
> EDKII_JSON_VALUE *
> MatchJsonObject (
> - IN EDKII_JSON_VALUE *JsonObj,
> - IN CHAR8 *ObjectName
> + IN EDKII_JSON_VALUE *JsonObj,
> + IN CHAR8 *ObjectName
> )
> {
> EDKII_JSON_VALUE N;
> CHAR8 *Key;
> EDKII_JSON_VALUE Value;
>
> - if (JsonObj == NULL || IS_EMPTY_STRING (ObjectName)) {
> + if ((JsonObj == NULL) || IS_EMPTY_STRING (ObjectName)) {
> return NULL;
> }
>
> @@ -2962,11 +3062,11 @@ MatchPropertyWithJsonContext (
> IN CHAR8 *Json
> )
> {
> - CHAR8 *AsciiProperty;
> - CHAR8 *PropertyNode;
> - UINTN Index;
> - EDKII_JSON_VALUE *JsonObj;
> - EDKII_JSON_VALUE *MatchObj;
> + CHAR8 *AsciiProperty;
> + CHAR8 *PropertyNode;
> + UINTN Index;
> + EDKII_JSON_VALUE *JsonObj;
> + EDKII_JSON_VALUE *MatchObj;
> EDKII_JSON_TYPE JsonType;
>
> if (IS_EMPTY_STRING (Property) || IS_EMPTY_STRING (Json)) {
> @@ -2974,7 +3074,7 @@ MatchPropertyWithJsonContext (
> }
>
> JsonObj = JsonLoadString (Json, 0, NULL);
> - if (JsonObj == NULL || !JsonValueIsObject (JsonObj)) {
> + if ((JsonObj == NULL) || !JsonValueIsObject (JsonObj)) {
> return FALSE;
> }
>
> @@ -2983,18 +3083,17 @@ MatchPropertyWithJsonContext (
> return FALSE;
> }
>
> - Index = 0;
> + Index = 0;
> PropertyNode = AsciiProperty;
> - MatchObj = JsonObj;
> + MatchObj = JsonObj;
>
> //
> // Walk through property and find corresponding object in JSON input
> //
> while (AsciiProperty[Index] != '\0') {
> -
> if (AsciiProperty[Index] == '/') {
> AsciiProperty[Index] = '\0';
> - MatchObj = MatchJsonObject (MatchObj, PropertyNode);
> + MatchObj = MatchJsonObject (MatchObj, PropertyNode);
> if (MatchObj == NULL) {
> PropertyNode = NULL;
> break;
> @@ -3023,16 +3122,19 @@ MatchPropertyWithJsonContext (
> if (JsonValueIsNull (MatchObj)) {
> MatchObj = NULL;
> }
> +
> break;
> case EdkiiJsonTypeArray:
> if (JsonArrayCount (MatchObj) == 0) {
> MatchObj = NULL;
> }
> +
> break;
> case EdkiiJsonTypeString:
> if (IS_EMPTY_STRING (JsonValueGetString (MatchObj))) {
> MatchObj = NULL;
> }
> +
> break;
> case EdkiiJsonTypeNull:
> MatchObj = NULL;
> @@ -3061,16 +3163,16 @@ MatchPropertyWithJsonContext (
> **/
> EFI_STATUS
> AddRedfishCharArray (
> - IN OUT RedfishCS_char_Array **Head,
> + IN OUT RedfishCS_char_Array **Head,
> IN CHAR8 **StringArray,
> IN UINTN ArraySize
> )
> {
> - UINTN Index;
> - RedfishCS_char_Array *CharArrayBuffer;
> - RedfishCS_char_Array *PreArrayBuffer;
> + UINTN Index;
> + RedfishCS_char_Array *CharArrayBuffer;
> + RedfishCS_char_Array *PreArrayBuffer;
>
> - if (Head == NULL || StringArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (StringArray == NULL) || (ArraySize == 0)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -3083,14 +3185,15 @@ AddRedfishCharArray (
> }
>
> if (Index == 0) {
> - *Head = CharArrayBuffer;
> + *Head = CharArrayBuffer;
> }
>
> CharArrayBuffer->ArrayValue = StringArray[Index];
> - CharArrayBuffer->Next = NULL;
> + CharArrayBuffer->Next = NULL;
> if (PreArrayBuffer != NULL) {
> PreArrayBuffer->Next = CharArrayBuffer;
> }
> +
> PreArrayBuffer = CharArrayBuffer;
> }
>
> @@ -3111,16 +3214,16 @@ AddRedfishCharArray (
> **/
> EFI_STATUS
> AddRedfishNumericArray (
> - IN OUT RedfishCS_int64_Array **Head,
> - IN INT64 *NumericArray,
> - IN UINTN ArraySize
> + IN OUT RedfishCS_int64_Array **Head,
> + IN INT64 *NumericArray,
> + IN UINTN ArraySize
> )
> {
> - UINTN Index;
> - RedfishCS_int64_Array *NumericArrayBuffer;
> - RedfishCS_int64_Array *PreArrayBuffer;
> + UINTN Index;
> + RedfishCS_int64_Array *NumericArrayBuffer;
> + RedfishCS_int64_Array *PreArrayBuffer;
>
> - if (Head == NULL || NumericArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (NumericArray == NULL) || (ArraySize == 0)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -3133,18 +3236,21 @@ AddRedfishNumericArray (
> }
>
> if (Index == 0) {
> - *Head = NumericArrayBuffer;
> + *Head = NumericArrayBuffer;
> }
> +
> NumericArrayBuffer->ArrayValue = AllocatePool (sizeof
> (RedfishCS_int64));
> if (NumericArrayBuffer->ArrayValue == NULL) {
> ASSERT (NumericArrayBuffer->ArrayValue != NULL);
> continue;
> }
> +
> *NumericArrayBuffer->ArrayValue = NumericArray[Index];
> - NumericArrayBuffer->Next = NULL;
> + NumericArrayBuffer->Next = NULL;
> if (PreArrayBuffer != NULL) {
> PreArrayBuffer->Next = NumericArrayBuffer;
> }
> +
> PreArrayBuffer = NumericArrayBuffer;
> }
>
> @@ -3170,11 +3276,11 @@ AddRedfishBooleanArray (
> IN UINTN ArraySize
> )
> {
> - UINTN Index;
> - RedfishCS_bool_Array *BooleanArrayBuffer;
> - RedfishCS_bool_Array *PreArrayBuffer;
> + UINTN Index;
> + RedfishCS_bool_Array *BooleanArrayBuffer;
> + RedfishCS_bool_Array *PreArrayBuffer;
>
> - if (Head == NULL || BooleanArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (BooleanArray == NULL) || (ArraySize == 0)) {
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -3187,7 +3293,7 @@ AddRedfishBooleanArray (
> }
>
> if (Index == 0) {
> - *Head = BooleanArrayBuffer;
> + *Head = BooleanArrayBuffer;
> }
>
> BooleanArrayBuffer->ArrayValue = AllocatePool (sizeof (RedfishCS_bool));
> @@ -3195,11 +3301,13 @@ AddRedfishBooleanArray (
> ASSERT (BooleanArrayBuffer->ArrayValue != NULL);
> continue;
> }
> +
> *BooleanArrayBuffer->ArrayValue = BooleanArray[Index];
> - BooleanArrayBuffer->Next = NULL;
> + BooleanArrayBuffer->Next = NULL;
> if (PreArrayBuffer != NULL) {
> PreArrayBuffer->Next = BooleanArrayBuffer;
> }
> +
> PreArrayBuffer = BooleanArrayBuffer;
> }
>
> @@ -3222,22 +3330,21 @@ AddRedfishBooleanArray (
> **/
> BOOLEAN
> CompareRedfishStringArrayValues (
> - IN RedfishCS_char_Array *Head,
> - IN CHAR8 **StringArray,
> - IN UINTN ArraySize
> + IN RedfishCS_char_Array *Head,
> + IN CHAR8 **StringArray,
> + IN UINTN ArraySize
> )
> {
> UINTN Index;
> RedfishCS_char_Array *CharArrayBuffer;
>
> - if (Head == NULL || StringArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (StringArray == NULL) || (ArraySize == 0)) {
> return FALSE;
> }
>
> CharArrayBuffer = Head;
> - Index = 0;
> + Index = 0;
> while (CharArrayBuffer != NULL && Index < ArraySize) {
> -
> if (AsciiStrCmp (StringArray[Index], CharArrayBuffer->ArrayValue) != 0) {
> break;
> }
> @@ -3246,7 +3353,7 @@ CompareRedfishStringArrayValues (
> CharArrayBuffer = CharArrayBuffer->Next;
> }
>
> - if (CharArrayBuffer != NULL || Index < ArraySize) {
> + if ((CharArrayBuffer != NULL) || (Index < ArraySize)) {
> return FALSE;
> }
>
> @@ -3269,20 +3376,20 @@ CompareRedfishStringArrayValues (
> **/
> BOOLEAN
> CompareRedfishNumericArrayValues (
> - IN RedfishCS_int64_Array *Head,
> - IN INT64 *NumericArray,
> - IN UINTN ArraySize
> + IN RedfishCS_int64_Array *Head,
> + IN INT64 *NumericArray,
> + IN UINTN ArraySize
> )
> {
> UINTN Index;
> RedfishCS_int64_Array *NumericArrayBuffer;
>
> - if (Head == NULL || NumericArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (NumericArray == NULL) || (ArraySize == 0)) {
> return FALSE;
> }
>
> NumericArrayBuffer = Head;
> - Index = 0;
> + Index = 0;
> while (NumericArrayBuffer != NULL && Index < ArraySize) {
> if (NumericArray[Index] != *NumericArrayBuffer->ArrayValue) {
> break;
> @@ -3292,7 +3399,7 @@ CompareRedfishNumericArrayValues (
> NumericArrayBuffer = NumericArrayBuffer->Next;
> }
>
> - if (NumericArrayBuffer != NULL || Index < ArraySize) {
> + if ((NumericArrayBuffer != NULL) || (Index < ArraySize)) {
> return FALSE;
> }
>
> @@ -3320,15 +3427,15 @@ CompareRedfishBooleanArrayValues (
> IN UINTN ArraySize
> )
> {
> - UINTN Index;
> + UINTN Index;
> RedfishCS_bool_Array *BooleanArrayBuffer;
>
> - if (Head == NULL || BooleanArray == NULL || ArraySize == 0) {
> + if ((Head == NULL) || (BooleanArray == NULL) || (ArraySize == 0)) {
> return FALSE;
> }
>
> BooleanArrayBuffer = Head;
> - Index = 0;
> + Index = 0;
> while (BooleanArrayBuffer != NULL && Index < ArraySize) {
> if (BooleanArray[Index] != *BooleanArrayBuffer->ArrayValue) {
> break;
> @@ -3338,7 +3445,7 @@ CompareRedfishBooleanArrayValues (
> BooleanArrayBuffer = BooleanArrayBuffer->Next;
> }
>
> - if (BooleanArrayBuffer != NULL || Index < ArraySize) {
> + if ((BooleanArrayBuffer != NULL) || (Index < ArraySize)) {
> return FALSE;
> }
>
> @@ -3361,12 +3468,12 @@ CompareRedfishBooleanArrayValues (
> **/
> BOOLEAN
> CompareRedfishPropertyVagueValues (
> - IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
> - IN UINT32 RedfishVagueKeyValueNumber,
> - IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
> - IN UINT32 ConfigVagueKeyValueNumber
> + IN RedfishCS_EmptyProp_KeyValue *RedfishVagueKeyValuePtr,
> + IN UINT32 RedfishVagueKeyValueNumber,
> + IN RedfishCS_EmptyProp_KeyValue *ConfigVagueKeyValuePtr,
> + IN UINT32 ConfigVagueKeyValueNumber
> )
> - {
> +{
> RedfishCS_EmptyProp_KeyValue *ThisConfigVagueKeyValuePtr;
> RedfishCS_EmptyProp_KeyValue *ThisRedfishVagueKeyValuePtr;
>
> @@ -3384,13 +3491,14 @@ CompareRedfishPropertyVagueValues (
> // Loop through all key/value on Redfish service..
> //
> while (ThisRedfishVagueKeyValuePtr != NULL) {
> - if (AsciiStrCmp(ThisConfigVagueKeyValuePtr->KeyNamePtr,
> ThisRedfishVagueKeyValuePtr->KeyNamePtr) == 0) {
> + if (AsciiStrCmp (ThisConfigVagueKeyValuePtr->KeyNamePtr,
> ThisRedfishVagueKeyValuePtr->KeyNamePtr) == 0) {
> //
> // Check the type of value.
> //
> if (ThisConfigVagueKeyValuePtr->Value->DataType !=
> ThisRedfishVagueKeyValuePtr->Value->DataType) {
> return FALSE;
> }
> +
> //
> // Check the value.
> //
> @@ -3398,11 +3506,13 @@ CompareRedfishPropertyVagueValues (
> //
> // Is the string identical?
> //
> - if (AsciiStrCmp (ThisConfigVagueKeyValuePtr->Value-
> >DataValue.CharPtr,
> - ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
> - ) == 0) {
> + if (AsciiStrCmp (
> + ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr,
> + ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
> + ) == 0)
> + {
> break;
> - } else{
> + } else {
> return FALSE;
> }
> } else if (ThisConfigVagueKeyValuePtr->Value->DataType ==
> RedfishCS_Vague_DataType_Int64) {
> @@ -3421,16 +3531,20 @@ CompareRedfishPropertyVagueValues (
> return FALSE;
> }
> }
> +
> ThisRedfishVagueKeyValuePtr = ThisRedfishVagueKeyValuePtr-
> >NextKeyValuePtr;
> - };
> + }
> +
> if (ThisRedfishVagueKeyValuePtr == NULL) {
> //
> // No matched key name. Threat these two vague value set is different.
> //
> return FALSE;
> }
> +
> ThisConfigVagueKeyValuePtr = ThisConfigVagueKeyValuePtr-
> >NextKeyValuePtr;
> - };
> + }
> +
> return TRUE;
> }
>
> @@ -3448,11 +3562,10 @@ CompareRedfishPropertyVagueValues (
> EFI_STATUS
> EFIAPI
> RedfishFeatureUtilityLibConstructor (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE *SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> -
> return EFI_SUCCESS;
> }
>
> @@ -3468,8 +3581,8 @@ RedfishFeatureUtilityLibConstructor (
> EFI_STATUS
> EFIAPI
> RedfishFeatureUtilityLibDestructor (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE *SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> return EFI_SUCCESS;
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .inf
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .inf
> index 84f338e680..66d5dce6c2 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .inf
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib
> .inf
> @@ -1,6 +1,8 @@
> ## @file
> +# INF for Redfish feature utility library.
> #
> # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> #
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> #
> @@ -49,6 +51,7 @@
> gEdkIIRedfishConfigLangMapProtocolGuid ## CONSUMED ##
>
> [Pcd]
> + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
>
> [Guids]
>
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index d3c97ecf68..c0ab30ab8b 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -2,7 +2,7 @@
> # Redfish Client Package
> #
> # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
> -# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> #
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> ##
> @@ -65,3 +65,9 @@
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupE
> ventGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8,
> 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x10000003
> ## Default Redfish version string
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID
> *|0x10000004
> + ## The number of seconds that the firmware will wait before system
> reboot
> +
> gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|
> UINT16|0x20000002
> +
> +[PcdsDynamicEx]
> + ## The flag used to indicate that system reboot is required due to system
> configuration change
> +
> gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired|FA
> LSE|BOOLEAN|0x20000001
> diff --git
> a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> index 3414f0c942..5a3a9e4c5a 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> @@ -3,6 +3,7 @@
> for EDK2 Redfish Feature driver registration.
>
> (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -10,10 +11,10 @@
>
> #include <RedfishFeatureCoreDxe.h>
>
> -EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent;
> -REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext;
> -REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList;
> -RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
> +EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent;
> +REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext;
> +REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList;
> +RESOURCE_INFORMATION_EXCHANGE *mInformationExchange;
>
> /**
> Setup the information to deliver to child feature/collection driver.
> @@ -24,19 +25,21 @@ RESOURCE_INFORMATION_EXCHANGE
> *mInformationExchange;
> **/
> EFI_STATUS
> SetupExchangeInformationInfo (
> - IN REDFISH_FEATURE_INTERNAL_DATA *ThisList,
> - IN EFI_STRING ParentConfgLanguageUri
> + IN REDFISH_FEATURE_INTERNAL_DATA *ThisList,
> + IN EFI_STRING ParentConfgLanguageUri
> )
> {
> ThisList->InformationExchange->SendInformation.ParentUri =
> (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
> if (ThisList->InformationExchange->SendInformation.ParentUri == NULL) {
> return EFI_OUT_OF_RESOURCES;
> }
> - ThisList->InformationExchange->SendInformation.PropertyName =
> (EFI_STRING)AllocateZeroPool(MaxNodeNameLength * sizeof (CHAR16));
> +
> + ThisList->InformationExchange->SendInformation.PropertyName =
> (EFI_STRING)AllocateZeroPool (MaxNodeNameLength * sizeof (CHAR16));
> if (ThisList->InformationExchange->SendInformation.PropertyName ==
> NULL) {
> return EFI_OUT_OF_RESOURCES;
> }
> - ThisList->InformationExchange->SendInformation.FullUri =
> (EFI_STRING)AllocateZeroPool(MaxParentUriLength * sizeof (CHAR16));
> +
> + ThisList->InformationExchange->SendInformation.FullUri =
> (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
> if (ThisList->InformationExchange->SendInformation.FullUri == NULL) {
> return EFI_OUT_OF_RESOURCES;
> }
> @@ -54,13 +57,15 @@ SetupExchangeInformationInfo (
> //
> // Full config language URI
> //
> - StrCpyS (ThisList->InformationExchange->SendInformation.FullUri,
> - MaxParentUriLength,
> - ThisList->InformationExchange->SendInformation.ParentUri
> - );
> + StrCpyS (
> + ThisList->InformationExchange->SendInformation.FullUri,
> + MaxParentUriLength,
> + ThisList->InformationExchange->SendInformation.ParentUri
> + );
> if (StrLen (ThisList->InformationExchange->SendInformation.FullUri) != 0) {
> StrCatS (ThisList->InformationExchange->SendInformation.FullUri,
> MaxParentUriLength, L"/");
> }
> +
> StrCatS (ThisList->InformationExchange->SendInformation.FullUri,
> MaxParentUriLength, ThisList->InformationExchange-
> >SendInformation.PropertyName);
> return EFI_SUCCESS;
> }
> @@ -73,20 +78,21 @@ SetupExchangeInformationInfo (
> **/
> EFI_STATUS
> DestroryExchangeInformation (
> - IN REDFISH_FEATURE_INTERNAL_DATA *ThisList
> + IN REDFISH_FEATURE_INTERNAL_DATA *ThisList
> )
> {
> -
> if (ThisList->InformationExchange != NULL) {
> if (ThisList->InformationExchange->SendInformation.Type ==
> InformationTypeCollectionMemberUri) {
> if (ThisList->InformationExchange->SendInformation.ParentUri != NULL) {
> FreePool (ThisList->InformationExchange->SendInformation.ParentUri);
> ThisList->InformationExchange->SendInformation.ParentUri = NULL;
> }
> +
> if (ThisList->InformationExchange->SendInformation.PropertyName !=
> NULL) {
> FreePool (ThisList->InformationExchange-
> >SendInformation.PropertyName);
> ThisList->InformationExchange->SendInformation.PropertyName =
> NULL;
> }
> +
> if (ThisList->InformationExchange->SendInformation.FullUri != NULL) {
> FreePool (ThisList->InformationExchange->SendInformation.FullUri);
> ThisList->InformationExchange->SendInformation.FullUri = NULL;
> @@ -97,10 +103,10 @@ DestroryExchangeInformation (
> DestroyConfiglanguageList (&ThisList->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList);
> }
>
> - ThisList->InformationExchange->SendInformation.Type =
> InformationTypeNone;
> + ThisList->InformationExchange->SendInformation.Type =
> InformationTypeNone;
> ThisList->InformationExchange->ReturnedInformation.Type =
> InformationTypeNone;
> -
> }
> +
> return EFI_SUCCESS;
> }
>
> @@ -114,44 +120,47 @@ DestroryExchangeInformation (
> **/
> VOID
> StartUpFeatureDriver (
> - IN REDFISH_FEATURE_INTERNAL_DATA *ThisFeatureDriverList,
> - IN EFI_STRING CurrentConfigLanguageUri,
> - IN REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext
> -)
> + IN REDFISH_FEATURE_INTERNAL_DATA *ThisFeatureDriverList,
> + IN EFI_STRING CurrentConfigLanguageUri,
> + IN REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext
> + )
> {
> - EFI_STATUS Status;
> - UINTN Index;
> - REDFISH_FEATURE_INTERNAL_DATA *ThisList;
> - REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList;
> - EFI_STRING NextParentUri;
> + EFI_STATUS Status;
> + UINTN Index;
> + REDFISH_FEATURE_INTERNAL_DATA *ThisList;
> + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList;
> + EFI_STRING NextParentUri;
>
> NextParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength *
> sizeof (CHAR16));
> if (NextParentUri == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure
> language.\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for parent
> configure language.\n", __FUNCTION__));
> return;
> }
> +
> if (CurrentConfigLanguageUri != NULL) {
> - StrCpyS(NextParentUri, MaxParentUriLength, CurrentConfigLanguageUri);
> + StrCpyS (NextParentUri, MaxParentUriLength,
> CurrentConfigLanguageUri);
> }
>
> ThisList = ThisFeatureDriverList;
> while (TRUE) {
> if (ThisList->Callback != NULL) {
> ThisList->InformationExchange = mInformationExchange;
> - Status = SetupExchangeInformationInfo (ThisList, NextParentUri);
> + Status = SetupExchangeInformationInfo (ThisList,
> NextParentUri);
> if (!EFI_ERROR (Status)) {
> - Status = ThisList->Callback(
> - StartupContext->This,
> - StartupContext->Action,
> - ThisList->Context,
> - ThisList->InformationExchange
> - );
> + Status = ThisList->Callback (
> + StartupContext->This,
> + StartupContext->Action,
> + ThisList->Context,
> + ThisList->InformationExchange
> + );
> }
> +
> if (EFI_ERROR (Status)) {
> - DEBUG((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature driver
> fail: %s.\n", __FUNCTION__, ThisList->InformationExchange-
> >SendInformation.FullUri));
> + DEBUG ((DEBUG_ERROR, "%a: Callback to EDK2 Redfish feature driver
> fail: %s.\n", __FUNCTION__, ThisList->InformationExchange-
> >SendInformation.FullUri));
> }
> }
> - if (!EFI_ERROR (Status) && ThisList->Callback != NULL && ThisList-
> >ChildList != NULL) {
> +
> + if (!EFI_ERROR (Status) && (ThisList->Callback != NULL) && (ThisList-
> >ChildList != NULL)) {
> //
> // Go through child list only when the parent node is managed by feature
> driver.
> //
> @@ -165,52 +174,56 @@ StartUpFeatureDriver (
> // Copy RESOURCE_INFORMATION_RETURNED then destroy the
> exchange information.
> //
> CopyConfiglanguageList (&ThisList->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList, &ConfigLangList);
> - DestroryExchangeInformation(ThisList);
> + DestroryExchangeInformation (ThisList);
> //
> // Modify the collection instance according to the returned
> InformationTypeCollectionMemberConfigLanguage.
> //
> - for (Index = 0; Index < ConfigLangList.Count; Index ++) {
> + for (Index = 0; Index < ConfigLangList.Count; Index++) {
> StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeName);
> StrCatS (NextParentUri, MaxParentUriLength,
> NodeIsCollectionSymbol);
> SetResourceConfigLangMemberInstance (&NextParentUri,
> MaxParentUriLength, (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG
> *)&ConfigLangList.List[Index]);
> - StartUpFeatureDriver(ThisList->ChildList, NextParentUri,
> StartupContext);
> + StartUpFeatureDriver (ThisList->ChildList, NextParentUri,
> StartupContext);
> }
> +
> DestroyConfiglanguageList (&ConfigLangList);
> } else {
> - DEBUG((DEBUG_ERROR, "%a: No
> InformationTypeCollectionMemberConfigLanguage of %s returned.\n",
> __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
> - DEBUG((DEBUG_ERROR, "%a: Redfish service maybe not connected or
> the network has problems.\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: No
> InformationTypeCollectionMemberConfigLanguage of %s returned.\n",
> __FUNCTION__, ThisList->InformationExchange->SendInformation.FullUri));
> + DEBUG ((DEBUG_ERROR, "%a: Redfish service maybe not connected
> or the network has problems.\n", __FUNCTION__));
> return;
> }
> } else {
> StrCatS (NextParentUri, MaxParentUriLength, ThisList->NodeName);
> - StartUpFeatureDriver(ThisList->ChildList, NextParentUri,
> StartupContext);
> + StartUpFeatureDriver (ThisList->ChildList, NextParentUri,
> StartupContext);
> }
> +
> //
> // Restore the parent configure language URI for this level.
> //
> if (CurrentConfigLanguageUri != NULL) {
> - StrCpyS(NextParentUri, MaxParentUriLength,
> CurrentConfigLanguageUri);
> - } else{
> - NextParentUri [0] = 0;
> + StrCpyS (NextParentUri, MaxParentUriLength,
> CurrentConfigLanguageUri);
> + } else {
> + NextParentUri[0] = 0;
> }
> } else {
> DestroryExchangeInformation (ThisList);
> }
> +
> //
> // Check sibling Redfish feature driver.
> //
> if (ThisList->SiblingList == NULL) {
> break;
> }
> +
> //
> // Go next sibling Redfish feature driver.
> //
> ThisList = ThisList->SiblingList;
> - };
> + }
> +
> if (NextParentUri != NULL) {
> FreePool (NextParentUri);
> }
> -
> }
>
> /**
> @@ -224,14 +237,16 @@ StartUpFeatureDriver (
> **/
> VOID
> EFIAPI
> -RedfishFeatureDriverStartup(
> - IN EFI_EVENT Event,
> - IN VOID *Context
> +RedfishFeatureDriverStartup (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> )
> {
> - REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext;
> + REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext;
> + UINT16 RebootTimeout;
>
> StartupContext = (REDFISH_FEATURE_STARTUP_CONTEXT *)Context;
> + RebootTimeout = PcdGet16 (PcdRedfishSystemRebootTimeout);
> //
> // Invoke EDK2 Redfish feature driver callback to start up
> // the Redfish operations.
> @@ -245,10 +260,15 @@ RedfishFeatureDriverStartup(
> //
> mInformationExchange = (RESOURCE_INFORMATION_EXCHANGE
> *)AllocateZeroPool (sizeof (RESOURCE_INFORMATION_EXCHANGE));
> if (mInformationExchange == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: Fail to allocate memory for exchange
> information.\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for exchange
> information.\n", __FUNCTION__));
> return;
> }
>
> + //
> + // Reset PcdRedfishSystemRebootRequired flag
> + //
> + PcdSetBoolS (PcdRedfishSystemRebootRequired, FALSE);
> +
> //
> // Signal event before doing provisioning
> //
> @@ -263,6 +283,16 @@ RedfishFeatureDriverStartup(
> // Signal event after provisioning finished
> //
> SignalAfterProvisioningEvent ();
> +
> + //
> + // If system configuration is changed, reboot system.
> + //
> + if (PcdGetBool (PcdRedfishSystemRebootRequired)) {
> + Print (L"System configuration is changed from RESTful interface. Reboot
> system in %d seconds...\n", RebootTimeout);
> + gBS->Stall (RebootTimeout * 1000000U);
> + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
> + CpuDeadLoop ();
> + }
> }
>
> /**
> @@ -281,31 +311,33 @@ RedfishFeatureDriverStartup(
> **/
> EFI_STATUS
> NewInternalInstance (
> - IN OUT REDFISH_FEATURE_INTERNAL_DATA **PtrToNewInternalData,
> - IN EFI_STRING NodeName,
> - IN BOOLEAN NodeIsCollection
> + IN OUT REDFISH_FEATURE_INTERNAL_DATA **PtrToNewInternalData,
> + IN EFI_STRING NodeName,
> + IN BOOLEAN NodeIsCollection
> )
> {
> - REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
> + REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
>
> - if (PtrToNewInternalData == NULL || NodeName == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: Inproper given parameters\n",
> __FUNCTION__));
> + if ((PtrToNewInternalData == NULL) || (NodeName == NULL)) {
> + DEBUG ((DEBUG_ERROR, "%a: Inproper given parameters\n",
> __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
>
> *PtrToNewInternalData = NULL;
> - NewInternalData = AllocateZeroPool (sizeof
> (REDFISH_FEATURE_INTERNAL_DATA));
> + NewInternalData = AllocateZeroPool (sizeof
> (REDFISH_FEATURE_INTERNAL_DATA));
> if (NewInternalData == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: No memory for
> REDFISH_FEATURE_INTERNAL_DATA\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: No memory for
> REDFISH_FEATURE_INTERNAL_DATA\n", __FUNCTION__));
> return EFI_OUT_OF_RESOURCES;
> }
> +
> NewInternalData->NodeName = AllocateZeroPool (StrSize (NodeName));
> StrnCpyS (NewInternalData->NodeName, StrSize (NodeName), (CONST
> CHAR16 *)NodeName, StrLen (NodeName));
> NewInternalData->SiblingList = NULL;
> - NewInternalData->ChildList = NULL;
> + NewInternalData->ChildList = NULL;
> if (NodeIsCollection) {
> NewInternalData->Flags |=
> REDFISH_FEATURE_INTERNAL_DATA_IS_COLLECTION;
> }
> +
> *PtrToNewInternalData = NewInternalData;
> return EFI_SUCCESS;
> }
> @@ -338,18 +370,19 @@ InsertRedfishFeatureUriNode (
> OUT REDFISH_FEATURE_INTERNAL_DATA **MatchNodeEntry
> )
> {
> - EFI_STATUS Status;
> - REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
> - REDFISH_FEATURE_INTERNAL_DATA *ThisInternalData;
> - REDFISH_FEATURE_INTERNAL_DATA *SiblingList;
> + EFI_STATUS Status;
> + REDFISH_FEATURE_INTERNAL_DATA *NewInternalData;
> + REDFISH_FEATURE_INTERNAL_DATA *ThisInternalData;
> + REDFISH_FEATURE_INTERNAL_DATA *SiblingList;
>
> *MatchNodeEntry = NULL;
> if (NodeName == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
> +
> if (NextNodeEntry == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n",
> __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n",
> __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
>
> @@ -358,27 +391,31 @@ InsertRedfishFeatureUriNode (
> if (EFI_ERROR (Status)) {
> return Status;
> }
> - if (HeadEntryToInsert == NULL && ResourceUriNodeList == NULL) {
> +
> + if ((HeadEntryToInsert == NULL) && (ResourceUriNodeList == NULL)) {
> ResourceUriNodeList = NewInternalData;
> } else {
> (*PrevisouEntry)->ChildList = NewInternalData;
> }
> +
> *PrevisouEntry = NewInternalData;
> *NextNodeEntry = NewInternalData->ChildList;
> return EFI_SUCCESS;
> }
> +
> //
> // Go through sibling list to find the entry.
> //
> ThisInternalData = HeadEntryToInsert;
> - SiblingList = ThisInternalData->SiblingList;
> + SiblingList = ThisInternalData->SiblingList;
> while (TRUE) {
> - if (StrCmp((CONST CHAR16 *)ThisInternalData->NodeName, (CONST
> CHAR16 *)NodeName) == 0) {
> + if (StrCmp ((CONST CHAR16 *)ThisInternalData->NodeName, (CONST
> CHAR16 *)NodeName) == 0) {
> *MatchNodeEntry = ThisInternalData;
> - *NextNodeEntry = ThisInternalData->ChildList;
> - *PrevisouEntry = ThisInternalData;
> + *NextNodeEntry = ThisInternalData->ChildList;
> + *PrevisouEntry = ThisInternalData;
> return EFI_SUCCESS;
> }
> +
> //
> // If sibing exist?
> //
> @@ -387,14 +424,17 @@ InsertRedfishFeatureUriNode (
> if (EFI_ERROR (Status)) {
> return Status;
> }
> +
> ThisInternalData->SiblingList = NewInternalData;
> - *PrevisouEntry = NewInternalData;
> - *NextNodeEntry = NewInternalData->ChildList;
> + *PrevisouEntry = NewInternalData;
> + *NextNodeEntry = NewInternalData->ChildList;
> return EFI_SUCCESS;
> }
> +
> ThisInternalData = SiblingList;
> - SiblingList = ThisInternalData->SiblingList;
> - };
> + SiblingList = ThisInternalData->SiblingList;
> + }
> +
> return EFI_SUCCESS;
> }
>
> @@ -432,66 +472,74 @@ RedfishFeatureRegister (
> IN EFI_STRING FeatureManagedUri,
> IN REDFISH_FEATURE_CALLBACK Callback,
> IN VOID *Context
> -)
> + )
> {
> - CHAR16 NodeName [MaxNodeNameLength];
> - EFI_STATUS Status;
> - UINTN Index;
> - UINTN AnchorIndex;
> - UINTN UriLength;
> - BOOLEAN NewUri;
> - REDFISH_FEATURE_INTERNAL_DATA *ThisUriNode;
> - REDFISH_FEATURE_INTERNAL_DATA *PreUriNode;
> - REDFISH_FEATURE_INTERNAL_DATA *NewUriNode;
> - REDFISH_FEATURE_INTERNAL_DATA *MatchNodeEntry;
> - BOOLEAN ItsCollection;
> -
> - if (FeatureManagedUri == NULL || Callback == NULL) {
> - DEBUG((DEBUG_ERROR, "%a: The given parameter is invalid\n",
> __FUNCTION__));
> + CHAR16 NodeName[MaxNodeNameLength];
> + EFI_STATUS Status;
> + UINTN Index;
> + UINTN AnchorIndex;
> + UINTN UriLength;
> + BOOLEAN NewUri;
> + REDFISH_FEATURE_INTERNAL_DATA *ThisUriNode;
> + REDFISH_FEATURE_INTERNAL_DATA *PreUriNode;
> + REDFISH_FEATURE_INTERNAL_DATA *NewUriNode;
> + REDFISH_FEATURE_INTERNAL_DATA *MatchNodeEntry;
> + BOOLEAN ItsCollection;
> +
> + if ((FeatureManagedUri == NULL) || (Callback == NULL)) {
> + DEBUG ((DEBUG_ERROR, "%a: The given parameter is invalid\n",
> __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
> +
> //
> // Walk through URI which managed by this EDK2 Redfish feature driver.
> //
> - UriLength = StrLen (FeatureManagedUri) + 1; // Add one NULL for the last
> node.
> - Index = 0;
> + UriLength = StrLen (FeatureManagedUri) + 1; // Add one NULL for the last
> node.
> + Index = 0;
> AnchorIndex = 0;
> ThisUriNode = ResourceUriNodeList;
> - PreUriNode = ResourceUriNodeList;
> - NewUri = FALSE;
> + PreUriNode = ResourceUriNodeList;
> + NewUri = FALSE;
> while ((Index < UriLength)) {
> - if ((Index - AnchorIndex + 1) >= MaxNodeNameLength) { // Increase one
> for the NULL terminator
> - DEBUG((DEBUG_ERROR, "%a: the length of node name is >=
> MaxNodeNameLength\n", __FUNCTION__));
> + if ((Index - AnchorIndex + 1) >= MaxNodeNameLength) {
> + // Increase one for the NULL terminator
> + DEBUG ((DEBUG_ERROR, "%a: the length of node name is >=
> MaxNodeNameLength\n", __FUNCTION__));
> ASSERT (FALSE);
> }
> +
> NodeName[Index - AnchorIndex] = *(FeatureManagedUri + Index);
> - if (NodeName [Index - AnchorIndex] == NodeSeperator || NodeName
> [Index - AnchorIndex] == UriSeperator || NodeName [Index - AnchorIndex]
> == (CHAR16)0) {
> - if (NodeName [Index - AnchorIndex] == UriSeperator) {
> + if ((NodeName[Index - AnchorIndex] == NodeSeperator) ||
> (NodeName[Index - AnchorIndex] == UriSeperator) || (NodeName[Index -
> AnchorIndex] == (CHAR16)0)) {
> + if (NodeName[Index - AnchorIndex] == UriSeperator) {
> NewUri = TRUE;
> }
> - NodeName [Index - AnchorIndex] = 0;
> - AnchorIndex = Index + 1;
> +
> + NodeName[Index - AnchorIndex] = 0;
> + AnchorIndex = Index + 1;
> //
> // Insert node
> //
> - if (StrLen(NodeName) != 0) {
> + if (StrLen (NodeName) != 0) {
> ItsCollection = FALSE;
> - if ((Index + StrLen(NodeIsCollectionSymbol)) < UriLength &&
> - *(FeatureManagedUri + Index + 1) == NodeIsCollectionLeftBracket
> &&
> - *(FeatureManagedUri + Index + 2) == NodeIsCollectionRightBracket) {
> - Index += (StrLen(NodeIsCollectionSymbol));
> - AnchorIndex += (StrLen(NodeIsCollectionSymbol));
> + if (((Index + StrLen (NodeIsCollectionSymbol)) < UriLength) &&
> + (*(FeatureManagedUri + Index + 1) == NodeIsCollectionLeftBracket)
> &&
> + (*(FeatureManagedUri + Index + 2) == NodeIsCollectionRightBracket))
> + {
> + Index += (StrLen (NodeIsCollectionSymbol));
> + AnchorIndex += (StrLen (NodeIsCollectionSymbol));
> ItsCollection = TRUE;
> if (*(FeatureManagedUri + Index) == UriSeperator) {
> - NewUri = TRUE;;
> + NewUri = TRUE;
> }
> }
> - Status = InsertRedfishFeatureUriNode(ThisUriNode, &PreUriNode,
> NodeName, ItsCollection, &NewUriNode, &MatchNodeEntry);
> +
> + Status = InsertRedfishFeatureUriNode (ThisUriNode, &PreUriNode,
> NodeName, ItsCollection, &NewUriNode, &MatchNodeEntry);
> if (EFI_ERROR (Status)) {
> return Status;
> }
> +
> ThisUriNode = NewUriNode;
> }
> +
> if (NewUri || ((Index + 1) >= UriLength)) {
> //
> // Setup the callabck and restart the searching for the
> @@ -499,28 +547,31 @@ RedfishFeatureRegister (
> //
> if (MatchNodeEntry != NULL) {
> MatchNodeEntry->Callback = Callback;
> - MatchNodeEntry->Context = Context;
> - MatchNodeEntry = NULL;
> + MatchNodeEntry->Context = Context;
> + MatchNodeEntry = NULL;
> } else {
> PreUriNode->Callback = Callback;
> - PreUriNode->Context = Context;
> + PreUriNode->Context = Context;
> }
> - NewUri = FALSE;
> +
> + NewUri = FALSE;
> ThisUriNode = ResourceUriNodeList;
> - Index ++;
> + Index++;
> continue;
> }
> }
> - Index ++;
> - };
> +
> + Index++;
> + }
>
> if (ThisUriNode == NULL) {
> //
> // No URI node was created
> //
> - DEBUG((DEBUG_ERROR, "%a: No URI node is added\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: No URI node is added\n",
> __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
> +
> return EFI_SUCCESS;
> }
>
> @@ -545,12 +596,12 @@ RedfishFeatureUnregister (
> IN EDKII_REDFISH_FEATURE_PROTOCOL *This,
> IN EFI_STRING FeatureManagedUri,
> IN VOID *Context
> -)
> + )
> {
> return EFI_UNSUPPORTED;
> }
>
> -EDKII_REDFISH_FEATURE_PROTOCOL mRedfishFeatureProtocol = {
> +EDKII_REDFISH_FEATURE_PROTOCOL mRedfishFeatureProtocol = {
> RedfishFeatureRegister,
> RedfishFeatureUnregister
> };
> @@ -567,30 +618,30 @@ EDKII_REDFISH_FEATURE_PROTOCOL
> mRedfishFeatureProtocol = {
> EFI_STATUS
> EFIAPI
> RedfishFeatureCoreEntryPoint (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE *SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> EFI_STATUS Status;
> EFI_HANDLE Handle;
> - EFI_GUID *EventGuid;
> + EFI_GUID *EventGuid;
>
> - Handle = NULL;
> + Handle = NULL;
> ResourceUriNodeList = NULL;
> - EventGuid = (EFI_GUID *)PcdGetPtr
> (PcdEdkIIRedfishFeatureDriverStartupEventGuid);
> + EventGuid = (EFI_GUID *)PcdGetPtr
> (PcdEdkIIRedfishFeatureDriverStartupEventGuid);
>
> ZeroMem ((VOID *)&mFeatureDriverStartupContext, sizeof
> (REDFISH_FEATURE_STARTUP_CONTEXT));
> - mFeatureDriverStartupContext.This = &mRedfishFeatureProtocol;
> + mFeatureDriverStartupContext.This = &mRedfishFeatureProtocol;
> mFeatureDriverStartupContext.Action = CallbackActionStartOperation;
>
> Status = gBS->CreateEventEx (
> - EVT_NOTIFY_SIGNAL,
> - TPL_CALLBACK,
> - RedfishFeatureDriverStartup,
> - (CONST VOID *)&mFeatureDriverStartupContext,
> - EventGuid,
> - &mEdkIIRedfishFeatureDriverStartupEvent
> - );
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + RedfishFeatureDriverStartup,
> + (CONST VOID *)&mFeatureDriverStartupContext,
> + EventGuid,
> + &mEdkIIRedfishFeatureDriverStartupEvent
> + );
> if (EFI_ERROR (Status)) {
> return Status;
> }
> diff --git
> a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> index 84b5e456d1..af274c01ca 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> @@ -2,6 +2,7 @@
> Definitions of RedfishFeatureCoreDxe
>
> (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -17,6 +18,8 @@
> #include <Library/DebugLib.h>
> #include <Library/MemoryAllocationLib.h>
> #include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiLib.h>
> +#include <Library/UefiRuntimeServicesTableLib.h>
> #include <Library/RedfishEventLib.h>
> #include <Library/RedfishFeatureUtilityLib.h>
>
> diff --git
> a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
> index ddcf991006..c67525eedd 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
> @@ -4,6 +4,8 @@
> # drivers for the registration.
> #
> # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR>
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> #
> ##
> @@ -40,6 +42,7 @@
> RedfishFeatureUtilityLib
> UefiBootServicesTableLib
> UefiDriverEntryPoint
> + UefiRuntimeServicesTableLib
> UefiLib
>
> [Protocols]
> @@ -47,6 +50,8 @@
>
> [Pcd]
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupE
> ventGuid
> + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
> + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout
>
> [Depex]
> TRUE
> --
> 2.39.2.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-01 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-01 13:15 [edk2-staging][PATCH v2 1/1] RedfishClientPkg: Add mechanism to reboot system if config is changed Nickle Wang
2023-03-01 13:25 ` Chang, Abner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox