1*7c88f3f6SAchin Gupta/* 2*7c88f3f6SAchin Gupta * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 3*7c88f3f6SAchin Gupta * 4*7c88f3f6SAchin Gupta * Redistribution and use in source and binary forms, with or without 5*7c88f3f6SAchin Gupta * modification, are permitted provided that the following conditions are met: 6*7c88f3f6SAchin Gupta * 7*7c88f3f6SAchin Gupta * Redistributions of source code must retain the above copyright notice, this 8*7c88f3f6SAchin Gupta * list of conditions and the following disclaimer. 9*7c88f3f6SAchin Gupta * 10*7c88f3f6SAchin Gupta * Redistributions in binary form must reproduce the above copyright notice, 11*7c88f3f6SAchin Gupta * this list of conditions and the following disclaimer in the documentation 12*7c88f3f6SAchin Gupta * and/or other materials provided with the distribution. 13*7c88f3f6SAchin Gupta * 14*7c88f3f6SAchin Gupta * Neither the name of ARM nor the names of its contributors may be used 15*7c88f3f6SAchin Gupta * to endorse or promote products derived from this software without specific 16*7c88f3f6SAchin Gupta * prior written permission. 17*7c88f3f6SAchin Gupta * 18*7c88f3f6SAchin Gupta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*7c88f3f6SAchin Gupta * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*7c88f3f6SAchin Gupta * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*7c88f3f6SAchin Gupta * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*7c88f3f6SAchin Gupta * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*7c88f3f6SAchin Gupta * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*7c88f3f6SAchin Gupta * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*7c88f3f6SAchin Gupta * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*7c88f3f6SAchin Gupta * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*7c88f3f6SAchin Gupta * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*7c88f3f6SAchin Gupta * POSSIBILITY OF SUCH DAMAGE. 29*7c88f3f6SAchin Gupta */ 30*7c88f3f6SAchin Gupta 31*7c88f3f6SAchin Gupta#include <tsp.h> 32*7c88f3f6SAchin Gupta 33*7c88f3f6SAchin Gupta .globl tsp_get_magic 34*7c88f3f6SAchin Gupta 35*7c88f3f6SAchin Gupta .section .text, "ax"; .align 3 36*7c88f3f6SAchin Gupta 37*7c88f3f6SAchin Gupta 38*7c88f3f6SAchin Gupta/* 39*7c88f3f6SAchin Gupta * This function raises an SMC to retrieve arguments from secure 40*7c88f3f6SAchin Gupta * monitor/dispatcher, saves the returned arguments the array received in x0, 41*7c88f3f6SAchin Gupta * and then returns to the caller 42*7c88f3f6SAchin Gupta */ 43*7c88f3f6SAchin Guptatsp_get_magic: 44*7c88f3f6SAchin Gupta /* Save address to stack */ 45*7c88f3f6SAchin Gupta stp x0, xzr, [sp, #-16]! 46*7c88f3f6SAchin Gupta 47*7c88f3f6SAchin Gupta /* Load arguments */ 48*7c88f3f6SAchin Gupta ldr w0, _tsp_fid_get_magic 49*7c88f3f6SAchin Gupta 50*7c88f3f6SAchin Gupta /* Raise SMC */ 51*7c88f3f6SAchin Gupta smc #0 52*7c88f3f6SAchin Gupta 53*7c88f3f6SAchin Gupta /* Restore address from stack */ 54*7c88f3f6SAchin Gupta ldp x4, xzr, [sp], #16 55*7c88f3f6SAchin Gupta 56*7c88f3f6SAchin Gupta /* Store returned arguments to the array */ 57*7c88f3f6SAchin Gupta stp x0, x1, [x4, #0] 58*7c88f3f6SAchin Gupta stp x2, x3, [x4, #16] 59*7c88f3f6SAchin Gupta 60*7c88f3f6SAchin Gupta ret 61*7c88f3f6SAchin Gupta 62*7c88f3f6SAchin Gupta .align 2 63*7c88f3f6SAchin Gupta_tsp_fid_get_magic: 64*7c88f3f6SAchin Gupta .word TSP_GET_ARGS 65