From: "Nickle Wang" <nicklew@nvidia.com>
To: <devel@edk2.groups.io>
Cc: Abner Chang <abner.chang@amd.com>, Igor Kulchytskyy <igork@ami.com>
Subject: [edk2-redfish-client][PATCH 3/3] RedfishClientPkg: Utilize RedfishAddendumLib
Date: Fri, 12 May 2023 15:23:08 +0800 [thread overview]
Message-ID: <20230512072308.17977-1-nicklew@nvidia.com> (raw)
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
reply other threads:[~2023-05-12 7:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230512072308.17977-1-nicklew@nvidia.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox