]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBusDxe: Install PciEnumerationComplete after PciIo
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 22 Jan 2018 06:23:00 +0000 (14:23 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 24 Jan 2018 03:40:34 +0000 (11:40 +0800)
Per PI spec, the PciEnumerationComplete protocol installation
should be after PciIo installation.
Today's implementation installs the PciEnumerationComplete
after hardware enumeration is completed, but before PciIo
installation.
The change corrects the spec/implementation gap.
The change also benefits certain implementation that depends on
the PciIo handle in PciEnumerationComplete callback.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c

index 3bb5099bd3fff4e390d5f4a1478c50dda8195c3e..c48e3bba968d0e00012d043533cd88e25c10dea4 100644 (file)
@@ -360,8 +360,19 @@ PciBusDriverBindingStart (
   //\r
   StartPciDevices (Controller);\r
 \r
-  gFullEnumeration = FALSE;\r
-  return EFI_SUCCESS;\r
+  if (gFullEnumeration) {\r
+    gFullEnumeration = FALSE;\r
+\r
+    Status = gBS->InstallProtocolInterface (\r
+                    &PciRootBridgeIo->ParentHandle,\r
+                    &gEfiPciEnumerationCompleteProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    NULL\r
+                    );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  return Status;\r
 }\r
 \r
 /**\r
index f6aa327493fb32986bb6574022ce598fb307013a..d5d3c07393e27a65f8b251a107bec0ee862efed1 100644 (file)
@@ -104,16 +104,6 @@ PciEnumerator (
     return Status;\r
   }\r
 \r
-  Status = gBS->InstallProtocolInterface (\r
-                  &HostBridgeHandle,\r
-                  &gEfiPciEnumerationCompleteProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  NULL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r