summaryrefslogtreecommitdiff
path: root/MdePkg/Library
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-06 05:13:52 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2006-12-06 05:13:52 +0000
commit756e4264d3e06c986cab44abe9a4db55787f7a49 (patch)
tree328007ee8feb6750f0220be79417806a414a3689 /MdePkg/Library
parent4eba0885474e6b29a3985880ac334d368c5b8810 (diff)
downloadedk2-platforms-756e4264d3e06c986cab44abe9a4db55787f7a49.tar.xz
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
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c67
1 files changed, 67 insertions, 0 deletions
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.
@@ -85,6 +129,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...
//
if (_gDriverUnloadImageCount != 0) {
@@ -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);
}