From: "Abner Chang" <abner.chang@hpe.com>
To: "Wang, Nickle (HPS SW)" <nickle.wang@hpe.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Subject: Re: [PATCH 1/1] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env.
Date: Wed, 13 Oct 2021 09:03:24 +0000 [thread overview]
Message-ID: <CS1PR8401MB11446E5C9F2798A8F5A5391CFFB79@CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20211013083105.1993-2-nickle.wang@hpe.com>
It's fine this time, but please add [staging/RedfishClientPkg] when next time send the patch against edk2-staging.
Only one comment in below, others look good to me.
Reviewed-by: Abner Chang <abner.chang@hpe.com>
> -----Original Message-----
> From: Wang, Nickle (HPS SW)
> Sent: Wednesday, October 13, 2021 4:31 PM
> To: devel@edk2.groups.io
> Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Chang, Abner (HPS
> SW/FW Technologist) <abner.chang@hpe.com>; Liming Gao
> <gaoliming@byosoft.com.cn>
> Subject: [PATCH 1/1] RedfishClientPkg: Facilities of EDK2 Redfish Feature
> driver Env.
>
> Initial common header file and meta files for feature drivers.
>
> Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> ---
> .../Include/Guid/RedfishClientPkgTokenSpace.h | 20 +++
> .../EdkIIRedfishResourceConfigProtocol.h | 129 ++++++++++++++++++
> .../Include/RedfishCollectionCommon.h | 53 +++++++
> .../Include/RedfishResourceCommon.h | 123 +++++++++++++++++
> RedfishClientPkg/RedfishClientPkg.dec | 8 +-
> 5 files changed, 332 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/Include/Guid/RedfishClientPkgTokenSpace.h
> b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h
> new file mode 100644
> index 0000000000..1cdf429da4
> --- /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_
Please remove the prefix "_"
Abner
>
> +
>
> +#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 0000000000..d6c41dda52
> --- /dev/null
> +++
> b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h
> @@ -0,0 +1,129 @@
> +/** @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 0000000000..3962b361ed
> --- /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 0000000000..1ba992bb69
> --- /dev/null
> +++ b/RedfishClientPkg/Include/RedfishResourceCommon.h
> @@ -0,0 +1,123 @@
> +/** @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
>
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index 8fa92d5b1e..f01509d78f 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]
>
> @@ -35,3 +38,6 @@
> #
>
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupE
> ventGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8,
> 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x10000003
>
>
>
> +[PcdsFixedAtBuild]
>
> +
> gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|
> UINT32|0x10000001
>
> +
> gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|
> UINT32|0x10000002
>
> --
> 2.31.1.windows.1
next prev parent reply other threads:[~2021-10-13 9:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 8:31 [PATCH 0/1] RedfishClientPkg: Facilities of EDK2 Redfish Feature Driver Nickle Wang
2021-10-13 8:31 ` [PATCH 1/1] RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env Nickle Wang
2021-10-13 9:03 ` Abner Chang [this message]
2021-10-25 2:49 ` Nickle Wang
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=CS1PR8401MB11446E5C9F2798A8F5A5391CFFB79@CS1PR8401MB1144.NAMPRD84.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