From nobody Wed May 8 15:37:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58461+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58461+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588274359; cv=none; d=zohomail.com; s=zohoarc; b=QGVk0ZU2GvpofjP3+jFCcaMaylXw2PC/ACPcNVL2xDFnPXVwol4BOtMuno4ycjyN5oQ3NUIcqVkvFSg+Ji2HFBWO+wPkdbTm6ne2sEX0x/h7xq9LYefAwsbcnKnU9PqHkfmXQZhZqcraVIOmaha6I+XyWlJilvCVrmSszt6uxuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588274359; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=kN8ChtxTtLVny/f7ZEUWtiI3TtJmZ80SFo8WyGjgF+M=; b=ZOQ2xTeEiYDsoXGobUOeiXjuyibOuDRcbarGm86wnZcqCe/k75ketwTyO2BN/54Q3jGuM38YGb6qXjOHiAkbZkTCO//g4ILYV4GAGl+N+jmht6dBSn0y1AowRdhQtJ7GOghvJmDnRKfZ8L1xu0s6FuC2l0ywVJdPSeVXoYL1sKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58461+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588274359702331.2279140177877; Thu, 30 Apr 2020 12:19:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id opInYY1788612xoNt0Vq040V; Thu, 30 Apr 2020 12:19:19 -0700 X-Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) by mx.groups.io with SMTP id smtpd.web12.1537.1588274358730823733 for ; Thu, 30 Apr 2020 12:19:18 -0700 X-Received: by mail-qv1-f67.google.com with SMTP id fb4so3617952qvb.7 for ; Thu, 30 Apr 2020 12:19:18 -0700 (PDT) X-Gm-Message-State: 6exIbkZz175FHkwEJhksq2eZx1787277AA= X-Google-Smtp-Source: APiQypJGayQ0tPLRPn/vZvzyF6VdzQukHOPElEZCABnbZ/bkbEfwsoBLbISS1geysAN2RoAAxM1Zkg== X-Received: by 2002:a05:6214:593:: with SMTP id bx19mr457736qvb.238.1588274357371; Thu, 30 Apr 2020 12:19:17 -0700 (PDT) X-Received: from localhost.localdomain (c-98-214-99-181.hsd1.il.comcast.net. [98.214.99.181]) by smtp.gmail.com with ESMTPSA id d188sm778733qkg.59.2020.04.30.12.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:19:17 -0700 (PDT) From: "Andrei Warkentin" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] RPi3/RPi4: fix RPi 3 VPU-passed FDT handling by unifying with RPi4 implementation Date: Thu, 30 Apr 2020 12:19:00 -0700 Message-Id: <20200430191901.89372-2-andrey.warkentin@gmail.com> In-Reply-To: <20200430191901.89372-1-andrey.warkentin@gmail.com> References: <20200430191901.89372-1-andrey.warkentin@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: <27952.devel.edk2.groups.io> Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,andrey.warkentin@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588274359; bh=m0z6qyYj1InOirsmFAfYB0DyhfsiCDFvEXKv98feO7w=; h=Cc:Date:From:Reply-To:Subject:To; b=tQUiNzWGq3IDihJGQBa0xHRPoBOcI3EZ9SxnixO9k4bJfvVnrMCFNlIuIkv2oZGx9Jz MWY+vwLGUeEAieqnt5lg2WXC3WG5PEzJ4BvsgC1acUmQmvcC81dooooej+JP+IcmPWTg5 nNRfP3PMNn9PGFjB0RRSMfBq4VIZ+rcZuzA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A rev-up of start.elf VPU firmware meant that the previous scheme of loading the DTB over top of RPI_EFI.FD no longer works - the DT is now loaded way before the armstub, so any overlap means the DT is overridden. This change re-arranges a few items in the FD, allowing the DTB to loaded directly after the FD in physical memory. Unlike the Pi 4 implementation, we can't move the UEFI image down in memory, as that needs a TF-A changem so it just reduces the size by 0x10000. The same base address (0x1f0000) is used as on the Pi 4. The Pi 3 FDF can be further unified with Pi 4 after work on TF-A to move to a single BL32-based Pi 3 TF-A implementation. Tested: Pi 3A+, Pi 2B v1.2, Pi 4B (4GB). Signed-off-by: Andrei Warkentin Reviewed-by: Pete Batard --- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 44 ++++++++++-= --------- Platform/RaspberryPi/RPi3/RPi3.dsc | 9 +++- Platform/RaspberryPi/RPi3/RPi3.fdf | 36 ++++++++---= ----- Platform/RaspberryPi/RPi4/RPi4.dsc | 7 ++-- Platform/RaspberryPi/RPi4/RPi4.fdf | 8 ++++ Platform/RaspberryPi/RaspberryPi.dec | 6 ++- 6 files changed, 63 insertions(+), 47 deletions(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index dec8e09d..aae189ec 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -94,29 +94,27 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryInfo[Index].Type =3D RPI_MEM_RUNTIME_REGION; VirtualMemoryInfo[Index++].Name =3D L"FD Variables"; =20 - if (BCM2711_SOC_REGISTERS !=3D 0) { - // - // Only the Pi 4 firmware today expects the DTB to directly follow the - // FD instead of overlapping the FD. - // - VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet32 (PcdFdtBa= seAddress); - VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Inde= x].PhysicalBase; - VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdFdtSi= ze);; - VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRI= BUTE_WRITE_BACK; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; - VirtualMemoryInfo[Index++].Name =3D L"Flattened Device Tree= "; - } else { - // - // TF-A reserved RAM only exists for the Pi 3 TF-A. - // - // This is 2MB that directly follows the FD. - // - VirtualMemoryTable[Index].PhysicalBase =3D (FixedPcdGet64(PcdFdBas= eAddress) + FixedPcdGet32(PcdFdSize)); - VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Inde= x].PhysicalBase; - VirtualMemoryTable[Index].Length =3D FixedPcdGet64 (PcdSyste= mMemoryBase) - VirtualMemoryTable[Index].PhysicalBase; - VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRI= BUTE_WRITE_BACK; - VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; - VirtualMemoryInfo[Index++].Name =3D L"TF-A RAM"; + // + // Both the the Pi 4 and Pi 3 implementations expect the DTB to directly= follow the FD. + // + VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet32 (PcdFdtBaseA= ddress); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D FixedPcdGet32 (PcdFdtSize)= ;; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Flattened Device Tree"; + if (BCM2711_SOC_REGISTERS =3D=3D 0) { + // + // TF-A reserved RAM only exists for the Pi 3 TF-A. + // + // This is 2MB that directly follows the FD. + // + VirtualMemoryTable[Index].PhysicalBase =3D (FixedPcdGet64(PcdFdBase= Address) + FixedPcdGet32(PcdFdSize)); + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index= ].PhysicalBase; + VirtualMemoryTable[Index].Length =3D FixedPcdGet64 (PcdSystem= MemoryBase) - VirtualMemoryTable[Index].PhysicalBase; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_RESERVED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"TF-A RAM"; } =20 // Base System RAM diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3= /RPi3.dsc index d4a3d49d..563fb891 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.dsc +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc @@ -387,8 +387,13 @@ # Size of the region used by UEFI in permanent memory (Reserved 64MB) gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000 # - # This matches PcdFvBaseAddress, since everything less is ATF, and - # will be reserved away. + # 0x00000000 - 0x001F0000 FD (PcdFdBaseAddress, PcdFdSize) + # 0x001F0000 - 0x00200000 DTB (PcdFdtBaseAddress, PcdFdtSize) + # 0x00200000 - 0x00400000 TFA (BL2 / BL31 / BL32 "secure SRAM") + # 0x00400000 - ... RAM (PcdSystemMemoryBase, PcdSystemMemorySize) + # + # This matches PcdFvBaseAddress, since everything less is FD + TF-A RAM, + # thus will be reserved away. # gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000 gArmTokenSpaceGuid.PcdSystemMemorySize|0x3FC00000 diff --git a/Platform/RaspberryPi/RPi3/RPi3.fdf b/Platform/RaspberryPi/RPi3= /RPi3.fdf index d334d3be..daedc443 100644 --- a/Platform/RaspberryPi/RPi3/RPi3.fdf +++ b/Platform/RaspberryPi/RPi3/RPi3.fdf @@ -25,11 +25,11 @@ =20 [FD.RPI_EFI] BaseAddress =3D 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress -Size =3D 0x00200000|gArmTokenSpaceGuid.PcdFdSize +Size =3D 0x001f0000|gArmTokenSpaceGuid.PcdFdSize ErasePolarity =3D 1 =20 BlockSize =3D 0x00001000|gRaspberryPiTokenSpaceGuid.PcdFirmwareBlockSi= ze -NumBlocks =3D 0x200 +NumBlocks =3D 0x1f0 =20 ##########################################################################= ###### # @@ -53,12 +53,6 @@ NumBlocks =3D 0x200 0x00000000|0x00010000 FILE =3D $(TFA_BUILD_BL1) =20 -# -# DTB. -# -0x00010000|0x00010000 -DATA =3D { 0x00 } - # # ATF secondary boot image in FIP format (BL2 + BL31) # @@ -68,21 +62,21 @@ FILE =3D $(TFA_BUILD_FIP) # # UEFI image # -0x00030000|0x001b0000 +0x00030000|0x001a0000 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize FV =3D FVMAIN_COMPACT =20 # # Variables (0x20000 overall). # -# 0x001e0000 - 0x001edfff EFI_FIRMWARE_VOLUME_HEADER -# 0x001ee000 - 0x001eefff Event log -# 0x001ef000 - 0x001effff EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER- -# 0x001f0000 - 0x001fffff Data +# 0x001d0000 - 0x001ddfff EFI_FIRMWARE_VOLUME_HEADER +# 0x001de000 - 0x001defff Event log +# 0x001df000 - 0x001dffff EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER- +# 0x001e0000 - 0x001effff Data # =20 # NV_VARIABLE_STORE -0x001e0000|0x0000e000 +0x001d0000|0x0000e000 gRaspberryPiTokenSpaceGuid.PcdNvStorageVariableBase|gEfiMdeModulePkgTokenS= paceGuid.PcdFlashNvStorageVariableSize =20 DATA =3D { @@ -125,11 +119,11 @@ DATA =3D { } =20 # NV_EVENT_LOG -0x001ee000|0x00001000 +0x001de000|0x00001000 gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogBase|gRaspberryPiTokenSpace= Guid.PcdNvStorageEventLogSize =20 # NV_FTW_WORKING header -0x001ef000|0x00001000 +0x001df000|0x00001000 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwWorkingBase|gEfiMdeModulePkgToke= nSpaceGuid.PcdFlashNvStorageFtwWorkingSize =20 DATA =3D { @@ -144,9 +138,17 @@ DATA =3D { } =20 # NV_FTW_WORKING data -0x001f0000|0x00010000 +0x001e0000|0x00010000 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|gEfiMdeModulePkgTokenS= paceGuid.PcdFlashNvStorageFtwSpareSize =20 +# +# This is just for documentation purposes! The DTB reserved space is not p= art of the FD, +# but this is exactly where it is expected to be. +# +# 0x001f0000|0x10000 +# gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|gRaspberryPiTokenSpaceGuid.= PcdFdtSize +# + ##########################################################################= ###### # # FV Section diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4= /RPi4.dsc index c401533a..4deccd9d 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.dsc +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc @@ -275,10 +275,6 @@ gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 - # - # Follows right after the FD image. - # - gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x001f0000 =20 # DEBUG_ASSERT_ENABLED 0x01 # DEBUG_PRINT_ENABLED 0x02 @@ -398,6 +394,9 @@ # 0x001F0000 - 0x00200000 DTB (PcdFdtBaseAddress, PcdFdtSize) # 0x00200000 - ... RAM (PcdSystemMemoryBase, PcdSystemMemorySize) # + # This matches PcdFvBaseAddress, since everything less is the FD, and + # will be reserved away. + # gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000 gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000 =20 diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf b/Platform/RaspberryPi/RPi4= /RPi4.fdf index b2164363..c3e9cfc4 100644 --- a/Platform/RaspberryPi/RPi4/RPi4.fdf +++ b/Platform/RaspberryPi/RPi4/RPi4.fdf @@ -135,6 +135,14 @@ DATA =3D { 0x001e0000|0x00010000 gRaspberryPiTokenSpaceGuid.PcdNvStorageFtwSpareBase|gEfiMdeModulePkgTokenS= paceGuid.PcdFlashNvStorageFtwSpareSize =20 +# +# This is just for documentation purposes! The DTB reserved space is not p= art of the FD, +# but this is exactly where it is expected to be. +# +# 0x001f0000|0x10000 +# gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|gRaspberryPiTokenSpaceGuid.= PcdFdtSize +# + ##########################################################################= ###### # # FV Section diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/Ra= spberryPi.dec index d59b5481..b66322be 100644 --- a/Platform/RaspberryPi/RaspberryPi.dec +++ b/Platform/RaspberryPi/RaspberryPi.dec @@ -35,7 +35,11 @@ gRaspberryPiDefaultFdtGuid =3D {0xDF5DA223, 0x1D27, 0x47C3, { 0x8D, 0x1B= , 0x9A, 0x41, 0xB5, 0x5A, 0x18, 0xBC}} =20 [PcdsFixedAtBuild.common] - gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x10000|UINT32|0x00000001 + # + # Space reserved for config.txt-specced DTB follows right after the FD i= mage + # in both RPi3 and RP4 implementations. + # + gRaspberryPiTokenSpaceGuid.PcdFdtBaseAddress|0x001f0000|UINT32|0x00000001 gRaspberryPiTokenSpaceGuid.PcdFirmwareBlockSize|0x0|UINT32|0x00000002 gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogBase|0x0|UINT32|0x00000003 gRaspberryPiTokenSpaceGuid.PcdNvStorageEventLogSize|0x0|UINT32|0x00000004 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58461): https://edk2.groups.io/g/devel/message/58461 Mute This Topic: https://groups.io/mt/73382824/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 8 15:37:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58462+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58462+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588274360; cv=none; d=zohomail.com; s=zohoarc; b=ddvTNly1aq/6v75B3zP5eYebE9W+ryvudfQwBSuLQ7pMI/evUHPtjt97GJfk+BfVOU2SulCIgU/qIJYlYtMnDPxbYyXRjqOyJYa8vhOMJlnC7LduXzcWmb7KKQ7sq4zwyu9lmkoWWgAxoap/HlequzD2gqekplDhEVrazsBD9uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588274360; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=QHKeGkiumIO6M0ay+j4j3dhKY5Xpm+3HGod3MwNqmko=; b=VBhlJM7f0lBFXN7P+AQz7H+dTowH/ZAeJyCJxV7NlEt19+ki3QWiq8axDe5ik4S8WK7Ewri3wIRvKRc7sEIz+/QWpN6xZydD2GQ391SPIN8G+KUZ3IOZR2U4Ztk1hUpk7carcZf++MvbOgzTKDeaKbsf5c7DjusRiitDqu8/BM4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58462+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588274360571209.8301905802549; Thu, 30 Apr 2020 12:19:20 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hQFlYY1788612xNTgBBpFoM0; Thu, 30 Apr 2020 12:19:20 -0700 X-Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by mx.groups.io with SMTP id smtpd.web10.1559.1588274359718683728 for ; Thu, 30 Apr 2020 12:19:19 -0700 X-Received: by mail-qk1-f193.google.com with SMTP id i136so2857231qke.10 for ; Thu, 30 Apr 2020 12:19:19 -0700 (PDT) X-Gm-Message-State: 9RWPfwgzpMoUbSwmvqPWD7GVx1787277AA= X-Google-Smtp-Source: APiQypKKsolF4LcZXbfPXThxcRuGz534oUWSDgnXC2DXjTVhjewiw3ulhnAfas5vK8Out2xc0GJdDw== X-Received: by 2002:a05:620a:88f:: with SMTP id b15mr21739qka.118.1588274358406; Thu, 30 Apr 2020 12:19:18 -0700 (PDT) X-Received: from localhost.localdomain (c-98-214-99-181.hsd1.il.comcast.net. [98.214.99.181]) by smtp.gmail.com with ESMTPSA id d188sm778733qkg.59.2020.04.30.12.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:19:18 -0700 (PDT) From: "Andrei Warkentin" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 2/2] RPi: update Pi3 and Pi4 readmes with correct info on FDT handling Date: Thu, 30 Apr 2020 12:19:01 -0700 Message-Id: <20200430191901.89372-3-andrey.warkentin@gmail.com> In-Reply-To: <20200430191901.89372-1-andrey.warkentin@gmail.com> References: <20200430191901.89372-1-andrey.warkentin@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: <27952.devel.edk2.groups.io> Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,andrey.warkentin@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588274360; bh=/hcMmRkyuwJJyexYDSyZgCyWXPvzoWvvGQKDv4gnLQw=; h=Cc:Date:From:Reply-To:Subject:To; b=V/G6GB0dA8RMI64FPV15mC2rbSEcuJ2pyIVPa3OUe86hf35g9CX4gckFAatH1rUFPSV u6R6iSq+dL1daQeg5+WnpKBm5uhLvbcK8rwPTuAlLO52Km/ZQRuBUO1SrbNuY27gihb5N PrFN2wo4eL1b9eLvDrW1xl93K6rmmFO9ynU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that Pi 3 FDT handling is fixed, let's update the docs. Furthermore, let's simplify - be proscriptive about the minimal supported config.txt configuration. Also, fix some factual mistakes: - device_tree=3D override is not mandatory when device_tree_address=3D is u= sed. Not using it means start.elf can chose the right one for the variant. - device_tree=3D override is not mandatory for dtoverlay use. Signed-off-by: Andrei Warkentin Reviewed-by: Pete Batard --- Platform/RaspberryPi/RPi3/Readme.md | 38 +++++++++++++------- Platform/RaspberryPi/RPi4/Readme.md | 24 +++++++------ 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Platform/RaspberryPi/RPi3/Readme.md b/Platform/RaspberryPi/RPi= 3/Readme.md index f5d25b50..f19d59d8 100644 --- a/Platform/RaspberryPi/RPi3/Readme.md +++ b/Platform/RaspberryPi/RPi3/Readme.md @@ -56,23 +56,30 @@ Build instructions from the top level edk2-platforms Re= adme.md apply. 1. Format a uSD card as FAT32 2. Copy the generated `RPI_EFI.fd` firmware onto the partition 3. Download and copy the following files from https://github.com/raspberry= pi/firmware/tree/master/boot + - `bcm2710-rpi-3-b.dtb` (for Pi 3B) + - `bcm2710-rpi-3-b-plus.dtb (for Pi 3B+) + - `bcm2710-rpi-2-b.dtb` (for Pi 2B v1.2) + - `bcm2710-rpi-cm3.dtb` (for Pi CM3) - `bootcode.bin` - `fixup.dat` - `start.elf` + - `overlays/miniuart-bt.dtbo` or `overlays/disable-bt.dtbo` (Optional) 4. Create a `config.txt` with the following content: ``` arm_control=3D0x200 enable_uart=3D1 armstub=3DRPI_EFI.fd - disable_commandline_tags=3D1 + disable_commandline_tags=3D2 + device_tree_address=3D0x1f0000 + device_tree_end=3D0x200000 ``` - Additionally, if you want to use PL011 instead of the miniUART, you can = add the lines: + If you want to use PL011 instead of the miniUART on your Pi 3B/3B+, you = can add the lines: ``` - device_tree_address=3D0x10000 - device_tree_end=3D0x20000 - device_tree=3Dbcm2710-rpi-3-b[-plus].dtb dtoverlay=3Dminiuart-bt ``` + Note: doing so requires `miniuart-bt.dbto` to have been copied into an `= overlays/` + directory on the uSD card. Alternatively, you may use `disable-bt` inste= ad of + `miniuart-bt` if you don't require Bluetooth. 5. Insert the uSD card and power up the Pi. =20 Note that if you have a model 3+ or a model 3 where you enabled USB boot t= hrough OTP @@ -92,21 +99,26 @@ in the `TrustedFirmware/` directory from `edk2-non-osi`. =20 ## Custom Device Tree =20 -The default Device Tree included in the firmware is the one for a Raspberr= y Pi 3 Model B (not B+). -If you want to use a different Device Tree, to boot a Pi 3 Model B+ for in= stance (for which a -DTB is also provided under `DeviceTree/`), you should copy the relevant `.= dtb` into the root of +By default, UEFI will use the device tree loaded by the VideoCore firmware= . This +depends on the model/variant, and relies on the presence on specific files= on your boot media. +E.g.: + - `bcm2710-rpi-3-b.dtb` (for Pi 3B) + - `bcm2710-rpi-3-b-plus.dtb (for Pi 3B+) + - `bcm2710-rpi-2-b.dtb` (for Pi 2B v1.2) + - `bcm2710-rpi-cm3.dtb` (for Pi CM3) + +You can override the DTB and provide a custom one. Copy the relevant `.dtb= ` into the root of the SD or USB, and then edit your `config.txt` so that it looks like: =20 ``` (...) disable_commandline_tags=3D2 -device_tree_address=3D0x10000 -device_tree_end=3D0x20000 -device_tree=3Dbcm2710-rpi-3-b-plus.dtb +device_tree_address=3D0x1f0000 +device_tree_end=3D0x200000 +device_tree=3Dyour_fdt_file.dtb ``` =20 -Note: the address range **must** be `[0x10000:0x20000]`. -`dtoverlay` and `dtparam` parameters are also supported **when** providing= a Device Tree`. +Note: the address range **must** be `[0x1f0000:0x200000]`. `dtoverlay` and= `dtparam` parameters are also supported. =20 ## Custom `bootargs` =20 diff --git a/Platform/RaspberryPi/RPi4/Readme.md b/Platform/RaspberryPi/RPi= 4/Readme.md index 17d02e9e..62a63c4c 100644 --- a/Platform/RaspberryPi/RPi4/Readme.md +++ b/Platform/RaspberryPi/RPi4/Readme.md @@ -54,18 +54,17 @@ Build instructions from the top level edk2-platforms Re= adme.md apply. enable_uart=3D1 enable_gic=3D1 armstub=3DRPI_EFI.fd - disable_commandline_tags=3D1 + disable_commandline_tags=3D2 + device_tree_address=3D0x1f0000 + device_tree_end=3D0x200000 ``` Additionally, if you want to use PL011 instead of the miniUART, you ca= n add the lines: ``` - device_tree_address=3D0x1f0000 - device_tree_end=3D0x200000 - device_tree=3Dbcm2711-rpi-4-b.dtb dtoverlay=3Dminiuart-bt ``` - Note that doing so requires `miniuart-bt.dbto` to have been copied int= o an `overlays/` + Note: doing so requires `miniuart-bt.dbto` to have been copied into an= `overlays/` directory on the uSD card. Alternatively, you may use `disable-bt` ins= tead of - `miniuart-bt` if you don't require BlueTooth. + `miniuart-bt` if you don't require Bluetooth. 5. Insert the uSD card and power up the Pi. =20 # Notes @@ -81,18 +80,23 @@ in the `TrustedFirmware/` directory from `edk2-non-osi`. =20 ## Device Tree =20 -You can pass a custom Device Tree and overlays using the following: +By default, UEFI will use the device tree loaded by the VideoCore firmware= . This +depends on the model/variant, and relies on the presence on specific files= on your boot media. +E.g.: + - `bcm2711-rpi-4-b.dtb` (for Pi 4B) + +You can override the DTB and provide a custom one. Copy the relevant `.dtb= ` into the root of +the SD or USB, and then edit your `config.txt` so that it looks like: =20 ``` (...) disable_commandline_tags=3D2 device_tree_address=3D0x1f0000 device_tree_end=3D0x200000 -device_tree=3Dbcm2711-rpi-4-b.dtb +device_tree=3Dyour_fdt_file.dtb ``` =20 -Note: the address range **must** be `[0x1f0000:0x200000]`. -`dtoverlay` and `dtparam` parameters are also supported **when** providing= a Device Tree`. +Note: the address range **must** be `[0x1f0000:0x200000]`. `dtoverlay` and= `dtparam` parameters are also supported. =20 ## Custom `bootargs` =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58462): https://edk2.groups.io/g/devel/message/58462 Mute This Topic: https://groups.io/mt/73382825/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-