1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2017-2019 NXP
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted provided that the following conditions are met:
9  *
10  * o Redistributions of source code must retain the above copyright notice, this list
11  *   of conditions and the following disclaimer.
12  *
13  * o Redistributions in binary form must reproduce the above copyright notice, this
14  *   list of conditions and the following disclaimer in the documentation and/or
15  *   other materials provided with the distribution.
16  *
17  * o Neither the name of the copyright holder nor the names of its
18  *   contributors may be used to endorse or promote products derived from this
19  *   software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*!
34  * Header file for the RM RPC implementation.
35  *
36  * @addtogroup RM_SVC
37  * @{
38  */
39 
40 #ifndef SC_RM_RPC_H
41 #define SC_RM_RPC_H
42 
43 /* Includes */
44 
45 /* Defines */
46 
47 /*!
48  * @name Defines for RPC RM function calls
49  */
50 /*@{*/
51 #define RM_FUNC_UNKNOWN 0 /*!< Unknown function */
52 #define RM_FUNC_PARTITION_ALLOC 1U /*!< Index for sc_rm_partition_alloc() RPC call */
53 #define RM_FUNC_SET_CONFIDENTIAL 31U /*!< Index for sc_rm_set_confidential() RPC call */
54 #define RM_FUNC_PARTITION_FREE 2U /*!< Index for sc_rm_partition_free() RPC call */
55 #define RM_FUNC_GET_DID 26U /*!< Index for sc_rm_get_did() RPC call */
56 #define RM_FUNC_PARTITION_STATIC 3U /*!< Index for sc_rm_partition_static() RPC call */
57 #define RM_FUNC_PARTITION_LOCK 4U /*!< Index for sc_rm_partition_lock() RPC call */
58 #define RM_FUNC_GET_PARTITION 5U /*!< Index for sc_rm_get_partition() RPC call */
59 #define RM_FUNC_SET_PARENT 6U /*!< Index for sc_rm_set_parent() RPC call */
60 #define RM_FUNC_MOVE_ALL 7U /*!< Index for sc_rm_move_all() RPC call */
61 #define RM_FUNC_ASSIGN_RESOURCE 8U /*!< Index for sc_rm_assign_resource() RPC call */
62 #define RM_FUNC_SET_RESOURCE_MOVABLE 9U /*!< Index for sc_rm_set_resource_movable() RPC call */
63 #define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U /*!< Index for sc_rm_set_subsys_rsrc_movable() RPC call */
64 #define RM_FUNC_SET_MASTER_ATTRIBUTES 10U /*!< Index for sc_rm_set_master_attributes() RPC call */
65 #define RM_FUNC_SET_MASTER_SID 11U /*!< Index for sc_rm_set_master_sid() RPC call */
66 #define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U /*!< Index for sc_rm_set_peripheral_permissions() RPC call */
67 #define RM_FUNC_IS_RESOURCE_OWNED 13U /*!< Index for sc_rm_is_resource_owned() RPC call */
68 #define RM_FUNC_GET_RESOURCE_OWNER 33U /*!< Index for sc_rm_get_resource_owner() RPC call */
69 #define RM_FUNC_IS_RESOURCE_MASTER 14U /*!< Index for sc_rm_is_resource_master() RPC call */
70 #define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U /*!< Index for sc_rm_is_resource_peripheral() RPC call */
71 #define RM_FUNC_GET_RESOURCE_INFO 16U /*!< Index for sc_rm_get_resource_info() RPC call */
72 #define RM_FUNC_MEMREG_ALLOC 17U /*!< Index for sc_rm_memreg_alloc() RPC call */
73 #define RM_FUNC_MEMREG_SPLIT 29U /*!< Index for sc_rm_memreg_split() RPC call */
74 #define RM_FUNC_MEMREG_FRAG 32U /*!< Index for sc_rm_memreg_frag() RPC call */
75 #define RM_FUNC_MEMREG_FREE 18U /*!< Index for sc_rm_memreg_free() RPC call */
76 #define RM_FUNC_FIND_MEMREG 30U /*!< Index for sc_rm_find_memreg() RPC call */
77 #define RM_FUNC_ASSIGN_MEMREG 19U /*!< Index for sc_rm_assign_memreg() RPC call */
78 #define RM_FUNC_SET_MEMREG_PERMISSIONS 20U /*!< Index for sc_rm_set_memreg_permissions() RPC call */
79 #define RM_FUNC_IS_MEMREG_OWNED 21U /*!< Index for sc_rm_is_memreg_owned() RPC call */
80 #define RM_FUNC_GET_MEMREG_INFO 22U /*!< Index for sc_rm_get_memreg_info() RPC call */
81 #define RM_FUNC_ASSIGN_PAD 23U /*!< Index for sc_rm_assign_pad() RPC call */
82 #define RM_FUNC_SET_PAD_MOVABLE 24U /*!< Index for sc_rm_set_pad_movable() RPC call */
83 #define RM_FUNC_IS_PAD_OWNED 25U /*!< Index for sc_rm_is_pad_owned() RPC call */
84 #define RM_FUNC_DUMP 27U /*!< Index for sc_rm_dump() RPC call */
85 /*@}*/
86 
87 /* Types */
88 
89 /* Functions */
90 
91 /*!
92  * This function dispatches an incoming RM RPC request.
93  *
94  * @param[in]     caller_pt   caller partition
95  * @param[in]     mu          MU message came from
96  * @param[in]     msg         pointer to RPC message
97  */
98 void rm_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
99 
100 #endif /* SC_RM_RPC_H */
101 
102 /**@}*/
103 
104