From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web10.11501.1583495500767965122 for ; Fri, 06 Mar 2020 03:51:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=D1HphglW; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.128.66, mailfrom: pete@akeo.ie) Received: by mail-wm1-f66.google.com with SMTP id 6so2055215wmi.5 for ; Fri, 06 Mar 2020 03:51: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=BHeZYNHNoXclkWnPDnrNSBHqzXPfCBE0/9gwcVCysZw=; b=D1HphglWIB8AaENu3yhW0P+VUd7ceoIZ+cGGOm0pgX7yawH1GueF9ba0OUOSbHQuAB wea9xo5cpzyv+tmbMFG77VuVxHQR8TTSOF/k1NNAoLzzHWMFC40HLuFT2DWDnUM4Dcc4 pnaGVKOf0OZc2omZcqXVoWlCDckq3DG+xPuqem6LpPOc4hvrk4K0EH7TgYJ4sZSvydVy ZtSO+YhVXWpWFJBjWZnsoryrVzWRAMBw0K193jYmld9sAH8B4twbl5AZOiE9oHy+NNyr qyOFTrLGbCIq1qBsAGH/crn0OJ66lD2KV4exg4PcleWpgdwlcgduOewov/qY96orB9ES X1zg== 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=BHeZYNHNoXclkWnPDnrNSBHqzXPfCBE0/9gwcVCysZw=; b=gsV8badwKXASonm6Sws0lryj0xiRBmWhXT8nvOfyDG6ibm9Anf0HsAqzFR19lRHyPA 7be1OJbS8lVM5Q95o+0/GE65BlFwx7AsfitbfMC5ji5oS2edbmu9T5Mw1A08x/+8I2eQ ceeyJBxdldWLjHhisQm81/ExDw1yYnXbiHVFUwFyNm4aKRGeS0ECEDenJCHno2inyt9g NIunfssWnY1M1JZTfKAW/GRAx+5zJy/KwfZ+0BJBDPLQv5b78LdfwhUhDxv60UXeLQwh ZUudIJAbXOssolyH3i5zFPnMuokjl2NEs3nfNVMWZl4kl/Mx6DkvXKWT6Q+GBbBDil/R B8PA== X-Gm-Message-State: ANhLgQ1KgMj5lM3Su8zX2WYNhKqP7sqovPxt4+fPzkouo8BzYxxGkFJG vOUQJqu8IoHfYuBoOSyvB6Vm7w== X-Google-Smtp-Source: ADFU+vt34wpQYTja3bCG6QpPU4amMFEDXBmCAOSKxZoXRj6VW8Jdz32evy2o8JjT5sBtxDzw/jL8fw== X-Received: by 2002:a7b:cbce:: with SMTP id n14mr3614807wmi.86.1583495499269; Fri, 06 Mar 2020 03:51:39 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.49.209]) by smtp.googlemail.com with ESMTPSA id r19sm12720986wmh.26.2020.03.06.03.51.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2020 03:51:38 -0800 (PST) Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back To: devel@edk2.groups.io, Andrei Warkentin Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com References: <20200305224605.7705-1-andrey.warkentin@gmail.com> <15F9B446FF373668.16592@groups.io> From: "Pete Batard" Message-ID: <741e7302-80e8-2daf-78fa-44cd49bdff4d@akeo.ie> Date: Fri, 6 Mar 2020 11:51: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: <15F9B446FF373668.16592@groups.io> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit On 2020.03.06 11:42, Pete Batard via Groups.Io wrote: > 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. Disregard. I was missing the fix IS_XIP dependency mentioned below. With this: Reviewed-by: Pete Batard Tested-by: Pete Batard > > 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 >> > > > >