11. DXE Drivers
11.1. Introduction
The DXE architecture provides a rich set of extensible services that provides for a wide variety of different system firmware designs. The DXE Foundation provides the generic services required to locate and execute DXE drivers. The DXE drivers are the components that actually initialize the platform and provide the services required to boot an UEFI-compliant operating system or a set of UEFI-compliant system utilities. There are many possible firmware implementations for any given platform. Because the DXE Foundation has fixed functionality, all the added value and flexibility in a firmware design is embodied in the implementation and organization of DXE drivers.
There are two basic classes of DXE drivers:
Early DXE Drivers
DXE Drivers that follow the UEFI Driver Model
Additional classifications of DXE drivers are also possible.
All DXE drivers may consume the UEFI Boot Services, UEFI Runtime Services, and DXE Services to perform their functions. DXE drivers must use dependency expressions to guarantee that the services and protocol interfaces they require are available before they are executed. See the following topics for the DXE Architectural Protocols upon which the services depend:
UEFI Boot Services Dependencies
UEFI Runtime Services Dependencies
DXE Services Dependencies
11.2. Classes of DXE Drivers
11.2.1. Early DXE Drivers
The first class of DXE drivers are those that execute very early in the DXE phase. The execution order of these DXE drivers depends on the following:
The presence and contents of an a priori file
The evaluation of dependency expressions
These early DXE drivers will typically contain basic services, processor initialization code, chipset initialization code, and platform initialization code. These early drivers will also typically produce the DXE Architectural Protocols that are required for the DXE Foundation to produces its full complement of UEFI Boot Services and UEFI Runtime Services. To support the fastest possible boot time, as much initialization should be deferred to the DXE drivers that follow UEFI Driver Model described in the UEFI 2.0 specification.
The early DXE drivers need to be aware that not all of the UEFI Boot Services, UEFI Runtime Services, and DXE Services may be available when they execute because not all of the DXE Architectural Protocols may be been registered yet.
11.2.2. DXE Drivers that Follow the UEFI Driver Model
The second class of DXE drivers are those that follow the UEFI Driver Model in the UEFI 2.0 specification. These drivers do not touch any hardware resources when they initialize. Instead, they register a Driver Binding Protocol interface in the handle database. The set of Driver Binding Protocols are used by the Boot Device Selection (BDS) phase to connect the drivers to the devices that are required to establish consoles and provide access to boot devices. The DXE drivers that follow the UEFI Driver Model ultimately provide software abstractions for console devices and boot devices, but only when they are explicitly asked to do so.
The DXE drivers that follow the UEFI Driver Model do not need to be concerned with dependency expressions. These drivers simply register the Driver Binding Protocol in the handle database when they are executed, and this operation can be performed without the use of any DXE Architectural Protocols. DXE drivers with empty dependency expressions will not be dispatched by the DXE Dispatcher until all of the DXE Architectural Protocols have been installed.
11.2.3. Additional Classifications
DXE drivers can also be classified as the following:
Boot service drivers
Runtime drivers
Boot service drivers provide services that are available until
the ExitBootServices()
function is called. When
ExitBootServices()
is called, all the memory used by boot
service drivers is released for use by an operating system.
Runtime drivers provide services that are available before and
after ExitBootServices()
is called, including the time that
an operating system is running. All of the services in the UEFI
Runtime Services Table are produced by runtime drivers.
The DXE Foundation is considered a boot service component, so
the DXE Foundation is also released when ExitBootServices()
is called. As a result, runtime drivers may not use any of the
UEFI Boot Services, DXE Services, or services produced by boot
service drivers after ExitBootServices()
is called.