Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 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 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 10 | #ifndef SEC_PROXY_H |
| 11 | #define SEC_PROXY_H |
Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 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}() |
Nishanth Menon | d32de84 | 2020-12-10 18:39:41 -0600 | [diff] [blame] | 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. |
Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 23 | */ |
| 24 | enum k3_sec_proxy_chan_id { |
Nishanth Menon | d32de84 | 2020-12-10 18:39:41 -0600 | [diff] [blame] | 25 | #if !K3_SEC_PROXY_LITE |
Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 26 | SP_NOTIFY = 0, |
| 27 | SP_RESPONSE, |
| 28 | SP_HIGH_PRIORITY, |
| 29 | SP_LOW_PRIORITY, |
| 30 | SP_NOTIFY_RESP, |
Nishanth Menon | d32de84 | 2020-12-10 18:39:41 -0600 | [diff] [blame] | 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 */ |
Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 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_send() - Send data over a 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 | */ |
Andrew F. Davis | 82a3c1d | 2019-01-04 12:44:00 -0600 | [diff] [blame] | 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 | */ |
Andrew F. Davis | 537d3ff | 2018-05-04 19:06:08 +0000 | [diff] [blame] | 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 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 82 | #endif /* SEC_PROXY_H */ |