参考和说明
相关参考:
- UEFI原理与编程_戴正华 第一章
- UEFI Platform Initialization (PI) Specification
- UEFI社区
老狼系列参考
- UEFI背后的历史
- UEFI和UEFI论坛
- UEFI 引导与 传统BIOS 引导在原理上有什么区别?芯片公司在其中扮演什么角色?
- X86生态圈为什么在物联网玩不转?什么是Intel® FSP ?它能解决什么问题?
参考文章下载地址:
链接: https://pan.baidu.com/s/1LjrydEzCACG3ohpx7mMKKg 提取码: 4i3j
说明
因为 BIOS也不是我学习得重点,但X86架构及服务器 在使用过程中 有很多部分初始化放在了UEFI中 ,
通过ACPI 给系统提供服务,所以我也不得不看一些基础知识。
本文也是 摘选 《UEFI原理与编程_戴正华》 第一章节 好的内容简单记录下,可以快速复习。
传统BIOS(了解)
初始BIOS
BIOS(Basic Input Output System,基本输入输出系统)诞生于1975年的CP/M计算机。BIOS是一组固化在计算机主板ROM里的程序代码,其主要功能是在计算机上电时对硬件进行初始化配置,并将硬件操作封装为BIOS中断服务。这样,各种硬件间的差异便由BIOS负责维护,程序直接调用BIOS中断服务即可实现对硬件的控制。
BIOS的主要组成部分:
- 加电自检程序(Power On Self Test, POST),在开机时负责检测硬件设备是否正常工作
- 系统初始化程序,其中包括硬件设备的初始化以及创建BIOS中断向量等。
- 适配外围即插即用设备。
- CMOS设置程序,负责读写保存在CMOS中的系统设置信息。
BIOS以16位实模式运行,20位地址线,最大寻址空间1MB。BIOS使用汇编代码编写。
BIOS缺点:
开发效率低,性能差,扩展性差,安全性差
UEFI
初始UEFI
UEFI**(Unified Extensible Firmware Interface,统一可扩展固件接口)定义了操作系统和平台固件之间的接口**,它是UEFI Forum发布的一种标准。UEFI是传统BIOS的替代者。UEFI发端于20世纪90年代中期的英特尔64位Itanium系统。到2005年,英特尔联合微软、AMD等公司成立Unified EFI Forum,负责指定统一的标准。第一个UEFI标准——UEFI 2.0在2006年1月发布。
UEFI不再为开发者提供中断支持,UEFI内部使用了时钟中断。**所有的异步操作都要通过事件(Event)来完成**。
UEFI优点:
UEFI使用C语言开发,开发效率高;
UEFI采用模块化设计;每个驱动都是一个独立的模块。
UEFI性能有较大提升,使用“事件+异步操作”取代中断来操作外部设备
UEFI的系统构成
UEFI工程模块组成
UEFI工程模块包括应用程序模块、驱动程序模块、库模块、Shell应用程序模块。
UEFI可执行文件使用Windows平台的PE/COFF格式, 而不是Linux的ELF格式。
UEFI的启动过程(PI)
参考: TianoCore 官方文档 PI-Boot-Flow
UEFI从加点到关机的7个阶段,其中 前三个是UEFI的初始化阶段
UEFI系统的启动遵循 **UEFI平台初始化(Platform Initialization - PI**)标准。UEFI从上电到关机,分为如下七个阶段。
前三个阶段(**SEC、PEI、DXE)是UEFI初始化阶段,DXE阶段结束后UEFI**环境已经准备完毕。
BDS和TSL是操作系统加载器(OS Loader)作为UEFI应用程序运行的阶段。
OS Loader调用ExitBootServices()服务后加入RT阶段,RT阶段包括操作系统加载器后期和操作系统运行期。
当系统硬件或操作系统出现严重错误不能继续运行时,固件会尝试修复错误,这时是AL(After Life)阶段。
UEFI的缩略语
Acronyms-and-Glossary 描述了UEFI中所有相关的缩略语
ACPI
Advanced Configuration and Power Interface. See www.acpi.info
AL
Afterlife phase. Also known as the "power down phase."
AML
ACPI Machine Language
API
Application Program Interface. Programmatic interfaces for the firmware (not Win32-type OS-level APIs).
a priori file
A file with a known GUID that contains the list of DXE drivers that are loaded and executed in the listed order before any other DXE drivers are discovered.
Artifact
Something tracked in Project Tracker
ASL
ACPI Source Language
Attribute
A field of something tracked in CEE Project Tracker
BA
Boot Authorization
BBS
BIOS Boot Specification
BDS
Boot Device Selection phase
BFV
Boot Firmware Volume. Code (i.e., PEI and PEIM code) that appears in the memory address space of the system without prior firmware intervention. See also FV.
BIS
Boot Integrity Services
BIST
Built-in self test
BLT
Block Transfer (pronounced "blit" as in "slit" or "flit"). A series of functions that form the basis of manipulation graphical data. The operation used to draw a rectangle of pixels on the screen.
BNF
Backus-Naur Form. A metasyntactic notation used to specify the syntax of programming languages, command sets, and the like
BootDevice
The device handle that corresponds to the device from which the currently executing image was loaded
BootManager
The part of the firmware implementation that is responsible for implementing system boot policy. Although a particular boot manager implementation is not specified in this document, such code is generally expected to be able to enumerate and handle transfers of control to the available OS loaders as well as EFI applications and drivers on a given system. The boot manager would typically be responsible for interacting with the system user, where applicable, to determine what to load during system startup. In cases where user interaction is not indicated, the boot manager would determine what to load and, if multiple items are to be loaded, what the sequencing of such loads would be.
Boot Services
The collection of interfaces and protocols that are present in the boot environment. The services minimally provide an OS loader with access to platform capabilities required to complete OS boot. Services are also available to drivers and applications that need access to platform capability. Boot services are terminated once the OS takes control of the platform.
BSD
Berkeley Software Distribution
BSP
Boot Strap Processor - typically the processor that will execute SEC and PEI
COFF
Common Object File Format. An (originally) Unix *-based file format that is now recognized under several OSs. The format uses one or more header fields followed by the section data for the file
Compatibility16
A traditional legacy BIOS with the POST and BIOS Setup code removed. Compatibility16 BIOS code executes in real mode
CompatibilityBIOS
The combination of both EfiCompatibility and Compatibility16
CompatibilitySmm
Any IBV-provided SMM code to perform traditional functions that are not provided by EFI
CRC
Cyclic Redundancy Check. A fixed-size error checking code appended to the end of a block of data (file) that is based on the content of the file
CRTM
Core Root-of-Trust Module
CSM
Compatibility Support Module. The combination of EfiCompatibility, CompatibilitySmm , and Compatibility16. Portion of the Framework that allows compatibility with non-EFI compliant operating systems to run on Framework firmware
CVDR
Configuration Values Driven through Reset
Depex
Dependency expression. Code associated with each Framework driver that describes the dependencies that must be satisfied in order for that driver to run. Controls order of execution in a Framework dispatch of PEIM and DXE drivers
DispatchEntry Point
The entry point that the dispatcher invokes
Driver
Modular chunk of firmware code that supports chipset or platform features. bReusable in multiple system contexts
DXE
Driver Execution Environment phase
DXE Foundation
A set of intrinsic services and an execution mechanism for sequenced control of driver modules
DXE Services
Services, such as security services and driver services, that are usable by DXE drivers
EfiCompatibility
EFI code that corresponds to EFI compatibility drivers, code that generates data for compatibility interfaces, or code that invokes compatibility services.
EDK
EFI Developer Kit
EPL
Eclipse Public License
Extensible Firmware Interface (EFI)
EFI is a specification that defines the interface between an operating system, option ROMs, and platform firmware. EFI was originally invented by Intel as the Intel(R) Itainum BIOS replacement. EFI is now owned by a industry non-profit collaborative trade organization called The UEFI Forum.
FAT
File Allocation Table
FAT32
FAT32 File System Driver
FD
Firmware Device. A persistent physical repository that contains firmware code and/or data and that may provide NVS. For the purposes of this architecture specification, the topology of bFDs should be abstracted via bFVs.
FFS
Firmware File System. A binary storage format that is well suited to firmware volumes. The abstracted model of the FFS is a flat file system
Firmware Device
See FD.
Firmware Volume
See FV.
FIT
Firmware Interface Tableb.( Itanium systems only)
Font
A translation between Unicode weights and glyphs. This "M" and this "M" and this "M" represent the same weight but in different fonts
FoundationCode
The core interoperability interfaces between modules and in the Framework
FPSWA
Floating Point Software Assist. (Itanium systems only)
Framework
short for Intel® Platform Innovation Framework for EFI
FS
Firmware Store. The abstracted model of the FS is a flat "file system" where individual files are SUMs
FV
There are one or more FVs in the FS. The FV containing the "reset vector" is known as the Boot Firmware Volume (BFV). A FV is a simple Flash File System that starts with a header and contains files that are named by a GUID. The file system is flat and does not support directories. Each file is made up of a series of sections that support encapsulation.
GCD
Global coherency domain. The address resources of a system as seen by a processor. It consists of both system memory and I/O space
glyph
The graphical representation of a single Unicode weight
Globally Unique IDentifier (GUID)
Globally Unique Identifier. A 128-bit value used to differentiate and name services and structures.
HII
Human Interface Infrastructure. Repository of configuration and translation information for localization. Typically used with boot manager and shell to provide a localized user interface.
HOB
Hand-Off Block. A structure used to pass information from one boot phase to another (i.e., from the PEI phase to the DXE phase)
IBV
Independent BIOS Vendor
IFR
Internal Forms Representation. A binary encoding of forms-based display content and configuration information
IHV
Independent Hardware Vendor
IME
Input Method Editor
Intrinsic Services
Services, such as security services and driver services, that remain available after the phase during which they are instantiated
IPL
Initial Program Load. An architectural PEIM to PEIM interface that starts the DXE phase
IPMI
Intelligent Platform Management Interface
ISO 3166
An association between a country or region and a two or three character ASCII string
ISO 639-2
An association between a language or dialect and a three character ASCII string
Localization
Concepts by which an interface is made useful to users speaking different languages and from various cultures by adapting the interfaces to the user. "STOP" in English would be "ALTO" in Spanish and "СТОП" in Russian. Alphabetic on keyboards are local to the language and may be local to the country the keyboard is localized for. For example, a French keyboard in France is different from a French keyboard in Canada.
MCA
Machine Check Architecture
MDE
Module Development Environment
NMI
Non-maskable Iinterrupt
NRAM
Nonvolatile Random Access Memory
NVS
Nonvolatile storage. Flash, EPROM, ROM, or other persistent store that will not go away once system power is removed
ODM
Original Device Manufacturer
OEM
Original Equipment Manufacturer
OpROM
Option ROM
PAL
Processor Abstraction Layer. A binary distributed by Intel that is used by the 64 bit Itanium processor family
PCI
Peripheral Component Interconnect. See www.pcisig.com for more information.
PCR
Platform Configuration Register
PE/COFF
PE32, PE32+, or Common Object File Format. A defined standard file format for binary images
PEI
Pre-EFI Initialization phase. Set of drivers usually designed to initialize memory and the cpu so that DXE phase can run. sually the first bset of code run starting from reset.
PEI Foundation
A set of intrinsic services and an execution mechanism for sequenced control of PEIMs
Pre EFI Initialization Module (PEIM)
Pre-EFI Initialization Module. Modular chunk of firmware code running in PEI that supports chipset or platform features. Reusable in multiple system contexts.
PEI Services
Common services that are usable by PEIMs
PEIM to PEIM Interface (PPI)
A C structure named by a GUID that is published by one PEIM and consumed by another. The C structure can contain data and member functions. It differs from a Protocol in that it may have to function prior to memory being available and parts of the PPI could be in read only memory.
PHIT
Phase Handoff Information Table. A HOB that describes the physical memory used by the PEI phase and the boot mode discovered during the PEI phase.
PIC
Position-independent code. Code that can be executed at any address without relocation
POST
Power On Self Test
Protocol
A C structure named by a GUID that is published by one EFI or DXE driver and consumed by another. The C structure can contain data and member functions.
Reverse Thunk
The code to transition from 16-bit real mode to native execution mode
RSD_PTR
ACPI definition: Root System Description Pointer
RT or Runtime phase
For EFI and the Framework this is after exit boot services has executed and the OS is in control of the system.
Runtime Services
Interfaces that provide access to underlying platform-specific hardware that may be useful during OS runtime, such as time and date services. These services become active during the boot process but also persist after the OS loader terminates boot services.
SAL
System Abstraction Layer. (Itanium systems only)
SALE_ENTRY
System Abstraction Layer entry point. (Itanium systems only)
Sandbox
The common properties of a driver or preboot environment that allow applications to run. These properties include a defined load image format and services that can run in the sandbox.
SEC
SECurity Phase. Initial starting point for boot process, first code executed after hardware reset. Responsible for 1) Establishing root trust in the software space; 2) Initializing architecture specific configuration to establish memory space for the C code stack.
SMI
System Management Interrupt
SMM
System Management Mode
SOR
Schedule on Request
SSE
Streaming SIMD Extensions
SUM
Separately Updateable Module. A portion of the BFV that is treated as a separate module that can be updated without affecting the other SUMs in the BFV.
Tiano
Codename for the Intel Project to develop the Framework
TCB
Trusted Computing Base
TCG
Trusted Computing Group
TE Image
Terse Executable image. An executable image format that is specific to the Framework. This format is used only in PEI and is used for storing executable images in a smaller amount of space than would be required by a full PE32+ image. Is a smaller more compact version of bPE32.
Thunk
The code to transition from native execution mode to 16-bit real mode
UNDI
Universal Network Driver Interface. Silicon specific driver in the preboot LAN stack that interfaces to SNP and PXEBC
Unicode
A standard defining an association between numeric values known as "weights" and characters from the majority of the worlds currently used languages. See the Unicode specification for more information.
USB
Universal Serial Bus. See http://www.usb.org for more information
VFR
Visual Forms Representation. A high-level language representation of IFR
VM
Virtual Machine
VTF
Volume Top File. A file in a firmware volume that must be located such that the last byte of the file is also the last byte of the firmware volume
VT-UTF8
A serial protocol definition that extends VT-100 to support Unicode
Watchdog Timer
An alarm timer that may be set to go off. This can be used to regain control in cases where a code path in the boot services environment fails to or is unable to return control by the expected path.
XIP
Execute In Place. PEI code that is executed from its storage location in a firmware volume