* [edk2-redfish-client][PATCH v2 3/3] RedfishClientPkg: Utilize RedfishAddendumLib
@ 2023-05-15 7:38 Nickle Wang
0 siblings, 0 replies; only message in thread
From: Nickle Wang @ 2023-05-15 7:38 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy
Bios feature driver utilizes RedfishAddendumLib and get additional data
before sending BIOS attributes to Redfish service.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
.../Features/Bios/v1_0_9/Dxe/BiosDxe.inf | 2 +
.../Include/RedfishResourceCommon.h | 2 +
.../Features/Bios/v1_0_9/Common/BiosCommon.c | 100 ++++++++++++++++++
3 files changed, 104 insertions(+)
diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf
index 8c01a3b8..37346e50 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) 2023, 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 c270f92b..b006755d 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) 2023, 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
diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 22074559..c7c77a02 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) 2023, 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;
@@ -401,6 +436,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;
@@ -562,6 +630,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
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-15 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15 7:38 [edk2-redfish-client][PATCH v2 3/3] RedfishClientPkg: Utilize RedfishAddendumLib Nickle Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox