1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2022, Linaro Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Description: 8 * msg buffer device driver. 9 */ 10 11 #ifndef MOD_MSG_SMT_H 12 #define MOD_MSG_SMT_H 13 14 #include <stddef.h> 15 #include <stdint.h> 16 #include <fwk_id.h> 17 18 /*! 19 * @} 20 */ 21 22 /*! 23 * \brief Channel type 24 * 25 * \details Defines the role of an entity in a channel 26 */ 27 enum mod_msg_smt_channel_type { 28 /*! Requester channel */ 29 MOD_MSG_SMT_CHANNEL_TYPE_REQUESTER, 30 31 /*! Completer channel */ 32 MOD_MSG_SMT_CHANNEL_TYPE_COMPLETER, 33 34 /*! Channel type count */ 35 MOD_MSG_SMT_CHANNEL_TYPE_COUNT, 36 }; 37 38 /*! 39 * \brief Channel config. 40 */ 41 struct mod_msg_smt_channel_config { 42 /*! Channel role (requester or completer) */ 43 enum mod_msg_smt_channel_type type; 44 45 /*! Shared mailbox size in bytes */ 46 size_t mailbox_size; 47 48 /*! Identifier of the driver */ 49 fwk_id_t driver_id; 50 51 /*! Identifier of the driver API to bind to */ 52 fwk_id_t driver_api_id; 53 }; 54 55 /*! 56 * \brief Driver input API (Implemented by SMT) 57 * 58 * \details Interface used for driver -> SMT communication. 59 */ 60 struct mod_msg_smt_driver_input_api { 61 /*! 62 * \brief Signal an incoming message in the mailbox 63 * 64 * \param device_id Channel identifier 65 * 66 * \retval FWK_SUCCESS The operation succeeded. 67 * \return One of the standard error codes for implementation-defined 68 * errors. 69 */ 70 int (*signal_message)(fwk_id_t channel_id, void *msg_in, size_t in_len, void *msg_out, size_t out_len); 71 }; 72 73 /*! 74 * \brief Driver output API (Implemented by MHU) 75 * 76 * \details Interface used for SMT -> driver communication. 77 */ 78 struct mod_msg_smt_driver_ouput_api { 79 /*! 80 * \brief Signal an incoming message in the mailbox 81 * 82 * \param device_id Channel identifier 83 * 84 * \retval FWK_SUCCESS The operation succeeded. 85 * \return One of the standard error codes for implementation-defined 86 * errors. 87 */ 88 int (*raise_notification)(fwk_id_t channel_id, size_t size); 89 }; 90 91 /*! 92 * \brief Type of the interfaces exposed by the power domain module. 93 */ 94 enum mod_msg_smt_api_idx { 95 MOD_MSG_SMT_API_IDX_SCMI_TRANSPORT, 96 MOD_MSG_SMT_API_IDX_DRIVER_INPUT, 97 MOD_MSG_SMT_API_IDX_COUNT, 98 }; 99 100 #endif /* MOD_MSG_SMT_H */ 101