From 984ec7588d569cc35dcbdd3c45a86088c4366eeb Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 9 Sep 2015 14:48:25 +0000 Subject: ArmPlatformPkg/MemoryInitPeim: handle memory above 4 GB on 32-bit ARM Make sure that the PEI memory region is carved out of memory that is 32-bit addressable, by taking MAX_ADDRESS into account (which is defined as '4 GB - 1' on ARM) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Leif Lindholm git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18426 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ArmPlatformPkg/MemoryInitPei') diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c index 93ab16ca4..25baac170 100755 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c @@ -96,7 +96,7 @@ InitializeMemory ( { EFI_STATUS Status; UINTN SystemMemoryBase; - UINTN SystemMemoryTop; + UINT64 SystemMemoryTop; UINTN FdBase; UINTN FdTop; UINTN UefiMemoryBase; @@ -115,7 +115,10 @@ InitializeMemory ( ASSERT (PcdGet64 (PcdSystemMemorySize) != 0); SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase); - SystemMemoryTop = SystemMemoryBase + (UINTN)PcdGet64 (PcdSystemMemorySize); + SystemMemoryTop = SystemMemoryBase + PcdGet64 (PcdSystemMemorySize); + if (SystemMemoryTop - 1 > MAX_ADDRESS) { + SystemMemoryTop = (UINT64)MAX_ADDRESS + 1; + } FdBase = (UINTN)PcdGet64 (PcdFdBaseAddress); FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); -- cgit v1.2.3