blob: 0c5551bc36256c1d10d2f5519ce7d63863ec0a26 [file] [log] [blame]
Soby Mathew49473e42015-06-10 13:49:59 +01001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew49473e42015-06-10 13:49:59 +01005 */
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