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