mon_destination_ring.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 _MON_DESTINATION_RING_H_
  17. #define _MON_DESTINATION_RING_H_
  18. #if !defined(__ASSEMBLER__)
  19. #endif
  20. #define NUM_OF_DWORDS_MON_DESTINATION_RING 4
  21. struct mon_destination_ring {
  22. #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
  23. uint32_t stat_buf_virt_addr_31_0 : 32; // [31:0]
  24. uint32_t stat_buf_virt_addr_63_32 : 32; // [31:0]
  25. uint32_t ppdu_id : 32; // [31:0]
  26. uint32_t end_offset : 12, // [11:0]
  27. reserved_3a : 4, // [15:12]
  28. end_reason : 2, // [17:16]
  29. initiator : 1, // [18:18]
  30. empty_descriptor : 1, // [19:19]
  31. ring_id : 8, // [27:20]
  32. looping_count : 4; // [31:28]
  33. #else
  34. uint32_t stat_buf_virt_addr_31_0 : 32; // [31:0]
  35. uint32_t stat_buf_virt_addr_63_32 : 32; // [31:0]
  36. uint32_t ppdu_id : 32; // [31:0]
  37. uint32_t looping_count : 4, // [31:28]
  38. ring_id : 8, // [27:20]
  39. empty_descriptor : 1, // [19:19]
  40. initiator : 1, // [18:18]
  41. end_reason : 2, // [17:16]
  42. reserved_3a : 4, // [15:12]
  43. end_offset : 12; // [11:0]
  44. #endif
  45. };
  46. /* Description STAT_BUF_VIRT_ADDR_31_0
  47. Lower 32 bits of the 64-bit virtual address of the status
  48. buffer
  49. <legal all>
  50. */
  51. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_OFFSET 0x00000000
  52. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_LSB 0
  53. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MSB 31
  54. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MASK 0xffffffff
  55. /* Description STAT_BUF_VIRT_ADDR_63_32
  56. Upper 32 bits of the 64-bit virtual address of the status
  57. buffer
  58. <legal all>
  59. */
  60. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_OFFSET 0x00000004
  61. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_LSB 0
  62. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MSB 31
  63. #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MASK 0xffffffff
  64. /* Description PPDU_ID
  65. TXMON fills this with the schedule_id from 'TX_FES_SETUP'
  66. when Initiator = 1.
  67. TXMON fills this with the Phy_ppdu_id from 'RX_RESPONSE_REQUIRED_INFO'
  68. when Initiator = 0.
  69. RXMON fills this with the Phy_ppdu_id from 'RX_PPDU_START.'
  70. <legal all>
  71. */
  72. #define MON_DESTINATION_RING_PPDU_ID_OFFSET 0x00000008
  73. #define MON_DESTINATION_RING_PPDU_ID_LSB 0
  74. #define MON_DESTINATION_RING_PPDU_ID_MSB 31
  75. #define MON_DESTINATION_RING_PPDU_ID_MASK 0xffffffff
  76. /* Description END_OFFSET
  77. The offset (in units of 4 bytes) into the status buffer
  78. where DMA ended, i.e. offset to the last TLV + last TLV
  79. size MINUS 1.
  80. In case of a 'TX_FLUSH' or 'RX_FLUSH,' this reflects the
  81. offset at which flush occurred.
  82. <legal all>
  83. */
  84. #define MON_DESTINATION_RING_END_OFFSET_OFFSET 0x0000000c
  85. #define MON_DESTINATION_RING_END_OFFSET_LSB 0
  86. #define MON_DESTINATION_RING_END_OFFSET_MSB 11
  87. #define MON_DESTINATION_RING_END_OFFSET_MASK 0x00000fff
  88. /* Description RESERVED_3A
  89. <legal 0>
  90. */
  91. #define MON_DESTINATION_RING_RESERVED_3A_OFFSET 0x0000000c
  92. #define MON_DESTINATION_RING_RESERVED_3A_LSB 12
  93. #define MON_DESTINATION_RING_RESERVED_3A_MSB 15
  94. #define MON_DESTINATION_RING_RESERVED_3A_MASK 0x0000f000
  95. /* Description END_REASON
  96. <enum 0 MON_status_buffer_full> The status buffer was fully
  97. written.
  98. <enum 1 MON_flush_detected> A 'TX_FLUSH' or 'RX_FLUSH' was
  99. received. This is implicitly the end of the Tx FES or Rx
  100. PPDU. The status buffer data can be discarded by SW.
  101. <enum 2 MON_end_of_PPDU> A 'TX_FES_STATUS_END' or 'RX_PPDU_END'
  102. was received indicating the end of the Tx FES or Rx PPDU.
  103. <enum 3 MON_PPDU_truncated> The PPDU got truncated due to
  104. a system-level error.
  105. <legal all>
  106. */
  107. #define MON_DESTINATION_RING_END_REASON_OFFSET 0x0000000c
  108. #define MON_DESTINATION_RING_END_REASON_LSB 16
  109. #define MON_DESTINATION_RING_END_REASON_MSB 17
  110. #define MON_DESTINATION_RING_END_REASON_MASK 0x00030000
  111. /* Description INITIATOR
  112. 1: This descriptor belongs to a TX FES (TXOP initiator)
  113. 0: This descriptor belongs to a response TX (TXOP responder)
  114. <legal all>
  115. */
  116. #define MON_DESTINATION_RING_INITIATOR_OFFSET 0x0000000c
  117. #define MON_DESTINATION_RING_INITIATOR_LSB 18
  118. #define MON_DESTINATION_RING_INITIATOR_MSB 18
  119. #define MON_DESTINATION_RING_INITIATOR_MASK 0x00040000
  120. /* Description EMPTY_DESCRIPTOR
  121. 0: This descriptor is written on a flush or the end of a
  122. PPDU or the end of status buffer
  123. 1: This descriptor is written to indicate drop information
  124. (see 'MON_DESTINATION_RING_WITH_DROP' structure)
  125. <legal 0>
  126. */
  127. #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_OFFSET 0x0000000c
  128. #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_LSB 19
  129. #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MSB 19
  130. #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MASK 0x00080000
  131. /* Description RING_ID
  132. Consumer: SW/REO/DEBUG
  133. Producer: SRNG (of TXMON/RXMON)
  134. For debugging.
  135. This field is filled in by the SRNG module.
  136. It help to identify the ring that is being looked
  137. <legal 0>
  138. */
  139. #define MON_DESTINATION_RING_RING_ID_OFFSET 0x0000000c
  140. #define MON_DESTINATION_RING_RING_ID_LSB 20
  141. #define MON_DESTINATION_RING_RING_ID_MSB 27
  142. #define MON_DESTINATION_RING_RING_ID_MASK 0x0ff00000
  143. /* Description LOOPING_COUNT
  144. Consumer: SW/DEBUG
  145. Producer: SRNG (of TXMON/RXMON)
  146. For debugging.
  147. This field is filled in by the SRNG module.
  148. A count value that indicates the number of times the producer
  149. of entries into this Ring has looped around the ring.
  150. At initialization time, this value is set to 0. On the first
  151. loop, this value is set to 1. After the max value is reached
  152. allowed by the number of bits for this field, the count
  153. value continues with 0 again.
  154. In case SW is the consumer of the ring entries, it can use
  155. this field to figure out up to where the producer of entries
  156. has created new entries. This eliminates the need to check
  157. where the "head pointer' of the ring is located once the
  158. SW starts processing an interrupt indicating that new entries
  159. have been put into this ring...
  160. Also note that SW if it wants only needs to look at the
  161. LSB bit of this count value.
  162. <legal all>
  163. */
  164. #define MON_DESTINATION_RING_LOOPING_COUNT_OFFSET 0x0000000c
  165. #define MON_DESTINATION_RING_LOOPING_COUNT_LSB 28
  166. #define MON_DESTINATION_RING_LOOPING_COUNT_MSB 31
  167. #define MON_DESTINATION_RING_LOOPING_COUNT_MASK 0xf0000000
  168. #endif // MON_DESTINATION_RING