From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.9736.1583483752084441837 for ; Fri, 06 Mar 2020 00:35:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DaPQLdAX; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583483751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9gZN3YNlDYblm/pdCar4J152jJ419NVP+tm6nG2y9iM=; b=DaPQLdAXmgAp3PCS9mSdgIRVx6z41Qfah12Krq5Dvr2ClmySFE6HNu77WJbFCuMwjhfV6P Wp6ZhaPvn8nTt0oPIxwJEmhnAGMXKR9gVzHDxGVK+xDQgomw3B6EbiCFzKk+z8jbfoKcHx c/6GDpTqKh4hswiAr4bDvYF1AUhfPUg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-UH8onYjKOkCPBa9uT4aDwg-1; Fri, 06 Mar 2020 03:35:47 -0500 X-MC-Unique: UH8onYjKOkCPBa9uT4aDwg-1 Received: by mail-wr1-f69.google.com with SMTP id n7so698133wro.9 for ; Fri, 06 Mar 2020 00:35:47 -0800 (PST) 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=9gZN3YNlDYblm/pdCar4J152jJ419NVP+tm6nG2y9iM=; b=SIr0XGKxOaiKwWaXrczOe0V0RHHpYzU8BLbcL73IM90BWE41P38vmltnrnf2yMd8Qq beFVGt/1jzbZOcot3yPu5XNGKOv2sxHU41u7ur/mjHGfVDSlkqtLc6+ING7F+G0WvvuJ RbDmxjTmMpZ6S6BSDFixo62U/Rk9hXH0rgr9lkJehaABq7wnvzxFLadZMXuxteBPE10j inHeiMGA+NRvATovs6WtyGiFIHeOxlk7tm3TjAO8mv/WAtRBNQd0fCS2/G0D5dE5qa7y FbZ+w50+86wQrK2vbyJDnSqtKyvv9pW64zgTst+khVaUgnu8CAd+qr6HfF6DZt/N3OsY oiJQ== X-Gm-Message-State: ANhLgQ0OaWsR5IV4O38C954bgp3UrP7POBvYRbbCo/3tNZPoEqzSVxCu nHGtG/l84Mz0oOrL6QcoooPUdAx5bBiE5pYbn7mvfBWCyYaMTILUe/CdbdyHyDMjfatVUEh74PF pjCSYU68kE7qm5Q== X-Received: by 2002:adf:f503:: with SMTP id q3mr2943449wro.363.1583483746186; Fri, 06 Mar 2020 00:35:46 -0800 (PST) X-Google-Smtp-Source: ADFU+vuFi8Dpz+gGKnOlMAmFsxf05QrEeaBRejFXb9g3PM8jiE6HiVNroHpFABv/1/0yuRM9/jpP7A== X-Received: by 2002:adf:f503:: with SMTP id q3mr2943429wro.363.1583483745885; Fri, 06 Mar 2020 00:35:45 -0800 (PST) Return-Path: Received: from [192.168.1.35] (47.red-88-21-205.staticip.rima-tde.net. [88.21.205.47]) by smtp.gmail.com with ESMTPSA id n13sm12703577wmd.21.2020.03.06.00.35.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2020 00:35:45 -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, pete@akeo.ie References: <20200305224605.7705-1-andrey.warkentin@gmail.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Fri, 6 Mar 2020 09:35:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200305224605.7705-1-andrey.warkentin@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 3/5/20 11:46 PM, 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. > The note ...: ---vvv--- > Note: this depends on the edk2 ArmPlatformPkg/PrePi: fix IS_XIP. ---^^^--- > > Signed-off-by: Andrei Warkentin > --- ... goes here below the '---' so it is removed by git-am when the patch is applied (else it is buried in git history and this is not relevant information). > 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 We could let this ^ comment here. Patch looks good otherwise. > - 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 >