1 /* 2 * Copyright (c) 2017-2018 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: This target interface shall be used 21 * to communicate with target using WMI. 22 */ 23 #ifndef _WLAN_TARGET_IF_H_ 24 #define _WLAN_TARGET_IF_H_ 25 26 #include "qdf_types.h" 27 #include "qdf_util.h" 28 #include "wlan_objmgr_psoc_obj.h" 29 #include "wmi_unified_api.h" 30 #include "wmi_unified_priv.h" 31 #include "wmi_unified_param.h" 32 33 /* ASCII "TGT\0" */ 34 #define TGT_MAGIC 0x54575400 35 36 #define target_if_fatal(params...) \ 37 QDF_TRACE_FATAL(QDF_MODULE_ID_TARGET_IF, params) 38 #define target_if_err(params...) \ 39 QDF_TRACE_ERROR(QDF_MODULE_ID_TARGET_IF, params) 40 #define target_if_warn(params...) \ 41 QDF_TRACE_WARN(QDF_MODULE_ID_TARGET_IF, params) 42 #define target_if_info(params...) \ 43 QDF_TRACE_INFO(QDF_MODULE_ID_TARGET_IF, params) 44 #define target_if_debug(params...) \ 45 QDF_TRACE_DEBUG(QDF_MODULE_ID_TARGET_IF, params) 46 47 #define TARGET_IF_ENTER() target_if_debug("enter") 48 #define TARGET_IF_EXIT() target_if_debug("exit") 49 50 #ifdef CONFIG_MCL 51 #define TARGET_TYPE_AR900B 9 /* Beeliner */ 52 #define TARGET_TYPE_QCA9984 15 /* cascade */ 53 #define TARGET_TYPE_IPQ4019 16 /* dakota */ 54 #define TARGET_TYPE_QCA9888 17 /* besra */ 55 #define TARGET_TYPE_AR9888 7 /* Peregrine */ 56 #endif 57 58 typedef struct wlan_objmgr_psoc *(*get_psoc_handle_callback)( 59 void *scn_handle); 60 61 typedef struct wlan_objmgr_pdev *(*get_pdev_handle_callback)( 62 void *scn_handle); 63 64 typedef int (*wmi_legacy_service_ready_callback)(uint32_t event_id, 65 void *handle, 66 uint8_t *event_data, 67 uint32_t length); 68 69 /** 70 * struct target_if_ctx - target_interface context 71 * @magic: magic for target if ctx 72 * @get_psoc_hdl_cb: function pointer to get psoc 73 * @get_pdev_hdl_cb: function pointer to get pdev 74 * @lock: spin lock for protecting the ctx 75 */ 76 struct target_if_ctx { 77 uint32_t magic; 78 get_psoc_handle_callback get_psoc_hdl_cb; 79 get_pdev_handle_callback get_pdev_hdl_cb; 80 wmi_legacy_service_ready_callback service_ready_cb; 81 qdf_spinlock_t lock; 82 }; 83 84 struct target_psoc_info; 85 /** 86 * struct host_fw_ver - holds host fw version 87 * @host_ver: Host version 88 * @target_ver: Target version ID 89 * @target_rev: Target revision ID 90 * @wlan_ver: FW SW version 91 * @wlan_ver_1: FW SW version second dword 92 * @abi_ver: ABI version 93 */ 94 struct host_fw_ver { 95 uint32_t host_ver; 96 uint32_t target_ver; 97 uint32_t target_rev; 98 uint32_t wlan_ver; 99 uint32_t wlan_ver_1; 100 uint32_t abi_ver; 101 }; 102 103 struct common_dbglog_handle; 104 struct common_hif_handle; 105 struct common_htc_handle; 106 struct common_wmi_handle; 107 struct common_accelerator_handle; 108 109 /** 110 * struct comp_hdls - Non-umac/lower layer components handles, it is a sub 111 * structure of target psoc information 112 * @hif_hdl: HIF handle 113 * @htc_hdl: HTC handle 114 * @wmi_hdl: WMI handle 115 * @accelerator_hdl: NSS offload/IPA handle 116 * @dbglog_hdl: Debug log handle 117 */ 118 struct comp_hdls { 119 struct common_hif_handle *hif_hdl; 120 struct common_htc_handle *htc_hdl; 121 struct common_wmi_handle *wmi_hdl; 122 struct common_accelerator_handle *accelerator_hdl; 123 struct common_dbglog_handle *dbglog_hdl; 124 }; 125 126 /** 127 * struct tgt_info - FW or lower layer related info(required by target_if), 128 * it is a sub structure of taarget psoc information 129 * @version: Host FW version struct 130 * @wlan_res_cfg: target_resource_config info 131 * @wlan_ext_res_cfg: wmi_host_ext_resource_config info 132 * @wmi_service_ready: is service ready received 133 * @wmi_ready: is ready event received 134 * @total_mac_phy_cnt: num of mac phys 135 * @num_radios: number of radios 136 * @wlan_init_status: Target init status 137 * @target_type: Target type 138 * @max_descs: Max descriptors 139 * @preferred_hw_mode: preferred hw mode 140 * @wmi_timeout: wait timeout for target events 141 * @wmi_timeout_unintr: wait timeout uninterruptedly 142 * @event_queue: wait queue for target events 143 * @service_bitmap: WMI service bitmap 144 * @target_cap: target capabilities 145 * @service_ext_param: ext service params 146 * @mac_phy_cap: phy caps array 147 * @reg_cap: regulatory caps array 148 * @num_mem_chunks: number of mem chunks allocated 149 * @mem_chunks: allocated memory blocks for FW 150 */ 151 struct tgt_info { 152 struct host_fw_ver version; 153 target_resource_config wlan_res_cfg; 154 wmi_host_ext_resource_config wlan_ext_res_cfg; 155 bool wmi_service_ready; 156 bool wmi_ready; 157 uint8_t total_mac_phy_cnt; 158 uint8_t num_radios; 159 uint32_t wlan_init_status; 160 uint32_t target_type; 161 uint32_t max_descs; 162 uint32_t preferred_hw_mode; 163 uint32_t wmi_timeout; 164 uint32_t wmi_timeout_unintr; 165 qdf_wait_queue_head_t event_queue; 166 uint32_t service_bitmap[PSOC_SERVICE_BM_SIZE]; 167 struct wlan_psoc_target_capability_info target_caps; 168 struct wlan_psoc_host_service_ext_param service_ext_param; 169 struct wlan_psoc_host_mac_phy_caps 170 mac_phy_cap[PSOC_MAX_MAC_PHY_CAP]; 171 struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap; 172 uint32_t num_mem_chunks; 173 struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS]; 174 }; 175 176 /** 177 * struct target_ops - Holds feature specific function pointers, which would be 178 * invoked as part of service ready or ext service ready 179 * @ext_resource_config_enable: Ext resource config 180 * @peer_config: Peer config enable 181 * @mesh_support_enable: Mesh support enable 182 * @smart_antenna_enable: Smart antenna enable 183 * @atf_config_enable: ATF config enable 184 * @qwrap_config_enable: QWRAP config enable 185 * @btcoex_config_enable: BTCOEX config enable 186 * @lteu_ext_support_enable: LTE-U Ext config enable 187 * @set_init_cmd_dev_based_params: Sets Init command params 188 * @alloc_pdevs: Allocates PDEVs 189 * @update_pdev_tgt_info: Updates PDEV target info 190 * @mem_mgr_alloc_chunk: Allocates memory through MEM manager 191 * @mem_mgr_free_chunks: Free memory chunks through MEM manager 192 * @print_svc_ready_ex_param: Print service ready ext params 193 * @add_11ax_modes: Adds 11ax modes to reg cap 194 * @set_default_tgt_config: Sets target config with default values 195 * @sw_version_check: Checks the SW version 196 * @smart_log_enable: Enable Smart Logs feature 197 */ 198 struct target_ops { 199 QDF_STATUS (*ext_resource_config_enable) 200 (struct wlan_objmgr_psoc *psoc, 201 struct target_psoc_info *tgt_info, uint8_t *event); 202 void (*peer_config) 203 (struct wlan_objmgr_psoc *psoc, 204 struct target_psoc_info *tgt_info, uint8_t *event); 205 void (*mesh_support_enable) 206 (struct wlan_objmgr_psoc *psoc, 207 struct target_psoc_info *tgt_info, uint8_t *event); 208 void (*smart_antenna_enable) 209 (struct wlan_objmgr_psoc *psoc, 210 struct target_psoc_info *tgt_info, uint8_t *event); 211 void (*atf_config_enable) 212 (struct wlan_objmgr_psoc *psoc, 213 struct target_psoc_info *tgt_info, uint8_t *event); 214 void (*qwrap_config_enable) 215 (struct wlan_objmgr_psoc *psoc, 216 struct target_psoc_info *tgt_info, uint8_t *event); 217 void (*btcoex_config_enable) 218 (struct wlan_objmgr_psoc *psoc, 219 struct target_psoc_info *tgt_info, uint8_t *event); 220 void (*lteu_ext_support_enable) 221 (struct wlan_objmgr_psoc *psoc, 222 struct target_psoc_info *tgt_info, uint8_t *event); 223 void (*set_init_cmd_dev_based_params) 224 (struct wlan_objmgr_psoc *psoc, 225 struct target_psoc_info *tgt_info); 226 QDF_STATUS (*alloc_pdevs) 227 (struct wlan_objmgr_psoc *psoc, 228 struct target_psoc_info *tgt_info); 229 QDF_STATUS (*update_pdev_tgt_info) 230 (struct wlan_objmgr_psoc *psoc, 231 struct target_psoc_info *tgt_info); 232 uint32_t (*mem_mgr_alloc_chunk)(struct wlan_objmgr_psoc *psoc, 233 struct target_psoc_info *tgt_info, 234 u_int32_t req_id, u_int32_t idx, u_int32_t num_units, 235 u_int32_t unit_len, u_int32_t num_unit_info); 236 QDF_STATUS (*mem_mgr_free_chunks)(struct wlan_objmgr_psoc *psoc, 237 struct target_psoc_info *tgt_hdl); 238 void (*print_svc_ready_ex_param)( 239 struct wlan_objmgr_psoc *psoc, 240 struct target_psoc_info *tgt_info); 241 void (*add_11ax_modes)( 242 struct wlan_objmgr_psoc *psoc, 243 struct target_psoc_info *tgt_info); 244 void (*set_default_tgt_config)( 245 struct wlan_objmgr_psoc *psoc, 246 struct target_psoc_info *tgt_info); 247 QDF_STATUS (*sw_version_check)( 248 struct wlan_objmgr_psoc *psoc, 249 struct target_psoc_info *tgt_hdl, 250 uint8_t *evt_buf); 251 void (*smart_log_enable) 252 (struct wlan_objmgr_psoc *psoc, 253 struct target_psoc_info *tgt_info, uint8_t *event); 254 }; 255 256 257 258 /** 259 * struct target_psoc_info - target psoc information 260 * @hdls: component handles (htc/htt/wmi) sub structure 261 * @info: target related info sub structure 262 * @feature_ptr: stores legacy pointer or few driver specific structures 263 * @tif_ops: holds driver specific function pointers 264 */ 265 struct target_psoc_info { 266 struct comp_hdls hdls; 267 struct tgt_info info; 268 void *feature_ptr; 269 struct target_ops *tif_ops; 270 }; 271 272 /** 273 * struct target_pdev_info - target pdev information 274 * @wmi_handle: WMI handle 275 * @accelerator_hdl: NSS offload/IPA handles 276 * @pdev_idx: pdev id (of FW) 277 * @phy_idx: phy id (of FW) 278 * @feature_ptr: stores legacy pointer or few driver specific structures 279 */ 280 struct target_pdev_info { 281 struct common_wmi_handle *wmi_handle; 282 struct common_accelerator_handle *accelerator_hdl; 283 int32_t pdev_idx; 284 int32_t phy_idx; 285 void *feature_ptr; 286 }; 287 288 289 /** 290 * target_if_open() - target_if open 291 * @get_wmi_handle: function pointer to get wmi handle 292 * 293 * 294 * Return: QDF_STATUS 295 */ 296 QDF_STATUS target_if_open(get_psoc_handle_callback psoc_hdl_cb); 297 298 /** 299 * target_if_close() - Close target_if 300 * @scn_handle: scn handle 301 * 302 * Return: QDF_STATUS_SUCCESS - in case of success 303 */ 304 QDF_STATUS target_if_close(void); 305 306 /** 307 * target_if_store_pdev_target_if_ctx() - stores objmgr pdev in target if ctx 308 * @pdev_hdl_cb: function pointer to get objmgr pdev 309 * 310 * Return: QDF_STATUS_SUCCESS - in case of success 311 */ 312 QDF_STATUS target_if_store_pdev_target_if_ctx( 313 get_pdev_handle_callback pdev_hdl_cb); 314 315 /** 316 * wlan_get_tgt_if_ctx() -Get target if ctx 317 * 318 * Return: target if ctx 319 */ 320 struct target_if_ctx *target_if_get_ctx(void); 321 322 /** 323 * target_if_get_psoc_from_scn_hdl() - get psoc from scn handle 324 * @scn_handle: scn handle 325 * 326 * This API is generally used while processing wmi event. 327 * In wmi event SCN handle will be passed by wmi hence 328 * using this API we can get psoc from scn handle. 329 * 330 * Return: index for matching scn handle 331 */ 332 struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle); 333 334 /** 335 * target_if_get_pdev_from_scn_hdl() - get pdev from scn handle 336 * @scn_handle: scn handle 337 * 338 * This API is generally used while processing wmi event. 339 * In wmi event SCN handle will be passed by wmi hence 340 * using this API we can get pdev from scn handle. 341 * 342 * Return: pdev for matching scn handle 343 */ 344 struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle); 345 346 /** target_if_register_tx_ops() - register tx_ops 347 * @tx_ops: tx_ops structure 348 * 349 * This function is to be used by components to populate 350 * the OL function pointers (tx_ops) required by the component 351 * for UMAC-LMAC interaction, with the appropriate handler 352 * 353 * Return: QDF STATUS 354 */ 355 QDF_STATUS target_if_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); 356 357 /** 358 * target_if_get_psoc_legacy_service_ready_cb() - get psoc from scn handle 359 * 360 * This API is generally used while processing wmi event. 361 * In wmi event SCN handle will be passed by wmi hence 362 * using this API we can get psoc from scn handle. 363 * 364 * Return: wmi_legacy_service_ready_callback 365 */ 366 wmi_legacy_service_ready_callback 367 target_if_get_psoc_legacy_service_ready_cb(void); 368 369 /** 370 * target_if_register_legacy_service_ready_cb() - get legacy 371 * service ready handler from scn handle 372 * 373 * @service_ready_cb: function pointer to service ready callback 374 * 375 * Return: QDF Status 376 */ 377 QDF_STATUS target_if_register_legacy_service_ready_cb( 378 wmi_legacy_service_ready_callback service_ready_cb); 379 380 /** 381 * target_if_alloc_pdev_tgt_info() - alloc pdev tgt info 382 * @pdev: pointer to pdev 383 * 384 * API to allocate memory for target_pdev_info 385 * 386 * Return: SUCCESS on successful memory allocation or Failure 387 */ 388 QDF_STATUS target_if_alloc_pdev_tgt_info(struct wlan_objmgr_pdev *pdev); 389 390 /** 391 * target_if_free_pdev_tgt_info() - free pdev tgt info 392 * @pdev: pointer to pdev 393 * 394 * API to free allocated memory for target_pdev_info 395 * 396 * Return: SUCCESS on successful memory deallocation or Failure 397 */ 398 QDF_STATUS target_if_free_pdev_tgt_info(struct wlan_objmgr_pdev *pdev); 399 400 /** 401 * target_if_alloc_psoc_tgt_info() - alloc psoc tgt info 402 * @psoc: pointer to psoc 403 * 404 * API to allocate memory for target_psoc_info 405 * 406 * Return: SUCCESS on successful memory allocation or Failure 407 */ 408 QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); 409 410 /** 411 * target_if_free_psoc_tgt_info() - free psoc tgt info 412 * @psoc: pointer to psoc 413 * 414 * API to free allocated memory for target_psoc_info 415 * 416 * Return: SUCCESS on successful memory deallocation or Failure 417 */ 418 QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); 419 420 /** 421 * target_is_tgt_type_ar900b() - Check if the target type is AR900B 422 * @target_type: target type to be checked. 423 * 424 * Return: true if the target_type is AR900B, else false. 425 */ 426 bool target_is_tgt_type_ar900b(uint32_t target_type); 427 428 /** 429 * target_is_tgt_type_ipq4019() - Check if the target type is IPQ4019 430 * @target_type: target type to be checked. 431 * 432 * Return: true if the target_type is IPQ4019, else false. 433 */ 434 bool target_is_tgt_type_ipq4019(uint32_t target_type); 435 436 /** 437 * target_is_tgt_type_qca9984() - Check if the target type is QCA9984 438 * @target_type: target type to be checked. 439 * 440 * Return: true if the target_type is QCA9984, else false. 441 */ 442 bool target_is_tgt_type_qca9984(uint32_t target_type); 443 444 /** 445 * target_is_tgt_type_qca9888() - Check if the target type is QCA9888 446 * @target_type: target type to be checked. 447 * 448 * Return: true if the target_type is QCA9888, else false. 449 */ 450 bool target_is_tgt_type_qca9888(uint32_t target_type); 451 452 453 /** 454 * target_psoc_set_wlan_init_status() - set info wlan_init_status 455 * @psoc_info: pointer to structure target_psoc_info 456 * @wlan_init_status: FW init status 457 * 458 * API to set wlan_init_status 459 * 460 * Return: void 461 */ 462 static inline void target_psoc_set_wlan_init_status 463 (struct target_psoc_info *psoc_info, uint32_t wlan_init_status) 464 { 465 if (psoc_info == NULL) 466 return; 467 468 psoc_info->info.wlan_init_status = wlan_init_status; 469 } 470 471 /** 472 * target_psoc_get_wlan_init_status() - get info wlan_init_status 473 * @psoc_info: pointer to structure target_psoc_info 474 * 475 * API to get wlan_init_status 476 * 477 * Return: uint32_t 478 */ 479 static inline uint32_t target_psoc_get_wlan_init_status 480 (struct target_psoc_info *psoc_info) 481 { 482 if (psoc_info == NULL) 483 return (uint32_t)-1; 484 485 return psoc_info->info.wlan_init_status; 486 } 487 488 /** 489 * target_psoc_set_target_type() - set info target_type 490 * @psoc_info: pointer to structure target_psoc_info 491 * @target_type: Target type 492 * 493 * API to set target_type 494 * 495 * Return: void 496 */ 497 static inline void target_psoc_set_target_type 498 (struct target_psoc_info *psoc_info, uint32_t target_type) 499 { 500 if (psoc_info == NULL) 501 return; 502 503 psoc_info->info.target_type = target_type; 504 } 505 506 /** 507 * target_psoc_get_target_type() - get info target_type 508 * @psoc_info: pointer to structure target_psoc_info 509 * 510 * API to get target_type 511 * 512 * Return: unit32_t 513 */ 514 static inline uint32_t target_psoc_get_target_type 515 (struct target_psoc_info *psoc_info) 516 { 517 if (psoc_info == NULL) 518 return (uint32_t)-1; 519 520 return psoc_info->info.target_type; 521 } 522 523 /** 524 * target_psoc_set_max_descs() - set info max_descs 525 * @psoc_info: pointer to structure target_psoc_info 526 * @max_descs: Max descriptors 527 * 528 * API to set max_descs 529 * 530 * Return: void 531 */ 532 static inline void target_psoc_set_max_descs 533 (struct target_psoc_info *psoc_info, uint32_t max_descs) 534 { 535 if (psoc_info == NULL) 536 return; 537 538 psoc_info->info.max_descs = max_descs; 539 } 540 541 /** 542 * target_psoc_get_max_descs() - get info max_descs 543 * @psoc_info: pointer to structure target_psoc_info 544 * 545 * API to get max_descs 546 * 547 * Return: unint32_t 548 */ 549 static inline uint32_t target_psoc_get_max_descs 550 (struct target_psoc_info *psoc_info) 551 { 552 if (psoc_info == NULL) 553 return (uint32_t)-1; 554 555 return psoc_info->info.max_descs; 556 } 557 558 /** 559 * target_psoc_set_wmi_service_ready() - set info wmi_service_ready 560 * @psoc_info: pointer to structure target_psoc_info 561 * @wmi_service_ready: service ready flag 562 * 563 * API to set wmi_service_ready 564 * 565 * Return: void 566 */ 567 static inline void target_psoc_set_wmi_service_ready 568 (struct target_psoc_info *psoc_info, bool wmi_service_ready) 569 { 570 if (psoc_info == NULL) 571 return; 572 573 psoc_info->info.wmi_service_ready = wmi_service_ready; 574 } 575 576 /** 577 * target_psoc_get_wmi_service_ready() - get info wmi_service_ready 578 * @psoc_info: pointer to structure target_psoc_info 579 * 580 * API to get wmi_service_ready 581 * 582 * Return: bool 583 */ 584 static inline bool target_psoc_get_wmi_service_ready 585 (struct target_psoc_info *psoc_info) 586 { 587 return psoc_info->info.wmi_service_ready; 588 } 589 590 /** 591 * target_psoc_set_wmi_ready() - set info wmi_ready 592 * @psoc_info: pointer to structure target_psoc_info 593 * @wmi_ready: Ready event flag 594 * 595 * API to set wmi_ready 596 * 597 * Return: void 598 */ 599 static inline void target_psoc_set_wmi_ready 600 (struct target_psoc_info *psoc_info, bool wmi_ready) 601 { 602 if (psoc_info == NULL) 603 return; 604 605 psoc_info->info.wmi_ready = wmi_ready; 606 } 607 608 /** 609 * target_psoc_get_wmi_ready() - get info wmi_ready 610 * @psoc_info: pointer to structure target_psoc_info 611 * 612 * API to get wmi_ready 613 * 614 * Return: bool 615 */ 616 static inline bool target_psoc_get_wmi_ready 617 (struct target_psoc_info *psoc_info) 618 { 619 return psoc_info->info.wmi_ready; 620 } 621 622 /** 623 * target_psoc_set_preferred_hw_mode() - set preferred_hw_mode 624 * @psoc_info: pointer to structure target_psoc_info 625 * @preferred_hw_mode: Preferred HW mode 626 * 627 * API to set preferred_hw_mode 628 * 629 * Return: void 630 */ 631 static inline void target_psoc_set_preferred_hw_mode( 632 struct target_psoc_info *psoc_info, uint32_t preferred_hw_mode) 633 { 634 if (psoc_info == NULL) 635 return; 636 637 psoc_info->info.preferred_hw_mode = preferred_hw_mode; 638 } 639 640 /** 641 * target_psoc_get_preferred_hw_mode() - get preferred_hw_mode 642 * @psoc_info: pointer to structure target_psoc_info 643 * 644 * API to get preferred_hw_mode 645 * 646 * Return: unint32_t 647 */ 648 static inline uint32_t target_psoc_get_preferred_hw_mode 649 (struct target_psoc_info *psoc_info) 650 { 651 if (psoc_info == NULL) 652 return WMI_HOST_HW_MODE_MAX; 653 654 return psoc_info->info.preferred_hw_mode; 655 } 656 657 /** 658 * target_psoc_set_wmi_timeout() - set wmi_timeout 659 * @psoc_info: pointer to structure target_psoc_info 660 * @wmi_timeout: WMI timeout value in sec 661 * 662 * API to set wmi_timeout 663 * 664 * Return: void 665 */ 666 static inline void target_psoc_set_wmi_timeout 667 (struct target_psoc_info *psoc_info, uint32_t wmi_timeout) 668 { 669 if (psoc_info == NULL) 670 return; 671 672 psoc_info->info.wmi_timeout = wmi_timeout; 673 } 674 675 /** 676 * target_psoc_get_wmi_timeout() - get wmi_timeout 677 * @psoc_info: pointer to structure target_psoc_info 678 * 679 * API to get wmi_timeout 680 * 681 * Return: unint32_t 682 */ 683 static inline uint32_t target_psoc_get_wmi_timeout 684 (struct target_psoc_info *psoc_info) 685 { 686 if (psoc_info == NULL) 687 return (uint32_t)-1; 688 689 return psoc_info->info.wmi_timeout; 690 } 691 692 /** 693 * target_psoc_set_wmi_timeout_unintr() - set wmi_timeout_unintr 694 * @psoc_info: pointer to structure target_psoc_info 695 * @wmi_timeout_unint: WMI timeout uninterrupted in sec 696 * 697 * API to set wmi_timeout_unintr 698 * 699 * Return: void 700 */ 701 static inline void target_psoc_set_wmi_timeout_unintr 702 (struct target_psoc_info *psoc_info, uint32_t wmi_timeout_unint) 703 { 704 if (psoc_info == NULL) 705 return; 706 707 psoc_info->info.wmi_timeout_unintr = wmi_timeout_unint; 708 } 709 710 /** 711 * target_psoc_get_wmi_timeout_unintr() - get wmi_timeout_unintr 712 * @psoc_info: pointer to structure target_psoc_info 713 * 714 * API to get wmi_timeout_unintr 715 * 716 * Return: unint32_t 717 */ 718 static inline uint32_t target_psoc_get_wmi_timeout_unintr 719 (struct target_psoc_info *psoc_info) 720 { 721 if (psoc_info == NULL) 722 return (uint32_t)-1; 723 724 return psoc_info->info.wmi_timeout_unintr; 725 } 726 727 /** 728 * target_psoc_set_total_mac_phy_cnt() - set total_mac_phy 729 * @psoc_info: pointer to structure target_psoc_infoa 730 * @total_mac_phy_cnt: Total MAC PHY cnt 731 * 732 * API to set total_mac_phy 733 * 734 * Return: void 735 */ 736 static inline void target_psoc_set_total_mac_phy_cnt 737 (struct target_psoc_info *psoc_info, uint8_t total_mac_phy_cnt) 738 { 739 if (psoc_info == NULL) 740 return; 741 742 psoc_info->info.total_mac_phy_cnt = total_mac_phy_cnt; 743 } 744 745 /** 746 * target_psoc_get_total_mac_phy_cnt() - get total_mac_phy 747 * @psoc_info: pointer to structure target_psoc_info 748 * 749 * API to get total_mac_phy 750 * 751 * Return: unint8_t 752 */ 753 static inline uint8_t target_psoc_get_total_mac_phy_cnt( 754 struct target_psoc_info *psoc_info) 755 { 756 if (psoc_info == NULL) 757 return 0; 758 759 return psoc_info->info.total_mac_phy_cnt; 760 } 761 762 /** 763 * target_psoc_set_num_radios() - set num of radios 764 * @psoc_info: pointer to structure target_psoc_info 765 * @num_radios: Number of radios 766 * 767 * API to set number of radios 768 * 769 * Return: number of radios 770 */ 771 static inline void target_psoc_set_num_radios( 772 struct target_psoc_info *psoc_info, uint8_t num_radios) 773 { 774 if (psoc_info == NULL) 775 return; 776 777 psoc_info->info.num_radios = num_radios; 778 } 779 780 /** 781 * target_psoc_get_num_radios() - get number of radios 782 * @psoc_info: pointer to structure target_psoc_info 783 * 784 * API to get number_of_radios 785 * 786 * Return: number of radios 787 */ 788 static inline uint8_t target_psoc_get_num_radios 789 (struct target_psoc_info *psoc_info) 790 { 791 if (psoc_info == NULL) 792 return 0; 793 794 return psoc_info->info.num_radios; 795 } 796 797 /** 798 * target_psoc_set_service_bitmap() - set service_bitmap 799 * @psoc_info: pointer to structure target_psoc_info 800 * @service_bitmap: FW service bitmap 801 * 802 * API to set service_bitmap 803 * 804 * Return: void 805 */ 806 static inline void target_psoc_set_service_bitmap 807 (struct target_psoc_info *psoc_info, uint32_t *service_bitmap) 808 { 809 qdf_mem_copy(psoc_info->info.service_bitmap, service_bitmap, 810 sizeof(psoc_info->info.service_bitmap)); 811 } 812 813 /** 814 * target_psoc_get_service_bitmap() - get service_bitmap 815 * @psoc_info: pointer to structure target_psoc_info 816 * 817 * API to get service_bitmap 818 * 819 * Return: unint32_t 820 */ 821 static inline uint32_t *target_psoc_get_service_bitmap 822 (struct target_psoc_info *psoc_info) 823 { 824 return psoc_info->info.service_bitmap; 825 } 826 827 /** 828 * target_psoc_set_num_mem_chunks - set num_mem_chunks 829 * @psoc_info: pointer to structure target_psoc_info 830 & @num_mem_chunks: Num Memory chunks allocated for FW 831 * 832 * API to set num_mem_chunks 833 * 834 * Return: void 835 */ 836 static inline void target_psoc_set_num_mem_chunks( 837 struct target_psoc_info *psoc_info, uint32_t num_mem_chunks) 838 { 839 if (psoc_info == NULL) 840 return; 841 psoc_info->info.num_mem_chunks = num_mem_chunks; 842 } 843 844 /** 845 * target_psoc_get_num_mem_chunks() - get num_mem_chunks 846 * @psoc_info: pointer to structure target_psoc_info 847 * 848 * API to get total_mac_phy 849 * 850 * Return: unint8_t 851 */ 852 static inline uint32_t target_psoc_get_num_mem_chunks 853 (struct target_psoc_info *psoc_info) 854 { 855 if (psoc_info == NULL) 856 return (uint32_t)-1; 857 858 return psoc_info->info.num_mem_chunks; 859 } 860 /** 861 * target_psoc_set_hif_hdl - set hif_hdl 862 * @psoc_info: pointer to structure target_psoc_info 863 * @hif_hdl: HIF handle 864 * 865 * API to set hif_hdl 866 * 867 * Return: void 868 */ 869 static inline void target_psoc_set_hif_hdl 870 (struct target_psoc_info *psoc_info, 871 struct common_hif_handle *hif_hdl) 872 { 873 if (psoc_info == NULL) 874 return; 875 876 psoc_info->hdls.hif_hdl = hif_hdl; 877 } 878 879 /** 880 * target_psoc_get_hif_hdl() - get hif_hdl 881 * @psoc_info: pointer to structure target_psoc_info 882 * 883 * API to get hif_hdl 884 * 885 * Return: hif_hdl 886 */ 887 static inline struct common_hif_handle *target_psoc_get_hif_hdl 888 (struct target_psoc_info *psoc_info) 889 { 890 if (psoc_info == NULL) 891 return NULL; 892 893 return psoc_info->hdls.hif_hdl; 894 } 895 896 /** 897 * target_psoc_set_hif_hdl - set htc_hdl 898 * @psoc_info: pointer to structure target_psoc_info 899 * @htc_hdl: HTC handle 900 * 901 * API to set htc_hdl 902 * 903 * Return: void 904 */ 905 static inline void target_psoc_set_htc_hdl 906 (struct target_psoc_info *psoc_info, 907 struct common_htc_handle *htc_hdl) 908 { 909 if (psoc_info == NULL) 910 return; 911 912 psoc_info->hdls.htc_hdl = htc_hdl; 913 } 914 915 /** 916 * target_psoc_get_htc_hdl() - get htc_hdl 917 * @psoc_info: pointer to structure target_psoc_info 918 * 919 * API to get htc_hdl 920 * 921 * Return: htc_hdl 922 */ 923 static inline struct common_htc_handle *target_psoc_get_htc_hdl 924 (struct target_psoc_info *psoc_info) 925 { 926 if (psoc_info == NULL) 927 return NULL; 928 929 return psoc_info->hdls.htc_hdl; 930 } 931 /** 932 * target_psoc_set_wmi_hdl - set wmi_hdl 933 * @psoc_info: pointer to structure target_psoc_info 934 * @wmi_hdl: WMI handle 935 * 936 * API to set wmi_hdl 937 * 938 * Return: void 939 */ 940 static inline void target_psoc_set_wmi_hdl 941 (struct target_psoc_info *psoc_info, 942 struct common_wmi_handle *wmi_hdl) 943 { 944 if (psoc_info == NULL) 945 return; 946 947 psoc_info->hdls.wmi_hdl = wmi_hdl; 948 } 949 950 /** 951 * target_psoc_get_wmi_hdl() - get wmi_hdl 952 * @psoc_info: pointer to structure target_psoc_info 953 * 954 * API to get wmi_hdl 955 * 956 * Return: wmi_hdl 957 */ 958 static inline struct common_wmi_handle *target_psoc_get_wmi_hdl 959 (struct target_psoc_info *psoc_info) 960 { 961 if (psoc_info == NULL) 962 return NULL; 963 964 return psoc_info->hdls.wmi_hdl; 965 } 966 967 /** 968 * target_psoc_set_accelerator_hdl - set accelerator_hdl 969 * @psoc_info: pointer to structure target_psoc_info 970 * @accelerator_hdl: Accelator handle 971 * 972 * API to set accelerator_hdl 973 * 974 * Return: void 975 */ 976 static inline void target_psoc_set_accelerator_hdl 977 (struct target_psoc_info *psoc_info, 978 struct common_accelerator_handle *accelerator_hdl) 979 { 980 if (psoc_info == NULL) 981 return; 982 983 psoc_info->hdls.accelerator_hdl = accelerator_hdl; 984 } 985 986 /** 987 * target_psoc_get_accelerator_hdl() - get accelerator_hdl 988 * @psoc_info: pointer to structure target_psoc_info 989 * 990 * API to get accelerator_hdl 991 * 992 * Return: accelerator_hdl 993 */ 994 static inline 995 struct common_accelerator_handle *target_psoc_get_accelerator_hdl 996 (struct target_psoc_info *psoc_info) 997 { 998 if (psoc_info == NULL) 999 return NULL; 1000 1001 return psoc_info->hdls.accelerator_hdl; 1002 } 1003 1004 /** 1005 * target_psoc_set_feature_ptr - set feature_ptr 1006 * @psoc_info: pointer to structure target_psoc_info 1007 * @feature_ptr: set feature pointer 1008 * 1009 * API to set feature_ptr 1010 * 1011 * Return: void 1012 */ 1013 static inline void target_psoc_set_feature_ptr 1014 (struct target_psoc_info *psoc_info, void *feature_ptr) 1015 { 1016 if (psoc_info == NULL) 1017 return; 1018 1019 psoc_info->feature_ptr = feature_ptr; 1020 } 1021 1022 /** 1023 * target_psoc_get_feature_ptr() - get feature_ptr 1024 * @psoc_info: pointer to structure target_psoc_info 1025 * 1026 * API to get feature_ptr 1027 * 1028 * Return: feature_ptr 1029 */ 1030 static inline void *target_psoc_get_feature_ptr 1031 (struct target_psoc_info *psoc_info) 1032 { 1033 if (psoc_info == NULL) 1034 return NULL; 1035 1036 return psoc_info->feature_ptr; 1037 } 1038 1039 /** 1040 * target_psoc_get_version()- get host_fw_ver version 1041 * @psoc_info: pointer to structure target_psoc_info 1042 * 1043 * API to get host_fw_ver version 1044 * 1045 * Return: void 1046 */ 1047 static inline struct host_fw_ver *target_psoc_get_version 1048 (struct target_psoc_info *psoc_info) 1049 { 1050 return &psoc_info->info.version; 1051 } 1052 1053 /** 1054 * target_psoc_get_target_ver()- get target version 1055 * @psoc_info: pointer to structure target_psoc_info 1056 * 1057 * API to get target version 1058 * 1059 * Return: target version 1060 */ 1061 static inline uint32_t target_psoc_get_target_ver 1062 (struct target_psoc_info *psoc_info) 1063 { 1064 return psoc_info->info.version.target_ver; 1065 } 1066 1067 /** 1068 * target_psoc_set_target_ver()- set target version 1069 * @psoc_info: pointer to structure target_psoc_info 1070 * @target_ver: Target version 1071 * 1072 * API to set target version 1073 * 1074 * Return: void 1075 */ 1076 static inline void target_psoc_set_target_ver 1077 (struct target_psoc_info *psoc_info, uint32_t target_ver) 1078 { 1079 if (psoc_info == NULL) 1080 return; 1081 1082 psoc_info->info.version.target_ver = target_ver; 1083 } 1084 1085 /** 1086 * target_psoc_set_target_rev()- set target revision 1087 * @psoc_info: pointer to structure target_psoc_info 1088 * @target_rev: Target revision 1089 * 1090 * API to get target version 1091 * 1092 * Return: void 1093 */ 1094 static inline void target_psoc_set_target_rev 1095 (struct target_psoc_info *psoc_info, uint32_t target_rev) 1096 { 1097 if (psoc_info == NULL) 1098 return; 1099 1100 psoc_info->info.version.target_rev = target_rev; 1101 } 1102 1103 /** 1104 * target_psoc_get_target_rev()- get target revision 1105 * @psoc_info: pointer to structure target_psoc_info 1106 * 1107 * API to get target revision 1108 * 1109 * Return: target revision 1110 */ 1111 static inline uint32_t target_psoc_get_target_rev 1112 (struct target_psoc_info *psoc_info) 1113 { 1114 return psoc_info->info.version.target_rev; 1115 } 1116 1117 /** 1118 * target_psoc_set_dbglog_hdl - set dbglog_hdl 1119 * @psoc_info: pointer to structure target_psoc_info 1120 * @dbglog_hdl: dbglog handle 1121 * 1122 * API to set dbglog_hdl 1123 * 1124 * Return: void 1125 */ 1126 static inline void target_psoc_set_dbglog_hdl 1127 (struct target_psoc_info *psoc_info, 1128 struct common_dbglog_handle *dbglog_hdl) 1129 { 1130 if (psoc_info == NULL) 1131 return; 1132 1133 psoc_info->hdls.dbglog_hdl = dbglog_hdl; 1134 } 1135 1136 /** 1137 * target_psoc_get_dbglog_hdl() - get dbglog_hdl 1138 * @psoc_info: pointer to structure target_psoc_info 1139 * 1140 * API to get dbglog_hdl 1141 * 1142 * Return: dbglog_hdl 1143 */ 1144 static inline struct common_dbglog_handle *target_psoc_get_dbglog_hdl 1145 (struct target_psoc_info *psoc_info) 1146 { 1147 if (psoc_info == NULL) 1148 return NULL; 1149 1150 return psoc_info->hdls.dbglog_hdl; 1151 } 1152 1153 /** 1154 * target_psoc_get_wlan_res_cfg() - get wlan_res_cfg 1155 * @psoc_info: pointer to structure target_psoc_info 1156 * 1157 * API to get wlan_res_cfg 1158 * 1159 * Return: structure pointer to host_fw_ver 1160 */ 1161 static inline target_resource_config *target_psoc_get_wlan_res_cfg 1162 (struct target_psoc_info *psoc_info) 1163 { 1164 if (psoc_info == NULL) 1165 return NULL; 1166 1167 return &psoc_info->info.wlan_res_cfg; 1168 } 1169 1170 /** 1171 * target_psoc_get_wlan_ext_res_cfg() - get wlan_ext_res_cfg 1172 * @psoc_info: pointer to structure target_psoc_info 1173 * 1174 * API to get wlan_ext_res_cfg 1175 * 1176 * Return: structure pointer to wmi_host_ext_resource_config 1177 */ 1178 static inline wmi_host_ext_resource_config *target_psoc_get_wlan_ext_res_cfg 1179 (struct target_psoc_info *psoc_info) 1180 { 1181 if (psoc_info == NULL) 1182 return NULL; 1183 1184 return &psoc_info->info.wlan_ext_res_cfg; 1185 } 1186 1187 /** 1188 * target_psoc_get_event_queue() - get event_queue 1189 * @psoc_info: pointer to structure target_psoc_info 1190 * 1191 * API to get event_queue 1192 * 1193 * Return: structure pointer to qdf_wait_queue_head_t 1194 */ 1195 static inline qdf_wait_queue_head_t *target_psoc_get_event_queue 1196 (struct target_psoc_info *psoc_info) 1197 { 1198 if (psoc_info == NULL) 1199 return NULL; 1200 1201 return &psoc_info->info.event_queue; 1202 } 1203 1204 /** 1205 * target_psoc_get_target_caps() - get target_caps 1206 * @psoc_info: pointer to structure target_psoc_info 1207 * 1208 * API to get target_caps 1209 * 1210 * Return: structure pointer to wlan_psoc_target_capability_info 1211 */ 1212 static inline struct wlan_psoc_target_capability_info 1213 *target_psoc_get_target_caps(struct target_psoc_info *psoc_info) 1214 { 1215 if (psoc_info == NULL) 1216 return NULL; 1217 1218 return &psoc_info->info.target_caps; 1219 } 1220 1221 /** 1222 * target_psoc_get_service_ext_param() - get service_ext_param 1223 * @psoc_info: pointer to structure target_psoc_info 1224 * 1225 * API to get service_ext_param 1226 * 1227 * Return: structure pointer to wlan_psoc_host_service_ext_param 1228 */ 1229 static inline struct wlan_psoc_host_service_ext_param 1230 *target_psoc_get_service_ext_param 1231 (struct target_psoc_info *psoc_info) 1232 { 1233 if (psoc_info == NULL) 1234 return NULL; 1235 1236 return &psoc_info->info.service_ext_param; 1237 } 1238 1239 1240 /** 1241 * target_psoc_get_mac_phy_cap() - get mac_phy_cap 1242 * @psoc_info: pointer to structure target_psoc_info 1243 * 1244 * API to get mac_phy_cap 1245 * 1246 * Return: structure pointer to wlan_psoc_host_mac_phy_caps 1247 */ 1248 static inline struct wlan_psoc_host_mac_phy_caps *target_psoc_get_mac_phy_cap 1249 (struct target_psoc_info *psoc_info) 1250 { 1251 if (psoc_info == NULL) 1252 return NULL; 1253 1254 return psoc_info->info.mac_phy_cap; 1255 } 1256 1257 /** 1258 * target_psoc_get_dbr_ring_caps() - get dbr_ring_cap 1259 * @psoc_info: pointer to structure target_psoc_info 1260 * 1261 * API to get dbr_ring_cap 1262 * 1263 * Return: structure pointer to wlan_psoc_host_dbr_ring_caps 1264 */ 1265 static inline struct wlan_psoc_host_dbr_ring_caps 1266 *target_psoc_get_dbr_ring_caps(struct target_psoc_info *psoc_info) 1267 { 1268 if (psoc_info == NULL) 1269 return NULL; 1270 1271 return psoc_info->info.dbr_ring_cap; 1272 } 1273 /** 1274 * target_psoc_get_mem_chunks() - get mem_chunks 1275 * @psoc_info: pointer to structure target_psoc_info 1276 * 1277 * API to get mem_chunks 1278 * 1279 * Return: structure pointer to wmi_host_mem_chunk 1280 */ 1281 static inline struct wmi_host_mem_chunk *target_psoc_get_mem_chunks 1282 (struct target_psoc_info *psoc_info) 1283 { 1284 if (psoc_info == NULL) 1285 return NULL; 1286 1287 return psoc_info->info.mem_chunks; 1288 } 1289 1290 /** 1291 * target_psoc_get_tif_ops() - get tif_ops 1292 * @psoc_info: pointer to structure target_psoc_info 1293 * 1294 * API to get tif_ops 1295 * 1296 * Return: structure pointer to target_ops 1297 */ 1298 static inline struct target_ops *target_psoc_get_tif_ops 1299 (struct target_psoc_info *psoc_info) 1300 { 1301 if (psoc_info == NULL) 1302 return NULL; 1303 1304 return psoc_info->tif_ops; 1305 } 1306 1307 /** 1308 * target_pdev_set_feature_ptr - set feature_ptr 1309 * @pdev_info: pointer to structure target_pdev_info 1310 * @feature_ptr: Feature pointer 1311 * 1312 * API to set feature_ptr 1313 * 1314 * Return: void 1315 */ 1316 static inline void target_pdev_set_feature_ptr 1317 (struct target_pdev_info *pdev_info, void *feature_ptr) 1318 { 1319 if (pdev_info == NULL) 1320 return; 1321 1322 pdev_info->feature_ptr = feature_ptr; 1323 } 1324 1325 /** 1326 * target_pdev_get_feature_ptr() - get feature_ptr 1327 * @pdev_info: pointer to structure target_pdev_info 1328 * 1329 * API to get feature_ptr 1330 * 1331 * Return: feature_ptr 1332 */ 1333 static inline void *target_pdev_get_feature_ptr 1334 (struct target_pdev_info *pdev_info) 1335 { 1336 if (pdev_info == NULL) 1337 return NULL; 1338 1339 return pdev_info->feature_ptr; 1340 } 1341 1342 /** 1343 * target_pdev_set_wmi_handle - set wmi_handle 1344 * @pdev_info: pointer to structure target_pdev_info 1345 * @wmi_handle: WMI handle 1346 * 1347 * API to set wmi_handle 1348 * 1349 * Return: void 1350 */ 1351 static inline void target_pdev_set_wmi_handle 1352 (struct target_pdev_info *pdev_info, 1353 struct common_wmi_handle *wmi_handle) 1354 { 1355 if (pdev_info == NULL) 1356 return; 1357 1358 pdev_info->wmi_handle = wmi_handle; 1359 } 1360 1361 /** 1362 * target_pdev_get_wmi_handle - get wmi_handle 1363 * @pdev_info: pointer to structure target_dev_info 1364 * 1365 * API to get wmi_handle 1366 * 1367 * Return: wmi_handle 1368 */ 1369 static inline struct common_wmi_handle *target_pdev_get_wmi_handle 1370 (struct target_pdev_info *pdev_info) 1371 { 1372 if (pdev_info == NULL) 1373 return NULL; 1374 1375 return pdev_info->wmi_handle; 1376 } 1377 1378 /** 1379 * target_pdev_set_accelerator_hdl - set accelerator_hdl 1380 * @pdev_info: pointer to structure target_pdev_info 1381 * @accelerator_hdl: Accelator handle 1382 * 1383 * API to set accelerator_hdl 1384 * 1385 * Return: void 1386 */ 1387 static inline void target_pdev_set_accelerator_hdl 1388 (struct target_pdev_info *pdev_info, 1389 struct common_accelerator_handle *accelerator_hdl) 1390 { 1391 if (pdev_info == NULL) 1392 return; 1393 1394 pdev_info->accelerator_hdl = accelerator_hdl; 1395 } 1396 1397 /** 1398 * target_pdev_get_accelerator_hdl - get accelerator_hdl 1399 * @pdev_info: pointer to structure target_dev_info 1400 * 1401 * API to get accelerator_hdl 1402 * 1403 * Return: accelerator_hdl 1404 */ 1405 static inline struct common_accelerator_handle * 1406 target_pdev_get_accelerator_hdl(struct target_pdev_info *pdev_info) 1407 { 1408 if (pdev_info == NULL) 1409 return NULL; 1410 1411 return pdev_info->accelerator_hdl; 1412 } 1413 1414 /** 1415 * target_pdev_set_pdev_idx - set pdev_idx 1416 * @pdev_info: pointer to structure target_pdev_info 1417 * @pdev_idx: PDEV id of FW 1418 * 1419 * API to set pdev_idx 1420 * 1421 * Return: void 1422 */ 1423 static inline void target_pdev_set_pdev_idx 1424 (struct target_pdev_info *pdev_info, int32_t pdev_idx) 1425 { 1426 if (pdev_info == NULL) 1427 return; 1428 1429 pdev_info->pdev_idx = pdev_idx; 1430 } 1431 1432 /** 1433 * target_pdev_get_pdev_idx - get pdev_idx 1434 * @pdev_info: pointer to structure target_dev_info 1435 * 1436 * API to get pdev_idx 1437 * 1438 * Return: int32_t 1439 */ 1440 static inline int32_t target_pdev_get_pdev_idx 1441 (struct target_pdev_info *pdev_info) 1442 { 1443 if (pdev_info == NULL) 1444 return -EINVAL; 1445 1446 return pdev_info->pdev_idx; 1447 } 1448 1449 /** 1450 * target_pdev_set_phy_idx - set phy_idx 1451 * @pdev_info: pointer to structure target_pdev_info 1452 * @phy_idx: phy ID of FW 1453 * 1454 * API to set phy_idx 1455 * 1456 * Return: void 1457 */ 1458 static inline void target_pdev_set_phy_idx 1459 (struct target_pdev_info *pdev_info, int32_t phy_idx) 1460 { 1461 if (pdev_info == NULL) 1462 return; 1463 1464 pdev_info->phy_idx = phy_idx; 1465 } 1466 1467 /** 1468 * target_pdev_get_phy_idx - get phy_idx 1469 * @pdev_info: pointer to structure target_dev_info 1470 * 1471 * API to get phy_idx 1472 * 1473 * Return: int32_t 1474 */ 1475 static inline int32_t target_pdev_get_phy_idx 1476 (struct target_pdev_info *pdev_info) 1477 { 1478 if (pdev_info == NULL) 1479 return -EINVAL; 1480 1481 return pdev_info->phy_idx; 1482 } 1483 1484 /** 1485 * GET_WMI_HDL_FROM_PSOC - get wmi handle from psoc 1486 * @psoc: psoc object 1487 * 1488 * API to get wmi_handle from psoc 1489 * 1490 * Return: wmi_handle on success 1491 * if tgt handle is not initialized, it returns NULL 1492 */ 1493 static inline struct common_wmi_handle *GET_WMI_HDL_FROM_PSOC( 1494 struct wlan_objmgr_psoc *psoc) 1495 { 1496 void *tgt_if_handle; 1497 1498 if (psoc) { 1499 tgt_if_handle = psoc->tgt_if_handle; 1500 1501 if (tgt_if_handle) 1502 return (target_psoc_get_wmi_hdl( 1503 (struct target_psoc_info *)tgt_if_handle)); 1504 else 1505 return NULL; 1506 } 1507 1508 return NULL; 1509 } 1510 1511 /** 1512 * GET_WMI_HDL_FROM_PDEV - get wmi handle from pdev 1513 * @pdev: pdev object 1514 * 1515 * API to get wmi_handle from pdev 1516 * 1517 * Return: wmi_handle on success 1518 * if tgt handle is not initialized, it returns NULL 1519 */ 1520 static inline struct common_wmi_handle *GET_WMI_HDL_FROM_PDEV( 1521 struct wlan_objmgr_pdev *pdev) 1522 { 1523 void *tgt_if_handle; 1524 1525 if (pdev) { 1526 tgt_if_handle = pdev->tgt_if_handle; 1527 1528 if (tgt_if_handle) 1529 return target_pdev_get_wmi_handle(tgt_if_handle); 1530 else 1531 return NULL; 1532 } 1533 1534 return NULL; 1535 } 1536 1537 /** 1538 * get_wmi_unified_hdl_from_psoc - get wmi handle from psoc 1539 * @psoc: psoc object 1540 * 1541 * API to get wmi_handle from psoc 1542 * 1543 * Return: wmi_handle on success 1544 * if tgt handle is not initialized, it returns NULL 1545 */ 1546 static inline wmi_unified_t 1547 get_wmi_unified_hdl_from_psoc(struct wlan_objmgr_psoc *psoc) 1548 { 1549 return (wmi_unified_t)GET_WMI_HDL_FROM_PSOC(psoc); 1550 } 1551 1552 /** 1553 * get_wmi_unified_hdl_from_pdev - get wmi handle from pdev 1554 * @pdev: pdev object 1555 * 1556 * API to get wmi_handle from pdev 1557 * 1558 * Return: wmi_handle on success 1559 * if tgt handle is not initialized, it returns NULL 1560 */ 1561 static inline wmi_unified_t 1562 get_wmi_unified_hdl_from_pdev(struct wlan_objmgr_pdev *pdev) 1563 { 1564 return (wmi_unified_t)GET_WMI_HDL_FROM_PDEV(pdev); 1565 } 1566 1567 /** 1568 * target_if_ext_res_cfg_enable - Enable ext resource config 1569 * @psoc: psoc object 1570 * @tgt_hdl: target_psoc_info pointer 1571 * @evt_buf: Event buffer received from FW 1572 * 1573 * API to enable Ext resource config 1574 * 1575 * Return: none 1576 */ 1577 static inline void target_if_ext_res_cfg_enable(struct wlan_objmgr_psoc *psoc, 1578 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1579 { 1580 if ((tgt_hdl->tif_ops) && 1581 (tgt_hdl->tif_ops->ext_resource_config_enable)) 1582 tgt_hdl->tif_ops->ext_resource_config_enable(psoc, 1583 tgt_hdl, evt_buf); 1584 } 1585 1586 /** 1587 * target_if_peer_cfg_enable - Enable peer config 1588 * @psoc: psoc object 1589 * @tgt_hdl: target_psoc_info pointer 1590 * @evt_buf: Event buffer received from FW 1591 * 1592 * API to enable peer config 1593 * 1594 * Return: none 1595 */ 1596 static inline void target_if_peer_cfg_enable(struct wlan_objmgr_psoc *psoc, 1597 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1598 { 1599 if ((tgt_hdl->tif_ops) && 1600 (tgt_hdl->tif_ops->peer_config)) 1601 tgt_hdl->tif_ops->peer_config(psoc, tgt_hdl, evt_buf); 1602 } 1603 1604 /** 1605 * target_if_mesh_support_enable - Enable MESH mode support 1606 * @psoc: psoc object 1607 * @tgt_hdl: target_psoc_info pointer 1608 * @evt_buf: Event buffer received from FW 1609 * 1610 * API to enable Mesh mode 1611 * 1612 * Return: none 1613 */ 1614 static inline void target_if_mesh_support_enable(struct wlan_objmgr_psoc *psoc, 1615 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1616 { 1617 if ((tgt_hdl->tif_ops) && 1618 (tgt_hdl->tif_ops->mesh_support_enable)) 1619 tgt_hdl->tif_ops->mesh_support_enable(psoc, tgt_hdl, evt_buf); 1620 } 1621 1622 /** 1623 * target_if_smart_antenna_enable - Enable Smart antenna module 1624 * @psoc: psoc object 1625 * @tgt_hdl: target_psoc_info pointer 1626 * @evt_buf: Event buffer received from FW 1627 * 1628 * API to enable Smart antenna 1629 * 1630 * Return: none 1631 */ 1632 static inline void target_if_smart_antenna_enable(struct wlan_objmgr_psoc *psoc, 1633 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1634 { 1635 if ((tgt_hdl->tif_ops) && 1636 (tgt_hdl->tif_ops->smart_antenna_enable)) 1637 tgt_hdl->tif_ops->smart_antenna_enable(psoc, tgt_hdl, evt_buf); 1638 } 1639 1640 /** 1641 * target_if_atf_cfg_enable - Enable ATF config 1642 * @psoc: psoc object 1643 * @tgt_hdl: target_psoc_info pointer 1644 * @evt_buf: Event buffer received from FW 1645 * 1646 * API to enable ATF config 1647 * 1648 * Return: none 1649 */ 1650 static inline void target_if_atf_cfg_enable(struct wlan_objmgr_psoc *psoc, 1651 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1652 { 1653 if ((tgt_hdl->tif_ops) && 1654 (tgt_hdl->tif_ops->atf_config_enable)) 1655 tgt_hdl->tif_ops->atf_config_enable(psoc, tgt_hdl, evt_buf); 1656 } 1657 1658 /** 1659 * target_if_qwrap_cfg_enable - Enable QWRAP config 1660 * @psoc: psoc object 1661 * @tgt_hdl: target_psoc_info pointer 1662 * @evt_buf: Event buffer received from FW 1663 * 1664 * API to enable QWRAP config 1665 * 1666 * Return: none 1667 */ 1668 static inline void target_if_qwrap_cfg_enable(struct wlan_objmgr_psoc *psoc, 1669 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1670 { 1671 if ((tgt_hdl->tif_ops) && 1672 (tgt_hdl->tif_ops->qwrap_config_enable)) 1673 tgt_hdl->tif_ops->qwrap_config_enable(psoc, tgt_hdl, evt_buf); 1674 } 1675 1676 /** 1677 * target_if_btcoex_cfg_enable - Enable BT coex config 1678 * @psoc: psoc object 1679 * @tgt_hdl: target_psoc_info pointer 1680 * @evt_buf: Event buffer received from FW 1681 * 1682 * API to enable BT coex config 1683 * 1684 * Return: none 1685 */ 1686 static inline void target_if_btcoex_cfg_enable(struct wlan_objmgr_psoc *psoc, 1687 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1688 { 1689 if ((tgt_hdl->tif_ops) && 1690 (tgt_hdl->tif_ops->btcoex_config_enable)) 1691 tgt_hdl->tif_ops->btcoex_config_enable(psoc, tgt_hdl, evt_buf); 1692 } 1693 1694 /** 1695 * target_if_lteu_cfg_enable - Enable LTEU config 1696 * @psoc: psoc object 1697 * @tgt_hdl: target_psoc_info pointer 1698 * @evt_buf: Event buffer received from FW 1699 * 1700 * API to enable LTEU coex config 1701 * 1702 * Return: none 1703 */ 1704 static inline void target_if_lteu_cfg_enable(struct wlan_objmgr_psoc *psoc, 1705 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1706 { 1707 if ((tgt_hdl->tif_ops) && 1708 (tgt_hdl->tif_ops->lteu_ext_support_enable)) 1709 tgt_hdl->tif_ops->lteu_ext_support_enable(psoc, tgt_hdl, 1710 evt_buf); 1711 } 1712 1713 /** 1714 * target_if_set_init_cmd_dev_param - Set init command params 1715 * @psoc: psoc object 1716 * @tgt_hdl: target_psoc_info pointer 1717 * 1718 * API to set init command param based on config 1719 * 1720 * Return: none 1721 */ 1722 static inline void target_if_set_init_cmd_dev_param( 1723 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1724 { 1725 if ((tgt_hdl->tif_ops) && 1726 (tgt_hdl->tif_ops->set_init_cmd_dev_based_params)) { 1727 tgt_hdl->tif_ops->set_init_cmd_dev_based_params(psoc, 1728 tgt_hdl); 1729 } 1730 } 1731 1732 /** 1733 * target_if_alloc_pdevs - Allocate PDEVs 1734 * @psoc: psoc object 1735 * @tgt_hdl: target_psoc_info pointer 1736 * 1737 * API allocates PDEVs based on ext service ready param 1738 * 1739 * Return: SUCCESS on pdev allocation or PDEV allocation is not needed 1740 * FAILURE, if allocation fails 1741 */ 1742 static inline QDF_STATUS target_if_alloc_pdevs(struct wlan_objmgr_psoc *psoc, 1743 struct target_psoc_info *tgt_hdl) 1744 { 1745 QDF_STATUS ret_val; 1746 1747 if ((tgt_hdl->tif_ops) && 1748 (tgt_hdl->tif_ops->alloc_pdevs)) 1749 ret_val = tgt_hdl->tif_ops->alloc_pdevs(psoc, tgt_hdl); 1750 else 1751 ret_val = QDF_STATUS_SUCCESS; 1752 1753 return ret_val; 1754 } 1755 1756 /** 1757 * target_if_update_pdev_tgt_info - Update PDEVs info 1758 * @psoc: psoc object 1759 * @tgt_hdl: target_psoc_info pointer 1760 * 1761 * API updates PDEVs info based on config 1762 * 1763 * Return: SUCCESS on pdev updation or PDEV updation is not needed 1764 * FAILURE, if updation fails 1765 */ 1766 static inline QDF_STATUS target_if_update_pdev_tgt_info( 1767 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1768 { 1769 QDF_STATUS ret_val; 1770 1771 if ((tgt_hdl->tif_ops) && 1772 (tgt_hdl->tif_ops->update_pdev_tgt_info)) 1773 ret_val = tgt_hdl->tif_ops->update_pdev_tgt_info(psoc, 1774 tgt_hdl); 1775 else 1776 ret_val = QDF_STATUS_SUCCESS; 1777 1778 return ret_val; 1779 } 1780 1781 /** 1782 * target_if_print_service_ready_ext_param - Print Service ready ext param 1783 * @psoc: psoc object 1784 * @tgt_hdl: target_psoc_info pointer 1785 * 1786 * API to print service ready ext param 1787 * 1788 * Return: none 1789 */ 1790 static inline void target_if_print_service_ready_ext_param( 1791 struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) 1792 { 1793 if ((tgt_hdl->tif_ops) && 1794 (tgt_hdl->tif_ops->print_svc_ready_ex_param)) { 1795 tgt_hdl->tif_ops->print_svc_ready_ex_param(psoc, 1796 tgt_hdl); 1797 } 1798 } 1799 1800 /** 1801 * target_if_add_11ax_modes - Add 11ax modes explicitly 1802 * @psoc: psoc object 1803 * @tgt_hdl: target_psoc_info pointer 1804 * 1805 * API to adds 11ax modes 1806 * 1807 * Return: none 1808 */ 1809 static inline void target_if_add_11ax_modes(struct wlan_objmgr_psoc *psoc, 1810 struct target_psoc_info *tgt_hdl) 1811 { 1812 if ((tgt_hdl->tif_ops) && 1813 (tgt_hdl->tif_ops->add_11ax_modes)) { 1814 tgt_hdl->tif_ops->add_11ax_modes(psoc, tgt_hdl); 1815 } 1816 } 1817 1818 /** 1819 * target_if_set_default_config - Set default config in init command 1820 * @psoc: psoc object 1821 * @tgt_hdl: target_psoc_info pointer 1822 * 1823 * API to set default config in init command 1824 * 1825 * Return: none 1826 */ 1827 static inline void target_if_set_default_config(struct wlan_objmgr_psoc *psoc, 1828 struct target_psoc_info *tgt_hdl) 1829 { 1830 if ((tgt_hdl->tif_ops) && 1831 (tgt_hdl->tif_ops->set_default_tgt_config)) { 1832 tgt_hdl->tif_ops->set_default_tgt_config(psoc, tgt_hdl); 1833 } 1834 } 1835 1836 /** 1837 * target_if_sw_version_check - SW version check 1838 * @psoc: psoc object 1839 * @tgt_hdl: target_psoc_info pointer 1840 * @evt_buf: Event buffer received from FW 1841 * 1842 * API checks the SW version 1843 * 1844 * Return: SUCCESS on version matches or version check is not needed 1845 * FAILURE, if check fails 1846 */ 1847 static inline QDF_STATUS target_if_sw_version_check( 1848 struct wlan_objmgr_psoc *psoc, 1849 struct target_psoc_info *tgt_hdl, uint8_t *evt_buf) 1850 { 1851 QDF_STATUS ret_val; 1852 1853 if ((tgt_hdl->tif_ops) && 1854 (tgt_hdl->tif_ops->sw_version_check)) 1855 ret_val = tgt_hdl->tif_ops->sw_version_check(psoc, tgt_hdl, 1856 evt_buf); 1857 else 1858 ret_val = QDF_STATUS_SUCCESS; 1859 1860 return ret_val; 1861 } 1862 1863 /** 1864 * target_if_get_phy_capability - get phy capability 1865 * @target_psoc_info: pointer to structure target_psoc_info 1866 * 1867 * API to get phy capability from the target caps 1868 * 1869 * Return: int32_t 1870 */ 1871 static inline int32_t target_if_get_phy_capability 1872 (struct target_psoc_info *target_psoc_info) 1873 { 1874 if (target_psoc_info == NULL) 1875 return -EINVAL; 1876 1877 return target_psoc_info->info.target_caps.phy_capability; 1878 } 1879 1880 /** 1881 * target_if_set_phy_capability - set phy capability 1882 * @target_psoc_info: pointer to structure target_psoc_info 1883 * @phy_capab: PHY capabilities 1884 * 1885 * API to set phy capability in the target caps 1886 * 1887 * Return: None 1888 */ 1889 static inline void target_if_set_phy_capability 1890 (struct target_psoc_info *target_psoc_info, int phy_capability) 1891 { 1892 if (target_psoc_info == NULL) 1893 return; 1894 1895 target_psoc_info->info.target_caps.phy_capability = phy_capability; 1896 } 1897 1898 /** 1899 * target_if_set_max_frag_entry - set Maximum frag entries 1900 * @target_psoc_info: pointer to structure target_psoc_info 1901 * @max_frag_entry: Maximum frag entries 1902 * 1903 * API to set Maximum frag entries from the target caps 1904 * 1905 * Return: None 1906 */ 1907 static inline void target_if_set_max_frag_entry 1908 (struct target_psoc_info *target_psoc_info, int max_frag_entry) 1909 { 1910 if (target_psoc_info == NULL) 1911 return; 1912 1913 target_psoc_info->info.target_caps.max_frag_entry = max_frag_entry; 1914 } 1915 1916 /** 1917 * target_if_get_max_frag_entry - get Maximum frag entries 1918 * @target_psoc_info: pointer to structure target_psoc_info 1919 * 1920 * API to get Maximum frag entries from the target caps 1921 * 1922 * Return: int32_t 1923 */ 1924 static inline int32_t target_if_get_max_frag_entry 1925 (struct target_psoc_info *target_psoc_info) 1926 { 1927 if (target_psoc_info == NULL) 1928 return -EINVAL; 1929 1930 return target_psoc_info->info.target_caps.max_frag_entry; 1931 } 1932 1933 /** 1934 * target_if_get_ht_cap_info - get ht capabilities info 1935 * @target_psoc_info: pointer to structure target_psoc_info 1936 * 1937 * API to get ht capabilities info from the target caps 1938 * 1939 * Return: int32_t 1940 */ 1941 static inline int32_t target_if_get_ht_cap_info 1942 (struct target_psoc_info *target_psoc_info) 1943 { 1944 if (target_psoc_info == NULL) 1945 return -EINVAL; 1946 1947 return target_psoc_info->info.target_caps.ht_cap_info; 1948 } 1949 1950 /** 1951 * target_if_get_vht_cap_info - get vht capabilities info 1952 * @target_psoc_info: pointer to structure target_psoc_info 1953 * 1954 * API to get vht capabilities info from the target caps 1955 * 1956 * Return: int32_t 1957 */ 1958 static inline int32_t target_if_get_vht_cap_info 1959 (struct target_psoc_info *target_psoc_info) 1960 { 1961 if (target_psoc_info == NULL) 1962 return -EINVAL; 1963 1964 return target_psoc_info->info.target_caps.vht_cap_info; 1965 } 1966 1967 /** 1968 * target_if_get_num_rf_chains - get Number of RF chains supported 1969 * @target_psoc_info: pointer to structure target_psoc_info 1970 * 1971 * API to get Number of RF chains supported from the target caps 1972 * 1973 * Return: int32_t 1974 */ 1975 static inline int32_t target_if_get_num_rf_chains 1976 (struct target_psoc_info *target_psoc_info) 1977 { 1978 if (target_psoc_info == NULL) 1979 return -EINVAL; 1980 1981 return target_psoc_info->info.target_caps.num_rf_chains; 1982 } 1983 1984 /** 1985 * target_if_get_fw_version - get firmware version 1986 * @target_psoc_info: pointer to structure target_psoc_info 1987 * 1988 * API to get firmware version from the target caps 1989 * 1990 * Return: int32_t 1991 */ 1992 static inline int32_t target_if_get_fw_version 1993 (struct target_psoc_info *target_psoc_info) 1994 { 1995 if (target_psoc_info == NULL) 1996 return 0; 1997 1998 return target_psoc_info->info.target_caps.fw_version; 1999 } 2000 2001 /** 2002 * target_if_get_wmi_fw_sub_feat_caps - FW sub feature capabilities 2003 * @target_psoc_info: pointer to structure target_psoc_info 2004 * 2005 * API to get FW sub feature capabilities from the target caps 2006 * 2007 * Return: int32_t 2008 */ 2009 static inline int32_t target_if_get_wmi_fw_sub_feat_caps 2010 (struct target_psoc_info *target_psoc_info) 2011 { 2012 if (target_psoc_info == NULL) 2013 return -EINVAL; 2014 2015 return target_psoc_info->info.target_caps.wmi_fw_sub_feat_caps; 2016 } 2017 2018 /** 2019 * target_if_get_conc_scan_config_bits - Default concurrenct scan config 2020 * @tgt_hdl: pointer to structure target_psoc_info 2021 * 2022 * API to get Default concurrenct scan config from the target caps 2023 * 2024 * Return: int32_t 2025 */ 2026 static inline int32_t target_if_get_conc_scan_config_bits 2027 (struct target_psoc_info *tgt_hdl) 2028 { 2029 if (tgt_hdl == NULL) 2030 return -EINVAL; 2031 2032 return tgt_hdl->info.service_ext_param.default_conc_scan_config_bits; 2033 } 2034 2035 /** 2036 * target_if_get_fw_config_bits - Default HW config bits 2037 * @tgt_hdl: pointer to structure target_psoc_info 2038 * 2039 * API to get Default HW config bits from the target caps 2040 * 2041 * Return: int32_t 2042 */ 2043 static inline int32_t target_if_get_fw_config_bits 2044 (struct target_psoc_info *tgt_hdl) 2045 { 2046 if (tgt_hdl == NULL) 2047 return -EINVAL; 2048 2049 return tgt_hdl->info.service_ext_param.default_fw_config_bits; 2050 } 2051 2052 /** 2053 * target_psoc_get_num_hw_modes - get number of dbs hardware modes 2054 * @tgt_hdl: pointer to structure target_psoc_info 2055 * 2056 * API to get Number of Dual Band Simultaneous (DBS) hardware modes 2057 * 2058 * Return: int32_t 2059 */ 2060 static inline int32_t target_psoc_get_num_hw_modes 2061 (struct target_psoc_info *tgt_hdl) 2062 { 2063 if (tgt_hdl == NULL) 2064 return -EINVAL; 2065 2066 return tgt_hdl->info.service_ext_param.num_hw_modes; 2067 } 2068 2069 /** 2070 * target_if_smart_log enable() - Enable Smart Logs 2071 * @psoc: psoc object 2072 * @tgt_hdl: target_psoc_info pointer 2073 * @evt_buf: Service ready Event buffer received from FW 2074 * 2075 * API to enable Smart Logs 2076 * 2077 * Return: none 2078 */ 2079 static inline void target_if_smart_log_enable 2080 (struct wlan_objmgr_psoc *psoc, 2081 struct target_psoc_info *tgt_hdl, 2082 uint8_t *evt_buf) 2083 { 2084 if ((tgt_hdl->tif_ops) && (tgt_hdl->tif_ops->smart_log_enable)) 2085 tgt_hdl->tif_ops->smart_log_enable(psoc, tgt_hdl, evt_buf); 2086 } 2087 #endif 2088 2089