1 /* $OpenBSD: if_iwnreg.h,v 1.20 2008/12/12 17:15:40 damien Exp $ */
2 /* $NetBSD: if_iwnreg.h,v 1.5 2008/11/13 12:04:09 blymn Exp $ */
5 * Copyright (c) 2007, 2008
6 * Damien Bergamini <damien.bergamini@free.fr>
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #define IWN_TKIP_MICLEN 8
23 #define IWN_TX_RING_COUNT 256
24 #define IWN_TX_RING_LOMARK 192
25 #define IWN_TX_RING_HIMARK 224
26 #define IWN_RX_RING_COUNT_LOG 8
27 #define IWN_RX_RING_COUNT (1 << IWN_RX_RING_COUNT_LOG)
29 #define IWN4965_NTXQUEUES 16
30 #define IWN5000_NTXQUEUES 20
31 #define IWN_SRVC_CHNL 9
33 /* Maximum number of DMA segments for TX. */
34 #define IWN_MAX_SCATTER 20
36 /* RX buffers must be large enough to hold a full 4K A-MPDU. */
37 #define IWN_RBUF_SIZE (4 * 1024)
40 /* HW supports 36-bit DMA addresses. */
41 #define IWN_LOADDR(paddr) ((uint32_t)(paddr))
42 #define IWN_HIADDR(paddr) (((paddr) >> 32) & 0xf)
44 #define IWN_LOADDR(paddr) (paddr)
45 #define IWN_HIADDR(paddr) (0)
48 /* Base Address Register. */
49 #define IWN_PCI_BAR0 PCI_MAPREG_START
52 * Control and status registers.
54 #define IWN_HW_IF_CONFIG 0x000
55 #define IWN_INT_COALESCING 0x004
57 #define IWN_MASK 0x00c
58 #define IWN_FH_INT 0x010
59 #define IWN_RESET 0x020
60 #define IWN_GP_CNTRL 0x024
61 #define IWN_HW_REV 0x028
62 #define IWN_EEPROM 0x02c
63 #define IWN_EEPROM_GP 0x030
65 #define IWN_UCODE_GP1_CLR 0x05c
67 #define IWN_GIO_CHICKEN 0x100
68 #define IWN_ANA_PLL 0x20c
69 #define IWN_DBG_HPET_MEM 0x240
70 #define IWN_MEM_RADDR 0x40c
71 #define IWN_MEM_WADDR 0x410
72 #define IWN_MEM_WDATA 0x418
73 #define IWN_MEM_RDATA 0x41c
74 #define IWN_PRPH_WADDR 0x444
75 #define IWN_PRPH_RADDR 0x448
76 #define IWN_PRPH_WDATA 0x44c
77 #define IWN_PRPH_RDATA 0x450
78 #define IWN_HBUS_TARG_WRPTR 0x460
81 * Flow-Handler registers.
83 #define IWN_FH_TFBD_CTRL0(qid) (0x1900 + (qid) * 8)
84 #define IWN_FH_TFBD_CTRL1(qid) (0x1904 + (qid) * 8)
85 #define IWN_FH_KW_ADDR 0x197c
86 #define IWN_FH_SRAM_ADDR(qid) (0x19a4 + (qid) * 4)
87 #define IWN_FH_CBBC_QUEUE(qid) (0x19d0 + (qid) * 4)
88 #define IWN_FH_STATUS_WPTR 0x1bc0
89 #define IWN_FH_RX_BASE 0x1bc4
90 #define IWN_FH_RX_WPTR 0x1bc8
91 #define IWN_FH_RX_CONFIG 0x1c00
92 #define IWN_FH_RX_STATUS 0x1c44
93 #define IWN_FH_TX_CONFIG(qid) (0x1d00 + (qid) * 32)
94 #define IWN_FH_TXBUF_STATUS(qid) (0x1d08 + (qid) * 32)
95 #define IWN_FH_TX_CHICKEN 0x1e98
96 #define IWN_FH_TX_STATUS 0x1eb0
99 * TX scheduler registers.
101 #define IWN_SCHED_BASE 0xa02c00
102 #define IWN_SCHED_SRAM_ADDR (IWN_SCHED_BASE + 0x000)
103 #define IWN5000_SCHED_DRAM_ADDR (IWN_SCHED_BASE + 0x008)
104 #define IWN4965_SCHED_DRAM_ADDR (IWN_SCHED_BASE + 0x010)
105 #define IWN5000_SCHED_TXFACT (IWN_SCHED_BASE + 0x010)
106 #define IWN4965_SCHED_TXFACT (IWN_SCHED_BASE + 0x01c)
107 #define IWN4965_SCHED_QUEUE_RDPTR(qid) (IWN_SCHED_BASE + 0x064 + (qid) * 4)
108 #define IWN5000_SCHED_QUEUE_RDPTR(qid) (IWN_SCHED_BASE + 0x068 + (qid) * 4)
109 #define IWN4965_SCHED_QCHAIN_SEL (IWN_SCHED_BASE + 0x0d0)
110 #define IWN4965_SCHED_INTR_MASK (IWN_SCHED_BASE + 0x0e4)
111 #define IWN5000_SCHED_QCHAIN_SEL (IWN_SCHED_BASE + 0x0e8)
112 #define IWN4965_SCHED_QUEUE_STATUS(qid) (IWN_SCHED_BASE + 0x104 + (qid) * 4)
113 #define IWN5000_SCHED_INTR_MASK (IWN_SCHED_BASE + 0x108)
114 #define IWN5000_SCHED_QUEUE_STATUS(qid) (IWN_SCHED_BASE + 0x10c + (qid) * 4)
115 #define IWN5000_SCHED_AGGR_SEL (IWN_SCHED_BASE + 0x248)
118 * Offsets in TX scheduler's SRAM.
120 #define IWN4965_SCHED_CTX_OFF 0x380
121 #define IWN4965_SCHED_CTX_LEN 416
122 #define IWN4965_SCHED_QUEUE_OFFSET(qid) (0x380 + (qid) * 8)
123 #define IWN4965_SCHED_TRANS_TBL(qid) (0x500 + (qid) * 2)
124 #define IWN5000_SCHED_CTX_OFF 0x600
125 #define IWN5000_SCHED_CTX_LEN 520
126 #define IWN5000_SCHED_QUEUE_OFFSET(qid) (0x600 + (qid) * 8)
127 #define IWN5000_SCHED_TRANS_TBL(qid) (0x7e0 + (qid) * 2)
130 * NIC internal memory offsets.
132 #define IWN_CLOCK_CTL 0x3000
133 #define IWN_APMG_CLK_CTRL 0x3004
134 #define IWN_APMG_CLK_DIS 0x3008
135 #define IWN_APMG_PS 0x300c
136 #define IWN_APMG_PCI_STT 0x3010
137 #define IWN_BSM_WR_CTRL 0x3400
138 #define IWN_BSM_WR_MEM_SRC 0x3404
139 #define IWN_BSM_WR_MEM_DST 0x3408
140 #define IWN_BSM_WR_DWCOUNT 0x340c
141 #define IWN_BSM_DRAM_TEXT_ADDR 0x3490
142 #define IWN_BSM_DRAM_TEXT_SIZE 0x3494
143 #define IWN_BSM_DRAM_DATA_ADDR 0x3498
144 #define IWN_BSM_DRAM_DATA_SIZE 0x349c
145 #define IWN_BSM_SRAM_BASE 0x3800
147 /* Possible values for IWN_APMG_CLK_DIS. */
148 #define IWN_APMG_CLK_DMA_RQT (1 << 9)
150 /* Possible flags for register IWN_HW_IF_CONFIG. */
151 #define IWN_HW_IF_CONFIG_4965_R (1 << 4)
152 #define IWN_HW_IF_CONFIG_MAC_SI (1 << 8)
153 #define IWN_HW_IF_CONFIG_RADIO_SI (1 << 9)
154 #define IWN_HW_IF_CONFIG_EEPROM_LOCKED (1 << 21)
155 #define IWN_HW_IF_CONFIG_HAP_WAKE_L1A (1 << 23)
157 /* Possible flags for registers IWN_PRPH_RADDR/IWN_PRPH_WADDR. */
158 #define IWN_PRPH_DWORD ((sizeof (uint32_t) - 1) << 24)
160 /* Possible values for IWN_BSM_WR_MEM_DST. */
161 #define IWN_FW_TEXT_BASE 0x00000000
162 #define IWN_FW_DATA_BASE 0x00800000
164 /* Possible flags for register IWN_RESET. */
165 #define IWN_RESET_NEVO (1 << 0)
166 #define IWN_RESET_SW (1 << 7)
167 #define IWN_RESET_MASTER_DISABLED (1 << 8)
168 #define IWN_RESET_STOP_MASTER (1 << 9)
170 /* Possible flags for register IWN_GP_CNTRL. */
171 #define IWN_GP_CNTRL_MAC_ACCESS_ENA (1 << 0)
172 #define IWN_GP_CNTRL_MAC_CLOCK_READY (1 << 0)
173 #define IWN_GP_CNTRL_INIT_DONE (1 << 2)
174 #define IWN_GP_CNTRL_MAC_ACCESS_REQ (1 << 3)
175 #define IWN_GP_CNTRL_SLEEP (1 << 4)
176 #define IWN_GP_CNTRL_RFKILL (1 << 27)
178 /* Possible flags for register IWN_HW_REV. */
179 #define IWN_HW_REV_TYPE_SHIFT 4
180 #define IWN_HW_REV_TYPE_MASK 0x000000f0
181 #define IWN_HW_REV_TYPE_4965 0
182 #define IWN_HW_REV_TYPE_5300 2
183 #define IWN_HW_REV_TYPE_5350 3
184 #define IWN_HW_REV_TYPE_5150 4
185 #define IWN_HW_REV_TYPE_5100 5
186 #define IWN_HW_REV_TYPE_1000 6
187 #define IWN_HW_REV_TYPE_6000 7
188 #define IWN_HW_REV_TYPE_6050 8
190 /* Possible flags for register IWN_GIO_CHICKEN. */
191 #define IWN_GIO_CHICKEN_L1A_NO_L0S_RX (1 << 23)
192 #define IWN_GIO_CHICKEN_DIS_L0S_TIMER (1 << 29)
194 /* Possible flags for register IWN_GIO. */
195 #define IWN_GIO_L0S_ENA (1 << 1)
197 /* Possible flags for register IWN_UCODE_GP1_CLR. */
198 #define IWN_UCODE_GP1_RFKILL (1 << 1)
199 #define IWN_UCODE_GP1_CMD_BLOCKED (1 << 2)
200 #define IWN_UCODE_GP1_CTEMP_STOP_RF (1 << 3)
202 /* Possible flags/values for register IWN_LED. */
203 #define IWN_LED_BSM_CTRL (1 << 5)
204 #define IWN_LED_OFF 0x00000038
205 #define IWN_LED_ON 0x00000078
207 /* Possible values for register IWN_ANA_PLL. */
208 #define IWN_ANA_PLL_INIT 0x00880300
210 /* Possible flags for register IWN_FH_RX_STATUS. */
211 #define IWN_FH_RX_STATUS_IDLE (1 << 24)
213 /* Possible flags for register IWN_BSM_WR_CTRL. */
214 #define IWN_BSM_WR_CTRL_START_EN (1 << 30)
215 #define IWN_BSM_WR_CTRL_START (1 << 31)
217 /* Possible flags for register IWN_INT. */
218 #define IWN_INT_ALIVE (1 << 0)
219 #define IWN_INT_WAKEUP (1 << 1)
220 #define IWN_INT_SW_RX (1 << 3)
221 #define IWN_INT_CT_REACHED (1 << 6)
222 #define IWN_INT_RF_TOGGLED (1 << 7)
223 #define IWN_INT_SW_ERR (1 << 25)
224 #define IWN_INT_FH_TX (1 << 27)
225 #define IWN_INT_HW_ERR (1 << 29)
226 #define IWN_INT_FH_RX (1 << 31)
229 #define IWN_INT_MASK \
230 (IWN_INT_SW_ERR | IWN_INT_HW_ERR | IWN_INT_FH_TX | \
231 IWN_INT_FH_RX | IWN_INT_ALIVE | IWN_INT_WAKEUP | \
232 IWN_INT_SW_RX | IWN_INT_CT_REACHED | IWN_INT_RF_TOGGLED)
234 /* Possible flags for register IWN_FH_INT. */
235 #define IWN_FH_INT_TX_CHNL(x) (1 << (x))
236 #define IWN_FH_INT_RX_CHNL(x) (1 << ((x) + 16))
237 #define IWN_FH_INT_HI_PRIOR (1 << 30)
238 /* Shortcuts for the above. */
239 #define IWN_FH_INT_TX \
240 (IWN_FH_INT_TX_CHNL(0) | IWN_FH_INT_TX_CHNL(1))
241 #define IWN_FH_INT_RX \
242 (IWN_FH_INT_RX_CHNL(0) | IWN_FH_INT_RX_CHNL(1) | IWN_FH_INT_HI_PRIOR)
244 /* Possible flags/values for register IWN_FH_TX_CONFIG. */
245 #define IWN_FH_TX_CONFIG_DMA_PAUSE 0
246 #define IWN_FH_TX_CONFIG_DMA_ENA (1 << 31)
247 #define IWN_FH_TX_CONFIG_CIRQ_HOST_ENDTFD (1 << 20)
249 /* Possible flags/values for register IWN_FH_TXBUF_STATUS. */
250 #define IWN_FH_TXBUF_STATUS_TBNUM(x) ((x) << 20)
251 #define IWN_FH_TXBUF_STATUS_TBIDX(x) ((x) << 12)
252 #define IWN_FH_TXBUF_STATUS_TFBD_VALID 3
254 /* Possible flags for register IWN_FH_TX_CHICKEN. */
255 #define IWN_FH_TX_CHICKEN_SCHED_RETRY (1 << 1)
257 /* Possible flags for register IWN_FH_TX_STATUS. */
258 #define IWN_FH_TX_STATUS_IDLE(chnl) \
259 (1 << ((chnl) + 24) | 1 << ((chnl) + 16))
261 /* Possible flags for register IWN_FH_RX_CONFIG. */
262 #define IWN_FH_RX_CONFIG_ENA (1 << 31)
263 #define IWN_FH_RX_CONFIG_NRBD(x) ((x) << 20)
264 #define IWN_FH_RX_CONFIG_RB_SIZE_8K (1 << 16)
265 #define IWN_FH_RX_CONFIG_SINGLE_FRAME (1 << 15)
266 #define IWN_FH_RX_CONFIG_IRQ_DST_HOST (1 << 12)
267 #define IWN_FH_RX_CONFIG_RB_TIMEOUT(x) ((x) << 4)
268 #define IWN_FH_RX_CONFIG_IGN_RXF_EMPTY (1 << 2)
270 /* Possible flags for register IWN_FH_TX_CONFIG. */
271 #define IWN_FH_TX_CONFIG_DMA_ENA (1 << 31)
272 #define IWN_FH_TX_CONFIG_DMA_CREDIT_ENA (1 << 3)
274 /* Possible flags for register IWN_EEPROM. */
275 #define IWN_EEPROM_READ_VALID (1 << 0)
276 #define IWN_EEPROM_CMD (1 << 1)
278 /* Possible flags for register IWN_SCHED_QUEUE_STATUS. */
279 #define IWN4965_TXQ_STATUS_ACTIVE 0x0007fc01
280 #define IWN4965_TXQ_STATUS_INACTIVE 0x0007fc00
281 #define IWN4965_TXQ_STATUS_AGGR_ENA (1 << 5 | 1 << 8)
282 #define IWN4965_TXQ_STATUS_CHGACT (1 << 10)
283 #define IWN5000_TXQ_STATUS_ACTIVE 0x00ff0018
284 #define IWN5000_TXQ_STATUS_INACTIVE 0x00ff0010
285 #define IWN5000_TXQ_STATUS_CHGACT (1 << 19)
287 /* Possible flags for register IWN_APMG_CLK_CTRL. */
288 #define IWN_APMG_CLK_CTRL_DMA_CLK_RQT (1 << 9)
289 #define IWN_APMG_CLK_CTRL_BSM_CLK_RQT (1 << 11)
291 /* Possible flags for register IWN_APMG_PS. */
292 #define IWN_APMG_PS_EARLY_PWROFF_DIS (1 << 22)
293 #define IWN_APMG_PS_PWR_SRC_MASK (3 << 24)
294 #define IWN_APMG_PS_PWR_SRC(x) ((x) << 24)
295 #define IWN_APMG_PS_PWR_SRC_VMAIN 0
297 /* Possible flags for IWN_APMG_PCI_STT. */
298 #define IWN_APMG_PCI_STT_L1A_DIS (1 << 11)
300 /* Possible flags for register IWN_BSM_DRAM_TEXT_SIZE. */
301 #define IWN_FW_UPDATED (1 << 31)
303 #define IWN_SCHED_WINSZ 64
304 #define IWN_SCHED_LIMIT 64
305 #define IWN4965_SCHED_COUNT 512
306 #define IWN5000_SCHED_COUNT (IWN_TX_RING_COUNT + IWN_SCHED_WINSZ)
307 #define IWN4965_SCHEDSZ (IWN4965_NTXQUEUES * IWN4965_SCHED_COUNT * 2)
308 #define IWN5000_SCHEDSZ (IWN5000_NTXQUEUES * IWN5000_SCHED_COUNT * 2)
311 uint8_t reserved1
[3];
316 } __packed segs
[IWN_MAX_SCATTER
];
317 /* Pad to 128 bytes. */
321 struct iwn_rx_status
{
322 uint16_t closed_count
;
323 uint16_t closed_rx_count
;
324 uint16_t finished_count
;
325 uint16_t finished_rx_count
;
326 uint32_t reserved
[2];
332 #define IWN_UC_READY 1
333 #define IWN_UC_ERROR 2
335 #define IWN_RXON_ASSOC 17
336 #define IWN_QOS_PARAM 19
337 #define IWN_RXON_TIMING 20
338 #define IWN_ADD_NODE_DONE 24
339 #define IWN_REMOVE_NODE_DONE 25
340 #define IWN_REMOVE_ALL_NODE_DONE 26
341 #define IWN_TX_DONE 28
342 #define IWN3945_RATE_SCALE 71
343 #define IWN_LEDS_CMD 72
344 #define IWN_4965_TX_LINK_QUALITY 78
345 #define IWN5000_CALIBRATION_RESULT 102
346 #define IWN5000_CALIBRATION_DONE 103
347 #define IWN_RADAR_NOTIFICATION 112
348 #define IWN_QUIET_CMD 113
349 #define IWN_CHANNEL_SWITCH 114
350 #define IWN_CHANNEL_SWITCH_NOTIFICATION 115
351 #define IWN_SPECTRUM_MEASUREMENT_CMD 116
352 #define IWN_SPECTRUM_MEASUREMENT_NOTIFICATION 117
353 #define IWN_POWER_TABLE_CMD 119
354 #define IWN_PM_SLEEP_NOTIFICATION 120
355 #define IWN_DEBUG_STATISTICS_NOTIFICATION 112
356 #define IWN_SCAN_CMD 128
357 #define IWN_SCAN_ABORT_CMD 129
358 #define IWN_SCAN_START_NOTIFICATION 130
359 #define IWN_START_SCAN 130
360 #define IWN_SCAN_RESULTS_NOTIFICATION 131
361 #define IWN_SCAN_COMPLETE_NOTIFICATION 132
362 #define IWN_STOP_SCAN 132
363 #define IWN_BEACON_NOTIFICATION 144
364 #define IWN_TX_BEACON 145
365 #define IWN_WHO_IS_AWAKE_NOTIFICATION 146
366 #define IWN_QUIET_NOTIFICATION 150
367 #define IWN_TX_PWR_TABLE_CMD 151
368 #define IWN_MEASURE_ABORT_CMD 153
369 #define IWN_BT_CONFIG 155
370 #define IWN_RX_STATISTICS 156
371 #define IWN_BEACON_STATISTICS 157
372 #define IWN_CARD_STATE_CMD 160
373 #define IWN_STATE_CHANGED 161
374 #define IWN_BEACON_MISSED 162
375 #define IWN_CT_KILL_CONFIG_CMD 164
376 #define IWN_SENSITIVITY_CMD 168
377 #define IWN_PHY_CALIBRATION_CMD 176
378 #define IWN_RX_PHY 192
379 #define IWN_MPDU_RX_DONE 193
380 #define IWN4965_RX_DONE 195
381 #define IWN_RX_DONE 195
382 #define IWN_COMPRESSED_BA 197
389 /* Possible RX status flags. */
390 #define IWN_RX_NO_CRC_ERR (1 << 0)
391 #define IWN_RX_NO_OVFL_ERR (1 << 1)
392 /* Shortcut for the above. */
393 #define IWN_RX_NOERROR (IWN_RX_NO_CRC_ERR | IWN_RX_NO_OVFL_ERR)
394 #define IWN_RX_MPDU_MIC_OK (1 << 6)
395 #define IWN_RX_CIPHER_MASK (7 << 8)
396 #define IWN_RX_CIPHER_CCMP (2 << 8)
397 #define IWN_RX_MPDU_DEC (1 << 11)
398 #define IWN_RX_DECRYPT_MASK (3 << 11)
399 #define IWN_RX_DECRYPT_OK (3 << 11)
403 #define IWN_CMD_CONFIGURE 16
404 #define IWN_CMD_ASSOCIATE 17
405 #define IWN_CMD_EDCA_PARAMS 19
406 #define IWN_CMD_TIMING 20
407 #define IWN_CMD_ADD_NODE 24
408 #define IWN_CMD_TX_DATA 28
409 #define IWN_CMD_LINK_QUALITY 78
410 #define IWN_CMD_SET_LED 72
411 #define IWN5000_CMD_WIMAX_COEX 90
412 #define IWN5000_CMD_CALIB_CONFIG 101
413 #define IWN_CMD_SET_POWER_MODE 119
414 #define IWN_CMD_SCAN 128
415 #define IWN_CMD_SET_BEACON 145
416 #define IWN_CMD_TXPOWER 151
417 #define IWN_CMD_TXPOWER_DBM 152
418 #define IWN_CMD_BT_COEX 155
419 #define IWN_CMD_GET_STATISTICS 156
420 #define IWN_CMD_SET_CRITICAL_TEMP 164
421 #define IWN_CMD_SET_SENSITIVITY 168
422 #define IWN_CMD_PHY_CALIB 176
430 /* Antenna flags, used in various commands. */
431 #define IWN_ANT_A (1 << 0)
432 #define IWN_ANT_B (1 << 1)
433 #define IWN_ANT_C (1 << 2)
435 #define IWN_ANT_ABC (IWN_ANT_A | IWN_ANT_B | IWN_ANT_C)
437 /* Structure for command IWN_CMD_CONFIGURE. */
439 uint8_t myaddr
[IEEE80211_ADDR_LEN
];
441 uint8_t bssid
[IEEE80211_ADDR_LEN
];
443 uint8_t wlap
[IEEE80211_ADDR_LEN
];
446 #define IWN_MODE_HOSTAP 1
447 #define IWN_MODE_STA 3
448 #define IWN_MODE_IBSS 4
449 #define IWN_MODE_MONITOR 6
453 #define IWN_RXCHAIN_FORCE (1 << 0)
454 #define IWN_RXCHAIN_VALID(x) ((x) << 1)
455 #define IWN_RXCHAIN_SEL(x) ((x) << 4)
456 #define IWN_RXCHAIN_MIMO(x) ((x) << 7)
457 #define IWN_RXCHAIN_IDLE_COUNT(x) ((x) << 10)
458 #define IWN_RXCHAIN_MIMO_COUNT(x) ((x) << 12)
459 #define IWN_RXCHAIN_MIMO_FORCE (1 << 14)
465 #define IWN_RXON_24GHZ (1 << 0)
466 #define IWN_RXON_CCK (1 << 1)
467 #define IWN_RXON_AUTO (1 << 2)
468 #define IWN_RXON_SHSLOT (1 << 4)
469 #define IWN_RXON_SHPREAMBLE (1 << 5)
470 #define IWN_RXON_NODIVERSITY (1 << 7)
471 #define IWN_RXON_ANTENNA_A (1 << 8)
472 #define IWN_RXON_ANTENNA_B (1 << 9)
473 #define IWN_RXON_TSF (1 << 15)
474 #define IWN_RXON_CTS_TO_SELF (1 << 30)
477 #define IWN_FILTER_PROMISC (1 << 0)
478 #define IWN_FILTER_CTL (1 << 1)
479 #define IWN_FILTER_MULTICAST (1 << 2)
480 #define IWN_FILTER_NODECRYPT (1 << 3)
481 #define IWN_FILTER_BSS (1 << 5)
482 #define IWN_FILTER_BEACON (1 << 6)
486 uint8_t ht_single_mask
;
487 uint8_t ht_dual_mask
;
488 /* The following fields are for 5000 Series only. */
489 uint8_t ht_triple_mask
;
491 uint16_t acquisition
;
495 #define IWN4965_RXONSZ (sizeof (struct iwn_rxon) - 6)
496 #define IWN5000_RXONSZ (sizeof (struct iwn_rxon))
498 /* Structure for command IWN_CMD_ASSOCIATE. */
507 /* Structure for command IWN_CMD_EDCA_PARAMS. */
508 struct iwn_edca_params
{
510 #define IWN_EDCA_UPDATE (1 << 0)
511 #define IWN_EDCA_TXOP (1 << 4)
519 } __packed ac
[WME_NUM_AC
];
522 /* Structure for command IWN_CMD_TIMING. */
523 struct iwn_cmd_timing
{
532 /* Structure for command IWN_CMD_ADD_NODE. */
533 struct iwn_node_info
{
535 #define IWN_NODE_UPDATE (1 << 0)
537 uint8_t reserved1
[3];
539 uint8_t macaddr
[IEEE80211_ADDR_LEN
];
543 #define IWN5000_ID_BROADCAST 15
544 #define IWN4965_ID_BROADCAST 31
547 #define IWN_FLAG_SET_KEY (1 << 0)
548 #define IWN_FLAG_SET_DISABLE_TID (1 << 1)
549 #define IWN_FLAG_SET_TXRATE (1 << 2)
550 #define IWN_FLAG_SET_ADDBA (1 << 3)
551 #define IWN_FLAG_SET_DELBA (1 << 4)
555 #define IWN_KFLAG_CCMP (1 << 1)
556 #define IWN_KFLAG_MAP (1 << 3)
557 #define IWN_KFLAG_KID(kid) ((kid) << 8)
558 #define IWN_KFLAG_INVALID (1 << 11)
559 #define IWN_KFLAG_GROUP (1 << 14)
561 uint8_t tsc2
; /* TKIP TSC2 */
567 /* The following 3 fields are for 5000 Series only. */
569 uint8_t rxmic
[IWN_TKIP_MICLEN
];
570 uint8_t txmic
[IWN_TKIP_MICLEN
];
573 #define IWN_AMDPU_SIZE_FACTOR(x) ((x) << 19)
574 #define IWN_AMDPU_DENSITY(x) ((x) << 23)
577 uint16_t disable_tid
;
585 struct iwn4965_node_info
{
587 uint8_t reserved1
[3];
588 uint8_t macaddr
[IEEE80211_ADDR_LEN
];
594 uint8_t tsc2
; /* TKIP TSC2 */
602 uint16_t disable_tid
;
610 #define IWN_RFLAG_CCK (1 << 1)
611 #define IWN_RFLAG_ANT(x) ((x) << 6)
613 /* Structure for command IWN_CMD_TX_DATA. */
614 struct iwn_cmd_data
{
618 #define IWN_TX_NEED_PROTECTION (1 << 0) /* 5000 only */
619 #define IWN_TX_NEED_RTS (1 << 1)
620 #define IWN_TX_NEED_CTS (1 << 2)
621 #define IWN_TX_NEED_ACK (1 << 3)
622 #define IWN_TX_LINKQ (1 << 4)
623 #define IWN_TX_IMM_BA (1 << 6)
624 #define IWN_TX_FULL_TXOP (1 << 7)
625 #define IWN_TX_BT_DISABLE (1 << 12) /* bluetooth coexistence */
626 #define IWN_TX_AUTO_SEQ (1 << 13)
627 #define IWN_TX_MORE_FRAG (1 << 14)
628 #define IWN_TX_INSERT_TSTAMP (1 << 16)
629 #define IWN_TX_NEED_PADDING (1 << 20)
638 #define IWN_CIPHER_WEP40 1
639 #define IWN_CIPHER_CCMP 2
640 #define IWN_CIPHER_TKIP 3
641 #define IWN_CIPHER_WEP104 9
649 #define IWN_LIFETIME_INFINITE 0xffffffff
660 /* Structure for command IWN_CMD_LINK_QUALITY. */
661 #define IWN_MAX_TX_RETRIES 16
662 struct iwn_cmd_link_quality
{
668 uint8_t antmsk_1stream
;
669 uint8_t antmsk_2stream
;
670 uint8_t ridx
[WME_NUM_AC
];
671 uint16_t ampdu_limit
;
672 uint8_t ampdu_threshold
;
679 } __packed retry
[IWN_MAX_TX_RETRIES
];
683 /* Structure for command IWN_CMD_SET_LED. */
685 uint32_t unit
; /* multiplier (in usecs) */
687 #define IWN_LED_ACTIVITY 1
688 #define IWN_LED_LINK 2
695 /* Structure for command IWN5000_CMD_WIMAX_COEX. */
696 struct iwn5000_wimax_coex
{
703 } __packed events
[16];
706 /* Structures for command IWN5000_CMD_CALIB_CONFIG. */
707 struct iwn5000_calib_elem
{
715 struct iwn5000_calib_status
{
716 struct iwn5000_calib_elem once
;
717 struct iwn5000_calib_elem perd
;
721 struct iwn5000_calib_config
{
722 struct iwn5000_calib_status ucode
;
723 struct iwn5000_calib_status driver
;
727 /* Structure for command IWN_CMD_SET_POWER_MODE. */
728 struct iwn_pmgt_cmd
{
730 #define IWN_PS_ALLOW_SLEEP (1 << 0)
731 #define IWN_PS_NOTIFY (1 << 1)
732 #define IWN_PS_SLEEP_OVER_DTIM (1 << 2)
733 #define IWN_PS_PCI_PMGT (1 << 3)
734 #define IWN_PS_FAST_PD (1 << 4)
744 /* Structures for command IWN_CMD_SCAN. */
745 struct iwn_scan_essid
{
748 uint8_t data
[IEEE80211_NWID_LEN
];
751 #define IWN_MAX_PROBES 20
753 struct iwn_scan_hdr
{
758 uint16_t quiet_threshold
;
759 uint16_t crc_threshold
;
761 uint32_t max_svc
; /* background scans */
762 uint32_t pause_svc
; /* background scans */
765 struct iwn_cmd_data tx_cmd
;
766 struct iwn_scan_essid scan_essid
[IWN_MAX_PROBES
];
767 struct ieee80211_frame wh
;
768 uint8_t data
[0]; /* nchan x struct iwn_scan_chan */
771 struct iwn_scan_chan
{
773 #define IWN_CHAN_ACTIVE (1 << 0)
774 #define IWN_CHAN_NPBREQS(x) (((1 << (x)) - 1) << 1)
779 uint16_t active
; /* msecs */
780 uint16_t passive
; /* msecs */
783 /* Maximum size of a scan command. */
784 #define IWN_SCAN_MAXSZ (MCLBYTES - 4)
786 /* structure for command IWN_CMD_SET_BEACON */
787 struct iwn_cmd_beacon
{
790 uint32_t flags
; /* same as iwn_cmd_data */
798 uint8_t reserved3
[23];
804 uint16_t reserved8
[9];
808 struct ieee80211_frame wh
;
812 /* Structure for command IWN_CMD_TXPOWER (4965AGN only.) */
813 #define IWN_RIDX_MAX 32
814 struct iwn4965_cmd_txpower
{
822 } __packed power
[IWN_RIDX_MAX
+ 1];
825 /* Structure for command IWN_CMD_TXPOWER_DBM (5000 Series only.) */
826 struct iwn5000_cmd_txpower
{
827 int8_t global_limit
; /* in half-dBm */
828 #define IWN5000_TXPOWER_AUTO 0x7f
829 #define IWN5000_TXPOWER_MAX_DBM 16
832 #define IWN5000_TXPOWER_NO_CLOSED (1 << 6)
834 int8_t srv_limit
; /* in half-dBm */
838 /* Structure for command IWN_CMD_BLUETOOTH. */
839 struct iwn_bluetooth
{
848 /* Structure for command IWN_CMD_SET_CRITICAL_TEMP. */
849 struct iwn_critical_temp
{
853 /* degK <-> degC conversion macros. */
854 #define IWN_CTOK(c) ((c) + 273)
855 #define IWN_KTOC(k) ((k) - 273)
856 #define IWN_CTOMUK(c) (((c) * 1000000) + 273150000)
859 /* Structure for command IWN_CMD_SET_SENSITIVITY. */
860 struct iwn_sensitivity_cmd
{
862 #define IWN_SENSITIVITY_DEFAULTTBL 0
863 #define IWN_SENSITIVITY_WORKTBL 1
866 uint16_t energy_ofdm
;
867 uint16_t corr_ofdm_x1
;
868 uint16_t corr_ofdm_mrc_x1
;
869 uint16_t corr_cck_mrc_x4
;
870 uint16_t corr_ofdm_x4
;
871 uint16_t corr_ofdm_mrc_x4
;
872 uint16_t corr_barker
;
873 uint16_t corr_barker_mrc
;
874 uint16_t corr_cck_x4
;
875 uint16_t energy_ofdm_th
;
878 /* Structures for command IWN_CMD_PHY_CALIB. */
879 struct iwn_phy_calib
{
881 #define IWN4965_PHY_CALIB_DIFF_GAIN 7
882 #define IWN5000_PHY_CALIB_DC 8
883 #define IWN5000_PHY_CALIB_LO 9
884 #define IWN5000_PHY_CALIB_TX_IQ 11
885 #define IWN5000_PHY_CALIB_CRYSTAL 15
886 #define IWN5000_PHY_CALIB_BASE_BAND 16
887 #define IWN5000_PHY_CALIB_TX_IQ_PERD 17
888 #define IWN5000_PHY_CALIB_RESET_NOISE_GAIN 18
889 #define IWN5000_PHY_CALIB_NOISE_GAIN 19
896 struct iwn5000_phy_calib_crystal
{
906 struct iwn_phy_calib_gain
{
916 /* Structure for command IWN_CMD_SPECTRUM_MEASUREMENT. */
917 struct iwn_spectrum_cmd
{
934 #define IWN_MEASUREMENT_BASIC (1 << 0)
935 #define IWN_MEASUREMENT_CCA (1 << 1)
936 #define IWN_MEASUREMENT_RPI_HISTOGRAM (1 << 2)
937 #define IWN_MEASUREMENT_NOISE_HISTOGRAM (1 << 3)
938 #define IWN_MEASUREMENT_FRAME (1 << 4)
939 #define IWN_MEASUREMENT_IDLE (1 << 7)
945 /* Structure for IWN_UC_READY notification. */
946 #define IWN_NATTEN_GROUPS 5
947 struct iwn_ucode_info
{
954 #define IWN_UCODE_RUNTIME 0
955 #define IWN_UCODE_INIT 9
963 /* The following fields are for UCODE_INIT only. */
969 int32_t atten
[IWN_NATTEN_GROUPS
][2];
972 /* Structures for IWN_TX_DONE notification. */
973 struct iwn4965_tx_stat
{
987 struct iwn5000_tx_stat
{
1006 /* Structure for IWN_BEACON_MISSED notification. */
1007 struct iwn_beacon_missed
{
1008 uint32_t consecutive
;
1014 /* Structure for IWN_MPDU_RX_DONE notification. */
1015 struct iwn_rx_mpdu
{
1020 /* Structures for IWN_RX_DONE and IWN_MPDU_RX_DONE notifications. */
1021 struct iwn4965_rx_phystat
{
1027 struct iwn5000_rx_phystat
{
1033 struct iwn_rx_stat
{
1035 uint8_t cfg_phy_len
;
1036 #define IWN_STAT_MAXLEN 20
1043 #define IWN_STAT_FLAG_SHPREAMBLE (1 << 2)
1054 #define IWN_RSSI_TO_DBM 44
1056 /* Structure for IWN_START_SCAN notification. */
1057 struct iwn_start_scan
{
1066 /* Structure for IWN_STOP_SCAN notification. */
1067 struct iwn_stop_scan
{
1075 /* Structure for IWN_SPECTRUM_MEASUREMENT notification. */
1076 struct iwn_spectrum_notif
{
1081 #define IWN_MEASUREMENT_START 0
1082 #define IWN_MEASUREMENT_STOP 1
1093 uint8_t reserved2
[3];
1098 #define IWN_MEASUREMENT_OK 0
1099 #define IWN_MEASUREMENT_CONCURRENT 1
1100 #define IWN_MEASUREMENT_CSA_CONFLICT 2
1101 #define IWN_MEASUREMENT_TGH_CONFLICT 3
1102 #define IWN_MEASUREMENT_STOPPED 6
1103 #define IWN_MEASUREMENT_TIMEOUT 7
1104 #define IWN_MEASUREMENT_FAILED 8
1107 /* Structure for IWN_{RX,BEACON}_STATISTICS notification. */
1108 struct iwn_rx_phy_stats
{
1115 uint32_t good_crc32
;
1117 uint32_t bad_fina_sync
;
1118 uint32_t sfd_timeout
;
1119 uint32_t fina_timeout
;
1120 uint32_t no_rts_ack
;
1131 struct iwn_rx_general_stats
{
1138 uint32_t missed_beacons
;
1139 uint32_t adc_saturated
; /* time in 0.8us */
1140 uint32_t ina_searched
; /* time in 0.8us */
1149 struct iwn_rx_ht_phy_stats
{
1153 uint32_t good_crc32
;
1156 uint32_t good_ampdu_crc32
;
1162 struct iwn_rx_stats
{
1163 struct iwn_rx_phy_stats ofdm
;
1164 struct iwn_rx_phy_stats cck
;
1165 struct iwn_rx_general_stats general
;
1166 struct iwn_rx_ht_phy_stats ht
;
1169 struct iwn_tx_stats
{
1171 uint32_t rx_detected
;
1175 uint32_t cts_timeout
;
1176 uint32_t ack_timeout
;
1180 uint32_t busrt_err1
;
1181 uint32_t burst_err2
;
1182 uint32_t cts_collision
;
1183 uint32_t ack_collision
;
1184 uint32_t ba_timeout
;
1185 uint32_t ba_resched
;
1186 uint32_t query_ampdu
;
1188 uint32_t query_ampdu_frag
;
1189 uint32_t query_mismatch
;
1192 uint32_t bt_ht_kill
;
1193 uint32_t rx_ba_resp
;
1194 uint32_t reserved
[2];
1197 struct iwn_general_stats
{
1200 uint32_t burst_check
;
1202 uint32_t reserved1
[4];
1206 uint32_t ttl_tstamp
;
1211 uint32_t reserved2
[2];
1212 uint32_t rx_enabled
;
1213 uint32_t reserved3
[3];
1218 struct iwn_rx_stats rx
;
1219 struct iwn_tx_stats tx
;
1220 struct iwn_general_stats general
;
1224 /* Firmware error dump. */
1225 struct iwn_fw_dump
{
1229 uint32_t branch_link
[2];
1230 uint32_t interrupt_link
[2];
1231 uint32_t error_data
[2];
1237 /* Firmware image file header. */
1238 struct iwn_firmware_hdr
{
1240 uint32_t main_textsz
;
1241 uint32_t main_datasz
;
1242 uint32_t init_textsz
;
1243 uint32_t init_datasz
;
1244 uint32_t boot_textsz
;
1247 #define IWN4965_FW_TEXT_MAXSZ ( 96 * 1024)
1248 #define IWN4965_FW_DATA_MAXSZ ( 40 * 1024)
1249 #define IWN5000_FW_TEXT_MAXSZ (256 * 1024)
1250 #define IWN5000_FW_DATA_MAXSZ ( 80 * 1024)
1251 #define IWN_FW_BOOT_TEXT_MAXSZ 1024
1252 #define IWN4965_FWSZ (IWN4965_FW_TEXT_MAXSZ + IWN4965_FW_DATA_MAXSZ)
1253 #define IWN5000_FWSZ IWN5000_FW_TEXT_MAXSZ
1256 * Offsets into EEPROM.
1258 #define IWN_EEPROM_MAC 0x015
1259 #define IWN_EEPROM_RFCFG 0x048
1260 #define IWN4965_EEPROM_DOMAIN 0x060
1261 #define IWN4965_EEPROM_BAND1 0x063
1262 #define IWN5000_EEPROM_REG 0x066
1263 #define IWN5000_EEPROM_CAL 0x067
1264 #define IWN4965_EEPROM_BAND2 0x072
1265 #define IWN4965_EEPROM_BAND3 0x080
1266 #define IWN4965_EEPROM_BAND4 0x08d
1267 #define IWN4965_EEPROM_BAND5 0x099
1268 #define IWN4965_EEPROM_BAND6 0x0a0
1269 #define IWN4965_EEPROM_BAND7 0x0a8
1270 #define IWN4965_EEPROM_MAXPOW 0x0e8
1271 #define IWN4965_EEPROM_VOLTAGE 0x0e9
1272 #define IWN4965_EEPROM_BANDS 0x0ea
1273 /* Indirect offsets. */
1274 #define IWN5000_EEPROM_DOMAIN 0x001
1275 #define IWN5000_EEPROM_BAND1 0x004
1276 #define IWN5000_EEPROM_BAND2 0x013
1277 #define IWN5000_EEPROM_BAND3 0x021
1278 #define IWN5000_EEPROM_BAND4 0x02e
1279 #define IWN5000_EEPROM_BAND5 0x03a
1280 #define IWN5000_EEPROM_BAND6 0x041
1281 #define IWN5000_EEPROM_BAND7 0x049
1282 #define IWN5000_EEPROM_CRYSTAL 0x128
1283 #define IWN5000_EEPROM_TEMP 0x12a
1284 #define IWN5000_EEPROM_VOLT 0x12b
1286 /* Possible flags for IWN_EEPROM_RFCFG. */
1287 #define IWN_RFCFG_TYPE(x) (((x) >> 0) & 0x3)
1288 #define IWN_RFCFG_STEP(x) (((x) >> 2) & 0x3)
1289 #define IWN_RFCFG_DASH(x) (((x) >> 4) & 0x3)
1290 #define IWN_RFCFG_TXANTMSK(x) (((x) >> 8) & 0xf)
1291 #define IWN_RFCFG_RXANTMSK(x) (((x) >> 12) & 0xf)
1293 struct iwn_eeprom_chan
{
1295 #define IWN_EEPROM_CHAN_VALID (1 << 0)
1296 #define IWN_EEPROM_CHAN_IBSS (1 << 1)
1297 #define IWN_EEPROM_CHAN_ACTIVE (1 << 3)
1298 #define IWN_EEPROM_CHAN_RADAR (1 << 4)
1303 #define IWN_NSAMPLES 3
1304 struct iwn4965_eeprom_chan_samples
{
1311 } samples
[2][IWN_NSAMPLES
];
1314 #define IWN_NBANDS 8
1315 struct iwn4965_eeprom_band
{
1316 uint8_t lo
; /* low channel number */
1317 uint8_t hi
; /* high channel number */
1318 struct iwn4965_eeprom_chan_samples chans
[2];
1322 * Offsets of channels descriptions in EEPROM.
1324 static const uint32_t iwn4965_regulatory_bands
[IWN_NBANDS
] = {
1325 IWN4965_EEPROM_BAND1
,
1326 IWN4965_EEPROM_BAND2
,
1327 IWN4965_EEPROM_BAND3
,
1328 IWN4965_EEPROM_BAND4
,
1329 IWN4965_EEPROM_BAND5
,
1330 IWN4965_EEPROM_BAND6
,
1331 IWN4965_EEPROM_BAND7
1334 static const uint32_t iwn5000_regulatory_bands
[IWN_NBANDS
] = {
1335 IWN5000_EEPROM_BAND1
,
1336 IWN5000_EEPROM_BAND2
,
1337 IWN5000_EEPROM_BAND3
,
1338 IWN5000_EEPROM_BAND4
,
1339 IWN5000_EEPROM_BAND5
,
1340 IWN5000_EEPROM_BAND6
,
1341 IWN5000_EEPROM_BAND7
1344 #define IWN_CHAN_BANDS_COUNT 7
1345 #define IWN_MAX_CHAN_PER_BAND 14
1346 static const struct iwn_chan_band
{
1348 uint8_t chan
[IWN_MAX_CHAN_PER_BAND
];
1350 /* 20MHz channels, 2GHz band. */
1351 { 14, { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 } },
1352 /* 20MHz channels, 5GHz band. */
1353 { 13, { 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 } },
1354 { 12, { 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 } },
1355 { 11, { 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 } },
1356 { 6, { 145, 149, 153, 157, 161, 165 } },
1357 /* 40MHz channels (primary channels), 2GHz band. */
1358 { 7, { 1, 2, 3, 4, 5, 6, 7 } },
1359 /* 40MHz channels (primary channels), 5GHz band. */
1360 { 11, { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 } }
1363 /* HW rate indices. */
1364 #define IWN_RIDX_CCK1 0
1365 #define IWN_RIDX_OFDM6 4
1367 static const struct iwn_rate
{
1371 } iwn_rates
[IWN_RIDX_MAX
+ 1] = {
1372 { 2, 10, IWN_RFLAG_CCK
},
1373 { 4, 20, IWN_RFLAG_CCK
},
1374 { 11, 55, IWN_RFLAG_CCK
},
1375 { 22, 110, IWN_RFLAG_CCK
},
1387 #define IWN4965_MAX_PWR_INDEX 107
1390 * RF Tx gain values from highest to lowest power (values obtained from
1391 * the reference driver.)
1393 static const uint8_t iwn4965_rf_gain_2ghz
[IWN4965_MAX_PWR_INDEX
+ 1] = {
1394 0x3f, 0x3f, 0x3f, 0x3e, 0x3e, 0x3e, 0x3d, 0x3d, 0x3d, 0x3c, 0x3c,
1395 0x3c, 0x3b, 0x3b, 0x3b, 0x3a, 0x3a, 0x3a, 0x39, 0x39, 0x39, 0x38,
1396 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x36, 0x35, 0x35, 0x35,
1397 0x34, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x31, 0x31,
1398 0x31, 0x30, 0x30, 0x30, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04,
1399 0x04, 0x04, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
1400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1406 static const uint8_t iwn4965_rf_gain_5ghz
[IWN4965_MAX_PWR_INDEX
+ 1] = {
1407 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3e, 0x3e, 0x3e, 0x3d, 0x3d, 0x3d,
1408 0x3c, 0x3c, 0x3c, 0x3b, 0x3b, 0x3b, 0x3a, 0x3a, 0x3a, 0x39, 0x39,
1409 0x39, 0x38, 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x36, 0x35,
1410 0x35, 0x35, 0x34, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32,
1411 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, 0x25, 0x25, 0x25, 0x24, 0x24,
1412 0x24, 0x23, 0x23, 0x23, 0x22, 0x18, 0x18, 0x17, 0x17, 0x17, 0x16,
1413 0x16, 0x16, 0x15, 0x15, 0x15, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13,
1414 0x12, 0x08, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x05, 0x05,
1415 0x05, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x01,
1416 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1420 * DSP pre-DAC gain values from highest to lowest power (values obtained
1421 * from the reference driver.)
1423 static const uint8_t iwn4965_dsp_gain_2ghz
[IWN4965_MAX_PWR_INDEX
+ 1] = {
1424 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68,
1425 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e,
1426 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62,
1427 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68,
1428 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e,
1429 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62,
1430 0x6e, 0x68, 0x62, 0x61, 0x60, 0x5f, 0x5e, 0x5d, 0x5c, 0x5b, 0x5a,
1431 0x59, 0x58, 0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f,
1432 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, 0x47, 0x46, 0x45, 0x44,
1433 0x43, 0x42, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b
1436 static const uint8_t iwn4965_dsp_gain_5ghz
[IWN4965_MAX_PWR_INDEX
+ 1] = {
1437 0x7b, 0x75, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62,
1438 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68,
1439 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e,
1440 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62,
1441 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68,
1442 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e,
1443 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62,
1444 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68,
1445 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e, 0x68, 0x62, 0x6e,
1446 0x68, 0x62, 0x6e, 0x68, 0x62, 0x5d, 0x58, 0x53, 0x4e
1450 * Power saving settings (values obtained from the reference driver.)
1452 #define IWN_NDTIMRANGES 3
1453 #define IWN_NPOWERLEVELS 6
1454 static const struct iwn_pmgt
{
1459 } iwn_pmgt
[IWN_NDTIMRANGES
][IWN_NPOWERLEVELS
] = {
1462 { 0, 0, { 0, 0, 0, 0, 0 }, 0 }, /* CAM */
1463 { 200, 500, { 1, 2, 2, 2, -1 }, 0 }, /* PS level 1 */
1464 { 200, 300, { 1, 2, 2, 2, -1 }, 0 }, /* PS level 2 */
1465 { 50, 100, { 2, 2, 2, 2, -1 }, 0 }, /* PS level 3 */
1466 { 50, 25, { 2, 2, 4, 4, -1 }, 1 }, /* PS level 4 */
1467 { 25, 25, { 2, 2, 4, 6, -1 }, 2 } /* PS level 5 */
1469 /* 3 <= DTIM <= 10 */
1471 { 0, 0, { 0, 0, 0, 0, 0 }, 0 }, /* CAM */
1472 { 200, 500, { 1, 2, 3, 4, 4 }, 0 }, /* PS level 1 */
1473 { 200, 300, { 1, 2, 3, 4, 7 }, 0 }, /* PS level 2 */
1474 { 50, 100, { 2, 4, 6, 7, 9 }, 0 }, /* PS level 3 */
1475 { 50, 25, { 2, 4, 6, 9, 10 }, 1 }, /* PS level 4 */
1476 { 25, 25, { 2, 4, 7, 10, 10 }, 2 } /* PS level 5 */
1480 { 0, 0, { 0, 0, 0, 0, 0 }, 0 }, /* CAM */
1481 { 200, 500, { 1, 2, 3, 4, -1 }, 0 }, /* PS level 1 */
1482 { 200, 300, { 2, 4, 6, 7, -1 }, 0 }, /* PS level 2 */
1483 { 50, 100, { 2, 7, 9, 9, -1 }, 0 }, /* PS level 3 */
1484 { 50, 25, { 2, 7, 9, 9, -1 }, 0 }, /* PS level 4 */
1485 { 25, 25, { 4, 7, 10, 10, -1 }, 0 } /* PS level 5 */
1489 struct iwn_sensitivity_limits
{
1490 uint32_t min_ofdm_x1
;
1491 uint32_t max_ofdm_x1
;
1492 uint32_t min_ofdm_mrc_x1
;
1493 uint32_t max_ofdm_mrc_x1
;
1494 uint32_t min_ofdm_x4
;
1495 uint32_t max_ofdm_x4
;
1496 uint32_t min_ofdm_mrc_x4
;
1497 uint32_t max_ofdm_mrc_x4
;
1498 uint32_t min_cck_x4
;
1499 uint32_t max_cck_x4
;
1500 uint32_t min_cck_mrc_x4
;
1501 uint32_t max_cck_mrc_x4
;
1502 uint32_t min_energy_cck
;
1503 uint32_t energy_cck
;
1504 uint32_t energy_ofdm
;
1508 * RX sensitivity limits (values obtained from the reference driver.)
1510 static const struct iwn_sensitivity_limits iwn4965_sensitivity_limits
= {
1522 static const struct iwn_sensitivity_limits iwn5000_sensitivity_limits
= {
1534 /* Map TID to TX scheduler's FIFO. */
1535 static const uint8_t iwn_tid2fifo
[] = {
1536 1, 0, 0, 1, 2, 2, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 3
1539 /* Firmware errors. */
1540 static const char * const iwn_fw_errmsg
[] = {
1545 "NMI_INTERRUPT_WDG",
1549 "HW_ERROR_TUNE_LOCK",
1550 "HW_ERROR_TEMPERATURE",
1551 "ILLEGAL_CHAN_FREQ",
1554 "NMI_INTERRUPT_HOST",
1555 "NMI_INTERRUPT_ACTION_PT",
1556 "NMI_INTERRUPT_UNKNOWN",
1557 "UCODE_VERSION_MISMATCH",
1558 "HW_ERROR_ABS_LOCK",
1559 "HW_ERROR_CAL_LOCK_FAIL",
1560 "NMI_INTERRUPT_INST_ACTION_PT",
1561 "NMI_INTERRUPT_DATA_ACTION_PT",
1563 "NMI_INTERRUPT_TRM",
1564 "NMI_INTERRUPT_BREAKPOINT"
1572 /* Find least significant bit that is set. */
1573 #define IWN_LSB(x) ((((x) - 1) & (x)) ^ (x))
1575 #define IWN_READ(sc, reg) \
1576 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
1578 #define IWN_WRITE(sc, reg, val) \
1579 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
1581 #define IWN_SETBITS(sc, reg, mask) \
1582 IWN_WRITE(sc, reg, IWN_READ(sc, reg) | (mask))
1584 #define IWN_CLRBITS(sc, reg, mask) \
1585 IWN_WRITE(sc, reg, IWN_READ(sc, reg) & ~(mask))