1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2022-2024, Linaro Limited and Contributors. All rights 4 * reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef MOD_OPTEE_SMT_H 10 #define MOD_OPTEE_SMT_H 11 12 #include <fwk_id.h> 13 #include <fwk_module_idx.h> 14 15 #include <stddef.h> 16 #include <stdint.h> 17 18 /*! 19 * \name Channel policies 20 * 21 * \details These policies define attributes that affect how the channel is 22 * treated by the SMT component. 23 * 24 * \{ 25 */ 26 27 /*! No policies */ 28 #define MOD_SMT_POLICY_NONE 0 29 30 /*! This channel is secure */ 31 #define MOD_SMT_POLICY_SECURE (1U << 0) 32 33 /*! The mailbox for this channel requires initialization */ 34 #define MOD_SMT_POLICY_INIT_MAILBOX (1U << 1) 35 36 /*! 37 * \} 38 */ 39 40 /*! 41 * \brief Channel type 42 * 43 * \details Defines the role of an entity in a channel 44 */ 45 enum mod_optee_smt_channel_type { 46 /*! Requester channel */ 47 MOD_OPTEE_SMT_CHANNEL_TYPE_REQUESTER, 48 49 /*! Completer channel */ 50 MOD_OPTEE_SMT_CHANNEL_TYPE_COMPLETER, 51 52 /*! Channel type count */ 53 MOD_OPTEE_SMT_CHANNEL_TYPE_COUNT, 54 }; 55 56 /*! 57 * \brief Channel config. 58 */ 59 struct mod_optee_smt_channel_config { 60 /*! Channel role (requester or completer) */ 61 enum mod_optee_smt_channel_type type; 62 63 /*! Channel policies */ 64 uint32_t policies; 65 66 /*! Shared mailbox address */ 67 uintptr_t mailbox_address; 68 69 /*! Shared mailbox size in bytes */ 70 size_t mailbox_size; 71 72 /*! Identifier of the driver */ 73 fwk_id_t driver_id; 74 75 /*! Identifier of the driver API to bind to */ 76 fwk_id_t driver_api_id; 77 }; 78 79 /*! 80 * \brief Driver API 81 */ 82 struct mod_optee_smt_driver_api { 83 /*! 84 * \brief Raise an interrupt on the receiver 85 * 86 * \param device_id Device identifier 87 * 88 * \retval ::FWK_SUCCESS The operation succeeded 89 * \retval ::FWK_E_PARAM The device_id parameter is invalid 90 * \return One of the standard error codes for implementation-defined 91 * errors 92 */ 93 int (*raise_interrupt)(fwk_id_t device_id); 94 }; 95 96 /*! 97 * \brief Driver input API (Implemented by SMT) 98 * 99 * \details Interface used for driver -> SMT communication. 100 */ 101 struct mod_optee_smt_driver_input_api { 102 /*! 103 * \brief Signal an incoming message in the mailbox 104 * 105 * \param device_id Channel identifier 106 * 107 * \retval ::FWK_SUCCESS The operation succeeded. 108 * \return One of the standard error codes for implementation-defined 109 * errors. 110 */ 111 int (*signal_message)(fwk_id_t channel_id); 112 }; 113 114 /*! 115 * \brief Type of the interfaces exposed by the power domain module. 116 */ 117 enum mod_optee_smt_api_idx { 118 MOD_OPTEE_SMT_API_IDX_DRIVER_INPUT, 119 MOD_OPTEE_SMT_API_IDX_SCMI_TRANSPORT, 120 MOD_OPTEE_SMT_API_IDX_COUNT, 121 }; 122 123 #endif /* MOD_OPTEE_SMT_H */ 124