public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner" <abner.chang@amd.com>
To: Nickle Wang <nicklew@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-redfish-client][PATCH 1/8] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env.
Date: Fri, 5 May 2023 00:55:23 +0000	[thread overview]
Message-ID: <MN2PR12MB39664588EE1ECF2128EEBB35EA729@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230504142144.16012-1-nicklew@nvidia.com>

[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

  reply	other threads:[~2023-05-05  0:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found] ` <175C1941955D1A73.22266@groups.io>
2023-05-05  1:14   ` [edk2-devel] " Chang, Abner

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=MN2PR12MB39664588EE1ECF2128EEBB35EA729@MN2PR12MB3966.namprd12.prod.outlook.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