if_iwireg.h revision 166846
1251652Sgjb/* $FreeBSD: head/sys/dev/iwi/if_iwireg.h 166846 2007-02-20 14:29:09Z luigi $ */ 2251652Sgjb 3251652Sgjb/*- 4251652Sgjb * Copyright (c) 2004, 2005 5251652Sgjb * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6251652Sgjb * 7251652Sgjb * Redistribution and use in source and binary forms, with or without 8251652Sgjb * modification, are permitted provided that the following conditions 9251652Sgjb * are met: 10251652Sgjb * 1. Redistributions of source code must retain the above copyright 11251652Sgjb * notice unmodified, this list of conditions, and the following 12251652Sgjb * disclaimer. 13251652Sgjb * 2. Redistributions in binary form must reproduce the above copyright 14251652Sgjb * notice, this list of conditions and the following disclaimer in the 15251652Sgjb * documentation and/or other materials provided with the distribution. 16251652Sgjb * 17251652Sgjb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18251652Sgjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19251652Sgjb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20251652Sgjb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21251652Sgjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22251652Sgjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23251652Sgjb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24251652Sgjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25251652Sgjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26251652Sgjb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27251652Sgjb * SUCH DAMAGE. 28251652Sgjb */ 29251652Sgjb 30251652Sgjb#define IWI_CMD_RING_COUNT 16 31251652Sgjb#define IWI_TX_RING_COUNT 64 32251652Sgjb#define IWI_RX_RING_COUNT 32 33251652Sgjb 34251652Sgjb#define IWI_TX_DESC_SIZE (sizeof (struct iwi_tx_desc)) 35251652Sgjb#define IWI_CMD_DESC_SIZE (sizeof (struct iwi_cmd_desc)) 36251652Sgjb 37251652Sgjb#define IWI_CSR_INTR 0x0008 38251652Sgjb#define IWI_CSR_INTR_MASK 0x000c 39251652Sgjb#define IWI_CSR_INDIRECT_ADDR 0x0010 40251652Sgjb#define IWI_CSR_INDIRECT_DATA 0x0014 41251652Sgjb#define IWI_CSR_AUTOINC_ADDR 0x0018 42251652Sgjb#define IWI_CSR_AUTOINC_DATA 0x001c 43251652Sgjb#define IWI_CSR_RST 0x0020 44251652Sgjb#define IWI_CSR_CTL 0x0024 45251652Sgjb#define IWI_CSR_IO 0x0030 46251652Sgjb#define IWI_CSR_CMD_BASE 0x0200 47251652Sgjb#define IWI_CSR_CMD_SIZE 0x0204 48253019Sgjb#define IWI_CSR_TX1_BASE 0x0208 49253019Sgjb#define IWI_CSR_TX1_SIZE 0x020c 50253019Sgjb#define IWI_CSR_TX2_BASE 0x0210 51253019Sgjb#define IWI_CSR_TX2_SIZE 0x0214 52251652Sgjb#define IWI_CSR_TX3_BASE 0x0218 53251652Sgjb#define IWI_CSR_TX3_SIZE 0x021c 54251652Sgjb#define IWI_CSR_TX4_BASE 0x0220 55251652Sgjb#define IWI_CSR_TX4_SIZE 0x0224 56251652Sgjb#define IWI_CSR_CMD_RIDX 0x0280 57251652Sgjb#define IWI_CSR_TX1_RIDX 0x0284 58251652Sgjb#define IWI_CSR_TX2_RIDX 0x0288 59251652Sgjb#define IWI_CSR_TX3_RIDX 0x028c 60251652Sgjb#define IWI_CSR_TX4_RIDX 0x0290 61251652Sgjb#define IWI_CSR_RX_RIDX 0x02a0 62251652Sgjb#define IWI_CSR_RX_BASE 0x0500 63251652Sgjb#define IWI_CSR_TABLE0_SIZE 0x0700 64251652Sgjb#define IWI_CSR_TABLE0_BASE 0x0704 65251652Sgjb#define IWI_CSR_NODE_BASE 0x0c0c 66251652Sgjb#define IWI_CSR_CMD_WIDX 0x0f80 67251652Sgjb#define IWI_CSR_TX1_WIDX 0x0f84 68251652Sgjb#define IWI_CSR_TX2_WIDX 0x0f88 69251652Sgjb#define IWI_CSR_TX3_WIDX 0x0f8c 70251652Sgjb#define IWI_CSR_TX4_WIDX 0x0f90 71251652Sgjb#define IWI_CSR_RX_WIDX 0x0fa0 72251652Sgjb#define IWI_CSR_READ_INT 0x0ff4 73251652Sgjb 74251652Sgjb/* aliases */ 75251652Sgjb#define IWI_CSR_CURRENT_TX_RATE IWI_CSR_TABLE0_BASE 76251652Sgjb 77251652Sgjb/* flags for IWI_CSR_INTR */ 78251652Sgjb#define IWI_INTR_RX_DONE 0x00000002 79251652Sgjb#define IWI_INTR_CMD_DONE 0x00000800 80251652Sgjb#define IWI_INTR_TX1_DONE 0x00001000 81251652Sgjb#define IWI_INTR_TX2_DONE 0x00002000 82251652Sgjb#define IWI_INTR_TX3_DONE 0x00004000 83251652Sgjb#define IWI_INTR_TX4_DONE 0x00008000 84251652Sgjb#define IWI_INTR_FW_INITED 0x01000000 85251652Sgjb#define IWI_INTR_RADIO_OFF 0x04000000 86251652Sgjb#define IWI_INTR_FATAL_ERROR 0x40000000 87251652Sgjb#define IWI_INTR_PARITY_ERROR 0x80000000 88251652Sgjb 89251652Sgjb#define IWI_INTR_MASK \ 90251652Sgjb (IWI_INTR_RX_DONE | IWI_INTR_CMD_DONE | IWI_INTR_TX1_DONE | \ 91251652Sgjb IWI_INTR_TX2_DONE | IWI_INTR_TX3_DONE | IWI_INTR_TX4_DONE | \ 92251652Sgjb IWI_INTR_FW_INITED | IWI_INTR_RADIO_OFF | \ 93251652Sgjb IWI_INTR_FATAL_ERROR | IWI_INTR_PARITY_ERROR) 94251652Sgjb 95251652Sgjb/* flags for IWI_CSR_RST */ 96251652Sgjb#define IWI_RST_PRINCETON_RESET 0x00000001 97251652Sgjb#define IWI_RST_STANDBY 0x00000004 98251652Sgjb#define IWI_RST_LED_ACTIVITY 0x00000010 /* tx/rx traffic led */ 99251652Sgjb#define IWI_RST_LED_ASSOCIATED 0x00000020 /* station associated led */ 100251652Sgjb#define IWI_RST_LED_OFDM 0x00000040 /* ofdm/cck led */ 101251652Sgjb#define IWI_RST_SOFT_RESET 0x00000080 102251652Sgjb#define IWI_RST_MASTER_DISABLED 0x00000100 103251652Sgjb#define IWI_RST_STOP_MASTER 0x00000200 104251652Sgjb#define IWI_RST_GATE_ODMA 0x02000000 105251652Sgjb#define IWI_RST_GATE_IDMA 0x04000000 106251652Sgjb#define IWI_RST_GATE_ADMA 0x20000000 107251652Sgjb 108251652Sgjb/* flags for IWI_CSR_CTL */ 109251652Sgjb#define IWI_CTL_CLOCK_READY 0x00000001 110251652Sgjb#define IWI_CTL_ALLOW_STANDBY 0x00000002 111251652Sgjb#define IWI_CTL_INIT 0x00000004 112251652Sgjb 113251652Sgjb/* flags for IWI_CSR_IO */ 114251652Sgjb#define IWI_IO_RADIO_ENABLED 0x00010000 115253019Sgjb 116253019Sgjb/* flags for IWI_CSR_READ_INT */ 117253019Sgjb#define IWI_READ_INT_INIT_HOST 0x20000000 118253019Sgjb 119253019Sgjb/* constants for command blocks */ 120253019Sgjb#define IWI_CB_DEFAULT_CTL 0x8cea0000 121253019Sgjb#define IWI_CB_MAXDATALEN 8191 122253019Sgjb 123253019Sgjb/* supported rates */ 124253019Sgjb#define IWI_RATE_DS1 10 125253019Sgjb#define IWI_RATE_DS2 20 126253019Sgjb#define IWI_RATE_DS5 55 127253019Sgjb#define IWI_RATE_DS11 110 128253019Sgjb#define IWI_RATE_OFDM6 13 129253019Sgjb#define IWI_RATE_OFDM9 15 130253019Sgjb#define IWI_RATE_OFDM12 5 131253019Sgjb#define IWI_RATE_OFDM18 7 132253019Sgjb#define IWI_RATE_OFDM24 9 133253019Sgjb#define IWI_RATE_OFDM36 11 134251652Sgjb#define IWI_RATE_OFDM48 1 135251652Sgjb#define IWI_RATE_OFDM54 3 136251652Sgjb 137251652Sgjb/* 138251652Sgjb * Old version firmware images start with this header, 139251652Sgjb * fields are in little endian (le32) format. 140251652Sgjb */ 141251652Sgjbstruct iwi_firmware_ohdr { 142251652Sgjb uint32_t version; 143253019Sgjb uint32_t mode; 144253019Sgjb}; 145253019Sgjb#define IWI_FW_REQ_MAJOR 2 146251652Sgjb#define IWI_FW_REQ_MINOR 4 147253019Sgjb#define IWI_FW_GET_MAJOR(ver) ((ver) & 0xff) 148253019Sgjb#define IWI_FW_GET_MINOR(ver) (((ver) & 0xff00) >> 8) 149253019Sgjb 150253019Sgjb#define IWI_FW_MODE_UCODE 0 151251652Sgjb#define IWI_FW_MODE_BOOT 0 152251652Sgjb#define IWI_FW_MODE_BSS 0 153251652Sgjb#define IWI_FW_MODE_IBSS 1 154251652Sgjb#define IWI_FW_MODE_MONITOR 2 155251652Sgjb 156251652Sgjb/* 157251652Sgjb * New version firmware images contain boot, ucode and firmware 158251652Sgjb * all in one chunk. The header at the beginning gives the version 159251652Sgjb * and the size of each (sub)image, in le32 format. 160251652Sgjb */ 161251652Sgjbstruct iwi_firmware_hdr { 162251652Sgjb uint32_t version; /* version stamp */ 163251652Sgjb uint32_t bsize; /* size of boot image */ 164251652Sgjb uint32_t usize; /* size of ucode image */ 165251652Sgjb uint32_t fsize; /* size of firmware image */ 166251652Sgjb}; 167253019Sgjb 168251652Sgjbstruct iwi_hdr { 169251652Sgjb uint8_t type; 170251652Sgjb#define IWI_HDR_TYPE_DATA 0 171251652Sgjb#define IWI_HDR_TYPE_COMMAND 1 172251652Sgjb#define IWI_HDR_TYPE_NOTIF 3 173251652Sgjb#define IWI_HDR_TYPE_FRAME 9 174251652Sgjb 175251652Sgjb uint8_t seq; 176251652Sgjb uint8_t flags; 177251652Sgjb#define IWI_HDR_FLAG_IRQ 0x04 178251652Sgjb 179251652Sgjb uint8_t reserved; 180251652Sgjb} __packed; 181251652Sgjb 182251652Sgjbstruct iwi_notif { 183251652Sgjb uint32_t reserved[2]; 184251652Sgjb uint8_t type; 185257836Sgjb#define IWI_NOTIF_TYPE_SUCCESS 0 186257836Sgjb#define IWI_NOTIF_TYPE_UNSPECIFIED 1 /* unspecified failure */ 187257836Sgjb#define IWI_NOTIF_TYPE_ASSOCIATION 10 188257836Sgjb#define IWI_NOTIF_TYPE_AUTHENTICATION 11 189251652Sgjb#define IWI_NOTIF_TYPE_SCAN_CHANNEL 12 190251652Sgjb#define IWI_NOTIF_TYPE_SCAN_COMPLETE 13 191253019Sgjb#define IWI_NOTIF_TYPE_FRAG_LENGTH 14 192253019Sgjb#define IWI_NOTIF_TYPE_LINK_QUALITY 15 /* "link deterioration" */ 193251652Sgjb#define IWI_NOTIF_TYPE_BEACON 17 /* beacon state, e.g. miss */ 194253019Sgjb#define IWI_NOTIF_TYPE_TGI_TX_KEY 18 /* WPA transmit key */ 195251652Sgjb#define IWI_NOTIF_TYPE_CALIBRATION 20 196251652Sgjb#define IWI_NOTIF_TYPE_NOISE 25 197251652Sgjb 198252224Sgjb uint8_t flags; 199252224Sgjb uint16_t len; 200252224Sgjb} __packed; 201252224Sgjb 202252224Sgjb/* structure for notification IWI_NOTIF_TYPE_AUTHENTICATION */ 203252224Sgjbstruct iwi_notif_authentication { 204252224Sgjb uint8_t state; 205252224Sgjb#define IWI_AUTH_FAIL 0 206252224Sgjb#define IWI_AUTH_SENT_1 1 /* tx first frame */ 207252224Sgjb#define IWI_AUTH_RECV_2 2 /* rx second frame */ 208252224Sgjb#define IWI_AUTH_SEQ1_PASS 3 /* 1st exchange passed */ 209251652Sgjb#define IWI_AUTH_SEQ1_FAIL 4 /* 1st exchange failed */ 210251652Sgjb#define IWI_AUTH_SUCCESS 9 211251652Sgjb} __packed; 212251652Sgjb 213251652Sgjb/* structure for notification IWI_NOTIF_TYPE_ASSOCIATION */ 214251652Sgjbstruct iwi_notif_association { 215251652Sgjb uint8_t state; 216251652Sgjb#define IWI_ASSOC_FAIL 0 217251652Sgjb#define IWI_ASSOC_SUCCESS 12 218253019Sgjb uint8_t pad[11]; 219253019Sgjb} __packed; 220253019Sgjb 221251652Sgjb/* structure for notification IWI_NOTIF_TYPE_SCAN_CHANNEL */ 222253019Sgjbstruct iwi_notif_scan_channel { 223251652Sgjb uint8_t nchan; 224 uint8_t reserved[47]; 225} __packed; 226 227/* structure for notification IWI_NOTIF_TYPE_SCAN_COMPLETE */ 228struct iwi_notif_scan_complete { 229 uint8_t type; 230 uint8_t nchan; 231 uint8_t status; 232 uint8_t reserved; 233} __packed; 234 235/* structure for notification IWI_NOTIF_TYPE_BEACON */ 236struct iwi_notif_beacon_state { 237 uint32_t state; 238#define IWI_BEACON_MISS 1 239 uint32_t number; 240} __packed; 241 242/* received frame header */ 243struct iwi_frame { 244 uint32_t reserved1[2]; 245 uint8_t chan; 246 uint8_t status; 247 uint8_t rate; 248 uint8_t rssi; 249 uint8_t agc; 250 uint8_t rssi_dbm; 251 uint16_t signal; 252 uint16_t noise; 253 uint8_t antenna; 254 uint8_t control; 255 uint8_t reserved2[2]; 256 uint16_t len; 257} __packed; 258 259/* header for transmission */ 260struct iwi_tx_desc { 261 struct iwi_hdr hdr; 262 uint32_t reserved1; 263 uint8_t station; /* adhoc sta #, 0 for bss */ 264 uint8_t reserved2[3]; 265 uint8_t cmd; 266#define IWI_DATA_CMD_TX 0x0b 267 268 uint8_t seq; 269 uint16_t len; 270 uint8_t priority; 271 uint8_t flags; 272#define IWI_DATA_FLAG_SHPREAMBLE 0x04 273#define IWI_DATA_FLAG_NO_WEP 0x20 274#define IWI_DATA_FLAG_NEED_ACK 0x80 275 276 uint8_t xflags; 277#define IWI_DATA_XFLAG_QOS 0x10 278 279 uint8_t wep_txkey; 280 uint8_t wepkey[IEEE80211_KEYBUF_SIZE]; 281 uint8_t rate; 282 uint8_t antenna; 283 uint8_t reserved3[10]; 284 struct ieee80211_qosframe_addr4 wh; 285 uint32_t iv; 286 uint32_t eiv; 287 288 uint32_t nseg; 289#define IWI_MAX_NSEG 6 290 uint32_t seg_addr[IWI_MAX_NSEG]; 291 uint16_t seg_len[IWI_MAX_NSEG]; 292} __packed; 293 294/* command */ 295struct iwi_cmd_desc { 296 struct iwi_hdr hdr; 297 uint8_t type; 298#define IWI_CMD_ENABLE 2 299#define IWI_CMD_SET_CONFIG 6 300#define IWI_CMD_SET_ESSID 8 301#define IWI_CMD_SET_MAC_ADDRESS 11 302#define IWI_CMD_SET_RTS_THRESHOLD 15 303#define IWI_CMD_SET_FRAG_THRESHOLD 16 304#define IWI_CMD_SET_POWER_MODE 17 305#define IWI_CMD_SET_WEP_KEY 18 306#define IWI_CMD_SCAN 20 307#define IWI_CMD_ASSOCIATE 21 308#define IWI_CMD_SET_RATES 22 309#define IWI_CMD_ABORT_SCAN 23 310#define IWI_CMD_SET_WME_PARAMS 25 311#define IWI_CMD_SCAN_EXT 26 312#define IWI_CMD_SET_OPTIE 31 313#define IWI_CMD_DISABLE 33 314#define IWI_CMD_SET_IV 34 315#define IWI_CMD_SET_TX_POWER 35 316#define IWI_CMD_SET_SENSITIVITY 42 317#define IWI_CMD_SET_WMEIE 84 318 319 uint8_t len; 320 uint16_t reserved; 321 uint8_t data[120]; 322} __packed; 323 324/* node information (IBSS) */ 325struct iwi_ibssnode { 326 uint8_t bssid[IEEE80211_ADDR_LEN]; 327 uint8_t reserved[2]; 328} __packed; 329 330/* constants for 'mode' fields */ 331#define IWI_MODE_11A 0 332#define IWI_MODE_11B 1 333#define IWI_MODE_11G 2 334 335/* possible values for command IWI_CMD_SET_POWER_MODE */ 336#define IWI_POWER_MODE_CAM 0 /* no power save */ 337#define IWI_POWER_MODE_PSP 3 338#define IWI_POWER_MODE_MAX 5 /* max power save operation */ 339 340/* structure for command IWI_CMD_SET_RATES */ 341struct iwi_rateset { 342 uint8_t mode; 343 uint8_t nrates; 344 uint8_t type; 345#define IWI_RATESET_TYPE_NEGOTIATED 0 346#define IWI_RATESET_TYPE_SUPPORTED 1 347 348 uint8_t reserved; 349#define IWI_RATESET_SIZE 12 350 uint8_t rates[IWI_RATESET_SIZE]; 351} __packed; 352 353/* structure for command IWI_CMD_SET_TX_POWER */ 354struct iwi_txpower { 355 uint8_t nchan; 356 uint8_t mode; 357 struct { 358 uint8_t chan; 359 uint8_t power; 360#define IWI_TXPOWER_MAX 20 361#define IWI_TXPOWER_RATIO (IEEE80211_TXPOWER_MAX / IWI_TXPOWER_MAX) 362 } __packed chan[37]; 363} __packed; 364 365/* structure for command IWI_CMD_ASSOCIATE */ 366struct iwi_associate { 367 uint8_t chan; /* channel # */ 368 uint8_t auth; /* type and key */ 369#define IWI_AUTH_OPEN 0 370#define IWI_AUTH_SHARED 1 371#define IWI_AUTH_NONE 3 372 373 uint8_t type; /* request */ 374#define IWI_HC_ASSOC 0 375#define IWI_HC_REASSOC 1 376#define IWI_HC_DISASSOC 2 377#define IWI_HC_IBSS_START 3 378#define IWI_HC_IBSS_RECONF 4 379#define IWI_HC_DISASSOC_QUIET 5 380 uint8_t reserved; 381 uint16_t policy; 382#define IWI_POLICY_WME 1 383#define IWI_POLICY_WPA 2 384 385 uint8_t plen; /* preamble length */ 386 uint8_t mode; /* 11a, 11b, or 11g */ 387 uint8_t bssid[IEEE80211_ADDR_LEN]; 388 uint8_t tstamp[8]; /* tsf for beacon sync */ 389 uint16_t capinfo; 390 uint16_t lintval; /* listen interval */ 391 uint16_t intval; /* beacon interval */ 392 uint8_t dst[IEEE80211_ADDR_LEN]; 393 uint16_t atim_window; 394 uint8_t smr; 395 uint8_t reserved1; 396 uint16_t reserved2; 397} __packed; 398 399#define IWI_SCAN_CHANNELS 54 400 401/* structure for command IWI_CMD_SCAN */ 402struct iwi_scan { 403 uint8_t type; 404 uint16_t dwelltime; /* channel dwell time (ms) */ 405 uint8_t channels[IWI_SCAN_CHANNELS]; 406#define IWI_CHAN_5GHZ (0 << 6) 407#define IWI_CHAN_2GHZ (1 << 6) 408 409 uint8_t reserved[3]; 410} __packed; 411 412/* scan type codes */ 413#define IWI_SCAN_TYPE_PASSIVE_STOP 0 /* passive, stop on first beacon */ 414#define IWI_SCAN_TYPE_PASSIVE 1 /* passive, full dwell on channel */ 415#define IWI_SCAN_TYPE_DIRECTED 2 /* active, directed probe req */ 416#define IWI_SCAN_TYPE_BROADCAST 3 /* active, bcast probe req */ 417#define IWI_SCAN_TYPE_BDIRECTED 4 /* active, directed+bcast probe */ 418#define IWI_SCAN_TYPES 5 419 420/* structure for command IWI_CMD_SCAN_EXT */ 421struct iwi_scan_ext { 422 uint32_t full_scan_index; 423 uint8_t channels[IWI_SCAN_CHANNELS]; 424 uint8_t scan_type[IWI_SCAN_CHANNELS / 2]; 425 uint8_t reserved; 426 uint16_t dwell_time[IWI_SCAN_TYPES]; 427} __packed; 428 429/* structure for command IWI_CMD_SET_CONFIG */ 430struct iwi_configuration { 431 uint8_t bluetooth_coexistence; 432 uint8_t reserved1; 433 uint8_t answer_pbreq; /* answer bcast ssid probe req frames */ 434 uint8_t allow_invalid_frames; /* accept data frames w/ errors */ 435 uint8_t multicast_enabled; /* accept frames w/ any bssid */ 436 uint8_t drop_unicast_unencrypted; 437 uint8_t disable_unicast_decryption; 438 uint8_t drop_multicast_unencrypted; 439 uint8_t disable_multicast_decryption; 440 uint8_t antenna; /* antenna diversity */ 441#define IWI_ANTENNA_AUTO 0 /* firmware selects best antenna */ 442#define IWI_ANTENNA_A 1 /* use antenna A only */ 443#define IWI_ANTENNA_B 3 /* use antenna B only */ 444#define IWI_ANTENNA_SLOWDIV 2 /* slow diversity algorithm */ 445 uint8_t include_crc; /* include crc in rx'd frames */ 446 uint8_t use_protection; /* auto-detect 11g operation */ 447 uint8_t protection_ctsonly; /* use CTS-to-self protection */ 448 uint8_t enable_multicast_filtering; 449 uint8_t bluetooth_threshold; /* collision threshold */ 450 uint8_t silence_threshold; /* silence over/under threshold */ 451 uint8_t allow_beacon_and_probe_resp;/* accept frames w/ any bssid */ 452 uint8_t allow_mgt; /* accept frames w/ any bssid */ 453 uint8_t noise_reported; /* report noise stats to host */ 454 uint8_t reserved5; 455} __packed; 456 457/* structure for command IWI_CMD_SET_WEP_KEY */ 458struct iwi_wep_key { 459 uint8_t cmd; 460#define IWI_WEP_KEY_CMD_SETKEY 0x08 461 462 uint8_t seq; 463 uint8_t idx; 464 uint8_t len; 465 uint8_t key[IEEE80211_KEYBUF_SIZE]; 466} __packed; 467 468/* structure for command IWI_CMD_SET_WME_PARAMS */ 469struct iwi_wme_params { 470 uint16_t cwmin[WME_NUM_AC]; 471 uint16_t cwmax[WME_NUM_AC]; 472 uint8_t aifsn[WME_NUM_AC]; 473 uint8_t acm[WME_NUM_AC]; 474 uint16_t burst[WME_NUM_AC]; 475} __packed; 476 477/* structure for command IWI_CMD_SET_SENSITIVTY */ 478struct iwi_sensitivity { 479 uint16_t rssi; /* beacon rssi in dBm */ 480#define IWI_RSSI_TO_DBM 112 481 uint16_t reserved; 482} __packed; 483 484#define IWI_MEM_EEPROM_EVENT 0x00300004 485#define IWI_MEM_EEPROM_CTL 0x00300040 486 487#define IWI_EEPROM_MAC 0x21 488#define IWI_EEPROM_NIC 0x25 /* nic type (lsb) */ 489#define IWI_EEPROM_SKU 0x25 /* nic type (msb) */ 490 491#define IWI_EEPROM_DELAY 1 /* minimum hold time (microsecond) */ 492 493#define IWI_EEPROM_C (1 << 0) /* Serial Clock */ 494#define IWI_EEPROM_S (1 << 1) /* Chip Select */ 495#define IWI_EEPROM_D (1 << 2) /* Serial data input */ 496#define IWI_EEPROM_Q (1 << 4) /* Serial data output */ 497 498#define IWI_EEPROM_SHIFT_D 2 499#define IWI_EEPROM_SHIFT_Q 4 500 501/* 502 * control and status registers access macros 503 */ 504#define CSR_READ_1(sc, reg) \ 505 bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 506 507#define CSR_READ_2(sc, reg) \ 508 bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 509 510#define CSR_READ_4(sc, reg) \ 511 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 512 513#define CSR_READ_REGION_4(sc, offset, datap, count) \ 514 bus_space_read_region_4((sc)->sc_st, (sc)->sc_sh, (offset), \ 515 (datap), (count)) 516 517#define CSR_WRITE_1(sc, reg, val) \ 518 bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 519 520#define CSR_WRITE_2(sc, reg, val) \ 521 bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 522 523#define CSR_WRITE_4(sc, reg, val) \ 524 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 525 526#define CSR_WRITE_REGION_1(sc, offset, datap, count) \ 527 bus_space_write_region_1((sc)->sc_st, (sc)->sc_sh, (offset), \ 528 (datap), (count)) 529 530/* 531 * indirect memory space access macros 532 */ 533#define MEM_WRITE_1(sc, addr, val) do { \ 534 CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 535 CSR_WRITE_1((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 536} while (/* CONSTCOND */0) 537 538#define MEM_WRITE_2(sc, addr, val) do { \ 539 CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 540 CSR_WRITE_2((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 541} while (/* CONSTCOND */0) 542 543#define MEM_WRITE_4(sc, addr, val) do { \ 544 CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 545 CSR_WRITE_4((sc), IWI_CSR_INDIRECT_DATA, (val)); \ 546} while (/* CONSTCOND */0) 547 548#define MEM_WRITE_MULTI_1(sc, addr, buf, len) do { \ 549 CSR_WRITE_4((sc), IWI_CSR_INDIRECT_ADDR, (addr)); \ 550 CSR_WRITE_MULTI_1((sc), IWI_CSR_INDIRECT_DATA, (buf), (len)); \ 551} while (/* CONSTCOND */0) 552 553/* 554 * EEPROM access macro 555 */ 556#define IWI_EEPROM_CTL(sc, val) do { \ 557 MEM_WRITE_4((sc), IWI_MEM_EEPROM_CTL, (val)); \ 558 DELAY(IWI_EEPROM_DELAY); \ 559} while (/* CONSTCOND */0) 560