Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 29 | * This file contains the API definitions for the Unified Wireless Module |
| 30 | * Interface (WMI). |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #ifndef _WMI_UNIFIED_API_H_ |
| 34 | #define _WMI_UNIFIED_API_H_ |
| 35 | |
| 36 | #include <osdep.h> |
| 37 | #include "a_types.h" |
| 38 | #include "ol_defines.h" |
| 39 | #include "wmi.h" |
| 40 | #include "htc_api.h" |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 41 | #include "wmi_unified_param.h" |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 42 | |
| 43 | typedef cdf_nbuf_t wmi_buf_t; |
| 44 | #define wmi_buf_data(_buf) cdf_nbuf_data(_buf) |
| 45 | |
| 46 | /** |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 47 | * struct wmi_ops - service callbacks to upper layer |
| 48 | * @service_ready_cbk: service ready callback |
| 49 | * @service_ready_ext_cbk: service ready ext callback |
| 50 | * @ready_cbk: ready calback |
| 51 | * @wma_process_fw_event_handler_cbk: generic event handler callback |
| 52 | */ |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 53 | struct wmi_rx_ops { |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 54 | |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 55 | int (*wma_process_fw_event_handler_cbk)(void *ctx, |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 56 | void *ev, uint8_t rx_ctx); |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | /** |
| 60 | * enum wmi_target_type - type of supported wmi command |
| 61 | * @WMI_TLV_TARGET: tlv based target |
| 62 | * @WMI_NON_TLV_TARGET: non-tlv based target |
| 63 | * |
| 64 | */ |
| 65 | enum wmi_target_type { |
| 66 | WMI_TLV_TARGET, |
| 67 | WMI_NON_TLV_TARGET |
| 68 | }; |
| 69 | |
| 70 | /** |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 71 | * enum wmi_rx_exec_ctx - wmi rx execution context |
| 72 | * @WMI_RX_WORK_CTX: work queue context execution provided by WMI layer |
| 73 | * @WMI_RX_UMAC_CTX: execution context provided by umac layer |
| 74 | * |
| 75 | */ |
| 76 | enum wmi_rx_exec_ctx { |
| 77 | WMI_RX_WORK_CTX, |
| 78 | WMI_RX_UMAC_CTX |
| 79 | }; |
| 80 | |
| 81 | /** |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 82 | * attach for unified WMI |
| 83 | * |
| 84 | * @param scn_handle : handle to SCN. |
| 85 | * @return opaque handle. |
| 86 | */ |
| 87 | void *wmi_unified_attach(void *scn_handle, |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 88 | osdev_t osdev, enum wmi_target_type target_type, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 89 | bool use_cookie, struct wmi_rx_ops *ops); |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 90 | |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 91 | /** |
| 92 | * detach for unified WMI |
| 93 | * |
| 94 | * @param wmi_handle : handle to WMI. |
| 95 | * @return void. |
| 96 | */ |
| 97 | void wmi_unified_detach(struct wmi_unified *wmi_handle); |
| 98 | |
| 99 | void |
| 100 | wmi_unified_remove_work(struct wmi_unified *wmi_handle); |
| 101 | |
| 102 | /** |
| 103 | * generic function to allocate WMI buffer |
| 104 | * |
| 105 | * @param wmi_handle : handle to WMI. |
| 106 | * @param len : length of the buffer |
| 107 | * @return wmi_buf_t. |
| 108 | */ |
| 109 | #ifdef MEMORY_DEBUG |
| 110 | #define wmi_buf_alloc(h, l) wmi_buf_alloc_debug(h, l, __FILE__, __LINE__) |
| 111 | wmi_buf_t |
| 112 | wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint16_t len, |
| 113 | uint8_t *file_name, uint32_t line_num); |
| 114 | #else |
| 115 | wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint16_t len); |
| 116 | #endif |
| 117 | |
| 118 | /** |
| 119 | * generic function frees WMI net buffer |
| 120 | * |
| 121 | * @param net_buf : Pointer ot net_buf to be freed |
| 122 | */ |
| 123 | void wmi_buf_free(wmi_buf_t net_buf); |
| 124 | |
| 125 | /** |
| 126 | * generic function to send unified WMI command |
| 127 | * |
| 128 | * @param wmi_handle : handle to WMI. |
| 129 | * @param buf : wmi command buffer |
| 130 | * @param buflen : wmi command buffer length |
| 131 | * @return 0 on success and -ve on failure. |
| 132 | */ |
| 133 | int |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 134 | wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t buflen, |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 135 | WMI_CMD_ID cmd_id); |
| 136 | |
| 137 | /** |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 138 | * wmi_unified_register_event_handler() - WMI event handler |
| 139 | * registration function |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 140 | * |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 141 | * @wmi_handle: handle to WMI. |
| 142 | * @event_id: WMI event ID |
| 143 | * @handler_func: Event handler call back function |
| 144 | * @rx_ctx: rx event processing context |
| 145 | * |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 146 | * @return 0 on success and -ve on failure. |
| 147 | */ |
| 148 | int |
| 149 | wmi_unified_register_event_handler(wmi_unified_t wmi_handle, |
| 150 | WMI_EVT_ID event_id, |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 151 | wmi_unified_event_handler handler_func, |
| 152 | uint8_t rx_ctx); |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * WMI event handler unregister function |
| 156 | * |
| 157 | * @param wmi_handle : handle to WMI. |
| 158 | * @param event_id : WMI event ID |
| 159 | * @return 0 on success and -ve on failure. |
| 160 | */ |
| 161 | int |
| 162 | wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle, |
| 163 | WMI_EVT_ID event_id); |
| 164 | |
| 165 | /** |
| 166 | * request wmi to connet its htc service. |
| 167 | * @param wmi_handle : handle to WMI. |
| 168 | * @return void |
| 169 | */ |
| 170 | int |
| 171 | wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle, |
| 172 | void *htc_handle); |
| 173 | |
| 174 | /* |
| 175 | * WMI API to verify the host has enough credits to suspend |
| 176 | */ |
| 177 | |
| 178 | int wmi_is_suspend_ready(wmi_unified_t wmi_handle); |
| 179 | |
| 180 | /** |
| 181 | WMI API to get updated host_credits |
| 182 | */ |
| 183 | |
| 184 | int wmi_get_host_credits(wmi_unified_t wmi_handle); |
| 185 | |
| 186 | /** |
| 187 | WMI API to get WMI Pending Commands in the HTC queue |
| 188 | */ |
| 189 | |
| 190 | int wmi_get_pending_cmds(wmi_unified_t wmi_handle); |
| 191 | |
| 192 | /** |
| 193 | WMI API to set target suspend state |
| 194 | */ |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 195 | void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val); |
| 196 | |
| 197 | #ifdef FEATURE_RUNTIME_PM |
| 198 | void |
| 199 | wmi_set_runtime_pm_inprogress(wmi_unified_t wmi_handle, bool val); |
| 200 | bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle); |
| 201 | #else |
| 202 | static inline void |
| 203 | wmi_set_runtime_pm_inprogress(wmi_unified_t wmi_handle, bool val) |
| 204 | { |
| 205 | return; |
| 206 | } |
| 207 | static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle) |
| 208 | { |
| 209 | return false; |
| 210 | } |
| 211 | #endif |
| 212 | |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 213 | |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 214 | /** |
| 215 | * WMA Callback to process fw event. |
| 216 | */ |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 217 | void wmi_process_fw_event(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf); |
| 218 | uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle); |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 219 | |
| 220 | |
| 221 | int32_t wmi_unified_vdev_create_send(void *wmi_hdl, |
| 222 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 223 | struct vdev_create_params *param); |
| 224 | |
| 225 | int32_t wmi_unified_vdev_delete_send(void *wmi_hdl, |
| 226 | uint8_t if_id); |
| 227 | |
| 228 | int32_t wmi_unified_vdev_start_send(void *wmi_hdl, |
| 229 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 230 | struct vdev_start_params *param); |
| 231 | |
| 232 | int32_t wmi_unified_vdev_restart_send(void *wmi_hdl, |
| 233 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 234 | struct vdev_start_params *param); |
| 235 | |
| 236 | int32_t wmi_unified_vdev_stop_send(void *wmi_hdl, |
| 237 | uint8_t vdev_id); |
| 238 | |
| 239 | int32_t wmi_unified_vdev_up_send(void *wmi_hdl, |
| 240 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 241 | struct vdev_up_params *params); |
| 242 | |
| 243 | int32_t wmi_unified_vdev_down_send(void *wmi_hdl, |
| 244 | uint8_t vdev_id); |
| 245 | |
| 246 | int32_t wmi_unified_vdev_set_param_send(void *wmi_hdl, |
| 247 | struct vdev_set_params *param); |
| 248 | |
| 249 | int32_t wmi_unified_peer_delete_send(void *wmi_hdl, |
| 250 | uint8_t |
| 251 | peer_addr[IEEE80211_ADDR_LEN], |
| 252 | uint8_t vdev_id); |
| 253 | |
| 254 | int32_t wmi_unified_peer_flush_tids_send(void *wmi_hdl, |
| 255 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 256 | struct peer_flush_params *param); |
| 257 | |
| 258 | int32_t wmi_set_peer_param_send(void *wmi_hdl, |
| 259 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 260 | struct peer_set_params *param); |
| 261 | |
| 262 | int32_t wmi_unified_peer_create_send(void *wmi_hdl, |
| 263 | struct peer_create_params *param); |
| 264 | |
| 265 | int32_t wmi_unified_stats_request_send(void *wmi_hdl, |
| 266 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 267 | struct stats_request_params *param); |
| 268 | |
| 269 | int32_t wmi_unified_green_ap_ps_send(void *wmi_hdl, |
| 270 | uint32_t value, uint8_t mac_id); |
| 271 | |
| 272 | |
| 273 | int32_t wmi_unified_wow_enable_send(void *wmi_hdl, |
| 274 | struct wow_cmd_params *param, |
| 275 | uint8_t mac_id); |
| 276 | |
| 277 | int32_t wmi_unified_packet_log_enable_send(void *wmi_hdl, |
| 278 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 279 | struct packet_enable_params *param); |
| 280 | |
| 281 | |
| 282 | int32_t wmi_unified_suspend_send(void *wmi_hdl, |
| 283 | struct suspend_params *param, |
| 284 | uint8_t mac_id); |
| 285 | |
| 286 | int32_t wmi_unified_resume_send(void *wmi_hdl, |
| 287 | uint8_t mac_id); |
| 288 | |
| 289 | int32_t |
| 290 | wmi_unified_pdev_param_send(void *wmi_hdl, |
| 291 | struct pdev_params *param, |
| 292 | uint8_t mac_id); |
| 293 | |
| 294 | int32_t wmi_unified_beacon_send_cmd(void *wmi_hdl, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 295 | struct beacon_params *param); |
| 296 | |
| 297 | int32_t wmi_unified_peer_assoc_send(void *wmi_hdl, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 298 | struct peer_assoc_params *param); |
| 299 | |
| 300 | int32_t wmi_unified_sta_ps_cmd_send(void *wmi_hdl, |
| 301 | struct sta_ps_params *param); |
| 302 | |
| 303 | int32_t wmi_unified_ap_ps_cmd_send(void *wmi_hdl, |
| 304 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 305 | struct ap_ps_params *param); |
| 306 | |
| 307 | int32_t wmi_unified_scan_start_cmd_send(void *wmi_hdl, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 308 | struct scan_start_params *param); |
| 309 | |
| 310 | int32_t wmi_unified_scan_stop_cmd_send(void *wmi_hdl, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 311 | struct scan_stop_params *param); |
| 312 | |
| 313 | int32_t wmi_unified_scan_chan_list_cmd_send(void *wmi_hdl, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 314 | struct scan_chan_list_params *param); |
| 315 | |
| 316 | |
| 317 | int32_t wmi_crash_inject(void *wmi_hdl, |
| 318 | struct crash_inject *param); |
| 319 | |
| 320 | int32_t wmi_unified_pdev_utf_cmd_send(void *wmi_hdl, |
| 321 | struct pdev_utf_params *param, |
| 322 | uint8_t mac_id); |
| 323 | |
| 324 | int32_t wmi_unified_dbglog_cmd_send(void *wmi_hdl, |
| 325 | struct dbglog_params *param); |
| 326 | |
Govind Singh | 50988cc | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 327 | int32_t wmi_mgmt_unified_cmd_send(void *wmi_hdl, |
| 328 | struct wmi_mgmt_params *param); |
| 329 | |
| 330 | int32_t wmi_unified_modem_power_state(void *wmi_hdl, |
| 331 | uint32_t param_value); |
| 332 | |
| 333 | int32_t wmi_unified_set_sta_ps_mode(void *wmi_hdl, |
| 334 | uint32_t vdev_id, uint8_t val); |
| 335 | int32_t |
| 336 | wmi_unified_set_sta_uapsd_auto_trig_cmd(void *wmi_hdl, |
| 337 | struct sta_uapsd_trig_params *param); |
| 338 | |
| 339 | int32_t wmi_unified_get_temperature(void *wmi_hdl); |
| 340 | |
| 341 | int32_t wmi_unified_set_p2pgo_oppps_req(void *wmi_hdl, |
| 342 | struct p2p_ps_params *oppps); |
| 343 | |
| 344 | int32_t wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl, |
| 345 | struct p2p_ps_params *noa); |
| 346 | |
| 347 | int32_t wmi_unified_set_smps_params(void *wmi_hdl, uint8_t vdev_id, |
| 348 | int value); |
| 349 | |
| 350 | int32_t wmi_unified_set_mimops(void *wmi_hdl, uint8_t vdev_id, int value); |
Govind Singh | e7b800c | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 351 | |
| 352 | int32_t wmi_unified_ocb_set_utc_time(void *wmi_hdl, |
| 353 | struct ocb_utc_param *utc); |
| 354 | |
| 355 | int32_t wmi_unified_ocb_start_timing_advert(void *wmi_hdl, |
| 356 | struct ocb_timing_advert_param *timing_advert); |
| 357 | |
| 358 | int32_t wmi_unified_ocb_stop_timing_advert(void *wmi_hdl, |
| 359 | struct ocb_timing_advert_param *timing_advert); |
| 360 | |
| 361 | int32_t wmi_unified_ocb_set_config(void *wmi_hdl, |
| 362 | struct ocb_config_param *config, uint32_t *ch_mhz); |
| 363 | |
| 364 | int32_t wmi_unified_ocb_get_tsf_timer(void *wmi_hdl, |
| 365 | uint8_t vdev_id); |
| 366 | |
| 367 | int wmi_unified_ocb_start_timing_advert(void *wmi_hdl, |
| 368 | struct ocb_timing_advert_param *timing_advert); |
| 369 | |
Govind Singh | 9bad000 | 2016-03-01 15:54:59 +0530 | [diff] [blame^] | 370 | int32_t wmi_unified_lro_config_cmd(void *wmi_hdl, |
| 371 | struct wmi_lro_config_cmd_t *wmi_lro_cmd); |
| 372 | |
| 373 | int32_t wmi_unified_set_thermal_mgmt_cmd(void *wmi_hdl, |
| 374 | struct thermal_cmd_params *thermal_info); |
| 375 | |
| 376 | int32_t wmi_unified_set_mcc_channel_time_quota_cmd |
| 377 | (void *wmi_hdl, |
| 378 | uint32_t adapter_1_chan_freq, |
| 379 | uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq); |
| 380 | |
| 381 | int32_t wmi_unified_set_mcc_channel_time_latency_cmd |
| 382 | (void *wmi_hdl, |
| 383 | uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency); |
| 384 | |
| 385 | int32_t wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd( |
| 386 | void *wmi_hdl, uint32_t mcc_adaptive_scheduler); |
Govind Singh | e7b800c | 2016-03-01 15:30:53 +0530 | [diff] [blame] | 387 | int32_t wmi_unified_ocb_set_utc_time_cmd(void *wmi_hdl, |
| 388 | struct ocb_utc_param *utc); |
| 389 | int32_t wmi_unified_dcc_get_stats_cmd(void *wmi_hdl, |
| 390 | struct dcc_get_stats_param *get_stats_param); |
| 391 | int32_t wmi_unified_dcc_clear_stats(void *wmi_hdl, |
| 392 | uint32_t vdev_id, uint32_t dcc_stats_bitmap); |
| 393 | int32_t wmi_unified_dcc_update_ndl(void *wmi_hdl, |
| 394 | struct dcc_update_ndl_param *update_ndl_param); |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 395 | #endif /* _WMI_UNIFIED_API_H_ */ |