summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2019-02-09 19:54:15 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:36:03 +0800
commit594b74f6622bf7e44c26bdfbfd51a33abf7defba (patch)
tree3ef686028805d34f61ba3900b8af14a85d8d6865 /drivers
parent955b970c335c4e12697c89b16e953c95b7fde9aa (diff)
MLK-20899 soc: imx: update SCFW APIs
Update SCFW APIs to SCFW commit: 5c03342369e8 ("SCF-105: Change links in wiki index.") Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/imx/sc/Makefile1
-rw-r--r--drivers/soc/imx/sc/main/rpc.h14
-rw-r--r--drivers/soc/imx/sc/svc/irq/rpc.h13
-rw-r--r--drivers/soc/imx/sc/svc/irq/rpc_clnt.c12
-rw-r--r--drivers/soc/imx/sc/svc/misc/rpc.h76
-rw-r--r--drivers/soc/imx/sc/svc/misc/rpc_clnt.c154
-rw-r--r--drivers/soc/imx/sc/svc/pad/rpc.h41
-rw-r--r--drivers/soc/imx/sc/svc/pad/rpc_clnt.c178
-rw-r--r--drivers/soc/imx/sc/svc/pm/rpc.h58
-rw-r--r--drivers/soc/imx/sc/svc/pm/rpc_clnt.c126
-rw-r--r--drivers/soc/imx/sc/svc/rm/rpc.h74
-rw-r--r--drivers/soc/imx/sc/svc/rm/rpc_clnt.c106
-rw-r--r--drivers/soc/imx/sc/svc/seco/rpc.h64
-rw-r--r--drivers/soc/imx/sc/svc/seco/rpc_clnt.c430
-rw-r--r--drivers/soc/imx/sc/svc/timer/rpc.h45
-rw-r--r--drivers/soc/imx/sc/svc/timer/rpc_clnt.c98
16 files changed, 1003 insertions, 487 deletions
diff --git a/drivers/soc/imx/sc/Makefile b/drivers/soc/imx/sc/Makefile
index 851c687ce7b3..aa22af211519 100644
--- a/drivers/soc/imx/sc/Makefile
+++ b/drivers/soc/imx/sc/Makefile
@@ -5,4 +5,5 @@ obj-y += svc/pm/rpc_clnt.o
obj-y += svc/rm/rpc_clnt.o
obj-y += svc/timer/rpc_clnt.o
obj-y += svc/irq/rpc_clnt.o
+obj-y += svc/seco/rpc_clnt.o
diff --git a/drivers/soc/imx/sc/main/rpc.h b/drivers/soc/imx/sc/main/rpc.h
index d6bc39e3cb19..ca20613d19a0 100644
--- a/drivers/soc/imx/sc/main/rpc.h
+++ b/drivers/soc/imx/sc/main/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -43,7 +43,8 @@
#define SC_RPC_SVC_PAD 6U
#define SC_RPC_SVC_MISC 7U
#define SC_RPC_SVC_IRQ 8U
-#define SC_RPC_SVC_ABORT 9U
+#define SC_RPC_SVC_SECO 9U
+#define SC_RPC_SVC_ABORT 10U
#define SC_RPC_ASYNC_STATE_RD_START 0U
#define SC_RPC_ASYNC_STATE_RD_ACTIVE 1U
@@ -53,6 +54,8 @@
#define SC_RPC_ASYNC_STATE_WR_DONE 5U
#define SC_RPC_MU_GIR_SVC 0x1U
+#define SC_RPC_MU_GIR_WAKE 0x2U
+#define SC_RPC_MU_GIR_BOOT 0x4U
#define SC_RPC_MU_GIR_DBG 0x8U
#define I8(X) ((int8_t) (X))
@@ -83,7 +86,7 @@
typedef uint8_t sc_rpc_svc_t;
-typedef struct sc_rpc_msg_s {
+typedef struct {
uint8_t version;
uint8_t size;
uint8_t svc;
@@ -100,7 +103,7 @@ typedef struct sc_rpc_msg_s {
typedef uint8_t sc_rpc_async_state_t;
-typedef struct sc_rpc_async_msg_s {
+typedef struct {
sc_rpc_async_state_t state;
uint8_t wordIdx;
sc_rpc_msg_t msg;
@@ -148,4 +151,5 @@ void sc_rpc_dispatch(sc_rsrc_t mu, sc_rpc_msg_t *msg);
*/
void sc_rpc_xlate(sc_ipc_t ipc, sc_rpc_msg_t *msg);
-#endif /* SC_RPC_H */
+#endif /* SC_RPC_H */
+
diff --git a/drivers/soc/imx/sc/svc/irq/rpc.h b/drivers/soc/imx/sc/svc/irq/rpc.h
index 216659d0bcba..2590e9ebd896 100644
--- a/drivers/soc/imx/sc/svc/irq/rpc.h
+++ b/drivers/soc/imx/sc/svc/irq/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,9 +23,9 @@
* @name Defines for RPC IRQ function calls
*/
/*@{*/
-#define IRQ_FUNC_UNKNOWN 0 /* Unknown function */
-#define IRQ_FUNC_ENABLE 1U /* Index for irq_enable() RPC call */
-#define IRQ_FUNC_STATUS 2U /* Index for irq_status() RPC call */
+#define IRQ_FUNC_UNKNOWN 0 /* Unknown function */
+#define IRQ_FUNC_ENABLE 1U /* Index for irq_enable() RPC call */
+#define IRQ_FUNC_STATUS 2U /* Index for irq_status() RPC call */
/*@}*/
/* Types */
@@ -38,8 +38,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void irq_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void irq_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_IRQ_RPC_H */
+#endif /* SC_IRQ_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/irq/rpc_clnt.c b/drivers/soc/imx/sc/svc/irq/rpc_clnt.c
index 881e19a8c19f..9cea4d7ce8c6 100644
--- a/drivers/soc/imx/sc/svc/irq/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/irq/rpc_clnt.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -28,7 +28,7 @@
/* Local Functions */
sc_err_t sc_irq_enable(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_irq_group_t group, uint32_t mask, sc_bool_t enable)
+ sc_irq_group_t group, uint32_t mask, sc_bool_t enable)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -49,7 +49,7 @@ sc_err_t sc_irq_enable(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_irq_status(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_irq_group_t group, uint32_t *status)
+ sc_irq_group_t group, uint32_t *status)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -63,12 +63,12 @@ sc_err_t sc_irq_status(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (status != NULL) {
- *status = RPC_U32(&msg, 0U);
- }
+ if (status != NULL)
+ *status = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/misc/rpc.h b/drivers/soc/imx/sc/svc/misc/rpc.h
index df0604fe4ae5..cec8791a5fc0 100644
--- a/drivers/soc/imx/sc/svc/misc/rpc.h
+++ b/drivers/soc/imx/sc/svc/misc/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,40 +23,41 @@
* @name Defines for RPC MISC function calls
*/
/*@{*/
-#define MISC_FUNC_UNKNOWN 0 /* Unknown function */
-#define MISC_FUNC_SET_CONTROL 1U /* Index for misc_set_control() RPC call */
-#define MISC_FUNC_GET_CONTROL 2U /* Index for misc_get_control() RPC call */
-#define MISC_FUNC_SET_MAX_DMA_GROUP 4U /* Index for misc_set_max_dma_group() RPC call */
-#define MISC_FUNC_SET_DMA_GROUP 5U /* Index for misc_set_dma_group() RPC call */
-#define MISC_FUNC_SECO_IMAGE_LOAD 8U /* Index for misc_seco_image_load() RPC call */
-#define MISC_FUNC_SECO_AUTHENTICATE 9U /* Index for misc_seco_authenticate() RPC call */
-#define MISC_FUNC_SECO_FUSE_WRITE 20U /* Index for misc_seco_fuse_write() RPC call */
-#define MISC_FUNC_SECO_ENABLE_DEBUG 21U /* Index for misc_seco_enable_debug() RPC call */
-#define MISC_FUNC_SECO_FORWARD_LIFECYCLE 22U /* Index for misc_seco_forward_lifecycle() RPC call */
-#define MISC_FUNC_SECO_RETURN_LIFECYCLE 23U /* Index for misc_seco_return_lifecycle() RPC call */
-#define MISC_FUNC_SECO_BUILD_INFO 24U /* Index for misc_seco_build_info() RPC call */
-#define MISC_FUNC_SECO_CHIP_INFO 25U /* Index for misc_seco_chip_info() RPC call */
-#define MISC_FUNC_SECO_ATTEST_MODE 27U /* Index for misc_seco_attest_mode() RPC call */
-#define MISC_FUNC_SECO_ATTEST 28U /* Index for misc_seco_attest() RPC call */
-#define MISC_FUNC_SECO_GET_ATTEST_PKEY 31U /* Index for misc_seco_get_attest_pkey() RPC call */
-#define MISC_FUNC_SECO_GET_ATTEST_SIGN 29U /* Index for misc_seco_get_attest_sign() RPC call */
-#define MISC_FUNC_SECO_ATTEST_VERIFY 30U /* Index for misc_seco_attest_verify() RPC call */
-#define MISC_FUNC_SECO_COMMIT 32U /* Index for misc_seco_commit() RPC call */
-#define MISC_FUNC_DEBUG_OUT 10U /* Index for misc_debug_out() RPC call */
-#define MISC_FUNC_WAVEFORM_CAPTURE 6U /* Index for misc_waveform_capture() RPC call */
-#define MISC_FUNC_BUILD_INFO 15U /* Index for misc_build_info() RPC call */
-#define MISC_FUNC_UNIQUE_ID 19U /* Index for misc_unique_id() RPC call */
-#define MISC_FUNC_SET_ARI 3U /* Index for misc_set_ari() RPC call */
-#define MISC_FUNC_BOOT_STATUS 7U /* Index for misc_boot_status() RPC call */
-#define MISC_FUNC_BOOT_DONE 14U /* Index for misc_boot_done() RPC call */
-#define MISC_FUNC_OTP_FUSE_READ 11U /* Index for misc_otp_fuse_read() RPC call */
-#define MISC_FUNC_OTP_FUSE_WRITE 17U /* Index for misc_otp_fuse_write() RPC call */
-#define MISC_FUNC_SET_TEMP 12U /* Index for misc_set_temp() RPC call */
-#define MISC_FUNC_GET_TEMP 13U /* Index for misc_get_temp() RPC call */
-#define MISC_FUNC_GET_BOOT_DEV 16U /* Index for misc_get_boot_dev() RPC call */
-#define MISC_FUNC_GET_BOOT_TYPE 33U /* Index for misc_get_boot_type() RPC call */
-#define MISC_FUNC_GET_BUTTON_STATUS 18U /* Index for misc_get_button_status() RPC call */
-#define MISC_FUNC_ROMPATCH_CHECKSUM 26U /* Index for misc_rompatch_checksum() RPC call */
+#define MISC_FUNC_UNKNOWN 0 /* Unknown function */
+#define MISC_FUNC_SET_CONTROL 1U /* Index for misc_set_control() RPC call */
+#define MISC_FUNC_GET_CONTROL 2U /* Index for misc_get_control() RPC call */
+#define MISC_FUNC_SET_MAX_DMA_GROUP 4U /* Index for misc_set_max_dma_group() RPC call */
+#define MISC_FUNC_SET_DMA_GROUP 5U /* Index for misc_set_dma_group() RPC call */
+#define MISC_FUNC_SECO_IMAGE_LOAD 8U /* Index for misc_seco_image_load() RPC call */
+#define MISC_FUNC_SECO_AUTHENTICATE 9U /* Index for misc_seco_authenticate() RPC call */
+#define MISC_FUNC_SECO_FUSE_WRITE 20U /* Index for misc_seco_fuse_write() RPC call */
+#define MISC_FUNC_SECO_ENABLE_DEBUG 21U /* Index for misc_seco_enable_debug() RPC call */
+#define MISC_FUNC_SECO_FORWARD_LIFECYCLE 22U /* Index for misc_seco_forward_lifecycle() RPC call */
+#define MISC_FUNC_SECO_RETURN_LIFECYCLE 23U /* Index for misc_seco_return_lifecycle() RPC call */
+#define MISC_FUNC_SECO_BUILD_INFO 24U /* Index for misc_seco_build_info() RPC call */
+#define MISC_FUNC_SECO_CHIP_INFO 25U /* Index for misc_seco_chip_info() RPC call */
+#define MISC_FUNC_SECO_ATTEST_MODE 27U /* Index for misc_seco_attest_mode() RPC call */
+#define MISC_FUNC_SECO_ATTEST 28U /* Index for misc_seco_attest() RPC call */
+#define MISC_FUNC_SECO_GET_ATTEST_PKEY 31U /* Index for misc_seco_get_attest_pkey() RPC call */
+#define MISC_FUNC_SECO_GET_ATTEST_SIGN 29U /* Index for misc_seco_get_attest_sign() RPC call */
+#define MISC_FUNC_SECO_ATTEST_VERIFY 30U /* Index for misc_seco_attest_verify() RPC call */
+#define MISC_FUNC_SECO_COMMIT 32U /* Index for misc_seco_commit() RPC call */
+#define MISC_FUNC_DEBUG_OUT 10U /* Index for misc_debug_out() RPC call */
+#define MISC_FUNC_WAVEFORM_CAPTURE 6U /* Index for misc_waveform_capture() RPC call */
+#define MISC_FUNC_BUILD_INFO 15U /* Index for misc_build_info() RPC call */
+#define MISC_FUNC_UNIQUE_ID 19U /* Index for misc_unique_id() RPC call */
+#define MISC_FUNC_SET_ARI 3U /* Index for misc_set_ari() RPC call */
+#define MISC_FUNC_BOOT_STATUS 7U /* Index for misc_boot_status() RPC call */
+#define MISC_FUNC_BOOT_DONE 14U /* Index for misc_boot_done() RPC call */
+#define MISC_FUNC_OTP_FUSE_READ 11U /* Index for misc_otp_fuse_read() RPC call */
+#define MISC_FUNC_OTP_FUSE_WRITE 17U /* Index for misc_otp_fuse_write() RPC call */
+#define MISC_FUNC_SET_TEMP 12U /* Index for misc_set_temp() RPC call */
+#define MISC_FUNC_GET_TEMP 13U /* Index for misc_get_temp() RPC call */
+#define MISC_FUNC_GET_BOOT_DEV 16U /* Index for misc_get_boot_dev() RPC call */
+#define MISC_FUNC_GET_BOOT_TYPE 33U /* Index for misc_get_boot_type() RPC call */
+#define MISC_FUNC_GET_BUTTON_STATUS 18U /* Index for misc_get_button_status() RPC call */
+#define MISC_FUNC_ROMPATCH_CHECKSUM 26U /* Index for misc_rompatch_checksum() RPC call */
+#define MISC_FUNC_BOARD_IOCTL 34U /* Index for misc_board_ioctl() RPC call */
/*@}*/
/* Types */
@@ -69,8 +70,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void misc_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void misc_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_MISC_RPC_H */
+#endif /* SC_MISC_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/misc/rpc_clnt.c b/drivers/soc/imx/sc/svc/misc/rpc_clnt.c
index ab36e879bd8b..faffbd75c27d 100644
--- a/drivers/soc/imx/sc/svc/misc/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/misc/rpc_clnt.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -28,7 +28,7 @@
/* Local Functions */
sc_err_t sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_ctrl_t ctrl, uint32_t val)
+ sc_ctrl_t ctrl, uint32_t val)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -48,7 +48,7 @@ sc_err_t sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_ctrl_t ctrl, uint32_t *val)
+ sc_ctrl_t ctrl, uint32_t *val)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -62,16 +62,15 @@ sc_err_t sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (val != NULL) {
- *val = RPC_U32(&msg, 0U);
- }
+ if (val != NULL)
+ *val = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_misc_set_max_dma_group(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_misc_dma_group_t max)
+ sc_misc_dma_group_t max)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -90,7 +89,7 @@ sc_err_t sc_misc_set_max_dma_group(sc_ipc_t ipc, sc_rm_pt_t pt,
}
sc_err_t sc_misc_set_dma_group(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_misc_dma_group_t group)
+ sc_misc_dma_group_t group)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -109,8 +108,7 @@ sc_err_t sc_misc_set_dma_group(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_misc_seco_image_load(sc_ipc_t ipc, sc_faddr_t addr_src,
- sc_faddr_t addr_dst, uint32_t len,
- sc_bool_t fw)
+ sc_faddr_t addr_dst, uint32_t len, sc_bool_t fw)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -133,7 +131,7 @@ sc_err_t sc_misc_seco_image_load(sc_ipc_t ipc, sc_faddr_t addr_src,
}
sc_err_t sc_misc_seco_authenticate(sc_ipc_t ipc,
- sc_misc_seco_auth_cmd_t cmd, sc_faddr_t addr)
+ sc_misc_seco_auth_cmd_t cmd, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -223,7 +221,8 @@ sc_err_t sc_misc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr)
return (sc_err_t)result;
}
-void sc_misc_seco_build_info(sc_ipc_t ipc, uint32_t *version, uint32_t *commit)
+void sc_misc_seco_build_info(sc_ipc_t ipc, uint32_t *version,
+ uint32_t *commit)
{
sc_rpc_msg_t msg;
@@ -234,20 +233,17 @@ void sc_misc_seco_build_info(sc_ipc_t ipc, uint32_t *version, uint32_t *commit)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (version != NULL) {
- *version = RPC_U32(&msg, 0U);
- }
+ if (version != NULL)
+ *version = RPC_U32(&msg, 0U);
- if (commit != NULL) {
- *commit = RPC_U32(&msg, 4U);
- }
+ if (commit != NULL)
+ *commit = RPC_U32(&msg, 4U);
return;
}
sc_err_t sc_misc_seco_chip_info(sc_ipc_t ipc, uint16_t *lc,
- uint16_t *monotonic, uint32_t *uid_l,
- uint32_t *uid_h)
+ uint16_t *monotonic, uint32_t *uid_l, uint32_t *uid_h)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -259,21 +255,17 @@ sc_err_t sc_misc_seco_chip_info(sc_ipc_t ipc, uint16_t *lc,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (uid_l != NULL) {
- *uid_l = RPC_U32(&msg, 0U);
- }
+ if (uid_l != NULL)
+ *uid_l = RPC_U32(&msg, 0U);
- if (uid_h != NULL) {
- *uid_h = RPC_U32(&msg, 4U);
- }
+ if (uid_h != NULL)
+ *uid_h = RPC_U32(&msg, 4U);
- if (lc != NULL) {
- *lc = RPC_U16(&msg, 8U);
- }
+ if (lc != NULL)
+ *lc = RPC_U16(&msg, 8U);
- if (monotonic != NULL) {
- *monotonic = RPC_U16(&msg, 10U);
- }
+ if (monotonic != NULL)
+ *monotonic = RPC_U16(&msg, 10U);
result = RPC_R8(&msg);
return (sc_err_t)result;
@@ -418,7 +410,8 @@ sc_err_t sc_misc_waveform_capture(sc_ipc_t ipc, sc_bool_t enable)
return (sc_err_t)result;
}
-void sc_misc_build_info(sc_ipc_t ipc, uint32_t *build, uint32_t *commit)
+void sc_misc_build_info(sc_ipc_t ipc, uint32_t *build,
+ uint32_t *commit)
{
sc_rpc_msg_t msg;
@@ -429,18 +422,15 @@ void sc_misc_build_info(sc_ipc_t ipc, uint32_t *build, uint32_t *commit)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (build != NULL) {
- *build = RPC_U32(&msg, 0U);
- }
+ if (build != NULL)
+ *build = RPC_U32(&msg, 0U);
- if (commit != NULL) {
- *commit = RPC_U32(&msg, 4U);
- }
-
- return;
+ if (commit != NULL)
+ *commit = RPC_U32(&msg, 4U);
}
-void sc_misc_unique_id(sc_ipc_t ipc, uint32_t *id_l, uint32_t *id_h)
+void sc_misc_unique_id(sc_ipc_t ipc, uint32_t *id_l,
+ uint32_t *id_h)
{
sc_rpc_msg_t msg;
@@ -451,19 +441,17 @@ void sc_misc_unique_id(sc_ipc_t ipc, uint32_t *id_l, uint32_t *id_h)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (id_l != NULL) {
- *id_l = RPC_U32(&msg, 0U);
- }
+ if (id_l != NULL)
+ *id_l = RPC_U32(&msg, 0U);
- if (id_h != NULL) {
- *id_h = RPC_U32(&msg, 4U);
- }
+ if (id_h != NULL)
+ *id_h = RPC_U32(&msg, 4U);
return;
}
sc_err_t sc_misc_set_ari(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_rsrc_t resource_mst, uint16_t ari, sc_bool_t enable)
+ sc_rsrc_t resource_mst, uint16_t ari, sc_bool_t enable)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -528,9 +516,8 @@ sc_err_t sc_misc_otp_fuse_read(sc_ipc_t ipc, uint32_t word, uint32_t *val)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (val != NULL) {
- *val = RPC_U32(&msg, 0U);
- }
+ if (val != NULL)
+ *val = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
@@ -555,7 +542,7 @@ sc_err_t sc_misc_otp_fuse_write(sc_ipc_t ipc, uint32_t word, uint32_t val)
}
sc_err_t sc_misc_set_temp(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_misc_temp_t temp, int16_t celsius, int8_t tenths)
+ sc_misc_temp_t temp, int16_t celsius, int8_t tenths)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -576,8 +563,7 @@ sc_err_t sc_misc_set_temp(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_misc_temp_t temp, int16_t * celsius,
- int8_t * tenths)
+ sc_misc_temp_t temp, int16_t *celsius, int8_t *tenths)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -591,14 +577,12 @@ sc_err_t sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (celsius != NULL) {
- *celsius = RPC_I16(&msg, 0U);
- }
+ if (celsius != NULL)
+ *celsius = RPC_I16(&msg, 0U);
result = RPC_R8(&msg);
- if (tenths != NULL) {
- *tenths = RPC_I8(&msg, 2U);
- }
+ if (tenths != NULL)
+ *tenths = RPC_I8(&msg, 2U);
return (sc_err_t)result;
}
@@ -614,11 +598,8 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *dev)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (dev != NULL) {
- *dev = RPC_U16(&msg, 0U);
- }
-
- return;
+ if (dev != NULL)
+ *dev = RPC_U16(&msg, 0U);
}
sc_err_t sc_misc_get_boot_type(sc_ipc_t ipc, sc_misc_bt_t *type)
@@ -634,9 +615,8 @@ sc_err_t sc_misc_get_boot_type(sc_ipc_t ipc, sc_misc_bt_t *type)
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (type != NULL) {
- *type = RPC_U8(&msg, 0U);
- }
+ if (type != NULL)
+ *type = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
@@ -652,11 +632,8 @@ void sc_misc_get_button_status(sc_ipc_t ipc, sc_bool_t *status)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (status != NULL) {
- *status = U2B(RPC_U8(&msg, 0U));
- }
-
- return;
+ if (status != NULL)
+ *status = U2B(RPC_U8(&msg, 0U));
}
sc_err_t sc_misc_rompatch_checksum(sc_ipc_t ipc, uint32_t *checksum)
@@ -671,12 +648,35 @@ sc_err_t sc_misc_rompatch_checksum(sc_ipc_t ipc, uint32_t *checksum)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (checksum != NULL) {
- *checksum = RPC_U32(&msg, 0U);
- }
+ if (checksum != NULL)
+ *checksum = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
+sc_err_t sc_misc_board_ioctl(sc_ipc_t ipc, uint32_t *parm1,
+ uint32_t *parm2, uint32_t *parm3)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
+ RPC_FUNC(&msg) = U8(MISC_FUNC_BOARD_IOCTL);
+ RPC_U32(&msg, 0U) = *PTR_U32(parm1);
+ RPC_U32(&msg, 4U) = *PTR_U32(parm2);
+ RPC_U32(&msg, 8U) = *PTR_U32(parm3);
+ RPC_SIZE(&msg) = 4U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ *parm1 = RPC_U32(&msg, 0U);
+ *parm2 = RPC_U32(&msg, 4U);
+ *parm3 = RPC_U32(&msg, 8U);
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/pad/rpc.h b/drivers/soc/imx/sc/svc/pad/rpc.h
index b00b9c13255d..c72947ebf123 100644
--- a/drivers/soc/imx/sc/svc/pad/rpc.h
+++ b/drivers/soc/imx/sc/svc/pad/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,23 +23,23 @@
* @name Defines for RPC PAD function calls
*/
/*@{*/
-#define PAD_FUNC_UNKNOWN 0 /* Unknown function */
-#define PAD_FUNC_SET_MUX 1U /* Index for pad_set_mux() RPC call */
-#define PAD_FUNC_GET_MUX 6U /* Index for pad_get_mux() RPC call */
-#define PAD_FUNC_SET_GP 2U /* Index for pad_set_gp() RPC call */
-#define PAD_FUNC_GET_GP 7U /* Index for pad_get_gp() RPC call */
-#define PAD_FUNC_SET_WAKEUP 4U /* Index for pad_set_wakeup() RPC call */
-#define PAD_FUNC_GET_WAKEUP 9U /* Index for pad_get_wakeup() RPC call */
-#define PAD_FUNC_SET_ALL 5U /* Index for pad_set_all() RPC call */
-#define PAD_FUNC_GET_ALL 10U /* Index for pad_get_all() RPC call */
-#define PAD_FUNC_SET 15U /* Index for pad_set() RPC call */
-#define PAD_FUNC_GET 16U /* Index for pad_get() RPC call */
-#define PAD_FUNC_SET_GP_28FDSOI 11U /* Index for pad_set_gp_28fdsoi() RPC call */
-#define PAD_FUNC_GET_GP_28FDSOI 12U /* Index for pad_get_gp_28fdsoi() RPC call */
-#define PAD_FUNC_SET_GP_28FDSOI_HSIC 3U /* Index for pad_set_gp_28fdsoi_hsic() RPC call */
-#define PAD_FUNC_GET_GP_28FDSOI_HSIC 8U /* Index for pad_get_gp_28fdsoi_hsic() RPC call */
-#define PAD_FUNC_SET_GP_28FDSOI_COMP 13U /* Index for pad_set_gp_28fdsoi_comp() RPC call */
-#define PAD_FUNC_GET_GP_28FDSOI_COMP 14U /* Index for pad_get_gp_28fdsoi_comp() RPC call */
+#define PAD_FUNC_UNKNOWN 0 /* Unknown function */
+#define PAD_FUNC_SET_MUX 1U /* Index for pad_set_mux() RPC call */
+#define PAD_FUNC_GET_MUX 6U /* Index for pad_get_mux() RPC call */
+#define PAD_FUNC_SET_GP 2U /* Index for pad_set_gp() RPC call */
+#define PAD_FUNC_GET_GP 7U /* Index for pad_get_gp() RPC call */
+#define PAD_FUNC_SET_WAKEUP 4U /* Index for pad_set_wakeup() RPC call */
+#define PAD_FUNC_GET_WAKEUP 9U /* Index for pad_get_wakeup() RPC call */
+#define PAD_FUNC_SET_ALL 5U /* Index for pad_set_all() RPC call */
+#define PAD_FUNC_GET_ALL 10U /* Index for pad_get_all() RPC call */
+#define PAD_FUNC_SET 15U /* Index for pad_set() RPC call */
+#define PAD_FUNC_GET 16U /* Index for pad_get() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI 11U /* Index for pad_set_gp_28fdsoi() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI 12U /* Index for pad_get_gp_28fdsoi() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI_HSIC 3U /* Index for pad_set_gp_28fdsoi_hsic() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI_HSIC 8U /* Index for pad_get_gp_28fdsoi_hsic() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI_COMP 13U /* Index for pad_set_gp_28fdsoi_comp() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI_COMP 14U /* Index for pad_get_gp_28fdsoi_comp() RPC call */
/*@}*/
/* Types */
@@ -52,8 +52,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void pad_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void pad_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_PAD_RPC_H */
+#endif /* SC_PAD_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/pad/rpc_clnt.c b/drivers/soc/imx/sc/svc/pad/rpc_clnt.c
index 02677450fcf1..da78b98b4927 100644
--- a/drivers/soc/imx/sc/svc/pad/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/pad/rpc_clnt.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -28,7 +28,7 @@
/* Local Functions */
sc_err_t sc_pad_set_mux(sc_ipc_t ipc, sc_pad_t pad,
- uint8_t mux, sc_pad_config_t config, sc_pad_iso_t iso)
+ uint8_t mux, sc_pad_config_t config, sc_pad_iso_t iso)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -49,8 +49,7 @@ sc_err_t sc_pad_set_mux(sc_ipc_t ipc, sc_pad_t pad,
}
sc_err_t sc_pad_get_mux(sc_ipc_t ipc, sc_pad_t pad,
- uint8_t *mux, sc_pad_config_t *config,
- sc_pad_iso_t *iso)
+ uint8_t *mux, sc_pad_config_t *config, sc_pad_iso_t *iso)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -64,17 +63,14 @@ sc_err_t sc_pad_get_mux(sc_ipc_t ipc, sc_pad_t pad,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mux != NULL) {
- *mux = RPC_U8(&msg, 0U);
- }
+ if (mux != NULL)
+ *mux = RPC_U8(&msg, 0U);
- if (config != NULL) {
- *config = RPC_U8(&msg, 1U);
- }
+ if (config != NULL)
+ *config = RPC_U8(&msg, 1U);
- if (iso != NULL) {
- *iso = RPC_U8(&msg, 2U);
- }
+ if (iso != NULL)
+ *iso = RPC_U8(&msg, 2U);
return (sc_err_t)result;
}
@@ -110,15 +106,15 @@ sc_err_t sc_pad_get_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t *ctrl)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (ctrl != NULL) {
- *ctrl = RPC_U32(&msg, 0U);
- }
+ if (ctrl != NULL)
+ *ctrl = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
-sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t wakeup)
+sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad,
+ sc_pad_wakeup_t wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -136,7 +132,8 @@ sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t wakeup)
return (sc_err_t)result;
}
-sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t *wakeup)
+sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad,
+ sc_pad_wakeup_t *wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -150,16 +147,15 @@ sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t *wakeup)
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (wakeup != NULL) {
- *wakeup = RPC_U8(&msg, 0U);
- }
+ if (wakeup != NULL)
+ *wakeup = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
- sc_pad_config_t config, sc_pad_iso_t iso, uint32_t ctrl,
- sc_pad_wakeup_t wakeup)
+ sc_pad_config_t config, sc_pad_iso_t iso, uint32_t ctrl,
+ sc_pad_wakeup_t wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -182,8 +178,8 @@ sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
}
sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
- sc_pad_config_t *config, sc_pad_iso_t *iso,
- uint32_t *ctrl, sc_pad_wakeup_t *wakeup)
+ sc_pad_config_t *config, sc_pad_iso_t *iso, uint32_t *ctrl,
+ sc_pad_wakeup_t *wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -196,26 +192,21 @@ sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (ctrl != NULL) {
- *ctrl = RPC_U32(&msg, 0U);
- }
+ if (ctrl != NULL)
+ *ctrl = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
- if (mux != NULL) {
- *mux = RPC_U8(&msg, 4U);
- }
+ if (mux != NULL)
+ *mux = RPC_U8(&msg, 4U);
- if (config != NULL) {
- *config = RPC_U8(&msg, 5U);
- }
+ if (config != NULL)
+ *config = RPC_U8(&msg, 5U);
- if (iso != NULL) {
- *iso = RPC_U8(&msg, 6U);
- }
+ if (iso != NULL)
+ *iso = RPC_U8(&msg, 6U);
- if (wakeup != NULL) {
- *wakeup = RPC_U8(&msg, 7U);
- }
+ if (wakeup != NULL)
+ *wakeup = RPC_U8(&msg, 7U);
return (sc_err_t)result;
}
@@ -251,16 +242,15 @@ sc_err_t sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (val != NULL) {
- *val = RPC_U32(&msg, 0U);
- }
+ if (val != NULL)
+ *val = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad,
- sc_pad_28fdsoi_dse_t dse, sc_pad_28fdsoi_ps_t ps)
+ sc_pad_28fdsoi_dse_t dse, sc_pad_28fdsoi_ps_t ps)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -280,8 +270,7 @@ sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad,
}
sc_err_t sc_pad_get_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad,
- sc_pad_28fdsoi_dse_t *dse,
- sc_pad_28fdsoi_ps_t *ps)
+ sc_pad_28fdsoi_dse_t *dse, sc_pad_28fdsoi_ps_t *ps)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -295,21 +284,18 @@ sc_err_t sc_pad_get_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (dse != NULL) {
- *dse = RPC_U8(&msg, 0U);
- }
+ if (dse != NULL)
+ *dse = RPC_U8(&msg, 0U);
- if (ps != NULL) {
- *ps = RPC_U8(&msg, 1U);
- }
+ if (ps != NULL)
+ *ps = RPC_U8(&msg, 1U);
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
- sc_pad_28fdsoi_dse_t dse, sc_bool_t hys,
- sc_pad_28fdsoi_pus_t pus, sc_bool_t pke,
- sc_bool_t pue)
+ sc_pad_28fdsoi_dse_t dse, sc_bool_t hys, sc_pad_28fdsoi_pus_t pus,
+ sc_bool_t pke, sc_bool_t pue)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -332,9 +318,8 @@ sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
}
sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
- sc_pad_28fdsoi_dse_t *dse, sc_bool_t *hys,
- sc_pad_28fdsoi_pus_t *pus, sc_bool_t *pke,
- sc_bool_t *pue)
+ sc_pad_28fdsoi_dse_t *dse, sc_bool_t *hys, sc_pad_28fdsoi_pus_t *pus,
+ sc_bool_t *pke, sc_bool_t *pue)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -348,33 +333,27 @@ sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (dse != NULL) {
- *dse = RPC_U8(&msg, 0U);
- }
+ if (dse != NULL)
+ *dse = RPC_U8(&msg, 0U);
- if (pus != NULL) {
- *pus = RPC_U8(&msg, 1U);
- }
+ if (pus != NULL)
+ *pus = RPC_U8(&msg, 1U);
- if (hys != NULL) {
- *hys = U2B(RPC_U8(&msg, 2U));
- }
+ if (hys != NULL)
+ *hys = U2B(RPC_U8(&msg, 2U));
- if (pke != NULL) {
- *pke = U2B(RPC_U8(&msg, 3U));
- }
+ if (pke != NULL)
+ *pke = U2B(RPC_U8(&msg, 3U));
- if (pue != NULL) {
- *pue = U2B(RPC_U8(&msg, 4U));
- }
+ if (pue != NULL)
+ *pue = U2B(RPC_U8(&msg, 4U));
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
- uint8_t compen, sc_bool_t fastfrz,
- uint8_t rasrcp, uint8_t rasrcn,
- sc_bool_t nasrc_sel, sc_bool_t psw_ovr)
+ uint8_t compen, sc_bool_t fastfrz, uint8_t rasrcp, uint8_t rasrcn,
+ sc_bool_t nasrc_sel, sc_bool_t psw_ovr)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -398,10 +377,8 @@ sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
}
sc_err_t sc_pad_get_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
- uint8_t *compen, sc_bool_t *fastfrz,
- uint8_t *rasrcp, uint8_t *rasrcn,
- sc_bool_t *nasrc_sel, sc_bool_t *compok,
- uint8_t *nasrc, sc_bool_t *psw_ovr)
+ uint8_t *compen, sc_bool_t *fastfrz, uint8_t *rasrcp, uint8_t *rasrcn,
+ sc_bool_t *nasrc_sel, sc_bool_t *compok, uint8_t *nasrc, sc_bool_t *psw_ovr)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -415,39 +392,32 @@ sc_err_t sc_pad_get_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (compen != NULL) {
- *compen = RPC_U8(&msg, 0U);
- }
+ if (compen != NULL)
+ *compen = RPC_U8(&msg, 0U);
- if (rasrcp != NULL) {
- *rasrcp = RPC_U8(&msg, 1U);
- }
+ if (rasrcp != NULL)
+ *rasrcp = RPC_U8(&msg, 1U);
- if (rasrcn != NULL) {
- *rasrcn = RPC_U8(&msg, 2U);
- }
+ if (rasrcn != NULL)
+ *rasrcn = RPC_U8(&msg, 2U);
- if (nasrc != NULL) {
- *nasrc = RPC_U8(&msg, 3U);
- }
+ if (nasrc != NULL)
+ *nasrc = RPC_U8(&msg, 3U);
- if (fastfrz != NULL) {
- *fastfrz = U2B(RPC_U8(&msg, 4U));
- }
+ if (fastfrz != NULL)
+ *fastfrz = U2B(RPC_U8(&msg, 4U));
- if (nasrc_sel != NULL) {
- *nasrc_sel = U2B(RPC_U8(&msg, 5U));
- }
+ if (nasrc_sel != NULL)
+ *nasrc_sel = U2B(RPC_U8(&msg, 5U));
- if (compok != NULL) {
- *compok = U2B(RPC_U8(&msg, 6U));
- }
+ if (compok != NULL)
+ *compok = U2B(RPC_U8(&msg, 6U));
- if (psw_ovr != NULL) {
- *psw_ovr = U2B(RPC_U8(&msg, 7U));
- }
+ if (psw_ovr != NULL)
+ *psw_ovr = U2B(RPC_U8(&msg, 7U));
return (sc_err_t)result;
}
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/pm/rpc.h b/drivers/soc/imx/sc/svc/pm/rpc.h
index 037923ae6e95..7585ad3bae99 100644
--- a/drivers/soc/imx/sc/svc/pm/rpc.h
+++ b/drivers/soc/imx/sc/svc/pm/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,30 +23,33 @@
* @name Defines for RPC PM function calls
*/
/*@{*/
-#define PM_FUNC_UNKNOWN 0 /* Unknown function */
-#define PM_FUNC_SET_SYS_POWER_MODE 19U /* Index for pm_set_sys_power_mode() RPC call */
-#define PM_FUNC_SET_PARTITION_POWER_MODE 1U /* Index for pm_set_partition_power_mode() RPC call */
-#define PM_FUNC_GET_SYS_POWER_MODE 2U /* Index for pm_get_sys_power_mode() RPC call */
-#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U /* Index for pm_set_resource_power_mode() RPC call */
-#define PM_FUNC_SET_RESOURCE_POWER_MODE_ALL 22U /* Index for pm_set_resource_power_mode_all() RPC call */
-#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U /* Index for pm_get_resource_power_mode() RPC call */
-#define PM_FUNC_REQ_LOW_POWER_MODE 16U /* Index for pm_req_low_power_mode() RPC call */
-#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U /* Index for pm_req_cpu_low_power_mode() RPC call */
-#define PM_FUNC_SET_CPU_RESUME_ADDR 17U /* Index for pm_set_cpu_resume_addr() RPC call */
-#define PM_FUNC_SET_CPU_RESUME 21U /* Index for pm_set_cpu_resume() RPC call */
-#define PM_FUNC_REQ_SYS_IF_POWER_MODE 18U /* Index for pm_req_sys_if_power_mode() RPC call */
-#define PM_FUNC_SET_CLOCK_RATE 5U /* Index for pm_set_clock_rate() RPC call */
-#define PM_FUNC_GET_CLOCK_RATE 6U /* Index for pm_get_clock_rate() RPC call */
-#define PM_FUNC_CLOCK_ENABLE 7U /* Index for pm_clock_enable() RPC call */
-#define PM_FUNC_SET_CLOCK_PARENT 14U /* Index for pm_set_clock_parent() RPC call */
-#define PM_FUNC_GET_CLOCK_PARENT 15U /* Index for pm_get_clock_parent() RPC call */
-#define PM_FUNC_RESET 13U /* Index for pm_reset() RPC call */
-#define PM_FUNC_RESET_REASON 10U /* Index for pm_reset_reason() RPC call */
-#define PM_FUNC_BOOT 8U /* Index for pm_boot() RPC call */
-#define PM_FUNC_REBOOT 9U /* Index for pm_reboot() RPC call */
-#define PM_FUNC_REBOOT_PARTITION 12U /* Index for pm_reboot_partition() RPC call */
-#define PM_FUNC_CPU_START 11U /* Index for pm_cpu_start() RPC call */
-#define PM_FUNC_CPU_RESET 23U /* Index for pm_cpu_reset() RPC call */
+#define PM_FUNC_UNKNOWN 0 /* Unknown function */
+#define PM_FUNC_SET_SYS_POWER_MODE 19U /* Index for pm_set_sys_power_mode() RPC call */
+#define PM_FUNC_SET_PARTITION_POWER_MODE 1U /* Index for pm_set_partition_power_mode() RPC call */
+#define PM_FUNC_GET_SYS_POWER_MODE 2U /* Index for pm_get_sys_power_mode() RPC call */
+#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U /* Index for pm_set_resource_power_mode() RPC call */
+#define PM_FUNC_SET_RESOURCE_POWER_MODE_ALL 22U /* Index for pm_set_resource_power_mode_all() RPC call */
+#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U /* Index for pm_get_resource_power_mode() RPC call */
+#define PM_FUNC_REQ_LOW_POWER_MODE 16U /* Index for pm_req_low_power_mode() RPC call */
+#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U /* Index for pm_req_cpu_low_power_mode() RPC call */
+#define PM_FUNC_SET_CPU_RESUME_ADDR 17U /* Index for pm_set_cpu_resume_addr() RPC call */
+#define PM_FUNC_SET_CPU_RESUME 21U /* Index for pm_set_cpu_resume() RPC call */
+#define PM_FUNC_REQ_SYS_IF_POWER_MODE 18U /* Index for pm_req_sys_if_power_mode() RPC call */
+#define PM_FUNC_SET_CLOCK_RATE 5U /* Index for pm_set_clock_rate() RPC call */
+#define PM_FUNC_GET_CLOCK_RATE 6U /* Index for pm_get_clock_rate() RPC call */
+#define PM_FUNC_CLOCK_ENABLE 7U /* Index for pm_clock_enable() RPC call */
+#define PM_FUNC_SET_CLOCK_PARENT 14U /* Index for pm_set_clock_parent() RPC call */
+#define PM_FUNC_GET_CLOCK_PARENT 15U /* Index for pm_get_clock_parent() RPC call */
+#define PM_FUNC_RESET 13U /* Index for pm_reset() RPC call */
+#define PM_FUNC_RESET_REASON 10U /* Index for pm_reset_reason() RPC call */
+#define PM_FUNC_GET_RESET_PART 26U /* Index for pm_get_reset_part() RPC call */
+#define PM_FUNC_BOOT 8U /* Index for pm_boot() RPC call */
+#define PM_FUNC_REBOOT 9U /* Index for pm_reboot() RPC call */
+#define PM_FUNC_REBOOT_PARTITION 12U /* Index for pm_reboot_partition() RPC call */
+#define PM_FUNC_REBOOT_CONTINUE 25U /* Index for pm_reboot_continue() RPC call */
+#define PM_FUNC_CPU_START 11U /* Index for pm_cpu_start() RPC call */
+#define PM_FUNC_CPU_RESET 23U /* Index for pm_cpu_reset() RPC call */
+#define PM_FUNC_IS_PARTITION_STARTED 24U /* Index for pm_is_partition_started() RPC call */
/*@}*/
/* Types */
@@ -59,8 +62,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void pm_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void pm_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_PM_RPC_H */
+#endif /* SC_PM_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/pm/rpc_clnt.c b/drivers/soc/imx/sc/svc/pm/rpc_clnt.c
index acbf99c01fcf..640bc93ae414 100644
--- a/drivers/soc/imx/sc/svc/pm/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/pm/rpc_clnt.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -45,7 +45,7 @@ sc_err_t sc_pm_set_sys_power_mode(sc_ipc_t ipc, sc_pm_power_mode_t mode)
}
sc_err_t sc_pm_set_partition_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_pm_power_mode_t mode)
+ sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -64,7 +64,7 @@ sc_err_t sc_pm_set_partition_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
}
sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_pm_power_mode_t *mode)
+ sc_pm_power_mode_t *mode)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -78,15 +78,14 @@ sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mode != NULL) {
- *mode = RPC_U8(&msg, 0U);
- }
+ if (mode != NULL)
+ *mode = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_power_mode_t mode)
+ sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -105,9 +104,7 @@ sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_set_resource_power_mode_all(sc_ipc_t ipc,
- sc_rm_pt_t pt,
- sc_pm_power_mode_t mode,
- sc_rsrc_t exclude)
+ sc_rm_pt_t pt, sc_pm_power_mode_t mode, sc_rsrc_t exclude)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -127,7 +124,7 @@ sc_err_t sc_pm_set_resource_power_mode_all(sc_ipc_t ipc,
}
sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_power_mode_t *mode)
+ sc_pm_power_mode_t *mode)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -141,15 +138,14 @@ sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mode != NULL) {
- *mode = RPC_U8(&msg, 0U);
- }
+ if (mode != NULL)
+ *mode = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_power_mode_t mode)
+ sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -168,8 +164,7 @@ sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_req_cpu_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_power_mode_t mode,
- sc_pm_wake_src_t wake_src)
+ sc_pm_power_mode_t mode, sc_pm_wake_src_t wake_src)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -189,7 +184,7 @@ sc_err_t sc_pm_req_cpu_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_faddr_t address)
+ sc_faddr_t address)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -209,7 +204,7 @@ sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_set_cpu_resume(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_bool_t isPrimary, sc_faddr_t address)
+ sc_bool_t isPrimary, sc_faddr_t address)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -230,9 +225,7 @@ sc_err_t sc_pm_set_cpu_resume(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_req_sys_if_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_sys_if_t sys_if,
- sc_pm_power_mode_t hpm,
- sc_pm_power_mode_t lpm)
+ sc_pm_sys_if_t sys_if, sc_pm_power_mode_t hpm, sc_pm_power_mode_t lpm)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -253,7 +246,7 @@ sc_err_t sc_pm_req_sys_if_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_clk_t clk, sc_pm_clock_rate_t *rate)
+ sc_pm_clk_t clk, sc_pm_clock_rate_t *rate)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -274,7 +267,7 @@ sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_clk_t clk, sc_pm_clock_rate_t *rate)
+ sc_pm_clk_t clk, sc_pm_clock_rate_t *rate)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -288,16 +281,15 @@ sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (rate != NULL) {
- *rate = RPC_U32(&msg, 0U);
- }
+ if (rate != NULL)
+ *rate = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_clk_t clk, sc_bool_t enable, sc_bool_t autog)
+ sc_pm_clk_t clk, sc_bool_t enable, sc_bool_t autog)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -318,7 +310,7 @@ sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_clk_t clk, sc_pm_clk_parent_t parent)
+ sc_pm_clk_t clk, sc_pm_clk_parent_t parent)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -338,7 +330,7 @@ sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
}
sc_err_t sc_pm_get_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_pm_clk_t clk, sc_pm_clk_parent_t * parent)
+ sc_pm_clk_t clk, sc_pm_clk_parent_t *parent)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -353,9 +345,8 @@ sc_err_t sc_pm_get_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (parent != NULL) {
- *parent = RPC_U8(&msg, 0U);
- }
+ if (parent != NULL)
+ *parent = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
@@ -390,16 +381,34 @@ sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason)
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (reason != NULL) {
- *reason = RPC_U8(&msg, 0U);
- }
+ if (reason != NULL)
+ *reason = RPC_U8(&msg, 0U);
+
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_pm_get_reset_part(sc_ipc_t ipc, sc_rm_pt_t *pt)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
+ RPC_FUNC(&msg) = U8(PM_FUNC_GET_RESET_PART);
+ RPC_SIZE(&msg) = 1U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ if (pt != NULL)
+ *pt = RPC_U8(&msg, 0U);
return (sc_err_t)result;
}
sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
- sc_rsrc_t resource_mu, sc_rsrc_t resource_dev)
+ sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
+ sc_rsrc_t resource_mu, sc_rsrc_t resource_dev)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -432,12 +441,10 @@ void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_TRUE);
-
- return;
}
sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_pm_reset_type_t type)
+ sc_pm_reset_type_t type)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -455,8 +462,25 @@ sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt,
return (sc_err_t)result;
}
+sc_err_t sc_pm_reboot_continue(sc_ipc_t ipc, sc_rm_pt_t pt)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
+ RPC_FUNC(&msg) = U8(PM_FUNC_REBOOT_CONTINUE);
+ RPC_U8(&msg, 0U) = U8(pt);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
- sc_faddr_t address)
+ sc_faddr_t address)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -493,4 +517,22 @@ void sc_pm_cpu_reset(sc_ipc_t ipc, sc_rsrc_t resource, sc_faddr_t address)
return;
}
+sc_bool_t sc_pm_is_partition_started(sc_ipc_t ipc, sc_rm_pt_t pt)
+{
+ sc_rpc_msg_t msg;
+ sc_bool_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
+ RPC_FUNC(&msg) = U8(PM_FUNC_IS_PARTITION_STARTED);
+ RPC_U8(&msg, 0U) = U8(pt);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = U2B(RPC_R8(&msg));
+ return result;
+}
+
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/rm/rpc.h b/drivers/soc/imx/sc/svc/rm/rpc.h
index 9b2fa1176429..67c5dd53c626 100644
--- a/drivers/soc/imx/sc/svc/rm/rpc.h
+++ b/drivers/soc/imx/sc/svc/rm/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,39 +23,40 @@
* @name Defines for RPC RM function calls
*/
/*@{*/
-#define RM_FUNC_UNKNOWN 0 /* Unknown function */
-#define RM_FUNC_PARTITION_ALLOC 1U /* Index for rm_partition_alloc() RPC call */
-#define RM_FUNC_SET_CONFIDENTIAL 31U /* Index for rm_set_confidential() RPC call */
-#define RM_FUNC_PARTITION_FREE 2U /* Index for rm_partition_free() RPC call */
-#define RM_FUNC_GET_DID 26U /* Index for rm_get_did() RPC call */
-#define RM_FUNC_PARTITION_STATIC 3U /* Index for rm_partition_static() RPC call */
-#define RM_FUNC_PARTITION_LOCK 4U /* Index for rm_partition_lock() RPC call */
-#define RM_FUNC_GET_PARTITION 5U /* Index for rm_get_partition() RPC call */
-#define RM_FUNC_SET_PARENT 6U /* Index for rm_set_parent() RPC call */
-#define RM_FUNC_MOVE_ALL 7U /* Index for rm_move_all() RPC call */
-#define RM_FUNC_ASSIGN_RESOURCE 8U /* Index for rm_assign_resource() RPC call */
-#define RM_FUNC_SET_RESOURCE_MOVABLE 9U /* Index for rm_set_resource_movable() RPC call */
-#define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U /* Index for rm_set_subsys_rsrc_movable() RPC call */
-#define RM_FUNC_SET_MASTER_ATTRIBUTES 10U /* Index for rm_set_master_attributes() RPC call */
-#define RM_FUNC_SET_MASTER_SID 11U /* Index for rm_set_master_sid() RPC call */
-#define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U /* Index for rm_set_peripheral_permissions() RPC call */
-#define RM_FUNC_IS_RESOURCE_OWNED 13U /* Index for rm_is_resource_owned() RPC call */
-#define RM_FUNC_IS_RESOURCE_MASTER 14U /* Index for rm_is_resource_master() RPC call */
-#define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U /* Index for rm_is_resource_peripheral() RPC call */
-#define RM_FUNC_GET_RESOURCE_INFO 16U /* Index for rm_get_resource_info() RPC call */
-#define RM_FUNC_MEMREG_ALLOC 17U /* Index for rm_memreg_alloc() RPC call */
-#define RM_FUNC_MEMREG_SPLIT 29U /* Index for rm_memreg_split() RPC call */
-#define RM_FUNC_MEMREG_FRAG 32U /* Index for rm_memreg_frag() RPC call */
-#define RM_FUNC_MEMREG_FREE 18U /* Index for rm_memreg_free() RPC call */
-#define RM_FUNC_FIND_MEMREG 30U /* Index for rm_find_memreg() RPC call */
-#define RM_FUNC_ASSIGN_MEMREG 19U /* Index for rm_assign_memreg() RPC call */
-#define RM_FUNC_SET_MEMREG_PERMISSIONS 20U /* Index for rm_set_memreg_permissions() RPC call */
-#define RM_FUNC_IS_MEMREG_OWNED 21U /* Index for rm_is_memreg_owned() RPC call */
-#define RM_FUNC_GET_MEMREG_INFO 22U /* Index for rm_get_memreg_info() RPC call */
-#define RM_FUNC_ASSIGN_PAD 23U /* Index for rm_assign_pad() RPC call */
-#define RM_FUNC_SET_PAD_MOVABLE 24U /* Index for rm_set_pad_movable() RPC call */
-#define RM_FUNC_IS_PAD_OWNED 25U /* Index for rm_is_pad_owned() RPC call */
-#define RM_FUNC_DUMP 27U /* Index for rm_dump() RPC call */
+#define RM_FUNC_UNKNOWN 0 /* Unknown function */
+#define RM_FUNC_PARTITION_ALLOC 1U /* Index for rm_partition_alloc() RPC call */
+#define RM_FUNC_SET_CONFIDENTIAL 31U /* Index for rm_set_confidential() RPC call */
+#define RM_FUNC_PARTITION_FREE 2U /* Index for rm_partition_free() RPC call */
+#define RM_FUNC_GET_DID 26U /* Index for rm_get_did() RPC call */
+#define RM_FUNC_PARTITION_STATIC 3U /* Index for rm_partition_static() RPC call */
+#define RM_FUNC_PARTITION_LOCK 4U /* Index for rm_partition_lock() RPC call */
+#define RM_FUNC_GET_PARTITION 5U /* Index for rm_get_partition() RPC call */
+#define RM_FUNC_SET_PARENT 6U /* Index for rm_set_parent() RPC call */
+#define RM_FUNC_MOVE_ALL 7U /* Index for rm_move_all() RPC call */
+#define RM_FUNC_ASSIGN_RESOURCE 8U /* Index for rm_assign_resource() RPC call */
+#define RM_FUNC_SET_RESOURCE_MOVABLE 9U /* Index for rm_set_resource_movable() RPC call */
+#define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U /* Index for rm_set_subsys_rsrc_movable() RPC call */
+#define RM_FUNC_SET_MASTER_ATTRIBUTES 10U /* Index for rm_set_master_attributes() RPC call */
+#define RM_FUNC_SET_MASTER_SID 11U /* Index for rm_set_master_sid() RPC call */
+#define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U /* Index for rm_set_peripheral_permissions() RPC call */
+#define RM_FUNC_IS_RESOURCE_OWNED 13U /* Index for rm_is_resource_owned() RPC call */
+#define RM_FUNC_GET_RESOURCE_OWNER 33U /* Index for rm_get_resource_owner() RPC call */
+#define RM_FUNC_IS_RESOURCE_MASTER 14U /* Index for rm_is_resource_master() RPC call */
+#define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U /* Index for rm_is_resource_peripheral() RPC call */
+#define RM_FUNC_GET_RESOURCE_INFO 16U /* Index for rm_get_resource_info() RPC call */
+#define RM_FUNC_MEMREG_ALLOC 17U /* Index for rm_memreg_alloc() RPC call */
+#define RM_FUNC_MEMREG_SPLIT 29U /* Index for rm_memreg_split() RPC call */
+#define RM_FUNC_MEMREG_FRAG 32U /* Index for rm_memreg_frag() RPC call */
+#define RM_FUNC_MEMREG_FREE 18U /* Index for rm_memreg_free() RPC call */
+#define RM_FUNC_FIND_MEMREG 30U /* Index for rm_find_memreg() RPC call */
+#define RM_FUNC_ASSIGN_MEMREG 19U /* Index for rm_assign_memreg() RPC call */
+#define RM_FUNC_SET_MEMREG_PERMISSIONS 20U /* Index for rm_set_memreg_permissions() RPC call */
+#define RM_FUNC_IS_MEMREG_OWNED 21U /* Index for rm_is_memreg_owned() RPC call */
+#define RM_FUNC_GET_MEMREG_INFO 22U /* Index for rm_get_memreg_info() RPC call */
+#define RM_FUNC_ASSIGN_PAD 23U /* Index for rm_assign_pad() RPC call */
+#define RM_FUNC_SET_PAD_MOVABLE 24U /* Index for rm_set_pad_movable() RPC call */
+#define RM_FUNC_IS_PAD_OWNED 25U /* Index for rm_is_pad_owned() RPC call */
+#define RM_FUNC_DUMP 27U /* Index for rm_dump() RPC call */
/*@}*/
/* Types */
@@ -68,8 +69,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void rm_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void rm_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_RM_RPC_H */
+#endif /* SC_RM_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/rm/rpc_clnt.c b/drivers/soc/imx/sc/svc/rm/rpc_clnt.c
index a24502386ea1..86f9370c0b8c 100644
--- a/drivers/soc/imx/sc/svc/rm/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/rm/rpc_clnt.c
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0+
*/
/*!
@@ -27,8 +27,7 @@
/* Local Functions */
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)
+ sc_bool_t isolated, sc_bool_t restricted, sc_bool_t grant, sc_bool_t coherent)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -46,9 +45,8 @@ sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, sc_bool_t secure,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (pt != NULL) {
+ if (pt != NULL)
*pt = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
@@ -101,10 +99,11 @@ sc_rm_did_t sc_rm_get_did(sc_ipc_t ipc)
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- return (sc_rm_did_t) result;
+ return (sc_rm_did_t)result;
}
-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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -152,14 +151,14 @@ sc_err_t sc_rm_get_partition(sc_ipc_t ipc, sc_rm_pt_t *pt)
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (pt != NULL) {
+ if (pt != NULL)
*pt = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
-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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -178,7 +177,7 @@ 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_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst,
- sc_bool_t move_rsrc, sc_bool_t move_pads)
+ sc_bool_t move_rsrc, sc_bool_t move_pads)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -198,7 +197,8 @@ sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst,
return (sc_err_t)result;
}
-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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -217,7 +217,7 @@ 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_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst,
- sc_rsrc_t resource_lst, sc_bool_t movable)
+ sc_rsrc_t resource_lst, sc_bool_t movable)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -237,7 +237,7 @@ sc_err_t sc_rm_set_resource_movable(sc_ipc_t ipc, sc_rsrc_t resource_fst,
}
sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_bool_t movable)
+ sc_bool_t movable)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -256,8 +256,7 @@ sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource,
}
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,
- sc_bool_t smmu_bypass)
+ sc_rm_spa_t sa, sc_rm_spa_t pa, sc_bool_t smmu_bypass)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -277,7 +276,8 @@ sc_err_t sc_rm_set_master_attributes(sc_ipc_t ipc, sc_rsrc_t resource,
return (sc_err_t)result;
}
-sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid)
+sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_rm_sid_t sid)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -296,7 +296,7 @@ sc_err_t sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid)
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -332,6 +332,27 @@ sc_bool_t sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource)
return result;
}
+sc_err_t sc_rm_get_resource_owner(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_rm_pt_t *pt)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
+ RPC_FUNC(&msg) = U8(RM_FUNC_GET_RESOURCE_OWNER);
+ RPC_U16(&msg, 0U) = U16(resource);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ if (pt != NULL)
+ *pt = RPC_U8(&msg, 0U);
+
+ return (sc_err_t)result;
+}
+
sc_bool_t sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource)
{
sc_rpc_msg_t msg;
@@ -367,7 +388,7 @@ sc_bool_t sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource)
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -380,16 +401,15 @@ sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (sid != NULL) {
+ if (sid != NULL)
*sid = RPC_U16(&msg, 0U);
- }
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -406,16 +426,14 @@ sc_err_t sc_rm_memreg_alloc(sc_ipc_t ipc, sc_rm_mr_t *mr,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mr != NULL) {
+ if (mr != NULL)
*mr = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -433,15 +451,14 @@ sc_err_t sc_rm_memreg_split(sc_ipc_t ipc, sc_rm_mr_t mr,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mr_ret != NULL) {
+ if (mr_ret != NULL)
*mr_ret = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
sc_err_t sc_rm_memreg_frag(sc_ipc_t ipc, sc_rm_mr_t *mr_ret,
- sc_faddr_t addr_start, sc_faddr_t addr_end)
+ sc_faddr_t addr_start, sc_faddr_t addr_end)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -458,9 +475,8 @@ sc_err_t sc_rm_memreg_frag(sc_ipc_t ipc, sc_rm_mr_t *mr_ret,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mr_ret != NULL) {
+ if (mr_ret != NULL)
*mr_ret = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
@@ -483,7 +499,7 @@ sc_err_t sc_rm_memreg_free(sc_ipc_t ipc, sc_rm_mr_t mr)
}
sc_err_t sc_rm_find_memreg(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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -500,9 +516,8 @@ sc_err_t sc_rm_find_memreg(sc_ipc_t ipc, sc_rm_mr_t *mr,
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
- if (mr != NULL) {
+ if (mr != NULL)
*mr = RPC_U8(&msg, 0U);
- }
return (sc_err_t)result;
}
@@ -526,7 +541,7 @@ sc_err_t sc_rm_assign_memreg(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_mr_t mr)
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -563,7 +578,7 @@ sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
}
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)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -576,15 +591,11 @@ sc_err_t sc_rm_get_memreg_info(sc_ipc_t ipc, sc_rm_mr_t mr,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (addr_start != NULL) {
- *addr_start =
- ((uint64_t) RPC_U32(&msg, 0U) << 32U) | RPC_U32(&msg, 4U);
- }
+ if (addr_start != NULL)
+ *addr_start = ((uint64_t) RPC_U32(&msg, 0U) << 32U) | RPC_U32(&msg, 4U);
- if (addr_end != NULL) {
- *addr_end =
- ((uint64_t) RPC_U32(&msg, 8U) << 32U) | RPC_U32(&msg, 12U);
- }
+ if (addr_end != NULL)
+ *addr_end = ((uint64_t) RPC_U32(&msg, 8U) << 32U) | RPC_U32(&msg, 12U);
result = RPC_R8(&msg);
return (sc_err_t)result;
@@ -609,7 +620,7 @@ sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad)
}
sc_err_t sc_rm_set_pad_movable(sc_ipc_t ipc, sc_pad_t pad_fst,
- sc_pad_t pad_lst, sc_bool_t movable)
+ sc_pad_t pad_lst, sc_bool_t movable)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -655,8 +666,7 @@ void sc_rm_dump(sc_ipc_t ipc)
RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
-
- return;
}
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/seco/rpc.h b/drivers/soc/imx/sc/svc/seco/rpc.h
new file mode 100644
index 000000000000..ecc7311e7be9
--- /dev/null
+++ b/drivers/soc/imx/sc/svc/seco/rpc.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017-2019 NXP
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/*!
+ * Header file for the SECO RPC implementation.
+ *
+ * @addtogroup SECO_SVC
+ * @{
+ */
+
+#ifndef SC_SECO_RPC_H
+#define SC_SECO_RPC_H
+
+/* Includes */
+
+/* Defines */
+
+/*!
+ * @name Defines for RPC SECO function calls
+ */
+/*@{*/
+#define SECO_FUNC_UNKNOWN 0 /* Unknown function */
+#define SECO_FUNC_IMAGE_LOAD 1U /* Index for seco_image_load() RPC call */
+#define SECO_FUNC_AUTHENTICATE 2U /* Index for seco_authenticate() RPC call */
+#define SECO_FUNC_FORWARD_LIFECYCLE 3U /* Index for seco_forward_lifecycle() RPC call */
+#define SECO_FUNC_RETURN_LIFECYCLE 4U /* Index for seco_return_lifecycle() RPC call */
+#define SECO_FUNC_COMMIT 5U /* Index for seco_commit() RPC call */
+#define SECO_FUNC_ATTEST_MODE 6U /* Index for seco_attest_mode() RPC call */
+#define SECO_FUNC_ATTEST 7U /* Index for seco_attest() RPC call */
+#define SECO_FUNC_GET_ATTEST_PKEY 8U /* Index for seco_get_attest_pkey() RPC call */
+#define SECO_FUNC_GET_ATTEST_SIGN 9U /* Index for seco_get_attest_sign() RPC call */
+#define SECO_FUNC_ATTEST_VERIFY 10U /* Index for seco_attest_verify() RPC call */
+#define SECO_FUNC_GEN_KEY_BLOB 11U /* Index for seco_gen_key_blob() RPC call */
+#define SECO_FUNC_LOAD_KEY 12U /* Index for seco_load_key() RPC call */
+#define SECO_FUNC_GET_MP_KEY 13U /* Index for seco_get_mp_key() RPC call */
+#define SECO_FUNC_UPDATE_MPMR 14U /* Index for seco_update_mpmr() RPC call */
+#define SECO_FUNC_GET_MP_SIGN 15U /* Index for seco_get_mp_sign() RPC call */
+#define SECO_FUNC_BUILD_INFO 16U /* Index for seco_build_info() RPC call */
+#define SECO_FUNC_CHIP_INFO 17U /* Index for seco_chip_info() RPC call */
+#define SECO_FUNC_ENABLE_DEBUG 18U /* Index for seco_enable_debug() RPC call */
+#define SECO_FUNC_GET_EVENT 19U /* Index for seco_get_event() RPC call */
+#define SECO_FUNC_FUSE_WRITE 20U /* Index for seco_fuse_write() RPC call */
+/*@}*/
+
+/* Types */
+
+/* Functions */
+
+/*!
+ * This function dispatches an incoming SECO RPC request.
+ *
+ * @param[in] caller_pt caller partition
+ * @param[in] msg pointer to RPC message
+ */
+void seco_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
+
+#endif /* SC_SECO_RPC_H */
+
+/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/seco/rpc_clnt.c b/drivers/soc/imx/sc/svc/seco/rpc_clnt.c
new file mode 100644
index 000000000000..cc23324ee20c
--- /dev/null
+++ b/drivers/soc/imx/sc/svc/seco/rpc_clnt.c
@@ -0,0 +1,430 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017-2019 NXP
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/*!
+ * File containing client-side RPC functions for the SECO service. These
+ * functions are ported to clients that communicate to the SC.
+ *
+ * @addtogroup SECO_SVC
+ * @{
+ */
+
+/* Includes */
+
+#include <soc/imx8/sc/types.h>
+#include <soc/imx8/sc/svc/rm/api.h>
+#include <soc/imx8/sc/svc/seco/api.h>
+#include "../../main/rpc.h"
+#include "rpc.h"
+
+/* Local Defines */
+
+/* Local Types */
+
+/* Local Functions */
+
+sc_err_t sc_seco_image_load(sc_ipc_t ipc, sc_faddr_t addr_src,
+ sc_faddr_t addr_dst, uint32_t len, sc_bool_t fw)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_IMAGE_LOAD);
+ RPC_U32(&msg, 0U) = U32(addr_src >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr_src);
+ RPC_U32(&msg, 8U) = U32(addr_dst >> 32ULL);
+ RPC_U32(&msg, 12U) = U32(addr_dst);
+ RPC_U32(&msg, 16U) = U32(len);
+ RPC_U8(&msg, 20U) = B2U8(fw);
+ RPC_SIZE(&msg) = 7U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_authenticate(sc_ipc_t ipc,
+ sc_seco_auth_cmd_t cmd, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_AUTHENTICATE);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_U8(&msg, 8U) = U8(cmd);
+ RPC_SIZE(&msg) = 4U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_forward_lifecycle(sc_ipc_t ipc, uint32_t change)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_FORWARD_LIFECYCLE);
+ RPC_U32(&msg, 0U) = U32(change);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_RETURN_LIFECYCLE);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_commit(sc_ipc_t ipc, uint32_t *info)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_COMMIT);
+ RPC_U32(&msg, 0U) = *PTR_U32(info);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ *info = RPC_U32(&msg, 0U);
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_attest_mode(sc_ipc_t ipc, uint32_t mode)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_ATTEST_MODE);
+ RPC_U32(&msg, 0U) = U32(mode);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_attest(sc_ipc_t ipc, uint64_t nonce)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_ATTEST);
+ RPC_U32(&msg, 0U) = U32(nonce >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(nonce);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_get_attest_pkey(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GET_ATTEST_PKEY);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_get_attest_sign(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GET_ATTEST_SIGN);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_attest_verify(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_ATTEST_VERIFY);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_gen_key_blob(sc_ipc_t ipc, uint32_t id,
+ sc_faddr_t load_addr, sc_faddr_t export_addr, uint16_t max_size)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GEN_KEY_BLOB);
+ RPC_U32(&msg, 0U) = U32(load_addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(load_addr);
+ RPC_U32(&msg, 8U) = U32(export_addr >> 32ULL);
+ RPC_U32(&msg, 12U) = U32(export_addr);
+ RPC_U32(&msg, 16U) = U32(id);
+ RPC_U16(&msg, 20U) = U16(max_size);
+ RPC_SIZE(&msg) = 7U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_load_key(sc_ipc_t ipc, uint32_t id,
+ sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_LOAD_KEY);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_U32(&msg, 8U) = U32(id);
+ RPC_SIZE(&msg) = 4U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_get_mp_key(sc_ipc_t ipc, sc_faddr_t dst_addr,
+ uint16_t dst_size)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GET_MP_KEY);
+ RPC_U32(&msg, 0U) = U32(dst_addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(dst_addr);
+ RPC_U16(&msg, 8U) = U16(dst_size);
+ RPC_SIZE(&msg) = 4U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr,
+ uint8_t size, uint8_t lock)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_UPDATE_MPMR);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_U8(&msg, 8U) = U8(size);
+ RPC_U8(&msg, 9U) = U8(lock);
+ RPC_SIZE(&msg) = 4U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_get_mp_sign(sc_ipc_t ipc, sc_faddr_t msg_addr,
+ uint16_t msg_size, sc_faddr_t dst_addr, uint16_t dst_size)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GET_MP_SIGN);
+ RPC_U32(&msg, 0U) = U32(msg_addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(msg_addr);
+ RPC_U32(&msg, 8U) = U32(dst_addr >> 32ULL);
+ RPC_U32(&msg, 12U) = U32(dst_addr);
+ RPC_U16(&msg, 16U) = U16(msg_size);
+ RPC_U16(&msg, 18U) = U16(dst_size);
+ RPC_SIZE(&msg) = 6U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+void sc_seco_build_info(sc_ipc_t ipc, uint32_t *version,
+ uint32_t *commit)
+{
+ sc_rpc_msg_t msg;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_BUILD_INFO);
+ RPC_SIZE(&msg) = 1U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ if (version != NULL)
+ *version = RPC_U32(&msg, 0U);
+
+ if (commit != NULL)
+ *commit = RPC_U32(&msg, 4U);
+
+ return;
+}
+
+sc_err_t sc_seco_chip_info(sc_ipc_t ipc, uint16_t *lc,
+ uint16_t *monotonic, uint32_t *uid_l, uint32_t *uid_h)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_CHIP_INFO);
+ RPC_SIZE(&msg) = 1U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ if (uid_l != NULL)
+ *uid_l = RPC_U32(&msg, 0U);
+
+ if (uid_h != NULL)
+ *uid_h = RPC_U32(&msg, 4U);
+
+ if (lc != NULL)
+ *lc = RPC_U16(&msg, 8U);
+
+ if (monotonic != NULL)
+ *monotonic = RPC_U16(&msg, 10U);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_enable_debug(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_ENABLE_DEBUG);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_get_event(sc_ipc_t ipc, uint8_t idx,
+ uint32_t *event)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_GET_EVENT);
+ RPC_U8(&msg, 0U) = U8(idx);
+ RPC_SIZE(&msg) = 2U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ if (event != NULL)
+ *event = RPC_U32(&msg, 0U);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_seco_fuse_write(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_FUSE_WRITE);
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_SIZE(&msg) = 3U;
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/timer/rpc.h b/drivers/soc/imx/sc/svc/timer/rpc.h
index 3d15d877471e..549265c6c01a 100644
--- a/drivers/soc/imx/sc/svc/timer/rpc.h
+++ b/drivers/soc/imx/sc/svc/timer/rpc.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -23,25 +23,25 @@
* @name Defines for RPC TIMER function calls
*/
/*@{*/
-#define TIMER_FUNC_UNKNOWN 0 /* Unknown function */
-#define TIMER_FUNC_SET_WDOG_TIMEOUT 1U /* Index for timer_set_wdog_timeout() RPC call */
-#define TIMER_FUNC_SET_WDOG_PRE_TIMEOUT 12U /* Index for timer_set_wdog_pre_timeout() RPC call */
-#define TIMER_FUNC_START_WDOG 2U /* Index for timer_start_wdog() RPC call */
-#define TIMER_FUNC_STOP_WDOG 3U /* Index for timer_stop_wdog() RPC call */
-#define TIMER_FUNC_PING_WDOG 4U /* Index for timer_ping_wdog() RPC call */
-#define TIMER_FUNC_GET_WDOG_STATUS 5U /* Index for timer_get_wdog_status() RPC call */
-#define TIMER_FUNC_PT_GET_WDOG_STATUS 13U /* Index for timer_pt_get_wdog_status() RPC call */
-#define TIMER_FUNC_SET_WDOG_ACTION 10U /* Index for timer_set_wdog_action() RPC call */
-#define TIMER_FUNC_SET_RTC_TIME 6U /* Index for timer_set_rtc_time() RPC call */
-#define TIMER_FUNC_GET_RTC_TIME 7U /* Index for timer_get_rtc_time() RPC call */
-#define TIMER_FUNC_GET_RTC_SEC1970 9U /* Index for timer_get_rtc_sec1970() RPC call */
-#define TIMER_FUNC_SET_RTC_ALARM 8U /* Index for timer_set_rtc_alarm() RPC call */
-#define TIMER_FUNC_SET_RTC_PERIODIC_ALARM 14U /* Index for timer_set_rtc_periodic_alarm() RPC call */
-#define TIMER_FUNC_CANCEL_RTC_ALARM 15U /* Index for timer_cancel_rtc_alarm() RPC call */
-#define TIMER_FUNC_SET_RTC_CALB 11U /* Index for timer_set_rtc_calb() RPC call */
-#define TIMER_FUNC_SET_SYSCTR_ALARM 16U /* Index for timer_set_sysctr_alarm() RPC call */
-#define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for timer_set_sysctr_periodic_alarm() RPC call */
-#define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for timer_cancel_sysctr_alarm() RPC call */
+#define TIMER_FUNC_UNKNOWN 0 /* Unknown function */
+#define TIMER_FUNC_SET_WDOG_TIMEOUT 1U /* Index for timer_set_wdog_timeout() RPC call */
+#define TIMER_FUNC_SET_WDOG_PRE_TIMEOUT 12U /* Index for timer_set_wdog_pre_timeout() RPC call */
+#define TIMER_FUNC_START_WDOG 2U /* Index for timer_start_wdog() RPC call */
+#define TIMER_FUNC_STOP_WDOG 3U /* Index for timer_stop_wdog() RPC call */
+#define TIMER_FUNC_PING_WDOG 4U /* Index for timer_ping_wdog() RPC call */
+#define TIMER_FUNC_GET_WDOG_STATUS 5U /* Index for timer_get_wdog_status() RPC call */
+#define TIMER_FUNC_PT_GET_WDOG_STATUS 13U /* Index for timer_pt_get_wdog_status() RPC call */
+#define TIMER_FUNC_SET_WDOG_ACTION 10U /* Index for timer_set_wdog_action() RPC call */
+#define TIMER_FUNC_SET_RTC_TIME 6U /* Index for timer_set_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_TIME 7U /* Index for timer_get_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_SEC1970 9U /* Index for timer_get_rtc_sec1970() RPC call */
+#define TIMER_FUNC_SET_RTC_ALARM 8U /* Index for timer_set_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_PERIODIC_ALARM 14U /* Index for timer_set_rtc_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_RTC_ALARM 15U /* Index for timer_cancel_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_CALB 11U /* Index for timer_set_rtc_calb() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_ALARM 16U /* Index for timer_set_sysctr_alarm() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for timer_set_sysctr_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for timer_cancel_sysctr_alarm() RPC call */
/*@}*/
/* Types */
@@ -54,8 +54,9 @@
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
-void timer_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
+void timer_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
-#endif /* SC_TIMER_RPC_H */
+#endif /* SC_TIMER_RPC_H */
/**@}*/
+
diff --git a/drivers/soc/imx/sc/svc/timer/rpc_clnt.c b/drivers/soc/imx/sc/svc/timer/rpc_clnt.c
index fe9fdab6f644..3ab677f4f760 100644
--- a/drivers/soc/imx/sc/svc/timer/rpc_clnt.c
+++ b/drivers/soc/imx/sc/svc/timer/rpc_clnt.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -27,7 +27,8 @@
/* Local Functions */
-sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc, sc_timer_wdog_time_t timeout)
+sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc,
+ sc_timer_wdog_time_t timeout)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -45,7 +46,7 @@ sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc, sc_timer_wdog_time_t timeout)
}
sc_err_t sc_timer_set_wdog_pre_timeout(sc_ipc_t ipc,
- sc_timer_wdog_time_t pre_timeout)
+ sc_timer_wdog_time_t pre_timeout)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -112,9 +113,8 @@ sc_err_t sc_timer_ping_wdog(sc_ipc_t ipc)
}
sc_err_t sc_timer_get_wdog_status(sc_ipc_t ipc,
- sc_timer_wdog_time_t *timeout,
- sc_timer_wdog_time_t *max_timeout,
- sc_timer_wdog_time_t *remaining_time)
+ sc_timer_wdog_time_t *timeout, sc_timer_wdog_time_t *max_timeout,
+ sc_timer_wdog_time_t *remaining_time)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -126,26 +126,21 @@ sc_err_t sc_timer_get_wdog_status(sc_ipc_t ipc,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (timeout != NULL) {
- *timeout = RPC_U32(&msg, 0U);
- }
+ if (timeout != NULL)
+ *timeout = RPC_U32(&msg, 0U);
- if (max_timeout != NULL) {
- *max_timeout = RPC_U32(&msg, 4U);
- }
+ if (max_timeout != NULL)
+ *max_timeout = RPC_U32(&msg, 4U);
- if (remaining_time != NULL) {
- *remaining_time = RPC_U32(&msg, 8U);
- }
+ if (remaining_time != NULL)
+ *remaining_time = RPC_U32(&msg, 8U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
-sc_err_t sc_timer_pt_get_wdog_status(sc_ipc_t ipc, sc_rm_pt_t pt,
- sc_bool_t *enb,
- sc_timer_wdog_time_t *timeout,
- sc_timer_wdog_time_t *remaining_time)
+sc_err_t sc_timer_pt_get_wdog_status(sc_ipc_t ipc, sc_rm_pt_t pt, sc_bool_t *enb,
+ sc_timer_wdog_time_t *timeout, sc_timer_wdog_time_t *remaining_time)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -158,24 +153,21 @@ sc_err_t sc_timer_pt_get_wdog_status(sc_ipc_t ipc, sc_rm_pt_t pt,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (timeout != NULL) {
- *timeout = RPC_U32(&msg, 0U);
- }
+ if (timeout != NULL)
+ *timeout = RPC_U32(&msg, 0U);
- if (remaining_time != NULL) {
- *remaining_time = RPC_U32(&msg, 4U);
- }
+ if (remaining_time != NULL)
+ *remaining_time = RPC_U32(&msg, 4U);
result = RPC_R8(&msg);
- if (enb != NULL) {
- *enb = U2B(RPC_U8(&msg, 8U));
- }
+ if (enb != NULL)
+ *enb = U2B(RPC_U8(&msg, 8U));
return (sc_err_t)result;
}
sc_err_t sc_timer_set_wdog_action(sc_ipc_t ipc,
- sc_rm_pt_t pt, sc_timer_wdog_action_t action)
+ sc_rm_pt_t pt, sc_timer_wdog_action_t action)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -194,8 +186,7 @@ sc_err_t sc_timer_set_wdog_action(sc_ipc_t ipc,
}
sc_err_t sc_timer_set_rtc_time(sc_ipc_t ipc, uint16_t year, uint8_t mon,
- uint8_t day, uint8_t hour, uint8_t min,
- uint8_t sec)
+ uint8_t day, uint8_t hour, uint8_t min, uint8_t sec)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -218,8 +209,7 @@ sc_err_t sc_timer_set_rtc_time(sc_ipc_t ipc, uint16_t year, uint8_t mon,
}
sc_err_t sc_timer_get_rtc_time(sc_ipc_t ipc, uint16_t *year, uint8_t *mon,
- uint8_t *day, uint8_t *hour, uint8_t *min,
- uint8_t *sec)
+ uint8_t *day, uint8_t *hour, uint8_t *min, uint8_t *sec)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -231,30 +221,24 @@ sc_err_t sc_timer_get_rtc_time(sc_ipc_t ipc, uint16_t *year, uint8_t *mon,
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (year != NULL) {
- *year = RPC_U16(&msg, 0U);
- }
+ if (year != NULL)
+ *year = RPC_U16(&msg, 0U);
result = RPC_R8(&msg);
- if (mon != NULL) {
- *mon = RPC_U8(&msg, 2U);
- }
+ if (mon != NULL)
+ *mon = RPC_U8(&msg, 2U);
- if (day != NULL) {
- *day = RPC_U8(&msg, 3U);
- }
+ if (day != NULL)
+ *day = RPC_U8(&msg, 3U);
- if (hour != NULL) {
- *hour = RPC_U8(&msg, 4U);
- }
+ if (hour != NULL)
+ *hour = RPC_U8(&msg, 4U);
- if (min != NULL) {
- *min = RPC_U8(&msg, 5U);
- }
+ if (min != NULL)
+ *min = RPC_U8(&msg, 5U);
- if (sec != NULL) {
- *sec = RPC_U8(&msg, 6U);
- }
+ if (sec != NULL)
+ *sec = RPC_U8(&msg, 6U);
return (sc_err_t)result;
}
@@ -271,17 +255,15 @@ sc_err_t sc_timer_get_rtc_sec1970(sc_ipc_t ipc, uint32_t *sec)
sc_call_rpc(ipc, &msg, SC_FALSE);
- if (sec != NULL) {
- *sec = RPC_U32(&msg, 0U);
- }
+ if (sec != NULL)
+ *sec = RPC_U32(&msg, 0U);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_timer_set_rtc_alarm(sc_ipc_t ipc, uint16_t year, uint8_t mon,
- uint8_t day, uint8_t hour, uint8_t min,
- uint8_t sec)
+ uint8_t day, uint8_t hour, uint8_t min, uint8_t sec)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -371,7 +353,8 @@ sc_err_t sc_timer_set_sysctr_alarm(sc_ipc_t ipc, uint64_t ticks)
return (sc_err_t)result;
}
-sc_err_t sc_timer_set_sysctr_periodic_alarm(sc_ipc_t ipc, uint64_t ticks)
+sc_err_t sc_timer_set_sysctr_periodic_alarm(sc_ipc_t ipc,
+ uint64_t ticks)
{
sc_rpc_msg_t msg;
uint8_t result;
@@ -406,3 +389,4 @@ sc_err_t sc_timer_cancel_sysctr_alarm(sc_ipc_t ipc)
}
/**@}*/
+