tcl_gse_cmd.h 14 KB

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