blob: 2c87219187acce7d732262f7196aaec90cf1fa2b [file] [log] [blame]
Andrew Thoelke65668f92014-03-20 10:48:23 +00001/*
Varun Wadekar9388afa2019-01-10 15:45:15 -08002 * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
Andrew Thoelke65668f92014-03-20 10:48:23 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Andrew Thoelke65668f92014-03-20 10:48:23 +00005 */
6
7#include <arch.h>
Andrew Thoelke65668f92014-03-20 10:48:23 +00008#include <asm_macros.S>
Dan Handleyed6ff952014-05-14 17:44:19 +01009#include <platform_def.h>
Andrew Thoelke65668f92014-03-20 10:48:23 +000010
11
Andrew Thoelke65668f92014-03-20 10:48:23 +000012 .local platform_normal_stacks
dp-arm230011c2017-03-07 11:02:47 +000013 .weak plat_set_my_stack
14 .weak plat_get_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000015
16 /* -----------------------------------------------------
Soby Mathewa0fedc42016-06-16 14:52:04 +010017 * uintptr_t plat_get_my_stack ()
Andrew Thoelke65668f92014-03-20 10:48:23 +000018 *
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 */
Soby Mathewb0082d22015-04-09 13:40:55 +010024func plat_get_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000025 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
26 ret
Soby Mathewb0082d22015-04-09 13:40:55 +010027endfunc plat_get_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000028
29 /* -----------------------------------------------------
Soby Mathewb0082d22015-04-09 13:40:55 +010030 * void plat_set_my_stack ()
Andrew Thoelke65668f92014-03-20 10:48:23 +000031 *
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 */
Soby Mathewb0082d22015-04-09 13:40:55 +010037func plat_set_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000038 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
39 mov sp, x0
40 ret
Soby Mathewb0082d22015-04-09 13:40:55 +010041endfunc plat_set_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000042
43 /* -----------------------------------------------------
44 * Single cpu stack in normal memory.
45 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
46 * are allocated
47 * -----------------------------------------------------
48 */
Chris Kay33bfc5e2023-02-14 11:30:04 +000049declare_stack platform_normal_stacks, .tzfw_normal_stacks, \
Soby Mathewbfdbecf2016-06-09 17:16:35 +010050 PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE