From nobody Tue Feb 10 13:18:13 2026 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+55305+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+55305+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231638; cv=none; d=zohomail.com; s=zohoarc; b=oCfrT6GJHQe+tKZ1z/Q72Pw0PiXsjdEq16D9LvYrlW3OCI/mbqLNvY5zApI1sE57N/u+vlCTgnilx7b4ZnjeO6OV7A135MFnxhvq6ddf4CNCaO5kNVVFHosAyVWPQ+0in23d0/EdoG9fUPhhK6yGHYEpMnGqmo5arx0qX9vRtss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231638; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VfZwxAyOnFKRJLSggnYU65oZ56KyRLqwvl4LgdptOOM=; b=JHYtWk2dEljCiXSbZQ0Jf5x/tUyB0TsJ7oOsXdIWQ0PJJMg9nJur1nzBMip5SOC2iz/7poHWixFJw8GnnWjUbCVA3jb1aAEVclEa2VKlsQRS3wK0cDrUD34n+0tD4Pr2qLbtCyn5Eg+5RLmOpoM/wFHM44sKadNMBltjRYTMs6I= 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+55305+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583231638082470.82445736781915; Tue, 3 Mar 2020 02:33:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5as7YY1788612xvIq36WSLo3; Tue, 03 Mar 2020 02:33:57 -0800 X-Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web12.1927.1583231636183589883 for ; Tue, 03 Mar 2020 02:33:56 -0800 X-Received: by mail-wr1-f68.google.com with SMTP id q8so3667849wrm.4 for ; Tue, 03 Mar 2020 02:33:55 -0800 (PST) X-Gm-Message-State: FCL9L5dgMNi4T9x85r1Hxfudx1787277AA= X-Google-Smtp-Source: ADFU+vt2AwDhBUf+OlUYEnCVVnF2K+Ez8J6WZmiqQDD4xZVkatAz5zxH07gZpgIpCYeu7mfzuh03BA== X-Received: by 2002:a5d:4ac8:: with SMTP id y8mr4791546wrs.272.1583231634312; Tue, 03 Mar 2020 02:33:54 -0800 (PST) X-Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id c4sm3255193wml.7.2020.03.03.02.33.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:53 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com, awarkentin@vmware.com Subject: [edk2-devel][PATCH 2/5] Platform/RPi: Separate RAM descriptors between 0-3 GB and 3+ GB Date: Tue, 3 Mar 2020 10:33:36 +0000 Message-Id: <20200303103339.7468-3-pete@akeo.ie> In-Reply-To: <20200303103339.7468-1-pete@akeo.ie> References: <20200303103339.7468-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583231637; bh=osOHX4PhMdAkLYtxih9upkQub7fJ1ei0Hs7s01cMne4=; h=Cc:Date:From:Reply-To:Subject:To; b=iiUoLIXC3jitEBKIoNYYahcy5HIGZccQcSiBOeLDZRKnR097mrErlpdVuWfs01iFDlm xReZkHMRb6+m47DrURQJBV2B2mPnCMduXlRM/C3CE6FIq82KIKzsIKNcwkc9ovl6i3sw8 mrsKR5ACPcY3xVwDum/6rYj11qYfgjejJlc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin This is required so that we can make the 3 to 4 GB segment of the Raspberry Pi 4 a user-configurable option. This also removes the need for the PcdAcpiBasicMode PCD. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf | 3 -- Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 33 +++++++++++= +++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf b/Pla= tform/RaspberryPi/Library/PlatformLib/PlatformLib.inf index 9abcc2cc0075..77cdbe399a06 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf +++ b/Platform/RaspberryPi/Library/PlatformLib/PlatformLib.inf @@ -59,8 +59,5 @@ [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize =20 -[FeaturePcd] - gRaspberryPiTokenSpaceGuid.PcdAcpiBasicMode - [Ppis] gArmMpCoreInfoPpiGuid diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Pl= atform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c index 4b388465cdde..3f257d4fa528 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c @@ -25,7 +25,7 @@ UINT32 mBoardRevision; =20 =20 // The total number of descriptors, including the final "end-of-table" des= criptor. -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 10 +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 11 =20 STATIC BOOLEAN VirtualMemoryInfoInitialized =3D FALSE; STATIC RPI_MEMORY_REGION_INFO VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_D= ESCRIPTORS]; @@ -60,6 +60,7 @@ ArmPlatformGetVirtualMemoryMap ( { UINTN Index =3D 0; UINTN GpuIndex; + INT64 OrigMemorySize; INT64 SystemMemorySize; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; =20 @@ -78,7 +79,6 @@ ArmPlatformGetVirtualMemoryMap ( return; } =20 - // Firmware Volume VirtualMemoryTable[Index].PhysicalBase =3D FixedPcdGet64 (PcdFdBaseAd= dress); VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; @@ -155,13 +155,13 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; VirtualMemoryInfo[Index++].Name =3D L"SoC Reserved (283x)"; =20 - if (FeaturePcdGet (PcdAcpiBasicMode)) { - // - // Limit the memory to 3 GB to work around the DMA bugs in the SoC wit= hout - // having to rely on IORT or _DMA descriptions. - // - SystemMemorySize =3D MIN(SystemMemorySize, 3U * SIZE_1GB); - } + // + // By default we limit the memory to 3 GB to work around the DMA bugs in= the SoC, for + // OSes that don't support _DMA range descriptors. On 4GB boards, it's r= untime + // setting to boot with 4GB, and the additional 1GB is added by ConfigDx= e. + // + OrigMemorySize =3D SystemMemorySize; + SystemMemorySize =3D MIN(SystemMemorySize, 3U * SIZE_1GB); =20 // If we have RAM above the 1 GB mark, declare it if (SystemMemorySize - SIZE_1GB > 0) { @@ -170,7 +170,20 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D SystemMemorySize - SIZE_1G= B; VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; VirtualMemoryInfo[Index].Type =3D RPI_MEM_BASIC_REGION; - VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM"; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM belo= w 3GB"; + } + + // + // If we have RAM above 3 GB mark, declare it so it's mapped, but + // don't add it to the memory map. This is done later by ConfigDxe if ne= cessary. + // + if (OrigMemorySize > (3UL * SIZE_1GB)) { + VirtualMemoryTable[Index].PhysicalBase =3D 3UL * SIZE_1GB; + VirtualMemoryTable[Index].VirtualBase =3D VirtualMemoryTable[Index].= PhysicalBase; + VirtualMemoryTable[Index].Length =3D OrigMemorySize - VirtualMe= moryTable[Index].PhysicalBase; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_WRITE_BACK; + VirtualMemoryInfo[Index].Type =3D RPI_MEM_UNMAPPED_REGION; + VirtualMemoryInfo[Index++].Name =3D L"Extended System RAM abov= e 3GB"; } =20 // End of Table --=20 2.21.0.windows.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 (#55305): https://edk2.groups.io/g/devel/message/55305 Mute This Topic: https://groups.io/mt/71697496/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-