summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library
diff options
context:
space:
mode:
authorOlivier Martin <Olivier.Martin@arm.com>2015-07-06 16:56:31 +0000
committeroliviermartin <oliviermartin@Edk2>2015-07-06 16:56:31 +0000
commit5dbacdb21b59748e885c2eccae370b81271ab795 (patch)
tree69f477c94ae7e754ab9214a222134e9d07c4ae89 /ArmPlatformPkg/Library
parent40a3f38f67cee7046feb5a5666883cc75a6962ff (diff)
downloadedk2-5dbacdb21b59748e885c2eccae370b81271ab795.tar.gz
edk2-5dbacdb21b59748e885c2eccae370b81271ab795.tar.bz2
edk2-5dbacdb21b59748e885c2eccae370b81271ab795.zip
ArmPlatformPkg/PrePi: Make dynamic the top of the System Memory
This change allows to change the top of the System Memory that was hardcoded by: FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet64 (PcdSystemMemorySize) It allows to add support when the Trusted Firmware reserves the top of the System Memory as Trusted. The size of this region might not be known in advance. Note: The reason why the start of the System Memory has not been made dynamic is because the early code calculates where to place the stack from the top of the System Memory. So there is no need to make the start of the System Memory a dynamic value at the early stage of the boot phase. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Ronald Cron <Ronald.Cron@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17835 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library')
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c12
-rw-r--r--ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf4
2 files changed, 8 insertions, 8 deletions
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
index 41af1836e1..db69ba047d 100644
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
+++ b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -19,7 +19,9 @@
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
-#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))) || \
+extern UINT64 mSystemMemoryEnd;
+
+#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(mSystemMemoryEnd)) || \
((PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet64 (PcdSystemMemoryBase)))
// Declared by ArmPlatformPkg/PrePi Module
@@ -40,7 +42,7 @@ ArmPlatformGetGlobalVariable (
if (IS_XIP()) {
// In Case of XIP, we expect the Primary Stack at the top of the System Memory
// The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
} else {
GlobalVariableBase = mGlobalVariableBase;
}
@@ -69,7 +71,7 @@ ArmPlatformSetGlobalVariable (
if (IS_XIP()) {
// In Case of XIP, we expect the Primary Stack at the top of the System Memory
// The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
} else {
GlobalVariableBase = mGlobalVariableBase;
}
@@ -96,7 +98,7 @@ ArmPlatformGetGlobalVariableAddress (
if (IS_XIP()) {
// In Case of XIP, we expect the Primary Stack at the top of the System Memory
// The size must be 64bit aligned to allow 64bit variable to be aligned
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);
} else {
GlobalVariableBase = mGlobalVariableBase;
}
diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
index 37de35e7d0..1b5b8fcbee 100644
--- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
+++ b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
+# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -41,6 +41,4 @@
[Pcd]
gArmTokenSpaceGuid.PcdSystemMemoryBase
- gArmTokenSpaceGuid.PcdSystemMemorySize
gArmTokenSpaceGuid.PcdFdBaseAddress
-