How to prevent a DXE driver from loading automatically


King Sumo
 

Hi All,

I'm including EFI drivers for an Intel Network card, but this adds a huge delay in the system startup when the ports are being initialized (the server has several slots). The network cards will be used only for PXE boot during the staging/setup process, so I'm thinking of adding a configurable option to enable/disable the PXE boot. So only if enabled the drivers will be loaded, and after the staging the PXE can be disabled via BMC or something else.

Do we have any way to prevent a driver from being loaded automatically? Such as using some conditions or dependencies? For instance, if some driver is not loaded or some protocol isn't available?

One option will be setting the EFI files as RAW or FREEFORM so they will not be recognized as a DRIVER during the DXE phase. But it will be required to implement the driver loading, I'm not sure how difficult it will be (maybe using GetSectionFromAnyFv to load the contents to a buffer, but how to load it?). 

Kind Regards,
Sumo