8.2 Write DXE Driver Entry Point
The [Defines] section of the INF file defines the entry point of the DXE driver.
Unlike the UEFI driver entry point, which is only allowed to install protocol instances onto its own image handle and may not touch any hardware, a DXE driver entry point has no such restriction. It may install any protocol into the system and perform necessary hardware and software initializations.
In the following example (from the WatchDogTimerDxe driver in the MdeModulePkg) the DXE driver entry point installs its Architectural Protocol if the protocol is not yet installed.
1
EFI_STATUS
2
EFIAPI
3
WatchdogTimerDriverInitialize (
4
IN EFI_HANDLE ImageHandle,
5
IN EFI_SYSTEM_TABLE *SystemTable
6
)
7
{
8
EFI_STATUS Status;
9
//
10
// Make sure the Watchdog Timer Architectural Protocol has not been
11
// installed in the system yet.
12
//
13
ASSERT_PROTOCOL_ALREADY_INSTALLED (
14
NULL,
15
&gEfiWatchdogTimerArchProtocolGuid
16
);
17
//
18
// Create the timer event to implement a simple watchdog timer
19
//
20
Status = gBS->CreateEvent (
21
EVT_TIMER | EVT_NOTIFY_SIGNAL,
22
TPL_NOTIFY,
23
WatchdogTimerDriverExpires,
24
NULL,
25
&mWatchdogTimerEvent
26
);
27
ASSERT_EFI_ERROR (Status);
Copied!
The two parameters for the DXE driver entry point are ImageHandle and SystemTable. ImageHandle refers to the image handle of the DXE driver.
SystemTable points to the EFI System Table.
Last modified 1yr ago
Copy link