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.
16 INCLUDE AsmMacroIoLib.inc
19 IMPORT ArmPlatformGetCorePosition
20 IMPORT ArmPlatformIsPrimaryCore
22 IMPORT ArmPlatformPeiBootAction
23 EXPORT _ModuleEntryPoint
26 AREA PrePeiCoreEntryPoint, CODE, READONLY
28 StartupAddr DCD CEntryPoint
31 // Do early platform specific actions
32 bl ArmPlatformPeiBootAction
36 // Keep a copy of the MpId register value
39 // Is it the Primary Core ?
40 bl ArmPlatformIsPrimaryCore
42 // Get the top of the primary stacks (and the base of the secondary stacks)
43 mov32 r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)
45 // r0 is equal to 1 if I am the primary core
47 beq _SetupPrimaryCoreStack
49 _SetupSecondaryCoreStack
50 // r1 contains the base of the secondary stacks
52 // Get the Core Position
53 mov r6, r1 // Save base of the secondary stacks
55 bl ArmPlatformGetCorePosition
56 // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack
59 // StackOffset = CorePos * StackSize
60 mov32 r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)
62 // SP = StackBase + StackOffset
66 // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
67 mov32 r2, FixedPcdGet32(PcdFvBaseAddress)
70 // Move sec startup address into a data register
71 // Ensure we're jumping to FV version of the code (not boot remapped alias)
74 // Jump to PrePeiCore C code
76 // r1 = pei_core_address
80 _SetupPrimaryCoreStack
82 mov32 r8, FixedPcdGet64 (PcdCPUCoresStackBase)
83 mov32 r9, FixedPcdGet32 (PcdInitValueInTempStack)