1/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <assert_macros.S>
10#include <platform_def.h>
11
12	.globl	plat_my_core_pos
13	.globl	plat_is_my_cpu_primary
14	.globl	plat_get_my_entrypoint
15	.weak	platform_get_core_pos
16
17	/* -----------------------------------------------------
18	 *  Compatibility wrappers for new platform APIs.
19	 * -----------------------------------------------------
20	 */
21func plat_my_core_pos
22	mrs	x0, mpidr_el1
23	b	platform_get_core_pos
24endfunc plat_my_core_pos
25
26func plat_is_my_cpu_primary
27	mrs	x0, mpidr_el1
28	b	platform_is_primary_cpu
29endfunc plat_is_my_cpu_primary
30
31func plat_get_my_entrypoint
32	mrs	x0, mpidr_el1
33	b	platform_get_entrypoint
34endfunc plat_get_my_entrypoint
35
36	/* -----------------------------------------------------
37	 *  int platform_get_core_pos(int mpidr);
38	 *  With this function: CorePos = (ClusterId * 4) +
39	 *                                CoreId
40	 * -----------------------------------------------------
41	 */
42func platform_get_core_pos
43	and	x1, x0, #MPIDR_CPU_MASK
44	and	x0, x0, #MPIDR_CLUSTER_MASK
45	add	x0, x1, x0, LSR #6
46	ret
47endfunc platform_get_core_pos
48