On 12/06/19 15:31, Ard Biesheuvel wrote: > Currently, we dispatch drivers specified via Driver#### entries after > calling PlatformBootManagerBeforeConsole(), which prevents us from > loading drivers that provide consoles via Driver#### entries.
I'd put this as: ... which prevents PlatformBootManagerBeforeConsole() from adding such consoles to ConIn, ConOut and StdErr that are produced by drivers loaded via Driver#### options. > This is particularly annoying on AArch64 systems, given that it prevents > us from loading AArch64 drivers from the ESP for PCIe graphics cards > that shipped with x86 drivers in the option ROM, which is the common > case today. > > So let's reorder the handling of the Driver#### entries with the > invocation of PlatformBootManagerBeforeConsole(), which results in > Driver#### entries being dispatched in the same way as option ROM > images. Ah, so you are saying the drivers will be added unconditionally to the deferred list, with this patch (because, at the new ProcessLoadOptions() call site, the platform cannot have signaled EndOfDxe yet). Then in PlatformBootManagerBeforeConsole(), the platform can signal EndOfDxe, call EfiBootManagerDispatchDeferredImages(), connect GOP drivers, see what new handles / device paths are created, and *then* update ConIn / ConOut / ConErr. Can you point out where the deferral happens, inside ProcessLoadOptions()? (If there is no deferral, then we can't / shouldn't do this, as drivers from the ESP should not be loaded before EndOfDxe, I think.) Hmmm... it looks like: BdsEntry() [MdeModulePkg/Universal/BdsDxe/BdsEntry.c] ProcessLoadOptions() [MdeModulePkg/Universal/BdsDxe/BdsEntry.c] EfiBootManagerProcessLoadOption() [MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c] CoreLoadImage() [MdeModulePkg/Core/Dxe/Image/Image.c] -- via gBS->LoadImage() CoreLoadImageCommon() [MdeModulePkg/Core/Dxe/Image/Image.c] Security2StubAuthenticate() [MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c] -- via gSecurity2->FileAuthentication() Defer3rdPartyImageLoad() [MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c] // checks "mEndOfDxe" QueueImage() [MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.c] OK. I think this series makes sense. I defer to Ray, but from my POV, it should be OK. With the patch#2 commit message updated: series Reviewed-by: Laszlo Ersek <ler...@redhat.com> Thanks Laszlo > > Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> > --- > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > index 1fb04dcbbcda..ad4c4c0406f6 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > @@ -850,6 +850,14 @@ BdsEntry ( > } > } > > + // > + // Execute Driver Options. Images will be loaded but dispatch will be > + // deferred for 3rd party images until EndOfDxe is signalled. > + // > + LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, > LoadOptionTypeDriver); > + ProcessLoadOptions (LoadOptions, LoadOptionCount); > + EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); > + > // > // Do the platform init, can be customized by OEM/IBV > // Possible things that can be done in PlatformBootManagerBeforeConsole: > @@ -868,13 +876,6 @@ BdsEntry ( > // > EfiBootManagerStartHotkeyService (&HotkeyTriggered); > > - // > - // Execute Driver Options > - // > - LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, > LoadOptionTypeDriver); > - ProcessLoadOptions (LoadOptions, LoadOptionCount); > - EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); > - > // > // Connect consoles > // > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51976): https://edk2.groups.io/g/devel/message/51976 Mute This Topic: https://groups.io/mt/67470372/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-