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  *     OP-TEE mailbox buffer layer
9  */
10 
11 #ifndef MOD_OPTEE_MBX_H
12 #define MOD_OPTEE_MBX_H
13 
14 /*!
15  * \brief Channel config.
16  */
17 struct mod_optee_mbx_channel_config {
18     /*! Identifier of the driver */
19     fwk_id_t driver_id;
20 
21     /*! Identifier of the driver API to bind to */
22     fwk_id_t driver_api_id;
23 };
24 
25 /*!
26  * \brief Interface to exchange message with OP-TEE
27  */
28 
29 /*!
30  * \brief Return the number of MBX devices registered in the paltform.
31  *
32  * \return Return the number of devices.
33  */
34 int optee_mbx_get_devices_count(void);
35 
36 /*!
37  * \brief Return the framwork ID related to the MBX device identifed by @id.
38  *
39  * \param id Device index.
40  *
41  * \return Return the framwork ID
42  */
43 fwk_id_t optee_mbx_get_device(unsigned int id);
44 
45 /*!
46  * \brief Signal an incoming SCMI message in a static shared memory.
47  *
48  * \param device_id MBX device ID.
49  */
50 void optee_mbx_signal_smt_message(fwk_id_t device_id);
51 
52 /*  */
53 /*!
54  * \brief Signal an incoming SCMI message in an OP-TEE dynamic shared memory.
55  *
56  * \param device_id MBX device ID.
57  * \param in_buf Pointer to the request buffer.
58  * \param in_size Size of the request buffer.
59  * \param out_buf Pointer to the response buffer.
60  * \param out_size Size of the response buffer.
61  */
62 void optee_mbx_signal_msg_message(fwk_id_t device_id,
63                                   void *in_buf, size_t in_size,
64                                   void *out_buf, size_t *out_size);
65 
66 #endif /* MOD_OPTEE_MBX_H */
67