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