1*5113495bSYour Name 2*5113495bSYour Name /* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. 3*5113495bSYour Name * 4*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for any 5*5113495bSYour Name * purpose with or without fee is hereby granted, provided that the above 6*5113495bSYour Name * copyright notice and this permission notice appear in all copies. 7*5113495bSYour Name * 8*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9*5113495bSYour Name * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10*5113495bSYour Name * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11*5113495bSYour Name * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12*5113495bSYour Name * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13*5113495bSYour Name * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14*5113495bSYour Name * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15*5113495bSYour Name */ 16*5113495bSYour Name 17*5113495bSYour Name 18*5113495bSYour Name 19*5113495bSYour Name 20*5113495bSYour Name 21*5113495bSYour Name 22*5113495bSYour Name 23*5113495bSYour Name 24*5113495bSYour Name 25*5113495bSYour Name 26*5113495bSYour Name #ifndef _MON_DESTINATION_RING_H_ 27*5113495bSYour Name #define _MON_DESTINATION_RING_H_ 28*5113495bSYour Name #if !defined(__ASSEMBLER__) 29*5113495bSYour Name #endif 30*5113495bSYour Name 31*5113495bSYour Name #define NUM_OF_DWORDS_MON_DESTINATION_RING 4 32*5113495bSYour Name 33*5113495bSYour Name 34*5113495bSYour Name struct mon_destination_ring { 35*5113495bSYour Name #ifndef BIG_ENDIAN_HOST 36*5113495bSYour Name uint32_t stat_buf_virt_addr_31_0 : 32; // [31:0] 37*5113495bSYour Name uint32_t stat_buf_virt_addr_63_32 : 32; // [31:0] 38*5113495bSYour Name uint32_t ppdu_id : 32; // [31:0] 39*5113495bSYour Name uint32_t end_offset : 12, // [11:0] 40*5113495bSYour Name reserved_3a : 4, // [15:12] 41*5113495bSYour Name end_reason : 2, // [17:16] 42*5113495bSYour Name initiator : 1, // [18:18] 43*5113495bSYour Name empty_descriptor : 1, // [19:19] 44*5113495bSYour Name ring_id : 8, // [27:20] 45*5113495bSYour Name looping_count : 4; // [31:28] 46*5113495bSYour Name #else 47*5113495bSYour Name uint32_t stat_buf_virt_addr_31_0 : 32; // [31:0] 48*5113495bSYour Name uint32_t stat_buf_virt_addr_63_32 : 32; // [31:0] 49*5113495bSYour Name uint32_t ppdu_id : 32; // [31:0] 50*5113495bSYour Name uint32_t looping_count : 4, // [31:28] 51*5113495bSYour Name ring_id : 8, // [27:20] 52*5113495bSYour Name empty_descriptor : 1, // [19:19] 53*5113495bSYour Name initiator : 1, // [18:18] 54*5113495bSYour Name end_reason : 2, // [17:16] 55*5113495bSYour Name reserved_3a : 4, // [15:12] 56*5113495bSYour Name end_offset : 12; // [11:0] 57*5113495bSYour Name #endif 58*5113495bSYour Name }; 59*5113495bSYour Name 60*5113495bSYour Name 61*5113495bSYour Name /* Description STAT_BUF_VIRT_ADDR_31_0 62*5113495bSYour Name 63*5113495bSYour Name Lower 32 bits of the 64-bit virtual address of the status 64*5113495bSYour Name buffer 65*5113495bSYour Name <legal all> 66*5113495bSYour Name */ 67*5113495bSYour Name 68*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_OFFSET 0x00000000 69*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_LSB 0 70*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MSB 31 71*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MASK 0xffffffff 72*5113495bSYour Name 73*5113495bSYour Name 74*5113495bSYour Name /* Description STAT_BUF_VIRT_ADDR_63_32 75*5113495bSYour Name 76*5113495bSYour Name Upper 32 bits of the 64-bit virtual address of the status 77*5113495bSYour Name buffer 78*5113495bSYour Name <legal all> 79*5113495bSYour Name */ 80*5113495bSYour Name 81*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_OFFSET 0x00000004 82*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_LSB 0 83*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MSB 31 84*5113495bSYour Name #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MASK 0xffffffff 85*5113495bSYour Name 86*5113495bSYour Name 87*5113495bSYour Name /* Description PPDU_ID 88*5113495bSYour Name 89*5113495bSYour Name TXMON fills this with the schedule_id from 'TX_FES_SETUP' 90*5113495bSYour Name when Initiator = 1. 91*5113495bSYour Name TXMON fills this with the Phy_ppdu_id from 'RX_RESPONSE_REQUIRED_INFO' 92*5113495bSYour Name when Initiator = 0. 93*5113495bSYour Name RXMON fills this with the Phy_ppdu_id from 'RX_PPDU_START.' 94*5113495bSYour Name 95*5113495bSYour Name <legal all> 96*5113495bSYour Name */ 97*5113495bSYour Name 98*5113495bSYour Name #define MON_DESTINATION_RING_PPDU_ID_OFFSET 0x00000008 99*5113495bSYour Name #define MON_DESTINATION_RING_PPDU_ID_LSB 0 100*5113495bSYour Name #define MON_DESTINATION_RING_PPDU_ID_MSB 31 101*5113495bSYour Name #define MON_DESTINATION_RING_PPDU_ID_MASK 0xffffffff 102*5113495bSYour Name 103*5113495bSYour Name 104*5113495bSYour Name /* Description END_OFFSET 105*5113495bSYour Name 106*5113495bSYour Name The offset (in units of 4 bytes) into the status buffer 107*5113495bSYour Name where DMA ended, i.e. offset to the last TLV + last TLV 108*5113495bSYour Name size MINUS 1. 109*5113495bSYour Name 110*5113495bSYour Name In case of a 'TX_FLUSH' or 'RX_FLUSH,' this reflects the 111*5113495bSYour Name offset at which flush occurred. 112*5113495bSYour Name <legal all> 113*5113495bSYour Name */ 114*5113495bSYour Name 115*5113495bSYour Name #define MON_DESTINATION_RING_END_OFFSET_OFFSET 0x0000000c 116*5113495bSYour Name #define MON_DESTINATION_RING_END_OFFSET_LSB 0 117*5113495bSYour Name #define MON_DESTINATION_RING_END_OFFSET_MSB 11 118*5113495bSYour Name #define MON_DESTINATION_RING_END_OFFSET_MASK 0x00000fff 119*5113495bSYour Name 120*5113495bSYour Name 121*5113495bSYour Name /* Description RESERVED_3A 122*5113495bSYour Name 123*5113495bSYour Name <legal 0> 124*5113495bSYour Name */ 125*5113495bSYour Name 126*5113495bSYour Name #define MON_DESTINATION_RING_RESERVED_3A_OFFSET 0x0000000c 127*5113495bSYour Name #define MON_DESTINATION_RING_RESERVED_3A_LSB 12 128*5113495bSYour Name #define MON_DESTINATION_RING_RESERVED_3A_MSB 15 129*5113495bSYour Name #define MON_DESTINATION_RING_RESERVED_3A_MASK 0x0000f000 130*5113495bSYour Name 131*5113495bSYour Name 132*5113495bSYour Name /* Description END_REASON 133*5113495bSYour Name 134*5113495bSYour Name <enum 0 MON_status_buffer_full> The status buffer was fully 135*5113495bSYour Name written. 136*5113495bSYour Name <enum 1 MON_flush_detected> A 'TX_FLUSH' or 'RX_FLUSH' was 137*5113495bSYour Name received. This is implicitly the end of the Tx FES or Rx 138*5113495bSYour Name PPDU. The status buffer data can be discarded by SW. 139*5113495bSYour Name <enum 2 MON_end_of_PPDU> A 'TX_FES_STATUS_END' or 'RX_PPDU_END' 140*5113495bSYour Name was received indicating the end of the Tx FES or Rx PPDU. 141*5113495bSYour Name 142*5113495bSYour Name <enum 3 MON_PPDU_truncated> The PPDU got truncated due to 143*5113495bSYour Name a system-level error. 144*5113495bSYour Name <legal all> 145*5113495bSYour Name */ 146*5113495bSYour Name 147*5113495bSYour Name #define MON_DESTINATION_RING_END_REASON_OFFSET 0x0000000c 148*5113495bSYour Name #define MON_DESTINATION_RING_END_REASON_LSB 16 149*5113495bSYour Name #define MON_DESTINATION_RING_END_REASON_MSB 17 150*5113495bSYour Name #define MON_DESTINATION_RING_END_REASON_MASK 0x00030000 151*5113495bSYour Name 152*5113495bSYour Name 153*5113495bSYour Name /* Description INITIATOR 154*5113495bSYour Name 155*5113495bSYour Name 1: This descriptor belongs to a TX FES (TXOP initiator) 156*5113495bSYour Name 0: This descriptor belongs to a response TX (TXOP responder) 157*5113495bSYour Name 158*5113495bSYour Name <legal all> 159*5113495bSYour Name */ 160*5113495bSYour Name 161*5113495bSYour Name #define MON_DESTINATION_RING_INITIATOR_OFFSET 0x0000000c 162*5113495bSYour Name #define MON_DESTINATION_RING_INITIATOR_LSB 18 163*5113495bSYour Name #define MON_DESTINATION_RING_INITIATOR_MSB 18 164*5113495bSYour Name #define MON_DESTINATION_RING_INITIATOR_MASK 0x00040000 165*5113495bSYour Name 166*5113495bSYour Name 167*5113495bSYour Name /* Description EMPTY_DESCRIPTOR 168*5113495bSYour Name 169*5113495bSYour Name 0: This descriptor is written on a flush or the end of a 170*5113495bSYour Name PPDU or the end of status buffer 171*5113495bSYour Name 1: This descriptor is written to indicate drop information 172*5113495bSYour Name (see 'MON_DESTINATION_RING_WITH_DROP' structure) 173*5113495bSYour Name <legal 0> 174*5113495bSYour Name */ 175*5113495bSYour Name 176*5113495bSYour Name #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_OFFSET 0x0000000c 177*5113495bSYour Name #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_LSB 19 178*5113495bSYour Name #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MSB 19 179*5113495bSYour Name #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MASK 0x00080000 180*5113495bSYour Name 181*5113495bSYour Name 182*5113495bSYour Name /* Description RING_ID 183*5113495bSYour Name 184*5113495bSYour Name Consumer: SW/REO/DEBUG 185*5113495bSYour Name Producer: SRNG (of TXMON/RXMON) 186*5113495bSYour Name 187*5113495bSYour Name For debugging. 188*5113495bSYour Name This field is filled in by the SRNG module. 189*5113495bSYour Name It help to identify the ring that is being looked 190*5113495bSYour Name <legal 0> 191*5113495bSYour Name */ 192*5113495bSYour Name 193*5113495bSYour Name #define MON_DESTINATION_RING_RING_ID_OFFSET 0x0000000c 194*5113495bSYour Name #define MON_DESTINATION_RING_RING_ID_LSB 20 195*5113495bSYour Name #define MON_DESTINATION_RING_RING_ID_MSB 27 196*5113495bSYour Name #define MON_DESTINATION_RING_RING_ID_MASK 0x0ff00000 197*5113495bSYour Name 198*5113495bSYour Name 199*5113495bSYour Name /* Description LOOPING_COUNT 200*5113495bSYour Name 201*5113495bSYour Name Consumer: SW/DEBUG 202*5113495bSYour Name Producer: SRNG (of TXMON/RXMON) 203*5113495bSYour Name 204*5113495bSYour Name For debugging. 205*5113495bSYour Name This field is filled in by the SRNG module. 206*5113495bSYour Name 207*5113495bSYour Name A count value that indicates the number of times the producer 208*5113495bSYour Name of entries into this Ring has looped around the ring. 209*5113495bSYour Name At initialization time, this value is set to 0. On the first 210*5113495bSYour Name loop, this value is set to 1. After the max value is reached 211*5113495bSYour Name allowed by the number of bits for this field, the count 212*5113495bSYour Name value continues with 0 again. 213*5113495bSYour Name 214*5113495bSYour Name In case SW is the consumer of the ring entries, it can use 215*5113495bSYour Name this field to figure out up to where the producer of entries 216*5113495bSYour Name has created new entries. This eliminates the need to check 217*5113495bSYour Name where the "head pointer' of the ring is located once the 218*5113495bSYour Name SW starts processing an interrupt indicating that new entries 219*5113495bSYour Name have been put into this ring... 220*5113495bSYour Name 221*5113495bSYour Name Also note that SW if it wants only needs to look at the 222*5113495bSYour Name LSB bit of this count value. 223*5113495bSYour Name <legal all> 224*5113495bSYour Name */ 225*5113495bSYour Name 226*5113495bSYour Name #define MON_DESTINATION_RING_LOOPING_COUNT_OFFSET 0x0000000c 227*5113495bSYour Name #define MON_DESTINATION_RING_LOOPING_COUNT_LSB 28 228*5113495bSYour Name #define MON_DESTINATION_RING_LOOPING_COUNT_MSB 31 229*5113495bSYour Name #define MON_DESTINATION_RING_LOOPING_COUNT_MASK 0xf0000000 230*5113495bSYour Name 231*5113495bSYour Name 232*5113495bSYour Name 233*5113495bSYour Name #endif // MON_DESTINATION_RING 234