public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env.
@ 2023-05-04 14:21 Nickle Wang
  2023-05-05  0:55 ` Chang, Abner
       [not found] ` <175C1941955D1A73.22266@groups.io>
  0 siblings, 2 replies; 3+ messages in thread
From: Nickle Wang @ 2023-05-04 14:21 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy

Initial common header file and meta files for feature drivers.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
 RedfishClientPkg/RedfishClientPkg.dec         |   5 +-
 .../Include/Guid/RedfishClientPkgTokenSpace.h |  20 +++
 .../EdkIIRedfishResourceConfigProtocol.h      | 127 ++++++++++++++++++
 .../Include/RedfishCollectionCommon.h         |  53 ++++++++
 .../Include/RedfishResourceCommon.h           | 121 +++++++++++++++++
 5 files changed, 325 insertions(+), 1 deletion(-)
 create mode 100644 RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
 create mode 100644 RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
 create mode 100644 RedfishClientPkg/Include/RedfishCollectionCommon.h
 create mode 100644 RedfishClientPkg/Include/RedfishResourceCommon.h

diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index 8fa92d5b..11eab386 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -21,9 +21,12 @@
 
 [Protocols]
   ## Include/Protocol/EdkIIRedfishFeature.h
-  gEdkIIRedfishFeatureProtocolGuid = { 0x785CC694, 0x4930, 0xEFBF, { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
+  gEdkIIRedfishFeatureProtocolGuid        = { 0x785CC694, 0x4930, 0xEFBF, { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
+  ## Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
+  gEdkIIRedfishResourceConfigProtocolGuid = { 0x6f164c68, 0xfb09, 0x4646, { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } }
 
 [Guids]
+  ## Include/Guid/RedfishClientPkgTokenSpace.h
   gEfiRedfishClientPkgTokenSpaceGuid    = { 0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }
 
 [PcdsFixedAtBuild]
diff --git a/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
new file mode 100644
index 00000000..7928e1a2
--- /dev/null
+++ b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
@@ -0,0 +1,20 @@
+/** @file
+  GUID for RedfishClientPkg PCD Token Space
+
+  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
+#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
+
+#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID \
+  { \
+    0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } \
+  }
+
+extern EFI_GUID  gEfiRedfishClientPkgTokenSpaceGuid;
+
+#endif
diff --git a/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
new file mode 100644
index 00000000..814fa9f9
--- /dev/null
+++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
@@ -0,0 +1,127 @@
+/** @file
+  This file defines the EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL interface.
+
+  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EDKII_REDFISH_RESOURCE_CONFIG_H_
+#define EDKII_REDFISH_RESOURCE_CONFIG_H_
+
+typedef struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL;
+
+/**
+  Provising redfish resource by given URI.
+
+  @param[in]   This                Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+  @param[in]   Uri                 Target URI to create resource.
+  @param[in]   HttpPostMode        TRUE if resource does not exist, HTTP POST method is used.
+                                   FALSE if the resource exist but some of properties are missing,
+                                   HTTP PUT method is used.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING)(
+  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
+  IN     CHAR8                                   *Uri,
+  IN     BOOLEAN                                 HttpPostMode
+  );
+
+/**
+  Consume resource from given URI.
+
+  @param[in]   This                Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+  @param[in]   Uri                 The target URI to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME)(
+  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
+  IN     CHAR8                                   *Uri
+  );
+
+/**
+  Update resource to given URI.
+
+  @param[in]   This                Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+  @param[in]   Uri                 The target URI to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE)(
+  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
+  IN     CHAR8                                   *Uri
+  );
+
+/**
+  Check resource on given URI.
+
+  @param[in]   This                Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+  @param[in]   Uri                 The target URI to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK)(
+  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
+  IN     CHAR8                                   *Uri
+  );
+
+//
+// definition of REDFISH_SCHEMA_INFO
+//
+#define REDFISH_SCHEMA_STRING_SIZE   (FixedPcdGet32 (PcdMaxRedfishSchemaStringSize))
+#define REDFISH_SCHEMA_VERSION_SIZE  (FixedPcdGet32 (PcdMaxRedfishSchemaVersionSize))
+
+typedef struct _SCHEMA_INFO {
+  CHAR8    Schema[REDFISH_SCHEMA_STRING_SIZE];
+  CHAR8    Major[REDFISH_SCHEMA_VERSION_SIZE];
+  CHAR8    Minor[REDFISH_SCHEMA_VERSION_SIZE];
+  CHAR8    Errata[REDFISH_SCHEMA_VERSION_SIZE];
+} REDFISH_SCHEMA_INFO;
+
+/**
+  Get information about this protocol.
+
+  @param[in]   This                Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+  @param[out]  Info                The schema information.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO)(
+  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
+  OUT    REDFISH_SCHEMA_INFO                     *Info
+  );
+
+struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL {
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING    Provisioning;
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME         Consume;
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE          Update;
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK           Check;
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO        GetInfo;
+};
+
+extern EFI_GUID  gEdkIIRedfishResourceConfigProtocolGuid;
+
+#endif
diff --git a/RedfishClientPkg/Include/RedfishCollectionCommon.h b/RedfishClientPkg/Include/RedfishCollectionCommon.h
new file mode 100644
index 00000000..b5735741
--- /dev/null
+++ b/RedfishClientPkg/Include/RedfishCollectionCommon.h
@@ -0,0 +1,53 @@
+/** @file
+  Redfish feature driver collection common header file.
+
+  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REDFISH_COLLECTION_COMMON_H_
+#define EFI_REDFISH_COLLECTION_COMMON_H_
+
+//
+// Libraries
+//
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PcdLib.h>
+#include <Library/RedfishLib.h>
+#include <Library/RedfishFeatureUtilityLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+//
+// Protocols
+//
+#include <Protocol/EdkIIRedfishConfigHandler.h>
+#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
+#include <Protocol/EdkIIRedfishFeature.h>
+#include <Protocol/RestJsonStructure.h>
+#include <Protocol/RestEx.h>
+
+#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0')
+#define REDFISH_DEBUG_TRACE  DEBUG_INFO
+
+typedef struct _REDFISH_COLLECTION_PRIVATE {
+  EFI_REST_JSON_STRUCTURE_PROTOCOL         *JsonStructProtocol;
+  EDKII_REDFISH_FEATURE_PROTOCOL           *FeatureProtocol;
+  REDFISH_SERVICE                          RedfishService;
+  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL    ConfigHandler;
+  EFI_EVENT                                Event;
+  CHAR8                                    *CollectionPath;
+  CHAR8                                    *CollectionJson;
+  REDFISH_PAYLOAD                          CollectionPayload;
+  REDFISH_RESPONSE                         RedResponse;
+} REDFISH_COLLECTION_PRIVATE;
+
+#define REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL(This) \
+          BASE_CR ((This), REDFISH_COLLECTION_PRIVATE, ConfigHandler)
+
+#endif
diff --git a/RedfishClientPkg/Include/RedfishResourceCommon.h b/RedfishClientPkg/Include/RedfishResourceCommon.h
new file mode 100644
index 00000000..95e8004d
--- /dev/null
+++ b/RedfishClientPkg/Include/RedfishResourceCommon.h
@@ -0,0 +1,121 @@
+/** @file
+  Redfish feature driver common header file.
+
+  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REDFISH_RESOURCE_COMMON_H_
+#define EFI_REDFISH_RESOURCE_COMMON_H_
+
+#define MAX_RED_PATH_LEN  128
+#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0')
+#define REDFISH_DEBUG_TRACE  DEBUG_INFO
+
+//
+// Libraries
+//
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PrintLib.h>
+#include <Library/PcdLib.h>
+#include <Library/RedfishLib.h>
+#include <Library/RedfishFeatureUtilityLib.h>
+#include <Library/RedfishPlatformConfigLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+//
+// Protocols
+//
+#include <Protocol/EdkIIRedfishConfigHandler.h>
+#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
+#include <Protocol/RestJsonStructure.h>
+#include <Protocol/RestEx.h>
+
+typedef struct _REDFISH_RESOURCE_COMMON_PRIVATE {
+  REDFISH_SERVICE                           RedfishService;
+  EFI_REST_JSON_STRUCTURE_PROTOCOL          *JsonStructProtocol;
+  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL    RedfishResourceConfig;
+  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL     ConfigHandler;
+  EFI_EVENT                                 Event;
+  CHAR8                                     *Uri;
+  CHAR8                                     *Json;
+  REDFISH_PAYLOAD                           Payload;
+} REDFISH_RESOURCE_COMMON_PRIVATE;
+
+#define REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL(This) \
+          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE, ConfigHandler)
+
+#define REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL(This) \
+          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE, RedfishResourceConfig)
+
+/**
+  Consume resource from given URI.
+
+  @param[in]   This                Pointer to REDFISH_RESOURCE_COMMON_PRIVATE instance.
+  @param[in]   Json                The JSON to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+EFI_STATUS
+RedfishConsumeResourceCommon (
+  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
+  IN     CHAR8                            *Json
+  );
+
+/**
+  Provisioning redfish resource by given URI.
+
+  @param[in]   This                Pointer to EFI_HP_REDFISH_HII_PROTOCOL instance.
+  @param[in]   ResourceExist       TRUE if resource exists, PUT method will be used.
+                                   FALSE if resource does not exist POST method is used.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+EFI_STATUS
+RedfishProvisioningResourceCommon (
+  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
+  IN     BOOLEAN                          ResourceExist
+  );
+
+/**
+  Check resource from given URI.
+
+  @param[in]   This                Pointer to REDFISH_RESOURCE_COMMON_PRIVATE instance.
+  @param[in]   Json                The JSON to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+EFI_STATUS
+RedfishCheckResourceCommon (
+  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
+  IN     CHAR8                            *Json
+  );
+
+/**
+  Update resource to given URI.
+
+  @param[in]   This                Pointer to REDFISH_RESOURCE_COMMON_PRIVATE instance.
+  @param[in]   Json                The JSON to consume.
+
+  @retval EFI_SUCCESS              Value is returned successfully.
+  @retval Others                   Some error happened.
+
+**/
+EFI_STATUS
+RedfishUpdateResourceCommon (
+  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
+  IN     CHAR8                            *Json
+  );
+
+#endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env.
  2023-05-04 14:21 [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env Nickle Wang
@ 2023-05-05  0:55 ` Chang, Abner
       [not found] ` <175C1941955D1A73.22266@groups.io>
  1 sibling, 0 replies; 3+ messages in thread
From: Chang, Abner @ 2023-05-05  0:55 UTC (permalink / raw)
  To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Thursday, May 4, 2023 10:22 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2
> Redfish Feature driver Env.
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Initial common header file and meta files for feature drivers.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
>  RedfishClientPkg/RedfishClientPkg.dec         |   5 +-
>  .../Include/Guid/RedfishClientPkgTokenSpace.h |  20 +++
>  .../EdkIIRedfishResourceConfigProtocol.h      | 127 ++++++++++++++++++
>  .../Include/RedfishCollectionCommon.h         |  53 ++++++++
>  .../Include/RedfishResourceCommon.h           | 121 +++++++++++++++++
>  5 files changed, 325 insertions(+), 1 deletion(-)  create mode 100644
> RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
>  create mode 100644
> RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
>  create mode 100644 RedfishClientPkg/Include/RedfishCollectionCommon.h
>  create mode 100644 RedfishClientPkg/Include/RedfishResourceCommon.h
> 
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index 8fa92d5b..11eab386 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -21,9 +21,12 @@
> 
>  [Protocols]
>    ## Include/Protocol/EdkIIRedfishFeature.h
> -  gEdkIIRedfishFeatureProtocolGuid = { 0x785CC694, 0x4930, 0xEFBF, { 0x2A,
> 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
> +  gEdkIIRedfishFeatureProtocolGuid        = { 0x785CC694, 0x4930, 0xEFBF,
> { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
> +  ## Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> +  gEdkIIRedfishResourceConfigProtocolGuid = { 0x6f164c68, 0xfb09,
> + 0x4646, { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } }
> 
>  [Guids]
> +  ## Include/Guid/RedfishClientPkgTokenSpace.h
>    gEfiRedfishClientPkgTokenSpaceGuid    = { 0x8c444dae, 0x728b, 0x48ee,
> { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }
> 
>  [PcdsFixedAtBuild]
> diff --git a/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> new file mode 100644
> index 00000000..7928e1a2
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> @@ -0,0 +1,20 @@
> +/** @file
> +  GUID for RedfishClientPkg PCD Token Space
> +
> +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
> +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
> +
> +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID \
> +  { \
> +    0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e,
> +0x9c, 0xc8 } \
> +  }
> +
> +extern EFI_GUID  gEfiRedfishClientPkgTokenSpaceGuid;
> +
> +#endif
> diff --git
> a/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> new file mode 100644
> index 00000000..814fa9f9
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtoc
> +++ ol.h
> @@ -0,0 +1,127 @@
> +/** @file
> +  This file defines the EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> interface.
> +
> +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EDKII_REDFISH_RESOURCE_CONFIG_H_ #define
> +EDKII_REDFISH_RESOURCE_CONFIG_H_
> +
> +typedef struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL;
> +
> +/**
> +  Provising redfish resource by given URI.
> +
> +  @param[in]   This                Pointer to
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> +  @param[in]   Uri                 Target URI to create resource.
> +  @param[in]   HttpPostMode        TRUE if resource does not exist, HTTP
> POST method is used.
> +                                   FALSE if the resource exist but some of properties are
> missing,
> +                                   HTTP PUT method is used.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI
> *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING)(
> +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> +  IN     CHAR8                                   *Uri,
> +  IN     BOOLEAN                                 HttpPostMode
> +  );
> +
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   This                Pointer to
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> +  @param[in]   Uri                 The target URI to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME)(
> +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> +  IN     CHAR8                                   *Uri
> +  );
> +
> +/**
> +  Update resource to given URI.
> +
> +  @param[in]   This                Pointer to
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> +  @param[in]   Uri                 The target URI to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE)(
> +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> +  IN     CHAR8                                   *Uri
> +  );
> +
> +/**
> +  Check resource on given URI.
> +
> +  @param[in]   This                Pointer to
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> +  @param[in]   Uri                 The target URI to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK)(
> +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> +  IN     CHAR8                                   *Uri
> +  );
> +
> +//
> +// definition of REDFISH_SCHEMA_INFO
> +//
> +#define REDFISH_SCHEMA_STRING_SIZE   (FixedPcdGet32
> (PcdMaxRedfishSchemaStringSize))
> +#define REDFISH_SCHEMA_VERSION_SIZE  (FixedPcdGet32
> +(PcdMaxRedfishSchemaVersionSize))
> +
> +typedef struct _SCHEMA_INFO {
> +  CHAR8    Schema[REDFISH_SCHEMA_STRING_SIZE];
> +  CHAR8    Major[REDFISH_SCHEMA_VERSION_SIZE];
> +  CHAR8    Minor[REDFISH_SCHEMA_VERSION_SIZE];
> +  CHAR8    Errata[REDFISH_SCHEMA_VERSION_SIZE];
> +} REDFISH_SCHEMA_INFO;
> +
> +/**
> +  Get information about this protocol.
> +
> +  @param[in]   This                Pointer to
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> +  @param[out]  Info                The schema information.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO)(
> +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> +  OUT    REDFISH_SCHEMA_INFO                     *Info
> +  );
> +
> +struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL {
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING
> Provisioning;
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME         Consume;
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE          Update;
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK           Check;
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO        GetInfo;
> +};
> +
> +extern EFI_GUID  gEdkIIRedfishResourceConfigProtocolGuid;
> +
> +#endif
> diff --git a/RedfishClientPkg/Include/RedfishCollectionCommon.h
> b/RedfishClientPkg/Include/RedfishCollectionCommon.h
> new file mode 100644
> index 00000000..b5735741
> --- /dev/null
> +++ b/RedfishClientPkg/Include/RedfishCollectionCommon.h
> @@ -0,0 +1,53 @@
> +/** @file
> +  Redfish feature driver collection common header file.
> +
> +  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EFI_REDFISH_COLLECTION_COMMON_H_ #define
> +EFI_REDFISH_COLLECTION_COMMON_H_
> +
> +//
> +// Libraries
> +//
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h> #include <Library/PrintLib.h>
> +#include <Library/PcdLib.h> #include <Library/RedfishLib.h> #include
> +<Library/RedfishFeatureUtilityLib.h>
> +#include <Library/UefiLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +//
> +// Protocols
> +//
> +#include <Protocol/EdkIIRedfishConfigHandler.h>
> +#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
> +#include <Protocol/EdkIIRedfishFeature.h> #include
> +<Protocol/RestJsonStructure.h> #include <Protocol/RestEx.h>
> +
> +#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0') #define
> +REDFISH_DEBUG_TRACE  DEBUG_INFO
> +
> +typedef struct _REDFISH_COLLECTION_PRIVATE {
> +  EFI_REST_JSON_STRUCTURE_PROTOCOL         *JsonStructProtocol;
> +  EDKII_REDFISH_FEATURE_PROTOCOL           *FeatureProtocol;
> +  REDFISH_SERVICE                          RedfishService;
> +  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL    ConfigHandler;
> +  EFI_EVENT                                Event;
> +  CHAR8                                    *CollectionPath;
> +  CHAR8                                    *CollectionJson;
> +  REDFISH_PAYLOAD                          CollectionPayload;
> +  REDFISH_RESPONSE                         RedResponse;
> +} REDFISH_COLLECTION_PRIVATE;
> +
> +#define REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL(This) \
> +          BASE_CR ((This), REDFISH_COLLECTION_PRIVATE, ConfigHandler)
> +
> +#endif
> diff --git a/RedfishClientPkg/Include/RedfishResourceCommon.h
> b/RedfishClientPkg/Include/RedfishResourceCommon.h
> new file mode 100644
> index 00000000..95e8004d
> --- /dev/null
> +++ b/RedfishClientPkg/Include/RedfishResourceCommon.h
> @@ -0,0 +1,121 @@
> +/** @file
> +  Redfish feature driver common header file.
> +
> +  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EFI_REDFISH_RESOURCE_COMMON_H_
> +#define EFI_REDFISH_RESOURCE_COMMON_H_
> +
> +#define MAX_RED_PATH_LEN  128
> +#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0') #define
> +REDFISH_DEBUG_TRACE  DEBUG_INFO
> +
> +//
> +// Libraries
> +//
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/MemoryAllocationLib.h> #include <Library/PrintLib.h>
> +#include <Library/PcdLib.h> #include <Library/RedfishLib.h> #include
> +<Library/RedfishFeatureUtilityLib.h>
> +#include <Library/RedfishPlatformConfigLib.h>
> +#include <Library/UefiLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +//
> +// Protocols
> +//
> +#include <Protocol/EdkIIRedfishConfigHandler.h>
> +#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
> +#include <Protocol/RestJsonStructure.h> #include <Protocol/RestEx.h>
> +
> +typedef struct _REDFISH_RESOURCE_COMMON_PRIVATE {
> +  REDFISH_SERVICE                           RedfishService;
> +  EFI_REST_JSON_STRUCTURE_PROTOCOL          *JsonStructProtocol;
> +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL    RedfishResourceConfig;
> +  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL     ConfigHandler;
> +  EFI_EVENT                                 Event;
> +  CHAR8                                     *Uri;
> +  CHAR8                                     *Json;
> +  REDFISH_PAYLOAD                           Payload;
> +} REDFISH_RESOURCE_COMMON_PRIVATE;
> +
> +#define
> REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCO
> L(This) \
> +          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE,
> +ConfigHandler)
> +
> +#define
> REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO
> COL(This) \
> +          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE,
> +RedfishResourceConfig)
> +
> +/**
> +  Consume resource from given URI.
> +
> +  @param[in]   This                Pointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   Json                The JSON to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishConsumeResourceCommon (
> +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> +  IN     CHAR8                            *Json
> +  );
> +
> +/**
> +  Provisioning redfish resource by given URI.
> +
> +  @param[in]   This                Pointer to EFI_HP_REDFISH_HII_PROTOCOL
> instance.
> +  @param[in]   ResourceExist       TRUE if resource exists, PUT method will be
> used.
> +                                   FALSE if resource does not exist POST method is used.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishProvisioningResourceCommon (
> +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> +  IN     BOOLEAN                          ResourceExist
> +  );
> +
> +/**
> +  Check resource from given URI.
> +
> +  @param[in]   This                Pointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   Json                The JSON to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishCheckResourceCommon (
> +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> +  IN     CHAR8                            *Json
> +  );
> +
> +/**
> +  Update resource to given URI.
> +
> +  @param[in]   This                Pointer to
> REDFISH_RESOURCE_COMMON_PRIVATE instance.
> +  @param[in]   Json                The JSON to consume.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishUpdateResourceCommon (
> +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> +  IN     CHAR8                            *Json
> +  );
> +
> +#endif
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env.
       [not found] ` <175C1941955D1A73.22266@groups.io>
@ 2023-05-05  1:14   ` Chang, Abner
  0 siblings, 0 replies; 3+ messages in thread
From: Chang, Abner @ 2023-05-05  1:14 UTC (permalink / raw)
  To: devel@edk2.groups.io, Chang, Abner, Nickle Wang; +Cc: Igor Kulchytskyy

[AMD Official Use Only - General]

Correct email address
Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> Abner via groups.io
> Sent: Friday, May 5, 2023 8:55 AM
> To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> Cc: Igor Kulchytskyy <igork@ami.com>
> Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH 1/8] RedfishClientPkg:
> Facilities of EDK2 Redfish Feature driver Env.
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> [AMD Official Use Only - General]
> 
> Reviewed-by: Abner Chang <abner.chang@hpe.com>
> 
> > -----Original Message-----
> > From: Nickle Wang <nicklew@nvidia.com>
> > Sent: Thursday, May 4, 2023 10:22 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> > <igork@ami.com>
> > Subject: [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities
> > of EDK2 Redfish Feature driver Env.
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Initial common header file and meta files for feature drivers.
> >
> > Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > ---
> >  RedfishClientPkg/RedfishClientPkg.dec         |   5 +-
> >  .../Include/Guid/RedfishClientPkgTokenSpace.h |  20 +++
> >  .../EdkIIRedfishResourceConfigProtocol.h      | 127 ++++++++++++++++++
> >  .../Include/RedfishCollectionCommon.h         |  53 ++++++++
> >  .../Include/RedfishResourceCommon.h           | 121 +++++++++++++++++
> >  5 files changed, 325 insertions(+), 1 deletion(-)  create mode 100644
> > RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> >  create mode 100644
> > RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> >  create mode 100644
> RedfishClientPkg/Include/RedfishCollectionCommon.h
> >  create mode 100644
> RedfishClientPkg/Include/RedfishResourceCommon.h
> >
> > diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> > b/RedfishClientPkg/RedfishClientPkg.dec
> > index 8fa92d5b..11eab386 100644
> > --- a/RedfishClientPkg/RedfishClientPkg.dec
> > +++ b/RedfishClientPkg/RedfishClientPkg.dec
> > @@ -21,9 +21,12 @@
> >
> >  [Protocols]
> >    ## Include/Protocol/EdkIIRedfishFeature.h
> > -  gEdkIIRedfishFeatureProtocolGuid = { 0x785CC694, 0x4930, 0xEFBF, {
> > 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
> > +  gEdkIIRedfishFeatureProtocolGuid        = { 0x785CC694, 0x4930, 0xEFBF,
> > { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }
> > +  ## Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> > +  gEdkIIRedfishResourceConfigProtocolGuid = { 0x6f164c68, 0xfb09,
> > + 0x4646, { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } }
> >
> >  [Guids]
> > +  ## Include/Guid/RedfishClientPkgTokenSpace.h
> >    gEfiRedfishClientPkgTokenSpaceGuid    = { 0x8c444dae, 0x728b, 0x48ee,
> > { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }
> >
> >  [PcdsFixedAtBuild]
> > diff --git
> > a/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> > b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> > new file mode 100644
> > index 00000000..7928e1a2
> > --- /dev/null
> > +++ b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> > @@ -0,0 +1,20 @@
> > +/** @file
> > +  GUID for RedfishClientPkg PCD Token Space
> > +
> > +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
> > +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_
> > +
> > +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID \
> > +  { \
> > +    0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e,
> > +0x9c, 0xc8 } \
> > +  }
> > +
> > +extern EFI_GUID  gEfiRedfishClientPkgTokenSpaceGuid;
> > +
> > +#endif
> > diff --git
> > a/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol
> > .h
> > b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol
> > .h
> > new file mode 100644
> > index 00000000..814fa9f9
> > --- /dev/null
> > +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProt
> > +++ oc
> > +++ ol.h
> > @@ -0,0 +1,127 @@
> > +/** @file
> > +  This file defines the EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> > interface.
> > +
> > +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef EDKII_REDFISH_RESOURCE_CONFIG_H_ #define
> > +EDKII_REDFISH_RESOURCE_CONFIG_H_
> > +
> > +typedef struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> > +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL;
> > +
> > +/**
> > +  Provising redfish resource by given URI.
> > +
> > +  @param[in]   This                Pointer to
> > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> > +  @param[in]   Uri                 Target URI to create resource.
> > +  @param[in]   HttpPostMode        TRUE if resource does not exist, HTTP
> > POST method is used.
> > +                                   FALSE if the resource exist but
> > + some of properties are
> > missing,
> > +                                   HTTP PUT method is used.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI
> > *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING)(
> > +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> > +  IN     CHAR8                                   *Uri,
> > +  IN     BOOLEAN                                 HttpPostMode
> > +  );
> > +
> > +/**
> > +  Consume resource from given URI.
> > +
> > +  @param[in]   This                Pointer to
> > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> > +  @param[in]   Uri                 The target URI to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME)(
> > +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> > +  IN     CHAR8                                   *Uri
> > +  );
> > +
> > +/**
> > +  Update resource to given URI.
> > +
> > +  @param[in]   This                Pointer to
> > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> > +  @param[in]   Uri                 The target URI to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE)(
> > +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> > +  IN     CHAR8                                   *Uri
> > +  );
> > +
> > +/**
> > +  Check resource on given URI.
> > +
> > +  @param[in]   This                Pointer to
> > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> > +  @param[in]   Uri                 The target URI to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK)(
> > +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> > +  IN     CHAR8                                   *Uri
> > +  );
> > +
> > +//
> > +// definition of REDFISH_SCHEMA_INFO
> > +//
> > +#define REDFISH_SCHEMA_STRING_SIZE   (FixedPcdGet32
> > (PcdMaxRedfishSchemaStringSize))
> > +#define REDFISH_SCHEMA_VERSION_SIZE  (FixedPcdGet32
> > +(PcdMaxRedfishSchemaVersionSize))
> > +
> > +typedef struct _SCHEMA_INFO {
> > +  CHAR8    Schema[REDFISH_SCHEMA_STRING_SIZE];
> > +  CHAR8    Major[REDFISH_SCHEMA_VERSION_SIZE];
> > +  CHAR8    Minor[REDFISH_SCHEMA_VERSION_SIZE];
> > +  CHAR8    Errata[REDFISH_SCHEMA_VERSION_SIZE];
> > +} REDFISH_SCHEMA_INFO;
> > +
> > +/**
> > +  Get information about this protocol.
> > +
> > +  @param[in]   This                Pointer to
> > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
> > +  @param[out]  Info                The schema information.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO)(
> > +  IN     EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL  *This,
> > +  OUT    REDFISH_SCHEMA_INFO                     *Info
> > +  );
> > +
> > +struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL {
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING
> > Provisioning;
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME
> Consume;
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE          Update;
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK           Check;
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO        GetInfo;
> > +};
> > +
> > +extern EFI_GUID  gEdkIIRedfishResourceConfigProtocolGuid;
> > +
> > +#endif
> > diff --git a/RedfishClientPkg/Include/RedfishCollectionCommon.h
> > b/RedfishClientPkg/Include/RedfishCollectionCommon.h
> > new file mode 100644
> > index 00000000..b5735741
> > --- /dev/null
> > +++ b/RedfishClientPkg/Include/RedfishCollectionCommon.h
> > @@ -0,0 +1,53 @@
> > +/** @file
> > +  Redfish feature driver collection common header file.
> > +
> > +  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development
> > + LP<BR>
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef EFI_REDFISH_COLLECTION_COMMON_H_ #define
> > +EFI_REDFISH_COLLECTION_COMMON_H_
> > +
> > +//
> > +// Libraries
> > +//
> > +#include <Library/BaseMemoryLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/MemoryAllocationLib.h> #include
> > +<Library/PrintLib.h> #include <Library/PcdLib.h> #include
> > +<Library/RedfishLib.h> #include <Library/RedfishFeatureUtilityLib.h>
> > +#include <Library/UefiLib.h>
> > +#include <Library/UefiBootServicesTableLib.h>
> > +
> > +//
> > +// Protocols
> > +//
> > +#include <Protocol/EdkIIRedfishConfigHandler.h>
> > +#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
> > +#include <Protocol/EdkIIRedfishFeature.h> #include
> > +<Protocol/RestJsonStructure.h> #include <Protocol/RestEx.h>
> > +
> > +#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0') #define
> > +REDFISH_DEBUG_TRACE  DEBUG_INFO
> > +
> > +typedef struct _REDFISH_COLLECTION_PRIVATE {
> > +  EFI_REST_JSON_STRUCTURE_PROTOCOL         *JsonStructProtocol;
> > +  EDKII_REDFISH_FEATURE_PROTOCOL           *FeatureProtocol;
> > +  REDFISH_SERVICE                          RedfishService;
> > +  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL    ConfigHandler;
> > +  EFI_EVENT                                Event;
> > +  CHAR8                                    *CollectionPath;
> > +  CHAR8                                    *CollectionJson;
> > +  REDFISH_PAYLOAD                          CollectionPayload;
> > +  REDFISH_RESPONSE                         RedResponse;
> > +} REDFISH_COLLECTION_PRIVATE;
> > +
> > +#define REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL(This)
> \
> > +          BASE_CR ((This), REDFISH_COLLECTION_PRIVATE, ConfigHandler)
> > +
> > +#endif
> > diff --git a/RedfishClientPkg/Include/RedfishResourceCommon.h
> > b/RedfishClientPkg/Include/RedfishResourceCommon.h
> > new file mode 100644
> > index 00000000..95e8004d
> > --- /dev/null
> > +++ b/RedfishClientPkg/Include/RedfishResourceCommon.h
> > @@ -0,0 +1,121 @@
> > +/** @file
> > +  Redfish feature driver common header file.
> > +
> > +  (C) Copyright 2020-2021 Hewlett Packard Enterprise Development
> > + LP<BR>
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef EFI_REDFISH_RESOURCE_COMMON_H_ #define
> > +EFI_REDFISH_RESOURCE_COMMON_H_
> > +
> > +#define MAX_RED_PATH_LEN  128
> > +#define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0') #define
> > +REDFISH_DEBUG_TRACE  DEBUG_INFO
> > +
> > +//
> > +// Libraries
> > +//
> > +#include <Library/DebugLib.h>
> > +#include <Library/BaseMemoryLib.h>
> > +#include <Library/MemoryAllocationLib.h> #include
> > +<Library/PrintLib.h> #include <Library/PcdLib.h> #include
> > +<Library/RedfishLib.h> #include <Library/RedfishFeatureUtilityLib.h>
> > +#include <Library/RedfishPlatformConfigLib.h>
> > +#include <Library/UefiLib.h>
> > +#include <Library/UefiBootServicesTableLib.h>
> > +
> > +//
> > +// Protocols
> > +//
> > +#include <Protocol/EdkIIRedfishConfigHandler.h>
> > +#include <Protocol/EdkIIRedfishResourceConfigProtocol.h>
> > +#include <Protocol/RestJsonStructure.h> #include <Protocol/RestEx.h>
> > +
> > +typedef struct _REDFISH_RESOURCE_COMMON_PRIVATE {
> > +  REDFISH_SERVICE                           RedfishService;
> > +  EFI_REST_JSON_STRUCTURE_PROTOCOL          *JsonStructProtocol;
> > +  EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL
> RedfishResourceConfig;
> > +  EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL     ConfigHandler;
> > +  EFI_EVENT                                 Event;
> > +  CHAR8                                     *Uri;
> > +  CHAR8                                     *Json;
> > +  REDFISH_PAYLOAD                           Payload;
> > +} REDFISH_RESOURCE_COMMON_PRIVATE;
> > +
> > +#define
> >
> REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCO
> > L(This) \
> > +          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE,
> > +ConfigHandler)
> > +
> > +#define
> >
> REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTO
> > COL(This) \
> > +          BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE,
> > +RedfishResourceConfig)
> > +
> > +/**
> > +  Consume resource from given URI.
> > +
> > +  @param[in]   This                Pointer to
> > REDFISH_RESOURCE_COMMON_PRIVATE instance.
> > +  @param[in]   Json                The JSON to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +EFI_STATUS
> > +RedfishConsumeResourceCommon (
> > +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> > +  IN     CHAR8                            *Json
> > +  );
> > +
> > +/**
> > +  Provisioning redfish resource by given URI.
> > +
> > +  @param[in]   This                Pointer to EFI_HP_REDFISH_HII_PROTOCOL
> > instance.
> > +  @param[in]   ResourceExist       TRUE if resource exists, PUT method will
> be
> > used.
> > +                                   FALSE if resource does not exist POST method is used.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +EFI_STATUS
> > +RedfishProvisioningResourceCommon (
> > +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> > +  IN     BOOLEAN                          ResourceExist
> > +  );
> > +
> > +/**
> > +  Check resource from given URI.
> > +
> > +  @param[in]   This                Pointer to
> > REDFISH_RESOURCE_COMMON_PRIVATE instance.
> > +  @param[in]   Json                The JSON to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +EFI_STATUS
> > +RedfishCheckResourceCommon (
> > +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> > +  IN     CHAR8                            *Json
> > +  );
> > +
> > +/**
> > +  Update resource to given URI.
> > +
> > +  @param[in]   This                Pointer to
> > REDFISH_RESOURCE_COMMON_PRIVATE instance.
> > +  @param[in]   Json                The JSON to consume.
> > +
> > +  @retval EFI_SUCCESS              Value is returned successfully.
> > +  @retval Others                   Some error happened.
> > +
> > +**/
> > +EFI_STATUS
> > +RedfishUpdateResourceCommon (
> > +  IN     REDFISH_RESOURCE_COMMON_PRIVATE  *Private,
> > +  IN     CHAR8                            *Json
> > +  );
> > +
> > +#endif
> > --
> > 2.17.1
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-05  1:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 14:21 [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env Nickle Wang
2023-05-05  0:55 ` Chang, Abner
     [not found] ` <175C1941955D1A73.22266@groups.io>
2023-05-05  1:14   ` [edk2-devel] " Chang, Abner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox