1/*
2 * Copyright (c) 2014-2019, 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
16	/* -----------------------------------------------------
17	 * uintptr_t plat_get_my_stack ()
18	 *
19	 * For cold-boot BL images, only the primary CPU needs a
20	 * stack. This function returns the stack pointer for a
21	 * stack allocated in device memory.
22	 * -----------------------------------------------------
23	 */
24func plat_get_my_stack
25	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
26	ret
27endfunc plat_get_my_stack
28
29	/* -----------------------------------------------------
30	 * void plat_set_my_stack ()
31	 *
32	 * For cold-boot BL images, only the primary CPU needs a
33	 * stack. This function sets the stack pointer to a stack
34	 * allocated in normal memory.
35	 * -----------------------------------------------------
36	 */
37func plat_set_my_stack
38	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
39	mov sp, x0
40	ret
41endfunc plat_set_my_stack
42
43	/* -----------------------------------------------------
44	 * Single cpu stack in normal memory.
45	 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
46	 * are allocated
47	 * -----------------------------------------------------
48	 */
49declare_stack platform_normal_stacks, .tzfw_normal_stacks, \
50		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
51