]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S
ARM Packages: Replace tabs by spaces for indentation
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibRTSM / AArch64 / RTSMHelper.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 <AsmMacroIoLibV8.h>
15 #include <Base.h>
16 #include <Library/ArmLib.h>
17 #include <Library/PcdLib.h>
18 #include <AutoGen.h>
19
20 .text
21 .align 2
22
23 GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
24 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
25 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
26 GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
27 GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
28
29 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
30 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
31 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
32
33 ASM_PFX(ArmPlatformPeiBootAction):
34 ret
35
36 //UINTN
37 //ArmPlatformGetPrimaryCoreMpId (
38 // VOID
39 // );
40 ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
41 LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
42 ldrh w0, [x0]
43 ret
44
45 # IN None
46 # OUT x0 = number of cores present in the system
47 ASM_PFX(ArmGetCpuCountPerCluster):
48 LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x0)
49 ldrh w0, [x0]
50 ret
51
52 //UINTN
53 //ArmPlatformIsPrimaryCore (
54 // IN UINTN MpId
55 // );
56 ASM_PFX(ArmPlatformIsPrimaryCore):
57 LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
58 ldrh w1, [x1]
59 and x0, x0, x1
60 LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1)
61 ldrh w1, [x1]
62 cmp w0, w1
63 b.ne 1f
64 mov x0, #1
65 ret
66 1:
67 mov x0, #0
68 ret
69
70 //UINTN
71 //ArmPlatformGetCorePosition (
72 // IN UINTN MpId
73 // );
74 // With this function: CorePos = (ClusterId * 4) + CoreId
75 ASM_PFX(ArmPlatformGetCorePosition):
76 and x1, x0, #ARM_CORE_MASK
77 and x0, x0, #ARM_CLUSTER_MASK
78 add x0, x1, x0, LSR #6
79 ret
80
81 ASM_FUNCTION_REMOVE_IF_UNREFERENCED