mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-23 21:44:15 +00:00

Platform may use specific cache line sizes. Since CACHE_WRITEBACK_GRANULE defines the platform specific cache line size, it is used to define the size of the cpu data structure CPU_DATA_SIZE aligned on cache line size. Introduce assembly macro 'mov_imm' for AArch32 to simplify implementation of function '_cpu_data_by_index'. Change-Id: Ic2d49ffe0c3e51649425fd9c8c99559c582ac5a1 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
42 lines
1.1 KiB
ArmAsm
42 lines
1.1 KiB
ArmAsm
/*
|
|
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <asm_macros.S>
|
|
#include <cpu_data.h>
|
|
|
|
.globl _cpu_data
|
|
.globl _cpu_data_by_index
|
|
|
|
/* -----------------------------------------------------------------
|
|
* cpu_data_t *_cpu_data(void)
|
|
*
|
|
* Return the cpu_data structure for the current CPU.
|
|
* -----------------------------------------------------------------
|
|
*/
|
|
func _cpu_data
|
|
/* r12 is pushed to meet the 8 byte stack alignment requirement */
|
|
push {r12, lr}
|
|
bl plat_my_core_pos
|
|
pop {r12, lr}
|
|
b _cpu_data_by_index
|
|
endfunc _cpu_data
|
|
|
|
/* -----------------------------------------------------------------
|
|
* cpu_data_t *_cpu_data_by_index(uint32_t cpu_index)
|
|
*
|
|
* Return the cpu_data structure for the CPU with given linear index
|
|
*
|
|
* This can be called without a valid stack.
|
|
* clobbers: r0, r1
|
|
* -----------------------------------------------------------------
|
|
*/
|
|
func _cpu_data_by_index
|
|
mov_imm r1, CPU_DATA_SIZE
|
|
mul r0, r0, r1
|
|
ldr r1, =percpu_data
|
|
add r0, r0, r1
|
|
bx lr
|
|
endfunc _cpu_data_by_index
|