DXE 由下面這三個compoment組成
- DXE Foundation
- DXE Dispatcher
- DXE Drivers
DXE Phase 是 system 實作最多 Initial 的時後
PEI Phase會initial Permanent Memory,所以DXE code 可以被 load跟executed
在PEI Phase最後面會傳HOB 給 DXE,HOB是一個Data Structure
PEI 跟DXE之間的溝通
- DXE Foundation 只有 depends on HOB 在initial state的時後,其它都不會影響 DXE Foundation(ex.PEI Phase的Service等等)
- DXE Foundation不會包含Hard-coded address。因為這個原因,DXE Foundation可以在任何Physical Address中被load
- DXE Foundation不會包含任何的processor-specific or chipset-specific or platform-spfcific的資訊, DXE Foudation 和 DXE Drivers 透過 Achitecture Protocols 和 Motherboard 溝通( 就是Hardware)
- DXE Foundation 會產生EFI System table (裡面有Runtime Service 、Boot Service等等 忘記的可以看下圖)
- 會維護Handle Database,每個Handle由GUID命名
- 裡面包含了boot mode、Processor's instruction set和Firmware Device的Memory Description
- 裡面最重要的是描述System Memory 和Firmware Volume的HOB
- FV 包含了DXE Driver,DXE Dispatcher負責將這些在FV中的DXE Driver 做 load 和執行的動作
Hand-Off Block (HOB)List
/// /// Value of version in EFI_HOB_HANDOFF_INFO_TABLE. /// #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009 /// /// Contains general state information used by the HOB producer phase. /// This HOB must be the first one in the HOB list. /// typedef struct { /// /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_HANDOFF. /// EFI_HOB_GENERIC_HEADER Header; /// /// The version number pertaining to the PHIT HOB definition. /// This value is four bytes in length to provide an 8-byte aligned entry /// when it is combined with the 4-byte BootMode. /// UINT32 Version; /// /// The system boot mode as determined during the HOB producer phase. /// EFI_BOOT_MODE BootMode; /// /// The highest address location of memory that is allocated for use by the HOB producer /// phase. This address must be 4-KB aligned to meet page restrictions of UEFI. /// EFI_PHYSICAL_ADDRESS EfiMemoryTop; /// /// The lowest address location of memory that is allocated for use by the HOB producer phase. /// EFI_PHYSICAL_ADDRESS EfiMemoryBottom; /// /// The highest address location of free memory that is currently available /// for use by the HOB producer phase. /// EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop; /// /// The lowest address location of free memory that is available for use by the HOB producer phase. /// EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom; /// /// The end of the HOB list. /// EFI_PHYSICAL_ADDRESS EfiEndOfHobList; } EFI_HOB_HANDOFF_INFO_TABLE;PHIT (Phase HandOff Information Table)
DXE Foundation Architectural
Protocols
- DXE Foundation 使用 DXE Architectural Protocol產生 Boot Service Table 和 Runtime Service Table。
- DXE Driver從FV load 出來並產生DXE Architectural Protocol。
- DXE Foundation 必需要有足夠的Service去load跟執行DXE Driver。
- HOB List裡面會描述System Momory的總數以及最少一個FV。
- System會保證在這個時後只會跑在單核並diable interrupt的flat Physical Mode。
- FV要pass給DXE Dispatcher必需要有read-only的FFS driver才能去search DXE Driver。
- 當有DXE Driver被找到並需要被執行的時後,會透過PE/COFF loader去load and invoke DXE Driver。
- EFI Boot Service 和DXE Service Table會在進入runtime phase時被free掉
- EFI System Table和EFI Runtime Service Table被分配在EFI Runtime Service Memory並會持續存在到OS Runtime Phase
- Runtime Architectural Protocol 會提供Service讓Runtime Service從Physical mode 到 Virtual Mode。
DXE Service Table
- GCD (Global Coherency Domain Service):管理 I/O Resource、Memory-mapped I/O Resource和System Memory Resource。可以參考/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
- DXE Dispatcher Service:管理被DXE Dispatcher Dispatch的DXE Driver
DXE Dispatcher Flow
- DXE Foundation Initial完,將控制權交給 DXE Dispatcher
- DXE Dispatcher從HOB List中找FV裡面的Driver
- 在過程中可能會有另外的FV被找到
- 透過priori file對新的FV進行Search (priori file有固定的name包含了DXE Driver List並且會第一個被執行到)
- 當DXE Driver都被load和執行後會開始跑Dependency expressions
- Dependency expression裡有weakly的執行順序
- 在DXE Driver被執行前,需要被 Security Architectural Protocol 授權
- 執行已經被授權的Driver
- 接著控制權會轉移給BDS Architectural Protocol
- BDS Architectural Protocol會建立Console Device並boot 進OS
- 如果 BDS Architectural Protocol無法開始Console Device或OS,會退回DXE Dispatcher
Dependency Grammer
- Dispatcher可以直接看Driver的Dependency Section
- Dependency Section包含了Section Header,寫法需符合Dependency grammer,也就是要有opcodes和operands
- 裡面包含了ordering
great!
回覆刪除MbrachinVbrev_pe_North Las Vegas Ana Brown https://wakelet.com/wake/DE0WFKqd2ai18JiES3NCp
回覆刪除abomuntran