2 // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
10 INCLUDE AsmMacroIoLib.inc
13 IMPORT ArmPlatformGetCorePosition
14 IMPORT ArmPlatformIsPrimaryCore
16 IMPORT ArmPlatformPeiBootAction
17 EXPORT _ModuleEntryPoint
20 AREA PrePeiCoreEntryPoint, CODE, READONLY
22 StartupAddr DCD CEntryPoint
25 // Do early platform specific actions
26 bl ArmPlatformPeiBootAction
30 // Keep a copy of the MpId register value
33 // Is it the Primary Core ?
34 bl ArmPlatformIsPrimaryCore
36 // Get the top of the primary stacks (and the base of the secondary stacks)
37 mov32 r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)
39 // r0 is equal to 1 if I am the primary core
41 beq _SetupPrimaryCoreStack
43 _SetupSecondaryCoreStack
44 // r1 contains the base of the secondary stacks
46 // Get the Core Position
47 mov r6, r1 // Save base of the secondary stacks
49 bl ArmPlatformGetCorePosition
50 // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
53 // StackOffset = CorePos * StackSize
54 mov32 r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)
56 // SP = StackBase + StackOffset
60 // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
61 mov32 r2, FixedPcdGet32(PcdFvBaseAddress)
64 // Move sec startup address into a data register
65 // Ensure we're jumping to FV version of the code (not boot remapped alias)
68 // Jump to PrePeiCore C code
70 // r1 = pei_core_address
74 _SetupPrimaryCoreStack
76 mov32 r8, FixedPcdGet64 (PcdCPUCoresStackBase)
77 mov32 r9, FixedPcdGet32 (PcdInitValueInTempStack)