From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: ardb+tianocore@kernel.org, quic_llindhol@quicinc.com,
Jeremy Linton <jeremy.linton@arm.com>
Subject: [edk2-devel] [PATCH v2 5/5] Platform/RaspberryPi: Update PCIe MMIO window for DT
Date: Wed, 17 Jan 2024 15:36:14 -0600 [thread overview]
Message-ID: <20240117213614.4188518-6-jeremy.linton@arm.com> (raw)
In-Reply-To: <20240117213614.4188518-1-jeremy.linton@arm.com>
Since we are updating the DT memory map and telling it how
we have configured the PCIe, there isn't a reason for moving the
MMIO window. In fact this appears to fix OpenBSD+DT as well as
it makes the linux XHCI reset sequence happier.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c | 22 +++++++++++++++++++
.../RaspberryPi/Drivers/FdtDxe/FdtDxe.inf | 6 +++++
2 files changed, 28 insertions(+)
diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c
index dd4fc0a05e..a247aa36ed 100644
--- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c
+++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.c
@@ -375,6 +375,28 @@ SyncPcie (
return EFI_NOT_FOUND;
}
+ // move the MMIO window too
+ DmaRanges[0] = cpu_to_fdt32 (0x02000000); //non prefech 32-bit
+ DmaRanges[1] = cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciBusMmioAdr) >> 32); //bus addr @ 0x0f8000000
+ DmaRanges[2] = cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciBusMmioAdr) & MAX_UINT32);
+ DmaRanges[3] = cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciCpuMmioAdr) >> 32); //cpu addr @ 0x600000000
+ DmaRanges[4] = cpu_to_fdt32 (FixedPcdGet64 (PcdBcm27xxPciCpuMmioAdr) & MAX_UINT32);
+ DmaRanges[5] = cpu_to_fdt32 (0x00000000);
+ DmaRanges[6] = cpu_to_fdt32 (FixedPcdGet32 (PcdBcm27xxPciBusMmioLen) + 1); // len = 0x4000 0000
+
+ DEBUG ((DEBUG_INFO, "%a: Updating PCIe ranges\n", __func__));
+
+ /*
+ * Match ranges (BAR/MMIO) with the EDK2+ACPI setup we are using.
+ */
+ Retval = fdt_setprop (mFdtImage, Node, "ranges",
+ DmaRanges, sizeof DmaRanges);
+ if (Retval != 0) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to locate PCIe MMIO 'ranges' property (%d)\n",
+ __func__, Retval));
+ return EFI_NOT_FOUND;
+ }
+
if (PcdGet32 (PcdXhciReload) != 1) {
return EFI_SUCCESS;
}
diff --git a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
index d9fb6ee480..90e138af7c 100644
--- a/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
+++ b/Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
@@ -23,6 +23,7 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
Platform/RaspberryPi/RaspberryPi.dec
+ Silicon/Broadcom/Bcm27xx/Bcm27xx.dec
[LibraryClasses]
BaseLib
@@ -44,6 +45,11 @@
[FixedPcd]
gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress
+ gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase
+ gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr
+ gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen
+ gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr
+
[Pcd]
gRaspberryPiTokenSpaceGuid.PcdSystemTableMode
--
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113965): https://edk2.groups.io/g/devel/message/113965
Mute This Topic: https://groups.io/mt/103796311/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-17 21:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 21:36 [edk2-devel] [PATCH v2 0/5] Platform/RaspberryPi: Various minor fixes Jeremy Linton
2024-01-17 21:36 ` [edk2-devel] [PATCH v2 1/5] Platform/RaspberryPi/DualSerialPortLib: Always configure the pl011 Jeremy Linton
2024-03-11 14:13 ` Ard Biesheuvel
2024-03-13 2:06 ` Jeremy Linton
2024-01-17 21:36 ` [edk2-devel] [PATCH v2 2/5] Silicon/Broadcom/BcmGenetDxe: Suppress some bogus compiler warnings Jeremy Linton
2024-01-17 21:36 ` [edk2-devel] [PATCH v2 3/5] Platform/RaspberryPi: Cleanup menu visibility Jeremy Linton
2024-01-17 21:36 ` [edk2-devel] [PATCH v2 4/5] Platform/RaspberryPi: Give the user control over the XHCI mailbox Jeremy Linton
2024-01-17 21:36 ` Jeremy Linton [this message]
2024-03-11 14:25 ` [edk2-devel] [PATCH v2 0/5] Platform/RaspberryPi: Various minor fixes Ard Biesheuvel
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=20240117213614.4188518-6-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