From 13406bdeb5c5bea7f5cee6b3c0dfaff253579710 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 8 Apr 2020 19:23:27 +0200 Subject: MdeModulePkg/DeviceManagerUiLib: connect all before creating menu page The device manager UI library creates a UiApp submenu that contains a list of network devices in the system. The logic that creates this menu assumes that all handles have been connected to their drivers, but this is not guaranteed in the general case: due to the way UiApp is constructed, this logic runs before the UiApp entrypoint is invoked, which is where ConnectAll() is normally called to ensure that all existing controllers are connected to their drivers. Moving this call into DeviceManagerUiLib is not an option, since it is incorporated into UiApp via NULL library class resolution, and so it may not be included to begin with. So work around this by doing an explicit additional ConnectAll() before populating the pages. Signed-off-by: Ard Biesheuvel Link: https://edk2.groups.io/g/devel/topic/72879609#57075 Reviewed-by: Dandan Bi --- MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c | 7 +++++++ MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h | 1 + MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf | 1 + 3 files changed, 9 insertions(+) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c index 0540e6fa8a..3bc13d3407 100644 --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c @@ -892,6 +892,13 @@ DeviceManagerUiLibConstructor ( ); ASSERT (gDeviceManagerPrivate.HiiHandle != NULL); + // + // The device manager form contains a page listing all the network + // controllers in the system. This list can only be populated if all + // handles have been connected, so do it here. + // + EfiBootManagerConnectAll (); + // // Update boot manager page // diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h index 22fe12d2a5..c53c2a1a0e 100644 --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include // diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf index cb01b3b851..d7f833d8b2 100644 --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf @@ -40,6 +40,7 @@ DebugLib PrintLib HiiLib + UefiBootManagerLib UefiHiiServicesLib [Guids] -- cgit v1.2.3