msm_eva_private.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __MSM_EVA_PRIVATE_H__
  6. #define __MSM_EVA_PRIVATE_H__
  7. #include <linux/types.h>
  8. /* Commands type */
  9. #define EVA_KMD_CMD_BASE 0x10000000
  10. #define EVA_KMD_CMD_START (EVA_KMD_CMD_BASE + 0x1000)
  11. /*
  12. * userspace clients pass one of the below arguments type
  13. * in struct eva_kmd_arg (@type field).
  14. */
  15. /*
  16. * EVA_KMD_GET_SESSION_INFO - this argument type is used to
  17. * get the session information from driver. it passes
  18. * struct eva_kmd_session_info {}
  19. */
  20. #define EVA_KMD_GET_SESSION_INFO (EVA_KMD_CMD_START + 1)
  21. /*
  22. * EVA_KMD_REGISTER_BUFFER - this argument type is used to
  23. * register the buffer to driver. it passes
  24. * struct eva_kmd_buffer {}
  25. */
  26. #define EVA_KMD_REGISTER_BUFFER (EVA_KMD_CMD_START + 3)
  27. /*
  28. * EVA_KMD_REGISTER_BUFFER - this argument type is used to
  29. * unregister the buffer to driver. it passes
  30. * struct eva_kmd_buffer {}
  31. */
  32. #define EVA_KMD_UNREGISTER_BUFFER (EVA_KMD_CMD_START + 4)
  33. #define EVA_KMD_UPDATE_POWER (EVA_KMD_CMD_START + 17)
  34. #define EVA_KMD_SEND_CMD_PKT (EVA_KMD_CMD_START + 64)
  35. #define EVA_KMD_RECEIVE_MSG_PKT (EVA_KMD_CMD_START + 65)
  36. #define EVA_KMD_SET_SYS_PROPERTY (EVA_KMD_CMD_START + 66)
  37. #define EVA_KMD_GET_SYS_PROPERTY (EVA_KMD_CMD_START + 67)
  38. #define EVA_KMD_SESSION_CONTROL (EVA_KMD_CMD_START + 68)
  39. #define EVA_KMD_SEND_FENCE_CMD_PKT (EVA_KMD_CMD_START + 69)
  40. #define EVA_KMD_FLUSH_ALL (EVA_KMD_CMD_START + 70)
  41. #define EVA_KMD_FLUSH_FRAME (EVA_KMD_CMD_START + 71)
  42. /* flags */
  43. #define EVA_KMD_FLAG_UNSECURE 0x00000000
  44. #define EVA_KMD_FLAG_SECURE 0x00000001
  45. /* buffer type */
  46. #define EVA_KMD_BUFTYPE_INPUT 0x00000001
  47. #define EVA_KMD_BUFTYPE_OUTPUT 0x00000002
  48. #define EVA_KMD_BUFTYPE_INTERNAL_1 0x00000003
  49. #define EVA_KMD_BUFTYPE_INTERNAL_2 0x00000004
  50. /**
  51. * struct eva_kmd_session_info - session information
  52. * @session_id: current session id
  53. */
  54. struct eva_kmd_session_info {
  55. __u32 session_id;
  56. __u32 reserved[10];
  57. };
  58. /**
  59. * struct eva_kmd_buffer - buffer information to be registered
  60. * @index: index of buffer
  61. * @type: buffer type
  62. * @fd: file descriptor of buffer
  63. * @size: allocated size of buffer
  64. * @offset: offset in fd from where usable data starts
  65. * @pixelformat: fourcc format
  66. * @flags: buffer flags
  67. */
  68. struct eva_kmd_buffer {
  69. __u32 index;
  70. __u32 type;
  71. __u32 fd;
  72. __u32 size;
  73. __u32 offset;
  74. __u32 pixelformat;
  75. __u32 flags;
  76. __u32 reserved[5];
  77. };
  78. /**
  79. * struct eva_kmd_send_cmd - sending generic HFI command
  80. * @cmd_address_fd: file descriptor of cmd_address
  81. * @cmd_size: allocated size of buffer
  82. */
  83. struct eva_kmd_send_cmd {
  84. __u32 cmd_address_fd;
  85. __u32 cmd_size;
  86. __u32 reserved[10];
  87. };
  88. /**
  89. * struct eva_kmd_client_data - store generic client
  90. * data
  91. * @transactionid: transaction id
  92. * @client_data1: client data to be used during callback
  93. * @client_data2: client data to be used during callback
  94. */
  95. struct eva_kmd_client_data {
  96. __u32 transactionid;
  97. __u32 client_data1;
  98. __u32 client_data2;
  99. };
  100. #define MAX_HFI_PKT_SIZE 490
  101. struct eva_kmd_hfi_packet {
  102. __u32 pkt_data[MAX_HFI_PKT_SIZE];
  103. };
  104. #define EVA_KMD_PROP_HFI_VERSION 1
  105. #define EVA_KMD_PROP_SESSION_TYPE 2
  106. #define EVA_KMD_PROP_SESSION_KERNELMASK 3
  107. #define EVA_KMD_PROP_SESSION_PRIORITY 4
  108. #define EVA_KMD_PROP_SESSION_SECURITY 5
  109. #define EVA_KMD_PROP_SESSION_DSPMASK 6
  110. #define EVA_KMD_PROP_SESSION_DUMPOFFSET 7
  111. #define EVA_KMD_PROP_SESSION_DUMPSIZE 8
  112. #define EVA_KMD_PROP_PWR_FDU 0x10
  113. #define EVA_KMD_PROP_PWR_ICA 0x11
  114. #define EVA_KMD_PROP_PWR_OD 0x12
  115. #define EVA_KMD_PROP_PWR_MPU 0x13
  116. #define EVA_KMD_PROP_PWR_FW 0x14
  117. #define EVA_KMD_PROP_PWR_DDR 0x15
  118. #define EVA_KMD_PROP_PWR_SYSCACHE 0x16
  119. #define EVA_KMD_PROP_PWR_FDU_OP 0x17
  120. #define EVA_KMD_PROP_PWR_ICA_OP 0x18
  121. #define EVA_KMD_PROP_PWR_OD_OP 0x19
  122. #define EVA_KMD_PROP_PWR_MPU_OP 0x1A
  123. #define EVA_KMD_PROP_PWR_FW_OP 0x1B
  124. #define EVA_KMD_PROP_PWR_DDR_OP 0x1C
  125. #define EVA_KMD_PROP_PWR_SYSCACHE_OP 0x1D
  126. #define EVA_KMD_PROP_PWR_FPS_FDU 0x1E
  127. #define EVA_KMD_PROP_PWR_FPS_MPU 0x1F
  128. #define EVA_KMD_PROP_PWR_FPS_OD 0x20
  129. #define EVA_KMD_PROP_PWR_FPS_ICA 0x21
  130. #define MAX_KMD_PROP_NUM_PER_PACKET 8
  131. #define MAX_KMD_PROP_TYPE (EVA_KMD_PROP_PWR_FPS_ICA + 1)
  132. struct eva_kmd_sys_property {
  133. __u32 prop_type;
  134. __u32 data;
  135. };
  136. struct eva_kmd_sys_properties {
  137. __u32 prop_num;
  138. struct eva_kmd_sys_property prop_data[MAX_KMD_PROP_NUM_PER_PACKET];
  139. };
  140. #define SESSION_CREATE 1
  141. #define SESSION_DELETE 2
  142. #define SESSION_START 3
  143. #define SESSION_STOP 4
  144. #define SESSION_INFO 5
  145. struct eva_kmd_session_control {
  146. __u32 ctrl_type;
  147. __u32 ctrl_data[8];
  148. };
  149. #define MAX_HFI_FENCE_SIZE 16
  150. #define MAX_HFI_FENCE_OFFSET (MAX_HFI_PKT_SIZE-MAX_HFI_FENCE_SIZE)
  151. struct eva_kmd_hfi_fence_packet {
  152. __u32 pkt_data[MAX_HFI_FENCE_OFFSET];
  153. __u32 fence_data[MAX_HFI_FENCE_SIZE];
  154. __u64 frame_id;
  155. };
  156. struct eva_kmd_fence {
  157. __s32 h_synx;
  158. __u32 secure_key;
  159. };
  160. struct eva_kmd_fence_ctrl {
  161. __u32 magic;
  162. __u32 reserved;
  163. __u64 frame_id;
  164. __u32 num_fences;
  165. __u32 output_index;
  166. struct eva_kmd_fence fences[MAX_HFI_FENCE_SIZE/2];
  167. };
  168. #define MAX_FENCE_DATA_SIZE (MAX_HFI_FENCE_SIZE + 6)
  169. struct eva_kmd_hfi_synx_packet {
  170. __u32 pkt_data[MAX_HFI_PKT_SIZE];
  171. union {
  172. __u32 fence_data[MAX_FENCE_DATA_SIZE];
  173. struct eva_kmd_fence_ctrl fc;
  174. };
  175. };
  176. /**
  177. * struct eva_kmd_arg
  178. *
  179. * @type: command type
  180. * @buf_offset: offset to buffer list in the command
  181. * @buf_num: number of buffers in the command
  182. * @session: session information
  183. * @req_power: power information
  184. * @regbuf: buffer to be registered
  185. * @unregbuf: buffer to be unregistered
  186. * @send_cmd: sending generic HFI command
  187. * @hfi_pkt: HFI packet created by user library
  188. * @sys_properties System properties read or set by user library
  189. * @hfi_fence_pkt: HFI fence packet created by user library
  190. */
  191. struct eva_kmd_arg {
  192. __u32 type;
  193. __u32 buf_offset;
  194. __u32 buf_num;
  195. union eva_data_t {
  196. struct eva_kmd_session_info session;
  197. struct eva_kmd_buffer regbuf;
  198. struct eva_kmd_buffer unregbuf;
  199. struct eva_kmd_send_cmd send_cmd;
  200. struct eva_kmd_hfi_packet hfi_pkt;
  201. struct eva_kmd_sys_properties sys_properties;
  202. struct eva_kmd_hfi_fence_packet hfi_fence_pkt;
  203. struct eva_kmd_hfi_synx_packet hfi_synx_pkt;
  204. struct eva_kmd_session_control session_ctrl;
  205. __u64 frame_id;
  206. } data;
  207. };
  208. struct eva_kmd_request_power {
  209. __u32 deprecated;
  210. };
  211. #endif