12bf28e62SAndrew Thoelke/* 22bf28e62SAndrew Thoelke * Copyright (c) 2014, 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 37*12d0d00dSSoby Mathew .globl plat_set_my_stack 38*12d0d00dSSoby Mathew .globl plat_get_my_stack 392bf28e62SAndrew Thoelke .globl platform_set_stack 402bf28e62SAndrew Thoelke .globl platform_get_stack 412bf28e62SAndrew Thoelke 422bf28e62SAndrew Thoelke /* ----------------------------------------------------- 43*12d0d00dSSoby Mathew * unsigned long plat_get_my_stack () 442bf28e62SAndrew Thoelke * unsigned long platform_get_stack (unsigned long) 452bf28e62SAndrew Thoelke * 462bf28e62SAndrew Thoelke * For cold-boot BL images, only the primary CPU needs a 472bf28e62SAndrew Thoelke * stack. This function returns the stack pointer for a 482bf28e62SAndrew Thoelke * stack allocated in device memory. 492bf28e62SAndrew Thoelke * ----------------------------------------------------- 502bf28e62SAndrew Thoelke */ 51*12d0d00dSSoby Mathewfunc plat_get_my_stack 52*12d0d00dSSoby Mathewplatform_get_stack: 532bf28e62SAndrew Thoelke get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE 542bf28e62SAndrew Thoelke ret 55*12d0d00dSSoby Mathewendfunc plat_get_my_stack 562bf28e62SAndrew Thoelke 572bf28e62SAndrew Thoelke /* ----------------------------------------------------- 58*12d0d00dSSoby Mathew * void plat_set_my_stack () 592bf28e62SAndrew Thoelke * void platform_set_stack (unsigned long) 602bf28e62SAndrew Thoelke * 612bf28e62SAndrew Thoelke * For cold-boot BL images, only the primary CPU needs a 622bf28e62SAndrew Thoelke * stack. This function sets the stack pointer to a stack 632bf28e62SAndrew Thoelke * allocated in normal memory. 642bf28e62SAndrew Thoelke * ----------------------------------------------------- 652bf28e62SAndrew Thoelke */ 66*12d0d00dSSoby Mathewfunc plat_set_my_stack 67*12d0d00dSSoby Mathewplatform_set_stack: 682bf28e62SAndrew Thoelke get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE 692bf28e62SAndrew Thoelke mov sp, x0 702bf28e62SAndrew Thoelke ret 71*12d0d00dSSoby Mathewendfunc plat_set_my_stack 722bf28e62SAndrew Thoelke 732bf28e62SAndrew Thoelke /* ----------------------------------------------------- 742bf28e62SAndrew Thoelke * Single cpu stack in normal memory. 752bf28e62SAndrew Thoelke * Used for C code during boot, PLATFORM_STACK_SIZE bytes 762bf28e62SAndrew Thoelke * are allocated 772bf28e62SAndrew Thoelke * ----------------------------------------------------- 782bf28e62SAndrew Thoelke */ 792bf28e62SAndrew Thoelkedeclare_stack platform_normal_stacks, tzfw_normal_stacks, \ 802bf28e62SAndrew Thoelke PLATFORM_STACK_SIZE, 1 81