ce_src_desc.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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 _CE_SRC_DESC_H_
  17. #define _CE_SRC_DESC_H_
  18. #if !defined(__ASSEMBLER__)
  19. #endif
  20. // ################ START SUMMARY #################
  21. //
  22. // Dword Fields
  23. // 0 src_buffer_low[31:0]
  24. // 1 src_buffer_high[7:0], toeplitz_en[8], src_swap[9], dest_swap[10], gather[11], ce_res_0[15:12], length[31:16]
  25. // 2 fw_metadata[15:0], ce_res_1[31:16]
  26. // 3 ce_res_2[19:0], ring_id[27:20], looping_count[31:28]
  27. //
  28. // ################ END SUMMARY #################
  29. #define NUM_OF_DWORDS_CE_SRC_DESC 4
  30. struct ce_src_desc {
  31. uint32_t src_buffer_low : 32; //[31:0]
  32. uint32_t src_buffer_high : 8, //[7:0]
  33. toeplitz_en : 1, //[8]
  34. src_swap : 1, //[9]
  35. dest_swap : 1, //[10]
  36. gather : 1, //[11]
  37. ce_res_0 : 4, //[15:12]
  38. length : 16; //[31:16]
  39. uint32_t fw_metadata : 16, //[15:0]
  40. ce_res_1 : 16; //[31:16]
  41. uint32_t ce_res_2 : 20, //[19:0]
  42. ring_id : 8, //[27:20]
  43. looping_count : 4; //[31:28]
  44. };
  45. /*
  46. src_buffer_low
  47. LSB 32 bits of the 40 Bit Pointer to the source buffer
  48. <legal all>
  49. src_buffer_high
  50. MSB 8 bits of the 40 Bit Pointer to the source buffer
  51. <legal all>
  52. toeplitz_en
  53. Enable generation of 32-bit Toeplitz-LFSR hash for the
  54. data transfer
  55. In case of gather field in first source ring entry of
  56. the gather copy cycle in taken into account.
  57. <legal all>
  58. src_swap
  59. Treats source memory organization as big-endian. For
  60. each dword read (4 bytes), the byte 0 is swapped with byte 3
  61. and byte 1 is swapped with byte 2.
  62. In case of gather field in first source ring entry of
  63. the gather copy cycle in taken into account.
  64. <legal all>
  65. dest_swap
  66. Treats destination memory organization as big-endian.
  67. For each dword write (4 bytes), the byte 0 is swapped with
  68. byte 3 and byte 1 is swapped with byte 2.
  69. In case of gather field in first source ring entry of
  70. the gather copy cycle in taken into account.
  71. <legal all>
  72. gather
  73. Enables gather of multiple copy engine source
  74. descriptors to one destination.
  75. <legal all>
  76. ce_res_0
  77. Reserved
  78. <legal all>
  79. length
  80. Length of the buffer in units of octets of the current
  81. descriptor
  82. <legal all>
  83. fw_metadata
  84. Meta data used by FW
  85. In case of gather field in first source ring entry of
  86. the gather copy cycle in taken into account.
  87. <legal all>
  88. ce_res_1
  89. Reserved
  90. <legal all>
  91. ce_res_2
  92. Reserved
  93. <legal all>
  94. ring_id
  95. The buffer pointer ring ID.
  96. 0 refers to the IDLE ring
  97. 1 - N refers to other rings
  98. Helps with debugging when dumping ring contents.
  99. <legal all>
  100. looping_count
  101. A count value that indicates the number of times the
  102. producer of entries into the Ring has looped around the
  103. ring.
  104. At initialization time, this value is set to 0. On the
  105. first loop, this value is set to 1. After the max value is
  106. reached allowed by the number of bits for this field, the
  107. count value continues with 0 again.
  108. In case SW is the consumer of the ring entries, it can
  109. use this field to figure out up to where the producer of
  110. entries has created new entries. This eliminates the need to
  111. check where the head pointer' of the ring is located once
  112. the SW starts processing an interrupt indicating that new
  113. entries have been put into this ring...
  114. Also note that SW if it wants only needs to look at the
  115. LSB bit of this count value.
  116. <legal all>
  117. */
  118. /* Description CE_SRC_DESC_0_SRC_BUFFER_LOW
  119. LSB 32 bits of the 40 Bit Pointer to the source buffer
  120. <legal all>
  121. */
  122. #define CE_SRC_DESC_0_SRC_BUFFER_LOW_OFFSET 0x00000000
  123. #define CE_SRC_DESC_0_SRC_BUFFER_LOW_LSB 0
  124. #define CE_SRC_DESC_0_SRC_BUFFER_LOW_MASK 0xffffffff
  125. /* Description CE_SRC_DESC_1_SRC_BUFFER_HIGH
  126. MSB 8 bits of the 40 Bit Pointer to the source buffer
  127. <legal all>
  128. */
  129. #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_OFFSET 0x00000004
  130. #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_LSB 0
  131. #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_MASK 0x000000ff
  132. /* Description CE_SRC_DESC_1_TOEPLITZ_EN
  133. Enable generation of 32-bit Toeplitz-LFSR hash for the
  134. data transfer
  135. In case of gather field in first source ring entry of
  136. the gather copy cycle in taken into account.
  137. <legal all>
  138. */
  139. #define CE_SRC_DESC_1_TOEPLITZ_EN_OFFSET 0x00000004
  140. #define CE_SRC_DESC_1_TOEPLITZ_EN_LSB 8
  141. #define CE_SRC_DESC_1_TOEPLITZ_EN_MASK 0x00000100
  142. /* Description CE_SRC_DESC_1_SRC_SWAP
  143. Treats source memory organization as big-endian. For
  144. each dword read (4 bytes), the byte 0 is swapped with byte 3
  145. and byte 1 is swapped with byte 2.
  146. In case of gather field in first source ring entry of
  147. the gather copy cycle in taken into account.
  148. <legal all>
  149. */
  150. #define CE_SRC_DESC_1_SRC_SWAP_OFFSET 0x00000004
  151. #define CE_SRC_DESC_1_SRC_SWAP_LSB 9
  152. #define CE_SRC_DESC_1_SRC_SWAP_MASK 0x00000200
  153. /* Description CE_SRC_DESC_1_DEST_SWAP
  154. Treats destination memory organization as big-endian.
  155. For each dword write (4 bytes), the byte 0 is swapped with
  156. byte 3 and byte 1 is swapped with byte 2.
  157. In case of gather field in first source ring entry of
  158. the gather copy cycle in taken into account.
  159. <legal all>
  160. */
  161. #define CE_SRC_DESC_1_DEST_SWAP_OFFSET 0x00000004
  162. #define CE_SRC_DESC_1_DEST_SWAP_LSB 10
  163. #define CE_SRC_DESC_1_DEST_SWAP_MASK 0x00000400
  164. /* Description CE_SRC_DESC_1_GATHER
  165. Enables gather of multiple copy engine source
  166. descriptors to one destination.
  167. <legal all>
  168. */
  169. #define CE_SRC_DESC_1_GATHER_OFFSET 0x00000004
  170. #define CE_SRC_DESC_1_GATHER_LSB 11
  171. #define CE_SRC_DESC_1_GATHER_MASK 0x00000800
  172. /* Description CE_SRC_DESC_1_CE_RES_0
  173. Reserved
  174. <legal all>
  175. */
  176. #define CE_SRC_DESC_1_CE_RES_0_OFFSET 0x00000004
  177. #define CE_SRC_DESC_1_CE_RES_0_LSB 12
  178. #define CE_SRC_DESC_1_CE_RES_0_MASK 0x0000f000
  179. /* Description CE_SRC_DESC_1_LENGTH
  180. Length of the buffer in units of octets of the current
  181. descriptor
  182. <legal all>
  183. */
  184. #define CE_SRC_DESC_1_LENGTH_OFFSET 0x00000004
  185. #define CE_SRC_DESC_1_LENGTH_LSB 16
  186. #define CE_SRC_DESC_1_LENGTH_MASK 0xffff0000
  187. /* Description CE_SRC_DESC_2_FW_METADATA
  188. Meta data used by FW
  189. In case of gather field in first source ring entry of
  190. the gather copy cycle in taken into account.
  191. <legal all>
  192. */
  193. #define CE_SRC_DESC_2_FW_METADATA_OFFSET 0x00000008
  194. #define CE_SRC_DESC_2_FW_METADATA_LSB 0
  195. #define CE_SRC_DESC_2_FW_METADATA_MASK 0x0000ffff
  196. /* Description CE_SRC_DESC_2_CE_RES_1
  197. Reserved
  198. <legal all>
  199. */
  200. #define CE_SRC_DESC_2_CE_RES_1_OFFSET 0x00000008
  201. #define CE_SRC_DESC_2_CE_RES_1_LSB 16
  202. #define CE_SRC_DESC_2_CE_RES_1_MASK 0xffff0000
  203. /* Description CE_SRC_DESC_3_CE_RES_2
  204. Reserved
  205. <legal all>
  206. */
  207. #define CE_SRC_DESC_3_CE_RES_2_OFFSET 0x0000000c
  208. #define CE_SRC_DESC_3_CE_RES_2_LSB 0
  209. #define CE_SRC_DESC_3_CE_RES_2_MASK 0x000fffff
  210. /* Description CE_SRC_DESC_3_RING_ID
  211. The buffer pointer ring ID.
  212. 0 refers to the IDLE ring
  213. 1 - N refers to other rings
  214. Helps with debugging when dumping ring contents.
  215. <legal all>
  216. */
  217. #define CE_SRC_DESC_3_RING_ID_OFFSET 0x0000000c
  218. #define CE_SRC_DESC_3_RING_ID_LSB 20
  219. #define CE_SRC_DESC_3_RING_ID_MASK 0x0ff00000
  220. /* Description CE_SRC_DESC_3_LOOPING_COUNT
  221. A count value that indicates the number of times the
  222. producer of entries into the Ring has looped around the
  223. ring.
  224. At initialization time, this value is set to 0. On the
  225. first loop, this value is set to 1. After the max value is
  226. reached allowed by the number of bits for this field, the
  227. count value continues with 0 again.
  228. In case SW is the consumer of the ring entries, it can
  229. use this field to figure out up to where the producer of
  230. entries has created new entries. This eliminates the need to
  231. check where the head pointer' of the ring is located once
  232. the SW starts processing an interrupt indicating that new
  233. entries have been put into this ring...
  234. Also note that SW if it wants only needs to look at the
  235. LSB bit of this count value.
  236. <legal all>
  237. */
  238. #define CE_SRC_DESC_3_LOOPING_COUNT_OFFSET 0x0000000c
  239. #define CE_SRC_DESC_3_LOOPING_COUNT_LSB 28
  240. #define CE_SRC_DESC_3_LOOPING_COUNT_MASK 0xf0000000
  241. #endif // _CE_SRC_DESC_H_