xref: /rk3399_ARM-atf/plat/common/aarch64/platform_up_stack.S (revision 4c0d03907652fdf9c66a02cec9ea7137ccccd2e9)
12bf28e62SAndrew Thoelke/*
2*4c0d0390SSoby Mathew * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved.
32bf28e62SAndrew Thoelke *
42bf28e62SAndrew Thoelke * Redistribution and use in source and binary forms, with or without
52bf28e62SAndrew Thoelke * modification, are permitted provided that the following conditions are met:
62bf28e62SAndrew Thoelke *
72bf28e62SAndrew Thoelke * Redistributions of source code must retain the above copyright notice, this
82bf28e62SAndrew Thoelke * list of conditions and the following disclaimer.
92bf28e62SAndrew Thoelke *
102bf28e62SAndrew Thoelke * Redistributions in binary form must reproduce the above copyright notice,
112bf28e62SAndrew Thoelke * this list of conditions and the following disclaimer in the documentation
122bf28e62SAndrew Thoelke * and/or other materials provided with the distribution.
132bf28e62SAndrew Thoelke *
142bf28e62SAndrew Thoelke * Neither the name of ARM nor the names of its contributors may be used
152bf28e62SAndrew Thoelke * to endorse or promote products derived from this software without specific
162bf28e62SAndrew Thoelke * prior written permission.
172bf28e62SAndrew Thoelke *
182bf28e62SAndrew Thoelke * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
192bf28e62SAndrew Thoelke * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
202bf28e62SAndrew Thoelke * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
212bf28e62SAndrew Thoelke * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
222bf28e62SAndrew Thoelke * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
232bf28e62SAndrew Thoelke * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
242bf28e62SAndrew Thoelke * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
252bf28e62SAndrew Thoelke * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
262bf28e62SAndrew Thoelke * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
272bf28e62SAndrew Thoelke * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
282bf28e62SAndrew Thoelke * POSSIBILITY OF SUCH DAMAGE.
292bf28e62SAndrew Thoelke */
302bf28e62SAndrew Thoelke
312bf28e62SAndrew Thoelke#include <arch.h>
322bf28e62SAndrew Thoelke#include <asm_macros.S>
335f0cdb05SDan Handley#include <platform_def.h>
342bf28e62SAndrew Thoelke
352bf28e62SAndrew Thoelke
362bf28e62SAndrew Thoelke	.local	platform_normal_stacks
3712d0d00dSSoby Mathew	.globl	plat_set_my_stack
3812d0d00dSSoby Mathew	.globl	plat_get_my_stack
392bf28e62SAndrew Thoelke	.globl	platform_set_stack
402bf28e62SAndrew Thoelke	.globl	platform_get_stack
412bf28e62SAndrew Thoelke
422bf28e62SAndrew Thoelke	/* -----------------------------------------------------
43*4c0d0390SSoby Mathew	 * uintptr_t plat_get_my_stack ()
442bf28e62SAndrew Thoelke	 *
452bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
462bf28e62SAndrew Thoelke	 * stack. This function returns the stack pointer for a
472bf28e62SAndrew Thoelke	 * stack allocated in device memory.
482bf28e62SAndrew Thoelke	 * -----------------------------------------------------
492bf28e62SAndrew Thoelke	 */
5012d0d00dSSoby Mathewfunc plat_get_my_stack
512bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
522bf28e62SAndrew Thoelke	ret
5312d0d00dSSoby Mathewendfunc plat_get_my_stack
542bf28e62SAndrew Thoelke
552bf28e62SAndrew Thoelke	/* -----------------------------------------------------
5612d0d00dSSoby Mathew	 * void plat_set_my_stack ()
572bf28e62SAndrew Thoelke	 *
582bf28e62SAndrew Thoelke	 * For cold-boot BL images, only the primary CPU needs a
592bf28e62SAndrew Thoelke	 * stack. This function sets the stack pointer to a stack
602bf28e62SAndrew Thoelke	 * allocated in normal memory.
612bf28e62SAndrew Thoelke	 * -----------------------------------------------------
622bf28e62SAndrew Thoelke	 */
6312d0d00dSSoby Mathewfunc plat_set_my_stack
642bf28e62SAndrew Thoelke	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
652bf28e62SAndrew Thoelke	mov sp, x0
662bf28e62SAndrew Thoelke	ret
6712d0d00dSSoby Mathewendfunc plat_set_my_stack
682bf28e62SAndrew Thoelke
692bf28e62SAndrew Thoelke	/* -----------------------------------------------------
705c8babcdSSoby Mathew	 * unsigned long platform_get_stack ()
715c8babcdSSoby Mathew	 *
725c8babcdSSoby Mathew	 * For cold-boot BL images, only the primary CPU needs a
735c8babcdSSoby Mathew	 * stack. This function returns the stack pointer for a
745c8babcdSSoby Mathew	 * stack allocated in device memory. This function
755c8babcdSSoby Mathew	 * is deprecated.
765c8babcdSSoby Mathew	 * -----------------------------------------------------
775c8babcdSSoby Mathew	 */
785c8babcdSSoby Mathewfunc_deprecated platform_get_stack
795c8babcdSSoby Mathew	b	plat_get_my_stack
805c8babcdSSoby Mathewendfunc_deprecated platform_get_stack
815c8babcdSSoby Mathew
825c8babcdSSoby Mathew	/* -----------------------------------------------------
835c8babcdSSoby Mathew	 * void platform_set_stack ()
845c8babcdSSoby Mathew	 *
855c8babcdSSoby Mathew	 * For cold-boot BL images, only the primary CPU needs a
865c8babcdSSoby Mathew	 * stack. This function sets the stack pointer to a stack
875c8babcdSSoby Mathew	 * allocated in normal memory.This function is
885c8babcdSSoby Mathew	 * deprecated.
895c8babcdSSoby Mathew	 * -----------------------------------------------------
905c8babcdSSoby Mathew	 */
915c8babcdSSoby Mathewfunc_deprecated platform_set_stack
925c8babcdSSoby Mathew	b	plat_set_my_stack
935c8babcdSSoby Mathewendfunc_deprecated platform_set_stack
945c8babcdSSoby Mathew
955c8babcdSSoby Mathew	/* -----------------------------------------------------
962bf28e62SAndrew Thoelke	 * Single cpu stack in normal memory.
972bf28e62SAndrew Thoelke	 * Used for C code during boot, PLATFORM_STACK_SIZE bytes
982bf28e62SAndrew Thoelke	 * are allocated
992bf28e62SAndrew Thoelke	 * -----------------------------------------------------
1002bf28e62SAndrew Thoelke	 */
1012bf28e62SAndrew Thoelkedeclare_stack platform_normal_stacks, tzfw_normal_stacks, \
102663db206SSoby Mathew		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
103