3 efi os loaders, 4 efi drivers – Intel Extensible Firmware Interface User Manual

Page 44

Advertising
background image

Extensible Firmware Interface Specification

2-4

12/01/02

Version 1.10

2.1.3

EFI OS Loaders

An EFI OS loader is a special type of EFI application that normally takes over control of the system
from the EFI firmware. When loaded, the OS loader behaves like any other EFI application in that
it must only use memory it has allocated from the firmware and can only use EFI services and
protocols to access the devices that the firmware exposes. If the OS Loader includes any boot
service style driver functions, it must use the proper EFI interfaces to obtain access to the bus
specific-resources. That is, I/Oand memory-mapped device registers must be accessed through the
proper bus specific I/Ocalls like those that an EFI driver would perform.

If the OS loader experiences a problem and cannot load its operating system correctly, it can release
all allocated resources and return control back to the firmware via the Boot Service

Exit()

call.

The

Exit()

call allows both an error code and

ExitData

to be returned. The

ExitData

contains both a Unicode string and OS loader-specific data to be returned.

If the OS loader successfully loads its operating system, it can take control of the system by using
the Boot Service

ExitBootServices()

. After successfully calling

ExitBootServices()

,

all boot services in the system are terminated, including memory management, and the OS loader is
responsible for the continued operation of the system.

2.1.4

EFI Drivers

EFI Drivers are loaded by the EFI Boot Manager, the EFI firmware, or by other EFI applications.
To load an EFI Driver the firmware allocates enough memory to hold the image, copies the sections
within the driver to the allocated memory and applies the relocation fix-ups needed. Once done, the
allocated memory is set to be the proper type for code and data for the image. Control is then
transferred to the driver’s entry point. When the driver returns from its entry point, or when it calls
the Boot Service

Exit()

, the driver is optionally unloaded from memory and control is returned

to the EFI component that loaded the driver. A driver is not unloaded from memory if it returns a
status code of

EFI_SUCCESS

. If the driver’s return code is an error status code, then the driver is

unloaded from memory.

There are two types of EFI Drivers. These are Boot Service Drivers and Runtime Drivers. The
only difference between these two driver types is that Runtime Drivers are available after an OS
Loader has taken control of the platform with the Boot Service

ExitBootServices()

. Boot

Service Drivers are terminated when

ExitBootServices()

is called, and all the memory

resources consumed by the Boot Service Drivers are released for use in the operating system
environment.

Advertising