Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[pandora-kernel.git] / drivers / staging / ath6kl / include / common / wmi_thin.h
1 //------------------------------------------------------------------------------
2 // <copyright file="wmi_thin.h" company="Atheros">
3 //    Copyright (c) 2004-2010 Atheros Corporation.  All rights reserved.
4 // 
5 //
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
9 //
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 //
18 //
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // Author(s): ="Atheros"
22 //==============================================================================
23
24 /*
25  * This file contains the definitions of the WMI protocol specified in the
26  * Wireless Module Interface (WMI).  It includes definitions of all the
27  * commands and events. Commands are messages from the host to the WM.
28  * Events and Replies are messages from the WM to the host.
29  *
30  * Ownership of correctness in regards to WMI commands
31  * belongs to the host driver and the WM is not required to validate
32  * parameters for value, proper range, or any other checking.
33  *
34  */
35
36 #ifndef _WMI_THIN_H_
37 #define _WMI_THIN_H_
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43
44 typedef enum {
45     WMI_THIN_CONFIG_CMDID =  0x8000, // WMI_THIN_RESERVED_START 
46     WMI_THIN_SET_MIB_CMDID,
47     WMI_THIN_GET_MIB_CMDID,
48     WMI_THIN_JOIN_CMDID,
49     /* add new CMDID's here */
50     WMI_THIN_RESERVED_END_CMDID = 0x8fff // WMI_THIN_RESERVED_END
51 } WMI_THIN_COMMAND_ID;
52
53 typedef enum{
54     TEMPLATE_FRM_FIRST = 0,
55     TEMPLATE_FRM_PROBE_REQ =TEMPLATE_FRM_FIRST,
56     TEMPLATE_FRM_BEACON,
57     TEMPLATE_FRM_PROBE_RESP,
58     TEMPLATE_FRM_NULL,
59     TEMPLATE_FRM_QOS_NULL,
60     TEMPLATE_FRM_PSPOLL,
61     TEMPLATE_FRM_MAX
62 }WMI_TEMPLATE_FRM_TYPE;
63
64 /* TEMPLATE_FRM_LEN... represent the maximum allowable
65  * data lengths (bytes) for each frame type */
66 #define TEMPLATE_FRM_LEN_PROBE_REQ  (256) /* Symbian dictates a minimum of 256 for these 3 frame types */
67 #define TEMPLATE_FRM_LEN_BEACON     (256)
68 #define TEMPLATE_FRM_LEN_PROBE_RESP (256)
69 #define TEMPLATE_FRM_LEN_NULL       (32)
70 #define TEMPLATE_FRM_LEN_QOS_NULL   (32)
71 #define TEMPLATE_FRM_LEN_PSPOLL     (32)
72 #define TEMPLATE_FRM_LEN_SUM (TEMPLATE_FRM_LEN_PROBE_REQ + TEMPLATE_FRM_LEN_BEACON + TEMPLATE_FRM_LEN_PROBE_RESP + \
73             TEMPLATE_FRM_LEN_NULL + TEMPLATE_FRM_LEN_QOS_NULL + TEMPLATE_FRM_LEN_PSPOLL)
74
75
76 /* MAC Header Build Rules */
77 /*  These values allow the host to configure the 
78  *  target code that is responsible for constructing
79  *  the MAC header.  In cases where the MAC header
80  *  is provided by the host framework, the target
81  *  has a diminished responsibility over what fields
82  *  it must write. This will vary from framework to framework.
83  *  Symbian requires different behavior from MAC80211 which
84  *  requires different behavior from MS Native Wifi. */
85 #define WMI_WRT_VER_TYPE    0x00000001
86 #define WMI_WRT_DURATION    0x00000002
87 #define WMI_WRT_DIRECTION   0x00000004
88 #define WMI_WRT_POWER       0x00000008
89 #define WMI_WRT_WEP         0x00000010
90 #define WMI_WRT_MORE        0x00000020
91 #define WMI_WRT_BSSID       0x00000040
92 #define WMI_WRT_QOS         0x00000080
93 #define WMI_WRT_SEQNO       0x00000100
94 #define WMI_GUARD_TX        0x00000200 /* prevents TX ops that are not allowed for a current state */
95 #define WMI_WRT_DEFAULT_CONFIG  (WMI_WRT_VER_TYPE | WMI_WRT_DURATION | WMI_WRT_DIRECTION | \
96                                  WMI_WRT_POWER | WMI_WRT_MORE | WMI_WRT_WEP | WMI_WRT_BSSID | \
97                                  WMI_WRT_QOS | WMI_WRT_SEQNO | WMI_GUARD_TX)
98
99 /* WMI_THIN_CONFIG_TXCOMPLETE -- Used to configure the params and content for 
100  *  TX Complete messages the will come from the Target.  these messages are 
101  *  disabled by default but can be enabled using this structure and the 
102  *  WMI_THIN_CONFIG_CMDID. */
103 typedef PREPACK struct {
104     A_UINT8     version; /* the versioned type of messages to use or 0 to disable */
105     A_UINT8     countThreshold; /* msg count threshold triggering a tx complete message */
106     A_UINT16    timeThreshold; /* timeout interval in MSEC triggering a tx complete message */       
107 } POSTPACK WMI_THIN_CONFIG_TXCOMPLETE;
108
109 /* WMI_THIN_CONFIG_DECRYPT_ERR -- Used to configure behavior for received frames 
110  *  that have decryption errors.  The default behavior is to discard the frame
111  *  without notification. Alternately, the MAC Header is forwarded to the host 
112  *  with the failed status. */
113 typedef PREPACK struct {
114     A_UINT8     enable; /* 1 == send decrypt errors to the host, 0 == don't */
115     A_UINT8     reserved[3]; /* align padding */
116 } POSTPACK WMI_THIN_CONFIG_DECRYPT_ERR;
117
118 /* WMI_THIN_CONFIG_TX_MAC_RULES -- Used to configure behavior for transmitted
119  *  frames that require partial MAC header construction. These rules 
120  *  are used by the target to indicate which fields need to be written. */
121 typedef PREPACK struct {
122     A_UINT32    rules; /* combination of WMI_WRT_... values */     
123 } POSTPACK WMI_THIN_CONFIG_TX_MAC_RULES;
124
125 /* WMI_THIN_CONFIG_RX_FILTER_RULES -- Used to configure behavior for received
126  *  frames as to which frames should get forwarded to the host and which
127  *  should get processed internally. */
128 typedef PREPACK struct {
129     A_UINT32    rules; /* combination of WMI_FILT_... values */     
130 } POSTPACK WMI_THIN_CONFIG_RX_FILTER_RULES;
131
132 /* WMI_THIN_CONFIG_CMD -- Used to contain some combination of the above
133  *  WMI_THIN_CONFIG_... structures. The actual combination is indicated 
134  *  by the value of cfgField. Each bit in this field corresponds to 
135  *  one of the above structures. */
136 typedef PREPACK struct {
137 #define WMI_THIN_CFG_TXCOMP         0x00000001
138 #define WMI_THIN_CFG_DECRYPT        0x00000002
139 #define WMI_THIN_CFG_MAC_RULES      0x00000004
140 #define WMI_THIN_CFG_FILTER_RULES   0x00000008
141     A_UINT32    cfgField;   /* combination of WMI_THIN_CFG_... describes contents of config command */
142     A_UINT16    length;     /* length in bytes of appended sub-commands */        
143     A_UINT8     reserved[2];   /* align padding */
144 } POSTPACK WMI_THIN_CONFIG_CMD;
145
146 /* MIB Access Identifiers tailored for Symbian. */
147 enum {
148     MIB_ID_STA_MAC = 1,             // [READONLY]
149     MIB_ID_RX_LIFE_TIME,            // [NOT IMPLEMENTED]
150     MIB_ID_SLOT_TIME,               // [READ/WRITE]
151     MIB_ID_RTS_THRESHOLD,           // [READ/WRITE]
152     MIB_ID_CTS_TO_SELF,             // [READ/WRITE]
153     MIB_ID_TEMPLATE_FRAME,          // [WRITE ONLY]
154     MIB_ID_RXFRAME_FILTER,          // [READ/WRITE]
155     MIB_ID_BEACON_FILTER_TABLE,     // [WRITE ONLY]
156     MIB_ID_BEACON_FILTER,           // [READ/WRITE]
157     MIB_ID_BEACON_LOST_COUNT,       // [WRITE ONLY]
158     MIB_ID_RSSI_THRESHOLD,          // [WRITE ONLY]
159     MIB_ID_HT_CAP,                  // [NOT IMPLEMENTED]
160     MIB_ID_HT_OP,                   // [NOT IMPLEMENTED]
161     MIB_ID_HT_2ND_BEACON,           // [NOT IMPLEMENTED]
162     MIB_ID_HT_BLOCK_ACK,            // [NOT IMPLEMENTED]
163     MIB_ID_PREAMBLE,                // [READ/WRITE]
164     /*MIB_ID_GROUP_ADDR_TABLE,*/
165     /*MIB_ID_WEP_DEFAULT_KEY_ID */
166     /*MIB_ID_TX_POWER */
167     /*MIB_ID_ARP_IP_TABLE */
168     /*MIB_ID_SLEEP_MODE */
169     /*MIB_ID_WAKE_INTERVAL*/
170     /*MIB_ID_STAT_TABLE*/
171     /*MIB_ID_IBSS_PWR_SAVE*/
172     /*MIB_ID_COUNTERS_TABLE*/
173     /*MIB_ID_ETHERTYPE_FILTER*/
174     /*MIB_ID_BC_UDP_FILTER*/
175        
176 };
177
178 typedef PREPACK struct {
179     A_UINT8 addr[ATH_MAC_LEN];
180 } POSTPACK WMI_THIN_MIB_STA_MAC;
181
182 typedef PREPACK struct {
183     A_UINT32 time; // units == msec
184 } POSTPACK WMI_THIN_MIB_RX_LIFE_TIME;
185
186 typedef PREPACK struct {
187     A_UINT8 enable; //1 = on, 0 = off
188 } POSTPACK WMI_THIN_MIB_CTS_TO_SELF;
189
190 typedef PREPACK struct {
191     A_UINT32 time; // units == usec
192 } POSTPACK WMI_THIN_MIB_SLOT_TIME;
193
194 typedef PREPACK struct {
195     A_UINT16 length; //units == bytes
196 } POSTPACK WMI_THIN_MIB_RTS_THRESHOLD;
197
198 typedef PREPACK struct {
199     A_UINT8 type; // type of frame
200     A_UINT8 rate; // tx rate to be used (one of WMI_BIT_RATE)
201     A_UINT16 length; // num bytes following this structure as the template data
202 } POSTPACK WMI_THIN_MIB_TEMPLATE_FRAME;
203
204 typedef PREPACK struct {
205 #define FRAME_FILTER_PROMISCUOUS 0x00000001
206 #define FRAME_FILTER_BSSID       0x00000002
207     A_UINT32 filterMask; 
208 } POSTPACK WMI_THIN_MIB_RXFRAME_FILTER;
209
210
211 #define IE_FILTER_TREATMENT_CHANGE 1
212 #define IE_FILTER_TREATMENT_APPEAR 2
213
214 typedef PREPACK struct {
215     A_UINT8 ie;
216     A_UINT8 treatment;
217 } POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE;
218
219 typedef PREPACK struct {
220     A_UINT8 ie;
221     A_UINT8 treatment;
222     A_UINT8 oui[3];
223     A_UINT8 type;
224     A_UINT16 version;
225 } POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_OUI;
226
227 typedef PREPACK struct {
228     A_UINT16 numElements;
229     A_UINT8 entrySize; // sizeof(WMI_THIN_MIB_BEACON_FILTER_TABLE) on host cpu may be 2 may be 4
230     A_UINT8 reserved;
231 } POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_HEADER; 
232
233 typedef PREPACK struct {
234     A_UINT32 count; /* num beacons between deliveries */
235     A_UINT8 enable;
236     A_UINT8 reserved[3];
237 } POSTPACK WMI_THIN_MIB_BEACON_FILTER;
238
239 typedef PREPACK struct {
240     A_UINT32 count; /* num consec lost beacons after which send event */
241 } POSTPACK WMI_THIN_MIB_BEACON_LOST_COUNT;
242
243 typedef PREPACK struct {
244     A_UINT8 rssi; /* the low threshold which can trigger an event warning */
245     A_UINT8 tolerance; /* the range above and below the threshold to prevent event flooding to the host. */
246     A_UINT8 count; /* the sample count of consecutive frames necessary to trigger an event. */
247     A_UINT8 reserved[1]; /* padding */
248 } POSTPACK WMI_THIN_MIB_RSSI_THRESHOLD;
249
250
251 typedef PREPACK struct {
252     A_UINT32 cap;
253     A_UINT32 rxRateField;
254     A_UINT32 beamForming;
255     A_UINT8 addr[ATH_MAC_LEN];
256     A_UINT8 enable;        
257     A_UINT8 stbc;
258     A_UINT8 maxAMPDU;    
259     A_UINT8 msduSpacing;
260     A_UINT8 mcsFeedback;   
261     A_UINT8 antennaSelCap;    
262 } POSTPACK WMI_THIN_MIB_HT_CAP;
263
264 typedef PREPACK struct {
265     A_UINT32 infoField;
266     A_UINT32 basicRateField;
267     A_UINT8 protection;
268     A_UINT8 secondChanneloffset;
269     A_UINT8 channelWidth;
270     A_UINT8 reserved;
271 } POSTPACK WMI_THIN_MIB_HT_OP;
272
273 typedef PREPACK struct {
274 #define SECOND_BEACON_PRIMARY   1
275 #define SECOND_BEACON_EITHER    2
276 #define SECOND_BEACON_SECONDARY 3
277     A_UINT8 cfg;
278     A_UINT8 reserved[3]; /* padding */
279 } POSTPACK WMI_THIN_MIB_HT_2ND_BEACON;
280
281 typedef PREPACK struct {
282     A_UINT8 txTIDField;
283     A_UINT8 rxTIDField;
284     A_UINT8 reserved[2]; /* padding */
285 } POSTPACK WMI_THIN_MIB_HT_BLOCK_ACK;
286
287 typedef PREPACK struct {
288     A_UINT8 enableLong; // 1 == long preamble, 0 == short preamble
289     A_UINT8 reserved[3];
290 } POSTPACK WMI_THIN_MIB_PREAMBLE;
291
292 typedef PREPACK struct {    
293     A_UINT16    length;     /* the length in bytes of the appended MIB data */
294     A_UINT8     mibID;      /* the ID of the MIB element being set */
295     A_UINT8     reserved; /* align padding */
296 } POSTPACK WMI_THIN_SET_MIB_CMD;
297
298 typedef PREPACK struct {    
299     A_UINT8     mibID;      /* the ID of the MIB element being set */
300     A_UINT8     reserved[3]; /* align padding */
301 } POSTPACK WMI_THIN_GET_MIB_CMD;
302
303 typedef PREPACK struct {
304     A_UINT32    basicRateMask; /* bit mask of basic rates */
305     A_UINT32    beaconIntval; /* TUs */
306     A_UINT16    atimWindow; /* TUs */
307     A_UINT16    channel; /* frequency in Mhz */
308     A_UINT8     networkType; /* INFRA_NETWORK | ADHOC_NETWORK */
309     A_UINT8     ssidLength; /* 0 - 32 */
310     A_UINT8     probe;      /* != 0 : issue probe req at start */
311     A_UINT8     reserved;   /* alignment */    
312     A_UCHAR     ssid[WMI_MAX_SSID_LEN];    
313     A_UINT8     bssid[ATH_MAC_LEN];
314 } POSTPACK WMI_THIN_JOIN_CMD;
315
316 typedef PREPACK struct {
317     A_UINT16 dtim; /* dtim interval in num beacons */
318     A_UINT16 aid; /* 80211 AID from Assoc resp */   
319 } POSTPACK WMI_THIN_POST_ASSOC_CMD;
320
321 typedef enum {
322     WMI_THIN_EVENTID_RESERVED_START           = 0x8000,
323     WMI_THIN_GET_MIB_EVENTID,
324     WMI_THIN_JOIN_EVENTID,
325     
326     /* Add new THIN EVENTID's here */
327     WMI_THIN_EVENTID_RESERVED_END           = 0x8fff    
328 } WMI_THIN_EVENT_ID;
329
330 /* Possible values for WMI_THIN_JOIN_EVENT.result */
331 typedef enum {
332     WMI_THIN_JOIN_RES_SUCCESS = 0, // device has joined the network
333     WMI_THIN_JOIN_RES_FAIL, // device failed for unspecified reason
334     WMI_THIN_JOIN_RES_TIMEOUT, // device failed due to no beacon rx in time limit
335     WMI_THIN_JOIN_RES_BAD_PARAM, // device failed due to bad cmd param.
336 }WMI_THIN_JOIN_RESULT;
337
338 typedef PREPACK struct {
339     A_UINT8 result; /* the result of the join cmd. one of WMI_THIN_JOIN_RESULT */
340     A_UINT8 reserved[3]; /* alignment */
341 } POSTPACK WMI_THIN_JOIN_EVENT;
342
343 #ifdef __cplusplus
344 }
345 #endif
346
347 #endif /* _WMI_THIN_H_ */