1 /* 2 * Copyright (c) 2018-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: init_event_handler.c 21 * 22 * WMI common event handler implementation source file 23 */ 24 25 #include <qdf_status.h> 26 #include <wlan_objmgr_psoc_obj.h> 27 #include <wlan_objmgr_pdev_obj.h> 28 #include <target_if.h> 29 #include <target_if_reg.h> 30 #include <init_event_handler.h> 31 #include <service_ready_util.h> 32 #include <service_ready_param.h> 33 #include <init_cmd_api.h> 34 #include <cdp_txrx_cmn.h> 35 36 static void init_deinit_set_send_init_cmd(struct wlan_objmgr_psoc *psoc, 37 struct target_psoc_info *tgt_hdl) 38 { 39 tgt_hdl->info.wmi_service_ready = TRUE; 40 /* send init command */ 41 init_deinit_prepare_send_init_cmd(psoc, tgt_hdl); 42 } 43 44 static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle, 45 uint8_t *event, 46 uint32_t data_len) 47 { 48 int err_code; 49 struct wlan_objmgr_psoc *psoc; 50 struct target_psoc_info *tgt_hdl; 51 wmi_legacy_service_ready_callback legacy_callback; 52 struct wmi_unified *wmi_handle; 53 QDF_STATUS ret_val; 54 55 if (!scn_handle) { 56 target_if_err("scn handle NULL in service ready handler"); 57 return -EINVAL; 58 } 59 60 psoc = target_if_get_psoc_from_scn_hdl(scn_handle); 61 if (!psoc) { 62 target_if_err("psoc is null in service ready handler"); 63 return -EINVAL; 64 } 65 66 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 67 if (!tgt_hdl) { 68 target_if_err("target_psoc_info is null in service ready ev"); 69 return -EINVAL; 70 } 71 72 ret_val = target_if_sw_version_check(psoc, tgt_hdl, event); 73 74 wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); 75 76 err_code = init_deinit_populate_service_bitmap(wmi_handle, event, 77 tgt_hdl->info.service_bitmap); 78 if (err_code) 79 goto exit; 80 81 err_code = init_deinit_populate_fw_version_cmd(wmi_handle, event); 82 if (err_code) 83 goto exit; 84 85 err_code = init_deinit_populate_target_cap(wmi_handle, event, 86 &(tgt_hdl->info.target_caps)); 87 if (err_code) 88 goto exit; 89 90 err_code = init_deinit_populate_phy_reg_cap(psoc, wmi_handle, event, 91 &(tgt_hdl->info), true); 92 if (err_code) 93 goto exit; 94 95 if (init_deinit_validate_160_80p80_fw_caps(psoc, tgt_hdl) != 96 QDF_STATUS_SUCCESS) { 97 wlan_psoc_nif_op_flag_set(psoc, WLAN_SOC_OP_VHT_INVALID_CAP); 98 } 99 100 target_if_ext_res_cfg_enable(psoc, tgt_hdl, event); 101 102 if (wmi_service_enabled(wmi_handle, wmi_service_tt)) 103 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TT_SUPPORT); 104 105 if (wmi_service_enabled(wmi_handle, wmi_service_widebw_scan)) 106 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_WIDEBAND_SCAN); 107 108 if (wmi_service_enabled(wmi_handle, wmi_service_check_cal_version)) 109 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_SW_CAL); 110 111 if (wmi_service_enabled(wmi_handle, wmi_service_twt_requestor)) 112 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TWT_REQUESTER); 113 114 if (wmi_service_enabled(wmi_handle, wmi_service_twt_responder)) 115 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_TWT_RESPONDER); 116 117 if (wmi_service_enabled(wmi_handle, wmi_service_bss_color_offload)) 118 target_if_debug(" BSS COLOR OFFLOAD supported"); 119 120 if (wmi_service_enabled(wmi_handle, wmi_service_ul_ru26_allowed)) 121 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_OBSS_NBW_RU); 122 123 if (wmi_service_enabled(wmi_handle, wmi_service_infra_mbssid)) 124 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_MBSS_IE); 125 126 if (wmi_service_enabled(wmi_handle, wmi_service_dynamic_hw_mode)) 127 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_DYNAMIC_HW_MODE); 128 129 if (wmi_service_enabled(wmi_handle, wmi_service_bw_165mhz_support)) 130 wlan_psoc_nif_fw_ext_cap_set(psoc, 131 WLAN_SOC_RESTRICTED_80P80_SUPPORT); 132 133 if (wmi_service_enabled(wmi_handle, 134 wmi_service_nss_ratio_to_host_support)) 135 wlan_psoc_nif_fw_ext_cap_set( 136 psoc, WLAN_SOC_NSS_RATIO_TO_HOST_SUPPORT); 137 138 target_if_debug(" TT support %d, Wide BW Scan %d, SW cal %d", 139 wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_TT_SUPPORT), 140 wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_WIDEBAND_SCAN), 141 wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_SW_CAL)); 142 143 target_if_mesh_support_enable(psoc, tgt_hdl, event); 144 145 target_if_eapol_minrate_enable(psoc, tgt_hdl, event); 146 147 target_if_smart_antenna_enable(psoc, tgt_hdl, event); 148 149 target_if_cfr_support_enable(psoc, tgt_hdl, event); 150 151 target_if_peer_cfg_enable(psoc, tgt_hdl, event); 152 153 target_if_atf_cfg_enable(psoc, tgt_hdl, event); 154 155 if (!wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) 156 target_if_qwrap_cfg_enable(psoc, tgt_hdl, event); 157 158 target_if_lteu_cfg_enable(psoc, tgt_hdl, event); 159 160 if (wmi_service_enabled(wmi_handle, wmi_service_rx_fse_support)) 161 wlan_psoc_nif_fw_ext_cap_set(psoc, 162 WLAN_SOC_CEXT_RX_FSE_SUPPORT); 163 164 /* override derived value, if it exceeds max peer count */ 165 if ((wlan_psoc_get_max_peer_count(psoc) > 166 tgt_hdl->info.wlan_res_cfg.num_active_peers) && 167 (wlan_psoc_get_max_peer_count(psoc) < 168 (tgt_hdl->info.wlan_res_cfg.num_peers - 169 tgt_hdl->info.wlan_res_cfg.num_vdevs))) { 170 tgt_hdl->info.wlan_res_cfg.num_peers = 171 wlan_psoc_get_max_peer_count(psoc) + 172 tgt_hdl->info.wlan_res_cfg.num_vdevs; 173 } 174 legacy_callback = target_if_get_psoc_legacy_service_ready_cb(); 175 if (!legacy_callback) { 176 err_code = -EINVAL; 177 goto exit; 178 } 179 180 err_code = legacy_callback(wmi_service_ready_event_id, 181 scn_handle, event, data_len); 182 init_deinit_chainmask_config(psoc, tgt_hdl); 183 184 if (wmi_service_enabled(wmi_handle, wmi_service_mgmt_tx_wmi)) { 185 wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_WMI_MGMT_REF); 186 target_if_debug("WMI mgmt service enabled"); 187 } else { 188 wlan_psoc_nif_fw_ext_cap_clear(psoc, 189 WLAN_SOC_CEXT_WMI_MGMT_REF); 190 target_if_debug("WMI mgmt service disabled"); 191 } 192 193 err_code = init_deinit_handle_host_mem_req(psoc, tgt_hdl, event); 194 if (err_code != QDF_STATUS_SUCCESS) 195 goto exit; 196 197 target_if_reg_set_offloaded_info(psoc); 198 target_if_reg_set_6ghz_info(psoc); 199 200 if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) { 201 target_if_debug("Wait for EXT message"); 202 } else { 203 target_if_debug("No EXT message, send init command"); 204 target_psoc_set_num_radios(tgt_hdl, 1); 205 init_deinit_set_send_init_cmd(psoc, tgt_hdl); 206 } 207 208 exit: 209 return err_code; 210 } 211 212 static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle, 213 uint8_t *event, 214 uint32_t data_len) 215 { 216 int err_code = 0; 217 struct wlan_objmgr_psoc *psoc; 218 struct target_psoc_info *tgt_hdl; 219 struct wmi_unified *wmi_handle; 220 struct tgt_info *info; 221 222 if (!scn_handle) { 223 target_if_err("scn handle NULL in service ready handler"); 224 return -EINVAL; 225 } 226 227 psoc = target_if_get_psoc_from_scn_hdl(scn_handle); 228 if (!psoc) { 229 target_if_err("psoc is null in service ready handler"); 230 return -EINVAL; 231 } 232 233 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 234 if (!tgt_hdl) { 235 target_if_err("target_psoc_info is null in service ready ev"); 236 return -EINVAL; 237 } 238 239 wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); 240 info = (&tgt_hdl->info); 241 242 err_code = init_deinit_populate_service_ready_ext2_param(wmi_handle, 243 event, info); 244 if (err_code) 245 goto exit; 246 247 /* dbr_ring_caps could have already come as part of EXT event */ 248 if (info->service_ext2_param.num_dbr_ring_caps) { 249 err_code = init_deinit_populate_dbr_ring_cap_ext2(psoc, 250 wmi_handle, 251 event, info); 252 if (err_code) 253 goto exit; 254 } 255 256 /* send init command */ 257 init_deinit_set_send_init_cmd(psoc, tgt_hdl); 258 259 exit: 260 return err_code; 261 } 262 263 static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle, 264 uint8_t *event, 265 uint32_t data_len) 266 { 267 int err_code; 268 uint8_t num_radios; 269 struct wlan_objmgr_psoc *psoc; 270 struct target_psoc_info *tgt_hdl; 271 struct wmi_unified *wmi_handle; 272 struct tgt_info *info; 273 wmi_legacy_service_ready_callback legacy_callback; 274 275 if (!scn_handle) { 276 target_if_err("scn handle NULL in service ready handler"); 277 return -EINVAL; 278 } 279 280 psoc = target_if_get_psoc_from_scn_hdl(scn_handle); 281 if (!psoc) { 282 target_if_err("psoc is null in service ready handler"); 283 return -EINVAL; 284 } 285 286 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 287 if (!tgt_hdl) { 288 target_if_err("target_psoc_info is null in service ready ev"); 289 return -EINVAL; 290 } 291 292 wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); 293 info = (&tgt_hdl->info); 294 295 err_code = init_deinit_populate_service_ready_ext_param(wmi_handle, 296 event, &(info->service_ext_param)); 297 if (err_code) 298 goto exit; 299 300 target_psoc_set_num_radios(tgt_hdl, 0); 301 err_code = init_deinit_populate_hw_mode_capability(wmi_handle, 302 event, tgt_hdl); 303 if (err_code) 304 goto exit; 305 306 if (init_deinit_is_preferred_hw_mode_supported(psoc, tgt_hdl) 307 == FALSE) { 308 target_if_err("Preferred mode %d not supported", 309 info->preferred_hw_mode); 310 return -EINVAL; 311 } 312 313 num_radios = target_psoc_get_num_radios_for_mode(tgt_hdl, 314 info->preferred_hw_mode); 315 316 /* set number of radios based on current mode */ 317 target_psoc_set_num_radios(tgt_hdl, num_radios); 318 319 target_if_print_service_ready_ext_param(psoc, tgt_hdl); 320 321 err_code = init_deinit_populate_phy_reg_cap(psoc, wmi_handle, 322 event, info, false); 323 if (err_code) 324 goto exit; 325 326 target_if_add_11ax_modes(psoc, tgt_hdl); 327 328 if (init_deinit_chainmask_table_alloc( 329 &(info->service_ext_param)) == 330 QDF_STATUS_SUCCESS) { 331 err_code = init_deinit_populate_chainmask_tables(wmi_handle, 332 event, 333 &(info->service_ext_param.chainmask_table[0])); 334 if (err_code) 335 goto exit; 336 } 337 338 /* dbr_ring_caps can be absent if enough space is not available */ 339 if (info->service_ext_param.num_dbr_ring_caps) { 340 err_code = init_deinit_populate_dbr_ring_cap(psoc, wmi_handle, 341 event, info); 342 if (err_code) 343 goto exit; 344 } 345 346 err_code = init_deinit_populate_spectral_bin_scale_params(psoc, 347 wmi_handle, 348 event, info); 349 if (err_code) 350 goto exit; 351 352 legacy_callback = target_if_get_psoc_legacy_service_ready_cb(); 353 if (legacy_callback) 354 legacy_callback(wmi_service_ready_ext_event_id, 355 scn_handle, event, data_len); 356 357 target_if_qwrap_cfg_enable(psoc, tgt_hdl, event); 358 359 target_if_set_twt_ap_pdev_count(info, tgt_hdl); 360 361 info->wlan_res_cfg.max_bssid_indicator = 362 info->service_ext_param.max_bssid_indicator; 363 364 if (wmi_service_enabled(wmi_handle, wmi_service_ext2_msg)) { 365 target_if_debug("Wait for EXT2 message"); 366 } else { 367 target_if_debug("No EXT2 message, send init command"); 368 init_deinit_set_send_init_cmd(psoc, tgt_hdl); 369 } 370 371 exit: 372 return err_code; 373 } 374 375 static int init_deinit_service_available_handler(ol_scn_t scn_handle, 376 uint8_t *event, 377 uint32_t data_len) 378 { 379 struct wlan_objmgr_psoc *psoc; 380 struct target_psoc_info *tgt_hdl; 381 struct wmi_unified *wmi_handle; 382 383 if (!scn_handle) { 384 target_if_err("scn handle NULL"); 385 return -EINVAL; 386 } 387 388 psoc = target_if_get_psoc_from_scn_hdl(scn_handle); 389 if (!psoc) { 390 target_if_err("psoc is null"); 391 return -EINVAL; 392 } 393 394 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 395 if (!tgt_hdl) { 396 target_if_err("target_psoc_info is null"); 397 return -EINVAL; 398 } 399 400 wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); 401 402 if (wmi_save_ext_service_bitmap(wmi_handle, event, NULL) != 403 QDF_STATUS_SUCCESS) { 404 target_if_err("Failed to save ext service bitmap"); 405 return -EINVAL; 406 } 407 408 return 0; 409 } 410 411 /* MAC address fourth byte index */ 412 #define MAC_BYTE_4 4 413 414 static int init_deinit_ready_event_handler(ol_scn_t scn_handle, 415 uint8_t *event, 416 uint32_t data_len) 417 { 418 struct wlan_objmgr_psoc *psoc; 419 struct wlan_objmgr_pdev *pdev; 420 struct target_psoc_info *tgt_hdl; 421 struct wmi_unified *wmi_handle; 422 struct wmi_host_fw_abi_ver fw_ver; 423 uint8_t myaddr[QDF_MAC_ADDR_SIZE]; 424 struct tgt_info *info; 425 struct wmi_host_ready_ev_param ready_ev; 426 wmi_legacy_service_ready_callback legacy_callback; 427 uint8_t num_radios, i; 428 uint32_t max_peers; 429 uint32_t max_ast_index; 430 target_resource_config *tgt_cfg; 431 432 if (!scn_handle) { 433 target_if_err("scn handle NULL"); 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"); 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"); 446 return -EINVAL; 447 } 448 449 wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); 450 info = (&tgt_hdl->info); 451 452 if (wmi_extract_fw_abi_version(wmi_handle, event, &fw_ver) == 453 QDF_STATUS_SUCCESS) { 454 info->version.wlan_ver = fw_ver.sw_version; 455 info->version.wlan_ver = fw_ver.abi_version; 456 } 457 458 if (wmi_check_and_update_fw_version(wmi_handle, event) < 0) { 459 target_if_err("Version mismatch with FW"); 460 return -EINVAL; 461 } 462 463 if (wmi_extract_ready_event_params(wmi_handle, event, &ready_ev) != 464 QDF_STATUS_SUCCESS) { 465 target_if_err("Failed to extract ready event"); 466 return -EINVAL; 467 } 468 469 if (!ready_ev.agile_capability) 470 target_if_err("agile capability disabled in HW"); 471 else 472 info->wlan_res_cfg.agile_capability = ready_ev.agile_capability; 473 474 /* Indicate to the waiting thread that the ready 475 * event was received 476 */ 477 info->wlan_init_status = wmi_ready_extract_init_status( 478 wmi_handle, event); 479 480 legacy_callback = target_if_get_psoc_legacy_service_ready_cb(); 481 if (legacy_callback) 482 if (legacy_callback(wmi_ready_event_id, 483 scn_handle, event, data_len)) { 484 target_if_err("Legacy callback returned error!"); 485 tgt_hdl->info.wmi_ready = FALSE; 486 goto exit; 487 } 488 489 num_radios = target_psoc_get_num_radios(tgt_hdl); 490 491 if ((ready_ev.num_total_peer != 0) && 492 (info->wlan_res_cfg.num_peers != ready_ev.num_total_peer)) { 493 uint16_t num_peers = 0; 494 /* FW allocated number of peers is different than host 495 * requested. Update host max with FW reported value. 496 */ 497 target_if_err("Host Requested %d peers. FW Supports %d peers", 498 info->wlan_res_cfg.num_peers, 499 ready_ev.num_total_peer); 500 info->wlan_res_cfg.num_peers = ready_ev.num_total_peer; 501 num_peers = info->wlan_res_cfg.num_peers / num_radios; 502 503 for (i = 0; i < num_radios; i++) { 504 pdev = wlan_objmgr_get_pdev_by_id(psoc, i, 505 WLAN_INIT_DEINIT_ID); 506 if (!pdev) { 507 target_if_err(" PDEV %d is NULL", i); 508 return -EINVAL; 509 } 510 511 wlan_pdev_set_max_peer_count(pdev, num_peers); 512 wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID); 513 } 514 515 wlan_psoc_set_max_peer_count(psoc, 516 info->wlan_res_cfg.num_peers); 517 } 518 519 /* for non legacy num_total_peer will be non zero 520 * allocate peer memory in this case 521 */ 522 if (ready_ev.num_total_peer != 0) { 523 tgt_cfg = &info->wlan_res_cfg; 524 max_peers = tgt_cfg->num_peers + ready_ev.num_extra_peer + 1; 525 max_ast_index = ready_ev.max_ast_index + 1; 526 527 if (cdp_peer_map_attach(wlan_psoc_get_dp_handle(psoc), 528 max_peers, max_ast_index, 529 tgt_cfg->peer_map_unmap_v2) != 530 QDF_STATUS_SUCCESS) { 531 target_if_err("DP peer map attach failed"); 532 return -EINVAL; 533 } 534 } 535 536 537 if (ready_ev.pktlog_defs_checksum) { 538 for (i = 0; i < num_radios; i++) { 539 pdev = wlan_objmgr_get_pdev_by_id(psoc, i, 540 WLAN_INIT_DEINIT_ID); 541 if (!pdev) { 542 target_if_err(" PDEV %d is NULL", i); 543 return -EINVAL; 544 } 545 target_if_set_pktlog_checksum(pdev, tgt_hdl, 546 ready_ev. 547 pktlog_defs_checksum); 548 wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID); 549 } 550 } 551 552 /* 553 * For non-legacy HW, MAC addr list is extracted. 554 */ 555 if (num_radios > 1) { 556 uint8_t num_mac_addr; 557 wmi_host_mac_addr *addr_list; 558 int i; 559 560 addr_list = wmi_ready_extract_mac_addr_list(wmi_handle, event, 561 &num_mac_addr); 562 if ((num_mac_addr >= num_radios) && (addr_list)) { 563 for (i = 0; i < num_radios; i++) { 564 WMI_HOST_MAC_ADDR_TO_CHAR_ARRAY(&addr_list[i], 565 myaddr); 566 pdev = wlan_objmgr_get_pdev_by_id(psoc, i, 567 WLAN_INIT_DEINIT_ID); 568 if (!pdev) { 569 target_if_err(" PDEV %d is NULL", i); 570 return -EINVAL; 571 } 572 wlan_pdev_set_hw_macaddr(pdev, myaddr); 573 wlan_objmgr_pdev_release_ref(pdev, 574 WLAN_INIT_DEINIT_ID); 575 576 /* assign 1st radio addr to psoc */ 577 if (i == 0) 578 wlan_psoc_set_hw_macaddr(psoc, myaddr); 579 } 580 goto out; 581 } else { 582 target_if_err("Using default MAC addr for all radios.."); 583 } 584 } 585 586 /* 587 * We extract single MAC address in two scenarios: 588 * 1. In non-legacy case, if addr list is NULL or num_mac_addr < num_radios 589 * 2. In all legacy cases 590 */ 591 for (i = 0; i < num_radios; i++) { 592 wmi_ready_extract_mac_addr(wmi_handle, event, myaddr); 593 myaddr[MAC_BYTE_4] += i; 594 pdev = wlan_objmgr_get_pdev_by_id(psoc, i, WLAN_INIT_DEINIT_ID); 595 if (!pdev) { 596 target_if_err(" PDEV %d is NULL", i); 597 return -EINVAL; 598 } 599 wlan_pdev_set_hw_macaddr(pdev, myaddr); 600 wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID); 601 /* assign 1st radio addr to psoc */ 602 if (i == 0) 603 wlan_psoc_set_hw_macaddr(psoc, myaddr); 604 } 605 606 out: 607 target_if_btcoex_cfg_enable(psoc, tgt_hdl, event); 608 tgt_hdl->info.wmi_ready = TRUE; 609 exit: 610 init_deinit_wakeup_host_wait(psoc, tgt_hdl); 611 612 return 0; 613 } 614 615 616 QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers( 617 struct wlan_objmgr_psoc *psoc) 618 { 619 struct target_psoc_info *tgt_hdl; 620 wmi_unified_t wmi_handle; 621 QDF_STATUS retval = QDF_STATUS_SUCCESS; 622 623 if (!psoc) { 624 target_if_err("psoc is null in register wmi handler"); 625 return QDF_STATUS_E_FAILURE; 626 } 627 628 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 629 if (!tgt_hdl) { 630 target_if_err("target_psoc_info null in register wmi hadler"); 631 return QDF_STATUS_E_FAILURE; 632 } 633 634 wmi_handle = (wmi_unified_t)target_psoc_get_wmi_hdl(tgt_hdl); 635 636 retval = wmi_unified_register_event_handler(wmi_handle, 637 wmi_service_ready_event_id, 638 init_deinit_service_ready_event_handler, 639 WMI_RX_WORK_CTX); 640 retval = wmi_unified_register_event_handler(wmi_handle, 641 wmi_service_ready_ext_event_id, 642 init_deinit_service_ext_ready_event_handler, 643 WMI_RX_WORK_CTX); 644 retval = wmi_unified_register_event_handler(wmi_handle, 645 wmi_service_available_event_id, 646 init_deinit_service_available_handler, 647 WMI_RX_UMAC_CTX); 648 retval = wmi_unified_register_event_handler(wmi_handle, 649 wmi_ready_event_id, 650 init_deinit_ready_event_handler, 651 WMI_RX_WORK_CTX); 652 retval = wmi_unified_register_event_handler( 653 wmi_handle, 654 wmi_service_ready_ext2_event_id, 655 init_deinit_service_ext2_ready_event_handler, 656 WMI_RX_WORK_CTX); 657 658 659 return retval; 660 } 661 662