Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_5_0 driver

2024-01-25 Thread Nickle Wang via groups.io


Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Friday, January 26, 2024 10:29 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang ; Igor Kulchytskyy 
> Subject: [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver:
> ComputerSystem_1_5_0 driver
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Update Redfish ComputerSystem_1_5_0 feature driver to align the
> implementation with latest code. This driver handles all of ComputerSystem
> v1_5_0 properties and incorporate with Redfish simualtor.
> 
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../v1_5_0/Dxe/ComputerSystemDxe.inf  |   1 +
>  .../v1_5_0/Common/ComputerSystemCommon.c  | 347 --
>  .../v1_5_0/Dxe/ComputerSystemDxe.c|  64 ++--
>  3 files changed, 271 insertions(+), 141 deletions(-)
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.inf
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.inf
> index 36cbe06211..4e7dc5c7c5 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.inf
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystem
> +++ Dxe.inf
> @@ -37,6 +37,7 @@
>RedfishResourceIdentifyLib
>UefiLib
>UefiDriverEntryPoint
> +  RedfishAddendumLib
>RedfishHttpCacheLib
> 
>  [Protocols]
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> index 3ace03bd4c..a67ef3dac2 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSyste
> mCommon.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSys
> +++ temCommon.c
> @@ -53,7 +53,7 @@ RedfishConsumeResourceCommon (
>(EFI_REST_JSON_STRUCTURE_HEADER
> **)
>);
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, 
> Status));
> +DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__,
> + Status));
>  return Status;
>}
> 
> @@ -66,8 +66,8 @@ RedfishConsumeResourceCommon (
>  //
>  // No change
>  //
> -DEBUG ((DEBUG_MANAGEABILITY, "%a, ETAG: %s has no change, ignore
> consume action\n", __func__, Private->Uri));
> -Status = EFI_ALREADY_STARTED;
> +DEBUG ((DEBUG_MANAGEABILITY, "%a: ETAG: %s has no change, ignore
> consume action\n", __func__, Private->Uri));
> +Status = EFI_SUCCESS;
>  goto ON_RELEASE;
>}
> 
> @@ -154,12 +154,12 @@ RedfishConsumeResourceCommon (
>  if (ConfigureLang != NULL) {
>Status = ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA,
> RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot-
> >BootOrder);
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
> __func__,
> ConfigureLang, Status));
> +DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n",
> + __func__, ConfigureLang, Status));
>}
> 
>FreePool (ConfigureLang);
>  } else {
> -  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: 
> %s\n",
> __func__, Private->Uri));
> +  DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI:
> + %s\n", __func__, Private->Uri));
>  }
>}
> 
> @@ -174,12 +174,12 @@ RedfishConsumeResourceCommon (
>  if (ConfigureLang != NULL) {
>Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA,
> RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot-
> >BootSourceOverrideEnabled);
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
> __func__,
> ConfigureLang, Status));
> +DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n",
> + __func__, ConfigureLang, Status));
>}
> 
>FreePool (ConfigureLang);
>  } else {
> -  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: 
> %s\n",
> __func__, Private->Uri));
> +  DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI:
> + %s\n", __func__, Private->Uri));
>  }
>}
> 
> @@ -194,12 +194,12 @@ RedfishConsumeResourceCommon (
>  if (ConfigureLang != NULL) {
>Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA,
> RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot-
> >BootSourceOverrideMode);
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
> __func__,
> ConfigureLang, Status));
> +DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n",
> + __func__, ConfigureLang, Status));
>}
> 
>FreePool (ConfigureLang);
>  } else {
> -  DEBUG ((DEBUG_ERROR, "%a, can 

[edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_5_0 driver

2024-01-25 Thread Chang, Abner via groups.io
From: Abner Chang 

Update Redfish ComputerSystem_1_5_0 feature
driver to align the implementation with latest
code. This driver handles all of ComputerSystem
v1_5_0 properties and incorporate with Redfish simualtor.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../v1_5_0/Dxe/ComputerSystemDxe.inf  |   1 +
 .../v1_5_0/Common/ComputerSystemCommon.c  | 347 --
 .../v1_5_0/Dxe/ComputerSystemDxe.c|  64 ++--
 3 files changed, 271 insertions(+), 141 deletions(-)

diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.inf 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.inf
index 36cbe06211..4e7dc5c7c5 100644
--- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.inf
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.inf
@@ -37,6 +37,7 @@
   RedfishResourceIdentifyLib
   UefiLib
   UefiDriverEntryPoint
+  RedfishAddendumLib
   RedfishHttpCacheLib
 
 [Protocols]
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index 3ace03bd4c..a67ef3dac2 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -53,7 +53,7 @@ RedfishConsumeResourceCommon (
   (EFI_REST_JSON_STRUCTURE_HEADER 
**)
   );
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Status));
+DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, Status));
 return Status;
   }
 
@@ -66,8 +66,8 @@ RedfishConsumeResourceCommon (
 //
 // No change
 //
-DEBUG ((DEBUG_MANAGEABILITY, "%a, ETAG: %s has no change, ignore consume 
action\n", __func__, Private->Uri));
-Status = EFI_ALREADY_STARTED;
+DEBUG ((DEBUG_MANAGEABILITY, "%a: ETAG: %s has no change, ignore consume 
action\n", __func__, Private->Uri));
+Status = EFI_SUCCESS;
 goto ON_RELEASE;
   }
 
@@ -154,12 +154,12 @@ RedfishConsumeResourceCommon (
 if (ConfigureLang != NULL) {
   Status = ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootOrder);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
+DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
   }
 
   FreePool (ConfigureLang);
 } else {
-  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s\n", 
__func__, Private->Uri));
+  DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s\n", 
__func__, Private->Uri));
 }
   }
 
@@ -174,12 +174,12 @@ RedfishConsumeResourceCommon (
 if (ConfigureLang != NULL) {
   Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, ConfigureLang, 
ComputerSystemCs->Boot->BootSourceOverrideEnabled);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
+DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
   }
 
   FreePool (ConfigureLang);
 } else {
-  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s\n", 
__func__, Private->Uri));
+  DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s\n", 
__func__, Private->Uri));
 }
   }
 
@@ -194,12 +194,12 @@ RedfishConsumeResourceCommon (
 if (ConfigureLang != NULL) {
   Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, ConfigureLang, 
ComputerSystemCs->Boot->BootSourceOverrideMode);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
+DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
   }
 
   FreePool (ConfigureLang);
 } else {
-  DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s\n", 
__func__, Private->Uri));
+  DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s\n", 
__func__, Private->Uri));
 }
   }
 
@@ -234,12 +234,12 @@ RedfishConsumeResourceCommon (
 if (ConfigureLang != NULL) {
   Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, ConfigureLang, 
ComputerSystemCs->Boot->UefiTargetBootSourceOverride);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", 
__func__, ConfigureLang, Status));
+DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n",