| 1 |
/* |
| 2 |
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
/*! |
| 8 |
* File containing client-side RPC functions for the RM service. These |
| 9 |
* functions are ported to clients that communicate to the SC. |
| 10 |
* |
| 11 |
* @addtogroup RM_SVC |
| 12 |
* @{ |
| 13 |
*/ |
| 14 |
|
| 15 |
/* Includes */ |
| 16 |
|
| 17 |
#include <stdlib.h> |
| 18 |
|
| 19 |
#include <sci/sci_types.h> |
| 20 |
#include <sci/svc/rm/sci_rm_api.h> |
| 21 |
#include <sci/sci_rpc.h> |
| 22 |
|
| 23 |
#include "sci_rm_rpc.h" |
| 24 |
|
| 25 |
/* Local Defines */ |
| 26 |
|
| 27 |
/* Local Types */ |
| 28 |
|
| 29 |
/* Local Functions */ |
| 30 |
|
| 31 |
sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, sc_bool_t secure, |
| 32 |
sc_bool_t isolated, sc_bool_t restricted, |
| 33 |
sc_bool_t grant, sc_bool_t coherent) |
| 34 |
{ |
| 35 |
sc_rpc_msg_t msg; |
| 36 |
uint8_t result; |
| 37 |
|
| 38 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 39 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 40 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_PARTITION_ALLOC; |
| 41 |
RPC_U8(&msg, 0U) = (uint8_t)secure; |
| 42 |
RPC_U8(&msg, 1U) = (uint8_t)isolated; |
| 43 |
RPC_U8(&msg, 2U) = (uint8_t)restricted; |
| 44 |
RPC_U8(&msg, 3U) = (uint8_t)grant; |
| 45 |
RPC_U8(&msg, 4U) = (uint8_t)coherent; |
| 46 |
RPC_SIZE(&msg) = 3U; |
| 47 |
|
| 48 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 49 |
|
| 50 |
result = RPC_R8(&msg); |
| 51 |
if (pt != NULL) { |
| 52 |
*pt = RPC_U8(&msg, 0U); |
| 53 |
} |
| 54 |
|
| 55 |
return (sc_err_t)result; |
| 56 |
} |
| 57 |
|
| 58 |
sc_err_t sc_rm_set_confidential(sc_ipc_t ipc, sc_rm_pt_t pt, sc_bool_t retro) |
| 59 |
{ |
| 60 |
sc_rpc_msg_t msg; |
| 61 |
uint8_t result; |
| 62 |
|
| 63 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 64 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 65 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_CONFIDENTIAL; |
| 66 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 67 |
RPC_U8(&msg, 1U) = (uint8_t)retro; |
| 68 |
RPC_SIZE(&msg) = 2U; |
| 69 |
|
| 70 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 71 |
|
| 72 |
result = RPC_R8(&msg); |
| 73 |
return (sc_err_t)result; |
| 74 |
} |
| 75 |
|
| 76 |
sc_err_t sc_rm_partition_free(sc_ipc_t ipc, sc_rm_pt_t pt) |
| 77 |
{ |
| 78 |
sc_rpc_msg_t msg; |
| 79 |
uint8_t result; |
| 80 |
|
| 81 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 82 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 83 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_PARTITION_FREE; |
| 84 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 85 |
RPC_SIZE(&msg) = 2U; |
| 86 |
|
| 87 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 88 |
|
| 89 |
result = RPC_R8(&msg); |
| 90 |
return (sc_err_t)result; |
| 91 |
} |
| 92 |
|
| 93 |
sc_rm_did_t sc_rm_get_did(sc_ipc_t ipc) |
| 94 |
{ |
| 95 |
sc_rpc_msg_t msg; |
| 96 |
uint8_t result; |
| 97 |
|
| 98 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 99 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 100 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_GET_DID; |
| 101 |
RPC_SIZE(&msg) = 1U; |
| 102 |
|
| 103 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 104 |
|
| 105 |
result = RPC_R8(&msg); |
| 106 |
return (sc_rm_did_t) result; |
| 107 |
} |
| 108 |
|
| 109 |
sc_err_t sc_rm_partition_static(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_did_t did) |
| 110 |
{ |
| 111 |
sc_rpc_msg_t msg; |
| 112 |
uint8_t result; |
| 113 |
|
| 114 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 115 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 116 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_PARTITION_STATIC; |
| 117 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 118 |
RPC_U8(&msg, 1U) = (uint8_t)did; |
| 119 |
RPC_SIZE(&msg) = 2U; |
| 120 |
|
| 121 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 122 |
|
| 123 |
result = RPC_R8(&msg); |
| 124 |
return (sc_err_t)result; |
| 125 |
} |
| 126 |
|
| 127 |
sc_err_t sc_rm_partition_lock(sc_ipc_t ipc, sc_rm_pt_t pt) |
| 128 |
{ |
| 129 |
sc_rpc_msg_t msg; |
| 130 |
uint8_t result; |
| 131 |
|
| 132 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 133 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 134 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_PARTITION_LOCK; |
| 135 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 136 |
RPC_SIZE(&msg) = 2U; |
| 137 |
|
| 138 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 139 |
|
| 140 |
result = RPC_R8(&msg); |
| 141 |
return (sc_err_t)result; |
| 142 |
} |
| 143 |
|
| 144 |
sc_err_t sc_rm_get_partition(sc_ipc_t ipc, sc_rm_pt_t *pt) |
| 145 |
{ |
| 146 |
sc_rpc_msg_t msg; |
| 147 |
uint8_t result; |
| 148 |
|
| 149 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 150 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 151 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_GET_PARTITION; |
| 152 |
RPC_SIZE(&msg) = 1U; |
| 153 |
|
| 154 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 155 |
|
| 156 |
result = RPC_R8(&msg); |
| 157 |
if (pt != NULL) { |
| 158 |
*pt = RPC_U8(&msg, 0U); |
| 159 |
} |
| 160 |
|
| 161 |
return (sc_err_t)result; |
| 162 |
} |
| 163 |
|
| 164 |
sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_pt_t pt_parent) |
| 165 |
{ |
| 166 |
sc_rpc_msg_t msg; |
| 167 |
uint8_t result; |
| 168 |
|
| 169 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 170 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 171 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_PARENT; |
| 172 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 173 |
RPC_U8(&msg, 1U) = (uint8_t)pt_parent; |
| 174 |
RPC_SIZE(&msg) = 2U; |
| 175 |
|
| 176 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 177 |
|
| 178 |
result = RPC_R8(&msg); |
| 179 |
return (sc_err_t)result; |
| 180 |
} |
| 181 |
|
| 182 |
sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst, |
| 183 |
sc_bool_t move_rsrc, sc_bool_t move_pads) |
| 184 |
{ |
| 185 |
sc_rpc_msg_t msg; |
| 186 |
uint8_t result; |
| 187 |
|
| 188 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 189 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 190 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_MOVE_ALL; |
| 191 |
RPC_U8(&msg, 0U) = (uint8_t)pt_src; |
| 192 |
RPC_U8(&msg, 1U) = (uint8_t)pt_dst; |
| 193 |
RPC_U8(&msg, 2U) = (uint8_t)move_rsrc; |
| 194 |
RPC_U8(&msg, 3U) = (uint8_t)move_pads; |
| 195 |
RPC_SIZE(&msg) = 2U; |
| 196 |
|
| 197 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 198 |
|
| 199 |
result = RPC_R8(&msg); |
| 200 |
return (sc_err_t)result; |
| 201 |
} |
| 202 |
|
| 203 |
sc_err_t sc_rm_assign_resource(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rsrc_t resource) |
| 204 |
{ |
| 205 |
sc_rpc_msg_t msg; |
| 206 |
uint8_t result; |
| 207 |
|
| 208 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 209 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 210 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_ASSIGN_RESOURCE; |
| 211 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 212 |
RPC_U8(&msg, 2U) = (uint8_t)pt; |
| 213 |
RPC_SIZE(&msg) = 2U; |
| 214 |
|
| 215 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 216 |
|
| 217 |
result = RPC_R8(&msg); |
| 218 |
return (sc_err_t)result; |
| 219 |
} |
| 220 |
|
| 221 |
sc_err_t sc_rm_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst, |
| 222 |
sc_rsrc_t resource_lst, sc_bool_t movable) |
| 223 |
{ |
| 224 |
sc_rpc_msg_t msg; |
| 225 |
uint8_t result; |
| 226 |
|
| 227 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 228 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 229 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_RESOURCE_MOVABLE; |
| 230 |
RPC_U16(&msg, 0U) = (uint16_t)resource_fst; |
| 231 |
RPC_U16(&msg, 2U) = (uint16_t)resource_lst; |
| 232 |
RPC_U8(&msg, 4U) = (uint8_t)movable; |
| 233 |
RPC_SIZE(&msg) = 3U; |
| 234 |
|
| 235 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 236 |
|
| 237 |
result = RPC_R8(&msg); |
| 238 |
return (sc_err_t)result; |
| 239 |
} |
| 240 |
|
| 241 |
sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource, |
| 242 |
sc_bool_t movable) |
| 243 |
{ |
| 244 |
sc_rpc_msg_t msg; |
| 245 |
uint8_t result; |
| 246 |
|
| 247 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 248 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 249 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_SUBSYS_RSRC_MOVABLE; |
| 250 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 251 |
RPC_U8(&msg, 2U) = (uint8_t)movable; |
| 252 |
RPC_SIZE(&msg) = 2U; |
| 253 |
|
| 254 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 255 |
|
| 256 |
result = RPC_R8(&msg); |
| 257 |
return (sc_err_t)result; |
| 258 |
} |
| 259 |
|
| 260 |
sc_err_t sc_rm_set_master_attributes(sc_ipc_t ipc, sc_rsrc_t resource, |
| 261 |
sc_rm_spa_t sa, sc_rm_spa_t pa, |
| 262 |
sc_bool_t smmu_bypass) |
| 263 |
{ |
| 264 |
sc_rpc_msg_t msg; |
| 265 |
uint8_t result; |
| 266 |
|
| 267 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 268 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 269 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_MASTER_ATTRIBUTES; |
| 270 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 271 |
RPC_U8(&msg, 2U) = (uint8_t)sa; |
| 272 |
RPC_U8(&msg, 3U) = (uint8_t)pa; |
| 273 |
RPC_U8(&msg, 4U) = (uint8_t)smmu_bypass; |
| 274 |
RPC_SIZE(&msg) = 3U; |
| 275 |
|
| 276 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 277 |
|
| 278 |
result = RPC_R8(&msg); |
| 279 |
return (sc_err_t)result; |
| 280 |
} |
| 281 |
|
| 282 |
sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid) |
| 283 |
{ |
| 284 |
sc_rpc_msg_t msg; |
| 285 |
uint8_t result; |
| 286 |
|
| 287 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 288 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 289 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_MASTER_SID; |
| 290 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 291 |
RPC_U16(&msg, 2U) = (uint16_t)sid; |
| 292 |
RPC_SIZE(&msg) = 2U; |
| 293 |
|
| 294 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 295 |
|
| 296 |
result = RPC_R8(&msg); |
| 297 |
return (sc_err_t)result; |
| 298 |
} |
| 299 |
|
| 300 |
sc_err_t sc_rm_set_peripheral_permissions(sc_ipc_t ipc, sc_rsrc_t resource, |
| 301 |
sc_rm_pt_t pt, sc_rm_perm_t perm) |
| 302 |
{ |
| 303 |
sc_rpc_msg_t msg; |
| 304 |
uint8_t result; |
| 305 |
|
| 306 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 307 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 308 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_PERIPHERAL_PERMISSIONS; |
| 309 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 310 |
RPC_U8(&msg, 2U) = (uint8_t)pt; |
| 311 |
RPC_U8(&msg, 3U) = (uint8_t)perm; |
| 312 |
RPC_SIZE(&msg) = 2U; |
| 313 |
|
| 314 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 315 |
|
| 316 |
result = RPC_R8(&msg); |
| 317 |
return (sc_err_t)result; |
| 318 |
} |
| 319 |
|
| 320 |
sc_bool_t sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource) |
| 321 |
{ |
| 322 |
sc_rpc_msg_t msg; |
| 323 |
uint8_t result; |
| 324 |
|
| 325 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 326 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 327 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_IS_RESOURCE_OWNED; |
| 328 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 329 |
RPC_SIZE(&msg) = 2U; |
| 330 |
|
| 331 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 332 |
|
| 333 |
result = RPC_R8(&msg); |
| 334 |
return (sc_bool_t)result; |
| 335 |
} |
| 336 |
|
| 337 |
sc_bool_t sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource) |
| 338 |
{ |
| 339 |
sc_rpc_msg_t msg; |
| 340 |
uint8_t result; |
| 341 |
|
| 342 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 343 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 344 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_IS_RESOURCE_MASTER; |
| 345 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 346 |
RPC_SIZE(&msg) = 2U; |
| 347 |
|
| 348 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 349 |
|
| 350 |
result = RPC_R8(&msg); |
| 351 |
return (sc_bool_t)result; |
| 352 |
} |
| 353 |
|
| 354 |
sc_bool_t sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource) |
| 355 |
{ |
| 356 |
sc_rpc_msg_t msg; |
| 357 |
uint8_t result; |
| 358 |
|
| 359 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 360 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 361 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_IS_RESOURCE_PERIPHERAL; |
| 362 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 363 |
RPC_SIZE(&msg) = 2U; |
| 364 |
|
| 365 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 366 |
|
| 367 |
result = RPC_R8(&msg); |
| 368 |
return (sc_bool_t)result; |
| 369 |
} |
| 370 |
|
| 371 |
sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource, |
| 372 |
sc_rm_sid_t *sid) |
| 373 |
{ |
| 374 |
sc_rpc_msg_t msg; |
| 375 |
uint8_t result; |
| 376 |
|
| 377 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 378 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 379 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_GET_RESOURCE_INFO; |
| 380 |
RPC_U16(&msg, 0U) = (uint16_t)resource; |
| 381 |
RPC_SIZE(&msg) = 2U; |
| 382 |
|
| 383 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 384 |
|
| 385 |
if (sid != NULL) { |
| 386 |
*sid = RPC_U16(&msg, 0U); |
| 387 |
} |
| 388 |
|
| 389 |
result = RPC_R8(&msg); |
| 390 |
return (sc_err_t)result; |
| 391 |
} |
| 392 |
|
| 393 |
sc_err_t sc_rm_memreg_alloc(sc_ipc_t ipc, sc_rm_mr_t *mr, |
| 394 |
sc_faddr_t addr_start, sc_faddr_t addr_end) |
| 395 |
{ |
| 396 |
sc_rpc_msg_t msg; |
| 397 |
uint8_t result; |
| 398 |
|
| 399 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 400 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 401 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_MEMREG_ALLOC; |
| 402 |
RPC_U32(&msg, 0U) = (uint32_t)(addr_start >> 32U); |
| 403 |
RPC_U32(&msg, 4U) = (uint32_t)addr_start; |
| 404 |
RPC_U32(&msg, 8U) = (uint32_t)(addr_end >> 32U); |
| 405 |
RPC_U32(&msg, 12U) = (uint32_t)addr_end; |
| 406 |
RPC_SIZE(&msg) = 5U; |
| 407 |
|
| 408 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 409 |
|
| 410 |
result = RPC_R8(&msg); |
| 411 |
if (mr != NULL) { |
| 412 |
*mr = RPC_U8(&msg, 0U); |
| 413 |
} |
| 414 |
|
| 415 |
return (sc_err_t)result; |
| 416 |
} |
| 417 |
|
| 418 |
sc_err_t sc_rm_memreg_split(sc_ipc_t ipc, sc_rm_mr_t mr, |
| 419 |
sc_rm_mr_t *mr_ret, sc_faddr_t addr_start, |
| 420 |
sc_faddr_t addr_end) |
| 421 |
{ |
| 422 |
sc_rpc_msg_t msg; |
| 423 |
uint8_t result; |
| 424 |
|
| 425 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 426 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 427 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_MEMREG_SPLIT; |
| 428 |
RPC_U32(&msg, 0U) = (uint32_t)(addr_start >> 32U); |
| 429 |
RPC_U32(&msg, 4U) = (uint32_t)addr_start; |
| 430 |
RPC_U32(&msg, 8U) = (uint32_t)(addr_end >> 32U); |
| 431 |
RPC_U32(&msg, 12U) = (uint32_t)addr_end; |
| 432 |
RPC_U8(&msg, 16U) = (uint8_t)mr; |
| 433 |
RPC_SIZE(&msg) = 6U; |
| 434 |
|
| 435 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 436 |
|
| 437 |
result = RPC_R8(&msg); |
| 438 |
if (mr_ret != NULL) { |
| 439 |
*mr_ret = RPC_U8(&msg, 0U); |
| 440 |
} |
| 441 |
|
| 442 |
return (sc_err_t)result; |
| 443 |
} |
| 444 |
|
| 445 |
sc_err_t sc_rm_memreg_free(sc_ipc_t ipc, sc_rm_mr_t mr) |
| 446 |
{ |
| 447 |
sc_rpc_msg_t msg; |
| 448 |
uint8_t result; |
| 449 |
|
| 450 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 451 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 452 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_MEMREG_FREE; |
| 453 |
RPC_U8(&msg, 0U) = (uint8_t)mr; |
| 454 |
RPC_SIZE(&msg) = 2U; |
| 455 |
|
| 456 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 457 |
|
| 458 |
result = RPC_R8(&msg); |
| 459 |
return (sc_err_t)result; |
| 460 |
} |
| 461 |
|
| 462 |
sc_err_t sc_rm_find_memreg(sc_ipc_t ipc, sc_rm_mr_t *mr, |
| 463 |
sc_faddr_t addr_start, sc_faddr_t addr_end) |
| 464 |
{ |
| 465 |
sc_rpc_msg_t msg; |
| 466 |
uint8_t result; |
| 467 |
|
| 468 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 469 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 470 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_FIND_MEMREG; |
| 471 |
RPC_U32(&msg, 0U) = (uint32_t)(addr_start >> 32U); |
| 472 |
RPC_U32(&msg, 4U) = (uint32_t)addr_start; |
| 473 |
RPC_U32(&msg, 8U) = (uint32_t)(addr_end >> 32U); |
| 474 |
RPC_U32(&msg, 12U) = (uint32_t)addr_end; |
| 475 |
RPC_SIZE(&msg) = 5U; |
| 476 |
|
| 477 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 478 |
|
| 479 |
result = RPC_R8(&msg); |
| 480 |
if (mr != NULL) { |
| 481 |
*mr = RPC_U8(&msg, 0U); |
| 482 |
} |
| 483 |
|
| 484 |
return (sc_err_t)result; |
| 485 |
} |
| 486 |
|
| 487 |
sc_err_t sc_rm_assign_memreg(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_mr_t mr) |
| 488 |
{ |
| 489 |
sc_rpc_msg_t msg; |
| 490 |
uint8_t result; |
| 491 |
|
| 492 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 493 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 494 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_ASSIGN_MEMREG; |
| 495 |
RPC_U8(&msg, 0U) = (uint8_t)pt; |
| 496 |
RPC_U8(&msg, 1U) = (uint8_t)mr; |
| 497 |
RPC_SIZE(&msg) = 2U; |
| 498 |
|
| 499 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 500 |
|
| 501 |
result = RPC_R8(&msg); |
| 502 |
return (sc_err_t)result; |
| 503 |
} |
| 504 |
|
| 505 |
sc_err_t sc_rm_set_memreg_permissions(sc_ipc_t ipc, sc_rm_mr_t mr, |
| 506 |
sc_rm_pt_t pt, sc_rm_perm_t perm) |
| 507 |
{ |
| 508 |
sc_rpc_msg_t msg; |
| 509 |
uint8_t result; |
| 510 |
|
| 511 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 512 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 513 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_MEMREG_PERMISSIONS; |
| 514 |
RPC_U8(&msg, 0U) = (uint8_t)mr; |
| 515 |
RPC_U8(&msg, 1U) = (uint8_t)pt; |
| 516 |
RPC_U8(&msg, 2U) = (uint8_t)perm; |
| 517 |
RPC_SIZE(&msg) = 2U; |
| 518 |
|
| 519 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 520 |
|
| 521 |
result = RPC_R8(&msg); |
| 522 |
return (sc_err_t)result; |
| 523 |
} |
| 524 |
|
| 525 |
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr) |
| 526 |
{ |
| 527 |
sc_rpc_msg_t msg; |
| 528 |
uint8_t result; |
| 529 |
|
| 530 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 531 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 532 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_IS_MEMREG_OWNED; |
| 533 |
RPC_U8(&msg, 0U) = (uint8_t)mr; |
| 534 |
RPC_SIZE(&msg) = 2U; |
| 535 |
|
| 536 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 537 |
|
| 538 |
result = RPC_R8(&msg); |
| 539 |
return (sc_bool_t)result; |
| 540 |
} |
| 541 |
|
| 542 |
sc_err_t sc_rm_get_memreg_info(sc_ipc_t ipc, sc_rm_mr_t mr, |
| 543 |
sc_faddr_t *addr_start, sc_faddr_t *addr_end) |
| 544 |
{ |
| 545 |
sc_rpc_msg_t msg; |
| 546 |
uint8_t result; |
| 547 |
|
| 548 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 549 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 550 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_GET_MEMREG_INFO; |
| 551 |
RPC_U8(&msg, 0U) = (uint8_t)mr; |
| 552 |
RPC_SIZE(&msg) = 2U; |
| 553 |
|
| 554 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 555 |
|
| 556 |
if (addr_start != NULL) { |
| 557 |
*addr_start = |
| 558 |
((uint64_t) RPC_U32(&msg, 0U) << 32U) | RPC_U32(&msg, 4U); |
| 559 |
} |
| 560 |
|
| 561 |
if (addr_end != NULL) { |
| 562 |
*addr_end = |
| 563 |
((uint64_t) RPC_U32(&msg, 8U) << 32U) | RPC_U32(&msg, 12U); |
| 564 |
} |
| 565 |
|
| 566 |
result = RPC_R8(&msg); |
| 567 |
return (sc_err_t)result; |
| 568 |
} |
| 569 |
|
| 570 |
sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad) |
| 571 |
{ |
| 572 |
sc_rpc_msg_t msg; |
| 573 |
uint8_t result; |
| 574 |
|
| 575 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 576 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 577 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_ASSIGN_PAD; |
| 578 |
RPC_U16(&msg, 0U) = (uint16_t)pad; |
| 579 |
RPC_U8(&msg, 2U) = (uint8_t)pt; |
| 580 |
RPC_SIZE(&msg) = 2U; |
| 581 |
|
| 582 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 583 |
|
| 584 |
result = RPC_R8(&msg); |
| 585 |
return (sc_err_t)result; |
| 586 |
} |
| 587 |
|
| 588 |
sc_err_t sc_rm_set_pad_movable(sc_ipc_t ipc, sc_pad_t pad_fst, |
| 589 |
sc_pad_t pad_lst, sc_bool_t movable) |
| 590 |
{ |
| 591 |
sc_rpc_msg_t msg; |
| 592 |
uint8_t result; |
| 593 |
|
| 594 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 595 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 596 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_SET_PAD_MOVABLE; |
| 597 |
RPC_U16(&msg, 0U) = (uint16_t)pad_fst; |
| 598 |
RPC_U16(&msg, 2U) = (uint16_t)pad_lst; |
| 599 |
RPC_U8(&msg, 4U) = (uint8_t)movable; |
| 600 |
RPC_SIZE(&msg) = 3U; |
| 601 |
|
| 602 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 603 |
|
| 604 |
result = RPC_R8(&msg); |
| 605 |
return (sc_err_t)result; |
| 606 |
} |
| 607 |
|
| 608 |
sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad) |
| 609 |
{ |
| 610 |
sc_rpc_msg_t msg; |
| 611 |
uint8_t result; |
| 612 |
|
| 613 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 614 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 615 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_IS_PAD_OWNED; |
| 616 |
RPC_U8(&msg, 0U) = (uint8_t)pad; |
| 617 |
RPC_SIZE(&msg) = 2U; |
| 618 |
|
| 619 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 620 |
|
| 621 |
result = RPC_R8(&msg); |
| 622 |
return (sc_bool_t)result; |
| 623 |
} |
| 624 |
|
| 625 |
void sc_rm_dump(sc_ipc_t ipc) |
| 626 |
{ |
| 627 |
sc_rpc_msg_t msg; |
| 628 |
|
| 629 |
RPC_VER(&msg) = SC_RPC_VERSION; |
| 630 |
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_RM; |
| 631 |
RPC_FUNC(&msg) = (uint8_t)RM_FUNC_DUMP; |
| 632 |
RPC_SIZE(&msg) = 1U; |
| 633 |
|
| 634 |
sc_call_rpc(ipc, &msg, SC_FALSE); |
| 635 |
} |
| 636 |
|
| 637 |
/**@}*/ |