Home | History | Annotate | Download | only in aarch32
      1 /*
      2  * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
      3  *
      4  * SPDX-License-Identifier: BSD-3-Clause
      5  */
      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  */
     19 func _cpu_data
     20 	/* r12 is pushed to meet the 8 byte stack alignment requirement */
     21 	push	{r12, lr}
     22 	bl	plat_my_core_pos
     23 	pop	{r12, lr}
     24 	b	_cpu_data_by_index
     25 endfunc _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  */
     36 func _cpu_data_by_index
     37 	mov_imm	r1, CPU_DATA_SIZE
     38 	mul	r0, r0, r1
     39 	ldr	r1, =percpu_data
     40 	add	r0, r0, r1
     41 	bx	lr
     42 endfunc _cpu_data_by_index
     43