Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | /* |
2 | * --------------------------------------------------------------------------- | |
3 | * | |
4 | * FILE: unifiio.h | |
5 | * | |
6 | * Public definitions for the UniFi linux driver. | |
7 | * This is mostly ioctl command values and structs. | |
8 | * | |
9 | * Include <sys/ioctl.h> or similar before this file | |
10 | * | |
11 | * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. | |
12 | * | |
13 | * Refer to LICENSE.txt included with this source code for details on | |
14 | * the license terms. | |
15 | * | |
16 | * --------------------------------------------------------------------------- | |
17 | */ | |
18 | #ifndef __UNIFIIO_H__ | |
19 | #define __UNIFIIO_H__ | |
20 | ||
21 | #include <linux/types.h> | |
635d2b00 GKH |
22 | |
23 | #define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int) | |
24 | #define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int) | |
25 | /* Values for UDI_ENABLE */ | |
26 | #define UDI_ENABLE_DATA 0x1 | |
27 | #define UDI_ENABLE_CONTROL 0x2 | |
28 | ||
29 | /* MIB set/get. Arg is a pointer to a varbind */ | |
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 | /* Private IOCTLs */ | |
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 | /* Private configuration commands */ | |
56 | #define UNIFI_CFG _IOWR('u', 5, unsigned char *) | |
57 | /* | |
58 | * <------------------ Read/Write Buffer --------------------> | |
59 | * _____________________________________________________________ | |
60 | * | Cmd | Arg | ... Buffer (opt) ... | | |
61 | * ------------------------------------------------------------- | |
62 | * <-- uint --><-- uint --><----- unsigned char buffer ------> | |
63 | * | |
64 | * Cmd: A unifi_cfg_command_t command. | |
65 | * Arg: Out:Length if Cmd==UNIFI_CFG_GET | |
66 | * In:PowerOnOff if Cmd==UNIFI_CFG_POWER | |
67 | * In:PowerMode if Cmd==UNIFI_CFG_POWERSAVE | |
68 | * In:Length if Cmd==UNIFI_CFG_FILTER | |
69 | * In:WMM Qos Info if Cmd==UNIFI_CFG_WMM_QOS_INFO | |
70 | * Buffer: Out:Data if Cmd==UNIFI_CFG_GET | |
71 | * NULL if Cmd==UNIFI_CFG_POWER | |
72 | * NULL if Cmd==UNIFI_CFG_POWERSAVE | |
73 | * In:Filters if Cmd==UNIFI_CFG_FILTER | |
74 | * | |
75 | * where Filters is a uf_cfg_bcast_packet_filter_t structure | |
76 | * followed by 0 - n tclas_t structures. The length of the tclas_t | |
77 | * structures is obtained by uf_cfg_bcast_packet_filter_t::tclas_ies_length. | |
78 | */ | |
79 | ||
80 | ||
81 | #define UNIFI_PUTEST _IOWR('u', 6, unsigned char *) | |
82 | /* | |
83 | * <------------------ Read/Write Buffer --------------------> | |
84 | * _____________________________________________________________ | |
85 | * | Cmd | Arg | ... Buffer (opt) ... | | |
86 | * ------------------------------------------------------------- | |
87 | * <-- uint --><-- uint --><----- unsigned char buffer ------> | |
88 | * | |
89 | * Cmd: A unifi_putest_command_t command. | |
90 | * Arg: N/A if Cmd==UNIFI_PUTEST_START | |
91 | * N/A if Cmd==UNIFI_PUTEST_STOP | |
92 | * In:int (Clock Speed) if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK | |
93 | * In/Out:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_READ | |
94 | * In:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_WRITE | |
95 | * In:uint (f/w file name length) if Cmd==UNIFI_PUTEST_DL_FW | |
96 | * Buffer: NULL if Cmd==UNIFI_PUTEST_START | |
97 | * NULL if Cmd==UNIFI_PUTEST_STOP | |
98 | * NULL if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK | |
99 | * In/Out:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_READ | |
100 | * In:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_WRITE | |
101 | * In:f/w file name if Cmd==UNIFI_PUTEST_DL_FW | |
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 | /* debugging */ | |
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 | * Following reset, f/w may only be downloaded using CMD52. | |
131 | * This is slow, so there is a facility to download a secondary | |
132 | * loader first which supports CMD53. | |
133 | * If loader_len is > 0, then loader_data is assumed to point to | |
134 | * a suitable secondary loader that can be used to download the | |
135 | * main image. | |
136 | * | |
137 | * The driver will run the host protocol initialisation sequence | |
138 | * after downloading the image. | |
139 | * | |
140 | * If both lengths are zero, then the f/w is assumed to have been | |
141 | * booted from Flash and the host protocol initialisation sequence | |
142 | * is run. | |
143 | */ | |
144 | typedef struct { | |
145 | ||
146 | /* Number of bytes in the image */ | |
147 | int img_len; | |
148 | ||
149 | /* Pointer to image data. */ | |
150 | unsigned char *img_data; | |
151 | ||
152 | ||
153 | /* Number of bytes in the loader image */ | |
154 | int loader_len; | |
155 | ||
156 | /* Pointer to loader image data. */ | |
157 | unsigned char *loader_data; | |
158 | ||
159 | } unifiio_img_t; | |
160 | ||
161 | ||
162 | /* Structure of data read from the unifi device. */ | |
163 | typedef struct | |
164 | { | |
165 | /* Length (in bytes) of entire structure including appended bulk data */ | |
166 | int length; | |
167 | ||
168 | /* System time (in milliseconds) that signal was transferred */ | |
169 | int timestamp; | |
170 | ||
171 | /* Direction in which signal was transferred. */ | |
172 | int direction; | |
173 | #define UDI_FROM_HOST 0 | |
174 | #define UDI_TO_HOST 1 | |
175 | #define UDI_CONFIG_IND 2 | |
176 | ||
177 | /* The length of the signal (in bytes) not including bulk data */ | |
178 | int signal_length; | |
179 | ||
180 | /* Signal body follows, then any bulk data */ | |
181 | ||
182 | } udi_msg_t; | |
183 | ||
184 | ||
185 | typedef enum | |
186 | { | |
187 | UfSigFil_AllOn = 0, /* Log all signal IDs */ | |
188 | UfSigFil_AllOff = 1, /* Don't log any signal IDs */ | |
189 | UfSigFil_SelectOn = 2, /* Log these signal IDs */ | |
190 | UfSigFil_SelectOff = 3 /* Don't log these signal IDs */ | |
191 | } uf_sigfilter_action_t; | |
192 | ||
193 | typedef struct { | |
194 | ||
195 | /* Number of 16-bit ints in the sig_ids array */ | |
196 | int num_sig_ids; | |
197 | /* The action to perform */ | |
198 | uf_sigfilter_action_t action; | |
199 | /* List of signal IDs to pass or block */ | |
200 | unsigned short *sig_ids; | |
201 | ||
202 | } unifiio_filter_t; | |
203 | ||
204 | ||
205 | typedef struct { | |
206 | /* Number of 16-bit ints in the protocols array */ | |
8c87f69a | 207 | u16 count; |
635d2b00 | 208 | /* List of protocol ids to pass */ |
8c87f69a | 209 | u16 *protocols; |
635d2b00 GKH |
210 | } unifiio_snap_filter_t; |
211 | ||
212 | ||
213 | ||
7e6f5794 | 214 | typedef u8 unifi_putest_command_t; |
95edd09e GKH |
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 | |
635d2b00 GKH |
227 | |
228 | ||
229 | struct unifi_putest_cmd52 { | |
230 | int funcnum; | |
231 | unsigned long addr; | |
232 | unsigned char data; | |
233 | }; | |
234 | ||
235 | ||
236 | struct unifi_putest_block_cmd52_r { | |
237 | int funcnum; | |
238 | unsigned long addr; | |
239 | unsigned int length; | |
240 | unsigned char *data; | |
241 | }; | |
242 | ||
243 | struct unifi_putest_gp_rw16 { | |
244 | unsigned long addr; /* generic address */ | |
245 | unsigned short data; | |
246 | }; | |
247 | ||
248 | typedef 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 /* request to take a fw core dump */ | |
261 | } unifi_cfg_command_t; | |
262 | ||
263 | typedef 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 | ||
269 | typedef 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 | ||
275 | typedef 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 | ||
283 | typedef 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 | ||
301 | typedef struct uf_cfg_bcast_packet_filter | |
302 | { | |
303 | unsigned long filter_mode; //as defined by HIP protocol | |
304 | unsigned char arp_filter; | |
305 | unsigned char dhcp_filter; | |
306 | unsigned long tclas_ies_length; // length of tclas_ies in bytes | |
307 | unsigned char tclas_ies[1]; // variable length depending on above field | |
308 | } uf_cfg_bcast_packet_filter_t; | |
309 | ||
310 | typedef struct uf_cfg_ap_config | |
311 | { | |
7e6f5794 GKH |
312 | u8 phySupportedBitmap; |
313 | u8 channel; | |
8c87f69a | 314 | u16 beaconInterval; |
7e6f5794 | 315 | u8 dtimPeriod; |
5379b13d | 316 | u8 wmmEnabled; |
7e6f5794 | 317 | u8 shortSlotTimeEnabled; |
8c87f69a | 318 | u16 groupkeyTimeout; |
5379b13d | 319 | u8 strictGtkRekeyEnabled; |
8c87f69a GKH |
320 | u16 gmkTimeout; |
321 | u16 responseTimeout; | |
7e6f5794 GKH |
322 | u8 retransLimit; |
323 | u8 rxStbc; | |
5379b13d | 324 | u8 rifsModeAllowed; |
7e6f5794 GKH |
325 | u8 dualCtsProtection; |
326 | u8 ctsProtectionType; | |
8c87f69a | 327 | u16 maxListenInterval; |
635d2b00 GKH |
328 | }uf_cfg_ap_config_t; |
329 | ||
330 | typedef 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 | ||
344 | typedef 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 | /* WAPI Key */ | |
358 | typedef struct | |
359 | { | |
7e6f5794 | 360 | u8 unicastKey; |
635d2b00 | 361 | /* If non zero, then unicast key otherwise group key */ |
7e6f5794 GKH |
362 | u8 keyIndex; |
363 | u8 keyRsc[16]; | |
364 | u8 authenticator; | |
635d2b00 | 365 | /* If non zero, then authenticator otherwise supplicant */ |
7e6f5794 GKH |
366 | u8 address[6]; |
367 | u8 key[32]; | |
635d2b00 GKH |
368 | } unifiio_wapi_key_t; |
369 | ||
370 | /* Values describing XAP memory regions captured by the mini-coredump system */ | |
371 | typedef 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 | /* Userspace tool uses this structure to retrieve a register value from a | |
381 | * mini-coredump buffer previously saved by the HIP | |
382 | */ | |
383 | typedef struct unifiio_coredump_req { | |
384 | /* From user */ | |
385 | int index; /* 0=newest, -1=oldest */ | |
386 | unsigned int offset; /* register offset in space */ | |
387 | unifiio_coredump_space_t space; /* memory space */ | |
388 | /* Filled by driver */ | |
389 | unsigned int drv_build; /* driver build id */ | |
390 | unsigned int chip_ver; /* chip version */ | |
391 | unsigned int fw_ver; /* firmware version */ | |
392 | int requestor; /* requestor: 0=auto dump, 1=manual */ | |
393 | unsigned int timestamp; /* time of capture by driver */ | |
394 | unsigned int serial; /* capture serial number */ | |
395 | int value; /* 16 bit register value, -ve for error */ | |
396 | } unifiio_coredump_req_t; /* Core-dumped register value request */ | |
397 | ||
398 | #endif /* __UNIFIIO_H__ */ |