[edk2-devel] [edk2-platforms][PATCH v2 4/4] Platform/RPi4: Build the PCIe and xHCI drivers into the firmware

Philippe Mathieu-Daudé philmd at redhat.com
Fri Dec 13 17:14:38 UTC 2019


On 12/13/19 6:07 PM, Pete Batard wrote:
> From: Jeremy Linton <lintonrjeremy at 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 at 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
>   
> 

Acked-by: Philippe Mathieu-Daude <philmd at redhat.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52208): https://edk2.groups.io/g/devel/message/52208
Mute This Topic: https://groups.io/mt/68533762/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list