Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: imx: add get resource owner api

Add resource owner management API, this API could be used to check
whether M4 is under control of Linux.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>

authored by

Peng Fan and committed by
Shawn Guo
6d240170 608d7c32

+50
+45
drivers/firmware/imx/rm.c
··· 43 43 return hdr->func; 44 44 } 45 45 EXPORT_SYMBOL(imx_sc_rm_is_resource_owned); 46 + 47 + struct imx_sc_msg_rm_get_resource_owner { 48 + struct imx_sc_rpc_msg hdr; 49 + union { 50 + struct { 51 + u16 resource; 52 + } req; 53 + struct { 54 + u8 val; 55 + } resp; 56 + } data; 57 + } __packed __aligned(4); 58 + 59 + /* 60 + * This function get @resource partition number 61 + * 62 + * @param[in] ipc IPC handle 63 + * @param[in] resource resource the control is associated with 64 + * @param[out] pt pointer to return the partition number 65 + * 66 + * @return Returns 0 for success and < 0 for errors. 67 + */ 68 + int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt) 69 + { 70 + struct imx_sc_msg_rm_get_resource_owner msg; 71 + struct imx_sc_rpc_msg *hdr = &msg.hdr; 72 + int ret; 73 + 74 + hdr->ver = IMX_SC_RPC_VERSION; 75 + hdr->svc = IMX_SC_RPC_SVC_RM; 76 + hdr->func = IMX_SC_RM_FUNC_GET_RESOURCE_OWNER; 77 + hdr->size = 2; 78 + 79 + msg.data.req.resource = resource; 80 + 81 + ret = imx_scu_call_rpc(ipc, &msg, true); 82 + if (ret) 83 + return ret; 84 + 85 + if (pt) 86 + *pt = msg.data.resp.val; 87 + 88 + return 0; 89 + } 90 + EXPORT_SYMBOL(imx_sc_rm_get_resource_owner);
+5
include/linux/firmware/imx/svc/rm.h
··· 59 59 60 60 #if IS_ENABLED(CONFIG_IMX_SCU) 61 61 bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource); 62 + int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt); 62 63 #else 63 64 static inline bool 64 65 imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource) 65 66 { 66 67 return true; 68 + } 69 + static inline int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt) 70 + { 71 + return -EOPNOTSUPP; 67 72 } 68 73 #endif 69 74 #endif