]>
Commit | Line | Data |
---|---|---|
295c2eb8 | 1 | //\r |
bebda7ce | 2 | // Copyright (c) 2012-2013, ARM Limited. All rights reserved.\r |
295c2eb8 | 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 | |
bebda7ce | 14 | #include <AsmMacroIoLib.h>\r |
295c2eb8 | 15 | #include <Library/ArmLib.h>\r |
16 | \r | |
bebda7ce | 17 | #include <ArmPlatform.h>\r |
18 | \r | |
295c2eb8 | 19 | INCLUDE AsmMacroIoLib.inc\r |
20 | \r | |
b5a57223 | 21 | EXPORT ArmPlatformPeiBootAction\r |
295c2eb8 | 22 | EXPORT ArmPlatformGetCorePosition\r |
bebda7ce | 23 | EXPORT ArmPlatformIsPrimaryCore\r |
99267097 | 24 | EXPORT ArmPlatformGetPrimaryCoreMpId\r |
295c2eb8 | 25 | \r |
26 | PRESERVE8\r | |
27 | AREA CTA15A7Helper, CODE, READONLY\r | |
b5a57223 | 28 | \r |
29 | ArmPlatformPeiBootAction FUNCTION\r | |
30 | bx lr\r | |
31 | ENDFUNC\r | |
295c2eb8 | 32 | \r |
33 | //UINTN\r | |
34 | //ArmPlatformGetCorePosition (\r | |
35 | // IN UINTN MpId\r | |
36 | // );\r | |
37 | ArmPlatformGetCorePosition FUNCTION\r | |
38 | and r1, r0, #ARM_CORE_MASK\r | |
39 | and r0, r0, #ARM_CLUSTER_MASK\r | |
40 | add r0, r1, r0, LSR #7\r | |
41 | bx lr\r | |
42 | ENDFUNC\r | |
43 | \r | |
bebda7ce | 44 | //UINTN\r |
45 | //ArmPlatformIsPrimaryCore (\r | |
46 | // IN UINTN MpId\r | |
47 | // );\r | |
48 | ArmPlatformIsPrimaryCore FUNCTION\r | |
49 | // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48\r | |
50 | // with cpu_id[0:3] and cluster_id[4:7]\r | |
51 | LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1)\r | |
52 | ldr r1, [r1]\r | |
53 | lsr r1, #24\r | |
54 | \r | |
55 | // Shift the SCC value to get the cluster ID at the offset #8\r | |
56 | lsl r2, r1, #4\r | |
57 | and r2, r2, #0xF00\r | |
58 | \r | |
59 | // Keep only the cpu ID from the original SCC\r | |
60 | and r1, r1, #0x0F\r | |
61 | // Add the Cluster ID to the Cpu ID\r | |
62 | orr r1, r1, r2\r | |
63 | \r | |
64 | // Keep the Cluster ID and Core ID from the MPID\r | |
9d94fa2d | 65 | LoadConstantToReg (ARM_CLUSTER_MASK :OR: ARM_CORE_MASK, r2)\r |
bebda7ce | 66 | and r0, r0, r2\r |
67 | \r | |
68 | // Compare mpid and boot cpu from ARM_SCC_CFGREG48\r | |
69 | cmp r0, r1\r | |
70 | moveq r0, #1\r | |
71 | movne r0, #0\r | |
72 | bx lr\r | |
73 | ENDFUNC\r | |
74 | \r | |
99267097 OM |
75 | //UINTN\r |
76 | //ArmPlatformGetPrimaryCoreMpId (\r | |
77 | // VOID\r | |
78 | // );\r | |
79 | ArmPlatformGetPrimaryCoreMpId FUNCTION\r | |
80 | // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48\r | |
81 | // with cpu_id[0:3] and cluster_id[4:7]\r | |
82 | LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)\r | |
83 | ldr r0, [r0]\r | |
84 | lsr r0, #24\r | |
85 | \r | |
86 | // Shift the SCC value to get the cluster ID at the offset #8\r | |
87 | lsl r1, r0, #4\r | |
88 | and r1, r1, #0xF00\r | |
89 | \r | |
90 | // Keep only the cpu ID from the original SCC\r | |
91 | and r0, r0, #0x0F\r | |
92 | // Add the Cluster ID to the Cpu ID\r | |
93 | orr r0, r0, r1\r | |
94 | bx lr\r | |
95 | ENDFUNC\r | |
96 | \r | |
295c2eb8 | 97 | END\r |