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