1/** @file 2* 3* Copyright (c) 2013-2014, ARM Limited. All rights reserved. 4* 5* This program and the accompanying materials 6* are licensed and made available under the terms and conditions of the BSD License 7* which accompanies this distribution. The full text of the license may be found at 8* http://opensource.org/licenses/bsd-license.php 9* 10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12* 13**/ 14 15#include <AsmMacroIoLibV8.h> 16#include <Library/ArmLib.h> 17 18//UINTN 19//ArmPlatformGetCorePosition ( 20// IN UINTN MpId 21// ); 22// With this function: CorePos = (ClusterId * 2) + CoreId 23ASM_FUNC(ArmPlatformGetCorePosition) 24 and x1, x0, #ARM_CORE_MASK 25 and x0, x0, #ARM_CLUSTER_MASK 26 add x0, x1, x0, LSR #7 27 ret 28 29//UINTN 30//ArmPlatformGetPrimaryCoreMpId ( 31// VOID 32// ); 33ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) 34 ldr w0, PrimaryCoreMpid 35 ret 36 37//UINTN 38//ArmPlatformIsPrimaryCore ( 39// IN UINTN MpId 40// ); 41ASM_FUNC(ArmPlatformIsPrimaryCore) 42 MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCoreMask)) 43 and x0, x0, x1 44 45 ldr w1, PrimaryCoreMpid 46 47 cmp w0, w1 48 cset x0, eq 49 ret 50 51ASM_FUNC(ArmPlatformPeiBootAction) 52 // The trusted firmware passes the primary CPU MPID through x0 register. 53 // Save it in a variable. 54 adr x1, PrimaryCoreMpid 55 str w0, [x1] 56 ret 57 58PrimaryCoreMpid: .word 0x0 59