blob: 3d6b80699788223251573d726533f7fb91c8fd10 [file] [log] [blame]
Soby Mathew748be1d2016-05-05 14:10:46 +01001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew748be1d2016-05-05 14:10:46 +01005 */
6
7#include <asm_macros.S>
8#include <cpu_data.h>
9
10 .globl _cpu_data
11 .globl _cpu_data_by_index
12
13/* -----------------------------------------------------------------
14 * cpu_data_t *_cpu_data(void)
15 *
16 * Return the cpu_data structure for the current CPU.
17 * -----------------------------------------------------------------
18 */
19func _cpu_data
Soby Mathewadb70272016-12-06 12:10:51 +000020 /* r12 is pushed to meet the 8 byte stack alignment requirement */
21 push {r12, lr}
Soby Mathew748be1d2016-05-05 14:10:46 +010022 bl plat_my_core_pos
Soby Mathewadb70272016-12-06 12:10:51 +000023 pop {r12, lr}
Soby Mathew748be1d2016-05-05 14:10:46 +010024 b _cpu_data_by_index
25endfunc _cpu_data
26
27/* -----------------------------------------------------------------
28 * cpu_data_t *_cpu_data_by_index(uint32_t cpu_index)
29 *
30 * Return the cpu_data structure for the CPU with given linear index
31 *
32 * This can be called without a valid stack.
33 * clobbers: r0, r1
34 * -----------------------------------------------------------------
35 */
36func _cpu_data_by_index
37 ldr r1, =percpu_data
38 add r0, r1, r0, LSL #CPU_DATA_LOG2SIZE
39 bx lr
40endfunc _cpu_data_by_index