qseecom_api.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2017, 2019, 2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _QSEECOM_API_H_
  7. #define _QSEECOM_API_H_
  8. #pragma message("Warning: This header file will be deprecated in future")
  9. #include <linux/types.h>
  10. #include <linux/ioctl.h>
  11. #include "qseecom.h"
  12. /*
  13. * struct qseecom_register_listener_req -
  14. * for register listener ioctl request
  15. * @listener_id - service id (shared between userspace and QSE)
  16. * @ifd_data_fd - ion handle
  17. * @virt_sb_base - shared buffer base in user space
  18. * @sb_size - shared buffer size
  19. */
  20. struct qseecom_register_listener_req {
  21. __u32 listener_id; /* in */
  22. __s32 ifd_data_fd; /* in */
  23. void *virt_sb_base; /* in */
  24. __u32 sb_size; /* in */
  25. };
  26. /*
  27. * struct qseecom_send_cmd_req - for send command ioctl request
  28. * @cmd_req_len - command buffer length
  29. * @cmd_req_buf - command buffer
  30. * @resp_len - response buffer length
  31. * @resp_buf - response buffer
  32. */
  33. struct qseecom_send_cmd_req {
  34. void *cmd_req_buf; /* in */
  35. unsigned int cmd_req_len; /* in */
  36. void *resp_buf; /* in/out */
  37. unsigned int resp_len; /* in/out */
  38. };
  39. /*
  40. * struct qseecom_send_modfd_cmd_req - for send command ioctl request
  41. * @cmd_req_len - command buffer length
  42. * @cmd_req_buf - command buffer
  43. * @resp_len - response buffer length
  44. * @resp_buf - response buffer
  45. * @ifd_data_fd - ion handle to memory allocated in user space
  46. * @cmd_buf_offset - command buffer offset
  47. */
  48. struct qseecom_send_modfd_cmd_req {
  49. void *cmd_req_buf; /* in */
  50. unsigned int cmd_req_len; /* in */
  51. void *resp_buf; /* in/out */
  52. unsigned int resp_len; /* in/out */
  53. struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
  54. };
  55. /*
  56. * struct qseecom_load_img_data - for sending image length information and
  57. * ion file descriptor to the qseecom driver. ion file descriptor is used
  58. * for retrieving the ion file handle and in turn the physical address of
  59. * the image location.
  60. * @mdt_len - Length of the .mdt file in bytes.
  61. * @img_len - Length of the .mdt + .b00 +..+.bxx images files in bytes
  62. * @ion_fd - Ion file descriptor used when allocating memory.
  63. * @img_name - Name of the image.
  64. * @app_arch - Architecture of the image, i.e. 32bit or 64bit app
  65. */
  66. struct qseecom_load_img_req {
  67. __u32 mdt_len; /* in */
  68. __u32 img_len; /* in */
  69. __s32 ifd_data_fd; /* in */
  70. char img_name[MAX_APP_NAME_SIZE]; /* in */
  71. __u32 app_arch; /* in */
  72. __u32 app_id; /* out*/
  73. };
  74. struct qseecom_set_sb_mem_param_req {
  75. __s32 ifd_data_fd; /* in */
  76. void *virt_sb_base; /* in */
  77. __u32 sb_len; /* in */
  78. };
  79. /*
  80. * struct qseecom_qseos_version_req - get qseos version
  81. * @qseos_version - version number
  82. */
  83. struct qseecom_qseos_version_req {
  84. unsigned int qseos_version; /* in */
  85. };
  86. /*
  87. * struct qseecom_qseos_app_load_query - verify if app is loaded in qsee
  88. * @app_name[MAX_APP_NAME_SIZE]- name of the app.
  89. * @app_id - app id.
  90. */
  91. struct qseecom_qseos_app_load_query {
  92. char app_name[MAX_APP_NAME_SIZE]; /* in */
  93. __u32 app_id; /* out */
  94. __u32 app_arch;
  95. };
  96. struct qseecom_send_svc_cmd_req {
  97. __u32 cmd_id;
  98. void *cmd_req_buf; /* in */
  99. unsigned int cmd_req_len; /* in */
  100. void *resp_buf; /* in/out */
  101. unsigned int resp_len; /* in/out */
  102. };
  103. /*
  104. * struct qseecom_send_modfd_resp - for send command ioctl request
  105. * @req_len - command buffer length
  106. * @req_buf - command buffer
  107. * @ifd_data_fd - ion handle to memory allocated in user space
  108. * @cmd_buf_offset - command buffer offset
  109. */
  110. struct qseecom_send_modfd_listener_resp {
  111. void *resp_buf_ptr; /* in */
  112. unsigned int resp_len; /* in */
  113. struct qseecom_ion_fd_info ifd_data[MAX_ION_FD]; /* in */
  114. };
  115. struct qseecom_sg_entry {
  116. __u32 phys_addr;
  117. __u32 len;
  118. };
  119. struct qseecom_sg_entry_64bit {
  120. __u64 phys_addr;
  121. __u32 len;
  122. } __attribute__ ((packed));
  123. struct file;
  124. #define QSEECOM_IOC_MAGIC 0x97
  125. #define QSEECOM_IOCTL_REGISTER_LISTENER_REQ \
  126. _IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req)
  127. #define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ \
  128. _IO(QSEECOM_IOC_MAGIC, 2)
  129. #define QSEECOM_IOCTL_SEND_CMD_REQ \
  130. _IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req)
  131. #define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ \
  132. _IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req)
  133. #define QSEECOM_IOCTL_RECEIVE_REQ \
  134. _IO(QSEECOM_IOC_MAGIC, 5)
  135. #define QSEECOM_IOCTL_SEND_RESP_REQ \
  136. _IO(QSEECOM_IOC_MAGIC, 6)
  137. #define QSEECOM_IOCTL_LOAD_APP_REQ \
  138. _IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req)
  139. #define QSEECOM_IOCTL_SET_MEM_PARAM_REQ \
  140. _IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req)
  141. #define QSEECOM_IOCTL_UNLOAD_APP_REQ \
  142. _IO(QSEECOM_IOC_MAGIC, 9)
  143. #define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ \
  144. _IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req)
  145. #define QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ \
  146. _IOWR(QSEECOM_IOC_MAGIC, 13, struct qseecom_load_img_req)
  147. #define QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ \
  148. _IO(QSEECOM_IOC_MAGIC, 14)
  149. #define QSEECOM_IOCTL_APP_LOADED_QUERY_REQ \
  150. _IOWR(QSEECOM_IOC_MAGIC, 15, struct qseecom_qseos_app_load_query)
  151. #define QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ \
  152. _IOWR(QSEECOM_IOC_MAGIC, 16, struct qseecom_send_svc_cmd_req)
  153. #define QSEECOM_IOCTL_SEND_MODFD_RESP \
  154. _IOWR(QSEECOM_IOC_MAGIC, 21, struct qseecom_send_modfd_listener_resp)
  155. #define QSEECOM_IOCTL_SEND_MODFD_CMD_64_REQ \
  156. _IOWR(QSEECOM_IOC_MAGIC, 35, struct qseecom_send_modfd_cmd_req)
  157. #define QSEECOM_IOCTL_SEND_MODFD_RESP_64 \
  158. _IOWR(QSEECOM_IOC_MAGIC, 36, struct qseecom_send_modfd_listener_resp)
  159. #endif /* _QSEECOM_API_H_ */