1 /*
2  * Copyright (c) 2023-2024 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 
17 
18 #ifndef _MON_DESTINATION_RING_H_
19 #define _MON_DESTINATION_RING_H_
20 
21 #define NUM_OF_DWORDS_MON_DESTINATION_RING 4
22 
23 struct mon_destination_ring {
24 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
25              uint32_t stat_buf_virt_addr_31_0                                 : 32;
26              uint32_t stat_buf_virt_addr_63_32                                : 32;
27              uint32_t ppdu_id                                                 : 32;
28              uint32_t end_offset                                              : 12,
29                       reserved_3a                                             :  2,
30                       link_info                                               :  2,
31                       end_reason                                              :  2,
32                       initiator                                               :  1,
33                       empty_descriptor                                        :  1,
34                       ring_id                                                 :  8,
35                       looping_count                                           :  4;
36 #else
37              uint32_t stat_buf_virt_addr_31_0                                 : 32;
38              uint32_t stat_buf_virt_addr_63_32                                : 32;
39              uint32_t ppdu_id                                                 : 32;
40              uint32_t looping_count                                           :  4,
41                       ring_id                                                 :  8,
42                       empty_descriptor                                        :  1,
43                       initiator                                               :  1,
44                       end_reason                                              :  2,
45                       link_info                                               :  2,
46                       reserved_3a                                             :  2,
47                       end_offset                                              : 12;
48 #endif
49 };
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 
56 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_OFFSET                        0x00000004
57 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_LSB                           0
58 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MSB                           31
59 #define MON_DESTINATION_RING_STAT_BUF_VIRT_ADDR_63_32_MASK                          0xffffffff
60 
61 #define MON_DESTINATION_RING_PPDU_ID_OFFSET                                         0x00000008
62 #define MON_DESTINATION_RING_PPDU_ID_LSB                                            0
63 #define MON_DESTINATION_RING_PPDU_ID_MSB                                            31
64 #define MON_DESTINATION_RING_PPDU_ID_MASK                                           0xffffffff
65 
66 #define MON_DESTINATION_RING_END_OFFSET_OFFSET                                      0x0000000c
67 #define MON_DESTINATION_RING_END_OFFSET_LSB                                         0
68 #define MON_DESTINATION_RING_END_OFFSET_MSB                                         11
69 #define MON_DESTINATION_RING_END_OFFSET_MASK                                        0x00000fff
70 
71 #define MON_DESTINATION_RING_RESERVED_3A_OFFSET                                     0x0000000c
72 #define MON_DESTINATION_RING_RESERVED_3A_LSB                                        12
73 #define MON_DESTINATION_RING_RESERVED_3A_MSB                                        13
74 #define MON_DESTINATION_RING_RESERVED_3A_MASK                                       0x00003000
75 
76 #define MON_DESTINATION_RING_LINK_INFO_OFFSET                                       0x0000000c
77 #define MON_DESTINATION_RING_LINK_INFO_LSB                                          14
78 #define MON_DESTINATION_RING_LINK_INFO_MSB                                          15
79 #define MON_DESTINATION_RING_LINK_INFO_MASK                                         0x0000c000
80 
81 #define MON_DESTINATION_RING_END_REASON_OFFSET                                      0x0000000c
82 #define MON_DESTINATION_RING_END_REASON_LSB                                         16
83 #define MON_DESTINATION_RING_END_REASON_MSB                                         17
84 #define MON_DESTINATION_RING_END_REASON_MASK                                        0x00030000
85 
86 #define MON_DESTINATION_RING_INITIATOR_OFFSET                                       0x0000000c
87 #define MON_DESTINATION_RING_INITIATOR_LSB                                          18
88 #define MON_DESTINATION_RING_INITIATOR_MSB                                          18
89 #define MON_DESTINATION_RING_INITIATOR_MASK                                         0x00040000
90 
91 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_OFFSET                                0x0000000c
92 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_LSB                                   19
93 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MSB                                   19
94 #define MON_DESTINATION_RING_EMPTY_DESCRIPTOR_MASK                                  0x00080000
95 
96 #define MON_DESTINATION_RING_RING_ID_OFFSET                                         0x0000000c
97 #define MON_DESTINATION_RING_RING_ID_LSB                                            20
98 #define MON_DESTINATION_RING_RING_ID_MSB                                            27
99 #define MON_DESTINATION_RING_RING_ID_MASK                                           0x0ff00000
100 
101 #define MON_DESTINATION_RING_LOOPING_COUNT_OFFSET                                   0x0000000c
102 #define MON_DESTINATION_RING_LOOPING_COUNT_LSB                                      28
103 #define MON_DESTINATION_RING_LOOPING_COUNT_MSB                                      31
104 #define MON_DESTINATION_RING_LOOPING_COUNT_MASK                                     0xf0000000
105 
106 #endif
107