]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/net/wireless/libertas/hostcmd.h
libertas: convert CMD_802_11_RF_TX_POWER to a direct command
[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_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         struct cmd_header hdr;
199
200         __le32 mcasttxframe;
201         __le32 failed;
202         __le32 retry;
203         __le32 multiretry;
204         __le32 framedup;
205         __le32 rtssuccess;
206         __le32 rtsfailure;
207         __le32 ackfailure;
208         __le32 rxfrag;
209         __le32 mcastrxframe;
210         __le32 fcserror;
211         __le32 txframe;
212         __le32 wepundecryptable;
213 };
214
215 struct cmd_ds_mac_control {
216         struct cmd_header hdr;
217         __le16 action;
218         u16 reserved;
219 };
220
221 struct cmd_ds_mac_multicast_adr {
222         struct cmd_header hdr;
223         __le16 action;
224         __le16 nr_of_adrs;
225         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
226 };
227
228 struct cmd_ds_802_11_authenticate {
229         u8 macaddr[ETH_ALEN];
230         u8 authtype;
231         u8 reserved[10];
232 };
233
234 struct cmd_ds_802_11_deauthenticate {
235         u8 macaddr[6];
236         __le16 reasoncode;
237 };
238
239 struct cmd_ds_802_11_associate {
240         u8 peerstaaddr[6];
241         __le16 capability;
242         __le16 listeninterval;
243         __le16 bcnperiod;
244         u8 dtimperiod;
245
246 #if 0
247         mrvlietypes_ssidparamset_t ssidParamSet;
248         mrvlietypes_phyparamset_t phyparamset;
249         mrvlietypes_ssparamset_t ssparamset;
250         mrvlietypes_ratesparamset_t ratesParamSet;
251 #endif
252 } __attribute__ ((packed));
253
254 struct cmd_ds_802_11_disassociate {
255         u8 destmacaddr[6];
256         __le16 reasoncode;
257 };
258
259 struct cmd_ds_802_11_associate_rsp {
260         struct ieeetypes_assocrsp assocRsp;
261 };
262
263 struct cmd_ds_802_11_ad_hoc_result {
264         u8 pad[3];
265         u8 bssid[ETH_ALEN];
266 };
267
268 struct cmd_ds_802_11_set_wep {
269         struct cmd_header hdr;
270
271         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
272         __le16 action;
273
274         /* key Index selected for Tx */
275         __le16 keyindex;
276
277         /* 40, 128bit or TXWEP */
278         uint8_t keytype[4];
279         uint8_t keymaterial[4][16];
280 };
281
282 struct cmd_ds_802_3_get_stat {
283         __le32 xmitok;
284         __le32 rcvok;
285         __le32 xmiterror;
286         __le32 rcverror;
287         __le32 rcvnobuffer;
288         __le32 rcvcrcerror;
289 };
290
291 struct cmd_ds_802_11_get_stat {
292         __le32 txfragmentcnt;
293         __le32 mcasttxframecnt;
294         __le32 failedcnt;
295         __le32 retrycnt;
296         __le32 Multipleretrycnt;
297         __le32 rtssuccesscnt;
298         __le32 rtsfailurecnt;
299         __le32 ackfailurecnt;
300         __le32 frameduplicatecnt;
301         __le32 rxfragmentcnt;
302         __le32 mcastrxframecnt;
303         __le32 fcserrorcnt;
304         __le32 bcasttxframecnt;
305         __le32 bcastrxframecnt;
306         __le32 txbeacon;
307         __le32 rxbeacon;
308         __le32 wepundecryptable;
309 };
310
311 struct cmd_ds_802_11_snmp_mib {
312         __le16 querytype;
313         __le16 oid;
314         __le16 bufsize;
315         u8 value[128];
316 };
317
318 struct cmd_ds_mac_reg_map {
319         __le16 buffersize;
320         u8 regmap[128];
321         __le16 reserved;
322 };
323
324 struct cmd_ds_bbp_reg_map {
325         __le16 buffersize;
326         u8 regmap[128];
327         __le16 reserved;
328 };
329
330 struct cmd_ds_rf_reg_map {
331         __le16 buffersize;
332         u8 regmap[64];
333         __le16 reserved;
334 };
335
336 struct cmd_ds_mac_reg_access {
337         __le16 action;
338         __le16 offset;
339         __le32 value;
340 };
341
342 struct cmd_ds_bbp_reg_access {
343         __le16 action;
344         __le16 offset;
345         u8 value;
346         u8 reserved[3];
347 };
348
349 struct cmd_ds_rf_reg_access {
350         __le16 action;
351         __le16 offset;
352         u8 value;
353         u8 reserved[3];
354 };
355
356 struct cmd_ds_802_11_radio_control {
357         struct cmd_header hdr;
358
359         __le16 action;
360         __le16 control;
361 };
362
363 struct cmd_ds_802_11_beacon_control {
364         __le16 action;
365         __le16 beacon_enable;
366         __le16 beacon_period;
367 };
368
369 struct cmd_ds_802_11_sleep_params {
370         struct cmd_header hdr;
371
372         /* ACT_GET/ACT_SET */
373         __le16 action;
374
375         /* Sleep clock error in ppm */
376         __le16 error;
377
378         /* Wakeup offset in usec */
379         __le16 offset;
380
381         /* Clock stabilization time in usec */
382         __le16 stabletime;
383
384         /* control periodic calibration */
385         uint8_t calcontrol;
386
387         /* control the use of external sleep clock */
388         uint8_t externalsleepclk;
389
390         /* reserved field, should be set to zero */
391         __le16 reserved;
392 };
393
394 struct cmd_ds_802_11_inactivity_timeout {
395         struct cmd_header hdr;
396
397         /* ACT_GET/ACT_SET */
398         __le16 action;
399
400         /* Inactivity timeout in msec */
401         __le16 timeout;
402 };
403
404 struct cmd_ds_802_11_rf_channel {
405         struct cmd_header hdr;
406
407         __le16 action;
408         __le16 channel;
409         __le16 rftype;      /* unused */
410         __le16 reserved;    /* unused */
411         u8 channellist[32]; /* unused */
412 };
413
414 struct cmd_ds_802_11_rssi {
415         /* weighting factor */
416         __le16 N;
417
418         __le16 reserved_0;
419         __le16 reserved_1;
420         __le16 reserved_2;
421 };
422
423 struct cmd_ds_802_11_rssi_rsp {
424         __le16 SNR;
425         __le16 noisefloor;
426         __le16 avgSNR;
427         __le16 avgnoisefloor;
428 };
429
430 struct cmd_ds_802_11_mac_address {
431         struct cmd_header hdr;
432
433         __le16 action;
434         u8 macadd[ETH_ALEN];
435 };
436
437 struct cmd_ds_802_11_rf_tx_power {
438         struct cmd_header hdr;
439
440         __le16 action;
441         __le16 curlevel;
442         s8 maxlevel;
443         s8 minlevel;
444 };
445
446 struct cmd_ds_802_11_rf_antenna {
447         __le16 action;
448
449         /* Number of antennas or 0xffff(diversity) */
450         __le16 antennamode;
451
452 };
453
454 struct cmd_ds_802_11_monitor_mode {
455         __le16 action;
456         __le16 mode;
457 };
458
459 struct cmd_ds_set_boot2_ver {
460         struct cmd_header hdr;
461
462         __le16 action;
463         __le16 version;
464 };
465
466 struct cmd_ds_802_11_fw_wake_method {
467         struct cmd_header hdr;
468
469         __le16 action;
470         __le16 method;
471 };
472
473 struct cmd_ds_802_11_sleep_period {
474         struct cmd_header hdr;
475
476         __le16 action;
477         __le16 period;
478 };
479
480 struct cmd_ds_802_11_ps_mode {
481         __le16 action;
482         __le16 nullpktinterval;
483         __le16 multipledtim;
484         __le16 reserved;
485         __le16 locallisteninterval;
486 };
487
488 struct cmd_confirm_sleep {
489         struct cmd_header hdr;
490
491         __le16 action;
492         __le16 nullpktinterval;
493         __le16 multipledtim;
494         __le16 reserved;
495         __le16 locallisteninterval;
496 };
497
498 struct cmd_ds_802_11_data_rate {
499         struct cmd_header hdr;
500
501         __le16 action;
502         __le16 reserved;
503         u8 rates[MAX_RATES];
504 };
505
506 struct cmd_ds_802_11_rate_adapt_rateset {
507         struct cmd_header hdr;
508         __le16 action;
509         __le16 enablehwauto;
510         __le16 bitmap;
511 };
512
513 struct cmd_ds_802_11_ad_hoc_start {
514         u8 ssid[IW_ESSID_MAX_SIZE];
515         u8 bsstype;
516         __le16 beaconperiod;
517         u8 dtimperiod;
518         union IEEEtypes_ssparamset ssparamset;
519         union ieeetypes_phyparamset phyparamset;
520         __le16 probedelay;
521         __le16 capability;
522         u8 rates[MAX_RATES];
523         u8 tlv_memory_size_pad[100];
524 } __attribute__ ((packed));
525
526 struct adhoc_bssdesc {
527         u8 bssid[6];
528         u8 ssid[32];
529         u8 type;
530         __le16 beaconperiod;
531         u8 dtimperiod;
532         __le64 timestamp;
533         __le64 localtime;
534         union ieeetypes_phyparamset phyparamset;
535         union IEEEtypes_ssparamset ssparamset;
536         __le16 capability;
537         u8 rates[MAX_RATES];
538
539         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
540          * Adhoc join command and will cause a binary layout mismatch with
541          * the firmware
542          */
543 } __attribute__ ((packed));
544
545 struct cmd_ds_802_11_ad_hoc_join {
546         struct adhoc_bssdesc bss;
547         __le16 failtimeout;
548         __le16 probedelay;
549
550 } __attribute__ ((packed));
551
552 struct cmd_ds_802_11_enable_rsn {
553         struct cmd_header hdr;
554
555         __le16 action;
556         __le16 enable;
557 } __attribute__ ((packed));
558
559 struct MrvlIEtype_keyParamSet {
560         /* type ID */
561         __le16 type;
562
563         /* length of Payload */
564         __le16 length;
565
566         /* type of key: WEP=0, TKIP=1, AES=2 */
567         __le16 keytypeid;
568
569         /* key control Info specific to a keytypeid */
570         __le16 keyinfo;
571
572         /* length of key */
573         __le16 keylen;
574
575         /* key material of size keylen */
576         u8 key[32];
577 };
578
579 struct cmd_ds_host_sleep {
580         struct cmd_header hdr;
581         __le32 criteria;
582         uint8_t gpio;
583         uint8_t gap;
584 } __attribute__ ((packed));
585
586 struct cmd_ds_802_11_key_material {
587         struct cmd_header hdr;
588
589         __le16 action;
590         struct MrvlIEtype_keyParamSet keyParamSet[2];
591 } __attribute__ ((packed));
592
593 struct cmd_ds_802_11_eeprom_access {
594         struct cmd_header hdr;
595         __le16 action;
596         __le16 offset;
597         __le16 len;
598         /* firmware says it returns a maximum of 20 bytes */
599 #define LBS_EEPROM_READ_LEN 20
600         u8 value[LBS_EEPROM_READ_LEN];
601 } __attribute__ ((packed));
602
603 struct cmd_ds_802_11_tpc_cfg {
604         __le16 action;
605         u8 enable;
606         s8 P0;
607         s8 P1;
608         s8 P2;
609         u8 usesnr;
610 } __attribute__ ((packed));
611
612 struct cmd_ds_802_11_led_ctrl {
613         __le16 action;
614         __le16 numled;
615         u8 data[256];
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_authenticate auth;
705                 struct cmd_ds_802_11_get_stat gstat;
706                 struct cmd_ds_802_3_get_stat gstat_8023;
707                 struct cmd_ds_802_11_snmp_mib smib;
708                 struct cmd_ds_802_11_rf_antenna rant;
709                 struct cmd_ds_802_11_monitor_mode monitor;
710                 struct cmd_ds_802_11_ad_hoc_join adj;
711                 struct cmd_ds_802_11_rssi rssi;
712                 struct cmd_ds_802_11_rssi_rsp rssirsp;
713                 struct cmd_ds_802_11_disassociate dassociate;
714                 struct cmd_ds_mac_reg_access macreg;
715                 struct cmd_ds_bbp_reg_access bbpreg;
716                 struct cmd_ds_rf_reg_access rfreg;
717
718                 struct cmd_ds_802_11d_domain_info domaininfo;
719                 struct cmd_ds_802_11d_domain_info domaininforesp;
720
721                 struct cmd_ds_802_11_tpc_cfg tpccfg;
722                 struct cmd_ds_802_11_afc afc;
723                 struct cmd_ds_802_11_led_ctrl ledgpio;
724
725                 struct cmd_tx_rate_query txrate;
726                 struct cmd_ds_bt_access bt;
727                 struct cmd_ds_fwt_access fwt;
728                 struct cmd_ds_get_tsf gettsf;
729                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
730         } params;
731 } __attribute__ ((packed));
732
733 #endif