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