xref: /wlan-driver/fw-api/hw/qca5332/ce_src_desc.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name 
2*5113495bSYour Name /* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for any
5*5113495bSYour Name  * purpose with or without fee is hereby granted, provided that the above
6*5113495bSYour Name  * copyright notice and this permission notice appear in all copies.
7*5113495bSYour Name  *
8*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*5113495bSYour Name  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*5113495bSYour Name  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*5113495bSYour Name  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*5113495bSYour Name  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*5113495bSYour Name  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*5113495bSYour Name  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*5113495bSYour Name  */
16*5113495bSYour Name 
17*5113495bSYour Name 
18*5113495bSYour Name 
19*5113495bSYour Name 
20*5113495bSYour Name 
21*5113495bSYour Name 
22*5113495bSYour Name 
23*5113495bSYour Name 
24*5113495bSYour Name 
25*5113495bSYour Name 
26*5113495bSYour Name #ifndef _CE_SRC_DESC_H_
27*5113495bSYour Name #define _CE_SRC_DESC_H_
28*5113495bSYour Name #if !defined(__ASSEMBLER__)
29*5113495bSYour Name #endif
30*5113495bSYour Name 
31*5113495bSYour Name #define NUM_OF_DWORDS_CE_SRC_DESC 4
32*5113495bSYour Name 
33*5113495bSYour Name 
34*5113495bSYour Name struct ce_src_desc {
35*5113495bSYour Name #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
36*5113495bSYour Name              uint32_t src_buffer_low                                          : 32; // [31:0]
37*5113495bSYour Name              uint32_t src_buffer_high                                         :  8, // [7:0]
38*5113495bSYour Name                       toeplitz_en                                             :  1, // [8:8]
39*5113495bSYour Name                       src_swap                                                :  1, // [9:9]
40*5113495bSYour Name                       dest_swap                                               :  1, // [10:10]
41*5113495bSYour Name                       gather                                                  :  1, // [11:11]
42*5113495bSYour Name                       ce_res_0                                                :  1, // [12:12]
43*5113495bSYour Name                       barrier_read                                            :  1, // [13:13]
44*5113495bSYour Name                       ce_res_1                                                :  2, // [15:14]
45*5113495bSYour Name                       length                                                  : 16; // [31:16]
46*5113495bSYour Name              uint32_t fw_metadata                                             : 16, // [15:0]
47*5113495bSYour Name                       ce_res_2                                                : 16; // [31:16]
48*5113495bSYour Name              uint32_t ce_res_3                                                : 20, // [19:0]
49*5113495bSYour Name                       ring_id                                                 :  8, // [27:20]
50*5113495bSYour Name                       looping_count                                           :  4; // [31:28]
51*5113495bSYour Name #else
52*5113495bSYour Name              uint32_t src_buffer_low                                          : 32; // [31:0]
53*5113495bSYour Name              uint32_t length                                                  : 16, // [31:16]
54*5113495bSYour Name                       ce_res_1                                                :  2, // [15:14]
55*5113495bSYour Name                       barrier_read                                            :  1, // [13:13]
56*5113495bSYour Name                       ce_res_0                                                :  1, // [12:12]
57*5113495bSYour Name                       gather                                                  :  1, // [11:11]
58*5113495bSYour Name                       dest_swap                                               :  1, // [10:10]
59*5113495bSYour Name                       src_swap                                                :  1, // [9:9]
60*5113495bSYour Name                       toeplitz_en                                             :  1, // [8:8]
61*5113495bSYour Name                       src_buffer_high                                         :  8; // [7:0]
62*5113495bSYour Name              uint32_t ce_res_2                                                : 16, // [31:16]
63*5113495bSYour Name                       fw_metadata                                             : 16; // [15:0]
64*5113495bSYour Name              uint32_t looping_count                                           :  4, // [31:28]
65*5113495bSYour Name                       ring_id                                                 :  8, // [27:20]
66*5113495bSYour Name                       ce_res_3                                                : 20; // [19:0]
67*5113495bSYour Name #endif
68*5113495bSYour Name };
69*5113495bSYour Name 
70*5113495bSYour Name 
71*5113495bSYour Name /* Description		SRC_BUFFER_LOW
72*5113495bSYour Name 
73*5113495bSYour Name 			LSB 32 bits of the 40 Bit Pointer to the source buffer
74*5113495bSYour Name 			<legal all>
75*5113495bSYour Name */
76*5113495bSYour Name 
77*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_LOW_OFFSET                                           0x00000000
78*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_LOW_LSB                                              0
79*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_LOW_MSB                                              31
80*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_LOW_MASK                                             0xffffffff
81*5113495bSYour Name 
82*5113495bSYour Name 
83*5113495bSYour Name /* Description		SRC_BUFFER_HIGH
84*5113495bSYour Name 
85*5113495bSYour Name 			Bits [6:0] for 40 Bit Pointer to the source buffer
86*5113495bSYour Name 			Bit [7] can be programmed with VC bit.
87*5113495bSYour Name 			Note: CE Descriptor has 40-bit address. Only 37 bits are
88*5113495bSYour Name 			 routed as address to NoC. Remaining bits are user bits.
89*5113495bSYour Name 			Bit [7] of SRC_BUFFER_HIGH can be used for VC configuration.
90*5113495bSYour Name 			0 indicate VC0 and 1 indicate VC1.
91*5113495bSYour Name 			<legal all>
92*5113495bSYour Name */
93*5113495bSYour Name 
94*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_HIGH_OFFSET                                          0x00000004
95*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_HIGH_LSB                                             0
96*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_HIGH_MSB                                             7
97*5113495bSYour Name #define CE_SRC_DESC_SRC_BUFFER_HIGH_MASK                                            0x000000ff
98*5113495bSYour Name 
99*5113495bSYour Name 
100*5113495bSYour Name /* Description		TOEPLITZ_EN
101*5113495bSYour Name 
102*5113495bSYour Name 			Enable generation of 32-bit Toeplitz-LFSR hash for the data
103*5113495bSYour Name 			 transfer
104*5113495bSYour Name 			In case of gather field in first source ring entry of the
105*5113495bSYour Name 			 gather copy cycle in taken into account.
106*5113495bSYour Name 			<legal all>
107*5113495bSYour Name */
108*5113495bSYour Name 
109*5113495bSYour Name #define CE_SRC_DESC_TOEPLITZ_EN_OFFSET                                              0x00000004
110*5113495bSYour Name #define CE_SRC_DESC_TOEPLITZ_EN_LSB                                                 8
111*5113495bSYour Name #define CE_SRC_DESC_TOEPLITZ_EN_MSB                                                 8
112*5113495bSYour Name #define CE_SRC_DESC_TOEPLITZ_EN_MASK                                                0x00000100
113*5113495bSYour Name 
114*5113495bSYour Name 
115*5113495bSYour Name /* Description		SRC_SWAP
116*5113495bSYour Name 
117*5113495bSYour Name 			Treats source memory organization as big-endian. For each
118*5113495bSYour Name 			 dword read (4 bytes), the byte 0 is swapped with byte 3
119*5113495bSYour Name 			 and byte 1 is swapped with byte 2.
120*5113495bSYour Name 			In case of gather field in first source ring entry of the
121*5113495bSYour Name 			 gather copy cycle in taken into account.
122*5113495bSYour Name 			<legal all>
123*5113495bSYour Name */
124*5113495bSYour Name 
125*5113495bSYour Name #define CE_SRC_DESC_SRC_SWAP_OFFSET                                                 0x00000004
126*5113495bSYour Name #define CE_SRC_DESC_SRC_SWAP_LSB                                                    9
127*5113495bSYour Name #define CE_SRC_DESC_SRC_SWAP_MSB                                                    9
128*5113495bSYour Name #define CE_SRC_DESC_SRC_SWAP_MASK                                                   0x00000200
129*5113495bSYour Name 
130*5113495bSYour Name 
131*5113495bSYour Name /* Description		DEST_SWAP
132*5113495bSYour Name 
133*5113495bSYour Name 			Treats destination memory organization as big-endian. For
134*5113495bSYour Name 			 each dword write (4 bytes), the byte 0 is swapped with
135*5113495bSYour Name 			byte 3 and byte 1 is swapped with byte 2.
136*5113495bSYour Name 			In case of gather field in first source ring entry of the
137*5113495bSYour Name 			 gather copy cycle in taken into account.
138*5113495bSYour Name 			<legal all>
139*5113495bSYour Name */
140*5113495bSYour Name 
141*5113495bSYour Name #define CE_SRC_DESC_DEST_SWAP_OFFSET                                                0x00000004
142*5113495bSYour Name #define CE_SRC_DESC_DEST_SWAP_LSB                                                   10
143*5113495bSYour Name #define CE_SRC_DESC_DEST_SWAP_MSB                                                   10
144*5113495bSYour Name #define CE_SRC_DESC_DEST_SWAP_MASK                                                  0x00000400
145*5113495bSYour Name 
146*5113495bSYour Name 
147*5113495bSYour Name /* Description		GATHER
148*5113495bSYour Name 
149*5113495bSYour Name 			Enables gather of multiple copy engine source descriptors
150*5113495bSYour Name 			 to one destination.
151*5113495bSYour Name 			<legal all>
152*5113495bSYour Name */
153*5113495bSYour Name 
154*5113495bSYour Name #define CE_SRC_DESC_GATHER_OFFSET                                                   0x00000004
155*5113495bSYour Name #define CE_SRC_DESC_GATHER_LSB                                                      11
156*5113495bSYour Name #define CE_SRC_DESC_GATHER_MSB                                                      11
157*5113495bSYour Name #define CE_SRC_DESC_GATHER_MASK                                                     0x00000800
158*5113495bSYour Name 
159*5113495bSYour Name 
160*5113495bSYour Name /* Description		CE_RES_0
161*5113495bSYour Name 
162*5113495bSYour Name 			Reserved
163*5113495bSYour Name 			<legal all>
164*5113495bSYour Name */
165*5113495bSYour Name 
166*5113495bSYour Name #define CE_SRC_DESC_CE_RES_0_OFFSET                                                 0x00000004
167*5113495bSYour Name #define CE_SRC_DESC_CE_RES_0_LSB                                                    12
168*5113495bSYour Name #define CE_SRC_DESC_CE_RES_0_MSB                                                    12
169*5113495bSYour Name #define CE_SRC_DESC_CE_RES_0_MASK                                                   0x00001000
170*5113495bSYour Name 
171*5113495bSYour Name 
172*5113495bSYour Name /* Description		BARRIER_READ
173*5113495bSYour Name 
174*5113495bSYour Name 			Barrier Read enable
175*5113495bSYour Name 			<legal all>
176*5113495bSYour Name */
177*5113495bSYour Name 
178*5113495bSYour Name #define CE_SRC_DESC_BARRIER_READ_OFFSET                                             0x00000004
179*5113495bSYour Name #define CE_SRC_DESC_BARRIER_READ_LSB                                                13
180*5113495bSYour Name #define CE_SRC_DESC_BARRIER_READ_MSB                                                13
181*5113495bSYour Name #define CE_SRC_DESC_BARRIER_READ_MASK                                               0x00002000
182*5113495bSYour Name 
183*5113495bSYour Name 
184*5113495bSYour Name /* Description		CE_RES_1
185*5113495bSYour Name 
186*5113495bSYour Name 			Reserved
187*5113495bSYour Name 			<legal all>
188*5113495bSYour Name */
189*5113495bSYour Name 
190*5113495bSYour Name #define CE_SRC_DESC_CE_RES_1_OFFSET                                                 0x00000004
191*5113495bSYour Name #define CE_SRC_DESC_CE_RES_1_LSB                                                    14
192*5113495bSYour Name #define CE_SRC_DESC_CE_RES_1_MSB                                                    15
193*5113495bSYour Name #define CE_SRC_DESC_CE_RES_1_MASK                                                   0x0000c000
194*5113495bSYour Name 
195*5113495bSYour Name 
196*5113495bSYour Name /* Description		LENGTH
197*5113495bSYour Name 
198*5113495bSYour Name 			Length of the buffer in units of octets of the current descriptor
199*5113495bSYour Name 
200*5113495bSYour Name 			<legal all>
201*5113495bSYour Name */
202*5113495bSYour Name 
203*5113495bSYour Name #define CE_SRC_DESC_LENGTH_OFFSET                                                   0x00000004
204*5113495bSYour Name #define CE_SRC_DESC_LENGTH_LSB                                                      16
205*5113495bSYour Name #define CE_SRC_DESC_LENGTH_MSB                                                      31
206*5113495bSYour Name #define CE_SRC_DESC_LENGTH_MASK                                                     0xffff0000
207*5113495bSYour Name 
208*5113495bSYour Name 
209*5113495bSYour Name /* Description		FW_METADATA
210*5113495bSYour Name 
211*5113495bSYour Name 			Meta data used by FW
212*5113495bSYour Name 			In case of gather field in first source ring entry of the
213*5113495bSYour Name 			 gather copy cycle in taken into account.
214*5113495bSYour Name 			<legal all>
215*5113495bSYour Name */
216*5113495bSYour Name 
217*5113495bSYour Name #define CE_SRC_DESC_FW_METADATA_OFFSET                                              0x00000008
218*5113495bSYour Name #define CE_SRC_DESC_FW_METADATA_LSB                                                 0
219*5113495bSYour Name #define CE_SRC_DESC_FW_METADATA_MSB                                                 15
220*5113495bSYour Name #define CE_SRC_DESC_FW_METADATA_MASK                                                0x0000ffff
221*5113495bSYour Name 
222*5113495bSYour Name 
223*5113495bSYour Name /* Description		CE_RES_2
224*5113495bSYour Name 
225*5113495bSYour Name 			Reserved
226*5113495bSYour Name 			<legal all>
227*5113495bSYour Name */
228*5113495bSYour Name 
229*5113495bSYour Name #define CE_SRC_DESC_CE_RES_2_OFFSET                                                 0x00000008
230*5113495bSYour Name #define CE_SRC_DESC_CE_RES_2_LSB                                                    16
231*5113495bSYour Name #define CE_SRC_DESC_CE_RES_2_MSB                                                    31
232*5113495bSYour Name #define CE_SRC_DESC_CE_RES_2_MASK                                                   0xffff0000
233*5113495bSYour Name 
234*5113495bSYour Name 
235*5113495bSYour Name /* Description		CE_RES_3
236*5113495bSYour Name 
237*5113495bSYour Name 			Reserved
238*5113495bSYour Name 			<legal all>
239*5113495bSYour Name */
240*5113495bSYour Name 
241*5113495bSYour Name #define CE_SRC_DESC_CE_RES_3_OFFSET                                                 0x0000000c
242*5113495bSYour Name #define CE_SRC_DESC_CE_RES_3_LSB                                                    0
243*5113495bSYour Name #define CE_SRC_DESC_CE_RES_3_MSB                                                    19
244*5113495bSYour Name #define CE_SRC_DESC_CE_RES_3_MASK                                                   0x000fffff
245*5113495bSYour Name 
246*5113495bSYour Name 
247*5113495bSYour Name /* Description		RING_ID
248*5113495bSYour Name 
249*5113495bSYour Name 			The buffer pointer ring ID.
250*5113495bSYour Name 			0 refers to the IDLE ring
251*5113495bSYour Name 			1 - N refers to other rings
252*5113495bSYour Name 
253*5113495bSYour Name 			Helps with debugging when dumping ring contents.
254*5113495bSYour Name 			<legal all>
255*5113495bSYour Name */
256*5113495bSYour Name 
257*5113495bSYour Name #define CE_SRC_DESC_RING_ID_OFFSET                                                  0x0000000c
258*5113495bSYour Name #define CE_SRC_DESC_RING_ID_LSB                                                     20
259*5113495bSYour Name #define CE_SRC_DESC_RING_ID_MSB                                                     27
260*5113495bSYour Name #define CE_SRC_DESC_RING_ID_MASK                                                    0x0ff00000
261*5113495bSYour Name 
262*5113495bSYour Name 
263*5113495bSYour Name /* Description		LOOPING_COUNT
264*5113495bSYour Name 
265*5113495bSYour Name 			A count value that indicates the number of times the producer
266*5113495bSYour Name 			 of entries into the Ring has looped around the ring.
267*5113495bSYour Name 			At initialization time, this value is set to 0. On the first
268*5113495bSYour Name 			 loop, this value is set to 1. After the max value is reached
269*5113495bSYour Name 			 allowed by the number of bits for this field, the count
270*5113495bSYour Name 			 value continues with 0 again.
271*5113495bSYour Name 			In case SW is the consumer of the ring entries, it can use
272*5113495bSYour Name 			 this field to figure out up to where the producer of entries
273*5113495bSYour Name 			 has created new entries. This eliminates the need to check
274*5113495bSYour Name 			 where the "head pointer' of the ring is located once the
275*5113495bSYour Name 			 SW starts processing an interrupt indicating that new entries
276*5113495bSYour Name 			 have been put into this ring...
277*5113495bSYour Name 			Also note that SW if it wants only needs to look at the
278*5113495bSYour Name 			LSB bit of this count value.
279*5113495bSYour Name 			<legal all>
280*5113495bSYour Name */
281*5113495bSYour Name 
282*5113495bSYour Name #define CE_SRC_DESC_LOOPING_COUNT_OFFSET                                            0x0000000c
283*5113495bSYour Name #define CE_SRC_DESC_LOOPING_COUNT_LSB                                               28
284*5113495bSYour Name #define CE_SRC_DESC_LOOPING_COUNT_MSB                                               31
285*5113495bSYour Name #define CE_SRC_DESC_LOOPING_COUNT_MASK                                              0xf0000000
286*5113495bSYour Name 
287*5113495bSYour Name 
288*5113495bSYour Name 
289*5113495bSYour Name #endif   // CE_SRC_DESC
290