xref: /rk3399_ARM-atf/drivers/ti/ti_sci/ti_sci_transport.h (revision 7147732a78852034972b93b87f17838f6aa0f9e5)
1f70572eeSDhruva Gole /*
2f70572eeSDhruva Gole  * Texas Instruments SCI Transport Protocol Header
3f70572eeSDhruva Gole  *
4f70572eeSDhruva Gole  * Copyright (C) 2018-2025 Texas Instruments Incorporated - http://www.ti.com/
5f70572eeSDhruva Gole  *
6f70572eeSDhruva Gole  * SPDX-License-Identifier: BSD-3-Clause
7f70572eeSDhruva Gole  */
8f70572eeSDhruva Gole 
9f70572eeSDhruva Gole #ifndef TI_SCI_TRANSPORT_H
10f70572eeSDhruva Gole #define TI_SCI_TRANSPORT_H
11f70572eeSDhruva Gole 
12f70572eeSDhruva Gole #include <stdint.h>
13f70572eeSDhruva Gole 
14f70572eeSDhruva Gole /**
15*a8de9718SDhruva Gole  * enum ti_sci_transport_chan_id - Secure Proxy thread IDs
16f70572eeSDhruva Gole  *
17*a8de9718SDhruva Gole  * These are the available IDs used in ti_sci_transport_{send,recv}()
18f70572eeSDhruva Gole  */
19*a8de9718SDhruva Gole enum ti_sci_transport_chan_id {
20f70572eeSDhruva Gole #if !K3_SEC_PROXY_LITE
21*a8de9718SDhruva Gole 	RX_SECURE_TRANSPORT_CHANNEL_ID = 1,
22*a8de9718SDhruva Gole 	TX_SECURE_TRANSPORT_CHANNEL_ID,
23f70572eeSDhruva Gole #else
24*a8de9718SDhruva Gole 	RX_SECURE_TRANSPORT_CHANNEL_ID = 8,
25f70572eeSDhruva Gole 	/*
26f70572eeSDhruva Gole 	 * Note: TISCI documentation indicates "low priority", but in reality
27f70572eeSDhruva Gole 	 * with a single thread, there is no low or high priority.. This usage
28f70572eeSDhruva Gole 	 * is more appropriate for TF-A since we can reduce the churn as a
29f70572eeSDhruva Gole 	 * result.
30f70572eeSDhruva Gole 	 */
31*a8de9718SDhruva Gole 	TX_SECURE_TRANSPORT_CHANNEL_ID,
32f70572eeSDhruva Gole #endif /* K3_SEC_PROXY_LITE */
33f70572eeSDhruva Gole };
34f70572eeSDhruva Gole 
35f70572eeSDhruva Gole /**
367bff7bf9SDhruva Gole  * struct ti_sci_msg - Secure proxy message structure
37f70572eeSDhruva Gole  * @len: Length of data in the Buffer
38f70572eeSDhruva Gole  * @buf: Buffer pointer
39f70572eeSDhruva Gole  *
407bff7bf9SDhruva Gole  * This is the structure for data used in ti_sci_transport_{send,recv}()
41f70572eeSDhruva Gole  */
427bff7bf9SDhruva Gole struct ti_sci_msg {
43f70572eeSDhruva Gole 	size_t len;
44f70572eeSDhruva Gole 	uint8_t *buf;
45f70572eeSDhruva Gole };
46f70572eeSDhruva Gole 
47f70572eeSDhruva Gole /**
487bff7bf9SDhruva Gole  * ti_sci_transport_clear_rx_thread() - Clear a receive Secure Proxy thread
49f70572eeSDhruva Gole  * @id: Channel Identifier
507bff7bf9SDhruva Gole  * @msg: Pointer to ti_sci_msg
51f70572eeSDhruva Gole  *
52f70572eeSDhruva Gole  * Return: 0 if all goes well, else appropriate error message
53f70572eeSDhruva Gole  */
54*a8de9718SDhruva Gole int ti_sci_transport_clear_rx_thread(enum ti_sci_transport_chan_id id);
55f70572eeSDhruva Gole 
56f70572eeSDhruva Gole /**
577bff7bf9SDhruva Gole  * ti_sci_transport_send() - Send data over mailbox/ Secure Proxy thread
58f70572eeSDhruva Gole  * @id: Channel Identifier
597bff7bf9SDhruva Gole  * @msg: Pointer to ti_sci_msg
60f70572eeSDhruva Gole  *
61f70572eeSDhruva Gole  * Return: 0 if all goes well, else appropriate error message
62f70572eeSDhruva Gole  */
63*a8de9718SDhruva Gole int ti_sci_transport_send(enum ti_sci_transport_chan_id id, const struct ti_sci_msg *msg);
64f70572eeSDhruva Gole 
65f70572eeSDhruva Gole /**
667bff7bf9SDhruva Gole  * ti_sci_transport_recv() - Receive data from a Secure Proxy thread/ mailbox
67f70572eeSDhruva Gole  * @id: Channel Identifier
687bff7bf9SDhruva Gole  * @msg: Pointer to ti_sci_msg
69f70572eeSDhruva Gole  *
70f70572eeSDhruva Gole  * Return: 0 if all goes well, else appropriate error message
71f70572eeSDhruva Gole  */
72*a8de9718SDhruva Gole int ti_sci_transport_recv(enum ti_sci_transport_chan_id id, struct ti_sci_msg *msg);
73f70572eeSDhruva Gole 
74f70572eeSDhruva Gole #endif /* TI_SCI_TRANSPORT_H */
75