blob: 02d94159d9464b754b01ce723b20b8c8ccbadfdb [file] [log] [blame]
Andrew Thoelke5e910072014-06-02 11:40:35 +01001/*
Boyan Karatotevb4a921c2024-11-19 11:27:01 +00002 * Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved.
Andrew Thoelke5e910072014-06-02 11:40:35 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Andrew Thoelke5e910072014-06-02 11:40:35 +01005 */
6
7#include <asm_macros.S>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +00008#include <lib/el3_runtime/cpu_data.h>
Andrew Thoelke5e910072014-06-02 11:40:35 +01009
Andrew Thoelke5e910072014-06-02 11:40:35 +010010.globl _cpu_data_by_index
11
12/* -----------------------------------------------------------------
Andrew Thoelke5e910072014-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 Carriere86606eb2017-09-01 10:22:20 +020022 mov_imm x1, CPU_DATA_SIZE
23 mul x0, x0, x1
Madhukar Pappireddyc367b752020-01-27 15:32:15 -060024 adrp x1, percpu_data
25 add x1, x1, :lo12:percpu_data
Etienne Carriere86606eb2017-09-01 10:22:20 +020026 add x0, x0, x1
Andrew Thoelke5e910072014-06-02 11:40:35 +010027 ret
Kévin Petit8b779622015-03-24 14:03:57 +000028endfunc _cpu_data_by_index