blob: e67ded8205422d0b1229f9f53928581dc5f8a539 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. 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 .globl platform_set_stack
14 .globl platform_get_stack
15
16 /* -----------------------------------------------------
17 * unsigned long platform_get_stack (unsigned long)
18 *
19 * For cold-boot 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 platform_get_stack
25 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
26 bx lr
27endfunc platform_get_stack
28
29 /* -----------------------------------------------------
30 * void platform_set_stack (unsigned long)
31 *
32 * For cold-boot 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 platform_set_stack
38 get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
39 mov sp, r0
40 bx lr
41endfunc platform_set_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, ns_bl_normal_stacks, \
50 PLATFORM_STACK_SIZE, 1