xref: /rk3399_ARM-atf/bl32/tsp/aarch64/tsp_request.S (revision 0a30cf54af7bb1f77b405062b1d5b44e809d0290)
17c88f3f6SAchin Gupta/*
27c88f3f6SAchin Gupta * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
37c88f3f6SAchin Gupta *
47c88f3f6SAchin Gupta * Redistribution and use in source and binary forms, with or without
57c88f3f6SAchin Gupta * modification, are permitted provided that the following conditions are met:
67c88f3f6SAchin Gupta *
77c88f3f6SAchin Gupta * Redistributions of source code must retain the above copyright notice, this
87c88f3f6SAchin Gupta * list of conditions and the following disclaimer.
97c88f3f6SAchin Gupta *
107c88f3f6SAchin Gupta * Redistributions in binary form must reproduce the above copyright notice,
117c88f3f6SAchin Gupta * this list of conditions and the following disclaimer in the documentation
127c88f3f6SAchin Gupta * and/or other materials provided with the distribution.
137c88f3f6SAchin Gupta *
147c88f3f6SAchin Gupta * Neither the name of ARM nor the names of its contributors may be used
157c88f3f6SAchin Gupta * to endorse or promote products derived from this software without specific
167c88f3f6SAchin Gupta * prior written permission.
177c88f3f6SAchin Gupta *
187c88f3f6SAchin Gupta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
197c88f3f6SAchin Gupta * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
207c88f3f6SAchin Gupta * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
217c88f3f6SAchin Gupta * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
227c88f3f6SAchin Gupta * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
237c88f3f6SAchin Gupta * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
247c88f3f6SAchin Gupta * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
257c88f3f6SAchin Gupta * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
267c88f3f6SAchin Gupta * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
277c88f3f6SAchin Gupta * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
287c88f3f6SAchin Gupta * POSSIBILITY OF SUCH DAMAGE.
297c88f3f6SAchin Gupta */
307c88f3f6SAchin Gupta
317c88f3f6SAchin Gupta#include <tsp.h>
32*0a30cf54SAndrew Thoelke#include <asm_macros.S>
337c88f3f6SAchin Gupta
347c88f3f6SAchin Gupta	.globl tsp_get_magic
357c88f3f6SAchin Gupta
367c88f3f6SAchin Gupta
377c88f3f6SAchin Gupta/*
387c88f3f6SAchin Gupta * This function raises an SMC to retrieve arguments from secure
397c88f3f6SAchin Gupta * monitor/dispatcher, saves the returned arguments the array received in x0,
407c88f3f6SAchin Gupta * and then returns to the caller
417c88f3f6SAchin Gupta */
42*0a30cf54SAndrew Thoelkefunc tsp_get_magic
437c88f3f6SAchin Gupta	/* Save address to stack */
447c88f3f6SAchin Gupta	stp	x0, xzr, [sp, #-16]!
457c88f3f6SAchin Gupta
467c88f3f6SAchin Gupta	/* Load arguments */
477c88f3f6SAchin Gupta	ldr	w0, _tsp_fid_get_magic
487c88f3f6SAchin Gupta
497c88f3f6SAchin Gupta	/* Raise SMC */
507c88f3f6SAchin Gupta	smc	#0
517c88f3f6SAchin Gupta
527c88f3f6SAchin Gupta	/* Restore address from stack */
537c88f3f6SAchin Gupta	ldp	x4, xzr, [sp], #16
547c88f3f6SAchin Gupta
557c88f3f6SAchin Gupta	/* Store returned arguments to the array */
567c88f3f6SAchin Gupta	stp	x0, x1, [x4, #0]
577c88f3f6SAchin Gupta
587c88f3f6SAchin Gupta	ret
597c88f3f6SAchin Gupta
607c88f3f6SAchin Gupta	.align 2
617c88f3f6SAchin Gupta_tsp_fid_get_magic:
627c88f3f6SAchin Gupta	.word	TSP_GET_ARGS
63