/** @file\r
*\r
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
#include <Library/PcdLib.h>\r
#include <Library/DebugLib.h>\r
\r
-#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))) || \\r
+extern UINT64 mSystemMemoryEnd;\r
+\r
+#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(mSystemMemoryEnd)) || \\r
((PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet64 (PcdSystemMemoryBase)))\r
\r
// Declared by ArmPlatformPkg/PrePi Module\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r
#/** @file\r
#\r
-# Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
\r
[Pcd]\r
gArmTokenSpaceGuid.PcdSystemMemoryBase\r
- gArmTokenSpaceGuid.PcdSystemMemorySize\r
gArmTokenSpaceGuid.PcdFdBaseAddress\r
-\r
//\r
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+// Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
GCC_ASM_IMPORT(ArmPlatformStackSet)\r
GCC_ASM_EXPORT(_ModuleEntryPoint)\r
+GCC_ASM_EXPORT(mSystemMemoryEnd)\r
\r
-StartupAddr: .8byte ASM_PFX(CEntryPoint)\r
+StartupAddr: .8byte ASM_PFX(CEntryPoint)\r
+mSystemMemoryEnd: .8byte 0\r
\r
ASM_PFX(_ModuleEntryPoint):\r
// Do early platform specific actions\r
// Check if we can install the stack at the top of the System Memory or if we need\r
// to install the stacks at the bottom of the Firmware Device (case the FD is located\r
// at the top of the DRAM)\r
-_SetupStackPosition:\r
- // Compute Top of System Memory\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), x1)\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), x2)\r
+_SystemMemoryEndInit:\r
+ ldr x1, mSystemMemoryEnd\r
+\r
+ // Is mSystemMemoryEnd initialized?\r
+ cmp x1, #0\r
+ bne _SetupStackPosition\r
+\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), x1)\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), x2)\r
sub x2, x2, #1\r
- add x1, x1, x2 // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize\r
+ add x1, x1, x2\r
+ // Update the global variable\r
+ adr x2, mSystemMemoryEnd\r
+ str x1, [x2]\r
+\r
+_SetupStackPosition:\r
+ // r1 = SystemMemoryTop\r
\r
// Calculate Top of the Firmware Device\r
LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2)\r
//\r
-// Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+// Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
GCC_ASM_IMPORT(ArmPlatformStackSet)\r
GCC_ASM_EXPORT(_ModuleEntryPoint)\r
+GCC_ASM_EXPORT(mSystemMemoryEnd)\r
\r
-StartupAddr: .word CEntryPoint\r
+StartupAddr: .word CEntryPoint\r
+mSystemMemoryEnd: .8byte 0\r
\r
\r
ASM_PFX(_ModuleEntryPoint):\r
// Check if we can install the stack at the top of the System Memory or if we need\r
// to install the stacks at the bottom of the Firmware Device (case the FD is located\r
// at the top of the DRAM)\r
-_SetupStackPosition:\r
- // Compute Top of System Memory\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1)\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2)\r
+_SystemMemoryEndInit:\r
+ ldr r1, mSystemMemoryEnd\r
+\r
+ // Is mSystemMemoryEnd initialized?\r
+ cmp r1, #0\r
+ bne _SetupStackPosition\r
+\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1)\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2)\r
sub r2, r2, #1\r
- add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize\r
+ add r1, r1, r2\r
+ // Update the global variable\r
+ adr r2, mSystemMemoryEnd\r
+ str r1, [r2]\r
+\r
+_SetupStackPosition:\r
+ // r1 = SystemMemoryTop\r
\r
// Calculate Top of the Firmware Device\r
LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)\r
//\r
-// Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+// Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
IMPORT ArmPlatformStackSet\r
\r
EXPORT _ModuleEntryPoint\r
+ EXPORT mSystemMemoryEnd\r
\r
PRESERVE8\r
AREA PrePiCoreEntryPoint, CODE, READONLY\r
\r
StartupAddr DCD CEntryPoint\r
+mSystemMemoryEnd DCQ 0\r
\r
_ModuleEntryPoint\r
// Do early platform specific actions\r
// Check if we can install the stack at the top of the System Memory or if we need\r
// to install the stacks at the bottom of the Firmware Device (case the FD is located\r
// at the top of the DRAM)\r
-_SetupStackPosition\r
- // Compute Top of System Memory\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), r1)\r
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), r2)\r
+_SystemMemoryEndInit\r
+ ldr r1, mSystemMemoryEnd\r
+\r
+ // Is mSystemMemoryEnd initialized?\r
+ cmp r1, #0\r
+ bne _SetupStackPosition\r
+\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1)\r
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2)\r
sub r2, r2, #1\r
- add r1, r1, r2 // r1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize\r
+ add r1, r1, r2\r
+ // Update the global variable\r
+ adr r2, mSystemMemoryEnd\r
+ str r1, [r2]\r
+\r
+_SetupStackPosition\r
+ // r1 = SystemMemoryTop\r
\r
// Calculate Top of the Firmware Device\r
LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)\r
#include "PrePi.h"\r
#include "LzmaDecompress.h"\r
\r
-#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \\r
+#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > mSystemMemoryEnd) || \\r
((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase)))\r
\r
// Not used when PrePi in run in XIP mode\r
// If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP)\r
ASSERT (IS_XIP() ||\r
((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) &&\r
- ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet64 (PcdSystemMemorySize)))));\r
+ ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)mSystemMemoryEnd)));\r
\r
// Initialize the architecture specific bits\r
ArchInitialize ();\r
/** @file\r
*\r
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
\r
#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1);\r
\r
+extern UINT64 mSystemMemoryEnd;\r
+\r
RETURN_STATUS\r
EFIAPI\r
TimerConstructor (\r