1 
2 /*
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 
19 
20 #ifndef _MON_DESTINATION_RING_H_
21 #define _MON_DESTINATION_RING_H_
22 #if !defined(__ASSEMBLER__)
23 #endif
24 
25 #define NUM_OF_DWORDS_MON_DESTINATION_RING 4
26 
27 struct mon_destination_ring {
28 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
29              uint32_t stat_buf_virt_addr_31_0                                 : 32;
30              uint32_t stat_buf_virt_addr_63_32                                : 32;
31              uint32_t ppdu_id                                                 : 32;
32              uint32_t end_offset                                              : 12,
33                       reserved_3a                                             :  4,
34                       end_reason                                              :  2,
35                       initiator                                               :  1,
36                       empty_descriptor                                        :  1,
37                       ring_id                                                 :  8,
38                       looping_count                                           :  4;
39 #else
40              uint32_t stat_buf_virt_addr_31_0                                 : 32;
41              uint32_t stat_buf_virt_addr_63_32                                : 32;
42              uint32_t ppdu_id                                                 : 32;
43              uint32_t looping_count                                           :  4,
44                       ring_id                                                 :  8,
45                       empty_descriptor                                        :  1,
46                       initiator                                               :  1,
47                       end_reason                                              :  2,
48                       reserved_3a                                             :  4,
49                       end_offset                                              : 12;
50 #endif
51 };
52 
53 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_OFFSET                         0x00000000
54 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_LSB                            0
55 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MSB                            31
56 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_31_0_MASK                           0xffffffff
57 
58 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_OFFSET                        0x00000004
59 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_LSB                           0
60 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MSB                           31
61 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MASK                          0xffffffff
62 
63 #define MON_DESTINATION_RING_PPDU_ID_OFFSET                                         0x00000008
64 #define MON_DESTINATION_RING_PPDU_ID_LSB                                            0
65 #define MON_DESTINATION_RING_PPDU_ID_MSB                                            31
66 #define MON_DESTINATION_RING_PPDU_ID_MASK                                           0xffffffff
67 
68 #define MON_DESTINATION_RING_END_OFFSET_OFFSET                                      0x0000000c
69 #define MON_DESTINATION_RING_END_OFFSET_LSB                                         0
70 #define MON_DESTINATION_RING_END_OFFSET_MSB                                         11
71 #define MON_DESTINATION_RING_END_OFFSET_MASK                                        0x00000fff
72 
73 #define MON_DESTINATION_RING_RESERVED_3A_OFFSET                                     0x0000000c
74 #define MON_DESTINATION_RING_RESERVED_3A_LSB                                        12
75 #define MON_DESTINATION_RING_RESERVED_3A_MSB                                        15
76 #define MON_DESTINATION_RING_RESERVED_3A_MASK                                       0x0000f000
77 
78 #define MON_DESTINATION_RING_END_REASON_OFFSET                                      0x0000000c
79 #define MON_DESTINATION_RING_END_REASON_LSB                                         16
80 #define MON_DESTINATION_RING_END_REASON_MSB                                         17
81 #define MON_DESTINATION_RING_END_REASON_MASK                                        0x00030000
82 
83 #define MON_DESTINATION_RING_INITIATOR_OFFSET                                       0x0000000c
84 #define MON_DESTINATION_RING_INITIATOR_LSB                                          18
85 #define MON_DESTINATION_RING_INITIATOR_MSB                                          18
86 #define MON_DESTINATION_RING_INITIATOR_MASK                                         0x00040000
87 
88 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_OFFSET                                0x0000000c
89 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_LSB                                   19
90 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MSB                                   19
91 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MASK                                  0x00080000
92 
93 #define MON_DESTINATION_RING_RING_ID_OFFSET                                         0x0000000c
94 #define MON_DESTINATION_RING_RING_ID_LSB                                            20
95 #define MON_DESTINATION_RING_RING_ID_MSB                                            27
96 #define MON_DESTINATION_RING_RING_ID_MASK                                           0x0ff00000
97 
98 #define MON_DESTINATION_RING_LOOPING_COUNT_OFFSET                                   0x0000000c
99 #define MON_DESTINATION_RING_LOOPING_COUNT_LSB                                      28
100 #define MON_DESTINATION_RING_LOOPING_COUNT_MSB                                      31
101 #define MON_DESTINATION_RING_LOOPING_COUNT_MASK                                     0xf0000000
102 
103 #endif
104