From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by mx.groups.io with SMTP id smtpd.web11.3481.1583448375681146206 for ; Thu, 05 Mar 2020 14:46:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m/O3lq5W; spf=pass (domain: gmail.com, ip: 209.85.160.194, mailfrom: andrey.warkentin@gmail.com) Received: by mail-qt1-f194.google.com with SMTP id v15so391494qto.2 for ; Thu, 05 Mar 2020 14:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=aTcUSQ28KqI05lSsGGOTdI3AF0ZQ/kuNeVTSey5fXv4=; b=m/O3lq5WOT02NM4KfrYHTNTM0tISNzCI/NKfNeJMs/CiZIU4DSGFfs/dtvLlWUZRm/ T2RHfrQysXVp1xH/YAfBsHPp/+DktMaGEL6Zdx3BObGHTtWMRIwBtU7Bqk+L/wgDTolo Br2oynN85SBDf4CruBRl+iWaON+txsJQYmSQVDpKVL2wum3+XPmp33PguVzlLsTdb4Jq lLCZC0bbxvbTGTUcyNilUyWeHi0Dn4gEJ+uz+1MCZhYMpKG9QTYuzFYWK6eXmSoknx5s 8eaLM0eMn1EcA5EGa9MPPEU8zjjrQfbedMMThBT3JmQ/PbiMElDqsjm4w3pnnQ+r3kTt 6kjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aTcUSQ28KqI05lSsGGOTdI3AF0ZQ/kuNeVTSey5fXv4=; b=VXlstghoxXG6CPkSE8s7Lhvq16Wtms9XamsWMg8yMhm8zc5kubQCliGzzsCer/T0aX ktA77RvDBc8FAvi9pBQIxGjBy+vxVob2Zxn4wkQwaQbW3bxOsnc+dVpLU20N69D1ij+v M8jw2k4QJN+a8mLKFLm4+pBELLe8hzRsX0sS7XHVv0osDZ5bcfmh/umvxL/vNG6XUv2c ZFrZ4iq5sJ6RElCJCxsLVMVsyAVX+U3pk5UpS6w+e8rJI9B8ZhmVGWeFJI4qu9d377Mt Z2NNFeGiMS9ipt+GjVrS/PdPV4eQUbmdtk1UXBVZTStTHjyxm4RZNBZ6wXoSW55ALWvk SvTg== X-Gm-Message-State: ANhLgQ2rBSWqtn/YuZM9WU+DHTjDXFxoVjxTVHT09sV+LvXRFVmCCkkQ +92Ix3Y8xQoMGq/pcGQz52/CG1pvoKg= X-Google-Smtp-Source: ADFU+vv/KgZkkINbU+MGJ2rWLbjFBeUUFEsDJK0u13clTUgYAHExNTCSJURebOoOlnYlH2eEWn3GJA== X-Received: by 2002:ac8:607:: with SMTP id d7mr435819qth.271.1583448374636; Thu, 05 Mar 2020 14:46:14 -0800 (PST) Return-Path: Received: from ubuntu.localdomain (c-24-147-160-127.hsd1.ma.comcast.net. [24.147.160.127]) by smtp.gmail.com with ESMTPSA id k50sm16986808qtc.90.2020.03.05.14.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 14:46:14 -0800 (PST) From: andrey.warkentin@gmail.com To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com Subject: [edk2-platforms][PATCH 1/1] Platform/RaspberryPi/RPi4: gain 2MB of RAM back Date: Thu, 5 Mar 2020 14:46:05 -0800 Message-Id: <20200305224605.7705-1-andrey.warkentin@gmail.com> X-Mailer: git-send-email 2.17.1 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 -- 2.17.1