Home | History | Annotate | Line # | Download | only in pci
if_iwireg.h revision 1.13
      1  1.13     skrll /*	$NetBSD: if_iwireg.h,v 1.13 2005/11/14 11:58:52 skrll 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.5     skrll #define IWI_CMD_RING_COUNT	16
     31   1.5     skrll #define IWI_TX_RING_COUNT	64
     32   1.5     skrll #define IWI_RX_RING_COUNT	32
     33   1.1     skrll 
     34   1.8     skrll #define IWI_TX_DESC_SIZE	(sizeof (struct iwi_tx_desc))
     35   1.8     skrll #define IWI_CMD_DESC_SIZE	(sizeof (struct iwi_cmd_desc))
     36   1.8     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.5     skrll #define IWI_CSR_CMD_RIDX	0x0280
     57   1.5     skrll #define IWI_CSR_TX1_RIDX	0x0284
     58   1.5     skrll #define IWI_CSR_TX2_RIDX	0x0288
     59   1.5     skrll #define IWI_CSR_TX3_RIDX	0x028c
     60   1.5     skrll #define IWI_CSR_TX4_RIDX	0x0290
     61   1.5     skrll #define IWI_CSR_RX_RIDX		0x02a0
     62   1.1     skrll #define IWI_CSR_RX_BASE		0x0500
     63  1.13     skrll #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.5     skrll #define IWI_CSR_CMD_WIDX	0x0f80
     68   1.5     skrll #define IWI_CSR_TX1_WIDX	0x0f84
     69   1.5     skrll #define IWI_CSR_TX2_WIDX	0x0f88
     70   1.5     skrll #define IWI_CSR_TX3_WIDX	0x0f8c
     71   1.5     skrll #define IWI_CSR_TX4_WIDX	0x0f90
     72   1.5     skrll #define IWI_CSR_RX_WIDX		0x0fa0
     73   1.1     skrll #define IWI_CSR_READ_INT	0x0ff4
     74   1.1     skrll 
     75   1.1     skrll /* possible flags for IWI_CSR_INTR */
     76   1.5     skrll #define IWI_INTR_RX_DONE	0x00000002
     77   1.5     skrll #define IWI_INTR_CMD_DONE	0x00000800
     78   1.5     skrll #define IWI_INTR_TX1_DONE	0x00001000
     79   1.5     skrll #define IWI_INTR_TX2_DONE	0x00002000
     80   1.5     skrll #define IWI_INTR_TX3_DONE	0x00004000
     81   1.5     skrll #define IWI_INTR_TX4_DONE	0x00008000
     82   1.1     skrll #define IWI_INTR_FW_INITED	0x01000000
     83   1.1     skrll #define IWI_INTR_RADIO_OFF	0x04000000
     84   1.1     skrll #define IWI_INTR_FATAL_ERROR	0x40000000
     85   1.1     skrll #define IWI_INTR_PARITY_ERROR	0x80000000
     86   1.1     skrll 
     87   1.5     skrll #define IWI_INTR_MASK						\
     88   1.5     skrll 	(IWI_INTR_RX_DONE | IWI_INTR_CMD_DONE |			\
     89   1.5     skrll 	 IWI_INTR_TX1_DONE | IWI_INTR_TX2_DONE |		\
     90   1.5     skrll 	 IWI_INTR_TX3_DONE | IWI_INTR_TX4_DONE |		\
     91   1.5     skrll 	 IWI_INTR_FW_INITED | IWI_INTR_RADIO_OFF |		\
     92   1.1     skrll 	 IWI_INTR_FATAL_ERROR | IWI_INTR_PARITY_ERROR)
     93   1.1     skrll 
     94   1.1     skrll /* possible flags for register IWI_CSR_RST */
     95   1.1     skrll #define IWI_RST_PRINCETON_RESET	0x00000001
     96   1.1     skrll #define IWI_RST_SW_RESET	0x00000080
     97   1.1     skrll #define IWI_RST_MASTER_DISABLED	0x00000100
     98   1.1     skrll #define IWI_RST_STOP_MASTER	0x00000200
     99   1.1     skrll 
    100   1.1     skrll /* possible flags for register IWI_CSR_CTL */
    101   1.1     skrll #define IWI_CTL_CLOCK_READY	0x00000001
    102   1.1     skrll #define IWI_CTL_ALLOW_STANDBY	0x00000002
    103   1.1     skrll #define IWI_CTL_INIT		0x00000004
    104   1.1     skrll 
    105   1.1     skrll /* possible flags for register IWI_CSR_IO */
    106   1.1     skrll #define IWI_IO_RADIO_ENABLED	0x00010000
    107   1.1     skrll 
    108   1.1     skrll /* possible flags for IWI_CSR_READ_INT */
    109   1.1     skrll #define IWI_READ_INT_INIT_HOST	0x20000000
    110   1.1     skrll 
    111  1.13     skrll /* error log definitions */
    112  1.13     skrll struct iwi_error {
    113  1.13     skrll 	uint32_t	type;
    114  1.13     skrll 	uint32_t	reserved2;
    115  1.13     skrll 	uint32_t	reserved3;
    116  1.13     skrll 	uint32_t	reserved4;
    117  1.13     skrll 	uint32_t	reserved5;
    118  1.13     skrll 	uint32_t	reserved6;
    119  1.13     skrll 	uint32_t	reserved7;
    120  1.13     skrll } __attribute__((__packed__));
    121  1.13     skrll 
    122   1.1     skrll /* table2 offsets */
    123   1.1     skrll #define IWI_INFO_ADAPTER_MAC	40
    124   1.1     skrll 
    125   1.1     skrll /* constants for command blocks */
    126   1.1     skrll #define IWI_CB_DEFAULT_CTL	0x8cea0000
    127   1.1     skrll #define IWI_CB_MAXDATALEN	8191
    128   1.1     skrll 
    129   1.1     skrll /* supported rates */
    130   1.1     skrll #define IWI_RATE_DS1	10
    131   1.1     skrll #define IWI_RATE_DS2	20
    132   1.1     skrll #define IWI_RATE_DS5	55
    133   1.1     skrll #define IWI_RATE_DS11	110
    134   1.1     skrll #define IWI_RATE_OFDM6	13
    135   1.1     skrll #define IWI_RATE_OFDM9	15
    136   1.1     skrll #define IWI_RATE_OFDM12	5
    137   1.1     skrll #define IWI_RATE_OFDM18	7
    138   1.1     skrll #define IWI_RATE_OFDM24	9
    139   1.1     skrll #define IWI_RATE_OFDM36	11
    140   1.1     skrll #define IWI_RATE_OFDM48	1
    141   1.1     skrll #define IWI_RATE_OFDM54	3
    142   1.1     skrll 
    143   1.1     skrll struct iwi_hdr {
    144   1.7     skrll 	uint8_t	type;
    145   1.1     skrll #define IWI_HDR_TYPE_DATA	0
    146   1.1     skrll #define IWI_HDR_TYPE_COMMAND	1
    147   1.1     skrll #define IWI_HDR_TYPE_NOTIF	3
    148   1.1     skrll #define IWI_HDR_TYPE_FRAME	9
    149   1.7     skrll 
    150   1.7     skrll 	uint8_t	seq;
    151   1.7     skrll 	uint8_t	flags;
    152   1.1     skrll #define IWI_HDR_FLAG_IRQ	0x04
    153   1.7     skrll 
    154   1.7     skrll 	uint8_t	reserved;
    155   1.1     skrll } __attribute__((__packed__));
    156   1.1     skrll 
    157   1.1     skrll struct iwi_notif {
    158   1.7     skrll 	uint32_t	reserved[2];
    159   1.7     skrll 	uint8_t		type;
    160   1.1     skrll #define IWI_NOTIF_TYPE_ASSOCIATION	10
    161   1.1     skrll #define IWI_NOTIF_TYPE_AUTHENTICATION	11
    162   1.1     skrll #define IWI_NOTIF_TYPE_SCAN_CHANNEL	12
    163   1.1     skrll #define IWI_NOTIF_TYPE_SCAN_COMPLETE	13
    164   1.1     skrll #define IWI_NOTIF_TYPE_BEACON		17
    165   1.1     skrll #define IWI_NOTIF_TYPE_CALIBRATION	20
    166   1.1     skrll #define IWI_NOTIF_TYPE_NOISE		25
    167   1.7     skrll 
    168   1.7     skrll 	uint8_t		flags;
    169   1.7     skrll 	uint16_t	len;
    170   1.1     skrll } __attribute__((__packed__));
    171   1.1     skrll 
    172   1.1     skrll /* structure for notification IWI_NOTIF_TYPE_AUTHENTICATION */
    173   1.1     skrll struct iwi_notif_authentication {
    174   1.7     skrll 	uint8_t	state;
    175   1.1     skrll #define IWI_DEAUTHENTICATED	0
    176   1.1     skrll #define IWI_AUTHENTICATED	9
    177   1.1     skrll } __attribute__((__packed__));
    178   1.1     skrll 
    179   1.1     skrll /* structure for notification IWI_NOTIF_TYPE_ASSOCIATION */
    180   1.1     skrll struct iwi_notif_association {
    181   1.7     skrll 	uint8_t			state;
    182   1.1     skrll #define IWI_DEASSOCIATED	0
    183   1.1     skrll #define IWI_ASSOCIATED		12
    184   1.5     skrll 
    185   1.1     skrll 	struct ieee80211_frame	frame;
    186   1.7     skrll 	uint16_t		capinfo;
    187   1.7     skrll 	uint16_t		status;
    188   1.7     skrll 	uint16_t		associd;
    189   1.1     skrll } __attribute__((__packed__));
    190   1.1     skrll 
    191   1.1     skrll /* structure for notification IWI_NOTIF_TYPE_SCAN_CHANNEL */
    192   1.1     skrll struct iwi_notif_scan_channel {
    193   1.7     skrll 	uint8_t	nchan;
    194   1.7     skrll 	uint8_t	reserved[47];
    195   1.1     skrll } __attribute__((__packed__));
    196   1.1     skrll 
    197   1.1     skrll /* structure for notification IWI_NOTIF_TYPE_SCAN_COMPLETE */
    198   1.1     skrll struct iwi_notif_scan_complete {
    199   1.7     skrll 	uint8_t	type;
    200   1.7     skrll 	uint8_t	nchan;
    201   1.7     skrll 	uint8_t	status;
    202   1.7     skrll 	uint8_t	reserved;
    203   1.1     skrll } __attribute__((__packed__));
    204   1.1     skrll 
    205   1.1     skrll /* received frame header */
    206   1.1     skrll struct iwi_frame {
    207   1.7     skrll 	uint32_t	reserved1[2];
    208   1.7     skrll 	uint8_t		chan;
    209   1.7     skrll 	uint8_t		status;
    210   1.7     skrll 	uint8_t		rate;
    211   1.7     skrll 	uint8_t		rssi;	/* receiver signal strength indicator */
    212   1.7     skrll 	uint8_t		agc;	/* automatic gain control */
    213   1.7     skrll 	uint8_t		rssi_dbm;
    214   1.7     skrll 	uint16_t	signal;
    215   1.7     skrll 	uint16_t	noise;
    216   1.7     skrll 	uint8_t		antenna;
    217   1.7     skrll 	uint8_t		control;
    218   1.7     skrll 	uint8_t		reserved2[2];
    219   1.7     skrll 	uint16_t	len;
    220   1.1     skrll } __attribute__((__packed__));
    221   1.1     skrll 
    222   1.1     skrll /* header for transmission */
    223   1.1     skrll struct iwi_tx_desc {
    224   1.1     skrll 	struct iwi_hdr	hdr;
    225   1.7     skrll 	uint32_t	reserved1;
    226   1.7     skrll 	uint8_t		station;
    227   1.7     skrll 	uint8_t		reserved2[3];
    228   1.7     skrll 	uint8_t		cmd;
    229   1.1     skrll #define IWI_DATA_CMD_TX	0x0b
    230   1.7     skrll 
    231   1.7     skrll 	uint8_t		seq;
    232   1.7     skrll 	uint16_t	len;
    233   1.7     skrll 	uint8_t		priority;
    234   1.7     skrll 	uint8_t		flags;
    235   1.1     skrll #define IWI_DATA_FLAG_SHPREAMBLE	0x04
    236   1.1     skrll #define IWI_DATA_FLAG_NO_WEP		0x20
    237   1.1     skrll #define IWI_DATA_FLAG_NEED_ACK		0x80
    238   1.1     skrll 
    239   1.7     skrll 	uint8_t		xflags;
    240   1.7     skrll 	uint8_t		wep_txkey;
    241   1.7     skrll 	uint8_t		wepkey[IEEE80211_KEYBUF_SIZE];
    242   1.7     skrll 	uint8_t		rate;
    243   1.7     skrll 	uint8_t		antenna;
    244   1.7     skrll 	uint8_t		reserved3[10];
    245   1.1     skrll 	struct ieee80211_qosframe_addr4	wh;
    246   1.7     skrll 	uint32_t	iv;
    247   1.7     skrll 	uint32_t	eiv;
    248   1.7     skrll 	uint32_t	nseg;
    249   1.7     skrll #define IWI_MAX_NSEG	6
    250   1.1     skrll 
    251   1.7     skrll 	uint32_t	seg_addr[IWI_MAX_NSEG];
    252   1.7     skrll 	uint16_t	seg_len[IWI_MAX_NSEG];
    253   1.1     skrll } __attribute__((__packed__));
    254   1.1     skrll 
    255   1.1     skrll /* command */
    256   1.1     skrll struct iwi_cmd_desc {
    257   1.1     skrll 	struct iwi_hdr	hdr;
    258   1.7     skrll 	uint8_t		type;
    259   1.1     skrll #define IWI_CMD_ENABLE				2
    260   1.1     skrll #define IWI_CMD_SET_CONFIGURATION		6
    261   1.1     skrll #define IWI_CMD_SET_ESSID			8
    262   1.1     skrll #define IWI_CMD_SET_MAC_ADDRESS			11
    263   1.1     skrll #define IWI_CMD_SET_RTS_THRESHOLD		15
    264   1.4  christos #define IWI_CMD_SET_FRAG_THRESHOLD		16
    265   1.1     skrll #define IWI_CMD_SET_POWER_MODE			17
    266   1.1     skrll #define IWI_CMD_SET_WEP_KEY			18
    267   1.1     skrll #define IWI_CMD_SCAN				20
    268   1.1     skrll #define IWI_CMD_ASSOCIATE			21
    269   1.1     skrll #define IWI_CMD_SET_RATES			22
    270   1.4  christos #define IWI_CMD_ABORT_SCAN			23
    271   1.9     skrll #define IWI_CMD_SCAN_V2				26
    272   1.4  christos #define IWI_CMD_SET_OPTIE			31
    273   1.1     skrll #define IWI_CMD_DISABLE				33
    274   1.1     skrll #define IWI_CMD_SET_IV				34
    275   1.1     skrll #define IWI_CMD_SET_TX_POWER			35
    276   1.1     skrll #define IWI_CMD_SET_SENSITIVITY			42
    277   1.7     skrll 
    278   1.7     skrll 	uint8_t		len;
    279   1.7     skrll 	uint16_t	reserved;
    280   1.7     skrll 	uint8_t		data[120];
    281   1.1     skrll } __attribute__((__packed__));
    282   1.1     skrll 
    283   1.1     skrll /* constants for 'mode' fields */
    284   1.1     skrll #define IWI_MODE_11A	0
    285   1.1     skrll #define IWI_MODE_11B	1
    286   1.1     skrll #define IWI_MODE_11G	2
    287   1.1     skrll 
    288   1.1     skrll /* possible values for command IWI_CMD_SET_POWER_MODE */
    289   1.1     skrll #define IWI_POWER_MODE_CAM	0
    290   1.1     skrll 
    291   1.1     skrll /* structure for command IWI_CMD_SET_RATES */
    292   1.1     skrll struct iwi_rateset {
    293   1.7     skrll 	uint8_t	mode;
    294   1.7     skrll 	uint8_t	nrates;
    295   1.7     skrll 	uint8_t	type;
    296   1.6     skrll #define IWI_RATESET_TYPE_NEGOTIATED	0
    297   1.1     skrll #define IWI_RATESET_TYPE_SUPPORTED	1
    298   1.7     skrll 
    299   1.7     skrll 	uint8_t	reserved;
    300   1.7     skrll 	uint8_t	rates[12];
    301   1.1     skrll } __attribute__((__packed__));
    302   1.1     skrll 
    303   1.1     skrll /* structure for command IWI_CMD_SET_TX_POWER */
    304   1.1     skrll struct iwi_txpower {
    305   1.7     skrll 	uint8_t	nchan;
    306   1.7     skrll 	uint8_t	mode;
    307   1.1     skrll 	struct {
    308   1.7     skrll 		uint8_t	chan;
    309   1.7     skrll 		uint8_t	power;
    310   1.1     skrll #define IWI_TXPOWER_MAX		20
    311   1.1     skrll #define IWI_TXPOWER_RATIO	(IEEE80211_TXPOWER_MAX / IWI_TXPOWER_MAX)
    312   1.1     skrll 	} __attribute__((__packed__)) chan[37];
    313   1.1     skrll } __attribute__((__packed__));
    314   1.1     skrll 
    315   1.1     skrll /* structure for command IWI_CMD_ASSOCIATE */
    316   1.1     skrll struct iwi_associate {
    317   1.7     skrll 	uint8_t		chan;
    318   1.7     skrll 	uint8_t		auth;
    319   1.1     skrll #define IWI_AUTH_OPEN	0
    320   1.1     skrll #define IWI_AUTH_SHARED	1
    321   1.1     skrll #define IWI_AUTH_NONE	3
    322   1.7     skrll 
    323   1.7     skrll 	uint8_t		type;
    324   1.7     skrll 	uint8_t		reserved1;
    325   1.7     skrll 	uint16_t	policy;
    326   1.4  christos #define IWI_POLICY_OPTIE	2
    327   1.4  christos 
    328   1.7     skrll 	uint8_t		plen;
    329   1.7     skrll 	uint8_t		mode;
    330   1.7     skrll 	uint8_t		bssid[IEEE80211_ADDR_LEN];
    331   1.7     skrll 	uint8_t		tstamp[8];
    332   1.7     skrll 	uint16_t	capinfo;
    333   1.7     skrll 	uint16_t	lintval;
    334   1.7     skrll 	uint16_t	intval;
    335   1.7     skrll 	uint8_t		dst[IEEE80211_ADDR_LEN];
    336   1.7     skrll 	uint32_t	reserved3;
    337   1.7     skrll 	uint16_t	reserved4;
    338   1.1     skrll } __attribute__((__packed__));
    339   1.1     skrll 
    340   1.5     skrll #define IWI_SCAN_CHANNELS	54
    341   1.5     skrll 
    342   1.9     skrll #define IWI_SCAN_TYPE_FIRST_BEACON	0
    343   1.9     skrll #define IWI_SCAN_TYPE_PASSIVE		1
    344   1.9     skrll #define IWI_SCAN_TYPE_ACTIVE_DIRECT	2
    345   1.9     skrll #define IWI_SCAN_TYPE_ACTIVE_BROADCAST	3
    346   1.9     skrll #define IWI_SCAN_TYPE_ACTIVE_BDIRECT	4
    347   1.9     skrll #define IWI_SCAN_TYPES			5
    348   1.9     skrll 
    349   1.9     skrll #define iwi_scan_type_set(s, i, t) 			\
    350   1.9     skrll 	do { 						\
    351   1.9     skrll 		if ((i) % 2 == 0)			\
    352   1.9     skrll 			(s).type[(i) / 2].lsn = (t);	\
    353   1.9     skrll 		else					\
    354   1.9     skrll 			(s).type[(i) / 2].msn = (t);	\
    355   1.9     skrll 	} while(0)
    356   1.9     skrll 
    357   1.9     skrll /* structure for command IWI_CMD_SCAN_V2 */
    358   1.9     skrll struct iwi_scan_v2 {
    359   1.9     skrll 	u_int32_t	fsidx;
    360   1.9     skrll 	u_int8_t	channels[IWI_SCAN_CHANNELS];
    361  1.11     skrll #define IWI_CHAN_5GHZ	(0 << 6)
    362  1.11     skrll #define IWI_CHAN_2GHZ	(1 << 6)
    363  1.11     skrll 
    364   1.9     skrll 	struct {
    365  1.12       scw #if _BYTE_ORDER == _LITTLE_ENDIAN
    366  1.10     skrll 		u_int8_t msn:4;
    367   1.9     skrll 		u_int8_t lsn:4;
    368  1.12       scw #else
    369  1.12       scw 		u_int8_t lsn:4;
    370  1.12       scw 		u_int8_t msn:4;
    371  1.12       scw #endif
    372   1.9     skrll 	} __attribute__ ((__packed__)) type[IWI_SCAN_CHANNELS / 2];
    373   1.9     skrll 
    374   1.9     skrll 	u_int8_t	reserved1;
    375   1.9     skrll 	u_int16_t	dwelltime[IWI_SCAN_TYPES];
    376   1.9     skrll 
    377   1.9     skrll } __attribute__ ((__packed__));
    378   1.9     skrll 
    379   1.1     skrll /* structure for command IWI_CMD_SET_CONFIGURATION */
    380   1.1     skrll struct iwi_configuration {
    381   1.7     skrll 	uint8_t	bluetooth_coexistence;
    382   1.7     skrll 	uint8_t	reserved1;
    383   1.7     skrll 	uint8_t	answer_pbreq;
    384   1.7     skrll 	uint8_t	allow_invalid_frames;
    385   1.7     skrll 	uint8_t	multicast_enabled;
    386   1.7     skrll 	uint8_t	drop_unicast_unencrypted;
    387   1.7     skrll 	uint8_t	disable_unicast_decryption;
    388   1.7     skrll 	uint8_t	drop_multicast_unencrypted;
    389   1.7     skrll 	uint8_t	disable_multicast_decryption;
    390   1.7     skrll 	uint8_t	antenna;
    391   1.7     skrll 	uint8_t	reserved2;
    392   1.7     skrll 	uint8_t	use_protection;
    393   1.7     skrll 	uint8_t	protection_ctsonly;
    394   1.7     skrll 	uint8_t	enable_multicast_filtering;
    395   1.7     skrll 	uint8_t	bluetooth_threshold;
    396   1.7     skrll 	uint8_t	reserved4;
    397   1.7     skrll 	uint8_t	allow_beacon_and_probe_resp;
    398   1.7     skrll 	uint8_t	allow_mgt;
    399   1.7     skrll 	uint8_t	noise_reported;
    400   1.7     skrll 	uint8_t	reserved5;
    401   1.1     skrll } __attribute__((__packed__));
    402   1.1     skrll 
    403   1.1     skrll /* structure for command IWI_CMD_SET_WEP_KEY */
    404   1.1     skrll struct iwi_wep_key {
    405   1.7     skrll 	uint8_t	cmd;
    406   1.1     skrll #define IWI_WEP_KEY_CMD_SETKEY	0x08
    407   1.7     skrll 
    408   1.7     skrll 	uint8_t	seq;
    409   1.7     skrll 	uint8_t	idx;
    410   1.7     skrll 	uint8_t	len;
    411   1.7     skrll 	uint8_t	key[IEEE80211_KEYBUF_SIZE];
    412   1.1     skrll } __attribute__((__packed__));
    413   1.1     skrll 
    414   1.1     skrll /* EEPROM = Electrically Erasable Programmable Read-Only Memory */
    415   1.1     skrll 
    416   1.1     skrll #define IWI_MEM_EEPROM_CTL	0x00300040
    417   1.1     skrll 
    418   1.1     skrll #define IWI_EEPROM_MAC	0x21
    419   1.1     skrll 
    420   1.1     skrll #define IWI_EEPROM_DELAY	1	/* minimum hold time (microsecond) */
    421   1.1     skrll 
    422   1.1     skrll #define IWI_EEPROM_C	(1 << 0)	/* Serial Clock */
    423   1.1     skrll #define IWI_EEPROM_S	(1 << 1)	/* Chip Select */
    424   1.1     skrll #define IWI_EEPROM_D	(1 << 2)	/* Serial data input */
    425   1.1     skrll #define IWI_EEPROM_Q	(1 << 4)	/* Serial data output */
    426   1.1     skrll 
    427   1.1     skrll #define IWI_EEPROM_SHIFT_D	2
    428   1.1     skrll #define IWI_EEPROM_SHIFT_Q	4
    429   1.1     skrll 
    430   1.1     skrll /*
    431   1.1     skrll  * control and status registers access macros
    432   1.1     skrll  */
    433   1.1     skrll #define CSR_READ_1(sc, reg)						\
    434   1.1     skrll 	bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg))
    435   1.1     skrll 
    436   1.1     skrll #define CSR_READ_2(sc, reg)						\
    437   1.1     skrll 	bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg))
    438   1.1     skrll 
    439   1.1     skrll #define CSR_READ_4(sc, reg)						\
    440   1.1     skrll 	bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
    441   1.1     skrll 
    442   1.1     skrll #define CSR_READ_REGION_4(sc, offset, datap, count)			\
    443   1.1     skrll 	bus_space_read_region_4((sc)->sc_st, (sc)->sc_sh, (offset),	\
    444   1.1     skrll 	    (datap), (count))
    445   1.1     skrll 
    446   1.1     skrll #define CSR_WRITE_1(sc, reg, val)					\
    447   1.1     skrll 	bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    448   1.1     skrll 
    449   1.1     skrll #define CSR_WRITE_2(sc, reg, val)					\
    450   1.1     skrll 	bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    451   1.1     skrll 
    452   1.1     skrll #define CSR_WRITE_4(sc, reg, val)					\
    453   1.1     skrll 	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    454   1.1     skrll 
    455   1.1     skrll /*
    456   1.1     skrll  * indirect memory space access macros
    457   1.1     skrll  */
    458   1.1     skrll #define MEM_WRITE_1(sc, addr, val) do {					\
    459   1.1     skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    460   1.1     skrll 	CSR_WRITE_1((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    461   1.1     skrll } while (/* CONSTCOND */0)
    462   1.1     skrll 
    463   1.1     skrll #define MEM_WRITE_2(sc, addr, val) do {					\
    464   1.1     skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    465   1.1     skrll 	CSR_WRITE_2((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    466   1.1     skrll } while (/* CONSTCOND */0)
    467   1.1     skrll 
    468   1.1     skrll #define MEM_WRITE_4(sc, addr, val) do {					\
    469   1.1     skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    470   1.1     skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_DATA, (val));		\
    471   1.1     skrll } while (/* CONSTCOND */0)
    472   1.1     skrll 
    473   1.1     skrll #define MEM_WRITE_MULTI_1(sc, addr, buf, len) do {			\
    474   1.1     skrll 	CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr));		\
    475   1.1     skrll 	CSR_WRITE_MULTI_1((sc), IWI_CSR_INDIRECT_DATA, (buf), (len));	\
    476   1.1     skrll } while (/* CONSTCOND */0)
    477   1.1     skrll 
    478   1.1     skrll /*
    479   1.1     skrll  * EEPROM access macro
    480   1.1     skrll  */
    481   1.1     skrll #define IWI_EEPROM_CTL(sc, val) do {					\
    482   1.1     skrll 	MEM_WRITE_4((sc), IWI_MEM_EEPROM_CTL, (val));			\
    483   1.1     skrll 	DELAY(IWI_EEPROM_DELAY);					\
    484   1.1     skrll } while (/* CONSTCOND */0)
    485