mirror of https://github.com/acidanthera/audk.git
Move registration and processing of ExitBootServices() events into UefiDriverEntryPoint/DriverEntryPoint.c
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2056 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4eba088547
commit
756e4264d3
|
@ -22,6 +22,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
@retval EFI_SUCCESS
|
@retval EFI_SUCCESS
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
EFI_EVENT _mDriverExitBootServicesNotifyEvent;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
_DriverUnloadHandler (
|
_DriverUnloadHandler (
|
||||||
|
@ -41,6 +44,14 @@ _DriverUnloadHandler (
|
||||||
// unloaded, and the library destructors should not be called
|
// unloaded, and the library destructors should not be called
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Close our ExitBootServices () notify function
|
||||||
|
//
|
||||||
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
|
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
ProcessLibraryDestructorList (ImageHandle, gST);
|
ProcessLibraryDestructorList (ImageHandle, gST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +61,39 @@ _DriverUnloadHandler (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
_DriverExitBootServices (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Set AtRuntime flag as TRUE after ExitBootServices
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Event - The Event that is being processed
|
||||||
|
|
||||||
|
Context - Event Context
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {
|
||||||
|
ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
|
||||||
|
ChildNotifyEventHandler (Event, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enrty point to DXE Driver.
|
Enrty point to DXE Driver.
|
||||||
|
|
||||||
|
@ -84,6 +128,21 @@ _ModuleEntryPoint (
|
||||||
//
|
//
|
||||||
ProcessLibraryConstructorList (ImageHandle, SystemTable);
|
ProcessLibraryConstructorList (ImageHandle, SystemTable);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register our ExitBootServices () notify function
|
||||||
|
//
|
||||||
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
|
Status = gBS->CreateEvent (
|
||||||
|
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
|
||||||
|
EFI_TPL_NOTIFY,
|
||||||
|
_DriverExitBootServices,
|
||||||
|
NULL,
|
||||||
|
&_mDriverExitBootServicesNotifyEvent
|
||||||
|
);
|
||||||
|
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install unload handler...
|
// Install unload handler...
|
||||||
//
|
//
|
||||||
|
@ -106,6 +165,14 @@ _ModuleEntryPoint (
|
||||||
// If all of the drivers returned errors, then invoke all of the library destructors
|
// If all of the drivers returned errors, then invoke all of the library destructors
|
||||||
//
|
//
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Close our ExitBootServices () notify function
|
||||||
|
//
|
||||||
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
|
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
ProcessLibraryDestructorList (ImageHandle, SystemTable);
|
ProcessLibraryDestructorList (ImageHandle, SystemTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue