blob: 6c3d08de359dcbd53a042e478603d136ef743f56 [file] [log] [blame]
Soby Mathew0d268dc2016-07-11 14:13:56 +01001/*
Soby Mathew50d768d2017-02-14 10:21:55 +00002 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
Soby Mathew0d268dc2016-07-11 14:13:56 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew0d268dc2016-07-11 14:13:56 +01005 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <platform_def.h>
10
Soby Mathew50d768d2017-02-14 10:21:55 +000011 .weak plat_get_my_stack
12 .weak plat_set_my_stack
Soby Mathew0d268dc2016-07-11 14:13:56 +010013
14 /* -----------------------------------------------------
15 * uintptr_t plat_get_my_stack (u_register_t mpidr)
16 *
17 * For a given CPU, this function returns the stack
18 * pointer for a stack allocated in device memory.
19 * -----------------------------------------------------
20 */
21func plat_get_my_stack
Jeenu Viswambharan953c4952017-07-20 16:42:50 +010022 push {r4, lr}
Soby Mathew0d268dc2016-07-11 14:13:56 +010023 get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
Jeenu Viswambharan953c4952017-07-20 16:42:50 +010024 pop {r4, pc}
Soby Mathew0d268dc2016-07-11 14:13:56 +010025endfunc plat_get_my_stack
26
27 /* -----------------------------------------------------
28 * void plat_set_my_stack ()
29 *
30 * For the current CPU, this function sets the stack
31 * pointer to a stack allocated in normal memory.
32 * -----------------------------------------------------
33 */
34func plat_set_my_stack
Jeenu Viswambharan953c4952017-07-20 16:42:50 +010035 mov r4, lr
Soby Mathew0d268dc2016-07-11 14:13:56 +010036 get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
37 mov sp, r0
Jeenu Viswambharan953c4952017-07-20 16:42:50 +010038 bx r4
Soby Mathew0d268dc2016-07-11 14:13:56 +010039endfunc plat_set_my_stack
40
41 /* -----------------------------------------------------
42 * Per-cpu stacks in normal memory. Each cpu gets a
43 * stack of PLATFORM_STACK_SIZE bytes.
44 * -----------------------------------------------------
45 */
46declare_stack platform_normal_stacks, tzfw_normal_stacks, \
47 PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT