1*1a0a3f06SYatharth Kochar/* 2*1a0a3f06SYatharth Kochar * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. 3*1a0a3f06SYatharth Kochar * 4*1a0a3f06SYatharth Kochar * Redistribution and use in source and binary forms, with or without 5*1a0a3f06SYatharth Kochar * modification, are permitted provided that the following conditions are met: 6*1a0a3f06SYatharth Kochar * 7*1a0a3f06SYatharth Kochar * Redistributions of source code must retain the above copyright notice, this 8*1a0a3f06SYatharth Kochar * list of conditions and the following disclaimer. 9*1a0a3f06SYatharth Kochar * 10*1a0a3f06SYatharth Kochar * Redistributions in binary form must reproduce the above copyright notice, 11*1a0a3f06SYatharth Kochar * this list of conditions and the following disclaimer in the documentation 12*1a0a3f06SYatharth Kochar * and/or other materials provided with the distribution. 13*1a0a3f06SYatharth Kochar * 14*1a0a3f06SYatharth Kochar * Neither the name of ARM nor the names of its contributors may be used 15*1a0a3f06SYatharth Kochar * to endorse or promote products derived from this software without specific 16*1a0a3f06SYatharth Kochar * prior written permission. 17*1a0a3f06SYatharth Kochar * 18*1a0a3f06SYatharth Kochar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*1a0a3f06SYatharth Kochar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*1a0a3f06SYatharth Kochar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*1a0a3f06SYatharth Kochar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*1a0a3f06SYatharth Kochar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*1a0a3f06SYatharth Kochar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*1a0a3f06SYatharth Kochar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*1a0a3f06SYatharth Kochar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*1a0a3f06SYatharth Kochar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*1a0a3f06SYatharth Kochar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*1a0a3f06SYatharth Kochar * POSSIBILITY OF SUCH DAMAGE. 29*1a0a3f06SYatharth Kochar */ 30*1a0a3f06SYatharth Kochar 31*1a0a3f06SYatharth Kochar#include <arch.h> 32*1a0a3f06SYatharth Kochar#include <asm_macros.S> 33*1a0a3f06SYatharth Kochar#include <platform_def.h> 34*1a0a3f06SYatharth Kochar 35*1a0a3f06SYatharth Kochar .globl plat_get_my_stack 36*1a0a3f06SYatharth Kochar .globl plat_set_my_stack 37*1a0a3f06SYatharth Kochar 38*1a0a3f06SYatharth Kochar /* ----------------------------------------------------- 39*1a0a3f06SYatharth Kochar * unsigned long plat_get_my_stack () 40*1a0a3f06SYatharth Kochar * 41*1a0a3f06SYatharth Kochar * For cold-boot BL images, only the primary CPU needs 42*1a0a3f06SYatharth Kochar * a stack. This function returns the stack pointer for 43*1a0a3f06SYatharth Kochar * a stack allocated in normal memory. 44*1a0a3f06SYatharth Kochar * ----------------------------------------------------- 45*1a0a3f06SYatharth Kochar */ 46*1a0a3f06SYatharth Kocharfunc plat_get_my_stack 47*1a0a3f06SYatharth Kochar get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE 48*1a0a3f06SYatharth Kochar bx lr 49*1a0a3f06SYatharth Kocharendfunc plat_get_my_stack 50*1a0a3f06SYatharth Kochar 51*1a0a3f06SYatharth Kochar /* ----------------------------------------------------- 52*1a0a3f06SYatharth Kochar * void plat_set_my_stack () 53*1a0a3f06SYatharth Kochar * 54*1a0a3f06SYatharth Kochar * For cold-boot BL images, only the primary CPU needs 55*1a0a3f06SYatharth Kochar * a stack. This function sets the stack pointer to a 56*1a0a3f06SYatharth Kochar * stack allocated in normal memory. 57*1a0a3f06SYatharth Kochar * ----------------------------------------------------- 58*1a0a3f06SYatharth Kochar */ 59*1a0a3f06SYatharth Kocharfunc plat_set_my_stack 60*1a0a3f06SYatharth Kochar get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE 61*1a0a3f06SYatharth Kochar mov sp, r0 62*1a0a3f06SYatharth Kochar bx lr 63*1a0a3f06SYatharth Kocharendfunc plat_set_my_stack 64*1a0a3f06SYatharth Kochar 65*1a0a3f06SYatharth Kochar /* ----------------------------------------------------- 66*1a0a3f06SYatharth Kochar * Per-cpu stacks in normal memory. Each cpu gets a 67*1a0a3f06SYatharth Kochar * stack of PLATFORM_STACK_SIZE bytes. 68*1a0a3f06SYatharth Kochar * ----------------------------------------------------- 69*1a0a3f06SYatharth Kochar */ 70*1a0a3f06SYatharth Kochardeclare_stack platform_normal_stacks, tzfw_normal_stacks, \ 71*1a0a3f06SYatharth Kochar PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE 72