xref: /wlan-driver/fw-api/hw/qca6290/11ax/v2/ce_stat_desc.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _CE_STAT_DESC_H_
20 #define _CE_STAT_DESC_H_
21 #if !defined(__ASSEMBLER__)
22 #endif
23 
24 
25 // ################ START SUMMARY #################
26 //
27 //	Dword	Fields
28 //	0	ce_res_5[7:0], toeplitz_en[8], src_swap[9], dest_swap[10], gather[11], ce_res_6[15:12], length[31:16]
29 //	1	toeplitz_hash_0[31:0]
30 //	2	toeplitz_hash_1[31:0]
31 //	3	fw_metadata[15:0], ce_res_7[19:16], ring_id[27:20], looping_count[31:28]
32 //
33 // ################ END SUMMARY #################
34 
35 #define NUM_OF_DWORDS_CE_STAT_DESC 4
36 
37 struct ce_stat_desc {
38              uint32_t ce_res_5                        :  8, //[7:0]
39                       toeplitz_en                     :  1, //[8]
40                       src_swap                        :  1, //[9]
41                       dest_swap                       :  1, //[10]
42                       gather                          :  1, //[11]
43                       ce_res_6                        :  4, //[15:12]
44                       length                          : 16; //[31:16]
45              uint32_t toeplitz_hash_0                 : 32; //[31:0]
46              uint32_t toeplitz_hash_1                 : 32; //[31:0]
47              uint32_t fw_metadata                     : 16, //[15:0]
48                       ce_res_7                        :  4, //[19:16]
49                       ring_id                         :  8, //[27:20]
50                       looping_count                   :  4; //[31:28]
51 };
52 
53 /*
54 
55 ce_res_5
56 
57 			Reserved
58 
59 			<legal all>
60 
61 toeplitz_en
62 
63 
64 			<legal all>
65 
66 src_swap
67 
68 			Source memory buffer swapped
69 
70 			<legal all>
71 
72 dest_swap
73 
74 			Destination  memory buffer swapped
75 
76 			<legal all>
77 
78 gather
79 
80 			Gather of multiple copy engine source descriptors to one
81 			destination enabled
82 
83 			<legal all>
84 
85 ce_res_6
86 
87 			Reserved
88 
89 			<legal all>
90 
91 length
92 
93 			Sum of all the Lengths of the source descriptor in the
94 			gather chain
95 
96 			<legal all>
97 
98 toeplitz_hash_0
99 
100 			32 LS bits of 64 bit Toeplitz LFSR hash result
101 
102 			<legal all>
103 
104 toeplitz_hash_1
105 
106 			32 MS bits of 64 bit Toeplitz LFSR hash result
107 
108 			<legal all>
109 
110 fw_metadata
111 
112 			Meta data used by FW
113 
114 			In case of gather field in first source ring entry of
115 			the gather copy cycle in taken into account.
116 
117 			<legal all>
118 
119 ce_res_7
120 
121 			Reserved
122 
123 			<legal all>
124 
125 ring_id
126 
127 			The buffer pointer ring ID.
128 
129 			0 refers to the IDLE ring
130 
131 			1 - N refers to other rings
132 
133 
134 
135 			Helps with debugging when dumping ring contents.
136 
137 			<legal all>
138 
139 looping_count
140 
141 			A count value that indicates the number of times the
142 			producer of entries into the Ring has looped around the
143 			ring.
144 
145 			At initialization time, this value is set to 0. On the
146 			first loop, this value is set to 1. After the max value is
147 			reached allowed by the number of bits for this field, the
148 			count value continues with 0 again.
149 
150 			In case SW is the consumer of the ring entries, it can
151 			use this field to figure out up to where the producer of
152 			entries has created new entries. This eliminates the need to
153 			check where the head pointer' of the ring is located once
154 			the SW starts processing an interrupt indicating that new
155 			entries have been put into this ring...
156 
157 			Also note that SW if it wants only needs to look at the
158 			LSB bit of this count value.
159 
160 			<legal all>
161 */
162 
163 
164 /* Description		CE_STAT_DESC_0_CE_RES_5
165 
166 			Reserved
167 
168 			<legal all>
169 */
170 #define CE_STAT_DESC_0_CE_RES_5_OFFSET                               0x00000000
171 #define CE_STAT_DESC_0_CE_RES_5_LSB                                  0
172 #define CE_STAT_DESC_0_CE_RES_5_MASK                                 0x000000ff
173 
174 /* Description		CE_STAT_DESC_0_TOEPLITZ_EN
175 
176 
177 			<legal all>
178 */
179 #define CE_STAT_DESC_0_TOEPLITZ_EN_OFFSET                            0x00000000
180 #define CE_STAT_DESC_0_TOEPLITZ_EN_LSB                               8
181 #define CE_STAT_DESC_0_TOEPLITZ_EN_MASK                              0x00000100
182 
183 /* Description		CE_STAT_DESC_0_SRC_SWAP
184 
185 			Source memory buffer swapped
186 
187 			<legal all>
188 */
189 #define CE_STAT_DESC_0_SRC_SWAP_OFFSET                               0x00000000
190 #define CE_STAT_DESC_0_SRC_SWAP_LSB                                  9
191 #define CE_STAT_DESC_0_SRC_SWAP_MASK                                 0x00000200
192 
193 /* Description		CE_STAT_DESC_0_DEST_SWAP
194 
195 			Destination  memory buffer swapped
196 
197 			<legal all>
198 */
199 #define CE_STAT_DESC_0_DEST_SWAP_OFFSET                              0x00000000
200 #define CE_STAT_DESC_0_DEST_SWAP_LSB                                 10
201 #define CE_STAT_DESC_0_DEST_SWAP_MASK                                0x00000400
202 
203 /* Description		CE_STAT_DESC_0_GATHER
204 
205 			Gather of multiple copy engine source descriptors to one
206 			destination enabled
207 
208 			<legal all>
209 */
210 #define CE_STAT_DESC_0_GATHER_OFFSET                                 0x00000000
211 #define CE_STAT_DESC_0_GATHER_LSB                                    11
212 #define CE_STAT_DESC_0_GATHER_MASK                                   0x00000800
213 
214 /* Description		CE_STAT_DESC_0_CE_RES_6
215 
216 			Reserved
217 
218 			<legal all>
219 */
220 #define CE_STAT_DESC_0_CE_RES_6_OFFSET                               0x00000000
221 #define CE_STAT_DESC_0_CE_RES_6_LSB                                  12
222 #define CE_STAT_DESC_0_CE_RES_6_MASK                                 0x0000f000
223 
224 /* Description		CE_STAT_DESC_0_LENGTH
225 
226 			Sum of all the Lengths of the source descriptor in the
227 			gather chain
228 
229 			<legal all>
230 */
231 #define CE_STAT_DESC_0_LENGTH_OFFSET                                 0x00000000
232 #define CE_STAT_DESC_0_LENGTH_LSB                                    16
233 #define CE_STAT_DESC_0_LENGTH_MASK                                   0xffff0000
234 
235 /* Description		CE_STAT_DESC_1_TOEPLITZ_HASH_0
236 
237 			32 LS bits of 64 bit Toeplitz LFSR hash result
238 
239 			<legal all>
240 */
241 #define CE_STAT_DESC_1_TOEPLITZ_HASH_0_OFFSET                        0x00000004
242 #define CE_STAT_DESC_1_TOEPLITZ_HASH_0_LSB                           0
243 #define CE_STAT_DESC_1_TOEPLITZ_HASH_0_MASK                          0xffffffff
244 
245 /* Description		CE_STAT_DESC_2_TOEPLITZ_HASH_1
246 
247 			32 MS bits of 64 bit Toeplitz LFSR hash result
248 
249 			<legal all>
250 */
251 #define CE_STAT_DESC_2_TOEPLITZ_HASH_1_OFFSET                        0x00000008
252 #define CE_STAT_DESC_2_TOEPLITZ_HASH_1_LSB                           0
253 #define CE_STAT_DESC_2_TOEPLITZ_HASH_1_MASK                          0xffffffff
254 
255 /* Description		CE_STAT_DESC_3_FW_METADATA
256 
257 			Meta data used by FW
258 
259 			In case of gather field in first source ring entry of
260 			the gather copy cycle in taken into account.
261 
262 			<legal all>
263 */
264 #define CE_STAT_DESC_3_FW_METADATA_OFFSET                            0x0000000c
265 #define CE_STAT_DESC_3_FW_METADATA_LSB                               0
266 #define CE_STAT_DESC_3_FW_METADATA_MASK                              0x0000ffff
267 
268 /* Description		CE_STAT_DESC_3_CE_RES_7
269 
270 			Reserved
271 
272 			<legal all>
273 */
274 #define CE_STAT_DESC_3_CE_RES_7_OFFSET                               0x0000000c
275 #define CE_STAT_DESC_3_CE_RES_7_LSB                                  16
276 #define CE_STAT_DESC_3_CE_RES_7_MASK                                 0x000f0000
277 
278 /* Description		CE_STAT_DESC_3_RING_ID
279 
280 			The buffer pointer ring ID.
281 
282 			0 refers to the IDLE ring
283 
284 			1 - N refers to other rings
285 
286 
287 
288 			Helps with debugging when dumping ring contents.
289 
290 			<legal all>
291 */
292 #define CE_STAT_DESC_3_RING_ID_OFFSET                                0x0000000c
293 #define CE_STAT_DESC_3_RING_ID_LSB                                   20
294 #define CE_STAT_DESC_3_RING_ID_MASK                                  0x0ff00000
295 
296 /* Description		CE_STAT_DESC_3_LOOPING_COUNT
297 
298 			A count value that indicates the number of times the
299 			producer of entries into the Ring has looped around the
300 			ring.
301 
302 			At initialization time, this value is set to 0. On the
303 			first loop, this value is set to 1. After the max value is
304 			reached allowed by the number of bits for this field, the
305 			count value continues with 0 again.
306 
307 			In case SW is the consumer of the ring entries, it can
308 			use this field to figure out up to where the producer of
309 			entries has created new entries. This eliminates the need to
310 			check where the head pointer' of the ring is located once
311 			the SW starts processing an interrupt indicating that new
312 			entries have been put into this ring...
313 
314 			Also note that SW if it wants only needs to look at the
315 			LSB bit of this count value.
316 
317 			<legal all>
318 */
319 #define CE_STAT_DESC_3_LOOPING_COUNT_OFFSET                          0x0000000c
320 #define CE_STAT_DESC_3_LOOPING_COUNT_LSB                             28
321 #define CE_STAT_DESC_3_LOOPING_COUNT_MASK                            0xf0000000
322 
323 
324 #endif // _CE_STAT_DESC_H_
325