xref: /wlan-dirver/qca-wifi-host-cmn/target_if/init_deinit/src/init_event_handler.c (revision 8b3dca18206e1a0461492f082fa6e270b092c035)
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 	if (info->wmi_service_status ==
457 			wmi_init_ext_processing_failed)
458 		return -EINVAL;
459 
460 	err_code = init_deinit_populate_service_ready_ext2_param(wmi_handle,
461 								 event, info);
462 	if (err_code)
463 		goto exit;
464 
465 	if (wmi_service_enabled(wmi_handle,
466 				wmi_service_reg_cc_ext_event_support)) {
467 		target_if_set_reg_cc_ext_supp(tgt_hdl, psoc);
468 		wlan_psoc_nif_fw_ext_cap_set(psoc,
469 					     WLAN_SOC_EXT_EVENT_SUPPORTED);
470 	}
471 
472 	if (wmi_service_enabled(wmi_handle,
473 				wmi_service_bang_radar_320_support)) {
474 		info->wlan_res_cfg.is_host_dfs_320mhz_bangradar_supported =
475 									   true;
476 	}
477 
478 	/* dbr_ring_caps could have already come as part of EXT event */
479 	if (info->service_ext2_param.num_dbr_ring_caps) {
480 		err_code = init_deinit_populate_dbr_ring_cap_ext2(psoc,
481 								  wmi_handle,
482 								  event, info);
483 		if (err_code)
484 			goto exit;
485 	}
486 
487 	err_code = init_deinit_populate_hal_reg_cap_ext2(wmi_handle, event,
488 							 info);
489 	if (err_code) {
490 		target_if_err("failed to populate hal reg cap ext2");
491 		goto exit;
492 	}
493 
494 	err_code = init_deinit_populate_mac_phy_cap_ext2(wmi_handle, event,
495 							 info);
496 	if (err_code) {
497 		target_if_err("failed to populate mac phy cap ext2");
498 		goto exit;
499 	}
500 
501 	target_if_add_11ax_modes(psoc, tgt_hdl);
502 
503 	err_code = init_deinit_populate_scan_radio_cap_ext2(wmi_handle, event,
504 							    info);
505 	if (err_code) {
506 		target_if_err("failed to populate scan radio cap ext2");
507 		goto exit;
508 	}
509 
510 	err_code = init_deinit_populate_twt_cap_ext2(psoc, wmi_handle, event,
511 						     info);
512 
513 	if (err_code)
514 		target_if_debug("failed to populate twt cap ext2");
515 
516 	err_code = init_deinit_populate_dbs_or_sbs_cap_ext2(psoc, wmi_handle,
517 							    event, info);
518 	if (err_code)
519 		target_if_debug("failed to populate dbs_or_sbs cap ext2");
520 
521 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
522 	if (legacy_callback)
523 		if (legacy_callback(wmi_service_ready_ext2_event_id,
524 				    scn_handle, event, data_len)) {
525 			target_if_err("Legacy callback return error!");
526 			goto exit;
527 		}
528 	target_if_regulatory_set_ext_tpc(psoc);
529 
530 	target_if_reg_set_lower_6g_edge_ch_info(psoc);
531 
532 	target_if_reg_set_disable_upper_6g_edge_ch_info(psoc);
533 
534 	target_if_reg_set_afc_dev_type(psoc, tgt_hdl);
535 
536 	/* send init command */
537 	init_deinit_set_send_init_cmd(psoc, tgt_hdl);
538 
539 	return 0;
540 exit:
541 	info->wmi_ready = false;
542 	info->wmi_service_status = wmi_init_ext2_processing_failed;
543 	return err_code;
544 }
545 
546 static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
547 						uint8_t *event,
548 						uint32_t data_len)
549 {
550 	int err_code;
551 	uint8_t num_radios;
552 	struct wlan_objmgr_psoc *psoc;
553 	struct target_psoc_info *tgt_hdl;
554 	struct wmi_unified *wmi_handle;
555 	struct tgt_info *info;
556 	wmi_legacy_service_ready_callback legacy_callback;
557 
558 	if (!scn_handle) {
559 		target_if_err("scn handle NULL in service ready handler");
560 		return -EINVAL;
561 	}
562 
563 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
564 	if (!psoc) {
565 		target_if_err("psoc is null in service ready handler");
566 		return -EINVAL;
567 	}
568 
569 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
570 	if (!tgt_hdl) {
571 		target_if_err("target_psoc_info is null in service ready ev");
572 		return -EINVAL;
573 	}
574 
575 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
576 	info = (&tgt_hdl->info);
577 
578 	err_code = init_deinit_populate_service_ready_ext_param(wmi_handle,
579 				event, &(info->service_ext_param));
580 	if (err_code)
581 		goto exit;
582 
583 	target_psoc_set_num_radios(tgt_hdl, 0);
584 	err_code =  init_deinit_populate_hw_mode_capability(wmi_handle,
585 					    event, tgt_hdl);
586 	if (err_code)
587 		goto exit;
588 
589 	if (init_deinit_is_preferred_hw_mode_supported(psoc, tgt_hdl)
590 			== FALSE) {
591 		target_if_err("Preferred mode %d not supported",
592 			      info->preferred_hw_mode);
593 		goto exit;
594 	}
595 
596 	num_radios = target_psoc_get_num_radios_for_mode(tgt_hdl,
597 							 info->preferred_hw_mode);
598 
599 	/* set number of radios based on current mode */
600 	target_psoc_set_num_radios(tgt_hdl, num_radios);
601 
602 	target_if_print_service_ready_ext_param(psoc, tgt_hdl);
603 
604 	err_code = init_deinit_populate_phy_reg_cap(psoc, wmi_handle,
605 					   event, info, false);
606 	if (err_code)
607 		goto exit;
608 
609 	/* Host receives 11AX wireless modes from target in service ext2
610 	 * message. Therefore, call target_if_add_11ax_modes() from service ext2
611 	 * event handler as well.
612 	 */
613 	if (!wmi_service_enabled(wmi_handle, wmi_service_ext2_msg))
614 		target_if_add_11ax_modes(psoc, tgt_hdl);
615 
616 	if (init_deinit_chainmask_table_alloc(
617 				&(info->service_ext_param)) ==
618 							QDF_STATUS_SUCCESS) {
619 		err_code = init_deinit_populate_chainmask_tables(wmi_handle,
620 				event,
621 				&(info->service_ext_param.chainmask_table[0]));
622 		if (err_code)
623 			goto exit;
624 	}
625 
626 	/* dbr_ring_caps can be absent if enough space is not available */
627 	if (info->service_ext_param.num_dbr_ring_caps) {
628 		err_code = init_deinit_populate_dbr_ring_cap(psoc, wmi_handle,
629 							     event, info);
630 		if (err_code)
631 			goto exit;
632 	}
633 
634 	err_code = init_deinit_populate_spectral_bin_scale_params(psoc,
635 								  wmi_handle,
636 								  event, info);
637 	if (err_code)
638 		goto exit;
639 
640 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
641 	if (legacy_callback) {
642 		if (legacy_callback(wmi_service_ready_ext_event_id,
643 				    scn_handle, event, data_len)) {
644 			target_if_err("Error Code %d", err_code);
645 			goto exit;
646 		}
647 	}
648 
649 	target_if_set_twt_ap_pdev_count(info, tgt_hdl);
650 
651 	info->wlan_res_cfg.max_bssid_indicator =
652 				info->service_ext_param.max_bssid_indicator;
653 
654 	if (wmi_service_enabled(wmi_handle, wmi_service_ext2_msg)) {
655 		target_if_debug("Wait for EXT2 message");
656 	} else {
657 		target_if_debug("No EXT2 message, send init command");
658 		init_deinit_set_send_init_cmd(psoc, tgt_hdl);
659 	}
660 
661 	return 0;
662 exit:
663 	info->wmi_ready = false;
664 	info->wmi_service_status = wmi_init_ext_processing_failed;
665 	init_deinit_wakeup_host_wait(psoc, tgt_hdl);
666 	return err_code;
667 }
668 
669 static int init_deinit_service_available_handler(ol_scn_t scn_handle,
670 						uint8_t *event,
671 						uint32_t data_len)
672 {
673 	struct wlan_objmgr_psoc *psoc;
674 	struct target_psoc_info *tgt_hdl;
675 	struct wmi_unified *wmi_handle;
676 
677 	if (!scn_handle) {
678 		target_if_err("scn handle NULL");
679 		return -EINVAL;
680 	}
681 
682 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
683 	if (!psoc) {
684 		target_if_err("psoc is null");
685 		return -EINVAL;
686 	}
687 
688 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
689 	if (!tgt_hdl) {
690 		target_if_err("target_psoc_info is null");
691 		return -EINVAL;
692 	}
693 
694 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
695 
696 	if (wmi_save_ext_service_bitmap(wmi_handle, event, NULL) !=
697 					QDF_STATUS_SUCCESS) {
698 		target_if_err("Failed to save ext service bitmap");
699 		return -EINVAL;
700 	}
701 
702 	return 0;
703 }
704 
705 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
706 static bool init_deinit_mlo_capable(struct wlan_objmgr_psoc *psoc)
707 {
708 	struct target_psoc_info *tgt_hdl;
709 
710 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
711 	if (!tgt_hdl) {
712 		target_if_err("target_psoc_info is null");
713 		return false;
714 	}
715 
716 	if ((tgt_hdl->tif_ops) &&
717 	    (tgt_hdl->tif_ops->mlo_capable))
718 		return tgt_hdl->tif_ops->mlo_capable(psoc);
719 
720 	return false;
721 }
722 
723 static void init_deinit_mlo_update_soc_ready(struct wlan_objmgr_psoc *psoc)
724 {
725 	if (init_deinit_mlo_capable(psoc))
726 		mlo_setup_update_soc_ready(psoc);
727 }
728 
729 static void init_deinit_send_ml_link_ready(struct wlan_objmgr_psoc *psoc,
730 					   void *object, void *arg)
731 {
732 	struct wlan_objmgr_pdev *pdev = object;
733 
734 	if (!init_deinit_mlo_capable(psoc))
735 		return;
736 
737 	qdf_assert_always(psoc);
738 	qdf_assert_always(pdev);
739 
740 	mlo_setup_link_ready(pdev);
741 }
742 
743 static void init_deinit_mlo_update_pdev_ready(struct wlan_objmgr_psoc *psoc,
744 					      uint8_t num_radios)
745 {
746 	if (!init_deinit_mlo_capable(psoc))
747 		return;
748 
749 	wlan_objmgr_iterate_obj_list(psoc, WLAN_PDEV_OP,
750 				     init_deinit_send_ml_link_ready,
751 				     NULL, 0, WLAN_INIT_DEINIT_ID);
752 }
753 #else
754 static void init_deinit_mlo_update_soc_ready(struct wlan_objmgr_psoc *psoc)
755 {}
756 static void init_deinit_mlo_update_pdev_ready(struct wlan_objmgr_psoc *psoc,
757 					      uint8_t num_radios)
758 {}
759 #endif /*WLAN_FEATURE_11BE_MLO && WLAN_MLO_MULTI_CHIP*/
760 
761 /* MAC address fourth byte index */
762 #define MAC_BYTE_4 4
763 
764 static int init_deinit_ready_event_handler(ol_scn_t scn_handle,
765 						uint8_t *event,
766 						uint32_t data_len)
767 {
768 	struct wlan_objmgr_psoc *psoc;
769 	struct wlan_objmgr_pdev *pdev;
770 	struct target_psoc_info *tgt_hdl;
771 	struct wmi_unified *wmi_handle;
772 	struct wmi_host_fw_abi_ver fw_ver;
773 	uint8_t myaddr[QDF_MAC_ADDR_SIZE];
774 	struct tgt_info *info;
775 	struct wmi_host_ready_ev_param ready_ev;
776 	wmi_legacy_service_ready_callback legacy_callback;
777 	uint8_t num_radios, i;
778 	uint32_t max_peers;
779 	uint32_t max_ast_index;
780 	target_resource_config *tgt_cfg;
781 
782 	if (!scn_handle) {
783 		target_if_err("scn handle NULL");
784 		return -EINVAL;
785 	}
786 
787 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
788 	if (!psoc) {
789 		target_if_err("psoc is null");
790 		return -EINVAL;
791 	}
792 
793 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
794 	if (!tgt_hdl) {
795 		target_if_err("target_psoc_info is null");
796 		return -EINVAL;
797 	}
798 
799 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
800 	info = (&tgt_hdl->info);
801 
802 	if (wmi_extract_fw_abi_version(wmi_handle, event, &fw_ver) ==
803 				QDF_STATUS_SUCCESS) {
804 		info->version.wlan_ver = fw_ver.sw_version;
805 		info->version.wlan_ver = fw_ver.abi_version;
806 	}
807 
808 	if (wmi_check_and_update_fw_version(wmi_handle, event) < 0) {
809 		target_if_err("Version mismatch with FW");
810 		return -EINVAL;
811 	}
812 
813 	if (wmi_extract_ready_event_params(wmi_handle, event, &ready_ev) !=
814 				QDF_STATUS_SUCCESS) {
815 		target_if_err("Failed to extract ready event");
816 		return -EINVAL;
817 	}
818 
819 	if (!ready_ev.agile_capability)
820 		target_if_err("agile capability disabled in HW");
821 	else
822 		info->wlan_res_cfg.agile_capability = ready_ev.agile_capability;
823 
824 	if (ready_ev.num_max_active_vdevs) {
825 		if (ready_ev.num_max_active_vdevs <
826 		    info->wlan_res_cfg.num_max_active_vdevs) {
827 			target_if_err("unexpected num_max_active_vdevs fw %d host %d",
828 				      ready_ev.num_max_active_vdevs,
829 				      info->wlan_res_cfg.num_max_active_vdevs);
830 			info->wlan_res_cfg.num_max_active_vdevs =
831 					ready_ev.num_max_active_vdevs;
832 		}
833 	}
834 
835 	/* Indicate to the waiting thread that the ready
836 	 * event was received
837 	 */
838 	info->wlan_init_status = wmi_ready_extract_init_status(
839 						wmi_handle, event);
840 
841 	legacy_callback = target_if_get_psoc_legacy_service_ready_cb();
842 	if (legacy_callback)
843 		if (legacy_callback(wmi_ready_event_id,
844 				    scn_handle, event, data_len)) {
845 			target_if_err("Legacy callback returned error!");
846 			tgt_hdl->info.wmi_ready = false;
847 			goto exit;
848 		}
849 
850 	init_deinit_mlo_update_soc_ready(psoc);
851 
852 	num_radios = target_psoc_get_num_radios(tgt_hdl);
853 
854 	if ((ready_ev.num_total_peer != 0) &&
855 	    (info->wlan_res_cfg.num_peers != ready_ev.num_total_peer)) {
856 		uint16_t num_peers = 0;
857 		/* FW allocated number of peers is different than host
858 		 * requested. Update host max with FW reported value.
859 		 */
860 		target_if_err("Host Requested %d peers. FW Supports %d peers",
861 			       info->wlan_res_cfg.num_peers,
862 			       ready_ev.num_total_peer);
863 		info->wlan_res_cfg.num_peers = ready_ev.num_total_peer;
864 		num_peers = info->wlan_res_cfg.num_peers / num_radios;
865 
866 		for (i = 0; i < num_radios; i++) {
867 			pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
868 							  WLAN_INIT_DEINIT_ID);
869 			if (!pdev) {
870 				target_if_err(" PDEV %d is NULL", i);
871 				return -EINVAL;
872 			}
873 
874 			wlan_pdev_set_max_peer_count(pdev, num_peers);
875 			wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
876 		}
877 
878 		wlan_psoc_set_max_peer_count(psoc,
879 					     info->wlan_res_cfg.num_peers);
880 	}
881 
882 	/* for non legacy  num_total_peer will be non zero
883 	 * allocate peer memory in this case
884 	 */
885 	if (ready_ev.num_total_peer != 0) {
886 		tgt_cfg = &info->wlan_res_cfg;
887 		max_peers = tgt_cfg->num_peers + ready_ev.num_extra_peer + 1;
888 		max_ast_index = ready_ev.max_ast_index + 1;
889 
890 		if (cdp_peer_map_attach(wlan_psoc_get_dp_handle(psoc),
891 					max_peers, max_ast_index,
892 					tgt_cfg->peer_map_unmap_version) !=
893 				QDF_STATUS_SUCCESS) {
894 			target_if_err("DP peer map attach failed");
895 			return -EINVAL;
896 		}
897 	}
898 
899 
900 	if (ready_ev.pktlog_defs_checksum) {
901 		for (i = 0; i < num_radios; i++) {
902 			pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
903 							  WLAN_INIT_DEINIT_ID);
904 			if (!pdev) {
905 				target_if_err(" PDEV %d is NULL", i);
906 				return -EINVAL;
907 			}
908 			target_if_set_pktlog_checksum(pdev, tgt_hdl,
909 						      ready_ev.
910 						      pktlog_defs_checksum);
911 			wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
912 		}
913 	}
914 
915 	/*
916 	 * For non-legacy HW, MAC addr list is extracted.
917 	 */
918 	if (num_radios > 1) {
919 		uint8_t num_mac_addr;
920 		wmi_host_mac_addr *addr_list;
921 		int i;
922 
923 		addr_list = wmi_ready_extract_mac_addr_list(wmi_handle, event,
924 							    &num_mac_addr);
925 		if ((num_mac_addr >= num_radios) && (addr_list)) {
926 			for (i = 0; i < num_radios; i++) {
927 				WMI_HOST_MAC_ADDR_TO_CHAR_ARRAY(&addr_list[i],
928 								myaddr);
929 				pdev = wlan_objmgr_get_pdev_by_id(psoc, i,
930 								  WLAN_INIT_DEINIT_ID);
931 				if (!pdev) {
932 					target_if_err(" PDEV %d is NULL", i);
933 					return -EINVAL;
934 				}
935 				wlan_pdev_set_hw_macaddr(pdev, myaddr);
936 				wlan_objmgr_pdev_release_ref(pdev,
937 							WLAN_INIT_DEINIT_ID);
938 
939 				/* assign 1st radio addr to psoc */
940 				if (i == 0)
941 					wlan_psoc_set_hw_macaddr(psoc, myaddr);
942 			}
943 			goto out;
944 		} else {
945 			target_if_err("Using default MAC addr for all radios..");
946 		}
947 	}
948 
949 	/*
950 	 * We extract single MAC address in two scenarios:
951 	 * 1. In non-legacy case, if addr list is NULL or num_mac_addr < num_radios
952 	 * 2. In all legacy cases
953 	 */
954 	for (i = 0; i < num_radios; i++) {
955 		wmi_ready_extract_mac_addr(wmi_handle, event, myaddr);
956 		myaddr[MAC_BYTE_4] += i;
957 		pdev = wlan_objmgr_get_pdev_by_id(psoc, i, WLAN_INIT_DEINIT_ID);
958 		if (!pdev) {
959 			target_if_err(" PDEV %d is NULL", i);
960 			return -EINVAL;
961 		}
962 		wlan_pdev_set_hw_macaddr(pdev, myaddr);
963 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
964 		/* assign 1st radio addr to psoc */
965 		if (i == 0)
966 			wlan_psoc_set_hw_macaddr(psoc, myaddr);
967 	}
968 
969 out:
970 	target_if_btcoex_cfg_enable(psoc, tgt_hdl, event);
971 	tgt_hdl->info.wmi_ready = true;
972 	init_deinit_mlo_update_pdev_ready(psoc, num_radios);
973 exit:
974 	init_deinit_wakeup_host_wait(psoc, tgt_hdl);
975 
976 	return 0;
977 }
978 
979 #ifdef HEALTH_MON_SUPPORT
980 static int init_deinit_health_mon_event_handler(ol_scn_t scn_handle,
981 						uint8_t *event,
982 						uint32_t data_len)
983 {
984 	struct wlan_objmgr_psoc *psoc;
985 	struct target_psoc_info *tgt_hdl;
986 	struct wmi_unified *wmi_handle;
987 	struct tgt_info *info;
988 	struct wmi_health_mon_params *param;
989 
990 	if (!scn_handle) {
991 		target_if_err("scn handle NULL");
992 		return -EINVAL;
993 	}
994 
995 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
996 	if (!psoc) {
997 		target_if_err("psoc is null");
998 		return -EINVAL;
999 	}
1000 
1001 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1002 	if (!tgt_hdl) {
1003 		target_if_err("target_psoc_info is null");
1004 		return -EINVAL;
1005 	}
1006 
1007 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
1008 	info = (&tgt_hdl->info);
1009 
1010 	param = (&info->health_mon_param);
1011 	wmi_extract_health_mon_event(wmi_handle, event, param);
1012 
1013 	return 0;
1014 }
1015 #endif /* HEALTH_MON_SUPPORT */
1016 
1017 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
1018 static void init_deinit_mlo_setup_done_event(struct wlan_objmgr_psoc *psoc)
1019 {
1020 	struct target_psoc_info *tgt_hdl;
1021 
1022 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1023 	if (!tgt_hdl) {
1024 		target_if_err("target_psoc_info is null");
1025 		return;
1026 	}
1027 
1028 	if ((tgt_hdl->tif_ops) &&
1029 	    (tgt_hdl->tif_ops->mlo_setup_done_event))
1030 		tgt_hdl->tif_ops->mlo_setup_done_event(psoc);
1031 }
1032 
1033 static int init_deinit_mlo_setup_comp_event_handler(ol_scn_t scn_handle,
1034 						    uint8_t *event,
1035 						    uint32_t data_len)
1036 {
1037 	struct wlan_objmgr_psoc *psoc;
1038 	struct wlan_objmgr_pdev *pdev;
1039 	struct target_psoc_info *tgt_hdl;
1040 	struct wmi_unified *wmi_handle;
1041 	struct wmi_mlo_setup_complete_params params;
1042 
1043 	if (!scn_handle) {
1044 		target_if_err("scn handle NULL");
1045 		return -EINVAL;
1046 	}
1047 
1048 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
1049 	if (!psoc) {
1050 		target_if_err("psoc is null");
1051 		return -EINVAL;
1052 	}
1053 
1054 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1055 	if (!tgt_hdl) {
1056 		target_if_err("target_psoc_info is null");
1057 		return -EINVAL;
1058 	}
1059 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
1060 
1061 	if (wmi_extract_mlo_setup_cmpl_event(wmi_handle, event, &params) !=
1062 			QDF_STATUS_SUCCESS)
1063 		return -EINVAL;
1064 
1065 	pdev = wlan_objmgr_get_pdev_by_id(psoc, params.pdev_id,
1066 					  WLAN_INIT_DEINIT_ID);
1067 	if (pdev) {
1068 		mlo_link_setup_complete(pdev);
1069 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
1070 	}
1071 
1072 	init_deinit_mlo_setup_done_event(psoc);
1073 
1074 	return 0;
1075 }
1076 
1077 static int init_deinit_mlo_teardown_comp_event_handler(ol_scn_t scn_handle,
1078 						       uint8_t *event,
1079 						       uint32_t data_len)
1080 {
1081 	struct wlan_objmgr_psoc *psoc;
1082 	struct wlan_objmgr_pdev *pdev;
1083 	struct target_psoc_info *tgt_hdl;
1084 	struct wmi_unified *wmi_handle;
1085 	struct wmi_mlo_teardown_cmpl_params params;
1086 
1087 	if (!scn_handle) {
1088 		target_if_err("scn handle NULL");
1089 		return -EINVAL;
1090 	}
1091 
1092 	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
1093 	if (!psoc) {
1094 		target_if_err("psoc is null");
1095 		return -EINVAL;
1096 	}
1097 
1098 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1099 	if (!tgt_hdl) {
1100 		target_if_err("target_psoc_info is null");
1101 		return -EINVAL;
1102 	}
1103 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
1104 
1105 	if (wmi_extract_mlo_teardown_cmpl_event(wmi_handle, event, &params) !=
1106 			QDF_STATUS_SUCCESS)
1107 		return -EINVAL;
1108 
1109 	pdev = wlan_objmgr_get_pdev_by_id(psoc, params.pdev_id,
1110 					  WLAN_INIT_DEINIT_ID);
1111 	if (pdev) {
1112 		mlo_link_teardown_complete(pdev);
1113 		wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID);
1114 	}
1115 
1116 	return 0;
1117 }
1118 
1119 static QDF_STATUS init_deinit_register_mlo_ev_handlers(wmi_unified_t wmi_handle)
1120 {
1121 	wmi_unified_register_event(wmi_handle,
1122 				   wmi_mlo_setup_complete_event_id,
1123 				   init_deinit_mlo_setup_comp_event_handler);
1124 	wmi_unified_register_event(wmi_handle,
1125 				   wmi_mlo_teardown_complete_event_id,
1126 				   init_deinit_mlo_teardown_comp_event_handler);
1127 
1128 	return QDF_STATUS_SUCCESS;
1129 }
1130 #else
1131 static QDF_STATUS init_deinit_register_mlo_ev_handlers(wmi_unified_t wmi_handle)
1132 {
1133 	return QDF_STATUS_SUCCESS;
1134 }
1135 #endif /*WLAN_FEATURE_11BE_MLO && WLAN_MLO_MULTI_CHIP*/
1136 
1137 QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers(
1138 				struct wlan_objmgr_psoc *psoc)
1139 {
1140 	struct target_psoc_info *tgt_hdl;
1141 	wmi_unified_t wmi_handle;
1142 	QDF_STATUS retval = QDF_STATUS_SUCCESS;
1143 
1144 	if (!psoc) {
1145 		target_if_err("psoc is null in register wmi handler");
1146 		return QDF_STATUS_E_FAILURE;
1147 	}
1148 
1149 	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
1150 	if (!tgt_hdl) {
1151 		target_if_err("target_psoc_info null in register wmi hadler");
1152 		return QDF_STATUS_E_FAILURE;
1153 	}
1154 
1155 	wmi_handle = (wmi_unified_t)target_psoc_get_wmi_hdl(tgt_hdl);
1156 
1157 	retval = wmi_unified_register_event_handler(wmi_handle,
1158 				wmi_service_ready_event_id,
1159 				init_deinit_service_ready_event_handler,
1160 				WMI_RX_WORK_CTX);
1161 	retval = wmi_unified_register_event_handler(wmi_handle,
1162 				wmi_service_ready_ext_event_id,
1163 				init_deinit_service_ext_ready_event_handler,
1164 				WMI_RX_WORK_CTX);
1165 	retval = wmi_unified_register_event_handler(wmi_handle,
1166 				wmi_service_available_event_id,
1167 				init_deinit_service_available_handler,
1168 				WMI_RX_UMAC_CTX);
1169 	retval = wmi_unified_register_event_handler(wmi_handle,
1170 				wmi_ready_event_id,
1171 				init_deinit_ready_event_handler,
1172 				WMI_RX_WORK_CTX);
1173 	retval = wmi_unified_register_event_handler(
1174 				wmi_handle,
1175 				wmi_service_ready_ext2_event_id,
1176 				init_deinit_service_ext2_ready_event_handler,
1177 				WMI_RX_WORK_CTX);
1178 	retval = init_deinit_register_mlo_ev_handlers(wmi_handle);
1179 
1180 #ifdef HEALTH_MON_SUPPORT
1181 	retval = wmi_unified_register_event_handler(
1182 				wmi_handle,
1183 				wmi_extract_health_mon_init_done_info_eventid,
1184 				init_deinit_health_mon_event_handler,
1185 				WMI_RX_WORK_CTX);
1186 #endif /* HEALTH_MON_SUPPORT */
1187 
1188 	return retval;
1189 }
1190 
1191