xref: /wlan-driver/fw-api/hw/qca6390/v1/buffer_addr_info.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 _BUFFER_ADDR_INFO_H_
20 #define _BUFFER_ADDR_INFO_H_
21 #if !defined(__ASSEMBLER__)
22 #endif
23 
24 
25 // ################ START SUMMARY #################
26 //
27 //	Dword	Fields
28 //	0	buffer_addr_31_0[31:0]
29 //	1	buffer_addr_39_32[7:0], return_buffer_manager[10:8], sw_buffer_cookie[31:11]
30 //
31 // ################ END SUMMARY #################
32 
33 #define NUM_OF_DWORDS_BUFFER_ADDR_INFO 2
34 
35 struct buffer_addr_info {
36              uint32_t buffer_addr_31_0                : 32; //[31:0]
37              uint32_t buffer_addr_39_32               :  8, //[7:0]
38                       return_buffer_manager           :  3, //[10:8]
39                       sw_buffer_cookie                : 21; //[31:11]
40 };
41 
42 /*
43 
44 buffer_addr_31_0
45 
46 			Address (lower 32 bits) of the MSDU buffer OR
47 			MSDU_EXTENSION descriptor OR Link Descriptor
48 
49 
50 
51 			In case of 'NULL' pointer, this field is set to 0
52 
53 			<legal all>
54 
55 buffer_addr_39_32
56 
57 			Address (upper 8 bits) of the MSDU buffer OR
58 			MSDU_EXTENSION descriptor OR Link Descriptor
59 
60 
61 
62 			In case of 'NULL' pointer, this field is set to 0
63 
64 			<legal all>
65 
66 return_buffer_manager
67 
68 			Consumer: WBM
69 
70 			Producer: SW/FW
71 
72 
73 
74 			In case of 'NULL' pointer, this field is set to 0
75 
76 
77 
78 			Indicates to which buffer manager the buffer OR
79 			MSDU_EXTENSION descriptor OR link descriptor that is being
80 			pointed to shall be returned after the frame has been
81 			processed. It is used by WBM for routing purposes.
82 
83 
84 
85 			<enum 0 WBM_IDLE_BUF_LIST> This buffer shall be returned
86 			to the WMB buffer idle list
87 
88 			<enum 1 WBM_IDLE_DESC_LIST> This buffer shall be
89 			returned to the WMB idle link descriptor idle list
90 
91 			<enum 2 FW_BM> This buffer shall be returned to the FW
92 
93 			<enum 3 SW0_BM> This buffer shall be returned to the SW,
94 			ring 0
95 
96 			<enum 4 SW1_BM> This buffer shall be returned to the SW,
97 			ring 1
98 
99 			<enum 5 SW2_BM> This buffer shall be returned to the SW,
100 			ring 2
101 
102 			<enum 6 SW3_BM> This buffer shall be returned to the SW,
103 			ring 3
104 
105 			<enum 7 SW4_BM> This buffer shall be returned to the SW,
106 			ring 4
107 
108 
109 
110 			<legal all>
111 
112 sw_buffer_cookie
113 
114 			Cookie field exclusively used by SW.
115 
116 
117 
118 			In case of 'NULL' pointer, this field is set to 0
119 
120 
121 
122 			HW ignores the contents, accept that it passes the
123 			programmed value on to other descriptors together with the
124 			physical address
125 
126 
127 
128 			Field can be used by SW to for example associate the
129 			buffers physical address with the virtual address
130 
131 			The bit definitions as used by SW are within SW HLD
132 			specification
133 
134 
135 
136 			NOTE:
137 
138 			The two most significant bits can have a special meaning
139 			in case this struct is embedded in a TX_MPDU_DETAILS STRUCT,
140 			and field transmit_bw_restriction is set
141 
142 			Sw_buffer_cookie[20:19] = 2'b00: 20 MHz TX only
143 
144 			Sw_buffer_cookie[20:19] = 2'b01: 40 MHz TX only
145 
146 			Sw_buffer_cookie[20:19] = 2'b10: 80 MHz TX only
147 
148 			Sw_buffer_cookie[20:19] = 2'b11: 160 MHz TX only
149 
150 
151 
152 			<legal all>
153 */
154 
155 
156 /* Description		BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0
157 
158 			Address (lower 32 bits) of the MSDU buffer OR
159 			MSDU_EXTENSION descriptor OR Link Descriptor
160 
161 
162 
163 			In case of 'NULL' pointer, this field is set to 0
164 
165 			<legal all>
166 */
167 #define BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET                   0x00000000
168 #define BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_LSB                      0
169 #define BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_MASK                     0xffffffff
170 
171 /* Description		BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32
172 
173 			Address (upper 8 bits) of the MSDU buffer OR
174 			MSDU_EXTENSION descriptor OR Link Descriptor
175 
176 
177 
178 			In case of 'NULL' pointer, this field is set to 0
179 
180 			<legal all>
181 */
182 #define BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_OFFSET                  0x00000004
183 #define BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_LSB                     0
184 #define BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_MASK                    0x000000ff
185 
186 /* Description		BUFFER_ADDR_INFO_1_RETURN_BUFFER_MANAGER
187 
188 			Consumer: WBM
189 
190 			Producer: SW/FW
191 
192 
193 
194 			In case of 'NULL' pointer, this field is set to 0
195 
196 
197 
198 			Indicates to which buffer manager the buffer OR
199 			MSDU_EXTENSION descriptor OR link descriptor that is being
200 			pointed to shall be returned after the frame has been
201 			processed. It is used by WBM for routing purposes.
202 
203 
204 
205 			<enum 0 WBM_IDLE_BUF_LIST> This buffer shall be returned
206 			to the WMB buffer idle list
207 
208 			<enum 1 WBM_IDLE_DESC_LIST> This buffer shall be
209 			returned to the WMB idle link descriptor idle list
210 
211 			<enum 2 FW_BM> This buffer shall be returned to the FW
212 
213 			<enum 3 SW0_BM> This buffer shall be returned to the SW,
214 			ring 0
215 
216 			<enum 4 SW1_BM> This buffer shall be returned to the SW,
217 			ring 1
218 
219 			<enum 5 SW2_BM> This buffer shall be returned to the SW,
220 			ring 2
221 
222 			<enum 6 SW3_BM> This buffer shall be returned to the SW,
223 			ring 3
224 
225 			<enum 7 SW4_BM> This buffer shall be returned to the SW,
226 			ring 4
227 
228 
229 
230 			<legal all>
231 */
232 #define BUFFER_ADDR_INFO_1_RETURN_BUFFER_MANAGER_OFFSET              0x00000004
233 #define BUFFER_ADDR_INFO_1_RETURN_BUFFER_MANAGER_LSB                 8
234 #define BUFFER_ADDR_INFO_1_RETURN_BUFFER_MANAGER_MASK                0x00000700
235 
236 /* Description		BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE
237 
238 			Cookie field exclusively used by SW.
239 
240 
241 
242 			In case of 'NULL' pointer, this field is set to 0
243 
244 
245 
246 			HW ignores the contents, accept that it passes the
247 			programmed value on to other descriptors together with the
248 			physical address
249 
250 
251 
252 			Field can be used by SW to for example associate the
253 			buffers physical address with the virtual address
254 
255 			The bit definitions as used by SW are within SW HLD
256 			specification
257 
258 
259 
260 			NOTE:
261 
262 			The two most significant bits can have a special meaning
263 			in case this struct is embedded in a TX_MPDU_DETAILS STRUCT,
264 			and field transmit_bw_restriction is set
265 
266 			Sw_buffer_cookie[20:19] = 2'b00: 20 MHz TX only
267 
268 			Sw_buffer_cookie[20:19] = 2'b01: 40 MHz TX only
269 
270 			Sw_buffer_cookie[20:19] = 2'b10: 80 MHz TX only
271 
272 			Sw_buffer_cookie[20:19] = 2'b11: 160 MHz TX only
273 
274 
275 
276 			<legal all>
277 */
278 #define BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET                   0x00000004
279 #define BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_LSB                      11
280 #define BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_MASK                     0xfffff800
281 
282 
283 #endif // _BUFFER_ADDR_INFO_H_
284