From nobody Mon Feb 9 19:07:51 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+55323+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+55323+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583240915; cv=none; d=zohomail.com; s=zohoarc; b=LcCSbBDOsiIMDGDvCs8BaB9159DwnMTjBoBzg9S0JuDKPEMesDxO81D8BGVGbRrha7czZ2LkpktMavbaN+hk6EYBkJ0e29wvvMbkty4/K0Ht2OjA4HtC9UtAKlPPNdQ7krYFeELSEZM4PDLxwZHIxgZqxm+Y1UhqFhg9E7N6d94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583240915; 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=7aEuD8N+14pFGHBcOiC/tfc+FO0e64RhuWEP7rWZkyU=; b=i7NXfUgOUjmHhHf/uvf9rVG7RmDoCapwGwUxRPhmSbtrcRq2pLYOnZBOVq0JOshbpzx9/ggdc/9E9rYHNMK+wf9QT0JI2Y1JUyUbMI6y9gMRAiGZn7FT5kzCv6EPf1ftgxftgV7Y83YKgz4ZwNelaLrFUESlYUV2ZIrLPyx7hlY= 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+55323+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583240915118166.04241959597357; Tue, 3 Mar 2020 05:08:35 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3l7ZYY1788612xHCPqa19OFh; Tue, 03 Mar 2020 05:08:34 -0800 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web12.3386.1583240913040008858 for ; Tue, 03 Mar 2020 05:08:33 -0800 X-Received: by mail-wm1-f66.google.com with SMTP id a141so2779465wme.2 for ; Tue, 03 Mar 2020 05:08:32 -0800 (PST) X-Gm-Message-State: m3kRswf6KM6Dne2otSLfprJwx1787277AA= X-Google-Smtp-Source: ADFU+vsGN3WxM7CYs0fJb8fA/+DGBpJ4Re+/cY0papgmES5GtHZqBM/YjZZPm8fkrHCny1uIc0V5xw== X-Received: by 2002:a7b:cf39:: with SMTP id m25mr4237796wmg.146.1583240911174; Tue, 03 Mar 2020 05:08:31 -0800 (PST) X-Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id j5sm3907620wmi.33.2020.03.03.05.08.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 05:08:30 -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 v2 3/6] Platform/RPi: Separate RAM descriptors between 0-3 GB and 3+ GB Date: Tue, 3 Mar 2020 13:08:11 +0000 Message-Id: <20200303130814.3092-4-pete@akeo.ie> In-Reply-To: <20200303130814.3092-1-pete@akeo.ie> References: <20200303130814.3092-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=1583240914; bh=LReP5g2d4+63BlU7Y4gDtJdr1Vc8OkR8SZIFzBZ20OI=; h=Cc:Date:From:Reply-To:Subject:To; b=gtqSk+vzfLdPrFhMlsSh/dgPzJbaNVsC90eSSDh4mhHnsNvUPeWh+kQe4XBZRUh1Xsd es4oMYi0LBJZtBsFLwG0tfydcx1hn7/r48C4Hq3TNUvbFs00e7nadEiJKdXzkom1tiGaw 36/4GGXx6pOx7QkpPcRi6XOjXGDBPkcjyx8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin Splitting the RAM descriptors 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 | 32 +++++++++++= +++------ 2 files changed, 23 insertions(+), 12 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..901e5e3ee924 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 @@ -155,13 +156,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 runtime + // setting to boot with 4 GB, and the additional 1 GB is added by Config= Dxe. + // + OrigMemorySize =3D SystemMemorySize; + SystemMemorySize =3D MIN(SystemMemorySize, 3UL * SIZE_1GB); =20 // If we have RAM above the 1 GB mark, declare it if (SystemMemorySize - SIZE_1GB > 0) { @@ -170,7 +171,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 3 GB"; + } + + // + // 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 3 GB"; } =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 (#55323): https://edk2.groups.io/g/devel/message/55323 Mute This Topic: https://groups.io/mt/71699475/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-