xref: /rk3399_ARM-atf/plat/common/aarch64/platform_mp_stack.S (revision 73308618fee8afc4518c592956b31864e57e48e7)
12bf28e62SAndrew Thoelke/*
2e095ba34SVarun Wadekar * Copyright (c) 2014-2019, 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	/* ---------------------------------------------------------------------
17*73308618SAntonio Nino Diaz	 * When the compatility layer is disabled, the platform APIs
18*73308618SAntonio Nino Diaz	 * plat_get_my_stack() and plat_set_my_stack() are supported by the
19*73308618SAntonio Nino Diaz	 * platform and the previous APIs platform_get_stack() and
20*73308618SAntonio Nino Diaz	 * platform_set_stack() are defined in terms of new APIs making use of
21*73308618SAntonio Nino Diaz	 * the fact that they are only ever invoked for the current CPU.  This
22*73308618SAntonio Nino Diaz	 * is to enable components of Trusted Firmware like SPDs using the old
23*73308618SAntonio 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
3512d0d00dSSoby Mathew	mov	x10, x30 // lr
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
4812d0d00dSSoby Mathew	mov	x9, x30 // lr
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	/* -----------------------------------------------------
55539a7b38SAchin Gupta	 * Per-cpu stacks in normal memory. Each cpu gets a
56539a7b38SAchin Gupta	 * stack of PLATFORM_STACK_SIZE bytes.
572bf28e62SAndrew Thoelke	 * -----------------------------------------------------
582bf28e62SAndrew Thoelke	 */
592bf28e62SAndrew Thoelkedeclare_stack platform_normal_stacks, tzfw_normal_stacks, \
60663db206SSoby Mathew		PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT, \
61663db206SSoby Mathew		CACHE_WRITEBACK_GRANULE
62