8.7 Handler for EVT_SIGNAL_EXIT_BOOT_SERVICES
Some DXE drivers need to place their controllers in a quiescent state or perform other controller-specific actions at the time that an operating system is about to take full control of the platform. In this case, the DXE driver should create a signal type event that is notified when gBS->ExitBootServices() is called by the EFI OS Loader.
Note: The notification function for this event is not allowed to use the Memory Allocation Services, or call any functions that use the Memory Allocation Services, and should only call functions that are known not to use Memory Allocation Services, because these services modify the current memory map.
The template code for the notification function and event registration is as follows:
1
VOID
2
EFIAPI
3
NotifyExitBootServices (
4
IN EFI_EVENT Event,
5
IN VOID *Context
6
)
7
{
8
//
9
// Put driver-specific actions here.
10
// No UEFI Memory Service may be used directly or indirectly.
11
//
12
}
13
EFI_STATUS
14
EFIAPI
15
SampleDriverInitialize (
16
IN EFI_HANDLE ImageHandle,
17
IN EFI_SYSTEM_TABLE *SystemTable
18
)
19
{
20
EFI_STATUS Status;
21
EFI_EVENT ExitBootServicesEvent;
22
//
23
// TODO: Other initialization of entry point can be added here.
24
//
25
//
26
// Here is just the sample of registration of
27
// EVT_SIGNAL_EXIT_BOOT_SERVICES
28
//
29
Status = gBS->CreateEventEx (
30
EVT_NOTIFY_SIGNAL,
31
TPL_CALLBACK,
32
NotifyExitBootServices,
33
NULL, // Parameter Context can be passed here
34
&gEfiEventExitBootServicesGuid,
35
&ExitBootServicesEvent
36
);
37
ASSERT_EFI_STATUS (Status);
38
}
Copied!
Last modified 1yr ago
Copy link