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