tz_iccc.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * @file tz_iccc.h
  3. * @brief header file for kernel tz_iccc
  4. * Copyright (c) 2015, Samsung Electronics Corporation. All rights reserved.
  5. */
  6. #ifndef TZ_ICCC_H
  7. #define TZ_ICCC_H
  8. /* ICCC Implementation in Kernel */
  9. #define MIN_PADDING_NEEDED 9
  10. /* ICCC TZApp name */
  11. #define ICCC_TZAPP_NAME "tz_iccc"
  12. /* Defining ICCC related CMD IDs for TZ communication*/
  13. #define CMD_ICCC_INIT 0x00000001
  14. #define CMD_ICCC_SAVEDATA_KERN 0x00000002
  15. #define CMD_ICCC_READDATA_KERN 0x00000003
  16. /* Buffer length to be used for ICCC TZ communication*/
  17. #define ICCC_QSEE_BUFFER_LENGTH 1024
  18. /* QSEECOM driver related MACROS*/
  19. #define QSEECOM_ALIGN_SIZE 0x40
  20. #define QSEECOM_ALIGN_MASK (QSEECOM_ALIGN_SIZE - 1)
  21. #define QSEECOM_ALIGN(x) \
  22. ((x + QSEECOM_ALIGN_SIZE) & (~QSEECOM_ALIGN_MASK))
  23. /* structures for ICCC QSEE communication*/
  24. typedef struct tz_msg_header {
  25. /* * First 4 bytes should always be id: either cmd_id or resp_id */
  26. uint32_t id;
  27. uint32_t content_id;
  28. uint32_t len;
  29. uint32_t status;
  30. } __attribute__ ((packed)) tz_msg_header_t;
  31. typedef struct iccc_req_s {
  32. uint32_t cmd_id;
  33. uint32_t type;
  34. uint32_t value;
  35. uint32_t padding[MIN_PADDING_NEEDED]; //only padding , just to make tciMessage_t's size >= 64
  36. } __attribute__ ((packed)) iccc_req_t;
  37. typedef struct iccc_rsp_s {
  38. uint32_t cmd_id;
  39. uint32_t type;
  40. uint32_t value;
  41. int ret;
  42. } __attribute__ ((packed)) iccc_rsp_t;
  43. typedef struct {
  44. union content_u {
  45. iccc_req_t iccc_req;
  46. iccc_rsp_t iccc_rsp;
  47. } __attribute__ ((packed)) content;
  48. } __attribute__ ((packed)) tima_iccc_generic_payload_t;
  49. typedef struct {
  50. tz_msg_header_t header;
  51. union payload_u {
  52. tima_iccc_generic_payload_t generic;
  53. } __attribute__ ((packed)) payload;
  54. } __attribute__ ((packed)) tima_iccc_message_t;
  55. typedef tima_iccc_message_t tciMessage_t;
  56. /* structures for QSEECOM driver interaction*/
  57. struct qseecom_handle {
  58. void *dev; /* in/out */
  59. unsigned char *sbuf; /* in/out */
  60. uint32_t sbuf_len; /* in/out */
  61. };
  62. /* declaring QSEECOM driver related functions*/
  63. extern int qseecom_start_app(struct qseecom_handle **handle, char *app_name, uint32_t size);
  64. extern int qseecom_shutdown_app(struct qseecom_handle **handle);
  65. extern int qseecom_send_command(struct qseecom_handle *handle, void *send_buf, uint32_t sbuf_len, void *resp_buf, uint32_t rbuf_len);
  66. extern int qseecom_set_bandwidth(struct qseecom_handle *handle, bool high);
  67. #endif /* TIMA_UEVENT_H */