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