mirror of https://github.com/acidanthera/audk.git
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:
parent
c103e09b52
commit
96b17e00b9
|
@ -47,9 +47,8 @@
|
|||
#include <Protocol/FirmwareManagement.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
|
||||
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;
|
||||
BOOLEAN mIsVirtualAddrConverted = 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;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Capsule library instance for DXE_DRIVER module types.
|
||||
#
|
||||
# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -23,6 +23,7 @@
|
|||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = CapsuleLib|DXE_DRIVER UEFI_APPLICATION
|
||||
CONSTRUCTOR = DxeCapsuleLibConstructor
|
||||
DESTRUCTOR = DxeCapsuleLibDestructor
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Capsule library runtime support.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -26,8 +26,9 @@
|
|||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
extern EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable;
|
||||
extern BOOLEAN mIsVirtualAddrConverted;
|
||||
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;
|
||||
BOOLEAN mIsVirtualAddrConverted = FALSE;
|
||||
EFI_EVENT mDxeRuntimeCapsuleLibVirtualAddressChangeEvent = NULL;
|
||||
|
||||
/**
|
||||
Convert EsrtTable physical address to virtual address.
|
||||
|
@ -92,21 +93,45 @@ DxeRuntimeCapsuleLibConstructor (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT Event;
|
||||
|
||||
//
|
||||
// Make sure we can handle virtual address changes.
|
||||
//
|
||||
Event = NULL;
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_NOTIFY,
|
||||
DxeCapsuleLibVirtualAddressChangeEvent,
|
||||
NULL,
|
||||
&gEfiEventVirtualAddressChangeGuid,
|
||||
&Event
|
||||
&mDxeRuntimeCapsuleLibVirtualAddressChangeEvent
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
The destructor function closes the VirtualAddressChange 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
|
||||
DxeRuntimeCapsuleLibDestructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Close the VirtualAddressChange event.
|
||||
//
|
||||
Status = gBS->CloseEvent (mDxeRuntimeCapsuleLibVirtualAddressChangeEvent);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Capsule library instance for DXE_RUNTIME_DRIVER module types.
|
||||
#
|
||||
# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -24,6 +24,8 @@
|
|||
LIBRARY_CLASS = CapsuleLib|DXE_RUNTIME_DRIVER
|
||||
CONSTRUCTOR = DxeCapsuleLibConstructor
|
||||
CONSTRUCTOR = DxeRuntimeCapsuleLibConstructor
|
||||
DESTRUCTOR = DxeCapsuleLibDestructor
|
||||
DESTRUCTOR = DxeRuntimeCapsuleLibDestructor
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
|
|
Loading…
Reference in New Issue