2 // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include <AsmMacroIoLib.h>
16 ASM_FUNC(_ModuleEntryPoint)
17 // Do early platform specific actions
18 bl ASM_PFX(ArmPlatformPeiBootAction)
21 bl ASM_PFX(ArmReadMpidr)
22 // Keep a copy of the MpId register value
25 // Is it the Primary Core ?
26 bl ASM_PFX(ArmPlatformIsPrimaryCore)
28 // Get the top of the primary stacks (and the base of the secondary stacks)
29 MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
31 // r0 is equal to 1 if I am the primary core
33 beq _SetupPrimaryCoreStack
35 _SetupSecondaryCoreStack:
36 // r1 contains the base of the secondary stacks
38 // Get the Core Position
39 mov r6, r1 // Save base of the secondary stacks
41 bl ASM_PFX(ArmPlatformGetCorePosition)
42 // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
45 // StackOffset = CorePos * StackSize
46 MOV32 (r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))
48 // SP = StackBase + StackOffset
52 // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
53 MOV32 (r2, FixedPcdGet32(PcdFvBaseAddress))
56 // Move sec startup address into a data register
57 // Ensure we're jumping to FV version of the code (not boot remapped alias)
58 ldr r3, =ASM_PFX(CEntryPoint)
60 // Jump to PrePeiCore C code
62 // r1 = pei_core_address
66 _SetupPrimaryCoreStack: