ce_src_desc.h 11 KB

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