UEFI boot sequence
PI(Platform Initialization) compliant system firmware must support the six phases: security (SEC), pre-efi initialization (PEI), driver execution environment (DXE), boot device selection (BDS), run time (RT) services and After Life (transition from the OS back to the firmware) of system. Refer to Figure below.
1. Security
(SEC)
The Security (SEC) phase is the first phase in
the PI Architecture and is responsible for the following:
? Handling all
platform restart events
? Creating a temporary memory store
? Serving as
the root of trust in the system
? Passing handoff information to the PEI
Foundation
The security section may contain modules with code written in
assembly. Therefore, some EDK II module development environment (MDE) modules
may contain assembly code. Where this occurs, both Windows and GCC versions of
assembly code are provided in different files.
2
Pre-EFI Initialization (PEI)
The Pre-EFI
Initialization (PEI) phase described in the PI Architecture specifications is
invoked quite early in the boot flow. Specifically, after some preliminary
processing in the Security (SEC) phase, any machine restart event will invoke
the PEI phase. The PEI phase initially operates with the platform in a
nascent state, leveraging only on-processor resources, such as the processor
cache as a call stack, to dispatch Pre-EFI Initialization Modules (PEIMs). These
PEIMs are responsible for the following:
? Initializing some permanent memory
complement
? Describing the memory in Hand-Off Blocks (HOBs)
? Describing
the firmware volume locations in HOBs
? Passing control into the Driver Execution Environment (DXE) phase
3
Drive Execution Environment (DXE)
Prior to the DXE
phase, the Pre-EFI Initialization (PEI) phase is responsible for initializing
permanent memory in the platform so that the DXE phase can be loaded and
executed. The state of the system at the end of the PEI phase is passed to the
DXE phase through a list of position independent data structures called Hand-Off
Blocks (HOBs). HOBs are described in detail in the Platform Initialization
Specification.
There are several components in the DXE phase:
? DXE
Foundation
? DXE Dispatcher
? A set of DXE Drivers
4
Boot Device Selection (BDS)
The Boot Device Selection
(BDS) phase is implemented as part of the BDS Architectural Protocol. The DXE
Foundation will hand control to the BDS Architectural Protocol after all of the
DXE drivers whose dependencies have been satisfied have been loaded and executed
by the DXE Dispatcher. The BDS phase is responsible for the following:
?
Initializing console devices
? Loading device drivers
? Attempting to load
and execute boot selections
5
Transient System Load (TLS) and Runtime (RT)
The
Transient System Load (TLS) primarily the OS vendor provided boot loader, along
with the Runtime Services (RT) phases may access persistent UEFI drivers and
applications. Drivers in this category include PCI Option ROMs.
6
After Life (AL)
The After Life (AL) phase consists of
persistent UEFI drivers used for storing the state of the system during the OS
orderly shutdown, sleep, hibernate or restart processes.
Excerpt from EDK_II_v1.22.pdf