Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unifiio.h
Go to the documentation of this file.
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>
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 */
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 */
170 
171  /* Direction in which signal was transferred. */
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 */
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 */
192 
193 typedef struct {
194 
195  /* Number of 16-bit ints in the sig_ids array */
197  /* The action to perform */
199  /* List of signal IDs to pass or block */
200  unsigned short *sig_ids;
201 
203 
204 
205 typedef struct {
206  /* Number of 16-bit ints in the protocols array */
208  /* List of protocol ids to pass */
211 
212 
213 
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 
230  int funcnum;
231  unsigned long addr;
232  unsigned char data;
233 };
234 
235 
237  int funcnum;
238  unsigned long addr;
239  unsigned int length;
240  unsigned char *data;
241 };
242 
244  unsigned long addr; /* generic address */
245  unsigned short data;
246 };
247 
248 typedef enum unifi_cfg_command {
260  UNIFI_CFG_CORE_DUMP /* request to take a fw core dump */
262 
263 typedef enum unifi_cfg_power {
268 
269 typedef enum unifi_cfg_powersupply {
274 
275 typedef enum unifi_cfg_powersave {
282 
283 typedef enum unifi_cfg_get {
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 
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
309 
310 typedef struct uf_cfg_ap_config
311 {
329 
330 typedef struct tcpic_clsfr
331 {
342 } __attribute__ ((packed)) tcpip_clsfr_t;
344 typedef struct tclas {
348  tcpip_clsfr_t tcp_ip_cls_fr;
349 } __attribute__ ((packed)) tclas_t;
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 {
361  /* If non zero, then unicast key otherwise group key */
363  u8 keyRsc[16];
365  /* If non zero, then authenticator otherwise supplicant */
367  u8 key[32];
369 
370 /* Values describing XAP memory regions captured by the mini-coredump system */
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__ */