tcl_gse_cmd.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /*
  2. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _TCL_GSE_CMD_H_
  17. #define _TCL_GSE_CMD_H_
  18. #if !defined(__ASSEMBLER__)
  19. #endif
  20. // ################ START SUMMARY #################
  21. //
  22. // Dword Fields
  23. // 0 control_buffer_addr_31_0[31:0]
  24. // 1 control_buffer_addr_39_32[7:0], gse_ctrl[11:8], gse_sel[12], status_destination_ring_id[13], swap[14], index_search_en[15], cache_set_num[19:16], reserved_1a[31:20]
  25. // 2 cmd_meta_data_31_0[31:0]
  26. // 3 cmd_meta_data_63_32[31:0]
  27. // 4 reserved_4a[31:0]
  28. // 5 reserved_5a[31:0]
  29. // 6 reserved_6a[19:0], ring_id[27:20], looping_count[31:28]
  30. //
  31. // ################ END SUMMARY #################
  32. #define NUM_OF_DWORDS_TCL_GSE_CMD 7
  33. struct tcl_gse_cmd {
  34. uint32_t control_buffer_addr_31_0 : 32; //[31:0]
  35. uint32_t control_buffer_addr_39_32 : 8, //[7:0]
  36. gse_ctrl : 4, //[11:8]
  37. gse_sel : 1, //[12]
  38. status_destination_ring_id : 1, //[13]
  39. swap : 1, //[14]
  40. index_search_en : 1, //[15]
  41. cache_set_num : 4, //[19:16]
  42. reserved_1a : 12; //[31:20]
  43. uint32_t cmd_meta_data_31_0 : 32; //[31:0]
  44. uint32_t cmd_meta_data_63_32 : 32; //[31:0]
  45. uint32_t reserved_4a : 32; //[31:0]
  46. uint32_t reserved_5a : 32; //[31:0]
  47. uint32_t reserved_6a : 20, //[19:0]
  48. ring_id : 8, //[27:20]
  49. looping_count : 4; //[31:28]
  50. };
  51. /*
  52. control_buffer_addr_31_0
  53. Address (lower 32 bits) of a control buffer containing
  54. additional info needed for this command execution.
  55. <legal all>
  56. control_buffer_addr_39_32
  57. Address (upper 8 bits) of a control buffer containing
  58. additional info needed for this command execution.
  59. <legal all>
  60. gse_ctrl
  61. GSE control operations. This includes cache operations
  62. and table entry statistics read/clear operation.
  63. <enum 0 rd_stat> Report or Read statistics
  64. <enum 1 srch_dis> Search disable. Report only Hash
  65. <enum 2 Wr_bk_single> Write Back single entry
  66. <enum 3 wr_bk_all> Write Back entire cache entry
  67. <enum 4 inval_single> Invalidate single cache entry
  68. <enum 5 inval_all> Invalidate entire cache
  69. <enum 6 wr_bk_inval_single> Write back and Invalidate
  70. single entry in cache
  71. <enum 7 wr_bk_inval_all> write back and invalidate
  72. entire cache
  73. <enum 8 clr_stat_single> Clear statistics for single
  74. entry
  75. <legal 0-8>
  76. Rest of the values reserved.
  77. For all single entry control operations (write back,
  78. Invalidate or both)Statistics will be reported
  79. gse_sel
  80. Bit to select the ASE or FSE to do the operation mention
  81. by GSE_ctrl bit
  82. 0: FSE select
  83. 1: ASE select
  84. status_destination_ring_id
  85. The TCL status ring to which the GSE status needs to be
  86. send.
  87. <enum 0 tcl_status_0_ring>
  88. <enum 1 tcl_status_1_ring>
  89. <legal all>
  90. swap
  91. Bit to enable byte swapping of contents of buffer
  92. <enum 0 Byte_swap_disable >
  93. <enum 1 byte_swap_enable >
  94. <legal all>
  95. index_search_en
  96. When this bit is set to 1 control_buffer_addr[19:0] will
  97. be considered as index of the AST or Flow table and GSE
  98. commands will be executed accordingly on the entry pointed
  99. by the index.
  100. This feature is disabled by setting this bit to 0.
  101. <enum 0 index_based_cmd_disable>
  102. <enum 1 index_based_cmd_enable>
  103. <legal all>
  104. cache_set_num
  105. Cache set number that should be used to cache the index
  106. based search results, for address and flow search. This
  107. value should be equal to value of cache_set_num for the
  108. index that is issued in TCL_DATA_CMD during search index
  109. based ASE or FSE. This field is valid for index based GSE
  110. commands
  111. <legal all>
  112. reserved_1a
  113. <legal 0>
  114. cmd_meta_data_31_0
  115. Meta data to be returned in the status descriptor
  116. <legal all>
  117. cmd_meta_data_63_32
  118. Meta data to be returned in the status descriptor
  119. <legal all>
  120. reserved_4a
  121. <legal 0>
  122. reserved_5a
  123. <legal 0>
  124. reserved_6a
  125. <legal 0>
  126. ring_id
  127. Helps with debugging when dumping ring contents.
  128. <legal all>
  129. looping_count
  130. A count value that indicates the number of times the
  131. producer of entries into the Ring has looped around the
  132. ring.
  133. At initialization time, this value is set to 0. On the
  134. first loop, this value is set to 1. After the max value is
  135. reached allowed by the number of bits for this field, the
  136. count value continues with 0 again.
  137. In case SW is the consumer of the ring entries, it can
  138. use this field to figure out up to where the producer of
  139. entries has created new entries. This eliminates the need to
  140. check where the head pointer' of the ring is located once
  141. the SW starts processing an interrupt indicating that new
  142. entries have been put into this ring...
  143. Also note that SW if it wants only needs to look at the
  144. LSB bit of this count value.
  145. <legal all>
  146. */
  147. /* Description TCL_GSE_CMD_0_CONTROL_BUFFER_ADDR_31_0
  148. Address (lower 32 bits) of a control buffer containing
  149. additional info needed for this command execution.
  150. <legal all>
  151. */
  152. #define TCL_GSE_CMD_0_CONTROL_BUFFER_ADDR_31_0_OFFSET 0x00000000
  153. #define TCL_GSE_CMD_0_CONTROL_BUFFER_ADDR_31_0_LSB 0
  154. #define TCL_GSE_CMD_0_CONTROL_BUFFER_ADDR_31_0_MASK 0xffffffff
  155. /* Description TCL_GSE_CMD_1_CONTROL_BUFFER_ADDR_39_32
  156. Address (upper 8 bits) of a control buffer containing
  157. additional info needed for this command execution.
  158. <legal all>
  159. */
  160. #define TCL_GSE_CMD_1_CONTROL_BUFFER_ADDR_39_32_OFFSET 0x00000004
  161. #define TCL_GSE_CMD_1_CONTROL_BUFFER_ADDR_39_32_LSB 0
  162. #define TCL_GSE_CMD_1_CONTROL_BUFFER_ADDR_39_32_MASK 0x000000ff
  163. /* Description TCL_GSE_CMD_1_GSE_CTRL
  164. GSE control operations. This includes cache operations
  165. and table entry statistics read/clear operation.
  166. <enum 0 rd_stat> Report or Read statistics
  167. <enum 1 srch_dis> Search disable. Report only Hash
  168. <enum 2 Wr_bk_single> Write Back single entry
  169. <enum 3 wr_bk_all> Write Back entire cache entry
  170. <enum 4 inval_single> Invalidate single cache entry
  171. <enum 5 inval_all> Invalidate entire cache
  172. <enum 6 wr_bk_inval_single> Write back and Invalidate
  173. single entry in cache
  174. <enum 7 wr_bk_inval_all> write back and invalidate
  175. entire cache
  176. <enum 8 clr_stat_single> Clear statistics for single
  177. entry
  178. <legal 0-8>
  179. Rest of the values reserved.
  180. For all single entry control operations (write back,
  181. Invalidate or both)Statistics will be reported
  182. */
  183. #define TCL_GSE_CMD_1_GSE_CTRL_OFFSET 0x00000004
  184. #define TCL_GSE_CMD_1_GSE_CTRL_LSB 8
  185. #define TCL_GSE_CMD_1_GSE_CTRL_MASK 0x00000f00
  186. /* Description TCL_GSE_CMD_1_GSE_SEL
  187. Bit to select the ASE or FSE to do the operation mention
  188. by GSE_ctrl bit
  189. 0: FSE select
  190. 1: ASE select
  191. */
  192. #define TCL_GSE_CMD_1_GSE_SEL_OFFSET 0x00000004
  193. #define TCL_GSE_CMD_1_GSE_SEL_LSB 12
  194. #define TCL_GSE_CMD_1_GSE_SEL_MASK 0x00001000
  195. /* Description TCL_GSE_CMD_1_STATUS_DESTINATION_RING_ID
  196. The TCL status ring to which the GSE status needs to be
  197. send.
  198. <enum 0 tcl_status_0_ring>
  199. <enum 1 tcl_status_1_ring>
  200. <legal all>
  201. */
  202. #define TCL_GSE_CMD_1_STATUS_DESTINATION_RING_ID_OFFSET 0x00000004
  203. #define TCL_GSE_CMD_1_STATUS_DESTINATION_RING_ID_LSB 13
  204. #define TCL_GSE_CMD_1_STATUS_DESTINATION_RING_ID_MASK 0x00002000
  205. /* Description TCL_GSE_CMD_1_SWAP
  206. Bit to enable byte swapping of contents of buffer
  207. <enum 0 Byte_swap_disable >
  208. <enum 1 byte_swap_enable >
  209. <legal all>
  210. */
  211. #define TCL_GSE_CMD_1_SWAP_OFFSET 0x00000004
  212. #define TCL_GSE_CMD_1_SWAP_LSB 14
  213. #define TCL_GSE_CMD_1_SWAP_MASK 0x00004000
  214. /* Description TCL_GSE_CMD_1_INDEX_SEARCH_EN
  215. When this bit is set to 1 control_buffer_addr[19:0] will
  216. be considered as index of the AST or Flow table and GSE
  217. commands will be executed accordingly on the entry pointed
  218. by the index.
  219. This feature is disabled by setting this bit to 0.
  220. <enum 0 index_based_cmd_disable>
  221. <enum 1 index_based_cmd_enable>
  222. <legal all>
  223. */
  224. #define TCL_GSE_CMD_1_INDEX_SEARCH_EN_OFFSET 0x00000004
  225. #define TCL_GSE_CMD_1_INDEX_SEARCH_EN_LSB 15
  226. #define TCL_GSE_CMD_1_INDEX_SEARCH_EN_MASK 0x00008000
  227. /* Description TCL_GSE_CMD_1_CACHE_SET_NUM
  228. Cache set number that should be used to cache the index
  229. based search results, for address and flow search. This
  230. value should be equal to value of cache_set_num for the
  231. index that is issued in TCL_DATA_CMD during search index
  232. based ASE or FSE. This field is valid for index based GSE
  233. commands
  234. <legal all>
  235. */
  236. #define TCL_GSE_CMD_1_CACHE_SET_NUM_OFFSET 0x00000004
  237. #define TCL_GSE_CMD_1_CACHE_SET_NUM_LSB 16
  238. #define TCL_GSE_CMD_1_CACHE_SET_NUM_MASK 0x000f0000
  239. /* Description TCL_GSE_CMD_1_RESERVED_1A
  240. <legal 0>
  241. */
  242. #define TCL_GSE_CMD_1_RESERVED_1A_OFFSET 0x00000004
  243. #define TCL_GSE_CMD_1_RESERVED_1A_LSB 20
  244. #define TCL_GSE_CMD_1_RESERVED_1A_MASK 0xfff00000
  245. /* Description TCL_GSE_CMD_2_CMD_META_DATA_31_0
  246. Meta data to be returned in the status descriptor
  247. <legal all>
  248. */
  249. #define TCL_GSE_CMD_2_CMD_META_DATA_31_0_OFFSET 0x00000008
  250. #define TCL_GSE_CMD_2_CMD_META_DATA_31_0_LSB 0
  251. #define TCL_GSE_CMD_2_CMD_META_DATA_31_0_MASK 0xffffffff
  252. /* Description TCL_GSE_CMD_3_CMD_META_DATA_63_32
  253. Meta data to be returned in the status descriptor
  254. <legal all>
  255. */
  256. #define TCL_GSE_CMD_3_CMD_META_DATA_63_32_OFFSET 0x0000000c
  257. #define TCL_GSE_CMD_3_CMD_META_DATA_63_32_LSB 0
  258. #define TCL_GSE_CMD_3_CMD_META_DATA_63_32_MASK 0xffffffff
  259. /* Description TCL_GSE_CMD_4_RESERVED_4A
  260. <legal 0>
  261. */
  262. #define TCL_GSE_CMD_4_RESERVED_4A_OFFSET 0x00000010
  263. #define TCL_GSE_CMD_4_RESERVED_4A_LSB 0
  264. #define TCL_GSE_CMD_4_RESERVED_4A_MASK 0xffffffff
  265. /* Description TCL_GSE_CMD_5_RESERVED_5A
  266. <legal 0>
  267. */
  268. #define TCL_GSE_CMD_5_RESERVED_5A_OFFSET 0x00000014
  269. #define TCL_GSE_CMD_5_RESERVED_5A_LSB 0
  270. #define TCL_GSE_CMD_5_RESERVED_5A_MASK 0xffffffff
  271. /* Description TCL_GSE_CMD_6_RESERVED_6A
  272. <legal 0>
  273. */
  274. #define TCL_GSE_CMD_6_RESERVED_6A_OFFSET 0x00000018
  275. #define TCL_GSE_CMD_6_RESERVED_6A_LSB 0
  276. #define TCL_GSE_CMD_6_RESERVED_6A_MASK 0x000fffff
  277. /* Description TCL_GSE_CMD_6_RING_ID
  278. Helps with debugging when dumping ring contents.
  279. <legal all>
  280. */
  281. #define TCL_GSE_CMD_6_RING_ID_OFFSET 0x00000018
  282. #define TCL_GSE_CMD_6_RING_ID_LSB 20
  283. #define TCL_GSE_CMD_6_RING_ID_MASK 0x0ff00000
  284. /* Description TCL_GSE_CMD_6_LOOPING_COUNT
  285. A count value that indicates the number of times the
  286. producer of entries into the Ring has looped around the
  287. ring.
  288. At initialization time, this value is set to 0. On the
  289. first loop, this value is set to 1. After the max value is
  290. reached allowed by the number of bits for this field, the
  291. count value continues with 0 again.
  292. In case SW is the consumer of the ring entries, it can
  293. use this field to figure out up to where the producer of
  294. entries has created new entries. This eliminates the need to
  295. check where the head pointer' of the ring is located once
  296. the SW starts processing an interrupt indicating that new
  297. entries have been put into this ring...
  298. Also note that SW if it wants only needs to look at the
  299. LSB bit of this count value.
  300. <legal all>
  301. */
  302. #define TCL_GSE_CMD_6_LOOPING_COUNT_OFFSET 0x00000018
  303. #define TCL_GSE_CMD_6_LOOPING_COUNT_LSB 28
  304. #define TCL_GSE_CMD_6_LOOPING_COUNT_MASK 0xf0000000
  305. #endif // _TCL_GSE_CMD_H_