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 | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 29 | * This file contains the API definitions for the Unified Wireless |
| 30 | * Module Interface (WMI). |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 31 | */ |
| 32 | #ifndef _WMI_UNIFIED_PRIV_H_ |
| 33 | #define _WMI_UNIFIED_PRIV_H_ |
| 34 | #include <osdep.h> |
| 35 | #include "a_types.h" |
| 36 | #include "wmi.h" |
| 37 | #include "wmi_unified.h" |
| 38 | #include "cdf_atomic.h" |
| 39 | |
| 40 | #define WMI_UNIFIED_MAX_EVENT 0x100 |
| 41 | #define WMI_MAX_CMDS 1024 |
| 42 | |
| 43 | typedef cdf_nbuf_t wmi_buf_t; |
| 44 | |
| 45 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 46 | |
| 47 | #define WMI_EVENT_DEBUG_MAX_ENTRY (1024) |
| 48 | |
| 49 | struct wmi_command_debug { |
| 50 | uint32_t command; |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 51 | uint32_t data[4]; /*16 bytes of WMI cmd excluding TLV and WMI headers */ |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 52 | uint64_t time; |
| 53 | }; |
| 54 | |
| 55 | struct wmi_event_debug { |
| 56 | uint32_t event; |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 57 | uint32_t data[4]; /*16 bytes of WMI event data excluding TLV header */ |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 58 | uint64_t time; |
| 59 | }; |
| 60 | |
| 61 | #endif /*WMI_INTERFACE_EVENT_LOGGING */ |
| 62 | |
| 63 | #ifdef WLAN_OPEN_SOURCE |
| 64 | struct fwdebug { |
| 65 | struct sk_buff_head fwlog_queue; |
| 66 | struct completion fwlog_completion; |
| 67 | A_BOOL fwlog_open; |
| 68 | }; |
| 69 | #endif /* WLAN_OPEN_SOURCE */ |
| 70 | |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 71 | struct wmi_ops { |
| 72 | int32_t (*send_vdev_create_cmd)(wmi_unified_t wmi_handle, |
| 73 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 74 | struct vdev_create_params *param); |
| 75 | |
| 76 | int32_t (*send_vdev_delete_cmd)(wmi_unified_t wmi_handle, |
| 77 | uint8_t if_id); |
| 78 | |
| 79 | int32_t (*send_vdev_stop_cmd)(wmi_unified_t wmi, |
| 80 | uint8_t vdev_id); |
| 81 | |
| 82 | int32_t (*send_vdev_down_cmd)(wmi_unified_t wmi, |
| 83 | uint8_t vdev_id); |
| 84 | |
| 85 | int32_t (*send_peer_flush_tids_cmd)(wmi_unified_t wmi, |
| 86 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 87 | struct peer_flush_params *param); |
| 88 | |
| 89 | int32_t (*send_peer_delete_cmd)(wmi_unified_t wmi, |
| 90 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 91 | uint8_t vdev_id); |
| 92 | |
| 93 | int32_t (*send_peer_param_cmd)(wmi_unified_t wmi, |
| 94 | uint8_t peer_addr[IEEE80211_ADDR_LEN], |
| 95 | struct peer_set_params *param); |
| 96 | |
| 97 | int32_t (*send_vdev_up_cmd)(wmi_unified_t wmi, |
| 98 | uint8_t bssid[IEEE80211_ADDR_LEN], |
| 99 | struct vdev_up_params *params); |
| 100 | |
| 101 | int32_t (*send_peer_create_cmd)(wmi_unified_t wmi, |
| 102 | struct peer_create_params *param); |
| 103 | |
| 104 | int32_t (*send_green_ap_ps_cmd)(wmi_unified_t wmi_handle, |
| 105 | uint32_t value, uint8_t mac_id); |
| 106 | |
| 107 | int32_t |
| 108 | (*send_pdev_utf_cmd)(wmi_unified_t wmi_handle, |
| 109 | struct pdev_utf_params *param, |
| 110 | uint8_t mac_id); |
| 111 | |
| 112 | int32_t |
| 113 | (*send_pdev_param_cmd)(wmi_unified_t wmi_handle, |
| 114 | struct pdev_params *param, |
| 115 | uint8_t mac_id); |
| 116 | |
| 117 | int32_t (*send_suspend_cmd)(wmi_unified_t wmi_handle, |
| 118 | struct suspend_params *param, |
| 119 | uint8_t mac_id); |
| 120 | |
| 121 | int32_t (*send_resume_cmd)(wmi_unified_t wmi_handle, |
| 122 | uint8_t mac_id); |
| 123 | |
| 124 | int32_t (*send_wow_enable_cmd)(wmi_unified_t wmi_handle, |
| 125 | struct wow_cmd_params *param, |
| 126 | uint8_t mac_id); |
| 127 | |
| 128 | int32_t (*send_set_ap_ps_param_cmd)(wmi_unified_t wmi_handle, |
| 129 | uint8_t *peer_addr, |
| 130 | struct ap_ps_params *param); |
| 131 | |
| 132 | int32_t (*send_set_sta_ps_param_cmd)(wmi_unified_t wmi_handle, |
| 133 | struct sta_ps_params *param); |
| 134 | |
| 135 | int32_t (*send_crash_inject_cmd)(wmi_unified_t wmi_handle, |
| 136 | struct crash_inject *param); |
| 137 | |
| 138 | int32_t |
| 139 | (*send_dbglog_cmd)(wmi_unified_t wmi_handle, |
| 140 | struct dbglog_params *dbglog_param); |
| 141 | |
| 142 | int32_t (*send_vdev_set_param_cmd)(wmi_unified_t wmi_handle, |
| 143 | struct vdev_set_params *param); |
| 144 | |
| 145 | int32_t (*send_stats_request_cmd)(wmi_unified_t wmi_handle, |
| 146 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 147 | struct stats_request_params *param); |
| 148 | |
| 149 | int32_t (*send_packet_log_enable_cmd)(wmi_unified_t wmi_handle, |
| 150 | uint8_t macaddr[IEEE80211_ADDR_LEN], |
| 151 | struct packet_enable_params *param); |
| 152 | |
| 153 | int32_t (*send_beacon_send_cmd)(wmi_unified_t wmi_handle, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 154 | struct beacon_params *param); |
| 155 | |
| 156 | int32_t (*send_peer_assoc_cmd)(wmi_unified_t wmi_handle, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 157 | struct peer_assoc_params *param); |
| 158 | |
| 159 | int32_t (*send_scan_start_cmd)(wmi_unified_t wmi_handle, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 160 | struct scan_start_params *param); |
| 161 | |
| 162 | int32_t (*send_scan_stop_cmd)(wmi_unified_t wmi_handle, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 163 | struct scan_stop_params *param); |
| 164 | |
| 165 | int32_t (*send_scan_chan_list_cmd)(wmi_unified_t wmi_handle, |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 166 | struct scan_chan_list_params *param); |
Govind Singh | 50988cc | 2016-02-26 18:09:36 +0530 | [diff] [blame] | 167 | |
| 168 | int32_t (*send_mgmt_cmd)(wmi_unified_t wmi_handle, |
| 169 | struct wmi_mgmt_params *param); |
| 170 | |
| 171 | int32_t (*send_modem_power_state_cmd)(wmi_unified_t wmi_handle, |
| 172 | uint32_t param_value); |
| 173 | |
| 174 | int32_t (*send_set_sta_ps_mode_cmd)(wmi_unified_t wmi_handle, |
| 175 | uint32_t vdev_id, uint8_t val); |
| 176 | |
| 177 | int32_t (*send_get_temperature_cmd)(wmi_unified_t wmi_handle); |
| 178 | |
| 179 | int32_t (*send_set_p2pgo_oppps_req_cmd)(wmi_unified_t wmi_handle, |
| 180 | struct p2p_ps_params *oppps); |
| 181 | |
| 182 | int32_t (*send_set_p2pgo_noa_req_cmd)(wmi_unified_t wmi_handle, |
| 183 | struct p2p_ps_params *noa); |
| 184 | |
| 185 | int32_t (*send_set_smps_params_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id, |
| 186 | int value); |
| 187 | |
| 188 | int32_t (*send_set_mimops_cmd)(wmi_unified_t wmi_handle, |
| 189 | uint8_t vdev_id, int value); |
| 190 | |
| 191 | int32_t (*send_set_sta_uapsd_auto_trig_cmd)(wmi_unified_t wmi_handle, |
| 192 | struct sta_uapsd_trig_params *param); |
Govind Singh | e7b800c | 2016-03-01 15:30:53 +0530 | [diff] [blame^] | 193 | |
| 194 | int32_t (*send_ocb_set_utc_time_cmd)(wmi_unified_t wmi_handle, |
| 195 | struct ocb_utc_param *utc); |
| 196 | |
| 197 | int32_t (*send_ocb_get_tsf_timer_cmd)(wmi_unified_t wmi_handle, |
| 198 | uint8_t vdev_id); |
| 199 | |
| 200 | int32_t (*send_ocb_start_timing_advert_cmd)(wmi_unified_t wmi_handle, |
| 201 | struct ocb_timing_advert_param *timing_advert); |
| 202 | |
| 203 | int32_t (*send_ocb_stop_timing_advert_cmd)(wmi_unified_t wmi_handle, |
| 204 | struct ocb_timing_advert_param *timing_advert); |
| 205 | |
| 206 | int32_t (*send_dcc_get_stats_cmd)(wmi_unified_t wmi_handle, |
| 207 | struct dcc_get_stats_param *get_stats_param); |
| 208 | |
| 209 | int32_t (*send_dcc_clear_stats_cmd)(wmi_unified_t wmi_handle, |
| 210 | uint32_t vdev_id, uint32_t dcc_stats_bitmap); |
| 211 | |
| 212 | int32_t (*send_dcc_update_ndl_cmd)(wmi_unified_t wmi_handle, |
| 213 | struct dcc_update_ndl_param *update_ndl_param); |
| 214 | |
| 215 | int32_t (*send_ocb_set_config_cmd)(wmi_unified_t wmi_handle, |
| 216 | struct ocb_config_param *config, uint32_t *ch_mhz); |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 217 | }; |
| 218 | |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 219 | struct wmi_unified { |
| 220 | ol_scn_t scn_handle; /* handle to device */ |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 221 | osdev_t osdev; /* handle to use OS-independent services */ |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 222 | cdf_atomic_t pending_cmds; |
| 223 | HTC_ENDPOINT_ID wmi_endpoint_id; |
| 224 | uint16_t max_msg_len; |
| 225 | WMI_EVT_ID event_id[WMI_UNIFIED_MAX_EVENT]; |
| 226 | wmi_unified_event_handler event_handler[WMI_UNIFIED_MAX_EVENT]; |
Govind Singh | 4ec6ff9 | 2016-03-09 12:03:29 +0530 | [diff] [blame] | 227 | enum wmi_rx_exec_ctx ctx[WMI_UNIFIED_MAX_EVENT]; |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 228 | uint32_t max_event_idx; |
| 229 | void *htc_handle; |
| 230 | cdf_spinlock_t eventq_lock; |
| 231 | cdf_nbuf_queue_t event_queue; |
| 232 | struct work_struct rx_event_work; |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 233 | int wmi_stop_in_progress; |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 234 | #ifdef WLAN_OPEN_SOURCE |
| 235 | struct fwdebug dbglog; |
| 236 | struct dentry *debugfs_phy; |
| 237 | #endif /* WLAN_OPEN_SOURCE */ |
| 238 | |
| 239 | #ifdef WMI_INTERFACE_EVENT_LOGGING |
| 240 | cdf_spinlock_t wmi_record_lock; |
| 241 | #endif /*WMI_INTERFACE_EVENT_LOGGING */ |
| 242 | |
| 243 | cdf_atomic_t is_target_suspended; |
| 244 | |
| 245 | #ifdef FEATURE_RUNTIME_PM |
| 246 | cdf_atomic_t runtime_pm_inprogress; |
| 247 | #endif |
| 248 | |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 249 | struct wmi_rx_ops rx_ops; |
| 250 | struct wmi_ops *ops; |
Govind Singh | 6ad6ada | 2016-02-04 18:42:30 +0530 | [diff] [blame] | 251 | void *event_handler_cookie[WMI_UNIFIED_MAX_EVENT]; |
| 252 | bool use_cookie; |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 253 | }; |
Govind Singh | 3ddda1f | 2016-03-09 11:34:12 +0530 | [diff] [blame] | 254 | struct wmi_ops *wmi_get_tlv_ops(void); |
| 255 | struct wmi_ops *wmi_get_non_tlv_ops(void); |
Govind Singh | d475ea9 | 2016-03-06 19:55:02 +0530 | [diff] [blame] | 256 | #endif |