tcl_gse_cmd.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. #ifndef _TCL_GSE_CMD_H_
  16. #define _TCL_GSE_CMD_H_
  17. #if !defined(__ASSEMBLER__)
  18. #endif
  19. #define NUM_OF_DWORDS_TCL_GSE_CMD 8
  20. struct tcl_gse_cmd {
  21. #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
  22. uint32_t control_buffer_addr_31_0 : 32; // [31:0]
  23. uint32_t control_buffer_addr_39_32 : 8, // [7:0]
  24. gse_ctrl : 4, // [11:8]
  25. gse_sel : 1, // [12:12]
  26. status_destination_ring_id : 1, // [13:13]
  27. swap : 1, // [14:14]
  28. index_search_en : 1, // [15:15]
  29. cache_set_num : 4, // [19:16]
  30. reserved_1a : 12; // [31:20]
  31. uint32_t tcl_cmd_type : 1, // [0:0]
  32. reserved_2a : 31; // [31:1]
  33. uint32_t cmd_meta_data_31_0 : 32; // [31:0]
  34. uint32_t cmd_meta_data_63_32 : 32; // [31:0]
  35. uint32_t reserved_5a : 32; // [31:0]
  36. uint32_t reserved_6a : 32; // [31:0]
  37. uint32_t reserved_7a : 20, // [19:0]
  38. ring_id : 8, // [27:20]
  39. looping_count : 4; // [31:28]
  40. #else
  41. uint32_t control_buffer_addr_31_0 : 32; // [31:0]
  42. uint32_t reserved_1a : 12, // [31:20]
  43. cache_set_num : 4, // [19:16]
  44. index_search_en : 1, // [15:15]
  45. swap : 1, // [14:14]
  46. status_destination_ring_id : 1, // [13:13]
  47. gse_sel : 1, // [12:12]
  48. gse_ctrl : 4, // [11:8]
  49. control_buffer_addr_39_32 : 8; // [7:0]
  50. uint32_t reserved_2a : 31, // [31:1]
  51. tcl_cmd_type : 1; // [0:0]
  52. uint32_t cmd_meta_data_31_0 : 32; // [31:0]
  53. uint32_t cmd_meta_data_63_32 : 32; // [31:0]
  54. uint32_t reserved_5a : 32; // [31:0]
  55. uint32_t reserved_6a : 32; // [31:0]
  56. uint32_t looping_count : 4, // [31:28]
  57. ring_id : 8, // [27:20]
  58. reserved_7a : 20; // [19:0]
  59. #endif
  60. };
  61. /* Description CONTROL_BUFFER_ADDR_31_0
  62. Address (lower 32 bits) of a control buffer containing additional
  63. info needed for this command execution.
  64. <legal all>
  65. */
  66. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_31_0_OFFSET 0x00000000
  67. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_31_0_LSB 0
  68. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_31_0_MSB 31
  69. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_31_0_MASK 0xffffffff
  70. /* Description CONTROL_BUFFER_ADDR_39_32
  71. Address (upper 8 bits) of a control buffer containing additional
  72. info needed for this command execution.
  73. <legal all>
  74. */
  75. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_39_32_OFFSET 0x00000004
  76. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_39_32_LSB 0
  77. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_39_32_MSB 7
  78. #define TCL_GSE_CMD_CONTROL_BUFFER_ADDR_39_32_MASK 0x000000ff
  79. /* Description GSE_CTRL
  80. GSE control operations. This includes cache operations and
  81. table entry statistics read/clear operation.
  82. <enum 0 rd_stat> Report or Read statistics
  83. <enum 1 srch_dis> Search disable. Report only Hash
  84. <enum 2 Wr_bk_single> Write Back single entry
  85. <enum 3 wr_bk_all> Write Back entire cache entry
  86. <enum 4 inval_single> Invalidate single cache entry
  87. <enum 5 inval_all> Invalidate entire cache
  88. <enum 6 wr_bk_inval_single> Write back and Invalidate single
  89. entry in cache
  90. <enum 7 wr_bk_inval_all> write back and invalidate entire
  91. cache
  92. <enum 8 clr_stat_single> Clear statistics for single entry
  93. <legal 0-8>
  94. Rest of the values reserved.
  95. For all single entry control operations (write back, Invalidate
  96. or both)Statistics will be reported
  97. */
  98. #define TCL_GSE_CMD_GSE_CTRL_OFFSET 0x00000004
  99. #define TCL_GSE_CMD_GSE_CTRL_LSB 8
  100. #define TCL_GSE_CMD_GSE_CTRL_MSB 11
  101. #define TCL_GSE_CMD_GSE_CTRL_MASK 0x00000f00
  102. /* Description GSE_SEL
  103. Bit to select the ASE or FSE to do the operation mention
  104. by GSE_ctrl bit
  105. 0: FSE select
  106. 1: ASE select
  107. */
  108. #define TCL_GSE_CMD_GSE_SEL_OFFSET 0x00000004
  109. #define TCL_GSE_CMD_GSE_SEL_LSB 12
  110. #define TCL_GSE_CMD_GSE_SEL_MSB 12
  111. #define TCL_GSE_CMD_GSE_SEL_MASK 0x00001000
  112. /* Description STATUS_DESTINATION_RING_ID
  113. The TCL status ring to which the GSE status needs to be
  114. send.
  115. <enum 0 tcl_status_0_ring>
  116. <enum 1 tcl_status_1_ring>
  117. <legal all>
  118. */
  119. #define TCL_GSE_CMD_STATUS_DESTINATION_RING_ID_OFFSET 0x00000004
  120. #define TCL_GSE_CMD_STATUS_DESTINATION_RING_ID_LSB 13
  121. #define TCL_GSE_CMD_STATUS_DESTINATION_RING_ID_MSB 13
  122. #define TCL_GSE_CMD_STATUS_DESTINATION_RING_ID_MASK 0x00002000
  123. /* Description SWAP
  124. Bit to enable byte swapping of contents of buffer
  125. <enum 0 Byte_swap_disable >
  126. <enum 1 byte_swap_enable >
  127. <legal all>
  128. */
  129. #define TCL_GSE_CMD_SWAP_OFFSET 0x00000004
  130. #define TCL_GSE_CMD_SWAP_LSB 14
  131. #define TCL_GSE_CMD_SWAP_MSB 14
  132. #define TCL_GSE_CMD_SWAP_MASK 0x00004000
  133. /* Description INDEX_SEARCH_EN
  134. When this bit is set to 1 control_buffer_addr[19:0] will
  135. be considered as index of the AST or Flow table and GSE
  136. commands will be executed accordingly on the entry pointed
  137. by the index.
  138. This feature is disabled by setting this bit to 0.
  139. <enum 0 index_based_cmd_disable>
  140. <enum 1 index_based_cmd_enable>
  141. <legal all>
  142. */
  143. #define TCL_GSE_CMD_INDEX_SEARCH_EN_OFFSET 0x00000004
  144. #define TCL_GSE_CMD_INDEX_SEARCH_EN_LSB 15
  145. #define TCL_GSE_CMD_INDEX_SEARCH_EN_MSB 15
  146. #define TCL_GSE_CMD_INDEX_SEARCH_EN_MASK 0x00008000
  147. /* Description CACHE_SET_NUM
  148. Cache set number that should be used to cache the index
  149. based search results, for address and flow search. This
  150. value should be equal to value of cache_set_num for the
  151. index that is issued in TCL_DATA_CMD during search index
  152. based ASE or FSE. This field is valid for index based GSE
  153. commands
  154. <legal all>
  155. */
  156. #define TCL_GSE_CMD_CACHE_SET_NUM_OFFSET 0x00000004
  157. #define TCL_GSE_CMD_CACHE_SET_NUM_LSB 16
  158. #define TCL_GSE_CMD_CACHE_SET_NUM_MSB 19
  159. #define TCL_GSE_CMD_CACHE_SET_NUM_MASK 0x000f0000
  160. /* Description RESERVED_1A
  161. <legal 0>
  162. */
  163. #define TCL_GSE_CMD_RESERVED_1A_OFFSET 0x00000004
  164. #define TCL_GSE_CMD_RESERVED_1A_LSB 20
  165. #define TCL_GSE_CMD_RESERVED_1A_MSB 31
  166. #define TCL_GSE_CMD_RESERVED_1A_MASK 0xfff00000
  167. /* Description TCL_CMD_TYPE
  168. This field is used to select the type of TCL Command decriptor
  169. that is queued by SW/FW. For 'TCL_GSE_CMD' this has to
  170. be 1.
  171. <legal 1>
  172. */
  173. #define TCL_GSE_CMD_TCL_CMD_TYPE_OFFSET 0x00000008
  174. #define TCL_GSE_CMD_TCL_CMD_TYPE_LSB 0
  175. #define TCL_GSE_CMD_TCL_CMD_TYPE_MSB 0
  176. #define TCL_GSE_CMD_TCL_CMD_TYPE_MASK 0x00000001
  177. /* Description RESERVED_2A
  178. <legal 0>
  179. */
  180. #define TCL_GSE_CMD_RESERVED_2A_OFFSET 0x00000008
  181. #define TCL_GSE_CMD_RESERVED_2A_LSB 1
  182. #define TCL_GSE_CMD_RESERVED_2A_MSB 31
  183. #define TCL_GSE_CMD_RESERVED_2A_MASK 0xfffffffe
  184. /* Description CMD_META_DATA_31_0
  185. Meta data to be returned in the status descriptor
  186. <legal all>
  187. */
  188. #define TCL_GSE_CMD_CMD_META_DATA_31_0_OFFSET 0x0000000c
  189. #define TCL_GSE_CMD_CMD_META_DATA_31_0_LSB 0
  190. #define TCL_GSE_CMD_CMD_META_DATA_31_0_MSB 31
  191. #define TCL_GSE_CMD_CMD_META_DATA_31_0_MASK 0xffffffff
  192. /* Description CMD_META_DATA_63_32
  193. Meta data to be returned in the status descriptor
  194. <legal all>
  195. */
  196. #define TCL_GSE_CMD_CMD_META_DATA_63_32_OFFSET 0x00000010
  197. #define TCL_GSE_CMD_CMD_META_DATA_63_32_LSB 0
  198. #define TCL_GSE_CMD_CMD_META_DATA_63_32_MSB 31
  199. #define TCL_GSE_CMD_CMD_META_DATA_63_32_MASK 0xffffffff
  200. /* Description RESERVED_5A
  201. <legal 0>
  202. */
  203. #define TCL_GSE_CMD_RESERVED_5A_OFFSET 0x00000014
  204. #define TCL_GSE_CMD_RESERVED_5A_LSB 0
  205. #define TCL_GSE_CMD_RESERVED_5A_MSB 31
  206. #define TCL_GSE_CMD_RESERVED_5A_MASK 0xffffffff
  207. /* Description RESERVED_6A
  208. <legal 0>
  209. */
  210. #define TCL_GSE_CMD_RESERVED_6A_OFFSET 0x00000018
  211. #define TCL_GSE_CMD_RESERVED_6A_LSB 0
  212. #define TCL_GSE_CMD_RESERVED_6A_MSB 31
  213. #define TCL_GSE_CMD_RESERVED_6A_MASK 0xffffffff
  214. /* Description RESERVED_7A
  215. <legal 0>
  216. */
  217. #define TCL_GSE_CMD_RESERVED_7A_OFFSET 0x0000001c
  218. #define TCL_GSE_CMD_RESERVED_7A_LSB 0
  219. #define TCL_GSE_CMD_RESERVED_7A_MSB 19
  220. #define TCL_GSE_CMD_RESERVED_7A_MASK 0x000fffff
  221. /* Description RING_ID
  222. Helps with debugging when dumping ring contents.
  223. <legal all>
  224. */
  225. #define TCL_GSE_CMD_RING_ID_OFFSET 0x0000001c
  226. #define TCL_GSE_CMD_RING_ID_LSB 20
  227. #define TCL_GSE_CMD_RING_ID_MSB 27
  228. #define TCL_GSE_CMD_RING_ID_MASK 0x0ff00000
  229. /* Description LOOPING_COUNT
  230. A count value that indicates the number of times the producer
  231. of entries into the Ring has looped around the ring.
  232. At initialization time, this value is set to 0. On the first
  233. loop, this value is set to 1. After the max value is reached
  234. allowed by the number of bits for this field, the count
  235. value continues with 0 again.
  236. In case SW is the consumer of the ring entries, it can use
  237. this field to figure out up to where the producer of entries
  238. has created new entries. This eliminates the need to check
  239. where the "head pointer' of the ring is located once the
  240. SW starts processing an interrupt indicating that new entries
  241. have been put into this ring...
  242. Also note that SW if it wants only needs to look at the
  243. LSB bit of this count value.
  244. <legal all>
  245. */
  246. #define TCL_GSE_CMD_LOOPING_COUNT_OFFSET 0x0000001c
  247. #define TCL_GSE_CMD_LOOPING_COUNT_LSB 28
  248. #define TCL_GSE_CMD_LOOPING_COUNT_MSB 31
  249. #define TCL_GSE_CMD_LOOPING_COUNT_MASK 0xf0000000
  250. #endif // TCL_GSE_CMD