diff options
author | Xu, Wei6 <wei6.xu@intel.com> | 2019-07-26 11:10:54 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2019-07-29 11:01:40 +0800 |
commit | 0f4b77f5b2efe4de8694c02c1cead7418595f1cb (patch) | |
tree | da0b7de428a65bf01f59a75c419e4e26e7615c82 /MdePkg/Library/UefiDebugLibDebugPortProtocol | |
parent | e92bdcb3ecbf73b3a56378c1f6e054335215d939 (diff) | |
download | edk2-0f4b77f5b2efe4de8694c02c1cead7418595f1cb.tar.gz edk2-0f4b77f5b2efe4de8694c02c1cead7418595f1cb.tar.bz2 edk2-0f4b77f5b2efe4de8694c02c1cead7418595f1cb.zip |
MdePkg/UefiDebugLibDebugPortProtocol: Add destructor to CloseEvent
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2012
When driver is unloaded, the ExitBootSerivesEvent must be closed at
the same time. Otherwise exception will occur when ExitBootServices.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg/Library/UefiDebugLibDebugPortProtocol')
-rw-r--r-- | MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c | 23 | ||||
-rw-r--r-- | MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c index de60d339a8..6ea0912f2b 100644 --- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c +++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c @@ -75,3 +75,26 @@ DxeDebugLibConstructor( return EFI_SUCCESS;
}
+
+/**
+ The destructor closes Exit Boot Services Event.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeDebugLibDestructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if (mExitBootServicesEvent != NULL) {
+ SystemTable->BootServices->CloseEvent (mExitBootServicesEvent);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf index 10a8f2a857..ff09a12ce4 100644 --- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf +++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf @@ -22,6 +22,7 @@ LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = DxeDebugLibConstructor
+ DESTRUCTOR = DxeDebugLibDestructor
#
# VALID_ARCHITECTURES = IA32 X64 EBC
|