xref: /rk3399_ARM-atf/plat/common/aarch64/platform_up_stack.S (revision 338dbe2f1f4b98da260e556d3f0fbdd8123caf06)
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>
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
152bf28e62SAndrew Thoelke
162bf28e62SAndrew Thoelke	/* -----------------------------------------------------
174c0d0390SSoby Mathew	 * uintptr_t plat_get_my_stack ()
182bf28e62SAndrew Thoelke	 *
192bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
202bf28e62SAndrew Thoelke	 * stack. This function returns the stack pointer for a
212bf28e62SAndrew Thoelke	 * stack allocated in device memory.
222bf28e62SAndrew Thoelke	 * -----------------------------------------------------
232bf28e62SAndrew Thoelke	 */
2412d0d00dSSoby Mathewfunc plat_get_my_stack
252bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
262bf28e62SAndrew Thoelke	ret
2712d0d00dSSoby Mathewendfunc plat_get_my_stack
282bf28e62SAndrew Thoelke
292bf28e62SAndrew Thoelke	/* -----------------------------------------------------
3012d0d00dSSoby Mathew	 * void plat_set_my_stack ()
312bf28e62SAndrew Thoelke	 *
322bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
332bf28e62SAndrew Thoelke	 * stack. This function sets the stack pointer to a stack
342bf28e62SAndrew Thoelke	 * allocated in normal memory.
352bf28e62SAndrew Thoelke	 * -----------------------------------------------------
362bf28e62SAndrew Thoelke	 */
3712d0d00dSSoby Mathewfunc plat_set_my_stack
382bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
392bf28e62SAndrew Thoelke	mov sp, x0
402bf28e62SAndrew Thoelke	ret
4112d0d00dSSoby Mathewendfunc plat_set_my_stack
422bf28e62SAndrew Thoelke
432bf28e62SAndrew Thoelke	/* -----------------------------------------------------
442bf28e62SAndrew Thoelke	 * Single cpu stack in normal memory.
452bf28e62SAndrew Thoelke	 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
462bf28e62SAndrew Thoelke	 * are allocated
472bf28e62SAndrew Thoelke	 * -----------------------------------------------------
482bf28e62SAndrew Thoelke	 */
49*da04341eSChris Kaydeclare_stack platform_normal_stacks, .tzfw_normal_stacks, \
50663db206SSoby Mathew		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
51