1/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <asm_macros.S>
8#include <platform_def.h>
9
10	.global	uniphier_calc_core_pos
11	.global	plat_my_core_pos
12	.globl	platform_mem_init
13
14/*
15 * unsigned int uniphier_calc_core_pos(u_register_t mpidr)
16 * core_pos = (cluster_id * max_cpus_per_cluster) + core_id
17 */
18func uniphier_calc_core_pos
19	and	x1, x0, #MPIDR_CPU_MASK
20	and	x0, x0, #MPIDR_CLUSTER_MASK
21	lsr	x0, x0, #MPIDR_AFFINITY_BITS
22	mov	x2, #UNIPHIER_MAX_CPUS_PER_CLUSTER
23	madd	x0, x0, x2, x1
24	ret
25endfunc uniphier_calc_core_pos
26
27func plat_my_core_pos
28	mrs	x0, mpidr_el1
29	b	uniphier_calc_core_pos
30endfunc plat_my_core_pos
31
32func platform_mem_init
33	ret
34endfunc platform_mem_init
35