From 72daeed8cfbbbf801c88412cf31cfef61ef59b6c Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 9 Sep 2015 14:48:33 +0000 Subject: 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 Reviewed-by: Laszlo Ersek git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18427 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ArmVirtMemoryInitPeiLib.c | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'ArmVirtPkg/Library') diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 8ce63b4596..f6c6915284 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -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 -- cgit v1.2.3