1 /* 2 * Copyright (c) 2017-2021 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 * DOC: service_ready_util.h 20 * 21 * Public APIs to access (ext)service ready data from psoc object 22 */ 23 #ifndef _SERVICE_READY_UTIL_H_ 24 #define _SERVICE_READY_UTIL_H_ 25 26 #include "wlan_objmgr_psoc_obj.h" 27 #include "service_ready_param.h" 28 #include "target_if.h" 29 30 /** 31 * init_deinit_chainmask_table_alloc() 32 * - allocate chainmask table capability list. 33 * @service_ext_param: pointer to server ext param. 34 * 35 * Allocates capability list based on num_valid_chainmasks for that table. 36 * 37 * Return: QDF Status. 38 */ 39 QDF_STATUS init_deinit_chainmask_table_alloc( 40 struct wlan_psoc_host_service_ext_param *service_ext_param); 41 42 /** 43 * init_deinit_chainmask_table_free() 44 * -free chainmask table capability list. 45 * @service_ext_param: pointer to server ext param. 46 * 47 * free capability list based on num_valid_chainmasks for that table. 48 * 49 * Return: QDF Status. 50 */ 51 QDF_STATUS init_deinit_chainmask_table_free( 52 struct wlan_psoc_host_service_ext_param *service_ext_param); 53 54 /** 55 * init_deinit_populate_service_bitmap() - populate service bitmap 56 * @wmi_handle: wmi handle 57 * @event: event buffer received from FW 58 * @service_bitmap: service bitmap information 59 * 60 * API to populate service bit map 61 * 62 * Return: zero on successful population of service bitmap or failure flag 63 */ 64 int init_deinit_populate_service_bitmap( 65 wmi_unified_t wmi_handle, uint8_t *event, 66 uint32_t *service_bitmap); 67 68 /** 69 * init_deinit_populate_fw_version_cmd() - populate FW version 70 * @wmi_handle: wmi handle 71 * @event: event buffer received from FW 72 * 73 * API to populate FW version 74 * 75 * Return: zero on successful population of fw_version command or failure flag 76 */ 77 int 78 init_deinit_populate_fw_version_cmd(wmi_unified_t wmi_handle, uint8_t *event); 79 80 /** 81 * init_deinit_populate_target_cap() - populate target cap 82 * @wmi_handle: wmi handle 83 * @event: event buffer received from FW 84 * @cap: target capability info object 85 * 86 * API to populate target cap 87 * 88 * Return: zero on successful population of target cap or failure flag 89 */ 90 int init_deinit_populate_target_cap( 91 wmi_unified_t wmi_handle, uint8_t *event, 92 struct wlan_psoc_target_capability_info *cap); 93 94 /** 95 * init_deinit_populate_service_ready_ext_param() - populate service ready ext 96 * parameter 97 * @handle: WMI handle pointer 98 * @evt: event buffer received from FW 99 * @param: service ext param object 100 * 101 * API to populate service ready ext param 102 * 103 * Return: zero on successful parsing of service ready ext parameter or failure 104 */ 105 int init_deinit_populate_service_ready_ext_param( 106 wmi_unified_t handle, uint8_t *evt, 107 struct wlan_psoc_host_service_ext_param *param); 108 109 /** 110 * init_deinit_populate_service_ready_ext2_param() - populate service ready ext2 111 * parameter 112 * @handle: WMI handle pointer 113 * @evt: event buffer received from FW 114 * @info: Target info handle 115 * 116 * API to populate service ready ext2 param 117 * 118 * Return: zero on successful parsing of service ready ext parameter or failure 119 */ 120 int init_deinit_populate_service_ready_ext2_param( 121 wmi_unified_t handle, uint8_t *evt, 122 struct tgt_info *info); 123 124 /** 125 * init_deinit_populate_chainmask_tables() - populate chainmaks tables 126 * @handle: WMI handle pointer 127 * @evt: event buffer received from FW 128 * @param: chainmaks_table object 129 * 130 * API to populate chainmaks tables 131 * 132 * Return: zero on successful parsing of chainmaks tables or failure flag 133 */ 134 int init_deinit_populate_chainmask_tables( 135 wmi_unified_t handle, uint8_t *evt, 136 struct wlan_psoc_host_chainmask_table *param); 137 138 /** 139 * init_deinit_populate_mac_phy_capability() - populate mac phy capability 140 * @handle: WMI handle pointer 141 * @evt: event buffer received from FW 142 * @hw_cap: hw_mode_caps object 143 * @info: tgt_info object 144 * 145 * API to populate mac phy capability 146 * 147 * Return: zero on successful population of mac physical capability or failure 148 */ 149 int init_deinit_populate_mac_phy_capability( 150 wmi_unified_t handle, uint8_t *evt, 151 struct wlan_psoc_host_hw_mode_caps *hw_cap, struct tgt_info *info); 152 153 /** 154 * init_deinit_populate_hw_mode_capability() - populate hw mode capability 155 * @wmi_handle: WMI handle pointer 156 * @event: event buffer received from FW 157 * @tgt_hdl: target_psoc_info object 158 * 159 * API to populate hw mode capability 160 * 161 * Return: zero on successful parsing of hw mode capability or failure 162 */ 163 int init_deinit_populate_hw_mode_capability( 164 wmi_unified_t wmi_handle, 165 uint8_t *event, struct target_psoc_info *tgt_hdl); 166 167 /** 168 * init_deinit_populate_dbr_ring_cap() - populate dbr ring capability 169 * @psoc: PSOC object 170 * @handle: WMI handle pointer 171 * @event: event buffer received from FW 172 * @info: tgt_info object 173 * 174 * API to populate dbr ring capability 175 * 176 * Return: zero on successful parsing of dbr ring capability or failure 177 */ 178 int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc, 179 wmi_unified_t handle, uint8_t *event, 180 struct tgt_info *info); 181 182 /** 183 * init_deinit_populate_dbr_ring_cap_ext2() - populate dbr ring capability 184 * from ext2 event 185 * @psoc: PSOC object 186 * @handle: WMI handle pointer 187 * @event: event buffer received from FW 188 * @info: tgt_info object 189 * 190 * API to populate dbr ring capability 191 * 192 * Return: zero on successful parsing of dbr ring capability or failure 193 */ 194 int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc, 195 wmi_unified_t handle, uint8_t *event, 196 struct tgt_info *info); 197 198 /** 199 * init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling 200 * @psoc: PSOC object 201 * @handle: WMI handle pointer 202 * @event: event buffer received from FW 203 * @info: tgt_info object 204 * 205 * API to populate Spectral bin scaling parameters 206 * 207 * Return: zero on successful parsing of scaling params or failure 208 */ 209 int init_deinit_populate_spectral_bin_scale_params( 210 struct wlan_objmgr_psoc *psoc, 211 wmi_unified_t handle, uint8_t *event, 212 struct tgt_info *info); 213 214 /** 215 * init_deinit_dbr_ring_cap_free() - free dbr ring capability 216 * @tgt_psoc_info: target psoc info object 217 * 218 * API to free dbr ring capability 219 * 220 * Return: QDF_STATUS 221 */ 222 QDF_STATUS init_deinit_dbr_ring_cap_free( 223 struct target_psoc_info *tgt_psoc_info); 224 225 /** 226 * init_deinit_scan_radio_cap_free() - free scan radio capability 227 * @tgt_psoc_info: target psoc info object 228 * 229 * API to free scan radio related capability information. 230 * 231 * Return: QDF_STATUS 232 */ 233 QDF_STATUS init_deinit_scan_radio_cap_free( 234 struct target_psoc_info *tgt_psoc_info); 235 236 /** 237 * init_deinit_spectral_scaling_params_free() - free Spectral scaling params 238 * @tgt_psoc_info: target psoc info object 239 * 240 * API to free Spectral scaling params 241 * 242 * Return: QDF_STATUS 243 */ 244 QDF_STATUS init_deinit_spectral_scaling_params_free( 245 struct target_psoc_info *tgt_psoc_info); 246 247 /** 248 * init_deinit_populate_phy_reg_cap() - populate phy reg capability 249 * @psoc: PSOC object 250 * @wmi_handle: WMI handle pointer 251 * @event: event buffer received from FW 252 * @info: tgt_info object 253 * @service_ready: service ready determiner 254 * 255 * API to populate phy reg capability 256 * 257 * Return: zero on successful parsing of physical reg capability or failure flag 258 */ 259 int init_deinit_populate_phy_reg_cap(struct wlan_objmgr_psoc *psoc, 260 wmi_unified_t wmi_handle, uint8_t *event, 261 struct tgt_info *info, 262 bool service_ready); 263 264 /** 265 * init_deinit_populate_hal_reg_cap_ext2() - Populate HAL reg capabilities from 266 * service ready ext2 event. 267 * @handle: WMI handle pointer 268 * @event: event buffer received from FW 269 * @info: tgt_info object 270 * 271 * API to populate HAL reg capabilities from service ready ext2 event. 272 * 273 * Return: zero on successful parsing of physical reg capability or failure flag 274 */ 275 int init_deinit_populate_hal_reg_cap_ext2(wmi_unified_t handle, uint8_t *event, 276 struct tgt_info *info); 277 278 /** 279 * init_deinit_populate_mac_phy_cap_ext2() - populate mac phy capabilities from 280 * service ready ext2 event 281 * @handle: WMI handle pointer 282 * @event: event buffer received from FW 283 * @info: tgt_info object 284 * 285 * API to populate mac phy capability from service ready ext2 event. 286 * 287 * Return: zero on successful population of mac physical capability or failure 288 */ 289 int init_deinit_populate_mac_phy_cap_ext2(wmi_unified_t handle, uint8_t *event, 290 struct tgt_info *info); 291 292 /** 293 * init_deinit_populate_scan_radio_cap_ext2() - populate scan radio capabilities 294 * from service ready ext2 event 295 * @handle: WMI handle pointer 296 * @event: event buffer received from FW 297 * @info: tgt_info object 298 * 299 * API to populate scan radio capability from service ready ext2 event. 300 * 301 * Return: zero on successful population of scan radio or failure 302 */ 303 int init_deinit_populate_scan_radio_cap_ext2(wmi_unified_t handle, 304 uint8_t *event, 305 struct tgt_info *info); 306 307 #ifdef WLAN_SUPPORT_TWT 308 /** 309 * init_deinit_populate_twt_cap_ext2() - populate twt capabilities from service 310 * ready ext2 event 311 * @psoc: PSOC object 312 * @handle: WMI handle pointer 313 * @event: event buffer received from FW 314 * @info: tgt_info object 315 * 316 * API to populate twt capability from service ready ext2 event. 317 * Return: zero on successful population of twt capability or failure 318 */ 319 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 320 wmi_unified_t handle, uint8_t *event, 321 struct tgt_info *info); 322 #else 323 static inline 324 int init_deinit_populate_twt_cap_ext2(struct wlan_objmgr_psoc *psoc, 325 wmi_unified_t handle, uint8_t *event, 326 struct tgt_info *info) 327 { 328 return 0; 329 } 330 #endif 331 332 /** 333 * init_deinit_populate_dbs_or_sbs_cap_ext2() - populate dbs or sbs capability 334 * from service ready ext2 event 335 * 336 * @psoc: PSOC object 337 * @handle: WMI handle pointer 338 * @event: event buffer received from FW 339 * @info: tgt_info object 340 * 341 * API to populate dbs or sbs capability from service ready ext2 event. 342 * Return: zero on successful dbs or sbs capability or failure 343 */ 344 int init_deinit_populate_dbs_or_sbs_cap_ext2(struct wlan_objmgr_psoc *psoc, 345 wmi_unified_t handle, 346 uint8_t *event, 347 struct tgt_info *info); 348 349 /** 350 * init_deinit_validate_160_80p80_fw_caps() - validate 160 80p80 fw caps 351 * @psoc: PSOC object 352 * @tgt_info: target_psoc_info object 353 * 354 * API to validate 160 80p80 fw caps 355 * 356 * Return: SUCCESS on successful validation of 160 80p80 forward caps or Failure 357 */ 358 QDF_STATUS init_deinit_validate_160_80p80_fw_caps( 359 struct wlan_objmgr_psoc *psoc, 360 struct target_psoc_info *tgt_info); 361 362 /** 363 * init_deinit_chainmask_config() - config chainmask 364 * @psoc: PSOC object 365 * @tgt_info: target_psoc_info object 366 * 367 * API to config chainmask 368 * 369 * Return: none 370 */ 371 void init_deinit_chainmask_config( 372 struct wlan_objmgr_psoc *psoc, 373 struct target_psoc_info *tgt_info); 374 375 /** 376 * init_deinit_is_service_ext_msg() - check service ext message 377 * @psoc: PSOC object 378 * @tgt_info: target_psoc_info object 379 * 380 * API to check whether service ext message is enabled 381 * 382 * Return: SUCCESS on successful check of service_ext message or Failure 383 */ 384 QDF_STATUS init_deinit_is_service_ext_msg( 385 struct wlan_objmgr_psoc *psoc, 386 struct target_psoc_info *tgt_info); 387 /** 388 * init_deinit_is_preferred_hw_mode_supported() - check support of preferred 389 * hw mode 390 * @psoc: PSOC object 391 * @tgt_info: target_psoc_info object 392 * 393 * API to check whether preferred hardware mode is enabled 394 * 395 * Return: True on support of preferred hardware support or False 396 */ 397 bool init_deinit_is_preferred_hw_mode_supported( 398 struct wlan_objmgr_psoc *psoc, 399 struct target_psoc_info *tgt_info); 400 401 /** 402 * init_deinit_wakeup_host_wait() - wakeup host wait 403 * @psoc: PSOC object 404 * @tgt_info: target_psoc_info object 405 * 406 * API to wakeup FW ready wait queue 407 * 408 * Return: None 409 */ 410 void init_deinit_wakeup_host_wait( 411 struct wlan_objmgr_psoc *psoc, 412 struct target_psoc_info *tgt_info); 413 414 #endif /* _SERVICE_READY_UTIL_H_*/ 415