]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
ArmPkg: Remove RVCT support
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / Arm / PrePeiCoreEntryPoint.asm
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 <AutoGen.h>
9
10 INCLUDE AsmMacroIoLib.inc
11
12 IMPORT CEntryPoint
13 IMPORT ArmPlatformGetCorePosition
14 IMPORT ArmPlatformIsPrimaryCore
15 IMPORT ArmReadMpidr
16 IMPORT ArmPlatformPeiBootAction
17 EXPORT _ModuleEntryPoint
18
19 PRESERVE8
20 AREA PrePeiCoreEntryPoint, CODE, READONLY
21
22 StartupAddr DCD CEntryPoint
23
24 _ModuleEntryPoint
25 // Do early platform specific actions
26 bl ArmPlatformPeiBootAction
27
28 // Identify CPU ID
29 bl ArmReadMpidr
30 // Keep a copy of the MpId register value
31 mov r5, r0
32
33 // Is it the Primary Core ?
34 bl ArmPlatformIsPrimaryCore
35
36 // Get the top of the primary stacks (and the base of the secondary stacks)
37 mov32 r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize)
38
39 // r0 is equal to 1 if I am the primary core
40 cmp r0, #1
41 beq _SetupPrimaryCoreStack
42
43 _SetupSecondaryCoreStack
44 // r1 contains the base of the secondary stacks
45
46 // Get the Core Position
47 mov r6, r1 // Save base of the secondary stacks
48 mov r0, r5
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
51 add r0, r0, #1
52
53 // StackOffset = CorePos * StackSize
54 mov32 r2, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)
55 mul r0, r0, r2
56 // SP = StackBase + StackOffset
57 add sp, r6, r0
58
59 _PrepareArguments
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)
62 ldr r1, [r2, #4]
63
64 // Move sec startup address into a data register
65 // Ensure we're jumping to FV version of the code (not boot remapped alias)
66 ldr r3, StartupAddr
67
68 // Jump to PrePeiCore C code
69 // r0 = mp_id
70 // r1 = pei_core_address
71 mov r0, r5
72 blx r3
73
74 _SetupPrimaryCoreStack
75 mov sp, r1
76 mov32 r8, FixedPcdGet64 (PcdCPUCoresStackBase)
77 mov32 r9, FixedPcdGet32 (PcdInitValueInTempStack)
78 mov r10, r9
79 mov r11, r9
80 mov r12, r9
81 0:stm r8!, {r9-r12}
82 cmp r8, r1
83 blt 0b
84 b _PrepareArguments
85
86 _NeverReturn
87 b _NeverReturn
88
89 END