public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Scott Telford <stelford@cadence.com>
To: <edk2-devel@ml01.01.org>, <feng.tian@intel.com>, <star.zeng@intel.com>
Subject: [PATCH] Copy bus scanning workaround from ARM Juno PCIe driver.
Date: Tue, 23 May 2017 17:15:47 +0100	[thread overview]
Message-ID: <1495556147-6883-1-git-send-email-stelford@cadence.com> (raw)

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 <stelford@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



             reply	other threads:[~2017-05-23 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 16:15 Scott Telford [this message]
2017-05-23 16:42 ` [PATCH] Copy bus scanning workaround from ARM Juno PCIe driver Ard Biesheuvel
2017-05-24  8:34   ` Scott Telford
2017-05-24 14:03     ` Ard Biesheuvel
2017-05-26 14:50       ` Leif Lindholm
2017-05-26 17:37         ` Ard Biesheuvel
2017-05-29 16:14           ` Scott Telford
2017-05-30 10:13             ` Ard Biesheuvel
2017-05-31 10:51               ` Scott Telford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495556147-6883-1-git-send-email-stelford@cadence.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox