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