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