]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/net/wireless/libertas/hostcmd.h
kbuild: fix kbuild.txt typos
[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         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_subscribe_event {
155         struct cmd_header hdr;
156
157         __le16 action;
158         __le16 events;
159
160         /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
161          * number of TLVs. From the v5.1 manual, those TLVs would add up to
162          * 40 bytes. However, future firmware might add additional TLVs, so I
163          * bump this up a bit.
164          */
165         uint8_t tlv[128];
166 };
167
168 /*
169  * This scan handle Country Information IE(802.11d compliant)
170  * Define data structure for CMD_802_11_SCAN
171  */
172 struct cmd_ds_802_11_scan {
173         struct cmd_header hdr;
174
175         uint8_t bsstype;
176         uint8_t bssid[ETH_ALEN];
177         uint8_t tlvbuffer[0];
178 #if 0
179         mrvlietypes_ssidparamset_t ssidParamSet;
180         mrvlietypes_chanlistparamset_t ChanListParamSet;
181         mrvlietypes_ratesparamset_t OpRateSet;
182 #endif
183 };
184
185 struct cmd_ds_802_11_scan_rsp {
186         struct cmd_header hdr;
187
188         __le16 bssdescriptsize;
189         uint8_t nr_sets;
190         uint8_t bssdesc_and_tlvbuffer[0];
191 };
192
193 struct cmd_ds_802_11_get_log {
194         struct cmd_header hdr;
195
196         __le32 mcasttxframe;
197         __le32 failed;
198         __le32 retry;
199         __le32 multiretry;
200         __le32 framedup;
201         __le32 rtssuccess;
202         __le32 rtsfailure;
203         __le32 ackfailure;
204         __le32 rxfrag;
205         __le32 mcastrxframe;
206         __le32 fcserror;
207         __le32 txframe;
208         __le32 wepundecryptable;
209 };
210
211 struct cmd_ds_mac_control {
212         struct cmd_header hdr;
213         __le16 action;
214         u16 reserved;
215 };
216
217 struct cmd_ds_mac_multicast_adr {
218         struct cmd_header hdr;
219         __le16 action;
220         __le16 nr_of_adrs;
221         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
222 };
223
224 struct cmd_ds_802_11_authenticate {
225         u8 macaddr[ETH_ALEN];
226         u8 authtype;
227         u8 reserved[10];
228 };
229
230 struct cmd_ds_802_11_deauthenticate {
231         struct cmd_header hdr;
232
233         u8 macaddr[ETH_ALEN];
234         __le16 reasoncode;
235 };
236
237 struct cmd_ds_802_11_associate {
238         u8 peerstaaddr[6];
239         __le16 capability;
240         __le16 listeninterval;
241         __le16 bcnperiod;
242         u8 dtimperiod;
243
244 #if 0
245         mrvlietypes_ssidparamset_t ssidParamSet;
246         mrvlietypes_phyparamset_t phyparamset;
247         mrvlietypes_ssparamset_t ssparamset;
248         mrvlietypes_ratesparamset_t ratesParamSet;
249 #endif
250 } __attribute__ ((packed));
251
252 struct cmd_ds_802_11_associate_rsp {
253         struct ieeetypes_assocrsp assocRsp;
254 };
255
256 struct cmd_ds_802_11_set_wep {
257         struct cmd_header hdr;
258
259         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
260         __le16 action;
261
262         /* key Index selected for Tx */
263         __le16 keyindex;
264
265         /* 40, 128bit or TXWEP */
266         uint8_t keytype[4];
267         uint8_t keymaterial[4][16];
268 };
269
270 struct cmd_ds_802_3_get_stat {
271         __le32 xmitok;
272         __le32 rcvok;
273         __le32 xmiterror;
274         __le32 rcverror;
275         __le32 rcvnobuffer;
276         __le32 rcvcrcerror;
277 };
278
279 struct cmd_ds_802_11_get_stat {
280         __le32 txfragmentcnt;
281         __le32 mcasttxframecnt;
282         __le32 failedcnt;
283         __le32 retrycnt;
284         __le32 Multipleretrycnt;
285         __le32 rtssuccesscnt;
286         __le32 rtsfailurecnt;
287         __le32 ackfailurecnt;
288         __le32 frameduplicatecnt;
289         __le32 rxfragmentcnt;
290         __le32 mcastrxframecnt;
291         __le32 fcserrorcnt;
292         __le32 bcasttxframecnt;
293         __le32 bcastrxframecnt;
294         __le32 txbeacon;
295         __le32 rxbeacon;
296         __le32 wepundecryptable;
297 };
298
299 struct cmd_ds_802_11_snmp_mib {
300         struct cmd_header hdr;
301
302         __le16 action;
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         struct cmd_header hdr;
348
349         __le16 action;
350         __le16 control;
351 };
352
353 struct cmd_ds_802_11_beacon_control {
354         __le16 action;
355         __le16 beacon_enable;
356         __le16 beacon_period;
357 };
358
359 struct cmd_ds_802_11_sleep_params {
360         struct cmd_header hdr;
361
362         /* ACT_GET/ACT_SET */
363         __le16 action;
364
365         /* Sleep clock error in ppm */
366         __le16 error;
367
368         /* Wakeup offset in usec */
369         __le16 offset;
370
371         /* Clock stabilization time in usec */
372         __le16 stabletime;
373
374         /* control periodic calibration */
375         uint8_t calcontrol;
376
377         /* control the use of external sleep clock */
378         uint8_t externalsleepclk;
379
380         /* reserved field, should be set to zero */
381         __le16 reserved;
382 };
383
384 struct cmd_ds_802_11_inactivity_timeout {
385         struct cmd_header hdr;
386
387         /* ACT_GET/ACT_SET */
388         __le16 action;
389
390         /* Inactivity timeout in msec */
391         __le16 timeout;
392 };
393
394 struct cmd_ds_802_11_rf_channel {
395         struct cmd_header hdr;
396
397         __le16 action;
398         __le16 channel;
399         __le16 rftype;      /* unused */
400         __le16 reserved;    /* unused */
401         u8 channellist[32]; /* unused */
402 };
403
404 struct cmd_ds_802_11_rssi {
405         /* weighting factor */
406         __le16 N;
407
408         __le16 reserved_0;
409         __le16 reserved_1;
410         __le16 reserved_2;
411 };
412
413 struct cmd_ds_802_11_rssi_rsp {
414         __le16 SNR;
415         __le16 noisefloor;
416         __le16 avgSNR;
417         __le16 avgnoisefloor;
418 };
419
420 struct cmd_ds_802_11_mac_address {
421         struct cmd_header hdr;
422
423         __le16 action;
424         u8 macadd[ETH_ALEN];
425 };
426
427 struct cmd_ds_802_11_rf_tx_power {
428         struct cmd_header hdr;
429
430         __le16 action;
431         __le16 curlevel;
432         s8 maxlevel;
433         s8 minlevel;
434 };
435
436 struct cmd_ds_802_11_rf_antenna {
437         __le16 action;
438
439         /* Number of antennas or 0xffff(diversity) */
440         __le16 antennamode;
441
442 };
443
444 struct cmd_ds_802_11_monitor_mode {
445         __le16 action;
446         __le16 mode;
447 };
448
449 struct cmd_ds_set_boot2_ver {
450         struct cmd_header hdr;
451
452         __le16 action;
453         __le16 version;
454 };
455
456 struct cmd_ds_802_11_fw_wake_method {
457         struct cmd_header hdr;
458
459         __le16 action;
460         __le16 method;
461 };
462
463 struct cmd_ds_802_11_sleep_period {
464         struct cmd_header hdr;
465
466         __le16 action;
467         __le16 period;
468 };
469
470 struct cmd_ds_802_11_ps_mode {
471         __le16 action;
472         __le16 nullpktinterval;
473         __le16 multipledtim;
474         __le16 reserved;
475         __le16 locallisteninterval;
476 };
477
478 struct cmd_confirm_sleep {
479         struct cmd_header hdr;
480
481         __le16 action;
482         __le16 nullpktinterval;
483         __le16 multipledtim;
484         __le16 reserved;
485         __le16 locallisteninterval;
486 };
487
488 struct cmd_ds_802_11_data_rate {
489         struct cmd_header hdr;
490
491         __le16 action;
492         __le16 reserved;
493         u8 rates[MAX_RATES];
494 };
495
496 struct cmd_ds_802_11_rate_adapt_rateset {
497         struct cmd_header hdr;
498         __le16 action;
499         __le16 enablehwauto;
500         __le16 bitmap;
501 };
502
503 struct cmd_ds_802_11_ad_hoc_start {
504         struct cmd_header hdr;
505
506         u8 ssid[IW_ESSID_MAX_SIZE];
507         u8 bsstype;
508         __le16 beaconperiod;
509         u8 dtimperiod;   /* Reserved on v9 and later */
510         union IEEEtypes_ssparamset ssparamset;
511         union ieeetypes_phyparamset phyparamset;
512         __le16 probedelay;
513         __le16 capability;
514         u8 rates[MAX_RATES];
515         u8 tlv_memory_size_pad[100];
516 } __attribute__ ((packed));
517
518 struct cmd_ds_802_11_ad_hoc_result {
519         struct cmd_header hdr;
520
521         u8 pad[3];
522         u8 bssid[ETH_ALEN];
523 };
524
525 struct adhoc_bssdesc {
526         u8 bssid[ETH_ALEN];
527         u8 ssid[IW_ESSID_MAX_SIZE];
528         u8 type;
529         __le16 beaconperiod;
530         u8 dtimperiod;
531         __le64 timestamp;
532         __le64 localtime;
533         union ieeetypes_phyparamset phyparamset;
534         union IEEEtypes_ssparamset ssparamset;
535         __le16 capability;
536         u8 rates[MAX_RATES];
537
538         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
539          * Adhoc join command and will cause a binary layout mismatch with
540          * the firmware
541          */
542 } __attribute__ ((packed));
543
544 struct cmd_ds_802_11_ad_hoc_join {
545         struct cmd_header hdr;
546
547         struct adhoc_bssdesc bss;
548         __le16 failtimeout;   /* Reserved on v9 and later */
549         __le16 probedelay;    /* Reserved on v9 and later */
550 } __attribute__ ((packed));
551
552 struct cmd_ds_802_11_ad_hoc_stop {
553         struct cmd_header hdr;
554 } __attribute__ ((packed));
555
556 struct cmd_ds_802_11_enable_rsn {
557         struct cmd_header hdr;
558
559         __le16 action;
560         __le16 enable;
561 } __attribute__ ((packed));
562
563 struct MrvlIEtype_keyParamSet {
564         /* type ID */
565         __le16 type;
566
567         /* length of Payload */
568         __le16 length;
569
570         /* type of key: WEP=0, TKIP=1, AES=2 */
571         __le16 keytypeid;
572
573         /* key control Info specific to a keytypeid */
574         __le16 keyinfo;
575
576         /* length of key */
577         __le16 keylen;
578
579         /* key material of size keylen */
580         u8 key[32];
581 };
582
583 #define MAX_WOL_RULES           16
584
585 struct host_wol_rule {
586         uint8_t rule_no;
587         uint8_t rule_ops;
588         __le16 sig_offset;
589         __le16 sig_length;
590         __le16 reserve;
591         __be32 sig_mask;
592         __be32 signature;
593 };
594
595 struct wol_config {
596         uint8_t action;
597         uint8_t pattern;
598         uint8_t no_rules_in_cmd;
599         uint8_t result;
600         struct host_wol_rule rule[MAX_WOL_RULES];
601 };
602
603
604 struct cmd_ds_host_sleep {
605         struct cmd_header hdr;
606         __le32 criteria;
607         uint8_t gpio;
608         uint16_t gap;
609         struct wol_config wol_conf;
610 } __attribute__ ((packed));
611
612
613
614 struct cmd_ds_802_11_key_material {
615         struct cmd_header hdr;
616
617         __le16 action;
618         struct MrvlIEtype_keyParamSet keyParamSet[2];
619 } __attribute__ ((packed));
620
621 struct cmd_ds_802_11_eeprom_access {
622         struct cmd_header hdr;
623         __le16 action;
624         __le16 offset;
625         __le16 len;
626         /* firmware says it returns a maximum of 20 bytes */
627 #define LBS_EEPROM_READ_LEN 20
628         u8 value[LBS_EEPROM_READ_LEN];
629 } __attribute__ ((packed));
630
631 struct cmd_ds_802_11_tpc_cfg {
632         struct cmd_header hdr;
633
634         __le16 action;
635         uint8_t enable;
636         int8_t P0;
637         int8_t P1;
638         int8_t P2;
639         uint8_t usesnr;
640 } __attribute__ ((packed));
641
642
643 struct cmd_ds_802_11_pa_cfg {
644         struct cmd_header hdr;
645
646         __le16 action;
647         uint8_t enable;
648         int8_t P0;
649         int8_t P1;
650         int8_t P2;
651 } __attribute__ ((packed));
652
653
654 struct cmd_ds_802_11_led_ctrl {
655         __le16 action;
656         __le16 numled;
657         u8 data[256];
658 } __attribute__ ((packed));
659
660 struct cmd_ds_802_11_afc {
661         __le16 afc_auto;
662         union {
663                 struct {
664                         __le16 threshold;
665                         __le16 period;
666                 };
667                 struct {
668                         __le16 timing_offset; /* signed */
669                         __le16 carrier_offset; /* signed */
670                 };
671         };
672 } __attribute__ ((packed));
673
674 struct cmd_tx_rate_query {
675         __le16 txrate;
676 } __attribute__ ((packed));
677
678 struct cmd_ds_get_tsf {
679         __le64 tsfvalue;
680 } __attribute__ ((packed));
681
682 struct cmd_ds_bt_access {
683         __le16 action;
684         __le32 id;
685         u8 addr1[ETH_ALEN];
686         u8 addr2[ETH_ALEN];
687 } __attribute__ ((packed));
688
689 struct cmd_ds_fwt_access {
690         __le16 action;
691         __le32 id;
692         u8 valid;
693         u8 da[ETH_ALEN];
694         u8 dir;
695         u8 ra[ETH_ALEN];
696         __le32 ssn;
697         __le32 dsn;
698         __le32 metric;
699         u8 rate;
700         u8 hopcount;
701         u8 ttl;
702         __le32 expiration;
703         u8 sleepmode;
704         __le32 snr;
705         __le32 references;
706         u8 prec[ETH_ALEN];
707 } __attribute__ ((packed));
708
709
710 struct cmd_ds_mesh_config {
711         struct cmd_header hdr;
712
713         __le16 action;
714         __le16 channel;
715         __le16 type;
716         __le16 length;
717         u8 data[128];   /* last position reserved */
718 } __attribute__ ((packed));
719
720
721 struct cmd_ds_mesh_access {
722         struct cmd_header hdr;
723
724         __le16 action;
725         __le32 data[32];        /* last position reserved */
726 } __attribute__ ((packed));
727
728 /* Number of stats counters returned by the firmware */
729 #define MESH_STATS_NUM 8
730
731 struct cmd_ds_command {
732         /* command header */
733         __le16 command;
734         __le16 size;
735         __le16 seqnum;
736         __le16 result;
737
738         /* command Body */
739         union {
740                 struct cmd_ds_802_11_ps_mode psmode;
741                 struct cmd_ds_802_11_associate associate;
742                 struct cmd_ds_802_11_authenticate auth;
743                 struct cmd_ds_802_11_get_stat gstat;
744                 struct cmd_ds_802_3_get_stat gstat_8023;
745                 struct cmd_ds_802_11_rf_antenna rant;
746                 struct cmd_ds_802_11_monitor_mode monitor;
747                 struct cmd_ds_802_11_rssi rssi;
748                 struct cmd_ds_802_11_rssi_rsp rssirsp;
749                 struct cmd_ds_mac_reg_access macreg;
750                 struct cmd_ds_bbp_reg_access bbpreg;
751                 struct cmd_ds_rf_reg_access rfreg;
752
753                 struct cmd_ds_802_11d_domain_info domaininfo;
754                 struct cmd_ds_802_11d_domain_info domaininforesp;
755
756                 struct cmd_ds_802_11_tpc_cfg tpccfg;
757                 struct cmd_ds_802_11_afc afc;
758                 struct cmd_ds_802_11_led_ctrl ledgpio;
759
760                 struct cmd_tx_rate_query txrate;
761                 struct cmd_ds_bt_access bt;
762                 struct cmd_ds_fwt_access fwt;
763                 struct cmd_ds_get_tsf gettsf;
764                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
765         } params;
766 } __attribute__ ((packed));
767
768 #endif