]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/net/wireless/libertas/hostcmd.h
ed502b74fa3c9c83264707a72af2aa79ff21812e
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / libertas / hostcmd.h
1 /*
2  * This file contains the function prototypes, data structure
3  * and defines for all the host/station commands
4  */
5 #ifndef _LBS_HOSTCMD_H
6 #define _LBS_HOSTCMD_H
7
8 #include <linux/wireless.h>
9 #include "11d.h"
10 #include "types.h"
11
12 /* 802.11-related definitions */
13
14 /* TxPD descriptor */
15 struct txpd {
16         /* Current Tx packet status */
17         __le32 tx_status;
18         /* Tx control */
19         __le32 tx_control;
20         __le32 tx_packet_location;
21         /* Tx packet length */
22         __le16 tx_packet_length;
23         /* First 2 byte of destination MAC address */
24         u8 tx_dest_addr_high[2];
25         /* Last 4 byte of destination MAC address */
26         u8 tx_dest_addr_low[4];
27         /* Pkt Priority */
28         u8 priority;
29         /* Pkt Trasnit Power control */
30         u8 powermgmt;
31         /* Amount of time the packet has been queued in the driver (units = 2ms) */
32         u8 pktdelay_2ms;
33         /* reserved */
34         u8 reserved1;
35 };
36
37 /* RxPD Descriptor */
38 struct rxpd {
39         /* Current Rx packet status */
40         __le16 status;
41
42         /* SNR */
43         u8 snr;
44
45         /* Tx control */
46         u8 rx_control;
47
48         /* Pkt length */
49         __le16 pkt_len;
50
51         /* Noise Floor */
52         u8 nf;
53
54         /* Rx Packet Rate */
55         u8 rx_rate;
56
57         /* Pkt addr */
58         __le32 pkt_ptr;
59
60         /* Next Rx RxPD addr */
61         __le32 next_rxpd_ptr;
62
63         /* Pkt Priority */
64         u8 priority;
65         u8 reserved[3];
66 };
67
68 struct cmd_ctrl_node {
69         struct list_head list;
70         /* wait for finish or not */
71         u16 wait_option;
72         /* command response */
73         void *pdata_buf;
74         int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp);
75         unsigned long callback_arg;
76         /* command data */
77         u8 *bufvirtualaddr;
78         /* wait queue */
79         u16 cmdwaitqwoken;
80         wait_queue_head_t cmdwait_q;
81 };
82
83 /* Generic structure to hold all key types. */
84 struct enc_key {
85         u16 len;
86         u16 flags;  /* KEY_INFO_* from defs.h */
87         u16 type; /* KEY_TYPE_* from defs.h */
88         u8 key[32];
89 };
90
91 /* lbs_offset_value */
92 struct lbs_offset_value {
93         u32 offset;
94         u32 value;
95 };
96
97 /* Define general data structure */
98 /* cmd_DS_GEN */
99 struct cmd_ds_gen {
100         __le16 command;
101         __le16 size;
102         __le16 seqnum;
103         __le16 result;
104         void *cmdresp[0];
105 };
106
107 #define S_DS_GEN sizeof(struct cmd_ds_gen)
108
109
110 /*
111  * Define data structure for CMD_GET_HW_SPEC
112  * This structure defines the response for the GET_HW_SPEC command
113  */
114 struct cmd_ds_get_hw_spec {
115         /* HW Interface version number */
116         __le16 hwifversion;
117         /* HW version number */
118         __le16 version;
119         /* Max number of TxPD FW can handle */
120         __le16 nr_txpd;
121         /* Max no of Multicast address */
122         __le16 nr_mcast_adr;
123         /* MAC address */
124         u8 permanentaddr[6];
125
126         /* region Code */
127         __le16 regioncode;
128
129         /* Number of antenna used */
130         __le16 nr_antenna;
131
132         /* FW release number, example 1,2,3,4 = 3.2.1p4 */
133         u8 fwreleasenumber[4];
134
135         /* Base Address of TxPD queue */
136         __le32 wcb_base;
137         /* Read Pointer of RxPd queue */
138         __le32 rxpd_rdptr;
139
140         /* Write Pointer of RxPd queue */
141         __le32 rxpd_wrptr;
142
143         /*FW/HW capability */
144         __le32 fwcapinfo;
145 } __attribute__ ((packed));
146
147 struct cmd_ds_802_11_reset {
148         __le16 action;
149 };
150
151 struct cmd_ds_802_11_subscribe_event {
152         __le16 action;
153         __le16 events;
154
155         /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
156          * number of TLVs. From the v5.1 manual, those TLVs would add up to
157          * 40 bytes. However, future firmware might add additional TLVs, so I
158          * bump this up a bit.
159          */
160         u8 tlv[128];
161 };
162
163 /*
164  * This scan handle Country Information IE(802.11d compliant)
165  * Define data structure for CMD_802_11_SCAN
166  */
167 struct cmd_ds_802_11_scan {
168         u8 bsstype;
169         u8 bssid[ETH_ALEN];
170         u8 tlvbuffer[1];
171 #if 0
172         mrvlietypes_ssidparamset_t ssidParamSet;
173         mrvlietypes_chanlistparamset_t ChanListParamSet;
174         mrvlietypes_ratesparamset_t OpRateSet;
175 #endif
176 };
177
178 struct cmd_ds_802_11_scan_rsp {
179         __le16 bssdescriptsize;
180         u8 nr_sets;
181         u8 bssdesc_and_tlvbuffer[1];
182 };
183
184 struct cmd_ds_802_11_get_log {
185         __le32 mcasttxframe;
186         __le32 failed;
187         __le32 retry;
188         __le32 multiretry;
189         __le32 framedup;
190         __le32 rtssuccess;
191         __le32 rtsfailure;
192         __le32 ackfailure;
193         __le32 rxfrag;
194         __le32 mcastrxframe;
195         __le32 fcserror;
196         __le32 txframe;
197         __le32 wepundecryptable;
198 };
199
200 struct cmd_ds_mac_control {
201         __le16 action;
202         __le16 reserved;
203 };
204
205 struct cmd_ds_mac_multicast_adr {
206         __le16 action;
207         __le16 nr_of_adrs;
208         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
209 };
210
211 struct cmd_ds_802_11_authenticate {
212         u8 macaddr[ETH_ALEN];
213         u8 authtype;
214         u8 reserved[10];
215 };
216
217 struct cmd_ds_802_11_deauthenticate {
218         u8 macaddr[6];
219         __le16 reasoncode;
220 };
221
222 struct cmd_ds_802_11_associate {
223         u8 peerstaaddr[6];
224         __le16 capability;
225         __le16 listeninterval;
226         __le16 bcnperiod;
227         u8 dtimperiod;
228
229 #if 0
230         mrvlietypes_ssidparamset_t ssidParamSet;
231         mrvlietypes_phyparamset_t phyparamset;
232         mrvlietypes_ssparamset_t ssparamset;
233         mrvlietypes_ratesparamset_t ratesParamSet;
234 #endif
235 } __attribute__ ((packed));
236
237 struct cmd_ds_802_11_disassociate {
238         u8 destmacaddr[6];
239         __le16 reasoncode;
240 };
241
242 struct cmd_ds_802_11_associate_rsp {
243         struct ieeetypes_assocrsp assocRsp;
244 };
245
246 struct cmd_ds_802_11_ad_hoc_result {
247         u8 pad[3];
248         u8 bssid[ETH_ALEN];
249 };
250
251 struct cmd_ds_802_11_set_wep {
252         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
253         __le16 action;
254
255         /* key Index selected for Tx */
256         __le16 keyindex;
257
258         /* 40, 128bit or TXWEP */
259         u8 keytype[4];
260         u8 keymaterial[4][16];
261 };
262
263 struct cmd_ds_802_3_get_stat {
264         __le32 xmitok;
265         __le32 rcvok;
266         __le32 xmiterror;
267         __le32 rcverror;
268         __le32 rcvnobuffer;
269         __le32 rcvcrcerror;
270 };
271
272 struct cmd_ds_802_11_get_stat {
273         __le32 txfragmentcnt;
274         __le32 mcasttxframecnt;
275         __le32 failedcnt;
276         __le32 retrycnt;
277         __le32 Multipleretrycnt;
278         __le32 rtssuccesscnt;
279         __le32 rtsfailurecnt;
280         __le32 ackfailurecnt;
281         __le32 frameduplicatecnt;
282         __le32 rxfragmentcnt;
283         __le32 mcastrxframecnt;
284         __le32 fcserrorcnt;
285         __le32 bcasttxframecnt;
286         __le32 bcastrxframecnt;
287         __le32 txbeacon;
288         __le32 rxbeacon;
289         __le32 wepundecryptable;
290 };
291
292 struct cmd_ds_802_11_snmp_mib {
293         __le16 querytype;
294         __le16 oid;
295         __le16 bufsize;
296         u8 value[128];
297 };
298
299 struct cmd_ds_mac_reg_map {
300         __le16 buffersize;
301         u8 regmap[128];
302         __le16 reserved;
303 };
304
305 struct cmd_ds_bbp_reg_map {
306         __le16 buffersize;
307         u8 regmap[128];
308         __le16 reserved;
309 };
310
311 struct cmd_ds_rf_reg_map {
312         __le16 buffersize;
313         u8 regmap[64];
314         __le16 reserved;
315 };
316
317 struct cmd_ds_mac_reg_access {
318         __le16 action;
319         __le16 offset;
320         __le32 value;
321 };
322
323 struct cmd_ds_bbp_reg_access {
324         __le16 action;
325         __le16 offset;
326         u8 value;
327         u8 reserved[3];
328 };
329
330 struct cmd_ds_rf_reg_access {
331         __le16 action;
332         __le16 offset;
333         u8 value;
334         u8 reserved[3];
335 };
336
337 struct cmd_ds_802_11_radio_control {
338         __le16 action;
339         __le16 control;
340 };
341
342 struct cmd_ds_802_11_beacon_control {
343         __le16 action;
344         __le16 beacon_enable;
345         __le16 beacon_period;
346 };
347
348 struct cmd_ds_802_11_sleep_params {
349         /* ACT_GET/ACT_SET */
350         __le16 action;
351
352         /* Sleep clock error in ppm */
353         __le16 error;
354
355         /* Wakeup offset in usec */
356         __le16 offset;
357
358         /* Clock stabilization time in usec */
359         __le16 stabletime;
360
361         /* control periodic calibration */
362         u8 calcontrol;
363
364         /* control the use of external sleep clock */
365         u8 externalsleepclk;
366
367         /* reserved field, should be set to zero */
368         __le16 reserved;
369 };
370
371 struct cmd_ds_802_11_inactivity_timeout {
372         /* ACT_GET/ACT_SET */
373         __le16 action;
374
375         /* Inactivity timeout in msec */
376         __le16 timeout;
377 };
378
379 struct cmd_ds_802_11_rf_channel {
380         __le16 action;
381         __le16 currentchannel;
382         __le16 rftype;
383         __le16 reserved;
384         u8 channellist[32];
385 };
386
387 struct cmd_ds_802_11_rssi {
388         /* weighting factor */
389         __le16 N;
390
391         __le16 reserved_0;
392         __le16 reserved_1;
393         __le16 reserved_2;
394 };
395
396 struct cmd_ds_802_11_rssi_rsp {
397         __le16 SNR;
398         __le16 noisefloor;
399         __le16 avgSNR;
400         __le16 avgnoisefloor;
401 };
402
403 struct cmd_ds_802_11_mac_address {
404         __le16 action;
405         u8 macadd[ETH_ALEN];
406 };
407
408 struct cmd_ds_802_11_rf_tx_power {
409         __le16 action;
410         __le16 currentlevel;
411 };
412
413 struct cmd_ds_802_11_rf_antenna {
414         __le16 action;
415
416         /* Number of antennas or 0xffff(diversity) */
417         __le16 antennamode;
418
419 };
420
421 struct cmd_ds_802_11_monitor_mode {
422         __le16 action;
423         __le16 mode;
424 };
425
426 struct cmd_ds_set_boot2_ver {
427         __le16 action;
428         __le16 version;
429 };
430
431 struct cmd_ds_802_11_ps_mode {
432         __le16 action;
433         __le16 nullpktinterval;
434         __le16 multipledtim;
435         __le16 reserved;
436         __le16 locallisteninterval;
437 };
438
439 struct PS_CMD_ConfirmSleep {
440         __le16 command;
441         __le16 size;
442         __le16 seqnum;
443         __le16 result;
444
445         __le16 action;
446         __le16 reserved1;
447         __le16 multipledtim;
448         __le16 reserved;
449         __le16 locallisteninterval;
450 };
451
452 struct cmd_ds_802_11_data_rate {
453         __le16 action;
454         __le16 reserved;
455         u8 rates[MAX_RATES];
456 };
457
458 struct cmd_ds_802_11_rate_adapt_rateset {
459         __le16 action;
460         __le16 enablehwauto;
461         __le16 bitmap;
462 };
463
464 struct cmd_ds_802_11_ad_hoc_start {
465         u8 ssid[IW_ESSID_MAX_SIZE];
466         u8 bsstype;
467         __le16 beaconperiod;
468         u8 dtimperiod;
469         union IEEEtypes_ssparamset ssparamset;
470         union ieeetypes_phyparamset phyparamset;
471         __le16 probedelay;
472         __le16 capability;
473         u8 rates[MAX_RATES];
474         u8 tlv_memory_size_pad[100];
475 } __attribute__ ((packed));
476
477 struct adhoc_bssdesc {
478         u8 bssid[6];
479         u8 ssid[32];
480         u8 type;
481         __le16 beaconperiod;
482         u8 dtimperiod;
483         __le64 timestamp;
484         __le64 localtime;
485         union ieeetypes_phyparamset phyparamset;
486         union IEEEtypes_ssparamset ssparamset;
487         __le16 capability;
488         u8 rates[MAX_RATES];
489
490         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
491          * Adhoc join command and will cause a binary layout mismatch with
492          * the firmware
493          */
494 } __attribute__ ((packed));
495
496 struct cmd_ds_802_11_ad_hoc_join {
497         struct adhoc_bssdesc bss;
498         __le16 failtimeout;
499         __le16 probedelay;
500
501 } __attribute__ ((packed));
502
503 struct cmd_ds_802_11_enable_rsn {
504         __le16 action;
505         __le16 enable;
506 } __attribute__ ((packed));
507
508 struct MrvlIEtype_keyParamSet {
509         /* type ID */
510         __le16 type;
511
512         /* length of Payload */
513         __le16 length;
514
515         /* type of key: WEP=0, TKIP=1, AES=2 */
516         __le16 keytypeid;
517
518         /* key control Info specific to a keytypeid */
519         __le16 keyinfo;
520
521         /* length of key */
522         __le16 keylen;
523
524         /* key material of size keylen */
525         u8 key[32];
526 };
527
528 struct cmd_ds_802_11_key_material {
529         __le16 action;
530         struct MrvlIEtype_keyParamSet keyParamSet[2];
531 } __attribute__ ((packed));
532
533 struct cmd_ds_802_11_eeprom_access {
534         __le16 action;
535
536         /* multiple 4 */
537         __le16 offset;
538         __le16 bytecount;
539         u8 value;
540 } __attribute__ ((packed));
541
542 struct cmd_ds_802_11_tpc_cfg {
543         __le16 action;
544         u8 enable;
545         s8 P0;
546         s8 P1;
547         s8 P2;
548         u8 usesnr;
549 } __attribute__ ((packed));
550
551 struct cmd_ds_802_11_led_ctrl {
552         __le16 action;
553         __le16 numled;
554         u8 data[256];
555 } __attribute__ ((packed));
556
557 struct cmd_ds_802_11_pwr_cfg {
558         __le16 action;
559         u8 enable;
560         s8 PA_P0;
561         s8 PA_P1;
562         s8 PA_P2;
563 } __attribute__ ((packed));
564
565 struct cmd_ds_802_11_afc {
566         __le16 afc_auto;
567         union {
568                 struct {
569                         __le16 threshold;
570                         __le16 period;
571                 };
572                 struct {
573                         __le16 timing_offset; /* signed */
574                         __le16 carrier_offset; /* signed */
575                 };
576         };
577 } __attribute__ ((packed));
578
579 struct cmd_tx_rate_query {
580         __le16 txrate;
581 } __attribute__ ((packed));
582
583 struct cmd_ds_get_tsf {
584         __le64 tsfvalue;
585 } __attribute__ ((packed));
586
587 struct cmd_ds_bt_access {
588         __le16 action;
589         __le32 id;
590         u8 addr1[ETH_ALEN];
591         u8 addr2[ETH_ALEN];
592 } __attribute__ ((packed));
593
594 struct cmd_ds_fwt_access {
595         __le16 action;
596         __le32 id;
597         u8 valid;
598         u8 da[ETH_ALEN];
599         u8 dir;
600         u8 ra[ETH_ALEN];
601         __le32 ssn;
602         __le32 dsn;
603         __le32 metric;
604         u8 rate;
605         u8 hopcount;
606         u8 ttl;
607         __le32 expiration;
608         u8 sleepmode;
609         __le32 snr;
610         __le32 references;
611         u8 prec[ETH_ALEN];
612 } __attribute__ ((packed));
613
614 struct cmd_ds_mesh_access {
615         __le16 action;
616         __le32 data[32];        /* last position reserved */
617 } __attribute__ ((packed));
618
619 /* Number of stats counters returned by the firmware */
620 #define MESH_STATS_NUM 8
621
622 struct cmd_ds_command {
623         /* command header */
624         __le16 command;
625         __le16 size;
626         __le16 seqnum;
627         __le16 result;
628
629         /* command Body */
630         union {
631                 struct cmd_ds_get_hw_spec hwspec;
632                 struct cmd_ds_802_11_ps_mode psmode;
633                 struct cmd_ds_802_11_scan scan;
634                 struct cmd_ds_802_11_scan_rsp scanresp;
635                 struct cmd_ds_mac_control macctrl;
636                 struct cmd_ds_802_11_associate associate;
637                 struct cmd_ds_802_11_deauthenticate deauth;
638                 struct cmd_ds_802_11_set_wep wep;
639                 struct cmd_ds_802_11_ad_hoc_start ads;
640                 struct cmd_ds_802_11_reset reset;
641                 struct cmd_ds_802_11_ad_hoc_result result;
642                 struct cmd_ds_802_11_get_log glog;
643                 struct cmd_ds_802_11_authenticate auth;
644                 struct cmd_ds_802_11_get_stat gstat;
645                 struct cmd_ds_802_3_get_stat gstat_8023;
646                 struct cmd_ds_802_11_snmp_mib smib;
647                 struct cmd_ds_802_11_rf_tx_power txp;
648                 struct cmd_ds_802_11_rf_antenna rant;
649                 struct cmd_ds_802_11_monitor_mode monitor;
650                 struct cmd_ds_802_11_data_rate drate;
651                 struct cmd_ds_802_11_rate_adapt_rateset rateset;
652                 struct cmd_ds_mac_multicast_adr madr;
653                 struct cmd_ds_802_11_ad_hoc_join adj;
654                 struct cmd_ds_802_11_radio_control radio;
655                 struct cmd_ds_802_11_rf_channel rfchannel;
656                 struct cmd_ds_802_11_rssi rssi;
657                 struct cmd_ds_802_11_rssi_rsp rssirsp;
658                 struct cmd_ds_802_11_disassociate dassociate;
659                 struct cmd_ds_802_11_mac_address macadd;
660                 struct cmd_ds_802_11_enable_rsn enbrsn;
661                 struct cmd_ds_802_11_key_material keymaterial;
662                 struct cmd_ds_mac_reg_access macreg;
663                 struct cmd_ds_bbp_reg_access bbpreg;
664                 struct cmd_ds_rf_reg_access rfreg;
665                 struct cmd_ds_802_11_eeprom_access rdeeprom;
666
667                 struct cmd_ds_802_11d_domain_info domaininfo;
668                 struct cmd_ds_802_11d_domain_info domaininforesp;
669
670                 struct cmd_ds_802_11_sleep_params sleep_params;
671                 struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
672                 struct cmd_ds_802_11_tpc_cfg tpccfg;
673                 struct cmd_ds_802_11_pwr_cfg pwrcfg;
674                 struct cmd_ds_802_11_afc afc;
675                 struct cmd_ds_802_11_led_ctrl ledgpio;
676
677                 struct cmd_tx_rate_query txrate;
678                 struct cmd_ds_bt_access bt;
679                 struct cmd_ds_fwt_access fwt;
680                 struct cmd_ds_mesh_access mesh;
681                 struct cmd_ds_set_boot2_ver boot2_ver;
682                 struct cmd_ds_get_tsf gettsf;
683                 struct cmd_ds_802_11_subscribe_event subscribe_event;
684                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
685         } params;
686 } __attribute__ ((packed));
687
688 #endif