From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web08.27362.1635130092661706417 for ; Sun, 24 Oct 2021 19:48:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=cpPsEDha; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0932ea4fe9=nickle.wang@hpe.com) Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19OHWOt0025209; Mon, 25 Oct 2021 02:48:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pps0720; bh=MHKe+nHnOOG9homM6D5zncvdIRhDCtqUFE7CJIY5k7Q=; b=cpPsEDhaXQQTJTx8ppoXmW6z8IcUjNrj46niVbdtpCXIICocR596CRLKbeuTAt/x9TOS nlehy6o4DsUNM9NFH5T+0tcJjNDEstIvzlLpKcvSNRJtIxG6/TtCxIIrvFmhhaPMTBf0 RA9tEioE/cEwhTMuYynH0ujROydwb1ipBBFmXBkVkmGNItfxUbe8YLr5nIDwuW6ymyEb AhpR/VsJciU7AuZqiUOl3r5RImd6c/DjFNoLTvUmE3TvHPg/oSlHiDQt3UdRDWwDvvpq GKH/McJDQcN3oB+5M3/B2qJa3GxD0kWeMIjrBsBsSVnVsl/W2zmMX2QAYsYZx+11R5hi WQ== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0a-002e3701.pphosted.com with ESMTP id 3bvve654rf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Oct 2021 02:48:06 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id 631C558; Mon, 25 Oct 2021 02:48:05 +0000 (UTC) Received: from WVE00YQZQF.asiapacific.hpqcorp.net (unknown [16.168.161.139]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 1804B45; Mon, 25 Oct 2021 02:48:02 +0000 (UTC) From: "Nickle Wang" To: devel@edk2.groups.io Cc: Nickle Wang , Abner Chang , Liming Gao Subject: [PATCH V2 1/1] staging/RedfishClientPkg: Facilities of EDK2 Redfish Feature driver Env. Date: Mon, 25 Oct 2021 10:47:31 +0800 Message-Id: <20211025024731.224-2-nickle.wang@hpe.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20211025024731.224-1-nickle.wang@hpe.com> References: <20211025024731.224-1-nickle.wang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: zL_uMDc3Tt2rzXaTBx1DoPZDCaqhmLGw X-Proofpoint-ORIG-GUID: zL_uMDc3Tt2rzXaTBx1DoPZDCaqhmLGw X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-24_07,2021-10-25_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 mlxlogscore=971 spamscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110250015 Content-Transfer-Encoding: quoted-printable Initial common header file and meta files for feature drivers. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Liming Gao --- .../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/RedfishClientPkgTokenSpac= e.h create mode 100644 RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceC= onfigProtocol.h create mode 100644 RedfishClientPkg/Include/RedfishCollectionCommon.h create mode 100644 RedfishClientPkg/Include/RedfishResourceCommon.h diff --git a/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h b/R= edfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h new file mode 100644 index 0000000000..a2a09ed004 --- /dev/null +++ b/RedfishClientPkg/Include/Guid/RedfishClientPkgTokenSpace.h @@ -0,0 +1,20 @@ +/** @file=0D + GUID for RedfishClientPkg PCD Token Space=0D +=0D + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_=0D +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID_H_=0D +=0D +#define REDFISHCLIENTPKG_TOKEN_SPACE_GUID \=0D + { \=0D + 0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c= , 0xc8 } \=0D + }=0D +=0D +extern EFI_GUID gEfiRedfishClientPkgTokenSpaceGuid;=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigPr= otocol.h b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProt= ocol.h new file mode 100644 index 0000000000..d6c41dda52 --- /dev/null +++ b/RedfishClientPkg/Include/Protocol/EdkIIRedfishResourceConfigProtocol.h @@ -0,0 +1,129 @@ +/** @file=0D + This file defines the EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL interface.= =0D +=0D + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef EDKII_REDFISH_RESOURCE_CONFIG_H_=0D +#define EDKII_REDFISH_RESOURCE_CONFIG_H_=0D +=0D +typedef struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL EDKII_REDFISH_RESOU= RCE_CONFIG_PROTOCOL;=0D +=0D +/**=0D + Provising redfish resource by given URI.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[in] Uri Target URI to create resource.=0D + @param[in] HttpPostMode TRUE if resource does not exist, HTTP P= OST method is used.=0D + FALSE if the resource exist but some of= properties are missing,=0D + HTTP PUT method is used.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING) (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN CHAR8 *Uri,=0D + IN BOOLEAN HttpPostMode=0D + );=0D +=0D +/**=0D + Consume resource from given URI.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME) (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN CHAR8 *Uri=0D + );=0D +=0D +=0D +/**=0D + Update resource to given URI.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE) (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN CHAR8 *Uri=0D + );=0D +=0D +=0D +/**=0D + Check resource on given URI.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK) (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN CHAR8 *Uri=0D + );=0D +=0D +//=0D +// definition of REDFISH_SCHEMA_INFO=0D +//=0D +#define REDFISH_SCHEMA_STRING_SIZE (FixedPcdGet32 (PcdMaxRedfishSchemaStr= ingSize))=0D +#define REDFISH_SCHEMA_VERSION_SIZE (FixedPcdGet32 (PcdMaxRedfishSchemaVer= sionSize))=0D +=0D +typedef struct _SCHEMA_INFO {=0D + CHAR8 Schema[REDFISH_SCHEMA_STRING_SIZE];=0D + CHAR8 Major[REDFISH_SCHEMA_VERSION_SIZE];=0D + CHAR8 Minor[REDFISH_SCHEMA_VERSION_SIZE];=0D + CHAR8 Errata[REDFISH_SCHEMA_VERSION_SIZE];=0D +} REDFISH_SCHEMA_INFO;=0D +=0D +/**=0D + Get information about this protocol.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[out] Info The schema information.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO) (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + OUT REDFISH_SCHEMA_INFO *Info=0D + );=0D +=0D +struct _EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL {=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_PROVISIONING Provisioning;=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CONSUME Consume;=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_UPDATE Update;=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_CHECK Check;=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL_GET_INFO GetInfo;=0D +};=0D +=0D +extern EFI_GUID gEdkIIRedfishResourceConfigProtocolGuid;=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Include/RedfishCollectionCommon.h b/RedfishCl= ientPkg/Include/RedfishCollectionCommon.h new file mode 100644 index 0000000000..3962b361ed --- /dev/null +++ b/RedfishClientPkg/Include/RedfishCollectionCommon.h @@ -0,0 +1,53 @@ +/** @file=0D + Redfish feature driver collection common header file.=0D +=0D + (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef EFI_REDFISH_COLLECTION_COMMON_H_=0D +#define EFI_REDFISH_COLLECTION_COMMON_H_=0D +=0D +//=0D +// Libraries=0D +//=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +//=0D +// Protocols=0D +//=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#define IS_EMPTY_STRING(a) ((a) =3D=3D NULL || (a)[0] =3D=3D = '\0')=0D +#define REDFISH_DEBUG_TRACE DEBUG_INFO=0D +=0D +typedef struct _REDFISH_COLLECTION_PRIVATE {=0D + EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol;=0D + EDKII_REDFISH_FEATURE_PROTOCOL *FeatureProtocol;=0D + REDFISH_SERVICE RedfishService;=0D + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL ConfigHandler;=0D + EFI_EVENT Event;=0D + CHAR8 *CollectionPath;=0D + CHAR8 *CollectionJson;=0D + REDFISH_PAYLOAD CollectionPayload;=0D + REDFISH_RESPONSE RedResponse;=0D +} REDFISH_COLLECTION_PRIVATE;=0D +=0D +#define REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL(This) \=0D + BASE_CR ((This), REDFISH_COLLECTION_PRIVATE, ConfigHandler)=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Include/RedfishResourceCommon.h b/RedfishClie= ntPkg/Include/RedfishResourceCommon.h new file mode 100644 index 0000000000..1ba992bb69 --- /dev/null +++ b/RedfishClientPkg/Include/RedfishResourceCommon.h @@ -0,0 +1,123 @@ +/** @file=0D + Redfish feature driver common header file.=0D +=0D + (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef EFI_REDFISH_RESOURCE_COMMON_H_=0D +#define EFI_REDFISH_RESOURCE_COMMON_H_=0D +=0D +#define MAX_RED_PATH_LEN 128=0D +#define IS_EMPTY_STRING(a) ((a) =3D=3D NULL || (a)[0] =3D=3D '\0')=0D +#define REDFISH_DEBUG_TRACE DEBUG_INFO=0D +=0D +//=0D +// Libraries=0D +//=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +//=0D +// Protocols=0D +//=0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +=0D +typedef struct _REDFISH_RESOURCE_COMMON_PRIVATE {=0D + REDFISH_SERVICE RedfishService;=0D + EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol;=0D + EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL RedfishResourceConfig;=0D + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL ConfigHandler;=0D + EFI_EVENT Event;=0D + CHAR8 *Uri;=0D + CHAR8 *Json;=0D + REDFISH_PAYLOAD Payload;=0D +} REDFISH_RESOURCE_COMMON_PRIVATE;=0D +=0D +#define REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL(This) \= =0D + BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE, ConfigHandler)= =0D +=0D +#define REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL(This) = \=0D + BASE_CR ((This), REDFISH_RESOURCE_COMMON_PRIVATE, RedfishResourc= eConfig)=0D +=0D +=0D +/**=0D + Consume resource from given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishConsumeResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json=0D + );=0D +=0D +/**=0D + Provisioning redfish resource by given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] ResourceExist TRUE if resource exists, PUT method wil= l be used.=0D + FALSE if resource does not exist POST m= ethod is used.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishProvisioningResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN BOOLEAN ResourceExist=0D + );=0D +=0D +/**=0D + Check resource from given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishCheckResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json=0D + );=0D +=0D +/**=0D + Update resource to given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishUpdateResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json=0D + );=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index 8fa92d5b1e..f01509d78f 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -21,9 +21,12 @@ =0D [Protocols]=0D ## Include/Protocol/EdkIIRedfishFeature.h=0D - gEdkIIRedfishFeatureProtocolGuid =3D { 0x785CC694, 0x4930, 0xEFBF, { 0x2= A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }=0D + gEdkIIRedfishFeatureProtocolGuid =3D { 0x785CC694, 0x4930, 0xEFBF= , { 0x2A, 0xCB, 0xA4, 0xB6, 0xA1, 0xCC, 0xAA, 0x34 } }=0D + ## Include/Protocol/EdkIIRedfishResourceConfigProtocol.h=0D + gEdkIIRedfishResourceConfigProtocolGuid =3D { 0x6f164c68, 0xfb09, 0x4646= , { 0xa8, 0xd3, 0x24, 0x11, 0x5d, 0xab, 0x3e, 0xe7 } }=0D =0D [Guids]=0D + ## Include/Guid/RedfishClientPkgTokenSpace.h=0D gEfiRedfishClientPkgTokenSpaceGuid =3D { 0x8c444dae, 0x728b, 0x48ee, = { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }=0D =0D [PcdsFixedAtBuild]=0D @@ -35,3 +38,6 @@ #=0D gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEv= entGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8, = 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x10000003=0D =0D +[PcdsFixedAtBuild]=0D + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT= 32|0x10000001=0D + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UINT= 32|0x10000002=0D --=20 2.31.1.windows.1