Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 24 | func platform_get_stack |
| 25 | get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE |
| 26 | bx lr |
| 27 | endfunc 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 | */ |
| 37 | func platform_set_stack |
| 38 | get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE |
| 39 | mov sp, r0 |
| 40 | bx lr |
| 41 | endfunc 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 | */ |
| 49 | declare_stack platform_normal_stacks, ns_bl_normal_stacks, \ |
| 50 | PLATFORM_STACK_SIZE, 1 |