blob: a99a7ccf9c5f09c9bb08df16050171a322fb9d4f [file] [log] [blame]
Andrew Thoelke65668f92014-03-20 10:48:23 +00001/*
dp-arm230011c2017-03-07 11:02:47 +00002 * Copyright (c) 2014-2017, 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
15 .weak platform_set_stack
16 .weak platform_get_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000017
18 /* -----------------------------------------------------
Soby Mathewa0fedc42016-06-16 14:52:04 +010019 * uintptr_t plat_get_my_stack ()
Andrew Thoelke65668f92014-03-20 10:48:23 +000020 *
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 */
Soby Mathewb0082d22015-04-09 13:40:55 +010026func plat_get_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000027 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
28 ret
Soby Mathewb0082d22015-04-09 13:40:55 +010029endfunc plat_get_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000030
31 /* -----------------------------------------------------
Soby Mathewb0082d22015-04-09 13:40:55 +010032 * void plat_set_my_stack ()
Andrew Thoelke65668f92014-03-20 10:48:23 +000033 *
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 */
Soby Mathewb0082d22015-04-09 13:40:55 +010039func plat_set_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000040 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
41 mov sp, x0
42 ret
Soby Mathewb0082d22015-04-09 13:40:55 +010043endfunc plat_set_my_stack
Andrew Thoelke65668f92014-03-20 10:48:23 +000044
45 /* -----------------------------------------------------
Soby Mathew70716d62015-07-13 16:26:11 +010046 * unsigned long platform_get_stack ()
47 *
48 * For cold-boot BL images, only the primary CPU needs a
49 * stack. This function returns the stack pointer for a
50 * stack allocated in device memory. This function
51 * is deprecated.
52 * -----------------------------------------------------
53 */
54func_deprecated platform_get_stack
55 b plat_get_my_stack
56endfunc_deprecated platform_get_stack
57
58 /* -----------------------------------------------------
59 * void platform_set_stack ()
60 *
61 * For cold-boot BL images, only the primary CPU needs a
62 * stack. This function sets the stack pointer to a stack
63 * allocated in normal memory.This function is
64 * deprecated.
65 * -----------------------------------------------------
66 */
67func_deprecated platform_set_stack
68 b plat_set_my_stack
69endfunc_deprecated platform_set_stack
70
71 /* -----------------------------------------------------
Andrew Thoelke65668f92014-03-20 10:48:23 +000072 * Single cpu stack in normal memory.
73 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
74 * are allocated
75 * -----------------------------------------------------
76 */
77declare_stack platform_normal_stacks, tzfw_normal_stacks, \
Soby Mathewbfdbecf2016-06-09 17:16:35 +010078 PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE