sec_proxy.h 2.1 KB

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