ipa_hw_defs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /* Copyright (c) 2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _IPA_HW_DEFS_H
  13. #define _IPA_HW_DEFS_H
  14. #include <linux/bitops.h>
  15. /* This header defines various HW related data types */
  16. /* immediate command op-codes */
  17. #define IPA_DECIPH_INIT (1)
  18. #define IPA_PPP_FRM_INIT (2)
  19. #define IPA_IP_V4_FILTER_INIT (3)
  20. #define IPA_IP_V6_FILTER_INIT (4)
  21. #define IPA_IP_V4_NAT_INIT (5)
  22. #define IPA_IP_V6_NAT_INIT (6)
  23. #define IPA_IP_V4_ROUTING_INIT (7)
  24. #define IPA_IP_V6_ROUTING_INIT (8)
  25. #define IPA_HDR_INIT_LOCAL (9)
  26. #define IPA_HDR_INIT_SYSTEM (10)
  27. #define IPA_DECIPH_SETUP (11)
  28. #define IPA_INSERT_NAT_RULE (12)
  29. #define IPA_DELETE_NAT_RULE (13)
  30. #define IPA_NAT_DMA (14)
  31. #define IPA_IP_PACKET_TAG (15)
  32. #define IPA_IP_PACKET_INIT (16)
  33. #define IPA_INTERFACE_ID_EXCEPTION (0)
  34. #define IPA_INTERFACE_ID_A2_WWAN (0x10)
  35. #define IPA_INTERFACE_ID_HSUSB_RMNET1 (0x21)
  36. #define IPA_INTERFACE_ID_HSUSB_RMNET2 (0x22)
  37. #define IPA_INTERFACE_ID_HSUSB_RMNET3 (0x23)
  38. #define IPA_INTERFACE_ID_HSIC_WLAN_WAN (0x31)
  39. #define IPA_INTERFACE_ID_HSIC_WLAN_LAN1 (0x32)
  40. #define IPA_INTERFACE_ID_HSIC_WLAN_LAN2 (0x33)
  41. #define IPA_INTERFACE_ID_HSIC_RMNET1 (0x41)
  42. #define IPA_INTERFACE_ID_HSIC_RMNET2 (0x42)
  43. #define IPA_INTERFACE_ID_HSIC_RMNET3 (0x43)
  44. #define IPA_INTERFACE_ID_HSIC_RMNET4 (0x44)
  45. #define IPA_INTERFACE_ID_HSIC_RMNET5 (0x45)
  46. /**
  47. * struct ipa_flt_rule_hw_hdr - HW header of IPA filter rule
  48. * @word: filtering rule properties
  49. * @en_rule: enable rule
  50. * @action: post routing action
  51. * @rt_tbl_idx: index in routing table
  52. * @rsvd: reserved
  53. */
  54. struct ipa_flt_rule_hw_hdr {
  55. union {
  56. u32 word;
  57. struct {
  58. u32 en_rule:16;
  59. u32 action:5;
  60. u32 rt_tbl_idx:5;
  61. u32 rsvd:6;
  62. } hdr;
  63. } u;
  64. };
  65. /**
  66. * struct ipa_rt_rule_hw_hdr - HW header of IPA routing rule
  67. * @word: filtering rule properties
  68. * @en_rule: enable rule
  69. * @pipe_dest_idx: destination pipe index
  70. * @system: changed from local to system due to HW change
  71. * @hdr_offset: header offset
  72. */
  73. struct ipa_rt_rule_hw_hdr {
  74. union {
  75. u32 word;
  76. struct {
  77. u32 en_rule:16;
  78. u32 pipe_dest_idx:5;
  79. u32 system:1;
  80. u32 hdr_offset:10;
  81. } hdr;
  82. } u;
  83. };
  84. /**
  85. * struct ipa_ip_v4_filter_init - IPA_IP_V4_FILTER_INIT command payload
  86. * @ipv4_rules_addr: address of ipv4 rules
  87. * @size_ipv4_rules: size of the above
  88. * @ipv4_addr: ipv4 address
  89. * @rsvd: reserved
  90. */
  91. struct ipa_ip_v4_filter_init {
  92. u64 ipv4_rules_addr:32;
  93. u64 size_ipv4_rules:12;
  94. u64 ipv4_addr:16;
  95. u64 rsvd:4;
  96. };
  97. /**
  98. * struct ipa_ip_v6_filter_init - IPA_IP_V6_FILTER_INIT command payload
  99. * @ipv6_rules_addr: address of ipv6 rules
  100. * @size_ipv6_rules: size of the above
  101. * @ipv6_addr: ipv6 address
  102. */
  103. struct ipa_ip_v6_filter_init {
  104. u64 ipv6_rules_addr:32;
  105. u64 size_ipv6_rules:16;
  106. u64 ipv6_addr:16;
  107. };
  108. /**
  109. * struct ipa_ip_v4_routing_init - IPA_IP_V4_ROUTING_INIT command payload
  110. * @ipv4_rules_addr: address of ipv4 rules
  111. * @size_ipv4_rules: size of the above
  112. * @ipv4_addr: ipv4 address
  113. * @rsvd: reserved
  114. */
  115. struct ipa_ip_v4_routing_init {
  116. u64 ipv4_rules_addr:32;
  117. u64 size_ipv4_rules:12;
  118. u64 ipv4_addr:16;
  119. u64 rsvd:4;
  120. };
  121. /**
  122. * struct ipa_ip_v6_routing_init - IPA_IP_V6_ROUTING_INIT command payload
  123. * @ipv6_rules_addr: address of ipv6 rules
  124. * @size_ipv6_rules: size of the above
  125. * @ipv6_addr: ipv6 address
  126. */
  127. struct ipa_ip_v6_routing_init {
  128. u64 ipv6_rules_addr:32;
  129. u64 size_ipv6_rules:16;
  130. u64 ipv6_addr:16;
  131. };
  132. /**
  133. * struct ipa_hdr_init_local - IPA_HDR_INIT_LOCAL command payload
  134. * @hdr_table_addr: address of header table
  135. * @size_hdr_table: size of the above
  136. * @hdr_addr: header address
  137. * @rsvd: reserved
  138. */
  139. struct ipa_hdr_init_local {
  140. u64 hdr_table_addr:32;
  141. u64 size_hdr_table:12;
  142. u64 hdr_addr:16;
  143. u64 rsvd:4;
  144. };
  145. /**
  146. * struct ipa_hdr_init_system - IPA_HDR_INIT_SYSTEM command payload
  147. * @hdr_table_addr: address of header table
  148. * @rsvd: reserved
  149. */
  150. struct ipa_hdr_init_system {
  151. u64 hdr_table_addr:32;
  152. u64 rsvd:32;
  153. };
  154. #define IPA_A5_MUX_HDR_EXCP_FLAG_IP BIT(7)
  155. #define IPA_A5_MUX_HDR_EXCP_FLAG_NAT BIT(6)
  156. #define IPA_A5_MUX_HDR_EXCP_FLAG_SW_FLT BIT(5)
  157. #define IPA_A5_MUX_HDR_EXCP_FLAG_TAG BIT(4)
  158. #define IPA_A5_MUX_HDR_EXCP_FLAG_REPLICATED BIT(3)
  159. #define IPA_A5_MUX_HDR_EXCP_FLAG_IHL BIT(2)
  160. /**
  161. * struct ipa_a5_mux_hdr - A5 MUX header definition
  162. * @interface_id: interface ID
  163. * @src_pipe_index: source pipe index
  164. * @flags: flags
  165. * @metadata: metadata
  166. *
  167. * A5 MUX header is in BE, A5 runs in LE. This struct definition
  168. * allows A5 SW to correctly parse the header
  169. */
  170. struct ipa_a5_mux_hdr {
  171. u16 interface_id;
  172. u8 src_pipe_index;
  173. u8 flags;
  174. u32 metadata;
  175. };
  176. /**
  177. * struct ipa_nat_dma - IPA_NAT_DMA command payload
  178. * @table_index: NAT table index
  179. * @rsvd1: reserved
  180. * @base_addr: base address
  181. * @rsvd2: reserved
  182. * @offset: offset
  183. * @data: metadata
  184. * @rsvd3: reserved
  185. */
  186. struct ipa_nat_dma {
  187. u64 table_index:3;
  188. u64 rsvd1:1;
  189. u64 base_addr:2;
  190. u64 rsvd2:2;
  191. u64 offset:32;
  192. u64 data:16;
  193. u64 rsvd3:8;
  194. };
  195. /**
  196. * struct ipa_nat_dma - IPA_IP_PACKET_INIT command payload
  197. * @destination_pipe_index: destination pipe index
  198. * @rsvd1: reserved
  199. * @metadata: metadata
  200. * @rsvd2: reserved
  201. */
  202. struct ipa_ip_packet_init {
  203. u64 destination_pipe_index:5;
  204. u64 rsvd1:3;
  205. u64 metadata:32;
  206. u64 rsvd2:24;
  207. };
  208. /**
  209. * struct ipa_nat_dma - IPA_IP_V4_NAT_INIT command payload
  210. * @ipv4_rules_addr: ipv4 rules address
  211. * @ipv4_expansion_rules_addr: ipv4 expansion rules address
  212. * @index_table_addr: index tables address
  213. * @index_table_expansion_addr: index expansion table address
  214. * @table_index: index in table
  215. * @ipv4_rules_addr_type: ipv4 address type
  216. * @ipv4_expansion_rules_addr_type: ipv4 expansion address type
  217. * @index_table_addr_type: index table address type
  218. * @index_table_expansion_addr_type: index expansion table type
  219. * @size_base_tables: size of base tables
  220. * @size_expansion_tables: size of expansion tables
  221. * @rsvd2: reserved
  222. * @public_ip_addr: public IP address
  223. */
  224. struct ipa_ip_v4_nat_init {
  225. u64 ipv4_rules_addr:32;
  226. u64 ipv4_expansion_rules_addr:32;
  227. u64 index_table_addr:32;
  228. u64 index_table_expansion_addr:32;
  229. u64 table_index:3;
  230. u64 rsvd1:1;
  231. u64 ipv4_rules_addr_type:1;
  232. u64 ipv4_expansion_rules_addr_type:1;
  233. u64 index_table_addr_type:1;
  234. u64 index_table_expansion_addr_type:1;
  235. u64 size_base_tables:12;
  236. u64 size_expansion_tables:10;
  237. u64 rsvd2:2;
  238. u64 public_ip_addr:32;
  239. };
  240. /**
  241. * struct ipa_ip_packet_tag - IPA_IP_PACKET_TAG command payload
  242. * @tag: tag value returned with response
  243. */
  244. struct ipa_ip_packet_tag {
  245. u32 tag;
  246. };
  247. #endif /* _IPA_HW_DEFS_H */