summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRanjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>2019-11-18 14:37:20 -0600
committerRanjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>2019-11-20 14:07:14 -0600
commit5770369e21247ce0a9944581b0bbaac1e929e16a (patch)
treea55067ad0cde5b89289b5b61e3370c9cc691add9 /arch
parent85f6a6c92594f0ebd6d2fd8aae8515ade9d4da2d (diff)
MLK-22998 iimx8qm/imx8qxp: Update to latest SCFW API
Sync SCFW API to commit 6dcd0242ae Signed-off-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/arch-imx8/imx8qm_pads.h2
-rw-r--r--arch/arm/include/asm/arch-imx8/imx8qxp_pads.h2
-rw-r--r--arch/arm/include/asm/mach-imx/sci/ipc.h2
-rw-r--r--arch/arm/include/asm/mach-imx/sci/rpc.h38
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/irq/api.h6
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/misc/api.h106
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/pad/api.h8
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/pm/api.h95
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/rm/api.h39
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/seco/api.h347
-rw-r--r--arch/arm/include/asm/mach-imx/sci/svc/timer/api.h17
-rw-r--r--arch/arm/include/asm/mach-imx/sci/types.h52
-rw-r--r--arch/arm/mach-imx/imx8/ahab.c6
-rw-r--r--arch/arm/mach-imx/imx8/parser.c6
-rw-r--r--arch/arm/mach-imx/sci/svc/irq/rpc.h7
-rw-r--r--arch/arm/mach-imx/sci/svc/irq/rpc_clnt.c32
-rw-r--r--arch/arm/mach-imx/sci/svc/misc/rpc.h61
-rw-r--r--arch/arm/mach-imx/sci/svc/misc/rpc_clnt.c543
-rw-r--r--arch/arm/mach-imx/sci/svc/pad/rpc.h35
-rw-r--r--arch/arm/mach-imx/sci/svc/pad/rpc_clnt.c258
-rw-r--r--arch/arm/mach-imx/sci/svc/pm/rpc.h59
-rw-r--r--arch/arm/mach-imx/sci/svc/pm/rpc_clnt.c335
-rw-r--r--arch/arm/mach-imx/sci/svc/rm/rpc.h69
-rw-r--r--arch/arm/mach-imx/sci/svc/rm/rpc_clnt.c360
-rw-r--r--arch/arm/mach-imx/sci/svc/seco/rpc.h52
-rw-r--r--arch/arm/mach-imx/sci/svc/seco/rpc_clnt.c383
-rw-r--r--arch/arm/mach-imx/sci/svc/timer/rpc.h39
-rw-r--r--arch/arm/mach-imx/sci/svc/timer/rpc_clnt.c225
28 files changed, 1711 insertions, 1473 deletions
diff --git a/arch/arm/include/asm/arch-imx8/imx8qm_pads.h b/arch/arm/include/asm/arch-imx8/imx8qm_pads.h
index 5cd2b76759..6b62f7d8f6 100644
--- a/arch/arm/include/asm/arch-imx8/imx8qm_pads.h
+++ b/arch/arm/include/asm/arch-imx8/imx8qm_pads.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+
*/
diff --git a/arch/arm/include/asm/arch-imx8/imx8qxp_pads.h b/arch/arm/include/asm/arch-imx8/imx8qxp_pads.h
index 8db40c549a..c35e5dfa60 100644
--- a/arch/arm/include/asm/arch-imx8/imx8qxp_pads.h
+++ b/arch/arm/include/asm/arch-imx8/imx8qxp_pads.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+
*/
diff --git a/arch/arm/include/asm/mach-imx/sci/ipc.h b/arch/arm/include/asm/mach-imx/sci/ipc.h
index 145df1db80..a484963bd4 100644
--- a/arch/arm/include/asm/mach-imx/sci/ipc.h
+++ b/arch/arm/include/asm/mach-imx/sci/ipc.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+
*/
diff --git a/arch/arm/include/asm/mach-imx/sci/rpc.h b/arch/arm/include/asm/mach-imx/sci/rpc.h
index 5c46855344..4105bde1f4 100644
--- a/arch/arm/include/asm/mach-imx/sci/rpc.h
+++ b/arch/arm/include/asm/mach-imx/sci/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+
*/
@@ -20,7 +20,7 @@
/* Defines */
#define SCFW_API_VERSION_MAJOR 1U
-#define SCFW_API_VERSION_MINOR 7U
+#define SCFW_API_VERSION_MINOR 15U
#define SC_RPC_VERSION 1U
@@ -31,9 +31,13 @@
#define RPC_SVC(MESG) ((MESG)->svc)
#define RPC_FUNC(MESG) ((MESG)->func)
#define RPC_R8(MESG) ((MESG)->func)
+#define RPC_I64(MESG, IDX) (I64(RPC_U32((MESG), (IDX))) << 32ULL) \
+ | I64(RPC_U32((MESG), (IDX) + 4U))
#define RPC_I32(MESG, IDX) ((MESG)->DATA.i32[(IDX) / 4U])
#define RPC_I16(MESG, IDX) ((MESG)->DATA.i16[(IDX) / 2U])
#define RPC_I8(MESG, IDX) ((MESG)->DATA.i8[(IDX)])
+#define RPC_U64(MESG, IDX) (U64(RPC_U32((MESG), (IDX))) << 32ULL) \
+ | U64(RPC_U32((MESG), (IDX) + 4U))
#define RPC_U32(MESG, IDX) ((MESG)->DATA.u32[(IDX) / 4U])
#define RPC_U16(MESG, IDX) ((MESG)->DATA.u16[(IDX) / 2U])
#define RPC_U8(MESG, IDX) ((MESG)->DATA.u8[(IDX)])
@@ -56,11 +60,15 @@
#define SC_RPC_ASYNC_STATE_WR_ACTIVE 4U
#define SC_RPC_ASYNC_STATE_WR_DONE 5U
+/* SC -> Client general-purpose MU IRQs */
#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
+/* Client -> SC general-purpose MU IRQs */
+#define SC_RPC_MU_GIR_RST 0x1U
+
#define I8(X) ((int8_t) (X))
#define I16(X) ((int16_t) (X))
#define I32(X) ((int32_t) (X))
@@ -131,31 +139,5 @@ typedef struct
*/
void sc_call_rpc(sc_ipc_t ipc, sc_rpc_msg_t *msg, sc_bool_t no_resp);
-/*!
- * This is an internal function to dispath an RPC call that has
- * arrived via IPC over an MU. It is called by server-side SCFW.
- *
- * @param[in] mu MU message arrived on
- * @param[in,out] msg handle to a message
- *
- * The function result is returned in \a msg.
- */
-void sc_rpc_dispatch(sc_rsrc_t mu, sc_rpc_msg_t *msg);
-
-/*!
- * This function translates an RPC message and forwards on to the
- * normal RPC API. It is used only by hypervisors.
- *
- * @param[in] ipc IPC handle
- * @param[in,out] msg handle to a message
- *
- * This function decodes a message, calls macros to translate the
- * resources, pads, addresses, partitions, memory regions, etc. and
- * then forwards on to the hypervisors SCFW API.Return results are
- * translated back abd placed back into the message to be returned
- * to the original API.
- */
-void sc_rpc_xlate(sc_ipc_t ipc, sc_rpc_msg_t *msg);
-
#endif /* SC_RPC_H */
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/irq/api.h b/arch/arm/include/asm/mach-imx/sci/svc/irq/api.h
index b065e45706..50713bc9c8 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/irq/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/irq/api.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+
*/
@@ -9,7 +9,7 @@
* Header file containing the public API for the System Controller (SC)
* Interrupt (IRQ) function.
*
- * @addtogroup IRQ_SVC (SVC) Interrupt Service
+ * @addtogroup IRQ_SVC IRQ: Interrupt Service
*
* Module for the Interrupt (IRQ) service.
*
@@ -91,6 +91,8 @@
#define SC_IRQ_USR1 (1U << 2U) /*!< User defined 1 */
#define SC_IRQ_USR2 (1U << 3U) /*!< User defined 2 */
#define SC_IRQ_BC_PAD (1U << 4U) /*!< Pad wakeup (broadcast to all partitions) */
+#define SC_IRQ_SW_WAKE (1U << 5U) /*!< Software requested wake */
+#define SC_IRQ_SECVIO (1U << 6U) /*!< Security violation */
/*@}*/
/*!
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/misc/api.h b/arch/arm/include/asm/mach-imx/sci/svc/misc/api.h
index 783c54749f..9fda313527 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/misc/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/misc/api.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+
*/
@@ -9,7 +9,7 @@
* Header file containing the public API for the System Controller (SC)
* Miscellaneous (MISC) function.
*
- * @addtogroup MISC_SVC (SVC) Miscellaneous Service
+ * @addtogroup MISC_SVC MISC: Miscellaneous Service
*
* Module for the Miscellaneous (MISC) service.
*
@@ -54,18 +54,6 @@
/*@}*/
/*!
- * @name Defines for sc_misc_seco_auth_cmd_t
- */
-/*@{*/
-#define SC_MISC_AUTH_CONTAINER 0U /*!< Authenticate container */
-#define SC_MISC_VERIFY_IMAGE 1U /*!< Verify image */
-#define SC_MISC_REL_CONTAINER 2U /*!< Release container */
-#define SC_MISC_SECO_AUTH_SECO_FW 3U /*!< SECO Firmware */
-#define SC_MISC_SECO_AUTH_HDMI_TX_FW 4U /*!< HDMI TX Firmware */
-#define SC_MISC_SECO_AUTH_HDMI_RX_FW 5U /*!< HDMI RX Firmware */
-/*@}*/
-
-/*!
* @name Defines for sc_misc_bt_t
*/
/*@{*/
@@ -89,11 +77,6 @@ typedef uint8_t sc_misc_dma_group_t;
typedef uint8_t sc_misc_boot_status_t;
/*!
- * This type is used to issue SECO authenticate commands.
- */
-typedef uint8_t sc_misc_seco_auth_cmd_t;
-
-/*!
* This type is used report boot status.
*/
typedef uint8_t sc_misc_temp_t;
@@ -202,87 +185,6 @@ sc_err_t sc_misc_set_dma_group(sc_ipc_t ipc, sc_rsrc_t resource,
/* @} */
/*!
- * @name Security Functions
- * @{
- */
-
-/*!
- * @deprecated Use sc_seco_image_load() instead.
- */
-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);
-
-/*!
- * @deprecated Use sc_seco_authenticate() instead.
- */
-sc_err_t sc_misc_seco_authenticate(sc_ipc_t ipc,
- sc_misc_seco_auth_cmd_t cmd, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_fuse_write() instead.
- */
-sc_err_t sc_misc_seco_fuse_write(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_enable_debug() instead.
- */
-sc_err_t sc_misc_seco_enable_debug(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_forward_lifecycle() instead.
- */
-sc_err_t sc_misc_seco_forward_lifecycle(sc_ipc_t ipc, uint32_t change);
-
-/*!
- * @deprecated Use sc_seco_return_lifecycle() instead.
- */
-sc_err_t sc_misc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_build_info() instead.
- */
-void sc_misc_seco_build_info(sc_ipc_t ipc, uint32_t *version,
- uint32_t *commit);
-
-/*!
- * @deprecated Use sc_seco_chip_info() instead.
- */
-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);
-
-/*!
- * @deprecated Use sc_seco_attest_mode() instead.
- */
-sc_err_t sc_misc_seco_attest_mode(sc_ipc_t ipc, uint32_t mode);
-
-/*!
- * @deprecated Use sc_seco_attest() instead.
- */
-sc_err_t sc_misc_seco_attest(sc_ipc_t ipc, uint64_t nonce);
-
-/*!
- * @deprecated Use sc_seco_get_attest_pkey() instead.
- */
-sc_err_t sc_misc_seco_get_attest_pkey(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_get_attest_sign() instead.
- */
-sc_err_t sc_misc_seco_get_attest_sign(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_attest_verify() instead.
- */
-sc_err_t sc_misc_seco_attest_verify(sc_ipc_t ipc, sc_faddr_t addr);
-
-/*!
- * @deprecated Use sc_seco_commit() instead.
- */
-sc_err_t sc_misc_seco_commit(sc_ipc_t ipc, uint32_t *info);
-
-/* @} */
-
-/*!
* @name Debug Functions
* @{
*/
@@ -327,7 +229,7 @@ void sc_misc_build_info(sc_ipc_t ipc, uint32_t *build,
* @param[out] sv_maj pointer to return major part of SCFW version
* @param[out] sv_min pointer to return minor part of SCFW version
*
- * Client verion is the version of the API ported to and used by the caller.
+ * Client version is the version of the API ported to and used by the caller.
* SCFW version is the version of the SCFW binary running on the CPU.
*
* Note a major version difference indicates a break in compatibility.
@@ -433,7 +335,7 @@ sc_err_t sc_misc_otp_fuse_read(sc_ipc_t ipc, uint32_t word, uint32_t *val);
* The command is passed as is to SECO. SECO uses part of the
* \a word parameter to indicate if the fuse should be locked
* after programming. See the "Write common fuse" section of
- * the Security Reference Manual (SRM) for more info.
+ * the SECO API Reference Guide for more info.
*
* @return Returns and error code (SC_ERR_NONE = success).
*
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/pad/api.h b/arch/arm/include/asm/mach-imx/sci/svc/pad/api.h
index b7d536f0e6..739058bd27 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/pad/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/pad/api.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+
*/
@@ -9,7 +9,7 @@
* Header file containing the public API for the System Controller (SC)
* Pad Control (PAD) function.
*
- * @addtogroup PAD_SVC (SVC) Pad Service
+ * @addtogroup PAD_SVC PAD: Pad Service
*
* Module for the Pad Control (PAD) service.
*
@@ -43,7 +43,7 @@
*
* Pads are managed as a resource by the Resource Manager (RM). They have
* assigned owners and only the owners can configure the pads. Some of the
- * pads are reserved for use by the SCFW itself and this can be overriden
+ * pads are reserved for use by the SCFW itself and this can be overridden
* with the implementation of board_config_sc(). Additionally, pads may
* be assigned to various other partitions via the implementation of
* board_system_config().
@@ -160,7 +160,7 @@ typedef uint8_t sc_pad_config_t;
* This type is used to declare a pad low-power isolation config.
* ISO_LATE is the most common setting. ISO_EARLY is only used when
* an output pad is directly determined by another input pad. The
- * other two are only used when SW wants to directly contol isolation.
+ * other two are only used when SW wants to directly control isolation.
*/
typedef uint8_t sc_pad_iso_t;
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/pm/api.h b/arch/arm/include/asm/mach-imx/sci/svc/pm/api.h
index 026aa27c1a..063cabf98f 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/pm/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/pm/api.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+
*/
@@ -10,7 +10,7 @@
* Power Management (PM) function. This includes functions for power state
* control, clock control, reset control, and wake-up event control.
*
- * @addtogroup PM_SVC (SVC) Power Management Service
+ * @addtogroup PM_SVC PM: Power Management Service
*
* Module for the Power Management (PM) service.
*
@@ -85,9 +85,9 @@
* @name Defines for sc_pm_clk_mode_t
*/
/*@{*/
-#define SC_PM_CLK_MODE_ROM_INIT 0U /*!< Clock is initialized by ROM. */
+#define SC_PM_CLK_MODE_ROM_INIT 0U /*!< Clock is initialized by ROM */
#define SC_PM_CLK_MODE_OFF 1U /*!< Clock is disabled */
-#define SC_PM_CLK_MODE_ON 2U /*!< Clock is enabled. */
+#define SC_PM_CLK_MODE_ON 2U /*!< Clock is enabled */
#define SC_PM_CLK_MODE_AUTOGATE_SW 3U /*!< Clock is in SW autogate mode */
#define SC_PM_CLK_MODE_AUTOGATE_HW 4U /*!< Clock is in HW autogate mode */
#define SC_PM_CLK_MODE_AUTOGATE_SW_HW 5U /*!< Clock is in SW-HW autogate mode */
@@ -97,7 +97,7 @@
* @name Defines for sc_pm_clk_parent_t
*/
/*@{*/
-#define SC_PM_PARENT_XTAL 0U /*!< Parent is XTAL. */
+#define SC_PM_PARENT_XTAL 0U /*!< Parent is XTAL */
#define SC_PM_PARENT_PLL0 1U /*!< Parent is PLL0 */
#define SC_PM_PARENT_PLL1 2U /*!< Parent is PLL1 or PLL0/2 */
#define SC_PM_PARENT_PLL2 3U /*!< Parent in PLL2 or PLL0/4 */
@@ -265,6 +265,23 @@ sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
sc_pm_power_mode_t *mode);
/*!
+ * This function sends a wake interrupt to a partition.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] pt handle of partition to wake
+ *
+ * @return Returns an error code (SC_ERR_NONE = success).
+ *
+ * An SC_IRQ_SW_WAKE interrupt is sent to all MUs owned by the
+ * partition that have this interrupt enabled. The CPU using an
+ * MU will exit a low-power state to service the MU interrupt.
+ *
+ * Return errors:
+ * - SC_ERR_PARM if invalid partition
+ */
+sc_err_t sc_pm_partition_wake(sc_ipc_t ipc, sc_rm_pt_t pt);
+
+/*!
* This function sets the power mode of a resource.
*
* @param[in] ipc IPC handle
@@ -275,6 +292,7 @@ sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
*
* Return errors:
* - SC_ERR_PARM if invalid resource or mode,
+ * - SC_ERR_PARM if resource is the MU used to make the call,
* - SC_ERR_NOACCESS if caller's partition is not the resource owner
* or parent of the owner
*
@@ -290,7 +308,7 @@ sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
* Note some resources are still not accessible even when powered up if bus
* transactions go through a fabric not powered up. Examples of this are
* resources in display and capture subsystems which require the display
- * controller or the imaging subsytem to be powered up first.
+ * controller or the imaging subsystem to be powered up first.
*
* Not that resources are grouped into power domains by the underlying
* hardware. If any resource in the domain is on, the entire power domain
@@ -316,7 +334,7 @@ sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
* Return errors:
* - SC_ERR_PARM if invalid partition or mode,
* - SC_ERR_NOACCESS if caller's partition is not the parent
-* of \a pt
+* (with grant) of \a pt
*
* This functions loops through all the resources owned by \a pt
* and sets the power mode to \a mode. It will skip setting
@@ -344,7 +362,7 @@ sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t *mode);
/*!
- * This function requests the low power mode some of the resources
+ * This function specifies the low power mode some of the resources
* can enter based on their state. This API is only valid for the
* following resources : SC_R_A53, SC_R_A53_0, SC_R_A53_1, SC_A53_2,
* SC_A53_3, SC_R_A72, SC_R_A72_0, SC_R_A72_1, SC_R_CC1, SC_R_A35,
@@ -400,6 +418,9 @@ sc_err_t sc_pm_req_cpu_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
* - SC_ERR_PARM if invalid resource or address,
* - SC_ERR_NOACCESS if caller's partition is not the parent of the
* resource (CPU) owner
+ *
+ * Note the address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
sc_faddr_t address);
@@ -419,13 +440,16 @@ sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
* - SC_ERR_PARM if invalid resource or address,
* - SC_ERR_NOACCESS if caller's partition is not the parent of the
* resource (CPU) owner
+ *
+ * Note the address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
sc_err_t sc_pm_set_cpu_resume(sc_ipc_t ipc, sc_rsrc_t resource,
sc_bool_t isPrimary, sc_faddr_t address);
/*!
* This function requests the power mode configuration for system-level
- * interfaces including messaging units, interconnect, and memories. This API
+ * interfaces including messaging units, interconnect, and memories. This API
* is only valid for the following resources : SC_R_A53, SC_R_A72, and
* SC_R_M4_x_PID_y. For all other resources, it will return SC_ERR_PARAM.
* The requested power mode will be captured and applied to system-level
@@ -488,6 +512,10 @@ sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
* or parent of the owner,
* - SC_ERR_UNAVAILABLE if clock/PLL not applicable to this resource
*
+ * This function returns the actual clock rate of the hardware. This rate
+ * may be different from the original requested clock rate if the resource
+ * is set to a low power mode.
+ *
* Refer to the [Clock List](@ref CLOCKS) for valid clock/PLL values.
*/
sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -513,7 +541,7 @@ sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
* Return errors:
* - SC_ERR_PARM if invalid resource or clock,
* - SC_ERR_NOACCESS if caller's partition is not the resource owner
- * or parent of the owner,
+ * or parent (with grant) of the owner,
* - SC_ERR_UNAVAILABLE if clock not applicable to this resource
*
* Refer to the [Clock List](@ref CLOCKS) for valid clock values.
@@ -528,14 +556,14 @@ sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource,
* @param[in] ipc IPC handle
* @param[in] resource ID of the resource
* @param[in] clk clock to affect
- * @param[in] parent New parent of the clock.
+ * @param[in] parent New parent of the clock
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_ERR_PARM if invalid resource or clock,
* - SC_ERR_NOACCESS if caller's partition is not the resource owner
- * or parent of the owner,
+ * or parent (with grant) of the owner,
* - SC_ERR_UNAVAILABLE if clock not applicable to this resource
* - SC_ERR_BUSY if clock is currently enabled.
* - SC_ERR_NOPOWER if resource not powered
@@ -551,7 +579,7 @@ sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
* @param[in] ipc IPC handle
* @param[in] resource ID of the resource
* @param[in] clk clock to affect
- * @param[out] parent pointer to return parent of clock.
+ * @param[out] parent pointer to return parent of clock
*
* @return Returns an error code (SC_ERR_NONE = success).
*
@@ -647,6 +675,9 @@ sc_err_t sc_pm_get_reset_part(sc_ipc_t ipc, sc_rm_pt_t *pt);
* This must be used to boot a partition. Only a partition booted this
* way can be rebooted using the watchdog, sc_pm_boot() or
* sc_pm_reboot_partition().
+ *
+ * Note the address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
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,
@@ -669,6 +700,9 @@ sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt,
* This function can be used to change the boot parameters for a partition.
* This can be useful if a partitions reboots differently from the initial
* boot done via sc_pm_boot() or via ROM.
+ *
+ * Note the address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
sc_err_t sc_pm_set_boot_parm(sc_ipc_t ipc,
sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
@@ -755,15 +789,18 @@ sc_err_t sc_pm_reboot_continue(sc_ipc_t ipc, sc_rm_pt_t pt);
* - SC_ERR_NOACCESS if caller's partition is not the parent of the
* resource (CPU) owner
*
- * This function is usually used to start a secondar CPU in the
- * same partition as the caller. It is not used to start the first
- * CPU in a dedicated partition. That would be started by calling
+ * This function is usually used to start a secondary CPU in the
+ * same partition as the caller. It is not used to start the first
+ * CPU in a dedicated partition. That would be started by calling
* sc_pm_boot().
*
* A CPU started with sc_pm_cpu_start() will not restart as a result
* of a watchdog event or calling sc_pm_reboot() or sc_pm_reboot_partition().
* Those will reboot that partition which will start the CPU started with
* sc_pm_boot().
+ *
+ * Note the address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
sc_faddr_t address);
@@ -784,10 +821,36 @@ sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
* Note this just resets the CPU. None of the peripherals or bus fabric used by
* the CPU is reset. State configured in the SCFW is not reset. The SW running
* on the core has to understand and deal with this.
+ *
+ * The address is limited by the hardware implementation. See the
+ * [CPU Start Address](@ref BOOT_ADDR) section in the Porting Guide.
*/
void sc_pm_cpu_reset(sc_ipc_t ipc, sc_rsrc_t resource, sc_faddr_t address);
/*!
+ * This function is used to reset a peripheral.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] resource resource to reset
+ *
+ * This function will reset a resource. Most resources cannot be reset unless
+ * the SoC design specifically allows it. In the case on MUs, the IPC/RPC
+ * protocol is also reset. Note a caller cannot reset an MU that this API
+ * call is sent on.
+ *
+ * @return Returns an error code (SC_ERR_NONE = success).
+ *
+ * Return errors:
+ * - SC_ERR_PARM if invalid resource,
+ * - SC_ERR_PARM if resource is the MU used to make the call,
+ * - SC_ERR_NOACCESS if caller's partition is not the resource owner or parent
+ * (with grant) of the owner,
+ * - SC_ERR_BUSY if the resource cannot be reset due to power state of buses,
+ * - SC_ERR_UNAVAILABLE if the resource cannot be reset due to hardware limitations
+ */
+sc_err_t sc_pm_resource_reset(sc_ipc_t ipc, sc_rsrc_t resource);
+
+/*!
* This function returns a bool indicating if a partition was started.
*
* @param[in] ipc IPC handle
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/rm/api.h b/arch/arm/include/asm/mach-imx/sci/svc/rm/api.h
index 8ac304e80f..afce3aba5b 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/rm/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/rm/api.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+
*/
@@ -10,7 +10,7 @@
* Resource Management (RM) function. This includes functions for
* partitioning resources, pads, and memory regions.
*
- * @addtogroup RM_SVC (SVC) Resource Management Service
+ * @addtogroup RM_SVC RM: Resource Management Service
*
* Module for the Resource Management (RM) service.
*
@@ -336,7 +336,7 @@ sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst,
*
* This action resets the resource's master and peripheral attributes.
* Privilege attribute will be PASSTHRU, security attribute will be
- * ASSERT if the partition si secure and NEGATE if it is not, and
+ * ASSERT if the partition is secure and NEGATE if it is not, and
* masters will defaulted to SMMU bypass. Access permissions will reset
* to SEC_RW for the owning partition only for secure partitions, FULL for
* non-secure. Default is no access by other partitions.
@@ -586,15 +586,18 @@ sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource,
* - SC_ERR_UNAVAILABLE if memory region table is full (no more allocation
* space)
*
- * The area covered by the memory region must currently be owned by the caller.
- * By default, the new region will have access permission set to allow the
- * caller to access.
+ * This function will create a new memory region. The area covered by the
+ * new region must already exist in a memory region owned by the caller. The
+ * result will be two memory regions, the new one overlapping the existing
+ * one. The new region has higher priority. See the XRDC2 MRC documentation
+ * for how it resolves access permissions in this case. By default, the new
+ * region will have access permission set to allow the 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);
/*!
- * This function requests that the SC split a memory region.
+ * This function requests that the SC split an existing memory region.
*
* @param[in] ipc IPC handle
* @param[in] mr handle of memory region to split
@@ -615,7 +618,9 @@ sc_err_t sc_rm_memreg_alloc(sc_ipc_t ipc, sc_rm_mr_t *mr,
* - SC_ERR_UNAVAILABLE if memory region table is full (no more allocation
* space)
*
- * Note the new region must start or end on the split region.
+ * This function will take an existing region and split it into two,
+ * non-overlapping regions. 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);
@@ -641,7 +646,9 @@ sc_err_t sc_rm_memreg_split(sc_ipc_t ipc, sc_rm_mr_t mr,
* space)
*
* This function finds the memory region containing the address range.
- * It then splits it as required and returns the extracted region.
+ * It then splits it as required and returns the extracted region. The
+ * result is 2-3 non-overlapping regions, depending on how the new region
+ * aligns with existing regions.
*/
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);
@@ -697,6 +704,12 @@ sc_err_t sc_rm_find_memreg(sc_ipc_t ipc, sc_rm_mr_t *mr,
*
* @return Returns an error code (SC_ERR_NONE = success).
*
+ * This function assigns a memory region to a partition. This partition is then
+ * the owner. All regions always have an owner (one owner). The owner
+ * has various rights to make API calls affecting the region. Ownership
+ * does not imply access to the memory itself (that is based on access
+ * rights).
+ *
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the \a mr owner or parent
@@ -715,11 +728,9 @@ sc_err_t sc_rm_assign_memreg(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_mr_t mr);
* applied for
* @param[in] perm permissions to apply to \a mr for \a pt
*
- * This function assigned a memory region to a partition. This partition is then
- * the owner. All regions always have an owner (one owner). The owner
- * has various rights to make API calls affecting the region. Ownership
- * does not imply access to the memory itself (that is based on access
- * rights).
+ * This operates on the memory region specified. If SC_RM_PT_ALL is specified
+ * then it operates on all the regions owned by the caller that exist at the
+ * time of the call.
*
* @return Returns an error code (SC_ERR_NONE = success).
*
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/seco/api.h b/arch/arm/include/asm/mach-imx/sci/svc/seco/api.h
index 42b9593210..4040448f55 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/seco/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/seco/api.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+
*/
@@ -9,10 +9,14 @@
* Header file containing the public API for the System Controller (SC)
* Security (SECO) function.
*
- * @addtogroup SECO_SVC (SVC) Security Service
+ * @addtogroup SECO_SVC SECO: Security Service
*
* Module for the Security (SECO) service.
*
+ * @anchor seco_err
+ *
+ * @includedoc seco/details.dox
+ *
* @{
*/
@@ -36,6 +40,7 @@
#define SC_SECO_AUTH_SECO_FW 3U /*!< SECO Firmware */
#define SC_SECO_AUTH_HDMI_TX_FW 4U /*!< HDMI TX Firmware */
#define SC_SECO_AUTH_HDMI_RX_FW 5U /*!< HDMI RX Firmware */
+#define SC_SECO_EVERIFY_IMAGE 6U /*!< Enhanced verify image */
/*@}*/
/*!
@@ -72,20 +77,23 @@ typedef uint32_t sc_seco_rng_stat_t;
* @param[in] ipc IPC handle
* @param[in] addr_src address of image source
* @param[in] addr_dst address of image destination
- * @param[in] len lenth of image to load
+ * @param[in] len length of image to load
* @param[in] fw SC_TRUE = firmware load
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This is used to load images via the SECO. Examples include SECO
* Firmware and IVT/CSF data used for authentication. These are usually
* loaded into SECO TCM. \a addr_src is in secure memory.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
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);
@@ -100,18 +108,66 @@ sc_err_t sc_seco_image_load(sc_ipc_t ipc, sc_faddr_t addr_src,
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_BUSY if SECO is busy with another authentication request,
+ * - SC_ERR_FAIL if SECO response is bad,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This is used to authenticate a SECO image or issue a security
* command. \a addr often points to an container. It is also
* just data (or even unused) for some commands.
*
- * See the Security Reference Manual (SRM) for more info.
+ * Implementation of this command depends on the underlying security
+ * architecture of the device. For example, on devices with SECO FW,
+ * the following options apply:
+ *
+ * - cmd=SC_SECO_AUTH_CONTAINER, addr=container address (sends AHAB_AUTH_CONTAINER_REQ to SECO)
+ * - cmd=SC_SECO_VERIFY_IMAGE, addr=image mask (sends AHAB_VERIFY_IMAGE_REQ to SECO)
+ * - cmd=SC_SECO_REL_CONTAINER, addr unused (sends AHAB_RELEASE_CONTAINER_REQ to SECO)
+ * - cmd=SC_SECO_AUTH_HDMI_TX_FW, addr unused (sends AHAB_ENABLE_HDMI_X_REQ with Subsystem=0 to SECO)
+ * - cmd=SC_SECO_AUTH_HDMI_RX_FW, addr unused (sends AHAB_ENABLE_HDMI_X_REQ with Subsystem=1 to SECO)
+ *
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_authenticate(sc_ipc_t ipc,
sc_seco_auth_cmd_t cmd, sc_faddr_t addr);
+/*!
+ * This function is used to authenticate a SECO image or command. This is an
+ * enhanced version that has additional mask arguments.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] cmd authenticate command
+ * @param[in] addr address of/or metadata
+ * @param[in] mask1 metadata
+ * @param[in] mask2 metadata
+ *
+ * Return errors codes:
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_BUSY if SECO is busy with another authentication request,
+ * - SC_ERR_FAIL if SECO response is bad,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
+ * This supports all the commands found in sc_seco_authenticate(). Those
+ * commands should set both masks to 0 (except SC_SECO_VERIFY_IMAGE).
+
+ * New commands are as follows:
+ *
+ * - cmd=SC_SECO_VERIFY_IMAGE, addr unused, mask1=image mask, mask2 unused (sends AHAB_VERIFY_IMAGE_REQ to SECO)
+ * - cmd=SC_SECO_EVERIFY_IMAGE, addr=container address, mask1=image mask, mask2=move mask (sends AHAB_EVERIFY_IMAGE_REQ to SECO)
+ *
+ * See the <em>SECO API Reference Guide</em> for more info.
+ */
+sc_err_t sc_seco_enh_authenticate(sc_ipc_t ipc,
+ sc_seco_auth_cmd_t cmd, sc_faddr_t addr,
+ uint32_t mask1, uint32_t mask2);
+
/* @} */
/*!
@@ -123,16 +179,19 @@ sc_err_t sc_seco_authenticate(sc_ipc_t ipc,
* This function updates the lifecycle of the device.
*
* @param[in] ipc IPC handle
- * @param[in] change desired lifecycle transistion
+ * @param[in] change desired lifecycle transition
*
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
- * This message is used for going from Open to NXP Closed to OEM Closed.
+ * This function is used for going from Open to NXP Closed to OEM Closed.
* Note \a change is NOT the new desired lifecycle. It is a lifecycle
- * transition as documented in the Security Reference Manual (SRM).
+ * transition as documented in the <em>SECO API Reference Guide</em>.
*
* If any SECO request fails or only succeeds because the part is in an
* "OEM open" lifecycle, then a request to transition from "NXP closed"
@@ -152,7 +211,10 @@ sc_err_t sc_seco_forward_lifecycle(sc_ipc_t ipc, uint32_t change);
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* Note \a addr must be a pointer to a signed message block.
*
@@ -160,7 +222,7 @@ sc_err_t sc_seco_forward_lifecycle(sc_ipc_t ipc, uint32_t change);
* by NXP SRK. For OEM States (Partial Field Return), must be signed by OEM
* SRK.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr);
@@ -177,8 +239,11 @@ sc_err_t sc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr);
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if \a info is invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if \a info is invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*/
sc_err_t sc_seco_commit(sc_ipc_t ipc, uint32_t *info);
@@ -199,18 +264,21 @@ sc_err_t sc_seco_commit(sc_ipc_t ipc, uint32_t *info);
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if \a mode is invalid
- * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if \a mode is invalid,
+ * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This is used to set the SECO attestation mode. This can be prover
- * or verfier. See the Security Reference Manual (SRM) for more on the
- * suported modes, mode values, and mode behavior.
+ * or verifier. See the <em>SECO API Reference Guide</em> for more on the
+ * supported modes, mode values, and mode behavior.
*/
sc_err_t sc_seco_attest_mode(sc_ipc_t ipc, uint32_t mode);
/*!
- * This function is used to request atestation. Only the owner of
+ * This function is used to request attestation. Only the owner of
* the SC_R_ATTESTATION resource may make this call.
*
* @param[in] ipc IPC handle
@@ -219,14 +287,17 @@ sc_err_t sc_seco_attest_mode(sc_ipc_t ipc, uint32_t mode);
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This is used to ask SECO to perform an attestation. The result depends
* on the attestation mode. After this call, the signature can be
* requested or a verify can be requested.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_attest(sc_ipc_t ipc, uint64_t nonce);
@@ -238,18 +309,21 @@ sc_err_t sc_seco_attest(sc_ipc_t ipc, uint64_t nonce);
* @param[in] ipc IPC handle
* @param[in] addr address to write response
*
- * Result will be written to \a addr. The \a addr parmater must point
+ * Result will be written to \a addr. The \a addr parameter must point
* to an address SECO can access. It must be 64-bit aligned. There
* should be 96 bytes of space.
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if \a addr bad or attestation has not been requested
- * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if \a addr bad or attestation has not been requested,
+ * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_get_attest_pkey(sc_ipc_t ipc, sc_faddr_t addr);
@@ -261,18 +335,21 @@ sc_err_t sc_seco_get_attest_pkey(sc_ipc_t ipc, sc_faddr_t addr);
* @param[in] ipc IPC handle
* @param[in] addr address to write response
*
- * Result will be written to \a addr. The \a addr parmater must point
+ * Result will be written to \a addr. The \a addr parameter must point
* to an address SECO can access. It must be 64-bit aligned. There
* should be 120 bytes of space.
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if \a addr bad or attestation has not been requested
- * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if \a addr bad or attestation has not been requested,
+ * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_get_attest_sign(sc_ipc_t ipc, sc_faddr_t addr);
@@ -283,18 +360,21 @@ sc_err_t sc_seco_get_attest_sign(sc_ipc_t ipc, sc_faddr_t addr);
* @param[in] ipc IPC handle
* @param[in] addr address of signature
*
- * The \a addr parmater must point to an address SECO can access. It must be
+ * The \a addr parameter must point to an address SECO can access. It must be
* 64-bit aligned.
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if \a addr bad or attestation has not been requested
- * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller
- * - SC_ERR_UNAVAILABLE if SECO not available
- * - SC_ERR_FAIL if signature doesn't match
+ * - SC_ERR_PARM if \a addr bad or attestation has not been requested,
+ * - SC_ERR_NOACCESS if SC_R_ATTESTATON not owned by caller,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_FAIL if signature doesn't match,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_attest_verify(sc_ipc_t ipc, sc_faddr_t addr);
@@ -317,13 +397,16 @@ sc_err_t sc_seco_attest_verify(sc_ipc_t ipc, sc_faddr_t addr);
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This function is used to encapsulate sensitive keys in a specific structure
* called a blob, which provides both confidentiality and integrity protection.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
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);
@@ -338,15 +421,18 @@ sc_err_t sc_seco_gen_key_blob(sc_ipc_t ipc, uint32_t id,
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This function is used to install private cryptographic keys encapsulated
* in a blob previously generated by SECO. The controller can be either the
* IEE or the VPU. The blob header carries the controller type and the key
* size, as provided by the user when generating the key blob.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_load_key(sc_ipc_t ipc, uint32_t id,
sc_faddr_t addr);
@@ -368,14 +454,17 @@ sc_err_t sc_seco_load_key(sc_ipc_t ipc, uint32_t id,
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This function is supported only in OEM-closed lifecycle. It generates
* the mfg public key and stores it in a specific location in the secure
* memory.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_get_mp_key(sc_ipc_t ipc, sc_faddr_t dst_addr,
uint16_t dst_size);
@@ -392,15 +481,18 @@ sc_err_t sc_seco_get_mp_key(sc_ipc_t ipc, sc_faddr_t dst_addr,
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This function is supported only in OEM-closed lifecycle. It updates the
* content of the MPMR (Manufacturing Protection Message register of 256
* bits). This register will be appended to the input-data message when
* generating the signature. Please refer to the CAAM block guide for details.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr,
uint8_t size, uint8_t lock);
@@ -417,8 +509,11 @@ sc_err_t sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr,
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_PARM if word fuse index param out of range or invalid
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_PARM if word fuse index param out of range or invalid,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* This function is used to generate an ECDSA signature for an input-data
* message and to store it in a specific location in the secure memory. It
@@ -426,7 +521,7 @@ sc_err_t sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr,
* signature, the RNG must be initialized. In case it has not been started
* an error will be returned.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
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);
@@ -458,6 +553,12 @@ void sc_seco_build_info(sc_ipc_t ipc, uint32_t *version,
* @param[out] uid_h pointer to return UID (upper 32 bits)
*
* @return Returns and error code (SC_ERR_NONE = success).
+ *
+ * Return errors codes:
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*/
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);
@@ -471,11 +572,14 @@ sc_err_t sc_seco_chip_info(sc_ipc_t ipc, uint16_t *lc,
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* Note \a addr must be a pointer to a signed message block.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_enable_debug(sc_ipc_t ipc, sc_faddr_t addr);
@@ -488,6 +592,12 @@ sc_err_t sc_seco_enable_debug(sc_ipc_t ipc, sc_faddr_t addr);
*
* @return Returns an error code (SC_ERR_NONE = success).
*
+ * Return errors codes:
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
* Read of \a idx 0 captures events from SECO. Loop starting
* with 0 until an error is returned to dump all events.
*/
@@ -510,11 +620,14 @@ sc_err_t sc_seco_get_event(sc_ipc_t ipc, uint8_t idx,
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* Note \a addr must be a pointer to a signed message block.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_fuse_write(sc_ipc_t ipc, sc_faddr_t addr);
@@ -527,11 +640,14 @@ sc_err_t sc_seco_fuse_write(sc_ipc_t ipc, sc_faddr_t addr);
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* Note \a addr must be a pointer to a signed message block.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_patch(sc_ipc_t ipc, sc_faddr_t addr);
@@ -544,15 +660,116 @@ sc_err_t sc_seco_patch(sc_ipc_t ipc, sc_faddr_t addr);
* @return Returns and error code (SC_ERR_NONE = success).
*
* Return errors codes:
- * - SC_ERR_UNAVAILABLE if SECO not available
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
*
* The RNG is started automatically after all CPUs are booted. This
* function can be used to start earlier and to check the status.
*
- * See the Security Reference Manual (SRM) for more info.
+ * See the <em>SECO API Reference Guide</em> for more info.
*/
sc_err_t sc_seco_start_rng(sc_ipc_t ipc, sc_seco_rng_stat_t *status);
+/*!
+ * This function sends a generic signed message to the
+ * SECO SHE/HSM components.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] addr address of message block
+ *
+ * @return Returns and error code (SC_ERR_NONE = success).
+ *
+ * Return errors codes:
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
+ * Note \a addr must be a pointer to a signed message block.
+ *
+ * See the <em>SECO API Reference Guide</em> for more info.
+ */
+sc_err_t sc_seco_sab_msg(sc_ipc_t ipc, sc_faddr_t addr);
+
+/*!
+ * This function is used to enable security violation and tamper interrupts.
+ * These are then reported using the IRQ service via the SC_IRQ_SECVIO
+ * interrupt. Note it is automatically enabled at boot.
+ *
+ * @param[in] ipc IPC handle
+ *
+ * @return Returns and error code (SC_ERR_NONE = success).
+ *
+ * Return errors codes:
+ * - SC_ERR_NOACCESS if caller does not own SC_R_SECVIO,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
+ * The security violation interrupt is self-masking. Once it is cleared in
+ * the SNVS it must be re-enabled using this function.
+ */
+sc_err_t sc_seco_secvio_enable(sc_ipc_t ipc);
+
+/*!
+ * This function is used to read/write SNVS security violation
+ * and tamper registers.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] id register ID
+ * @param[in] access 0=read, 1=write
+ * @param[in] data0 pointer to data to read or write
+ * @param[in] data1 pointer to data to read or write
+ * @param[in] data2 pointer to data to read or write
+ * @param[in] data3 pointer to data to read or write
+ * @param[in] data4 pointer to data to read or write
+ * @param[in] size number of valid data words
+ *
+ * @return Returns and error code (SC_ERR_NONE = success).
+ *
+ * Return errors codes:
+ * - SC_ERR_NOACCESS if caller does not own SC_R_SECVIO,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
+ * Unused data words can be passed a NULL pointer.
+ *
+ * See AHAB_MANAGE_SNVS_REQ in the <em>SECO API Reference Guide</em> for
+ * more info.
+ */
+sc_err_t sc_seco_secvio_config(sc_ipc_t ipc, uint8_t id, uint8_t access,
+ uint32_t *data0, uint32_t *data1, uint32_t *data2, uint32_t *data3,
+ uint32_t *data4, uint8_t size);
+
+/*!
+ * This function is used to read/write SNVS security violation
+ * and tamper DGO registers.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] id regsiter ID
+ * @param[in] access 0=read, 1=write
+ * @param[in] data pointer to data to read or write
+ *
+ * @return Returns and error code (SC_ERR_NONE = success).
+ *
+ * Return errors codes:
+ * - SC_ERR_NOACCESS if caller does not own SC_R_SECVIO,
+ * - SC_ERR_UNAVAILABLE if SECO not available,
+ * - SC_ERR_IPC if SECO response has bad header tag or size,
+ * - SC_ERR_VERSION if SECO response has bad version,
+ * - Others, see the [Security Service Detailed Description](\ref seco_err) section
+ *
+ * See AHAB_MANAGE_SNVS_DGO_REQ in the <em>SECO API Reference Guide</em>
+ * for more info.
+ */
+sc_err_t sc_seco_secvio_dgo_config(sc_ipc_t ipc, uint8_t id,
+ uint8_t access, uint32_t *data);
+
/* @} */
#endif /* SC_SECO_API_H */
diff --git a/arch/arm/include/asm/mach-imx/sci/svc/timer/api.h b/arch/arm/include/asm/mach-imx/sci/svc/timer/api.h
index bd1ccbd5bf..844ae96893 100644
--- a/arch/arm/include/asm/mach-imx/sci/svc/timer/api.h
+++ b/arch/arm/include/asm/mach-imx/sci/svc/timer/api.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+
*/
@@ -9,7 +9,7 @@
* Header file containing the public API for the System Controller (SC)
* Timer function.
*
- * @addtogroup TIMER_SVC (SVC) Timer Service
+ * @addtogroup TIMER_SVC TIMER: Timer Service
*
* Module for the Timer service. This includes support for the watchdog, RTC,
* and system counter. Note every resource partition has a watchdog it can
@@ -61,7 +61,7 @@ typedef uint32_t sc_timer_wdog_time_t;
/* Functions */
/*!
- * @name Wathdog Functions
+ * @name Watchdog Functions
* @{
*/
@@ -104,8 +104,15 @@ sc_err_t sc_timer_set_wdog_pre_timeout(sc_ipc_t ipc,
*
* @return Returns an error code (SC_ERR_NONE = success).
*
+ * Return errors:
+ * - SC_ERR_NOACCESS if caller's partition is not isolated
+ *
* If \a lock is set then the watchdog cannot be stopped or the timeout
* period changed.
+ *
+ * If the calling partition is not isolated then the wdog cannot be used.
+ * This is always the case if a non-secure partition is running on the same
+ * CPU as a secure partition (e.g. Linux under TZ). See sc_rm_partition_alloc().
*/
sc_err_t sc_timer_start_wdog(sc_ipc_t ipc, sc_bool_t lock);
@@ -293,11 +300,11 @@ sc_err_t sc_timer_cancel_rtc_alarm(sc_ipc_t ipc);
* calibration.
*
* @param[in] ipc IPC handle
- * @param[in] count calbration count (-16 to 15)
+ * @param[in] count calibration count (-16 to 15)
*
* The calibration value is a 5-bit value including the sign bit, which is
* implemented in 2's complement. It is added or subtracted from the RTC on
- * a perdiodic basis, once per 32768 cycles of the RTC clock.
+ * a periodic basis, once per 32768 cycles of the RTC clock.
*
* @return Returns an error code (SC_ERR_NONE = success).
*/
diff --git a/arch/arm/include/asm/mach-imx/sci/types.h b/arch/arm/include/asm/mach-imx/sci/types.h
index bc5462504e..3cfefde362 100644
--- a/arch/arm/include/asm/mach-imx/sci/types.h
+++ b/arch/arm/include/asm/mach-imx/sci/types.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+
*/
@@ -18,8 +18,6 @@
/* Defines */
-#define SCFW_API_VERSION 100U
-
/*!
* @name Defines for common frequencies
*/
@@ -40,6 +38,7 @@
#define SC_83MHZ 83333333U /*!< 83MHz */
#define SC_84MHZ 84375000U /*!< 84.37MHz */
#define SC_100MHZ 100000000U /*!< 100MHz */
+#define SC_114MHZ 114000000U /*!< 114MHz */
#define SC_125MHZ 125000000U /*!< 125MHz */
#define SC_133MHZ 133333333U /*!< 133MHz */
#define SC_135MHZ 135000000U /*!< 135MHz */
@@ -60,6 +59,7 @@
#define SC_372MHZ 372000000U /*!< 372MHz */
#define SC_375MHZ 375000000U /*!< 375MHz */
#define SC_400MHZ 400000000U /*!< 400MHz */
+#define SC_465MHZ 465000000U /*!< 465MHz */
#define SC_500MHZ 500000000U /*!< 500MHz */
#define SC_594MHZ 594000000U /*!< 594MHz */
#define SC_625MHZ 625000000U /*!< 625MHz */
@@ -95,6 +95,7 @@
#define SC_1500MHZ 1500000000U /*!< 1.5GHz */
#define SC_1600MHZ 1600000000U /*!< 1.6GHz */
#define SC_1800MHZ 1800000000U /*!< 1.8GHz */
+#define SC_1860MHZ 1860000000U /*!< 1.86GHz */
#define SC_2000MHZ 2000000000U /*!< 2.0GHz */
#define SC_2112MHZ 2112000000U /*!< 2.12GHz */
/*@}*/
@@ -113,6 +114,7 @@
#define SC_144MHZ 144000000U /*!< 144MHz */
#define SC_192MHZ 192000000U /*!< 192MHz */
#define SC_211MHZ 211200000U /*!< 211.2MHz */
+#define SC_228MHZ 228000000U /*!< 233MHz */
#define SC_240MHZ 240000000U /*!< 240MHz */
#define SC_264MHZ 264000000U /*!< 264MHz */
#define SC_352MHZ 352000000U /*!< 352MHz */
@@ -120,11 +122,13 @@
#define SC_384MHZ 384000000U /*!< 384MHz */
#define SC_396MHZ 396000000U /*!< 396MHz */
#define SC_432MHZ 432000000U /*!< 432MHz */
+#define SC_456MHZ 456000000U /*!< 466MHz */
#define SC_480MHZ 480000000U /*!< 480MHz */
#define SC_600MHZ 600000000U /*!< 600MHz */
#define SC_744MHZ 744000000U /*!< 744MHz */
#define SC_792MHZ 792000000U /*!< 792MHz */
#define SC_864MHZ 864000000U /*!< 864MHz */
+#define SC_912MHZ 912000000U /*!< 912MHz */
#define SC_960MHZ 960000000U /*!< 960MHz */
#define SC_1056MHZ 1056000000U /*!< 1056MHz */
#define SC_1104MHZ 1104000000U /*!< 1104MHz */
@@ -208,12 +212,12 @@
#define SC_R_PERF 23U
#define SC_R_USB_1_PHY 24U
#define SC_R_DC_0_WARP 25U
-#define SC_R_UNUSED7 26U
-#define SC_R_UNUSED8 27U
+#define SC_R_V2X_MU_0 26U
+#define SC_R_V2X_MU_1 27U
#define SC_R_DC_0_VIDEO0 28U
#define SC_R_DC_0_VIDEO1 29U
#define SC_R_DC_0_FRAC0 30U
-#define SC_R_UNUSED6 31U
+#define SC_R_V2X_MU_2 31U
#define SC_R_DC_0 32U
#define SC_R_GPU_2_PID0 33U
#define SC_R_DC_0_PLL_0 34U
@@ -222,11 +226,11 @@
#define SC_R_DC_1_BLIT1 37U
#define SC_R_DC_1_BLIT2 38U
#define SC_R_DC_1_BLIT_OUT 39U
-#define SC_R_UNUSED9 40U
-#define SC_R_UNUSED10 41U
+#define SC_R_V2X_MU_3 40U
+#define SC_R_V2X_MU_4 41U
#define SC_R_DC_1_WARP 42U
-#define SC_R_UNUSED11 43U
-#define SC_R_UNUSED12 44U
+#define SC_R_TBU_CTL 43U
+#define SC_R_SECVIO 44U
#define SC_R_DC_1_VIDEO0 45U
#define SC_R_DC_1_VIDEO1 46U
#define SC_R_DC_1_FRAC0 47U
@@ -322,10 +326,10 @@
#define SC_R_DMA_1_CH29 137U
#define SC_R_DMA_1_CH30 138U
#define SC_R_DMA_1_CH31 139U
-#define SC_R_UNUSED1 140U
-#define SC_R_UNUSED2 141U
-#define SC_R_UNUSED3 142U
-#define SC_R_UNUSED4 143U
+#define SC_R_V2X_PID0 140U
+#define SC_R_V2X_PID1 141U
+#define SC_R_V2X_PID2 142U
+#define SC_R_V2X_PID3 143U
#define SC_R_GPU_0_PID0 144U
#define SC_R_GPU_0_PID1 145U
#define SC_R_GPU_0_PID2 146U
@@ -472,8 +476,8 @@
#define SC_R_M4_0_UART 287U
#define SC_R_M4_0_I2C 288U
#define SC_R_M4_0_INTMUX 289U
-#define SC_R_UNUSED15 290U
-#define SC_R_UNUSED16 291U
+#define SC_R_ENET_0_A0 290U
+#define SC_R_ENET_0_A1 291U
#define SC_R_M4_0_MU_0B 292U
#define SC_R_M4_0_MU_0A0 293U
#define SC_R_M4_0_MU_0A1 294U
@@ -548,12 +552,12 @@
#define SC_R_VPU_PID5 363U
#define SC_R_VPU_PID6 364U
#define SC_R_VPU_PID7 365U
-#define SC_R_VPU_UART 366U
-#define SC_R_VPUCORE 367U
-#define SC_R_VPUCORE_0 368U
-#define SC_R_VPUCORE_1 369U
-#define SC_R_VPUCORE_2 370U
-#define SC_R_VPUCORE_3 371U
+#define SC_R_ENET_0_A2 366U
+#define SC_R_ENET_1_A0 367U
+#define SC_R_ENET_1_A1 368U
+#define SC_R_ENET_1_A2 369U
+#define SC_R_ENET_1_A3 370U
+#define SC_R_ENET_1_A4 371U
#define SC_R_DMA_4_CH0 372U
#define SC_R_DMA_4_CH1 373U
#define SC_R_DMA_4_CH2 374U
@@ -799,7 +803,9 @@
#define SC_C_IPG_STOP_MODE 53U
#define SC_C_IPG_STOP_ACK 54U
#define SC_C_SYNC_CTRL 55U
-#define SC_C_LAST 56U
+#define SC_C_OFS_AUDIO_ALT 56U
+#define SC_C_DSP_BYP 57U
+#define SC_C_LAST 58U
#define SC_P_ALL ((sc_pad_t) UINT16_MAX) /*!< All pads */
diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index df50862e9b..fdd6ef453b 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -76,7 +76,7 @@ int authenticate_os_container(ulong addr)
debug("container length %u\n", length);
memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)addr, ALIGN(length, CONFIG_SYS_CACHELINE_SIZE));
- err = sc_seco_authenticate(ipcHndl, SC_MISC_AUTH_CONTAINER, SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);
+ err = sc_seco_authenticate(ipcHndl, SC_SECO_AUTH_CONTAINER, SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);
if (err) {
printf("Error: authenticate container hdr failed, return %d\n", err);
ret = -EIO;
@@ -114,7 +114,7 @@ int authenticate_os_container(ulong addr)
goto exit;
}
- err = sc_seco_authenticate(ipcHndl, SC_MISC_VERIFY_IMAGE, (1 << i));
+ err = sc_seco_authenticate(ipcHndl, SC_SECO_VERIFY_IMAGE, (1 << i));
if (err) {
printf("Error: authenticate img %d failed, return %d\n", i, err);
ret = -EIO;
@@ -131,7 +131,7 @@ int authenticate_os_container(ulong addr)
}
exit:
- if (sc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0) != SC_ERR_NONE)
+ if (sc_seco_authenticate(ipcHndl, SC_SECO_REL_CONTAINER, 0) != SC_ERR_NONE)
printf("Error: release container failed!\n");
return ret;
diff --git a/arch/arm/mach-imx/imx8/parser.c b/arch/arm/mach-imx/imx8/parser.c
index e8644bc260..2c91a70d85 100644
--- a/arch/arm/mach-imx/imx8/parser.c
+++ b/arch/arm/mach-imx/imx8/parser.c
@@ -129,7 +129,7 @@ static int authenticate_image(struct boot_img_t *img, int image_index)
return -EPERM;
}
- err = sc_seco_authenticate(ipcHndl, SC_MISC_VERIFY_IMAGE,
+ err = sc_seco_authenticate(ipcHndl, SC_SECO_VERIFY_IMAGE,
1 << image_index);
if (err) {
printf("authenticate img %d failed, return %d\n",
@@ -233,7 +233,7 @@ static int read_auth_container(struct spl_image_info *spl_image)
memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)container,
ALIGN(length, CONFIG_SYS_CACHELINE_SIZE));
- ret = sc_seco_authenticate(ipcHndl, SC_MISC_AUTH_CONTAINER,
+ ret = sc_seco_authenticate(ipcHndl, SC_SECO_AUTH_CONTAINER,
SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);
if (ret) {
printf("authenticate container hdr failed, return %d\n", ret);
@@ -264,7 +264,7 @@ static int read_auth_container(struct spl_image_info *spl_image)
end_auth:
#ifdef CONFIG_AHAB_BOOT
- if (sc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0) != SC_ERR_NONE)
+ if (sc_seco_authenticate(ipcHndl, SC_SECO_REL_CONTAINER, 0) != SC_ERR_NONE)
printf("Error: release container failed!\n");
#endif
out:
diff --git a/arch/arm/mach-imx/sci/svc/irq/rpc.h b/arch/arm/mach-imx/sci/svc/irq/rpc.h
index 687dc2866d..bc01cad93c 100644
--- a/arch/arm/mach-imx/sci/svc/irq/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,8 +24,8 @@
*/
/*@{*/
#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_ENABLE 1U /*!< Index for sc_irq_enable() RPC call */
+#define IRQ_FUNC_STATUS 2U /*!< Index for sc_irq_status() RPC call */
/*@}*/
/* Types */
@@ -36,6 +36,7 @@
* This function dispatches an incoming IRQ RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void irq_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/irq/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/irq/rpc_clnt.c
index c0cfe16164..d9be8bd58e 100644
--- a/arch/arm/mach-imx/sci/svc/irq/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -27,49 +27,53 @@
/* 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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_IRQ);
RPC_FUNC(&msg) = U8(IRQ_FUNC_ENABLE);
+
RPC_U32(&msg, 0U) = U32(mask);
RPC_U16(&msg, 4U) = U16(resource);
RPC_U8(&msg, 6U) = U8(group);
RPC_U8(&msg, 7U) = B2U8(enable);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_irq_status(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_irq_group_t group, uint32_t *status)
+sc_err_t sc_irq_status(sc_ipc_t ipc, sc_rsrc_t resource, sc_irq_group_t group,
+ uint32_t *status)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_IRQ);
RPC_FUNC(&msg) = U8(IRQ_FUNC_STATUS);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(group);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (status != NULL)
{
- *status = RPC_U32(&msg, 0U);
+ *status = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
/**@}*/
diff --git a/arch/arm/mach-imx/sci/svc/misc/rpc.h b/arch/arm/mach-imx/sci/svc/misc/rpc.h
index 7df34515bc..8eeb5572b2 100644
--- a/arch/arm/mach-imx/sci/svc/misc/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,42 +24,28 @@
*/
/*@{*/
#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_API_VER 35U /*!< Index for misc_api_ver() 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_BOOT_CONTAINER 36U /*!< Index for misc_get_boot_container() 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 */
+#define MISC_FUNC_SET_CONTROL 1U /*!< Index for sc_misc_set_control() RPC call */
+#define MISC_FUNC_GET_CONTROL 2U /*!< Index for sc_misc_get_control() RPC call */
+#define MISC_FUNC_SET_MAX_DMA_GROUP 4U /*!< Index for sc_misc_set_max_dma_group() RPC call */
+#define MISC_FUNC_SET_DMA_GROUP 5U /*!< Index for sc_misc_set_dma_group() RPC call */
+#define MISC_FUNC_DEBUG_OUT 10U /*!< Index for sc_misc_debug_out() RPC call */
+#define MISC_FUNC_WAVEFORM_CAPTURE 6U /*!< Index for sc_misc_waveform_capture() RPC call */
+#define MISC_FUNC_BUILD_INFO 15U /*!< Index for sc_misc_build_info() RPC call */
+#define MISC_FUNC_API_VER 35U /*!< Index for sc_misc_api_ver() RPC call */
+#define MISC_FUNC_UNIQUE_ID 19U /*!< Index for sc_misc_unique_id() RPC call */
+#define MISC_FUNC_SET_ARI 3U /*!< Index for sc_misc_set_ari() RPC call */
+#define MISC_FUNC_BOOT_STATUS 7U /*!< Index for sc_misc_boot_status() RPC call */
+#define MISC_FUNC_BOOT_DONE 14U /*!< Index for sc_misc_boot_done() RPC call */
+#define MISC_FUNC_OTP_FUSE_READ 11U /*!< Index for sc_misc_otp_fuse_read() RPC call */
+#define MISC_FUNC_OTP_FUSE_WRITE 17U /*!< Index for sc_misc_otp_fuse_write() RPC call */
+#define MISC_FUNC_SET_TEMP 12U /*!< Index for sc_misc_set_temp() RPC call */
+#define MISC_FUNC_GET_TEMP 13U /*!< Index for sc_misc_get_temp() RPC call */
+#define MISC_FUNC_GET_BOOT_DEV 16U /*!< Index for sc_misc_get_boot_dev() RPC call */
+#define MISC_FUNC_GET_BOOT_TYPE 33U /*!< Index for sc_misc_get_boot_type() RPC call */
+#define MISC_FUNC_GET_BOOT_CONTAINER 36U /*!< Index for sc_misc_get_boot_container() RPC call */
+#define MISC_FUNC_GET_BUTTON_STATUS 18U /*!< Index for sc_misc_get_button_status() RPC call */
+#define MISC_FUNC_ROMPATCH_CHECKSUM 26U /*!< Index for sc_misc_rompatch_checksum() RPC call */
+#define MISC_FUNC_BOARD_IOCTL 34U /*!< Index for sc_misc_board_ioctl() RPC call */
/*@}*/
/* Types */
@@ -70,6 +56,7 @@
* This function dispatches an incoming MISC RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void misc_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/misc/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/misc/rpc_clnt.c
index 2deae9eeda..4cbd8e5827 100644
--- a/arch/arm/mach-imx/sci/svc/misc/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -27,369 +27,94 @@
/* 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_err_t sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl,
+ uint32_t val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_SET_CONTROL);
+
RPC_U32(&msg, 0U) = U32(ctrl);
RPC_U32(&msg, 4U) = U32(val);
RPC_U16(&msg, 8U) = U16(resource);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource,
- sc_ctrl_t ctrl, uint32_t *val)
+sc_err_t sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl,
+ uint32_t *val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_CONTROL);
+
RPC_U32(&msg, 0U) = U32(ctrl);
RPC_U16(&msg, 4U) = U16(resource);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (val != NULL)
{
- *val = RPC_U32(&msg, 0U);
+ *val = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_SET_MAX_DMA_GROUP);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(max);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_misc_set_dma_group(sc_ipc_t ipc, sc_rsrc_t resource,
sc_misc_dma_group_t group)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_SET_DMA_GROUP);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(group);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
-}
+ err = (sc_err_t) RPC_R8(&msg);
-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_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_SECO_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_misc_seco_authenticate(sc_ipc_t ipc,
- sc_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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;
-}
-
-sc_err_t sc_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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;
-}
-
-void sc_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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_misc_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_MISC);
- RPC_FUNC(&msg) = U8(MISC_FUNC_SECO_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;
+ return err;
}
void sc_misc_debug_out(sc_ipc_t ipc, uint8_t ch)
@@ -397,137 +122,127 @@ void sc_misc_debug_out(sc_ipc_t ipc, uint8_t ch)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_DEBUG_OUT);
+
RPC_U8(&msg, 0U) = U8(ch);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
-
- return;
}
sc_err_t sc_misc_waveform_capture(sc_ipc_t ipc, sc_bool_t enable)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_WAVEFORM_CAPTURE);
+
RPC_U8(&msg, 0U) = B2U8(enable);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_BUILD_INFO);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (build != NULL)
{
- *build = RPC_U32(&msg, 0U);
+ *build = (uint32_t) RPC_U32(&msg, 0U);
}
-
if (commit != NULL)
{
- *commit = RPC_U32(&msg, 4U);
+ *commit = (uint32_t) RPC_U32(&msg, 4U);
}
-
- return;
}
-void sc_misc_api_ver(sc_ipc_t ipc, uint16_t *cl_maj,
- uint16_t *cl_min, uint16_t *sv_maj, uint16_t *sv_min)
+void sc_misc_api_ver(sc_ipc_t ipc, uint16_t *cl_maj, uint16_t *cl_min,
+ uint16_t *sv_maj, uint16_t *sv_min)
{
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_API_VER);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (cl_maj != NULL)
{
- *cl_maj = SCFW_API_VERSION_MAJOR;
+ *cl_maj = (uint16_t) SCFW_API_VERSION_MAJOR;
}
-
if (cl_min != NULL)
{
- *cl_min = SCFW_API_VERSION_MINOR;
+ *cl_min = (uint16_t) SCFW_API_VERSION_MINOR;
}
-
if (sv_maj != NULL)
{
- *sv_maj = RPC_U16(&msg, 4U);
+ *sv_maj = (uint16_t) RPC_U16(&msg, 4U);
}
-
if (sv_min != NULL)
{
- *sv_min = RPC_U16(&msg, 6U);
+ *sv_min = (uint16_t) RPC_U16(&msg, 6U);
}
-
- return;
}
-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;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_UNIQUE_ID);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (id_l != NULL)
{
- *id_l = RPC_U32(&msg, 0U);
+ *id_l = (uint32_t) RPC_U32(&msg, 0U);
}
-
if (id_h != NULL)
{
- *id_h = RPC_U32(&msg, 4U);
+ *id_h = (uint32_t) 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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_SET_ARI);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U16(&msg, 2U) = U16(resource_mst);
RPC_U16(&msg, 4U) = U16(ari);
RPC_U8(&msg, 6U) = B2U8(enable);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status)
@@ -535,121 +250,129 @@ void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_BOOT_STATUS);
+
RPC_U8(&msg, 0U) = U8(status);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_TRUE);
-
- return;
}
sc_err_t sc_misc_boot_done(sc_ipc_t ipc, sc_rsrc_t cpu)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_BOOT_DONE);
+
RPC_U16(&msg, 0U) = U16(cpu);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_misc_otp_fuse_read(sc_ipc_t ipc, uint32_t word, uint32_t *val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_OTP_FUSE_READ);
+
RPC_U32(&msg, 0U) = U32(word);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (val != NULL)
{
- *val = RPC_U32(&msg, 0U);
+ *val = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_misc_otp_fuse_write(sc_ipc_t ipc, uint32_t word, uint32_t val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_OTP_FUSE_WRITE);
+
RPC_U32(&msg, 0U) = U32(word);
RPC_U32(&msg, 4U) = U32(val);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_SET_TEMP);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_I16(&msg, 2U) = I16(celsius);
RPC_U8(&msg, 4U) = U8(temp);
RPC_I8(&msg, 5U) = I8(tenths);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_TEMP);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(temp);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (celsius != NULL)
{
- *celsius = RPC_I16(&msg, 0U);
+ *celsius = (int16_t) RPC_I16(&msg, 0U);
}
-
- result = RPC_R8(&msg);
if (tenths != NULL)
{
- *tenths = RPC_I8(&msg, 2U);
+ *tenths = (int8_t) RPC_I8(&msg, 2U);
}
- return (sc_err_t) result;
+ return err;
}
void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *dev)
@@ -657,60 +380,60 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *dev)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_BOOT_DEV);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (dev != NULL)
{
- *dev = RPC_U16(&msg, 0U);
+ *dev = (sc_rsrc_t) RPC_U16(&msg, 0U);
}
-
- return;
}
sc_err_t sc_misc_get_boot_type(sc_ipc_t ipc, sc_misc_bt_t *type)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_BOOT_TYPE);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (type != NULL)
{
- *type = RPC_U8(&msg, 0U);
+ *type = (sc_misc_bt_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_misc_get_boot_container(sc_ipc_t ipc, uint8_t *idx)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_BOOT_CONTAINER);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (idx != NULL)
{
- *idx = RPC_U8(&msg, 0U);
+ *idx = (uint8_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
void sc_misc_get_button_status(sc_ipc_t ipc, sc_bool_t *status)
@@ -718,62 +441,64 @@ void sc_misc_get_button_status(sc_ipc_t ipc, sc_bool_t *status)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_GET_BUTTON_STATUS);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (status != NULL)
{
- *status = U2B(RPC_U8(&msg, 0U));
+ *status = (sc_bool_t) U2B(RPC_U8(&msg, 0U));
}
-
- return;
}
sc_err_t sc_misc_rompatch_checksum(sc_ipc_t ipc, uint32_t *checksum)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_MISC);
RPC_FUNC(&msg) = U8(MISC_FUNC_ROMPATCH_CHECKSUM);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (checksum != NULL)
{
- *checksum = RPC_U32(&msg, 0U);
+ *checksum = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
-sc_err_t sc_misc_board_ioctl(sc_ipc_t ipc, uint32_t *parm1,
- uint32_t *parm2, uint32_t *parm3)
+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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
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;
+
+ RPC_U32(&msg, 0U) = U32(*parm1);
+ RPC_U32(&msg, 4U) = U32(*parm2);
+ RPC_U32(&msg, 8U) = U32(*parm3);
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ *parm1 = (uint32_t) RPC_U32(&msg, 0U);
+ *parm2 = (uint32_t) RPC_U32(&msg, 4U);
+ *parm3 = (uint32_t) RPC_U32(&msg, 8U);
+
+ return err;
}
/**@}*/
diff --git a/arch/arm/mach-imx/sci/svc/pad/rpc.h b/arch/arm/mach-imx/sci/svc/pad/rpc.h
index 4589e1f801..a3b165a92a 100644
--- a/arch/arm/mach-imx/sci/svc/pad/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,22 +24,22 @@
*/
/*@{*/
#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_SET_MUX 1U /*!< Index for sc_pad_set_mux() RPC call */
+#define PAD_FUNC_GET_MUX 6U /*!< Index for sc_pad_get_mux() RPC call */
+#define PAD_FUNC_SET_GP 2U /*!< Index for sc_pad_set_gp() RPC call */
+#define PAD_FUNC_GET_GP 7U /*!< Index for sc_pad_get_gp() RPC call */
+#define PAD_FUNC_SET_WAKEUP 4U /*!< Index for sc_pad_set_wakeup() RPC call */
+#define PAD_FUNC_GET_WAKEUP 9U /*!< Index for sc_pad_get_wakeup() RPC call */
+#define PAD_FUNC_SET_ALL 5U /*!< Index for sc_pad_set_all() RPC call */
+#define PAD_FUNC_GET_ALL 10U /*!< Index for sc_pad_get_all() RPC call */
+#define PAD_FUNC_SET 15U /*!< Index for sc_pad_set() RPC call */
+#define PAD_FUNC_GET 16U /*!< Index for sc_pad_get() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI 11U /*!< Index for sc_pad_set_gp_28fdsoi() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI 12U /*!< Index for sc_pad_get_gp_28fdsoi() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI_HSIC 3U /*!< Index for sc_pad_set_gp_28fdsoi_hsic() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI_HSIC 8U /*!< Index for sc_pad_get_gp_28fdsoi_hsic() RPC call */
+#define PAD_FUNC_SET_GP_28FDSOI_COMP 13U /*!< Index for sc_pad_set_gp_28fdsoi_comp() RPC call */
+#define PAD_FUNC_GET_GP_28FDSOI_COMP 14U /*!< Index for sc_pad_get_gp_28fdsoi_comp() RPC call */
/*@}*/
/* Types */
@@ -50,6 +50,7 @@
* This function dispatches an incoming PAD RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void pad_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/pad/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/pad/rpc_clnt.c
index 8e67c95e2c..5ef2c69bca 100644
--- a/arch/arm/mach-imx/sci/svc/pad/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -27,140 +27,148 @@
/* 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)
+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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_MUX);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(mux);
RPC_U8(&msg, 3U) = U8(config);
RPC_U8(&msg, 4U) = U8(iso);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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)
+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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_MUX);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mux != NULL)
{
- *mux = RPC_U8(&msg, 0U);
+ *mux = (uint8_t) RPC_U8(&msg, 0U);
}
-
if (config != NULL)
{
- *config = RPC_U8(&msg, 1U);
+ *config = (sc_pad_config_t) RPC_U8(&msg, 1U);
}
-
if (iso != NULL)
{
- *iso = RPC_U8(&msg, 2U);
+ *iso = (sc_pad_iso_t) RPC_U8(&msg, 2U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pad_set_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t ctrl)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_GP);
+
RPC_U32(&msg, 0U) = U32(ctrl);
RPC_U16(&msg, 4U) = U16(pad);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pad_get_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t *ctrl)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_GP);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (ctrl != NULL)
{
- *ctrl = RPC_U32(&msg, 0U);
+ *ctrl = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_WAKEUP);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(wakeup);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_WAKEUP);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (wakeup != NULL)
{
- *wakeup = RPC_U8(&msg, 0U);
+ *wakeup = (sc_pad_wakeup_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
@@ -168,23 +176,25 @@ sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
sc_pad_wakeup_t wakeup)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_ALL);
+
RPC_U32(&msg, 0U) = U32(ctrl);
RPC_U16(&msg, 4U) = U16(pad);
RPC_U8(&msg, 6U) = U8(mux);
RPC_U8(&msg, 7U) = U8(config);
RPC_U8(&msg, 8U) = U8(iso);
RPC_U8(&msg, 9U) = U8(wakeup);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
@@ -192,131 +202,136 @@ sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
sc_pad_wakeup_t *wakeup)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_ALL);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (ctrl != NULL)
{
- *ctrl = RPC_U32(&msg, 0U);
+ *ctrl = (uint32_t) RPC_U32(&msg, 0U);
}
-
- result = RPC_R8(&msg);
if (mux != NULL)
{
- *mux = RPC_U8(&msg, 4U);
+ *mux = (uint8_t) RPC_U8(&msg, 4U);
}
-
if (config != NULL)
{
- *config = RPC_U8(&msg, 5U);
+ *config = (sc_pad_config_t) RPC_U8(&msg, 5U);
}
-
if (iso != NULL)
{
- *iso = RPC_U8(&msg, 6U);
+ *iso = (sc_pad_iso_t) RPC_U8(&msg, 6U);
}
-
if (wakeup != NULL)
{
- *wakeup = RPC_U8(&msg, 7U);
+ *wakeup = (sc_pad_wakeup_t) RPC_U8(&msg, 7U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, uint32_t val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET);
+
RPC_U32(&msg, 0U) = U32(val);
RPC_U16(&msg, 4U) = U16(pad);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (val != NULL)
{
- *val = RPC_U32(&msg, 0U);
+ *val = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_GP_28FDSOI);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(dse);
RPC_U8(&msg, 3U) = U8(ps);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_GP_28FDSOI);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (dse != NULL)
{
- *dse = RPC_U8(&msg, 0U);
+ *dse = (sc_pad_28fdsoi_dse_t) RPC_U8(&msg, 0U);
}
-
if (ps != NULL)
{
- *ps = RPC_U8(&msg, 1U);
+ *ps = (sc_pad_28fdsoi_ps_t) RPC_U8(&msg, 1U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
@@ -324,23 +339,25 @@ sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_bool_t pke, sc_bool_t pue)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_GP_28FDSOI_HSIC);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(dse);
RPC_U8(&msg, 3U) = U8(pus);
RPC_U8(&msg, 4U) = B2U8(hys);
RPC_U8(&msg, 5U) = B2U8(pke);
RPC_U8(&msg, 6U) = B2U8(pue);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
@@ -348,55 +365,55 @@ sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_bool_t *pke, sc_bool_t *pue)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_GP_28FDSOI_HSIC);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (dse != NULL)
{
- *dse = RPC_U8(&msg, 0U);
+ *dse = (sc_pad_28fdsoi_dse_t) RPC_U8(&msg, 0U);
}
-
if (pus != NULL)
{
- *pus = RPC_U8(&msg, 1U);
+ *pus = (sc_pad_28fdsoi_pus_t) RPC_U8(&msg, 1U);
}
-
if (hys != NULL)
{
- *hys = U2B(RPC_U8(&msg, 2U));
+ *hys = (sc_bool_t) U2B(RPC_U8(&msg, 2U));
}
-
if (pke != NULL)
{
- *pke = U2B(RPC_U8(&msg, 3U));
+ *pke = (sc_bool_t) U2B(RPC_U8(&msg, 3U));
}
-
if (pue != NULL)
{
- *pue = U2B(RPC_U8(&msg, 4U));
+ *pue = (sc_bool_t) U2B(RPC_U8(&msg, 4U));
}
- return (sc_err_t) result;
+ return err;
}
-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)
+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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_SET_GP_28FDSOI_COMP);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(compen);
RPC_U8(&msg, 3U) = U8(rasrcp);
@@ -404,71 +421,66 @@ sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
RPC_U8(&msg, 5U) = B2U8(fastfrz);
RPC_U8(&msg, 6U) = B2U8(nasrc_sel);
RPC_U8(&msg, 7U) = B2U8(psw_ovr);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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)
+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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PAD);
RPC_FUNC(&msg) = U8(PAD_FUNC_GET_GP_28FDSOI_COMP);
+
RPC_U16(&msg, 0U) = U16(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (compen != NULL)
{
- *compen = RPC_U8(&msg, 0U);
+ *compen = (uint8_t) RPC_U8(&msg, 0U);
}
-
if (rasrcp != NULL)
{
- *rasrcp = RPC_U8(&msg, 1U);
+ *rasrcp = (uint8_t) RPC_U8(&msg, 1U);
}
-
if (rasrcn != NULL)
{
- *rasrcn = RPC_U8(&msg, 2U);
+ *rasrcn = (uint8_t) RPC_U8(&msg, 2U);
}
-
if (nasrc != NULL)
{
- *nasrc = RPC_U8(&msg, 3U);
+ *nasrc = (uint8_t) RPC_U8(&msg, 3U);
}
-
if (fastfrz != NULL)
{
- *fastfrz = U2B(RPC_U8(&msg, 4U));
+ *fastfrz = (sc_bool_t) U2B(RPC_U8(&msg, 4U));
}
-
if (nasrc_sel != NULL)
{
- *nasrc_sel = U2B(RPC_U8(&msg, 5U));
+ *nasrc_sel = (sc_bool_t) U2B(RPC_U8(&msg, 5U));
}
-
if (compok != NULL)
{
- *compok = U2B(RPC_U8(&msg, 6U));
+ *compok = (sc_bool_t) U2B(RPC_U8(&msg, 6U));
}
-
if (psw_ovr != NULL)
{
- *psw_ovr = U2B(RPC_U8(&msg, 7U));
+ *psw_ovr = (sc_bool_t) U2B(RPC_U8(&msg, 7U));
}
- return (sc_err_t) result;
+ return err;
}
/**@}*/
diff --git a/arch/arm/mach-imx/sci/svc/pm/rpc.h b/arch/arm/mach-imx/sci/svc/pm/rpc.h
index d219b6a960..94cfdfb3a3 100644
--- a/arch/arm/mach-imx/sci/svc/pm/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,33 +24,35 @@
*/
/*@{*/
#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_SET_BOOT_PARM 27U /*!< Index for pm_set_boot_parm() 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 */
+#define PM_FUNC_SET_SYS_POWER_MODE 19U /*!< Index for sc_pm_set_sys_power_mode() RPC call */
+#define PM_FUNC_SET_PARTITION_POWER_MODE 1U /*!< Index for sc_pm_set_partition_power_mode() RPC call */
+#define PM_FUNC_GET_SYS_POWER_MODE 2U /*!< Index for sc_pm_get_sys_power_mode() RPC call */
+#define PM_FUNC_PARTITION_WAKE 28U /*!< Index for sc_pm_partition_wake() RPC call */
+#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U /*!< Index for sc_pm_set_resource_power_mode() RPC call */
+#define PM_FUNC_SET_RESOURCE_POWER_MODE_ALL 22U /*!< Index for sc_pm_set_resource_power_mode_all() RPC call */
+#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U /*!< Index for sc_pm_get_resource_power_mode() RPC call */
+#define PM_FUNC_REQ_LOW_POWER_MODE 16U /*!< Index for sc_pm_req_low_power_mode() RPC call */
+#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U /*!< Index for sc_pm_req_cpu_low_power_mode() RPC call */
+#define PM_FUNC_SET_CPU_RESUME_ADDR 17U /*!< Index for sc_pm_set_cpu_resume_addr() RPC call */
+#define PM_FUNC_SET_CPU_RESUME 21U /*!< Index for sc_pm_set_cpu_resume() RPC call */
+#define PM_FUNC_REQ_SYS_IF_POWER_MODE 18U /*!< Index for sc_pm_req_sys_if_power_mode() RPC call */
+#define PM_FUNC_SET_CLOCK_RATE 5U /*!< Index for sc_pm_set_clock_rate() RPC call */
+#define PM_FUNC_GET_CLOCK_RATE 6U /*!< Index for sc_pm_get_clock_rate() RPC call */
+#define PM_FUNC_CLOCK_ENABLE 7U /*!< Index for sc_pm_clock_enable() RPC call */
+#define PM_FUNC_SET_CLOCK_PARENT 14U /*!< Index for sc_pm_set_clock_parent() RPC call */
+#define PM_FUNC_GET_CLOCK_PARENT 15U /*!< Index for sc_pm_get_clock_parent() RPC call */
+#define PM_FUNC_RESET 13U /*!< Index for sc_pm_reset() RPC call */
+#define PM_FUNC_RESET_REASON 10U /*!< Index for sc_pm_reset_reason() RPC call */
+#define PM_FUNC_GET_RESET_PART 26U /*!< Index for sc_pm_get_reset_part() RPC call */
+#define PM_FUNC_BOOT 8U /*!< Index for sc_pm_boot() RPC call */
+#define PM_FUNC_SET_BOOT_PARM 27U /*!< Index for sc_pm_set_boot_parm() RPC call */
+#define PM_FUNC_REBOOT 9U /*!< Index for sc_pm_reboot() RPC call */
+#define PM_FUNC_REBOOT_PARTITION 12U /*!< Index for sc_pm_reboot_partition() RPC call */
+#define PM_FUNC_REBOOT_CONTINUE 25U /*!< Index for sc_pm_reboot_continue() RPC call */
+#define PM_FUNC_CPU_START 11U /*!< Index for sc_pm_cpu_start() RPC call */
+#define PM_FUNC_CPU_RESET 23U /*!< Index for sc_pm_cpu_reset() RPC call */
+#define PM_FUNC_RESOURCE_RESET 29U /*!< Index for sc_pm_resource_reset() RPC call */
+#define PM_FUNC_IS_PARTITION_STARTED 24U /*!< Index for sc_pm_is_partition_started() RPC call */
/*@}*/
/* Types */
@@ -61,6 +63,7 @@
* This function dispatches an incoming PM RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void pm_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/pm/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/pm/rpc_clnt.c
index 91bdeda57e..e45fd7211c 100644
--- a/arch/arm/mach-imx/sci/svc/pm/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -30,439 +30,497 @@
sc_err_t sc_pm_set_sys_power_mode(sc_ipc_t ipc, sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_SYS_POWER_MODE);
+
RPC_U8(&msg, 0U) = U8(mode);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_PARTITION_POWER_MODE);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(mode);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_GET_SYS_POWER_MODE);
+
RPC_U8(&msg, 0U) = U8(pt);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mode != NULL)
{
- *mode = RPC_U8(&msg, 0U);
+ *mode = (sc_pm_power_mode_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
+}
+
+sc_err_t sc_pm_partition_wake(sc_ipc_t ipc, sc_rm_pt_t pt)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
+ RPC_FUNC(&msg) = U8(PM_FUNC_PARTITION_WAKE);
+
+ RPC_U8(&msg, 0U) = U8(pt);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_RESOURCE_POWER_MODE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(mode);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_RESOURCE_POWER_MODE_ALL);
+
RPC_U16(&msg, 0U) = U16(exclude);
RPC_U8(&msg, 2U) = U8(pt);
RPC_U8(&msg, 3U) = U8(mode);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t *mode)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_GET_RESOURCE_POWER_MODE);
+
RPC_U16(&msg, 0U) = U16(resource);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mode != NULL)
{
- *mode = RPC_U8(&msg, 0U);
+ *mode = (sc_pm_power_mode_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_REQ_LOW_POWER_MODE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(mode);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_REQ_CPU_LOW_POWER_MODE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(mode);
RPC_U8(&msg, 3U) = U8(wake_src);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
sc_faddr_t address)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_CPU_RESUME_ADDR);
+
RPC_U32(&msg, 0U) = U32(address >> 32ULL);
RPC_U32(&msg, 4U) = U32(address);
RPC_U16(&msg, 8U) = U16(resource);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_CPU_RESUME);
+
RPC_U32(&msg, 0U) = U32(address >> 32ULL);
RPC_U32(&msg, 4U) = U32(address);
RPC_U16(&msg, 8U) = U16(resource);
RPC_U8(&msg, 10U) = B2U8(isPrimary);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_REQ_SYS_IF_POWER_MODE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(sys_if);
RPC_U8(&msg, 3U) = U8(hpm);
RPC_U8(&msg, 4U) = U8(lpm);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_CLOCK_RATE);
- RPC_U32(&msg, 0U) = *PTR_U32(rate);
+
+ RPC_U32(&msg, 0U) = U32(*rate);
RPC_U16(&msg, 4U) = U16(resource);
RPC_U8(&msg, 6U) = U8(clk);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- *rate = RPC_U32(&msg, 0U);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ *rate = (sc_pm_clock_rate_t) RPC_U32(&msg, 0U);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_GET_CLOCK_RATE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(clk);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (rate != NULL)
{
- *rate = RPC_U32(&msg, 0U);
+ *rate = (sc_pm_clock_rate_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_CLOCK_ENABLE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(clk);
RPC_U8(&msg, 3U) = B2U8(enable);
RPC_U8(&msg, 4U) = B2U8(autog);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_CLOCK_PARENT);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(clk);
RPC_U8(&msg, 3U) = U8(parent);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_GET_CLOCK_PARENT);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(clk);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (parent != NULL)
{
- *parent = RPC_U8(&msg, 0U);
+ *parent = (sc_pm_clk_parent_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_RESET);
+
RPC_U8(&msg, 0U) = U8(type);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_RESET_REASON);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (reason != NULL)
{
- *reason = RPC_U8(&msg, 0U);
+ *reason = (sc_pm_reset_reason_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
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);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (pt != NULL)
{
- *pt = RPC_U8(&msg, 0U);
+ *pt = (sc_rm_pt_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 5U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_BOOT);
+
RPC_U32(&msg, 0U) = U32(boot_addr >> 32ULL);
RPC_U32(&msg, 4U) = U32(boot_addr);
RPC_U16(&msg, 8U) = U16(resource_cpu);
RPC_U16(&msg, 10U) = U16(resource_mu);
RPC_U16(&msg, 12U) = U16(resource_dev);
RPC_U8(&msg, 14U) = U8(pt);
- RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_pm_set_boot_parm(sc_ipc_t ipc,
- sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
- sc_rsrc_t resource_mu, sc_rsrc_t resource_dev)
+sc_err_t sc_pm_set_boot_parm(sc_ipc_t ipc, 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 5U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_SET_BOOT_PARM);
+
RPC_U32(&msg, 0U) = U32(boot_addr >> 32ULL);
RPC_U32(&msg, 4U) = U32(boot_addr);
RPC_U16(&msg, 8U) = U16(resource_cpu);
RPC_U16(&msg, 10U) = U16(resource_mu);
RPC_U16(&msg, 12U) = U16(resource_dev);
- RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
@@ -470,71 +528,76 @@ void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_REBOOT);
+
RPC_U8(&msg, 0U) = U8(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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_REBOOT_PARTITION);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(type);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_reboot_continue(sc_ipc_t ipc, sc_rm_pt_t pt)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
sc_faddr_t address)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_CPU_START);
+
RPC_U32(&msg, 0U) = U32(address >> 32ULL);
RPC_U32(&msg, 4U) = U32(address);
RPC_U16(&msg, 8U) = U16(resource);
RPC_U8(&msg, 10U) = B2U8(enable);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
void sc_pm_cpu_reset(sc_ipc_t ipc, sc_rsrc_t resource, sc_faddr_t address)
@@ -542,16 +605,34 @@ void sc_pm_cpu_reset(sc_ipc_t ipc, sc_rsrc_t resource, sc_faddr_t address)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
RPC_FUNC(&msg) = U8(PM_FUNC_CPU_RESET);
+
RPC_U32(&msg, 0U) = U32(address >> 32ULL);
RPC_U32(&msg, 4U) = U32(address);
RPC_U16(&msg, 8U) = U16(resource);
- RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_TRUE);
+}
- return;
+sc_err_t sc_pm_resource_reset(sc_ipc_t ipc, sc_rsrc_t resource)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_PM);
+ RPC_FUNC(&msg) = U8(PM_FUNC_RESOURCE_RESET);
+
+ RPC_U16(&msg, 0U) = U16(resource);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_bool_t sc_pm_is_partition_started(sc_ipc_t ipc, sc_rm_pt_t pt)
@@ -560,14 +641,16 @@ sc_bool_t sc_pm_is_partition_started(sc_ipc_t ipc, sc_rm_pt_t pt)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
diff --git a/arch/arm/mach-imx/sci/svc/rm/rpc.h b/arch/arm/mach-imx/sci/svc/rm/rpc.h
index d8b86fd1aa..2982b2623c 100644
--- a/arch/arm/mach-imx/sci/svc/rm/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,39 +24,39 @@
*/
/*@{*/
#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 */
+#define RM_FUNC_PARTITION_ALLOC 1U /*!< Index for sc_rm_partition_alloc() RPC call */
+#define RM_FUNC_SET_CONFIDENTIAL 31U /*!< Index for sc_rm_set_confidential() RPC call */
+#define RM_FUNC_PARTITION_FREE 2U /*!< Index for sc_rm_partition_free() RPC call */
+#define RM_FUNC_GET_DID 26U /*!< Index for sc_rm_get_did() RPC call */
+#define RM_FUNC_PARTITION_STATIC 3U /*!< Index for sc_rm_partition_static() RPC call */
+#define RM_FUNC_PARTITION_LOCK 4U /*!< Index for sc_rm_partition_lock() RPC call */
+#define RM_FUNC_GET_PARTITION 5U /*!< Index for sc_rm_get_partition() RPC call */
+#define RM_FUNC_SET_PARENT 6U /*!< Index for sc_rm_set_parent() RPC call */
+#define RM_FUNC_MOVE_ALL 7U /*!< Index for sc_rm_move_all() RPC call */
+#define RM_FUNC_ASSIGN_RESOURCE 8U /*!< Index for sc_rm_assign_resource() RPC call */
+#define RM_FUNC_SET_RESOURCE_MOVABLE 9U /*!< Index for sc_rm_set_resource_movable() RPC call */
+#define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U /*!< Index for sc_rm_set_subsys_rsrc_movable() RPC call */
+#define RM_FUNC_SET_MASTER_ATTRIBUTES 10U /*!< Index for sc_rm_set_master_attributes() RPC call */
+#define RM_FUNC_SET_MASTER_SID 11U /*!< Index for sc_rm_set_master_sid() RPC call */
+#define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U /*!< Index for sc_rm_set_peripheral_permissions() RPC call */
+#define RM_FUNC_IS_RESOURCE_OWNED 13U /*!< Index for sc_rm_is_resource_owned() RPC call */
+#define RM_FUNC_GET_RESOURCE_OWNER 33U /*!< Index for sc_rm_get_resource_owner() RPC call */
+#define RM_FUNC_IS_RESOURCE_MASTER 14U /*!< Index for sc_rm_is_resource_master() RPC call */
+#define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U /*!< Index for sc_rm_is_resource_peripheral() RPC call */
+#define RM_FUNC_GET_RESOURCE_INFO 16U /*!< Index for sc_rm_get_resource_info() RPC call */
+#define RM_FUNC_MEMREG_ALLOC 17U /*!< Index for sc_rm_memreg_alloc() RPC call */
+#define RM_FUNC_MEMREG_SPLIT 29U /*!< Index for sc_rm_memreg_split() RPC call */
+#define RM_FUNC_MEMREG_FRAG 32U /*!< Index for sc_rm_memreg_frag() RPC call */
+#define RM_FUNC_MEMREG_FREE 18U /*!< Index for sc_rm_memreg_free() RPC call */
+#define RM_FUNC_FIND_MEMREG 30U /*!< Index for sc_rm_find_memreg() RPC call */
+#define RM_FUNC_ASSIGN_MEMREG 19U /*!< Index for sc_rm_assign_memreg() RPC call */
+#define RM_FUNC_SET_MEMREG_PERMISSIONS 20U /*!< Index for sc_rm_set_memreg_permissions() RPC call */
+#define RM_FUNC_IS_MEMREG_OWNED 21U /*!< Index for sc_rm_is_memreg_owned() RPC call */
+#define RM_FUNC_GET_MEMREG_INFO 22U /*!< Index for sc_rm_get_memreg_info() RPC call */
+#define RM_FUNC_ASSIGN_PAD 23U /*!< Index for sc_rm_assign_pad() RPC call */
+#define RM_FUNC_SET_PAD_MOVABLE 24U /*!< Index for sc_rm_set_pad_movable() RPC call */
+#define RM_FUNC_IS_PAD_OWNED 25U /*!< Index for sc_rm_is_pad_owned() RPC call */
+#define RM_FUNC_DUMP 27U /*!< Index for sc_rm_dump() RPC call */
/*@}*/
/* Types */
@@ -67,6 +67,7 @@
* This function dispatches an incoming RM RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void rm_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/rm/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/rm/rpc_clnt.c
index 45773545fe..e45693297a 100644
--- a/arch/arm/mach-imx/sci/svc/rm/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/svc/rm/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,296 +27,321 @@
/* 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_PARTITION_ALLOC);
+
RPC_U8(&msg, 0U) = B2U8(secure);
RPC_U8(&msg, 1U) = B2U8(isolated);
RPC_U8(&msg, 2U) = B2U8(restricted);
RPC_U8(&msg, 3U) = B2U8(grant);
RPC_U8(&msg, 4U) = B2U8(coherent);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (pt != NULL)
{
- *pt = RPC_U8(&msg, 0U);
+ *pt = (sc_rm_pt_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_rm_set_confidential(sc_ipc_t ipc, sc_rm_pt_t pt, sc_bool_t retro)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_CONFIDENTIAL);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = B2U8(retro);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_rm_partition_free(sc_ipc_t ipc, sc_rm_pt_t pt)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_PARTITION_FREE);
+
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_rm_did_t sc_rm_get_did(sc_ipc_t ipc)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_rm_did_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_GET_DID);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_rm_did_t) result;
+ result = (sc_rm_did_t) RPC_R8(&msg);
+
+ return 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_PARTITION_STATIC);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(did);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_rm_partition_lock(sc_ipc_t ipc, sc_rm_pt_t pt)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_PARTITION_LOCK);
+
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_rm_get_partition(sc_ipc_t ipc, sc_rm_pt_t *pt)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_GET_PARTITION);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (pt != NULL)
{
- *pt = RPC_U8(&msg, 0U);
+ *pt = (sc_rm_pt_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_PARENT);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(pt_parent);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_MOVE_ALL);
+
RPC_U8(&msg, 0U) = U8(pt_src);
RPC_U8(&msg, 1U) = U8(pt_dst);
RPC_U8(&msg, 2U) = B2U8(move_rsrc);
RPC_U8(&msg, 3U) = B2U8(move_pads);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_ASSIGN_RESOURCE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(pt);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_RESOURCE_MOVABLE);
+
RPC_U16(&msg, 0U) = U16(resource_fst);
RPC_U16(&msg, 2U) = U16(resource_lst);
RPC_U8(&msg, 4U) = B2U8(movable);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_rm_set_subsys_rsrc_movable(sc_ipc_t ipc, sc_rsrc_t resource,
sc_bool_t movable)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_SUBSYS_RSRC_MOVABLE);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = B2U8(movable);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_MASTER_ATTRIBUTES);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(sa);
RPC_U8(&msg, 3U) = U8(pa);
RPC_U8(&msg, 4U) = B2U8(smmu_bypass);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_MASTER_SID);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U16(&msg, 2U) = U16(sid);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_PERIPHERAL_PERMISSIONS);
+
RPC_U16(&msg, 0U) = U16(resource);
RPC_U8(&msg, 2U) = U8(pt);
RPC_U8(&msg, 3U) = U8(perm);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_bool_t sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource)
@@ -325,14 +350,16 @@ sc_bool_t sc_rm_is_resource_owned(sc_ipc_t ipc, sc_rsrc_t resource)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_IS_RESOURCE_OWNED);
+
RPC_U16(&msg, 0U) = U16(resource);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = U2B(RPC_R8(&msg));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
@@ -340,23 +367,25 @@ 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (pt != NULL)
{
- *pt = RPC_U8(&msg, 0U);
+ *pt = (sc_rm_pt_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_bool_t sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource)
@@ -365,14 +394,16 @@ sc_bool_t sc_rm_is_resource_master(sc_ipc_t ipc, sc_rsrc_t resource)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_IS_RESOURCE_MASTER);
+
RPC_U16(&msg, 0U) = U16(resource);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = U2B(RPC_R8(&msg));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
@@ -382,14 +413,16 @@ sc_bool_t sc_rm_is_resource_peripheral(sc_ipc_t ipc, sc_rsrc_t resource)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_IS_RESOURCE_PERIPHERAL);
+
RPC_U16(&msg, 0U) = U16(resource);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = U2B(RPC_R8(&msg));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
@@ -397,183 +430,199 @@ sc_err_t sc_rm_get_resource_info(sc_ipc_t ipc, sc_rsrc_t resource,
sc_rm_sid_t *sid)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_GET_RESOURCE_INFO);
+
RPC_U16(&msg, 0U) = U16(resource);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (sid != NULL)
{
- *sid = RPC_U16(&msg, 0U);
+ *sid = (sc_rm_sid_t) RPC_U16(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 5U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_MEMREG_ALLOC);
+
RPC_U32(&msg, 0U) = U32(addr_start >> 32ULL);
RPC_U32(&msg, 4U) = U32(addr_start);
RPC_U32(&msg, 8U) = U32(addr_end >> 32ULL);
RPC_U32(&msg, 12U) = U32(addr_end);
- RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mr != NULL)
{
- *mr = RPC_U8(&msg, 0U);
+ *mr = (sc_rm_mr_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 6U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_MEMREG_SPLIT);
+
RPC_U32(&msg, 0U) = U32(addr_start >> 32ULL);
RPC_U32(&msg, 4U) = U32(addr_start);
RPC_U32(&msg, 8U) = U32(addr_end >> 32ULL);
RPC_U32(&msg, 12U) = U32(addr_end);
RPC_U8(&msg, 16U) = U8(mr);
- RPC_SIZE(&msg) = 6U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mr_ret != NULL)
{
- *mr_ret = RPC_U8(&msg, 0U);
+ *mr_ret = (sc_rm_mr_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 5U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_MEMREG_FRAG);
+
RPC_U32(&msg, 0U) = U32(addr_start >> 32ULL);
RPC_U32(&msg, 4U) = U32(addr_start);
RPC_U32(&msg, 8U) = U32(addr_end >> 32ULL);
RPC_U32(&msg, 12U) = U32(addr_end);
- RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mr_ret != NULL)
{
- *mr_ret = RPC_U8(&msg, 0U);
+ *mr_ret = (sc_rm_mr_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_rm_memreg_free(sc_ipc_t ipc, sc_rm_mr_t mr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_MEMREG_FREE);
+
RPC_U8(&msg, 0U) = U8(mr);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 5U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_FIND_MEMREG);
+
RPC_U32(&msg, 0U) = U32(addr_start >> 32ULL);
RPC_U32(&msg, 4U) = U32(addr_start);
RPC_U32(&msg, 8U) = U32(addr_end >> 32ULL);
RPC_U32(&msg, 12U) = U32(addr_end);
- RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (mr != NULL)
{
- *mr = RPC_U8(&msg, 0U);
+ *mr = (sc_rm_mr_t) RPC_U8(&msg, 0U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_rm_assign_memreg(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_mr_t mr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_ASSIGN_MEMREG);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(mr);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_MEMREG_PERMISSIONS);
+
RPC_U8(&msg, 0U) = U8(mr);
RPC_U8(&msg, 1U) = U8(pt);
RPC_U8(&msg, 2U) = U8(perm);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
@@ -582,14 +631,16 @@ sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_IS_MEMREG_OWNED);
+
RPC_U8(&msg, 0U) = U8(mr);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = U2B(RPC_R8(&msg));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
@@ -597,66 +648,71 @@ 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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_GET_MEMREG_INFO);
+
RPC_U8(&msg, 0U) = U8(mr);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (addr_start != NULL)
{
- *addr_start = ((uint64_t) RPC_U32(&msg, 0U) << 32U) | RPC_U32(&msg, 4U);
+ *addr_start = (sc_faddr_t) RPC_U64(&msg, 0U);
}
-
if (addr_end != NULL)
{
- *addr_end = ((uint64_t) RPC_U32(&msg, 8U) << 32U) | RPC_U32(&msg, 12U);
+ *addr_end = (sc_faddr_t) RPC_U64(&msg, 8U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_ASSIGN_PAD);
+
RPC_U16(&msg, 0U) = U16(pad);
RPC_U8(&msg, 2U) = U8(pt);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_SET_PAD_MOVABLE);
+
RPC_U16(&msg, 0U) = U16(pad_fst);
RPC_U16(&msg, 2U) = U16(pad_lst);
RPC_U8(&msg, 4U) = B2U8(movable);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad)
@@ -665,14 +721,16 @@ sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad)
sc_bool_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_IS_PAD_OWNED);
+
RPC_U8(&msg, 0U) = U8(pad);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = U2B(RPC_R8(&msg));
+ result = (sc_bool_t) U2B(RPC_R8(&msg));
+
return result;
}
@@ -681,13 +739,11 @@ void sc_rm_dump(sc_ipc_t ipc)
sc_rpc_msg_t msg;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_RM);
RPC_FUNC(&msg) = U8(RM_FUNC_DUMP);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
-
- return;
}
/**@}*/
diff --git a/arch/arm/mach-imx/sci/svc/seco/rpc.h b/arch/arm/mach-imx/sci/svc/seco/rpc.h
index 89c7a72372..fab2836807 100644
--- a/arch/arm/mach-imx/sci/svc/seco/rpc.h
+++ b/arch/arm/mach-imx/sci/svc/seco/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+
*/
@@ -24,28 +24,33 @@
*/
/*@{*/
#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 */
-#define SECO_FUNC_PATCH 21U /*!< Index for seco_patch() RPC call */
-#define SECO_FUNC_START_RNG 22U /*!< Index for seco_start_rng() RPC call */
+#define SECO_FUNC_IMAGE_LOAD 1U /*!< Index for sc_seco_image_load() RPC call */
+#define SECO_FUNC_AUTHENTICATE 2U /*!< Index for sc_seco_authenticate() RPC call */
+#define SECO_FUNC_ENH_AUTHENTICATE 24U /*!< Index for sc_seco_enh_authenticate() RPC call */
+#define SECO_FUNC_FORWARD_LIFECYCLE 3U /*!< Index for sc_seco_forward_lifecycle() RPC call */
+#define SECO_FUNC_RETURN_LIFECYCLE 4U /*!< Index for sc_seco_return_lifecycle() RPC call */
+#define SECO_FUNC_COMMIT 5U /*!< Index for sc_seco_commit() RPC call */
+#define SECO_FUNC_ATTEST_MODE 6U /*!< Index for sc_seco_attest_mode() RPC call */
+#define SECO_FUNC_ATTEST 7U /*!< Index for sc_seco_attest() RPC call */
+#define SECO_FUNC_GET_ATTEST_PKEY 8U /*!< Index for sc_seco_get_attest_pkey() RPC call */
+#define SECO_FUNC_GET_ATTEST_SIGN 9U /*!< Index for sc_seco_get_attest_sign() RPC call */
+#define SECO_FUNC_ATTEST_VERIFY 10U /*!< Index for sc_seco_attest_verify() RPC call */
+#define SECO_FUNC_GEN_KEY_BLOB 11U /*!< Index for sc_seco_gen_key_blob() RPC call */
+#define SECO_FUNC_LOAD_KEY 12U /*!< Index for sc_seco_load_key() RPC call */
+#define SECO_FUNC_GET_MP_KEY 13U /*!< Index for sc_seco_get_mp_key() RPC call */
+#define SECO_FUNC_UPDATE_MPMR 14U /*!< Index for sc_seco_update_mpmr() RPC call */
+#define SECO_FUNC_GET_MP_SIGN 15U /*!< Index for sc_seco_get_mp_sign() RPC call */
+#define SECO_FUNC_BUILD_INFO 16U /*!< Index for sc_seco_build_info() RPC call */
+#define SECO_FUNC_CHIP_INFO 17U /*!< Index for sc_seco_chip_info() RPC call */
+#define SECO_FUNC_ENABLE_DEBUG 18U /*!< Index for sc_seco_enable_debug() RPC call */
+#define SECO_FUNC_GET_EVENT 19U /*!< Index for sc_seco_get_event() RPC call */
+#define SECO_FUNC_FUSE_WRITE 20U /*!< Index for sc_seco_fuse_write() RPC call */
+#define SECO_FUNC_PATCH 21U /*!< Index for sc_seco_patch() RPC call */
+#define SECO_FUNC_START_RNG 22U /*!< Index for sc_seco_start_rng() RPC call */
+#define SECO_FUNC_SAB_MSG 23U /*!< Index for sc_seco_sab_msg() RPC call */
+#define SECO_FUNC_SECVIO_ENABLE 25U /*!< Index for sc_seco_secvio_enable() RPC call */
+#define SECO_FUNC_SECVIO_CONFIG 26U /*!< Index for sc_seco_secvio_config() RPC call */
+#define SECO_FUNC_SECVIO_DGO_CONFIG 27U /*!< Index for sc_seco_secvio_dgo_config() RPC call */
/*@}*/
/* Types */
@@ -56,6 +61,7 @@
* This function dispatches an incoming SECO RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @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);
diff --git a/arch/arm/mach-imx/sci/svc/seco/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/seco/rpc_clnt.c
index 6b5ca75b3f..d07591d3d4 100644
--- a/arch/arm/mach-imx/sci/svc/seco/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/svc/seco/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+
*/
@@ -31,452 +31,603 @@ 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 7U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_seco_authenticate(sc_ipc_t ipc,
- sc_seco_auth_cmd_t cmd, sc_faddr_t addr)
+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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
+}
+
+sc_err_t sc_seco_enh_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
+ sc_faddr_t addr, uint32_t mask1, uint32_t mask2)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 6U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_ENH_AUTHENTICATE);
+
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+ RPC_U32(&msg, 8U) = U32(mask1);
+ RPC_U32(&msg, 12U) = U32(mask2);
+ RPC_U8(&msg, 16U) = U8(cmd);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_forward_lifecycle(sc_ipc_t ipc, uint32_t change)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_return_lifecycle(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_commit(sc_ipc_t ipc, uint32_t *info)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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;
+
+ RPC_U32(&msg, 0U) = U32(*info);
sc_call_rpc(ipc, &msg, SC_FALSE);
- *info = RPC_U32(&msg, 0U);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ *info = (uint32_t) RPC_U32(&msg, 0U);
+
+ return err;
}
sc_err_t sc_seco_attest_mode(sc_ipc_t ipc, uint32_t mode)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_attest(sc_ipc_t ipc, uint64_t nonce)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_get_attest_pkey(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_get_attest_sign(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_attest_verify(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 7U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_seco_load_key(sc_ipc_t ipc, uint32_t id,
- sc_faddr_t addr)
+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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_seco_update_mpmr(sc_ipc_t ipc, sc_faddr_t addr,
- uint8_t size, uint8_t lock)
+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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 4U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 6U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-void sc_seco_build_info(sc_ipc_t ipc, uint32_t *version,
- uint32_t *commit)
+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_SIZE(&msg) = 1U;
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);
+ *version = (uint32_t) RPC_U32(&msg, 0U);
}
-
if (commit != NULL)
{
- *commit = RPC_U32(&msg, 4U);
+ *commit = (uint32_t) 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_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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
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);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (uid_l != NULL)
{
- *uid_l = RPC_U32(&msg, 0U);
+ *uid_l = (uint32_t) RPC_U32(&msg, 0U);
}
-
if (uid_h != NULL)
{
- *uid_h = RPC_U32(&msg, 4U);
+ *uid_h = (uint32_t) RPC_U32(&msg, 4U);
}
-
if (lc != NULL)
{
- *lc = RPC_U16(&msg, 8U);
+ *lc = (uint16_t) RPC_U16(&msg, 8U);
}
-
if (monotonic != NULL)
{
- *monotonic = RPC_U16(&msg, 10U);
+ *monotonic = (uint16_t) RPC_U16(&msg, 10U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_seco_enable_debug(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-sc_err_t sc_seco_get_event(sc_ipc_t ipc, uint8_t idx,
- uint32_t *event)
+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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
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);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (event != NULL)
{
- *event = RPC_U32(&msg, 0U);
+ *event = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_seco_fuse_write(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_patch(sc_ipc_t ipc, sc_faddr_t addr)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
RPC_FUNC(&msg) = U8(SECO_FUNC_PATCH);
+
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;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_seco_start_rng(sc_ipc_t ipc, sc_seco_rng_stat_t *status)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
RPC_FUNC(&msg) = U8(SECO_FUNC_START_RNG);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (status != NULL)
{
- *status = RPC_U32(&msg, 0U);
+ *status = (sc_seco_rng_stat_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
+}
+
+sc_err_t sc_seco_sab_msg(sc_ipc_t ipc, sc_faddr_t addr)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_SAB_MSG);
+
+ RPC_U32(&msg, 0U) = U32(addr >> 32ULL);
+ RPC_U32(&msg, 4U) = U32(addr);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
+}
+
+sc_err_t sc_seco_secvio_enable(sc_ipc_t ipc)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_SECVIO_ENABLE);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
+}
+
+sc_err_t sc_seco_secvio_config(sc_ipc_t ipc, uint8_t id, uint8_t access,
+ uint32_t *data0, uint32_t *data1, uint32_t *data2, uint32_t *data3,
+ uint32_t *data4, uint8_t size)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 7U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_SECVIO_CONFIG);
+
+ RPC_U32(&msg, 0U) = U32(*data0);
+ RPC_U32(&msg, 4U) = U32(*data1);
+ RPC_U32(&msg, 8U) = U32(*data2);
+ RPC_U32(&msg, 12U) = U32(*data3);
+ RPC_U32(&msg, 16U) = U32(*data4);
+ RPC_U8(&msg, 20U) = U8(id);
+ RPC_U8(&msg, 21U) = U8(access);
+ RPC_U8(&msg, 22U) = U8(size);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ *data0 = (uint32_t) RPC_U32(&msg, 0U);
+ *data1 = (uint32_t) RPC_U32(&msg, 4U);
+ *data2 = (uint32_t) RPC_U32(&msg, 8U);
+ *data3 = (uint32_t) RPC_U32(&msg, 12U);
+ *data4 = (uint32_t) RPC_U32(&msg, 16U);
+
+ return err;
+}
+
+sc_err_t sc_seco_secvio_dgo_config(sc_ipc_t ipc, uint8_t id, uint8_t access,
+ uint32_t *data)
+{
+ sc_rpc_msg_t msg;
+ sc_err_t err;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
+ RPC_SVC(&msg) = U8(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = U8(SECO_FUNC_SECVIO_DGO_CONFIG);
+
+ RPC_U32(&msg, 0U) = U32(*data);
+ RPC_U8(&msg, 4U) = U8(id);
+ RPC_U8(&msg, 5U) = U8(access);
+
+ sc_call_rpc(ipc, &msg, SC_FALSE);
+
+ err = (sc_err_t) RPC_R8(&msg);
+
+ *data = (uint32_t) RPC_U32(&msg, 0U);
+
+ return err;
}
/**@}*/
diff --git a/arch/arm/mach-imx/sci/svc/timer/rpc.h b/arch/arm/mach-imx/sci/svc/timer/rpc.h
index c97147c5a3..723272056d 100644
--- a/arch/arm/mach-imx/sci/svc/timer/rpc.h
+++ b/arch/arm/mach-imx/sci/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+
*/
@@ -24,24 +24,24 @@
*/
/*@{*/
#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_SET_WDOG_TIMEOUT 1U /*!< Index for sc_timer_set_wdog_timeout() RPC call */
+#define TIMER_FUNC_SET_WDOG_PRE_TIMEOUT 12U /*!< Index for sc_timer_set_wdog_pre_timeout() RPC call */
+#define TIMER_FUNC_START_WDOG 2U /*!< Index for sc_timer_start_wdog() RPC call */
+#define TIMER_FUNC_STOP_WDOG 3U /*!< Index for sc_timer_stop_wdog() RPC call */
+#define TIMER_FUNC_PING_WDOG 4U /*!< Index for sc_timer_ping_wdog() RPC call */
+#define TIMER_FUNC_GET_WDOG_STATUS 5U /*!< Index for sc_timer_get_wdog_status() RPC call */
+#define TIMER_FUNC_PT_GET_WDOG_STATUS 13U /*!< Index for sc_timer_pt_get_wdog_status() RPC call */
+#define TIMER_FUNC_SET_WDOG_ACTION 10U /*!< Index for sc_timer_set_wdog_action() RPC call */
+#define TIMER_FUNC_SET_RTC_TIME 6U /*!< Index for sc_timer_set_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_TIME 7U /*!< Index for sc_timer_get_rtc_time() RPC call */
+#define TIMER_FUNC_GET_RTC_SEC1970 9U /*!< Index for sc_timer_get_rtc_sec1970() RPC call */
+#define TIMER_FUNC_SET_RTC_ALARM 8U /*!< Index for sc_timer_set_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_PERIODIC_ALARM 14U /*!< Index for sc_timer_set_rtc_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_RTC_ALARM 15U /*!< Index for sc_timer_cancel_rtc_alarm() RPC call */
+#define TIMER_FUNC_SET_RTC_CALB 11U /*!< Index for sc_timer_set_rtc_calb() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_ALARM 16U /*!< Index for sc_timer_set_sysctr_alarm() RPC call */
+#define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /*!< Index for sc_timer_set_sysctr_periodic_alarm() RPC call */
+#define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /*!< Index for sc_timer_cancel_sysctr_alarm() RPC call */
/*@}*/
/* Types */
@@ -52,6 +52,7 @@
* This function dispatches an incoming TIMER RPC request.
*
* @param[in] caller_pt caller partition
+ * @param[in] mu MU message came from
* @param[in] msg pointer to RPC message
*/
void timer_dispatch(sc_rm_pt_t caller_pt, sc_rsrc_t mu, sc_rpc_msg_t *msg);
diff --git a/arch/arm/mach-imx/sci/svc/timer/rpc_clnt.c b/arch/arm/mach-imx/sci/svc/timer/rpc_clnt.c
index b35572726a..3ea0d7b170 100644
--- a/arch/arm/mach-imx/sci/svc/timer/rpc_clnt.c
+++ b/arch/arm/mach-imx/sci/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,391 +27,408 @@
/* 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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_WDOG_TIMEOUT);
+
RPC_U32(&msg, 0U) = U32(timeout);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_set_wdog_pre_timeout(sc_ipc_t ipc,
sc_timer_wdog_time_t pre_timeout)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_WDOG_PRE_TIMEOUT);
+
RPC_U32(&msg, 0U) = U32(pre_timeout);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_start_wdog(sc_ipc_t ipc, sc_bool_t lock)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_START_WDOG);
+
RPC_U8(&msg, 0U) = B2U8(lock);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_stop_wdog(sc_ipc_t ipc)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_STOP_WDOG);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_ping_wdog(sc_ipc_t ipc)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_PING_WDOG);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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_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_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_GET_WDOG_STATUS);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (timeout != NULL)
{
- *timeout = RPC_U32(&msg, 0U);
+ *timeout = (sc_timer_wdog_time_t) RPC_U32(&msg, 0U);
}
-
if (max_timeout != NULL)
{
- *max_timeout = RPC_U32(&msg, 4U);
+ *max_timeout = (sc_timer_wdog_time_t) RPC_U32(&msg, 4U);
}
-
if (remaining_time != NULL)
{
- *remaining_time = RPC_U32(&msg, 8U);
+ *remaining_time = (sc_timer_wdog_time_t) RPC_U32(&msg, 8U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_PT_GET_WDOG_STATUS);
+
RPC_U8(&msg, 0U) = U8(pt);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (timeout != NULL)
{
- *timeout = RPC_U32(&msg, 0U);
+ *timeout = (sc_timer_wdog_time_t) RPC_U32(&msg, 0U);
}
-
if (remaining_time != NULL)
{
- *remaining_time = RPC_U32(&msg, 4U);
+ *remaining_time = (sc_timer_wdog_time_t) RPC_U32(&msg, 4U);
}
-
- result = RPC_R8(&msg);
if (enb != NULL)
{
- *enb = U2B(RPC_U8(&msg, 8U));
+ *enb = (sc_bool_t) U2B(RPC_U8(&msg, 8U));
}
- return (sc_err_t) result;
+ return err;
}
-sc_err_t sc_timer_set_wdog_action(sc_ipc_t ipc,
- sc_rm_pt_t pt, sc_timer_wdog_action_t action)
+sc_err_t sc_timer_set_wdog_action(sc_ipc_t ipc, sc_rm_pt_t pt,
+ sc_timer_wdog_action_t action)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_WDOG_ACTION);
+
RPC_U8(&msg, 0U) = U8(pt);
RPC_U8(&msg, 1U) = U8(action);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_RTC_TIME);
+
RPC_U16(&msg, 0U) = U16(year);
RPC_U8(&msg, 2U) = U8(mon);
RPC_U8(&msg, 3U) = U8(day);
RPC_U8(&msg, 4U) = U8(hour);
RPC_U8(&msg, 5U) = U8(min);
RPC_U8(&msg, 6U) = U8(sec);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_GET_RTC_TIME);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (year != NULL)
{
- *year = RPC_U16(&msg, 0U);
+ *year = (uint16_t) RPC_U16(&msg, 0U);
}
-
- result = RPC_R8(&msg);
if (mon != NULL)
{
- *mon = RPC_U8(&msg, 2U);
+ *mon = (uint8_t) RPC_U8(&msg, 2U);
}
-
if (day != NULL)
{
- *day = RPC_U8(&msg, 3U);
+ *day = (uint8_t) RPC_U8(&msg, 3U);
}
-
if (hour != NULL)
{
- *hour = RPC_U8(&msg, 4U);
+ *hour = (uint8_t) RPC_U8(&msg, 4U);
}
-
if (min != NULL)
{
- *min = RPC_U8(&msg, 5U);
+ *min = (uint8_t) RPC_U8(&msg, 5U);
}
-
if (sec != NULL)
{
- *sec = RPC_U8(&msg, 6U);
+ *sec = (uint8_t) RPC_U8(&msg, 6U);
}
- return (sc_err_t) result;
+ return err;
}
sc_err_t sc_timer_get_rtc_sec1970(sc_ipc_t ipc, uint32_t *sec)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_GET_RTC_SEC1970);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
+ err = (sc_err_t) RPC_R8(&msg);
+
if (sec != NULL)
{
- *sec = RPC_U32(&msg, 0U);
+ *sec = (uint32_t) RPC_U32(&msg, 0U);
}
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ return err;
}
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)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_RTC_ALARM);
+
RPC_U16(&msg, 0U) = U16(year);
RPC_U8(&msg, 2U) = U8(mon);
RPC_U8(&msg, 3U) = U8(day);
RPC_U8(&msg, 4U) = U8(hour);
RPC_U8(&msg, 5U) = U8(min);
RPC_U8(&msg, 6U) = U8(sec);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_set_rtc_periodic_alarm(sc_ipc_t ipc, uint32_t sec)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_RTC_PERIODIC_ALARM);
+
RPC_U32(&msg, 0U) = U32(sec);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_cancel_rtc_alarm(sc_ipc_t ipc)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_CANCEL_RTC_ALARM);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_set_rtc_calb(sc_ipc_t ipc, int8_t count)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_RTC_CALB);
+
RPC_I8(&msg, 0U) = I8(count);
- RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_set_sysctr_alarm(sc_ipc_t ipc, uint64_t ticks)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_SYSCTR_ALARM);
+
RPC_U32(&msg, 0U) = U32(ticks >> 32ULL);
RPC_U32(&msg, 4U) = U32(ticks);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
-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;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 3U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM);
+
RPC_U32(&msg, 0U) = U32(ticks >> 32ULL);
RPC_U32(&msg, 4U) = U32(ticks);
- RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
sc_err_t sc_timer_cancel_sysctr_alarm(sc_ipc_t ipc)
{
sc_rpc_msg_t msg;
- uint8_t result;
+ sc_err_t err;
RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 1U;
RPC_SVC(&msg) = U8(SC_RPC_SVC_TIMER);
RPC_FUNC(&msg) = U8(TIMER_FUNC_CANCEL_SYSCTR_ALARM);
- RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
- result = RPC_R8(&msg);
- return (sc_err_t) result;
+ err = (sc_err_t) RPC_R8(&msg);
+
+ return err;
}
/**@}*/