Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 1 | /* |
Varun Wadekar | 9388afa | 2019-01-10 15:45:15 -0800 | [diff] [blame] | 2 | * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 8 | #include <asm_macros.S> |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 9 | #include <platform_def.h> |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 10 | |
| 11 | |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 12 | .local platform_normal_stacks |
dp-arm | 230011c | 2017-03-07 11:02:47 +0000 | [diff] [blame] | 13 | .weak plat_set_my_stack |
| 14 | .weak plat_get_my_stack |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 15 | |
| 16 | /* ----------------------------------------------------- |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 17 | * uintptr_t plat_get_my_stack () |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 18 | * |
| 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 Mathew | b0082d2 | 2015-04-09 13:40:55 +0100 | [diff] [blame] | 24 | func plat_get_my_stack |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 25 | get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE |
| 26 | ret |
Soby Mathew | b0082d2 | 2015-04-09 13:40:55 +0100 | [diff] [blame] | 27 | endfunc plat_get_my_stack |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 28 | |
| 29 | /* ----------------------------------------------------- |
Soby Mathew | b0082d2 | 2015-04-09 13:40:55 +0100 | [diff] [blame] | 30 | * void plat_set_my_stack () |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 31 | * |
| 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 Mathew | b0082d2 | 2015-04-09 13:40:55 +0100 | [diff] [blame] | 37 | func plat_set_my_stack |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 38 | get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE |
| 39 | mov sp, x0 |
| 40 | ret |
Soby Mathew | b0082d2 | 2015-04-09 13:40:55 +0100 | [diff] [blame] | 41 | endfunc plat_set_my_stack |
Andrew Thoelke | 65668f9 | 2014-03-20 10:48:23 +0000 | [diff] [blame] | 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, tzfw_normal_stacks, \ |
Soby Mathew | bfdbecf | 2016-06-09 17:16:35 +0100 | [diff] [blame] | 50 | PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE |