blob: 6d98ffb126be881f5880143b783e9afa97fe7530 [file] [log] [blame]
Mate Toth-Pal2611c552023-02-28 10:28:32 +01001/*
2 * SPDX-License-Identifier: BSD-3-Clause
3 * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4 */
5
6#include <host_rmi_wrappers.h>
7
8/* Declaring SMC handler */
9void handle_ns_smc(unsigned long function_id,
10 unsigned long arg0,
11 unsigned long arg1,
12 unsigned long arg2,
13 unsigned long arg3,
14 unsigned long arg4,
15 unsigned long arg5,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010016 struct smc_result *res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010017
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010018void host_rmi_granule_delegate(void *granule_address, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010019{
20 handle_ns_smc(SMC_RMM_GRANULE_DELEGATE,
21 (uintptr_t)granule_address,
22 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010023 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010024}
25
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010026void host_rmi_granule_undelegate(void *granule_address, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010027{
28 handle_ns_smc(SMC_RMM_GRANULE_UNDELEGATE,
29 (uintptr_t)granule_address,
30 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010031 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010032}
33
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010034void host_rmi_realm_create(void *rd, void *params_ptr, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010035{
36 handle_ns_smc(SMC_RMM_REALM_CREATE,
37 (uintptr_t)rd,
38 (uintptr_t)params_ptr,
39 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010040 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010041}
42
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010043void host_rmi_realm_destroy(void *rd, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010044{
45 handle_ns_smc(SMC_RMM_REALM_DESTROY,
46 (uintptr_t)rd,
47 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010048 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010049}
50
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010051void host_rmi_rtt_create(void *rd, void *rtt, void *ipa, unsigned int level, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010052{
53 handle_ns_smc(SMC_RMM_RTT_CREATE,
Mate Toth-Pal2611c552023-02-28 10:28:32 +010054 (uintptr_t)rd,
AlexeiFedorovac923c82023-04-06 15:12:04 +010055 (uintptr_t)rtt,
Mate Toth-Pal2611c552023-02-28 10:28:32 +010056 (uintptr_t)ipa,
57 level,
58 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010059 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010060}
61
AlexeiFedorove2002be2023-04-19 17:20:12 +010062void host_rmi_rtt_destroy(void *rd, void *ipa, unsigned int level,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010063 struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010064{
65 handle_ns_smc(SMC_RMM_RTT_DESTROY,
Mate Toth-Pal2611c552023-02-28 10:28:32 +010066 (uintptr_t)rd,
67 (uintptr_t)ipa,
68 level,
AlexeiFedorove2002be2023-04-19 17:20:12 +010069 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010070 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010071}
72
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010073void host_rmi_rec_aux_count(void *rd, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010074{
75 handle_ns_smc(SMC_RMM_REC_AUX_COUNT,
76 (uintptr_t)rd,
77 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010078 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010079}
80
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010081void host_rmi_rec_create(void *rd, void *rec, void *params_ptr, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010082{
83 handle_ns_smc(SMC_RMM_REC_CREATE,
Mate Toth-Pal2611c552023-02-28 10:28:32 +010084 (uintptr_t)rd,
AlexeiFedorovac923c82023-04-06 15:12:04 +010085 (uintptr_t)rec,
Mate Toth-Pal2611c552023-02-28 10:28:32 +010086 (uintptr_t)params_ptr,
87 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010088 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010089}
90
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010091void host_rmi_rec_destroy(void *rec, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +010092{
93 handle_ns_smc(SMC_RMM_REC_DESTROY,
94 (uintptr_t)rec,
95 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010096 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +010097}
98
AlexeiFedorovccce3ad2023-04-28 18:29:47 +010099void host_rmi_realm_activate(void *rd, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +0100100{
101 handle_ns_smc(SMC_RMM_REALM_ACTIVATE,
102 (uintptr_t)rd,
103 0, 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100104 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +0100105}
106
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100107void host_rmi_rec_enter(void *rec, void *run_ptr, struct smc_result *res)
Mate Toth-Pal2611c552023-02-28 10:28:32 +0100108{
109 handle_ns_smc(SMC_RMM_REC_ENTER,
110 (uintptr_t)rec,
111 (uintptr_t)run_ptr,
112 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100113 res);
Mate Toth-Pal2611c552023-02-28 10:28:32 +0100114}
Soby Mathew76e9b452023-05-16 15:11:34 +0100115
116void host_rmi_data_create(uintptr_t data, void *rd, uintptr_t ipa,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100117 uintptr_t src, struct smc_result *res)
Soby Mathew76e9b452023-05-16 15:11:34 +0100118{
119 handle_ns_smc(SMC_RMM_DATA_CREATE,
120 (uintptr_t)data,
121 (uintptr_t)rd, ipa, src,
122 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100123 res);
Soby Mathew76e9b452023-05-16 15:11:34 +0100124}
125
AlexeiFedorovac923c82023-04-06 15:12:04 +0100126void host_rmi_data_create_unknown(void *rd, uintptr_t data, uintptr_t ipa,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100127 struct smc_result *res)
Soby Mathew76e9b452023-05-16 15:11:34 +0100128{
129 handle_ns_smc(SMC_RMM_DATA_CREATE_UNKNOWN,
AlexeiFedorovac923c82023-04-06 15:12:04 +0100130 (uintptr_t)rd,
131 (uintptr_t)data, ipa,
Soby Mathew76e9b452023-05-16 15:11:34 +0100132 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100133 res);
Soby Mathew76e9b452023-05-16 15:11:34 +0100134}
135
AlexeiFedorov960d1612023-04-25 13:23:39 +0100136void host_rmi_rtt_init_ripas(void *rd, uintptr_t base, uintptr_t top,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100137 struct smc_result *res)
Soby Mathew76e9b452023-05-16 15:11:34 +0100138{
139 handle_ns_smc(SMC_RMM_RTT_INIT_RIPAS,
140 (uintptr_t)rd,
AlexeiFedorov960d1612023-04-25 13:23:39 +0100141 base, top,
Soby Mathew76e9b452023-05-16 15:11:34 +0100142 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100143 res);
Soby Mathew76e9b452023-05-16 15:11:34 +0100144}
145
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100146void host_rmi_data_destroy(void *rd, uintptr_t ipa, struct smc_result *res)
Soby Mathew76e9b452023-05-16 15:11:34 +0100147{
148 handle_ns_smc(SMC_RMM_DATA_DESTROY,
149 (uintptr_t)rd, ipa,
150 0, 0, 0, 0,
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100151 res);
Soby Mathew76e9b452023-05-16 15:11:34 +0100152}