ArmVirtPkg/ArmVirtMemoryInitPeiLib: handle memory above 4 GB on 32-bit ARM

On 32-bit ARM, split system memory into a region below (and up to) 4 GB
and a region above 4 GB. This is necessary to get the DXE core to consider
the former as the resource descriptor that describes the primary memory
region that also covers the PHIT region.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18427 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2015-09-09 14:48:33 +00:00 committed by abiesheuvel
parent 984ec7588d
commit 72daeed8cf
1 changed files with 25 additions and 6 deletions

View File

@ -56,6 +56,7 @@ MemoryPeim (
)
{
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
UINT64 SystemMemoryTop;
// Ensure PcdSystemMemorySize has been set
ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
@ -73,12 +74,30 @@ MemoryPeim (
EFI_RESOURCE_ATTRIBUTE_TESTED
);
BuildResourceDescriptorHob (
EFI_RESOURCE_SYSTEM_MEMORY,
ResourceAttributes,
PcdGet64 (PcdSystemMemoryBase),
PcdGet64 (PcdSystemMemorySize)
);
SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +
PcdGet64 (PcdSystemMemorySize);
if (SystemMemoryTop - 1 > MAX_ADDRESS) {
BuildResourceDescriptorHob (
EFI_RESOURCE_SYSTEM_MEMORY,
ResourceAttributes,
PcdGet64 (PcdSystemMemoryBase),
(UINT64)MAX_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1
);
BuildResourceDescriptorHob (
EFI_RESOURCE_SYSTEM_MEMORY,
ResourceAttributes,
(UINT64)MAX_ADDRESS + 1,
SystemMemoryTop - MAX_ADDRESS - 1
);
} else {
BuildResourceDescriptorHob (
EFI_RESOURCE_SYSTEM_MEMORY,
ResourceAttributes,
PcdGet64 (PcdSystemMemoryBase),
PcdGet64 (PcdSystemMemorySize)
);
}
//
// When running under virtualization, the PI/UEFI memory region may be