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 | |
| 10 | #ifndef K3_SEC_PROXY_H |
| 11 | #define K3_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 | */ |
| 20 | enum k3_sec_proxy_chan_id { |
| 21 | SP_NOTIFY = 0, |
| 22 | SP_RESPONSE, |
| 23 | SP_HIGH_PRIORITY, |
| 24 | SP_LOW_PRIORITY, |
| 25 | SP_NOTIFY_RESP, |
| 26 | }; |
| 27 | |
| 28 | /** |
| 29 | * struct k3_sec_proxy_msg - Secure proxy message structure |
| 30 | * @len: Length of data in the Buffer |
| 31 | * @buf: Buffer pointer |
| 32 | * |
| 33 | * This is the structure for data used in k3_sec_proxy_{send,recv}() |
| 34 | */ |
| 35 | struct k3_sec_proxy_msg { |
| 36 | size_t len; |
| 37 | uint8_t *buf; |
| 38 | }; |
| 39 | |
| 40 | /** |
| 41 | * k3_sec_proxy_send() - Send data over a Secure Proxy thread |
| 42 | * @id: Channel Identifier |
| 43 | * @msg: Pointer to k3_sec_proxy_msg |
| 44 | * |
| 45 | * Return: 0 if all goes well, else appropriate error message |
| 46 | */ |
| 47 | int k3_sec_proxy_send(enum k3_sec_proxy_chan_id id, const struct k3_sec_proxy_msg *msg); |
| 48 | |
| 49 | /** |
| 50 | * k3_sec_proxy_recv() - Receive data from a Secure Proxy thread |
| 51 | * @id: Channel Identifier |
| 52 | * @msg: Pointer to k3_sec_proxy_msg |
| 53 | * |
| 54 | * Return: 0 if all goes well, else appropriate error message |
| 55 | */ |
| 56 | int k3_sec_proxy_recv(enum k3_sec_proxy_chan_id id, struct k3_sec_proxy_msg *msg); |
| 57 | |
| 58 | #endif /* K3_SEC_PROXY_H */ |