xref: /rk3399_ARM-atf/plat/common/aarch32/platform_up_stack.S (revision 75311203d8a4f8d543dae3399cfb1f33cfbef059)
11a0a3f06SYatharth Kochar/*
2*75311203Sdp-arm * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
31a0a3f06SYatharth Kochar *
41a0a3f06SYatharth Kochar * Redistribution and use in source and binary forms, with or without
51a0a3f06SYatharth Kochar * modification, are permitted provided that the following conditions are met:
61a0a3f06SYatharth Kochar *
71a0a3f06SYatharth Kochar * Redistributions of source code must retain the above copyright notice, this
81a0a3f06SYatharth Kochar * list of conditions and the following disclaimer.
91a0a3f06SYatharth Kochar *
101a0a3f06SYatharth Kochar * Redistributions in binary form must reproduce the above copyright notice,
111a0a3f06SYatharth Kochar * this list of conditions and the following disclaimer in the documentation
121a0a3f06SYatharth Kochar * and/or other materials provided with the distribution.
131a0a3f06SYatharth Kochar *
141a0a3f06SYatharth Kochar * Neither the name of ARM nor the names of its contributors may be used
151a0a3f06SYatharth Kochar * to endorse or promote products derived from this software without specific
161a0a3f06SYatharth Kochar * prior written permission.
171a0a3f06SYatharth Kochar *
181a0a3f06SYatharth Kochar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
191a0a3f06SYatharth Kochar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201a0a3f06SYatharth Kochar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211a0a3f06SYatharth Kochar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
221a0a3f06SYatharth Kochar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
231a0a3f06SYatharth Kochar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
241a0a3f06SYatharth Kochar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
251a0a3f06SYatharth Kochar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
261a0a3f06SYatharth Kochar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
271a0a3f06SYatharth Kochar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
281a0a3f06SYatharth Kochar * POSSIBILITY OF SUCH DAMAGE.
291a0a3f06SYatharth Kochar */
301a0a3f06SYatharth Kochar
311a0a3f06SYatharth Kochar#include <arch.h>
321a0a3f06SYatharth Kochar#include <asm_macros.S>
331a0a3f06SYatharth Kochar#include <platform_def.h>
341a0a3f06SYatharth Kochar
35*75311203Sdp-arm	.weak	plat_get_my_stack
36*75311203Sdp-arm	.weak	plat_set_my_stack
371a0a3f06SYatharth Kochar
381a0a3f06SYatharth Kochar	/* -----------------------------------------------------
391a0a3f06SYatharth Kochar	 * unsigned long plat_get_my_stack ()
401a0a3f06SYatharth Kochar	 *
411a0a3f06SYatharth Kochar	 * For cold-boot BL images, only the primary CPU needs
421a0a3f06SYatharth Kochar	 * a stack. This function returns the stack pointer for
431a0a3f06SYatharth Kochar	 * a stack allocated in normal memory.
441a0a3f06SYatharth Kochar	 * -----------------------------------------------------
451a0a3f06SYatharth Kochar	 */
461a0a3f06SYatharth Kocharfunc plat_get_my_stack
471a0a3f06SYatharth Kochar	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
481a0a3f06SYatharth Kochar	bx	lr
491a0a3f06SYatharth Kocharendfunc	plat_get_my_stack
501a0a3f06SYatharth Kochar
511a0a3f06SYatharth Kochar	/* -----------------------------------------------------
521a0a3f06SYatharth Kochar	 * void plat_set_my_stack ()
531a0a3f06SYatharth Kochar	 *
541a0a3f06SYatharth Kochar	 * For cold-boot BL images, only the primary CPU needs
551a0a3f06SYatharth Kochar	 * a stack. This function sets the stack pointer to a
561a0a3f06SYatharth Kochar	 * stack allocated in normal memory.
571a0a3f06SYatharth Kochar	 * -----------------------------------------------------
581a0a3f06SYatharth Kochar	 */
591a0a3f06SYatharth Kocharfunc plat_set_my_stack
601a0a3f06SYatharth Kochar	get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
611a0a3f06SYatharth Kochar	mov	sp, r0
621a0a3f06SYatharth Kochar	bx	lr
631a0a3f06SYatharth Kocharendfunc plat_set_my_stack
641a0a3f06SYatharth Kochar
651a0a3f06SYatharth Kochar	/* -----------------------------------------------------
661a0a3f06SYatharth Kochar	 * Per-cpu stacks in normal memory. Each cpu gets a
671a0a3f06SYatharth Kochar	 * stack of PLATFORM_STACK_SIZE bytes.
681a0a3f06SYatharth Kochar	 * -----------------------------------------------------
691a0a3f06SYatharth Kochar	 */
701a0a3f06SYatharth Kochardeclare_stack platform_normal_stacks, tzfw_normal_stacks, \
711a0a3f06SYatharth Kochar		PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
72