MdeModulePkg/CapsuleLib: Add lib destructors to handle unclosed events

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Hao Wu
2017-03-10 10:13:32 +08:00
parent c103e09b52
commit 96b17e00b9
4 changed files with 65 additions and 13 deletions

View File

@@ -47,9 +47,8 @@
#include <Protocol/FirmwareManagement.h>
#include <Protocol/DevicePath.h>
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;
BOOLEAN mIsVirtualAddrConverted = FALSE;
BOOLEAN mDxeCapsuleLibEndOfDxe = FALSE;
BOOLEAN mDxeCapsuleLibEndOfDxe = FALSE;
EFI_EVENT mDxeCapsuleLibEndOfDxeEvent = NULL;
/**
Initialize capsule related variables.
@@ -1654,7 +1653,6 @@ DxeCapsuleLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_EVENT EndOfDxeEvent;
EFI_STATUS Status;
Status = gBS->CreateEventEx (
@@ -1663,7 +1661,7 @@ DxeCapsuleLibConstructor (
DxeCapsuleLibEndOfDxe,
NULL,
&gEfiEndOfDxeEventGroupGuid,
&EndOfDxeEvent
&mDxeCapsuleLibEndOfDxeEvent
);
ASSERT_EFI_ERROR (Status);
@@ -1671,3 +1669,29 @@ DxeCapsuleLibConstructor (
return EFI_SUCCESS;
}
/**
The destructor function closes the End of DXE 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 completed successfully.
**/
EFI_STATUS
EFIAPI
DxeCapsuleLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
//
// Close the End of DXE event.
//
Status = gBS->CloseEvent (mDxeCapsuleLibEndOfDxeEvent);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}