From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web09.4862.1576148124121947001 for ; Thu, 12 Dec 2019 02:55:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=Zs/9TstF; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.46, mailfrom: pete@akeo.ie) Received: by mail-wr1-f46.google.com with SMTP id q6so2189471wro.9 for ; Thu, 12 Dec 2019 02:55:23 -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=Zs/9TstFSsruTf5Rc3DaaKgGmtokP2n7yl6KIg+nVPbhIbPjKbI68f8YNF9lZp7cHM EK+Hyz+0QM7A3KN+I6gzCm3fckBwIHMR9djKola8BgCG4IkqgVqzQp3mtU4dGnDRPbx4 Oqtz4sC+SWrKwfQrp2o89N/JgV6tKDvJjeNa6c1Q68rkHMecMXDmLLCMjlZGn5JT0Nlj frejbKAksHMlePGO6amygNoJV2C2Jj10z1df5gWLTrQbIOaWyFBuqJLhj0HJcKWifbk7 wkF+WzQqQpAP6renLzwixT9rpjixHpXhaueIZ6O57H4sUEzIgCQApVrgg6MrlYbTyjf8 r4Qg== 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=eHpQhP3GlRsabvZGT4bKsD2ch6pIwnCppaewcqndCGdZDfAGIKZisr3IfN19Fi0z8u j9UMdwZeXi0XMGXKySK48g+JVchVes7KgOtxGkSIg1cI8HMmXib01ND2C74ia+gaRnbA 24dQoKol8s0ubLTK5jNbRQmGf9FDrtLheTpmIMuIGUWZf1oJQUsDYo+HaVqZoY4WRI3A POSwCdRsRUscJszdNcljTM3psYaopSfmS5xeTK5RMofKPN3VfsB6eOsOwk2w+oxzxZfD ewcE3240xJcYBTLuApoC/oWyBXJd2bllf/wHG75juuhPi0kfZv+N8EsXxYbfamWXYIBK TeSQ== X-Gm-Message-State: APjAAAX/BcjtzOZWkGRYgs1aU06BmTSzl09zYSk1ak6DwPcRkTWY1qHm xQxZYQMpDE7wwIMPCsKpcMAG1R3O3h3YQg== X-Google-Smtp-Source: APXvYqyPInRpQpydt9zXopPzVs16GgW788zNEInA+lYtoaidnO6DSuxmW58ogg0MUwm0R5GOLV3LRA== X-Received: by 2002:adf:81c2:: with SMTP id 60mr5471473wra.8.1576148122329; Thu, 12 Dec 2019 02:55:22 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.45.230]) by smtp.gmail.com with ESMTPSA id o66sm1710595wmo.20.2019.12.12.02.55.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 02:55:21 -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 4/4] Platform/RPi4: Build the PCIe and xHCI drivers into the firmware Date: Thu, 12 Dec 2019 10:55:02 +0000 Message-Id: <20191212105502.8492-5-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191212105502.8492-1-pete@akeo.ie> References: <20191212105502.8492-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