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