xref: /optee_os/core/arch/arm/plat-vexpress/juno_core_pos_a64.S (revision b1d7375c01ec8bcbf3561d27425d320afed23bce)
1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2014, Linaro Limited
4 */
5
6#include <asm.S>
7#include <arm.h>
8
9/* For Juno number the two A57s as 4 to 5 and A53s as 0 to 3 */
10FUNC get_core_pos_mpidr , :
11	/* Calculate CorePos = ((ClusterId ^ 1) * 4) + CoreId */
12	and	x1, x0, #MPIDR_CPU_MASK
13	and	x0, x0, #MPIDR_CLUSTER_MASK
14	eor	x0, x0, #(1 << MPIDR_CLUSTER_SHIFT)
15	add	x0, x1, x0, LSR #6
16	ret
17END_FUNC get_core_pos_mpidr
18