blob: 9c340f5731628802f8b696bcfb3551449b8da85b [file] [log] [blame]
Govind Singhd475ea92016-03-06 19:55:02 +05301/*
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 Singh3ddda1f2016-03-09 11:34:12 +053029 * This file contains the API definitions for the Unified Wireless
30 * Module Interface (WMI).
Govind Singhd475ea92016-03-06 19:55:02 +053031 */
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
43typedef cdf_nbuf_t wmi_buf_t;
44
45#ifdef WMI_INTERFACE_EVENT_LOGGING
46
47#define WMI_EVENT_DEBUG_MAX_ENTRY (1024)
48
49struct wmi_command_debug {
50 uint32_t command;
Govind Singh4ec6ff92016-03-09 12:03:29 +053051 uint32_t data[4]; /*16 bytes of WMI cmd excluding TLV and WMI headers */
Govind Singhd475ea92016-03-06 19:55:02 +053052 uint64_t time;
53};
54
55struct wmi_event_debug {
56 uint32_t event;
Govind Singh4ec6ff92016-03-09 12:03:29 +053057 uint32_t data[4]; /*16 bytes of WMI event data excluding TLV header */
Govind Singhd475ea92016-03-06 19:55:02 +053058 uint64_t time;
59};
60
61#endif /*WMI_INTERFACE_EVENT_LOGGING */
62
63#ifdef WLAN_OPEN_SOURCE
64struct 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 Singh3ddda1f2016-03-09 11:34:12 +053071struct wmi_ops {
72int32_t (*send_vdev_create_cmd)(wmi_unified_t wmi_handle,
73 uint8_t macaddr[IEEE80211_ADDR_LEN],
74 struct vdev_create_params *param);
75
76int32_t (*send_vdev_delete_cmd)(wmi_unified_t wmi_handle,
77 uint8_t if_id);
78
79int32_t (*send_vdev_stop_cmd)(wmi_unified_t wmi,
80 uint8_t vdev_id);
81
82int32_t (*send_vdev_down_cmd)(wmi_unified_t wmi,
83 uint8_t vdev_id);
84
85int32_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
89int32_t (*send_peer_delete_cmd)(wmi_unified_t wmi,
90 uint8_t peer_addr[IEEE80211_ADDR_LEN],
91 uint8_t vdev_id);
92
93int32_t (*send_peer_param_cmd)(wmi_unified_t wmi,
94 uint8_t peer_addr[IEEE80211_ADDR_LEN],
95 struct peer_set_params *param);
96
97int32_t (*send_vdev_up_cmd)(wmi_unified_t wmi,
98 uint8_t bssid[IEEE80211_ADDR_LEN],
99 struct vdev_up_params *params);
100
101int32_t (*send_peer_create_cmd)(wmi_unified_t wmi,
102 struct peer_create_params *param);
103
104int32_t (*send_green_ap_ps_cmd)(wmi_unified_t wmi_handle,
105 uint32_t value, uint8_t mac_id);
106
107int32_t
108(*send_pdev_utf_cmd)(wmi_unified_t wmi_handle,
109 struct pdev_utf_params *param,
110 uint8_t mac_id);
111
112int32_t
113(*send_pdev_param_cmd)(wmi_unified_t wmi_handle,
114 struct pdev_params *param,
115 uint8_t mac_id);
116
117int32_t (*send_suspend_cmd)(wmi_unified_t wmi_handle,
118 struct suspend_params *param,
119 uint8_t mac_id);
120
121int32_t (*send_resume_cmd)(wmi_unified_t wmi_handle,
122 uint8_t mac_id);
123
124int32_t (*send_wow_enable_cmd)(wmi_unified_t wmi_handle,
125 struct wow_cmd_params *param,
126 uint8_t mac_id);
127
128int32_t (*send_set_ap_ps_param_cmd)(wmi_unified_t wmi_handle,
129 uint8_t *peer_addr,
130 struct ap_ps_params *param);
131
132int32_t (*send_set_sta_ps_param_cmd)(wmi_unified_t wmi_handle,
133 struct sta_ps_params *param);
134
135int32_t (*send_crash_inject_cmd)(wmi_unified_t wmi_handle,
136 struct crash_inject *param);
137
138int32_t
139(*send_dbglog_cmd)(wmi_unified_t wmi_handle,
140 struct dbglog_params *dbglog_param);
141
142int32_t (*send_vdev_set_param_cmd)(wmi_unified_t wmi_handle,
143 struct vdev_set_params *param);
144
145int32_t (*send_stats_request_cmd)(wmi_unified_t wmi_handle,
146 uint8_t macaddr[IEEE80211_ADDR_LEN],
147 struct stats_request_params *param);
148
149int32_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
153int32_t (*send_beacon_send_cmd)(wmi_unified_t wmi_handle,
Govind Singh3ddda1f2016-03-09 11:34:12 +0530154 struct beacon_params *param);
155
156int32_t (*send_peer_assoc_cmd)(wmi_unified_t wmi_handle,
Govind Singh3ddda1f2016-03-09 11:34:12 +0530157 struct peer_assoc_params *param);
158
159int32_t (*send_scan_start_cmd)(wmi_unified_t wmi_handle,
Govind Singh3ddda1f2016-03-09 11:34:12 +0530160 struct scan_start_params *param);
161
162int32_t (*send_scan_stop_cmd)(wmi_unified_t wmi_handle,
Govind Singh3ddda1f2016-03-09 11:34:12 +0530163 struct scan_stop_params *param);
164
165int32_t (*send_scan_chan_list_cmd)(wmi_unified_t wmi_handle,
Govind Singh3ddda1f2016-03-09 11:34:12 +0530166 struct scan_chan_list_params *param);
Govind Singh50988cc2016-02-26 18:09:36 +0530167
168int32_t (*send_mgmt_cmd)(wmi_unified_t wmi_handle,
169 struct wmi_mgmt_params *param);
170
171int32_t (*send_modem_power_state_cmd)(wmi_unified_t wmi_handle,
172 uint32_t param_value);
173
174int32_t (*send_set_sta_ps_mode_cmd)(wmi_unified_t wmi_handle,
175 uint32_t vdev_id, uint8_t val);
176
177int32_t (*send_get_temperature_cmd)(wmi_unified_t wmi_handle);
178
179int32_t (*send_set_p2pgo_oppps_req_cmd)(wmi_unified_t wmi_handle,
180 struct p2p_ps_params *oppps);
181
182int32_t (*send_set_p2pgo_noa_req_cmd)(wmi_unified_t wmi_handle,
183 struct p2p_ps_params *noa);
184
185int32_t (*send_set_smps_params_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id,
186 int value);
187
188int32_t (*send_set_mimops_cmd)(wmi_unified_t wmi_handle,
189 uint8_t vdev_id, int value);
190
191int32_t (*send_set_sta_uapsd_auto_trig_cmd)(wmi_unified_t wmi_handle,
192 struct sta_uapsd_trig_params *param);
Govind Singhe7b800c2016-03-01 15:30:53 +0530193
194int32_t (*send_ocb_set_utc_time_cmd)(wmi_unified_t wmi_handle,
195 struct ocb_utc_param *utc);
196
197int32_t (*send_ocb_get_tsf_timer_cmd)(wmi_unified_t wmi_handle,
198 uint8_t vdev_id);
199
200int32_t (*send_ocb_start_timing_advert_cmd)(wmi_unified_t wmi_handle,
201 struct ocb_timing_advert_param *timing_advert);
202
203int32_t (*send_ocb_stop_timing_advert_cmd)(wmi_unified_t wmi_handle,
204 struct ocb_timing_advert_param *timing_advert);
205
206int32_t (*send_dcc_get_stats_cmd)(wmi_unified_t wmi_handle,
207 struct dcc_get_stats_param *get_stats_param);
208
209int32_t (*send_dcc_clear_stats_cmd)(wmi_unified_t wmi_handle,
210 uint32_t vdev_id, uint32_t dcc_stats_bitmap);
211
212int32_t (*send_dcc_update_ndl_cmd)(wmi_unified_t wmi_handle,
213 struct dcc_update_ndl_param *update_ndl_param);
214
215int32_t (*send_ocb_set_config_cmd)(wmi_unified_t wmi_handle,
216 struct ocb_config_param *config, uint32_t *ch_mhz);
Govind Singh3ddda1f2016-03-09 11:34:12 +0530217};
218
Govind Singhd475ea92016-03-06 19:55:02 +0530219struct wmi_unified {
220 ol_scn_t scn_handle; /* handle to device */
Govind Singh6ad6ada2016-02-04 18:42:30 +0530221 osdev_t osdev; /* handle to use OS-independent services */
Govind Singhd475ea92016-03-06 19:55:02 +0530222 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 Singh4ec6ff92016-03-09 12:03:29 +0530227 enum wmi_rx_exec_ctx ctx[WMI_UNIFIED_MAX_EVENT];
Govind Singhd475ea92016-03-06 19:55:02 +0530228 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 Singh6ad6ada2016-02-04 18:42:30 +0530233 int wmi_stop_in_progress;
Govind Singhd475ea92016-03-06 19:55:02 +0530234#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 Singh3ddda1f2016-03-09 11:34:12 +0530249 struct wmi_rx_ops rx_ops;
250 struct wmi_ops *ops;
Govind Singh6ad6ada2016-02-04 18:42:30 +0530251 void *event_handler_cookie[WMI_UNIFIED_MAX_EVENT];
252 bool use_cookie;
Govind Singhd475ea92016-03-06 19:55:02 +0530253};
Govind Singh3ddda1f2016-03-09 11:34:12 +0530254struct wmi_ops *wmi_get_tlv_ops(void);
255struct wmi_ops *wmi_get_non_tlv_ops(void);
Govind Singhd475ea92016-03-06 19:55:02 +0530256#endif