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