X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FLibrary%2FEdkUefiRuntimeLib%2FIpf%2FRuntimeLib.c;h=ba00daf0ff97b409a62bfff97bda6b2998266f37;hp=3e9554721a84026943f09f2c33085f8ca2b8a412;hb=020a9a5b780d8fcc278e23d91b0a8aa8e1858baa;hpb=c25aaa00aa0e39ed1242a29576703cffedef850a diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c index 3e9554721a..ba00daf0ff 100644 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c +++ b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c @@ -15,19 +15,15 @@ Module Name: --*/ -#include +//#include #include // // Driver Lib Module Globals // +static EFI_EVENT mEfiVirtualNotifyEvent; +EFI_RUNTIME_SERVICES *mRT; -STATIC EFI_EVENT mRuntimeNotifyEvent; -STATIC EFI_EVENT mEfiVirtualNotifyEvent; - -EFI_RUNTIME_SERVICES *mRT; - -STATIC VOID EFIAPI RuntimeDriverExitBootServices ( @@ -52,21 +48,11 @@ Returns: --*/ { - EFI_EVENT_NOTIFY ChildNotifyEventHandler; - UINTN Index; - - for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) { - ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index]; - ChildNotifyEventHandler (Event, NULL); + if (EfiAtRuntime()) { + return; } - - // - // Clear out BootService globals - // - gBS = NULL; } -STATIC VOID EFIAPI RuntimeLibVirtualNotifyEvent ( @@ -93,7 +79,7 @@ Returns: --*/ { - UINTN Index; + UINTN Index; EFI_EVENT_NOTIFY ChildNotifyEventHandler; for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) { @@ -137,31 +123,19 @@ Returns: mRT = SystemTable->RuntimeServices; - // - // Register our ExitBootServices () notify function - // - - Status = gBS->CreateEvent ( - EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES, - EFI_TPL_NOTIFY, - RuntimeDriverExitBootServices, - NULL, - &mRuntimeNotifyEvent - ); - ASSERT_EFI_ERROR (Status); - // // Register SetVirtualAddressMap () notify function // - - Status = gBS->CreateEvent ( - EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, - EFI_TPL_NOTIFY, - RuntimeLibVirtualNotifyEvent, - NULL, - mEfiVirtualNotifyEvent - ); - ASSERT_EFI_ERROR (Status); + if (_gDriverSetVirtualAddressMapEvent[0] != NULL) { + Status = gBS->CreateEvent ( + EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, + EFI_TPL_NOTIFY, + RuntimeLibVirtualNotifyEvent, + NULL, + &mEfiVirtualNotifyEvent + ); + ASSERT_EFI_ERROR (Status); + } return EFI_SUCCESS; } @@ -192,17 +166,13 @@ Returns: { EFI_STATUS Status; - // - // Close our ExitBootServices () notify function - // - Status = gBS->CloseEvent (mRuntimeNotifyEvent); - ASSERT_EFI_ERROR (Status); - // // Close SetVirtualAddressMap () notify function // - Status = gBS->CloseEvent (mEfiVirtualNotifyEvent); - ASSERT_EFI_ERROR (Status); + if (_gDriverSetVirtualAddressMapEvent[0] != NULL) { + Status = gBS->CloseEvent (mEfiVirtualNotifyEvent); + ASSERT_EFI_ERROR (Status); + } return EFI_SUCCESS; }