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