xref: /rk3399_ARM-atf/plat/common/aarch64/platform_up_stack.S (revision 82cb2c1ad9897473743f08437d0a3995bed561b9)
12bf28e62SAndrew Thoelke/*
275311203Sdp-arm * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
32bf28e62SAndrew Thoelke *
4*82cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause
52bf28e62SAndrew Thoelke */
62bf28e62SAndrew Thoelke
72bf28e62SAndrew Thoelke#include <arch.h>
82bf28e62SAndrew Thoelke#include <asm_macros.S>
95f0cdb05SDan Handley#include <platform_def.h>
102bf28e62SAndrew Thoelke
112bf28e62SAndrew Thoelke
122bf28e62SAndrew Thoelke	.local	platform_normal_stacks
1375311203Sdp-arm	.weak	plat_set_my_stack
1475311203Sdp-arm	.weak	plat_get_my_stack
1575311203Sdp-arm	.weak	platform_set_stack
1675311203Sdp-arm	.weak	platform_get_stack
172bf28e62SAndrew Thoelke
182bf28e62SAndrew Thoelke	/* -----------------------------------------------------
194c0d0390SSoby Mathew	 * uintptr_t plat_get_my_stack ()
202bf28e62SAndrew Thoelke	 *
212bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
222bf28e62SAndrew Thoelke	 * stack. This function returns the stack pointer for a
232bf28e62SAndrew Thoelke	 * stack allocated in device memory.
242bf28e62SAndrew Thoelke	 * -----------------------------------------------------
252bf28e62SAndrew Thoelke	 */
2612d0d00dSSoby Mathewfunc plat_get_my_stack
272bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
282bf28e62SAndrew Thoelke	ret
2912d0d00dSSoby Mathewendfunc plat_get_my_stack
302bf28e62SAndrew Thoelke
312bf28e62SAndrew Thoelke	/* -----------------------------------------------------
3212d0d00dSSoby Mathew	 * void plat_set_my_stack ()
332bf28e62SAndrew Thoelke	 *
342bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
352bf28e62SAndrew Thoelke	 * stack. This function sets the stack pointer to a stack
362bf28e62SAndrew Thoelke	 * allocated in normal memory.
372bf28e62SAndrew Thoelke	 * -----------------------------------------------------
382bf28e62SAndrew Thoelke	 */
3912d0d00dSSoby Mathewfunc plat_set_my_stack
402bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
412bf28e62SAndrew Thoelke	mov sp, x0
422bf28e62SAndrew Thoelke	ret
4312d0d00dSSoby Mathewendfunc plat_set_my_stack
442bf28e62SAndrew Thoelke
452bf28e62SAndrew Thoelke	/* -----------------------------------------------------
465c8babcdSSoby Mathew	 * unsigned long platform_get_stack ()
475c8babcdSSoby Mathew	 *
485c8babcdSSoby Mathew	 * For cold-boot BL images, only the primary CPU needs a
495c8babcdSSoby Mathew	 * stack. This function returns the stack pointer for a
505c8babcdSSoby Mathew	 * stack allocated in device memory. This function
515c8babcdSSoby Mathew	 * is deprecated.
525c8babcdSSoby Mathew	 * -----------------------------------------------------
535c8babcdSSoby Mathew	 */
545c8babcdSSoby Mathewfunc_deprecated platform_get_stack
555c8babcdSSoby Mathew	b	plat_get_my_stack
565c8babcdSSoby Mathewendfunc_deprecated platform_get_stack
575c8babcdSSoby Mathew
585c8babcdSSoby Mathew	/* -----------------------------------------------------
595c8babcdSSoby Mathew	 * void platform_set_stack ()
605c8babcdSSoby Mathew	 *
615c8babcdSSoby Mathew	 * For cold-boot BL images, only the primary CPU needs a
625c8babcdSSoby Mathew	 * stack. This function sets the stack pointer to a stack
635c8babcdSSoby Mathew	 * allocated in normal memory.This function is
645c8babcdSSoby Mathew	 * deprecated.
655c8babcdSSoby Mathew	 * -----------------------------------------------------
665c8babcdSSoby Mathew	 */
675c8babcdSSoby Mathewfunc_deprecated platform_set_stack
685c8babcdSSoby Mathew	b	plat_set_my_stack
695c8babcdSSoby Mathewendfunc_deprecated platform_set_stack
705c8babcdSSoby Mathew
715c8babcdSSoby Mathew	/* -----------------------------------------------------
722bf28e62SAndrew Thoelke	 * Single cpu stack in normal memory.
732bf28e62SAndrew Thoelke	 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
742bf28e62SAndrew Thoelke	 * are allocated
752bf28e62SAndrew Thoelke	 * -----------------------------------------------------
762bf28e62SAndrew Thoelke	 */
772bf28e62SAndrew Thoelkedeclare_stack platform_normal_stacks, tzfw_normal_stacks, \
78663db206SSoby Mathew		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
79