2 // Copyright (c) 2012-2013, ARM Limited. All rights reserved.
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
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.
14 #include <AsmMacroIoLib.h>
15 #include <Library/ArmLib.h>
17 #include <ArmPlatform.h>
22 GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
23 GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
24 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
25 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
27 ASM_PFX(ArmPlatformPeiBootAction):
31 //ArmPlatformGetCorePosition (
34 ASM_PFX(ArmPlatformGetCorePosition):
35 and r1, r0, #ARM_CORE_MASK
36 and r0, r0, #ARM_CLUSTER_MASK
37 add r0, r1, r0, LSR #7
41 //ArmPlatformIsPrimaryCore (
44 ASM_PFX(ArmPlatformIsPrimaryCore):
45 // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
46 // with cpu_id[0:3] and cluster_id[4:7]
47 LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1)
51 // Shift the SCC value to get the cluster ID at the offset #8
55 // Keep only the cpu ID from the original SCC
57 // Add the Cluster ID to the Cpu ID
60 // Keep the Cluster ID and Core ID from the MPID
61 LoadConstantToReg (ARM_CLUSTER_MASK | ARM_CORE_MASK, r2)
64 // Compare mpid and boot cpu from ARM_SCC_CFGREG48
71 //ArmPlatformGetPrimaryCoreMpId (
74 ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
75 // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
76 // with cpu_id[0:3] and cluster_id[4:7]
77 LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)
81 // Shift the SCC value to get the cluster ID at the offset #8
85 // Keep only the cpu ID from the original SCC
87 // Add the Cluster ID to the Cpu ID