Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Andrew Thoelke | 38bde41 | 2014-03-18 13:46:55 +0000 | [diff] [blame] | 7 | #include <asm_macros.S> |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 8 | #include <tsp.h> |
Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 9 | |
| 10 | .globl tsp_get_magic |
| 11 | |
Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 12 | |
| 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 Thoelke | 38bde41 | 2014-03-18 13:46:55 +0000 | [diff] [blame] | 18 | func tsp_get_magic |
Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 19 | /* 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 Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 33 | |
| 34 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 35 | endfunc tsp_get_magic |
Achin Gupta | 7c88f3f | 2014-02-18 18:09:12 +0000 | [diff] [blame] | 36 | |
| 37 | .align 2 |
| 38 | _tsp_fid_get_magic: |
| 39 | .word TSP_GET_ARGS |