xref: /wlan-dirver/qca-wifi-host-cmn/target_if/init_deinit/src/init_event_handler.c (revision 2888b71da71bce103343119fa1b31f4a0cee07c8)
1 /*
2  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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 /**
21  * DOC: init_event_handler.c
22  *
23  * WMI common event handler implementation source file
24  */
25 
26 #include <qdf_status.h>
27 #include <wlan_objmgr_psoc_obj.h>
28 #include <wlan_objmgr_pdev_obj.h>
29 #include <target_if.h>
30 #include <target_if_reg.h>
31 #include <init_event_handler.h>
32 #include <service_ready_util.h>
33 #include <service_ready_param.h>
34 #include <init_cmd_api.h>
35 #include <cdp_txrx_cmn.h>
36 #include <wlan_reg_ucfg_api.h>
37 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
38 #include <wlan_mlo_mgr_cmn.h>
39 #include <wlan_mlo_mgr_setup.h>
40 #endif
41 #include <target_if_twt.h>
42 
43 static void init_deinit_set_send_init_cmd(struct wlan_objmgr_psoc *psoc,
44 					  struct target_psoc_info *tgt_hdl)
45 {
46 	tgt_hdl->info.wmi_service_ready = TRUE;
47 	/* send init command */
48 	init_deinit_prepare_send_init_cmd(psoc, tgt_hdl);
49 }
50 
51 #ifdef WLAN_FEATURE_P2P_P2P_STA
52 static void
53 init_deinit_update_p2p_p2p_conc_support(struct wmi_unified *wmi_handle,
54 					struct wlan_objmgr_psoc *psoc)
55 {
56 	if (wmi_service_enabled(wmi_handle, wmi_service_p2p_p2p_cc_support))
57 		wlan_psoc_nif_fw_ext_cap_set(psoc,
58 					     WLAN_SOC_EXT_P2P_P2P_CONC_SUPPORT);
59 	else
60 		target_if_debug("P2P + P2P conc disabled");
61 }
62 #else
63 static inline void
64 init_deinit_update_p2p_p2p_conc_support(struct wmi_unified *wmi_handle,
65 					struct wlan_objmgr_psoc *psoc)
66 {}
67 #endif
68 
69 #ifdef QCA_RSSI_DB2DBM
70 static void
71 init_deinit_update_rssi_dbm_conv_support(struct wmi_unified *wmi_handle,
72 					 struct wlan_objmgr_psoc *psoc)
73 {
74 	/* Send RSSI_DBM_CONV to DP layer */
75 	if (wmi_service_enabled(wmi_handle,
76 				wmi_service_pdev_rssi_dbm_conv_event_support))
77 		cdp_soc_set_param(wlan_psoc_get_dp_handle(psoc),
78 				  DP_SOC_PARAM_RSSI_DBM_CONV_SUPPORT, 1);
79 }
80 #else
81 static inline void
82 init_deinit_update_rssi_dbm_conv_support(struct wmi_unified *wmi_handle,
83 					 struct wlan_objmgr_psoc *psoc)
84 {}
85 #endif
86 
87 #ifdef WIFI_POS_CONVERGED
88 static inline void
89 init_deinit_update_wifi_pos_caps(struct wmi_unified *wmi_handle,
90 				 struct wlan_objmgr_psoc *psoc)
91 {
92 	if (wmi_service_enabled(wmi_handle, wmi_service_rtt_11az_ntb_support))
93 		wlan_psoc_nif_fw_ext_cap_set(psoc,
94 					     WLAN_RTT_11AZ_NTB_SUPPORT);
95 
96 	if (wmi_service_enabled(wmi_handle, wmi_service_rtt_11az_tb_support))
97 		wlan_psoc_nif_fw_ext2_cap_set(psoc,
98 					      WLAN_RTT_11AZ_TB_SUPPORT);
99 
100 	if (wmi_service_enabled(wmi_handle,
101 				wmi_service_rtt_11az_mac_sec_support))
102 		wlan_psoc_nif_fw_ext2_cap_set(psoc,
103 					      WLAN_RTT_11AZ_MAC_SEC_SUPPORT);
104 
105 	if (wmi_service_enabled(wmi_handle,
106 				wmi_service_rtt_11az_mac_phy_sec_support))
107 		wlan_psoc_nif_fw_ext2_cap_set(
108 				psoc, WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT);
109 }
110 #else
111 static inline void
112 init_deinit_update_wifi_pos_caps(struct wmi_unified *wmi_handle,
113 				 struct wlan_objmgr_psoc *psoc)
114 {}
115 #endif
116 
117 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
118 static void
119 init_deinit_update_roam_stats_cap(struct wmi_unified *wmi_handle,
120 				  struct wlan_objmgr_psoc *psoc)
121 {
122 	if (wmi_service_enabled(wmi_handle,
123 				wmi_service_roam_stats_per_candidate_frame_info))
124 		wlan_psoc_nif_fw_ext2_cap_set(
125 			psoc, WLAN_ROAM_STATS_FRAME_INFO_PER_CANDIDATE);
126 }
127 #else
128 static inline void
129 init_deinit_update_roam_stats_cap(struct wmi_unified *wmi_handle,
130 				  struct wlan_objmgr_psoc *psoc)
131 {}
132 #endif
133 
134 #ifdef MULTI_CLIENT_LL_SUPPORT
135 /**
136  * init_deinit_update_multi_client_ll_caps() - Update multi client service
137  * capability bit
138  * @wmi_handle: wmi hanle
139  * @psoc: psoc commom object
140  *
141  * Return: none
142  */
143 static void
144 init_deinit_update_multi_client_ll_caps(struct wmi_unified *wmi_handle,
145 					struct wlan_objmgr_psoc *psoc)
146 {
147 	if (wmi_service_enabled(wmi_handle,
148 				wmi_service_configure_multi_client_ll_support))
149 		wlan_psoc_nif_fw_ext2_cap_set(psoc,
150 					WLAN_SOC_WLM_MULTI_CLIENT_LL_SUPPORT);
151 }
152 #else
153 static inline void
154 init_deinit_update_multi_client_ll_caps(struct wmi_unified *wmi_handle,
155 					struct wlan_objmgr_psoc *psoc)
156 {}
157 #endif
158 
159 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
160 /**
161  * init_deinit_update_vendor_handoff_control_caps() - Update vendor handoff
162  * control service capability bit
163  * @wmi_handle: wmi hanle
164  * @psoc: psoc commom object
165  *
166  * Return: none
167  */
168 static void
169 init_deinit_update_vendor_handoff_control_caps(struct wmi_unified *wmi_handle,
170 					       struct wlan_objmgr_psoc *psoc)
171 {
172 	if (wmi_service_enabled(wmi_handle,
173 			wmi_service_configure_vendor_handoff_control_support))
174 		wlan_psoc_nif_fw_ext2_cap_set(psoc,
175 					      WLAN_SOC_VENDOR_HANDOFF_CONTROL);
176 }
177 #else
178 static inline void
179 init_deinit_update_vendor_handoff_control_caps(struct wmi_unified *wmi_handle,
180 					       struct wlan_objmgr_psoc *psoc)
181 {}
182 #endif
183 
184 static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
185 							uint8_t *event,
186 							uint32_t data_len)
187 {
188 	int err_code;
189 	struct wlan_objmgr_psoc *psoc;
190 	struct target_psoc_info *tgt_hdl;
191 	wmi_legacy_service_ready_callback legacy_callback;
192 	struct wmi_unified *wmi_handle;
193 	QDF_STATUS ret_val;
194 
195 	if (!scn_handle) {
196 		target_if_err("scn handle NULL in service ready handler");
197 		return -EINVAL;
198 	}
199 
200 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
201 	if (!psoc) {
202 		target_if_err("psoc is null in service ready handler");
203 		return -EINVAL;
204 	}
205 
206 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
207 	if (!tgt_hdl) {
208 		target_if_err("target_psoc_info is null in service ready ev");
209 		return -EINVAL;
210 	}
211 
212 	ret_val = target_if_sw_version_check(psoc, tgt_hdl, event);
213 
214 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
215 
216 	err_code = init_deinit_populate_service_bitmap(wmi_handle, event,
217 			tgt_hdl->info.service_bitmap);
218 	if (err_code)
219 		goto exit;
220 
221 	err_code = init_deinit_populate_fw_version_cmd(wmi_handle, event);
222 	if (err_code)
223 		goto exit;
224 
225 	err_code = init_deinit_populate_target_cap(wmi_handle, event,
226 				   &(tgt_hdl->info.target_caps));
227 	if (err_code)
228 		goto exit;
229 
230 	err_code = init_deinit_populate_phy_reg_cap(psoc, wmi_handle, event,
231 				    &(tgt_hdl->info), true);
232 	if (err_code)
233 		goto exit;
234 
235 	if (init_deinit_validate_160_80p80_fw_caps(psoc, tgt_hdl) !=
236 			QDF_STATUS_SUCCESS) {
237 		wlan_psoc_nif_op_flag_set(psoc, WLAN_SOC_OP_VHT_INVALID_CAP);
238 	}
239 
240 	if (wmi_service_enabled(wmi_handle, wmi_service_tt))
241 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TT_SUPPORT);
242 
243 	if (wmi_service_enabled(wmi_handle, wmi_service_widebw_scan))
244 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_WIDEBAND_SCAN);
245 
246 	if (wmi_service_enabled(wmi_handle, wmi_service_check_cal_version))
247 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_SW_CAL);
248 
249 	if (wmi_service_enabled(wmi_handle, wmi_service_twt_requestor))
250 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TWT_REQUESTER);
251 
252 	if (wmi_service_enabled(wmi_handle, wmi_service_twt_responder))
253 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TWT_RESPONDER);
254 
255 	if (wmi_service_enabled(wmi_handle, wmi_service_bss_color_offload))
256 		target_if_debug(" BSS COLOR OFFLOAD supported");
257 
258 	if (wmi_service_enabled(wmi_handle, wmi_service_ul_ru26_allowed))
259 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_OBSS_NBW_RU);
260 
261 	if (wmi_service_enabled(wmi_handle, wmi_service_infra_mbssid))
262 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_MBSS_IE);
263 
264 	if (wmi_service_enabled(wmi_handle,
265 				wmi_service_mbss_param_in_vdev_start_support))
266 		wlan_psoc_nif_fw_ext_cap_set(psoc,
267 					     WLAN_SOC_CEXT_MBSS_PARAM_IN_START);
268 
269 	if (wmi_service_enabled(wmi_handle, wmi_service_dynamic_hw_mode))
270 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_DYNAMIC_HW_MODE);
271 
272 	if (wmi_service_enabled(wmi_handle,
273 				wmi_service_bw_restricted_80p80_support))
274 		wlan_psoc_nif_fw_ext_cap_set(psoc,
275 					     WLAN_SOC_RESTRICTED_80P80_SUPPORT);
276 
277 	if (wmi_service_enabled(wmi_handle,
278 				wmi_service_nss_ratio_to_host_support))
279 		wlan_psoc_nif_fw_ext_cap_set(
280 				psoc, WLAN_SOC_NSS_RATIO_TO_HOST_SUPPORT);
281 
282 	if (wmi_service_enabled(wmi_handle,
283 				wmi_service_rtt_ap_initiator_staggered_mode_supported))
284 		wlan_psoc_nif_fw_ext_cap_set(
285 				psoc, WLAN_SOC_RTT_AP_INITIATOR_STAGGERED_MODE_SUPPORTED);
286 
287 	if (wmi_service_enabled(wmi_handle,
288 				wmi_service_rtt_ap_initiator_bursted_mode_supported))
289 		wlan_psoc_nif_fw_ext_cap_set(
290 				psoc, WLAN_SOC_RTT_AP_INITIATOR_BURSTED_MODE_SUPPORTED);
291 
292 	target_if_debug(" TT support %d, Wide BW Scan %d, SW cal %d",
293 		wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_TT_SUPPORT),
294 		wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_WIDEBAND_SCAN),
295 		wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_SW_CAL));
296 
297 	target_if_mesh_support_enable(psoc, tgt_hdl, event);
298 
299 	target_if_eapol_minrate_enable(psoc, tgt_hdl, event);
300 
301 	target_if_smart_antenna_enable(psoc, tgt_hdl, event);
302 
303 	target_if_cfr_support_enable(psoc, tgt_hdl, event);
304 
305 	target_if_peer_cfg_enable(psoc, tgt_hdl, event);
306 
307 	target_if_atf_cfg_enable(psoc, tgt_hdl, event);
308 
309 	if (wmi_service_enabled(wmi_handle,
310 				wmi_service_mgmt_rx_reo_supported))
311 		wlan_psoc_nif_feat_cap_set(psoc,
312 					   WLAN_SOC_F_MGMT_RX_REO_CAPABLE);
313 
314 	target_if_lteu_cfg_enable(psoc, tgt_hdl, event);
315 
316 	if (wmi_service_enabled(wmi_handle, wmi_service_rx_fse_support))
317 		wlan_psoc_nif_fw_ext_cap_set(psoc,
318 					     WLAN_SOC_CEXT_RX_FSE_SUPPORT);
319 
320 	if (wmi_service_enabled(wmi_handle,
321 				wmi_service_scan_conf_per_ch_support))
322 		wlan_psoc_nif_fw_ext_cap_set(psoc,
323 					     WLAN_SOC_CEXT_SCAN_PER_CH_CONFIG);
324 
325 	if (wmi_service_enabled(wmi_handle,
326 				wmi_service_pno_scan_conf_per_ch_support))
327 		wlan_psoc_nif_fw_ext_cap_set(psoc,
328 					WLAN_SOC_PNO_SCAN_CONFIG_PER_CHANNEL);
329 
330 	if (wmi_service_enabled(wmi_handle, wmi_service_csa_beacon_template))
331 		wlan_psoc_nif_fw_ext_cap_set(psoc,
332 					     WLAN_SOC_CEXT_CSA_TX_OFFLOAD);
333 
334 	init_deinit_update_roam_stats_cap(wmi_handle, psoc);
335 
336 	init_deinit_update_wifi_pos_caps(wmi_handle, psoc);
337 
338 	/* override derived value, if it exceeds max peer count */
339 	if ((wlan_psoc_get_max_peer_count(psoc) >
340 		tgt_hdl->info.wlan_res_cfg.num_active_peers) &&
341 		(wlan_psoc_get_max_peer_count(psoc) <
342 			(tgt_hdl->info.wlan_res_cfg.num_peers -
343 				tgt_hdl->info.wlan_res_cfg.num_vdevs))) {
344 		tgt_hdl->info.wlan_res_cfg.num_peers =
345 				wlan_psoc_get_max_peer_count(psoc) +
346 					tgt_hdl->info.wlan_res_cfg.num_vdevs;
347 	}
348 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
349 	if (!legacy_callback) {
350 		err_code = -EINVAL;
351 		goto exit;
352 	}
353 
354 	err_code = legacy_callback(wmi_service_ready_event_id,
355 				  scn_handle, event, data_len);
356 	init_deinit_chainmask_config(psoc, tgt_hdl);
357 
358 	if (wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)) {
359 		wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_WMI_MGMT_REF);
360 		target_if_debug("WMI mgmt service enabled");
361 	} else {
362 		wlan_psoc_nif_fw_ext_cap_clear(psoc,
363 					       WLAN_SOC_CEXT_WMI_MGMT_REF);
364 		target_if_debug("WMI mgmt service disabled");
365 	}
366 	init_deinit_update_p2p_p2p_conc_support(wmi_handle, psoc);
367 
368 	err_code = init_deinit_handle_host_mem_req(psoc, tgt_hdl, event);
369 	if (err_code != QDF_STATUS_SUCCESS)
370 		goto exit;
371 
372 	target_if_reg_set_offloaded_info(psoc);
373 	target_if_reg_set_6ghz_info(psoc);
374 	target_if_reg_set_5dot9_ghz_info(psoc);
375 	target_if_twt_fill_tgt_caps(psoc, wmi_handle);
376 
377 	/* Send num_msdu_desc to DP layer */
378 	cdp_soc_set_param(wlan_psoc_get_dp_handle(psoc),
379 			  DP_SOC_PARAM_MSDU_EXCEPTION_DESC,
380 			  tgt_hdl->info.target_caps.num_msdu_desc);
381 
382 	/* Send CMEM FSE support to DP layer */
383 	if (wmi_service_enabled(wmi_handle, wmi_service_fse_cmem_alloc_support))
384 		cdp_soc_set_param(wlan_psoc_get_dp_handle(psoc),
385 				  DP_SOC_PARAM_CMEM_FSE_SUPPORT, 1);
386 
387 	/* Send multi_peer_group support to DP layer */
388 	if (wmi_service_enabled(wmi_handle,
389 				wmi_service_multi_peer_group_cmd_support))
390 		cdp_soc_set_param(wlan_psoc_get_dp_handle(psoc),
391 				  DP_SOC_PARAM_MULTI_PEER_GRP_CMD_SUPPORT, 1);
392 
393 	/* Send UMAC HW reset support to DP layer */
394 	if (wmi_service_enabled(wmi_handle,
395 				wmi_service_umac_hang_recovery_support))
396 		cdp_soc_set_param(wlan_psoc_get_dp_handle(psoc),
397 				  DP_SOC_PARAM_UMAC_HW_RESET_SUPPORT, 1);
398 
399 	if (wmi_service_enabled(wmi_handle, wmi_service_vdev_delete_all_peer))
400 		wlan_psoc_nif_fw_ext2_cap_set(psoc,
401 					      WLAN_VDEV_DELETE_ALL_PEER_SUPPORT);
402 
403 	init_deinit_update_rssi_dbm_conv_support(wmi_handle, psoc);
404 
405 	init_deinit_update_multi_client_ll_caps(wmi_handle, psoc);
406 
407 	init_deinit_update_vendor_handoff_control_caps(wmi_handle, psoc);
408 
409 	if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) {
410 		target_if_debug("Wait for EXT message");
411 	} else {
412 		target_if_debug("No EXT message, send init command");
413 		target_psoc_set_num_radios(tgt_hdl, 1);
414 		init_deinit_set_send_init_cmd(psoc, tgt_hdl);
415 	}
416 
417 exit:
418 	return err_code;
419 }
420 
421 static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
422 							uint8_t *event,
423 							uint32_t data_len)
424 {
425 	int err_code = 0;
426 	struct wlan_objmgr_psoc *psoc;
427 	struct target_psoc_info *tgt_hdl;
428 	struct wmi_unified *wmi_handle;
429 	struct tgt_info *info;
430 	wmi_legacy_service_ready_callback legacy_callback;
431 
432 	if (!scn_handle) {
433 		target_if_err("scn handle NULL in service ready ext2 handler");
434 		return -EINVAL;
435 	}
436 
437 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
438 	if (!psoc) {
439 		target_if_err("psoc is null in service ready ext2 handler");
440 		return -EINVAL;
441 	}
442 
443 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
444 	if (!tgt_hdl) {
445 		target_if_err("target_psoc_info is null in service ready ext2 handler");
446 		return -EINVAL;
447 	}
448 
449 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
450 	if (!wmi_handle) {
451 		target_if_err("wmi_handle is null in service ready ext2 handler");
452 		return -EINVAL;
453 	}
454 
455 	info = (&tgt_hdl->info);
456 
457 	err_code = init_deinit_populate_service_ready_ext2_param(wmi_handle,
458 								 event, info);
459 	if (err_code)
460 		goto exit;
461 
462 	if (wmi_service_enabled(wmi_handle,
463 				wmi_service_reg_cc_ext_event_support)) {
464 		target_if_set_reg_cc_ext_supp(tgt_hdl, psoc);
465 		wlan_psoc_nif_fw_ext_cap_set(psoc,
466 					     WLAN_SOC_EXT_EVENT_SUPPORTED);
467 	}
468 
469 	if (wmi_service_enabled(wmi_handle,
470 				wmi_service_bang_radar_320_support)) {
471 		info->wlan_res_cfg.is_host_dfs_320mhz_bangradar_supported =
472 									   true;
473 	}
474 
475 	/* dbr_ring_caps could have already come as part of EXT event */
476 	if (info->service_ext2_param.num_dbr_ring_caps) {
477 		err_code = init_deinit_populate_dbr_ring_cap_ext2(psoc,
478 								  wmi_handle,
479 								  event, info);
480 		if (err_code)
481 			goto exit;
482 	}
483 
484 	err_code = init_deinit_populate_hal_reg_cap_ext2(wmi_handle, event,
485 							 info);
486 	if (err_code) {
487 		target_if_err("failed to populate hal reg cap ext2");
488 		goto exit;
489 	}
490 
491 	err_code = init_deinit_populate_mac_phy_cap_ext2(wmi_handle, event,
492 							 info);
493 	if (err_code) {
494 		target_if_err("failed to populate mac phy cap ext2");
495 		goto exit;
496 	}
497 
498 	target_if_add_11ax_modes(psoc, tgt_hdl);
499 
500 	err_code = init_deinit_populate_scan_radio_cap_ext2(wmi_handle, event,
501 							    info);
502 	if (err_code) {
503 		target_if_err("failed to populate scan radio cap ext2");
504 		goto exit;
505 	}
506 
507 	err_code = init_deinit_populate_twt_cap_ext2(psoc, wmi_handle, event,
508 						     info);
509 
510 	if (err_code)
511 		target_if_debug("failed to populate twt cap ext2");
512 
513 	err_code = init_deinit_populate_dbs_or_sbs_cap_ext2(psoc, wmi_handle,
514 							    event, info);
515 	if (err_code)
516 		target_if_debug("failed to populate dbs_or_sbs cap ext2");
517 
518 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
519 	if (legacy_callback)
520 		legacy_callback(wmi_service_ready_ext2_event_id,
521 				scn_handle, event, data_len);
522 
523 	target_if_regulatory_set_ext_tpc(psoc);
524 
525 	target_if_reg_set_lower_6g_edge_ch_info(psoc);
526 
527 	target_if_reg_set_disable_upper_6g_edge_ch_info(psoc);
528 
529 	target_if_reg_set_afc_dev_type(psoc, tgt_hdl);
530 
531 	/* send init command */
532 	init_deinit_set_send_init_cmd(psoc, tgt_hdl);
533 
534 exit:
535 	return err_code;
536 }
537 
538 static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
539 						uint8_t *event,
540 						uint32_t data_len)
541 {
542 	int err_code;
543 	uint8_t num_radios;
544 	struct wlan_objmgr_psoc *psoc;
545 	struct target_psoc_info *tgt_hdl;
546 	struct wmi_unified *wmi_handle;
547 	struct tgt_info *info;
548 	wmi_legacy_service_ready_callback legacy_callback;
549 
550 	if (!scn_handle) {
551 		target_if_err("scn handle NULL in service ready handler");
552 		return -EINVAL;
553 	}
554 
555 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
556 	if (!psoc) {
557 		target_if_err("psoc is null in service ready handler");
558 		return -EINVAL;
559 	}
560 
561 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
562 	if (!tgt_hdl) {
563 		target_if_err("target_psoc_info is null in service ready ev");
564 		return -EINVAL;
565 	}
566 
567 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
568 	info = (&tgt_hdl->info);
569 
570 	err_code = init_deinit_populate_service_ready_ext_param(wmi_handle,
571 				event, &(info->service_ext_param));
572 	if (err_code)
573 		goto exit;
574 
575 	target_psoc_set_num_radios(tgt_hdl, 0);
576 	err_code =  init_deinit_populate_hw_mode_capability(wmi_handle,
577 					    event, tgt_hdl);
578 	if (err_code)
579 		goto exit;
580 
581 	if (init_deinit_is_preferred_hw_mode_supported(psoc, tgt_hdl)
582 			== FALSE) {
583 		target_if_err("Preferred mode %d not supported",
584 			      info->preferred_hw_mode);
585 		return -EINVAL;
586 	}
587 
588 	num_radios = target_psoc_get_num_radios_for_mode(tgt_hdl,
589 							 info->preferred_hw_mode);
590 
591 	/* set number of radios based on current mode */
592 	target_psoc_set_num_radios(tgt_hdl, num_radios);
593 
594 	target_if_print_service_ready_ext_param(psoc, tgt_hdl);
595 
596 	err_code = init_deinit_populate_phy_reg_cap(psoc, wmi_handle,
597 					   event, info, false);
598 	if (err_code)
599 		goto exit;
600 
601 	/* Host receives 11AX wireless modes from target in service ext2
602 	 * message. Therefore, call target_if_add_11ax_modes() from service ext2
603 	 * event handler as well.
604 	 */
605 	if (!wmi_service_enabled(wmi_handle, wmi_service_ext2_msg))
606 		target_if_add_11ax_modes(psoc, tgt_hdl);
607 
608 	if (init_deinit_chainmask_table_alloc(
609 				&(info->service_ext_param)) ==
610 							QDF_STATUS_SUCCESS) {
611 		err_code = init_deinit_populate_chainmask_tables(wmi_handle,
612 				event,
613 				&(info->service_ext_param.chainmask_table[0]));
614 		if (err_code)
615 			goto exit;
616 	}
617 
618 	/* dbr_ring_caps can be absent if enough space is not available */
619 	if (info->service_ext_param.num_dbr_ring_caps) {
620 		err_code = init_deinit_populate_dbr_ring_cap(psoc, wmi_handle,
621 							     event, info);
622 		if (err_code)
623 			goto exit;
624 	}
625 
626 	err_code = init_deinit_populate_spectral_bin_scale_params(psoc,
627 								  wmi_handle,
628 								  event, info);
629 	if (err_code)
630 		goto exit;
631 
632 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
633 	if (legacy_callback)
634 		legacy_callback(wmi_service_ready_ext_event_id,
635 				scn_handle, event, data_len);
636 
637 	target_if_set_twt_ap_pdev_count(info, tgt_hdl);
638 
639 	info->wlan_res_cfg.max_bssid_indicator =
640 				info->service_ext_param.max_bssid_indicator;
641 
642 	if (wmi_service_enabled(wmi_handle, wmi_service_ext2_msg)) {
643 		target_if_debug("Wait for EXT2 message");
644 	} else {
645 		target_if_debug("No EXT2 message, send init command");
646 		init_deinit_set_send_init_cmd(psoc, tgt_hdl);
647 	}
648 
649 exit:
650 	return err_code;
651 }
652 
653 static int init_deinit_service_available_handler(ol_scn_t scn_handle,
654 						uint8_t *event,
655 						uint32_t data_len)
656 {
657 	struct wlan_objmgr_psoc *psoc;
658 	struct target_psoc_info *tgt_hdl;
659 	struct wmi_unified *wmi_handle;
660 
661 	if (!scn_handle) {
662 		target_if_err("scn handle NULL");
663 		return -EINVAL;
664 	}
665 
666 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
667 	if (!psoc) {
668 		target_if_err("psoc is null");
669 		return -EINVAL;
670 	}
671 
672 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
673 	if (!tgt_hdl) {
674 		target_if_err("target_psoc_info is null");
675 		return -EINVAL;
676 	}
677 
678 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
679 
680 	if (wmi_save_ext_service_bitmap(wmi_handle, event, NULL) !=
681 					QDF_STATUS_SUCCESS) {
682 		target_if_err("Failed to save ext service bitmap");
683 		return -EINVAL;
684 	}
685 
686 	return 0;
687 }
688 
689 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
690 static bool init_deinit_mlo_capable(struct wlan_objmgr_psoc *psoc)
691 {
692 	struct target_psoc_info *tgt_hdl;
693 
694 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
695 	if (!tgt_hdl) {
696 		target_if_err("target_psoc_info is null");
697 		return false;
698 	}
699 
700 	if ((tgt_hdl->tif_ops) &&
701 	    (tgt_hdl->tif_ops->mlo_capable))
702 		return tgt_hdl->tif_ops->mlo_capable(psoc);
703 
704 	return false;
705 }
706 
707 static void init_deinit_mlo_update_soc_ready(struct wlan_objmgr_psoc *psoc)
708 {
709 	if (init_deinit_mlo_capable(psoc))
710 		mlo_setup_update_soc_ready(psoc);
711 }
712 
713 static void init_deinit_send_ml_link_ready(struct wlan_objmgr_psoc *psoc,
714 					   void *object, void *arg)
715 {
716 	struct wlan_objmgr_pdev *pdev = object;
717 
718 	if (!init_deinit_mlo_capable(psoc))
719 		return;
720 
721 	qdf_assert_always(psoc);
722 	qdf_assert_always(pdev);
723 
724 	mlo_setup_link_ready(pdev);
725 }
726 
727 static void init_deinit_mlo_update_pdev_ready(struct wlan_objmgr_psoc *psoc,
728 					      uint8_t num_radios)
729 {
730 	if (!init_deinit_mlo_capable(psoc))
731 		return;
732 
733 	wlan_objmgr_iterate_obj_list(psoc, WLAN_PDEV_OP,
734 				     init_deinit_send_ml_link_ready,
735 				     NULL, 0, WLAN_INIT_DEINIT_ID);
736 }
737 #else
738 static void init_deinit_mlo_update_soc_ready(struct wlan_objmgr_psoc *psoc)
739 {}
740 static void init_deinit_mlo_update_pdev_ready(struct wlan_objmgr_psoc *psoc,
741 					      uint8_t num_radios)
742 {}
743 #endif /*WLAN_FEATURE_11BE_MLO && WLAN_MLO_MULTI_CHIP*/
744 
745 /* MAC address fourth byte index */
746 #define MAC_BYTE_4 4
747 
748 static int init_deinit_ready_event_handler(ol_scn_t scn_handle,
749 						uint8_t *event,
750 						uint32_t data_len)
751 {
752 	struct wlan_objmgr_psoc *psoc;
753 	struct wlan_objmgr_pdev *pdev;
754 	struct target_psoc_info *tgt_hdl;
755 	struct wmi_unified *wmi_handle;
756 	struct wmi_host_fw_abi_ver fw_ver;
757 	uint8_t myaddr[QDF_MAC_ADDR_SIZE];
758 	struct tgt_info *info;
759 	struct wmi_host_ready_ev_param ready_ev;
760 	wmi_legacy_service_ready_callback legacy_callback;
761 	uint8_t num_radios, i;
762 	uint32_t max_peers;
763 	uint32_t max_ast_index;
764 	target_resource_config *tgt_cfg;
765 
766 	if (!scn_handle) {
767 		target_if_err("scn handle NULL");
768 		return -EINVAL;
769 	}
770 
771 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
772 	if (!psoc) {
773 		target_if_err("psoc is null");
774 		return -EINVAL;
775 	}
776 
777 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
778 	if (!tgt_hdl) {
779 		target_if_err("target_psoc_info is null");
780 		return -EINVAL;
781 	}
782 
783 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
784 	info = (&tgt_hdl->info);
785 
786 	if (wmi_extract_fw_abi_version(wmi_handle, event, &fw_ver) ==
787 				QDF_STATUS_SUCCESS) {
788 		info->version.wlan_ver = fw_ver.sw_version;
789 		info->version.wlan_ver = fw_ver.abi_version;
790 	}
791 
792 	if (wmi_check_and_update_fw_version(wmi_handle, event) < 0) {
793 		target_if_err("Version mismatch with FW");
794 		return -EINVAL;
795 	}
796 
797 	if (wmi_extract_ready_event_params(wmi_handle, event, &ready_ev) !=
798 				QDF_STATUS_SUCCESS) {
799 		target_if_err("Failed to extract ready event");
800 		return -EINVAL;
801 	}
802 
803 	if (!ready_ev.agile_capability)
804 		target_if_err("agile capability disabled in HW");
805 	else
806 		info->wlan_res_cfg.agile_capability = ready_ev.agile_capability;
807 
808 	if (ready_ev.num_max_active_vdevs) {
809 		if (ready_ev.num_max_active_vdevs <
810 		    info->wlan_res_cfg.num_max_active_vdevs) {
811 			target_if_err("unexpected num_max_active_vdevs fw %d host %d",
812 				      ready_ev.num_max_active_vdevs,
813 				      info->wlan_res_cfg.num_max_active_vdevs);
814 			info->wlan_res_cfg.num_max_active_vdevs =
815 					ready_ev.num_max_active_vdevs;
816 		}
817 	}
818 
819 	/* Indicate to the waiting thread that the ready
820 	 * event was received
821 	 */
822 	info->wlan_init_status = wmi_ready_extract_init_status(
823 						wmi_handle, event);
824 
825 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
826 	if (legacy_callback)
827 		if (legacy_callback(wmi_ready_event_id,
828 				    scn_handle, event, data_len)) {
829 			target_if_err("Legacy callback returned error!");
830 			tgt_hdl->info.wmi_ready = FALSE;
831 			goto exit;
832 		}
833 
834 	init_deinit_mlo_update_soc_ready(psoc);
835 
836 	num_radios = target_psoc_get_num_radios(tgt_hdl);
837 
838 	if ((ready_ev.num_total_peer != 0) &&
839 	    (info->wlan_res_cfg.num_peers != ready_ev.num_total_peer)) {
840 		uint16_t num_peers = 0;
841 		/* FW allocated number of peers is different than host
842 		 * requested. Update host max with FW reported value.
843 		 */
844 		target_if_err("Host Requested %d peers. FW Supports %d peers",
845 			       info->wlan_res_cfg.num_peers,
846 			       ready_ev.num_total_peer);
847 		info->wlan_res_cfg.num_peers = ready_ev.num_total_peer;
848 		num_peers = info->wlan_res_cfg.num_peers / num_radios;
849 
850 		for (i = 0; i < num_radios; i++) {
851 			pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
852 							  WLAN_INIT_DEINIT_ID);
853 			if (!pdev) {
854 				target_if_err(" PDEV %d is NULL", i);
855 				return -EINVAL;
856 			}
857 
858 			wlan_pdev_set_max_peer_count(pdev, num_peers);
859 			wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
860 		}
861 
862 		wlan_psoc_set_max_peer_count(psoc,
863 					     info->wlan_res_cfg.num_peers);
864 	}
865 
866 	/* for non legacy  num_total_peer will be non zero
867 	 * allocate peer memory in this case
868 	 */
869 	if (ready_ev.num_total_peer != 0) {
870 		tgt_cfg = &info->wlan_res_cfg;
871 		max_peers = tgt_cfg->num_peers + ready_ev.num_extra_peer + 1;
872 		max_ast_index = ready_ev.max_ast_index + 1;
873 
874 		if (cdp_peer_map_attach(wlan_psoc_get_dp_handle(psoc),
875 					max_peers, max_ast_index,
876 					tgt_cfg->peer_map_unmap_version) !=
877 				QDF_STATUS_SUCCESS) {
878 			target_if_err("DP peer map attach failed");
879 			return -EINVAL;
880 		}
881 	}
882 
883 
884 	if (ready_ev.pktlog_defs_checksum) {
885 		for (i = 0; i < num_radios; i++) {
886 			pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
887 							  WLAN_INIT_DEINIT_ID);
888 			if (!pdev) {
889 				target_if_err(" PDEV %d is NULL", i);
890 				return -EINVAL;
891 			}
892 			target_if_set_pktlog_checksum(pdev, tgt_hdl,
893 						      ready_ev.
894 						      pktlog_defs_checksum);
895 			wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
896 		}
897 	}
898 
899 	/*
900 	 * For non-legacy HW, MAC addr list is extracted.
901 	 */
902 	if (num_radios > 1) {
903 		uint8_t num_mac_addr;
904 		wmi_host_mac_addr *addr_list;
905 		int i;
906 
907 		addr_list = wmi_ready_extract_mac_addr_list(wmi_handle, event,
908 							    &num_mac_addr);
909 		if ((num_mac_addr >= num_radios) && (addr_list)) {
910 			for (i = 0; i < num_radios; i++) {
911 				WMI_HOST_MAC_ADDR_TO_CHAR_ARRAY(&addr_list[i],
912 								myaddr);
913 				pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
914 								  WLAN_INIT_DEINIT_ID);
915 				if (!pdev) {
916 					target_if_err(" PDEV %d is NULL", i);
917 					return -EINVAL;
918 				}
919 				wlan_pdev_set_hw_macaddr(pdev, myaddr);
920 				wlan_objmgr_pdev_release_ref(pdev,
921 							WLAN_INIT_DEINIT_ID);
922 
923 				/* assign 1st radio addr to psoc */
924 				if (i == 0)
925 					wlan_psoc_set_hw_macaddr(psoc, myaddr);
926 			}
927 			goto out;
928 		} else {
929 			target_if_err("Using default MAC addr for all radios..");
930 		}
931 	}
932 
933 	/*
934 	 * We extract single MAC address in two scenarios:
935 	 * 1. In non-legacy case, if addr list is NULL or num_mac_addr < num_radios
936 	 * 2. In all legacy cases
937 	 */
938 	for (i = 0; i < num_radios; i++) {
939 		wmi_ready_extract_mac_addr(wmi_handle, event, myaddr);
940 		myaddr[MAC_BYTE_4] += i;
941 		pdev = wlan_objmgr_get_pdev_by_id(psoc, i, WLAN_INIT_DEINIT_ID);
942 		if (!pdev) {
943 			target_if_err(" PDEV %d is NULL", i);
944 			return -EINVAL;
945 		}
946 		wlan_pdev_set_hw_macaddr(pdev, myaddr);
947 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
948 		/* assign 1st radio addr to psoc */
949 		if (i == 0)
950 			wlan_psoc_set_hw_macaddr(psoc, myaddr);
951 	}
952 
953 out:
954 	target_if_btcoex_cfg_enable(psoc, tgt_hdl, event);
955 	tgt_hdl->info.wmi_ready = TRUE;
956 	init_deinit_mlo_update_pdev_ready(psoc, num_radios);
957 exit:
958 	init_deinit_wakeup_host_wait(psoc, tgt_hdl);
959 
960 	return 0;
961 }
962 
963 #ifdef HEALTH_MON_SUPPORT
964 static int init_deinit_health_mon_event_handler(ol_scn_t scn_handle,
965 						uint8_t *event,
966 						uint32_t data_len)
967 {
968 	struct wlan_objmgr_psoc *psoc;
969 	struct target_psoc_info *tgt_hdl;
970 	struct wmi_unified *wmi_handle;
971 	struct tgt_info *info;
972 	struct wmi_health_mon_params *param;
973 
974 	if (!scn_handle) {
975 		target_if_err("scn handle NULL");
976 		return -EINVAL;
977 	}
978 
979 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
980 	if (!psoc) {
981 		target_if_err("psoc is null");
982 		return -EINVAL;
983 	}
984 
985 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
986 	if (!tgt_hdl) {
987 		target_if_err("target_psoc_info is null");
988 		return -EINVAL;
989 	}
990 
991 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
992 	info = (&tgt_hdl->info);
993 
994 	param = (&info->health_mon_param);
995 	wmi_extract_health_mon_event(wmi_handle, event, param);
996 
997 	return 0;
998 }
999 #endif /* HEALTH_MON_SUPPORT */
1000 
1001 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
1002 static void init_deinit_mlo_setup_done_event(struct wlan_objmgr_psoc *psoc)
1003 {
1004 	struct target_psoc_info *tgt_hdl;
1005 
1006 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1007 	if (!tgt_hdl) {
1008 		target_if_err("target_psoc_info is null");
1009 		return;
1010 	}
1011 
1012 	if ((tgt_hdl->tif_ops) &&
1013 	    (tgt_hdl->tif_ops->mlo_setup_done_event))
1014 		tgt_hdl->tif_ops->mlo_setup_done_event(psoc);
1015 }
1016 
1017 static int init_deinit_mlo_setup_comp_event_handler(ol_scn_t scn_handle,
1018 						    uint8_t *event,
1019 						    uint32_t data_len)
1020 {
1021 	struct wlan_objmgr_psoc *psoc;
1022 	struct wlan_objmgr_pdev *pdev;
1023 	struct target_psoc_info *tgt_hdl;
1024 	struct wmi_unified *wmi_handle;
1025 	struct wmi_mlo_setup_complete_params params;
1026 
1027 	if (!scn_handle) {
1028 		target_if_err("scn handle NULL");
1029 		return -EINVAL;
1030 	}
1031 
1032 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
1033 	if (!psoc) {
1034 		target_if_err("psoc is null");
1035 		return -EINVAL;
1036 	}
1037 
1038 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1039 	if (!tgt_hdl) {
1040 		target_if_err("target_psoc_info is null");
1041 		return -EINVAL;
1042 	}
1043 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
1044 
1045 	if (wmi_extract_mlo_setup_cmpl_event(wmi_handle, event, &params) !=
1046 			QDF_STATUS_SUCCESS)
1047 		return -EINVAL;
1048 
1049 	pdev = wlan_objmgr_get_pdev_by_id(psoc, params.pdev_id,
1050 					  WLAN_INIT_DEINIT_ID);
1051 	if (pdev) {
1052 		mlo_link_setup_complete(pdev);
1053 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
1054 	}
1055 
1056 	init_deinit_mlo_setup_done_event(psoc);
1057 
1058 	return 0;
1059 }
1060 
1061 static int init_deinit_mlo_teardown_comp_event_handler(ol_scn_t scn_handle,
1062 						       uint8_t *event,
1063 						       uint32_t data_len)
1064 {
1065 	struct wlan_objmgr_psoc *psoc;
1066 	struct wlan_objmgr_pdev *pdev;
1067 	struct target_psoc_info *tgt_hdl;
1068 	struct wmi_unified *wmi_handle;
1069 	struct wmi_mlo_teardown_cmpl_params params;
1070 
1071 	if (!scn_handle) {
1072 		target_if_err("scn handle NULL");
1073 		return -EINVAL;
1074 	}
1075 
1076 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
1077 	if (!psoc) {
1078 		target_if_err("psoc is null");
1079 		return -EINVAL;
1080 	}
1081 
1082 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1083 	if (!tgt_hdl) {
1084 		target_if_err("target_psoc_info is null");
1085 		return -EINVAL;
1086 	}
1087 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
1088 
1089 	if (wmi_extract_mlo_teardown_cmpl_event(wmi_handle, event, &params) !=
1090 			QDF_STATUS_SUCCESS)
1091 		return -EINVAL;
1092 
1093 	pdev = wlan_objmgr_get_pdev_by_id(psoc, params.pdev_id,
1094 					  WLAN_INIT_DEINIT_ID);
1095 	if (pdev) {
1096 		mlo_link_teardown_complete(pdev);
1097 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
1098 	}
1099 
1100 	return 0;
1101 }
1102 
1103 static QDF_STATUS init_deinit_register_mlo_ev_handlers(wmi_unified_t wmi_handle)
1104 {
1105 	wmi_unified_register_event(wmi_handle,
1106 				   wmi_mlo_setup_complete_event_id,
1107 				   init_deinit_mlo_setup_comp_event_handler);
1108 	wmi_unified_register_event(wmi_handle,
1109 				   wmi_mlo_teardown_complete_event_id,
1110 				   init_deinit_mlo_teardown_comp_event_handler);
1111 
1112 	return QDF_STATUS_SUCCESS;
1113 }
1114 #else
1115 static QDF_STATUS init_deinit_register_mlo_ev_handlers(wmi_unified_t wmi_handle)
1116 {
1117 	return QDF_STATUS_SUCCESS;
1118 }
1119 #endif /*WLAN_FEATURE_11BE_MLO && WLAN_MLO_MULTI_CHIP*/
1120 
1121 QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers(
1122 				struct wlan_objmgr_psoc *psoc)
1123 {
1124 	struct target_psoc_info *tgt_hdl;
1125 	wmi_unified_t wmi_handle;
1126 	QDF_STATUS retval = QDF_STATUS_SUCCESS;
1127 
1128 	if (!psoc) {
1129 		target_if_err("psoc is null in register wmi handler");
1130 		return QDF_STATUS_E_FAILURE;
1131 	}
1132 
1133 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1134 	if (!tgt_hdl) {
1135 		target_if_err("target_psoc_info null in register wmi hadler");
1136 		return QDF_STATUS_E_FAILURE;
1137 	}
1138 
1139 	wmi_handle = (wmi_unified_t)target_psoc_get_wmi_hdl(tgt_hdl);
1140 
1141 	retval = wmi_unified_register_event_handler(wmi_handle,
1142 				wmi_service_ready_event_id,
1143 				init_deinit_service_ready_event_handler,
1144 				WMI_RX_WORK_CTX);
1145 	retval = wmi_unified_register_event_handler(wmi_handle,
1146 				wmi_service_ready_ext_event_id,
1147 				init_deinit_service_ext_ready_event_handler,
1148 				WMI_RX_WORK_CTX);
1149 	retval = wmi_unified_register_event_handler(wmi_handle,
1150 				wmi_service_available_event_id,
1151 				init_deinit_service_available_handler,
1152 				WMI_RX_UMAC_CTX);
1153 	retval = wmi_unified_register_event_handler(wmi_handle,
1154 				wmi_ready_event_id,
1155 				init_deinit_ready_event_handler,
1156 				WMI_RX_WORK_CTX);
1157 	retval = wmi_unified_register_event_handler(
1158 				wmi_handle,
1159 				wmi_service_ready_ext2_event_id,
1160 				init_deinit_service_ext2_ready_event_handler,
1161 				WMI_RX_WORK_CTX);
1162 	retval = init_deinit_register_mlo_ev_handlers(wmi_handle);
1163 
1164 #ifdef HEALTH_MON_SUPPORT
1165 	retval = wmi_unified_register_event_handler(
1166 				wmi_handle,
1167 				wmi_extract_health_mon_init_done_info_eventid,
1168 				init_deinit_health_mon_event_handler,
1169 				WMI_RX_WORK_CTX);
1170 #endif /* HEALTH_MON_SUPPORT */
1171 
1172 	return retval;
1173 }
1174 
1175