Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 1 | /* |
Boyan Karatotev | 97476aa | 2024-11-19 11:27:01 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved. |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <asm_macros.S> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <lib/el3_runtime/cpu_data.h> |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 9 | |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 10 | .globl _cpu_data_by_index |
| 11 | |
| 12 | /* ----------------------------------------------------------------- |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 13 | * 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 | */ |
| 21 | func _cpu_data_by_index |
Etienne Carriere | 97ad6ce | 2017-09-01 10:22:20 +0200 | [diff] [blame] | 22 | mov_imm x1, CPU_DATA_SIZE |
| 23 | mul x0, x0, x1 |
Madhukar Pappireddy | f4e6ea6 | 2020-01-27 15:32:15 -0600 | [diff] [blame] | 24 | adrp x1, percpu_data |
| 25 | add x1, x1, :lo12:percpu_data |
Etienne Carriere | 97ad6ce | 2017-09-01 10:22:20 +0200 | [diff] [blame] | 26 | add x0, x0, x1 |
Andrew Thoelke | 8c28fe0 | 2014-06-02 11:40:35 +0100 | [diff] [blame] | 27 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 28 | endfunc _cpu_data_by_index |