reo_flush_cache.h 17 KB

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