diff --git a/ArmPlatformPkg/PrePi/MainMPCore.c b/ArmPlatformPkg/PrePi/MainMPCore.c index 2f1f86a4b7..139b60289e 100644 --- a/ArmPlatformPkg/PrePi/MainMPCore.c +++ b/ArmPlatformPkg/PrePi/MainMPCore.c @@ -21,6 +21,8 @@ VOID PrimaryMain ( IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, IN UINT64 StartTimeStamp ) { @@ -33,7 +35,7 @@ PrimaryMain ( ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E); } - PrePiMain (UefiMemoryBase, StartTimeStamp); + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); // We must never return ASSERT(FALSE); diff --git a/ArmPlatformPkg/PrePi/MainUniCore.c b/ArmPlatformPkg/PrePi/MainUniCore.c index f1dff8af37..e56697ca50 100644 --- a/ArmPlatformPkg/PrePi/MainUniCore.c +++ b/ArmPlatformPkg/PrePi/MainUniCore.c @@ -17,10 +17,12 @@ VOID PrimaryMain ( IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, IN UINT64 StartTimeStamp ) { - PrePiMain (UefiMemoryBase, StartTimeStamp); + PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); // We must never return ASSERT(FALSE); diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S index 601128b12f..d7c4e2e00d 100755 --- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S +++ b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S @@ -133,14 +133,21 @@ _InitGlobals: _PrepareArguments: + mov r0, r5 + mov r1, r6 + mov r2, r7 + mov r3, sp + // Move sec startup address into a data register // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r2, StartupAddr + ldr r4, StartupAddr // Jump to PrePiCore C code // r0 = MpId // r1 = UefiMemoryBase - blx r2 + // r2 = StacksBase + // r3 = GlobalVariableBase + blx r4 _NeverReturn: b _NeverReturn diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm index 2c798d09d7..5b56e66b9b 100644 --- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm +++ b/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm @@ -134,14 +134,21 @@ _InitGlobals _PrepareArguments + mov r0, r5 + mov r1, r6 + mov r2, r7 + mov r3, sp + // Move sec startup address into a data register // Ensure we're jumping to FV version of the code (not boot remapped alias) - ldr r2, StartupAddr + ldr r4, StartupAddr // Jump to PrePiCore C code // r0 = MpId // r1 = UefiMemoryBase - blx r2 + // r2 = StacksBase + // r3 = GlobalVariableBase + blx r4 _NeverReturn b _NeverReturn diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index 64c371c803..2ca9c3b8fd 100755 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -51,6 +51,8 @@ LzmaDecompressLibConstructor ( VOID PrePiMain ( IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, IN UINT64 StartTimeStamp ) { @@ -58,9 +60,7 @@ PrePiMain ( EFI_STATUS Status; CHAR8 Buffer[100]; UINTN CharCount; - UINTN UefiMemoryTop; UINTN StacksSize; - UINTN StacksBase; // Enable program flow prediction, if supported. ArmEnableBranchPrediction (); @@ -77,12 +77,6 @@ PrePiMain ( // Initialize the Debug Agent for Source Level Debugging InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); SaveAndSetDebugTimerInterrupt (TRUE); - - UefiMemoryTop = UefiMemoryBase + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); - StacksBase = UefiMemoryTop - StacksSize; - - // Check the PcdCPUCoresNonSecStackBase match with the calculated StackBase - ASSERT (StacksBase == PcdGet32 (PcdCPUCoresNonSecStackBase)); // Declare the PI/UEFI memory region HobList = HobConstructor ( @@ -137,7 +131,9 @@ PrePiMain ( VOID CEntryPoint ( IN UINTN MpId, - IN UINTN UefiMemoryBase + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase ) { UINT64 StartTimeStamp; @@ -170,7 +166,7 @@ CEntryPoint ( // If not primary Jump to Secondary Main if (IS_PRIMARY_CORE(MpId)) { // Goto primary Main. - PrimaryMain (UefiMemoryBase, StartTimeStamp); + PrimaryMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp); } else { SecondaryMain (MpId); } diff --git a/ArmPlatformPkg/PrePi/PrePi.h b/ArmPlatformPkg/PrePi/PrePi.h index 9cf953a796..59f5971231 100644 --- a/ArmPlatformPkg/PrePi/PrePi.h +++ b/ArmPlatformPkg/PrePi/PrePi.h @@ -44,6 +44,8 @@ TimerConstructor ( VOID PrePiMain ( IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, IN UINT64 StartTimeStamp ); @@ -63,6 +65,8 @@ PlatformPeim ( VOID PrimaryMain ( IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINTN GlobalVariableBase, IN UINT64 StartTimeStamp ); diff --git a/BeagleBoardPkg/BeagleBoardPkg-next.dsc b/BeagleBoardPkg/BeagleBoardPkg-next.dsc index 65974d8262..fd9cb5b9a6 100755 --- a/BeagleBoardPkg/BeagleBoardPkg-next.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg-next.dsc @@ -124,6 +124,7 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibPrePi.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf @@ -293,7 +294,6 @@ # DEBUG_LOADFILE 0x00020000 // UNDI Driver # DEBUG_EVENT 0x00080000 // Event messages # DEBUG_ERROR 0x80000000 // Error - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 @@ -331,9 +331,6 @@ # gArmTokenSpaceGuid.PcdVFPEnabled|1 - gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase|0x87FE0000 # stack at top of memory - gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize|0x20000 # 128K stack - gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 gArmTokenSpaceGuid.PcdSystemMemorySize|0x08000000 @@ -354,7 +351,6 @@ gEmbeddedTokenSpaceGuid.PcdMemoryBase|0x80000000 gEmbeddedTokenSpaceGuid.PcdMemorySize|0x10000000 - gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x80008000 gArmTokenSpaceGuid.PcdCpuResetAddress|0x80008000