From mboxrd@z Thu Jan 1 00:00:00 1970 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.11476.1583494960282730032 for ; Fri, 06 Mar 2020 03:42:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=iffUXFs7; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.68, mailfrom: pete@akeo.ie) Received: by mail-wr1-f68.google.com with SMTP id v11so1955203wrm.9 for ; Fri, 06 Mar 2020 03:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jzyTn4EJQaW3GV7A6W0Vae8YnMw4WirMkr772/I1Oec=; b=iffUXFs7DLDsp96CLEdAW3JkZ4yXg5BVzpd/h9Lj/bt100B61zwMcHrkntsO3DoYWJ vm/8xX36qS7vvLlnINVnEtnXBc9VMKNwECoHP/NFtFTwcskU9N+QaESA332h4+WoYyTa gjL3nxliDEPFUoPkPj01sz0vd2i1zIQZe+aa86xOzzoFosB2NYs7z4+eQPMxMDL2a7I2 pcEo4fgd4mFBRAbT0Oiklxck0YJqUjNtRWKwf29Zwyo6AyF2ni768+XmWa4KItMKD99o HNuHFOE4oiQeHD+wyCVjLAYb+IgAER/sp5dR8FUsb5PnxKg+osbwKBklniycFyGOK7Tu 0M6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jzyTn4EJQaW3GV7A6W0Vae8YnMw4WirMkr772/I1Oec=; b=izbVZbKk1txsa9/Iauh8C+QlyRy7xzcXuLgG+MzN/AdnR6QGeaNiwbAsM6jECbI+9Y +B6Ao7OxfMKYH044r2zxoL/SRbuSuV/r0LALYno7tsSO8n4L+nYxsUXdViF9T3hrxD/x ck6X+4mfaUPru9C9SN1t5FrowoQqmSltizUn/lLIsOe2IeWlea/+Fy96Mbp7YXPGL3vi dW2oerSMz8fOUWqGb/Ut+9iI7M0bgD7wYgsBJ+5uMnHIyxhRchfDyiMVGhRF6S0GQR/H OY5XddRlmiPPmpO86A53l6r7tQYovvwWrMGufN5CHx4Rr170EzNCgk079mVWiRyy5Ow4 H53Q== X-Gm-Message-State: ANhLgQ0mj0lXQ8BSCR6BpL0EmZWuG6BXYoqzPMx8u4wfLPt/yT3vcUR/ xOm313gpH511KGvm2dyXQIOHJA== X-Google-Smtp-Source: ADFU+vu61BtBk2Rdag6QeEaZlgC8Hviq1gpb8VX3HeVEF63EAgSk0ynhuqGYPcXlyuisSqvgjXQShA== X-Received: by 2002:adf:f504:: with SMTP id q4mr3524938wro.28.1583494958756; Fri, 06 Mar 2020 03:42:38 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.49.209]) by smtp.googlemail.com with ESMTPSA id y12sm7791939wmi.48.2020.03.06.03.42.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2020 03:42:37 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back To: Andrei Warkentin , devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com References: <20200305224605.7705-1-andrey.warkentin@gmail.com> From: "Pete Batard" Message-ID: Date: Fri, 6 Mar 2020 11:42:36 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200305224605.7705-1-andrey.warkentin@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit This currently produces an ASSERT for me: ASSERT [ArmPlatformPrePiUniCore] /usr/src/edk2/ArmPlatformPkg/PrePi/PrePi.c(75): (((UINT64)0x00000000ULL > mSystemMemoryEnd) || ((0x00000000ULL + 0x00200000U) < 0x00200000ULL)) || ((0x00000000ULL >= 0x00200000ULL) && ((UINT64)(0x00000000ULL + 0x00200000U) Please hold off integration until we've looked into it further. Regards, /Pete On 2020.03.05 22:46, Andrei Warkentin wrote: > From: Andrei Warkentin > > The RPi4 TF-A is much smaller than RPi3 TF-A, and doesn't need > an extra 2MB region. > > Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP. > > Signed-off-by: Andrei Warkentin > --- > Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 22 ++++++++++++-------- > Platform/RaspberryPi/RPi4/RPi4.dsc | 4 ++-- > 2 files changed, 15 insertions(+), 11 deletions(-) > > diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > index 901e5e3e..e795a885 100644 > --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c > @@ -39,8 +39,6 @@ STATIC RPI_MEMORY_REGION_INFO VirtualMemoryInfo[MAX_VIRTUAL_MEMORY_MAP_DESCRIP > FixedPcdGet32(PcdFdSize) - \ > VariablesSize) > > -#define ATFBase (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize)) > - > /** > Return the Virtual Memory Map of your platform > > @@ -96,13 +94,19 @@ ArmPlatformGetVirtualMemoryMap ( > VirtualMemoryInfo[Index].Type = RPI_MEM_RUNTIME_REGION; > VirtualMemoryInfo[Index++].Name = L"FD Variables"; > > - // TF-A reserved RAM > - VirtualMemoryTable[Index].PhysicalBase = ATFBase; > - VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > - VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdSystemMemoryBase) - ATFBase; > - VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > - VirtualMemoryInfo[Index++].Name = L"TF-A RAM"; > + if (BCM2711_SOC_REGISTERS == 0) { > + // > + // TF-A reserved RAM only exists for the Pi 3 TF-A. > + // > + // This is 2MB that directly follows the FD. > + // > + VirtualMemoryTable[Index].PhysicalBase = (FixedPcdGet64(PcdFdBaseAddress) + FixedPcdGet32(PcdFdSize)); > + VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase; > + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdSystemMemoryBase) - VirtualMemoryTable[Index].PhysicalBase; > + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; > + VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION; > + VirtualMemoryInfo[Index++].Name = L"TF-A RAM"; > + } > > // Base System RAM > VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdSystemMemoryBase); > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RPi4/RPi4.dsc > index 79295729..da62dc5b 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > @@ -396,8 +396,8 @@ > # This matches PcdFvBaseAddress, since everything less is ATF, and > # will be reserved away. > # > - gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00400000 > - gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fc00000 > + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x00200000 > + gArmTokenSpaceGuid.PcdSystemMemorySize|0x3fe00000 > > # > # Device specific addresses >