diff options
Diffstat (limited to 'plat/imx/common/include/sci/svc/rm/api.h')
-rw-r--r-- | plat/imx/common/include/sci/svc/rm/api.h | 134 |
1 files changed, 68 insertions, 66 deletions
diff --git a/plat/imx/common/include/sci/svc/rm/api.h b/plat/imx/common/include/sci/svc/rm/api.h index 1fcbee58..9c42087b 100644 --- a/plat/imx/common/include/sci/svc/rm/api.h +++ b/plat/imx/common/include/sci/svc/rm/api.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. - * Copyright 2017 NXP + * Copyright 2017-2018 NXP * * SPDX-License-Identifier: BSD-3-Clause */ @@ -14,11 +14,13 @@ * * Module for the Resource Management (RM) service. * + * @includedoc rm/details.dox + * * @{ */ -#ifndef _SC_RM_API_H -#define _SC_RM_API_H +#ifndef SC_RM_API_H +#define SC_RM_API_H /* Includes */ @@ -30,44 +32,44 @@ * @name Defines for type widths */ /*@{*/ -#define SC_RM_PARTITION_W 5 /*!< Width of sc_rm_pt_t */ -#define SC_RM_MEMREG_W 6 /*!< Width of sc_rm_mr_t */ -#define SC_RM_DID_W 4 /*!< Width of sc_rm_did_t */ -#define SC_RM_SID_W 6 /*!< Width of sc_rm_sid_t */ -#define SC_RM_SPA_W 2 /*!< Width of sc_rm_spa_t */ -#define SC_RM_PERM_W 3 /*!< Width of sc_rm_perm_t */ +#define SC_RM_PARTITION_W 5 /* Width of sc_rm_pt_t */ +#define SC_RM_MEMREG_W 6 /* Width of sc_rm_mr_t */ +#define SC_RM_DID_W 4 /* Width of sc_rm_did_t */ +#define SC_RM_SID_W 6 /* Width of sc_rm_sid_t */ +#define SC_RM_SPA_W 2 /* Width of sc_rm_spa_t */ +#define SC_RM_PERM_W 3 /* Width of sc_rm_perm_t */ /*@}*/ /*! * @name Defines for ALL parameters */ /*@{*/ -#define SC_RM_PT_ALL UINT8_MAX /*!< All partitions */ -#define SC_RM_MR_ALL UINT8_MAX /*!< All memory regions */ +#define SC_RM_PT_ALL ((sc_rm_pt_t) UINT8_MAX) /* All partitions */ +#define SC_RM_MR_ALL ((sc_rm_mr_t) UINT8_MAX) /* All memory regions */ /*@}*/ /*! * @name Defines for sc_rm_spa_t */ /*@{*/ -#define SC_RM_SPA_PASSTHRU 0 /*!< Pass through (attribute driven by master) */ -#define SC_RM_SPA_PASSSID 1 /*!< Pass through and output on SID */ -#define SC_RM_SPA_ASSERT 2 /*!< Assert (force to be secure/privileged) */ -#define SC_RM_SPA_NEGATE 3 /*!< Negate (force to be non-secure/user) */ +#define SC_RM_SPA_PASSTHRU 0U /* Pass through (attribute driven by master) */ +#define SC_RM_SPA_PASSSID 1U /* Pass through and output on SID */ +#define SC_RM_SPA_ASSERT 2U /* Assert (force to be secure/privileged) */ +#define SC_RM_SPA_NEGATE 3U /* Negate (force to be non-secure/user) */ /*@}*/ /*! * @name Defines for sc_rm_perm_t */ /*@{*/ -#define SC_RM_PERM_NONE 0 /*!< No access */ -#define SC_RM_PERM_SEC_R 1 /*!< Secure RO */ -#define SC_RM_PERM_SECPRIV_RW 2 /*!< Secure privilege R/W */ -#define SC_RM_PERM_SEC_RW 3 /*!< Secure R/W */ -#define SC_RM_PERM_NSPRIV_R 4 /*!< Secure R/W, non-secure privilege RO */ -#define SC_RM_PERM_NS_R 5 /*!< Secure R/W, non-secure RO */ -#define SC_RM_PERM_NSPRIV_RW 6 /*!< Secure R/W, non-secure privilege R/W */ -#define SC_RM_PERM_FULL 7 /*!< Full access */ +#define SC_RM_PERM_NONE 0U /* No access */ +#define SC_RM_PERM_SEC_R 1U /* Secure RO */ +#define SC_RM_PERM_SECPRIV_RW 2U /* Secure privilege R/W */ +#define SC_RM_PERM_SEC_RW 3U /* Secure R/W */ +#define SC_RM_PERM_NSPRIV_R 4U /* Secure R/W, non-secure privilege RO */ +#define SC_RM_PERM_NS_R 5U /* Secure R/W, non-secure RO */ +#define SC_RM_PERM_NSPRIV_RW 6U /* Secure R/W, non-secure privilege R/W */ +#define SC_RM_PERM_FULL 7U /* Full access */ /*@}*/ /* Types */ @@ -120,13 +122,13 @@ typedef uint8_t sc_rm_perm_t; * @param[in] secure boolean indicating if this partition should be secure; only * valid if caller is secure * @param[in] isolated boolean indicating if this partition should be HW isolated - * via XRDC; set true if new DID is desired + * via XRDC; set SC_TRUE if new DID is desired * @param[in] restricted boolean indicating if this partition should be restricted; set - * true if masters in this partition cannot create new partitions + * SC_TRUE if masters in this partition cannot create new partitions * @param[in] grant boolean indicating if this partition should always grant * access and control to the parent * @param[in] coherent boolean indicating if this partition is coherent; - * set true if only this partition will contain both AP clusters + * set SC_TRUE if only this partition will contain both AP clusters * and they will be coherent via the CCI * * @return Returns an error code (SC_ERR_NONE = success). @@ -145,8 +147,9 @@ typedef uint8_t sc_rm_perm_t; * memory without isolating the peripheral interface of the master or the API * controls of that master. */ -sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, bool secure, - bool isolated, bool restricted, bool grant, bool coherent); +sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, sc_bool_t secure, + sc_bool_t isolated, sc_bool_t restricted, + sc_bool_t grant, sc_bool_t coherent); /*! * This function makes a partition confidential. @@ -168,7 +171,7 @@ sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, bool secure, * If retroactive, then all resources owned by other partitions will have * access rights for this partition removed, even if locked. */ -sc_err_t sc_rm_set_confidential(sc_ipc_t ipc, sc_rm_pt_t pt, bool retro); +sc_err_t sc_rm_set_confidential(sc_ipc_t ipc, sc_rm_pt_t pt, sc_bool_t retro); /*! * This function frees a partition and assigns all resources to the caller. @@ -221,8 +224,7 @@ sc_rm_did_t sc_rm_get_did(sc_ipc_t ipc); * Assumes no assigned resources or memory regions yet! The number of static * DID is fixed by the SC at boot. */ -sc_err_t sc_rm_partition_static(sc_ipc_t ipc, sc_rm_pt_t pt, - sc_rm_did_t did); +sc_err_t sc_rm_partition_static(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_did_t did); /*! * This function locks a partition. @@ -267,8 +269,7 @@ sc_err_t sc_rm_get_partition(sc_ipc_t ipc, sc_rm_pt_t *pt); * - SC_ERR_NOACCESS if caller's partition is not the parent of \a pt, * - SC_ERR_LOCKED if either partition is locked */ -sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, - sc_rm_pt_t pt_parent); +sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_pt_t pt_parent); /*! * This function moves all movable resources/pads owned by a source partition @@ -298,7 +299,7 @@ sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, * - SC_ERR_LOCKED if either partition is locked */ sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst, - bool move_rsrc, bool move_pads); + sc_bool_t move_rsrc, sc_bool_t move_pads); /* @} */ @@ -331,8 +332,7 @@ sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst, * of the owner, * - SC_ERR_LOCKED if the owning partition or \a pt is locked */ -sc_err_t sc_rm_assign_resource(sc_ipc_t ipc, sc_rm_pt_t pt, - sc_rsrc_t resource); +sc_err_t sc_rm_assign_resource(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rsrc_t resource); /*! * This function flags resources as movable or not. @@ -340,7 +340,7 @@ sc_err_t sc_rm_assign_resource(sc_ipc_t ipc, sc_rm_pt_t pt, * @param[in] ipc IPC handle * @param[in] resource_fst first resource for which flag should be set * @param[in] resource_lst last resource for which flag should be set - * @param[in] movable movable flag (true) is movable + * @param[in] movable movable flag (SC_TRUE is movable) * * @return Returns an error code (SC_ERR_NONE = success). * @@ -355,7 +355,7 @@ sc_err_t sc_rm_assign_resource(sc_ipc_t ipc, sc_rm_pt_t pt, * resources from moving. */ sc_err_t sc_rm_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst, - sc_rsrc_t resource_lst, bool movable); + sc_rsrc_t resource_lst, sc_bool_t movable); /*! * This function flags all of a subsystem's resources as movable @@ -363,7 +363,7 @@ sc_err_t sc_rm_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst, * * @param[in] ipc IPC handle * @param[in] resource resource to use to identify subsystem - * @param[in] movable movable flag (true) is movable + * @param[in] movable movable flag (SC_TRUE is movable) * * @return Returns an error code (SC_ERR_NONE = success). * @@ -374,7 +374,7 @@ sc_err_t sc_rm_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst, * resources owned by the caller are set. */ sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource, - bool movable); + sc_bool_t movable); /*! * This function sets attributes for a resource which is a bus master (i.e. @@ -399,7 +399,8 @@ sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource, * changed if the caller's partition is secure. */ sc_err_t sc_rm_set_master_attributes(sc_ipc_t ipc, sc_rsrc_t resource, - sc_rm_spa_t sa, sc_rm_spa_t pa, bool smmu_bypass); + sc_rm_spa_t sa, sc_rm_spa_t pa, + sc_bool_t smmu_bypass); /*! * This function sets the StreamID for a resource which is a bus master (i.e. @@ -423,7 +424,7 @@ sc_err_t sc_rm_set_master_attributes(sc_ipc_t ipc, sc_rsrc_t resource, * bypass. */ sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, - sc_rm_sid_t sid); + sc_rm_sid_t sid); /*! * This function sets access permissions for a peripheral resource. @@ -446,7 +447,7 @@ sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, * peripheral based on the attributes of a transaction from bus master. */ sc_err_t sc_rm_set_peripheral_permissions(sc_ipc_t ipc, sc_rsrc_t resource, - sc_rm_pt_t pt, sc_rm_perm_t perm); + sc_rm_pt_t pt, sc_rm_perm_t perm); /*! * This function gets ownership status of a resource. @@ -454,11 +455,11 @@ sc_err_t sc_rm_set_peripheral_permissions(sc_ipc_t ipc, sc_rsrc_t resource, * @param[in] ipc IPC handle * @param[in] resource resource to check * - * @return Returns a boolean (true if caller's partition owns the resource). + * @return Returns a boolean (SC_TRUE if caller's partition owns the resource). * - * If \a resource is out of range then false is returned. + * If \a resource is out of range then SC_FALSE is returned. */ -bool sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource); +sc_bool_t sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource); /*! * This function is used to test if a resource is a bus master. @@ -466,11 +467,11 @@ bool sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource); * @param[in] ipc IPC handle * @param[in] resource resource to check * - * @return Returns a boolean (true if the resource is a bus master). + * @return Returns a boolean (SC_TRUE if the resource is a bus master). * - * If \a resource is out of range then false is returned. + * If \a resource is out of range then SC_FALSE is returned. */ -bool sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource); +sc_bool_t sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource); /*! * This function is used to test if a resource is a peripheral. @@ -478,11 +479,11 @@ bool sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource); * @param[in] ipc IPC handle * @param[in] resource resource to check * - * @return Returns a boolean (true if the resource is a peripheral). + * @return Returns a boolean (SC_TRUE if the resource is a peripheral). * - * If \a resource is out of range then false is returned. + * If \a resource is out of range then SC_FALSE is returned. */ -bool sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource); +sc_bool_t sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource); /*! * This function is used to obtain info about a resource. @@ -497,7 +498,7 @@ bool sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource); * - SC_PARM if \a resource is out of range */ sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource, - sc_rm_sid_t *sid); + sc_rm_sid_t *sid); /* @} */ @@ -532,7 +533,7 @@ sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource, * caller to access. */ sc_err_t sc_rm_memreg_alloc(sc_ipc_t ipc, sc_rm_mr_t *mr, - sc_faddr_t addr_start, sc_faddr_t addr_end); + sc_faddr_t addr_start, sc_faddr_t addr_end); /*! * This function requests that the SC split a memory region. @@ -559,7 +560,8 @@ sc_err_t sc_rm_memreg_alloc(sc_ipc_t ipc, sc_rm_mr_t *mr, * Note the new region must start or end on the split region. */ sc_err_t sc_rm_memreg_split(sc_ipc_t ipc, sc_rm_mr_t mr, - sc_rm_mr_t *mr_ret, sc_faddr_t addr_start, sc_faddr_t addr_end); + sc_rm_mr_t *mr_ret, sc_faddr_t addr_start, + sc_faddr_t addr_end); /*! * This function frees a memory region. @@ -643,7 +645,7 @@ sc_err_t sc_rm_assign_memreg(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_mr_t mr); * memory region based on the attributes of a transaction from bus master. */ sc_err_t sc_rm_set_memreg_permissions(sc_ipc_t ipc, sc_rm_mr_t mr, - sc_rm_pt_t pt, sc_rm_perm_t perm); + sc_rm_pt_t pt, sc_rm_perm_t perm); /*! * This function gets ownership status of a memory region. @@ -651,12 +653,12 @@ sc_err_t sc_rm_set_memreg_permissions(sc_ipc_t ipc, sc_rm_mr_t mr, * @param[in] ipc IPC handle * @param[in] mr handle of memory region to check * - * @return Returns a boolean (true if caller's partition owns the + * @return Returns a boolean (SC_TRUE if caller's partition owns the * memory region). * - * If \a mr is out of range then false is returned. + * If \a mr is out of range then SC_FALSE is returned. */ -bool sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr); +sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr); /*! * This function is used to obtain info about a memory region. @@ -672,7 +674,7 @@ bool sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr); * - SC_PARM if \a mr is out of range */ sc_err_t sc_rm_get_memreg_info(sc_ipc_t ipc, sc_rm_mr_t mr, - sc_faddr_t *addr_start, sc_faddr_t *addr_end); + sc_faddr_t *addr_start, sc_faddr_t *addr_end); /* @} */ @@ -706,7 +708,7 @@ sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad); * @param[in] ipc IPC handle * @param[in] pad_fst first pad for which flag should be set * @param[in] pad_lst last pad for which flag should be set - * @param[in] movable movable flag (true) is movable + * @param[in] movable movable flag (SC_TRUE is movable) * * @return Returns an error code (SC_ERR_NONE = success). * @@ -721,7 +723,7 @@ sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad); * pads from moving. */ sc_err_t sc_rm_set_pad_movable(sc_ipc_t ipc, sc_pad_t pad_fst, - sc_pad_t pad_lst, bool movable); + sc_pad_t pad_lst, sc_bool_t movable); /*! * This function gets ownership status of a pad. @@ -729,11 +731,11 @@ sc_err_t sc_rm_set_pad_movable(sc_ipc_t ipc, sc_pad_t pad_fst, * @param[in] ipc IPC handle * @param[in] pad pad to check * - * @return Returns a boolean (true if caller's partition owns the pad). + * @return Returns a boolean (SC_TRUE if caller's partition owns the pad). * - * If \a pad is out of range then false is returned. + * If \a pad is out of range then SC_FALSE is returned. */ -bool sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad); +sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad); /* @} */ @@ -751,6 +753,6 @@ void sc_rm_dump(sc_ipc_t ipc); /* @} */ -#endif /* _SC_RM_API_H */ +#endif /* SC_RM_API_H */ /**@}*/ |