[PATCH] libertas: first pass at fixing up endianness issues
[linux-2.6/x86.git] / drivers / net / wireless / libertas / hostcmd.h
blob204d9d53aba85fd0bff57d99c3f9bfd1a8ca8217
1 /*
2 * This file contains the function prototypes, data structure
3 * and defines for all the host/station commands
4 */
5 #ifndef __HOSTCMD__H
6 #define __HOSTCMD__H
8 #include <linux/wireless.h>
9 #include "11d.h"
10 #include "types.h"
12 /* 802.11-related definitions */
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;
37 /* RxPD Descriptor */
38 struct rxpd {
39 /* Current Rx packet status */
40 __le16 status;
42 /* SNR */
43 u8 snr;
45 /* Tx control */
46 u8 rx_control;
48 /* Pkt length */
49 __le16 pkt_len;
51 /* Noise Floor */
52 u8 nf;
54 /* Rx Packet Rate */
55 u8 rx_rate;
57 /* Pkt addr */
58 __le32 pkt_ptr;
60 /* Next Rx RxPD addr */
61 __le32 next_rxpd_ptr;
63 /* Pkt Priority */
64 u8 priority;
65 u8 reserved[3];
68 struct cmd_ctrl_node {
69 /* CMD link list */
70 struct list_head list;
71 u32 status;
72 /* CMD ID */
73 u32 cmd_oid;
74 /*CMD wait option: wait for finish or no wait */
75 u16 wait_option;
76 /* command parameter */
77 void *pdata_buf;
78 /*command data */
79 u8 *bufvirtualaddr;
80 u16 cmdflags;
81 /* wait queue */
82 u16 cmdwaitqwoken;
83 wait_queue_head_t cmdwait_q;
86 /* WLAN_802_11_KEY
88 * Generic structure to hold all key types. key type (WEP40, WEP104, TKIP, AES)
89 * is determined from the keylength field.
91 struct WLAN_802_11_KEY {
92 __le32 len;
93 __le32 flags; /* KEY_INFO_* from wlan_defs.h */
94 u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
95 __le16 type; /* KEY_TYPE_* from wlan_defs.h */
98 struct IE_WPA {
99 u8 elementid;
100 u8 len;
101 u8 oui[4];
102 __le16 version;
105 struct WLAN_802_11_SSID {
106 /* SSID length */
107 __le32 ssidlength;
109 /* SSID information field */
110 u8 ssid[IW_ESSID_MAX_SIZE];
113 struct WPA_SUPPLICANT {
114 u8 wpa_ie[256];
115 u8 wpa_ie_len;
118 /* wlan_offset_value */
119 struct wlan_offset_value {
120 u32 offset;
121 u32 value;
124 struct WLAN_802_11_FIXED_IEs {
125 __le64 timestamp;
126 __le16 beaconinterval;
127 u16 capabilities; /* Actually struct ieeetypes_capinfo */
130 struct WLAN_802_11_VARIABLE_IEs {
131 u8 elementid;
132 u8 length;
133 u8 data[1];
136 /* Define general data structure */
137 /* cmd_DS_GEN */
138 struct cmd_ds_gen {
139 __le16 command;
140 __le16 size;
141 __le16 seqnum;
142 __le16 result;
145 #define S_DS_GEN sizeof(struct cmd_ds_gen)
147 * Define data structure for cmd_get_hw_spec
148 * This structure defines the response for the GET_HW_SPEC command
150 struct cmd_ds_get_hw_spec {
151 /* HW Interface version number */
152 __le16 hwifversion;
153 /* HW version number */
154 __le16 version;
155 /* Max number of TxPD FW can handle */
156 __le16 nr_txpd;
157 /* Max no of Multicast address */
158 __le16 nr_mcast_adr;
159 /* MAC address */
160 u8 permanentaddr[6];
162 /* region Code */
163 __le16 regioncode;
165 /* Number of antenna used */
166 __le16 nr_antenna;
168 /* FW release number, example 0x1234=1.2.3.4 */
169 __le32 fwreleasenumber;
171 /* Base Address of TxPD queue */
172 __le32 wcb_base;
173 /* Read Pointer of RxPd queue */
174 __le32 rxpd_rdptr;
176 /* Write Pointer of RxPd queue */
177 __le32 rxpd_wrptr;
179 /*FW/HW capability */
180 __le32 fwcapinfo;
181 } __attribute__ ((packed));
183 struct cmd_ds_802_11_reset {
184 __le16 action;
187 struct cmd_ds_802_11_subscribe_event {
188 __le16 action;
189 __le16 events;
193 * This scan handle Country Information IE(802.11d compliant)
194 * Define data structure for cmd_802_11_scan
196 struct cmd_ds_802_11_scan {
197 u8 bsstype;
198 u8 BSSID[ETH_ALEN];
199 u8 tlvbuffer[1];
200 #if 0
201 mrvlietypes_ssidparamset_t ssidParamSet;
202 mrvlietypes_chanlistparamset_t ChanListParamSet;
203 mrvlietypes_ratesparamset_t OpRateSet;
204 #endif
207 struct cmd_ds_802_11_scan_rsp {
208 __le16 bssdescriptsize;
209 u8 nr_sets;
210 u8 bssdesc_and_tlvbuffer[1];
213 struct cmd_ds_802_11_get_log {
214 __le32 mcasttxframe;
215 __le32 failed;
216 __le32 retry;
217 __le32 multiretry;
218 __le32 framedup;
219 __le32 rtssuccess;
220 __le32 rtsfailure;
221 __le32 ackfailure;
222 __le32 rxfrag;
223 __le32 mcastrxframe;
224 __le32 fcserror;
225 __le32 txframe;
226 __le32 wepundecryptable;
229 struct cmd_ds_mac_control {
230 __le16 action;
231 __le16 reserved;
234 struct cmd_ds_mac_multicast_adr {
235 __le16 action;
236 __le16 nr_of_adrs;
237 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
240 struct cmd_ds_802_11_authenticate {
241 u8 macaddr[ETH_ALEN];
242 u8 authtype;
243 u8 reserved[10];
246 struct cmd_ds_802_11_deauthenticate {
247 u8 macaddr[6];
248 __le16 reasoncode;
251 struct cmd_ds_802_11_associate {
252 u8 peerstaaddr[6];
253 struct ieeetypes_capinfo capinfo;
254 __le16 listeninterval;
255 __le16 bcnperiod;
256 u8 dtimperiod;
258 #if 0
259 mrvlietypes_ssidparamset_t ssidParamSet;
260 mrvlietypes_phyparamset_t phyparamset;
261 mrvlietypes_ssparamset_t ssparamset;
262 mrvlietypes_ratesparamset_t ratesParamSet;
263 #endif
264 } __attribute__ ((packed));
266 struct cmd_ds_802_11_disassociate {
267 u8 destmacaddr[6];
268 __le16 reasoncode;
271 struct cmd_ds_802_11_associate_rsp {
272 struct ieeetypes_assocrsp assocRsp;
275 struct cmd_ds_802_11_ad_hoc_result {
276 u8 PAD[3];
277 u8 BSSID[ETH_ALEN];
280 struct cmd_ds_802_11_set_wep {
281 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
282 __le16 action;
284 /* key Index selected for Tx */
285 __le16 keyindex;
287 /* 40, 128bit or TXWEP */
288 u8 keytype[4];
289 u8 keymaterial[4][16];
292 struct cmd_ds_802_3_get_stat {
293 __le32 xmitok;
294 __le32 rcvok;
295 __le32 xmiterror;
296 __le32 rcverror;
297 __le32 rcvnobuffer;
298 __le32 rcvcrcerror;
301 struct cmd_ds_802_11_get_stat {
302 __le32 txfragmentcnt;
303 __le32 mcasttxframecnt;
304 __le32 failedcnt;
305 __le32 retrycnt;
306 __le32 Multipleretrycnt;
307 __le32 rtssuccesscnt;
308 __le32 rtsfailurecnt;
309 __le32 ackfailurecnt;
310 __le32 frameduplicatecnt;
311 __le32 rxfragmentcnt;
312 __le32 mcastrxframecnt;
313 __le32 fcserrorcnt;
314 __le32 bcasttxframecnt;
315 __le32 bcastrxframecnt;
316 __le32 txbeacon;
317 __le32 rxbeacon;
318 __le32 wepundecryptable;
321 struct cmd_ds_802_11_snmp_mib {
322 __le16 querytype;
323 __le16 oid;
324 __le16 bufsize;
325 u8 value[128];
328 struct cmd_ds_mac_reg_map {
329 __le16 buffersize;
330 u8 regmap[128];
331 __le16 reserved;
334 struct cmd_ds_bbp_reg_map {
335 __le16 buffersize;
336 u8 regmap[128];
337 __le16 reserved;
340 struct cmd_ds_rf_reg_map {
341 __le16 buffersize;
342 u8 regmap[64];
343 __le16 reserved;
346 struct cmd_ds_mac_reg_access {
347 __le16 action;
348 __le16 offset;
349 __le32 value;
352 struct cmd_ds_bbp_reg_access {
353 __le16 action;
354 __le16 offset;
355 u8 value;
356 u8 reserved[3];
359 struct cmd_ds_rf_reg_access {
360 __le16 action;
361 __le16 offset;
362 u8 value;
363 u8 reserved[3];
366 struct cmd_ds_802_11_radio_control {
367 __le16 action;
368 __le16 control;
371 struct cmd_ds_802_11_sleep_params {
372 /* ACT_GET/ACT_SET */
373 __le16 action;
375 /* Sleep clock error in ppm */
376 __le16 error;
378 /* Wakeup offset in usec */
379 __le16 offset;
381 /* Clock stabilization time in usec */
382 __le16 stabletime;
384 /* control periodic calibration */
385 u8 calcontrol;
387 /* control the use of external sleep clock */
388 u8 externalsleepclk;
390 /* reserved field, should be set to zero */
391 __le16 reserved;
394 struct cmd_ds_802_11_inactivity_timeout {
395 /* ACT_GET/ACT_SET */
396 __le16 action;
398 /* Inactivity timeout in msec */
399 __le16 timeout;
402 struct cmd_ds_802_11_rf_channel {
403 __le16 action;
404 __le16 currentchannel;
405 __le16 rftype;
406 __le16 reserved;
407 u8 channellist[32];
410 struct cmd_ds_802_11_rssi {
411 /* weighting factor */
412 __le16 N;
414 __le16 reserved_0;
415 __le16 reserved_1;
416 __le16 reserved_2;
419 struct cmd_ds_802_11_rssi_rsp {
420 __le16 SNR;
421 __le16 noisefloor;
422 __le16 avgSNR;
423 __le16 avgnoisefloor;
426 struct cmd_ds_802_11_mac_address {
427 __le16 action;
428 u8 macadd[ETH_ALEN];
431 struct cmd_ds_802_11_rf_tx_power {
432 __le16 action;
433 __le16 currentlevel;
436 struct cmd_ds_802_11_rf_antenna {
437 __le16 action;
439 /* Number of antennas or 0xffff(diversity) */
440 __le16 antennamode;
444 struct cmd_ds_802_11_ps_mode {
445 __le16 action;
446 __le16 nullpktinterval;
447 __le16 multipledtim;
448 __le16 reserved;
449 __le16 locallisteninterval;
452 struct PS_CMD_ConfirmSleep {
453 __le16 command;
454 __le16 size;
455 __le16 seqnum;
456 __le16 result;
458 __le16 action;
459 __le16 reserved1;
460 __le16 multipledtim;
461 __le16 reserved;
462 __le16 locallisteninterval;
465 struct cmd_ds_802_11_data_rate {
466 __le16 action;
467 __le16 reserverd;
468 u8 datarate[G_SUPPORTED_RATES];
471 struct cmd_ds_802_11_rate_adapt_rateset {
472 __le16 action;
473 __le16 enablehwauto;
474 __le16 bitmap;
477 struct cmd_ds_802_11_ad_hoc_start {
478 u8 SSID[IW_ESSID_MAX_SIZE];
479 u8 bsstype;
480 __le16 beaconperiod;
481 u8 dtimperiod;
482 union IEEEtypes_ssparamset ssparamset;
483 union ieeetypes_phyparamset phyparamset;
484 __le16 probedelay;
485 struct ieeetypes_capinfo cap;
486 u8 datarate[G_SUPPORTED_RATES];
487 u8 tlv_memory_size_pad[100];
488 } __attribute__ ((packed));
490 struct adhoc_bssdesc {
491 u8 BSSID[6];
492 u8 SSID[32];
493 u8 bsstype;
494 __le16 beaconperiod;
495 u8 dtimperiod;
496 __le64 timestamp;
497 __le64 localtime;
498 union ieeetypes_phyparamset phyparamset;
499 union IEEEtypes_ssparamset ssparamset;
500 struct ieeetypes_capinfo cap;
501 u8 datarates[G_SUPPORTED_RATES];
503 /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
504 * Adhoc join command and will cause a binary layout mismatch with
505 * the firmware
507 } __attribute__ ((packed));
509 struct cmd_ds_802_11_ad_hoc_join {
510 struct adhoc_bssdesc bssdescriptor;
511 __le16 failtimeout;
512 __le16 probedelay;
514 } __attribute__ ((packed));
516 struct cmd_ds_802_11_enable_rsn {
517 __le16 action;
518 __le16 enable;
521 struct MrvlIEtype_keyParamSet {
522 /* type ID */
523 __le16 type;
525 /* length of Payload */
526 __le16 length;
528 /* type of key: WEP=0, TKIP=1, AES=2 */
529 __le16 keytypeid;
531 /* key control Info specific to a keytypeid */
532 __le16 keyinfo;
534 /* length of key */
535 __le16 keylen;
537 /* key material of size keylen */
538 u8 key[32];
541 struct cmd_ds_802_11_key_material {
542 __le16 action;
543 struct MrvlIEtype_keyParamSet keyParamSet[2];
544 } __attribute__ ((packed));
546 struct cmd_ds_802_11_eeprom_access {
547 __le16 action;
549 /* multiple 4 */
550 __le16 offset;
551 __le16 bytecount;
552 u8 value;
553 } __attribute__ ((packed));
555 struct cmd_ds_802_11_tpc_cfg {
556 __le16 action;
557 u8 enable;
558 s8 P0;
559 s8 P1;
560 s8 P2;
561 u8 usesnr;
562 } __attribute__ ((packed));
564 struct cmd_ds_802_11_led_ctrl {
565 __le16 action;
566 __le16 numled;
567 u8 data[256];
568 } __attribute__ ((packed));
570 struct cmd_ds_802_11_pwr_cfg {
571 __le16 action;
572 u8 enable;
573 s8 PA_P0;
574 s8 PA_P1;
575 s8 PA_P2;
576 } __attribute__ ((packed));
578 struct cmd_ds_802_11_afc {
579 __le16 afc_auto;
580 union {
581 struct {
582 __le16 threshold;
583 __le16 period;
585 struct {
586 __le16 timing_offset; /* signed */
587 __le16 carrier_offset; /* signed */
590 } __attribute__ ((packed));
592 struct cmd_tx_rate_query {
593 __le16 txrate;
594 } __attribute__ ((packed));
596 struct cmd_ds_get_tsf {
597 __le64 tsfvalue;
598 } __attribute__ ((packed));
600 struct cmd_ds_bt_access {
601 __le16 action;
602 __le32 id;
603 u8 addr1[ETH_ALEN];
604 u8 addr2[ETH_ALEN];
605 } __attribute__ ((packed));
607 struct cmd_ds_fwt_access {
608 __le16 action;
609 __le32 id;
610 u8 valid;
611 u8 da[ETH_ALEN];
612 u8 dir;
613 u8 ra[ETH_ALEN];
614 __le32 ssn;
615 __le32 dsn;
616 __le32 metric;
617 u8 rate;
618 u8 hopcount;
619 u8 ttl;
620 __le32 expiration;
621 u8 sleepmode;
622 __le32 snr;
623 __le32 references;
624 u8 prec[ETH_ALEN];
625 } __attribute__ ((packed));
627 struct cmd_ds_mesh_access {
628 __le16 action;
629 __le32 data[32]; /* last position reserved */
630 } __attribute__ ((packed));
632 /* Number of stats counters returned by the firmware */
633 #define MESH_STATS_NUM 8
635 struct cmd_ds_command {
636 /* command header */
637 __le16 command;
638 __le16 size;
639 __le16 seqnum;
640 __le16 result;
642 /* command Body */
643 union {
644 struct cmd_ds_get_hw_spec hwspec;
645 struct cmd_ds_802_11_ps_mode psmode;
646 struct cmd_ds_802_11_scan scan;
647 struct cmd_ds_802_11_scan_rsp scanresp;
648 struct cmd_ds_mac_control macctrl;
649 struct cmd_ds_802_11_associate associate;
650 struct cmd_ds_802_11_deauthenticate deauth;
651 struct cmd_ds_802_11_set_wep wep;
652 struct cmd_ds_802_11_ad_hoc_start ads;
653 struct cmd_ds_802_11_reset reset;
654 struct cmd_ds_802_11_ad_hoc_result result;
655 struct cmd_ds_802_11_get_log glog;
656 struct cmd_ds_802_11_authenticate auth;
657 struct cmd_ds_802_11_get_stat gstat;
658 struct cmd_ds_802_3_get_stat gstat_8023;
659 struct cmd_ds_802_11_snmp_mib smib;
660 struct cmd_ds_802_11_rf_tx_power txp;
661 struct cmd_ds_802_11_rf_antenna rant;
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;
679 struct cmd_ds_802_11d_domain_info domaininfo;
680 struct cmd_ds_802_11d_domain_info domaininforesp;
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;
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_mesh_access mesh;
693 struct cmd_ds_get_tsf gettsf;
694 struct cmd_ds_802_11_subscribe_event subscribe_event;
695 } params;
696 } __attribute__ ((packed));
698 #endif