public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/RedfishFeatureUtilityLib: fix issues and enhancement
@ 2023-10-31  7:45 Nickle Wang via groups.io
  2023-11-01 13:42 ` Chang, Abner via groups.io
  0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang via groups.io @ 2023-10-31  7:45 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez

-Add RedfishDebugLib to print Redfish request and response
details when PATCH and POST request return error.
-Use "%a:" in debug print to align with the style in EDK2.
-Enhance GetConfigureLang() to handle pending resource URI.
Pending resource share ths same schema as its active resource.
So we can simply remove "/Settings" from URI and search again.
-Enhancement to GetPropertyVagueValue(). This function stops
to handle remaining property while error happens. We like to
process as much as properties as we can and skip the problematic
property.
-Enhancement to MatchPropertyWithJsonContext(). For string type
of BIOS attribute, it is possible that the attribute value is
empty by default. This does not means that the resource is not
provisioned yet.
-Fix typo.

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>
---
 RedfishClientPkg/RedfishClientLibs.dsc.inc    |   1 +
 .../RedfishFeatureUtilityLib.inf              |   1 +
 .../RedfishFeatureUtilityInternal.h           |   2 +
 .../RedfishFeatureUtilityLib.c                | 272 ++++++++++--------
 4 files changed, 154 insertions(+), 122 deletions(-)

diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc b/RedfishClientPkg/RedfishClientLibs.dsc.inc
index 5ea38015..5eae6711 100644
--- a/RedfishClientPkg/RedfishClientLibs.dsc.inc
+++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc
@@ -39,3 +39,4 @@
   RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
   RedfishVersionLib|RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf
   RedfishAddendumLib|RedfishClientPkg/Library/RedfishAddendumLib/RedfishAddendumLib.inf
+  RedfishDebugLib|RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
index 66d5dce6..fd66b8ac 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
@@ -45,6 +45,7 @@
   UefiRuntimeServicesTableLib
   PrintLib
   HttpLib
+  RedfishDebugLib
 
 [Protocols]
   gEdkIIRedfishETagProtocolGuid           ## CONSUMED ##
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h
index d2bd6507..5d39984c 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h
@@ -2,6 +2,7 @@
   Common header file for RedfishFeatureUtilityLib driver.
 
   (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
 
@@ -28,6 +29,7 @@
 #include <Library/UefiLib.h>
 #include <Library/PrintLib.h>
 #include <Library/HttpLib.h>
+#include <Library/RedfishDebugLib.h>
 
 #include <Guid/VariableFormat.h>
 
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index e1899878..13e29902 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -133,7 +133,7 @@ SetEtagWithUri (
 
   Status = RedfishLocateProtocol ((VOID **)&mEtagProtocol, &gEdkIIRedfishETagProtocolGuid);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, fail to locate gEdkIIRedfishETagProtocolGuid: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: fail to locate gEdkIIRedfishETagProtocolGuid: %r\n", __func__, Status));
     return Status;
   }
 
@@ -175,7 +175,7 @@ GetEtagWithUri (
 
   Status = RedfishLocateProtocol ((VOID **)&mEtagProtocol, &gEdkIIRedfishETagProtocolGuid);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, fail to locate gEdkIIRedfishETagProtocolGuid: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: fail to locate gEdkIIRedfishETagProtocolGuid: %r\n", __func__, Status));
     return NULL;
   }
 
@@ -306,10 +306,10 @@ ApplyFeatureSettingsStringType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
   } else {
     if (RedfishValue.Type != RedfishValueTypeString) {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __func__, Schema, Version, ConfigureLang));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string type\n", __func__, Schema, Version, ConfigureLang));
       return EFI_DEVICE_ERROR;
     }
 
@@ -317,7 +317,7 @@ ApplyFeatureSettingsStringType (
       //
       // Apply settings from redfish
       //
-      DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s from %a to %a\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Buffer, FeatureValue));
+      DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s from %a to %a\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Buffer, FeatureValue));
 
       FreePool (RedfishValue.Value.Buffer);
       RedfishValue.Value.Buffer = FeatureValue;
@@ -329,10 +329,10 @@ ApplyFeatureSettingsStringType (
         //
         REDFISH_ENABLE_SYSTEM_REBOOT ();
       } else {
-        DEBUG ((DEBUG_ERROR, "%a, apply %s to %s failed: %r\n", __func__, ConfigureLang, FeatureValue, Status));
+        DEBUG ((DEBUG_ERROR, "%a: apply %s to %s failed: %r\n", __func__, ConfigureLang, FeatureValue, Status));
       }
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Buffer));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Buffer));
     }
   }
 
@@ -341,7 +341,7 @@ ApplyFeatureSettingsStringType (
 
 /**
 
-  Apply property value to UEFI HII database in numric type.
+  Apply property value to UEFI HII database in numeric type.
 
   @param[in]  Schema        Property schema.
   @param[in]  Version       Property schema version.
@@ -372,10 +372,10 @@ ApplyFeatureSettingsNumericType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
   } else {
     if (RedfishValue.Type != RedfishValueTypeInteger) {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __func__, Schema, Version, ConfigureLang));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not numeric type\n", __func__, Schema, Version, ConfigureLang));
       return EFI_DEVICE_ERROR;
     }
 
@@ -383,7 +383,7 @@ ApplyFeatureSettingsNumericType (
       //
       // Apply settings from redfish
       //
-      DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s from 0x%x to 0x%x\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Integer, FeatureValue));
+      DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s from 0x%x to 0x%x\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Integer, FeatureValue));
 
       RedfishValue.Value.Integer = (INT64)FeatureValue;
 
@@ -394,10 +394,10 @@ ApplyFeatureSettingsNumericType (
         //
         REDFISH_ENABLE_SYSTEM_REBOOT ();
       } else {
-        DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __func__, ConfigureLang, FeatureValue, Status));
+        DEBUG ((DEBUG_ERROR, "%a: apply %s to 0x%x failed: %r\n", __func__, ConfigureLang, FeatureValue, Status));
       }
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is: 0x%x\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Integer, Status));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is: 0x%x\n", __func__, Schema, Version, ConfigureLang, RedfishValue.Value.Integer));
     }
   }
 
@@ -437,10 +437,10 @@ ApplyFeatureSettingsBooleanType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
   } else {
     if (RedfishValue.Type != RedfishValueTypeBoolean) {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __func__, Schema, Version, ConfigureLang));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not boolean type\n", __func__, Schema, Version, ConfigureLang));
       return EFI_DEVICE_ERROR;
     }
 
@@ -448,7 +448,7 @@ ApplyFeatureSettingsBooleanType (
       //
       // Apply settings from redfish
       //
-      DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s from %a to %a\n", __func__, Schema, Version, ConfigureLang, (RedfishValue.Value.Boolean ? "True" : "False"), (FeatureValue ? "True" : "False")));
+      DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s from %a to %a\n", __func__, Schema, Version, ConfigureLang, (RedfishValue.Value.Boolean ? "True" : "False"), (FeatureValue ? "True" : "False")));
 
       RedfishValue.Value.Boolean = FeatureValue;
 
@@ -459,10 +459,10 @@ ApplyFeatureSettingsBooleanType (
         //
         REDFISH_ENABLE_SYSTEM_REBOOT ();
       } else {
-        DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __func__, ConfigureLang, (FeatureValue ? "True" : "False"), Status));
+        DEBUG ((DEBUG_ERROR, "%a: apply %s to %a failed: %r\n", __func__, ConfigureLang, (FeatureValue ? "True" : "False"), Status));
       }
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureLang, (RedfishValue.Value.Boolean ? "True" : "False")));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureLang, (RedfishValue.Value.Boolean ? "True" : "False")));
     }
   }
 
@@ -508,13 +508,13 @@ ApplyFeatureSettingsVagueType (
   ConfigureLangAscii = AllocatePool (StrLen (ConfigureLang) + 1);
   if (ConfigureLangAscii == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
-    DEBUG ((DEBUG_ERROR, "%a, Allocate memory for generate ConfigureLang of vague key of %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: Allocate memory for generate ConfigureLang of vague key of %a.%a %s failed: %r\n", __func__, 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", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: Convert the configureLang of vague key of %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
     FreePool (ConfigureLangAscii);
     return Status;
   }
@@ -529,7 +529,7 @@ ApplyFeatureSettingsVagueType (
     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", __func__, Schema, Version, ConfigureLang, CurrentVagueValuePtr->KeyNamePtr));
+      DEBUG ((DEBUG_ERROR, "%a: Generate ConfigureLang of vague key of %a.%a %s %a failed!\n", __func__, Schema, Version, ConfigureLang, CurrentVagueValuePtr->KeyNamePtr));
       goto ErrorContinue;
     }
 
@@ -549,7 +549,7 @@ ApplyFeatureSettingsVagueType (
     } else if (CurrentVagueValuePtr->Value->DataType == RedfishCS_Vague_DataType_Int64) {
       PropertyDatatype = RedfishValueTypeInteger;
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __func__, Schema, Version, ConfigureLang));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s Unsupported Redfish property data type\n", __func__, Schema, Version, ConfigureLang));
       goto ErrorContinue;
     }
 
@@ -558,10 +558,10 @@ ApplyFeatureSettingsVagueType (
     //
     Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureKeyLang, &RedfishValue);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureKeyLang, Status));
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureKeyLang, Status));
     } else {
       if (RedfishValue.Type != PropertyDatatype) {
-        DEBUG ((DEBUG_ERROR, "%a, %a.%a %s mismatched data type\n", __func__, Schema, Version, ConfigureKeyLang));
+        DEBUG ((DEBUG_ERROR, "%a: %a.%a %s mismatched data type\n", __func__, Schema, Version, ConfigureKeyLang));
         goto ErrorContinue;
       }
 
@@ -573,7 +573,7 @@ ApplyFeatureSettingsVagueType (
           //
           // Apply settings from redfish
           //
-          DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s from %a to %a\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Buffer, CurrentVagueValuePtr->Value->DataValue.CharPtr));
+          DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s from %a to %a\n", __func__, 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);
@@ -583,10 +583,10 @@ ApplyFeatureSettingsVagueType (
             //
             REDFISH_ENABLE_SYSTEM_REBOOT ();
           } else {
-            DEBUG ((DEBUG_ERROR, "%a, apply %a to %a failed: %r\n", __func__, ConfigureKeyLang, CurrentVagueValuePtr->Value->DataValue.CharPtr, Status));
+            DEBUG ((DEBUG_ERROR, "%a: apply %a to %a failed: %r\n", __func__, ConfigureKeyLang, CurrentVagueValuePtr->Value->DataValue.CharPtr, Status));
           }
         } else {
-          DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Buffer));
+          DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Buffer));
         }
       } else if (PropertyDatatype == RedfishValueTypeBoolean) {
         //
@@ -598,7 +598,7 @@ ApplyFeatureSettingsVagueType (
           //
           DEBUG ((
             DEBUG_MANAGEABILITY,
-            "%a, %a.%a apply %s from %a to %a\n",
+            "%a: %a.%a apply %s from %a to %a\n",
             __func__,
             Schema,
             Version,
@@ -615,10 +615,10 @@ ApplyFeatureSettingsVagueType (
             //
             REDFISH_ENABLE_SYSTEM_REBOOT ();
           } else {
-            DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __func__, ConfigureKeyLang, (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" : "False"), Status));
+            DEBUG ((DEBUG_ERROR, "%a: apply %s to %a failed: %r\n", __func__, ConfigureKeyLang, (*CurrentVagueValuePtr->Value->DataValue.BoolPtr ? "True" : "False"), Status));
           }
         } else {
-          DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureKeyLang, (RedfishValue.Value.Boolean ? "True" : "False")));
+          DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a %s value is: %a\n", __func__, Schema, Version, ConfigureKeyLang, (RedfishValue.Value.Boolean ? "True" : "False")));
         }
       } else if (PropertyDatatype == RedfishValueTypeInteger) {
         //
@@ -628,7 +628,7 @@ ApplyFeatureSettingsVagueType (
           //
           // Apply settings from redfish
           //
-          DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s from 0x%x to 0x%x\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr));
+          DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s from 0x%x to 0x%x\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr));
 
           RedfishValue.Value.Integer = (INT64)*CurrentVagueValuePtr->Value->DataValue.Int64Ptr;
           Status                     = RedfishPlatformConfigSetValue (Schema, Version, ConfigureKeyLang, RedfishValue);
@@ -638,13 +638,13 @@ ApplyFeatureSettingsVagueType (
             //
             REDFISH_ENABLE_SYSTEM_REBOOT ();
           } else {
-            DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __func__, ConfigureKeyLang, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr, Status));
+            DEBUG ((DEBUG_ERROR, "%a: apply %s to 0x%x failed: %r\n", __func__, ConfigureKeyLang, *CurrentVagueValuePtr->Value->DataValue.Int64Ptr, Status));
           }
         } else {
-          DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a %s value is: 0x%x\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer));
+          DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a %s value is: 0x%x\n", __func__, Schema, Version, ConfigureKeyLang, RedfishValue.Value.Integer));
         }
       } else {
-        DEBUG ((DEBUG_ERROR, "%a, %a.%a %s Unsupported Redfish property data type\n", __func__, Schema, Version, ConfigureLang));
+        DEBUG ((DEBUG_ERROR, "%a: %a.%a %s Unsupported Redfish property data type\n", __func__, Schema, Version, ConfigureLang));
         goto ErrorContinue;
       }
     }
@@ -762,12 +762,12 @@ ApplyFeatureSettingsStringArrayType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
     return Status;
   }
 
   if (RedfishValue.Type != RedfishValueTypeStringArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return EFI_DEVICE_ERROR;
   }
 
@@ -778,7 +778,7 @@ ApplyFeatureSettingsStringArrayType (
     //
     // Apply settings from redfish
     //
-    DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
     FreeArrayTypeRedfishValue (&RedfishValue);
 
     //
@@ -823,10 +823,10 @@ ApplyFeatureSettingsStringArrayType (
       //
       REDFISH_ENABLE_SYSTEM_REBOOT ();
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __func__, ConfigureLang, Status));
+      DEBUG ((DEBUG_ERROR, "%a: apply %s array failed: %r\n", __func__, ConfigureLang, Status));
     }
   } else {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
   }
 
   for (Index = 0; Index < RedfishValue.ArrayCount; Index++) {
@@ -873,12 +873,12 @@ ApplyFeatureSettingsNumericArrayType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
     return Status;
   }
 
   if (RedfishValue.Type != RedfishValueTypeIntegerArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return EFI_DEVICE_ERROR;
   }
 
@@ -889,7 +889,7 @@ ApplyFeatureSettingsNumericArrayType (
     //
     // Apply settings from redfish
     //
-    DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
     FreeArrayTypeRedfishValue (&RedfishValue);
 
     //
@@ -928,10 +928,10 @@ ApplyFeatureSettingsNumericArrayType (
       //
       REDFISH_ENABLE_SYSTEM_REBOOT ();
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __func__, ConfigureLang, Status));
+      DEBUG ((DEBUG_ERROR, "%a: apply %s array failed: %r\n", __func__, ConfigureLang, Status));
     }
   } else {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
   }
 
   FreePool (RedfishValue.Value.IntegerArray);
@@ -946,7 +946,7 @@ ApplyFeatureSettingsNumericArrayType (
   @param[in]  Schema        Property schema.
   @param[in]  Version       Property schema version.
   @param[in]  ConfigureLang Configure language refers to this property.
-  @param[in]  ArrayHead     Head of Redfich CS boolean array value.
+  @param[in]  ArrayHead     Head of Redfish CS boolean array value.
 
   @retval     EFI_SUCCESS     New value is applied successfully.
   @retval     Others          Errors occur.
@@ -974,12 +974,12 @@ ApplyFeatureSettingsBooleanArrayType (
   //
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));
     return Status;
   }
 
   if (RedfishValue.Type != RedfishValueTypeBooleanArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return EFI_DEVICE_ERROR;
   }
 
@@ -990,7 +990,7 @@ ApplyFeatureSettingsBooleanArrayType (
     //
     // Apply settings from redfish
     //
-    DEBUG ((DEBUG_MANAGEABILITY, "%a, %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", __func__, Schema, Version, ConfigureLang));
     FreeArrayTypeRedfishValue (&RedfishValue);
 
     //
@@ -1029,10 +1029,10 @@ ApplyFeatureSettingsBooleanArrayType (
       //
       REDFISH_ENABLE_SYSTEM_REBOOT ();
     } else {
-      DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __func__, ConfigureLang, Status));
+      DEBUG ((DEBUG_ERROR, "%a: apply %s array failed: %r\n", __func__, ConfigureLang, Status));
     }
   } else {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has no change\n", __func__, Schema, Version, ConfigureLang));
   }
 
   FreePool (RedfishValue.Value.BooleanArray);
@@ -1044,7 +1044,7 @@ ApplyFeatureSettingsBooleanArrayType (
 
   Read redfish resource by given resource URI.
 
-  @param[in]  Service       Redfish srvice instacne to make query.
+  @param[in]  Service       Redfish service instance to make query.
   @param[in]  ResourceUri   Target resource URI.
   @param[out] Response      HTTP response from redfish service.
 
@@ -1080,7 +1080,7 @@ GetResourceByUri (
              Response
              );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, RedfishGetByUri to %a failed: %r\n", __func__, AsciiResourceUri, Status));
+    DEBUG ((DEBUG_ERROR, "%a: RedfishGetByUri to %a failed: %r\n", __func__, AsciiResourceUri, Status));
     if (Response->Payload != NULL) {
       RedfishDumpPayload (Response->Payload);
       RedfishFreeResponse (
@@ -1110,7 +1110,7 @@ GetResourceByUri (
   @param[out] ArraySignatureClose       String to the close of array signature.
 
   @retval     EFI_SUCCESS            Index is found.
-  @retval     EFI_NOT_FOUND          The non-array configure language string is retured.
+  @retval     EFI_NOT_FOUND          The non-array configure language string is returned.
   @retval     EFI_INVALID_PARAMETER  The format of input ConfigureLang is wrong.
   @retval     Others                 Errors occur.
 
@@ -1169,7 +1169,7 @@ IsRedpathArray (
 
 /**
 
-  Get number of node from the string. Node is seperated by '/'.
+  Get number of node from the string. Node is separated by '/'.
 
   @param[in]  NodeString             The node string to parse.
 
@@ -1207,10 +1207,10 @@ GetNumberOfRedpathNodes (
 
   @param[in]  NodeString             The node string to parse.
   @param[in]  Index                  Zero-based index of the node.
-  @param[out] EndOfNodePtr           Pointer to receive the poitner to
+  @param[out] EndOfNodePtr           Pointer to receive the pointer to
                                      the last character of node string.
 
-  @retval     EFI_STRING             the begining of the node string.
+  @retval     EFI_STRING             the beginning of the node string.
 
 **/
 EFI_STRING
@@ -1263,7 +1263,7 @@ GetRedpathNodeByIndex (
   @param[out] Index                 The array index number.
 
   @retval     EFI_SUCCESS            Index is found.
-  @retval     EFI_NOT_FOUND          The non-array configure language string is retured.
+  @retval     EFI_NOT_FOUND          The non-array configure language string is returned.
   @retval     EFI_INVALID_PARAMETER  The format of input ConfigureLang is wrong.
   @retval     Others                 Errors occur.
 
@@ -1303,7 +1303,7 @@ GetArrayIndexFromArrayTypeConfigureLang (
     *Index = StrDecimalToUintn (ArrayOpenStr + StrLen (BIOS_CONFIG_TO_REDFISH_REDPATH_ARRAY_START_SIGNATURE));
 
     //
-    // Resotre the '}' character and remove rest of string.
+    // Restore the '}' character and remove rest of string.
     //
     ArrayCloseStr[0]      = L'}';
     ArrayCloseStr[1]      = '\0';
@@ -1359,7 +1359,7 @@ CopyConfiglanguageList (
   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", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __func__));
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -1471,7 +1471,7 @@ DestroyConfiglanguageList (
 
   @param[in]  DestConfigLang        Pointer to the node's configure language string.
                                     The memory pointed by ConfigLang must be allocated
-                                    through memory allocation interface. Becasue we will replace
+                                    through memory allocation interface. Because we will replace
                                     the pointer in this function.
   @param[in]  MaxtLengthConfigLang  The maximum length of ConfigLang.
   @param[in]  ConfigLangInstance    Pointer to Collection member instance.
@@ -1518,7 +1518,7 @@ SetResourceConfigLangMemberInstance (
   if (MaxtLengthConfigLang < MaxStrLength) {
     NewConfigLang = (EFI_STRING)AllocateZeroPool (MaxStrLength);
     if (NewConfigLang == NULL) {
-      DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for NewConfigLang.\n", __func__));
+      DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for NewConfigLang.\n", __func__));
       return EFI_OUT_OF_RESOURCES;
     }
   }
@@ -1601,7 +1601,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
 
   Status = RedfishPlatformConfigGetConfigureLang (Schema, Version, Pattern, &ConfigureLangList, &Count);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, RedfishFeatureGetConfigureLangRegex failed: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: RedfishFeatureGetConfigureLangRegex failed: %r\n", __func__, Status));
     return Status;
   }
 
@@ -1815,6 +1815,13 @@ CreatePayloadToPatchResource (
   Status = RedfishPatchToPayload (TargetPayload, Payload, &PostResponse);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish service.\n", __func__, __LINE__));
+
+    DEBUG_CODE_BEGIN ();
+    DEBUG ((DEBUG_ERROR, "%a: Request:\n", __func__));
+    DumpRedfishPayload (DEBUG_ERROR, Payload);
+    DEBUG ((DEBUG_ERROR, "%a: Response:\n", __func__));
+    DumpRedfishResponse (__func__, DEBUG_ERROR, &PostResponse);
+    DEBUG_CODE_END ();
     goto EXIT_FREE_JSON_VALUE;
   }
 
@@ -1886,12 +1893,20 @@ 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", __func__, __LINE__));
+    DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST payload to Redfish service.\n", __func__, __LINE__));
+
+    DEBUG_CODE_BEGIN ();
+    DEBUG ((DEBUG_ERROR, "%a: Request:\n", __func__));
+    DumpRedfishPayload (DEBUG_ERROR, Payload);
+    DEBUG ((DEBUG_ERROR, "%a: Response:\n", __func__));
+    DumpRedfishResponse (__func__, DEBUG_ERROR, &PostResponse);
+    DEBUG_CODE_END ();
+
     goto EXIT_FREE_JSON_VALUE;
   }
 
   //
-  // per Redfish spec. the URL of new eresource will be returned in "Location" header.
+  // per Redfish spec. the URL of new resource will be returned in "Location" header.
   //
   Status = GetEtagAndLocation (&PostResponse, Etag, Location);
   if (EFI_ERROR (Status)) {
@@ -1941,11 +1956,11 @@ RedfishGetUri (
 
   Status = RedfishLocateProtocol ((VOID **)&mConfigLangMapProtocol, &gEdkIIRedfishConfigLangMapProtocolGuid);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
     return NULL;
   }
 
-  DEBUG ((REDFISH_DEBUG_TRACE, "%a, Get: %s\n", __func__, ConfigLang));
+  DEBUG ((REDFISH_DEBUG_TRACE, "%a: Get: %s\n", __func__, ConfigLang));
 
   CloseBracket = StrStr (ConfigLang, L"{");
   if (CloseBracket == NULL) {
@@ -1986,7 +2001,7 @@ RedfishGetUri (
     // Invalid format. No '}' found
     //
     if (*Target == '\0') {
-      DEBUG ((DEBUG_ERROR, "%a, invalid format: %s\n", __func__, ConfigLang));
+      DEBUG ((DEBUG_ERROR, "%a: invalid format: %s\n", __func__, ConfigLang));
       FreePool (ResultStr);
       return NULL;
     }
@@ -2012,13 +2027,13 @@ RedfishGetUri (
                                        &Found
                                        );
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a, Can not find: %s\n", __func__, TempStr));
+      DEBUG ((DEBUG_ERROR, "%a: Can not find: %s\n", __func__, TempStr));
       FreePool (ResultStr);
       FreePool (TempStr);
       return NULL;
     }
 
-    DEBUG ((REDFISH_DEBUG_TRACE, "%a, Found: %s\n", __func__, Found));
+    DEBUG ((REDFISH_DEBUG_TRACE, "%a: Found: %s\n", __func__, Found));
 
     //
     // Keep result in final string pool
@@ -2040,7 +2055,7 @@ RedfishGetUri (
     StrCatS (ResultStr, MAX_REDFISH_URL_LEN, Head);
   }
 
-  DEBUG ((REDFISH_DEBUG_TRACE, "%a, return: %s\n", __func__, ResultStr));
+  DEBUG ((REDFISH_DEBUG_TRACE, "%a: return: %s\n", __func__, ResultStr));
 
   return ResultStr;
 }
@@ -2067,11 +2082,11 @@ RedfishGetConfigLanguage (
     return NULL;
   }
 
-  DEBUG ((REDFISH_DEBUG_TRACE, "%a, search config lang for URI: %s\n", __func__, Uri));
+  DEBUG ((REDFISH_DEBUG_TRACE, "%a: search config lang for URI: %s\n", __func__, Uri));
 
   Status = RedfishLocateProtocol ((VOID **)&mConfigLangMapProtocol, &gEdkIIRedfishConfigLangMapProtocolGuid);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
     return NULL;
   }
 
@@ -2088,7 +2103,7 @@ RedfishGetConfigLanguage (
 
 /**
 
-  Return config language from given URI and prperty name. It's call responsibility to release returned buffer.
+  Return config language from given URI and property name. It's call responsibility to release returned buffer.
 
   @param[in] Uri            The URI to match
   @param[in] PropertyName   The property name of resource. This is optional.
@@ -2108,6 +2123,7 @@ GetConfigureLang (
   EFI_STRING  ResultStr;
   EFI_STRING  UnicodeUri;
   EFI_STATUS  Status;
+  EFI_STRING  StrFound;
 
   if (IS_EMPTY_STRING (Uri)) {
     return NULL;
@@ -2126,6 +2142,18 @@ GetConfigureLang (
   }
 
   ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
+  if (ConfigLang == NULL) {
+    //
+    // @Redfish.Settings share the same schema as its parent.
+    // Remove "Settings" and try again.
+    //
+    StrFound = StrStr (UnicodeUri, L"/Settings");
+    if (StrFound != NULL) {
+      StrFound[0] = L'\0';
+      DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI, try: %s\n", __func__, UnicodeUri));
+      ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
+    }
+  }
 
   FreePool (UnicodeUri);
 
@@ -2158,7 +2186,7 @@ GetConfigureLang (
   @param[in]    ConfigLang        ConfigLang to save
   @param[in]    Uri               Redfish Uri to save
 
-  @retval  EFI_INVALID_PARAMETR   SystemId is NULL or EMPTY
+  @retval  EFI_INVALID_PARAMETER  SystemId is NULL or EMPTY
   @retval  EFI_SUCCESS            Redfish uri is saved
 
 **/
@@ -2176,11 +2204,11 @@ RedfisSetRedfishUri (
 
   Status = RedfishLocateProtocol ((VOID **)&mConfigLangMapProtocol, &gEdkIIRedfishConfigLangMapProtocolGuid);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: fail to locate gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
     return Status;
   }
 
-  DEBUG ((REDFISH_DEBUG_TRACE, "%a, Saved: %s -> %s\n", __func__, ConfigLang, Uri));
+  DEBUG ((REDFISH_DEBUG_TRACE, "%a: Saved: %s -> %s\n", __func__, ConfigLang, Uri));
 
   return mConfigLangMapProtocol->Set (mConfigLangMapProtocol, ConfigLang, Uri);
 }
@@ -2228,7 +2256,7 @@ GetOdataId (
 
 /**
 
-  Get the property name by given Configure Langauge.
+  Get the property name by given Configure Language.
 
   @param[in]  ResourceUri              URI of root of resource.
   @param[in]  ConfigureLang            Configure Language string.
@@ -2261,7 +2289,7 @@ GetPropertyFromConfigureLang (
   }
 
   //
-  // The ConigLang has no '{}'
+  // The ConfigLang has no '{}'
   //
   if (GetNumberOfRedpathNodes (ConfigureLang) == 1) {
     return NULL;
@@ -2321,7 +2349,7 @@ GetPropertyStringValue (
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2329,7 +2357,7 @@ GetPropertyStringValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeString) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
@@ -2382,7 +2410,7 @@ GetPropertyNumericValue (
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2390,7 +2418,7 @@ GetPropertyNumericValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeInteger) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not numeric type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
@@ -2447,7 +2475,7 @@ GetPropertyBooleanValue (
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2455,7 +2483,7 @@ GetPropertyBooleanValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeBoolean) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not boolean type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
@@ -2544,14 +2572,14 @@ GetPropertyStringArrayValue (
   BufferSize          = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
   ConfigureLangBuffer = AllocatePool (BufferSize);
   if (ConfigureLangBuffer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2559,13 +2587,13 @@ GetPropertyStringArrayValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeStringArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
   StringArray = AllocatePool (sizeof (CHAR8 *) * RedfishValue.ArrayCount);
   if (StringArray == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
@@ -2618,14 +2646,14 @@ GetPropertyNumericArrayValue (
   BufferSize          = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
   ConfigureLangBuffer = AllocatePool (BufferSize);
   if (ConfigureLangBuffer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2633,13 +2661,13 @@ GetPropertyNumericArrayValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeIntegerArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
   IntegerArray = AllocatePool (sizeof (INT64) * RedfishValue.ArrayCount);
   if (IntegerArray == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
@@ -2692,14 +2720,14 @@ GetPropertyBooleanArrayValue (
   BufferSize          = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
   ConfigureLangBuffer = AllocatePool (BufferSize);
   if (ConfigureLangBuffer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
   UnicodeSPrint (ConfigureLangBuffer, BufferSize, L"%s/%s", ConfigureLang, PropertyName);
   Status = RedfishPlatformConfigGetValue (Schema, Version, ConfigureLangBuffer, &RedfishValue);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2707,13 +2735,13 @@ GetPropertyBooleanArrayValue (
   FreePool (ConfigureLangBuffer);
 
   if (RedfishValue.Type != RedfishValueTypeBooleanArray) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a %s value is not string array type\n", __func__, Schema, Version, ConfigureLang));
     return NULL;
   }
 
   BooleanArray = AllocatePool (sizeof (INT64) * RedfishValue.ArrayCount);
   if (BooleanArray == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, out of resource\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: out of resource\n", __func__));
     return NULL;
   }
 
@@ -2784,19 +2812,19 @@ NewEmptyPropKeyValueFromRedfishValue (
 
   KeyNameChar = StrUnicodeToAscii (KeyName);
   if (KeyNameChar == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, Failed to convert unicode to ASCII.\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Failed to convert unicode to ASCII.\n", __func__));
     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", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Failed to allocate memory for EmptyPropKeyValue\n", __func__));
     return NULL;
   }
 
   VagueValue = (RedfishCS_Vague *)AllocateZeroPool (sizeof (RedfishCS_Vague));
   if (VagueValue == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for VagueValue\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Failed to allocate memory for VagueValue\n", __func__));
     FreePool (EmptyPropKeyValue);
     return NULL;
   }
@@ -2805,7 +2833,7 @@ NewEmptyPropKeyValueFromRedfishValue (
     VagueValue->DataType = RedfishCS_Vague_DataType_Bool;
     DataSize             = sizeof (BOOLEAN);
     //
-    // Redfish JSON to C strcuture converter uses
+    // Redfish JSON to C structure converter uses
     // "int" for the BOOLEAN.
     //
     Bool32 = (INT32)RedfishValue->Value.Boolean;
@@ -2819,7 +2847,7 @@ NewEmptyPropKeyValueFromRedfishValue (
     DataSize             = AsciiStrSize (RedfishValue->Value.Buffer);
     Data                 = (VOID *)RedfishValue->Value.Buffer;
   } else {
-    DEBUG ((DEBUG_ERROR, "%a, wrong type of RedfishValue: %x\n", __func__, RedfishValue->Type));
+    DEBUG ((DEBUG_ERROR, "%a: wrong type of RedfishValue: %x\n", __func__, RedfishValue->Type));
     FreePool (VagueValue);
     FreePool (EmptyPropKeyValue);
     return NULL;
@@ -2866,18 +2894,21 @@ GetPropertyVagueValue (
   UINTN                         BufferSize;
   UINTN                         ConfigListCount;
   UINTN                         ConfigListCountIndex;
+  UINTN                         ListCount;
 
   if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING (ConfigureLang) || IS_EMPTY_STRING (PropertyName)) {
     return NULL;
   }
 
+  ListCount                  = 0;
+  FirstEmptyPropKeyValueList = 0;
   //
   // Configure Language buffer.
   //
   BufferSize          = sizeof (CHAR16) * MAX_CONF_LANG_LEN;
   ConfigureLangBuffer = AllocatePool (BufferSize);
   if (ConfigureLangBuffer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a, Failed to allocate memory for ConfigureLangBuffer\n", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Failed to allocate memory for ConfigureLangBuffer\n", __func__));
     return NULL;
   }
 
@@ -2889,7 +2920,7 @@ GetPropertyVagueValue (
   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", __func__));
+    DEBUG ((DEBUG_ERROR, "%a: Failed to allocate memory for SearchPattern\n", __func__));
     FreePool (ConfigureLangBuffer);
     return NULL;
   }
@@ -2899,21 +2930,23 @@ GetPropertyVagueValue (
   StrCatS (SearchPattern, BufferSize, L"/.*");
   Status = RedfishPlatformConfigGetConfigureLang (Schema, Version, SearchPattern, &ConfigureLangList, &ConfigListCount);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, %a.%a Get configure language of vague type values of %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %a.%a Get configure language of vague type values of %s failed: %r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));
     goto ErrorLeave;
   }
 
   //
   // Build up the list of RedfishCS_EmptyProp_KeyValue.
   //
+  ListCount                  = 0;
   ConfigListCountIndex       = 0;
   PreEmptyPropKeyValueList   = NULL;
   FirstEmptyPropKeyValueList = NULL;
   while (ConfigListCountIndex < ConfigListCount) {
     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", __func__, Schema, Version, ConfigureLangList[ConfigListCountIndex], Status));
-      goto ErrorLeave;
+      DEBUG ((DEBUG_ERROR, "%a: %a.%a query current setting for %s failed: %r\n", __func__, Schema, Version, ConfigureLangList[ConfigListCountIndex], Status));
+      ConfigListCountIndex++;
+      continue;
     }
 
     //
@@ -2925,7 +2958,7 @@ GetPropertyVagueValue (
     //
     EmptyPropKeyValueList = NewEmptyPropKeyValueFromRedfishValue (KeyName, &RedfishValue);
     if (EmptyPropKeyValueList == NULL) {
-      DEBUG ((DEBUG_ERROR, "%a, Failed to create an entry of EmptyPropKeyValueList\n", __func__));
+      DEBUG ((DEBUG_ERROR, "%a: Failed to create an entry of EmptyPropKeyValueList\n", __func__));
       ConfigListCountIndex++;
       continue;
     }
@@ -2941,6 +2974,7 @@ GetPropertyVagueValue (
 
     PreEmptyPropKeyValueList = EmptyPropKeyValueList;
     ConfigListCountIndex++;
+    ListCount++;
   }
 
   goto LeaveFunction;
@@ -2963,7 +2997,7 @@ LeaveFunction:
 
   FreePool (ConfigureLangList);
 
-  *NumberOfValues = (UINT32)ConfigListCount;
+  *NumberOfValues = (UINT32)ListCount;
   return FirstEmptyPropKeyValueList;
 }
 
@@ -3030,7 +3064,7 @@ CheckEtag (
   EtagInDb = NULL;
   EtagInDb = GetEtagWithUri (Uri);
   if (EtagInDb == NULL) {
-    DEBUG ((REDFISH_DEBUG_TRACE, "%a, no ETAG record cound be found for: %s\n", __func__, Uri));
+    DEBUG ((REDFISH_DEBUG_TRACE, "%a: no ETAG record could be found for: %s\n", __func__, Uri));
     return FALSE;
   }
 
@@ -3173,12 +3207,6 @@ MatchPropertyWithJsonContext (
           MatchObj = NULL;
         }
 
-        break;
-      case EdkiiJsonTypeString:
-        if (IS_EMPTY_STRING (JsonValueGetString (MatchObj))) {
-          MatchObj = NULL;
-        }
-
         break;
       case EdkiiJsonTypeNull:
         MatchObj = NULL;
@@ -3195,7 +3223,7 @@ MatchPropertyWithJsonContext (
 
 /**
 
-  Create string array and append to arry node in Redfish JSON convert format.
+  Create string array and append to array node in Redfish JSON convert format.
 
   @param[in,out]  Head          The head of string array.
   @param[in]      StringArray   Input string array.
@@ -3246,7 +3274,7 @@ AddRedfishCharArray (
 
 /**
 
-  Create numeric array and append to arry node in Redfish JSON convert format.
+  Create numeric array and append to array node in Redfish JSON convert format.
 
   @param[in,out]  Head           The head of string array.
   @param[in]      NumericArray   Input numeric array.
@@ -3303,7 +3331,7 @@ AddRedfishNumericArray (
 
 /**
 
-  Create boolean array and append to arry node in Redfish JSON convert format.
+  Create boolean array and append to array node in Redfish JSON convert format.
 
   @param[in,out]  Head           The head of string array.
   @param[in]      BooleanArray   Input boolean array.
@@ -3409,7 +3437,7 @@ CompareRedfishStringArrayValues (
   Check and see if value in Redfish numeric array are all the same as the one
   from HII configuration.
 
-  @param[in]  Head          The head of Redfish CS numeraic array.
+  @param[in]  Head          The head of Redfish CS numeric array.
   @param[in]  NumericArray  Input numeric array.
   @param[in]  ArraySize     The size of NumericArray.
 
@@ -3502,9 +3530,9 @@ CompareRedfishBooleanArrayValues (
   This is just a simple check.
 
   @param[in]  RedfishVagueKeyValuePtr     The vague key value sets on Redfish service.
-  @param[in]  RedfishVagueKeyValueNumber  The numebr of vague key value sets
+  @param[in]  RedfishVagueKeyValueNumber  The number of vague key value sets
   @param[in]  ConfigVagueKeyValuePtr      The vague configuration on platform.
-  @param[in]  ConfigVagueKeyValueNumber   The numebr of vague key value sets
+  @param[in]  ConfigVagueKeyValueNumber   The number of vague key value sets
 
   @retval     TRUE          All values are the same.
               FALSE         There is some difference.
@@ -3599,7 +3627,7 @@ CompareRedfishPropertyVagueValues (
   @param[in] ImageHandle     The image handle.
   @param[in] SystemTable     The system table.
 
-  @retval  EFI_SUCEESS  Install Boot manager menu success.
+  @retval  EFI_SUCCESS  Install Boot manager menu success.
   @retval  Other        Return error status.
 
 **/
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110382): https://edk2.groups.io/g/devel/message/110382
Mute This Topic: https://groups.io/mt/102293054/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-01 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31  7:45 [edk2-devel] [edk2-redfish-client][PATCH 3/3] RedfishClientPkg/RedfishFeatureUtilityLib: fix issues and enhancement Nickle Wang via groups.io
2023-11-01 13:42 ` Chang, Abner via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox