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