UEFI标准与架构简介

参考文档:Vincent Zimmer, Michael Rothman, Suresh Marisetty - Beyond BIOS_ Developing with the Unified Extensible Firmware Interface-De_G Press (2017).pdf

uefi  spec

http://www.lab-z.com/uefi-spec/

https://uefi.org/specifications/

 

bios全称Basic Input/Output System,会碰到的实际场景。

What can the operating system count on when it is loaded and initially receives control? 操作系统loaded初始化之后获取控制权的依据是什么?
How can the same basic structure work for handhelds and megaservers?
相同的基本结构如何适用于手持设备和大型服务器?
How do we convince ourselves today’s design will work 10 or 20 years from now?
如何确保设计在10年或20年后有效?
What comes after BIOS (Basic Input/Output System)?
bios之后的过程?

How should you boot a computer?  如何启动一个系统?

What sits at the reset vector?  复位表位于什么位置?

 

UEFI架构?UEFI的驱动模型?驱动存储的host-bus adapter,

This Unified Extensible Firmware Interface (hereafter known as UEFI) Specification describes an interface between the operating system (OS) and the platform firmware. UEFI was preceded by the Extensible Firmware Interface Specification 1.10 (EFI). As a result, some code and certain protocol names retain the EFI designation. Unless otherwise noted, EFI designations in this specification may be assumed to be part of UEFI. The interface is in the form of data tables that contain platform-related information, and boot and runtime service calls that are available to the OS loader and the OS. Together, these provide a standard environment for booting an OS. This specification is designed as a pure interface specification. As such, the specification defines the set of interfaces and structures that platform firmware must implement. Similarly, the specification defines the set of interfaces and structures that the OS may use in booting. How either the firmware developer chooses to implement the required elements or the OS developer chooses to make use of those interfaces and structures is an implementation decision left for the developer. The intent of this specification is to define a way for the OS and platform firmware to communicate only information necessary to support the OS boot process. This is accomplished through a formal and complete abstract specification of the software-visible interface presented to the OS by the platform and firmware. Using this formal definition, a shrink-wrap OS intended to run on platforms compatible with supported processor specifications will be able to boot on a variety of system designs without further platform or OS customization. The definition will also allow for platform innovation to introduce new features and functionality that enhance platform capability without requiring new code to be written in the OS boot sequence. Furthermore, an abstract specification opens a route to replace legacy devices and firmware code over time. New device types and associated code can provide equivalent functionality through the same defined abstract interface, again without impact on the OS boot support code. The specification is applicable to a full range of hardware platforms from mobile systems to servers. The specification provides a core set of services along with a selection of protocol interfaces. The selection of protocol interfaces can evolve over time to be optimized for various platform market segments. At the same time, the specification allows maximum extensibility and customization abilities for OEMs to allow differentiation. In this, the purpose of UEFI is to define an evolutionary path from the traditional “PC-AT”- style boot world into a legacy-API free environment.
### UEFI GOP 驱动架构详解 UEFI(统一可扩展固件接口)中的图形输出协议 (Graphics Output Protocol, GOP) 是一种用于定义硬件抽象层的标准,旨在提供对显示设备的支持。GOP 协议允许操作系统或其他软件访问底层图形硬件的功能,从而实现更高效的图形渲染和更高的分辨率支持。 #### 1. GOP 的基本概念 GOP 提供了一种标准化的方式来管理计算机的图形输出功能。它替代了传统的 VGA 生物中断调用模式(INT10h),并提供了更高层次的抽象[^3]。GOP 定义了一个通用的 API 接口,使得开发者可以轻松地编写跨平台的应用程序而不必关心具体的硬件细节。 #### 2. 架构组成 UEFI GOP 驱动通常由以下几个主要组件构成: - **EDK II Framework**: 这是一个开源框架,包含了构建 UEFI 应用所需的各种工具和服务。它是开发 UEFI 驱动的基础环境之一。 - **DXE Driver Initialization Phase**: DXE(Driver Execution Environment)阶段负责初始化所有的驱动程序,包括 GOP 驱动。在此期间,GOP 驱动会探测可用的显示适配器,并设置默认的视频模式。 - **Protocol Interfaces**: GOP 使用一组特定的协议接口来暴露其能力给其他模块或应用程序。这些接口主要包括 `SetMode` 和 `Blt` 函数等操作方法[^1]。 #### 3. 工作流程分析 当系统启动进入 Pre-OS Boot 阶段时,GOP 驱动按照如下顺序完成初始化过程: 1. **检测硬件资源** - 扫描连接到主板上的所有可能存在的显示器端口(如 HDMI、DisplayPort 等)。 2. **配置初始状态** - 设置一个基础的工作模式,默认情况下可能是较低分辨率但稳定可靠的选项。 3. **注册服务入口点** - 将自己作为 GraphicsOutputProtocol 实现者向 EFI System Table 注册,以便后续组件能够发现并利用该功能。 4. **处理用户交互请求** - 如果有来自 Shell 或 Setup Utility 的命令更改当前屏幕参数,则相应调整实际物理帧缓冲区的内容布局以及像素格式转换逻辑。 #### 4. 技术优势对比 Legacy VBIOS 相比于 legacy BIOS 中使用的 VBE/Int10h 方法,采用基于 GOP 的新方案具有显著的技术进步之处: | 特性 | Traditional VBios | Modern UEFI GOP | |--------------------|-------------------------------------|----------------------------------| | 显示控制机制 | 基于中断的服务模型 | 利用了现代总线通信协议 | | 支持的最大分辨率 | 受限于固定表项 | 动态适应多种高分屏需求 | | 性能表现 | 较慢 | 更快速度 | 以上表格清晰展示了两者之间的差异所在。 ```c // 示例代码片段展示如何查询已安装的GOP实例数量 #include <Uefi.h> #include <Library/UefiLib.h> UINTN HandleCount; EFI_HANDLE *HandleBuffer; Status = gBS->LocateHandleBuffer( ByProtocol, &gEfiGraphicsOutputProtocolGuid, NULL, &HandleCount, &HandleBuffer); if (!EFI_ERROR(Status)) { Print(L"%d instances of GOP found.\n", HandleCount); } ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值