| created on | November 13, 2025 |
I’ve always been running Intel CPU’s, so I focus on the Intel platform here. Intel and AMD do take slightly different approaches during the early boot sequence, but the overall picture is the same.
I deliberately leave out the parts of a secure boot like with Intel’s Boot Guard modes Verified or Measured Boot to keep the article shorter.
I focus only on the ’normal’ boot sequence, omitting both recovery boot and resuming from any suspend mode. Also, I do not touch on other boot modes, like cold boot vs warm boot, or boot on flash update.
An UEFI boot sequence is divided into the following six stages:
UEFI boot sequence
credits: adapted from UEFI Platform Specification 1.9, 2. Overview, Fig. 2.2 PI Architecture Firmware Phases
click on image to enlarge
Most sources apart from the official UEFI docs do not contain the AL stage. Strictly speaking, the AL stage is not part of the UEFI boot sequence, but part of the whole UEFI life cycle.
The six boot stages are referred to as the PI (Platform Initialization).
In the old days, there were three main distinct chips able to execute operations on a motherboard:
Later, the northbridge was integrated into the CPU. Intel renamed the southbridge to PCH (Platform Controller Hub). If we want to include AMD, we can just call the latter ’the chipset'.
On power on, the CPU is stuck in reset and no execution takes place there. The PMC (Power Management Controller) delivers power to the CSME (Converged Security and Manageability Engine). The CSME, containing a tiny i486-like IP block, starts executing code from the reset vector of its ROM code. This ROM code acts as the Root-of-Trust for the entire platform. After a few other steps I’m skipping here, the CSME requests from the PMC to bring the CPU out of reset. The boot sequence continues with the IBB (Initial Boot Block).
Intel CPUs ship with built-in µCode (microcode). But improved versions of the µCode might be available or the µCode currently in the system’s flash memory is known to contain bugs. The CPU starts the SEC phase by checking the system flash memory for µCode updates. New µCodes images are pulled out of the flash and the new microcode starts running.
The µCode loads a component called the ACM (Authenticated Code Module) of the flash. The ACM is still Intel code.
Modern CPUs are connected to an SPI (Serial Peripheral Interface) flash memory that contains the initial boot code. The CPU can execute code directly from the SPI flash memory. The CPU starts the SEC phase by executing code from the SPI’s reset vector 0xfffffff0. Address 0xfffffff0 is the legacy reset vector for the 80386 CPU. The CPU is running in real mode, which comes with a set of constraints like no memory protection and a memory limit of 1 MB. Also, at the reset vector, the platform can execute only in a constrained state and has no concept of components such as RAM. Not really cool if you want to execute code above bare essential stuff. In the next step the CPU is switched to protected mode.
The memory available in the CPU caches is configured via MTRRs (Memory-Type Range Registers) into a CAR (Cache-as-RAM) with ’no-eviction mode’. This mode will ensure that reads/writes to the CPU caches do not lead to an attempt to evict the data to RAM, which is not under control of the CPU yet. The available memory at this point is limited to the memory of the CPU caches, but this is usually large enough to hold the entire firmware in memory and still have enough memory for execution environments (heap, stack and data regions). I’m still running an i7-8700 with an L3 cache of 12 MB. The Core Ultra 9 Series CPUs variants, released in October 2024, come with a L3 cache of 36 MB and a L2 cache of 40 MB, summing up to a total cache of 76 MB. Note that not all the firmware image is loaded into the CAR.
The Initial Boot Block (IBB) is the first chunk of OEM provided BIOS code executed by ACM. The IBB verifies and executes the OBB (OEM Boot Block). The OBB then verifies and executes the next code to run, which is an UEFI application – usually it is a boot manager. The IBB runs not only during the SEC stage, but overlaps into the PEI (Pre EFI Initialization) stage.
The PEI foundation is a binary without any dependency and is responsible for executing the PEIMs (Pre-EFI Initialization Modules). A PEIM can be dependent on other PEIMs. The PEI Foundation revolves much around the PEI Dispatcher, which resolves those dependencies in order to execute the PEIMs in the appropriate order.
The PEIMs in turn are responsible for all aspects of base-hardware initialization, such as setting up the main RAM, CPU and chipset initialization, I/O initialization (i.e., disk controllers), system buses init, and the setup of other core functions of the platform.
PEIMs can communicate to each other though PPIs (PEIM-to-PEIM Interfaces). PEIMs and PPIs can reside in the BFV (Boot Firmware Volume) or other FVs (Firmware Volumes). It is mandatory that the SEC infrastructure code and PEI Foundation code are not linked together into one binary in the ROM.
The SEC (Security) phase calls the entry point to the PEI Foundation with some information, including:
The PEI Foundation begins operation using the CAR that contains the initial call stack from the SEC phase.
The PEI stack is available for subsequent PEIM invocations. PEIMs can create sequential data structures that can be used in later boot stages, called HOBs (Hand-Off Block). The PEI heap is used for PEIM memory allocations and HOBs.
During the PEI Foundation, some services that are also available to later stages are set up. Because the PEI Foundation stage has no main RAM available until nearly the end of the stage, the services created during the PEI Foundation can’t be as functionally rich as services created during later stages.
Among the services are:
There can be no memory writes to the main RAM until it is initialized by the corresponding PEIM. When the main RAM is set up, PEI Foundation copies the call stack located in CAR into a segment of the main RAM. If necessary, the size of the call stack is expanded to support the subsequent operation, including those of the DXE.
In addition to the call stack, the PEI Foundation copies the following from CAR to main RAM:
Any main RAM used by the PEI Foundation is described in a HOB, which the PEI Foundation creates. Interestingly, the main RAM is set up very late in the PEI stage.
The PEI transfers execution to the DXE stage with a HOB list containing the following information:
The DXE Foundation is completely independent of the system’s hardware (CPU, chipset, etc.) so it is completely portable. The DXE Foundation only depends on the HOB list created in the PEI stage, thus any other data in RAM can be cleared. The HOB list is treated as read-only data and is never updated during the DXE stage.
The HOB list starts with a PHIT Hob (Phase Handoff Information Table), which contains the following information:
The base address of the HOB list is passed to the DXE Foundation in the parameter , and the PHIT HOB field specifies the end of the HOB list.
The CPU HOB contains the field , which defines the number of address bits that the processor can use to address memory resources. The CPU HOB also contains the field which defines the number of address bits that the processor can use to address I/O resources. This information enables the DXE phase to operate completely platform-agnostic (in the sense of CPU platform).
Using the PHIT and the CPU HOB, the DXE Foundation can relocate teh HOB list to a new location in system memory and can initialize the GCD (Global Coherency Domain) memory space map as well as the GCD I/O space map.
HOB List
credits: adapted from UEFI Specification 1.9, 9. DXE Foundation, Fig. 9.1 HOB List
The DXE Foundation produces the UEFI System Table, which is passed to every executable component in the DXE stage. The UEFI System Table contains:
UEFI System Table
credits: adapted from UEFI specification 1.9, 9. DXE Foundation, Fig. 9.2 UEFI System Table and Related Components
click on image to enlarge
Much like the PEI Foundation revolving around the PEI Dispatcher, the DXE Foundation revolves around the DXE Driver Dispatcher which is a component of the DXE Foundation. The DXE Driver Dispatcher discovers DXE drivers stored in firmware volumes and executes them in the proper order.
There are two DXE Diver classes.
The Early DXE Drivers provide basic services, like CPU, chipset and platform initialization. They also produce the DXE Architectural Protocols that are required by the DXE Foundation to produce the UEFI Boot Services and UEFI Runtime Services of the UEFI System Table.
The order by which the Early DXE divers are executed is determined by:
Late DXE Drivers do not touch any hardware resources, but register a Driver Binding Protocol interface in the handle database. The set of Driver Binding Protocols produced by the late Drivers is used in the BDS (Boot Device Selection) stage to connect the drivers to the devices that are required for console access and boot devices access.
When a specific controller is needed, an EFI boot service is used to connect to the controller, along with the EFI Driver Binding Protocol services to identify the best drivers for a controller. When the EFI boot service has identified the best drivers for a controller, the start service in the EFI Driver Binding Protocol is used to start each driver on the controller. Once a controller is no longer needed, it can be released with an EFI boot service, which calls the stop service in each EFI Driver Binding Protocol to stop the controller.
Late DXE Drivers do not have dependencies. DXE drivers without dependencies are not dispatched by the DXE Dispatcher until all DXE Architectural Protocols have been installed. In order to speed up boot time, as much initialization as possible is deferred to the Late DXE Drivers.
DXE drivers can also be classified by the kind of service they produce:
After all DXE drivers whose dependencies have been satisfied have been loaded and executed, the DXE phase hands over control to the BDS phase.
The BDS phase is responsible for the following:
In the BDS phase, the firmware boot manager loads UEFI drivers and UEFI applications like an UEFI Shell or UEFI OS bootloaders in an order defined by the global NVRAM variables. The boot order in which to invoke the UEFI drivers and UEFI applications is also defined by the global NVRAM variables and is mandatory for normal boot. The platform firmware may add extra boot options or remove invalid boot options from the boot order list.
The firmware can load UEFI drivers and UEFI apps from any file on an UEFI-defined file system, from media that contain an UEFI OS loader, or through the use of an UEFI-defined image loading service, i.e. for network boot. To load UEFI image apps from block devices, UEFI requires UEFI-defined system partition. An UEFI-defined system partition does not require any change to the first sector of a partition, so it is possible to set up media that boot on both legacy architectures and UEFI platforms.
On initialization the firmware boot manager reads the NVRAM variables, whose values comprise the boot load options:
| variable name | attributes | description |
|---|---|---|
| Boot#### | NV | A boot load option. Specifies an OS to load. |
| BootCurrent | The boot option that was selected for the current boot. | |
| BootNext | NV | The boot option that is to be booted next after the current boot. |
| BootOrder | NV | Defines the order in which options are processed. |
| BootOptionSupport | The types of boot options supported by the boot manager. Should be treated as read-only. | |
| Driver#### | NV | A driver load option. Specifies a driver to load. |
| DriverOrder | NV | Defines the order in which the options are processed |
| Key#### | NV | Defines a hot-key for a option. |
| PlatformRecovery#### | NV? | Platform-specified recovery options. Only modified by firmware and are read-only to the OS. |
| SecureBoot | Indicates if the platform firmware is operating in Secure boot mode (1) or not (0). Should be treated as read-only. | |
| SysPrep#### | NV | A System Prep application load option. |
| SysPrepOrder | NV | Defines the order in which the load options are processed. |
| Timeout | NV | The firmware’s boot managers timeout, in seconds, before initiating the default boot selection. |
| OsIndications | NV | Set by the OS to request the firmware to enable certain features or to take certain actions. |
| OsIndicationsSupported | Indicates the firmware features and actions supported by the firmware to the OS. |
Modifications to NVRAM variables are guaranteed to take effect in the next system boot. Firmware boot manager implementations may improve on this guarantee, so that changes that effect boot manager behaviour take effect immediately for subsequent accesses to these variables without requiring any form of system reset. An exception to this is the variable. Changes to this variable are only guaranteed to take effect after the next system reset.
The design goal of UEFI was to have a boot menu that be provided by the platform firmware. The UEFI spec specifies only the NVRAM variables used in boot options but leaves the implementation of the boot menu system to the firmware supplier.
The firmware boot manager may support launching a option using a special key press or a combination of several keys being pressed. If so, the boot manager reports this capability by setting in the global variable.
The key information is read from the console. Any key press is compared the defined NVRAM variables. For any match, it is verified that the load option specified is valid and, if so, the specified option is launched immediately. The order in which the variables are checked is implementation-specific.
The boot manager may ignore variables where the hot keys specified overlap with those used for internal firmware boot manager functions. The firmware boot manager may delete such keys.
Unfortunately, the UEFI specification is not clear on how hot keys for launching a option are defined.
If the option does not contain a pointer to a file, the UEFI firmware generates a default pointer in the form , where defines the PE32+ image format architecture. Each file only contains one UEFI image type. A medium (i.e., a USB-stick) can provide several UEFI image types in the form of to support booting for several architectures. The following table lists the UEFI image types for several architectures:
| architecture | UEFI image file name | PE executable machine type |
|---|---|---|
| 32-bit | BOOTIA32.EFI | 0x14c |
| x64 | BOOTx64.EFI | 0x8664 |
| Itanium architecture | BOOTIA64.EFI | 0x200 |
| AArch32 architecture | BOOTARM.EFI | 0x01c2 |
| RISC-V 32-bit architecture | BOOTRISCV32.EFI | 0x5032 |
| RISC-V 64-bit architecture | BOOTRISCV64.EFI | 0x5064 |
| RISC-V 128-bit architecture | BOOTRISCV128.EFI | 0x5128 |
| LoongArch32 architecture | BOOTLOONGARCH32.EFI | 0x6232 |
| LoongArch64 architecture | BOOTLOONGARCH64.EFI | 0x6264 |
The PE Executable machine type is contained in the machine field of the COFF file header as defined in the Microsoft Portable Executable and Common Object File Format Specification, Revision 6.0
If the BDS phase cannot make forward progress, it will re-invoke the DXE Dispatcher to see if the dependencies of any additional DXE drivers have been satisfied since the last time the DXE Dispatcher was invoked.
In the TSL phase, EFI applications execute. That is, UEFI images are loaded and executed. The range of EFI applications is not limited, but in most cases the EFI application may be an UEFI Shell, or an OS bootloader for loading the OS, optionally presenting a menu to the user to choose an OS to load beforehand. When an UEFI Shell terminates, control is transferred back to the firmware boot manager and the PI switches back to the last part of the BDS phase, so other EFI applications like an OS boot manager can be executed.
Usually, an OS bootloader terminates the UEFI Boot Services (firmware bootloader) via the ExitBootServices() call. However, terminating of the firmware boot manager is also possible for the OS itself. In both cases, the TSL phase transitions to the RT phase.
The RT phase is the runtime of the OS. This is the phase where the OS controls the system. The UEFI firmware provides access to certain firmware NVRAM variables to the OS. The OS’ access to each variable is either read/write or read-only.
As in real life, not much is known about the Afterlife in PI.
After the OS takes over from the BDS via its boot (TSL), only a small set of UEFI is left behind. If the hardware or OS crashes, the firmware could try and implement some form of recovery or remediation action. The UEFI spec does not specify any required behavior in this phase.