12bf28e62SAndrew Thoelke/* 234dd1e96SAlexei Fedorov * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved. 32bf28e62SAndrew Thoelke * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 52bf28e62SAndrew Thoelke */ 62bf28e62SAndrew Thoelke 72bf28e62SAndrew Thoelke#include <arch.h> 82bf28e62SAndrew Thoelke#include <asm_macros.S> 932bc85f2SSoby Mathew#include <assert_macros.S> 105f0cdb05SDan Handley#include <platform_def.h> 112bf28e62SAndrew Thoelke 122bf28e62SAndrew Thoelke .local platform_normal_stacks 1312d0d00dSSoby Mathew .weak plat_get_my_stack 1412d0d00dSSoby Mathew .weak plat_set_my_stack 152bf28e62SAndrew Thoelke 165c8babcdSSoby Mathew /* --------------------------------------------------------------------- 175d9101b3SDavid Horstmann * When the compatibility layer is disabled, the platform APIs 1873308618SAntonio Nino Diaz * plat_get_my_stack() and plat_set_my_stack() are supported by the 1973308618SAntonio Nino Diaz * platform and the previous APIs platform_get_stack() and 2073308618SAntonio Nino Diaz * platform_set_stack() are defined in terms of new APIs making use of 2173308618SAntonio Nino Diaz * the fact that they are only ever invoked for the current CPU. This 2273308618SAntonio Nino Diaz * is to enable components of Trusted Firmware like SPDs using the old 2373308618SAntonio Nino Diaz * platform APIs to continue to work. 245c8babcdSSoby Mathew * -------------------------------------------------------------------- 255c8babcdSSoby Mathew */ 265c8babcdSSoby Mathew 272bf28e62SAndrew Thoelke /* ----------------------------------------------------- 284c0d0390SSoby Mathew * uintptr_t plat_get_my_stack () 2912d0d00dSSoby Mathew * 3012d0d00dSSoby Mathew * For the current CPU, this function returns the stack 3112d0d00dSSoby Mathew * pointer for a stack allocated in device memory. 3212d0d00dSSoby Mathew * ----------------------------------------------------- 3312d0d00dSSoby Mathew */ 3412d0d00dSSoby Mathewfunc plat_get_my_stack 3534dd1e96SAlexei Fedorov mov x10, x30 3612d0d00dSSoby Mathew get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE 3712d0d00dSSoby Mathew ret x10 3812d0d00dSSoby Mathewendfunc plat_get_my_stack 3912d0d00dSSoby Mathew 4012d0d00dSSoby Mathew /* ----------------------------------------------------- 4112d0d00dSSoby Mathew * void plat_set_my_stack () 4212d0d00dSSoby Mathew * 4312d0d00dSSoby Mathew * For the current CPU, this function sets the stack 4412d0d00dSSoby Mathew * pointer to a stack allocated in normal memory. 4512d0d00dSSoby Mathew * ----------------------------------------------------- 4612d0d00dSSoby Mathew */ 4712d0d00dSSoby Mathewfunc plat_set_my_stack 4834dd1e96SAlexei Fedorov mov x9, x30 4912d0d00dSSoby Mathew bl plat_get_my_stack 5012d0d00dSSoby Mathew mov sp, x0 5112d0d00dSSoby Mathew ret x9 5212d0d00dSSoby Mathewendfunc plat_set_my_stack 5312d0d00dSSoby Mathew 5412d0d00dSSoby Mathew /* ----------------------------------------------------- 5534dd1e96SAlexei Fedorov * Per-CPU stacks in normal memory. Each CPU gets a 56539a7b38SAchin Gupta * stack of PLATFORM_STACK_SIZE bytes. 572bf28e62SAndrew Thoelke * ----------------------------------------------------- 582bf28e62SAndrew Thoelke */ 59*da04341eSChris Kaydeclare_stack platform_normal_stacks, .tzfw_normal_stacks, \ 60663db206SSoby Mathew PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT, \ 61663db206SSoby Mathew CACHE_WRITEBACK_GRANULE 62