1 // 2 // Copyright (c) 2012-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 <AsmMacroIoLib.h> 15 #include <Library/ArmLib.h> 16 17 #include <ArmPlatform.h> 18 19 ASM_FUNC(ArmPlatformPeiBootAction) 20 bx lr 21 22 //UINTN 23 //ArmPlatformGetCorePosition ( 24 // IN UINTN MpId 25 // ); 26 ASM_FUNC(ArmPlatformGetCorePosition) 27 and r1, r0, #ARM_CORE_MASK 28 and r0, r0, #ARM_CLUSTER_MASK 29 add r0, r1, r0, LSR #7 30 bx lr 31 32 //UINTN 33 //ArmPlatformIsPrimaryCore ( 34 // IN UINTN MpId 35 // ); 36 ASM_FUNC(ArmPlatformIsPrimaryCore) 37 // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48 38 // with cpu_id[0:3] and cluster_id[4:7] 39 MOV32 (r1, ARM_CTA15A7_SCC_CFGREG48) 40 ldr r1, [r1] 41 lsr r1, #24 42 43 // Shift the SCC value to get the cluster ID at the offset #8 44 lsl r2, r1, #4 45 and r2, r2, #0xF00 46 47 // Keep only the cpu ID from the original SCC 48 and r1, r1, #0x0F 49 // Add the Cluster ID to the Cpu ID 50 orr r1, r1, r2 51 52 // Keep the Cluster ID and Core ID from the MPID 53 MOV32 (r2, ARM_CLUSTER_MASK | ARM_CORE_MASK) 54 and r0, r0, r2 55 56 // Compare mpid and boot cpu from ARM_SCC_CFGREG48 57 cmp r0, r1 58 moveq r0, #1 59 movne r0, #0 60 bx lr 61 62 //UINTN 63 //ArmPlatformGetPrimaryCoreMpId ( 64 // VOID 65 // ); 66 ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) 67 // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48 68 // with cpu_id[0:3] and cluster_id[4:7] 69 MOV32 (r0, ARM_CTA15A7_SCC_CFGREG48) 70 ldr r0, [r0] 71 lsr r0, #24 72 73 // Shift the SCC value to get the cluster ID at the offset #8 74 lsl r1, r0, #4 75 and r1, r1, #0xF00 76 77 // Keep only the cpu ID from the original SCC 78 and r0, r0, #0x0F 79 // Add the Cluster ID to the Cpu ID 80 orr r0, r0, r1 81 bx lr 82