xref: /rk3399_ARM-atf/plat/common/aarch64/platform_up_stack.S (revision c948f77136c42a92d0bb660543a3600c36dcf7f1)
1/*
2 * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <platform_def.h>
10
11
12	.local	platform_normal_stacks
13	.weak	plat_set_my_stack
14	.weak	plat_get_my_stack
15	.weak	platform_set_stack
16	.weak	platform_get_stack
17
18	/* -----------------------------------------------------
19	 * uintptr_t plat_get_my_stack ()
20	 *
21	 * For cold-boot BL images, only the primary CPU needs a
22	 * stack. This function returns the stack pointer for a
23	 * stack allocated in device memory.
24	 * -----------------------------------------------------
25	 */
26func plat_get_my_stack
27	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
28	ret
29endfunc plat_get_my_stack
30
31	/* -----------------------------------------------------
32	 * void plat_set_my_stack ()
33	 *
34	 * For cold-boot BL images, only the primary CPU needs a
35	 * stack. This function sets the stack pointer to a stack
36	 * allocated in normal memory.
37	 * -----------------------------------------------------
38	 */
39func plat_set_my_stack
40	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
41	mov sp, x0
42	ret
43endfunc plat_set_my_stack
44
45	/* -----------------------------------------------------
46	 * Single cpu stack in normal memory.
47	 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
48	 * are allocated
49	 * -----------------------------------------------------
50	 */
51declare_stack platform_normal_stacks, tzfw_normal_stacks, \
52		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
53