xref: /wlan-driver/fw-api/hw/qca9574/ce_src_desc.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021 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 // $ATH_LICENSE_HW_HDR_C$
18 //
19 // DO NOT EDIT!  This file is automatically generated
20 //               These definitions are tied to a particular hardware layout
21 
22 
23 #ifndef _CE_SRC_DESC_H_
24 #define _CE_SRC_DESC_H_
25 #if !defined(__ASSEMBLER__)
26 #endif
27 
28 
29 // ################ START SUMMARY #################
30 //
31 //	Dword	Fields
32 //	0	src_buffer_low[31:0]
33 //	1	src_buffer_high[7:0], toeplitz_en[8], src_swap[9], dest_swap[10], gather[11], ce_res_0[15:12], length[31:16]
34 //	2	fw_metadata[15:0], ce_res_1[31:16]
35 //	3	ce_res_2[19:0], ring_id[27:20], looping_count[31:28]
36 //
37 // ################ END SUMMARY #################
38 
39 #define NUM_OF_DWORDS_CE_SRC_DESC 4
40 
41 struct ce_src_desc {
42              uint32_t src_buffer_low                  : 32; //[31:0]
43              uint32_t src_buffer_high                 :  8, //[7:0]
44                       toeplitz_en                     :  1, //[8]
45                       src_swap                        :  1, //[9]
46                       dest_swap                       :  1, //[10]
47                       gather                          :  1, //[11]
48                       ce_res_0                        :  4, //[15:12]
49                       length                          : 16; //[31:16]
50              uint32_t fw_metadata                     : 16, //[15:0]
51                       ce_res_1                        : 16; //[31:16]
52              uint32_t ce_res_2                        : 20, //[19:0]
53                       ring_id                         :  8, //[27:20]
54                       looping_count                   :  4; //[31:28]
55 };
56 
57 /*
58 
59 src_buffer_low
60 
61 			LSB 32 bits of the 40 Bit Pointer to the source buffer
62 
63 			<legal all>
64 
65 src_buffer_high
66 
67 			MSB 8 bits of the 40 Bit Pointer to the source buffer
68 
69 			<legal all>
70 
71 toeplitz_en
72 
73 			Enable generation of 32-bit Toeplitz-LFSR hash for the
74 			data transfer
75 
76 			In case of gather field in first source ring entry of
77 			the gather copy cycle in taken into account.
78 
79 			<legal all>
80 
81 src_swap
82 
83 			Treats source memory organization as big-endian. For
84 			each dword read (4 bytes), the byte 0 is swapped with byte 3
85 			and byte 1 is swapped with byte 2.
86 
87 			In case of gather field in first source ring entry of
88 			the gather copy cycle in taken into account.
89 
90 			<legal all>
91 
92 dest_swap
93 
94 			Treats destination memory organization as big-endian.
95 			For each dword write (4 bytes), the byte 0 is swapped with
96 			byte 3 and byte 1 is swapped with byte 2.
97 
98 			In case of gather field in first source ring entry of
99 			the gather copy cycle in taken into account.
100 
101 			<legal all>
102 
103 gather
104 
105 			Enables gather of multiple copy engine source
106 			descriptors to one destination.
107 
108 			<legal all>
109 
110 ce_res_0
111 
112 			Reserved
113 
114 			<legal all>
115 
116 length
117 
118 			Length of the buffer in units of octets of the current
119 			descriptor
120 
121 			<legal all>
122 
123 fw_metadata
124 
125 			Meta data used by FW
126 
127 			In case of gather field in first source ring entry of
128 			the gather copy cycle in taken into account.
129 
130 			<legal all>
131 
132 ce_res_1
133 
134 			Reserved
135 
136 			<legal all>
137 
138 ce_res_2
139 
140 			Reserved
141 
142 			<legal all>
143 
144 ring_id
145 
146 			The buffer pointer ring ID.
147 
148 			0 refers to the IDLE ring
149 
150 			1 - N refers to other rings
151 
152 
153 
154 			Helps with debugging when dumping ring contents.
155 
156 			<legal all>
157 
158 looping_count
159 
160 			A count value that indicates the number of times the
161 			producer of entries into the Ring has looped around the
162 			ring.
163 
164 			At initialization time, this value is set to 0. On the
165 			first loop, this value is set to 1. After the max value is
166 			reached allowed by the number of bits for this field, the
167 			count value continues with 0 again.
168 
169 			In case SW is the consumer of the ring entries, it can
170 			use this field to figure out up to where the producer of
171 			entries has created new entries. This eliminates the need to
172 			check where the head pointer' of the ring is located once
173 			the SW starts processing an interrupt indicating that new
174 			entries have been put into this ring...
175 
176 			Also note that SW if it wants only needs to look at the
177 			LSB bit of this count value.
178 
179 			<legal all>
180 */
181 
182 
183 /* Description		CE_SRC_DESC_0_SRC_BUFFER_LOW
184 
185 			LSB 32 bits of the 40 Bit Pointer to the source buffer
186 
187 			<legal all>
188 */
189 #define CE_SRC_DESC_0_SRC_BUFFER_LOW_OFFSET                          0x00000000
190 #define CE_SRC_DESC_0_SRC_BUFFER_LOW_LSB                             0
191 #define CE_SRC_DESC_0_SRC_BUFFER_LOW_MASK                            0xffffffff
192 
193 /* Description		CE_SRC_DESC_1_SRC_BUFFER_HIGH
194 
195 			MSB 8 bits of the 40 Bit Pointer to the source buffer
196 
197 			<legal all>
198 */
199 #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_OFFSET                         0x00000004
200 #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_LSB                            0
201 #define CE_SRC_DESC_1_SRC_BUFFER_HIGH_MASK                           0x000000ff
202 
203 /* Description		CE_SRC_DESC_1_TOEPLITZ_EN
204 
205 			Enable generation of 32-bit Toeplitz-LFSR hash for the
206 			data transfer
207 
208 			In case of gather field in first source ring entry of
209 			the gather copy cycle in taken into account.
210 
211 			<legal all>
212 */
213 #define CE_SRC_DESC_1_TOEPLITZ_EN_OFFSET                             0x00000004
214 #define CE_SRC_DESC_1_TOEPLITZ_EN_LSB                                8
215 #define CE_SRC_DESC_1_TOEPLITZ_EN_MASK                               0x00000100
216 
217 /* Description		CE_SRC_DESC_1_SRC_SWAP
218 
219 			Treats source memory organization as big-endian. For
220 			each dword read (4 bytes), the byte 0 is swapped with byte 3
221 			and byte 1 is swapped with byte 2.
222 
223 			In case of gather field in first source ring entry of
224 			the gather copy cycle in taken into account.
225 
226 			<legal all>
227 */
228 #define CE_SRC_DESC_1_SRC_SWAP_OFFSET                                0x00000004
229 #define CE_SRC_DESC_1_SRC_SWAP_LSB                                   9
230 #define CE_SRC_DESC_1_SRC_SWAP_MASK                                  0x00000200
231 
232 /* Description		CE_SRC_DESC_1_DEST_SWAP
233 
234 			Treats destination memory organization as big-endian.
235 			For each dword write (4 bytes), the byte 0 is swapped with
236 			byte 3 and byte 1 is swapped with byte 2.
237 
238 			In case of gather field in first source ring entry of
239 			the gather copy cycle in taken into account.
240 
241 			<legal all>
242 */
243 #define CE_SRC_DESC_1_DEST_SWAP_OFFSET                               0x00000004
244 #define CE_SRC_DESC_1_DEST_SWAP_LSB                                  10
245 #define CE_SRC_DESC_1_DEST_SWAP_MASK                                 0x00000400
246 
247 /* Description		CE_SRC_DESC_1_GATHER
248 
249 			Enables gather of multiple copy engine source
250 			descriptors to one destination.
251 
252 			<legal all>
253 */
254 #define CE_SRC_DESC_1_GATHER_OFFSET                                  0x00000004
255 #define CE_SRC_DESC_1_GATHER_LSB                                     11
256 #define CE_SRC_DESC_1_GATHER_MASK                                    0x00000800
257 
258 /* Description		CE_SRC_DESC_1_CE_RES_0
259 
260 			Reserved
261 
262 			<legal all>
263 */
264 #define CE_SRC_DESC_1_CE_RES_0_OFFSET                                0x00000004
265 #define CE_SRC_DESC_1_CE_RES_0_LSB                                   12
266 #define CE_SRC_DESC_1_CE_RES_0_MASK                                  0x0000f000
267 
268 /* Description		CE_SRC_DESC_1_LENGTH
269 
270 			Length of the buffer in units of octets of the current
271 			descriptor
272 
273 			<legal all>
274 */
275 #define CE_SRC_DESC_1_LENGTH_OFFSET                                  0x00000004
276 #define CE_SRC_DESC_1_LENGTH_LSB                                     16
277 #define CE_SRC_DESC_1_LENGTH_MASK                                    0xffff0000
278 
279 /* Description		CE_SRC_DESC_2_FW_METADATA
280 
281 			Meta data used by FW
282 
283 			In case of gather field in first source ring entry of
284 			the gather copy cycle in taken into account.
285 
286 			<legal all>
287 */
288 #define CE_SRC_DESC_2_FW_METADATA_OFFSET                             0x00000008
289 #define CE_SRC_DESC_2_FW_METADATA_LSB                                0
290 #define CE_SRC_DESC_2_FW_METADATA_MASK                               0x0000ffff
291 
292 /* Description		CE_SRC_DESC_2_CE_RES_1
293 
294 			Reserved
295 
296 			<legal all>
297 */
298 #define CE_SRC_DESC_2_CE_RES_1_OFFSET                                0x00000008
299 #define CE_SRC_DESC_2_CE_RES_1_LSB                                   16
300 #define CE_SRC_DESC_2_CE_RES_1_MASK                                  0xffff0000
301 
302 /* Description		CE_SRC_DESC_3_CE_RES_2
303 
304 			Reserved
305 
306 			<legal all>
307 */
308 #define CE_SRC_DESC_3_CE_RES_2_OFFSET                                0x0000000c
309 #define CE_SRC_DESC_3_CE_RES_2_LSB                                   0
310 #define CE_SRC_DESC_3_CE_RES_2_MASK                                  0x000fffff
311 
312 /* Description		CE_SRC_DESC_3_RING_ID
313 
314 			The buffer pointer ring ID.
315 
316 			0 refers to the IDLE ring
317 
318 			1 - N refers to other rings
319 
320 
321 
322 			Helps with debugging when dumping ring contents.
323 
324 			<legal all>
325 */
326 #define CE_SRC_DESC_3_RING_ID_OFFSET                                 0x0000000c
327 #define CE_SRC_DESC_3_RING_ID_LSB                                    20
328 #define CE_SRC_DESC_3_RING_ID_MASK                                   0x0ff00000
329 
330 /* Description		CE_SRC_DESC_3_LOOPING_COUNT
331 
332 			A count value that indicates the number of times the
333 			producer of entries into the Ring has looped around the
334 			ring.
335 
336 			At initialization time, this value is set to 0. On the
337 			first loop, this value is set to 1. After the max value is
338 			reached allowed by the number of bits for this field, the
339 			count value continues with 0 again.
340 
341 			In case SW is the consumer of the ring entries, it can
342 			use this field to figure out up to where the producer of
343 			entries has created new entries. This eliminates the need to
344 			check where the head pointer' of the ring is located once
345 			the SW starts processing an interrupt indicating that new
346 			entries have been put into this ring...
347 
348 			Also note that SW if it wants only needs to look at the
349 			LSB bit of this count value.
350 
351 			<legal all>
352 */
353 #define CE_SRC_DESC_3_LOOPING_COUNT_OFFSET                           0x0000000c
354 #define CE_SRC_DESC_3_LOOPING_COUNT_LSB                              28
355 #define CE_SRC_DESC_3_LOOPING_COUNT_MASK                             0xf0000000
356 
357 
358 #endif // _CE_SRC_DESC_H_
359