blob: 02d94159d9464b754b01ce723b20b8c8ccbadfdb [file] [log] [blame]
Andrew Thoelke8c28fe02014-06-02 11:40:35 +01001/*
Boyan Karatotev97476aa2024-11-19 11:27:01 +00002 * Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved.
Andrew Thoelke8c28fe02014-06-02 11:40:35 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Andrew Thoelke8c28fe02014-06-02 11:40:35 +01005 */
6
7#include <asm_macros.S>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <lib/el3_runtime/cpu_data.h>
Andrew Thoelke8c28fe02014-06-02 11:40:35 +01009
Andrew Thoelke8c28fe02014-06-02 11:40:35 +010010.globl _cpu_data_by_index
11
12/* -----------------------------------------------------------------
Andrew Thoelke8c28fe02014-06-02 11:40:35 +010013 * cpu_data_t *_cpu_data_by_index(uint32_t cpu_index)
14 *
15 * Return the cpu_data structure for the CPU with given linear index
16 *
17 * This can be called without a valid stack.
18 * clobbers: x0, x1
19 * -----------------------------------------------------------------
20 */
21func _cpu_data_by_index
Etienne Carriere97ad6ce2017-09-01 10:22:20 +020022 mov_imm x1, CPU_DATA_SIZE
23 mul x0, x0, x1
Madhukar Pappireddyf4e6ea62020-01-27 15:32:15 -060024 adrp x1, percpu_data
25 add x1, x1, :lo12:percpu_data
Etienne Carriere97ad6ce2017-09-01 10:22:20 +020026 add x0, x0, x1
Andrew Thoelke8c28fe02014-06-02 11:40:35 +010027 ret
Kévin Petita877c252015-03-24 14:03:57 +000028endfunc _cpu_data_by_index