From: Shawn Guo <shawnguo@kernel.org>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH] firmware: imx: add get resource owner api
Date: Fri, 28 Jan 2022 16:56:34 +0800 [thread overview]
Message-ID: <20220128085633.GG4686@dragon> (raw)
In-Reply-To: <20220111032147.342012-1-peng.fan@oss.nxp.com>
On Tue, Jan 11, 2022 at 11:21:47AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> 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>
> ---
> drivers/firmware/imx/rm.c | 45 +++++++++++++++++++++++++++++
> include/linux/firmware/imx/svc/rm.h | 5 ++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/drivers/firmware/imx/rm.c b/drivers/firmware/imx/rm.c
> index a12db6ff323b..3c3605f98123 100644
> --- a/drivers/firmware/imx/rm.c
> +++ b/drivers/firmware/imx/rm.c
> @@ -43,3 +43,48 @@ bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource)
> return hdr->func;
> }
> EXPORT_SYMBOL(imx_sc_rm_is_resource_owned);
> +
> +/*
> + * This function get @resource partition number
> + *
> + * @param[in] ipc IPC handle
> + * @param[in] resource resource the control is associated with
> + * @param[out] pt pointer to return the partition number
> + *
> + * @return Returns 0 for success and < 0 for errors.
> + */
Shouldn't the documentation be put right above the function?
Shawn
> +struct imx_sc_msg_rm_get_resource_owner {
> + struct imx_sc_rpc_msg hdr;
> + union {
> + struct {
> + u16 resource;
> + } req;
> + struct {
> + u8 val;
> + } resp;
> + } data;
> +} __packed __aligned(4);
> +
> +int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt)
> +{
> + struct imx_sc_msg_rm_get_resource_owner msg;
> + struct imx_sc_rpc_msg *hdr = &msg.hdr;
> + int ret;
> +
> + hdr->ver = IMX_SC_RPC_VERSION;
> + hdr->svc = IMX_SC_RPC_SVC_RM;
> + hdr->func = IMX_SC_RM_FUNC_GET_RESOURCE_OWNER;
> + hdr->size = 2;
> +
> + msg.data.req.resource = resource;
> +
> + ret = imx_scu_call_rpc(ipc, &msg, true);
> + if (ret)
> + return ret;
> +
> + if (pt)
> + *pt = msg.data.resp.val;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(imx_sc_rm_get_resource_owner);
> diff --git a/include/linux/firmware/imx/svc/rm.h b/include/linux/firmware/imx/svc/rm.h
> index 456b6a59d29b..ff481b23ea36 100644
> --- a/include/linux/firmware/imx/svc/rm.h
> +++ b/include/linux/firmware/imx/svc/rm.h
> @@ -59,11 +59,16 @@ enum imx_sc_rm_func {
>
> #if IS_ENABLED(CONFIG_IMX_SCU)
> bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource);
> +int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt);
> #else
> static inline bool
> imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource)
> {
> return true;
> }
> +static inline int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt)
> +{
> + return -ENOTSUPP;
> +}
> #endif
> #endif
> --
> 2.25.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Shawn Guo <shawnguo@kernel.org>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, linux-imx@nxp.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH] firmware: imx: add get resource owner api
Date: Fri, 28 Jan 2022 16:56:34 +0800 [thread overview]
Message-ID: <20220128085633.GG4686@dragon> (raw)
In-Reply-To: <20220111032147.342012-1-peng.fan@oss.nxp.com>
On Tue, Jan 11, 2022 at 11:21:47AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> 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>
> ---
> drivers/firmware/imx/rm.c | 45 +++++++++++++++++++++++++++++
> include/linux/firmware/imx/svc/rm.h | 5 ++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/drivers/firmware/imx/rm.c b/drivers/firmware/imx/rm.c
> index a12db6ff323b..3c3605f98123 100644
> --- a/drivers/firmware/imx/rm.c
> +++ b/drivers/firmware/imx/rm.c
> @@ -43,3 +43,48 @@ bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource)
> return hdr->func;
> }
> EXPORT_SYMBOL(imx_sc_rm_is_resource_owned);
> +
> +/*
> + * This function get @resource partition number
> + *
> + * @param[in] ipc IPC handle
> + * @param[in] resource resource the control is associated with
> + * @param[out] pt pointer to return the partition number
> + *
> + * @return Returns 0 for success and < 0 for errors.
> + */
Shouldn't the documentation be put right above the function?
Shawn
> +struct imx_sc_msg_rm_get_resource_owner {
> + struct imx_sc_rpc_msg hdr;
> + union {
> + struct {
> + u16 resource;
> + } req;
> + struct {
> + u8 val;
> + } resp;
> + } data;
> +} __packed __aligned(4);
> +
> +int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt)
> +{
> + struct imx_sc_msg_rm_get_resource_owner msg;
> + struct imx_sc_rpc_msg *hdr = &msg.hdr;
> + int ret;
> +
> + hdr->ver = IMX_SC_RPC_VERSION;
> + hdr->svc = IMX_SC_RPC_SVC_RM;
> + hdr->func = IMX_SC_RM_FUNC_GET_RESOURCE_OWNER;
> + hdr->size = 2;
> +
> + msg.data.req.resource = resource;
> +
> + ret = imx_scu_call_rpc(ipc, &msg, true);
> + if (ret)
> + return ret;
> +
> + if (pt)
> + *pt = msg.data.resp.val;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(imx_sc_rm_get_resource_owner);
> diff --git a/include/linux/firmware/imx/svc/rm.h b/include/linux/firmware/imx/svc/rm.h
> index 456b6a59d29b..ff481b23ea36 100644
> --- a/include/linux/firmware/imx/svc/rm.h
> +++ b/include/linux/firmware/imx/svc/rm.h
> @@ -59,11 +59,16 @@ enum imx_sc_rm_func {
>
> #if IS_ENABLED(CONFIG_IMX_SCU)
> bool imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource);
> +int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt);
> #else
> static inline bool
> imx_sc_rm_is_resource_owned(struct imx_sc_ipc *ipc, u16 resource)
> {
> return true;
> }
> +static inline int imx_sc_rm_get_resource_owner(struct imx_sc_ipc *ipc, u16 resource, u8 *pt)
> +{
> + return -ENOTSUPP;
> +}
> #endif
> #endif
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-01-28 8:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 3:21 [PATCH] firmware: imx: add get resource owner api Peng Fan (OSS)
2022-01-11 3:21 ` Peng Fan (OSS)
2022-01-26 8:23 ` Peng Fan
2022-01-26 8:23 ` Peng Fan
2022-01-28 8:56 ` Shawn Guo [this message]
2022-01-28 8:56 ` Shawn Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220128085633.GG4686@dragon \
--to=shawnguo@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.