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.web11.8337.1657628509299240508 for ; Tue, 12 Jul 2022 05:21:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=i8VLeO/2; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0192e24d61=nickle.wang@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26CCJei3024337; Tue, 12 Jul 2022 12:21:46 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=3OwYZtQEC63Pghc5r2jkoqcstf/NIUE5EWeW4wLr0iI=; b=i8VLeO/2s05oCQSL5Q6s4ufyJ/ILogJnNaCLpy3TVEajAXUPyL388CYqvxXnebsONJ2a /gz4EwT5Dp+/wCc+7jYSp1aj7u/VieWL4uHZJx7YLBHrbuSzgYACY7NSzxoUA8luf/Wx jO4WNKx6dxe8R7zUUxwygbx8/z4eNmo2R2g7NCxlpr4qaizJ0i5SxfTUbQ9Fiv8gdQtS qqMdB14r409TQVOvtzdierMX07ufeWziQi3mXjXJo7a/MJOnvXidpIVWVllL26tv2fIZ +TJ16fFsi2oN7hglQVdn/kZ8Gs+3PUgZ/mqJp6PmkQvUNsFGJNHKx50jDGbyAkbcq4+q Kg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3h98uw80jg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 12:21:46 +0000 Received: from p1lg14885.dc01.its.hpecorp.net (unknown [10.119.18.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id 32D34800224; Tue, 12 Jul 2022 12:21:46 +0000 (UTC) Received: from WAFM3XJD5N.asiapacific.hpqcorp.net (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id 29B6280562B; Tue, 12 Jul 2022 12:21:45 +0000 (UTC) From: "Nickle Wang" To: devel@edk2.groups.io Cc: Abner Chang , Yang Atom , Nick Ramirez Subject: [edk2-staging][PATCH 01/15] edk2-staging/RedfishClientPkg: Introduce Redfish event library Date: Tue, 12 Jul 2022 20:21:29 +0800 Message-Id: <20220712122143.1827-2-nickle.wang@hpe.com> X-Mailer: git-send-email 2.32.0.windows.2 In-Reply-To: <20220712122143.1827-1-nickle.wang@hpe.com> References: <20220712122143.1827-1-nickle.wang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: t4Ox4PGxq97fh3O_XOcb0_GMch39Xkdd X-Proofpoint-ORIG-GUID: t4Ox4PGxq97fh3O_XOcb0_GMch39Xkdd X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-12_08,2022-07-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=878 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 phishscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207120048 Content-Transfer-Encoding: quoted-printable Add RedfishEventLib to handle Redfish event. There are two events defined in this library. One is the event before feature driver provisioning and the other one is the event after all provisioning is finished. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Yang Atom Cc: Nick Ramirez --- .../Include/Guid/RedfishClientEventGroup.h | 27 ++++ .../Include/Library/RedfishEventLib.h | 77 ++++++++++ .../Library/RedfishEventLib/RedfishEventLib.c | 139 ++++++++++++++++++ .../RedfishEventLib/RedfishEventLib.inf | 42 ++++++ RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 + RedfishClientPkg/RedfishClientPkg.dec | 5 + 6 files changed, 291 insertions(+) create mode 100644 RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h create mode 100644 RedfishClientPkg/Include/Library/RedfishEventLib.h create mode 100644 RedfishClientPkg/Library/RedfishEventLib/RedfishEventLi= b.c create mode 100644 RedfishClientPkg/Library/RedfishEventLib/RedfishEventLi= b.inf diff --git a/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h b/Redf= ishClientPkg/Include/Guid/RedfishClientEventGroup.h new file mode 100644 index 0000000000..0d88dd4726 --- /dev/null +++ b/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h @@ -0,0 +1,27 @@ +/** @file=0D + GUID for Redfish Client Event Group GUID=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef REDFISH_CLIENT_EVENT_GROUP_GUID_H_=0D +#define REDFISH_CLIENT_EVENT_GROUP_GUID_H_=0D +=0D +#define REDFISH_CLIENT_FEATURE_READY_TO_PROVISIONING_GUID \=0D + { \=0D + 0x77E4FC1C, 0x2428, 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E= , 0xF0 } \=0D + }=0D +=0D +extern EFI_GUID gEfiRedfishClientFeatureReadyToProvisioningGuid;=0D +=0D +#define REDFISH_CLIENT_FEATURE_AFTER_PROVISIONING_GUID \=0D + { \=0D + 0xE547CB6F, 0x306F, 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E= , 0xD0 } \=0D + }=0D +=0D +extern EFI_GUID gEfiRedfishClientFeatureAfterProvisioningGuid;=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Include/Library/RedfishEventLib.h b/RedfishCl= ientPkg/Include/Library/RedfishEventLib.h new file mode 100644 index 0000000000..1f3d0acf19 --- /dev/null +++ b/RedfishClientPkg/Include/Library/RedfishEventLib.h @@ -0,0 +1,77 @@ +/** @file=0D + This file defines the Redfish event library interface.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef REDFISH_EVENT_LIB_H_=0D +#define REDFISH_EVENT_LIB_H_=0D +=0D +#include =0D +=0D +/**=0D + Create an EFI event before Redfish provisioning start.=0D +=0D + @param NotifyFunction The notification function to call when= the event is signaled.=0D + @param NotifyContext The content to pass to NotifyFunction = when the event is signaled.=0D + @param ReadyToProvisioningEvent Returns the EFI event returned from gB= S->CreateEvent(Ex).=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +CreateReadyToProvisioningEvent (=0D + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL=0D + IN VOID *NotifyContext, OPTIONAL=0D + OUT EFI_EVENT *ReadyToProvisioningEvent=0D + );=0D +=0D +/**=0D + Create an EFI event after Redfish provisioning finished.=0D +=0D + @param NotifyFunction The notification function to call when= the event is signaled.=0D + @param NotifyContext The content to pass to NotifyFunction = when the event is signaled.=0D + @param ReadyToProvisioningEvent Returns the EFI event returned from gB= S->CreateEvent(Ex).=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +CreateAfterProvisioningEvent (=0D + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL=0D + IN VOID *NotifyContext, OPTIONAL=0D + OUT EFI_EVENT *ReadyToProvisioningEvent=0D + );=0D +=0D +/**=0D + Signal ready to provisioning event.=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +SignalReadyToProvisioningEvent (=0D + IN VOID=0D + );=0D +=0D +/**=0D + Signal after provisioning event.=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +SignalAfterProvisioningEvent (=0D + IN VOID=0D + );=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c b/R= edfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c new file mode 100644 index 0000000000..0a8483c371 --- /dev/null +++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c @@ -0,0 +1,139 @@ +/** @file=0D + Redfish event library to deliver Redfish specific event.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + Create an EFI event before Redfish provisioning start.=0D +=0D + @param NotifyFunction The notification function to call when= the event is signaled.=0D + @param NotifyContext The content to pass to NotifyFunction = when the event is signaled.=0D + @param ReadyToProvisioningEvent Returns the EFI event returned from gB= S->CreateEvent(Ex).=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +CreateReadyToProvisioningEvent (=0D + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL=0D + IN VOID *NotifyContext, OPTIONAL=0D + OUT EFI_EVENT *ReadyToProvisioningEvent=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D gBS->CreateEventEx (=0D + EVT_NOTIFY_SIGNAL,=0D + TPL_CALLBACK,=0D + (NotifyFunction =3D=3D NULL ? EfiEventEmptyFunction : No= tifyFunction),=0D + NotifyContext,=0D + &gEfiRedfishClientFeatureReadyToProvisioningGuid,=0D + ReadyToProvisioningEvent=0D + );=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Create an EFI event after Redfish provisioning finished.=0D +=0D + @param NotifyFunction The notification function to call when= the event is signaled.=0D + @param NotifyContext The content to pass to NotifyFunction = when the event is signaled.=0D + @param ReadyToProvisioningEvent Returns the EFI event returned from gB= S->CreateEvent(Ex).=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +CreateAfterProvisioningEvent (=0D + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL=0D + IN VOID *NotifyContext, OPTIONAL=0D + OUT EFI_EVENT *ReadyToProvisioningEvent=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D gBS->CreateEventEx (=0D + EVT_NOTIFY_SIGNAL,=0D + TPL_CALLBACK,=0D + (NotifyFunction =3D=3D NULL ? EfiEventEmptyFunction : No= tifyFunction),=0D + NotifyContext,=0D + &gEfiRedfishClientFeatureAfterProvisioningGuid,=0D + ReadyToProvisioningEvent=0D + );=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Signal ready to provisioning event.=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +SignalReadyToProvisioningEvent (=0D + IN VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_EVENT Event;=0D +=0D + Status =3D CreateReadyToProvisioningEvent (NULL, NULL, &Event);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n"= , __FUNCTION__));=0D + return Status;=0D + }=0D +=0D + gBS->SignalEvent (Event);=0D + gBS->CloseEvent (Event);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Signal after provisioning event.=0D +=0D + @retval EFI_SUCCESS Event was created.=0D + @retval Other Event was not created.=0D +=0D +**/=0D +EFI_STATUS=0D +SignalAfterProvisioningEvent (=0D + IN VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_EVENT Event;=0D +=0D + Status =3D CreateAfterProvisioningEvent (NULL, NULL, &Event);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n"= , __FUNCTION__));=0D + return Status;=0D + }=0D +=0D + gBS->SignalEvent (Event);=0D + gBS->CloseEvent (Event);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf b= /RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf new file mode 100644 index 0000000000..a9d475c27c --- /dev/null +++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf @@ -0,0 +1,42 @@ +## @file=0D +#=0D +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010006=0D + BASE_NAME =3D RedfishEventLib=0D + FILE_GUID =3D C4F7E27D-2338-43EA-9D1F-D10960E36521= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D RedfishEventLib| DXE_DRIVER UEFI_DRIV= ER=0D +=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC=0D +#=0D +=0D +[Sources]=0D + RedfishEventLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + RedfishPkg/RedfishPkg.dec=0D + RedfishClientPkg/RedfishClientPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + DebugLib=0D + UefiBootServicesTableLib=0D + UefiLib=0D +=0D +[Protocols]=0D +=0D +[Pcd]=0D +=0D +[Guids]=0D + gEfiRedfishClientFeatureReadyToProvisioningGuid=0D + gEfiRedfishClientFeatureAfterProvisioningGuid=0D diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc b/RedfishClientPkg/= RedfishClientLibs.dsc.inc index 5467acedd0..ce1c27d884 100644 --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc @@ -28,3 +28,4 @@ RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/R= edfishContentCodingLibNull.inf=0D ConverterCommonLib|RedfishClientPkg/ConverterLib/edk2library/ConverterCo= mmonLib/ConverterCommonLib.inf=0D =0D + RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib= .inf=0D diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index 09df062dd3..39b2f5baf8 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -21,6 +21,7 @@ =0D [LibraryClasses]=0D RedfishFeatureUtilityLib|Include/Library/RedfishFeatureUtilityLib.h=0D + RedfishEventLib|Include/Library/RedfishEventLib.h=0D =0D [LibraryClasses.Common.Private]=0D ## @libraryclass Redfish Helper Library=0D @@ -39,6 +40,10 @@ ## Include/Guid/RedfishClientPkgTokenSpace.h=0D gEfiRedfishClientPkgTokenSpaceGuid =3D { 0x8c444dae, 0x728b, 0x48ee, = { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }=0D =0D + ## Include/Guid/RedfishClientEventGroup.h=0D + gEfiRedfishClientFeatureReadyToProvisioningGuid =3D { 0x77E4FC1C, 0x2428= , 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } }=0D + gEfiRedfishClientFeatureAfterProvisioningGuid =3D { 0xE547CB6F, 0x306F= , 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } }=0D +=0D [PcdsFixedAtBuild]=0D gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT= 32|0x10000001=0D gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UINT= 32|0x10000002=0D --=20 2.32.0.windows.2