Home | History | Annotate | Line # | Download | only in pci
if_iwireg.h revision 1.3.2.3
      1  1.3.2.3   yamt /*	$NetBSD: if_iwireg.h,v 1.3.2.3 2008/01/21 09:43:55 yamt Exp $ */
      2      1.1  skrll 
      3      1.1  skrll /*-
      4      1.1  skrll  * Copyright (c) 2004, 2005
      5      1.1  skrll  *      Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
      6      1.1  skrll  *
      7      1.1  skrll  * Redistribution and use in source and binary forms, with or without
      8      1.1  skrll  * modification, are permitted provided that the following conditions
      9      1.1  skrll  * are met:
     10      1.1  skrll  * 1. Redistributions of source code must retain the above copyright
     11      1.1  skrll  *    notice unmodified, this list of conditions, and the following
     12      1.1  skrll  *    disclaimer.
     13      1.1  skrll  * 2. Redistributions in binary form must reproduce the above copyright
     14      1.1  skrll  *    notice, this list of conditions and the following disclaimer in the
     15      1.1  skrll  *    documentation and/or other materials provided with the distribution.
     16      1.1  skrll  *
     17      1.1  skrll  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     18      1.1  skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19      1.1  skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20      1.1  skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     21      1.1  skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22      1.1  skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23      1.1  skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24      1.1  skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25      1.1  skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26      1.1  skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27      1.1  skrll  * SUCH DAMAGE.
     28      1.1  skrll  */
     29      1.1  skrll 
     30  1.3.2.1   yamt #define IWI_CMD_RING_COUNT	16
     31  1.3.2.1   yamt #define IWI_TX_RING_COUNT	64
     32  1.3.2.1   yamt #define IWI_RX_RING_COUNT	32
     33  1.3.2.1   yamt 
     34  1.3.2.1   yamt #define IWI_TX_DESC_SIZE	(sizeof (struct iwi_tx_desc))
     35  1.3.2.1   yamt #define IWI_CMD_DESC_SIZE	(sizeof (struct iwi_cmd_desc))
     36      1.1  skrll 
     37      1.1  skrll #define IWI_CSR_INTR		0x0008
     38      1.1  skrll #define IWI_CSR_INTR_MASK	0x000c
     39      1.1  skrll #define IWI_CSR_INDIRECT_ADDR	0x0010
     40      1.1  skrll #define IWI_CSR_INDIRECT_DATA	0x0014
     41      1.1  skrll #define IWI_CSR_AUTOINC_ADDR	0x0018
     42      1.1  skrll #define IWI_CSR_AUTOINC_DATA	0x001c
     43      1.1  skrll #define IWI_CSR_RST		0x0020
     44      1.1  skrll #define IWI_CSR_CTL		0x0024
     45      1.1  skrll #define IWI_CSR_IO		0x0030
     46      1.1  skrll #define IWI_CSR_CMD_BASE	0x0200
     47      1.1  skrll #define IWI_CSR_CMD_SIZE	0x0204
     48      1.1  skrll #define IWI_CSR_TX1_BASE	0x0208
     49      1.1  skrll #define IWI_CSR_TX1_SIZE	0x020c
     50      1.1  skrll #define IWI_CSR_TX2_BASE	0x0210
     51      1.1  skrll #define IWI_CSR_TX2_SIZE	0x0214
     52      1.1  skrll #define IWI_CSR_TX3_BASE	0x0218
     53      1.1  skrll #define IWI_CSR_TX3_SIZE	0x021c
     54      1.1  skrll #define IWI_CSR_TX4_BASE	0x0220
     55      1.1  skrll #define IWI_CSR_TX4_SIZE	0x0224
     56  1.3.2.1   yamt #define IWI_CSR_CMD_RIDX	0x0280
     57  1.3.2.1   yamt #define IWI_CSR_TX1_RIDX	0x0284
     58  1.3.2.1   yamt #define IWI_CSR_TX2_RIDX	0x0288
     59  1.3.2.1   yamt #define IWI_CSR_TX3_RIDX	0x028c
     60  1.3.2.1   yamt #define IWI_CSR_TX4_RIDX	0x0290
     61  1.3.2.1   yamt #define IWI_CSR_RX_RIDX		0x02a0
     62      1.1  skrll #define IWI_CSR_RX_BASE		0x0500
     63  1.3.2.1   yamt #define IWI_CSR_ERRORLOG	0x0610
     64      1.1  skrll #define IWI_CSR_TABLE0_SIZE	0x0700
     65      1.1  skrll #define IWI_CSR_TABLE0_BASE	0x0704
     66      1.1  skrll #define IWI_CSR_CURRENT_TX_RATE	IWI_CSR_TABLE0_BASE
     67  1.3.2.1   yamt #define IWI_CSR_NODE_BASE	0x0c0c
     68  1.3.2.1   yamt #define IWI_CSR_CMD_WIDX	0x0f80
     69  1.3.2.1   yamt #define IWI_CSR_TX1_WIDX	0x0f84
     70  1.3.2.1   yamt #define IWI_CSR_TX2_WIDX	0x0f88
     71  1.3.2.1   yamt #define IWI_CSR_TX3_WIDX	0x0f8c
     72  1.3.2.1   yamt #define IWI_CSR_TX4_WIDX	0x0f90
     73  1.3.2.1   yamt #define IWI_CSR_RX_WIDX		0x0fa0
     74      1.1  skrll #define IWI_CSR_READ_INT	0x0ff4
     75      1.1  skrll 
     76  1.3.2.2   yamt /* flags for IWI_CSR_INTR */
     77  1.3.2.1   yamt #define IWI_INTR_RX_DONE	0x00000002
     78  1.3.2.1   yamt #define IWI_INTR_CMD_DONE	0x00000800
     79  1.3.2.1   yamt #define IWI_INTR_TX1_DONE	0x00001000
     80  1.3.2.1   yamt #define IWI_INTR_TX2_DONE	0x00002000
     81  1.3.2.1   yamt #define IWI_INTR_TX3_DONE	0x00004000
     82  1.3.2.1   yamt #define IWI_INTR_TX4_DONE	0x00008000
     83      1.1  skrll #define IWI_INTR_FW_INITED	0x01000000
     84      1.1  skrll #define IWI_INTR_RADIO_OFF	0x04000000
     85      1.1  skrll #define IWI_INTR_FATAL_ERROR	0x40000000
     86      1.1  skrll #define IWI_INTR_PARITY_ERROR	0x80000000
     87      1.1  skrll 
     88  1.3.2.1   yamt #define IWI_INTR_MASK						\
     89  1.3.2.1   yamt 	(IWI_INTR_RX_DONE | IWI_INTR_CMD_DONE |			\
     90  1.3.2.1   yamt 	 IWI_INTR_TX1_DONE | IWI_INTR_TX2_DONE |		\
     91  1.3.2.1   yamt 	 IWI_INTR_TX3_DONE | IWI_INTR_TX4_DONE |		\
     92  1.3.2.1   yamt 	 IWI_INTR_FW_INITED | IWI_INTR_RADIO_OFF |		\
     93      1.1  skrll 	 IWI_INTR_FATAL_ERROR | IWI_INTR_PARITY_ERROR)
     94      1.1  skrll 
     95  1.3.2.2   yamt /* flags for IWI_CSR_RST */
     96      1.1  skrll #define IWI_RST_PRINCETON_RESET	0x00000001
     97  1.3.2.2   yamt #define	IWI_RST_STANDBY		0x00000004
     98  1.3.2.2   yamt #define	IWI_RST_LED_ACTIVITY	0x00000010	/* tx/rx traffic led */
     99  1.3.2.2   yamt #define	IWI_RST_LED_ASSOCIATED	0x00000020	/* station associated led */
    100  1.3.2.2   yamt #define	IWI_RST_LED_OFDM	0x00000040	/* ofdm/cck led */
    101      1.1  skrll #define IWI_RST_SW_RESET	0x00000080
    102      1.1  skrll #define IWI_RST_MASTER_DISABLED	0x00000100
    103      1.1  skrll #define IWI_RST_STOP_MASTER	0x00000200
    104  1.3.2.2   yamt #define IWI_RST_GATE_ODMA	0x02000000
    105  1.3.2.2   yamt #define IWI_RST_GATE_IDMA	0x04000000
    106  1.3.2.2   yamt #define IWI_RST_GATE_ADMA	0x20000000
    107      1.1  skrll 
    108  1.3.2.2   yamt /* flags for IWI_CSR_CTL */
    109      1.1  skrll #define IWI_CTL_CLOCK_READY	0x00000001
    110      1.1  skrll #define IWI_CTL_ALLOW_STANDBY	0x00000002
    111      1.1  skrll #define IWI_CTL_INIT		0x00000004
    112      1.1  skrll 
    113  1.3.2.2   yamt /* flags for IWI_CSR_IO */
    114      1.1  skrll #define IWI_IO_RADIO_ENABLED	0x00010000
    115      1.1  skrll 
    116  1.3.2.2   yamt /* flags for IWI_CSR_READ_INT */
    117      1.1  skrll #define IWI_READ_INT_INIT_HOST	0x20000000
    118      1.1  skrll 
    119  1.3.2.1   yamt /* error log definitions */
    120  1.3.2.1   yamt struct iwi_error {
    121  1.3.2.1   yamt 	uint32_t	type;
    122  1.3.2.1   yamt 	uint32_t	reserved2;
    123  1.3.2.1   yamt 	uint32_t	reserved3;
    124  1.3.2.1   yamt 	uint32_t	reserved4;
    125  1.3.2.1   yamt 	uint32_t	reserved5;
    126  1.3.2.1   yamt 	uint32_t	reserved6;
    127  1.3.2.1   yamt 	uint32_t	reserved7;
    128  1.3.2.3   yamt } __packed;
    129  1.3.2.1   yamt 
    130      1.1  skrll /* constants for command blocks */
    131      1.1  skrll #define IWI_CB_DEFAULT_CTL	0x8cea0000
    132      1.1  skrll #define IWI_CB_MAXDATALEN	8191
    133      1.1  skrll 
    134      1.1  skrll /* supported rates */
    135      1.1  skrll #define IWI_RATE_DS1	10
    136      1.1  skrll #define IWI_RATE_DS2	20
    137      1.1  skrll #define IWI_RATE_DS5	55
    138      1.1  skrll #define IWI_RATE_DS11	110
    139      1.1  skrll #define IWI_RATE_OFDM6	13
    140      1.1  skrll #define IWI_RATE_OFDM9	15
    141      1.1  skrll #define IWI_RATE_OFDM12	5
    142      1.1  skrll #define IWI_RATE_OFDM18	7
    143      1.1  skrll #define IWI_RATE_OFDM24	9
    144      1.1  skrll #define IWI_RATE_OFDM36	11
    145      1.1  skrll #define IWI_RATE_OFDM48	1
    146      1.1  skrll #define IWI_RATE_OFDM54	3
    147      1.1  skrll 
    148  1.3.2.2   yamt /* firmware binary image header */
    149  1.3.2.2   yamt struct iwi_firmware_ohdr {
    150  1.3.2.2   yamt 	uint32_t	version;
    151  1.3.2.2   yamt 	uint32_t	mode;
    152  1.3.2.3   yamt } __packed;
    153  1.3.2.2   yamt #define	IWI_FW_REQ_MAJOR	3
    154  1.3.2.2   yamt #define	IWI_FW_REQ_MINOR	0
    155  1.3.2.2   yamt #define	IWI_FW_GET_MAJOR(ver)	(((ver) & 0x00ff0000) >> 16)
    156  1.3.2.2   yamt #define	IWI_FW_GET_MINOR(ver)	(((ver) & 0xff000000) >> 24)
    157  1.3.2.2   yamt 
    158  1.3.2.2   yamt struct iwi_firmware_hdr {
    159  1.3.2.2   yamt 	uint32_t	version;	/* version stamp */
    160  1.3.2.2   yamt 	uint32_t	bsize;		/* size of boot image */
    161  1.3.2.2   yamt 	uint32_t	usize;		/* size of ucode image */
    162  1.3.2.2   yamt 	uint32_t	fsize;		/* size of firmware image */
    163  1.3.2.3   yamt } __packed;
    164  1.3.2.2   yamt 
    165      1.1  skrll struct iwi_hdr {
    166  1.3.2.1   yamt 	uint8_t	type;
    167      1.1  skrll #define IWI_HDR_TYPE_DATA	0
    168      1.1  skrll #define IWI_HDR_TYPE_COMMAND	1
    169      1.1  skrll #define IWI_HDR_TYPE_NOTIF	3
    170      1.1  skrll #define IWI_HDR_TYPE_FRAME	9
    171  1.3.2.1   yamt 
    172  1.3.2.1   yamt 	uint8_t	seq;
    173  1.3.2.1   yamt 	uint8_t	flags;
    174      1.1  skrll #define IWI_HDR_FLAG_IRQ	0x04
    175  1.3.2.1   yamt 
    176  1.3.2.1   yamt 	uint8_t	reserved;
    177  1.3.2.3   yamt } __packed;
    178      1.1  skrll 
    179      1.1  skrll struct iwi_notif {
    180  1.3.2.1   yamt 	uint32_t	reserved[2];
    181  1.3.2.1   yamt 	uint8_t		type;
    182      1.1  skrll #define IWI_NOTIF_TYPE_ASSOCIATION	10
    183      1.1  skrll #define IWI_NOTIF_TYPE_AUTHENTICATION	11
    184      1.1  skrll #define IWI_NOTIF_TYPE_SCAN_CHANNEL	12
    185      1.1  skrll #define IWI_NOTIF_TYPE_SCAN_COMPLETE	13
    186  1.3.2.2   yamt #define IWI_NOTIF_TYPE_FRAG_LENGTH	14
    187  1.3.2.2   yamt #define IWI_NOTIF_TYPE_LINK_QUALITY	15	/* "link deterioration" */
    188  1.3.2.2   yamt #define IWI_NOTIF_TYPE_BEACON		17	/* beacon state, e.g. miss */
    189  1.3.2.2   yamt #define IWI_NOTIF_TYPE_TGI_TX_KEY	18	/* WPA transmit key */
    190      1.1  skrll #define IWI_NOTIF_TYPE_CALIBRATION	20
    191      1.1  skrll #define IWI_NOTIF_TYPE_NOISE		25
    192  1.3.2.1   yamt 
    193  1.3.2.1   yamt 	uint8_t		flags;
    194  1.3.2.1   yamt 	uint16_t	len;
    195  1.3.2.3   yamt } __packed;
    196      1.1  skrll 
    197      1.1  skrll /* structure for notification IWI_NOTIF_TYPE_AUTHENTICATION */
    198      1.1  skrll struct iwi_notif_authentication {
    199  1.3.2.1   yamt 	uint8_t	state;
    200  1.3.2.2   yamt #define IWI_AUTH_FAIL		0
    201  1.3.2.2   yamt #define	IWI_AUTH_SENT_1		1		/* tx first frame */
    202  1.3.2.2   yamt #define	IWI_AUTH_RECV_2		2		/* rx second frame */
    203  1.3.2.2   yamt #define	IWI_AUTH_SEQ1_PASS	3		/* 1st exchange passed */
    204  1.3.2.2   yamt #define	IWI_AUTH_SEQ1_FAIL	4		/* 1st exchange failed */
    205  1.3.2.2   yamt #define IWI_AUTH_SUCCESS	9
    206  1.3.2.2   yamt 
    207  1.3.2.3   yamt } __packed;
    208      1.1  skrll 
    209      1.1  skrll /* structure for notification IWI_NOTIF_TYPE_ASSOCIATION */
    210      1.1  skrll struct iwi_notif_association {
    211  1.3.2.1   yamt 	uint8_t			state;
    212  1.3.2.2   yamt #define IWI_ASSOC_FAIL		0
    213  1.3.2.2   yamt #define IWI_ASSOC_SUCCESS	12
    214  1.3.2.1   yamt 
    215      1.1  skrll 	struct ieee80211_frame	frame;
    216  1.3.2.1   yamt 	uint16_t		capinfo;
    217  1.3.2.1   yamt 	uint16_t		status;
    218  1.3.2.1   yamt 	uint16_t		associd;
    219  1.3.2.3   yamt } __packed;
    220      1.1  skrll 
    221      1.1  skrll /* structure for notification IWI_NOTIF_TYPE_SCAN_CHANNEL */
    222      1.1  skrll struct iwi_notif_scan_channel {
    223  1.3.2.1   yamt 	uint8_t	nchan;
    224  1.3.2.1   yamt 	uint8_t	reserved[47];
    225  1.3.2.3   yamt } __packed;
    226      1.1  skrll 
    227      1.1  skrll /* structure for notification IWI_NOTIF_TYPE_SCAN_COMPLETE */
    228      1.1  skrll struct iwi_notif_scan_complete {
    229  1.3.2.1   yamt 	uint8_t	type;
    230  1.3.2.1   yamt 	uint8_t	nchan;
    231  1.3.2.1   yamt 	uint8_t	status;
    232  1.3.2.1   yamt 	uint8_t	reserved;
    233  1.3.2.3   yamt } __packed;
    234      1.1  skrll 
    235  1.3.2.2   yamt /* structure for notification IWI_NOTIF_TYPE_BEACON */
    236  1.3.2.2   yamt struct iwi_notif_beacon_state {
    237  1.3.2.2   yamt 	uint32_t	state;
    238  1.3.2.2   yamt #define IWI_BEACON_MISS		1
    239  1.3.2.2   yamt 
    240  1.3.2.2   yamt 	uint32_t	number;
    241  1.3.2.3   yamt } __packed;
    242  1.3.2.2   yamt 
    243      1.1  skrll /* received frame header */
    244      1.1  skrll struct iwi_frame {
    245  1.3.2.1   yamt 	uint32_t	reserved1[2];
    246  1.3.2.1   yamt 	uint8_t		chan;
    247  1.3.2.1   yamt 	uint8_t		status;
    248  1.3.2.1   yamt 	uint8_t		rate;
    249  1.3.2.1   yamt 	uint8_t		rssi;	/* receiver signal strength indicator */
    250  1.3.2.1   yamt 	uint8_t		agc;	/* automatic gain control */
    251  1.3.2.1   yamt 	uint8_t		rssi_dbm;
    252  1.3.2.1   yamt 	uint16_t	signal;
    253  1.3.2.1   yamt 	uint16_t	noise;
    254  1.3.2.1   yamt 	uint8_t		antenna;
    255  1.3.2.1   yamt 	uint8_t		control;
    256  1.3.2.1   yamt 	uint8_t		reserved2[2];
    257  1.3.2.1   yamt 	uint16_t	len;
    258  1.3.2.3   yamt } __packed;
    259      1.1  skrll 
    260      1.1  skrll /* header for transmission */
    261      1.1  skrll struct iwi_tx_desc {
    262      1.1  skrll 	struct iwi_hdr	hdr;
    263  1.3.2.1   yamt 	uint32_t	reserved1;
    264  1.3.2.1   yamt 	uint8_t		station;
    265  1.3.2.1   yamt 	uint8_t		reserved2[3];
    266  1.3.2.1   yamt 	uint8_t		cmd;
    267      1.1  skrll #define IWI_DATA_CMD_TX	0x0b
    268  1.3.2.1   yamt 
    269  1.3.2.1   yamt 	uint8_t		seq;
    270  1.3.2.1   yamt 	uint16_t	len;
    271  1.3.2.1   yamt 	uint8_t		priority;
    272  1.3.2.1   yamt 	uint8_t		flags;
    273      1.1  skrll #define IWI_DATA_FLAG_SHPREAMBLE	0x04
    274      1.1  skrll #define IWI_DATA_FLAG_NO_WEP		0x20
    275      1.1  skrll #define IWI_DATA_FLAG_NEED_ACK		0x80
    276      1.1  skrll 
    277  1.3.2.1   yamt 	uint8_t		xflags;
    278  1.3.2.2   yamt #define IWI_DATA_XFLAG_CCK	0x01
    279  1.3.2.2   yamt #define IWI_DATA_XFLAG_OFDM	0x00
    280  1.3.2.1   yamt #define IWI_DATA_XFLAG_QOS	0x10
    281      1.1  skrll 
    282  1.3.2.1   yamt 	uint8_t		wep_txkey;
    283  1.3.2.2   yamt #define IWI_DATA_KEY_WEP40		0x40
    284  1.3.2.2   yamt #define IWI_DATA_KEY_WEP104		0x80
    285  1.3.2.2   yamt 
    286  1.3.2.1   yamt 	uint8_t		wepkey[IEEE80211_KEYBUF_SIZE];
    287  1.3.2.1   yamt 	uint8_t		rate;
    288  1.3.2.1   yamt 	uint8_t		antenna;
    289  1.3.2.1   yamt 	uint8_t		reserved3[10];
    290  1.3.2.1   yamt 	struct ieee80211_qosframe_addr4	wh;
    291  1.3.2.1   yamt 	uint32_t	iv;
    292  1.3.2.1   yamt 	uint32_t	eiv;
    293  1.3.2.1   yamt 	uint32_t	nseg;
    294      1.1  skrll #define IWI_MAX_NSEG	6
    295  1.3.2.1   yamt 
    296  1.3.2.1   yamt 	uint32_t	seg_addr[IWI_MAX_NSEG];
    297  1.3.2.1   yamt 	uint16_t	seg_len[IWI_MAX_NSEG];
    298  1.3.2.3   yamt } __packed;
    299      1.1  skrll 
    300      1.1  skrll /* command */
    301      1.1  skrll struct iwi_cmd_desc {
    302      1.1  skrll 	struct iwi_hdr	hdr;
    303  1.3.2.1   yamt 	uint8_t		type;
    304      1.1  skrll #define IWI_CMD_ENABLE				2
    305      1.1  skrll #define IWI_CMD_SET_CONFIGURATION		6
    306      1.1  skrll #define IWI_CMD_SET_ESSID			8
    307      1.1  skrll #define IWI_CMD_SET_MAC_ADDRESS			11
    308      1.1  skrll #define IWI_CMD_SET_RTS_THRESHOLD		15
    309  1.3.2.1   yamt #define IWI_CMD_SET_FRAG_THRESHOLD		16
    310      1.1  skrll #define IWI_CMD_SET_POWER_MODE			17
    311      1.1  skrll #define IWI_CMD_SET_WEP_KEY			18
    312      1.1  skrll #define IWI_CMD_ASSOCIATE			21
    313      1.1  skrll #define IWI_CMD_SET_RATES			22
    314  1.3.2.1   yamt #define IWI_CMD_ABORT_SCAN			23
    315  1.3.2.1   yamt #define IWI_CMD_SET_WME_PARAMS			25
    316  1.3.2.1   yamt #define IWI_CMD_SCAN_V2				26
    317  1.3.2.1   yamt #define IWI_CMD_SET_OPTIE			31
    318      1.1  skrll #define IWI_CMD_DISABLE				33
    319      1.1  skrll #define IWI_CMD_SET_IV				34
    320      1.1  skrll #define IWI_CMD_SET_TX_POWER			35
    321      1.1  skrll #define IWI_CMD_SET_SENSITIVITY			42
    322  1.3.2.1   yamt #define IWI_CMD_SET_WMEIE			84
    323  1.3.2.1   yamt 
    324  1.3.2.1   yamt 	uint8_t		len;
    325  1.3.2.1   yamt 	uint16_t	reserved;
    326  1.3.2.1   yamt 	uint8_t		data[120];
    327  1.3.2.3   yamt } __packed;
    328      1.1  skrll 
    329  1.3.2.1   yamt /* node information (IBSS) */
    330  1.3.2.1   yamt struct iwi_ibssnode {
    331  1.3.2.1   yamt 	uint8_t	bssid[IEEE80211_ADDR_LEN];
    332  1.3.2.1   yamt 	uint8_t	reserved[2];
    333  1.3.2.1   yamt } __packed;
    334  1.3.2.1   yamt 
    335      1.1  skrll /* constants for 'mode' fields */
    336      1.1  skrll #define IWI_MODE_11A	0
    337      1.1  skrll #define IWI_MODE_11B	1
    338      1.1  skrll #define IWI_MODE_11G	2
    339      1.1  skrll 
    340      1.1  skrll /* possible values for command IWI_CMD_SET_POWER_MODE */
    341  1.3.2.2   yamt #define IWI_POWER_MODE_CAM	0	/* no power save */
    342  1.3.2.2   yamt #define IWI_POWER_MODE_PSP	3
    343  1.3.2.2   yamt #define IWI_POWER_MODE_MAX	5	/* max power save operation */
    344      1.1  skrll 
    345      1.1  skrll /* structure for command IWI_CMD_SET_RATES */
    346      1.1  skrll struct iwi_rateset {
    347  1.3.2.1   yamt 	uint8_t	mode;
    348  1.3.2.1   yamt 	uint8_t	nrates;
    349  1.3.2.1   yamt 	uint8_t	type;
    350  1.3.2.1   yamt #define IWI_RATESET_TYPE_NEGOTIATED	0
    351      1.1  skrll #define IWI_RATESET_TYPE_SUPPORTED	1
    352  1.3.2.1   yamt 
    353  1.3.2.1   yamt 	uint8_t	reserved;
    354  1.3.2.2   yamt #define	IWI_RATESET_SIZE	12
    355  1.3.2.2   yamt 	uint8_t	rates[IWI_RATESET_SIZE];
    356  1.3.2.3   yamt } __packed;
    357      1.1  skrll 
    358      1.1  skrll /* structure for command IWI_CMD_SET_TX_POWER */
    359      1.1  skrll struct iwi_txpower {
    360  1.3.2.1   yamt 	uint8_t	nchan;
    361  1.3.2.1   yamt 	uint8_t	mode;
    362      1.1  skrll 	struct {
    363  1.3.2.1   yamt 		uint8_t	chan;
    364  1.3.2.1   yamt 		uint8_t	power;
    365      1.1  skrll #define IWI_TXPOWER_MAX		20
    366      1.1  skrll #define IWI_TXPOWER_RATIO	(IEEE80211_TXPOWER_MAX / IWI_TXPOWER_MAX)
    367  1.3.2.3   yamt 	} __packed chan[37];
    368  1.3.2.3   yamt } __packed;
    369      1.1  skrll 
    370      1.1  skrll /* structure for command IWI_CMD_ASSOCIATE */
    371      1.1  skrll struct iwi_associate {
    372  1.3.2.2   yamt 	uint8_t		chan;		/* channel # */
    373  1.3.2.2   yamt 	uint8_t		auth;		/* type and key */
    374      1.1  skrll #define IWI_AUTH_OPEN	0
    375      1.1  skrll #define IWI_AUTH_SHARED	1
    376      1.1  skrll #define IWI_AUTH_NONE	3
    377  1.3.2.1   yamt 
    378  1.3.2.2   yamt 	uint8_t		type;		/* request */
    379  1.3.2.2   yamt #define	IWI_HC_ASSOC		0
    380  1.3.2.2   yamt #define	IWI_HC_REASSOC		1
    381  1.3.2.2   yamt #define	IWI_HC_DISASSOC		2
    382  1.3.2.2   yamt #define	IWI_HC_IBSS_START	3
    383  1.3.2.2   yamt #define	IWI_HC_IBSS_RECONF	4
    384  1.3.2.2   yamt #define	IWI_HC_DISASSOC_QUIET	5
    385  1.3.2.2   yamt 
    386  1.3.2.1   yamt 	uint8_t		reserved1;
    387  1.3.2.1   yamt 	uint16_t	policy;
    388  1.3.2.1   yamt #define IWI_POLICY_WME	1
    389  1.3.2.1   yamt #define IWI_POLICY_WPA	2
    390  1.3.2.1   yamt 
    391  1.3.2.2   yamt 	uint8_t		plen;		/* preamble length */
    392  1.3.2.2   yamt #define IWI_ASSOC_SHPREAMBLE	(1 << 2) /* ogre */
    393  1.3.2.2   yamt 
    394  1.3.2.1   yamt 	uint8_t		mode;
    395  1.3.2.1   yamt 	uint8_t		bssid[IEEE80211_ADDR_LEN];
    396  1.3.2.1   yamt 	uint8_t		tstamp[8];
    397  1.3.2.1   yamt 	uint16_t	capinfo;
    398  1.3.2.1   yamt 	uint16_t	lintval;
    399  1.3.2.1   yamt 	uint16_t	intval;
    400  1.3.2.1   yamt 	uint8_t		dst[IEEE80211_ADDR_LEN];
    401  1.3.2.1   yamt 	uint32_t	reserved3;
    402  1.3.2.1   yamt 	uint16_t	reserved4;
    403  1.3.2.3   yamt } __packed;
    404  1.3.2.1   yamt 
    405  1.3.2.1   yamt #define IWI_SCAN_CHANNELS	54
    406  1.3.2.1   yamt 
    407  1.3.2.1   yamt #define IWI_SCAN_TYPE_FIRST_BEACON	0
    408  1.3.2.1   yamt #define IWI_SCAN_TYPE_PASSIVE		1
    409  1.3.2.1   yamt #define IWI_SCAN_TYPE_ACTIVE_DIRECT	2
    410  1.3.2.1   yamt #define IWI_SCAN_TYPE_ACTIVE_BROADCAST	3
    411  1.3.2.1   yamt #define IWI_SCAN_TYPE_ACTIVE_BDIRECT	4
    412  1.3.2.1   yamt #define IWI_SCAN_TYPES			5
    413  1.3.2.1   yamt 
    414  1.3.2.1   yamt #define iwi_scan_type_set(s, i, t) 			\
    415  1.3.2.1   yamt 	do { 						\
    416  1.3.2.1   yamt 		if ((i) % 2 == 0)			\
    417  1.3.2.1   yamt 			(s).type[(i) / 2].lsn = (t);	\
    418  1.3.2.1   yamt 		else					\
    419  1.3.2.1   yamt 			(s).type[(i) / 2].msn = (t);	\
    420  1.3.2.1   yamt 	} while(0)
    421  1.3.2.1   yamt 
    422  1.3.2.1   yamt /* structure for command IWI_CMD_SCAN_V2 */
    423  1.3.2.1   yamt struct iwi_scan_v2 {
    424  1.3.2.1   yamt 	u_int32_t	fsidx;
    425  1.3.2.1   yamt 	u_int8_t	channels[IWI_SCAN_CHANNELS];
    426      1.1  skrll #define IWI_CHAN_5GHZ	(0 << 6)
    427      1.1  skrll #define IWI_CHAN_2GHZ	(1 << 6)
    428  1.3.2.1   yamt 
    429  1.3.2.1   yamt 	struct {
    430  1.3.2.1   yamt #if _BYTE_ORDER == _LITTLE_ENDIAN
    431  1.3.2.1   yamt 		u_int8_t msn:4;
    432  1.3.2.1   yamt 		u_int8_t lsn:4;
    433  1.3.2.1   yamt #else
    434  1.3.2.1   yamt 		u_int8_t lsn:4;
    435  1.3.2.1   yamt 		u_int8_t msn:4;
    436  1.3.2.1   yamt #endif
    437  1.3.2.1   yamt 	} __attribute__ ((__packed__)) type[IWI_SCAN_CHANNELS / 2];
    438  1.3.2.1   yamt 
    439  1.3.2.1   yamt 	u_int8_t	reserved1;
    440  1.3.2.1   yamt 	u_int16_t	dwelltime[IWI_SCAN_TYPES];
    441  1.3.2.1   yamt 
    442  1.3.2.1   yamt } __attribute__ ((__packed__));
    443      1.1  skrll 
    444      1.1  skrll /* structure for command IWI_CMD_SET_CONFIGURATION */
    445      1.1  skrll struct iwi_configuration {
    446  1.3.2.1   yamt 	uint8_t	bluetooth_coexistence;
    447  1.3.2.1   yamt 	uint8_t	reserved1;
    448  1.3.2.1   yamt 	uint8_t	answer_pbreq;
    449  1.3.2.1   yamt 	uint8_t	allow_invalid_frames;
    450  1.3.2.1   yamt 	uint8_t	multicast_enabled;
    451  1.3.2.1   yamt 	uint8_t	drop_unicast_unencrypted;
    452  1.3.2.1   yamt 	uint8_t	disable_unicast_decryption;
    453  1.3.2.1   yamt 	uint8_t	drop_multicast_unencrypted;
    454  1.3.2.1   yamt 	uint8_t	disable_multicast_decryption;
    455  1.3.2.1   yamt 	uint8_t	antenna;
    456  1.3.2.2   yamt #define	IWI_ANTENNA_AUTO	0	/* firmware selects best antenna */
    457  1.3.2.2   yamt #define	IWI_ANTENNA_A		1	/* use antenna A only */
    458  1.3.2.2   yamt #define	IWI_ANTENNA_B		3	/* use antenna B only */
    459  1.3.2.2   yamt #define	IWI_ANTENNA_SLOWDIV	2	/* slow diversity algorithm */
    460  1.3.2.2   yamt 
    461  1.3.2.2   yamt 	uint8_t	include_crc;		/* include crc in rx'd frames */
    462  1.3.2.2   yamt 	uint8_t	use_protection;		/* auto-detect 11g operation */
    463  1.3.2.2   yamt 	uint8_t	protection_ctsonly;	/* use CTS-to-self protection */
    464  1.3.2.1   yamt 	uint8_t	enable_multicast_filtering;
    465  1.3.2.2   yamt 	uint8_t	bluetooth_threshold;	/* collision threshold */
    466  1.3.2.2   yamt 	uint8_t	silence_threshold;	/* silence over/under threshold */
    467  1.3.2.1   yamt 	uint8_t	allow_beacon_and_probe_resp;
    468  1.3.2.1   yamt 	uint8_t	allow_mgt;
    469  1.3.2.2   yamt 	uint8_t	noise_reported;		/* report noise stats to host */
    470  1.3.2.1   yamt 	uint8_t	reserved5;
    471  1.3.2.3   yamt } __packed;
    472      1.1  skrll 
    473      1.1  skrll /* structure for command IWI_CMD_SET_WEP_KEY */
    474      1.1  skrll struct iwi_wep_key {
    475  1.3.2.1   yamt 	uint8_t	cmd;
    476      1.1  skrll #define IWI_WEP_KEY_CMD_SETKEY	0x08
    477  1.3.2.1   yamt 
    478  1.3.2.1   yamt 	uint8_t	seq;
    479  1.3.2.1   yamt 	uint8_t	idx;
    480  1.3.2.1   yamt 	uint8_t	len;
    481  1.3.2.1   yamt 	uint8_t	key[IEEE80211_KEYBUF_SIZE];
    482  1.3.2.3   yamt } __packed;
    483      1.1  skrll 
    484      1.1  skrll /* EEPROM = Electrically Erasable Programmable Read-Only Memory */
    485      1.1  skrll 
    486  1.3.2.1   yamt /* structure for command IWI_CMD_SET_WME_PARAMS */
    487  1.3.2.1   yamt struct iwi_wme_params {
    488  1.3.2.1   yamt 	uint16_t	cwmin[WME_NUM_AC];
    489  1.3.2.1   yamt 	uint16_t	cwmax[WME_NUM_AC];
    490  1.3.2.1   yamt 	uint8_t		aifsn[WME_NUM_AC];
    491  1.3.2.1   yamt 	uint8_t		acm[WME_NUM_AC];
    492  1.3.2.1   yamt 	uint16_t	burst[WME_NUM_AC];
    493  1.3.2.1   yamt } __packed;
    494      1.1  skrll 
    495  1.3.2.1   yamt #define IWI_MEM_START_ADDR	0x00300000
    496  1.3.2.1   yamt 
    497  1.3.2.1   yamt #define IWI_MEM_EEPROM_CTL	(IWI_MEM_START_ADDR + 0x40)
    498  1.3.2.1   yamt #define IWI_MEM_EVENT_CTL	(IWI_MEM_START_ADDR + 0x04)
    499  1.3.2.1   yamt 
    500  1.3.2.1   yamt /*
    501  1.3.2.1   yamt  * led control bits
    502  1.3.2.1   yamt  */
    503  1.3.2.1   yamt #define IWI_LED_ACTIVITY	0x00000010
    504  1.3.2.1   yamt #define IWI_LED_ASSOCIATED	0x00000020
    505  1.3.2.1   yamt #define IWI_LED_OFDM		0x00000040
    506  1.3.2.1   yamt 
    507  1.3.2.1   yamt #define IWI_LED_MASK    (IWI_LED_ACTIVITY | \
    508  1.3.2.1   yamt 			       IWI_LED_ASSOCIATED | \
    509  1.3.2.1   yamt 			       IWI_LED_OFDM)
    510  1.3.2.1   yamt 
    511  1.3.2.1   yamt #define IWI_LED_OFF(sc) 						 \
    512  1.3.2.1   yamt 	do { 								 \
    513  1.3.2.1   yamt 		MEM_WRITE_4(sc, IWI_MEM_EVENT_CTL, ~IWI_LED_MASK); \
    514  1.3.2.1   yamt 	} while (/* CONSTCOND */ 0)
    515  1.3.2.1   yamt 
    516  1.3.2.1   yamt 
    517  1.3.2.1   yamt #define IWI_EEPROM_MAC		0x21
    518  1.3.2.1   yamt #define IWI_EEPROM_NIC_TYPE	0x25
    519      1.1  skrll 
    520      1.1  skrll #define IWI_EEPROM_DELAY	1	/* minimum hold time (microsecond) */
    521      1.1  skrll 
    522      1.1  skrll #define IWI_EEPROM_C	(1 << 0)	/* Serial Clock */
    523      1.1  skrll #define IWI_EEPROM_S	(1 << 1)	/* Chip Select */
    524      1.1  skrll #define IWI_EEPROM_D	(1 << 2)	/* Serial data input */
    525      1.1  skrll #define IWI_EEPROM_Q	(1 << 4)	/* Serial data output */
    526      1.1  skrll 
    527      1.1  skrll #define IWI_EEPROM_SHIFT_D	2
    528      1.1  skrll #define IWI_EEPROM_SHIFT_Q	4
    529      1.1  skrll 
    530      1.1  skrll /*
    531      1.1  skrll  * control and status registers access macros
    532      1.1  skrll  */
    533      1.1  skrll #define CSR_READ_1(sc, reg)						\
    534      1.1  skrll 	bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg))
    535      1.1  skrll 
    536      1.1  skrll #define CSR_READ_2(sc, reg)						\
    537      1.1  skrll 	bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg))
    538      1.1  skrll 
    539      1.1  skrll #define CSR_READ_4(sc, reg)						\
    540      1.1  skrll 	bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
    541      1.1  skrll 
    542      1.1  skrll #define CSR_READ_REGION_4(sc, offset, datap, count)			\
    543      1.1  skrll 	bus_space_read_region_4((sc)->sc_st, (sc)->sc_sh, (offset),	\
    544      1.1  skrll 	    (datap), (count))
    545      1.1  skrll 
    546      1.1  skrll #define CSR_WRITE_1(sc, reg, val)					\
    547      1.1  skrll 	bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    548      1.1  skrll 
    549      1.1  skrll #define CSR_WRITE_2(sc, reg, val)					\
    550      1.1  skrll 	bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    551      1.1  skrll 
    552      1.1  skrll #define CSR_WRITE_4(sc, reg, val)					\
    553      1.1  skrll 	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    554      1.1  skrll 
    555  1.3.2.1   yamt #define CSR_WRITE_REGION_1(sc, offset, datap, count)			\
    556  1.3.2.1   yamt 	bus_space_write_region_1((sc)->sc_st, (sc)->sc_sh, (offset),	\
    557  1.3.2.1   yamt 	    (datap), (count))
    558  1.3.2.1   yamt 
    559      1.1  skrll /*
    560      1.1  skrll  * indirect memory space access macros
    561      1.1  skrll  */
    562      1.1  skrll #define MEM_WRITE_1(sc, addr, val) do {					\
    563      1.1  skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    564      1.1  skrll 	CSR_WRITE_1((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    565      1.1  skrll } while (/* CONSTCOND */0)
    566      1.1  skrll 
    567      1.1  skrll #define MEM_WRITE_2(sc, addr, val) do {					\
    568      1.1  skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    569      1.1  skrll 	CSR_WRITE_2((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    570      1.1  skrll } while (/* CONSTCOND */0)
    571      1.1  skrll 
    572      1.1  skrll #define MEM_WRITE_4(sc, addr, val) do {					\
    573      1.1  skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    574      1.1  skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    575      1.1  skrll } while (/* CONSTCOND */0)
    576      1.1  skrll 
    577      1.1  skrll #define MEM_WRITE_MULTI_1(sc, addr, buf, len) do {			\
    578      1.1  skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    579      1.1  skrll 	CSR_WRITE_MULTI_1((sc), IWI_CSR_INDIRECT_DATA, (buf), (len));	\
    580      1.1  skrll } while (/* CONSTCOND */0)
    581      1.1  skrll 
    582      1.1  skrll /*
    583      1.1  skrll  * EEPROM access macro
    584      1.1  skrll  */
    585      1.1  skrll #define IWI_EEPROM_CTL(sc, val) do {					\
    586      1.1  skrll 	MEM_WRITE_4((sc), IWI_MEM_EEPROM_CTL, (val));			\
    587      1.1  skrll 	DELAY(IWI_EEPROM_DELAY);					\
    588      1.1  skrll } while (/* CONSTCOND */0)
    589