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