]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
MdeModulePkg/Variable: Initialize local variable "RtPtrTrack"
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / Arm / PrePeiCoreEntryPoint.S
1 //
2 // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8 #include <AsmMacroIoLib.h>
9
10 ASM_FUNC(_ModuleEntryPoint)
11 // Do early platform specific actions
12 bl ASM_PFX(ArmPlatformPeiBootAction)
13
14 // Identify CPU ID
15 bl ASM_PFX(ArmReadMpidr)
16 // Keep a copy of the MpId register value
17 mov r5, r0
18
19 // Is it the Primary Core ?
20 bl ASM_PFX(ArmPlatformIsPrimaryCore)
21
22 // Get the top of the primary stacks (and the base of the secondary stacks)
23 MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
24
25 // r0 is equal to 1 if I am the primary core
26 cmp r0, #1
27 beq _SetupPrimaryCoreStack
28
29 _SetupSecondaryCoreStack:
30 // r1 contains the base of the secondary stacks
31
32 // Get the Core Position
33 mov r6, r1 // Save base of the secondary stacks
34 mov r0, r5
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
37 add r0, r0, #1
38
39 // StackOffset = CorePos * StackSize
40 MOV32 (r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))
41 mul r0, r0, r2
42 // SP = StackBase + StackOffset
43 add sp, r6, r0
44
45 _PrepareArguments:
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))
48 ldr r1, [r2, #4]
49
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)
53
54 // Jump to PrePeiCore C code
55 // r0 = mp_id
56 // r1 = pei_core_address
57 mov r0, r5
58 blx r3
59
60 _SetupPrimaryCoreStack:
61 mov sp, r1
62 MOV32 (r8, FixedPcdGet64 (PcdCPUCoresStackBase))
63 MOV32 (r9, FixedPcdGet32 (PcdInitValueInTempStack))
64 mov r10, r9
65 mov r11, r9
66 mov r12, r9
67 0:stm r8!, {r9-r12}
68 cmp r8, r1
69 blt 0b
70 b _PrepareArguments
71
72 _NeverReturn:
73 b _NeverReturn