原 UEFI中DXE阶段概总

 

 

------------------------------------------MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c

  1. // Setup the default exception handlers
  2. // Initialize Debug Agent to support source level debug in DXE phase
  3. // Initialize Memory Services
  4. // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
  5. // Start the Image Services.
  6. // Initialize the Global Coherency Domain Services
  7. // Call constructor for all libraries
  8. // Report DXE Core image information to the PE/COFF Extra Action Library
  9. // Install the DXE Services Table into the EFI System Tables's Configuration Table
  10. // Install the HOB List into the EFI System Tables's Configuration Table
  11. // Install Memory Type Information Table into the EFI System Tables's Configuration Table
  12.   // If Loading modules At fixed address feature is enabled, install Load moduels at fixed address Configuration Table so that user could easily to retrieve the top address to load Dxe and PEI Code and Tseg base to load SMM driver.
  13. // Report Status Code here for DXE_ENTRY_POINT once it is available
  14.   // Create the aligned system table pointer structure that is used by external debuggers to locate the system table...  Also, install debug image info configuration table.
  15. // Initialize the Event Services
  16.   // Get persisted vector hand-off info from GUIDeed HOB again due to HobStart may be updated, and install configuration table
  17. // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
  18.   // Register for the GUIDs of the Architectural Protocols, so the rest of the  EFI Boot Services and EFI Runtime Services tables can be filled in. Also register for the GUIDs of optional protocols.
  19. // Produce Firmware Volume Protocols, one for each FV in the HOB list.
  20. // Produce the Section Extraction Protocol
  21. // Initialize the DXE Dispatcher
  22. // Invoke the DXE Dispatcher
  23. // Display Architectural protocols that were not loaded if this is DEBUG build
  24. // Display any drivers that were not dispatched because dependency expression evaluated to false if this is a debug build
  25. // Assert if the Architectural Protocols are not present.
  26. // Report Status code before transfer control to BDS
  27. // Transfer control to the BDS Architectural Protocol
  28. // BDS should never return

 

  1. //设置默认异常处理程序
  2. //初始化调试代理以支持DXE阶段的源级调试
  3. //初始化内存服务
  4. //从EfiRuntimeServicesData中分配EFI系统表和EFI运行时服务表,使用模板初始化EFI系统表和EFI运行时服务表的内容
  5. //启动映像服务。
  6. //初始化全局一致性域服务
  7. //调用所有库的构造函数
  8. //将DXE核心映像信息报告给PE/COFF额外动作库
  9. //将DXE服务表安装到EFI系统表的配置表中
  10. //将HOB列表安装到EFI系统表的配置表中
  11. //将内存类型信息表安装到EFI系统表的配置表中
  12. //如果启用了固定地址加载模块功能,则在固定地址配置表中安装加载模块,以便用户能够轻松检索到要加载Dxe和PEI代码的顶层地址,以及要加载SMM驱动程序的Tseg base。
  13. // DXE_ENTRY_POINT一旦可用,就在这里报告状态代码
  14. //创建对齐的系统表指针结构,用于外部调试器定位系统表…另外,安装调试映像信息配置表。
  15. //初始化事件服务
  16. //由于HobStart的原因,再次从GUIDeed HOB获取持久化的矢量传递信息,并安装配置表
  17. //发布EFI、Tiano和自定义解压协议,供其他DXE组件使用
  18. //注册体系结构协议的guid,以便填充EFI引导服务和EFI运行时服务表的其余部分。还可以注册可选协议的guid。
  19. //为HOB列表中的每个FV生成固件卷协议。
  20. //生成切片提取协议
  21. //初始化DXE调度程序
  22. //调用DXE调度程序
  23. //如果这是调试构建,则显示未加载的体系结构协议
  24. //如果这是一个调试构建,则显示由于依赖关系表达式被计算为false而没有被分派的驱动程序
  25. //如果不存在体系结构协议,则断言。
  26. //在将控制转移到BDS之前报告状态码
  27. //将控制转移到BDS体系结构协议
  28. //北斗不应该再回来

 

------------------------------------MdePkg/Include/Pi/PiDxeCis.h
/// EFI System Table
typedef struct {
  EFI_TABLE_HEADER     Hdr;  ///EFI系统表的表头。
typedef struct {
  UINT64  Signature; ///一个64位签名,用于标识下面的表的类型。已经为EFI系统表、EFI引导服务表和EFI运行时服务表生成了惟一的签名。         
  UINT32  Revision;  ///本表所符合的EFI规范的修订。该字段的上16位包含主要修订值,下16位包含次要修订值。次要的修订值被限制在00..99的范围内。
  UINT32  HeaderSize;///包括EFI_TABLE_HEADER在内的整个表的大小(以字节为单位)。
  UINT32  CRC32;///整个表的32位CRC。该值的计算方法是将该字段设置为0,并计算HeaderSize字节的32位CRC。
  UINT32  Reserved; ///保留字段,必须设置为0。                                                                                                                                                    
} EFI_TABLE_HEADER;
 
  CHAR16               *FirmwareVendor;    ///指向空终止字符串的指针,该字符串标识为平台生产系统固件的供应商。
  UINT32               FirmwareRevision;  ///固件供应商指定的值,用于标识平台系统固件的修订。
  EFI_HANDLE           ConsoleInHandle;  ///活动控制台输入设备的句柄。这个句柄必须支持EFI_SIMPLE_TEXT_INPUT_PROTOCOL和EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL。
  EFI_SIMPLE_TEXT_INPUT_PROTOCOL    *ConIn;  ///指向与ConsoleInHandle关联的EFI_SIMPLE_TEXT_INPUT_PROTOCOL接口的指针。
  EFI_HANDLE                        ConsoleOutHandle;  ///活动控制台输出设备的句柄。
  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *ConOut;///指向与ConsoleOutHandle关联的EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL接口的指针。
  EFI_HANDLE                        StandardErrorHandle;   ///活动标准错误控制台设备的句柄。这个句柄必须支持EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL。
  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *StdErr;///指向与standard derrorhandle关联的EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL接口的指针。
  EFI_RUNTIME_SERVICES              *RuntimeServices;//指向EFI运行时服务表的指针。
  EFI_BOOT_SERVICES                 *BootServices;///指向EFI引导服务表的指针。
  UINTN                             NumberOfTableEntries;        ///缓冲区configuration表中系统配置表的数量。
  EFI_CONFIGURATION_TABLE           *ConfigurationTable; //指向系统配置表的指针。表中的条目数是NumberOfTableEntries。
} EFI_SYSTEM_TABLE;   


------------------------------------MdePkg/Include/Pi/PiDxeCis.h
typedef struct {
  /// The table header for the DXE Services Table.This header contains the DXE_SERVICES_SIGNATURE and DXE_SERVICES_REVISION values.
  EFI_TABLE_HEADER                Hdr;

  // Global Coherency Domain Services
  EFI_ADD_MEMORY_SPACE            AddMemorySpace;
  EFI_ALLOCATE_MEMORY_SPACE       AllocateMemorySpace;
  EFI_FREE_MEMORY_SPACE           FreeMemorySpace;
  EFI_REMOVE_MEMORY_SPACE         RemoveMemorySpace;
  EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
  EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
  EFI_GET_MEMORY_SPACE_MAP        GetMemorySpaceMap;
  EFI_ADD_IO_SPACE                AddIoSpace;
  EFI_ALLOCATE_IO_SPACE           AllocateIoSpace;
  EFI_FREE_IO_SPACE               FreeIoSpace;
  EFI_REMOVE_IO_SPACE             RemoveIoSpace;
  EFI_GET_IO_SPACE_DESCRIPTOR     GetIoSpaceDescriptor;
  EFI_GET_IO_SPACE_MAP            GetIoSpaceMap;

  // Dispatcher Services
  EFI_DISPATCH                    Dispatch;                                                                                                                                                   
  EFI_SCHEDULE                    Schedule;
  EFI_TRUST                       Trust;

  // Service to process a single firmware volume found in a capsule
  EFI_PROCESS_FIRMWARE_VOLUME     ProcessFirmwareVolume;

  // Extensions to Global Coherency Domain Services
  EFI_SET_MEMORY_SPACE_CAPABILITIES SetMemorySpaceCapabilities;
} DXE_SERVICES;


------------------MdePkg/Include/Uefi/UefiSpec.h
/// EFI Runtime Services Table.
typedef struct {
  /// The table header for the EFI Runtime Services Table. EFI运行时服务表的表头。
  EFI_TABLE_HEADER                Hdr;

  // Time Services       时间服务
  EFI_GET_TIME                    GetTime;
  EFI_SET_TIME                    SetTime;
  EFI_GET_WAKEUP_TIME             GetWakeupTime;
  EFI_SET_WAKEUP_TIME             SetWakeupTime;

  // Virtual Memory Services  虚拟内存服务
  EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
  EFI_CONVERT_POINTER             ConvertPointer;

  // Variable Services     变量服务
  EFI_GET_VARIABLE                GetVariable;
  EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
  EFI_SET_VARIABLE                SetVariable;

  // Miscellaneous Services  各种各样的服务
  EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
  EFI_RESET_SYSTEM                ResetSystem;

  // UEFI 2.0 Capsule Services UEFI 2.0服务
  EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
} EFI_RUNTIME_SERVICES;

 

 

 

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值