2 driver initialization – Intel Extensible Firmware Interface User Manual

Page 60

Advertising
background image

Extensible Firmware Interface Specification

2-20

12/01/02

Version 1.10

2.5.2

Driver Initialization

The file for a driver image must be loaded from some type of media. This could include ROM,
FLASH, hard drives, floppy drives, CD-ROM, or even a network connection. Once a driver image
has been found, it can be loaded into system memory with the boot service

LoadImage()

.

LoadImage()

loads a PE/COFF formatted image into system memory. A handle is created for

the driver, and a Loaded Image Protocol instance is placed on that handle. A handle that contains a
Loaded Image Protocol instance is called an Image Handle. At this point, the driver has not been
started. It is just sitting in memory waiting to be started. Figure 2-7 shows the state of an image
handle for a driver after

LoadImage()

has been called.

Image Handle

EFI_LOADED_IMAGE_PROTOCOL

OM13148

Figure 2-7. Image Handle

After a driver has been loaded with the boot service

LoadImage()

, it must be started with the

boot service

StartImage()

. This is true of all types of EFI Applications and EFI Drivers that

can be loaded and started on an EFI-compliant system. The entry point for a driver that follows the
EFI Driver Model must follow some strict rules. First, it is not allowed to touch any hardware.
Instead, the driver is only allowed to install protocol instances onto its own Image Handle. A
driver that follows the EFI Driver Model is required to install an instance of the Driver Binding
Protocol onto its own Image Handle. It may optionally install the Driver Configuration Protocol,
the Driver Diagnostics Protocol, or the Component Name Protocol. In addition, if a driver wishes
to be unloadable it may optionally update the Loaded Image Protocol to provide its own

Unload()

function. Finally, if a driver needs to perform any special operations when the boot

service

ExitBootServices()

is called, it may optionally create an event with a notification

function that is triggered when the boot service

ExitBootServices()

is called. An Image

Handle that contains a Driver Binding Protocol instance is known as a Driver Image Handle.
Figure 2-8 shows a possible configuration for the Image Handle from Figure 2-7 after the boot
service

StartImage()

has been called.

Advertising