xref: /wlan-driver/fw-api/hw/qcn6432/ce_stat_desc.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 
18 #ifndef _CE_STAT_DESC_H_
19 #define _CE_STAT_DESC_H_
20 #if !defined(__ASSEMBLER__)
21 #endif
22 
23 #define NUM_OF_DWORDS_CE_STAT_DESC 4
24 
25 
26 struct ce_stat_desc {
27 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
28              uint32_t ce_res_5                                                :  8, // [7:0]
29                       toeplitz_en                                             :  1, // [8:8]
30                       src_swap                                                :  1, // [9:9]
31                       dest_swap                                               :  1, // [10:10]
32                       gather                                                  :  1, // [11:11]
33                       barrier_read                                            :  1, // [12:12]
34                       ce_res_6                                                :  3, // [15:13]
35                       length                                                  : 16; // [31:16]
36              uint32_t toeplitz_hash_0                                         : 32; // [31:0]
37              uint32_t toeplitz_hash_1                                         : 32; // [31:0]
38              uint32_t fw_metadata                                             : 16, // [15:0]
39                       ce_res_7                                                :  4, // [19:16]
40                       ring_id                                                 :  8, // [27:20]
41                       looping_count                                           :  4; // [31:28]
42 #else
43              uint32_t length                                                  : 16, // [31:16]
44                       ce_res_6                                                :  3, // [15:13]
45                       barrier_read                                            :  1, // [12:12]
46                       gather                                                  :  1, // [11:11]
47                       dest_swap                                               :  1, // [10:10]
48                       src_swap                                                :  1, // [9:9]
49                       toeplitz_en                                             :  1, // [8:8]
50                       ce_res_5                                                :  8; // [7:0]
51              uint32_t toeplitz_hash_0                                         : 32; // [31:0]
52              uint32_t toeplitz_hash_1                                         : 32; // [31:0]
53              uint32_t looping_count                                           :  4, // [31:28]
54                       ring_id                                                 :  8, // [27:20]
55                       ce_res_7                                                :  4, // [19:16]
56                       fw_metadata                                             : 16; // [15:0]
57 #endif
58 };
59 
60 
61 /* Description		CE_RES_5
62 
63 			Reserved
64 			<legal all>
65 */
66 
67 #define CE_STAT_DESC_CE_RES_5_OFFSET                                                0x00000000
68 #define CE_STAT_DESC_CE_RES_5_LSB                                                   0
69 #define CE_STAT_DESC_CE_RES_5_MSB                                                   7
70 #define CE_STAT_DESC_CE_RES_5_MASK                                                  0x000000ff
71 
72 
73 /* Description		TOEPLITZ_EN
74 
75 			32-bit Toeplitz-LFSR hash for the data transfer, Enabled
76 
77 			<legal all>
78 */
79 
80 #define CE_STAT_DESC_TOEPLITZ_EN_OFFSET                                             0x00000000
81 #define CE_STAT_DESC_TOEPLITZ_EN_LSB                                                8
82 #define CE_STAT_DESC_TOEPLITZ_EN_MSB                                                8
83 #define CE_STAT_DESC_TOEPLITZ_EN_MASK                                               0x00000100
84 
85 
86 /* Description		SRC_SWAP
87 
88 			Source memory buffer swapped
89 			<legal all>
90 */
91 
92 #define CE_STAT_DESC_SRC_SWAP_OFFSET                                                0x00000000
93 #define CE_STAT_DESC_SRC_SWAP_LSB                                                   9
94 #define CE_STAT_DESC_SRC_SWAP_MSB                                                   9
95 #define CE_STAT_DESC_SRC_SWAP_MASK                                                  0x00000200
96 
97 
98 /* Description		DEST_SWAP
99 
100 			Destination  memory buffer swapped
101 			<legal all>
102 */
103 
104 #define CE_STAT_DESC_DEST_SWAP_OFFSET                                               0x00000000
105 #define CE_STAT_DESC_DEST_SWAP_LSB                                                  10
106 #define CE_STAT_DESC_DEST_SWAP_MSB                                                  10
107 #define CE_STAT_DESC_DEST_SWAP_MASK                                                 0x00000400
108 
109 
110 /* Description		GATHER
111 
112 			Gather of multiple copy engine source descriptors to one
113 			 destination enabled
114 			<legal all>
115 */
116 
117 #define CE_STAT_DESC_GATHER_OFFSET                                                  0x00000000
118 #define CE_STAT_DESC_GATHER_LSB                                                     11
119 #define CE_STAT_DESC_GATHER_MSB                                                     11
120 #define CE_STAT_DESC_GATHER_MASK                                                    0x00000800
121 
122 
123 /* Description		BARRIER_READ
124 
125 			Barrier read enabled
126 			<legal all>
127 */
128 
129 #define CE_STAT_DESC_BARRIER_READ_OFFSET                                            0x00000000
130 #define CE_STAT_DESC_BARRIER_READ_LSB                                               12
131 #define CE_STAT_DESC_BARRIER_READ_MSB                                               12
132 #define CE_STAT_DESC_BARRIER_READ_MASK                                              0x00001000
133 
134 
135 /* Description		CE_RES_6
136 
137 			Reserved
138 			<legal all>
139 */
140 
141 #define CE_STAT_DESC_CE_RES_6_OFFSET                                                0x00000000
142 #define CE_STAT_DESC_CE_RES_6_LSB                                                   13
143 #define CE_STAT_DESC_CE_RES_6_MSB                                                   15
144 #define CE_STAT_DESC_CE_RES_6_MASK                                                  0x0000e000
145 
146 
147 /* Description		LENGTH
148 
149 			Sum of all the Lengths of the source descriptor in the gather
150 			 chain
151 			<legal all>
152 */
153 
154 #define CE_STAT_DESC_LENGTH_OFFSET                                                  0x00000000
155 #define CE_STAT_DESC_LENGTH_LSB                                                     16
156 #define CE_STAT_DESC_LENGTH_MSB                                                     31
157 #define CE_STAT_DESC_LENGTH_MASK                                                    0xffff0000
158 
159 
160 /* Description		TOEPLITZ_HASH_0
161 
162 			32 LS bits of 64 bit Toeplitz LFSR hash result
163 			<legal all>
164 */
165 
166 #define CE_STAT_DESC_TOEPLITZ_HASH_0_OFFSET                                         0x00000004
167 #define CE_STAT_DESC_TOEPLITZ_HASH_0_LSB                                            0
168 #define CE_STAT_DESC_TOEPLITZ_HASH_0_MSB                                            31
169 #define CE_STAT_DESC_TOEPLITZ_HASH_0_MASK                                           0xffffffff
170 
171 
172 /* Description		TOEPLITZ_HASH_1
173 
174 			32 MS bits of 64 bit Toeplitz LFSR hash result
175 			<legal all>
176 */
177 
178 #define CE_STAT_DESC_TOEPLITZ_HASH_1_OFFSET                                         0x00000008
179 #define CE_STAT_DESC_TOEPLITZ_HASH_1_LSB                                            0
180 #define CE_STAT_DESC_TOEPLITZ_HASH_1_MSB                                            31
181 #define CE_STAT_DESC_TOEPLITZ_HASH_1_MASK                                           0xffffffff
182 
183 
184 /* Description		FW_METADATA
185 
186 			Meta data used by FW
187 			In case of gather field in first source ring entry of the
188 			 gather copy cycle in taken into account.
189 			<legal all>
190 */
191 
192 #define CE_STAT_DESC_FW_METADATA_OFFSET                                             0x0000000c
193 #define CE_STAT_DESC_FW_METADATA_LSB                                                0
194 #define CE_STAT_DESC_FW_METADATA_MSB                                                15
195 #define CE_STAT_DESC_FW_METADATA_MASK                                               0x0000ffff
196 
197 
198 /* Description		CE_RES_7
199 
200 			Reserved
201 			<legal all>
202 */
203 
204 #define CE_STAT_DESC_CE_RES_7_OFFSET                                                0x0000000c
205 #define CE_STAT_DESC_CE_RES_7_LSB                                                   16
206 #define CE_STAT_DESC_CE_RES_7_MSB                                                   19
207 #define CE_STAT_DESC_CE_RES_7_MASK                                                  0x000f0000
208 
209 
210 /* Description		RING_ID
211 
212 			The buffer pointer ring ID.
213 			0 refers to the IDLE ring
214 			1 - N refers to other rings
215 
216 			Helps with debugging when dumping ring contents.
217 			<legal all>
218 */
219 
220 #define CE_STAT_DESC_RING_ID_OFFSET                                                 0x0000000c
221 #define CE_STAT_DESC_RING_ID_LSB                                                    20
222 #define CE_STAT_DESC_RING_ID_MSB                                                    27
223 #define CE_STAT_DESC_RING_ID_MASK                                                   0x0ff00000
224 
225 
226 /* Description		LOOPING_COUNT
227 
228 			A count value that indicates the number of times the producer
229 			 of entries into the Ring has looped around the ring.
230 			At initialization time, this value is set to 0. On the first
231 			 loop, this value is set to 1. After the max value is reached
232 			 allowed by the number of bits for this field, the count
233 			 value continues with 0 again.
234 			In case SW is the consumer of the ring entries, it can use
235 			 this field to figure out up to where the producer of entries
236 			 has created new entries. This eliminates the need to check
237 			 where the "head pointer' of the ring is located once the
238 			 SW starts processing an interrupt indicating that new entries
239 			 have been put into this ring...
240 			Also note that SW if it wants only needs to look at the
241 			LSB bit of this count value.
242 			<legal all>
243 */
244 
245 #define CE_STAT_DESC_LOOPING_COUNT_OFFSET                                           0x0000000c
246 #define CE_STAT_DESC_LOOPING_COUNT_LSB                                              28
247 #define CE_STAT_DESC_LOOPING_COUNT_MSB                                              31
248 #define CE_STAT_DESC_LOOPING_COUNT_MASK                                             0xf0000000
249 
250 
251 
252 #endif   // CE_STAT_DESC
253