1 /* 2 * Texas Instruments K3 Secure Proxy Driver 3 * Based on Linux and U-Boot implementation 4 * 5 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 */ 9 10 #ifndef SEC_PROXY_H 11 #define SEC_PROXY_H 12 13 #include <stdint.h> 14 15 /** 16 * enum k3_sec_proxy_chan_id - Secure Proxy thread IDs 17 * 18 * These the available IDs used in k3_sec_proxy_{send,recv}() 19 * There are two schemes we use: 20 * * if K3_SEC_PROXY_LITE = 1, we just have two threads to talk 21 * * if K3_SEC_PROXY_LITE = 0, we have the full fledged 22 * communication scheme available. 23 */ 24 enum k3_sec_proxy_chan_id { 25 #if !K3_SEC_PROXY_LITE 26 SP_NOTIFY = 0, 27 SP_RESPONSE, 28 SP_HIGH_PRIORITY, 29 SP_LOW_PRIORITY, 30 SP_NOTIFY_RESP, 31 #else 32 SP_RESPONSE = 8, 33 /* 34 * Note: TISCI documentation indicates "low priority", but in reality 35 * with a single thread, there is no low or high priority.. This usage 36 * is more appropriate for TF-A since we can reduce the churn as a 37 * result. 38 */ 39 SP_HIGH_PRIORITY, 40 #endif /* K3_SEC_PROXY_LITE */ 41 }; 42 43 /** 44 * struct k3_sec_proxy_msg - Secure proxy message structure 45 * @len: Length of data in the Buffer 46 * @buf: Buffer pointer 47 * 48 * This is the structure for data used in k3_sec_proxy_{send,recv}() 49 */ 50 struct k3_sec_proxy_msg { 51 size_t len; 52 uint8_t *buf; 53 }; 54 55 /** 56 * k3_sec_proxy_clear_rx_thread() - Clear a receive Secure Proxy thread 57 * @id: Channel Identifier 58 * @msg: Pointer to k3_sec_proxy_msg 59 * 60 * Return: 0 if all goes well, else appropriate error message 61 */ 62 int k3_sec_proxy_clear_rx_thread(enum k3_sec_proxy_chan_id id); 63 64 /** 65 * k3_sec_proxy_send() - Send data over a Secure Proxy thread 66 * @id: Channel Identifier 67 * @msg: Pointer to k3_sec_proxy_msg 68 * 69 * Return: 0 if all goes well, else appropriate error message 70 */ 71 int k3_sec_proxy_send(enum k3_sec_proxy_chan_id id, const struct k3_sec_proxy_msg *msg); 72 73 /** 74 * k3_sec_proxy_recv() - Receive data from a Secure Proxy thread 75 * @id: Channel Identifier 76 * @msg: Pointer to k3_sec_proxy_msg 77 * 78 * Return: 0 if all goes well, else appropriate error message 79 */ 80 int k3_sec_proxy_recv(enum k3_sec_proxy_chan_id id, struct k3_sec_proxy_msg *msg); 81 82 #endif /* SEC_PROXY_H */ 83