Copy workaround previously in
ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciRootBridge.c:PciRbPciRead()
to RootBridgeIoPciAccess(), to avoid spurious multiple detections when
scanning buses.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Telford <stelf...@cadence.com>
---
 MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
index a0e7e5b..3cca3c1 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
@@ -945,6 +945,19 @@ RootBridgeIoPciAccess (
     PciAddress.ExtendedRegister = PciAddress.Register;
   }
 
+  // The UEFI PCI enumerator scans for devices at all possible addresses,
+  // and ignores some PCI rules - this results in some hardware being
+  // detected multiple times. We work around this by faking absent
+  // devices
+  if ((PciAddress.Bus == 0) && ((PciAddress.Device != 0) || 
(PciAddress.Function != 0))) {
+    *((UINT32 *)Buffer) = 0xffffffff;
+    return EFI_SUCCESS;
+  }
+  if ((PciAddress.Bus == 1) && ((PciAddress.Device != 0) || 
(PciAddress.Function != 0))) {
+    *((UINT32 *)Buffer) = 0xffffffff;
+    return EFI_SUCCESS;
+  }
+
   Address = PCI_SEGMENT_LIB_ADDRESS (
               RootBridge->RootBridgeIo.SegmentNumber,
               PciAddress.Bus,
-- 
2.2.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to