xref: /wlan-dirver/fw-api/hw/qca5332/ce_stat_desc.h (revision 36637cf1775e28c58b692de245b10cbcd02fa7c3)
1 
2 /* Copyright (c) 2022, 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 
19 
20 
21 
22 
23 
24 
25 
26 #ifndef _CE_STAT_DESC_H_
27 #define _CE_STAT_DESC_H_
28 #if !defined(__ASSEMBLER__)
29 #endif
30 
31 #define NUM_OF_DWORDS_CE_STAT_DESC 4
32 
33 
34 struct ce_stat_desc {
35 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
36              uint32_t ce_res_5                                                :  8, // [7:0]
37                       toeplitz_en                                             :  1, // [8:8]
38                       src_swap                                                :  1, // [9:9]
39                       dest_swap                                               :  1, // [10:10]
40                       gather                                                  :  1, // [11:11]
41                       barrier_read                                            :  1, // [12:12]
42                       ce_res_6                                                :  3, // [15:13]
43                       length                                                  : 16; // [31:16]
44              uint32_t toeplitz_hash_0                                         : 32; // [31:0]
45              uint32_t toeplitz_hash_1                                         : 32; // [31:0]
46              uint32_t fw_metadata                                             : 16, // [15:0]
47                       ce_res_7                                                :  4, // [19:16]
48                       ring_id                                                 :  8, // [27:20]
49                       looping_count                                           :  4; // [31:28]
50 #else
51              uint32_t length                                                  : 16, // [31:16]
52                       ce_res_6                                                :  3, // [15:13]
53                       barrier_read                                            :  1, // [12:12]
54                       gather                                                  :  1, // [11:11]
55                       dest_swap                                               :  1, // [10:10]
56                       src_swap                                                :  1, // [9:9]
57                       toeplitz_en                                             :  1, // [8:8]
58                       ce_res_5                                                :  8; // [7:0]
59              uint32_t toeplitz_hash_0                                         : 32; // [31:0]
60              uint32_t toeplitz_hash_1                                         : 32; // [31:0]
61              uint32_t looping_count                                           :  4, // [31:28]
62                       ring_id                                                 :  8, // [27:20]
63                       ce_res_7                                                :  4, // [19:16]
64                       fw_metadata                                             : 16; // [15:0]
65 #endif
66 };
67 
68 
69 /* Description		CE_RES_5
70 
71 			Reserved
72 			<legal all>
73 */
74 
75 #define CE_STAT_DESC_CE_RES_5_OFFSET                                                0x00000000
76 #define CE_STAT_DESC_CE_RES_5_LSB                                                   0
77 #define CE_STAT_DESC_CE_RES_5_MSB                                                   7
78 #define CE_STAT_DESC_CE_RES_5_MASK                                                  0x000000ff
79 
80 
81 /* Description		TOEPLITZ_EN
82 
83 			32-bit Toeplitz-LFSR hash for the data transfer, Enabled
84 
85 			<legal all>
86 */
87 
88 #define CE_STAT_DESC_TOEPLITZ_EN_OFFSET                                             0x00000000
89 #define CE_STAT_DESC_TOEPLITZ_EN_LSB                                                8
90 #define CE_STAT_DESC_TOEPLITZ_EN_MSB                                                8
91 #define CE_STAT_DESC_TOEPLITZ_EN_MASK                                               0x00000100
92 
93 
94 /* Description		SRC_SWAP
95 
96 			Source memory buffer swapped
97 			<legal all>
98 */
99 
100 #define CE_STAT_DESC_SRC_SWAP_OFFSET                                                0x00000000
101 #define CE_STAT_DESC_SRC_SWAP_LSB                                                   9
102 #define CE_STAT_DESC_SRC_SWAP_MSB                                                   9
103 #define CE_STAT_DESC_SRC_SWAP_MASK                                                  0x00000200
104 
105 
106 /* Description		DEST_SWAP
107 
108 			Destination  memory buffer swapped
109 			<legal all>
110 */
111 
112 #define CE_STAT_DESC_DEST_SWAP_OFFSET                                               0x00000000
113 #define CE_STAT_DESC_DEST_SWAP_LSB                                                  10
114 #define CE_STAT_DESC_DEST_SWAP_MSB                                                  10
115 #define CE_STAT_DESC_DEST_SWAP_MASK                                                 0x00000400
116 
117 
118 /* Description		GATHER
119 
120 			Gather of multiple copy engine source descriptors to one
121 			 destination enabled
122 			<legal all>
123 */
124 
125 #define CE_STAT_DESC_GATHER_OFFSET                                                  0x00000000
126 #define CE_STAT_DESC_GATHER_LSB                                                     11
127 #define CE_STAT_DESC_GATHER_MSB                                                     11
128 #define CE_STAT_DESC_GATHER_MASK                                                    0x00000800
129 
130 
131 /* Description		BARRIER_READ
132 
133 			Barrier read enabled
134 			<legal all>
135 */
136 
137 #define CE_STAT_DESC_BARRIER_READ_OFFSET                                            0x00000000
138 #define CE_STAT_DESC_BARRIER_READ_LSB                                               12
139 #define CE_STAT_DESC_BARRIER_READ_MSB                                               12
140 #define CE_STAT_DESC_BARRIER_READ_MASK                                              0x00001000
141 
142 
143 /* Description		CE_RES_6
144 
145 			Reserved
146 			<legal all>
147 */
148 
149 #define CE_STAT_DESC_CE_RES_6_OFFSET                                                0x00000000
150 #define CE_STAT_DESC_CE_RES_6_LSB                                                   13
151 #define CE_STAT_DESC_CE_RES_6_MSB                                                   15
152 #define CE_STAT_DESC_CE_RES_6_MASK                                                  0x0000e000
153 
154 
155 /* Description		LENGTH
156 
157 			Sum of all the Lengths of the source descriptor in the gather
158 			 chain
159 			<legal all>
160 */
161 
162 #define CE_STAT_DESC_LENGTH_OFFSET                                                  0x00000000
163 #define CE_STAT_DESC_LENGTH_LSB                                                     16
164 #define CE_STAT_DESC_LENGTH_MSB                                                     31
165 #define CE_STAT_DESC_LENGTH_MASK                                                    0xffff0000
166 
167 
168 /* Description		TOEPLITZ_HASH_0
169 
170 			32 LS bits of 64 bit Toeplitz LFSR hash result
171 			<legal all>
172 */
173 
174 #define CE_STAT_DESC_TOEPLITZ_HASH_0_OFFSET                                         0x00000004
175 #define CE_STAT_DESC_TOEPLITZ_HASH_0_LSB                                            0
176 #define CE_STAT_DESC_TOEPLITZ_HASH_0_MSB                                            31
177 #define CE_STAT_DESC_TOEPLITZ_HASH_0_MASK                                           0xffffffff
178 
179 
180 /* Description		TOEPLITZ_HASH_1
181 
182 			32 MS bits of 64 bit Toeplitz LFSR hash result
183 			<legal all>
184 */
185 
186 #define CE_STAT_DESC_TOEPLITZ_HASH_1_OFFSET                                         0x00000008
187 #define CE_STAT_DESC_TOEPLITZ_HASH_1_LSB                                            0
188 #define CE_STAT_DESC_TOEPLITZ_HASH_1_MSB                                            31
189 #define CE_STAT_DESC_TOEPLITZ_HASH_1_MASK                                           0xffffffff
190 
191 
192 /* Description		FW_METADATA
193 
194 			Meta data used by FW
195 			In case of gather field in first source ring entry of the
196 			 gather copy cycle in taken into account.
197 			<legal all>
198 */
199 
200 #define CE_STAT_DESC_FW_METADATA_OFFSET                                             0x0000000c
201 #define CE_STAT_DESC_FW_METADATA_LSB                                                0
202 #define CE_STAT_DESC_FW_METADATA_MSB                                                15
203 #define CE_STAT_DESC_FW_METADATA_MASK                                               0x0000ffff
204 
205 
206 /* Description		CE_RES_7
207 
208 			Reserved
209 			<legal all>
210 */
211 
212 #define CE_STAT_DESC_CE_RES_7_OFFSET                                                0x0000000c
213 #define CE_STAT_DESC_CE_RES_7_LSB                                                   16
214 #define CE_STAT_DESC_CE_RES_7_MSB                                                   19
215 #define CE_STAT_DESC_CE_RES_7_MASK                                                  0x000f0000
216 
217 
218 /* Description		RING_ID
219 
220 			The buffer pointer ring ID.
221 			0 refers to the IDLE ring
222 			1 - N refers to other rings
223 
224 			Helps with debugging when dumping ring contents.
225 			<legal all>
226 */
227 
228 #define CE_STAT_DESC_RING_ID_OFFSET                                                 0x0000000c
229 #define CE_STAT_DESC_RING_ID_LSB                                                    20
230 #define CE_STAT_DESC_RING_ID_MSB                                                    27
231 #define CE_STAT_DESC_RING_ID_MASK                                                   0x0ff00000
232 
233 
234 /* Description		LOOPING_COUNT
235 
236 			A count value that indicates the number of times the producer
237 			 of entries into the Ring has looped around the ring.
238 			At initialization time, this value is set to 0. On the first
239 			 loop, this value is set to 1. After the max value is reached
240 			 allowed by the number of bits for this field, the count
241 			 value continues with 0 again.
242 			In case SW is the consumer of the ring entries, it can use
243 			 this field to figure out up to where the producer of entries
244 			 has created new entries. This eliminates the need to check
245 			 where the "head pointer' of the ring is located once the
246 			 SW starts processing an interrupt indicating that new entries
247 			 have been put into this ring...
248 			Also note that SW if it wants only needs to look at the
249 			LSB bit of this count value.
250 			<legal all>
251 */
252 
253 #define CE_STAT_DESC_LOOPING_COUNT_OFFSET                                           0x0000000c
254 #define CE_STAT_DESC_LOOPING_COUNT_LSB                                              28
255 #define CE_STAT_DESC_LOOPING_COUNT_MSB                                              31
256 #define CE_STAT_DESC_LOOPING_COUNT_MASK                                             0xf0000000
257 
258 
259 
260 #endif   // CE_STAT_DESC
261