Commit ff2743e5 authored by Anson Huang's avatar Anson Huang
Browse files

Support for NXP's i.MX8 SoCs IPC



NXP's i.MX8 SoCs have system controller (M4 core)
which takes control of clock management, power management,
partition management, PAD management etc., other
clusters like Cortex-A35 can send out command via MU
(Message Unit) to system controller for clock/power
management etc..

This patch adds basic IPC(inter-processor communication) support.
Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
parent 841cb4f7
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __IMX8_IOMUX_H__
#define __IMX8_IOMUX_H__
#define PADRING_IFMUX_EN_SHIFT 31
#define PADRING_IFMUX_EN_MASK (1 << PADRING_IFMUX_EN_SHIFT)
#define PADRING_GP_EN_SHIFT 30
#define PADRING_GP_EN_MASK (1 << PADRING_GP_EN_SHIFT)
#define PADRING_IFMUX_SHIFT 27
#define PADRING_IFMUX_MASK (0x7 << PADRING_IFMUX_SHIFT)
#define PADRING_CONFIG_SHIFT 25
#define PADRING_CONFIG_MASK (0x3 << PADRING_CONFIG_SHIFT)
#define PADRING_LPCONFIG_SHIFT 23
#define PADRING_LPCONFIG_MASK (0x3 << PADRING_LPCONFIG_SHIFT)
#define PADRING_PULL_SHIFT 5
#define PADRING_PULL_MASK (0x3 << PADRING_PULL_SHIFT)
#define PADRING_DSE_SHIFT 0
#define PADRING_DSE_MASK (0x7 << PADRING_DSE_SHIFT)
#endif /* __IMX8_IOMUX_H__ */
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _SC_SCI_H
#define _SC_SCI_H
/* Defines */
/* Includes */
#include <sci/sci_ipc.h>
#include <sci/svc/pad/sci_pad_api.h>
#include <sci/svc/pm/sci_pm_api.h>
#include <sci/svc/rm/sci_rm_api.h>
#endif /* _SC_SCI_H */
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file for the IPC implementation.
*/
#ifndef SC_IPC_H
#define SC_IPC_H
/* Includes */
#include <sci/sci_types.h>
/* Defines */
/* Types */
/* Functions */
/*!
* This function opens an IPC channel.
*
* @param[out] ipc return pointer for ipc handle
* @param[in] id id of channel to open
*
* @return Returns an error code (SC_ERR_NONE = success, SC_ERR_IPC
* otherwise).
*
* The \a id parameter is implementation specific. Could be an MU
* address, pointer to a driver path, channel index, etc.
*/
sc_err_t sc_ipc_open(sc_ipc_t *ipc, sc_ipc_id_t id);
/*!
* This function closes an IPC channel.
*
* @param[in] ipc id of channel to close
*/
void sc_ipc_close(sc_ipc_t ipc);
/*!
* This function reads a message from an IPC channel.
*
* @param[in] ipc id of channel read from
* @param[out] data pointer to message buffer to read
*
* This function will block if no message is available to be read.
*/
void sc_ipc_read(sc_ipc_t ipc, void *data);
/*!
* This function writes a message to an IPC channel.
*
* @param[in] ipc id of channel to write to
* @param[in] data pointer to message buffer to write
*
* This function will block if the outgoing buffer is full.
*/
void sc_ipc_write(sc_ipc_t ipc, void *data);
sc_ipc_t ipc_handle;
#endif /* SC_IPC_H */
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file for the RPC implementation.
*/
#ifndef SC_RPC_H
#define SC_RPC_H
/* Includes */
#include <sci/sci_types.h>
#include <sci/sci_ipc.h>
#include <stdbool.h>
/* Defines */
#define SC_RPC_VERSION 1U
#define SC_RPC_MAX_MSG 8U
#define RPC_VER(MSG) ((MSG)->version)
#define RPC_SIZE(MSG) ((MSG)->size)
#define RPC_SVC(MSG) ((MSG)->svc)
#define RPC_FUNC(MSG) ((MSG)->func)
#define RPC_R8(MSG) ((MSG)->func)
#define RPC_I32(MSG, IDX) ((MSG)->DATA.i32[(IDX) / 4U])
#define RPC_I16(MSG, IDX) ((MSG)->DATA.i16[(IDX) / 2U])
#define RPC_I8(MSG, IDX) ((MSG)->DATA.i8[(IDX)])
#define RPC_U32(MSG, IDX) ((MSG)->DATA.u32[(IDX) / 4U])
#define RPC_U16(MSG, IDX) ((MSG)->DATA.u16[(IDX) / 2U])
#define RPC_U8(MSG, IDX) ((MSG)->DATA.u8[(IDX)])
#define SC_RPC_SVC_UNKNOWN 0U
#define SC_RPC_SVC_RETURN 1U
#define SC_RPC_SVC_PM 2U
#define SC_RPC_SVC_RM 3U
#define SC_RPC_SVC_TIMER 5U
#define SC_RPC_SVC_PAD 6U
#define SC_RPC_SVC_MISC 7U
#define SC_RPC_SVC_IRQ 8U
#define SC_RPC_SVC_ABORT 9U
#define SC_RPC_ASYNC_STATE_RD_START 0U
#define SC_RPC_ASYNC_STATE_RD_ACTIVE 1U
#define SC_RPC_ASYNC_STATE_RD_DONE 2U
#define SC_RPC_ASYNC_STATE_WR_START 3U
#define SC_RPC_ASYNC_STATE_WR_ACTIVE 4U
#define SC_RPC_ASYNC_STATE_WR_DONE 5U
#define SC_RPC_MU_GIR_SVC 0x1U
#define SC_RPC_MU_GIR_DBG 0x8U
/* Types */
typedef uint8_t sc_rpc_svc_t;
typedef struct sc_rpc_msg_s {
uint8_t version;
uint8_t size;
uint8_t svc;
uint8_t func;
union {
int32_t i32[(SC_RPC_MAX_MSG - 1U)];
int16_t i16[(SC_RPC_MAX_MSG - 1U) * 2U];
int8_t i8[(SC_RPC_MAX_MSG - 1U) * 4U];
uint32_t u32[(SC_RPC_MAX_MSG - 1U)];
uint16_t u16[(SC_RPC_MAX_MSG - 1U) * 2U];
uint8_t u8[(SC_RPC_MAX_MSG - 1U) * 4U];
} DATA;
} sc_rpc_msg_t;
typedef uint8_t sc_rpc_async_state_t;
typedef struct sc_rpc_async_msg_s {
sc_rpc_async_state_t state;
uint8_t wordIdx;
sc_rpc_msg_t msg;
uint32_t timeStamp;
} sc_rpc_async_msg_t;
/* Functions */
/*!
* This is an internal function to send an RPC message over an IPC
* channel. It is called by client-side SCFW API function shims.
*
* @param[in] ipc IPC handle
* @param[in,out] msg handle to a message
* @param[in] no_resp response flag
*
* If \a no_resp is SC_FALSE then this function waits for a response
* and returns the result in \a msg.
*/
void sc_call_rpc(sc_ipc_t ipc, sc_rpc_msg_t *msg, bool 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 */
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _SC_SCFW_H
#define _SC_SCFW_H
/* Includes */
#include <types.h>
#ifdef __cplusplus
#define __I volatile /*!< Defines 'read only' permissions */
#else
#define __I volatile const /*!< Defines 'read only' permissions */
#endif
#define __O volatile /*!< Defines 'write only' permissions */
#define __IO volatile /*!< Defines 'read / write' permissions */
/*!
* This type is used to declare a handle for an IPC communication
* channel. Its meaning is specific to the IPC implementation.
*/
typedef uint64_t sc_ipc_t;
/*!
* This type is used to declare an ID for an IPC communication
* channel. For the reference IPC implementation, this ID
* selects the base address of the MU used for IPC.
*/
typedef uint64_t sc_ipc_id_t;
#endif /* _SC_SCFW_H */
This diff is collapsed.
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file containing the public API for the System Controller (SC)
* Pad Control (PAD) function.
*
* @addtogroup PAD_SVC (SVC) Pad Service
*
* Module for the Pad Control (PAD) service.
*
* @details
*
* Pad configuration is managed by SC firmware. The pad configuration
* features supported by the SC firmware include:
*
* - Configuring the mux, input/output connection, and low-power isolation
mode.
* - Configuring the technology-specific pad setting such as drive strength,
* pullup/pulldown, etc.
* - Configuring compensation for pad groups with dual voltage capability.
*
* Pad functions fall into one of three categories. Generic functions are
* common to all SoCs and all process technologies. SoC functions are raw
* low-level functions. Technology-specific functions are specific to the
* process technology.
*
* The list of pads is SoC specific. Refer to the SoC [Pad List](@ref PADS)
* for valid pad values. Note that all pads exist on a die but may or
* may not be brought out by the specific package. Mapping of pads to
* package pins/balls is documented in the associated Data Sheet. Some pads
* may not be brought out because the part (die+package) is defeatured and
* some pads may connect to the substrate in the package.
*
* Some pads (SC_P_COMP_*) that can be specified are not individual pads
* but are in fact pad groups. These groups have additional configuration
* that can be done using the sc_pad_set_gp_28fdsoi_comp() function. More
* info on these can be found in the associated Reference Manual.
*
* 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
* with the implementation of board_config_sc(). Additionally, pads may
* be assigned to various other partitions via the implementation of
* board_system_config().
*
* Note muxing two input pads to the same IP functional signal will
* result in undefined behavior.
* @{
*/
#ifndef SC_PAD_API_H
#define SC_PAD_API_H
/* Includes */
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
/* Defines */
/*!
* @name Defines for type widths
*/
/*@{*/
#define SC_PAD_MUX_W 3 /* Width of mux parameter */
/*@}*/
/*!
* @name Defines for sc_pad_config_t
*/
/*@{*/
#define SC_PAD_CONFIG_NORMAL 0U /* Normal */
#define SC_PAD_CONFIG_OD 1U /* Open Drain */
#define SC_PAD_CONFIG_OD_IN 2U /* Open Drain and input */
#define SC_PAD_CONFIG_OUT_IN 3U /* Output and input */
/*@}*/
/*!
* @name Defines for sc_pad_iso_t
*/
/*@{*/
#define SC_PAD_ISO_OFF 0U /* ISO latch is transparent */
#define SC_PAD_ISO_EARLY 1U /* Follow EARLY_ISO */
#define SC_PAD_ISO_LATE 2U /* Follow LATE_ISO */
#define SC_PAD_ISO_ON 3U /* ISO latched data is held */
/*@}*/
/*!
* @name Defines for sc_pad_28fdsoi_dse_t
*/
/*@{*/
#define SC_PAD_28FDSOI_DSE_18V_1MA 0U /* Drive strength of 1mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_2MA 1U /* Drive strength of 2mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_4MA 2U /* Drive strength of 4mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_6MA 3U /* Drive strength of 6mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_8MA 4U /* Drive strength of 8mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_10MA 5U /* Drive strength of 10mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_12MA 6U /* Drive strength of 12mA for 1.8v */
#define SC_PAD_28FDSOI_DSE_18V_HS 7U /* High-speed drive strength for 1.8v */
#define SC_PAD_28FDSOI_DSE_33V_2MA 0U /* Drive strength of 2mA for 3.3v */
#define SC_PAD_28FDSOI_DSE_33V_4MA 1U /* Drive strength of 4mA for 3.3v */
#define SC_PAD_28FDSOI_DSE_33V_8MA 2U /* Drive strength of 8mA for 3.3v */
#define SC_PAD_28FDSOI_DSE_33V_12MA 3U /* Drive strength of 12mA for 3.3v */
#define SC_PAD_28FDSOI_DSE_DV_HIGH 0U /* High drive strength for dual volt */
#define SC_PAD_28FDSOI_DSE_DV_LOW 1U /* Low drive strength for dual volt */
/*@}*/
/*!
* @name Defines for sc_pad_28fdsoi_ps_t
*/
/*@{*/
#define SC_PAD_28FDSOI_PS_KEEPER 0U /* Bus-keeper (only valid for 1.8v) */
#define SC_PAD_28FDSOI_PS_PU 1U /* Pull-up */
#define SC_PAD_28FDSOI_PS_PD 2U /* Pull-down */
#define SC_PAD_28FDSOI_PS_NONE 3U /* No pull (disabled) */
/*@}*/
/*!
* @name Defines for sc_pad_28fdsoi_pus_t
*/
/*@{*/
#define SC_PAD_28FDSOI_PUS_30K_PD 0U /* 30K pull-down */
#define SC_PAD_28FDSOI_PUS_100K_PU 1U /* 100K pull-up */
#define SC_PAD_28FDSOI_PUS_3K_PU 2U /* 3K pull-up */
#define SC_PAD_28FDSOI_PUS_30K_PU 3U /* 30K pull-up */
/*@}*/
/*!
* @name Defines for sc_pad_wakeup_t
*/
/*@{*/
#define SC_PAD_WAKEUP_OFF 0U /* Off */
#define SC_PAD_WAKEUP_CLEAR 1U /* Clears pending flag */
#define SC_PAD_WAKEUP_LOW_LVL 4U /* Low level */
#define SC_PAD_WAKEUP_FALL_EDGE 5U /* Falling edge */
#define SC_PAD_WAKEUP_RISE_EDGE 6U /* Rising edge */
#define SC_PAD_WAKEUP_HIGH_LVL 7U /* High-level */
/*@}*/
/* Types */
/*!
* This type is used to declare a pad config. It determines how the
* output data is driven, pull-up is controlled, and input signal is
* connected. Normal and OD are typical and only connect the input
* when the output is not driven. The IN options are less common and
* force an input connection even when driving the output.
*/
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.
*/
typedef uint8_t sc_pad_iso_t;
/*!
* This type is used to declare a drive strength. Note it is specific
* to 28FDSOI. Also note that valid values depend on the pad type.
*/
typedef uint8_t sc_pad_28fdsoi_dse_t;
/*!
* This type is used to declare a pull select. Note it is specific
* to 28FDSOI.
*/
typedef uint8_t sc_pad_28fdsoi_ps_t;
/*!
* This type is used to declare a pull-up select. Note it is specific
* to 28FDSOI HSIC pads.
*/
typedef uint8_t sc_pad_28fdsoi_pus_t;
/*!
* This type is used to declare a wakeup mode of a pad.
*/
typedef uint8_t sc_pad_wakeup_t;
/* Functions */
/*!
* @name Generic Functions
* @{
*/
/*!
* This function configures the mux settings for a pad. This includes
* the signal mux, pad config, and low-power isolation mode.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] mux mux setting
* @param[in] config pad config
* @param[in] iso low-power isolation mode
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Note muxing two input pads to the same IP functional signal will
* result in undefined behavior.
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
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);
/*!
* This function gets the mux settings for a pad. This includes
* the signal mux, pad config, and low-power isolation mode.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] mux pointer to return mux setting
* @param[out] config pointer to return pad config
* @param[out] iso pointer to return low-power isolation mode
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
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);
/*!
* This function configures the general purpose pad control. This
* is technology dependent and includes things like drive strength,
* slew rate, pull up/down, etc. Refer to the SoC Reference Manual
* for bit field details.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] ctrl control value to set
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_set_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t ctrl);
/*!
* This function gets the general purpose pad control. This
* is technology dependent and includes things like drive strength,
* slew rate, pull up/down, etc. Refer to the SoC Reference Manual
* for bit field details.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] ctrl pointer to return control value
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_get_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t *ctrl);
/*!
* This function configures the wakeup mode of the pad.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] wakeup wakeup to set
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t wakeup);
/*!
* This function gets the wakeup mode of a pad.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] wakeup pointer to return wakeup
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t *wakeup);
/*!
* This function configures a pad.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] mux mux setting
* @param[in] config pad config
* @param[in] iso low-power isolation mode
* @param[in] ctrl control value
* @param[in] wakeup wakeup to set
*
* @see sc_pad_set_mux().
* @see sc_pad_set_gp().
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Note muxing two input pads to the same IP functional signal will
* result in undefined behavior.
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
sc_pad_config_t config, sc_pad_iso_t iso, uint32_t ctrl,
sc_pad_wakeup_t wakeup);
/*!
* This function gets a pad's config.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] mux pointer to return mux setting
* @param[out] config pointer to return pad config
* @param[out] iso pointer to return low-power isolation mode
* @param[out] ctrl pointer to return control value
* @param[out] wakeup pointer to return wakeup to set
*
* @see sc_pad_set_mux().
* @see sc_pad_set_gp().
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
sc_pad_config_t *config, sc_pad_iso_t *iso,
uint32_t *ctrl, sc_pad_wakeup_t *wakeup);
/* @} */
/*!
* @name SoC Specific Functions
* @{
*/
/*!
* This function configures the settings for a pad. This setting is SoC
* specific.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] val value to set
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, uint32_t val);
/*!
* This function gets the settings for a pad. This setting is SoC
* specific.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] val pointer to return setting
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val);
/* @} */
/*!
* @name Technology Specific Functions
* @{
*/
/*!
* This function configures the pad control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] dse drive strength
* @param[in] ps pull select
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
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);
/*!
* This function gets the pad control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] dse pointer to return drive strength
* @param[out] ps pointer to return pull select
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
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);
/*!
* This function configures the pad control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] dse drive strength
* @param[in] hys hysteresis
* @param[in] pus pull-up select
* @param[in] pke pull keeper enable
* @param[in] pue pull-up enable
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_pad_28fdsoi_dse_t dse, sc_bool_t hys,
sc_pad_28fdsoi_pus_t pus, sc_bool_t pke,
sc_bool_t pue);
/*!
* This function gets the pad control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] dse pointer to return drive strength
* @param[out] hys pointer to return hysteresis
* @param[out] pus pointer to return pull-up select
* @param[out] pke pointer to return pull keeper enable
* @param[out] pue pointer to return pull-up enable
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_pad_28fdsoi_dse_t *dse, sc_bool_t *hys,
sc_pad_28fdsoi_pus_t *pus, sc_bool_t *pke,
sc_bool_t *pue);
/*!
* This function configures the compensation control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to configure
* @param[in] compen compensation/freeze mode
* @param[in] fastfrz fast freeze
* @param[in] rasrcp compensation code for PMOS
* @param[in] rasrcn compensation code for NMOS
* @param[in] nasrc_sel NASRC read select
* @param[in] psw_ovr 2.5v override
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*
* Note \a psw_ovr is only applicable to pads supporting 2.5 volt
* operation (e.g. some Ethernet pads).
*/
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);
/*!
* This function gets the compensation control specific to 28FDSOI.
*
* @param[in] ipc IPC handle
* @param[in] pad pad to query
* @param[out] compen pointer to return compensation/freeze mode
* @param[out] fastfrz pointer to return fast freeze
* @param[out] rasrcp pointer to return compensation code for PMOS
* @param[out] rasrcn pointer to return compensation code for NMOS
* @param[out] nasrc_sel pointer to return NASRC read select
* @param[out] compok pointer to return compensation status
* @param[out] nasrc pointer to return NASRCP/NASRCN
* @param[out] psw_ovr pointer to return the 2.5v override
*
* @return Returns an error code (SC_ERR_NONE = success).
*
* Return errors:
* - SC_PARM if arguments out of range or invalid,
* - SC_ERR_NOACCESS if caller's partition is not the pad owner,
* - SC_ERR_UNAVAILABLE if process not applicable
*
* Refer to the SoC [Pad List](@ref PADS) for valid pad values.
*/
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);
/* @} */
#endif /* SC_PAD_API_H */
/**@}*/
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <mmio.h>
#include "imx8_mu.h"
void MU_EnableRxFullInt(uint32_t base, uint32_t index)
{
uint32_t reg = mmio_read_32(base + MU_ACR_OFFSET1);
reg &= ~(MU_CR_GIRn_MASK1 | MU_CR_NMI_MASK1);
reg |= MU_CR_RIE0_MASK1 >> index;
mmio_write_32(base + MU_ACR_OFFSET1, reg);
}
void MU_EnableGeneralInt(uint32_t base, uint32_t index)
{
uint32_t reg = mmio_read_32(base + MU_ACR_OFFSET1);
reg &= ~(MU_CR_GIRn_MASK1 | MU_CR_NMI_MASK1);
reg |= MU_CR_GIE0_MASK1 >> index;
mmio_write_32(base + MU_ACR_OFFSET1, reg);
}
void MU_SendMessage(uint32_t base, uint32_t regIndex, uint32_t msg)
{
uint32_t mask = MU_SR_TE0_MASK1 >> regIndex;
/* Wait TX register to be empty. */
while (!(mmio_read_32(base + MU_ASR_OFFSET1) & mask))
;
mmio_write_32(base + MU_ATR0_OFFSET1 + (regIndex * 4), msg);
}
void MU_ReceiveMsg(uint32_t base, uint32_t regIndex, uint32_t *msg)
{
uint32_t mask = MU_SR_RF0_MASK1 >> regIndex;
/* Wait RX register to be full. */
while (!(mmio_read_32(base + MU_ASR_OFFSET1) & mask))
;
*msg = mmio_read_32(base + MU_ARR0_OFFSET1 + (regIndex * 4));
}
void MU_Init(uint32_t base)
{
uint32_t reg;
reg = mmio_read_32(base + MU_ACR_OFFSET1);
/* Clear GIEn, RIEn, TIEn, GIRn and ABFn. */
reg &= ~(MU_CR_GIEn_MASK1 | MU_CR_RIEn_MASK1 | MU_CR_TIEn_MASK1
| MU_CR_GIRn_MASK1 | MU_CR_Fn_MASK1);
mmio_write_32(base + MU_ACR_OFFSET1, reg);
}
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <types.h>
#define MU_ATR0_OFFSET1 0x0
#define MU_ARR0_OFFSET1 0x10
#define MU_ASR_OFFSET1 0x20
#define MU_ACR_OFFSET1 0x24
#define MU_TR_COUNT1 4
#define MU_RR_COUNT1 4
#define MU_CR_GIEn_MASK1 (0xF << 28)
#define MU_CR_RIEn_MASK1 (0xF << 24)
#define MU_CR_TIEn_MASK1 (0xF << 20)
#define MU_CR_GIRn_MASK1 (0xF << 16)
#define MU_CR_NMI_MASK1 (1 << 3)
#define MU_CR_Fn_MASK1 0x7
#define MU_SR_TE0_MASK1 (1 << 23)
#define MU_SR_RF0_MASK1 (1 << 27)
#define MU_CR_RIE0_MASK1 (1 << 27)
#define MU_CR_GIE0_MASK1 (1 << 31)
#define MU_TR_COUNT 4
#define MU_RR_COUNT 4
void MU_Init(uint32_t base);
void MU_SendMessage(uint32_t base, uint32_t regIndex, uint32_t msg);
void MU_ReceiveMsg(uint32_t base, uint32_t regIndex, uint32_t *msg);
void MU_EnableGeneralInt(uint32_t base, uint32_t index);
void MU_EnableRxFullInt(uint32_t base, uint32_t index);
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <bakery_lock.h>
#include <sci/sci_scfw.h>
#include <sci/sci_ipc.h>
#include <sci/sci_rpc.h>
#include <stdlib.h>
#include "imx8_mu.h"
DEFINE_BAKERY_LOCK(sc_ipc_bakery_lock);
#define sc_ipc_lock_init() bakery_lock_init(&sc_ipc_bakery_lock)
#define sc_ipc_lock() bakery_lock_get(&sc_ipc_bakery_lock)
#define sc_ipc_unlock() bakery_lock_release(&sc_ipc_bakery_lock)
void sc_call_rpc(sc_ipc_t ipc, sc_rpc_msg_t *msg, bool no_resp)
{
sc_ipc_lock();
sc_ipc_write(ipc, msg);
if (!no_resp)
sc_ipc_read(ipc, msg);
sc_ipc_unlock();
}
sc_err_t sc_ipc_open(sc_ipc_t *ipc, sc_ipc_id_t id)
{
uint32_t base = id;
uint32_t i;
/* Get MU base associated with IPC channel */
if ((ipc == NULL) || (base == 0))
return SC_ERR_IPC;
sc_ipc_lock_init();
/* Init MU */
MU_Init(base);
/* Enable all RX interrupts */
for (i = 0; i < MU_RR_COUNT; i++) {
MU_EnableRxFullInt(base, i);
}
/* Return MU address as handle */
*ipc = (sc_ipc_t) id;
return SC_ERR_NONE;
}
void sc_ipc_close(sc_ipc_t ipc)
{
uint32_t base = ipc;
if (base != 0)
MU_Init(base);
}
void sc_ipc_read(sc_ipc_t ipc, void *data)
{
uint32_t base = ipc;
sc_rpc_msg_t *msg = (sc_rpc_msg_t *) data;
uint8_t count = 0;
/* Check parms */
if ((base == 0) || (msg == NULL))
return;
/* Read first word */
MU_ReceiveMsg(base, 0, (uint32_t *) msg);
count++;
/* Check size */
if (msg->size > SC_RPC_MAX_MSG) {
*((uint32_t *) msg) = 0;
return;
}
/* Read remaining words */
while (count < msg->size) {
MU_ReceiveMsg(base, count % MU_RR_COUNT,
&(msg->DATA.u32[count - 1]));
count++;
}
}
void sc_ipc_write(sc_ipc_t ipc, void *data)
{
sc_rpc_msg_t *msg = (sc_rpc_msg_t *) data;
uint32_t base = ipc;
uint8_t count = 0;
/* Check parms */
if ((base == 0) || (msg == NULL))
return;
/* Check size */
if (msg->size > SC_RPC_MAX_MSG)
return;
/* Write first word */
MU_SendMessage(base, 0, *((uint32_t *) msg));
count++;
/* Write remaining words */
while (count < msg->size) {
MU_SendMessage(base, count % MU_TR_COUNT,
msg->DATA.u32[count - 1]);
count++;
}
}
#
# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
BL31_SOURCES += plat/imx/common/sci/ipc.c \
plat/imx/common/sci/imx8_mu.c \
plat/imx/common/sci/svc/pad/pad_rpc_clnt.c \
plat/imx/common/sci/svc/pm/pm_rpc_clnt.c \
plat/imx/common/sci/svc/rm/rm_rpc_clnt.c
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* File containing client-side RPC functions for the PAD service. These
* functions are ported to clients that communicate to the SC.
*
* @addtogroup PAD_SVC
* @{
*/
/* Includes */
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
#include <sci/svc/pad/sci_pad_api.h>
#include <sci/sci_rpc.h>
#include <stdlib.h>
#include "sci_pad_rpc.h"
/* Local Defines */
/* Local Types */
/* 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_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_MUX;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_U8(&msg, 2U) = (uint8_t)mux;
RPC_U8(&msg, 3U) = (uint8_t)config;
RPC_U8(&msg, 4U) = (uint8_t)iso;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_MUX;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (mux != NULL) {
*mux = RPC_U8(&msg, 0U);
}
if (config != NULL) {
*config = RPC_U8(&msg, 1U);
}
if (iso != NULL) {
*iso = RPC_U8(&msg, 2U);
}
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_GP;
RPC_U32(&msg, 0U) = (uint32_t)ctrl;
RPC_U16(&msg, 4U) = (uint16_t)pad;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_GP;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (ctrl != NULL) {
*ctrl = RPC_U32(&msg, 0U);
}
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_WAKEUP;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_U8(&msg, 2U) = (uint8_t)wakeup;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t *wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_WAKEUP;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (wakeup != NULL) {
*wakeup = RPC_U8(&msg, 0U);
}
return (sc_err_t)result;
}
sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux,
sc_pad_config_t config, sc_pad_iso_t iso, uint32_t ctrl,
sc_pad_wakeup_t wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_ALL;
RPC_U32(&msg, 0U) = (uint32_t)ctrl;
RPC_U16(&msg, 4U) = (uint16_t)pad;
RPC_U8(&msg, 6U) = (uint8_t)mux;
RPC_U8(&msg, 7U) = (uint8_t)config;
RPC_U8(&msg, 8U) = (uint8_t)iso;
RPC_U8(&msg, 9U) = (uint8_t)wakeup;
RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux,
sc_pad_config_t *config, sc_pad_iso_t *iso,
uint32_t *ctrl, sc_pad_wakeup_t *wakeup)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_ALL;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (ctrl != NULL) {
*ctrl = RPC_U32(&msg, 0U);
}
result = RPC_R8(&msg);
if (mux != NULL) {
*mux = RPC_U8(&msg, 4U);
}
if (config != NULL) {
*config = RPC_U8(&msg, 5U);
}
if (iso != NULL) {
*iso = RPC_U8(&msg, 6U);
}
if (wakeup != NULL) {
*wakeup = RPC_U8(&msg, 7U);
}
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET;
RPC_U32(&msg, 0U) = (uint32_t)val;
RPC_U16(&msg, 4U) = (uint16_t)pad;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (val != NULL) {
*val = RPC_U32(&msg, 0U);
}
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad,
sc_pad_28fdsoi_dse_t dse, sc_pad_28fdsoi_ps_t ps)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_GP_28FDSOI;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_U8(&msg, 2U) = (uint8_t)dse;
RPC_U8(&msg, 3U) = (uint8_t)ps;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_GP_28FDSOI;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (dse != NULL) {
*dse = RPC_U8(&msg, 0U);
}
if (ps != NULL) {
*ps = RPC_U8(&msg, 1U);
}
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_pad_28fdsoi_dse_t dse, sc_bool_t hys,
sc_pad_28fdsoi_pus_t pus, sc_bool_t pke,
sc_bool_t pue)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_GP_28FDSOI_HSIC;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_U8(&msg, 2U) = (uint8_t)dse;
RPC_U8(&msg, 3U) = (uint8_t)pus;
RPC_U8(&msg, 4U) = (uint8_t)hys;
RPC_U8(&msg, 5U) = (uint8_t)pke;
RPC_U8(&msg, 6U) = (uint8_t)pue;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pad_get_gp_28fdsoi_hsic(sc_ipc_t ipc, sc_pad_t pad,
sc_pad_28fdsoi_dse_t *dse, sc_bool_t *hys,
sc_pad_28fdsoi_pus_t *pus, sc_bool_t *pke,
sc_bool_t *pue)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_GP_28FDSOI_HSIC;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (dse != NULL) {
*dse = RPC_U8(&msg, 0U);
}
if (pus != NULL) {
*pus = RPC_U8(&msg, 1U);
}
if (hys != NULL) {
*hys = RPC_U8(&msg, 2U);
}
if (pke != NULL) {
*pke = RPC_U8(&msg, 3U);
}
if (pue != NULL) {
*pue = RPC_U8(&msg, 4U);
}
return (sc_err_t)result;
}
sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad,
uint8_t compen, sc_bool_t fastfrz,
uint8_t rasrcp, uint8_t rasrcn,
sc_bool_t nasrc_sel, sc_bool_t psw_ovr)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_SET_GP_28FDSOI_COMP;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_U8(&msg, 2U) = (uint8_t)compen;
RPC_U8(&msg, 3U) = (uint8_t)rasrcp;
RPC_U8(&msg, 4U) = (uint8_t)rasrcn;
RPC_U8(&msg, 5U) = (uint8_t)fastfrz;
RPC_U8(&msg, 6U) = (uint8_t)nasrc_sel;
RPC_U8(&msg, 7U) = (uint8_t)psw_ovr;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PAD;
RPC_FUNC(&msg) = (uint8_t)PAD_FUNC_GET_GP_28FDSOI_COMP;
RPC_U16(&msg, 0U) = (uint16_t)pad;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (compen != NULL) {
*compen = RPC_U8(&msg, 0U);
}
if (rasrcp != NULL) {
*rasrcp = RPC_U8(&msg, 1U);
}
if (rasrcn != NULL) {
*rasrcn = RPC_U8(&msg, 2U);
}
if (nasrc != NULL) {
*nasrc = RPC_U8(&msg, 3U);
}
if (fastfrz != NULL) {
*fastfrz = RPC_U8(&msg, 4U);
}
if (nasrc_sel != NULL) {
*nasrc_sel = RPC_U8(&msg, 5U);
}
if (compok != NULL) {
*compok = RPC_U8(&msg, 6U);
}
if (psw_ovr != NULL) {
*psw_ovr = RPC_U8(&msg, 7U);
}
return (sc_err_t)result;
}
/**@}*/
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file for the PAD RPC implementation.
*
* @addtogroup PAD_SVC
* @{
*/
#ifndef SC_PAD_RPC_H
#define SC_PAD_RPC_H
/* Includes */
/* Defines */
/*!
* @name Defines for RPC PAD function calls
*/
/*@{*/
#define PAD_FUNC_UNKNOWN 0 /* Unknown function */
#define PAD_FUNC_SET_MUX 1U /* Index for pad_set_mux() RPC call */
#define PAD_FUNC_GET_MUX 6U /* Index for pad_get_mux() RPC call */
#define PAD_FUNC_SET_GP 2U /* Index for pad_set_gp() RPC call */
#define PAD_FUNC_GET_GP 7U /* Index for pad_get_gp() RPC call */
#define PAD_FUNC_SET_WAKEUP 4U /* Index for pad_set_wakeup() RPC call */
#define PAD_FUNC_GET_WAKEUP 9U /* Index for pad_get_wakeup() RPC call */
#define PAD_FUNC_SET_ALL 5U /* Index for pad_set_all() RPC call */
#define PAD_FUNC_GET_ALL 10U /* Index for pad_get_all() RPC call */
#define PAD_FUNC_SET 15U /* Index for pad_set() RPC call */
#define PAD_FUNC_GET 16U /* Index for pad_get() RPC call */
#define PAD_FUNC_SET_GP_28FDSOI 11U /* Index for pad_set_gp_28fdsoi() RPC call */
#define PAD_FUNC_GET_GP_28FDSOI 12U /* Index for pad_get_gp_28fdsoi() RPC call */
#define PAD_FUNC_SET_GP_28FDSOI_HSIC 3U /* Index for pad_set_gp_28fdsoi_hsic() RPC call */
#define PAD_FUNC_GET_GP_28FDSOI_HSIC 8U /* Index for pad_get_gp_28fdsoi_hsic() RPC call */
#define PAD_FUNC_SET_GP_28FDSOI_COMP 13U /* Index for pad_set_gp_28fdsoi_comp() RPC call */
#define PAD_FUNC_GET_GP_28FDSOI_COMP 14U /* Index for pad_get_gp_28fdsoi_comp() RPC call */
/*@}*/
/* Types */
/* Functions */
/*!
* This function dispatches an incoming PAD RPC request.
*
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
void pad_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
/*!
* This function translates and dispatches an PAD RPC request.
*
* @param[in] ipc IPC handle
* @param[in] msg pointer to RPC message
*/
void pad_xlate(sc_ipc_t ipc, sc_rpc_msg_t *msg);
#endif /* SC_PAD_RPC_H */
/**@}*/
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* File containing client-side RPC functions for the PM service. These
* functions are ported to clients that communicate to the SC.
*
* @addtogroup PM_SVC
* @{
*/
/* Includes */
#include <sci/sci_types.h>
#include <sci/svc/rm/sci_rm_api.h>
#include <sci/svc/pm/sci_pm_api.h>
#include <sci/sci_rpc.h>
#include <stdlib.h>
#include "sci_pm_rpc.h"
/* Local Defines */
/* Local Types */
/* Local Functions */
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_SYS_POWER_MODE;
RPC_U8(&msg, 0U) = (uint8_t)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_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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_PARTITION_POWER_MODE;
RPC_U8(&msg, 0U) = (uint8_t)pt;
RPC_U8(&msg, 1U) = (uint8_t)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_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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_GET_SYS_POWER_MODE;
RPC_U8(&msg, 0U) = (uint8_t)pt;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (mode != NULL) {
*mode = RPC_U8(&msg, 0U);
}
return (sc_err_t)result;
}
sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_RESOURCE_POWER_MODE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)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_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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_GET_RESOURCE_POWER_MODE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (mode != NULL) {
*mode = RPC_U8(&msg, 0U);
}
return (sc_err_t)result;
}
sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t mode)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_REQ_LOW_POWER_MODE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)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_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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_REQ_CPU_LOW_POWER_MODE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)mode;
RPC_U8(&msg, 3U) = (uint8_t)wake_src;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
sc_faddr_t address)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_CPU_RESUME_ADDR;
RPC_U32(&msg, 0U) = (uint32_t)(address >> 32U);
RPC_U32(&msg, 4U) = (uint32_t)address;
RPC_U16(&msg, 8U) = (uint16_t)resource;
RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_CPU_RESUME;
RPC_U32(&msg, 0U) = (uint32_t)(address >> 32U);
RPC_U32(&msg, 4U) = (uint32_t)address;
RPC_U16(&msg, 8U) = (uint16_t)resource;
RPC_U8(&msg, 10U) = (uint8_t)isPrimary;
RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_REQ_SYS_IF_POWER_MODE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)sys_if;
RPC_U8(&msg, 3U) = (uint8_t)hpm;
RPC_U8(&msg, 4U) = (uint8_t)lpm;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_CLOCK_RATE;
RPC_U32(&msg, 0U) = *(uint32_t *)rate;
RPC_U16(&msg, 4U) = (uint16_t)resource;
RPC_U8(&msg, 6U) = (uint8_t)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;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_GET_CLOCK_RATE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)clk;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
if (rate != NULL) {
*rate = RPC_U32(&msg, 0U);
}
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_clk_t clk, sc_bool_t enable, sc_bool_t autog)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_CLOCK_ENABLE;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)clk;
RPC_U8(&msg, 3U) = (uint8_t)enable;
RPC_U8(&msg, 4U) = (uint8_t)autog;
RPC_SIZE(&msg) = 3U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_SET_CLOCK_PARENT;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)clk;
RPC_U8(&msg, 3U) = (uint8_t)parent;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_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;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_GET_CLOCK_PARENT;
RPC_U16(&msg, 0U) = (uint16_t)resource;
RPC_U8(&msg, 2U) = (uint8_t)clk;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (parent != NULL) {
*parent = RPC_U8(&msg, 0U);
}
return (sc_err_t)result;
}
sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_RESET;
RPC_U8(&msg, 0U) = (uint8_t)type;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_RESET_REASON;
RPC_SIZE(&msg) = 1U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
if (reason != NULL) {
*reason = RPC_U8(&msg, 0U);
}
return (sc_err_t)result;
}
sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt,
sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
sc_rsrc_t resource_mu, sc_rsrc_t resource_dev)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_BOOT;
RPC_U32(&msg, 0U) = (uint32_t)(boot_addr >> 32U);
RPC_U32(&msg, 4U) = (uint32_t)boot_addr;
RPC_U16(&msg, 8U) = (uint16_t)resource_cpu;
RPC_U16(&msg, 10U) = (uint16_t)resource_mu;
RPC_U16(&msg, 12U) = (uint16_t)resource_dev;
RPC_U8(&msg, 14U) = (uint8_t)pt;
RPC_SIZE(&msg) = 5U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
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_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_REBOOT;
RPC_U8(&msg, 0U) = (uint8_t)type;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_TRUE);
return;
}
sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt,
sc_pm_reset_type_t type)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_REBOOT_PARTITION;
RPC_U8(&msg, 0U) = (uint8_t)pt;
RPC_U8(&msg, 1U) = (uint8_t)type;
RPC_SIZE(&msg) = 2U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
sc_faddr_t address)
{
sc_rpc_msg_t msg;
uint8_t result;
RPC_VER(&msg) = SC_RPC_VERSION;
RPC_SVC(&msg) = (uint8_t)SC_RPC_SVC_PM;
RPC_FUNC(&msg) = (uint8_t)PM_FUNC_CPU_START;
RPC_U32(&msg, 0U) = (uint32_t)(address >> 32U);
RPC_U32(&msg, 4U) = (uint32_t)address;
RPC_U16(&msg, 8U) = (uint16_t)resource;
RPC_U8(&msg, 10U) = (uint8_t)enable;
RPC_SIZE(&msg) = 4U;
sc_call_rpc(ipc, &msg, SC_FALSE);
result = RPC_R8(&msg);
return (sc_err_t)result;
}
/**@}*/
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file for the PM RPC implementation.
*
* @addtogroup PM_SVC
* @{
*/
#ifndef SC_PM_RPC_H
#define SC_PM_RPC_H
/* Includes */
/* Defines */
/*!
* @name Defines for RPC PM function calls
*/
/*@{*/
#define PM_FUNC_UNKNOWN 0 /* Unknown function */
#define PM_FUNC_SET_SYS_POWER_MODE 19U /* Index for pm_set_sys_power_mode() RPC call */
#define PM_FUNC_SET_PARTITION_POWER_MODE 1U /* Index for pm_set_partition_power_mode() RPC call */
#define PM_FUNC_GET_SYS_POWER_MODE 2U /* Index for pm_get_sys_power_mode() RPC call */
#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U /* Index for pm_set_resource_power_mode() RPC call */
#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U /* Index for pm_get_resource_power_mode() RPC call */
#define PM_FUNC_REQ_LOW_POWER_MODE 16U /* Index for pm_req_low_power_mode() RPC call */
#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U /* Index for pm_req_cpu_low_power_mode() RPC call */
#define PM_FUNC_SET_CPU_RESUME_ADDR 17U /* Index for pm_set_cpu_resume_addr() RPC call */
#define PM_FUNC_SET_CPU_RESUME 21U /* Index for pm_set_cpu_resume() RPC call */
#define PM_FUNC_REQ_SYS_IF_POWER_MODE 18U /* Index for pm_req_sys_if_power_mode() RPC call */
#define PM_FUNC_SET_CLOCK_RATE 5U /* Index for pm_set_clock_rate() RPC call */
#define PM_FUNC_GET_CLOCK_RATE 6U /* Index for pm_get_clock_rate() RPC call */
#define PM_FUNC_CLOCK_ENABLE 7U /* Index for pm_clock_enable() RPC call */
#define PM_FUNC_SET_CLOCK_PARENT 14U /* Index for pm_set_clock_parent() RPC call */
#define PM_FUNC_GET_CLOCK_PARENT 15U /* Index for pm_get_clock_parent() RPC call */
#define PM_FUNC_RESET 13U /* Index for pm_reset() RPC call */
#define PM_FUNC_RESET_REASON 10U /* Index for pm_reset_reason() RPC call */
#define PM_FUNC_BOOT 8U /* Index for pm_boot() RPC call */
#define PM_FUNC_REBOOT 9U /* Index for pm_reboot() RPC call */
#define PM_FUNC_REBOOT_PARTITION 12U /* Index for pm_reboot_partition() RPC call */
#define PM_FUNC_CPU_START 11U /* Index for pm_cpu_start() RPC call */
/*@}*/
/* Types */
/* Functions */
/*!
* This function dispatches an incoming PM RPC request.
*
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
void pm_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
/*!
* This function translates and dispatches an PM RPC request.
*
* @param[in] ipc IPC handle
* @param[in] msg pointer to RPC message
*/
void pm_xlate(sc_ipc_t ipc, sc_rpc_msg_t *msg);
#endif /* SC_PM_RPC_H */
/**@}*/
This diff is collapsed.
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*!
* Header file for the RM RPC implementation.
*
* @addtogroup RM_SVC
* @{
*/
#ifndef SC_RM_RPC_H
#define SC_RM_RPC_H
/* Includes */
/* Defines */
/*!
* @name Defines for RPC RM function calls
*/
/*@{*/
#define RM_FUNC_UNKNOWN 0 /* Unknown function */
#define RM_FUNC_PARTITION_ALLOC 1U /* Index for rm_partition_alloc() RPC call */
#define RM_FUNC_SET_CONFIDENTIAL 31U /* Index for rm_set_confidential() RPC call */
#define RM_FUNC_PARTITION_FREE 2U /* Index for rm_partition_free() RPC call */
#define RM_FUNC_GET_DID 26U /* Index for rm_get_did() RPC call */
#define RM_FUNC_PARTITION_STATIC 3U /* Index for rm_partition_static() RPC call */
#define RM_FUNC_PARTITION_LOCK 4U /* Index for rm_partition_lock() RPC call */
#define RM_FUNC_GET_PARTITION 5U /* Index for rm_get_partition() RPC call */
#define RM_FUNC_SET_PARENT 6U /* Index for rm_set_parent() RPC call */
#define RM_FUNC_MOVE_ALL 7U /* Index for rm_move_all() RPC call */
#define RM_FUNC_ASSIGN_RESOURCE 8U /* Index for rm_assign_resource() RPC call */
#define RM_FUNC_SET_RESOURCE_MOVABLE 9U /* Index for rm_set_resource_movable() RPC call */
#define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U /* Index for rm_set_subsys_rsrc_movable() RPC call */
#define RM_FUNC_SET_MASTER_ATTRIBUTES 10U /* Index for rm_set_master_attributes() RPC call */
#define RM_FUNC_SET_MASTER_SID 11U /* Index for rm_set_master_sid() RPC call */
#define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U /* Index for rm_set_peripheral_permissions() RPC call */
#define RM_FUNC_IS_RESOURCE_OWNED 13U /* Index for rm_is_resource_owned() RPC call */
#define RM_FUNC_IS_RESOURCE_MASTER 14U /* Index for rm_is_resource_master() RPC call */
#define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U /* Index for rm_is_resource_peripheral() RPC call */
#define RM_FUNC_GET_RESOURCE_INFO 16U /* Index for rm_get_resource_info() RPC call */
#define RM_FUNC_MEMREG_ALLOC 17U /* Index for rm_memreg_alloc() RPC call */
#define RM_FUNC_MEMREG_SPLIT 29U /* Index for rm_memreg_split() RPC call */
#define RM_FUNC_MEMREG_FREE 18U /* Index for rm_memreg_free() RPC call */
#define RM_FUNC_FIND_MEMREG 30U /* Index for rm_find_memreg() RPC call */
#define RM_FUNC_ASSIGN_MEMREG 19U /* Index for rm_assign_memreg() RPC call */
#define RM_FUNC_SET_MEMREG_PERMISSIONS 20U /* Index for rm_set_memreg_permissions() RPC call */
#define RM_FUNC_IS_MEMREG_OWNED 21U /* Index for rm_is_memreg_owned() RPC call */
#define RM_FUNC_GET_MEMREG_INFO 22U /* Index for rm_get_memreg_info() RPC call */
#define RM_FUNC_ASSIGN_PAD 23U /* Index for rm_assign_pad() RPC call */
#define RM_FUNC_SET_PAD_MOVABLE 24U /* Index for rm_set_pad_movable() RPC call */
#define RM_FUNC_IS_PAD_OWNED 25U /* Index for rm_is_pad_owned() RPC call */
#define RM_FUNC_DUMP 27U /* Index for rm_dump() RPC call */
/*@}*/
/* Types */
/* Functions */
/*!
* This function dispatches an incoming RM RPC request.
*
* @param[in] caller_pt caller partition
* @param[in] msg pointer to RPC message
*/
void rm_dispatch(sc_rm_pt_t caller_pt, sc_rpc_msg_t *msg);
/*!
* This function translates and dispatches an RM RPC request.
*
* @param[in] ipc IPC handle
* @param[in] msg pointer to RPC message
*/
void rm_xlate(sc_ipc_t ipc, sc_rpc_msg_t *msg);
#endif /* SC_RM_RPC_H */
/**@}*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment