xref: /rk3399_ARM-atf/bl32/tsp/aarch64/tsp_request.S (revision 82cb2c1ad9897473743f08437d0a3995bed561b9)
17c88f3f6SAchin Gupta/*
27c88f3f6SAchin Gupta * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
37c88f3f6SAchin Gupta *
4*82cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause
57c88f3f6SAchin Gupta */
67c88f3f6SAchin Gupta
70a30cf54SAndrew Thoelke#include <asm_macros.S>
897043ac9SDan Handley#include <tsp.h>
97c88f3f6SAchin Gupta
107c88f3f6SAchin Gupta	.globl tsp_get_magic
117c88f3f6SAchin Gupta
127c88f3f6SAchin Gupta
137c88f3f6SAchin Gupta/*
147c88f3f6SAchin Gupta * This function raises an SMC to retrieve arguments from secure
157c88f3f6SAchin Gupta * monitor/dispatcher, saves the returned arguments the array received in x0,
167c88f3f6SAchin Gupta * and then returns to the caller
177c88f3f6SAchin Gupta */
180a30cf54SAndrew Thoelkefunc tsp_get_magic
197c88f3f6SAchin Gupta	/* Save address to stack */
207c88f3f6SAchin Gupta	stp	x0, xzr, [sp, #-16]!
217c88f3f6SAchin Gupta
227c88f3f6SAchin Gupta	/* Load arguments */
237c88f3f6SAchin Gupta	ldr	w0, _tsp_fid_get_magic
247c88f3f6SAchin Gupta
257c88f3f6SAchin Gupta	/* Raise SMC */
267c88f3f6SAchin Gupta	smc	#0
277c88f3f6SAchin Gupta
287c88f3f6SAchin Gupta	/* Restore address from stack */
297c88f3f6SAchin Gupta	ldp	x4, xzr, [sp], #16
307c88f3f6SAchin Gupta
317c88f3f6SAchin Gupta	/* Store returned arguments to the array */
327c88f3f6SAchin Gupta	stp	x0, x1, [x4, #0]
337c88f3f6SAchin Gupta
347c88f3f6SAchin Gupta	ret
358b779620SKévin Petitendfunc tsp_get_magic
367c88f3f6SAchin Gupta
377c88f3f6SAchin Gupta	.align 2
387c88f3f6SAchin Gupta_tsp_fid_get_magic:
397c88f3f6SAchin Gupta	.word	TSP_GET_ARGS
40