summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhi Jin <zhi.jin@intel.com>2024-01-15 16:56:44 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-06 17:54:53 +0000
commit959f71c801b447186413532166d3fb2ad9a590da (patch)
tree036c234cfc5ea6439eb74591079cc14c70bc05b2
parent9eddbab65042259beb1a75ccdf724996eab9660d (diff)
downloadedk2-959f71c801b447186413532166d3fb2ad9a590da.tar.gz
edk2-959f71c801b447186413532166d3fb2ad9a590da.tar.bz2
edk2-959f71c801b447186413532166d3fb2ad9a590da.zip
MdeModulePkg: Optimize CoreConnectSingleController
CoreConnectSingleController() searches for the Driver Family Override Protocol drivers by looping and checking each Driver Binding Handles. This loop can be skipped by checking if any Driver Family Override Protocol installed in the platform first, to improve the performance. Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Zhi Jin <zhi.jin@intel.com>
-rw-r--r--MdeModulePkg/Core/Dxe/Hand/DriverSupport.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
index 0b824c62b7..64d7474f15 100644
--- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
+++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
@@ -497,7 +497,12 @@ CoreConnectSingleController (
//
// Add the Driver Family Override Protocol drivers for ControllerHandle
//
- while (TRUE) {
+ Status = CoreLocateProtocol (
+ &gEfiDriverFamilyOverrideProtocolGuid,
+ NULL,
+ (VOID **)&DriverFamilyOverride
+ );
+ while (!EFI_ERROR (Status) && (DriverFamilyOverride != NULL)) {
HighestIndex = DriverBindingHandleCount;
HighestVersion = 0;
for (Index = 0; Index < DriverBindingHandleCount; Index++) {