This section introduces communication channels between DXE driver and PEIM, including HOB, variable, and PCD.
A HOB is a one-way channel to pass data from PEI to DXE. The HOB list is provided during the PEI phase, and must be treated as a read-only data structure in the DXE phase. It conveys the state of the system at the time the DXE Foundation is started. The DXE drivers must not modify the contents of the HOB list.
HobLib provides a set of APIs to build and parse a HOB list. Since DXE drivers only read the HOB list, module writers of DXE drivers can focus on the APIs to parse HOB list.
Several typical usage types are shown in examples below:
184.108.40.206 Traversing all HOBs in the HOB list
!END_OF_HOB_LIST(Hob); Hob =GET_NEXT_HOB(Hob))
// Further operation on the HOB can be added
220.127.116.11 Retrieving only the first HOB of a specific type in the HOB list
(CPU HOB type example)
// Operation on the HOB can be added here.
18.104.22.168 Traversing specific types of HOBs in the HOB list (CPU HOB type example)
// At the end of loop, GET_NEXT_HOB must be added here.
// GetNextHob (
HobType, HobStart) does not skip the HOB passed by
// parameter HobStart. It returns HobStart back if HobStart itself
// meets the requirement. So it is required to use GET_NEXT_HOB() to
// skip current HOB. Otherwise, it would be in dead loop.
A non-volatile variable can serve as a channel to pass data from DXE to PEI. Because only a DXE driver can write a variable, and PEIM can only read variables, this channel from DXE to PEI is also a one-way channel.
8.5.3 Dynamic PCD
A non-volatile dynamic PCD is also a high-level mechanism for communication between a DXE driver and a PEIM.