blob: b11baa8c1dffd716f6df659c4986e4b7950deeb5 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Olivier Deprez3e1a2952020-03-12 15:44:17 +01002 * Copyright (c) 2013-2020, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <asm_macros.S>
8
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02009 .section .text, "ax"
10
Olivier Deprez3e1a2952020-03-12 15:44:17 +010011 .macro smccc_conduit _conduit
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020012
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020013 /*
14 * According to the AAPCS64, x8 is the indirect result location
15 * register. It contains the address of the memory block that the caller
16 * has reserved to hold the result, i.e. the smc_ret_values structure
17 * in our case.
18 * x8 might be clobbered across the SMC call so save it on the stack.
19 * Although x8 contains an 8 byte value, we are allocating 16bytes on the stack
20 * to respect 16byte stack-alignment.
21 */
22 str x8, [sp, #-16]!
23
Olivier Deprez3e1a2952020-03-12 15:44:17 +010024 /* "Conduit" arguments are already stored in x0-x7 */
25 \_conduit #0
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020026
27 /* Pop x8 into a caller-saved register */
28 ldr x9, [sp], #16
29
30 /*
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -060031 * Return values are stored in x0-x7, put them in the 'smc_ret_values'
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020032 * return structure
33 */
34 stp x0, x1, [x9, #0]
35 stp x2, x3, [x9, #16]
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -060036 stp x4, x5, [x9, #32]
37 stp x6, x7, [x9, #48]
Olivier Deprez3e1a2952020-03-12 15:44:17 +010038
39 .endm
40
41/* ---------------------------------------------------------------------------
42 * smc_ret_values asm_tftf_smc64(uint32_t fid,
43 * u_register_t arg1,
44 * u_register_t arg2,
45 * u_register_t arg3,
46 * u_register_t arg4,
47 * u_register_t arg5,
48 * u_register_t arg6,
49 * u_register_t arg7);
50 * ---------------------------------------------------------------------------
51 */
52 .globl asm_tftf_smc64
53
54func asm_tftf_smc64
55 smccc_conduit smc
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020056 ret
57endfunc asm_tftf_smc64
Olivier Deprez3e1a2952020-03-12 15:44:17 +010058
59/* ---------------------------------------------------------------------------
60 * hvc_ret_values asm_tftf_hvcc64(uint32_t fid,
61 * u_register_t arg1,
62 * u_register_t arg2,
63 * u_register_t arg3,
64 * u_register_t arg4,
65 * u_register_t arg5,
66 * u_register_t arg6,
67 * u_register_t arg7);
68 * ---------------------------------------------------------------------------
69 */
70 .globl asm_tftf_hvc64
71
72func asm_tftf_hvc64
73 smccc_conduit hvc
74 ret
75endfunc asm_tftf_hvc64