From: mdkinney Date: Wed, 6 Dec 2006 05:13:52 +0000 (+0000) Subject: Move registration and processing of ExitBootServices() events into UefiDriverEntryPoi... X-Git-Tag: edk2-stable201903~23821 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=756e4264d3e06c986cab44abe9a4db55787f7a49;ds=inline 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 --- diff --git a/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c b/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c index 60177bc9c5..cd096c59b5 100644 --- a/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c +++ b/MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c @@ -22,6 +22,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @retval EFI_SUCCESS **/ + +EFI_EVENT _mDriverExitBootServicesNotifyEvent; + EFI_STATUS EFIAPI _DriverUnloadHandler ( @@ -41,6 +44,14 @@ _DriverUnloadHandler ( // unloaded, and the library destructors should not be called // if (!EFI_ERROR (Status)) { + // + // Close our ExitBootServices () notify function + // + if (_gDriverExitBootServicesEvent[0] != NULL) { + Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent); + ASSERT_EFI_ERROR (Status); + } + ProcessLibraryDestructorList (ImageHandle, gST); } @@ -50,6 +61,39 @@ _DriverUnloadHandler ( 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. @@ -84,6 +128,21 @@ _ModuleEntryPoint ( // 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... // @@ -106,6 +165,14 @@ _ModuleEntryPoint ( // If all of the drivers returned errors, then invoke all of the library destructors // if (EFI_ERROR (Status)) { + // + // Close our ExitBootServices () notify function + // + if (_gDriverExitBootServicesEvent[0] != NULL) { + Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent); + ASSERT_EFI_ERROR (Status); + } + ProcessLibraryDestructorList (ImageHandle, SystemTable); }