]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiLib/UefiNotTiano.c
UefiLib:
[mirror_edk2.git] / MdePkg / Library / UefiLib / UefiNotTiano.c
index f883c1d3c6247233ac44ff55647978f2ceb4795b..770d76df7eda02ab579752d6ec2e4e649f8ea77a 100644 (file)
@@ -16,7 +16,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-\r
+/**\r
+  An empty function to pass error checking of CreateEventEx (). \r
+  \r
+  This empty function enusres that EFI_EVENT_NOTIFY_SIGNAL_ALL is error
+  checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
+  \r
+**/\r
+VOID
+InternalEmptyFuntion (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  )
+{
+  return;
+}\r
 \r
 /**\r
   Create a Legacy Boot Event.  \r
@@ -39,6 +53,42 @@ EFIAPI
 EfiCreateEventLegacyBoot (\r
   OUT EFI_EVENT  *LegacyBootEvent\r
   )\r
+{\r
+  return EfiCreateEventLegacyBootEx (\r
+           EFI_TPL_CALLBACK,\r
+           InternalEmptyFuntion,\r
+           NULL,\r
+           LegacyBootEvent\r
+           );\r
+}\r
+\r
+/**\r
+  Create an EFI event in the Legacy Boot Event Group and allows\r
+  the caller to specify a notification function.  \r
+  \r
+  This function abstracts the creation of the Legacy Boot Event.\r
+  The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
+  This library abstracts the caller from how this event is created to prevent\r
+  to code form having to change with the version of the specification supported.\r
+  If LegacyBootEvent is NULL, then ASSERT().\r
+\r
+  @param  NotifyTpl         The task priority level of the event.\r
+  @param  NotifyFunction    The notification function to call when the event is signaled.\r
+  @param  NotifyContext     The content to pass to NotifyFunction when the event is signaled.\r
+  @param  LegacyBootEvent   Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+\r
+  @retval EFI_SUCCESS       Event was created.\r
+  @retval Other             Event was not created.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiCreateEventLegacyBootEx (\r
+  IN  EFI_TPL           NotifyTpl,\r
+  IN  EFI_EVENT_NOTIFY  NotifyFunction,  OPTIONAL\r
+  IN  VOID              *NotifyContext,  OPTIONAL\r
+  OUT EFI_EVENT         *LegacyBootEvent\r
+  )\r
 {\r
   EFI_STATUS    Status;\r
 \r
@@ -50,9 +100,9 @@ EfiCreateEventLegacyBoot (
   //\r
   Status = gBS->CreateEvent (\r
                   EFI_EVENT_SIGNAL_LEGACY_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,\r
-                  EFI_TPL_CALLBACK,\r
-                  NULL,\r
-                  NULL,\r
+                  NotifyTpl,\r
+                  NotifyFunction,\r
+                  NotifyContext,\r
                   LegacyBootEvent\r
                   );\r
 #else\r
@@ -61,18 +111,17 @@ EfiCreateEventLegacyBoot (
   //\r
   Status = gBS->CreateEventEx (\r
                   EVENT_NOTIFY_SIGNAL,\r
-                  EFI_TPL_CALLBACK,\r
-                  NULL,\r
-                  NULL,\r
+                  NotifyTpl,\r
+                  NotifyFunction,\r
+                  NotifyContext,\r
                   &gEfiEventLegacyBootGuid,\r
                   LegacyBootEvent\r
                   );\r
 #endif\r
+\r
   return Status;\r
 }\r
 \r
-\r
-\r
 /**\r
   Create a Read to Boot Event.  \r
   \r
@@ -94,6 +143,42 @@ EFIAPI
 EfiCreateEventReadyToBoot (\r
   OUT EFI_EVENT  *ReadyToBootEvent\r
   )\r
+{\r
+  return EfiCreateEventReadyToBootEx (\r
+           EFI_TPL_CALLBACK,\r
+           InternalEmptyFuntion,\r
+           NULL,\r
+           ReadyToBootEvent\r
+           );\r
+}\r
+\r
+/**\r
+  Create an EFI event in the Ready To Boot Event Group and allows\r
+  the caller to specify a notification function.  \r
+  \r
+  This function abstracts the creation of the Ready to Boot Event.\r
+  The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
+  This library abstracts the caller from how this event is created to prevent\r
+  to code form having to change with the version of the specification supported.\r
+  If ReadyToBootEvent is NULL, then ASSERT().\r
+\r
+  @param  NotifyTpl         The task priority level of the event.\r
+  @param  NotifyFunction    The notification function to call when the event is signaled.\r
+  @param  NotifyContext     The content to pass to NotifyFunction when the event is signaled.\r
+  @param  LegacyBootEvent   Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+\r
+  @retval EFI_SUCCESS       Event was created.\r
+  @retval Other             Event was not created.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiCreateEventReadyToBootEx (\r
+  IN  EFI_TPL           NotifyTpl,\r
+  IN  EFI_EVENT_NOTIFY  NotifyFunction,  OPTIONAL\r
+  IN  VOID              *NotifyContext,  OPTIONAL\r
+  OUT EFI_EVENT         *ReadyToBootEvent\r
+  )\r
 {\r
   EFI_STATUS    Status;\r
 \r
@@ -105,9 +190,9 @@ EfiCreateEventReadyToBoot (
   //\r
   Status = gBS->CreateEvent (\r
                   EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,\r
-                  EFI_TPL_CALLBACK,\r
-                  NULL,\r
-                  NULL,\r
+                  NotifyTpl,\r
+                  NotifyFunction,\r
+                  NotifyContext,\r
                   ReadyToBootEvent\r
                   );\r
 #else\r
@@ -116,9 +201,9 @@ EfiCreateEventReadyToBoot (
   //\r
   Status = gBS->CreateEventEx (\r
                   EVENT_NOTIFY_SIGNAL,\r
-                  EFI_TPL_CALLBACK,\r
-                  NULL,\r
-                  NULL,\r
+                  NotifyTpl,\r
+                  NotifyFunction,\r
+                  NotifyContext,\r
                   &gEfiEventReadyToBootGuid,\r
                   ReadyToBootEvent\r
                   );\r