]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiRuntimeLib/RuntimeLib.c
Use GUIDed event for virtual address change event
[mirror_edk2.git] / MdePkg / Library / UefiRuntimeLib / RuntimeLib.c
index 1fe7c1f62097636e3315beb419d364da0d89aeaf..2a6ab39ba441a2d7efc4a217dbb2b42fab20aead 100644 (file)
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include <RuntimeLibInternal.h>\r
+#include "RuntimeLibInternal.h"\r
 \r
 ///\r
 /// Driver Lib Module Globals\r
@@ -22,7 +22,7 @@ EFI_EVENT              mEfiVirtualNotifyEvent;
 EFI_EVENT              mEfiExitBootServicesEvent;\r
 BOOLEAN                mEfiGoneVirtual         = FALSE;\r
 BOOLEAN                mEfiAtRuntime           = FALSE;\r
-EFI_RUNTIME_SERVICES          *mRT;\r
+EFI_RUNTIME_SERVICES   *gInternalRT;\r
 \r
 /**\r
   Set AtRuntime flag as TRUE after ExitBootServices.\r
@@ -63,13 +63,13 @@ RuntimeLibVirtualNotifyEvent (
   //\r
   // Update global for Runtime Services Table and IO\r
   //\r
-  EfiConvertPointer (0, (VOID **) &mRT);\r
+  EfiConvertPointer (0, (VOID **) &gInternalRT);\r
 \r
   mEfiGoneVirtual = TRUE;\r
 }\r
 \r
 /**\r
-  Intialize runtime Driver Lib if it has not yet been initialized.\r
+  Initialize runtime Driver Lib if it has not yet been initialized.\r
   It will ASSERT() if gRT is NULL or gBS is NULL.\r
   It will ASSERT() if that operation fails.\r
 \r
@@ -90,25 +90,27 @@ RuntimeDriverLibConstruct (
   ASSERT (gRT != NULL);\r
   ASSERT (gBS != NULL);\r
 \r
-  mRT = gRT;\r
+  gInternalRT = gRT;\r
   //\r
   // Register SetVirtualAddressMap () notify function\r
   //\r
-  Status = gBS->CreateEvent (\r
-                  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
                   TPL_NOTIFY,\r
                   RuntimeLibVirtualNotifyEvent,\r
                   NULL,\r
+                  &gEfiEventVirtualAddressChangeGuid,\r
                   &mEfiVirtualNotifyEvent\r
                   );\r
 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  Status = gBS->CreateEvent (\r
-                  EVT_SIGNAL_EXIT_BOOT_SERVICES,\r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
                   TPL_NOTIFY,\r
                   RuntimeLibExitBootServicesEvent,\r
                   NULL,\r
+                  &gEfiEventExitBootServicesGuid,\r
                   &mEfiExitBootServicesEvent\r
                   );\r
 \r
@@ -152,9 +154,16 @@ RuntimeDriverLibDeconstruct (
 }\r
 \r
 /**\r
-  Return TRUE if ExitBootServices () has been called.\r
+  This function allows the caller to determine if UEFI ExitBootServices() has been called.\r
+\r
+  This function returns TRUE after all the EVT_SIGNAL_EXIT_BOOT_SERVICES functions have\r
+  executed as a result of the OS calling ExitBootServices().  Prior to this time FALSE\r
+  is returned. This function is used by runtime code to decide it is legal to access\r
+  services that go away after ExitBootServices().\r
+\r
+  @retval  TRUE  The system has finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event.\r
+  @retval  FALSE The system has not finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event.\r
 \r
-  @retval TRUE If ExitBootServices () has been called\r
 **/\r
 BOOLEAN\r
 EFIAPI\r
@@ -166,9 +175,16 @@ EfiAtRuntime (
 }\r
 \r
 /**\r
-  Return TRUE if SetVirtualAddressMap () has been called.\r
+  This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called. \r
+\r
+  This function returns TRUE after all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE functions have\r
+  executed as a result of the OS calling SetVirtualAddressMap(). Prior to this time FALSE\r
+  is returned. This function is used by runtime code to decide it is legal to access services\r
+  that go away after SetVirtualAddressMap().\r
+\r
+  @retval  TRUE  The system has finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
+  @retval  FALSE The system has not finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
 \r
-  @retval TRUE  If SetVirtualAddressMap () has been called\r
 **/\r
 BOOLEAN\r
 EFIAPI\r