xref: /wlan-dirver/qca-wifi-host-cmn/target_if/core/src/target_if_main.c (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2017-2020 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 /**
20  * DOC: API for interacting with target interface.
21  *
22  */
23 
24 #include "target_if.h"
25 #include "target_type.h"
26 #ifdef WLAN_ATF_ENABLE
27 #include "target_if_atf.h"
28 #endif
29 #ifdef WLAN_SA_API_ENABLE
30 #include "target_if_sa_api.h"
31 #endif
32 #ifdef WLAN_CFR_ENABLE
33 #include "target_if_cfr.h"
34 #endif
35 #ifdef WLAN_CONV_SPECTRAL_ENABLE
36 #include "target_if_spectral.h"
37 #endif
38 
39 #ifdef WLAN_IOT_SIM_SUPPORT
40 #include <target_if_iot_sim.h>
41 #endif
42 #include <target_if_reg.h>
43 #include <target_if_scan.h>
44 #include <target_if_ftm.h>
45 #ifdef DFS_COMPONENT_ENABLE
46 #include <target_if_dfs.h>
47 #endif
48 
49 #ifdef CONVERGED_P2P_ENABLE
50 #include "target_if_p2p.h"
51 #endif
52 
53 #ifdef WIFI_POS_CONVERGED
54 #include "target_if_wifi_pos.h"
55 #endif
56 
57 #ifdef FEATURE_WLAN_TDLS
58 #include "target_if_tdls.h"
59 #endif
60 #ifdef QCA_SUPPORT_SON
61 #include <target_if_son.h>
62 #endif
63 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
64 #include <target_if_offchan_txrx_api.h>
65 #endif
66 #ifdef WLAN_SUPPORT_GREEN_AP
67 #include <target_if_green_ap.h>
68 #endif
69 #include <init_deinit_lmac.h>
70 #include <service_ready_util.h>
71 
72 #ifdef DIRECT_BUF_RX_ENABLE
73 #include <target_if_direct_buf_rx_api.h>
74 #endif
75 
76 #ifdef WLAN_SUPPORT_FILS
77 #include <target_if_fd.h>
78 #endif
79 #include "qdf_module.h"
80 
81 #include <target_if_cp_stats.h>
82 #ifdef CRYPTO_SET_KEY_CONVERGED
83 #include <target_if_crypto.h>
84 #endif
85 #include <target_if_vdev_mgr_tx_ops.h>
86 
87 #ifdef FEATURE_COEX
88 #include <target_if_coex.h>
89 #endif
90 #include <wlan_utility.h>
91 
92 #ifdef DCS_INTERFERENCE_DETECTION
93 #include <target_if_dcs.h>
94 #endif
95 
96 static struct target_if_ctx *g_target_if_ctx;
97 
98 struct target_if_ctx *target_if_get_ctx()
99 {
100 	return g_target_if_ctx;
101 }
102 
103 struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle)
104 {
105 	struct wlan_objmgr_psoc *psoc;
106 
107 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
108 	if (scn_handle && g_target_if_ctx->get_psoc_hdl_cb)
109 		psoc = g_target_if_ctx->get_psoc_hdl_cb(scn_handle);
110 	else
111 		psoc = NULL;
112 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
113 
114 	return psoc;
115 }
116 
117 struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle)
118 {
119 	struct wlan_objmgr_pdev *pdev;
120 
121 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
122 	if (scn_handle && g_target_if_ctx->get_pdev_hdl_cb)
123 		pdev = g_target_if_ctx->get_pdev_hdl_cb(scn_handle);
124 	else
125 		pdev = NULL;
126 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
127 
128 	return pdev;
129 }
130 
131 #ifdef DIRECT_BUF_RX_ENABLE
132 static QDF_STATUS target_if_direct_buf_rx_init(void)
133 {
134 	return direct_buf_rx_init();
135 }
136 
137 static QDF_STATUS target_if_direct_buf_rx_deinit(void)
138 {
139 	return direct_buf_rx_deinit();
140 }
141 #else
142 static QDF_STATUS target_if_direct_buf_rx_init(void)
143 {
144 	return QDF_STATUS_SUCCESS;
145 }
146 
147 static QDF_STATUS target_if_direct_buf_rx_deinit(void)
148 {
149 	return QDF_STATUS_SUCCESS;
150 }
151 #endif /* DIRECT_BUF_RX_ENABLE */
152 
153 QDF_STATUS target_if_init(get_psoc_handle_callback psoc_hdl_cb)
154 {
155 	g_target_if_ctx = qdf_mem_malloc(sizeof(*g_target_if_ctx));
156 	if (!g_target_if_ctx) {
157 		QDF_ASSERT(0);
158 		return QDF_STATUS_E_NOMEM;
159 	}
160 
161 	qdf_spinlock_create(&g_target_if_ctx->lock);
162 
163 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
164 	g_target_if_ctx->magic = TGT_MAGIC;
165 	g_target_if_ctx->get_psoc_hdl_cb = psoc_hdl_cb;
166 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
167 
168 	target_if_direct_buf_rx_init();
169 
170 	return QDF_STATUS_SUCCESS;
171 }
172 
173 QDF_STATUS target_if_deinit(void)
174 {
175 	if (!g_target_if_ctx) {
176 		QDF_ASSERT(0);
177 		target_if_err("target if ctx is null");
178 		return QDF_STATUS_E_INVAL;
179 	}
180 
181 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
182 	g_target_if_ctx->magic = 0;
183 	g_target_if_ctx->get_psoc_hdl_cb = NULL;
184 	g_target_if_ctx->get_pdev_hdl_cb = NULL;
185 	g_target_if_ctx->service_ready_cb = NULL;
186 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
187 
188 	qdf_spinlock_destroy(&g_target_if_ctx->lock);
189 	qdf_mem_free(g_target_if_ctx);
190 	g_target_if_ctx = NULL;
191 
192 	target_if_direct_buf_rx_deinit();
193 
194 	return QDF_STATUS_SUCCESS;
195 }
196 
197 qdf_export_symbol(target_if_deinit);
198 
199 QDF_STATUS target_if_store_pdev_target_if_ctx(
200 		get_pdev_handle_callback pdev_hdl_cb)
201 {
202 	if (!g_target_if_ctx) {
203 		QDF_ASSERT(0);
204 		target_if_err("target if ctx is null");
205 		return QDF_STATUS_E_INVAL;
206 	}
207 
208 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
209 	g_target_if_ctx->get_pdev_hdl_cb = pdev_hdl_cb;
210 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
211 
212 	return QDF_STATUS_SUCCESS;
213 }
214 
215 #ifndef WLAN_OFFCHAN_TXRX_ENABLE
216 static void target_if_offchan_txrx_ops_register(
217 					struct wlan_lmac_if_tx_ops *tx_ops)
218 {
219 }
220 #endif /* WLAN_OFFCHAN_TXRX_ENABLE */
221 
222 #ifndef WLAN_ATF_ENABLE
223 static void target_if_atf_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
224 {
225 }
226 #endif /* WLAN_ATF_ENABLE */
227 
228 #ifndef WLAN_SA_API_ENABLE
229 static void target_if_sa_api_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
230 {
231 }
232 #endif /* WLAN_SA_API_ENABLE */
233 
234 #ifndef WLAN_CFR_ENABLE
235 static void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
236 {
237 }
238 #endif
239 
240 #ifdef WLAN_SUPPORT_FILS
241 static void target_if_fd_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
242 {
243 	target_if_fd_register_tx_ops(tx_ops);
244 }
245 #else
246 static void target_if_fd_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
247 {
248 }
249 #endif
250 
251 #ifdef WIFI_POS_CONVERGED
252 static void target_if_wifi_pos_tx_ops_register(
253 			struct wlan_lmac_if_tx_ops *tx_ops)
254 {
255 	target_if_wifi_pos_register_tx_ops(tx_ops);
256 }
257 #else
258 static void target_if_wifi_pos_tx_ops_register(
259 			struct wlan_lmac_if_tx_ops *tx_ops)
260 {
261 }
262 #endif
263 #ifdef QCA_SUPPORT_SON
264 static void target_if_son_tx_ops_register(
265 			struct wlan_lmac_if_tx_ops *tx_ops)
266 {
267 	target_if_son_register_tx_ops(tx_ops);
268 	return;
269 }
270 #else
271 static void target_if_son_tx_ops_register(
272 			struct wlan_lmac_if_tx_ops *tx_ops)
273 {
274 	return;
275 }
276 #endif
277 
278 #ifdef FEATURE_WLAN_TDLS
279 static void target_if_tdls_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
280 {
281 	target_if_tdls_register_tx_ops(tx_ops);
282 }
283 #else
284 static void target_if_tdls_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
285 {
286 }
287 #endif /* FEATURE_WLAN_TDLS */
288 
289 #ifdef DFS_COMPONENT_ENABLE
290 static void target_if_dfs_tx_ops_register(
291 				struct wlan_lmac_if_tx_ops *tx_ops)
292 {
293 	target_if_register_dfs_tx_ops(tx_ops);
294 }
295 #else
296 static void target_if_dfs_tx_ops_register(
297 				struct wlan_lmac_if_tx_ops *tx_ops)
298 {
299 }
300 #endif /* DFS_COMPONENT_ENABLE */
301 
302 #ifdef WLAN_CONV_SPECTRAL_ENABLE
303 static void target_if_sptrl_tx_ops_register(
304 				struct wlan_lmac_if_tx_ops *tx_ops)
305 {
306 	target_if_sptrl_register_tx_ops(tx_ops);
307 }
308 #else
309 static void target_if_sptrl_tx_ops_register(
310 				struct wlan_lmac_if_tx_ops *tx_ops)
311 {
312 }
313 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
314 
315 #ifdef WLAN_IOT_SIM_SUPPORT
316 static void target_if_iot_sim_tx_ops_register(
317 				struct wlan_lmac_if_tx_ops *tx_ops)
318 {
319 	target_if_iot_sim_register_tx_ops(tx_ops);
320 }
321 #else
322 static void target_if_iot_sim_tx_ops_register(
323 				struct wlan_lmac_if_tx_ops *tx_ops)
324 {
325 }
326 #endif
327 
328 #ifdef DIRECT_BUF_RX_ENABLE
329 static void target_if_direct_buf_rx_tx_ops_register(
330 				struct wlan_lmac_if_tx_ops *tx_ops)
331 {
332 	target_if_direct_buf_rx_register_tx_ops(tx_ops);
333 }
334 #else
335 static void target_if_direct_buf_rx_tx_ops_register(
336 				struct wlan_lmac_if_tx_ops *tx_ops)
337 {
338 }
339 #endif /* DIRECT_BUF_RX_ENABLE */
340 
341 #ifdef WLAN_SUPPORT_GREEN_AP
342 static QDF_STATUS target_if_green_ap_tx_ops_register(
343 				struct wlan_lmac_if_tx_ops *tx_ops)
344 {
345 	return target_if_register_green_ap_tx_ops(tx_ops);
346 }
347 #else
348 static QDF_STATUS target_if_green_ap_tx_ops_register(
349 				struct wlan_lmac_if_tx_ops *tx_ops)
350 {
351 	return QDF_STATUS_SUCCESS;
352 }
353 #endif /* WLAN_SUPPORT_GREEN_AP */
354 #if defined(WLAN_CONV_CRYPTO_SUPPORTED) && defined(CRYPTO_SET_KEY_CONVERGED)
355 static void target_if_crypto_tx_ops_register(
356 				struct wlan_lmac_if_tx_ops *tx_ops)
357 {
358 	target_if_crypto_register_tx_ops(tx_ops);
359 }
360 #else
361 static inline void target_if_crypto_tx_ops_register(
362 				struct wlan_lmac_if_tx_ops *tx_ops)
363 {
364 }
365 #endif
366 
367 #ifdef FEATURE_COEX
368 static QDF_STATUS
369 target_if_coex_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
370 {
371 	return target_if_coex_register_tx_ops(tx_ops);
372 }
373 #else
374 static inline QDF_STATUS
375 target_if_coex_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
376 {
377 	return QDF_STATUS_SUCCESS;
378 }
379 #endif
380 
381 static void target_if_target_tx_ops_register(
382 		struct wlan_lmac_if_tx_ops *tx_ops)
383 {
384 	struct wlan_lmac_if_target_tx_ops *target_tx_ops;
385 
386 	if (!tx_ops) {
387 		target_if_err("invalid tx_ops");
388 		return;
389 	}
390 
391 	target_tx_ops = &tx_ops->target_tx_ops;
392 
393 	target_tx_ops->tgt_is_tgt_type_ar900b =
394 		target_is_tgt_type_ar900b;
395 
396 	target_tx_ops->tgt_is_tgt_type_ipq4019 =
397 		target_is_tgt_type_ipq4019;
398 
399 	target_tx_ops->tgt_is_tgt_type_qca9984 =
400 		target_is_tgt_type_qca9984;
401 
402 	target_tx_ops->tgt_is_tgt_type_qca9888 =
403 		target_is_tgt_type_qca9888;
404 
405 	target_tx_ops->tgt_is_tgt_type_adrastea =
406 		target_is_tgt_type_adrastea;
407 
408 	target_tx_ops->tgt_is_tgt_type_qcn9000 =
409 		target_is_tgt_type_qcn9000;
410 
411 	target_tx_ops->tgt_get_tgt_type =
412 		lmac_get_tgt_type;
413 
414 	target_tx_ops->tgt_get_tgt_version =
415 		lmac_get_tgt_version;
416 
417 	target_tx_ops->tgt_get_tgt_revision =
418 		lmac_get_tgt_revision;
419 }
420 
421 static QDF_STATUS
422 target_if_cp_stats_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
423 {
424 	return target_if_cp_stats_register_tx_ops(tx_ops);
425 }
426 
427 #ifdef DCS_INTERFERENCE_DETECTION
428 static QDF_STATUS
429 target_if_dcs_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
430 {
431 	return target_if_dcs_register_tx_ops(tx_ops);
432 }
433 #else
434 static QDF_STATUS
435 target_if_dcs_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
436 {
437 	return QDF_STATUS_SUCCESS;
438 }
439 #endif
440 
441 static QDF_STATUS
442 target_if_vdev_mgr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
443 {
444 	return target_if_vdev_mgr_register_tx_ops(tx_ops);
445 }
446 
447 #ifdef QCA_WIFI_FTM
448 static
449 void target_if_ftm_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
450 {
451 	target_if_ftm_register_tx_ops(tx_ops);
452 }
453 #else
454 static
455 void target_if_ftm_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
456 {
457 }
458 #endif
459 
460 #ifdef FEATURE_NO_DBS_INTRABAND_MCC_SUPPORT
461 static enum wmi_host_hw_mode_config_type
462 target_if_get_default_pref_hw_mode(struct target_psoc_info *psoc_info)
463 {
464 	return WMI_HOST_HW_MODE_DETECT;
465 }
466 #else
467 static enum wmi_host_hw_mode_config_type
468 target_if_get_default_pref_hw_mode(struct target_psoc_info *psoc_info)
469 {
470 	return WMI_HOST_HW_MODE_MAX;
471 }
472 #endif
473 
474 static
475 QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
476 {
477 	/* call regulatory callback to register tx ops */
478 	target_if_register_regulatory_tx_ops(tx_ops);
479 
480 	/* call umac callback to register legacy tx ops */
481 	wlan_lmac_if_umac_tx_ops_register(tx_ops);
482 
483 	/* Register scan tx ops */
484 	target_if_scan_tx_ops_register(tx_ops);
485 
486 	target_if_atf_tx_ops_register(tx_ops);
487 
488 	target_if_sa_api_tx_ops_register(tx_ops);
489 
490 	target_if_cfr_tx_ops_register(tx_ops);
491 
492 	target_if_wifi_pos_tx_ops_register(tx_ops);
493 
494 	target_if_dfs_tx_ops_register(tx_ops);
495 
496 	target_if_son_tx_ops_register(tx_ops);
497 
498 	target_if_tdls_tx_ops_register(tx_ops);
499 
500 	target_if_fd_tx_ops_register(tx_ops);
501 
502 	target_if_target_tx_ops_register(tx_ops);
503 
504 	target_if_offchan_txrx_ops_register(tx_ops);
505 
506 	target_if_green_ap_tx_ops_register(tx_ops);
507 
508 	target_if_ftm_tx_ops_register(tx_ops);
509 
510 	target_if_cp_stats_tx_ops_register(tx_ops);
511 
512 	target_if_dcs_tx_ops_register(tx_ops);
513 
514 	target_if_crypto_tx_ops_register(tx_ops);
515 
516 	target_if_vdev_mgr_tx_ops_register(tx_ops);
517 
518 	target_if_coex_tx_ops_register(tx_ops);
519 
520 	/* Converged UMAC components to register their TX-ops here */
521 	return QDF_STATUS_SUCCESS;
522 }
523 
524 QDF_STATUS target_if_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
525 {
526 	/* Converged UMAC components to register their TX-ops */
527 	target_if_register_umac_tx_ops(tx_ops);
528 
529 	/* Components parallel to UMAC to register their TX-ops here */
530 	target_if_sptrl_tx_ops_register(tx_ops);
531 
532 	target_if_iot_sim_tx_ops_register(tx_ops);
533 
534 	/* Register direct buffer rx component tx ops here */
535 	target_if_direct_buf_rx_tx_ops_register(tx_ops);
536 
537 #ifdef CONVERGED_P2P_ENABLE
538 	/* Converged UMAC components to register P2P TX-ops */
539 	target_if_p2p_register_tx_ops(tx_ops);
540 #endif
541 
542 	return QDF_STATUS_SUCCESS;
543 }
544 qdf_export_symbol(target_if_register_tx_ops);
545 
546 wmi_legacy_service_ready_callback
547 target_if_get_psoc_legacy_service_ready_cb(void)
548 {
549 	wmi_legacy_service_ready_callback service_ready_cb;
550 
551 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
552 	if (g_target_if_ctx->service_ready_cb)
553 		service_ready_cb = g_target_if_ctx->service_ready_cb;
554 	else
555 		service_ready_cb = NULL;
556 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
557 
558 	return service_ready_cb;
559 }
560 qdf_export_symbol(target_if_get_psoc_legacy_service_ready_cb);
561 
562 QDF_STATUS target_if_register_legacy_service_ready_cb(
563 	wmi_legacy_service_ready_callback service_ready_cb)
564 {
565 	qdf_spin_lock_bh(&g_target_if_ctx->lock);
566 	g_target_if_ctx->service_ready_cb = service_ready_cb;
567 	qdf_spin_unlock_bh(&g_target_if_ctx->lock);
568 
569 	return QDF_STATUS_SUCCESS;
570 }
571 qdf_export_symbol(target_if_register_legacy_service_ready_cb);
572 
573 QDF_STATUS target_if_alloc_pdev_tgt_info(struct wlan_objmgr_pdev *pdev)
574 {
575 	struct target_pdev_info *tgt_pdev_info;
576 
577 	if (!pdev) {
578 		target_if_err("pdev is null");
579 		return QDF_STATUS_E_INVAL;
580 	}
581 
582 	tgt_pdev_info = qdf_mem_malloc(sizeof(*tgt_pdev_info));
583 
584 	if (!tgt_pdev_info)
585 		return QDF_STATUS_E_NOMEM;
586 
587 	wlan_pdev_set_tgt_if_handle(pdev, tgt_pdev_info);
588 
589 	return QDF_STATUS_SUCCESS;
590 }
591 
592 QDF_STATUS target_if_free_pdev_tgt_info(struct wlan_objmgr_pdev *pdev)
593 {
594 	struct target_pdev_info *tgt_pdev_info;
595 
596 	if (!pdev) {
597 		target_if_err("pdev is null");
598 		return QDF_STATUS_E_INVAL;
599 	}
600 
601 	tgt_pdev_info = wlan_pdev_get_tgt_if_handle(pdev);
602 
603 	wlan_pdev_set_tgt_if_handle(pdev, NULL);
604 
605 	qdf_mem_free(tgt_pdev_info);
606 
607 	return QDF_STATUS_SUCCESS;
608 }
609 
610 QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
611 {
612 	struct target_psoc_info *tgt_psoc_info;
613 	enum wmi_host_hw_mode_config_type hw_mode;
614 
615 	if (!psoc) {
616 		target_if_err("psoc is null");
617 		return QDF_STATUS_E_INVAL;
618 	}
619 
620 	tgt_psoc_info = qdf_mem_malloc(sizeof(*tgt_psoc_info));
621 
622 	if (!tgt_psoc_info)
623 		return QDF_STATUS_E_NOMEM;
624 
625 	wlan_psoc_set_tgt_if_handle(psoc, tgt_psoc_info);
626 	hw_mode = target_if_get_default_pref_hw_mode(tgt_psoc_info);
627 	target_psoc_set_preferred_hw_mode(tgt_psoc_info, hw_mode);
628 	wlan_minidump_log(tgt_psoc_info,
629 			  sizeof(*tgt_psoc_info), psoc,
630 			  WLAN_MD_OBJMGR_PSOC_TGT_INFO, "target_psoc_info");
631 
632 	qdf_event_create(&tgt_psoc_info->info.event);
633 
634 	return QDF_STATUS_SUCCESS;
635 }
636 
637 QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
638 {
639 	struct target_psoc_info *tgt_psoc_info;
640 	struct wlan_psoc_host_service_ext_param *ext_param;
641 
642 	if (!psoc) {
643 		target_if_err("psoc is null");
644 		return QDF_STATUS_E_INVAL;
645 	}
646 
647 	tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
648 
649 	ext_param = target_psoc_get_service_ext_param(tgt_psoc_info);
650 	if (!ext_param) {
651 		target_if_err("tgt_psoc_info is NULL");
652 		return QDF_STATUS_E_INVAL;
653 	}
654 	init_deinit_chainmask_table_free(ext_param);
655 	init_deinit_dbr_ring_cap_free(tgt_psoc_info);
656 	init_deinit_spectral_scaling_params_free(tgt_psoc_info);
657 
658 	qdf_event_destroy(&tgt_psoc_info->info.event);
659 
660 	wlan_psoc_set_tgt_if_handle(psoc, NULL);
661 
662 	wlan_minidump_remove(tgt_psoc_info);
663 	qdf_mem_free(tgt_psoc_info);
664 
665 	return QDF_STATUS_SUCCESS;
666 }
667 
668 bool target_is_tgt_type_ar900b(uint32_t target_type)
669 {
670 	return target_type == TARGET_TYPE_AR900B;
671 }
672 
673 bool target_is_tgt_type_ipq4019(uint32_t target_type)
674 {
675 	return target_type == TARGET_TYPE_IPQ4019;
676 }
677 
678 bool target_is_tgt_type_qca9984(uint32_t target_type)
679 {
680 	return target_type == TARGET_TYPE_QCA9984;
681 }
682 
683 bool target_is_tgt_type_qca9888(uint32_t target_type)
684 {
685 	return target_type == TARGET_TYPE_QCA9888;
686 }
687 
688 bool target_is_tgt_type_adrastea(uint32_t target_type)
689 {
690 	return target_type == TARGET_TYPE_ADRASTEA;
691 }
692 
693 bool target_is_tgt_type_qcn9000(uint32_t target_type)
694 {
695 	return target_type == TARGET_TYPE_QCN9000;
696 }
697