ipa_qmi_msg.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2018-2022 Linaro Ltd.
  4. */
  5. #ifndef _IPA_QMI_MSG_H_
  6. #define _IPA_QMI_MSG_H_
  7. /* === Only "ipa_qmi" and "ipa_qmi_msg.c" should include this file === */
  8. #include <linux/types.h>
  9. #include <linux/soc/qcom/qmi.h>
  10. /* Request/response/indication QMI message ids used for IPA. Receiving
  11. * end issues a response for requests; indications require no response.
  12. */
  13. #define IPA_QMI_INDICATION_REGISTER 0x20 /* modem -> AP request */
  14. #define IPA_QMI_INIT_DRIVER 0x21 /* AP -> modem request */
  15. #define IPA_QMI_INIT_COMPLETE 0x22 /* AP -> modem indication */
  16. #define IPA_QMI_DRIVER_INIT_COMPLETE 0x35 /* modem -> AP request */
  17. /* The maximum size required for message types. These sizes include
  18. * the message data, along with type (1 byte) and length (2 byte)
  19. * information for each field. The qmi_send_*() interfaces require
  20. * the message size to be provided.
  21. */
  22. #define IPA_QMI_INDICATION_REGISTER_REQ_SZ 20 /* -> server handle */
  23. #define IPA_QMI_INDICATION_REGISTER_RSP_SZ 7 /* <- server handle */
  24. #define IPA_QMI_INIT_DRIVER_REQ_SZ 162 /* client handle -> */
  25. #define IPA_QMI_INIT_DRIVER_RSP_SZ 25 /* client handle <- */
  26. #define IPA_QMI_INIT_COMPLETE_IND_SZ 7 /* <- server handle */
  27. #define IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ 4 /* -> server handle */
  28. #define IPA_QMI_DRIVER_INIT_COMPLETE_RSP_SZ 7 /* <- server handle */
  29. /* Maximum size of messages we expect the AP to receive (max of above) */
  30. #define IPA_QMI_SERVER_MAX_RCV_SZ 8
  31. #define IPA_QMI_CLIENT_MAX_RCV_SZ 25
  32. /* Request message for the IPA_QMI_INDICATION_REGISTER request */
  33. struct ipa_indication_register_req {
  34. u8 master_driver_init_complete_valid;
  35. u8 master_driver_init_complete;
  36. u8 data_usage_quota_reached_valid;
  37. u8 data_usage_quota_reached;
  38. u8 ipa_mhi_ready_ind_valid;
  39. u8 ipa_mhi_ready_ind;
  40. u8 endpoint_desc_ind_valid;
  41. u8 endpoint_desc_ind;
  42. u8 bw_change_ind_valid;
  43. u8 bw_change_ind;
  44. };
  45. /* The response to a IPA_QMI_INDICATION_REGISTER request consists only of
  46. * a standard QMI response.
  47. */
  48. struct ipa_indication_register_rsp {
  49. struct qmi_response_type_v01 rsp;
  50. };
  51. /* Request message for the IPA_QMI_DRIVER_INIT_COMPLETE request */
  52. struct ipa_driver_init_complete_req {
  53. u8 status;
  54. };
  55. /* The response to a IPA_QMI_DRIVER_INIT_COMPLETE request consists only
  56. * of a standard QMI response.
  57. */
  58. struct ipa_driver_init_complete_rsp {
  59. struct qmi_response_type_v01 rsp;
  60. };
  61. /* The message for the IPA_QMI_INIT_COMPLETE_IND indication consists
  62. * only of a standard QMI response.
  63. */
  64. struct ipa_init_complete_ind {
  65. struct qmi_response_type_v01 status;
  66. };
  67. /* The AP tells the modem its platform type. We assume Android. */
  68. enum ipa_platform_type {
  69. IPA_QMI_PLATFORM_TYPE_INVALID = 0x0, /* Invalid */
  70. IPA_QMI_PLATFORM_TYPE_TN = 0x1, /* Data card */
  71. IPA_QMI_PLATFORM_TYPE_LE = 0x2, /* Data router */
  72. IPA_QMI_PLATFORM_TYPE_MSM_ANDROID = 0x3, /* Android MSM */
  73. IPA_QMI_PLATFORM_TYPE_MSM_WINDOWS = 0x4, /* Windows MSM */
  74. IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01 = 0x5, /* QNX MSM */
  75. };
  76. /* This defines the start and end offset of a range of memory. The start
  77. * value is a byte offset relative to the start of IPA shared memory. The
  78. * end value is the last addressable unit *within* the range. Typically
  79. * the end value is in units of bytes, however it can also be a maximum
  80. * array index value.
  81. */
  82. struct ipa_mem_bounds {
  83. u32 start;
  84. u32 end;
  85. };
  86. /* This defines the location and size of an array. The start value
  87. * is an offset relative to the start of IPA shared memory. The
  88. * size of the array is implied by the number of entries (the entry
  89. * size is assumed to be known).
  90. */
  91. struct ipa_mem_array {
  92. u32 start;
  93. u32 count;
  94. };
  95. /* This defines the location and size of a range of memory. The
  96. * start is an offset relative to the start of IPA shared memory.
  97. * This differs from the ipa_mem_bounds structure in that the size
  98. * (in bytes) of the memory region is specified rather than the
  99. * offset of its last byte.
  100. */
  101. struct ipa_mem_range {
  102. u32 start;
  103. u32 size;
  104. };
  105. /* The message for the IPA_QMI_INIT_DRIVER request contains information
  106. * from the AP that affects modem initialization.
  107. */
  108. struct ipa_init_modem_driver_req {
  109. u8 platform_type_valid;
  110. u32 platform_type; /* enum ipa_platform_type */
  111. /* Modem header table information. This defines the IPA shared
  112. * memory in which the modem may insert header table entries.
  113. */
  114. u8 hdr_tbl_info_valid;
  115. struct ipa_mem_bounds hdr_tbl_info;
  116. /* Routing table information. These define the location and maximum
  117. * *index* (not byte) for the modem portion of non-hashable IPv4 and
  118. * IPv6 routing tables. The start values are byte offsets relative
  119. * to the start of IPA shared memory.
  120. */
  121. u8 v4_route_tbl_info_valid;
  122. struct ipa_mem_bounds v4_route_tbl_info;
  123. u8 v6_route_tbl_info_valid;
  124. struct ipa_mem_bounds v6_route_tbl_info;
  125. /* Filter table information. These define the location of the
  126. * non-hashable IPv4 and IPv6 filter tables. The start values are
  127. * byte offsets relative to the start of IPA shared memory.
  128. */
  129. u8 v4_filter_tbl_start_valid;
  130. u32 v4_filter_tbl_start;
  131. u8 v6_filter_tbl_start_valid;
  132. u32 v6_filter_tbl_start;
  133. /* Modem memory information. This defines the location and
  134. * size of memory available for the modem to use.
  135. */
  136. u8 modem_mem_info_valid;
  137. struct ipa_mem_range modem_mem_info;
  138. /* This defines the destination endpoint on the AP to which
  139. * the modem driver can send control commands. Must be less
  140. * than ipa_endpoint_max().
  141. */
  142. u8 ctrl_comm_dest_end_pt_valid;
  143. u32 ctrl_comm_dest_end_pt;
  144. /* This defines whether the modem should load the microcontroller
  145. * or not. It is unnecessary to reload it if the modem is being
  146. * restarted.
  147. *
  148. * NOTE: this field is named "is_ssr_bootup" elsewhere.
  149. */
  150. u8 skip_uc_load_valid;
  151. u8 skip_uc_load;
  152. /* Processing context memory information. This defines the memory in
  153. * which the modem may insert header processing context table entries.
  154. */
  155. u8 hdr_proc_ctx_tbl_info_valid;
  156. struct ipa_mem_bounds hdr_proc_ctx_tbl_info;
  157. /* Compression command memory information. This defines the memory
  158. * in which the modem may insert compression/decompression commands.
  159. */
  160. u8 zip_tbl_info_valid;
  161. struct ipa_mem_bounds zip_tbl_info;
  162. /* Routing table information. These define the location and maximum
  163. * *index* (not byte) for the modem portion of hashable IPv4 and IPv6
  164. * routing tables (if supported by hardware). The start values are
  165. * byte offsets relative to the start of IPA shared memory.
  166. */
  167. u8 v4_hash_route_tbl_info_valid;
  168. struct ipa_mem_bounds v4_hash_route_tbl_info;
  169. u8 v6_hash_route_tbl_info_valid;
  170. struct ipa_mem_bounds v6_hash_route_tbl_info;
  171. /* Filter table information. These define the location and size
  172. * of hashable IPv4 and IPv6 filter tables (if supported by hardware).
  173. * The start values are byte offsets relative to the start of IPA
  174. * shared memory.
  175. */
  176. u8 v4_hash_filter_tbl_start_valid;
  177. u32 v4_hash_filter_tbl_start;
  178. u8 v6_hash_filter_tbl_start_valid;
  179. u32 v6_hash_filter_tbl_start;
  180. /* Statistics information. These define the locations of the
  181. * first and last statistics sub-regions. (IPA v4.0 and above)
  182. */
  183. u8 hw_stats_quota_base_addr_valid;
  184. u32 hw_stats_quota_base_addr;
  185. u8 hw_stats_quota_size_valid;
  186. u32 hw_stats_quota_size;
  187. u8 hw_stats_drop_base_addr_valid;
  188. u32 hw_stats_drop_base_addr;
  189. u8 hw_stats_drop_size_valid;
  190. u32 hw_stats_drop_size;
  191. };
  192. /* The response to a IPA_QMI_INIT_DRIVER request begins with a standard
  193. * QMI response, but contains other information as well. Currently we
  194. * simply wait for the INIT_DRIVER transaction to complete and
  195. * ignore any other data that might be returned.
  196. */
  197. struct ipa_init_modem_driver_rsp {
  198. struct qmi_response_type_v01 rsp;
  199. /* This defines the destination endpoint on the modem to which
  200. * the AP driver can send control commands. Must be less than
  201. * ipa_endpoint_max().
  202. */
  203. u8 ctrl_comm_dest_end_pt_valid;
  204. u32 ctrl_comm_dest_end_pt;
  205. /* This defines the default endpoint. The AP driver is not
  206. * required to configure the hardware with this value. Must
  207. * be less than ipa_endpoint_max().
  208. */
  209. u8 default_end_pt_valid;
  210. u32 default_end_pt;
  211. /* This defines whether a second handshake is required to complete
  212. * initialization.
  213. */
  214. u8 modem_driver_init_pending_valid;
  215. u8 modem_driver_init_pending;
  216. };
  217. /* Message structure definitions defined in "ipa_qmi_msg.c" */
  218. extern struct qmi_elem_info ipa_indication_register_req_ei[];
  219. extern struct qmi_elem_info ipa_indication_register_rsp_ei[];
  220. extern struct qmi_elem_info ipa_driver_init_complete_req_ei[];
  221. extern struct qmi_elem_info ipa_driver_init_complete_rsp_ei[];
  222. extern struct qmi_elem_info ipa_init_complete_ind_ei[];
  223. extern struct qmi_elem_info ipa_mem_bounds_ei[];
  224. extern struct qmi_elem_info ipa_mem_array_ei[];
  225. extern struct qmi_elem_info ipa_mem_range_ei[];
  226. extern struct qmi_elem_info ipa_init_modem_driver_req_ei[];
  227. extern struct qmi_elem_info ipa_init_modem_driver_rsp_ei[];
  228. #endif /* !_IPA_QMI_MSG_H_ */