public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
	philmd@redhat.com, lintonrjeremy@gmail.com
Subject: [edk2-platforms][PATCH v2 4/4] Platform/RPi4: Build the PCIe and xHCI drivers into the firmware
Date: Fri, 13 Dec 2019 17:07:04 +0000	[thread overview]
Message-ID: <20191213170704.8120-5-pete@akeo.ie> (raw)
In-Reply-To: <20191213170704.8120-1-pete@akeo.ie>

From: Jeremy Linton <lintonrjeremy@gmail.com>

This uses the recently introduced NonCoherentIoMmuDxe for PCIe access
and should enable USB device usage in the UEFI environment.

As mentioned in https://lkml.org/lkml/2019/9/9/170, imposing a 3 GB
DMA limit might be necessary for the 4 GB models so we follow suit by
setting PcdDmaDeviceLimit to 3 GB - 1 in NonCoherentIoMmuDxe.

Note that this patch does not provide xHCI ACPI support because the
required Xhci.asl table will be provided in a later commit.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/RPi4/RPi4.dsc  | 29 +++++++++++++++++++-
 Platform/RaspberryPi/RPi4/RPi4.fdf  | 10 ++++++-
 Platform/RaspberryPi/RPi4/Readme.md | 23 +++++-----------
 3 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc
index 03139e57a8db..00b75741702a 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -161,6 +161,14 @@ [LibraryClasses.common]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   GpioLib|Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.inf
 
+  #
+  # PCI dependencies
+  #
+  # PCI root port configuation and description
+  PciHostBridgeLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciHostBridgeLib/Bcm2711PciHostBridgeLib.inf
+  # The "segment lib" provides the CAM accessors/etc when they aren't ECAM standard
+  PciSegmentLib|Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.inf
+
 [LibraryClasses.common.SEC]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
@@ -318,6 +326,7 @@ [PcdsFixedAtBuild.common]
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
 
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0xc0000000
+  gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xffffffff
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-DEV"
 
@@ -378,6 +387,12 @@ [PcdsFixedAtBuild.common]
   gBcm27xxTokenSpaceGuid.PcdBcm27xxRegistersAddress|0xfc000000
   gBcm283xTokenSpaceGuid.PcdBcm283xRegistersAddress|0xfe000000
 
+  # PCIe specific addresses
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciRegBase|0xfd500000
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioAdr|0xf8000000
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciBusMmioLen|0x3ffffff
+  gBcm27xxTokenSpaceGuid.PcdBcm27xxPciCpuMmioAdr|0x600000000
+
   ## NS16550 compatible UART
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xfe215040
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
@@ -525,7 +540,6 @@ [Components.common]
 
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
-  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
   Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
@@ -587,6 +601,7 @@ [Components.common]
   #
   # USB Support
   #
+  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
   Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
@@ -610,6 +625,18 @@ [Components.common]
   #
   Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf
 
+  #
+  # PCI Support
+  #
+  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf {
+    <PcdsFixedAtBuild>
+      gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x00000000
+      gEmbeddedTokenSpaceGuid.PcdDmaDeviceLimit|0xbfffffff
+  }
+
   #
   # UEFI application (Shell Embedded Boot Loader)
   #
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4/RPi4.fdf
index f0ab47c6c0a9..7a506bd2813b 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -205,7 +205,6 @@ [FV.FvMain]
   INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
   INF Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.inf
 
-  INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
   INF Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.inf
   INF Platform/RaspberryPi/Drivers/FdtDxe/FdtDxe.inf
@@ -269,6 +268,14 @@ [FV.FvMain]
   #
   INF Silicon/Broadcom/Bcm283x/Drivers/Bcm2838RngDxe/Bcm2838RngDxe.inf
 
+  #
+  # PCI Support
+  #
+  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  INF EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf
+
   #
   # SCSI Bus and Disk Driver
   #
@@ -278,6 +285,7 @@ [FV.FvMain]
   #
   # USB Support
   #
+  INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
   INF Platform/RaspberryPi/Drivers/DwUsbHostDxe/DwUsbHostDxe.inf
   INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
   INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi4/Readme.md
index 917f8436a382..2e37646e043d 100644
--- a/Platform/RaspberryPi/RPi4/Readme.md
+++ b/Platform/RaspberryPi/RPi4/Readme.md
@@ -7,28 +7,19 @@ This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 4 platfor
 
 This is intended to be useful 64-bit [TF-A](https://www.trustedfirmware.org/) +
 UEFI implementation for the Raspberry Pi 4 which should be good enough for most
-kind of UEFI development, as well as for running consummer Operating Systems
-such as Linux or Windows.
+kind of UEFI development, as well as for running consummer Operating Systems.
 
 Raspberry Pi is a trademark of the [Raspberry Pi Foundation](https://www.raspberrypi.org).
 
 # Status
 
-This firmware is still in early stage of development, meaning that it comes with
-the following __major__ limitations:
+This firmware is still in development stage, meaning that it comes with the
+following __major__ limitations:
 
-- USB is not supported yet (will be added soon)
-- Booting of vanilla Operating Systems (Windows, Linux) is not supported yet,
-  let alone expected to work at all.
-
-The only features that are expected to work with this first iteration of the
-firmware are HDMI and serial I/O.
-
-## Known issues
-
-- The serial output from TF-A is garbled when using a `start4.elf` that was
-  released after 2019.11.18. This is a TF-A issue that will be fixed in a
-  later version.
+- USB is likely to work only in pre-OS phase at this stage (nonstandard ECAM,
+  missing ACPI tables).
+- Serial I/O from the OS may not work at all due to CPU throttling affecting
+  the miniUART baudrate.
 
 # Building
 
-- 
2.21.0.windows.1


  parent reply	other threads:[~2019-12-13 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 17:07 [edk2-platforms][PATCH v2 0/4] Platform/RPi4: Add PCIe and xHCI support Pete Batard
2019-12-13 17:07 ` [edk2-platforms][PATCH v2 1/4] Silicon/Bcm27xx: Add PCIe constants to Bcm2711.h Pete Batard
2019-12-13 17:07 ` [edk2-platforms][PATCH v2 2/4] Silicon/Bcm27xx: Add segment library to handle nonstandard ECAM Pete Batard
2019-12-13 17:07 ` [edk2-platforms][PATCH v2 3/4] Silicon/Bcm27xx: Add PCIe host bridge config library Pete Batard
2019-12-13 17:07 ` Pete Batard [this message]
2019-12-13 17:14   ` [edk2-platforms][PATCH v2 4/4] Platform/RPi4: Build the PCIe and xHCI drivers into the firmware Philippe Mathieu-Daudé
2019-12-13 17:40 ` [edk2-platforms][PATCH v2 0/4] Platform/RPi4: Add PCIe and xHCI support Ard Biesheuvel
2019-12-13 17:51   ` Pete Batard

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=20191213170704.8120-5-pete@akeo.ie \
    --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