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