Bios feature driver utilizes RedfishAddendumLib and get additional data
before sending BIOS attributes to Redfish service.

Signed-off-by: Nickle Wang <nick...@nvidia.com>
Cc: Abner Chang <abner.ch...@amd.com>
Cc: Igor Kulchytskyy <ig...@ami.com>
Cc: Nick Ramirez <nrami...@nvidia.com>
---
 .../Features/Bios/v1_0_9/Common/BiosCommon.c  | 100 ++++++++++++++++++
 .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf      |   2 +
 .../Include/RedfishResourceCommon.h           |   2 +
 3 files changed, 104 insertions(+)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index d910d0d8a9..72a5f51c5f 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -2,6 +2,7 @@
   Redfish feature driver implementation - common functions
 
   (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -265,6 +266,7 @@ ProvisioningBiosResource (
   )
 {
   CHAR8       *Json;
+  CHAR8       *JsonWithAddendum;
   EFI_STATUS  Status;
   EFI_STRING  NewResourceLocation;
   CHAR8       *EtagStr;
@@ -290,6 +292,38 @@ ProvisioningBiosResource (
     return Status;
   }
 
+  //
+  // Check and see if platform has OEM data or not
+  //
+  Status = RedfishGetOemData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
+  //
+  // Check and see if platform has addendum data or not
+  //
+  Status = RedfishGetAddendumData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
   Status = CreatePayloadToPostResource (Private->RedfishService, 
Private->Payload, Json, &NewResourceLocation, &EtagStr);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a, post Bios resource for %s failed: %r\n", 
__FUNCTION__, ConfigureLang, Status));
@@ -369,6 +403,7 @@ ProvisioningBiosExistResource (
   EFI_STRING ConfigureLang;
   CHAR8      *EtagStr;
   CHAR8      *Json;
+  CHAR8      *JsonWithAddendum;
 
   if (Private == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -400,6 +435,38 @@ ProvisioningBiosExistResource (
     goto ON_RELEASE;
   }
 
+  //
+  // Check and see if platform has OEM data or not
+  //
+  Status = RedfishGetOemData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
+  //
+  // Check and see if platform has addendum data or not
+  //
+  Status = RedfishGetAddendumData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
   DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for %s\n", 
__FUNCTION__, ConfigureLang));
   //
   // PUT back to instance
@@ -528,6 +595,7 @@ RedfishUpdateResourceCommon (
 {
   EFI_STATUS Status;
   CHAR8      *Json;
+  CHAR8      *JsonWithAddendum;
   EFI_STRING ConfigureLang;
   CHAR8      *EtagStr;
 
@@ -561,6 +629,38 @@ RedfishUpdateResourceCommon (
     goto ON_RELEASE;
   }
 
+  //
+  // Check and see if platform has OEM data or not
+  //
+  Status = RedfishGetOemData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
+  //
+  // Check and see if platform has addendum data or not
+  //
+  Status = RedfishGetAddendumData (
+             Private->Uri,
+             RESOURCE_SCHEMA,
+             RESOURCE_SCHEMA_VERSION,
+             Json,
+             &JsonWithAddendum
+             );
+  if (!EFI_ERROR (Status) && (JsonWithAddendum != NULL)) {
+    FreePool (Json);
+    Json             = JsonWithAddendum;
+    JsonWithAddendum = NULL;
+  }
+
   DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", __FUNCTION__, 
ConfigureLang));
   //
   // PUT back to instance
diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
index 8c01a3b877..3c3a4946b9 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
@@ -1,6 +1,7 @@
 ## @file
 #
 #  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+#  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -37,6 +38,7 @@
   RedfishResourceIdentifyLib
   UefiLib
   UefiDriverEntryPoint
+  RedfishAddendumLib
 
 [Protocols]
   gEdkIIRedfishConfigHandlerProtocolGuid          ## PRODUCED
diff --git a/RedfishClientPkg/Include/RedfishResourceCommon.h 
b/RedfishClientPkg/Include/RedfishResourceCommon.h
index af4b809121..ba42bb01c8 100644
--- a/RedfishClientPkg/Include/RedfishResourceCommon.h
+++ b/RedfishClientPkg/Include/RedfishResourceCommon.h
@@ -2,6 +2,7 @@
   Redfish feature driver common header file.
 
   (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -30,6 +31,7 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/RedfishResourceIdentifyLib.h>
 #include <Library/EdkIIRedfishResourceConfigLib.h>
+#include <Library/RedfishAddendumLib.h>
 
 //
 // Protocols
-- 
2.38.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97086): https://edk2.groups.io/g/devel/message/97086
Mute This Topic: https://groups.io/mt/95516370/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to