Uefi Firmware Enabling Guide For The Intel Atom Processor E3900 Series 820238
Uefi Firmware Enabling Guide For The Intel Atom Processor E3900 Series 820238
Intel provides an open source UEFI firmware project for the Intel Atom®
Processor E3900 Series platforms (formerly Apollo Lake SoC). This document
describes the architecture and boot flow of that firmware project.
See https://firmware.intel.com/projects/IntelAtomProcessorE3900.
Revision History
Date Description
List of Tables
Table 1: SPI Flash Regions........................................................................................................................................................... 9
Table 2: Firmware Volumes in IA Firmware ...................................................................................................................... 16
Table 3: FSP API and Wrapper................................................................................................................................................ 20
Table 4: Intel FSP UPD Input ................................................................................................................................................... 21
Table 5: FSP Platform Hooks................................................................................................................................................... 21
Table 6: HOBs Produced by FSP............................................................................................................................................ 21
Table 7: Platform Porting Configuration Consideration.............................................................................................. 24
Table 8: SMM Foundation Modules...................................................................................................................................... 25
Table 9: SMM Extension Modules ......................................................................................................................................... 25
Table 10: Platform Protocols Associated with SMM..................................................................................................... 26
Table 11: PPM Modules ............................................................................................................................................................. 26
Table 12: Power Features Controlled by FSPS_UPD.................................................................................................... 27
Table 13: ACPI Tables for Power Management............................................................................................................... 28
Table 14: Thermal Control Registers ................................................................................................................................... 28
Table 15: Critical Memory Controller Signals .................................................................................................................. 33
Table 16: Memory Rank Configuration ............................................................................................................................... 36
List of Figures
Figure 1: SPI Flash Regions and Access Control ................................................................................................................ 9
Figure 2: Logical Boot Partition Layout in IFWI ............................................................................................................... 11
Figure 3: UEFI Variable Access via Intel TXE..................................................................................................................... 11
Figure 4: TXE Loads IBBL .......................................................................................................................................................... 12
Figure 5: TXE and Host Processor Load IBB ..................................................................................................................... 13
Figure 6: Shadow IBB to Permanent Memory DRAM .................................................................................................... 14
Figure 7: Load OBB into DRAM ............................................................................................................................................... 15
Figure 8: Layout of Cache as RAM Region ......................................................................................................................... 18
Figure 9: IA Firmware and Intel FSP Boot Flow ............................................................................................................... 22
Figure 10: Thermal Management Logical Flow ............................................................................................................... 31
Figure 11: Board Specific Configuration............................................................................................................................. 32
Figure 12: Micron Single Die, Dual Channel Package ................................................................................................... 34
Figure 13: Memory Controller Channel .............................................................................................................................. 34
Figure 14: Micron Dual Die, Dual Channel Package....................................................................................................... 35
Figure 15: Memory Controller Channel .............................................................................................................................. 36
Figure 16: Firmware Boot Flow, Verified Boot Enabled ............................................................................................... 38
Figure 17: Intel TXE Keys, Owners, and Storage Locations ....................................................................................... 40
Platform Firmware
Platform firmware components are mandatory code for platform initialization. They are responsible for
initializing power management controllers (PMC and P-unit), Intel TXE, and Intel Atom® Processor
E3900 Series CPUs.
From the perspective of UDK2018 architecture, IBB contains part of SEC stage code, pre-
memory PEI modules, and memory initialization code (FSP-M). IBB loads OBB into DRAM.
3. OEM Boot Block (OBB)
The third stage of IA Firmware which executes from DRAM. From the perspective of
UDK2018 architecture, OBB contains post-memory PEI modules, FSP-S, DXE stage and BDS
stage.
Besides the above three code regions for UEFI, there is a separate area in the Logical Data Region of SPI
flash for UEFI to store Non-volatile Variables (NV). IA Firmware does not access this region directly, but
can access it via HECI commands to Intel TXE.
IFWI Region
The IFWI region in SPI flash physically follows the SPI Flash Descriptor Region. It contains all platform
firmware components and device firmware components.
The IFWI region is divided into two Logical Boot Partitions, which are identical in size. The Logical Boot
Partition layout is defined by the Boot Partition Descriptor Table (BPDT) at the head of the Logical Boot
Partition.
Logical Boot Partition 1 and Logical Boot Partition 2 contain multiple entries, also referred to as sub-
partitions. These can be signed firmware components or a Secondary Boot Partition (“Secondary
BPDT”).
• BPDT: Boot Partition Descriptor Table
• SBPDT: Secondary BPDT, points to sub-partitions recursively
• OEM SMIP (Signed Master Image Profile)
• TXE Firmware
• IPU Firmware
• PMC Firmware
• CPU Microcode and p-Unit Firmware
• IA Firmware
o IBBL
o IBB
o OBB
• Misc. Device Firmware
• Security Data
o Boot Policy Manifest
o OEM Key Manifest
The open source UEFI project contains details for the BPDT and code for accessing entries inside
Logical Boot Partitions:
https://github.com/tianocore/edk2-platforms/tree/devel-
IntelAtomProcessorE3900/Silicon/BroxtonSoC/BroxtonSiPkg/Library/BpdtLib
Figure 2 is an example of Logical Boot Partition layout that could be used to illustrate the structure of
both Logical Boot Partition 1 and Logical Boot Partition 2.
IBBL Stage
IBBL is the first stage of IA Firmware, executed from Shared SRAM. The IA processor starts fetching IBBL
code from the reset vector.
1) IBBL sets up Cache as RAM (CAR) as temporary memory.
2) IBBL requests Intel TXE load IBB from SPI Flash into shared SRAM.
3) IBBL copies IBB from SRAM to CAR area.
4) IBBL transfers control to IBB.
Figure 5 shows how IBB is loaded from SPI flash into Cache as RAM.
IBB Stage
IBB is the second stage of IA Firmware, containing the PEI Core and Memory Reference Code (FSP-M).
Prior to system memory initialization, IBB resides in temporary memory (CAR).
After IBB completes system memory (DRAM) initialization, the following steps will be taken to disable
CAR and avoid data loss:
1) PEI Core shadows itself from CAR into DRAM, as Figure 6 shows.
2) PEI Core shadows any PEI Modules which have been dispatched and registered themselves with
PEI Service RegiserForShadow().
Note:
a) A PEI Module must register itself with RegiserForShadow() if it has any PPI produced. It
has to reinstall the PPIs it has installed previously. Otherwise after CAR is teared down,
those PPIs’ EFI_PEI_PPI_DESCRIPTOR and the PPI code, which was located in CAR, will
be unavailable. This could lead to system crash
b) PEI code that runs prior to PEI memory installation, which is handled by PEI Service
InstallPeiMemory (), cannot register any PPI notification with PeiNotifyPpi(). Otherwise
the EFI_PEIM_NOTIFY_ENTRY_POINT pointer in EFI_PEI_NOTIFY_DESCRIPTOR will still
point to code in CAR, which will be unavailable. Accessing this pointer will lead to
system crash.
3) IBB issues a HECI message to TXE to request ownership of SPI NOR flash. After ownership is
granted, SPI NOR flash will be mapped to the top 4GB of host processor memory space. Host
processor could get data from SPI NOR flash by memory reading operation.
4) IA processor could also read and write SPI NOR flash through SPI protocol.
5) IBB reads OBB from SPI flash to system DRAM and gives control to OBB.
Figure 7 illustrates the memory map after the host controller has acquired ownership of SPI flash.
OBB Stage
OBB consists of post-memory PEI modules, FSP-S, DXE modules, and BDS of UEFI IA Firmware. These
modules initialize CPU, Chipset and platform:
• GPIO initialization
• Intel Chipset configuration
• Publish UEFI Services
• Multi-Processor initialization
• Initialize Graphics device and provide GOP service
• Initialize Storage devices
• Publish ACPI tables
• Logo display
• OEM specific customized features
• SMM initialization
• Network
• Console
• SMBIOS, TCG
• BIOS Setup
IBBL IBBL.Fv
IBB FVIBBM.Fv
FSP_M.fv
OBB FSP_S.fv
FVIBBR.fv
FVOBB.Fv
FVOBBX.Fv
FVOBBY.Fv
FSP-T is not used by this project, because open source UEFI IA Firmware already covers the function of
FSP-T. So we will only discuss FSP-M and FSP-S in this paper.
The FSP-M firmware volume (FV) is integrated into IBB, and the FSP-S FV is integrated into OBB. Note:
FSP-T is not used in this firmware project.
Rebase FSP
The SplitFspBin.py utility is used to rebase the separate sections of Intel® FSP (FSP-T, FSP-M, FSP-
S). This section describes how the build process uses this utility.
Rebase FSP-M
FSP-M is part of IBB, which is executed from Cache as RAM (CAR). The layout of CAR is described in
Figure 8, from which we could calculate out the runtime base address of FSP-M. The pre-build script
rebases FSP-M to the runtime address within CAR:
https://github.com/tianocore/edk2-platforms/blob/devel-
IntelAtomProcessorE3900/Platform/BroxtonPlatformPkg/BuildBxtBios.bat
::0xFEF7A000 = gIntelFsp2WrapperTokenSpaceGuid.PcdFlashFvFspBase =
::$(CAR_BASE_ADDRESS) + $(BLD_RAM_DATA_SIZE) + $(FSP_RAM_DATA_SIZE) +
::$(FSP_EMP_DATA_SIZE) + $(BLD_IBBM_SIZE)
Python %WORKSPACE%\Core\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f Fsp.fd -c
m -b 0xFEF7A000 -o .\ -n ApolloLakeFsp.fd
Rebase FSP-S
The default base address for FSP-S is set to 0x0200000. This codebase does not rebase FSP-S at build
time, so the UEFI IA Firmware will shadow the FSP-S FV to 0x0200000 at runtime before calling the
FSP-S API.
Please refer to the following code for FSP-S shadowing during boot:
https://github.com/tianocore/edk2-platforms/blob/devel-
IntelAtomProcessorE3900/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPreMemPe
i/FvCallback.c
//
// Copy to FSP-S to preferred base. The preferred base is defined in FSP
// Integration Guide.
// This region must be reserved for BIOS S3 resume.
//
BuildMemoryAllocationHob (
(EFI_PHYSICAL_ADDRESS)FspSImageBase,
(UINT64)FspHeader->ImageSize,
EfiReservedMemoryType
);
CopyMemSse4 ((VOID*) FspSImageBase, FvHeader, (UINT32) FvHeader->FvLength);
PcdSet32S (PcdFspsBaseAddress, (UINT32) FspSImageBase);
https://github.com/tianocore/edk2/tree/master/IntelFsp2WrapperPkg/Library/PeiFspWr
apperHobProcessLibSample
FSP API UPD Platform Hook of Intel FSP Wrapper Wrapper Module
IA Processor Configuration:
• BSP execute code from Reset Vector.
• BSP enters 16bit real mode.
• IA Firmware sets BSP to protect mode, initialize processor Non-Eviction Mode (NEM) and setup
Cache as RAM.
# TRUE - DxeIpl will load a 64-bit DxeCore and switch to long mode to hand
over to DxeCore.
# FALSE - DxeIpl will load a 32-bit DxeCore and perform stack switch to hand
over to DxeCore.s
# @Prompt DxeIpl switch to long mode.
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE|BOOLEAN|0x00010
03b
PCD Description
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize Configure stack size for Application
Processor (AP).
gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode Specifies the AP wait loop state during
POST phase. The value is defined as below
1: Place AP in the Hlt-Loop state.
2: Place AP in the Mwait-Loop state.
3: Place AP in the Run-Loop state.
gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate Specifies the AP target C-state for Mwait
during POST phase.
SMM Access
$(PLATFORM_SI_PACKAGE)/Cpu/SmmAcc Platform Specific driver which Controls
ess/Dxe/SmmAccess.inf access to SMRAM regions. Produces
EFI_SMM_ACCESS2_PROTOCOL.
SMM Control
$(PLATFORM_SI_PACKAGE)/SouthClust Platform specific driver which produces
er/SmmControl/RuntimeDxe/SmmContr EFI_SMM_CONTROL2_PROTOCOL for
ol.inf
software SMI triggering.
PI SMM IPL
MdeModulePkg/Core/PiSmmCore/PiSmm Load SMM Core into SMRAM, register
Ipl.inf SMM Core entry point for SMIs, install
SMM Base 2 Protocol and SMM
Communication Protocol, and register
for the critical events required to
coordinate between DXE and SMM
environments.
PI SMM Core
MdeModulePkg/Core/PiSmmCore/PiSmm Reload SMM Core into SMRAM and
Core.inf register SMM Core EntryPoint on the
SMI vector.
PI SMM CPU
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCp Setup SMRAM region for the CPU save
uDxeSmm.inf state and code for the SMI entry point of
each logical thread. Relocate SMM Base
of each thread from default 0x38000 to
preferred SMRAM.
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.in
CPU IO SMM
f
UEFI IA Firmware also provides extensions to facilitate the SMI handler registration, as described in
Table 9.
PI SMM
UefiCpuPkg/PiSmmCommunication/PiS Produces
mmCommunicationSmm.inf EFI_SMM_COMMUNICATION_PROTOCOL
Communication
which provides a means of
communicating between drivers outside
of SMM and SMI handlers inside of
SMM.
The SMM foundation also hooks callback functions on DXE protocols. UEFI IA Firmware must ensure
the protocols listed in Table 10 are properly installed.
PowerMgmtDxe $(PLATFORM_SI_PACKAGE)/Cpu/PowerManagement/Dxe/PowerMgmtDxe.inf
CpuAcpiTables $(PLATFORM_SI_PACKAGE)/Cpu/AcpiTables/CpuAcpiTables.inf
Max Core C-State. 0:Unlimited, 1:C1, 2:C3, 3:C6, 4:C7, 5:C8, 6:C9, 7:C10,
MaxCoreCState
8:CCx(Default).
PkgCStateDemotion Enable or Disable Package Cstate Demotion. 0:Disable(Default), 1:Enable.
SSDT “Cpu0Ist” Patch the native _PSS (Processor Supported States) package
with the EIST values from CPU_INIT_DATA_HOB.FvidTable
SSDT “CpuSsdt” Processor scope ACPI PPM GlobalNvs NVS Region with data
from CPU_INIT_DATA_HOB.CpuGnvsPointer
Register Interfaces
Table 14 list the registers that are involved in implementing DTS function.
Register Description
IA32_THERM_STATUS The status of the temperature sensor. It also indicates the
temperature of digital thermal sensor.
(MSR 0x19C, Core Level)
SWGPE_EN bit of GPE0a_EN Software GPE Enable bit of PMC General Purpose Event 0 Enable
Register. This bit enables the SW GPE function. If SWGPE_STS,
SWGPE_EN, and SCI_EN are all ones, an SCI will be generated.
Scope (\_TZ)
{
// Thermal Zone 1 = DTS Thermal Zone.
ThermalZone (TZ01)
{
...
Method (_TMP,0,Serialized)
{
If (DTSE) {
//
// If DTS support is enabled, simply return the higher of the two
// DTS Temperatures.
//
If (LGreaterEqual (DTS1, DTS2)) {
Return (Add(2732, Multiply(DTS1, 10)))
}
Return(Add(2732, Multiply(DTS2, 10)))
}
...
} // End of _TMP
...
}// end ThermalZone(TZ01)
} // end Scope(\_TZ)
If(CondRefOf(DTSE))
{
If (LGreaterEqual (DTSE, 0x01))
{
Notify (\_TZ.TZ01,0x80)
}
}
}
EFI_STATUS
EFIAPI
AuroraUpdateFspmUpd (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN FSPM_UPD *FspUpdRgn
)
This example is based on Micron Mobile LPDDR4 SDRAM (MT53B256M32D1, MT53B512M32D2,
MT53B1024M32D4).
MEM_CH0_CKE[1:0]A Channel 0 Clock Enable. 2 signal pins in total. One pin for each memory
Rank.
MEM_CH0_CS[1:0]A Channel 0 Chip Select. 2 signal pins in total. One pin for each memory Rank.
MEM_CH0_DQB[31:0] Channel 1 x32 data bus to the LPDDR4 DRAM data bus.
MEM_CH0_CKE[1:0]B Channel 1 Clock Enable. 2 signal pins in total. One pin for each memory
Rank.
MEM_CH0_CS[1:0]B Channel 1 Chip Select. 2 signal pins in total. One pin for each memory Rank.
MEM_CH1_DQA[31:0] Channel 2 x32 data bus to the LPDDR4 DRAM data bus.
MEM_CH1_CKE[1:0]A Channel 2 Clock Enable. 2 signal pins in total. One pin for each memory
Rank.
MEM_CH1_CS[1:0]A Channel 2 Chip Select. 2 signal pins in total. One pin for each memory Rank.
MEM_CH1_DQB[31:0] Channel 3 x32 data bus to the LPDDR4 DRAM data bus.
MEM_CH1_CKE[1:0]B Channel 3 Clock Enable. 2 signal pins in total. One pin for each memory
Rank.
MEM_CH1_CS[1:0]B Channel 3 Chip Select. 2 signal pins in total. One pin for each memory Rank.
The term “channel” refers to the DQ signal arrays (not be confused with a Channel of the SoC memory
controller.)
The SoC memory controller requires LPDDR4 SDRAM with x32 rank, so two x16 devices in the same die
will be combined to form a x32 memory rank. Their Chip Select signals, CS0_A and CS0_B, will be
merged and connected to the SoC memory controller Chip Select signal.
For the memory configuration shown in Figure 13, the following Intel FSP parameters are required:
FSP_M_CONFIG ->FspmConfig.Ch0_RankEnable = 0x01; // [0]: Rank 0; [1]: Rank 1
FSP_M_CONFIG ->FspmConfig.Ch0_DeviceWidth = 0x01; // x16 device width
Note: the above code is board-specific and added into board specific function AuroraUpdateFspmUpd().
Please refer to below board specific file for detail:
https://github.com/tianocore/edk2-platforms/blob/devel-
IntelAtomProcessorE3900/Platform/BroxtonPlatformPkg/Board/AuroraGlacier/BoardInitPreMem/BoardI
nitMiscs.c
Figure 14 shows a slightly different memory configuration than Figure 12. The memory “package” has
two “dies”.
The Intel Atom® Processor E3900 Series memory controller requires LPDDR4 SDRAM with x32 Rank. So
in this example, two x16 DQ in the same die will be combined to form an x32 memory rank. The Chip
Select signals are merged and connected to the SoC memory controller Chip Select (Table 16). A DDP
package provides two x32 memory Ranks, which will be connected to a single channel of the SoC
memory controller (Figure 14).
For the memory configuration shown in Figure 15, the following Intel FSP parameters are required:
FSP_M_CONFIG ->FspmConfig.Ch0_RankEnable = 0x03; // [0]: Rank 0; [1]: Rank 1
FSP_M_CONFIG ->FspmConfig.Ch0_DeviceWidth = 0x01; // x16 device width
6. IBB initializes system memory (DRAM), copies OBB from SPI NOR flash into DRAM, and verifies
the OBB hash. If OBB passes hash verification, IBB will hand off control to OBB. Otherwise, IBB
will stop the boot process.
7. The IA processor executes OBB. OBB installs UEFI boot services, creates system tables (ACPI,
SMBIOS), installs UEFI runtime services, and locates the OS Boot Loader on a mass storage
device.
8. If UEFI Secure Boot is enabled, OBB authenticates the OS Boot Loader. If the Boot Loader
passes signature authentication of UEFI Secure Boot, OBB will load the OS.
Firmware Component Private Key Public Key Location of Public Key Hash
Owner Consumer
Boot Policy Manifest (IA OEM Intel TXE OEM Key Manifest
Firmware Hash Inside)
Public key hash values for Intel components are stored in the Intel TXE ROM. Public key hash values for
OEM firmware components are stored in OEM Key Manifest in SPI flash. Hash of public key for OEM Key
Manifest is stored in SoC FPF fuse. The vendor securely stores the private key used to sign the firmware.