Most device drivers produce a single instance of the
EFI_DRIVER_BINDING_PROTOCOL
. These drivers are the simplest among those that follow the UEFI driver model
and all other driver types have their roots in this type of device driver.
A device driver is loaded into memory with the LoadImage()
Boot Service and
invoked with the StartImage()
Boot Service. The LoadImage()
service
automatically creates an image handle and installs the
EFI_LOADED_IMAGE_PROTOCOL
onto the image handle. The
EFI_LOADED_IMAGE_PROTOCOL
describes the location from where the device driver
was loaded and the location in system memory to where the device driver was
placed. The Unload()
service of the EFI_LOADED_IMAGE_PROTOCOL
is
initialized to NULL
by LoadImage()
. This setting means that by default the
driver does not have an unload function.
The StartImage()
service transfers control to the driver's entry point as
described in the PE/COFF header of the UEFI Driver image. The PE/COFF header layout is defined
in the Microsoft Portable Executable and Common Object File Format
Specification.
The driver entry point is responsible for installing the Driver Binding Protocol onto the driver's image handle. The figure below shows the state of the system before a device driver is loaded, just before it is started, and after the driver's entry point has been executed.
The following figure is the same as the figure above, except this device driver has also implemented optional features. This difference means the following:
-
Additional protocols are installed onto the driver's image handle.
-
An
Unload()
service is registered in theEFI_LOADED_IMAGE_PROTOCOL
. -
An Exit Boot Services event and Set Virtual Address Map event have been created. These are part of the driver's initialization (the driver's entry point).