]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / Arm / PrePeiCoreEntryPoint.S
... / ...
CommitLineData
1//\r
2// Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
3//\r
4// This program and the accompanying materials\r
5// are licensed and made available under the terms and conditions of the BSD License\r
6// which accompanies this distribution. The full text of the license may be found at\r
7// http://opensource.org/licenses/bsd-license.php\r
8//\r
9// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11//\r
12//\r
13\r
14#include <AsmMacroIoLib.h>\r
15#include <Base.h>\r
16#include <Library/PcdLib.h>\r
17#include <AutoGen.h>\r
18\r
19.text\r
20.align 3\r
21\r
22GCC_ASM_IMPORT(CEntryPoint)\r
23GCC_ASM_IMPORT(ArmPlatformGetCorePosition)\r
24GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
25GCC_ASM_IMPORT(ArmReadMpidr)\r
26GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
27GCC_ASM_EXPORT(_ModuleEntryPoint)\r
28\r
29StartupAddr: .word CEntryPoint\r
30\r
31ASM_PFX(_ModuleEntryPoint):\r
32 // Do early platform specific actions\r
33 bl ASM_PFX(ArmPlatformPeiBootAction)\r
34\r
35 // Identify CPU ID\r
36 bl ASM_PFX(ArmReadMpidr)\r
37 // Keep a copy of the MpId register value\r
38 mov r5, r0\r
39\r
40 // Is it the Primary Core ?\r
41 bl ASM_PFX(ArmPlatformIsPrimaryCore)\r
42\r
43 // Get the top of the primary stacks (and the base of the secondary stacks)\r
44 LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1)\r
45 LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
46 add r1, r1, r2\r
47\r
48 // r0 is equal to 1 if I am the primary core\r
49 cmp r0, #1\r
50 beq _SetupPrimaryCoreStack\r
51\r
52_SetupSecondaryCoreStack:\r
53 // r1 contains the base of the secondary stacks\r
54\r
55 // Get the Core Position\r
56 mov r6, r1 // Save base of the secondary stacks\r
57 mov r0, r5\r
58 bl ASM_PFX(ArmPlatformGetCorePosition)\r
59 // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack\r
60 add r0, r0, #1\r
61\r
62 // StackOffset = CorePos * StackSize\r
63 LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)\r
64 mul r0, r0, r2\r
65 // SP = StackBase + StackOffset\r
66 add sp, r6, r0\r
67\r
68_PrepareArguments:\r
69 // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector\r
70 LoadConstantToReg (FixedPcdGet32(PcdFvBaseAddress), r2)\r
71 add r2, r2, #4\r
72 ldr r1, [r2]\r
73\r
74 // Move sec startup address into a data register\r
75 // Ensure we're jumping to FV version of the code (not boot remapped alias)\r
76 ldr r3, StartupAddr\r
77\r
78 // Jump to PrePeiCore C code\r
79 // r0 = mp_id\r
80 // r1 = pei_core_address\r
81 mov r0, r5\r
82 blx r3\r
83\r
84_SetupPrimaryCoreStack:\r
85 // r1 contains the top of the primary stack\r
86 LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)\r
87\r
88 // The reserved space for global variable must be 8-bytes aligned for pushing\r
89 // 64-bit variable on the stack\r
90 SetPrimaryStack (r1, r2, r3)\r
91 b _PrepareArguments\r
92\r
93_NeverReturn:\r
94 b _NeverReturn\r