1*91f16700Schasinglulu/* 2*91f16700Schasinglulu * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu#include <arch.h> 8*91f16700Schasinglulu#include <asm_macros.S> 9*91f16700Schasinglulu#include <assert_macros.S> 10*91f16700Schasinglulu#include <platform_def.h> 11*91f16700Schasinglulu 12*91f16700Schasinglulu .local platform_normal_stacks 13*91f16700Schasinglulu .weak plat_get_my_stack 14*91f16700Schasinglulu .weak plat_set_my_stack 15*91f16700Schasinglulu 16*91f16700Schasinglulu /* --------------------------------------------------------------------- 17*91f16700Schasinglulu * When the compatibility layer is disabled, the platform APIs 18*91f16700Schasinglulu * plat_get_my_stack() and plat_set_my_stack() are supported by the 19*91f16700Schasinglulu * platform and the previous APIs platform_get_stack() and 20*91f16700Schasinglulu * platform_set_stack() are defined in terms of new APIs making use of 21*91f16700Schasinglulu * the fact that they are only ever invoked for the current CPU. This 22*91f16700Schasinglulu * is to enable components of Trusted Firmware like SPDs using the old 23*91f16700Schasinglulu * platform APIs to continue to work. 24*91f16700Schasinglulu * -------------------------------------------------------------------- 25*91f16700Schasinglulu */ 26*91f16700Schasinglulu 27*91f16700Schasinglulu /* ----------------------------------------------------- 28*91f16700Schasinglulu * uintptr_t plat_get_my_stack () 29*91f16700Schasinglulu * 30*91f16700Schasinglulu * For the current CPU, this function returns the stack 31*91f16700Schasinglulu * pointer for a stack allocated in device memory. 32*91f16700Schasinglulu * ----------------------------------------------------- 33*91f16700Schasinglulu */ 34*91f16700Schasinglulufunc plat_get_my_stack 35*91f16700Schasinglulu mov x10, x30 36*91f16700Schasinglulu get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE 37*91f16700Schasinglulu ret x10 38*91f16700Schasingluluendfunc plat_get_my_stack 39*91f16700Schasinglulu 40*91f16700Schasinglulu /* ----------------------------------------------------- 41*91f16700Schasinglulu * void plat_set_my_stack () 42*91f16700Schasinglulu * 43*91f16700Schasinglulu * For the current CPU, this function sets the stack 44*91f16700Schasinglulu * pointer to a stack allocated in normal memory. 45*91f16700Schasinglulu * ----------------------------------------------------- 46*91f16700Schasinglulu */ 47*91f16700Schasinglulufunc plat_set_my_stack 48*91f16700Schasinglulu mov x9, x30 49*91f16700Schasinglulu bl plat_get_my_stack 50*91f16700Schasinglulu mov sp, x0 51*91f16700Schasinglulu ret x9 52*91f16700Schasingluluendfunc plat_set_my_stack 53*91f16700Schasinglulu 54*91f16700Schasinglulu /* ----------------------------------------------------- 55*91f16700Schasinglulu * Per-CPU stacks in normal memory. Each CPU gets a 56*91f16700Schasinglulu * stack of PLATFORM_STACK_SIZE bytes. 57*91f16700Schasinglulu * ----------------------------------------------------- 58*91f16700Schasinglulu */ 59*91f16700Schasingluludeclare_stack platform_normal_stacks, .tzfw_normal_stacks, \ 60*91f16700Schasinglulu PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT, \ 61*91f16700Schasinglulu CACHE_WRITEBACK_GRANULE 62