]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro
[mirror_edk2.git] / ArmPlatformPkg / ArmJunoPkg / Library / ArmJunoLib / Arm / ArmJunoHelper.S
CommitLineData
9f38945f
OM
1/** @file\r
2*\r
3* Copyright (c) 2013-2014, ARM Limited. All rights reserved.\r
4*\r
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12*\r
13**/\r
14\r
a0f56915 15#include <AsmMacroIoLib.h>\r
9f38945f
OM
16#include <Library/ArmLib.h>\r
17\r
9f38945f
OM
18//\r
19// Return the core position from the value of its MpId register\r
20//\r
21// This function returns the core position from the position 0 in the processor.\r
22// This function might be called from assembler before any stack is set.\r
23//\r
24// @return Return the core position\r
25//\r
26//UINTN\r
27//ArmPlatformGetCorePosition (\r
28// IN UINTN MpId\r
29// );\r
30// With this function: CorePos = (ClusterId * 2) + CoreId\r
a0f56915 31ASM_FUNC(ArmPlatformGetCorePosition)\r
9f38945f
OM
32 and r1, r0, #ARM_CORE_MASK\r
33 and r0, r0, #ARM_CLUSTER_MASK\r
34 add r0, r1, r0, LSR #7\r
35 bx lr\r
36\r
37//\r
38// Return the MpId of the primary core\r
39//\r
40// This function returns the MpId of the primary core.\r
41// This function might be called from assembler before any stack is set.\r
42//\r
43// @return Return the MpId of the primary core\r
44//\r
45//UINTN\r
46//ArmPlatformGetPrimaryCoreMpId (\r
47// VOID\r
48// );\r
a0f56915
AB
49ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
50 LDRL (r0, PrimaryCoreMpid)\r
9f38945f
OM
51 bx lr\r
52\r
53//\r
54// Return a non-zero value if the callee is the primary core\r
55//\r
56// This function returns a non-zero value if the callee is the primary core.\r
57// The primary core is the core responsible to initialize the hardware and run UEFI.\r
58// This function might be called from assembler before any stack is set.\r
59//\r
60// @return Return a non-zero value if the callee is the primary core.\r
61//\r
62//UINTN\r
63//ArmPlatformIsPrimaryCore (\r
64// IN UINTN MpId\r
65// );\r
a0f56915
AB
66ASM_FUNC(ArmPlatformIsPrimaryCore)\r
67 MOV32 (r1, FixedPcdGet32 (PcdArmPrimaryCoreMask))\r
9f38945f
OM
68 and r0, r0, r1\r
69\r
a0f56915 70 LDRL (r1, PrimaryCoreMpid)\r
9f38945f
OM
71\r
72 cmp r0, r1\r
73 moveq r0, #1\r
74 movne r0, #0\r
75 bx lr\r
76\r
77//\r
78// First platform specific function to be called in the PEI phase\r
79//\r
80// This function is actually the first function called by the PrePi\r
81// or PrePeiCore modules. It allows to retrieve arguments passed to\r
82// the UEFI firmware through the CPU registers.\r
83//\r
a0f56915 84ASM_FUNC(ArmPlatformPeiBootAction)\r
9f38945f
OM
85 // The trusted firmware passes the primary CPU MPID through r0 register.\r
86 // Save it in a variable.\r
a0f56915 87 adr r1, PrimaryCoreMpid\r
9f38945f
OM
88 str r0, [r1]\r
89 bx lr\r
a0f56915
AB
90\r
91PrimaryCoreMpid: .word 0x0\r