/** @file\r
Capsule library runtime support.\r
\r
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
\r
-extern EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable;\r
-extern BOOLEAN mIsVirtualAddrConverted;\r
+EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;\r
+BOOLEAN mIsVirtualAddrConverted = FALSE;\r
+EFI_EVENT mDxeRuntimeCapsuleLibVirtualAddressChangeEvent = NULL;\r
\r
/**\r
Convert EsrtTable physical address to virtual address.\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_EVENT Event;\r
\r
//\r
// Make sure we can handle virtual address changes.\r
//\r
- Event = NULL;\r
Status = gBS->CreateEventEx (\r
EVT_NOTIFY_SIGNAL,\r
TPL_NOTIFY,\r
DxeCapsuleLibVirtualAddressChangeEvent,\r
NULL,\r
&gEfiEventVirtualAddressChangeGuid,\r
- &Event\r
+ &mDxeRuntimeCapsuleLibVirtualAddressChangeEvent\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
return EFI_SUCCESS;\r
}\r
+\r
+/**\r
+ The destructor function closes the VirtualAddressChange event.\r
+\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The destructor completed successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DxeRuntimeCapsuleLibDestructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Close the VirtualAddressChange event.\r
+ //\r
+ Status = gBS->CloseEvent (mDxeRuntimeCapsuleLibVirtualAddressChangeEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r