blob: e319fd64d07c315ac284ddd89a8805009f12b378 [file] [log] [blame]
Ben Hutchings8ceee662008-04-27 12:55:59 +01001/****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2008 Solarflare Communications Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
9 */
10
11#ifndef EFX_FALCON_HWDEFS_H
12#define EFX_FALCON_HWDEFS_H
13
14/*
15 * Falcon hardware value definitions.
16 * Falcon is the internal codename for the SFC4000 controller that is
17 * present in SFE400X evaluation boards
18 */
19
20/**************************************************************************
21 *
22 * Falcon registers
23 *
24 **************************************************************************
25 */
26
27/* Address region register */
28#define ADR_REGION_REG_KER 0x00
29#define ADR_REGION0_LBN 0
30#define ADR_REGION0_WIDTH 18
31#define ADR_REGION1_LBN 32
32#define ADR_REGION1_WIDTH 18
33#define ADR_REGION2_LBN 64
34#define ADR_REGION2_WIDTH 18
35#define ADR_REGION3_LBN 96
36#define ADR_REGION3_WIDTH 18
37
38/* Interrupt enable register */
39#define INT_EN_REG_KER 0x0010
40#define KER_INT_KER_LBN 3
41#define KER_INT_KER_WIDTH 1
42#define DRV_INT_EN_KER_LBN 0
43#define DRV_INT_EN_KER_WIDTH 1
44
45/* Interrupt status address register */
46#define INT_ADR_REG_KER 0x0030
47#define NORM_INT_VEC_DIS_KER_LBN 64
48#define NORM_INT_VEC_DIS_KER_WIDTH 1
49#define INT_ADR_KER_LBN 0
50#define INT_ADR_KER_WIDTH EFX_DMA_TYPE_WIDTH(64) /* not 46 for this one */
51
52/* Interrupt status register (B0 only) */
53#define INT_ISR0_B0 0x90
54#define INT_ISR1_B0 0xA0
55
56/* Interrupt acknowledge register (A0/A1 only) */
57#define INT_ACK_REG_KER_A1 0x0050
58#define INT_ACK_DUMMY_DATA_LBN 0
59#define INT_ACK_DUMMY_DATA_WIDTH 32
60
61/* Interrupt acknowledge work-around register (A0/A1 only )*/
62#define WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 0x0070
63
64/* SPI host command register */
65#define EE_SPI_HCMD_REG_KER 0x0100
66#define EE_SPI_HCMD_CMD_EN_LBN 31
67#define EE_SPI_HCMD_CMD_EN_WIDTH 1
68#define EE_WR_TIMER_ACTIVE_LBN 28
69#define EE_WR_TIMER_ACTIVE_WIDTH 1
70#define EE_SPI_HCMD_SF_SEL_LBN 24
71#define EE_SPI_HCMD_SF_SEL_WIDTH 1
72#define EE_SPI_EEPROM 0
73#define EE_SPI_FLASH 1
74#define EE_SPI_HCMD_DABCNT_LBN 16
75#define EE_SPI_HCMD_DABCNT_WIDTH 5
76#define EE_SPI_HCMD_READ_LBN 15
77#define EE_SPI_HCMD_READ_WIDTH 1
78#define EE_SPI_READ 1
79#define EE_SPI_WRITE 0
80#define EE_SPI_HCMD_DUBCNT_LBN 12
81#define EE_SPI_HCMD_DUBCNT_WIDTH 2
82#define EE_SPI_HCMD_ADBCNT_LBN 8
83#define EE_SPI_HCMD_ADBCNT_WIDTH 2
84#define EE_SPI_HCMD_ENC_LBN 0
85#define EE_SPI_HCMD_ENC_WIDTH 8
86
87/* SPI host address register */
88#define EE_SPI_HADR_REG_KER 0x0110
89#define EE_SPI_HADR_ADR_LBN 0
90#define EE_SPI_HADR_ADR_WIDTH 24
91
92/* SPI host data register */
93#define EE_SPI_HDATA_REG_KER 0x0120
94
Ben Hutchings4a5b5042008-09-01 12:47:16 +010095/* SPI/VPD config register */
96#define EE_VPD_CFG_REG_KER 0x0140
97#define EE_VPD_EN_LBN 0
98#define EE_VPD_EN_WIDTH 1
99#define EE_VPD_EN_AD9_MODE_LBN 1
100#define EE_VPD_EN_AD9_MODE_WIDTH 1
101#define EE_EE_CLOCK_DIV_LBN 112
102#define EE_EE_CLOCK_DIV_WIDTH 7
103#define EE_SF_CLOCK_DIV_LBN 120
104#define EE_SF_CLOCK_DIV_WIDTH 7
105
Ben Hutchings8ceee662008-04-27 12:55:59 +0100106/* PCIE CORE ACCESS REG */
107#define PCIE_CORE_ADDR_PCIE_DEVICE_CTRL_STAT 0x68
108#define PCIE_CORE_ADDR_PCIE_LINK_CTRL_STAT 0x70
109#define PCIE_CORE_ADDR_ACK_RPL_TIMER 0x700
110#define PCIE_CORE_ADDR_ACK_FREQ 0x70C
111
112/* NIC status register */
113#define NIC_STAT_REG 0x0200
114#define ONCHIP_SRAM_LBN 16
115#define ONCHIP_SRAM_WIDTH 1
116#define SF_PRST_LBN 9
117#define SF_PRST_WIDTH 1
118#define EE_PRST_LBN 8
119#define EE_PRST_WIDTH 1
120/* See pic_mode_t for decoding of this field */
121/* These bit definitions are extrapolated from the list of numerical
122 * values for STRAP_PINS.
123 */
124#define STRAP_10G_LBN 2
125#define STRAP_10G_WIDTH 1
126#define STRAP_PCIE_LBN 0
127#define STRAP_PCIE_WIDTH 1
128
Ben Hutchings4a5b5042008-09-01 12:47:16 +0100129#define BOOTED_USING_NVDEVICE_LBN 3
130#define BOOTED_USING_NVDEVICE_WIDTH 1
131
Ben Hutchings8ceee662008-04-27 12:55:59 +0100132/* GPIO control register */
133#define GPIO_CTL_REG_KER 0x0210
134#define GPIO_OUTPUTS_LBN (16)
135#define GPIO_OUTPUTS_WIDTH (4)
136#define GPIO_INPUTS_LBN (8)
137#define GPIO_DIRECTION_LBN (24)
138#define GPIO_DIRECTION_WIDTH (4)
139#define GPIO_DIRECTION_OUT (1)
140#define GPIO_SRAM_SLEEP (1 << 1)
141
142#define GPIO3_OEN_LBN (GPIO_DIRECTION_LBN + 3)
143#define GPIO3_OEN_WIDTH 1
144#define GPIO2_OEN_LBN (GPIO_DIRECTION_LBN + 2)
145#define GPIO2_OEN_WIDTH 1
146#define GPIO1_OEN_LBN (GPIO_DIRECTION_LBN + 1)
147#define GPIO1_OEN_WIDTH 1
148#define GPIO0_OEN_LBN (GPIO_DIRECTION_LBN + 0)
149#define GPIO0_OEN_WIDTH 1
150
151#define GPIO3_OUT_LBN (GPIO_OUTPUTS_LBN + 3)
152#define GPIO3_OUT_WIDTH 1
153#define GPIO2_OUT_LBN (GPIO_OUTPUTS_LBN + 2)
154#define GPIO2_OUT_WIDTH 1
155#define GPIO1_OUT_LBN (GPIO_OUTPUTS_LBN + 1)
156#define GPIO1_OUT_WIDTH 1
157#define GPIO0_OUT_LBN (GPIO_OUTPUTS_LBN + 0)
158#define GPIO0_OUT_WIDTH 1
159
160#define GPIO3_IN_LBN (GPIO_INPUTS_LBN + 3)
161#define GPIO3_IN_WIDTH 1
162#define GPIO2_IN_WIDTH 1
163#define GPIO1_IN_WIDTH 1
164#define GPIO0_IN_LBN (GPIO_INPUTS_LBN + 0)
165#define GPIO0_IN_WIDTH 1
166
167/* Global control register */
168#define GLB_CTL_REG_KER 0x0220
169#define EXT_PHY_RST_CTL_LBN 63
170#define EXT_PHY_RST_CTL_WIDTH 1
171#define PCIE_SD_RST_CTL_LBN 61
172#define PCIE_SD_RST_CTL_WIDTH 1
173
174#define PCIE_NSTCK_RST_CTL_LBN 58
175#define PCIE_NSTCK_RST_CTL_WIDTH 1
176#define PCIE_CORE_RST_CTL_LBN 57
177#define PCIE_CORE_RST_CTL_WIDTH 1
178#define EE_RST_CTL_LBN 49
179#define EE_RST_CTL_WIDTH 1
180#define RST_XGRX_LBN 24
181#define RST_XGRX_WIDTH 1
182#define RST_XGTX_LBN 23
183#define RST_XGTX_WIDTH 1
184#define RST_EM_LBN 22
185#define RST_EM_WIDTH 1
186#define EXT_PHY_RST_DUR_LBN 1
187#define EXT_PHY_RST_DUR_WIDTH 3
188#define SWRST_LBN 0
189#define SWRST_WIDTH 1
190#define INCLUDE_IN_RESET 0
191#define EXCLUDE_FROM_RESET 1
192
193/* Fatal interrupt register */
194#define FATAL_INTR_REG_KER 0x0230
195#define RBUF_OWN_INT_KER_EN_LBN 39
196#define RBUF_OWN_INT_KER_EN_WIDTH 1
197#define TBUF_OWN_INT_KER_EN_LBN 38
198#define TBUF_OWN_INT_KER_EN_WIDTH 1
199#define ILL_ADR_INT_KER_EN_LBN 33
200#define ILL_ADR_INT_KER_EN_WIDTH 1
201#define MEM_PERR_INT_KER_LBN 8
202#define MEM_PERR_INT_KER_WIDTH 1
203#define INT_KER_ERROR_LBN 0
204#define INT_KER_ERROR_WIDTH 12
205
206#define DP_CTRL_REG 0x250
207#define FLS_EVQ_ID_LBN 0
208#define FLS_EVQ_ID_WIDTH 11
209
210#define MEM_STAT_REG_KER 0x260
211
212/* Debug probe register */
213#define DEBUG_BLK_SEL_MISC 7
214#define DEBUG_BLK_SEL_SERDES 6
215#define DEBUG_BLK_SEL_EM 5
216#define DEBUG_BLK_SEL_SR 4
217#define DEBUG_BLK_SEL_EV 3
218#define DEBUG_BLK_SEL_RX 2
219#define DEBUG_BLK_SEL_TX 1
220#define DEBUG_BLK_SEL_BIU 0
221
222/* FPGA build version */
223#define ALTERA_BUILD_REG_KER 0x0300
224#define VER_ALL_LBN 0
225#define VER_ALL_WIDTH 32
226
227/* Spare EEPROM bits register (flash 0x390) */
228#define SPARE_REG_KER 0x310
229#define MEM_PERR_EN_TX_DATA_LBN 72
230#define MEM_PERR_EN_TX_DATA_WIDTH 2
231
232/* Timer table for kernel access */
233#define TIMER_CMD_REG_KER 0x420
234#define TIMER_MODE_LBN 12
235#define TIMER_MODE_WIDTH 2
236#define TIMER_MODE_DIS 0
237#define TIMER_MODE_INT_HLDOFF 2
238#define TIMER_VAL_LBN 0
239#define TIMER_VAL_WIDTH 12
240
241/* Driver generated event register */
242#define DRV_EV_REG_KER 0x440
243#define DRV_EV_QID_LBN 64
244#define DRV_EV_QID_WIDTH 12
245#define DRV_EV_DATA_LBN 0
246#define DRV_EV_DATA_WIDTH 64
247
248/* Buffer table configuration register */
249#define BUF_TBL_CFG_REG_KER 0x600
250#define BUF_TBL_MODE_LBN 3
251#define BUF_TBL_MODE_WIDTH 1
252#define BUF_TBL_MODE_HALF 0
253#define BUF_TBL_MODE_FULL 1
254
255/* SRAM receive descriptor cache configuration register */
256#define SRM_RX_DC_CFG_REG_KER 0x610
257#define SRM_RX_DC_BASE_ADR_LBN 0
258#define SRM_RX_DC_BASE_ADR_WIDTH 21
259
260/* SRAM transmit descriptor cache configuration register */
261#define SRM_TX_DC_CFG_REG_KER 0x620
262#define SRM_TX_DC_BASE_ADR_LBN 0
263#define SRM_TX_DC_BASE_ADR_WIDTH 21
264
265/* SRAM configuration register */
266#define SRM_CFG_REG_KER 0x630
267#define SRAM_OOB_BT_INIT_EN_LBN 3
268#define SRAM_OOB_BT_INIT_EN_WIDTH 1
269#define SRM_NUM_BANKS_AND_BANK_SIZE_LBN 0
270#define SRM_NUM_BANKS_AND_BANK_SIZE_WIDTH 3
271#define SRM_NB_BSZ_1BANKS_2M 0
272#define SRM_NB_BSZ_1BANKS_4M 1
273#define SRM_NB_BSZ_1BANKS_8M 2
274#define SRM_NB_BSZ_DEFAULT 3 /* char driver will set the default */
275#define SRM_NB_BSZ_2BANKS_4M 4
276#define SRM_NB_BSZ_2BANKS_8M 5
277#define SRM_NB_BSZ_2BANKS_16M 6
278#define SRM_NB_BSZ_RESERVED 7
279
280/* Special buffer table update register */
281#define BUF_TBL_UPD_REG_KER 0x0650
282#define BUF_UPD_CMD_LBN 63
283#define BUF_UPD_CMD_WIDTH 1
284#define BUF_CLR_CMD_LBN 62
285#define BUF_CLR_CMD_WIDTH 1
286#define BUF_CLR_END_ID_LBN 32
287#define BUF_CLR_END_ID_WIDTH 20
288#define BUF_CLR_START_ID_LBN 0
289#define BUF_CLR_START_ID_WIDTH 20
290
291/* Receive configuration register */
292#define RX_CFG_REG_KER 0x800
293
294/* B0 */
295#define RX_INGR_EN_B0_LBN 47
296#define RX_INGR_EN_B0_WIDTH 1
297#define RX_DESC_PUSH_EN_B0_LBN 43
298#define RX_DESC_PUSH_EN_B0_WIDTH 1
299#define RX_XON_TX_TH_B0_LBN 33
300#define RX_XON_TX_TH_B0_WIDTH 5
301#define RX_XOFF_TX_TH_B0_LBN 28
302#define RX_XOFF_TX_TH_B0_WIDTH 5
303#define RX_USR_BUF_SIZE_B0_LBN 19
304#define RX_USR_BUF_SIZE_B0_WIDTH 9
305#define RX_XON_MAC_TH_B0_LBN 10
306#define RX_XON_MAC_TH_B0_WIDTH 9
307#define RX_XOFF_MAC_TH_B0_LBN 1
308#define RX_XOFF_MAC_TH_B0_WIDTH 9
309#define RX_XOFF_MAC_EN_B0_LBN 0
310#define RX_XOFF_MAC_EN_B0_WIDTH 1
311
312/* A1 */
313#define RX_DESC_PUSH_EN_A1_LBN 35
314#define RX_DESC_PUSH_EN_A1_WIDTH 1
315#define RX_XON_TX_TH_A1_LBN 25
316#define RX_XON_TX_TH_A1_WIDTH 5
317#define RX_XOFF_TX_TH_A1_LBN 20
318#define RX_XOFF_TX_TH_A1_WIDTH 5
319#define RX_USR_BUF_SIZE_A1_LBN 11
320#define RX_USR_BUF_SIZE_A1_WIDTH 9
321#define RX_XON_MAC_TH_A1_LBN 6
322#define RX_XON_MAC_TH_A1_WIDTH 5
323#define RX_XOFF_MAC_TH_A1_LBN 1
324#define RX_XOFF_MAC_TH_A1_WIDTH 5
325#define RX_XOFF_MAC_EN_A1_LBN 0
326#define RX_XOFF_MAC_EN_A1_WIDTH 1
327
328/* Receive filter control register */
329#define RX_FILTER_CTL_REG 0x810
330#define UDP_FULL_SRCH_LIMIT_LBN 32
331#define UDP_FULL_SRCH_LIMIT_WIDTH 8
332#define NUM_KER_LBN 24
333#define NUM_KER_WIDTH 2
334#define UDP_WILD_SRCH_LIMIT_LBN 16
335#define UDP_WILD_SRCH_LIMIT_WIDTH 8
336#define TCP_WILD_SRCH_LIMIT_LBN 8
337#define TCP_WILD_SRCH_LIMIT_WIDTH 8
338#define TCP_FULL_SRCH_LIMIT_LBN 0
339#define TCP_FULL_SRCH_LIMIT_WIDTH 8
340
341/* RX queue flush register */
342#define RX_FLUSH_DESCQ_REG_KER 0x0820
343#define RX_FLUSH_DESCQ_CMD_LBN 24
344#define RX_FLUSH_DESCQ_CMD_WIDTH 1
345#define RX_FLUSH_DESCQ_LBN 0
346#define RX_FLUSH_DESCQ_WIDTH 12
347
348/* Receive descriptor update register */
349#define RX_DESC_UPD_REG_KER_DWORD (0x830 + 12)
350#define RX_DESC_WPTR_DWORD_LBN 0
351#define RX_DESC_WPTR_DWORD_WIDTH 12
352
353/* Receive descriptor cache configuration register */
354#define RX_DC_CFG_REG_KER 0x840
355#define RX_DC_SIZE_LBN 0
356#define RX_DC_SIZE_WIDTH 2
357
358#define RX_DC_PF_WM_REG_KER 0x850
359#define RX_DC_PF_LWM_LBN 0
360#define RX_DC_PF_LWM_WIDTH 6
361
362/* RX no descriptor drop counter */
363#define RX_NODESC_DROP_REG_KER 0x880
364#define RX_NODESC_DROP_CNT_LBN 0
365#define RX_NODESC_DROP_CNT_WIDTH 16
366
367/* RX black magic register */
368#define RX_SELF_RST_REG_KER 0x890
369#define RX_ISCSI_DIS_LBN 17
370#define RX_ISCSI_DIS_WIDTH 1
371#define RX_NODESC_WAIT_DIS_LBN 9
372#define RX_NODESC_WAIT_DIS_WIDTH 1
373#define RX_RECOVERY_EN_LBN 8
374#define RX_RECOVERY_EN_WIDTH 1
375
376/* TX queue flush register */
377#define TX_FLUSH_DESCQ_REG_KER 0x0a00
378#define TX_FLUSH_DESCQ_CMD_LBN 12
379#define TX_FLUSH_DESCQ_CMD_WIDTH 1
380#define TX_FLUSH_DESCQ_LBN 0
381#define TX_FLUSH_DESCQ_WIDTH 12
382
383/* Transmit descriptor update register */
384#define TX_DESC_UPD_REG_KER_DWORD (0xa10 + 12)
385#define TX_DESC_WPTR_DWORD_LBN 0
386#define TX_DESC_WPTR_DWORD_WIDTH 12
387
388/* Transmit descriptor cache configuration register */
389#define TX_DC_CFG_REG_KER 0xa20
390#define TX_DC_SIZE_LBN 0
391#define TX_DC_SIZE_WIDTH 2
392
393/* Transmit checksum configuration register (A0/A1 only) */
394#define TX_CHKSM_CFG_REG_KER_A1 0xa30
395
396/* Transmit configuration register */
397#define TX_CFG_REG_KER 0xa50
398#define TX_NO_EOP_DISC_EN_LBN 5
399#define TX_NO_EOP_DISC_EN_WIDTH 1
400
401/* Transmit configuration register 2 */
402#define TX_CFG2_REG_KER 0xa80
403#define TX_CSR_PUSH_EN_LBN 89
404#define TX_CSR_PUSH_EN_WIDTH 1
405#define TX_RX_SPACER_LBN 64
406#define TX_RX_SPACER_WIDTH 8
407#define TX_SW_EV_EN_LBN 59
408#define TX_SW_EV_EN_WIDTH 1
409#define TX_RX_SPACER_EN_LBN 57
410#define TX_RX_SPACER_EN_WIDTH 1
411#define TX_PREF_THRESHOLD_LBN 19
412#define TX_PREF_THRESHOLD_WIDTH 2
413#define TX_ONE_PKT_PER_Q_LBN 18
414#define TX_ONE_PKT_PER_Q_WIDTH 1
415#define TX_DIS_NON_IP_EV_LBN 17
416#define TX_DIS_NON_IP_EV_WIDTH 1
417#define TX_FLUSH_MIN_LEN_EN_B0_LBN 7
418#define TX_FLUSH_MIN_LEN_EN_B0_WIDTH 1
419
420/* PHY management transmit data register */
421#define MD_TXD_REG_KER 0xc00
422#define MD_TXD_LBN 0
423#define MD_TXD_WIDTH 16
424
425/* PHY management receive data register */
426#define MD_RXD_REG_KER 0xc10
427#define MD_RXD_LBN 0
428#define MD_RXD_WIDTH 16
429
430/* PHY management configuration & status register */
431#define MD_CS_REG_KER 0xc20
432#define MD_GC_LBN 4
433#define MD_GC_WIDTH 1
434#define MD_RIC_LBN 2
435#define MD_RIC_WIDTH 1
436#define MD_RDC_LBN 1
437#define MD_RDC_WIDTH 1
438#define MD_WRC_LBN 0
439#define MD_WRC_WIDTH 1
440
441/* PHY management PHY address register */
442#define MD_PHY_ADR_REG_KER 0xc30
443#define MD_PHY_ADR_LBN 0
444#define MD_PHY_ADR_WIDTH 16
445
446/* PHY management ID register */
447#define MD_ID_REG_KER 0xc40
448#define MD_PRT_ADR_LBN 11
449#define MD_PRT_ADR_WIDTH 5
450#define MD_DEV_ADR_LBN 6
451#define MD_DEV_ADR_WIDTH 5
452/* Used for writing both at once */
453#define MD_PRT_DEV_ADR_LBN 6
454#define MD_PRT_DEV_ADR_WIDTH 10
455
456/* PHY management status & mask register (DWORD read only) */
457#define MD_STAT_REG_KER 0xc50
458#define MD_BSERR_LBN 2
459#define MD_BSERR_WIDTH 1
460#define MD_LNFL_LBN 1
461#define MD_LNFL_WIDTH 1
462#define MD_BSY_LBN 0
463#define MD_BSY_WIDTH 1
464
465/* Port 0 and 1 MAC stats registers */
466#define MAC0_STAT_DMA_REG_KER 0xc60
467#define MAC_STAT_DMA_CMD_LBN 48
468#define MAC_STAT_DMA_CMD_WIDTH 1
469#define MAC_STAT_DMA_ADR_LBN 0
470#define MAC_STAT_DMA_ADR_WIDTH EFX_DMA_TYPE_WIDTH(46)
471
472/* Port 0 and 1 MAC control registers */
473#define MAC0_CTRL_REG_KER 0xc80
474#define MAC_XOFF_VAL_LBN 16
475#define MAC_XOFF_VAL_WIDTH 16
476#define TXFIFO_DRAIN_EN_B0_LBN 7
477#define TXFIFO_DRAIN_EN_B0_WIDTH 1
478#define MAC_BCAD_ACPT_LBN 4
479#define MAC_BCAD_ACPT_WIDTH 1
480#define MAC_UC_PROM_LBN 3
481#define MAC_UC_PROM_WIDTH 1
482#define MAC_LINK_STATUS_LBN 2
483#define MAC_LINK_STATUS_WIDTH 1
484#define MAC_SPEED_LBN 0
485#define MAC_SPEED_WIDTH 2
486
487/* 10G XAUI XGXS default values */
488#define XX_TXDRV_DEQ_DEFAULT 0xe /* deq=.6 */
489#define XX_TXDRV_DTX_DEFAULT 0x5 /* 1.25 */
490#define XX_SD_CTL_DRV_DEFAULT 0 /* 20mA */
491
492/* Multicast address hash table */
493#define MAC_MCAST_HASH_REG0_KER 0xca0
494#define MAC_MCAST_HASH_REG1_KER 0xcb0
495
Ben Hutchings8ceee662008-04-27 12:55:59 +0100496/* XGMAC address register low */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100497#define XM_ADR_LO_REG 0x1200
Ben Hutchings8ceee662008-04-27 12:55:59 +0100498#define XM_ADR_3_LBN 24
499#define XM_ADR_3_WIDTH 8
500#define XM_ADR_2_LBN 16
501#define XM_ADR_2_WIDTH 8
502#define XM_ADR_1_LBN 8
503#define XM_ADR_1_WIDTH 8
504#define XM_ADR_0_LBN 0
505#define XM_ADR_0_WIDTH 8
506
507/* XGMAC address register high */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100508#define XM_ADR_HI_REG 0x1210
Ben Hutchings8ceee662008-04-27 12:55:59 +0100509#define XM_ADR_5_LBN 8
510#define XM_ADR_5_WIDTH 8
511#define XM_ADR_4_LBN 0
512#define XM_ADR_4_WIDTH 8
513
514/* XGMAC global configuration */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100515#define XM_GLB_CFG_REG 0x1220
Ben Hutchings8ceee662008-04-27 12:55:59 +0100516#define XM_RX_STAT_EN_LBN 11
517#define XM_RX_STAT_EN_WIDTH 1
518#define XM_TX_STAT_EN_LBN 10
519#define XM_TX_STAT_EN_WIDTH 1
520#define XM_RX_JUMBO_MODE_LBN 6
521#define XM_RX_JUMBO_MODE_WIDTH 1
522#define XM_INTCLR_MODE_LBN 3
523#define XM_INTCLR_MODE_WIDTH 1
524#define XM_CORE_RST_LBN 0
525#define XM_CORE_RST_WIDTH 1
526
527/* XGMAC transmit configuration */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100528#define XM_TX_CFG_REG 0x1230
Ben Hutchings8ceee662008-04-27 12:55:59 +0100529#define XM_IPG_LBN 16
530#define XM_IPG_WIDTH 4
531#define XM_FCNTL_LBN 10
532#define XM_FCNTL_WIDTH 1
533#define XM_TXCRC_LBN 8
534#define XM_TXCRC_WIDTH 1
535#define XM_AUTO_PAD_LBN 5
536#define XM_AUTO_PAD_WIDTH 1
537#define XM_TX_PRMBL_LBN 2
538#define XM_TX_PRMBL_WIDTH 1
539#define XM_TXEN_LBN 1
540#define XM_TXEN_WIDTH 1
541
542/* XGMAC receive configuration */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100543#define XM_RX_CFG_REG 0x1240
Ben Hutchings8ceee662008-04-27 12:55:59 +0100544#define XM_PASS_CRC_ERR_LBN 25
545#define XM_PASS_CRC_ERR_WIDTH 1
546#define XM_ACPT_ALL_MCAST_LBN 11
547#define XM_ACPT_ALL_MCAST_WIDTH 1
548#define XM_ACPT_ALL_UCAST_LBN 9
549#define XM_ACPT_ALL_UCAST_WIDTH 1
550#define XM_AUTO_DEPAD_LBN 8
551#define XM_AUTO_DEPAD_WIDTH 1
552#define XM_RXEN_LBN 1
553#define XM_RXEN_WIDTH 1
554
555/* XGMAC management interrupt mask register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100556#define XM_MGT_INT_MSK_REG_B0 0x1250
Ben Hutchings8ceee662008-04-27 12:55:59 +0100557#define XM_MSK_PRMBLE_ERR_LBN 2
558#define XM_MSK_PRMBLE_ERR_WIDTH 1
559#define XM_MSK_RMTFLT_LBN 1
560#define XM_MSK_RMTFLT_WIDTH 1
561#define XM_MSK_LCLFLT_LBN 0
562#define XM_MSK_LCLFLT_WIDTH 1
563
564/* XGMAC flow control register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100565#define XM_FC_REG 0x1270
Ben Hutchings8ceee662008-04-27 12:55:59 +0100566#define XM_PAUSE_TIME_LBN 16
567#define XM_PAUSE_TIME_WIDTH 16
568#define XM_DIS_FCNTL_LBN 0
569#define XM_DIS_FCNTL_WIDTH 1
570
571/* XGMAC pause time count register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100572#define XM_PAUSE_TIME_REG 0x1290
Ben Hutchings8ceee662008-04-27 12:55:59 +0100573
574/* XGMAC transmit parameter register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100575#define XM_TX_PARAM_REG 0x012d0
Ben Hutchings8ceee662008-04-27 12:55:59 +0100576#define XM_TX_JUMBO_MODE_LBN 31
577#define XM_TX_JUMBO_MODE_WIDTH 1
578#define XM_MAX_TX_FRM_SIZE_LBN 16
579#define XM_MAX_TX_FRM_SIZE_WIDTH 14
580
581/* XGMAC receive parameter register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100582#define XM_RX_PARAM_REG 0x12e0
Ben Hutchings8ceee662008-04-27 12:55:59 +0100583#define XM_MAX_RX_FRM_SIZE_LBN 0
584#define XM_MAX_RX_FRM_SIZE_WIDTH 14
585
586/* XGMAC management interrupt status register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100587#define XM_MGT_INT_REG_B0 0x12f0
Ben Hutchings8ceee662008-04-27 12:55:59 +0100588#define XM_PRMBLE_ERR 2
589#define XM_PRMBLE_WIDTH 1
590#define XM_RMTFLT_LBN 1
591#define XM_RMTFLT_WIDTH 1
592#define XM_LCLFLT_LBN 0
593#define XM_LCLFLT_WIDTH 1
594
595/* XGXS/XAUI powerdown/reset register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100596#define XX_PWR_RST_REG 0x1300
Ben Hutchings8ceee662008-04-27 12:55:59 +0100597
598#define XX_PWRDND_EN_LBN 15
599#define XX_PWRDND_EN_WIDTH 1
600#define XX_PWRDNC_EN_LBN 14
601#define XX_PWRDNC_EN_WIDTH 1
602#define XX_PWRDNB_EN_LBN 13
603#define XX_PWRDNB_EN_WIDTH 1
604#define XX_PWRDNA_EN_LBN 12
605#define XX_PWRDNA_EN_WIDTH 1
606#define XX_RSTPLLCD_EN_LBN 9
607#define XX_RSTPLLCD_EN_WIDTH 1
608#define XX_RSTPLLAB_EN_LBN 8
609#define XX_RSTPLLAB_EN_WIDTH 1
610#define XX_RESETD_EN_LBN 7
611#define XX_RESETD_EN_WIDTH 1
612#define XX_RESETC_EN_LBN 6
613#define XX_RESETC_EN_WIDTH 1
614#define XX_RESETB_EN_LBN 5
615#define XX_RESETB_EN_WIDTH 1
616#define XX_RESETA_EN_LBN 4
617#define XX_RESETA_EN_WIDTH 1
618#define XX_RSTXGXSRX_EN_LBN 2
619#define XX_RSTXGXSRX_EN_WIDTH 1
620#define XX_RSTXGXSTX_EN_LBN 1
621#define XX_RSTXGXSTX_EN_WIDTH 1
622#define XX_RST_XX_EN_LBN 0
623#define XX_RST_XX_EN_WIDTH 1
624
625/* XGXS/XAUI powerdown/reset control register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100626#define XX_SD_CTL_REG 0x1310
Ben Hutchings8ceee662008-04-27 12:55:59 +0100627#define XX_HIDRVD_LBN 15
628#define XX_HIDRVD_WIDTH 1
629#define XX_LODRVD_LBN 14
630#define XX_LODRVD_WIDTH 1
631#define XX_HIDRVC_LBN 13
632#define XX_HIDRVC_WIDTH 1
633#define XX_LODRVC_LBN 12
634#define XX_LODRVC_WIDTH 1
635#define XX_HIDRVB_LBN 11
636#define XX_HIDRVB_WIDTH 1
637#define XX_LODRVB_LBN 10
638#define XX_LODRVB_WIDTH 1
639#define XX_HIDRVA_LBN 9
640#define XX_HIDRVA_WIDTH 1
641#define XX_LODRVA_LBN 8
642#define XX_LODRVA_WIDTH 1
Ben Hutchings3273c2e2008-05-07 13:36:19 +0100643#define XX_LPBKD_LBN 3
644#define XX_LPBKD_WIDTH 1
645#define XX_LPBKC_LBN 2
646#define XX_LPBKC_WIDTH 1
647#define XX_LPBKB_LBN 1
648#define XX_LPBKB_WIDTH 1
649#define XX_LPBKA_LBN 0
650#define XX_LPBKA_WIDTH 1
Ben Hutchings8ceee662008-04-27 12:55:59 +0100651
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100652#define XX_TXDRV_CTL_REG 0x1320
Ben Hutchings8ceee662008-04-27 12:55:59 +0100653#define XX_DEQD_LBN 28
654#define XX_DEQD_WIDTH 4
655#define XX_DEQC_LBN 24
656#define XX_DEQC_WIDTH 4
657#define XX_DEQB_LBN 20
658#define XX_DEQB_WIDTH 4
659#define XX_DEQA_LBN 16
660#define XX_DEQA_WIDTH 4
661#define XX_DTXD_LBN 12
662#define XX_DTXD_WIDTH 4
663#define XX_DTXC_LBN 8
664#define XX_DTXC_WIDTH 4
665#define XX_DTXB_LBN 4
666#define XX_DTXB_WIDTH 4
667#define XX_DTXA_LBN 0
668#define XX_DTXA_WIDTH 4
669
670/* XAUI XGXS core status register */
Ben Hutchingsc1e5fcc2008-09-01 12:48:41 +0100671#define XX_CORE_STAT_REG 0x1360
Ben Hutchings3273c2e2008-05-07 13:36:19 +0100672#define XX_FORCE_SIG_LBN 24
673#define XX_FORCE_SIG_WIDTH 8
674#define XX_FORCE_SIG_DECODE_FORCED 0xff
675#define XX_XGXS_LB_EN_LBN 23
676#define XX_XGXS_LB_EN_WIDTH 1
677#define XX_XGMII_LB_EN_LBN 22
678#define XX_XGMII_LB_EN_WIDTH 1
Ben Hutchings8ceee662008-04-27 12:55:59 +0100679#define XX_ALIGN_DONE_LBN 20
680#define XX_ALIGN_DONE_WIDTH 1
681#define XX_SYNC_STAT_LBN 16
682#define XX_SYNC_STAT_WIDTH 4
683#define XX_SYNC_STAT_DECODE_SYNCED 0xf
684#define XX_COMMA_DET_LBN 12
685#define XX_COMMA_DET_WIDTH 4
686#define XX_COMMA_DET_DECODE_DETECTED 0xf
687#define XX_COMMA_DET_RESET 0xf
688#define XX_CHARERR_LBN 4
689#define XX_CHARERR_WIDTH 4
690#define XX_CHARERR_RESET 0xf
691#define XX_DISPERR_LBN 0
692#define XX_DISPERR_WIDTH 4
693#define XX_DISPERR_RESET 0xf
694
695/* Receive filter table */
696#define RX_FILTER_TBL0 0xF00000
697
698/* Receive descriptor pointer table */
699#define RX_DESC_PTR_TBL_KER_A1 0x11800
700#define RX_DESC_PTR_TBL_KER_B0 0xF40000
701#define RX_DESC_PTR_TBL_KER_P0 0x900
702#define RX_ISCSI_DDIG_EN_LBN 88
703#define RX_ISCSI_DDIG_EN_WIDTH 1
704#define RX_ISCSI_HDIG_EN_LBN 87
705#define RX_ISCSI_HDIG_EN_WIDTH 1
706#define RX_DESCQ_BUF_BASE_ID_LBN 36
707#define RX_DESCQ_BUF_BASE_ID_WIDTH 20
708#define RX_DESCQ_EVQ_ID_LBN 24
709#define RX_DESCQ_EVQ_ID_WIDTH 12
710#define RX_DESCQ_OWNER_ID_LBN 10
711#define RX_DESCQ_OWNER_ID_WIDTH 14
712#define RX_DESCQ_LABEL_LBN 5
713#define RX_DESCQ_LABEL_WIDTH 5
714#define RX_DESCQ_SIZE_LBN 3
715#define RX_DESCQ_SIZE_WIDTH 2
716#define RX_DESCQ_SIZE_4K 3
717#define RX_DESCQ_SIZE_2K 2
718#define RX_DESCQ_SIZE_1K 1
719#define RX_DESCQ_SIZE_512 0
720#define RX_DESCQ_TYPE_LBN 2
721#define RX_DESCQ_TYPE_WIDTH 1
722#define RX_DESCQ_JUMBO_LBN 1
723#define RX_DESCQ_JUMBO_WIDTH 1
724#define RX_DESCQ_EN_LBN 0
725#define RX_DESCQ_EN_WIDTH 1
726
727/* Transmit descriptor pointer table */
728#define TX_DESC_PTR_TBL_KER_A1 0x11900
729#define TX_DESC_PTR_TBL_KER_B0 0xF50000
730#define TX_DESC_PTR_TBL_KER_P0 0xa40
731#define TX_NON_IP_DROP_DIS_B0_LBN 91
732#define TX_NON_IP_DROP_DIS_B0_WIDTH 1
733#define TX_IP_CHKSM_DIS_B0_LBN 90
734#define TX_IP_CHKSM_DIS_B0_WIDTH 1
735#define TX_TCP_CHKSM_DIS_B0_LBN 89
736#define TX_TCP_CHKSM_DIS_B0_WIDTH 1
737#define TX_DESCQ_EN_LBN 88
738#define TX_DESCQ_EN_WIDTH 1
739#define TX_ISCSI_DDIG_EN_LBN 87
740#define TX_ISCSI_DDIG_EN_WIDTH 1
741#define TX_ISCSI_HDIG_EN_LBN 86
742#define TX_ISCSI_HDIG_EN_WIDTH 1
743#define TX_DESCQ_BUF_BASE_ID_LBN 36
744#define TX_DESCQ_BUF_BASE_ID_WIDTH 20
745#define TX_DESCQ_EVQ_ID_LBN 24
746#define TX_DESCQ_EVQ_ID_WIDTH 12
747#define TX_DESCQ_OWNER_ID_LBN 10
748#define TX_DESCQ_OWNER_ID_WIDTH 14
749#define TX_DESCQ_LABEL_LBN 5
750#define TX_DESCQ_LABEL_WIDTH 5
751#define TX_DESCQ_SIZE_LBN 3
752#define TX_DESCQ_SIZE_WIDTH 2
753#define TX_DESCQ_SIZE_4K 3
754#define TX_DESCQ_SIZE_2K 2
755#define TX_DESCQ_SIZE_1K 1
756#define TX_DESCQ_SIZE_512 0
757#define TX_DESCQ_TYPE_LBN 1
758#define TX_DESCQ_TYPE_WIDTH 2
759
760/* Event queue pointer */
761#define EVQ_PTR_TBL_KER_A1 0x11a00
762#define EVQ_PTR_TBL_KER_B0 0xf60000
763#define EVQ_PTR_TBL_KER_P0 0x500
764#define EVQ_EN_LBN 23
765#define EVQ_EN_WIDTH 1
766#define EVQ_SIZE_LBN 20
767#define EVQ_SIZE_WIDTH 3
768#define EVQ_SIZE_32K 6
769#define EVQ_SIZE_16K 5
770#define EVQ_SIZE_8K 4
771#define EVQ_SIZE_4K 3
772#define EVQ_SIZE_2K 2
773#define EVQ_SIZE_1K 1
774#define EVQ_SIZE_512 0
775#define EVQ_BUF_BASE_ID_LBN 0
776#define EVQ_BUF_BASE_ID_WIDTH 20
777
778/* Event queue read pointer */
779#define EVQ_RPTR_REG_KER_A1 0x11b00
780#define EVQ_RPTR_REG_KER_B0 0xfa0000
781#define EVQ_RPTR_REG_KER_DWORD (EVQ_RPTR_REG_KER + 0)
782#define EVQ_RPTR_DWORD_LBN 0
783#define EVQ_RPTR_DWORD_WIDTH 14
784
785/* RSS indirection table */
786#define RX_RSS_INDIR_TBL_B0 0xFB0000
787#define RX_RSS_INDIR_ENT_B0_LBN 0
788#define RX_RSS_INDIR_ENT_B0_WIDTH 6
789
790/* Special buffer descriptors (full-mode) */
791#define BUF_FULL_TBL_KER_A1 0x8000
792#define BUF_FULL_TBL_KER_B0 0x800000
793#define IP_DAT_BUF_SIZE_LBN 50
794#define IP_DAT_BUF_SIZE_WIDTH 1
795#define IP_DAT_BUF_SIZE_8K 1
796#define IP_DAT_BUF_SIZE_4K 0
797#define BUF_ADR_REGION_LBN 48
798#define BUF_ADR_REGION_WIDTH 2
799#define BUF_ADR_FBUF_LBN 14
800#define BUF_ADR_FBUF_WIDTH 34
801#define BUF_OWNER_ID_FBUF_LBN 0
802#define BUF_OWNER_ID_FBUF_WIDTH 14
803
804/* Transmit descriptor */
805#define TX_KER_PORT_LBN 63
806#define TX_KER_PORT_WIDTH 1
807#define TX_KER_CONT_LBN 62
808#define TX_KER_CONT_WIDTH 1
809#define TX_KER_BYTE_CNT_LBN 48
810#define TX_KER_BYTE_CNT_WIDTH 14
811#define TX_KER_BUF_REGION_LBN 46
812#define TX_KER_BUF_REGION_WIDTH 2
813#define TX_KER_BUF_REGION0_DECODE 0
814#define TX_KER_BUF_REGION1_DECODE 1
815#define TX_KER_BUF_REGION2_DECODE 2
816#define TX_KER_BUF_REGION3_DECODE 3
817#define TX_KER_BUF_ADR_LBN 0
818#define TX_KER_BUF_ADR_WIDTH EFX_DMA_TYPE_WIDTH(46)
819
820/* Receive descriptor */
821#define RX_KER_BUF_SIZE_LBN 48
822#define RX_KER_BUF_SIZE_WIDTH 14
823#define RX_KER_BUF_REGION_LBN 46
824#define RX_KER_BUF_REGION_WIDTH 2
825#define RX_KER_BUF_REGION0_DECODE 0
826#define RX_KER_BUF_REGION1_DECODE 1
827#define RX_KER_BUF_REGION2_DECODE 2
828#define RX_KER_BUF_REGION3_DECODE 3
829#define RX_KER_BUF_ADR_LBN 0
830#define RX_KER_BUF_ADR_WIDTH EFX_DMA_TYPE_WIDTH(46)
831
832/**************************************************************************
833 *
834 * Falcon events
835 *
836 **************************************************************************
837 */
838
839/* Event queue entries */
840#define EV_CODE_LBN 60
841#define EV_CODE_WIDTH 4
842#define RX_IP_EV_DECODE 0
843#define TX_IP_EV_DECODE 2
844#define DRIVER_EV_DECODE 5
845#define GLOBAL_EV_DECODE 6
846#define DRV_GEN_EV_DECODE 7
847#define WHOLE_EVENT_LBN 0
848#define WHOLE_EVENT_WIDTH 64
849
850/* Receive events */
851#define RX_EV_PKT_OK_LBN 56
852#define RX_EV_PKT_OK_WIDTH 1
853#define RX_EV_PAUSE_FRM_ERR_LBN 55
854#define RX_EV_PAUSE_FRM_ERR_WIDTH 1
855#define RX_EV_BUF_OWNER_ID_ERR_LBN 54
856#define RX_EV_BUF_OWNER_ID_ERR_WIDTH 1
857#define RX_EV_IF_FRAG_ERR_LBN 53
858#define RX_EV_IF_FRAG_ERR_WIDTH 1
859#define RX_EV_IP_HDR_CHKSUM_ERR_LBN 52
860#define RX_EV_IP_HDR_CHKSUM_ERR_WIDTH 1
861#define RX_EV_TCP_UDP_CHKSUM_ERR_LBN 51
862#define RX_EV_TCP_UDP_CHKSUM_ERR_WIDTH 1
863#define RX_EV_ETH_CRC_ERR_LBN 50
864#define RX_EV_ETH_CRC_ERR_WIDTH 1
865#define RX_EV_FRM_TRUNC_LBN 49
866#define RX_EV_FRM_TRUNC_WIDTH 1
867#define RX_EV_DRIB_NIB_LBN 48
868#define RX_EV_DRIB_NIB_WIDTH 1
869#define RX_EV_TOBE_DISC_LBN 47
870#define RX_EV_TOBE_DISC_WIDTH 1
871#define RX_EV_PKT_TYPE_LBN 44
872#define RX_EV_PKT_TYPE_WIDTH 3
873#define RX_EV_PKT_TYPE_ETH_DECODE 0
874#define RX_EV_PKT_TYPE_LLC_DECODE 1
875#define RX_EV_PKT_TYPE_JUMBO_DECODE 2
876#define RX_EV_PKT_TYPE_VLAN_DECODE 3
877#define RX_EV_PKT_TYPE_VLAN_LLC_DECODE 4
878#define RX_EV_PKT_TYPE_VLAN_JUMBO_DECODE 5
879#define RX_EV_HDR_TYPE_LBN 42
880#define RX_EV_HDR_TYPE_WIDTH 2
881#define RX_EV_HDR_TYPE_TCP_IPV4_DECODE 0
882#define RX_EV_HDR_TYPE_UDP_IPV4_DECODE 1
883#define RX_EV_HDR_TYPE_OTHER_IP_DECODE 2
884#define RX_EV_HDR_TYPE_NON_IP_DECODE 3
885#define RX_EV_HDR_TYPE_HAS_CHECKSUMS(hdr_type) \
886 ((hdr_type) <= RX_EV_HDR_TYPE_UDP_IPV4_DECODE)
887#define RX_EV_MCAST_HASH_MATCH_LBN 40
888#define RX_EV_MCAST_HASH_MATCH_WIDTH 1
889#define RX_EV_MCAST_PKT_LBN 39
890#define RX_EV_MCAST_PKT_WIDTH 1
891#define RX_EV_Q_LABEL_LBN 32
892#define RX_EV_Q_LABEL_WIDTH 5
893#define RX_EV_JUMBO_CONT_LBN 31
894#define RX_EV_JUMBO_CONT_WIDTH 1
895#define RX_EV_BYTE_CNT_LBN 16
896#define RX_EV_BYTE_CNT_WIDTH 14
897#define RX_EV_SOP_LBN 15
898#define RX_EV_SOP_WIDTH 1
899#define RX_EV_DESC_PTR_LBN 0
900#define RX_EV_DESC_PTR_WIDTH 12
901
902/* Transmit events */
903#define TX_EV_PKT_ERR_LBN 38
904#define TX_EV_PKT_ERR_WIDTH 1
905#define TX_EV_Q_LABEL_LBN 32
906#define TX_EV_Q_LABEL_WIDTH 5
907#define TX_EV_WQ_FF_FULL_LBN 15
908#define TX_EV_WQ_FF_FULL_WIDTH 1
909#define TX_EV_COMP_LBN 12
910#define TX_EV_COMP_WIDTH 1
911#define TX_EV_DESC_PTR_LBN 0
912#define TX_EV_DESC_PTR_WIDTH 12
913
914/* Driver events */
915#define DRIVER_EV_SUB_CODE_LBN 56
916#define DRIVER_EV_SUB_CODE_WIDTH 4
917#define DRIVER_EV_SUB_DATA_LBN 0
918#define DRIVER_EV_SUB_DATA_WIDTH 14
919#define TX_DESCQ_FLS_DONE_EV_DECODE 0
920#define RX_DESCQ_FLS_DONE_EV_DECODE 1
921#define EVQ_INIT_DONE_EV_DECODE 2
922#define EVQ_NOT_EN_EV_DECODE 3
923#define RX_DESCQ_FLSFF_OVFL_EV_DECODE 4
924#define SRM_UPD_DONE_EV_DECODE 5
925#define WAKE_UP_EV_DECODE 6
926#define TX_PKT_NON_TCP_UDP_DECODE 9
927#define TIMER_EV_DECODE 10
928#define RX_RECOVERY_EV_DECODE 11
929#define RX_DSC_ERROR_EV_DECODE 14
930#define TX_DSC_ERROR_EV_DECODE 15
931#define DRIVER_EV_TX_DESCQ_ID_LBN 0
932#define DRIVER_EV_TX_DESCQ_ID_WIDTH 12
933#define DRIVER_EV_RX_FLUSH_FAIL_LBN 12
934#define DRIVER_EV_RX_FLUSH_FAIL_WIDTH 1
935#define DRIVER_EV_RX_DESCQ_ID_LBN 0
936#define DRIVER_EV_RX_DESCQ_ID_WIDTH 12
937#define SRM_CLR_EV_DECODE 0
938#define SRM_UPD_EV_DECODE 1
939#define SRM_ILLCLR_EV_DECODE 2
940
941/* Global events */
942#define RX_RECOVERY_B0_LBN 12
943#define RX_RECOVERY_B0_WIDTH 1
944#define XG_MNT_INTR_B0_LBN 11
945#define XG_MNT_INTR_B0_WIDTH 1
946#define RX_RECOVERY_A1_LBN 11
947#define RX_RECOVERY_A1_WIDTH 1
948#define XG_PHY_INTR_LBN 9
949#define XG_PHY_INTR_WIDTH 1
950#define G_PHY1_INTR_LBN 8
951#define G_PHY1_INTR_WIDTH 1
952#define G_PHY0_INTR_LBN 7
953#define G_PHY0_INTR_WIDTH 1
954
955/* Driver-generated test events */
956#define EVQ_MAGIC_LBN 0
957#define EVQ_MAGIC_WIDTH 32
958
959/**************************************************************************
960 *
961 * Falcon MAC stats
962 *
963 **************************************************************************
964 *
965 */
966#define GRxGoodOct_offset 0x0
967#define GRxBadOct_offset 0x8
968#define GRxMissPkt_offset 0x10
969#define GRxFalseCRS_offset 0x14
970#define GRxPausePkt_offset 0x18
971#define GRxBadPkt_offset 0x1C
972#define GRxUcastPkt_offset 0x20
973#define GRxMcastPkt_offset 0x24
974#define GRxBcastPkt_offset 0x28
975#define GRxGoodLt64Pkt_offset 0x2C
976#define GRxBadLt64Pkt_offset 0x30
977#define GRx64Pkt_offset 0x34
978#define GRx65to127Pkt_offset 0x38
979#define GRx128to255Pkt_offset 0x3C
980#define GRx256to511Pkt_offset 0x40
981#define GRx512to1023Pkt_offset 0x44
982#define GRx1024to15xxPkt_offset 0x48
983#define GRx15xxtoJumboPkt_offset 0x4C
984#define GRxGtJumboPkt_offset 0x50
985#define GRxFcsErr64to15xxPkt_offset 0x54
986#define GRxFcsErr15xxtoJumboPkt_offset 0x58
987#define GRxFcsErrGtJumboPkt_offset 0x5C
988#define GTxGoodBadOct_offset 0x80
989#define GTxGoodOct_offset 0x88
990#define GTxSglColPkt_offset 0x90
991#define GTxMultColPkt_offset 0x94
992#define GTxExColPkt_offset 0x98
993#define GTxDefPkt_offset 0x9C
994#define GTxLateCol_offset 0xA0
995#define GTxExDefPkt_offset 0xA4
996#define GTxPausePkt_offset 0xA8
997#define GTxBadPkt_offset 0xAC
998#define GTxUcastPkt_offset 0xB0
999#define GTxMcastPkt_offset 0xB4
1000#define GTxBcastPkt_offset 0xB8
1001#define GTxLt64Pkt_offset 0xBC
1002#define GTx64Pkt_offset 0xC0
1003#define GTx65to127Pkt_offset 0xC4
1004#define GTx128to255Pkt_offset 0xC8
1005#define GTx256to511Pkt_offset 0xCC
1006#define GTx512to1023Pkt_offset 0xD0
1007#define GTx1024to15xxPkt_offset 0xD4
1008#define GTx15xxtoJumboPkt_offset 0xD8
1009#define GTxGtJumboPkt_offset 0xDC
1010#define GTxNonTcpUdpPkt_offset 0xE0
1011#define GTxMacSrcErrPkt_offset 0xE4
1012#define GTxIpSrcErrPkt_offset 0xE8
1013#define GDmaDone_offset 0xEC
1014
1015#define XgRxOctets_offset 0x0
1016#define XgRxOctets_WIDTH 48
1017#define XgRxOctetsOK_offset 0x8
1018#define XgRxOctetsOK_WIDTH 48
1019#define XgRxPkts_offset 0x10
1020#define XgRxPkts_WIDTH 32
1021#define XgRxPktsOK_offset 0x14
1022#define XgRxPktsOK_WIDTH 32
1023#define XgRxBroadcastPkts_offset 0x18
1024#define XgRxBroadcastPkts_WIDTH 32
1025#define XgRxMulticastPkts_offset 0x1C
1026#define XgRxMulticastPkts_WIDTH 32
1027#define XgRxUnicastPkts_offset 0x20
1028#define XgRxUnicastPkts_WIDTH 32
1029#define XgRxUndersizePkts_offset 0x24
1030#define XgRxUndersizePkts_WIDTH 32
1031#define XgRxOversizePkts_offset 0x28
1032#define XgRxOversizePkts_WIDTH 32
1033#define XgRxJabberPkts_offset 0x2C
1034#define XgRxJabberPkts_WIDTH 32
1035#define XgRxUndersizeFCSerrorPkts_offset 0x30
1036#define XgRxUndersizeFCSerrorPkts_WIDTH 32
1037#define XgRxDropEvents_offset 0x34
1038#define XgRxDropEvents_WIDTH 32
1039#define XgRxFCSerrorPkts_offset 0x38
1040#define XgRxFCSerrorPkts_WIDTH 32
1041#define XgRxAlignError_offset 0x3C
1042#define XgRxAlignError_WIDTH 32
1043#define XgRxSymbolError_offset 0x40
1044#define XgRxSymbolError_WIDTH 32
1045#define XgRxInternalMACError_offset 0x44
1046#define XgRxInternalMACError_WIDTH 32
1047#define XgRxControlPkts_offset 0x48
1048#define XgRxControlPkts_WIDTH 32
1049#define XgRxPausePkts_offset 0x4C
1050#define XgRxPausePkts_WIDTH 32
1051#define XgRxPkts64Octets_offset 0x50
1052#define XgRxPkts64Octets_WIDTH 32
1053#define XgRxPkts65to127Octets_offset 0x54
1054#define XgRxPkts65to127Octets_WIDTH 32
1055#define XgRxPkts128to255Octets_offset 0x58
1056#define XgRxPkts128to255Octets_WIDTH 32
1057#define XgRxPkts256to511Octets_offset 0x5C
1058#define XgRxPkts256to511Octets_WIDTH 32
1059#define XgRxPkts512to1023Octets_offset 0x60
1060#define XgRxPkts512to1023Octets_WIDTH 32
1061#define XgRxPkts1024to15xxOctets_offset 0x64
1062#define XgRxPkts1024to15xxOctets_WIDTH 32
1063#define XgRxPkts15xxtoMaxOctets_offset 0x68
1064#define XgRxPkts15xxtoMaxOctets_WIDTH 32
1065#define XgRxLengthError_offset 0x6C
1066#define XgRxLengthError_WIDTH 32
1067#define XgTxPkts_offset 0x80
1068#define XgTxPkts_WIDTH 32
1069#define XgTxOctets_offset 0x88
1070#define XgTxOctets_WIDTH 48
1071#define XgTxMulticastPkts_offset 0x90
1072#define XgTxMulticastPkts_WIDTH 32
1073#define XgTxBroadcastPkts_offset 0x94
1074#define XgTxBroadcastPkts_WIDTH 32
1075#define XgTxUnicastPkts_offset 0x98
1076#define XgTxUnicastPkts_WIDTH 32
1077#define XgTxControlPkts_offset 0x9C
1078#define XgTxControlPkts_WIDTH 32
1079#define XgTxPausePkts_offset 0xA0
1080#define XgTxPausePkts_WIDTH 32
1081#define XgTxPkts64Octets_offset 0xA4
1082#define XgTxPkts64Octets_WIDTH 32
1083#define XgTxPkts65to127Octets_offset 0xA8
1084#define XgTxPkts65to127Octets_WIDTH 32
1085#define XgTxPkts128to255Octets_offset 0xAC
1086#define XgTxPkts128to255Octets_WIDTH 32
1087#define XgTxPkts256to511Octets_offset 0xB0
1088#define XgTxPkts256to511Octets_WIDTH 32
1089#define XgTxPkts512to1023Octets_offset 0xB4
1090#define XgTxPkts512to1023Octets_WIDTH 32
1091#define XgTxPkts1024to15xxOctets_offset 0xB8
1092#define XgTxPkts1024to15xxOctets_WIDTH 32
1093#define XgTxPkts1519toMaxOctets_offset 0xBC
1094#define XgTxPkts1519toMaxOctets_WIDTH 32
1095#define XgTxUndersizePkts_offset 0xC0
1096#define XgTxUndersizePkts_WIDTH 32
1097#define XgTxOversizePkts_offset 0xC4
1098#define XgTxOversizePkts_WIDTH 32
1099#define XgTxNonTcpUdpPkt_offset 0xC8
1100#define XgTxNonTcpUdpPkt_WIDTH 16
1101#define XgTxMacSrcErrPkt_offset 0xCC
1102#define XgTxMacSrcErrPkt_WIDTH 16
1103#define XgTxIpSrcErrPkt_offset 0xD0
1104#define XgTxIpSrcErrPkt_WIDTH 16
1105#define XgDmaDone_offset 0xD4
1106
1107#define FALCON_STATS_NOT_DONE 0x00000000
1108#define FALCON_STATS_DONE 0xffffffff
1109
1110/* Interrupt status register bits */
1111#define FATAL_INT_LBN 64
1112#define FATAL_INT_WIDTH 1
1113#define INT_EVQS_LBN 40
1114#define INT_EVQS_WIDTH 4
1115
1116/**************************************************************************
1117 *
1118 * Falcon non-volatile configuration
1119 *
1120 **************************************************************************
1121 */
1122
1123/* Board configuration v2 (v1 is obsolete; later versions are compatible) */
1124struct falcon_nvconfig_board_v2 {
1125 __le16 nports;
1126 u8 port0_phy_addr;
1127 u8 port0_phy_type;
1128 u8 port1_phy_addr;
1129 u8 port1_phy_type;
1130 __le16 asic_sub_revision;
1131 __le16 board_revision;
Ben Hutchings24c28ed2008-05-16 21:19:21 +01001132} __packed;
Ben Hutchings8ceee662008-04-27 12:55:59 +01001133
Ben Hutchings4a5b5042008-09-01 12:47:16 +01001134/* Board configuration v3 extra information */
1135struct falcon_nvconfig_board_v3 {
1136 __le32 spi_device_type[2];
1137} __packed;
1138
1139/* Bit numbers for spi_device_type */
1140#define SPI_DEV_TYPE_SIZE_LBN 0
1141#define SPI_DEV_TYPE_SIZE_WIDTH 5
1142#define SPI_DEV_TYPE_ADDR_LEN_LBN 6
1143#define SPI_DEV_TYPE_ADDR_LEN_WIDTH 2
1144#define SPI_DEV_TYPE_ERASE_CMD_LBN 8
1145#define SPI_DEV_TYPE_ERASE_CMD_WIDTH 8
1146#define SPI_DEV_TYPE_ERASE_SIZE_LBN 16
1147#define SPI_DEV_TYPE_ERASE_SIZE_WIDTH 5
1148#define SPI_DEV_TYPE_BLOCK_SIZE_LBN 24
1149#define SPI_DEV_TYPE_BLOCK_SIZE_WIDTH 5
Ben Hutchingsa5150892008-09-01 12:48:55 +01001150#define SPI_DEV_TYPE_FIELD(type, field) \
1151 (((type) >> EFX_LOW_BIT(field)) & EFX_MASK32(EFX_WIDTH(field)))
Ben Hutchings4a5b5042008-09-01 12:47:16 +01001152
Ben Hutchings8c8661e2008-09-01 12:49:02 +01001153#define NVCONFIG_OFFSET 0x300
1154#define NVCONFIG_END 0x400
1155
Ben Hutchings8ceee662008-04-27 12:55:59 +01001156#define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C
1157struct falcon_nvconfig {
1158 efx_oword_t ee_vpd_cfg_reg; /* 0x300 */
1159 u8 mac_address[2][8]; /* 0x310 */
1160 efx_oword_t pcie_sd_ctl0123_reg; /* 0x320 */
1161 efx_oword_t pcie_sd_ctl45_reg; /* 0x330 */
1162 efx_oword_t pcie_pcs_ctl_stat_reg; /* 0x340 */
1163 efx_oword_t hw_init_reg; /* 0x350 */
1164 efx_oword_t nic_stat_reg; /* 0x360 */
1165 efx_oword_t glb_ctl_reg; /* 0x370 */
1166 efx_oword_t srm_cfg_reg; /* 0x380 */
1167 efx_oword_t spare_reg; /* 0x390 */
1168 __le16 board_magic_num; /* 0x3A0 */
1169 __le16 board_struct_ver;
1170 __le16 board_checksum;
1171 struct falcon_nvconfig_board_v2 board_v2;
Ben Hutchings4a5b5042008-09-01 12:47:16 +01001172 efx_oword_t ee_base_page_reg; /* 0x3B0 */
1173 struct falcon_nvconfig_board_v3 board_v3;
Ben Hutchings24c28ed2008-05-16 21:19:21 +01001174} __packed;
Ben Hutchings8ceee662008-04-27 12:55:59 +01001175
1176#endif /* EFX_FALCON_HWDEFS_H */