1ceaec73dSDamien Bergamini /* $FreeBSD$ */ 2ceaec73dSDamien Bergamini 3ceaec73dSDamien Bergamini /*- 4ceaec73dSDamien Bergamini * Copyright (c) 2004, 2005 5ceaec73dSDamien Bergamini * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6ceaec73dSDamien Bergamini * 7ceaec73dSDamien Bergamini * Redistribution and use in source and binary forms, with or without 8ceaec73dSDamien Bergamini * modification, are permitted provided that the following conditions 9ceaec73dSDamien Bergamini * are met: 10ceaec73dSDamien Bergamini * 1. Redistributions of source code must retain the above copyright 11ceaec73dSDamien Bergamini * notice unmodified, this list of conditions, and the following 12ceaec73dSDamien Bergamini * disclaimer. 13ceaec73dSDamien Bergamini * 2. Redistributions in binary form must reproduce the above copyright 14ceaec73dSDamien Bergamini * notice, this list of conditions and the following disclaimer in the 15ceaec73dSDamien Bergamini * documentation and/or other materials provided with the distribution. 16ceaec73dSDamien Bergamini * 17ceaec73dSDamien Bergamini * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18ceaec73dSDamien Bergamini * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19ceaec73dSDamien Bergamini * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20ceaec73dSDamien Bergamini * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21ceaec73dSDamien Bergamini * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22ceaec73dSDamien Bergamini * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23ceaec73dSDamien Bergamini * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24ceaec73dSDamien Bergamini * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25ceaec73dSDamien Bergamini * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26ceaec73dSDamien Bergamini * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27ceaec73dSDamien Bergamini * SUCH DAMAGE. 28ceaec73dSDamien Bergamini */ 29ceaec73dSDamien Bergamini 30ceaec73dSDamien Bergamini #define IWI_CMD_RING_COUNT 16 31ceaec73dSDamien Bergamini #define IWI_TX_RING_COUNT 64 32ceaec73dSDamien Bergamini #define IWI_RX_RING_COUNT 32 33ceaec73dSDamien Bergamini 34ceaec73dSDamien Bergamini #define IWI_TX_DESC_SIZE (sizeof (struct iwi_tx_desc)) 35ceaec73dSDamien Bergamini #define IWI_CMD_DESC_SIZE (sizeof (struct iwi_cmd_desc)) 36ceaec73dSDamien Bergamini 37ceaec73dSDamien Bergamini #define IWI_CSR_INTR 0x0008 38ceaec73dSDamien Bergamini #define IWI_CSR_INTR_MASK 0x000c 39ceaec73dSDamien Bergamini #define IWI_CSR_INDIRECT_ADDR 0x0010 40ceaec73dSDamien Bergamini #define IWI_CSR_INDIRECT_DATA 0x0014 41ceaec73dSDamien Bergamini #define IWI_CSR_AUTOINC_ADDR 0x0018 42ceaec73dSDamien Bergamini #define IWI_CSR_AUTOINC_DATA 0x001c 43ceaec73dSDamien Bergamini #define IWI_CSR_RST 0x0020 44ceaec73dSDamien Bergamini #define IWI_CSR_CTL 0x0024 45ceaec73dSDamien Bergamini #define IWI_CSR_IO 0x0030 46ceaec73dSDamien Bergamini #define IWI_CSR_CMD_BASE 0x0200 47ceaec73dSDamien Bergamini #define IWI_CSR_CMD_SIZE 0x0204 48ceaec73dSDamien Bergamini #define IWI_CSR_TX1_BASE 0x0208 49ceaec73dSDamien Bergamini #define IWI_CSR_TX1_SIZE 0x020c 50ceaec73dSDamien Bergamini #define IWI_CSR_TX2_BASE 0x0210 51ceaec73dSDamien Bergamini #define IWI_CSR_TX2_SIZE 0x0214 52ceaec73dSDamien Bergamini #define IWI_CSR_TX3_BASE 0x0218 53ceaec73dSDamien Bergamini #define IWI_CSR_TX3_SIZE 0x021c 54ceaec73dSDamien Bergamini #define IWI_CSR_TX4_BASE 0x0220 55ceaec73dSDamien Bergamini #define IWI_CSR_TX4_SIZE 0x0224 56ceaec73dSDamien Bergamini #define IWI_CSR_CMD_RIDX 0x0280 57ceaec73dSDamien Bergamini #define IWI_CSR_TX1_RIDX 0x0284 58ceaec73dSDamien Bergamini #define IWI_CSR_TX2_RIDX 0x0288 59ceaec73dSDamien Bergamini #define IWI_CSR_TX3_RIDX 0x028c 60ceaec73dSDamien Bergamini #define IWI_CSR_TX4_RIDX 0x0290 61ceaec73dSDamien Bergamini #define IWI_CSR_RX_RIDX 0x02a0 62ceaec73dSDamien Bergamini #define IWI_CSR_RX_BASE 0x0500 63ceaec73dSDamien Bergamini #define IWI_CSR_TABLE0_SIZE 0x0700 64ceaec73dSDamien Bergamini #define IWI_CSR_TABLE0_BASE 0x0704 650b74a285SDamien Bergamini #define IWI_CSR_NODE_BASE 0x0c0c 66ceaec73dSDamien Bergamini #define IWI_CSR_CMD_WIDX 0x0f80 67ceaec73dSDamien Bergamini #define IWI_CSR_TX1_WIDX 0x0f84 68ceaec73dSDamien Bergamini #define IWI_CSR_TX2_WIDX 0x0f88 69ceaec73dSDamien Bergamini #define IWI_CSR_TX3_WIDX 0x0f8c 70ceaec73dSDamien Bergamini #define IWI_CSR_TX4_WIDX 0x0f90 71ceaec73dSDamien Bergamini #define IWI_CSR_RX_WIDX 0x0fa0 72ceaec73dSDamien Bergamini #define IWI_CSR_READ_INT 0x0ff4 73ceaec73dSDamien Bergamini 74ceaec73dSDamien Bergamini /* aliases */ 75ceaec73dSDamien Bergamini #define IWI_CSR_CURRENT_TX_RATE IWI_CSR_TABLE0_BASE 76ceaec73dSDamien Bergamini 77ceaec73dSDamien Bergamini /* flags for IWI_CSR_INTR */ 78ceaec73dSDamien Bergamini #define IWI_INTR_RX_DONE 0x00000002 79ceaec73dSDamien Bergamini #define IWI_INTR_CMD_DONE 0x00000800 80ceaec73dSDamien Bergamini #define IWI_INTR_TX1_DONE 0x00001000 81ceaec73dSDamien Bergamini #define IWI_INTR_TX2_DONE 0x00002000 82ceaec73dSDamien Bergamini #define IWI_INTR_TX3_DONE 0x00004000 83ceaec73dSDamien Bergamini #define IWI_INTR_TX4_DONE 0x00008000 84ceaec73dSDamien Bergamini #define IWI_INTR_FW_INITED 0x01000000 85ceaec73dSDamien Bergamini #define IWI_INTR_RADIO_OFF 0x04000000 86ceaec73dSDamien Bergamini #define IWI_INTR_FATAL_ERROR 0x40000000 87ceaec73dSDamien Bergamini #define IWI_INTR_PARITY_ERROR 0x80000000 88ceaec73dSDamien Bergamini 89ceaec73dSDamien Bergamini #define IWI_INTR_MASK \ 90ceaec73dSDamien Bergamini (IWI_INTR_RX_DONE | IWI_INTR_CMD_DONE | IWI_INTR_TX1_DONE | \ 91ceaec73dSDamien Bergamini IWI_INTR_TX2_DONE | IWI_INTR_TX3_DONE | IWI_INTR_TX4_DONE | \ 92ceaec73dSDamien Bergamini IWI_INTR_FW_INITED | IWI_INTR_RADIO_OFF | \ 93ceaec73dSDamien Bergamini IWI_INTR_FATAL_ERROR | IWI_INTR_PARITY_ERROR) 94ceaec73dSDamien Bergamini 95ceaec73dSDamien Bergamini /* flags for IWI_CSR_RST */ 96ceaec73dSDamien Bergamini #define IWI_RST_PRINCETON_RESET 0x00000001 97ceaec73dSDamien Bergamini #define IWI_RST_SOFT_RESET 0x00000080 98ceaec73dSDamien Bergamini #define IWI_RST_MASTER_DISABLED 0x00000100 99ceaec73dSDamien Bergamini #define IWI_RST_STOP_MASTER 0x00000200 100ceaec73dSDamien Bergamini 101ceaec73dSDamien Bergamini /* flags for IWI_CSR_CTL */ 102ceaec73dSDamien Bergamini #define IWI_CTL_CLOCK_READY 0x00000001 103ceaec73dSDamien Bergamini #define IWI_CTL_ALLOW_STANDBY 0x00000002 104ceaec73dSDamien Bergamini #define IWI_CTL_INIT 0x00000004 105ceaec73dSDamien Bergamini 106ceaec73dSDamien Bergamini /* flags for IWI_CSR_IO */ 107ceaec73dSDamien Bergamini #define IWI_IO_RADIO_ENABLED 0x00010000 108ceaec73dSDamien Bergamini 109ceaec73dSDamien Bergamini /* flags for IWI_CSR_READ_INT */ 110ceaec73dSDamien Bergamini #define IWI_READ_INT_INIT_HOST 0x20000000 111ceaec73dSDamien Bergamini 112ceaec73dSDamien Bergamini /* constants for command blocks */ 113ceaec73dSDamien Bergamini #define IWI_CB_DEFAULT_CTL 0x8cea0000 114ceaec73dSDamien Bergamini #define IWI_CB_MAXDATALEN 8191 115ceaec73dSDamien Bergamini 116ceaec73dSDamien Bergamini /* supported rates */ 117ceaec73dSDamien Bergamini #define IWI_RATE_DS1 10 118ceaec73dSDamien Bergamini #define IWI_RATE_DS2 20 119ceaec73dSDamien Bergamini #define IWI_RATE_DS5 55 120ceaec73dSDamien Bergamini #define IWI_RATE_DS11 110 121ceaec73dSDamien Bergamini #define IWI_RATE_OFDM6 13 122ceaec73dSDamien Bergamini #define IWI_RATE_OFDM9 15 123ceaec73dSDamien Bergamini #define IWI_RATE_OFDM12 5 124ceaec73dSDamien Bergamini #define IWI_RATE_OFDM18 7 125ceaec73dSDamien Bergamini #define IWI_RATE_OFDM24 9 126ceaec73dSDamien Bergamini #define IWI_RATE_OFDM36 11 127ceaec73dSDamien Bergamini #define IWI_RATE_OFDM48 1 128ceaec73dSDamien Bergamini #define IWI_RATE_OFDM54 3 129ceaec73dSDamien Bergamini 130ceaec73dSDamien Bergamini struct iwi_hdr { 131ceaec73dSDamien Bergamini uint8_t type; 132ceaec73dSDamien Bergamini #define IWI_HDR_TYPE_DATA 0 133ceaec73dSDamien Bergamini #define IWI_HDR_TYPE_COMMAND 1 134ceaec73dSDamien Bergamini #define IWI_HDR_TYPE_NOTIF 3 135ceaec73dSDamien Bergamini #define IWI_HDR_TYPE_FRAME 9 136ceaec73dSDamien Bergamini 137ceaec73dSDamien Bergamini uint8_t seq; 138ceaec73dSDamien Bergamini uint8_t flags; 139ceaec73dSDamien Bergamini #define IWI_HDR_FLAG_IRQ 0x04 140ceaec73dSDamien Bergamini 141ceaec73dSDamien Bergamini uint8_t reserved; 142ceaec73dSDamien Bergamini } __packed; 143ceaec73dSDamien Bergamini 144ceaec73dSDamien Bergamini struct iwi_notif { 145ceaec73dSDamien Bergamini uint32_t reserved[2]; 146ceaec73dSDamien Bergamini uint8_t type; 147ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_ASSOCIATION 10 148ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_AUTHENTICATION 11 149ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_SCAN_CHANNEL 12 150ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_SCAN_COMPLETE 13 151ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_BEACON 17 152ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_CALIBRATION 20 153ceaec73dSDamien Bergamini #define IWI_NOTIF_TYPE_NOISE 25 154ceaec73dSDamien Bergamini 155ceaec73dSDamien Bergamini uint8_t flags; 156ceaec73dSDamien Bergamini uint16_t len; 157ceaec73dSDamien Bergamini } __packed; 158ceaec73dSDamien Bergamini 159ceaec73dSDamien Bergamini /* structure for notification IWI_NOTIF_TYPE_AUTHENTICATION */ 160ceaec73dSDamien Bergamini struct iwi_notif_authentication { 161ceaec73dSDamien Bergamini uint8_t state; 162ceaec73dSDamien Bergamini #define IWI_DEAUTHENTICATED 0 163ceaec73dSDamien Bergamini #define IWI_AUTHENTICATED 9 164ceaec73dSDamien Bergamini } __packed; 165ceaec73dSDamien Bergamini 166ceaec73dSDamien Bergamini /* structure for notification IWI_NOTIF_TYPE_ASSOCIATION */ 167ceaec73dSDamien Bergamini struct iwi_notif_association { 168ceaec73dSDamien Bergamini uint8_t state; 169ceaec73dSDamien Bergamini #define IWI_DEASSOCIATED 0 170ceaec73dSDamien Bergamini #define IWI_ASSOCIATED 12 171ceaec73dSDamien Bergamini 172ceaec73dSDamien Bergamini struct ieee80211_frame frame; 173ceaec73dSDamien Bergamini uint16_t capinfo; 174ceaec73dSDamien Bergamini uint16_t status; 175ceaec73dSDamien Bergamini uint16_t associd; 176ceaec73dSDamien Bergamini } __packed; 177ceaec73dSDamien Bergamini 178ceaec73dSDamien Bergamini /* structure for notification IWI_NOTIF_TYPE_SCAN_CHANNEL */ 179ceaec73dSDamien Bergamini struct iwi_notif_scan_channel { 180ceaec73dSDamien Bergamini uint8_t nchan; 181ceaec73dSDamien Bergamini uint8_t reserved[47]; 182ceaec73dSDamien Bergamini } __packed; 183ceaec73dSDamien Bergamini 184ceaec73dSDamien Bergamini /* structure for notification IWI_NOTIF_TYPE_SCAN_COMPLETE */ 185ceaec73dSDamien Bergamini struct iwi_notif_scan_complete { 186ceaec73dSDamien Bergamini uint8_t type; 187ceaec73dSDamien Bergamini uint8_t nchan; 188ceaec73dSDamien Bergamini uint8_t status; 189ceaec73dSDamien Bergamini uint8_t reserved; 190ceaec73dSDamien Bergamini } __packed; 191ceaec73dSDamien Bergamini 192ceaec73dSDamien Bergamini /* received frame header */ 193ceaec73dSDamien Bergamini struct iwi_frame { 194ceaec73dSDamien Bergamini uint32_t reserved1[2]; 195ceaec73dSDamien Bergamini uint8_t chan; 196ceaec73dSDamien Bergamini uint8_t status; 197ceaec73dSDamien Bergamini uint8_t rate; 198ceaec73dSDamien Bergamini uint8_t rssi; 199ceaec73dSDamien Bergamini uint8_t agc; 200ceaec73dSDamien Bergamini uint8_t rssi_dbm; 201ceaec73dSDamien Bergamini uint16_t signal; 202ceaec73dSDamien Bergamini uint16_t noise; 203ceaec73dSDamien Bergamini uint8_t antenna; 204ceaec73dSDamien Bergamini uint8_t control; 205ceaec73dSDamien Bergamini uint8_t reserved2[2]; 206ceaec73dSDamien Bergamini uint16_t len; 207ceaec73dSDamien Bergamini } __packed; 208ceaec73dSDamien Bergamini 209ceaec73dSDamien Bergamini /* header for transmission */ 210ceaec73dSDamien Bergamini struct iwi_tx_desc { 211ceaec73dSDamien Bergamini struct iwi_hdr hdr; 212ceaec73dSDamien Bergamini uint32_t reserved1; 213ceaec73dSDamien Bergamini uint8_t station; 214ceaec73dSDamien Bergamini uint8_t reserved2[3]; 215ceaec73dSDamien Bergamini uint8_t cmd; 216ceaec73dSDamien Bergamini #define IWI_DATA_CMD_TX 0x0b 217ceaec73dSDamien Bergamini 218ceaec73dSDamien Bergamini uint8_t seq; 219ceaec73dSDamien Bergamini uint16_t len; 220ceaec73dSDamien Bergamini uint8_t priority; 221ceaec73dSDamien Bergamini uint8_t flags; 222ceaec73dSDamien Bergamini #define IWI_DATA_FLAG_SHPREAMBLE 0x04 223ceaec73dSDamien Bergamini #define IWI_DATA_FLAG_NO_WEP 0x20 224ceaec73dSDamien Bergamini #define IWI_DATA_FLAG_NEED_ACK 0x80 225ceaec73dSDamien Bergamini 226ceaec73dSDamien Bergamini uint8_t xflags; 227ec01dc2bSDamien Bergamini #define IWI_DATA_XFLAG_QOS 0x10 228ec01dc2bSDamien Bergamini 229ceaec73dSDamien Bergamini uint8_t wep_txkey; 230ceaec73dSDamien Bergamini uint8_t wepkey[IEEE80211_KEYBUF_SIZE]; 231ceaec73dSDamien Bergamini uint8_t rate; 232ceaec73dSDamien Bergamini uint8_t antenna; 233ceaec73dSDamien Bergamini uint8_t reserved3[10]; 234ceaec73dSDamien Bergamini struct ieee80211_qosframe_addr4 wh; 235ceaec73dSDamien Bergamini uint32_t iv; 236ceaec73dSDamien Bergamini uint32_t eiv; 237ceaec73dSDamien Bergamini uint32_t nseg; 238ceaec73dSDamien Bergamini #define IWI_MAX_NSEG 6 239ceaec73dSDamien Bergamini 240ceaec73dSDamien Bergamini uint32_t seg_addr[IWI_MAX_NSEG]; 241ceaec73dSDamien Bergamini uint16_t seg_len[IWI_MAX_NSEG]; 242ceaec73dSDamien Bergamini } __packed; 243ceaec73dSDamien Bergamini 244ceaec73dSDamien Bergamini /* command */ 245ceaec73dSDamien Bergamini struct iwi_cmd_desc { 246ceaec73dSDamien Bergamini struct iwi_hdr hdr; 247ceaec73dSDamien Bergamini uint8_t type; 248ceaec73dSDamien Bergamini #define IWI_CMD_ENABLE 2 249ceaec73dSDamien Bergamini #define IWI_CMD_SET_CONFIG 6 250ceaec73dSDamien Bergamini #define IWI_CMD_SET_ESSID 8 251ceaec73dSDamien Bergamini #define IWI_CMD_SET_MAC_ADDRESS 11 252ceaec73dSDamien Bergamini #define IWI_CMD_SET_RTS_THRESHOLD 15 253acea4241SDamien Bergamini #define IWI_CMD_SET_FRAG_THRESHOLD 16 254ceaec73dSDamien Bergamini #define IWI_CMD_SET_POWER_MODE 17 255ceaec73dSDamien Bergamini #define IWI_CMD_SET_WEP_KEY 18 256ceaec73dSDamien Bergamini #define IWI_CMD_ASSOCIATE 21 257ceaec73dSDamien Bergamini #define IWI_CMD_SET_RATES 22 258acea4241SDamien Bergamini #define IWI_CMD_ABORT_SCAN 23 259ec01dc2bSDamien Bergamini #define IWI_CMD_SET_WME_PARAMS 25 26080e1a712SDamien Bergamini #define IWI_CMD_SCAN 26 261acea4241SDamien Bergamini #define IWI_CMD_SET_OPTIE 31 262ceaec73dSDamien Bergamini #define IWI_CMD_DISABLE 33 263ceaec73dSDamien Bergamini #define IWI_CMD_SET_IV 34 264ceaec73dSDamien Bergamini #define IWI_CMD_SET_TX_POWER 35 265ceaec73dSDamien Bergamini #define IWI_CMD_SET_SENSITIVITY 42 266ec01dc2bSDamien Bergamini #define IWI_CMD_SET_WMEIE 84 267ceaec73dSDamien Bergamini 268ceaec73dSDamien Bergamini uint8_t len; 269ceaec73dSDamien Bergamini uint16_t reserved; 270ceaec73dSDamien Bergamini uint8_t data[120]; 271ceaec73dSDamien Bergamini } __packed; 272ceaec73dSDamien Bergamini 2730b74a285SDamien Bergamini /* node information (IBSS) */ 27428a38073SDamien Bergamini struct iwi_ibssnode { 2750b74a285SDamien Bergamini uint8_t bssid[IEEE80211_ADDR_LEN]; 2760b74a285SDamien Bergamini uint8_t reserved[2]; 2770b74a285SDamien Bergamini } __packed; 2780b74a285SDamien Bergamini 279ceaec73dSDamien Bergamini /* constants for 'mode' fields */ 280ceaec73dSDamien Bergamini #define IWI_MODE_11A 0 281ceaec73dSDamien Bergamini #define IWI_MODE_11B 1 282ceaec73dSDamien Bergamini #define IWI_MODE_11G 2 283ceaec73dSDamien Bergamini 284ceaec73dSDamien Bergamini /* possible values for command IWI_CMD_SET_POWER_MODE */ 285ceaec73dSDamien Bergamini #define IWI_POWER_MODE_CAM 0 286ceaec73dSDamien Bergamini 287ceaec73dSDamien Bergamini /* structure for command IWI_CMD_SET_RATES */ 288ceaec73dSDamien Bergamini struct iwi_rateset { 289ceaec73dSDamien Bergamini uint8_t mode; 290ceaec73dSDamien Bergamini uint8_t nrates; 291ceaec73dSDamien Bergamini uint8_t type; 29280e1a712SDamien Bergamini #define IWI_RATESET_TYPE_NEGOTIATED 0 293ceaec73dSDamien Bergamini #define IWI_RATESET_TYPE_SUPPORTED 1 294ceaec73dSDamien Bergamini 295ceaec73dSDamien Bergamini uint8_t reserved; 296ceaec73dSDamien Bergamini uint8_t rates[12]; 297ceaec73dSDamien Bergamini } __packed; 298ceaec73dSDamien Bergamini 299ceaec73dSDamien Bergamini /* structure for command IWI_CMD_SET_TX_POWER */ 300ceaec73dSDamien Bergamini struct iwi_txpower { 301ceaec73dSDamien Bergamini uint8_t nchan; 302ceaec73dSDamien Bergamini uint8_t mode; 303ceaec73dSDamien Bergamini struct { 304ceaec73dSDamien Bergamini uint8_t chan; 305ceaec73dSDamien Bergamini uint8_t power; 306ceaec73dSDamien Bergamini #define IWI_TXPOWER_MAX 20 307ceaec73dSDamien Bergamini #define IWI_TXPOWER_RATIO (IEEE80211_TXPOWER_MAX / IWI_TXPOWER_MAX) 308ceaec73dSDamien Bergamini } __packed chan[37]; 309ceaec73dSDamien Bergamini } __packed; 310ceaec73dSDamien Bergamini 311ceaec73dSDamien Bergamini /* structure for command IWI_CMD_ASSOCIATE */ 312ceaec73dSDamien Bergamini struct iwi_associate { 313ceaec73dSDamien Bergamini uint8_t chan; 314ceaec73dSDamien Bergamini uint8_t auth; 315ceaec73dSDamien Bergamini #define IWI_AUTH_OPEN 0 316ceaec73dSDamien Bergamini #define IWI_AUTH_SHARED 1 317ceaec73dSDamien Bergamini #define IWI_AUTH_NONE 3 318ceaec73dSDamien Bergamini 319ceaec73dSDamien Bergamini uint8_t type; 320ceaec73dSDamien Bergamini uint8_t reserved1; 321acea4241SDamien Bergamini uint16_t policy; 322ec01dc2bSDamien Bergamini #define IWI_POLICY_WME 1 323ec01dc2bSDamien Bergamini #define IWI_POLICY_WPA 2 324acea4241SDamien Bergamini 325ceaec73dSDamien Bergamini uint8_t plen; 326ceaec73dSDamien Bergamini uint8_t mode; 327ceaec73dSDamien Bergamini uint8_t bssid[IEEE80211_ADDR_LEN]; 328ceaec73dSDamien Bergamini uint8_t tstamp[8]; 329ceaec73dSDamien Bergamini uint16_t capinfo; 330ceaec73dSDamien Bergamini uint16_t lintval; 331ceaec73dSDamien Bergamini uint16_t intval; 332ceaec73dSDamien Bergamini uint8_t dst[IEEE80211_ADDR_LEN]; 333ceaec73dSDamien Bergamini uint32_t reserved3; 334ceaec73dSDamien Bergamini uint16_t reserved4; 335ceaec73dSDamien Bergamini } __packed; 336ceaec73dSDamien Bergamini 337ceaec73dSDamien Bergamini /* structure for command IWI_CMD_SCAN */ 338ceaec73dSDamien Bergamini struct iwi_scan { 33980e1a712SDamien Bergamini uint32_t index; 340ceaec73dSDamien Bergamini uint8_t channels[54]; 341ceaec73dSDamien Bergamini #define IWI_CHAN_5GHZ (0 << 6) 342ceaec73dSDamien Bergamini #define IWI_CHAN_2GHZ (1 << 6) 343ceaec73dSDamien Bergamini 34480e1a712SDamien Bergamini uint8_t type[26]; 34580e1a712SDamien Bergamini #define IWI_SCAN_TYPE_PASSIVE 0x11 34680e1a712SDamien Bergamini #define IWI_SCAN_TYPE_DIRECTED 0x22 34780e1a712SDamien Bergamini #define IWI_SCAN_TYPE_BROADCAST 0x33 34880e1a712SDamien Bergamini #define IWI_SCAN_TYPE_BDIRECTED 0x44 34980e1a712SDamien Bergamini 35080e1a712SDamien Bergamini uint8_t reserved1[2]; 35180e1a712SDamien Bergamini uint16_t reserved2; 35280e1a712SDamien Bergamini uint16_t passive; /* dwell time */ 35380e1a712SDamien Bergamini uint16_t directed; /* dwell time */ 35480e1a712SDamien Bergamini uint16_t broadcast; /* dwell time */ 35580e1a712SDamien Bergamini uint16_t bdirected; /* dwell time */ 356ceaec73dSDamien Bergamini } __packed; 357ceaec73dSDamien Bergamini 358ceaec73dSDamien Bergamini /* structure for command IWI_CMD_SET_CONFIG */ 359ceaec73dSDamien Bergamini struct iwi_configuration { 360ceaec73dSDamien Bergamini uint8_t bluetooth_coexistence; 361ceaec73dSDamien Bergamini uint8_t reserved1; 362acea4241SDamien Bergamini uint8_t answer_pbreq; 363ceaec73dSDamien Bergamini uint8_t allow_invalid_frames; 364ceaec73dSDamien Bergamini uint8_t multicast_enabled; 365acea4241SDamien Bergamini uint8_t drop_unicast_unencrypted; 366ceaec73dSDamien Bergamini uint8_t disable_unicast_decryption; 367acea4241SDamien Bergamini uint8_t drop_multicast_unencrypted; 368ceaec73dSDamien Bergamini uint8_t disable_multicast_decryption; 369ceaec73dSDamien Bergamini uint8_t antenna; 370ceaec73dSDamien Bergamini uint8_t reserved2; 371ceaec73dSDamien Bergamini uint8_t use_protection; 372ceaec73dSDamien Bergamini uint8_t protection_ctsonly; 373ceaec73dSDamien Bergamini uint8_t enable_multicast_filtering; 374ceaec73dSDamien Bergamini uint8_t bluetooth_threshold; 375ceaec73dSDamien Bergamini uint8_t reserved4; 376ceaec73dSDamien Bergamini uint8_t allow_beacon_and_probe_resp; 377ceaec73dSDamien Bergamini uint8_t allow_mgt; 378ceaec73dSDamien Bergamini uint8_t noise_reported; 379ceaec73dSDamien Bergamini uint8_t reserved5; 380ceaec73dSDamien Bergamini } __packed; 381ceaec73dSDamien Bergamini 382ceaec73dSDamien Bergamini /* structure for command IWI_CMD_SET_WEP_KEY */ 383ceaec73dSDamien Bergamini struct iwi_wep_key { 384ceaec73dSDamien Bergamini uint8_t cmd; 385ceaec73dSDamien Bergamini #define IWI_WEP_KEY_CMD_SETKEY 0x08 386ceaec73dSDamien Bergamini 387ceaec73dSDamien Bergamini uint8_t seq; 388ceaec73dSDamien Bergamini uint8_t idx; 389ceaec73dSDamien Bergamini uint8_t len; 390ceaec73dSDamien Bergamini uint8_t key[IEEE80211_KEYBUF_SIZE]; 391ceaec73dSDamien Bergamini } __packed; 392ceaec73dSDamien Bergamini 393ec01dc2bSDamien Bergamini /* structure for command IWI_CMD_SET_WME_PARAMS */ 394ec01dc2bSDamien Bergamini struct iwi_wme_params { 395fb533d55SDamien Bergamini uint16_t cwmin[WME_NUM_AC]; 396fb533d55SDamien Bergamini uint16_t cwmax[WME_NUM_AC]; 397ec01dc2bSDamien Bergamini uint8_t aifsn[WME_NUM_AC]; 398ec01dc2bSDamien Bergamini uint8_t acm[WME_NUM_AC]; 399fb533d55SDamien Bergamini uint16_t burst[WME_NUM_AC]; 400ec01dc2bSDamien Bergamini } __packed; 401ec01dc2bSDamien Bergamini 402ceaec73dSDamien Bergamini #define IWI_MEM_EEPROM_CTL 0x00300040 403ceaec73dSDamien Bergamini 404ceaec73dSDamien Bergamini #define IWI_EEPROM_MAC 0x21 405ceaec73dSDamien Bergamini 406ceaec73dSDamien Bergamini #define IWI_EEPROM_DELAY 1 /* minimum hold time (microsecond) */ 407ceaec73dSDamien Bergamini 408ceaec73dSDamien Bergamini #define IWI_EEPROM_C (1 << 0) /* Serial Clock */ 409ceaec73dSDamien Bergamini #define IWI_EEPROM_S (1 << 1) /* Chip Select */ 410ceaec73dSDamien Bergamini #define IWI_EEPROM_D (1 << 2) /* Serial data input */ 411ceaec73dSDamien Bergamini #define IWI_EEPROM_Q (1 << 4) /* Serial data output */ 412ceaec73dSDamien Bergamini 413ceaec73dSDamien Bergamini #define IWI_EEPROM_SHIFT_D 2 414ceaec73dSDamien Bergamini #define IWI_EEPROM_SHIFT_Q 4 415ceaec73dSDamien Bergamini 416ceaec73dSDamien Bergamini /* 417ceaec73dSDamien Bergamini * control and status registers access macros 418ceaec73dSDamien Bergamini */ 419ceaec73dSDamien Bergamini #define CSR_READ_1(sc, reg) \ 420ceaec73dSDamien Bergamini bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 421ceaec73dSDamien Bergamini 422ceaec73dSDamien Bergamini #define CSR_READ_2(sc, reg) \ 423ceaec73dSDamien Bergamini bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 424ceaec73dSDamien Bergamini 425ceaec73dSDamien Bergamini #define CSR_READ_4(sc, reg) \ 426ceaec73dSDamien Bergamini bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 427ceaec73dSDamien Bergamini 428ceaec73dSDamien Bergamini #define CSR_READ_REGION_4(sc, offset, datap, count) \ 429ceaec73dSDamien Bergamini bus_space_read_region_4((sc)->sc_st, (sc)->sc_sh, (offset), \ 430ceaec73dSDamien Bergamini (datap), (count)) 431ceaec73dSDamien Bergamini 432ceaec73dSDamien Bergamini #define CSR_WRITE_1(sc, reg, val) \ 433ceaec73dSDamien Bergamini bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 434ceaec73dSDamien Bergamini 435ceaec73dSDamien Bergamini #define CSR_WRITE_2(sc, reg, val) \ 436ceaec73dSDamien Bergamini bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 437ceaec73dSDamien Bergamini 438ceaec73dSDamien Bergamini #define CSR_WRITE_4(sc, reg, val) \ 439ceaec73dSDamien Bergamini bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 440ceaec73dSDamien Bergamini 4410b74a285SDamien Bergamini #define CSR_WRITE_REGION_1(sc, offset, datap, count) \ 4420b74a285SDamien Bergamini bus_space_write_region_1((sc)->sc_st, (sc)->sc_sh, (offset), \ 4430b74a285SDamien Bergamini (datap), (count)) 4440b74a285SDamien Bergamini 445ceaec73dSDamien Bergamini /* 446ceaec73dSDamien Bergamini * indirect memory space access macros 447ceaec73dSDamien Bergamini */ 448ceaec73dSDamien Bergamini #define MEM_WRITE_1(sc, addr, val) do { \ 449ceaec73dSDamien Bergamini CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 450ceaec73dSDamien Bergamini CSR_WRITE_1((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 451ceaec73dSDamien Bergamini } while (/* CONSTCOND */0) 452ceaec73dSDamien Bergamini 453ceaec73dSDamien Bergamini #define MEM_WRITE_2(sc, addr, val) do { \ 454ceaec73dSDamien Bergamini CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 455ceaec73dSDamien Bergamini CSR_WRITE_2((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 456ceaec73dSDamien Bergamini } while (/* CONSTCOND */0) 457ceaec73dSDamien Bergamini 458ceaec73dSDamien Bergamini #define MEM_WRITE_4(sc, addr, val) do { \ 459ceaec73dSDamien Bergamini CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 460ceaec73dSDamien Bergamini CSR_WRITE_4((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 461ceaec73dSDamien Bergamini } while (/* CONSTCOND */0) 462ceaec73dSDamien Bergamini 463ceaec73dSDamien Bergamini #define MEM_WRITE_MULTI_1(sc, addr, buf, len) do { \ 464ceaec73dSDamien Bergamini CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 465ceaec73dSDamien Bergamini CSR_WRITE_MULTI_1((sc), IWI_CSR_INDIRECT_DATA, (buf), (len)); \ 466ceaec73dSDamien Bergamini } while (/* CONSTCOND */0) 467ceaec73dSDamien Bergamini 468ceaec73dSDamien Bergamini /* 469ceaec73dSDamien Bergamini * EEPROM access macro 470ceaec73dSDamien Bergamini */ 471ceaec73dSDamien Bergamini #define IWI_EEPROM_CTL(sc, val) do { \ 472ceaec73dSDamien Bergamini MEM_WRITE_4((sc), IWI_MEM_EEPROM_CTL, (val)); \ 473ceaec73dSDamien Bergamini DELAY(IWI_EEPROM_DELAY); \ 474ceaec73dSDamien Bergamini } while (/* CONSTCOND */0) 475