* [edk2-redfish-client][PATCH 1/6] RedfishClientPkg: Introduce Redfish event library
@ 2023-05-09 13:58 Nickle Wang
2023-05-10 1:29 ` Chang, Abner
0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang @ 2023-05-09 13:58 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy
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 <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
RedfishClientPkg/RedfishClientPkg.dec | 5 +
RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 +
.../RedfishEventLib/RedfishEventLib.inf | 42 ++++++
.../Include/Guid/RedfishClientEventGroup.h | 27 ++++
.../Include/Library/RedfishEventLib.h | 77 ++++++++++
.../Library/RedfishEventLib/RedfishEventLib.c | 138 ++++++++++++++++++
6 files changed, 290 insertions(+)
create mode 100644 RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
create mode 100644 RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
create mode 100644 RedfishClientPkg/Include/Library/RedfishEventLib.h
create mode 100644 RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/RedfishClientPkg.dec
index 09df062d..39b2f5ba 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -21,6 +21,7 @@
[LibraryClasses]
RedfishFeatureUtilityLib|Include/Library/RedfishFeatureUtilityLib.h
+ RedfishEventLib|Include/Library/RedfishEventLib.h
[LibraryClasses.Common.Private]
## @libraryclass Redfish Helper Library
@@ -39,6 +40,10 @@
## Include/Guid/RedfishClientPkgTokenSpace.h
gEfiRedfishClientPkgTokenSpaceGuid = { 0x8c444dae, 0x728b, 0x48ee, { 0x9e, 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }
+ ## Include/Guid/RedfishClientEventGroup.h
+ gEfiRedfishClientFeatureReadyToProvisioningGuid = { 0x77E4FC1C, 0x2428, 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } }
+ gEfiRedfishClientFeatureAfterProvisioningGuid = { 0xE547CB6F, 0x306F, 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } }
+
[PcdsFixedAtBuild]
gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT32|0x10000001
gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UINT32|0x10000002
diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc b/RedfishClientPkg/RedfishClientLibs.dsc.inc
index 5467aced..ce1c27d8 100644
--- a/RedfishClientPkg/RedfishClientLibs.dsc.inc
+++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc
@@ -28,3 +28,4 @@
RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
ConverterCommonLib|RedfishClientPkg/ConverterLib/edk2library/ConverterCommonLib/ConverterCommonLib.inf
+ RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
new file mode 100644
index 00000000..a9d475c2
--- /dev/null
+++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
@@ -0,0 +1,42 @@
+## @file
+#
+# (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010006
+ BASE_NAME = RedfishEventLib
+ FILE_GUID = C4F7E27D-2338-43EA-9D1F-D10960E36521
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = RedfishEventLib| DXE_DRIVER UEFI_DRIVER
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ RedfishEventLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ RedfishPkg/RedfishPkg.dec
+ RedfishClientPkg/RedfishClientPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ UefiBootServicesTableLib
+ UefiLib
+
+[Protocols]
+
+[Pcd]
+
+[Guids]
+ gEfiRedfishClientFeatureReadyToProvisioningGuid
+ gEfiRedfishClientFeatureAfterProvisioningGuid
diff --git a/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h b/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
new file mode 100644
index 00000000..07ce118e
--- /dev/null
+++ b/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
@@ -0,0 +1,27 @@
+/** @file
+ GUID for Redfish Client Event Group GUID
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_CLIENT_EVENT_GROUP_GUID_H_
+#define REDFISH_CLIENT_EVENT_GROUP_GUID_H_
+
+#define REDFISH_CLIENT_FEATURE_READY_TO_PROVISIONING_GUID \
+ { \
+ 0x77E4FC1C, 0x2428, 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } \
+ }
+
+extern EFI_GUID gEfiRedfishClientFeatureReadyToProvisioningGuid;
+
+#define REDFISH_CLIENT_FEATURE_AFTER_PROVISIONING_GUID \
+ { \
+ 0xE547CB6F, 0x306F, 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } \
+ }
+
+extern EFI_GUID gEfiRedfishClientFeatureAfterProvisioningGuid;
+
+#endif
diff --git a/RedfishClientPkg/Include/Library/RedfishEventLib.h b/RedfishClientPkg/Include/Library/RedfishEventLib.h
new file mode 100644
index 00000000..e569ac8b
--- /dev/null
+++ b/RedfishClientPkg/Include/Library/RedfishEventLib.h
@@ -0,0 +1,77 @@
+/** @file
+ This file defines the Redfish event library interface.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_EVENT_LIB_H_
+#define REDFISH_EVENT_LIB_H_
+
+#include <Uefi.h>
+
+/**
+ Create an EFI event before Redfish provisioning start.
+
+ @param NotifyFunction The notification function to call when the event is signaled.
+ @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
+ @param ReadyToProvisioningEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateReadyToProvisioningEvent (
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN VOID *NotifyContext, OPTIONAL
+ OUT EFI_EVENT *ReadyToProvisioningEvent
+ );
+
+/**
+ Create an EFI event after Redfish provisioning finished.
+
+ @param NotifyFunction The notification function to call when the event is signaled.
+ @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
+ @param ReadyToProvisioningEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateAfterProvisioningEvent (
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN VOID *NotifyContext, OPTIONAL
+ OUT EFI_EVENT *ReadyToProvisioningEvent
+ );
+
+/**
+ Signal ready to provisioning event.
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+SignalReadyToProvisioningEvent (
+ IN VOID
+ );
+
+/**
+ Signal after provisioning event.
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+SignalAfterProvisioningEvent (
+ IN VOID
+ );
+
+#endif
diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
new file mode 100644
index 00000000..b2a3db75
--- /dev/null
+++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
@@ -0,0 +1,138 @@
+/** @file
+ Redfish event library to deliver Redfish specific event.
+
+ (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+#include <Guid/RedfishClientEventGroup.h>
+
+#include <Library/UefiLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/RedfishEventLib.h>
+
+/**
+ Create an EFI event before Redfish provisioning start.
+
+ @param NotifyFunction The notification function to call when the event is signaled.
+ @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
+ @param ReadyToProvisioningEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateReadyToProvisioningEvent (
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN VOID *NotifyContext, OPTIONAL
+ OUT EFI_EVENT *ReadyToProvisioningEvent
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ (NotifyFunction == NULL ? EfiEventEmptyFunction : NotifyFunction),
+ NotifyContext,
+ &gEfiRedfishClientFeatureReadyToProvisioningGuid,
+ ReadyToProvisioningEvent
+ );
+
+ return Status;
+}
+
+/**
+ Create an EFI event after Redfish provisioning finished.
+
+ @param NotifyFunction The notification function to call when the event is signaled.
+ @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
+ @param ReadyToProvisioningEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateAfterProvisioningEvent (
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN VOID *NotifyContext, OPTIONAL
+ OUT EFI_EVENT *ReadyToProvisioningEvent
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ (NotifyFunction == NULL ? EfiEventEmptyFunction : NotifyFunction),
+ NotifyContext,
+ &gEfiRedfishClientFeatureAfterProvisioningGuid,
+ ReadyToProvisioningEvent
+ );
+
+ return Status;
+}
+
+/**
+ Signal ready to provisioning event.
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+SignalReadyToProvisioningEvent (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT Event;
+
+ Status = CreateReadyToProvisioningEvent (NULL, NULL, &Event);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n", __FUNCTION__));
+ return Status;
+ }
+
+ gBS->SignalEvent (Event);
+ gBS->CloseEvent (Event);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Signal after provisioning event.
+
+ @retval EFI_SUCCESS Event was created.
+ @retval Other Event was not created.
+
+**/
+EFI_STATUS
+SignalAfterProvisioningEvent (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT Event;
+
+ Status = CreateAfterProvisioningEvent (NULL, NULL, &Event);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n", __FUNCTION__));
+ return Status;
+ }
+
+ gBS->SignalEvent (Event);
+ gBS->CloseEvent (Event);
+
+ return EFI_SUCCESS;
+}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-redfish-client][PATCH 1/6] RedfishClientPkg: Introduce Redfish event library
2023-05-09 13:58 [edk2-redfish-client][PATCH 1/6] RedfishClientPkg: Introduce Redfish event library Nickle Wang
@ 2023-05-10 1:29 ` Chang, Abner
0 siblings, 0 replies; 2+ messages in thread
From: Chang, Abner @ 2023-05-10 1:29 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Tuesday, May 9, 2023 9:59 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-redfish-client][PATCH 1/6] RedfishClientPkg: Introduce Redfish
> event library
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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 <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
> RedfishClientPkg/RedfishClientPkg.dec | 5 +
> RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 +
> .../RedfishEventLib/RedfishEventLib.inf | 42 ++++++
> .../Include/Guid/RedfishClientEventGroup.h | 27 ++++
> .../Include/Library/RedfishEventLib.h | 77 ++++++++++
> .../Library/RedfishEventLib/RedfishEventLib.c | 138 ++++++++++++++++++
> 6 files changed, 290 insertions(+)
> create mode 100644
> RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
> create mode 100644 RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
> create mode 100644 RedfishClientPkg/Include/Library/RedfishEventLib.h
> create mode 100644
> RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
>
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index 09df062d..39b2f5ba 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -21,6 +21,7 @@
>
> [LibraryClasses]
> RedfishFeatureUtilityLib|Include/Library/RedfishFeatureUtilityLib.h
> + RedfishEventLib|Include/Library/RedfishEventLib.h
>
> [LibraryClasses.Common.Private]
> ## @libraryclass Redfish Helper Library @@ -39,6 +40,10 @@
> ## Include/Guid/RedfishClientPkgTokenSpace.h
> gEfiRedfishClientPkgTokenSpaceGuid = { 0x8c444dae, 0x728b, 0x48ee, { 0x9e,
> 0x19, 0x8f, 0x0a, 0x3d, 0x4e, 0x9c, 0xc8 } }
>
> + ## Include/Guid/RedfishClientEventGroup.h
> + gEfiRedfishClientFeatureReadyToProvisioningGuid = { 0x77E4FC1C, 0x2428,
> 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } }
> + gEfiRedfishClientFeatureAfterProvisioningGuid = { 0xE547CB6F, 0x306F,
> 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } }
> +
> [PcdsFixedAtBuild]
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT
> 32|0x10000001
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UIN
> T32|0x10000002
> diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc
> b/RedfishClientPkg/RedfishClientLibs.dsc.inc
> index 5467aced..ce1c27d8 100644
> --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc
> +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc
> @@ -28,3 +28,4 @@
>
> RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/Red
> fishContentCodingLibNull.inf
>
> ConverterCommonLib|RedfishClientPkg/ConverterLib/edk2library/ConverterCo
> mmonLib/ConverterCommonLib.inf
>
> +
> + RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventL
> + ib.inf
> diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
> b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
> new file mode 100644
> index 00000000..a9d475c2
> --- /dev/null
> +++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.inf
> @@ -0,0 +1,42 @@
> +## @file
> +#
> +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> # #
> +SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +[Defines]
> + INF_VERSION = 0x00010006
> + BASE_NAME = RedfishEventLib
> + FILE_GUID = C4F7E27D-2338-43EA-9D1F-D10960E36521
> + MODULE_TYPE = DXE_DRIVER
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = RedfishEventLib| DXE_DRIVER UEFI_DRIVER
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 EBC
> +#
> +
> +[Sources]
> + RedfishEventLib.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + RedfishPkg/RedfishPkg.dec
> + RedfishClientPkg/RedfishClientPkg.dec
> +
> +[LibraryClasses]
> + BaseLib
> + DebugLib
> + UefiBootServicesTableLib
> + UefiLib
> +
> +[Protocols]
> +
> +[Pcd]
> +
> +[Guids]
> + gEfiRedfishClientFeatureReadyToProvisioningGuid
> + gEfiRedfishClientFeatureAfterProvisioningGuid
> diff --git a/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
> b/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
> new file mode 100644
> index 00000000..07ce118e
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Guid/RedfishClientEventGroup.h
> @@ -0,0 +1,27 @@
> +/** @file
> + GUID for Redfish Client Event Group GUID
> +
> + (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_CLIENT_EVENT_GROUP_GUID_H_
> +#define REDFISH_CLIENT_EVENT_GROUP_GUID_H_
> +
> +#define REDFISH_CLIENT_FEATURE_READY_TO_PROVISIONING_GUID \
> + { \
> + 0x77E4FC1C, 0x2428, 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D,
> +0x4E, 0xF0 } \
> + }
> +
> +extern EFI_GUID gEfiRedfishClientFeatureReadyToProvisioningGuid;
> +
> +#define REDFISH_CLIENT_FEATURE_AFTER_PROVISIONING_GUID \
> + { \
> + 0xE547CB6F, 0x306F, 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1,
> +0x2E, 0xD0 } \
> + }
> +
> +extern EFI_GUID gEfiRedfishClientFeatureAfterProvisioningGuid;
> +
> +#endif
> diff --git a/RedfishClientPkg/Include/Library/RedfishEventLib.h
> b/RedfishClientPkg/Include/Library/RedfishEventLib.h
> new file mode 100644
> index 00000000..e569ac8b
> --- /dev/null
> +++ b/RedfishClientPkg/Include/Library/RedfishEventLib.h
> @@ -0,0 +1,77 @@
> +/** @file
> + This file defines the Redfish event library interface.
> +
> + (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_EVENT_LIB_H_
> +#define REDFISH_EVENT_LIB_H_
> +
> +#include <Uefi.h>
> +
> +/**
> + Create an EFI event before Redfish provisioning start.
> +
> + @param NotifyFunction The notification function to call when the
> event is signaled.
> + @param NotifyContext The content to pass to NotifyFunction when
> the event is signaled.
> + @param ReadyToProvisioningEvent Returns the EFI event returned from
> gBS->CreateEvent(Ex).
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CreateReadyToProvisioningEvent (
> + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
> + IN VOID *NotifyContext, OPTIONAL
> + OUT EFI_EVENT *ReadyToProvisioningEvent
> + );
> +
> +/**
> + Create an EFI event after Redfish provisioning finished.
> +
> + @param NotifyFunction The notification function to call when the
> event is signaled.
> + @param NotifyContext The content to pass to NotifyFunction when
> the event is signaled.
> + @param ReadyToProvisioningEvent Returns the EFI event returned from
> gBS->CreateEvent(Ex).
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CreateAfterProvisioningEvent (
> + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
> + IN VOID *NotifyContext, OPTIONAL
> + OUT EFI_EVENT *ReadyToProvisioningEvent
> + );
> +
> +/**
> + Signal ready to provisioning event.
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +SignalReadyToProvisioningEvent (
> + IN VOID
> + );
> +
> +/**
> + Signal after provisioning event.
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +SignalAfterProvisioningEvent (
> + IN VOID
> + );
> +
> +#endif
> diff --git a/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
> b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
> new file mode 100644
> index 00000000..b2a3db75
> --- /dev/null
> +++ b/RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.c
> @@ -0,0 +1,138 @@
> +/** @file
> + Redfish event library to deliver Redfish specific event.
> +
> + (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Uefi.h>
> +
> +#include <Guid/RedfishClientEventGroup.h>
> +
> +#include <Library/UefiLib.h>
> +#include <Library/BaseLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/RedfishEventLib.h>
> +
> +/**
> + Create an EFI event before Redfish provisioning start.
> +
> + @param NotifyFunction The notification function to call when the
> event is signaled.
> + @param NotifyContext The content to pass to NotifyFunction when
> the event is signaled.
> + @param ReadyToProvisioningEvent Returns the EFI event returned from
> gBS->CreateEvent(Ex).
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CreateReadyToProvisioningEvent (
> + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
> + IN VOID *NotifyContext, OPTIONAL
> + OUT EFI_EVENT *ReadyToProvisioningEvent
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = gBS->CreateEventEx (
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + (NotifyFunction == NULL ? EfiEventEmptyFunction : NotifyFunction),
> + NotifyContext,
> + &gEfiRedfishClientFeatureReadyToProvisioningGuid,
> + ReadyToProvisioningEvent
> + );
> +
> + return Status;
> +}
> +
> +/**
> + Create an EFI event after Redfish provisioning finished.
> +
> + @param NotifyFunction The notification function to call when the
> event is signaled.
> + @param NotifyContext The content to pass to NotifyFunction when
> the event is signaled.
> + @param ReadyToProvisioningEvent Returns the EFI event returned from
> gBS->CreateEvent(Ex).
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CreateAfterProvisioningEvent (
> + IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
> + IN VOID *NotifyContext, OPTIONAL
> + OUT EFI_EVENT *ReadyToProvisioningEvent
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = gBS->CreateEventEx (
> + EVT_NOTIFY_SIGNAL,
> + TPL_CALLBACK,
> + (NotifyFunction == NULL ? EfiEventEmptyFunction : NotifyFunction),
> + NotifyContext,
> + &gEfiRedfishClientFeatureAfterProvisioningGuid,
> + ReadyToProvisioningEvent
> + );
> +
> + return Status;
> +}
> +
> +/**
> + Signal ready to provisioning event.
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +SignalReadyToProvisioningEvent (
> + IN VOID
> + )
> +{
> + EFI_STATUS Status;
> + EFI_EVENT Event;
> +
> + Status = CreateReadyToProvisioningEvent (NULL, NULL, &Event); if
> + (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n",
> __FUNCTION__));
> + return Status;
> + }
> +
> + gBS->SignalEvent (Event);
> + gBS->CloseEvent (Event);
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Signal after provisioning event.
> +
> + @retval EFI_SUCCESS Event was created.
> + @retval Other Event was not created.
> +
> +**/
> +EFI_STATUS
> +SignalAfterProvisioningEvent (
> + IN VOID
> + )
> +{
> + EFI_STATUS Status;
> + EFI_EVENT Event;
> +
> + Status = CreateAfterProvisioningEvent (NULL, NULL, &Event); if
> + (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to create after provisioning event\n",
> __FUNCTION__));
> + return Status;
> + }
> +
> + gBS->SignalEvent (Event);
> + gBS->CloseEvent (Event);
> +
> + return EFI_SUCCESS;
> +}
> --
> 2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-10 1:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 13:58 [edk2-redfish-client][PATCH 1/6] RedfishClientPkg: Introduce Redfish event library Nickle Wang
2023-05-10 1:29 ` Chang, Abner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox