reo_flush_cache.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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 _REO_FLUSH_CACHE_H_
  16. #define _REO_FLUSH_CACHE_H_
  17. #if !defined(__ASSEMBLER__)
  18. #endif
  19. #include "uniform_reo_cmd_header.h"
  20. #define NUM_OF_DWORDS_REO_FLUSH_CACHE 10
  21. #define NUM_OF_QWORDS_REO_FLUSH_CACHE 5
  22. struct reo_flush_cache {
  23. #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
  24. struct uniform_reo_cmd_header cmd_header;
  25. uint32_t flush_addr_31_0 : 32; // [31:0]
  26. uint32_t flush_addr_39_32 : 8, // [7:0]
  27. forward_all_mpdus_in_queue : 1, // [8:8]
  28. release_cache_block_index : 1, // [9:9]
  29. cache_block_resource_index : 2, // [11:10]
  30. flush_without_invalidate : 1, // [12:12]
  31. block_cache_usage_after_flush : 1, // [13:13]
  32. flush_entire_cache : 1, // [14:14]
  33. flush_queue_1k_desc : 1, // [15:15]
  34. reserved_2b : 16; // [31:16]
  35. uint32_t reserved_3a : 32; // [31:0]
  36. uint32_t reserved_4a : 32; // [31:0]
  37. uint32_t reserved_5a : 32; // [31:0]
  38. uint32_t reserved_6a : 32; // [31:0]
  39. uint32_t reserved_7a : 32; // [31:0]
  40. uint32_t reserved_8a : 32; // [31:0]
  41. uint32_t tlv64_padding : 32; // [31:0]
  42. #else
  43. struct uniform_reo_cmd_header cmd_header;
  44. uint32_t flush_addr_31_0 : 32; // [31:0]
  45. uint32_t reserved_2b : 16, // [31:16]
  46. flush_queue_1k_desc : 1, // [15:15]
  47. flush_entire_cache : 1, // [14:14]
  48. block_cache_usage_after_flush : 1, // [13:13]
  49. flush_without_invalidate : 1, // [12:12]
  50. cache_block_resource_index : 2, // [11:10]
  51. release_cache_block_index : 1, // [9:9]
  52. forward_all_mpdus_in_queue : 1, // [8:8]
  53. flush_addr_39_32 : 8; // [7:0]
  54. uint32_t reserved_3a : 32; // [31:0]
  55. uint32_t reserved_4a : 32; // [31:0]
  56. uint32_t reserved_5a : 32; // [31:0]
  57. uint32_t reserved_6a : 32; // [31:0]
  58. uint32_t reserved_7a : 32; // [31:0]
  59. uint32_t reserved_8a : 32; // [31:0]
  60. uint32_t tlv64_padding : 32; // [31:0]
  61. #endif
  62. };
  63. /* Description CMD_HEADER
  64. Consumer: REO
  65. Producer: SW
  66. Details for command execution tracking purposes.
  67. */
  68. /* Description REO_CMD_NUMBER
  69. Consumer: REO/SW/DEBUG
  70. Producer: SW
  71. This number can be used by SW to track, identify and link
  72. the created commands with the command statusses
  73. <legal all>
  74. */
  75. #define REO_FLUSH_CACHE_CMD_HEADER_REO_CMD_NUMBER_OFFSET 0x0000000000000000
  76. #define REO_FLUSH_CACHE_CMD_HEADER_REO_CMD_NUMBER_LSB 0
  77. #define REO_FLUSH_CACHE_CMD_HEADER_REO_CMD_NUMBER_MSB 15
  78. #define REO_FLUSH_CACHE_CMD_HEADER_REO_CMD_NUMBER_MASK 0x000000000000ffff
  79. /* Description REO_STATUS_REQUIRED
  80. Consumer: REO
  81. Producer: SW
  82. <enum 0 NoStatus> REO does not need to generate a status
  83. TLV for the execution of this command
  84. <enum 1 StatusRequired> REO shall generate a status TLV
  85. for the execution of this command
  86. <legal all>
  87. */
  88. #define REO_FLUSH_CACHE_CMD_HEADER_REO_STATUS_REQUIRED_OFFSET 0x0000000000000000
  89. #define REO_FLUSH_CACHE_CMD_HEADER_REO_STATUS_REQUIRED_LSB 16
  90. #define REO_FLUSH_CACHE_CMD_HEADER_REO_STATUS_REQUIRED_MSB 16
  91. #define REO_FLUSH_CACHE_CMD_HEADER_REO_STATUS_REQUIRED_MASK 0x0000000000010000
  92. /* Description RESERVED_0A
  93. <legal 0>
  94. */
  95. #define REO_FLUSH_CACHE_CMD_HEADER_RESERVED_0A_OFFSET 0x0000000000000000
  96. #define REO_FLUSH_CACHE_CMD_HEADER_RESERVED_0A_LSB 17
  97. #define REO_FLUSH_CACHE_CMD_HEADER_RESERVED_0A_MSB 31
  98. #define REO_FLUSH_CACHE_CMD_HEADER_RESERVED_0A_MASK 0x00000000fffe0000
  99. /* Description FLUSH_ADDR_31_0
  100. Consumer: REO
  101. Producer: SW
  102. Address (lower 32 bits) of the descriptor to flush
  103. <legal all>
  104. */
  105. #define REO_FLUSH_CACHE_FLUSH_ADDR_31_0_OFFSET 0x0000000000000000
  106. #define REO_FLUSH_CACHE_FLUSH_ADDR_31_0_LSB 32
  107. #define REO_FLUSH_CACHE_FLUSH_ADDR_31_0_MSB 63
  108. #define REO_FLUSH_CACHE_FLUSH_ADDR_31_0_MASK 0xffffffff00000000
  109. /* Description FLUSH_ADDR_39_32
  110. Consumer: REO
  111. Producer: SW
  112. Address (upper 8 bits) of the descriptor to flush
  113. <legal all>
  114. */
  115. #define REO_FLUSH_CACHE_FLUSH_ADDR_39_32_OFFSET 0x0000000000000008
  116. #define REO_FLUSH_CACHE_FLUSH_ADDR_39_32_LSB 0
  117. #define REO_FLUSH_CACHE_FLUSH_ADDR_39_32_MSB 7
  118. #define REO_FLUSH_CACHE_FLUSH_ADDR_39_32_MASK 0x00000000000000ff
  119. /* Description FORWARD_ALL_MPDUS_IN_QUEUE
  120. Is only allowed to be set when the flush address corresponds
  121. with a REO descriptor.
  122. When set, REO shall first forward all the MPDUs held in
  123. the indicated re-order queue, before flushing the descriptor
  124. from the cache.
  125. <legal all>
  126. */
  127. #define REO_FLUSH_CACHE_FORWARD_ALL_MPDUS_IN_QUEUE_OFFSET 0x0000000000000008
  128. #define REO_FLUSH_CACHE_FORWARD_ALL_MPDUS_IN_QUEUE_LSB 8
  129. #define REO_FLUSH_CACHE_FORWARD_ALL_MPDUS_IN_QUEUE_MSB 8
  130. #define REO_FLUSH_CACHE_FORWARD_ALL_MPDUS_IN_QUEUE_MASK 0x0000000000000100
  131. /* Description RELEASE_CACHE_BLOCK_INDEX
  132. Field not valid when Flush_entire_cache is set.
  133. If SW has previously used a blocking resource that it now
  134. wants to re-use for this command, this bit shall be set.
  135. It prevents SW from having to send a separate REO_UNBLOCK_CACHE
  136. command.
  137. When set, HW will first release the blocking resource (indicated
  138. in field 'Cache_block_resouce_index') before this command
  139. gets executed.
  140. If that resource was already unblocked, this will be considered
  141. an error. This command will not be executed, and an error
  142. shall be returned.
  143. <legal all>
  144. */
  145. #define REO_FLUSH_CACHE_RELEASE_CACHE_BLOCK_INDEX_OFFSET 0x0000000000000008
  146. #define REO_FLUSH_CACHE_RELEASE_CACHE_BLOCK_INDEX_LSB 9
  147. #define REO_FLUSH_CACHE_RELEASE_CACHE_BLOCK_INDEX_MSB 9
  148. #define REO_FLUSH_CACHE_RELEASE_CACHE_BLOCK_INDEX_MASK 0x0000000000000200
  149. /* Description CACHE_BLOCK_RESOURCE_INDEX
  150. Field not valid when Flush_entire_cache is set.
  151. Indicates which of the four blocking resources in REO will
  152. be assigned for managing the blocking of this (descriptor)
  153. address
  154. <legal all>
  155. */
  156. #define REO_FLUSH_CACHE_CACHE_BLOCK_RESOURCE_INDEX_OFFSET 0x0000000000000008
  157. #define REO_FLUSH_CACHE_CACHE_BLOCK_RESOURCE_INDEX_LSB 10
  158. #define REO_FLUSH_CACHE_CACHE_BLOCK_RESOURCE_INDEX_MSB 11
  159. #define REO_FLUSH_CACHE_CACHE_BLOCK_RESOURCE_INDEX_MASK 0x0000000000000c00
  160. /* Description FLUSH_WITHOUT_INVALIDATE
  161. Field not valid when Flush_entire_cache is set.
  162. When set, REO shall flush the cache line contents from the
  163. cache, but there is NO need to invalidate the cache line
  164. entry... The contents in the cache can be maintained. This
  165. feature can be used by SW (and DV) to get a current snapshot
  166. of the contents in the cache
  167. <legal all>
  168. */
  169. #define REO_FLUSH_CACHE_FLUSH_WITHOUT_INVALIDATE_OFFSET 0x0000000000000008
  170. #define REO_FLUSH_CACHE_FLUSH_WITHOUT_INVALIDATE_LSB 12
  171. #define REO_FLUSH_CACHE_FLUSH_WITHOUT_INVALIDATE_MSB 12
  172. #define REO_FLUSH_CACHE_FLUSH_WITHOUT_INVALIDATE_MASK 0x0000000000001000
  173. /* Description BLOCK_CACHE_USAGE_AFTER_FLUSH
  174. Field not valid when Flush_entire_cache is set.
  175. When set, REO shall block any cache accesses to this address
  176. till explicitly unblocked.
  177. Whenever SW sets this bit, SW shall also set bit 'Forward_all_mpdus_in_queue'
  178. to ensure all packets are flushed out in order to make sure
  179. this queue desc is not in one of the aging link lists.
  180. In case SW does not want to flush the MPDUs in the queue,
  181. see the recipe description below this TLV definition.
  182. The 'blocking' index to be used for this is indicated in
  183. field 'cache_block_resource_index'. If SW had previously
  184. used this blocking resource and was not freed up yet, SW
  185. shall first unblock that index (by setting bit Release_cache_block_index)
  186. or use an unblock command.
  187. If the resource indicated here was already blocked (and
  188. did not get unblocked in this command), it is considered
  189. an error scenario...
  190. No flush shall happen. The status for this command shall
  191. indicate error.
  192. <legal all>
  193. */
  194. #define REO_FLUSH_CACHE_BLOCK_CACHE_USAGE_AFTER_FLUSH_OFFSET 0x0000000000000008
  195. #define REO_FLUSH_CACHE_BLOCK_CACHE_USAGE_AFTER_FLUSH_LSB 13
  196. #define REO_FLUSH_CACHE_BLOCK_CACHE_USAGE_AFTER_FLUSH_MSB 13
  197. #define REO_FLUSH_CACHE_BLOCK_CACHE_USAGE_AFTER_FLUSH_MASK 0x0000000000002000
  198. /* Description FLUSH_ENTIRE_CACHE
  199. When set, the entire cache shall be flushed. The entire
  200. cache will also remain blocked, till the 'REO_UNBLOCK_COMMAND'
  201. is received with bit unblock type set to unblock_cache.
  202. All other fields in this command are to be ignored.
  203. Note that flushing the entire cache has no changes to the
  204. current settings of the blocking resource settings
  205. <legal all>
  206. */
  207. #define REO_FLUSH_CACHE_FLUSH_ENTIRE_CACHE_OFFSET 0x0000000000000008
  208. #define REO_FLUSH_CACHE_FLUSH_ENTIRE_CACHE_LSB 14
  209. #define REO_FLUSH_CACHE_FLUSH_ENTIRE_CACHE_MSB 14
  210. #define REO_FLUSH_CACHE_FLUSH_ENTIRE_CACHE_MASK 0x0000000000004000
  211. /* Description FLUSH_QUEUE_1K_DESC
  212. When set, REO will flush the 'RX_REO_QUEUE_1K' descriptor
  213. after flushing the 'RX_REO_QUEUE' descriptor.
  214. This bit shall only be set when the BA_window_size > 255
  215. in 'RX_REO_QUEUE.'
  216. <legal all>
  217. */
  218. #define REO_FLUSH_CACHE_FLUSH_QUEUE_1K_DESC_OFFSET 0x0000000000000008
  219. #define REO_FLUSH_CACHE_FLUSH_QUEUE_1K_DESC_LSB 15
  220. #define REO_FLUSH_CACHE_FLUSH_QUEUE_1K_DESC_MSB 15
  221. #define REO_FLUSH_CACHE_FLUSH_QUEUE_1K_DESC_MASK 0x0000000000008000
  222. /* Description RESERVED_2B
  223. <legal 0>
  224. */
  225. #define REO_FLUSH_CACHE_RESERVED_2B_OFFSET 0x0000000000000008
  226. #define REO_FLUSH_CACHE_RESERVED_2B_LSB 16
  227. #define REO_FLUSH_CACHE_RESERVED_2B_MSB 31
  228. #define REO_FLUSH_CACHE_RESERVED_2B_MASK 0x00000000ffff0000
  229. /* Description RESERVED_3A
  230. <legal 0>
  231. */
  232. #define REO_FLUSH_CACHE_RESERVED_3A_OFFSET 0x0000000000000008
  233. #define REO_FLUSH_CACHE_RESERVED_3A_LSB 32
  234. #define REO_FLUSH_CACHE_RESERVED_3A_MSB 63
  235. #define REO_FLUSH_CACHE_RESERVED_3A_MASK 0xffffffff00000000
  236. /* Description RESERVED_4A
  237. <legal 0>
  238. */
  239. #define REO_FLUSH_CACHE_RESERVED_4A_OFFSET 0x0000000000000010
  240. #define REO_FLUSH_CACHE_RESERVED_4A_LSB 0
  241. #define REO_FLUSH_CACHE_RESERVED_4A_MSB 31
  242. #define REO_FLUSH_CACHE_RESERVED_4A_MASK 0x00000000ffffffff
  243. /* Description RESERVED_5A
  244. <legal 0>
  245. */
  246. #define REO_FLUSH_CACHE_RESERVED_5A_OFFSET 0x0000000000000010
  247. #define REO_FLUSH_CACHE_RESERVED_5A_LSB 32
  248. #define REO_FLUSH_CACHE_RESERVED_5A_MSB 63
  249. #define REO_FLUSH_CACHE_RESERVED_5A_MASK 0xffffffff00000000
  250. /* Description RESERVED_6A
  251. <legal 0>
  252. */
  253. #define REO_FLUSH_CACHE_RESERVED_6A_OFFSET 0x0000000000000018
  254. #define REO_FLUSH_CACHE_RESERVED_6A_LSB 0
  255. #define REO_FLUSH_CACHE_RESERVED_6A_MSB 31
  256. #define REO_FLUSH_CACHE_RESERVED_6A_MASK 0x00000000ffffffff
  257. /* Description RESERVED_7A
  258. <legal 0>
  259. */
  260. #define REO_FLUSH_CACHE_RESERVED_7A_OFFSET 0x0000000000000018
  261. #define REO_FLUSH_CACHE_RESERVED_7A_LSB 32
  262. #define REO_FLUSH_CACHE_RESERVED_7A_MSB 63
  263. #define REO_FLUSH_CACHE_RESERVED_7A_MASK 0xffffffff00000000
  264. /* Description RESERVED_8A
  265. <legal 0>
  266. */
  267. #define REO_FLUSH_CACHE_RESERVED_8A_OFFSET 0x0000000000000020
  268. #define REO_FLUSH_CACHE_RESERVED_8A_LSB 0
  269. #define REO_FLUSH_CACHE_RESERVED_8A_MSB 31
  270. #define REO_FLUSH_CACHE_RESERVED_8A_MASK 0x00000000ffffffff
  271. /* Description TLV64_PADDING
  272. Automatic DWORD padding inserted while converting TLV32
  273. to TLV64 for 64 bit ARCH
  274. <legal 0>
  275. */
  276. #define REO_FLUSH_CACHE_TLV64_PADDING_OFFSET 0x0000000000000020
  277. #define REO_FLUSH_CACHE_TLV64_PADDING_LSB 32
  278. #define REO_FLUSH_CACHE_TLV64_PADDING_MSB 63
  279. #define REO_FLUSH_CACHE_TLV64_PADDING_MASK 0xffffffff00000000
  280. #endif // REO_FLUSH_CACHE