2 // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include <AsmMacroIoLib.h>
10 ASM_FUNC(_ModuleEntryPoint)
11 // Do early platform specific actions
12 bl ASM_PFX(ArmPlatformPeiBootAction)
15 bl ASM_PFX(ArmReadMpidr)
16 // Keep a copy of the MpId register value
19 // Is it the Primary Core ?
20 bl ASM_PFX(ArmPlatformIsPrimaryCore)
22 // Get the top of the primary stacks (and the base of the secondary stacks)
23 MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
25 // r0 is equal to 1 if I am the primary core
27 beq _SetupPrimaryCoreStack
29 _SetupSecondaryCoreStack:
30 // r1 contains the base of the secondary stacks
32 // Get the Core Position
33 mov r6, r1 // Save base of the secondary stacks
35 bl ASM_PFX(ArmPlatformGetCorePosition)
36 // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
39 // StackOffset = CorePos * StackSize
40 MOV32 (r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))
42 // SP = StackBase + StackOffset
46 // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
47 MOV32 (r2, FixedPcdGet32(PcdFvBaseAddress))
50 // Move sec startup address into a data register
51 // Ensure we're jumping to FV version of the code (not boot remapped alias)
52 ldr r3, =ASM_PFX(CEntryPoint)
54 // Jump to PrePeiCore C code
56 // r1 = pei_core_address
60 _SetupPrimaryCoreStack:
62 MOV32 (r8, FixedPcdGet64 (PcdCPUCoresStackBase))
63 MOV32 (r9, FixedPcdGet32 (PcdInitValueInTempStack))