Introduce Redfish Resource Addendum Protocol to Redfish feature driver.
Feature driver uses this protocol to query OEM resource from platform in
order to support Redfish OEM property. This protocol is also used to get
addendum data that is required by BMC to manage Redfish BIOS service.

Signed-off-by: Nickle Wang <nick...@nvidia.com>
Cc: Abner Chang <abner.ch...@amd.com>
Cc: Igor Kulchytskyy <ig...@ami.com>
---
 RedfishClientPkg/RedfishClientPkg.dec         |  2 +
 .../EdkIIRedfishResourceAddendumProtocol.h    | 94 +++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 
RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceAddendumProtocol.h

diff --git a/RedfishClientPkg/RedfishClientPkg.dec 
b/RedfishClientPkg/RedfishClientPkg.dec
index c0ab30ab..84bceca3 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -43,6 +43,8 @@
   gEdkIIRedfishConfigLangMapProtocolGuid    = { 0x1d9ba9fe, 0x5d5a, 0x4b66, 
{0x83, 0x5b, 0xe2, 0x5d, 0x13, 0x93, 0x4a, 0x9c } }
   ## Include/Protocol/EdkIIRedfishInterchangeData.h
   gEdkIIRedfishFeatureInterchangeDataProtocolGuid = { 0x4B8FF71C, 0x4A7B, 
0x9478, { 0xB7, 0x81, 0x35, 0x9B, 0x0A, 0xF2, 0x00, 0x91 } }
+  ## Include/Protocol/EdkIIRedfishResourceAddendumProtocol.h
+  gEdkIIRedfishResourceAddendumProtocolGuid = { 0xda36b12b, 0xaad4, 0x4e90, { 
0xba, 0xcb, 0xe3, 0xb5, 0x3b, 0x08, 0xbc, 0x54 } }
 
 [Guids]
   ## Include/Guid/RedfishClientPkgTokenSpace.h
diff --git 
a/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceAddendumProtocol.h 
b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceAddendumProtocol.h
new file mode 100644
index 00000000..da88fa29
--- /dev/null
+++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceAddendumProtocol.h
@@ -0,0 +1,94 @@
+/** @file
+  This file defines the EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL interface.
+
+  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL_H_
+#define EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL_H_
+
+#include <Uefi.h>
+
+typedef struct _EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL 
EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL;
+
+///
+/// The definition of REDFISH_SCHEMA_INFO
+///
+typedef struct {
+  CHAR8    *Uri;
+  CHAR8    *Schema;
+  CHAR8    *Version;
+} REDFISH_RESOURCE_SCHEMA_INFO;
+
+/**
+  Edk2 platform Redfish Resource Addendum driver provides this interface to 
create addendum data
+  which is required by Redfish service to manage Redfish resource.
+
+  Redfish feature driver calls this interface with the JSON data on input and 
Redfish schema
+  information. The JSON data contains Redfish attributes that is created by 
feature driver.
+  Based those attributes, edk2 platform Redfish Resource Addendum driver 
appends addendum data
+  to it, or edk2 platform Redfish Resource Addendum driver replaces it with 
addendum data that
+  is required by Redfish service. Then Redfish feature driver sends JSON data 
to Redfish
+  service directly without modification.
+
+  @param[in]      This             Pointer to 
EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL instance.
+  @param[in]      SchemaInfo       Redfish schema information.
+  @param[in,out]  Json             On input, this is the Redfish data in given 
JSON in JSON object.
+                                   On output, This is the Redfish data with 
addendum information
+                                   which platform would like to add to Redfish 
service.
+
+  @retval EFI_SUCCESS              Addendum data is attached.
+  @retval EFI_UNSUPPORTED          No addendum data is required in given 
schema.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_ADDENDUM_DATA)(
+  IN     EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL  *This,
+  IN     REDFISH_RESOURCE_SCHEMA_INFO              *SchemaInfo,
+  IN OUT EDKII_JSON_VALUE                          Json
+  );
+
+/**
+  Edk2 platform Redfish Resource Addendum driver provides this interface to 
create OEM data which
+  is specified by Redfish schema.
+
+  Redfish feature driver calls this interface with Redfish schema information. 
edk2 platform
+  Redfish Resource Addendum driver creates OEM data and return it to feature 
driver. Then feature
+  driver will append returned JSON data to "Oem" attribute. Feature driver 
sends Oem attribute
+  and all other attributes to Redfish service without modification.
+
+  @param[in]   This             Pointer to 
EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL instance.
+  @param[in]   SchemaInfo       Redfish schema information.
+  @param[out]  Json             This is the Redfish data which will be 
attached to OEM object in
+                                given schema.
+
+  @retval EFI_SUCCESS           OEM data is attached.
+  @retval EFI_UNSUPPORTED       No OEM data is required in given schema.
+  @retval Others                Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_ADDENDUM_OEM)(
+  IN   EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL  *This,
+  IN   REDFISH_RESOURCE_SCHEMA_INFO              *SchemaInfo,
+  OUT  EDKII_JSON_VALUE                          Json
+  );
+
+///
+/// The definition of _EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL
+///
+struct _EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL {
+  UINT64                                  Revision;    ///< Protocol revision
+  EDKII_REDFISH_RESOURCE_ADDENDUM_OEM     GetOemData;  ///< Get OEM data
+  EDKII_REDFISH_RESOURCE_ADDENDUM_DATA    GetData;     ///< Get addendum data
+};
+
+extern EFI_GUID  gEdkIIRedfishResourceAddendumProtocolGuid;
+
+#endif
-- 
2.17.1



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


Reply via email to