1 /*
2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19 /**
20 * DOC: service_ready_util.h
21 *
22 * Public APIs to access (ext)service ready data from psoc object
23 */
24 #ifndef _SERVICE_READY_UTIL_H_
25 #define _SERVICE_READY_UTIL_H_
26
27 #include "wlan_objmgr_psoc_obj.h"
28 #include "service_ready_param.h"
29 #include "target_if.h"
30
31 /**
32 * init_deinit_chainmask_table_alloc()
33 * - allocate chainmask table capability list.
34 * @service_ext_param: pointer to server ext param.
35 *
36 * Allocates capability list based on num_valid_chainmasks for that table.
37 *
38 * Return: QDF Status.
39 */
40 QDF_STATUS init_deinit_chainmask_table_alloc(
41 struct wlan_psoc_host_service_ext_param *service_ext_param);
42
43 /**
44 * init_deinit_chainmask_table_free()
45 * -free chainmask table capability list.
46 * @service_ext_param: pointer to server ext param.
47 *
48 * free capability list based on num_valid_chainmasks for that table.
49 *
50 * Return: QDF Status.
51 */
52 QDF_STATUS init_deinit_chainmask_table_free(
53 struct wlan_psoc_host_service_ext_param *service_ext_param);
54
55 /**
56 * init_deinit_populate_service_bitmap() - populate service bitmap
57 * @wmi_handle: wmi handle
58 * @event: event buffer received from FW
59 * @service_bitmap: service bitmap information
60 *
61 * API to populate service bit map
62 *
63 * Return: zero on successful population of service bitmap or failure flag
64 */
65 int init_deinit_populate_service_bitmap(
66 wmi_unified_t wmi_handle, uint8_t *event,
67 uint32_t *service_bitmap);
68
69 /**
70 * init_deinit_populate_fw_version_cmd() - populate FW version
71 * @wmi_handle: wmi handle
72 * @event: event buffer received from FW
73 *
74 * API to populate FW version
75 *
76 * Return: zero on successful population of fw_version command or failure flag
77 */
78 int
79 init_deinit_populate_fw_version_cmd(wmi_unified_t wmi_handle, uint8_t *event);
80
81 /**
82 * init_deinit_populate_target_cap() - populate target cap
83 * @wmi_handle: wmi handle
84 * @event: event buffer received from FW
85 * @cap: target capability info object
86 *
87 * API to populate target cap
88 *
89 * Return: zero on successful population of target cap or failure flag
90 */
91 int init_deinit_populate_target_cap(
92 wmi_unified_t wmi_handle, uint8_t *event,
93 struct wlan_psoc_target_capability_info *cap);
94
95 /**
96 * init_deinit_populate_service_ready_ext_param() - populate service ready ext
97 * parameter
98 * @handle: WMI handle pointer
99 * @evt: event buffer received from FW
100 * @param: service ext param object
101 *
102 * API to populate service ready ext param
103 *
104 * Return: zero on successful parsing of service ready ext parameter or failure
105 */
106 int init_deinit_populate_service_ready_ext_param(
107 wmi_unified_t handle, uint8_t *evt,
108 struct wlan_psoc_host_service_ext_param *param);
109
110 /**
111 * init_deinit_populate_service_ready_ext2_param() - populate service ready ext2
112 * parameter
113 * @handle: WMI handle pointer
114 * @evt: event buffer received from FW
115 * @info: Target info handle
116 *
117 * API to populate service ready ext2 param
118 *
119 * Return: zero on successful parsing of service ready ext parameter or failure
120 */
121 int init_deinit_populate_service_ready_ext2_param(
122 wmi_unified_t handle, uint8_t *evt,
123 struct tgt_info *info);
124
125 /**
126 * init_deinit_populate_chainmask_tables() - populate chainmaks tables
127 * @handle: WMI handle pointer
128 * @evt: event buffer received from FW
129 * @param: chainmaks_table object
130 *
131 * API to populate chainmaks tables
132 *
133 * Return: zero on successful parsing of chainmaks tables or failure flag
134 */
135 int init_deinit_populate_chainmask_tables(
136 wmi_unified_t handle, uint8_t *evt,
137 struct wlan_psoc_host_chainmask_table *param);
138
139 /**
140 * init_deinit_populate_mac_phy_capability() - populate mac phy capability
141 * @handle: WMI handle pointer
142 * @evt: event buffer received from FW
143 * @hw_cap: hw_mode_caps object
144 * @info: tgt_info object
145 *
146 * API to populate mac phy capability
147 *
148 * Return: zero on successful population of mac physical capability or failure
149 */
150 int init_deinit_populate_mac_phy_capability(
151 wmi_unified_t handle, uint8_t *evt,
152 struct wlan_psoc_host_hw_mode_caps *hw_cap, struct tgt_info *info);
153
154 /**
155 * init_deinit_populate_hw_mode_capability() - populate hw mode capability
156 * @wmi_handle: WMI handle pointer
157 * @event: event buffer received from FW
158 * @tgt_hdl: target_psoc_info object
159 *
160 * API to populate hw mode capability
161 *
162 * Return: zero on successful parsing of hw mode capability or failure
163 */
164 int init_deinit_populate_hw_mode_capability(
165 wmi_unified_t wmi_handle,
166 uint8_t *event, struct target_psoc_info *tgt_hdl);
167
168 /**
169 * init_deinit_populate_dbr_ring_cap() - populate dbr ring capability
170 * @psoc: PSOC object
171 * @handle: WMI handle pointer
172 * @event: event buffer received from FW
173 * @info: tgt_info object
174 *
175 * API to populate dbr ring capability
176 *
177 * Return: zero on successful parsing of dbr ring capability or failure
178 */
179 int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
180 wmi_unified_t handle, uint8_t *event,
181 struct tgt_info *info);
182
183 /**
184 * init_deinit_populate_dbr_ring_cap_ext2() - populate dbr ring capability
185 * from ext2 event
186 * @psoc: PSOC object
187 * @handle: WMI handle pointer
188 * @event: event buffer received from FW
189 * @info: tgt_info object
190 *
191 * API to populate dbr ring capability
192 *
193 * Return: zero on successful parsing of dbr ring capability or failure
194 */
195 int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc,
196 wmi_unified_t handle, uint8_t *event,
197 struct tgt_info *info);
198
199 /**
200 * init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling
201 * @psoc: PSOC object
202 * @handle: WMI handle pointer
203 * @event: event buffer received from FW
204 * @info: tgt_info object
205 *
206 * API to populate Spectral bin scaling parameters
207 *
208 * Return: zero on successful parsing of scaling params or failure
209 */
210 int init_deinit_populate_spectral_bin_scale_params(
211 struct wlan_objmgr_psoc *psoc,
212 wmi_unified_t handle, uint8_t *event,
213 struct tgt_info *info);
214
215 /**
216 * init_deinit_dbr_ring_cap_free() - free dbr ring capability
217 * @tgt_psoc_info: target psoc info object
218 *
219 * API to free dbr ring capability
220 *
221 * Return: QDF_STATUS
222 */
223 QDF_STATUS init_deinit_dbr_ring_cap_free(
224 struct target_psoc_info *tgt_psoc_info);
225
226 /**
227 * init_deinit_scan_radio_cap_free() - free scan radio capability
228 * @tgt_psoc_info: target psoc info object
229 *
230 * API to free scan radio related capability information.
231 *
232 * Return: QDF_STATUS
233 */
234 QDF_STATUS init_deinit_scan_radio_cap_free(
235 struct target_psoc_info *tgt_psoc_info);
236
237 /**
238 * init_deinit_msdu_idx_qtype_map_free() - free msdu index to qtype map
239 * @tgt_psoc_info: target psoc info object
240 *
241 * API to free msdu index to qtype map information.
242 *
243 * Return: QDF_STATUS
244 */
245 QDF_STATUS init_deinit_msdu_idx_qtype_map_free(
246 struct target_psoc_info *tgt_psoc_info);
247
248 /**
249 * init_deinit_spectral_scaling_params_free() - free Spectral scaling params
250 * @tgt_psoc_info: target psoc info object
251 *
252 * API to free Spectral scaling params
253 *
254 * Return: QDF_STATUS
255 */
256 QDF_STATUS init_deinit_spectral_scaling_params_free(
257 struct target_psoc_info *tgt_psoc_info);
258
259 /**
260 * init_deinit_aux_dev_cap_free() - free aux dev capability buffer
261 * @tgt_psoc_info: target psoc info object
262 *
263 * API to free aux dev capability buffer
264 *
265 * Return: QDF_STATUS
266 */
267 QDF_STATUS init_deinit_aux_dev_cap_free(
268 struct target_psoc_info *tgt_psoc_info);
269
270 /**
271 * init_deinit_populate_phy_reg_cap() - populate phy reg capability
272 * @psoc: PSOC object
273 * @wmi_handle: WMI handle pointer
274 * @event: event buffer received from FW
275 * @info: tgt_info object
276 * @service_ready: service ready determiner
277 *
278 * API to populate phy reg capability
279 *
280 * Return: zero on successful parsing of physical reg capability or failure flag
281 */
282 int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc,
283 wmi_unified_t wmi_handle, uint8_t *event,
284 struct tgt_info *info,
285 bool service_ready);
286
287 /**
288 * init_deinit_populate_hal_reg_cap_ext2() - Populate HAL reg capabilities from
289 * service ready ext2 event.
290 * @handle: WMI handle pointer
291 * @event: event buffer received from FW
292 * @info: tgt_info object
293 *
294 * API to populate HAL reg capabilities from service ready ext2 event.
295 *
296 * Return: zero on successful parsing of physical reg capability or failure flag
297 */
298 int init_deinit_populate_hal_reg_cap_ext2(wmi_unified_t handle, uint8_t *event,
299 struct tgt_info *info);
300
301 /**
302 * init_deinit_populate_mac_phy_cap_ext2() - populate mac phy capabilities from
303 * service ready ext2 event
304 * @handle: WMI handle pointer
305 * @event: event buffer received from FW
306 * @info: tgt_info object
307 *
308 * API to populate mac phy capability from service ready ext2 event.
309 *
310 * Return: zero on successful population of mac physical capability or failure
311 */
312 int init_deinit_populate_mac_phy_cap_ext2(wmi_unified_t handle, uint8_t *event,
313 struct tgt_info *info);
314
315 /**
316 * init_deinit_populate_rcc_aoa_cap_ext2() - populate aoa capabilities from
317 * service ready ext2 event
318 * @psoc: PSOC object
319 * @handle: WMI handle pointer
320 * @event: event buffer received from FW
321 * @info: tgt_info object
322 *
323 * API to populate aoa capability from service ready ext2 event.
324 *
325 * Return: zero on successful population of aoa capability or failure
326 */
327 int init_deinit_populate_rcc_aoa_cap_ext2(struct wlan_objmgr_psoc *psoc,
328 wmi_unified_t handle, uint8_t *event,
329 struct tgt_info *info);
330
331 /**
332 * init_deinit_rcc_aoa_cap_ext2_free() - free aoa capability
333 * @tgt_psoc_info: target psoc info object
334 *
335 * API to free aoa capability
336 *
337 * Return: QDF_STATUS
338 */
339 QDF_STATUS init_deinit_rcc_aoa_cap_ext2_free(
340 struct target_psoc_info *tgt_psoc_info);
341
342 /**
343 * init_deinit_populate_scan_radio_cap_ext2() - populate scan radio capabilities
344 * from service ready ext2 event
345 * @handle: WMI handle pointer
346 * @event: event buffer received from FW
347 * @info: tgt_info object
348 *
349 * API to populate scan radio capability from service ready ext2 event.
350 *
351 * Return: zero on successful population of scan radio or failure
352 */
353 int init_deinit_populate_scan_radio_cap_ext2(wmi_unified_t handle,
354 uint8_t *event,
355 struct tgt_info *info);
356
357 /**
358 * init_deinit_populate_msdu_idx_qtype_map_ext2() - populate msdu index to
359 * qtype map from service
360 * ready ext2 event
361 * @handle: WMI handle pointer
362 * @event: event buffer received from FW
363 * @info: tgt_info object
364 *
365 * API to populate HTT msdu index to qtype map from service ready ext2 event.
366 *
367 * Return: zero on successful population or non-zero failure
368 */
369 int init_deinit_populate_msdu_idx_qtype_map_ext2(wmi_unified_t handle,
370 uint8_t *event,
371 struct tgt_info *info);
372
373 #ifdef WLAN_SUPPORT_TWT
374 /**
375 * init_deinit_populate_twt_cap_ext2() - populate twt capabilities from service
376 * ready ext2 event
377 * @psoc: PSOC object
378 * @handle: WMI handle pointer
379 * @event: event buffer received from FW
380 * @info: tgt_info object
381 *
382 * API to populate twt capability from service ready ext2 event.
383 * Return: zero on successful population of twt capability or failure
384 */
385 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc,
386 wmi_unified_t handle, uint8_t *event,
387 struct tgt_info *info);
388 #else
389 static inline
init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc * psoc,wmi_unified_t handle,uint8_t * event,struct tgt_info * info)390 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc,
391 wmi_unified_t handle, uint8_t *event,
392 struct tgt_info *info)
393 {
394 return 0;
395 }
396 #endif
397
398 /**
399 * init_deinit_populate_dbs_or_sbs_cap_ext2() - populate dbs or sbs capability
400 * from service ready ext2 event
401 *
402 * @psoc: PSOC object
403 * @handle: WMI handle pointer
404 * @event: event buffer received from FW
405 * @info: tgt_info object
406 *
407 * API to populate dbs or sbs capability from service ready ext2 event.
408 * Return: zero on successful dbs or sbs capability or failure
409 */
410 int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc,
411 wmi_unified_t handle,
412 uint8_t *event,
413 struct tgt_info *info);
414
415 /**
416 * init_deinit_populate_aux_dev_cap_ext2() - populate aux dev capability
417 * from service ready ext2 event
418 *
419 * @psoc: PSOC object
420 * @handle: WMI handle pointer
421 * @event: event buffer received from FW
422 * @info: tgt_info object
423 *
424 * API to populate aux dev capability from service ready ext2 event.
425 * Return: zero on successful or failure
426 */
427
428 int init_deinit_populate_aux_dev_cap_ext2(struct wlan_objmgr_psoc *psoc,
429 wmi_unified_t handle, uint8_t *event,
430 struct tgt_info *info);
431
432 /**
433 * init_deinit_populate_sap_coex_capability() - SAP coex capability
434 * @psoc: PSOC object
435 * @handle: WMI handle pointer
436 * @event: event buffer received from FW
437 *
438 * API to populate SAP coex capabilities which currently indicates whether SAP
439 * is allowed on a coex channel when it's started with fixed chan config
440 *
441 * Return: zero on successful capability fetching or failure
442 */
443 int init_deinit_populate_sap_coex_capability(struct wlan_objmgr_psoc *psoc,
444 wmi_unified_t handle,
445 uint8_t *event);
446 /**
447 * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps
448 * @psoc: PSOC object
449 * @tgt_info: target_psoc_info object
450 *
451 * API to validate 160 80p80 fw caps
452 *
453 * Return: SUCCESS on successful validation of 160 80p80 forward caps or Failure
454 */
455 QDF_STATUS init_deinit_validate_160_80p80_fw_caps(
456 struct wlan_objmgr_psoc *psoc,
457 struct target_psoc_info *tgt_info);
458
459 /**
460 * init_deinit_chainmask_config() - config chainmask
461 * @psoc: PSOC object
462 * @tgt_info: target_psoc_info object
463 *
464 * API to config chainmask
465 *
466 * Return: none
467 */
468 void init_deinit_chainmask_config(
469 struct wlan_objmgr_psoc *psoc,
470 struct target_psoc_info *tgt_info);
471
472 /**
473 * init_deinit_is_service_ext_msg() - check service ext message
474 * @psoc: PSOC object
475 * @tgt_info: target_psoc_info object
476 *
477 * API to check whether service ext message is enabled
478 *
479 * Return: SUCCESS on successful check of service_ext message or Failure
480 */
481 QDF_STATUS init_deinit_is_service_ext_msg(
482 struct wlan_objmgr_psoc *psoc,
483 struct target_psoc_info *tgt_info);
484 /**
485 * init_deinit_is_preferred_hw_mode_supported() - check support of preferred
486 * hw mode
487 * @psoc: PSOC object
488 * @tgt_info: target_psoc_info object
489 *
490 * API to check whether preferred hardware mode is enabled
491 *
492 * Return: True on support of preferred hardware support or False
493 */
494 bool init_deinit_is_preferred_hw_mode_supported(
495 struct wlan_objmgr_psoc *psoc,
496 struct target_psoc_info *tgt_info);
497
498 /**
499 * init_deinit_wakeup_host_wait() - wakeup host wait
500 * @psoc: PSOC object
501 * @tgt_info: target_psoc_info object
502 *
503 * API to wakeup FW ready wait queue
504 *
505 * Return: None
506 */
507 void init_deinit_wakeup_host_wait(
508 struct wlan_objmgr_psoc *psoc,
509 struct target_psoc_info *tgt_info);
510
511 #endif /* _SERVICE_READY_UTIL_H_*/
512