blob: 2261f87f9cde746b85fbe3691661e5651f1c447d [file] [log] [blame]
Achin Gupta7c88f3f2014-02-18 18:09:12 +00001/*
2 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta7c88f3f2014-02-18 18:09:12 +00005 */
6
Andrew Thoelke38bde412014-03-18 13:46:55 +00007#include <asm_macros.S>
Dan Handley2bd4ef22014-04-09 13:14:54 +01008#include <tsp.h>
Achin Gupta7c88f3f2014-02-18 18:09:12 +00009
10 .globl tsp_get_magic
11
Achin Gupta7c88f3f2014-02-18 18:09:12 +000012
13/*
14 * This function raises an SMC to retrieve arguments from secure
15 * monitor/dispatcher, saves the returned arguments the array received in x0,
16 * and then returns to the caller
17 */
Andrew Thoelke38bde412014-03-18 13:46:55 +000018func tsp_get_magic
Achin Gupta7c88f3f2014-02-18 18:09:12 +000019 /* Save address to stack */
20 stp x0, xzr, [sp, #-16]!
21
22 /* Load arguments */
23 ldr w0, _tsp_fid_get_magic
24
25 /* Raise SMC */
26 smc #0
27
28 /* Restore address from stack */
29 ldp x4, xzr, [sp], #16
30
31 /* Store returned arguments to the array */
32 stp x0, x1, [x4, #0]
Achin Gupta7c88f3f2014-02-18 18:09:12 +000033
34 ret
Kévin Petita877c252015-03-24 14:03:57 +000035endfunc tsp_get_magic
Achin Gupta7c88f3f2014-02-18 18:09:12 +000036
37 .align 2
38_tsp_fid_get_magic:
39 .word TSP_GET_ARGS