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>
19 INCLUDE AsmMacroIoLib.inc
21 EXPORT ArmPlatformGetCorePosition
22 EXPORT ArmPlatformIsPrimaryCore
25 AREA CTA15A7Helper, CODE, READONLY
28 //ArmPlatformGetCorePosition (
31 ArmPlatformGetCorePosition FUNCTION
32 and r1, r0, #ARM_CORE_MASK
33 and r0, r0, #ARM_CLUSTER_MASK
34 add r0, r1, r0, LSR #7
39 //ArmPlatformIsPrimaryCore (
42 ArmPlatformIsPrimaryCore FUNCTION
43 // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
44 // with cpu_id[0:3] and cluster_id[4:7]
45 LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r1)
49 // Shift the SCC value to get the cluster ID at the offset #8
53 // Keep only the cpu ID from the original SCC
55 // Add the Cluster ID to the Cpu ID
58 // Keep the Cluster ID and Core ID from the MPID
59 LoadConstantToReg (ARM_CLUSTER_MASK | ARM_CORE_MASK, r2)
62 // Compare mpid and boot cpu from ARM_SCC_CFGREG48