From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web11.13763.1576256847100312482 for ; Fri, 13 Dec 2019 09:07:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=QdrF4OTL; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.128.52, mailfrom: pete@akeo.ie) Received: by mail-wm1-f52.google.com with SMTP id d5so324783wmb.4 for ; Fri, 13 Dec 2019 09:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xadgJV1ZTT6T+JVURTtIvuX5F659o7MsJtu6zTQoBYM=; b=QdrF4OTLsm00ATstwD8FwaJWm57y9vFYt8geIfxIAFqHH9a4bWbh7gvP/EIDXLPs/q 3Gy5eTVVbJi7f1bf+HaM8NyL7AGUHBpKfkFhvOCBQZqfnDLlR0S8aFUBke8zHBX1GuKr 3u0aYKUwYfsBVLvoIVJnZJPfMMaq4IddQHxaOdaH2aXLo7aRlAVbUva2W0Ynqe6jB6CN c+uvUaIXKMjEv5o8cA+1co5gkk5vnlJTrMRAm8x7YGvGPXFLin8jCcgtdFiG+ET1Ax4g DJRZmRmU0r1U8oCC44xk0+0q4qcW+Re9YQhEflLIl9P1yPd85/8Y4yZx69VGoSEM4qU8 LmRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xadgJV1ZTT6T+JVURTtIvuX5F659o7MsJtu6zTQoBYM=; b=k6GCU/O3da2DF4Pj7F/7OTcSkyrAw5C0m7ZbPhvl9CKLkR1vfr808UEA2TJp8HEKD2 DsNWfvp+SGqPq1lxXibEn7IFe3jgMAHqEKjnNvroMZ3Kiq1OBY1kMO35+1srFO7Nvjon W48NEIZUXJl9GzH9OBz9FLsWk7a7OPLVrLkarxYml7/PiquROYtCOrKtM4kDXbvgDlBn NqRJqlANbNvhE5vGBh6CAFfFffcqxv2aKiGMJmj1dJhDIqhIJ+M0IZ6K7EXlFpDdXOAF Qm9Tt/6UmiqxtKVeSOfOwRcLzEJzvyuMkVTyNiW+Zb5dhBQxYnGFUemRm3z6DSppJRZV uzFg== X-Gm-Message-State: APjAAAVqrvJNCfDd94DoOxFeBErTEZTrxcxST6R1+BprMaZlv75Iz/HR HytJsy9DW3/zc0J8UZ/mnEoug2OQfqDb8A== X-Google-Smtp-Source: APXvYqwfhHN5/UOUDV5SUl7ObbNcDkwDNVXartRnpxYM0PhINtG6QVvkNQmoKZnXxTVe3nTqIQiWKw== X-Received: by 2002:a05:600c:1:: with SMTP id g1mr13982603wmc.131.1576256845198; Fri, 13 Dec 2019 09:07:25 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id o66sm7204203wmo.20.2019.12.13.09.07.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Dec 2019 09:07:24 -0800 (PST) From: "Pete Batard" 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 Message-Id: <20191213170704.8120-5-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191213170704.8120-1-pete@akeo.ie> References: <20191213170704.8120-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jeremy Linton 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 --- 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 { + + 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