1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * QLogic QLA3xxx NIC HBA Driver
4 * Copyright (c) 2003-2006 QLogic Corporation
14 #define OPCODE_OB_MAC_IOCB_FN0 0x01
15 #define OPCODE_OB_MAC_IOCB_FN2 0x21
17 #define OPCODE_IB_MAC_IOCB 0xF9
18 #define OPCODE_IB_3032_MAC_IOCB 0x09
19 #define OPCODE_IB_IP_IOCB 0xFA
20 #define OPCODE_IB_3032_IP_IOCB 0x0A
22 #define OPCODE_FUNC_ID_MASK 0x30
23 #define OUTBOUND_MAC_IOCB 0x01 /* plus function bits */
25 #define FN0_MA_BITS_MASK 0x00
26 #define FN1_MA_BITS_MASK 0x80
28 struct ob_mac_iocb_req
{
31 #define OB_MAC_IOCB_REQ_MA 0xe0
32 #define OB_MAC_IOCB_REQ_F 0x10
33 #define OB_MAC_IOCB_REQ_X 0x08
34 #define OB_MAC_IOCB_REQ_D 0x02
35 #define OB_MAC_IOCB_REQ_I 0x01
37 #define OB_3032MAC_IOCB_REQ_IC 0x04
38 #define OB_3032MAC_IOCB_REQ_TC 0x02
39 #define OB_3032MAC_IOCB_REQ_UC 0x01
42 u32 transaction_id
; /* opaque for hardware */
49 __le32 buf_addr0_high
;
52 __le32 buf_addr1_high
;
55 __le32 buf_addr2_high
;
61 * The following constants define control bits for buffer
62 * length fields for all IOCB's.
64 #define OB_MAC_IOCB_REQ_E 0x80000000 /* Last valid buffer in list. */
65 #define OB_MAC_IOCB_REQ_C 0x40000000 /* points to an OAL. (continuation) */
66 #define OB_MAC_IOCB_REQ_L 0x20000000 /* Auburn local address pointer. */
67 #define OB_MAC_IOCB_REQ_R 0x10000000 /* 32-bit address pointer. */
69 struct ob_mac_iocb_rsp
{
72 #define OB_MAC_IOCB_RSP_P 0x08
73 #define OB_MAC_IOCB_RSP_L 0x04
74 #define OB_MAC_IOCB_RSP_S 0x02
75 #define OB_MAC_IOCB_RSP_I 0x01
78 u32 transaction_id
; /* opaque for hardware */
83 struct ib_mac_iocb_rsp
{
85 #define IB_MAC_IOCB_RSP_V 0x80
87 #define IB_MAC_IOCB_RSP_S 0x80
88 #define IB_MAC_IOCB_RSP_H1 0x40
89 #define IB_MAC_IOCB_RSP_H0 0x20
90 #define IB_MAC_IOCB_RSP_B 0x10
91 #define IB_MAC_IOCB_RSP_M 0x08
92 #define IB_MAC_IOCB_RSP_MA 0x07
101 struct ob_ip_iocb_req
{
104 #define OB_IP_IOCB_REQ_O 0x100
105 #define OB_IP_IOCB_REQ_H 0x008
106 #define OB_IP_IOCB_REQ_U 0x004
107 #define OB_IP_IOCB_REQ_D 0x002
108 #define OB_IP_IOCB_REQ_I 0x001
112 __le32 transaction_id
;
116 __le32 hncb_ptr_high
;
117 __le32 buf_addr0_low
;
118 __le32 buf_addr0_high
;
120 __le32 buf_addr1_low
;
121 __le32 buf_addr1_high
;
123 __le32 buf_addr2_low
;
124 __le32 buf_addr2_high
;
130 /* defines for BufferLength fields above */
131 #define OB_IP_IOCB_REQ_E 0x80000000
132 #define OB_IP_IOCB_REQ_C 0x40000000
133 #define OB_IP_IOCB_REQ_L 0x20000000
134 #define OB_IP_IOCB_REQ_R 0x10000000
136 struct ob_ip_iocb_rsp
{
139 #define OB_MAC_IOCB_RSP_H 0x10
140 #define OB_MAC_IOCB_RSP_E 0x08
141 #define OB_MAC_IOCB_RSP_L 0x04
142 #define OB_MAC_IOCB_RSP_S 0x02
143 #define OB_MAC_IOCB_RSP_I 0x01
146 __le32 transaction_id
;
151 struct ib_ip_iocb_rsp
{
153 #define IB_IP_IOCB_RSP_3032_V 0x80
154 #define IB_IP_IOCB_RSP_3032_O 0x40
155 #define IB_IP_IOCB_RSP_3032_I 0x20
156 #define IB_IP_IOCB_RSP_3032_R 0x10
158 #define IB_IP_IOCB_RSP_S 0x80
159 #define IB_IP_IOCB_RSP_H1 0x40
160 #define IB_IP_IOCB_RSP_H0 0x20
161 #define IB_IP_IOCB_RSP_B 0x10
162 #define IB_IP_IOCB_RSP_M 0x08
163 #define IB_IP_IOCB_RSP_MA 0x07
167 #define IB_IP_IOCB_RSP_3032_ICE 0x01
168 #define IB_IP_IOCB_RSP_3032_CE 0x02
169 #define IB_IP_IOCB_RSP_3032_NUC 0x04
170 #define IB_IP_IOCB_RSP_3032_UDP 0x08
171 #define IB_IP_IOCB_RSP_3032_TCP 0x10
172 #define IB_IP_IOCB_RSP_3032_IPE 0x20
174 #define IB_IP_IOCB_RSP_R 0x01
179 struct net_rsp_iocb
{
188 * Register Definitions...
190 #define PORT0_PHY_ADDRESS 0x1e00
191 #define PORT1_PHY_ADDRESS 0x1f00
193 #define ETHERNET_CRC_SIZE 4
195 #define MII_SCAN_REGISTER 0x00000001
197 #define PHY_ID_0_REG 2
198 #define PHY_ID_1_REG 3
200 #define PHY_OUI_1_MASK 0xfc00
201 #define PHY_MODEL_MASK 0x03f0
203 /* Address for the Agere Phy */
204 #define MII_AGERE_ADDR_1 0x00001000
205 #define MII_AGERE_ADDR_2 0x00001100
207 /* 32-bit ispControlStatus */
209 ISP_CONTROL_NP_MASK
= 0x0003,
210 ISP_CONTROL_NP_PCSR
= 0x0000,
211 ISP_CONTROL_NP_HMCR
= 0x0001,
212 ISP_CONTROL_NP_LRAMCR
= 0x0002,
213 ISP_CONTROL_NP_PSR
= 0x0003,
214 ISP_CONTROL_RI
= 0x0008,
215 ISP_CONTROL_CI
= 0x0010,
216 ISP_CONTROL_PI
= 0x0020,
217 ISP_CONTROL_IN
= 0x0040,
218 ISP_CONTROL_BE
= 0x0080,
219 ISP_CONTROL_FN_MASK
= 0x0700,
220 ISP_CONTROL_FN0_NET
= 0x0400,
221 ISP_CONTROL_FN0_SCSI
= 0x0500,
222 ISP_CONTROL_FN1_NET
= 0x0600,
223 ISP_CONTROL_FN1_SCSI
= 0x0700,
224 ISP_CONTROL_LINK_DN_0
= 0x0800,
225 ISP_CONTROL_LINK_DN_1
= 0x1000,
226 ISP_CONTROL_FSR
= 0x2000,
227 ISP_CONTROL_FE
= 0x4000,
228 ISP_CONTROL_SR
= 0x8000,
231 /* 32-bit ispInterruptMaskReg */
233 ISP_IMR_ENABLE_INT
= 0x0004,
234 ISP_IMR_DISABLE_RESET_INT
= 0x0008,
235 ISP_IMR_DISABLE_CMPL_INT
= 0x0010,
236 ISP_IMR_DISABLE_PROC_INT
= 0x0020,
239 /* 32-bit serialPortInterfaceReg */
241 ISP_SERIAL_PORT_IF_CLK
= 0x0001,
242 ISP_SERIAL_PORT_IF_CS
= 0x0002,
243 ISP_SERIAL_PORT_IF_D0
= 0x0004,
244 ISP_SERIAL_PORT_IF_DI
= 0x0008,
245 ISP_NVRAM_MASK
= (0x000F << 16),
246 ISP_SERIAL_PORT_IF_WE
= 0x0010,
247 ISP_SERIAL_PORT_IF_NVR_MASK
= 0x001F,
248 ISP_SERIAL_PORT_IF_SCI
= 0x0400,
249 ISP_SERIAL_PORT_IF_SC0
= 0x0800,
250 ISP_SERIAL_PORT_IF_SCE
= 0x1000,
251 ISP_SERIAL_PORT_IF_SDI
= 0x2000,
252 ISP_SERIAL_PORT_IF_SDO
= 0x4000,
253 ISP_SERIAL_PORT_IF_SDE
= 0x8000,
254 ISP_SERIAL_PORT_IF_I2C_MASK
= 0xFC00,
259 QL_RESOURCE_MASK_BASE_CODE
= 0x7,
260 QL_RESOURCE_BITS_BASE_CODE
= 0x4,
261 QL_DRVR_SEM_BITS
= (QL_RESOURCE_BITS_BASE_CODE
<< 1),
262 QL_DDR_RAM_SEM_BITS
= (QL_RESOURCE_BITS_BASE_CODE
<< 4),
263 QL_PHY_GIO_SEM_BITS
= (QL_RESOURCE_BITS_BASE_CODE
<< 7),
264 QL_NVRAM_SEM_BITS
= (QL_RESOURCE_BITS_BASE_CODE
<< 10),
265 QL_FLASH_SEM_BITS
= (QL_RESOURCE_BITS_BASE_CODE
<< 13),
266 QL_DRVR_SEM_MASK
= (QL_RESOURCE_MASK_BASE_CODE
<< (1 + 16)),
267 QL_DDR_RAM_SEM_MASK
= (QL_RESOURCE_MASK_BASE_CODE
<< (4 + 16)),
268 QL_PHY_GIO_SEM_MASK
= (QL_RESOURCE_MASK_BASE_CODE
<< (7 + 16)),
269 QL_NVRAM_SEM_MASK
= (QL_RESOURCE_MASK_BASE_CODE
<< (10 + 16)),
270 QL_FLASH_SEM_MASK
= (QL_RESOURCE_MASK_BASE_CODE
<< (13 + 16)),
274 * QL3XXX memory-mapped registers
275 * QL3XXX has 4 "pages" of registers, each page occupying
276 * 256 bytes. Each page has a "common" area at the start and then
277 * page-specific registers after that.
279 struct ql3xxx_common_registers
{
280 u32 MB0
; /* Offset 0x00 */
281 u32 MB1
; /* Offset 0x04 */
282 u32 MB2
; /* Offset 0x08 */
283 u32 MB3
; /* Offset 0x0c */
284 u32 MB4
; /* Offset 0x10 */
285 u32 MB5
; /* Offset 0x14 */
286 u32 MB6
; /* Offset 0x18 */
287 u32 MB7
; /* Offset 0x1c */
290 u32 ispControlStatus
;
291 u32 ispInterruptMaskReg
;
292 u32 serialPortInterfaceReg
;
294 u32 reqQProducerIndex
;
295 u32 rspQConsumerIndex
;
297 u32 rxLargeQProducerIndex
;
298 u32 rxSmallQProducerIndex
;
304 EXT_HW_CONFIG_SP_MASK
= 0x0006,
305 EXT_HW_CONFIG_SP_NONE
= 0x0000,
306 EXT_HW_CONFIG_SP_BYTE_PARITY
= 0x0002,
307 EXT_HW_CONFIG_SP_ECC
= 0x0004,
308 EXT_HW_CONFIG_SP_ECCx
= 0x0006,
309 EXT_HW_CONFIG_SIZE_MASK
= 0x0060,
310 EXT_HW_CONFIG_SIZE_128M
= 0x0000,
311 EXT_HW_CONFIG_SIZE_256M
= 0x0020,
312 EXT_HW_CONFIG_SIZE_512M
= 0x0040,
313 EXT_HW_CONFIG_SIZE_INVALID
= 0x0060,
314 EXT_HW_CONFIG_PD
= 0x0080,
315 EXT_HW_CONFIG_FW
= 0x0200,
316 EXT_HW_CONFIG_US
= 0x0400,
317 EXT_HW_CONFIG_DCS_MASK
= 0x1800,
318 EXT_HW_CONFIG_DCS_9MA
= 0x0000,
319 EXT_HW_CONFIG_DCS_15MA
= 0x0800,
320 EXT_HW_CONFIG_DCS_18MA
= 0x1000,
321 EXT_HW_CONFIG_DCS_24MA
= 0x1800,
322 EXT_HW_CONFIG_DDS_MASK
= 0x6000,
323 EXT_HW_CONFIG_DDS_9MA
= 0x0000,
324 EXT_HW_CONFIG_DDS_15MA
= 0x2000,
325 EXT_HW_CONFIG_DDS_18MA
= 0x4000,
326 EXT_HW_CONFIG_DDS_24MA
= 0x6000,
329 /* InternalChipConfig */
331 INTERNAL_CHIP_DM
= 0x0001,
332 INTERNAL_CHIP_SD
= 0x0002,
333 INTERNAL_CHIP_RAP_MASK
= 0x000C,
334 INTERNAL_CHIP_RAP_RR
= 0x0000,
335 INTERNAL_CHIP_RAP_NRM
= 0x0004,
336 INTERNAL_CHIP_RAP_ERM
= 0x0008,
337 INTERNAL_CHIP_RAP_ERMx
= 0x000C,
338 INTERNAL_CHIP_WE
= 0x0010,
339 INTERNAL_CHIP_EF
= 0x0020,
340 INTERNAL_CHIP_FR
= 0x0040,
341 INTERNAL_CHIP_FW
= 0x0080,
342 INTERNAL_CHIP_FI
= 0x0100,
343 INTERNAL_CHIP_FT
= 0x0200,
348 PORT_CONTROL_DS
= 0x0001,
349 PORT_CONTROL_HH
= 0x0002,
350 PORT_CONTROL_EI
= 0x0004,
351 PORT_CONTROL_ET
= 0x0008,
352 PORT_CONTROL_EF
= 0x0010,
353 PORT_CONTROL_DRM
= 0x0020,
354 PORT_CONTROL_RLB
= 0x0040,
355 PORT_CONTROL_RCB
= 0x0080,
356 PORT_CONTROL_MAC
= 0x0100,
357 PORT_CONTROL_IPV
= 0x0200,
358 PORT_CONTROL_IFP
= 0x0400,
359 PORT_CONTROL_ITP
= 0x0800,
360 PORT_CONTROL_FI
= 0x1000,
361 PORT_CONTROL_DFP
= 0x2000,
362 PORT_CONTROL_OI
= 0x4000,
363 PORT_CONTROL_CC
= 0x8000,
368 PORT_STATUS_SM0
= 0x0001,
369 PORT_STATUS_SM1
= 0x0002,
370 PORT_STATUS_X
= 0x0008,
371 PORT_STATUS_DL
= 0x0080,
372 PORT_STATUS_IC
= 0x0200,
373 PORT_STATUS_MRC
= 0x0400,
374 PORT_STATUS_NL
= 0x0800,
375 PORT_STATUS_REV_ID_MASK
= 0x7000,
376 PORT_STATUS_REV_ID_1
= 0x1000,
377 PORT_STATUS_REV_ID_2
= 0x2000,
378 PORT_STATUS_REV_ID_3
= 0x3000,
379 PORT_STATUS_64
= 0x8000,
380 PORT_STATUS_UP0
= 0x10000,
381 PORT_STATUS_AC0
= 0x20000,
382 PORT_STATUS_AE0
= 0x40000,
383 PORT_STATUS_UP1
= 0x100000,
384 PORT_STATUS_AC1
= 0x200000,
385 PORT_STATUS_AE1
= 0x400000,
386 PORT_STATUS_F0_ENABLED
= 0x1000000,
387 PORT_STATUS_F1_ENABLED
= 0x2000000,
388 PORT_STATUS_F2_ENABLED
= 0x4000000,
389 PORT_STATUS_F3_ENABLED
= 0x8000000,
392 /* macMIIMgmtControlReg */
394 MAC_ADDR_INDIRECT_PTR_REG_RP_MASK
= 0x0003,
395 MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_LWR
= 0x0000,
396 MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_UPR
= 0x0001,
397 MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_LWR
= 0x0002,
398 MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_UPR
= 0x0003,
399 MAC_ADDR_INDIRECT_PTR_REG_PR
= 0x0008,
400 MAC_ADDR_INDIRECT_PTR_REG_SS
= 0x0010,
401 MAC_ADDR_INDIRECT_PTR_REG_SE
= 0x0020,
402 MAC_ADDR_INDIRECT_PTR_REG_SP
= 0x0040,
403 MAC_ADDR_INDIRECT_PTR_REG_PE
= 0x0080,
406 /* macMIIMgmtControlReg */
408 MAC_MII_CONTROL_RC
= 0x0001,
409 MAC_MII_CONTROL_SC
= 0x0002,
410 MAC_MII_CONTROL_AS
= 0x0004,
411 MAC_MII_CONTROL_NP
= 0x0008,
412 MAC_MII_CONTROL_CLK_SEL_MASK
= 0x0070,
413 MAC_MII_CONTROL_CLK_SEL_DIV2
= 0x0000,
414 MAC_MII_CONTROL_CLK_SEL_DIV4
= 0x0010,
415 MAC_MII_CONTROL_CLK_SEL_DIV6
= 0x0020,
416 MAC_MII_CONTROL_CLK_SEL_DIV8
= 0x0030,
417 MAC_MII_CONTROL_CLK_SEL_DIV10
= 0x0040,
418 MAC_MII_CONTROL_CLK_SEL_DIV14
= 0x0050,
419 MAC_MII_CONTROL_CLK_SEL_DIV20
= 0x0060,
420 MAC_MII_CONTROL_CLK_SEL_DIV28
= 0x0070,
421 MAC_MII_CONTROL_RM
= 0x8000,
424 /* macMIIStatusReg */
426 MAC_MII_STATUS_BSY
= 0x0001,
427 MAC_MII_STATUS_SC
= 0x0002,
428 MAC_MII_STATUS_NV
= 0x0004,
432 MAC_CONFIG_REG_PE
= 0x0001,
433 MAC_CONFIG_REG_TF
= 0x0002,
434 MAC_CONFIG_REG_RF
= 0x0004,
435 MAC_CONFIG_REG_FD
= 0x0008,
436 MAC_CONFIG_REG_GM
= 0x0010,
437 MAC_CONFIG_REG_LB
= 0x0020,
438 MAC_CONFIG_REG_SR
= 0x8000,
442 MAC_HALF_DUPLEX_REG_ED
= 0x10000,
443 MAC_HALF_DUPLEX_REG_NB
= 0x20000,
444 MAC_HALF_DUPLEX_REG_BNB
= 0x40000,
445 MAC_HALF_DUPLEX_REG_ALT
= 0x80000,
449 IP_ADDR_INDEX_REG_MASK
= 0x000f,
450 IP_ADDR_INDEX_REG_FUNC_0_PRI
= 0x0000,
451 IP_ADDR_INDEX_REG_FUNC_0_SEC
= 0x0001,
452 IP_ADDR_INDEX_REG_FUNC_1_PRI
= 0x0002,
453 IP_ADDR_INDEX_REG_FUNC_1_SEC
= 0x0003,
454 IP_ADDR_INDEX_REG_FUNC_2_PRI
= 0x0004,
455 IP_ADDR_INDEX_REG_FUNC_2_SEC
= 0x0005,
456 IP_ADDR_INDEX_REG_FUNC_3_PRI
= 0x0006,
457 IP_ADDR_INDEX_REG_FUNC_3_SEC
= 0x0007,
458 IP_ADDR_INDEX_REG_6
= 0x0008,
459 IP_ADDR_INDEX_REG_OFFSET_MASK
= 0x0030,
460 IP_ADDR_INDEX_REG_E
= 0x0040,
463 QL3032_PORT_CONTROL_DS
= 0x0001,
464 QL3032_PORT_CONTROL_HH
= 0x0002,
465 QL3032_PORT_CONTROL_EIv6
= 0x0004,
466 QL3032_PORT_CONTROL_EIv4
= 0x0008,
467 QL3032_PORT_CONTROL_ET
= 0x0010,
468 QL3032_PORT_CONTROL_EF
= 0x0020,
469 QL3032_PORT_CONTROL_DRM
= 0x0040,
470 QL3032_PORT_CONTROL_RLB
= 0x0080,
471 QL3032_PORT_CONTROL_RCB
= 0x0100,
472 QL3032_PORT_CONTROL_KIE
= 0x0200,
476 PROBE_MUX_ADDR_REG_MUX_SEL_MASK
= 0x003f,
477 PROBE_MUX_ADDR_REG_SYSCLK
= 0x0000,
478 PROBE_MUX_ADDR_REG_PCICLK
= 0x0040,
479 PROBE_MUX_ADDR_REG_NRXCLK
= 0x0080,
480 PROBE_MUX_ADDR_REG_CPUCLK
= 0x00C0,
481 PROBE_MUX_ADDR_REG_MODULE_SEL_MASK
= 0x3f00,
482 PROBE_MUX_ADDR_REG_UP
= 0x4000,
483 PROBE_MUX_ADDR_REG_RE
= 0x8000,
487 STATISTICS_INDEX_REG_MASK
= 0x01ff,
488 STATISTICS_INDEX_REG_MAC0_TX_FRAME
= 0x0000,
489 STATISTICS_INDEX_REG_MAC0_TX_BYTES
= 0x0001,
490 STATISTICS_INDEX_REG_MAC0_TX_STAT1
= 0x0002,
491 STATISTICS_INDEX_REG_MAC0_TX_STAT2
= 0x0003,
492 STATISTICS_INDEX_REG_MAC0_TX_STAT3
= 0x0004,
493 STATISTICS_INDEX_REG_MAC0_TX_STAT4
= 0x0005,
494 STATISTICS_INDEX_REG_MAC0_TX_STAT5
= 0x0006,
495 STATISTICS_INDEX_REG_MAC0_RX_FRAME
= 0x0007,
496 STATISTICS_INDEX_REG_MAC0_RX_BYTES
= 0x0008,
497 STATISTICS_INDEX_REG_MAC0_RX_STAT1
= 0x0009,
498 STATISTICS_INDEX_REG_MAC0_RX_STAT2
= 0x000a,
499 STATISTICS_INDEX_REG_MAC0_RX_STAT3
= 0x000b,
500 STATISTICS_INDEX_REG_MAC0_RX_ERR_CRC
= 0x000c,
501 STATISTICS_INDEX_REG_MAC0_RX_ERR_ENC
= 0x000d,
502 STATISTICS_INDEX_REG_MAC0_RX_ERR_LEN
= 0x000e,
503 STATISTICS_INDEX_REG_MAC0_RX_STAT4
= 0x000f,
504 STATISTICS_INDEX_REG_MAC1_TX_FRAME
= 0x0010,
505 STATISTICS_INDEX_REG_MAC1_TX_BYTES
= 0x0011,
506 STATISTICS_INDEX_REG_MAC1_TX_STAT1
= 0x0012,
507 STATISTICS_INDEX_REG_MAC1_TX_STAT2
= 0x0013,
508 STATISTICS_INDEX_REG_MAC1_TX_STAT3
= 0x0014,
509 STATISTICS_INDEX_REG_MAC1_TX_STAT4
= 0x0015,
510 STATISTICS_INDEX_REG_MAC1_TX_STAT5
= 0x0016,
511 STATISTICS_INDEX_REG_MAC1_RX_FRAME
= 0x0017,
512 STATISTICS_INDEX_REG_MAC1_RX_BYTES
= 0x0018,
513 STATISTICS_INDEX_REG_MAC1_RX_STAT1
= 0x0019,
514 STATISTICS_INDEX_REG_MAC1_RX_STAT2
= 0x001a,
515 STATISTICS_INDEX_REG_MAC1_RX_STAT3
= 0x001b,
516 STATISTICS_INDEX_REG_MAC1_RX_ERR_CRC
= 0x001c,
517 STATISTICS_INDEX_REG_MAC1_RX_ERR_ENC
= 0x001d,
518 STATISTICS_INDEX_REG_MAC1_RX_ERR_LEN
= 0x001e,
519 STATISTICS_INDEX_REG_MAC1_RX_STAT4
= 0x001f,
520 STATISTICS_INDEX_REG_IP_TX_PKTS
= 0x0020,
521 STATISTICS_INDEX_REG_IP_TX_BYTES
= 0x0021,
522 STATISTICS_INDEX_REG_IP_TX_FRAG
= 0x0022,
523 STATISTICS_INDEX_REG_IP_RX_PKTS
= 0x0023,
524 STATISTICS_INDEX_REG_IP_RX_BYTES
= 0x0024,
525 STATISTICS_INDEX_REG_IP_RX_FRAG
= 0x0025,
526 STATISTICS_INDEX_REG_IP_DGRM_REASSEMBLY
= 0x0026,
527 STATISTICS_INDEX_REG_IP_V6_RX_PKTS
= 0x0027,
528 STATISTICS_INDEX_REG_IP_RX_PKTERR
= 0x0028,
529 STATISTICS_INDEX_REG_IP_REASSEMBLY_ERR
= 0x0029,
530 STATISTICS_INDEX_REG_TCP_TX_SEG
= 0x0030,
531 STATISTICS_INDEX_REG_TCP_TX_BYTES
= 0x0031,
532 STATISTICS_INDEX_REG_TCP_RX_SEG
= 0x0032,
533 STATISTICS_INDEX_REG_TCP_RX_BYTES
= 0x0033,
534 STATISTICS_INDEX_REG_TCP_TIMER_EXP
= 0x0034,
535 STATISTICS_INDEX_REG_TCP_RX_ACK
= 0x0035,
536 STATISTICS_INDEX_REG_TCP_TX_ACK
= 0x0036,
537 STATISTICS_INDEX_REG_TCP_RX_ERR
= 0x0037,
538 STATISTICS_INDEX_REG_TCP_RX_WIN_PROBE
= 0x0038,
539 STATISTICS_INDEX_REG_TCP_ECC_ERR_CORR
= 0x003f,
543 PORT_FATAL_ERROR_STATUS_OFB_RE_MAC0
= 0x00000001,
544 PORT_FATAL_ERROR_STATUS_OFB_RE_MAC1
= 0x00000002,
545 PORT_FATAL_ERROR_STATUS_OFB_WE
= 0x00000004,
546 PORT_FATAL_ERROR_STATUS_IFB_RE
= 0x00000008,
547 PORT_FATAL_ERROR_STATUS_IFB_WE_MAC0
= 0x00000010,
548 PORT_FATAL_ERROR_STATUS_IFB_WE_MAC1
= 0x00000020,
549 PORT_FATAL_ERROR_STATUS_ODE_RE
= 0x00000040,
550 PORT_FATAL_ERROR_STATUS_ODE_WE
= 0x00000080,
551 PORT_FATAL_ERROR_STATUS_IDE_RE
= 0x00000100,
552 PORT_FATAL_ERROR_STATUS_IDE_WE
= 0x00000200,
553 PORT_FATAL_ERROR_STATUS_SDE_RE
= 0x00000400,
554 PORT_FATAL_ERROR_STATUS_SDE_WE
= 0x00000800,
555 PORT_FATAL_ERROR_STATUS_BLE
= 0x00001000,
556 PORT_FATAL_ERROR_STATUS_SPE
= 0x00002000,
557 PORT_FATAL_ERROR_STATUS_EP0
= 0x00004000,
558 PORT_FATAL_ERROR_STATUS_EP1
= 0x00008000,
559 PORT_FATAL_ERROR_STATUS_ICE
= 0x00010000,
560 PORT_FATAL_ERROR_STATUS_ILE
= 0x00020000,
561 PORT_FATAL_ERROR_STATUS_OPE
= 0x00040000,
562 PORT_FATAL_ERROR_STATUS_TA
= 0x00080000,
563 PORT_FATAL_ERROR_STATUS_MA
= 0x00100000,
564 PORT_FATAL_ERROR_STATUS_SCE
= 0x00200000,
565 PORT_FATAL_ERROR_STATUS_RPE
= 0x00400000,
566 PORT_FATAL_ERROR_STATUS_MPE
= 0x00800000,
567 PORT_FATAL_ERROR_STATUS_OCE
= 0x01000000,
571 * port control and status page - page 0
574 struct ql3xxx_port_registers
{
575 struct ql3xxx_common_registers CommonRegs
;
577 u32 ExternalHWConfig
;
578 u32 InternalChipConfig
;
581 u32 macAddrIndirectPtrReg
;
583 u32 macMIIMgmtControlReg
;
584 u32 macMIIMgmtAddrReg
;
585 u32 macMIIMgmtDataReg
;
589 u32 mac0HalfDuplexReg
;
590 u32 mac0MaxFrameLengthReg
;
591 u32 mac0PauseThresholdReg
;
594 u32 mac1HalfDuplexReg
;
595 u32 mac1MaxFrameLengthReg
;
596 u32 mac1PauseThresholdReg
;
599 u32 ipReassemblyTimeout
;
601 u32 currentTcpTimestamp
[2];
602 u32 internalRamRWAddrReg
;
603 u32 internalRamWDataReg
;
604 u32 reclaimedBufferAddrRegLow
;
605 u32 reclaimedBufferAddrRegHigh
;
606 u32 tcpConfiguration
;
610 u32 localRamDataAutoIncr
;
611 u32 localRamDataNonIncr
;
616 u32 statisticsIndexReg
;
617 u32 statisticsReadDataRegAutoIncr
;
618 u32 statisticsReadDataRegNoIncr
;
619 u32 PortFatalErrStatus
;
623 * port host memory config page - page 1
625 struct ql3xxx_host_memory_registers
{
626 struct ql3xxx_common_registers CommonRegs
;
630 /* Network Request Queue */
631 u32 reqConsumerIndex
;
632 u32 reqConsumerIndexAddrLow
;
633 u32 reqConsumerIndexAddrHigh
;
638 /* Network Completion Queue */
639 u32 rspProducerIndex
;
640 u32 rspProducerIndexAddrLow
;
641 u32 rspProducerIndexAddrHigh
;
646 /* RX Large Buffer Queue */
647 u32 rxLargeQConsumerIndex
;
648 u32 rxLargeQBaseAddrLow
;
649 u32 rxLargeQBaseAddrHigh
;
651 u32 rxLargeBufferLength
;
653 /* RX Small Buffer Queue */
654 u32 rxSmallQConsumerIndex
;
655 u32 rxSmallQBaseAddrLow
;
656 u32 rxSmallQBaseAddrHigh
;
658 u32 rxSmallBufferLength
;
663 * port local RAM page - page 2
665 struct ql3xxx_local_ram_registers
{
666 struct ql3xxx_common_registers CommonRegs
;
669 u32 currentBufletCount
;
671 u32 freeBufletThresholdLow
;
672 u32 freeBufletThresholdHigh
;
674 u32 ipHashTableCount
;
675 u32 tcpHashTableBase
;
676 u32 tcpHashTableCount
;
686 * definitions for Semaphore bits in Semaphore/Serial NVRAM interface register
689 #define LS_64BITS(x) (u32)(0xffffffff & ((u64)x))
690 #define MS_64BITS(x) (u32)(0xffffffff & (((u64)x)>>16>>16) )
699 PHY_STAT_LINK_UP
= 0x0004,
700 PHY_CTRL_LOOPBACK
= 0x4000,
702 PETBI_CONTROL_REG
= 0x00,
703 PETBI_CTRL_ALL_PARAMS
= 0x7140,
704 PETBI_CTRL_SOFT_RESET
= 0x8000,
705 PETBI_CTRL_AUTO_NEG
= 0x1000,
706 PETBI_CTRL_RESTART_NEG
= 0x0200,
707 PETBI_CTRL_FULL_DUPLEX
= 0x0100,
708 PETBI_CTRL_SPEED_1000
= 0x0040,
710 PETBI_STATUS_REG
= 0x01,
711 PETBI_STAT_NEG_DONE
= 0x0020,
712 PETBI_STAT_LINK_UP
= 0x0004,
714 PETBI_NEG_ADVER
= 0x04,
715 PETBI_NEG_PAUSE
= 0x0080,
716 PETBI_NEG_PAUSE_MASK
= 0x0180,
717 PETBI_NEG_DUPLEX
= 0x0020,
718 PETBI_NEG_DUPLEX_MASK
= 0x0060,
720 PETBI_NEG_PARTNER
= 0x05,
721 PETBI_NEG_ERROR_MASK
= 0x3000,
723 PETBI_EXPANSION_REG
= 0x06,
724 PETBI_EXP_PAGE_RX
= 0x0002,
727 PHY_GIG_ENABLE_MAN
= 0x1000, /* Enable Master/Slave Manual Config*/
728 PHY_GIG_SET_MASTER
= 0x0800, /* Set Master (slave if clear)*/
729 PHY_GIG_ALL_PARAMS
= 0x0300,
730 PHY_GIG_ADV_1000F
= 0x0200,
731 PHY_GIG_ADV_1000H
= 0x0100,
734 PHY_NEG_ALL_PARAMS
= 0x0fe0,
735 PHY_NEG_ASY_PAUSE
= 0x0800,
736 PHY_NEG_SYM_PAUSE
= 0x0400,
737 PHY_NEG_ADV_SPEED
= 0x01e0,
738 PHY_NEG_ADV_100F
= 0x0100,
739 PHY_NEG_ADV_100H
= 0x0080,
740 PHY_NEG_ADV_10F
= 0x0040,
741 PHY_NEG_ADV_10H
= 0x0020,
743 PETBI_TBI_CTRL
= 0x11,
744 PETBI_TBI_RESET
= 0x8000,
745 PETBI_TBI_AUTO_SENSE
= 0x0100,
746 PETBI_TBI_SERDES_MODE
= 0x0010,
747 PETBI_TBI_SERDES_WRAP
= 0x0002,
749 AUX_CONTROL_STATUS
= 0x1c,
750 PHY_AUX_NEG_DONE
= 0x8000,
752 PHY_AUX_DUPLEX_STAT
= 0x0020,
753 PHY_AUX_SPEED_STAT
= 0x0018,
754 PHY_AUX_NO_HW_STRAP
= 0x0004,
755 PHY_AUX_RESET_STICK
= 0x0002,
756 PHY_NEG_PAUSE
= 0x0400,
757 PHY_CTRL_SOFT_RESET
= 0x8000,
758 PHY_CTRL_AUTO_NEG
= 0x1000,
759 PHY_CTRL_RESTART_NEG
= 0x0200,
762 /* AM29LV Flash definitions */
763 FM93C56A_START
= 0x1,
767 FM93C56A_WRITE
= 0x1,
768 FM93C56A_WRITE_ALL
= 0x0,
770 FM93C56A_ERASE
= 0x3,
771 FM93C56A_ERASE_ALL
= 0x0,
772 /* Command Extensions */
773 FM93C56A_WEN_EXT
= 0x3,
774 FM93C56A_WRITE_ALL_EXT
= 0x1,
775 FM93C56A_WDS_EXT
= 0x0,
776 FM93C56A_ERASE_ALL_EXT
= 0x2,
778 FM93C56A_READ_DUMMY_BITS
= 1,
781 FM93C56A_CMD_BITS
= 2,
782 /* AM29LV Flash definitions */
783 FM93C56A_SIZE_8
= 0x100,
784 FM93C56A_SIZE_16
= 0x80,
785 FM93C66A_SIZE_8
= 0x200,
786 FM93C66A_SIZE_16
= 0x100,
787 FM93C86A_SIZE_16
= 0x400,
789 FM93C56A_NO_ADDR_BITS_16
= 8,
790 FM93C56A_NO_ADDR_BITS_8
= 9,
791 FM93C86A_NO_ADDR_BITS_16
= 10,
793 FM93C56A_DATA_BITS_16
= 16,
794 FM93C56A_DATA_BITS_8
= 8,
798 AUBURN_EEPROM_DI
= 0x8,
799 AUBURN_EEPROM_DI_0
= 0x0,
800 AUBURN_EEPROM_DI_1
= 0x8,
801 AUBURN_EEPROM_DO
= 0x4,
802 AUBURN_EEPROM_DO_0
= 0x0,
803 AUBURN_EEPROM_DO_1
= 0x4,
804 AUBURN_EEPROM_CS
= 0x2,
805 AUBURN_EEPROM_CS_0
= 0x0,
806 AUBURN_EEPROM_CS_1
= 0x2,
807 AUBURN_EEPROM_CLK_RISE
= 0x1,
808 AUBURN_EEPROM_CLK_FALL
= 0x0,
810 enum {EEPROM_SIZE
= FM93C86A_SIZE_16
,
811 EEPROM_NO_ADDR_BITS
= FM93C86A_NO_ADDR_BITS_16
,
812 EEPROM_NO_DATA_BITS
= FM93C56A_DATA_BITS_16
,
816 * MAC Config data structure
818 struct eeprom_port_cfg
{
820 u16 pauseThreshold_mac
;
821 u16 resumeThreshold_mac
;
822 u16 portConfiguration
;
823 #define PORT_CONFIG_DEFAULT 0xf700
824 #define PORT_CONFIG_AUTO_NEG_ENABLED 0x8000
825 #define PORT_CONFIG_SYM_PAUSE_ENABLED 0x4000
826 #define PORT_CONFIG_FULL_DUPLEX_ENABLED 0x2000
827 #define PORT_CONFIG_HALF_DUPLEX_ENABLED 0x1000
828 #define PORT_CONFIG_1000MB_SPEED 0x0400
829 #define PORT_CONFIG_100MB_SPEED 0x0200
830 #define PORT_CONFIG_10MB_SPEED 0x0100
831 #define PORT_CONFIG_LINK_SPEED_MASK 0x0F00
837 * BIOS data structure
839 struct eeprom_bios_cfg
{
840 u16 SpinDlyEn
:1, disBios
:1, EnMemMap
:1, EnSelectBoot
:1, Reserved
:12;
842 u8 bootID0
:7, boodID0Valid
:1;
845 u8 bootID1
:7, boodID1Valid
:1;
853 * Function Specific Data structure
855 struct eeprom_function_cfg
{
858 u16 macAddressSecondary
[3];
869 u16 version_and_numPorts
; /* together to avoid endianness crap */
872 #define EEPROM_BOARDID_STR_SIZE 16
873 #define EEPROM_SERIAL_NUM_SIZE 16
878 struct eeprom_port_cfg macCfg_port0
;
879 struct eeprom_port_cfg macCfg_port1
;
882 u16 tcpWindowThreshold50
;
883 u16 tcpWindowThreshold25
;
884 u16 tcpWindowThreshold0
;
885 u16 ipHashTableBaseHi
;
886 u16 ipHashTableBaseLo
;
888 u16 tcpHashTableBaseHi
;
889 u16 tcpHashTableBaseLo
;
890 u16 tcpHashTableSize
;
898 u16 ipReassemblyTimeout
;
899 u16 tcpMaxWindowSize
;
901 #define IPSEC_CONFIG_PRESENT 0x0001
902 u8 reserved_156
[294];
904 struct eeprom_function_cfg funcCfg_fn0
;
907 struct eeprom_bios_cfg biosCfg_fn1
;
908 struct eeprom_function_cfg funcCfg_fn1
;
910 u8 reserved_1024
[464];
911 struct eeprom_function_cfg funcCfg_fn2
;
913 u8 reserved_1536
[432];
914 struct eeprom_bios_cfg biosCfg_fn3
;
915 struct eeprom_function_cfg funcCfg_fn3
;
920 * General definitions...
924 * Below are a number compiler switches for controlling driver behavior.
925 * Some are not supported under certain conditions and are notated as such.
928 #define QL3XXX_VENDOR_ID 0x1077
929 #define QL3022_DEVICE_ID 0x3022
930 #define QL3032_DEVICE_ID 0x3032
932 /* MTU & Frame Size stuff */
933 #define NORMAL_MTU_SIZE ETH_DATA_LEN
934 #define JUMBO_MTU_SIZE 9000
935 #define VLAN_ID_LEN 2
937 /* Request Queue Related Definitions */
938 #define NUM_REQ_Q_ENTRIES 256 /* so that 64 * 64 = 4096 (1 page) */
940 /* Response Queue Related Definitions */
941 #define NUM_RSP_Q_ENTRIES 256 /* so that 256 * 16 = 4096 (1 page) */
943 /* Transmit and Receive Buffers */
944 #define NUM_LBUFQ_ENTRIES 128
945 #define JUMBO_NUM_LBUFQ_ENTRIES 32
946 #define NUM_SBUFQ_ENTRIES 64
947 #define QL_SMALL_BUFFER_SIZE 32
948 #define QL_ADDR_ELE_PER_BUFQ_ENTRY \
949 (sizeof(struct lrg_buf_q_entry) / sizeof(struct bufq_addr_element))
950 /* Each send has at least control block. This is how many we keep. */
951 #define NUM_SMALL_BUFFERS NUM_SBUFQ_ENTRIES * QL_ADDR_ELE_PER_BUFQ_ENTRY
953 #define QL_HEADER_SPACE 32 /* make header space at top of skb. */
955 * Large & Small Buffers for Receives
957 struct lrg_buf_q_entry
{
960 #define IAL_LAST_ENTRY 0x00000001
961 #define IAL_CONT_ENTRY 0x00000002
962 #define IAL_FLAG_MASK 0x00000003
981 struct bufq_addr_element
{
986 #define QL_NO_RESET 0
987 #define QL_DO_RESET 1
997 struct ql_rcv_buf_cb
{
998 struct ql_rcv_buf_cb
*next
;
1000 DEFINE_DMA_UNMAP_ADDR(mapaddr
);
1001 DEFINE_DMA_UNMAP_LEN(maplen
);
1002 __le32 buf_phy_addr_low
;
1003 __le32 buf_phy_addr_high
;
1008 * Original IOCB has 3 sg entries:
1009 * first points to skb-data area
1010 * second points to first frag
1011 * third points to next oal.
1012 * OAL has 5 entries:
1013 * 1 thru 4 point to frags
1014 * fifth points to next oal.
1016 #define MAX_OAL_CNT ((MAX_SKB_FRAGS-1)/4 + 1)
1022 #define OAL_LAST_ENTRY 0x80000000 /* Last valid buffer in list. */
1023 #define OAL_CONT_ENTRY 0x40000000 /* points to an OAL. (continuation) */
1027 struct oal_entry oal_entry
[5];
1031 DEFINE_DMA_UNMAP_ADDR(mapaddr
);
1032 DEFINE_DMA_UNMAP_LEN(maplen
);
1035 struct ql_tx_buf_cb
{
1036 struct sk_buff
*skb
;
1037 struct ob_mac_iocb_req
*queue_entry
;
1040 struct map_list map
[MAX_SKB_FRAGS
+1];
1043 /* definitions for type field */
1044 #define QL_BUF_TYPE_MACIOCB 0x01
1045 #define QL_BUF_TYPE_IPIOCB 0x02
1046 #define QL_BUF_TYPE_TCPIOCB 0x03
1048 /* qdev->flags definitions. */
1049 enum { QL_RESET_DONE
= 1, /* Reset finished. */
1050 QL_RESET_ACTIVE
= 2, /* Waiting for reset to finish. */
1051 QL_RESET_START
= 3, /* Please reset the chip. */
1052 QL_RESET_PER_SCSI
= 4, /* SCSI driver requests reset. */
1053 QL_TX_TIMEOUT
= 5, /* Timeout in progress. */
1054 QL_LINK_MASTER
= 6, /* This driver controls the link. */
1055 QL_ADAPTER_UP
= 7, /* Adapter has been brought up. */
1056 QL_THREAD_UP
= 8, /* This flag is available. */
1057 QL_LINK_UP
= 9, /* Link Status. */
1058 QL_ALLOC_REQ_RSP_Q_DONE
= 10,
1059 QL_ALLOC_BUFQS_DONE
= 11,
1060 QL_ALLOC_SMALL_BUF_DONE
= 12,
1061 QL_LINK_OPTICAL
= 13,
1062 QL_MSI_ENABLED
= 14,
1066 * ql3_adapter - The main Adapter structure definition.
1067 * This structure has all fields relevant to the hardware.
1070 struct ql3_adapter
{
1072 unsigned long flags
;
1074 /* PCI Configuration information for this device */
1075 struct pci_dev
*pdev
;
1076 struct net_device
*ndev
; /* Parent NET device */
1078 struct napi_struct napi
;
1080 /* Hardware information */
1087 struct timer_list adapter_timer
; /* timer used for various functions */
1089 spinlock_t adapter_lock
;
1092 /* PCI Bus Relative Register Addresses */
1093 u8 __iomem
*mmap_virt_base
; /* stores return value from ioremap() */
1094 struct ql3xxx_port_registers __iomem
*mem_map_registers
;
1095 u32 current_page
; /* tracks current register page */
1101 /* Page for Shadow Registers */
1102 void *shadow_reg_virt_addr
;
1103 dma_addr_t shadow_reg_phy_addr
;
1105 /* Net Request Queue */
1108 struct ob_mac_iocb_req
*req_q_virt_addr
;
1109 dma_addr_t req_q_phy_addr
;
1110 u16 req_producer_index
;
1112 u16
*preq_consumer_index
;
1113 u32 req_consumer_index_phy_addr_high
;
1114 u32 req_consumer_index_phy_addr_low
;
1116 struct ql_tx_buf_cb tx_buf
[NUM_REQ_Q_ENTRIES
];
1118 /* Net Response Queue */
1120 u32 eeprom_cmd_data
;
1121 struct net_rsp_iocb
*rsp_q_virt_addr
;
1122 dma_addr_t rsp_q_phy_addr
;
1123 struct net_rsp_iocb
*rsp_current
;
1124 u16 rsp_consumer_index
;
1126 volatile __le32
*prsp_producer_index
;
1127 u32 rsp_producer_index_phy_addr_high
;
1128 u32 rsp_producer_index_phy_addr_low
;
1130 /* Large Buffer Queue */
1131 u32 lrg_buf_q_alloc_size
;
1133 void *lrg_buf_q_alloc_virt_addr
;
1134 void *lrg_buf_q_virt_addr
;
1135 dma_addr_t lrg_buf_q_alloc_phy_addr
;
1136 dma_addr_t lrg_buf_q_phy_addr
;
1137 u32 lrg_buf_q_producer_index
;
1138 u32 lrg_buf_release_cnt
;
1139 struct bufq_addr_element
*lrg_buf_next_free
;
1140 u32 num_large_buffers
;
1141 u32 num_lbufq_entries
;
1143 /* Large (Receive) Buffers */
1144 struct ql_rcv_buf_cb
*lrg_buf
;
1145 struct ql_rcv_buf_cb
*lrg_buf_free_head
;
1146 struct ql_rcv_buf_cb
*lrg_buf_free_tail
;
1147 u32 lrg_buf_free_count
;
1150 u32 lrg_buf_skb_check
;
1152 /* Small Buffer Queue */
1153 u32 small_buf_q_alloc_size
;
1154 u32 small_buf_q_size
;
1155 u32 small_buf_q_producer_index
;
1156 void *small_buf_q_alloc_virt_addr
;
1157 void *small_buf_q_virt_addr
;
1158 dma_addr_t small_buf_q_alloc_phy_addr
;
1159 dma_addr_t small_buf_q_phy_addr
;
1160 u32 small_buf_index
;
1162 /* Small (Receive) Buffers */
1163 void *small_buf_virt_addr
;
1164 dma_addr_t small_buf_phy_addr
;
1165 u32 small_buf_phy_addr_low
;
1166 u32 small_buf_phy_addr_high
;
1167 u32 small_buf_release_cnt
;
1168 u32 small_buf_total_size
;
1170 struct eeprom_data nvram_data
;
1171 u32 port_link_state
;
1174 u32 mac_index
; /* Driver's MAC number can be 0 or 1 for first and second networking functions respectively */
1175 u32 PHYAddr
; /* Address of PHY 0x1e00 Port 0 and 0x1f00 Port 1 */
1176 u32 mac_ob_opcode
; /* Opcode to use on mac transmission */
1177 u32 mb_bit_mask
; /* MA Bits mask to use on transmission */
1179 struct workqueue_struct
*workqueue
;
1180 struct delayed_work reset_work
;
1181 struct delayed_work tx_timeout_work
;
1182 struct delayed_work link_state_work
;
1188 #endif /* _QLA3XXX_H_ */