xref: /rk3399_ARM-atf/drivers/ti/ti_sci/ti_sci_transport.h (revision 7bff7bf968f9f27d95f0622116aa8e9485577039)
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 k3_sec_proxy_chan_id - Secure Proxy thread IDs
16  *
17  * These the available IDs used in k3_sec_proxy_{send,recv}()
18  * There are two schemes we use:
19  * * if K3_SEC_PROXY_LITE = 1, we just have two threads to talk
20  * * if K3_SEC_PROXY_LITE = 0, we have the full fledged
21  *   communication scheme available.
22  */
23 enum k3_sec_proxy_chan_id {
24 #if !K3_SEC_PROXY_LITE
25 	SP_NOTIFY = 0,
26 	SP_RESPONSE,
27 	SP_HIGH_PRIORITY,
28 	SP_LOW_PRIORITY,
29 	SP_NOTIFY_RESP,
30 #else
31 	SP_RESPONSE = 8,
32 	/*
33 	 * Note: TISCI documentation indicates "low priority", but in reality
34 	 * with a single thread, there is no low or high priority.. This usage
35 	 * is more appropriate for TF-A since we can reduce the churn as a
36 	 * result.
37 	 */
38 	SP_HIGH_PRIORITY,
39 #endif /* K3_SEC_PROXY_LITE */
40 };
41 
42 /**
43  * struct ti_sci_msg - Secure proxy message structure
44  * @len: Length of data in the Buffer
45  * @buf: Buffer pointer
46  *
47  * This is the structure for data used in ti_sci_transport_{send,recv}()
48  */
49 struct ti_sci_msg {
50 	size_t len;
51 	uint8_t *buf;
52 };
53 
54 /**
55  * ti_sci_transport_clear_rx_thread() - Clear a receive Secure Proxy thread
56  * @id: Channel Identifier
57  * @msg: Pointer to ti_sci_msg
58  *
59  * Return: 0 if all goes well, else appropriate error message
60  */
61 int ti_sci_transport_clear_rx_thread(enum k3_sec_proxy_chan_id id);
62 
63 /**
64  * ti_sci_transport_send() - Send data over mailbox/ Secure Proxy thread
65  * @id: Channel Identifier
66  * @msg: Pointer to ti_sci_msg
67  *
68  * Return: 0 if all goes well, else appropriate error message
69  */
70 int ti_sci_transport_send(enum k3_sec_proxy_chan_id id, const struct ti_sci_msg *msg);
71 
72 /**
73  * ti_sci_transport_recv() - Receive data from a Secure Proxy thread/ mailbox
74  * @id: Channel Identifier
75  * @msg: Pointer to ti_sci_msg
76  *
77  * Return: 0 if all goes well, else appropriate error message
78  */
79 int ti_sci_transport_recv(enum k3_sec_proxy_chan_id id, struct ti_sci_msg *msg);
80 
81 #endif /* TI_SCI_TRANSPORT_H */
82