enum scmi_optee_pta_cmd { /* * PTA_SCMI_CMD_CAPABILITIES - Get channel capabilities * * [out] value[0].a: Capability bit mask (enum pta_scmi_caps) * [out] value[0].b: Extended capabilities or 0
*/
PTA_SCMI_CMD_CAPABILITIES = 0,
/* * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL - Process SCMI message in SMT buffer * * [in] value[0].a: Channel handle * * Shared memory used for SCMI message/response exhange is expected * already identified and bound to channel handle in both SCMI agent * and SCMI server (OP-TEE) parts. * The memory uses SMT header to carry SCMI meta-data (protocol ID and * protocol message ID).
*/
PTA_SCMI_CMD_PROCESS_SMT_CHANNEL = 1,
/* * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE - Process SMT/SCMI message * * [in] value[0].a: Channel handle * [in/out] memref[1]: Message/response buffer (SMT and SCMI payload) * * Shared memory used for SCMI message/response is a SMT buffer * referenced by param[1]. It shall be 128 bytes large to fit response * payload whatever message playload size. * The memory uses SMT header to carry SCMI meta-data (protocol ID and * protocol message ID).
*/
PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE = 2,
/* * PTA_SCMI_CMD_GET_CHANNEL - Get channel handle * * SCMI shm information are 0 if agent expects to use OP-TEE regular SHM * * [in] value[0].a: Channel identifier * [out] value[0].a: Returned channel handle * [in] value[0].b: Requested capabilities mask (enum pta_scmi_caps)
*/
PTA_SCMI_CMD_GET_CHANNEL = 3,
/* * PTA_SCMI_CMD_PROCESS_MSG_CHANNEL - Process SCMI message in a MSG * buffer pointed by memref parameters * * [in] value[0].a: Channel handle * [in] memref[1]: Message buffer (MSG and SCMI payload) * [out] memref[2]: Response buffer (MSG and SCMI payload) * * Shared memories used for SCMI message/response are MSG buffers * referenced by param[1] and param[2]. MSG transport protocol * uses a 32bit header to carry SCMI meta-data (protocol ID and * protocol message ID) followed by the effective SCMI message * payload.
*/
PTA_SCMI_CMD_PROCESS_MSG_CHANNEL = 4,
};
/* * OP-TEE SCMI service capabilities bit flags (32bit) * * PTA_SCMI_CAPS_SMT_HEADER * When set, OP-TEE supports command using SMT header protocol (SCMI shmem) in * shared memory buffers to carry SCMI protocol synchronisation information. * * PTA_SCMI_CAPS_MSG_HEADER * When set, OP-TEE supports command using MSG header protocol in an OP-TEE * shared memory to carry SCMI protocol synchronisation information and SCMI * message payload.
*/ #define PTA_SCMI_CAPS_NONE 0 #define PTA_SCMI_CAPS_SMT_HEADER BIT(0) #define PTA_SCMI_CAPS_MSG_HEADER BIT(1) #define PTA_SCMI_CAPS_MASK (PTA_SCMI_CAPS_SMT_HEADER | \
PTA_SCMI_CAPS_MSG_HEADER)
/** * struct scmi_optee_channel - Description of an OP-TEE SCMI channel * * @channel_id: OP-TEE channel ID used for this transport * @tee_session: TEE session identifier * @caps: OP-TEE SCMI channel capabilities * @rx_len: Response size * @mu: Mutex protection on channel access * @cinfo: SCMI channel information * @req: union for SCMI interface * @req.shmem: Virtual base address of the shared memory * @req.msg: Shared memory protocol handle for SCMI request and * synchronous response * @io_ops: Transport specific I/O operations * @tee_shm: TEE shared memory handle @req or NULL if using IOMEM shmem * @link: Reference in agent's channel list
*/ struct scmi_optee_channel {
u32 channel_id;
u32 tee_session;
u32 caps;
u32 rx_len; struct mutex mu; struct scmi_chan_info *cinfo; union { struct scmi_shared_mem __iomem *shmem; struct scmi_msg_payld *msg;
} req; struct scmi_shmem_io_ops *io_ops; struct tee_shm *tee_shm; struct list_head link;
};
/** * struct scmi_optee_agent - OP-TEE transport private data * * @dev: Device used for communication with TEE * @tee_ctx: TEE context used for communication * @caps: Supported channel capabilities * @mu: Mutex for protection of @channel_list * @channel_list: List of all created channels for the agent
*/ struct scmi_optee_agent { struct device *dev; struct tee_context *tee_ctx;
u32 caps; struct mutex mu; struct list_head channel_list;
};
ret = setup_shmem(dev, cinfo, channel); if (ret) return ret;
ret = open_session(scmi_optee_private, &channel->tee_session); if (ret) goto err_free_shm;
ret = tee_client_system_session(scmi_optee_private->tee_ctx, channel->tee_session); if (ret)
dev_warn(dev, "Could not switch to system session, do best effort\n");
ret = get_channel(channel); if (ret) goto err_close_sess;
/* Only one SCMI OP-TEE device allowed */ if (scmi_optee_private) {
dev_err(dev, "An SCMI OP-TEE device was already initialized: only one allowed\n"); return -EBUSY;
}
tee_ctx = tee_client_open_context(NULL, scmi_optee_ctx_match, NULL, NULL); if (IS_ERR(tee_ctx)) return -ENODEV;
agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); if (!agent) {
ret = -ENOMEM; goto err;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.