Skip to content

Commit

Permalink
Platform/RaspberryPi/RPi4: gain 2MB of RAM back
Browse files Browse the repository at this point in the history
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 <awarkentin@vmware.com>
Reviewed-by: Pete Batard <pete@akeo.ie>
Tested-by:  Pete Batard <pete@akeo.ie>
  • Loading branch information
Andrei Warkentin authored and Ard Biesheuvel committed Mar 6, 2020
1 parent f9d4207 commit 91ed4f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Platform/RaspberryPi/RPi4/RPi4.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91ed4f9

Please sign in to comment.