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