1/* 2 * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#ifndef _MACRO_PRIV_INC_ 8#define _MACRO_PRIV_INC_ 9 10#include <arch/arm64/tpidrro_el0.h> 11 12#ifdef _ASMLANGUAGE 13 14/* 15 * Get CPU id 16 */ 17 18.macro get_cpu_id xreg0 19 mrs \xreg0, mpidr_el1 20 /* FIMXME: aff3 not taken into consideration */ 21 ubfx \xreg0, \xreg0, #0, #24 22.endm 23 24/* 25 * Get CPU pointer 26 */ 27 28.macro get_cpu xreg0 29 mrs \xreg0, tpidrro_el0 30 and \xreg0, \xreg0, #TPIDRROEL0_CURR_CPU 31.endm 32 33/* 34 * Increment nested counter 35 */ 36 37.macro inc_nest_counter xreg0, xreg1 38 get_cpu \xreg0 39 ldr \xreg1, [\xreg0, #___cpu_t_nested_OFFSET] 40 add \xreg1, \xreg1, #1 41 str \xreg1, [\xreg0, #___cpu_t_nested_OFFSET] 42.endm 43 44/* 45 * Decrement nested counter and update condition flags 46 */ 47 48.macro dec_nest_counter xreg0, xreg1 49 get_cpu \xreg0 50 ldr \xreg1, [\xreg0, #___cpu_t_nested_OFFSET] 51 subs \xreg1, \xreg1, #1 52 str \xreg1, [\xreg0, #___cpu_t_nested_OFFSET] 53.endm 54 55#endif /* _ASMLANGUAGE */ 56 57#endif /* _MACRO_PRIV_INC_ */ 58