Execution order FAQ - lersek/edk2 GitHub Wiki

Execution order

Table of Contents

Can you see the execution order?

Yes with performance tools and on a specific platform with DEBUG enabled you can see the individual DXE Drivers through the serial redirection on a host machine running a terminal emulation application. The execution order is deterministic. For a given a platform configuration, the dispatch order will always be the same on every boot. If there are platform configuration changes, then the dispatch order may change.The serial output can also show the dispatch order of PEIMs and UEFI Drivers.

What tool collects all the drivers and what order does the driver dispatcher execute the drivers?

The mechanism is in the PI Spec. The concept is that for every driver there is a dependency expression - UEFI Drivers implied dependence on architecure protocoals and DXE Services. The PEI and DXE dispatcher is responsible for checking each driver's dependency and deterines whether to dispatch/execute each driver as it finds it in the flash device. If the driver's dependency expression does not evaluate to TRUE it will set that driver aside and continue to the next driver in the flash device. It is possible some drivers may not get dispatched.

Does it mean that Dispatched is accessing the flash searching for the dependency expressions?

The code will access the flash as little as possible because of the performance. For example, in PEI there is use of Cache memory if a driver's dependency is not TRUE.

How does PEI core allocate Cache for keeping track of PEIMs that do not get dispatched?

No eviction mode and set a side temp memory. PEI core will allocate memory.

There is another method called an a priori file. There can be one per Firmware volume. This will tell the dispatcher what order to dispatch list drivers in the order they need to dipatch them. This is a manual order. It does not need to be in any specific place in the FV. If it in the FV the dispatcher will find it.

⚠️ **GitHub.com Fallback** ⚠️