1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef __UNIFIIO_H__
19#define __UNIFIIO_H__
20
21#include <linux/types.h>
22
23#define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int)
24#define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int)
25
26#define UDI_ENABLE_DATA 0x1
27#define UDI_ENABLE_CONTROL 0x2
28
29
30#define UNIFI_GET_MIB _IOWR('u', 3, unsigned char *)
31#define UNIFI_SET_MIB _IOW ('u', 4, unsigned char *)
32#define MAX_VARBIND_LENGTH 127
33
34
35#define SIOCIWS80211POWERSAVEPRIV SIOCIWFIRSTPRIV
36#define SIOCIWG80211POWERSAVEPRIV SIOCIWFIRSTPRIV + 1
37#define SIOCIWS80211RELOADDEFAULTSPRIV SIOCIWFIRSTPRIV + 2
38#define SIOCIWSCONFWAPIPRIV SIOCIWFIRSTPRIV + 4
39#define SIOCIWSWAPIKEYPRIV SIOCIWFIRSTPRIV + 6
40#define SIOCIWSSMEDEBUGPRIV SIOCIWFIRSTPRIV + 8
41#define SIOCIWSAPCFGPRIV SIOCIWFIRSTPRIV + 10
42#define SIOCIWSAPSTARTPRIV SIOCIWFIRSTPRIV + 12
43#define SIOCIWSAPSTOPPRIV SIOCIWFIRSTPRIV + 14
44#define SIOCIWSFWRELOADPRIV SIOCIWFIRSTPRIV + 16
45#define SIOCIWSSTACKSTART SIOCIWFIRSTPRIV + 18
46#define SIOCIWSSTACKSTOP SIOCIWFIRSTPRIV + 20
47
48
49
50#define IWPRIV_POWER_SAVE_MAX_STRING 32
51#define IWPRIV_SME_DEBUG_MAX_STRING 32
52#define IWPRIV_SME_MAX_STRING 120
53
54
55
56#define UNIFI_CFG _IOWR('u', 5, unsigned char *)
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81#define UNIFI_PUTEST _IOWR('u', 6, unsigned char *)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104#define UNIFI_BUILD_TYPE _IOWR('u', 7, unsigned char)
105#define UNIFI_BUILD_NME 1
106#define UNIFI_BUILD_WEXT 2
107#define UNIFI_BUILD_AP 3
108
109
110#define UNIFI_KICK _IO ('u', 0x10)
111#define UNIFI_SET_DEBUG _IO ('u', 0x11)
112#define UNIFI_SET_TRACE _IO ('u', 0x12)
113
114#define UNIFI_GET_INIT_STATUS _IOR ('u', 0x15, int)
115#define UNIFI_SET_UDI_LOG_MASK _IOR('u', 0x18, unifiio_filter_t)
116#define UNIFI_SET_UDI_SNAP_MASK _IOW('u', 0x1a, unifiio_snap_filter_t)
117#define UNIFI_SET_AMP_ENABLE _IOWR('u', 0x1b, int)
118
119#define UNIFI_INIT_HW _IOR ('u', 0x13, unsigned char)
120#define UNIFI_INIT_NETDEV _IOW ('u', 0x14, unsigned char[6])
121#define UNIFI_SME_PRESENT _IOW ('u', 0x19, int)
122
123#define UNIFI_CFG_PERIOD_TRAFFIC _IOW ('u', 0x21, unsigned char *)
124#define UNIFI_CFG_UAPSD_TRAFFIC _IOW ('u', 0x22, unsigned char)
125
126#define UNIFI_COREDUMP_GET_REG _IOWR('u', 0x23, unifiio_coredump_req_t)
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144typedef struct {
145
146
147 int img_len;
148
149
150 unsigned char *img_data;
151
152
153
154 int loader_len;
155
156
157 unsigned char *loader_data;
158
159} unifiio_img_t;
160
161
162
163typedef struct
164{
165
166 int length;
167
168
169 int timestamp;
170
171
172 int direction;
173#define UDI_FROM_HOST 0
174#define UDI_TO_HOST 1
175#define UDI_CONFIG_IND 2
176
177
178 int signal_length;
179
180
181
182} udi_msg_t;
183
184
185typedef enum
186{
187 UfSigFil_AllOn = 0,
188 UfSigFil_AllOff = 1,
189 UfSigFil_SelectOn = 2,
190 UfSigFil_SelectOff = 3
191} uf_sigfilter_action_t;
192
193typedef struct {
194
195
196 int num_sig_ids;
197
198 uf_sigfilter_action_t action;
199
200 unsigned short *sig_ids;
201
202} unifiio_filter_t;
203
204
205typedef struct {
206
207 u16 count;
208
209 u16 *protocols;
210} unifiio_snap_filter_t;
211
212
213
214typedef u8 unifi_putest_command_t;
215
216#define UNIFI_PUTEST_START 0
217#define UNIFI_PUTEST_STOP 1
218#define UNIFI_PUTEST_SET_SDIO_CLOCK 2
219#define UNIFI_PUTEST_CMD52_READ 3
220#define UNIFI_PUTEST_CMD52_WRITE 4
221#define UNIFI_PUTEST_DL_FW 5
222#define UNIFI_PUTEST_DL_FW_BUFF 6
223#define UNIFI_PUTEST_CMD52_BLOCK_READ 7
224#define UNIFI_PUTEST_COREDUMP_PREPARE 8
225#define UNIFI_PUTEST_GP_READ16 9
226#define UNIFI_PUTEST_GP_WRITE16 10
227
228
229struct unifi_putest_cmd52 {
230 int funcnum;
231 unsigned long addr;
232 unsigned char data;
233};
234
235
236struct unifi_putest_block_cmd52_r {
237 int funcnum;
238 unsigned long addr;
239 unsigned int length;
240 unsigned char *data;
241};
242
243struct unifi_putest_gp_rw16 {
244 unsigned long addr;
245 unsigned short data;
246};
247
248typedef enum unifi_cfg_command {
249 UNIFI_CFG_GET,
250 UNIFI_CFG_POWER,
251 UNIFI_CFG_POWERSAVE,
252 UNIFI_CFG_FILTER,
253 UNIFI_CFG_POWERSUPPLY,
254 UNIFI_CFG_WMM_QOSINFO,
255 UNIFI_CFG_WMM_ADDTS,
256 UNIFI_CFG_WMM_DELTS,
257 UNIFI_CFG_STRICT_DRAFT_N,
258 UNIFI_CFG_ENABLE_OKC,
259 UNIFI_CFG_SET_AP_CONFIG,
260 UNIFI_CFG_CORE_DUMP
261} unifi_cfg_command_t;
262
263typedef enum unifi_cfg_power {
264 UNIFI_CFG_POWER_UNSPECIFIED,
265 UNIFI_CFG_POWER_OFF,
266 UNIFI_CFG_POWER_ON
267} unifi_cfg_power_t;
268
269typedef enum unifi_cfg_powersupply {
270 UNIFI_CFG_POWERSUPPLY_UNSPECIFIED,
271 UNIFI_CFG_POWERSUPPLY_MAINS,
272 UNIFI_CFG_POWERSUPPLY_BATTERIES
273} unifi_cfg_powersupply_t;
274
275typedef enum unifi_cfg_powersave {
276 UNIFI_CFG_POWERSAVE_UNSPECIFIED,
277 UNIFI_CFG_POWERSAVE_NONE,
278 UNIFI_CFG_POWERSAVE_FAST,
279 UNIFI_CFG_POWERSAVE_FULL,
280 UNIFI_CFG_POWERSAVE_AUTO
281} unifi_cfg_powersave_t;
282
283typedef enum unifi_cfg_get {
284 UNIFI_CFG_GET_COEX,
285 UNIFI_CFG_GET_POWER_MODE,
286 UNIFI_CFG_GET_VERSIONS,
287 UNIFI_CFG_GET_POWER_SUPPLY,
288 UNIFI_CFG_GET_INSTANCE,
289 UNIFI_CFG_GET_AP_CONFIG
290} unifi_cfg_get_t;
291
292#define UNIFI_CFG_FILTER_NONE 0x0000
293#define UNIFI_CFG_FILTER_DHCP 0x0001
294#define UNIFI_CFG_FILTER_ARP 0x0002
295#define UNIFI_CFG_FILTER_NBNS 0x0004
296#define UNIFI_CFG_FILTER_NBDS 0x0008
297#define UNIFI_CFG_FILTER_CUPS 0x0010
298#define UNIFI_CFG_FILTER_ALL 0xFFFF
299
300
301typedef struct uf_cfg_bcast_packet_filter
302{
303 unsigned long filter_mode;
304 unsigned char arp_filter;
305 unsigned char dhcp_filter;
306 unsigned long tclas_ies_length;
307 unsigned char tclas_ies[1];
308} uf_cfg_bcast_packet_filter_t;
309
310typedef struct uf_cfg_ap_config
311{
312 u8 phySupportedBitmap;
313 u8 channel;
314 u16 beaconInterval;
315 u8 dtimPeriod;
316 u8 wmmEnabled;
317 u8 shortSlotTimeEnabled;
318 u16 groupkeyTimeout;
319 u8 strictGtkRekeyEnabled;
320 u16 gmkTimeout;
321 u16 responseTimeout;
322 u8 retransLimit;
323 u8 rxStbc;
324 u8 rifsModeAllowed;
325 u8 dualCtsProtection;
326 u8 ctsProtectionType;
327 u16 maxListenInterval;
328}uf_cfg_ap_config_t;
329
330typedef struct tcpic_clsfr
331{
332 __u8 cls_fr_type;
333 __u8 cls_fr_mask;
334 __u8 version;
335 __u8 source_ip_addr[4];
336 __u8 dest_ip_addr[4];
337 __u16 source_port;
338 __u16 dest_port;
339 __u8 dscp;
340 __u8 protocol;
341 __u8 reserved;
342} __attribute__ ((packed)) tcpip_clsfr_t;
343
344typedef struct tclas {
345 __u8 element_id;
346 __u8 length;
347 __u8 user_priority;
348 tcpip_clsfr_t tcp_ip_cls_fr;
349} __attribute__ ((packed)) tclas_t;
350
351
352#define CONFIG_IND_ERROR 0x01
353#define CONFIG_IND_EXIT 0x02
354#define CONFIG_SME_NOT_PRESENT 0x10
355#define CONFIG_SME_PRESENT 0x20
356
357
358typedef struct
359{
360 u8 unicastKey;
361
362 u8 keyIndex;
363 u8 keyRsc[16];
364 u8 authenticator;
365
366 u8 address[6];
367 u8 key[32];
368} unifiio_wapi_key_t;
369
370
371typedef enum unifiio_coredump_space {
372 UNIFIIO_COREDUMP_MAC_REG,
373 UNIFIIO_COREDUMP_PHY_REG,
374 UNIFIIO_COREDUMP_SH_DMEM,
375 UNIFIIO_COREDUMP_MAC_DMEM,
376 UNIFIIO_COREDUMP_PHY_DMEM,
377 UNIFIIO_COREDUMP_TRIGGER_MAGIC = 0xFEED
378} unifiio_coredump_space_t;
379
380
381
382
383typedef struct unifiio_coredump_req {
384
385 int index;
386 unsigned int offset;
387 unifiio_coredump_space_t space;
388
389 unsigned int drv_build;
390 unsigned int chip_ver;
391 unsigned int fw_ver;
392 int requestor;
393 unsigned int timestamp;
394 unsigned int serial;
395 int value;
396} unifiio_coredump_req_t;
397
398#endif
399