\r
#include <Ppi/GuidedSectionExtraction.h>\r
#include <Guid/LzmaDecompress.h>\r
+#include <Guid/ArmGlobalVariableHob.h>\r
\r
#include "PrePi.h"\r
#include "LzmaDecompress.h"\r
\r
+#define IS_XIP() ((FixedPcdGet32 (PcdFdBaseAddress) > (FixedPcdGet32 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \\r
+ ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet32 (PcdSystemMemoryBase)))\r
+\r
+// Not used when PrePi in run in XIP mode\r
+UINTN mGlobalVariableBase = 0;\r
+\r
VOID\r
PrePiCommonExceptionEntry (\r
IN UINT32 Entry,\r
VOID\r
);\r
\r
+VOID\r
+EFIAPI\r
+BuildGlobalVariableHob (\r
+ IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,\r
+ IN UINT32 GlobalVariableSize\r
+ )\r
+{\r
+ ARM_HOB_GLOBAL_VARIABLE *Hob;\r
+\r
+ Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE));\r
+ ASSERT(Hob != NULL);\r
+\r
+ CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);\r
+ Hob->GlobalVariableBase = GlobalVariableBase;\r
+ Hob->GlobalVariableSize = GlobalVariableSize;\r
+}\r
+\r
VOID\r
PrePiMain (\r
IN UINTN UefiMemoryBase,\r
UINTN CharCount;\r
UINTN StacksSize;\r
\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) >= FixedPcdGet32 (PcdSystemMemoryBase)) &&\r
+ ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (FixedPcdGet32 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize)))));\r
+\r
// Enable program flow prediction, if supported.\r
ArmEnableBranchPrediction ();\r
\r
// Initialize the Debug Agent for Source Level Debugging\r
InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);\r
SaveAndSetDebugTimerInterrupt (TRUE);\r
+\r
+ if (!IS_XIP()) {\r
+ mGlobalVariableBase = GlobalVariableBase;\r
+ }\r
\r
// Declare the PI/UEFI memory region\r
HobList = HobConstructor (\r
StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) + (FixedPcdGet32(PcdClusterCount) * 4 * FixedPcdGet32(PcdCPUCoreSecondaryStackSize));\r
BuildStackHob (StacksBase, StacksSize);\r
\r
+ // Declare the Global Variable HOB\r
+ BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));\r
+\r
// Set the Boot Mode\r
SetBootMode (ArmPlatformGetBootMode ());\r
\r