From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: pete@akeo.ie, ardb+tianocore@kernel.org, awarkentin@vmware.com,
Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com,
"Jeremy Linton" <jeremy.linton@arm.com>,
"René Treffer" <treffer+groups.io@measite.de>
Subject: [PATCH v2 4/6] Silicon/Broadcom/Bcm27xx: Relax PCIe device restriction
Date: Mon, 9 Aug 2021 22:36:16 -0500 [thread overview]
Message-ID: <20210810033618.5139-5-jeremy.linton@arm.com> (raw)
In-Reply-To: <20210810033618.5139-1-jeremy.linton@arm.com>
The CM4 has an actual PCIe slot, so the device filtering
need to be a little less restrictive WRT busses with more
than 1 device given that switches can now appear in the
topology. Since it is possible to start numbering the
busses with a non-zero value, the bus restriction should
be based on the secondary side of the root port. This
isn't likely but its better than hard-coding the limit.
Suggested-by: René Treffer <treffer+groups.io@measite.de>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
.../Library/Bcm2711PciSegmentLib/PciSegmentLib.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
index 44ce3b4b99..6d15e82fa2 100644
--- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
+++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c
@@ -19,6 +19,7 @@
#include <Library/PciSegmentLib.h>
#include <Library/UefiLib.h>
#include <IndustryStandard/Bcm2711.h>
+#include <IndustryStandard/Pci30.h>
typedef enum {
PciCfgWidthUint8 = 0,
@@ -78,6 +79,9 @@ PciSegmentLibGetConfigBase (
UINT64 Base;
UINT64 Offset;
UINT32 Dev;
+ UINT32 Bus;
+ UINT32 Data;
+ UINT32 HostPortSec;
Base = PCIE_REG_BASE;
Offset = Address & 0xFFF; /* Pick off the 4k register offset */
@@ -89,17 +93,20 @@ PciSegmentLibGetConfigBase (
Base += PCIE_EXT_CFG_DATA;
if (mPciSegmentLastAccess != Address) {
Dev = EFI_PCI_ADDR_DEV (Address);
+ Bus = EFI_PCI_ADDR_BUS (Address);
+ HostPortSec = MmioRead8 (PCIE_REG_BASE +
+ PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET);
+
/*
- * Scan things out directly rather than translating the "bus" to a device, etc..
- * only we need to limit each bus to a single device.
+ * There can only be a single device on bus 1 (downstream of root).
+ * Subsequent busses (behind a PCIe switch) can have more.
*/
- if (Dev < 1) {
- MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address);
- mPciSegmentLastAccess = Address;
- } else {
- mPciSegmentLastAccess = 0;
+ if (Dev > 0 && (Bus <= HostPortSec)) {
return 0xFFFFFFFF;
}
+
+ MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address);
+ mPciSegmentLastAccess = Address;
}
}
return Base + Offset;
--
2.13.7
next prev parent reply other threads:[~2021-08-10 3:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 3:36 [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Jeremy Linton
2021-08-10 3:36 ` [PATCH v2 1/6] Platform/RaspberryPi: Add XHCI/PCI selection menu Jeremy Linton
2021-08-10 3:36 ` [PATCH v2 2/6] Platform/RaspberryPi: Break XHCI into its own SSDT Jeremy Linton
2021-08-10 3:36 ` [PATCH v2 3/6] Platform/RaspberryPi: Add PCIe SSDT Jeremy Linton
2021-08-10 3:36 ` Jeremy Linton [this message]
2021-08-10 3:36 ` [PATCH v2 5/6] Silicon/Broadcom/Bcm27xx: Move linkup check into the cfg accessor Jeremy Linton
2021-08-10 3:36 ` [PATCH v2 6/6] Platform/RaspberryPi: Enable NVMe boot on CM4 Jeremy Linton
2021-08-17 15:09 ` [PATCH v2 0/6] RPi4: Enable ACPI PCIe conduit Ard Biesheuvel
2021-08-19 23:35 ` Jeremy Linton
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=20210810033618.5139-5-jeremy.linton@arm.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