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