参考和说明
相关参考:
- 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中所有相关的缩略语
ACPIAdvanced Configuration and Power Interface. See www.acpi.infoALAfterlife phase. Also known as the "power down phase."AMLACPI Machine LanguageAPIApplication Program Interface. Programmatic interfaces for the firmware (not Win32-type OS-level APIs).a priori fileA 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.ArtifactSomething tracked in Project TrackerASLACPI Source LanguageAttributeA field of something tracked in CEE Project TrackerBABoot AuthorizationBBSBIOS Boot SpecificationBDSBoot Device Selection phaseBFVBoot 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.BISBoot Integrity ServicesBISTBuilt-in self testBLTBlock 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.BNFBackus-Naur Form. A metasyntactic notation used to specify the syntax of programming languages, command sets, and the likeBootDeviceThe device handle that corresponds to the device from which the currently executing image was loadedBootManagerThe 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 ServicesThe 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.BSDBerkeley Software DistributionBSPBoot Strap Processor - typically the processor that will execute SEC and PEICOFFCommon 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 fileCompatibility16A traditional legacy BIOS with the POST and BIOS Setup code removed. Compatibility16 BIOS code executes in real modeCompatibilityBIOSThe combination of both EfiCompatibility and Compatibility16CompatibilitySmmAny IBV-provided SMM code to perform traditional functions that are not provided by EFICRCCyclic 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 fileCRTMCore Root-of-Trust ModuleCSMCompatibility 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 firmwareCVDRConfiguration Values Driven through ResetDepexDependency 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 driversDispatchEntry PointThe entry point that the dispatcher invokesDriverModular chunk of firmware code that supports chipset or platform features. bReusable in multiple system contextsDXEDriver Execution Environment phaseDXE FoundationA set of intrinsic services and an execution mechanism for sequenced control of driver modulesDXE ServicesServices, such as security services and driver services, that are usable by DXE driversEfiCompatibilityEFI code that corresponds to EFI compatibility drivers, code that generates data for compatibility interfaces, or code that invokes compatibility services.EDKEFI Developer KitEPLEclipse Public LicenseExtensible 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.FATFile Allocation TableFAT32FAT32 File System DriverFDFirmware 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.FFSFirmware File System. A binary storage format that is well suited to firmware volumes. The abstracted model of the FFS is a flat file systemFirmware DeviceSee FD.Firmware VolumeSee FV.FITFirmware Interface Tableb.( Itanium systems only)FontA translation between Unicode weights and glyphs. This "M" and this "M" and this "M" represent the same weight but in different fontsFoundationCodeThe core interoperability interfaces between modules and in the FrameworkFPSWAFloating Point Software Assist. (Itanium systems only)Frameworkshort for Intel® Platform Innovation Framework for EFIFSFirmware Store. The abstracted model of the FS is a flat "file system" where individual files are SUMsFVThere 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.GCDGlobal coherency domain. The address resources of a system as seen by a processor. It consists of both system memory and I/O spaceglyphThe graphical representation of a single Unicode weightGlobally Unique IDentifier (GUID)Globally Unique Identifier. A 128-bit value used to differentiate and name services and structures.HIIHuman Interface Infrastructure. Repository of configuration and translation information for localization. Typically used with boot manager and shell to provide a localized user interface.HOBHand-Off Block. A structure used to pass information from one boot phase to another (i.e., from the PEI phase to the DXE phase)IBVIndependent BIOS VendorIFRInternal Forms Representation. A binary encoding of forms-based display content and configuration informationIHVIndependent Hardware VendorIMEInput Method EditorIntrinsic ServicesServices, such as security services and driver services, that remain available after the phase during which they are instantiatedIPLInitial Program Load. An architectural PEIM to PEIM interface that starts the DXE phaseIPMIIntelligent Platform Management InterfaceISO 3166An association between a country or region and a two or three character ASCII stringISO 639-2An association between a language or dialect and a three character ASCII stringLocalizationConcepts 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.MCAMachine Check ArchitectureMDEModule Development EnvironmentNMINon-maskable IinterruptNRAMNonvolatile Random Access MemoryNVSNonvolatile storage. Flash, EPROM, ROM, or other persistent store that will not go away once system power is removedODMOriginal Device ManufacturerOEMOriginal Equipment ManufacturerOpROMOption ROMPALProcessor Abstraction Layer. A binary distributed by Intel that is used by the 64 bit Itanium processor familyPCIPeripheral Component Interconnect. See www.pcisig.com for more information.PCRPlatform Configuration RegisterPE/COFFPE32, PE32+, or Common Object File Format. A defined standard file format for binary imagesPEIPre-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 FoundationA set of intrinsic services and an execution mechanism for sequenced control of PEIMsPre 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 ServicesCommon services that are usable by PEIMsPEIM 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.PHITPhase Handoff Information Table. A HOB that describes the physical memory used by the PEI phase and the boot mode discovered during the PEI phase.PICPosition-independent code. Code that can be executed at any address without relocationPOSTPower On Self TestProtocolA 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 ThunkThe code to transition from 16-bit real mode to native execution modeRSD_PTRACPI definition: Root System Description PointerRT or Runtime phaseFor EFI and the Framework this is after exit boot services has executed and the OS is in control of the system.Runtime ServicesInterfaces 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.SALSystem Abstraction Layer. (Itanium systems only)SALE_ENTRYSystem Abstraction Layer entry point. (Itanium systems only)SandboxThe 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.SECSECurity 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.SMISystem Management InterruptSMMSystem Management ModeSORSchedule on RequestSSEStreaming SIMD ExtensionsSUMSeparately 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.TianoCodename for the Intel Project to develop the FrameworkTCBTrusted Computing BaseTCGTrusted Computing GroupTE ImageTerse 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.ThunkThe code to transition from native execution mode to 16-bit real modeUNDIUniversal Network Driver Interface. Silicon specific driver in the preboot LAN stack that interfaces to SNP and PXEBCUnicodeA 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.USBUniversal Serial Bus. See http://www.usb.org for more informationVFRVisual Forms Representation. A high-level language representation of IFRVMVirtual MachineVTFVolume 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 volumeVT-UTF8A serial protocol definition that extends VT-100 to support UnicodeWatchdog TimerAn 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.XIPExecute In Place. PEI code that is executed from its storage location in a firmware volume
