blob: 626735e73429135c858128adfb829dd461b25b84 [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
496/* GMAC registers */
497#define FALCON_GMAC_REGBANK 0xe00
498#define FALCON_GMAC_REGBANK_SIZE 0x200
499#define FALCON_GMAC_REG_SIZE 0x10
500
501/* XMAC registers */
502#define FALCON_XMAC_REGBANK 0x1200
503#define FALCON_XMAC_REGBANK_SIZE 0x200
504#define FALCON_XMAC_REG_SIZE 0x10
505
506/* XGMAC address register low */
507#define XM_ADR_LO_REG_MAC 0x00
508#define XM_ADR_3_LBN 24
509#define XM_ADR_3_WIDTH 8
510#define XM_ADR_2_LBN 16
511#define XM_ADR_2_WIDTH 8
512#define XM_ADR_1_LBN 8
513#define XM_ADR_1_WIDTH 8
514#define XM_ADR_0_LBN 0
515#define XM_ADR_0_WIDTH 8
516
517/* XGMAC address register high */
518#define XM_ADR_HI_REG_MAC 0x01
519#define XM_ADR_5_LBN 8
520#define XM_ADR_5_WIDTH 8
521#define XM_ADR_4_LBN 0
522#define XM_ADR_4_WIDTH 8
523
524/* XGMAC global configuration */
525#define XM_GLB_CFG_REG_MAC 0x02
526#define XM_RX_STAT_EN_LBN 11
527#define XM_RX_STAT_EN_WIDTH 1
528#define XM_TX_STAT_EN_LBN 10
529#define XM_TX_STAT_EN_WIDTH 1
530#define XM_RX_JUMBO_MODE_LBN 6
531#define XM_RX_JUMBO_MODE_WIDTH 1
532#define XM_INTCLR_MODE_LBN 3
533#define XM_INTCLR_MODE_WIDTH 1
534#define XM_CORE_RST_LBN 0
535#define XM_CORE_RST_WIDTH 1
536
537/* XGMAC transmit configuration */
538#define XM_TX_CFG_REG_MAC 0x03
539#define XM_IPG_LBN 16
540#define XM_IPG_WIDTH 4
541#define XM_FCNTL_LBN 10
542#define XM_FCNTL_WIDTH 1
543#define XM_TXCRC_LBN 8
544#define XM_TXCRC_WIDTH 1
545#define XM_AUTO_PAD_LBN 5
546#define XM_AUTO_PAD_WIDTH 1
547#define XM_TX_PRMBL_LBN 2
548#define XM_TX_PRMBL_WIDTH 1
549#define XM_TXEN_LBN 1
550#define XM_TXEN_WIDTH 1
551
552/* XGMAC receive configuration */
553#define XM_RX_CFG_REG_MAC 0x04
554#define XM_PASS_CRC_ERR_LBN 25
555#define XM_PASS_CRC_ERR_WIDTH 1
556#define XM_ACPT_ALL_MCAST_LBN 11
557#define XM_ACPT_ALL_MCAST_WIDTH 1
558#define XM_ACPT_ALL_UCAST_LBN 9
559#define XM_ACPT_ALL_UCAST_WIDTH 1
560#define XM_AUTO_DEPAD_LBN 8
561#define XM_AUTO_DEPAD_WIDTH 1
562#define XM_RXEN_LBN 1
563#define XM_RXEN_WIDTH 1
564
565/* XGMAC management interrupt mask register */
566#define XM_MGT_INT_MSK_REG_MAC_B0 0x5
567#define XM_MSK_PRMBLE_ERR_LBN 2
568#define XM_MSK_PRMBLE_ERR_WIDTH 1
569#define XM_MSK_RMTFLT_LBN 1
570#define XM_MSK_RMTFLT_WIDTH 1
571#define XM_MSK_LCLFLT_LBN 0
572#define XM_MSK_LCLFLT_WIDTH 1
573
574/* XGMAC flow control register */
575#define XM_FC_REG_MAC 0x7
576#define XM_PAUSE_TIME_LBN 16
577#define XM_PAUSE_TIME_WIDTH 16
578#define XM_DIS_FCNTL_LBN 0
579#define XM_DIS_FCNTL_WIDTH 1
580
581/* XGMAC pause time count register */
582#define XM_PAUSE_TIME_REG_MAC 0x9
583
584/* XGMAC transmit parameter register */
585#define XM_TX_PARAM_REG_MAC 0x0d
586#define XM_TX_JUMBO_MODE_LBN 31
587#define XM_TX_JUMBO_MODE_WIDTH 1
588#define XM_MAX_TX_FRM_SIZE_LBN 16
589#define XM_MAX_TX_FRM_SIZE_WIDTH 14
590
591/* XGMAC receive parameter register */
592#define XM_RX_PARAM_REG_MAC 0x0e
593#define XM_MAX_RX_FRM_SIZE_LBN 0
594#define XM_MAX_RX_FRM_SIZE_WIDTH 14
595
596/* XGMAC management interrupt status register */
597#define XM_MGT_INT_REG_MAC_B0 0x0f
598#define XM_PRMBLE_ERR 2
599#define XM_PRMBLE_WIDTH 1
600#define XM_RMTFLT_LBN 1
601#define XM_RMTFLT_WIDTH 1
602#define XM_LCLFLT_LBN 0
603#define XM_LCLFLT_WIDTH 1
604
605/* XGXS/XAUI powerdown/reset register */
606#define XX_PWR_RST_REG_MAC 0x10
607
608#define XX_PWRDND_EN_LBN 15
609#define XX_PWRDND_EN_WIDTH 1
610#define XX_PWRDNC_EN_LBN 14
611#define XX_PWRDNC_EN_WIDTH 1
612#define XX_PWRDNB_EN_LBN 13
613#define XX_PWRDNB_EN_WIDTH 1
614#define XX_PWRDNA_EN_LBN 12
615#define XX_PWRDNA_EN_WIDTH 1
616#define XX_RSTPLLCD_EN_LBN 9
617#define XX_RSTPLLCD_EN_WIDTH 1
618#define XX_RSTPLLAB_EN_LBN 8
619#define XX_RSTPLLAB_EN_WIDTH 1
620#define XX_RESETD_EN_LBN 7
621#define XX_RESETD_EN_WIDTH 1
622#define XX_RESETC_EN_LBN 6
623#define XX_RESETC_EN_WIDTH 1
624#define XX_RESETB_EN_LBN 5
625#define XX_RESETB_EN_WIDTH 1
626#define XX_RESETA_EN_LBN 4
627#define XX_RESETA_EN_WIDTH 1
628#define XX_RSTXGXSRX_EN_LBN 2
629#define XX_RSTXGXSRX_EN_WIDTH 1
630#define XX_RSTXGXSTX_EN_LBN 1
631#define XX_RSTXGXSTX_EN_WIDTH 1
632#define XX_RST_XX_EN_LBN 0
633#define XX_RST_XX_EN_WIDTH 1
634
635/* XGXS/XAUI powerdown/reset control register */
636#define XX_SD_CTL_REG_MAC 0x11
637#define XX_HIDRVD_LBN 15
638#define XX_HIDRVD_WIDTH 1
639#define XX_LODRVD_LBN 14
640#define XX_LODRVD_WIDTH 1
641#define XX_HIDRVC_LBN 13
642#define XX_HIDRVC_WIDTH 1
643#define XX_LODRVC_LBN 12
644#define XX_LODRVC_WIDTH 1
645#define XX_HIDRVB_LBN 11
646#define XX_HIDRVB_WIDTH 1
647#define XX_LODRVB_LBN 10
648#define XX_LODRVB_WIDTH 1
649#define XX_HIDRVA_LBN 9
650#define XX_HIDRVA_WIDTH 1
651#define XX_LODRVA_LBN 8
652#define XX_LODRVA_WIDTH 1
Ben Hutchings3273c2e2008-05-07 13:36:19 +0100653#define XX_LPBKD_LBN 3
654#define XX_LPBKD_WIDTH 1
655#define XX_LPBKC_LBN 2
656#define XX_LPBKC_WIDTH 1
657#define XX_LPBKB_LBN 1
658#define XX_LPBKB_WIDTH 1
659#define XX_LPBKA_LBN 0
660#define XX_LPBKA_WIDTH 1
Ben Hutchings8ceee662008-04-27 12:55:59 +0100661
662#define XX_TXDRV_CTL_REG_MAC 0x12
663#define XX_DEQD_LBN 28
664#define XX_DEQD_WIDTH 4
665#define XX_DEQC_LBN 24
666#define XX_DEQC_WIDTH 4
667#define XX_DEQB_LBN 20
668#define XX_DEQB_WIDTH 4
669#define XX_DEQA_LBN 16
670#define XX_DEQA_WIDTH 4
671#define XX_DTXD_LBN 12
672#define XX_DTXD_WIDTH 4
673#define XX_DTXC_LBN 8
674#define XX_DTXC_WIDTH 4
675#define XX_DTXB_LBN 4
676#define XX_DTXB_WIDTH 4
677#define XX_DTXA_LBN 0
678#define XX_DTXA_WIDTH 4
679
680/* XAUI XGXS core status register */
Ben Hutchings8ceee662008-04-27 12:55:59 +0100681#define XX_CORE_STAT_REG_MAC 0x16
Ben Hutchings3273c2e2008-05-07 13:36:19 +0100682#define XX_FORCE_SIG_LBN 24
683#define XX_FORCE_SIG_WIDTH 8
684#define XX_FORCE_SIG_DECODE_FORCED 0xff
685#define XX_XGXS_LB_EN_LBN 23
686#define XX_XGXS_LB_EN_WIDTH 1
687#define XX_XGMII_LB_EN_LBN 22
688#define XX_XGMII_LB_EN_WIDTH 1
Ben Hutchings8ceee662008-04-27 12:55:59 +0100689#define XX_ALIGN_DONE_LBN 20
690#define XX_ALIGN_DONE_WIDTH 1
691#define XX_SYNC_STAT_LBN 16
692#define XX_SYNC_STAT_WIDTH 4
693#define XX_SYNC_STAT_DECODE_SYNCED 0xf
694#define XX_COMMA_DET_LBN 12
695#define XX_COMMA_DET_WIDTH 4
696#define XX_COMMA_DET_DECODE_DETECTED 0xf
697#define XX_COMMA_DET_RESET 0xf
698#define XX_CHARERR_LBN 4
699#define XX_CHARERR_WIDTH 4
700#define XX_CHARERR_RESET 0xf
701#define XX_DISPERR_LBN 0
702#define XX_DISPERR_WIDTH 4
703#define XX_DISPERR_RESET 0xf
704
705/* Receive filter table */
706#define RX_FILTER_TBL0 0xF00000
707
708/* Receive descriptor pointer table */
709#define RX_DESC_PTR_TBL_KER_A1 0x11800
710#define RX_DESC_PTR_TBL_KER_B0 0xF40000
711#define RX_DESC_PTR_TBL_KER_P0 0x900
712#define RX_ISCSI_DDIG_EN_LBN 88
713#define RX_ISCSI_DDIG_EN_WIDTH 1
714#define RX_ISCSI_HDIG_EN_LBN 87
715#define RX_ISCSI_HDIG_EN_WIDTH 1
716#define RX_DESCQ_BUF_BASE_ID_LBN 36
717#define RX_DESCQ_BUF_BASE_ID_WIDTH 20
718#define RX_DESCQ_EVQ_ID_LBN 24
719#define RX_DESCQ_EVQ_ID_WIDTH 12
720#define RX_DESCQ_OWNER_ID_LBN 10
721#define RX_DESCQ_OWNER_ID_WIDTH 14
722#define RX_DESCQ_LABEL_LBN 5
723#define RX_DESCQ_LABEL_WIDTH 5
724#define RX_DESCQ_SIZE_LBN 3
725#define RX_DESCQ_SIZE_WIDTH 2
726#define RX_DESCQ_SIZE_4K 3
727#define RX_DESCQ_SIZE_2K 2
728#define RX_DESCQ_SIZE_1K 1
729#define RX_DESCQ_SIZE_512 0
730#define RX_DESCQ_TYPE_LBN 2
731#define RX_DESCQ_TYPE_WIDTH 1
732#define RX_DESCQ_JUMBO_LBN 1
733#define RX_DESCQ_JUMBO_WIDTH 1
734#define RX_DESCQ_EN_LBN 0
735#define RX_DESCQ_EN_WIDTH 1
736
737/* Transmit descriptor pointer table */
738#define TX_DESC_PTR_TBL_KER_A1 0x11900
739#define TX_DESC_PTR_TBL_KER_B0 0xF50000
740#define TX_DESC_PTR_TBL_KER_P0 0xa40
741#define TX_NON_IP_DROP_DIS_B0_LBN 91
742#define TX_NON_IP_DROP_DIS_B0_WIDTH 1
743#define TX_IP_CHKSM_DIS_B0_LBN 90
744#define TX_IP_CHKSM_DIS_B0_WIDTH 1
745#define TX_TCP_CHKSM_DIS_B0_LBN 89
746#define TX_TCP_CHKSM_DIS_B0_WIDTH 1
747#define TX_DESCQ_EN_LBN 88
748#define TX_DESCQ_EN_WIDTH 1
749#define TX_ISCSI_DDIG_EN_LBN 87
750#define TX_ISCSI_DDIG_EN_WIDTH 1
751#define TX_ISCSI_HDIG_EN_LBN 86
752#define TX_ISCSI_HDIG_EN_WIDTH 1
753#define TX_DESCQ_BUF_BASE_ID_LBN 36
754#define TX_DESCQ_BUF_BASE_ID_WIDTH 20
755#define TX_DESCQ_EVQ_ID_LBN 24
756#define TX_DESCQ_EVQ_ID_WIDTH 12
757#define TX_DESCQ_OWNER_ID_LBN 10
758#define TX_DESCQ_OWNER_ID_WIDTH 14
759#define TX_DESCQ_LABEL_LBN 5
760#define TX_DESCQ_LABEL_WIDTH 5
761#define TX_DESCQ_SIZE_LBN 3
762#define TX_DESCQ_SIZE_WIDTH 2
763#define TX_DESCQ_SIZE_4K 3
764#define TX_DESCQ_SIZE_2K 2
765#define TX_DESCQ_SIZE_1K 1
766#define TX_DESCQ_SIZE_512 0
767#define TX_DESCQ_TYPE_LBN 1
768#define TX_DESCQ_TYPE_WIDTH 2
769
770/* Event queue pointer */
771#define EVQ_PTR_TBL_KER_A1 0x11a00
772#define EVQ_PTR_TBL_KER_B0 0xf60000
773#define EVQ_PTR_TBL_KER_P0 0x500
774#define EVQ_EN_LBN 23
775#define EVQ_EN_WIDTH 1
776#define EVQ_SIZE_LBN 20
777#define EVQ_SIZE_WIDTH 3
778#define EVQ_SIZE_32K 6
779#define EVQ_SIZE_16K 5
780#define EVQ_SIZE_8K 4
781#define EVQ_SIZE_4K 3
782#define EVQ_SIZE_2K 2
783#define EVQ_SIZE_1K 1
784#define EVQ_SIZE_512 0
785#define EVQ_BUF_BASE_ID_LBN 0
786#define EVQ_BUF_BASE_ID_WIDTH 20
787
788/* Event queue read pointer */
789#define EVQ_RPTR_REG_KER_A1 0x11b00
790#define EVQ_RPTR_REG_KER_B0 0xfa0000
791#define EVQ_RPTR_REG_KER_DWORD (EVQ_RPTR_REG_KER + 0)
792#define EVQ_RPTR_DWORD_LBN 0
793#define EVQ_RPTR_DWORD_WIDTH 14
794
795/* RSS indirection table */
796#define RX_RSS_INDIR_TBL_B0 0xFB0000
797#define RX_RSS_INDIR_ENT_B0_LBN 0
798#define RX_RSS_INDIR_ENT_B0_WIDTH 6
799
800/* Special buffer descriptors (full-mode) */
801#define BUF_FULL_TBL_KER_A1 0x8000
802#define BUF_FULL_TBL_KER_B0 0x800000
803#define IP_DAT_BUF_SIZE_LBN 50
804#define IP_DAT_BUF_SIZE_WIDTH 1
805#define IP_DAT_BUF_SIZE_8K 1
806#define IP_DAT_BUF_SIZE_4K 0
807#define BUF_ADR_REGION_LBN 48
808#define BUF_ADR_REGION_WIDTH 2
809#define BUF_ADR_FBUF_LBN 14
810#define BUF_ADR_FBUF_WIDTH 34
811#define BUF_OWNER_ID_FBUF_LBN 0
812#define BUF_OWNER_ID_FBUF_WIDTH 14
813
814/* Transmit descriptor */
815#define TX_KER_PORT_LBN 63
816#define TX_KER_PORT_WIDTH 1
817#define TX_KER_CONT_LBN 62
818#define TX_KER_CONT_WIDTH 1
819#define TX_KER_BYTE_CNT_LBN 48
820#define TX_KER_BYTE_CNT_WIDTH 14
821#define TX_KER_BUF_REGION_LBN 46
822#define TX_KER_BUF_REGION_WIDTH 2
823#define TX_KER_BUF_REGION0_DECODE 0
824#define TX_KER_BUF_REGION1_DECODE 1
825#define TX_KER_BUF_REGION2_DECODE 2
826#define TX_KER_BUF_REGION3_DECODE 3
827#define TX_KER_BUF_ADR_LBN 0
828#define TX_KER_BUF_ADR_WIDTH EFX_DMA_TYPE_WIDTH(46)
829
830/* Receive descriptor */
831#define RX_KER_BUF_SIZE_LBN 48
832#define RX_KER_BUF_SIZE_WIDTH 14
833#define RX_KER_BUF_REGION_LBN 46
834#define RX_KER_BUF_REGION_WIDTH 2
835#define RX_KER_BUF_REGION0_DECODE 0
836#define RX_KER_BUF_REGION1_DECODE 1
837#define RX_KER_BUF_REGION2_DECODE 2
838#define RX_KER_BUF_REGION3_DECODE 3
839#define RX_KER_BUF_ADR_LBN 0
840#define RX_KER_BUF_ADR_WIDTH EFX_DMA_TYPE_WIDTH(46)
841
842/**************************************************************************
843 *
844 * Falcon events
845 *
846 **************************************************************************
847 */
848
849/* Event queue entries */
850#define EV_CODE_LBN 60
851#define EV_CODE_WIDTH 4
852#define RX_IP_EV_DECODE 0
853#define TX_IP_EV_DECODE 2
854#define DRIVER_EV_DECODE 5
855#define GLOBAL_EV_DECODE 6
856#define DRV_GEN_EV_DECODE 7
857#define WHOLE_EVENT_LBN 0
858#define WHOLE_EVENT_WIDTH 64
859
860/* Receive events */
861#define RX_EV_PKT_OK_LBN 56
862#define RX_EV_PKT_OK_WIDTH 1
863#define RX_EV_PAUSE_FRM_ERR_LBN 55
864#define RX_EV_PAUSE_FRM_ERR_WIDTH 1
865#define RX_EV_BUF_OWNER_ID_ERR_LBN 54
866#define RX_EV_BUF_OWNER_ID_ERR_WIDTH 1
867#define RX_EV_IF_FRAG_ERR_LBN 53
868#define RX_EV_IF_FRAG_ERR_WIDTH 1
869#define RX_EV_IP_HDR_CHKSUM_ERR_LBN 52
870#define RX_EV_IP_HDR_CHKSUM_ERR_WIDTH 1
871#define RX_EV_TCP_UDP_CHKSUM_ERR_LBN 51
872#define RX_EV_TCP_UDP_CHKSUM_ERR_WIDTH 1
873#define RX_EV_ETH_CRC_ERR_LBN 50
874#define RX_EV_ETH_CRC_ERR_WIDTH 1
875#define RX_EV_FRM_TRUNC_LBN 49
876#define RX_EV_FRM_TRUNC_WIDTH 1
877#define RX_EV_DRIB_NIB_LBN 48
878#define RX_EV_DRIB_NIB_WIDTH 1
879#define RX_EV_TOBE_DISC_LBN 47
880#define RX_EV_TOBE_DISC_WIDTH 1
881#define RX_EV_PKT_TYPE_LBN 44
882#define RX_EV_PKT_TYPE_WIDTH 3
883#define RX_EV_PKT_TYPE_ETH_DECODE 0
884#define RX_EV_PKT_TYPE_LLC_DECODE 1
885#define RX_EV_PKT_TYPE_JUMBO_DECODE 2
886#define RX_EV_PKT_TYPE_VLAN_DECODE 3
887#define RX_EV_PKT_TYPE_VLAN_LLC_DECODE 4
888#define RX_EV_PKT_TYPE_VLAN_JUMBO_DECODE 5
889#define RX_EV_HDR_TYPE_LBN 42
890#define RX_EV_HDR_TYPE_WIDTH 2
891#define RX_EV_HDR_TYPE_TCP_IPV4_DECODE 0
892#define RX_EV_HDR_TYPE_UDP_IPV4_DECODE 1
893#define RX_EV_HDR_TYPE_OTHER_IP_DECODE 2
894#define RX_EV_HDR_TYPE_NON_IP_DECODE 3
895#define RX_EV_HDR_TYPE_HAS_CHECKSUMS(hdr_type) \
896 ((hdr_type) <= RX_EV_HDR_TYPE_UDP_IPV4_DECODE)
897#define RX_EV_MCAST_HASH_MATCH_LBN 40
898#define RX_EV_MCAST_HASH_MATCH_WIDTH 1
899#define RX_EV_MCAST_PKT_LBN 39
900#define RX_EV_MCAST_PKT_WIDTH 1
901#define RX_EV_Q_LABEL_LBN 32
902#define RX_EV_Q_LABEL_WIDTH 5
903#define RX_EV_JUMBO_CONT_LBN 31
904#define RX_EV_JUMBO_CONT_WIDTH 1
905#define RX_EV_BYTE_CNT_LBN 16
906#define RX_EV_BYTE_CNT_WIDTH 14
907#define RX_EV_SOP_LBN 15
908#define RX_EV_SOP_WIDTH 1
909#define RX_EV_DESC_PTR_LBN 0
910#define RX_EV_DESC_PTR_WIDTH 12
911
912/* Transmit events */
913#define TX_EV_PKT_ERR_LBN 38
914#define TX_EV_PKT_ERR_WIDTH 1
915#define TX_EV_Q_LABEL_LBN 32
916#define TX_EV_Q_LABEL_WIDTH 5
917#define TX_EV_WQ_FF_FULL_LBN 15
918#define TX_EV_WQ_FF_FULL_WIDTH 1
919#define TX_EV_COMP_LBN 12
920#define TX_EV_COMP_WIDTH 1
921#define TX_EV_DESC_PTR_LBN 0
922#define TX_EV_DESC_PTR_WIDTH 12
923
924/* Driver events */
925#define DRIVER_EV_SUB_CODE_LBN 56
926#define DRIVER_EV_SUB_CODE_WIDTH 4
927#define DRIVER_EV_SUB_DATA_LBN 0
928#define DRIVER_EV_SUB_DATA_WIDTH 14
929#define TX_DESCQ_FLS_DONE_EV_DECODE 0
930#define RX_DESCQ_FLS_DONE_EV_DECODE 1
931#define EVQ_INIT_DONE_EV_DECODE 2
932#define EVQ_NOT_EN_EV_DECODE 3
933#define RX_DESCQ_FLSFF_OVFL_EV_DECODE 4
934#define SRM_UPD_DONE_EV_DECODE 5
935#define WAKE_UP_EV_DECODE 6
936#define TX_PKT_NON_TCP_UDP_DECODE 9
937#define TIMER_EV_DECODE 10
938#define RX_RECOVERY_EV_DECODE 11
939#define RX_DSC_ERROR_EV_DECODE 14
940#define TX_DSC_ERROR_EV_DECODE 15
941#define DRIVER_EV_TX_DESCQ_ID_LBN 0
942#define DRIVER_EV_TX_DESCQ_ID_WIDTH 12
943#define DRIVER_EV_RX_FLUSH_FAIL_LBN 12
944#define DRIVER_EV_RX_FLUSH_FAIL_WIDTH 1
945#define DRIVER_EV_RX_DESCQ_ID_LBN 0
946#define DRIVER_EV_RX_DESCQ_ID_WIDTH 12
947#define SRM_CLR_EV_DECODE 0
948#define SRM_UPD_EV_DECODE 1
949#define SRM_ILLCLR_EV_DECODE 2
950
951/* Global events */
952#define RX_RECOVERY_B0_LBN 12
953#define RX_RECOVERY_B0_WIDTH 1
954#define XG_MNT_INTR_B0_LBN 11
955#define XG_MNT_INTR_B0_WIDTH 1
956#define RX_RECOVERY_A1_LBN 11
957#define RX_RECOVERY_A1_WIDTH 1
958#define XG_PHY_INTR_LBN 9
959#define XG_PHY_INTR_WIDTH 1
960#define G_PHY1_INTR_LBN 8
961#define G_PHY1_INTR_WIDTH 1
962#define G_PHY0_INTR_LBN 7
963#define G_PHY0_INTR_WIDTH 1
964
965/* Driver-generated test events */
966#define EVQ_MAGIC_LBN 0
967#define EVQ_MAGIC_WIDTH 32
968
969/**************************************************************************
970 *
971 * Falcon MAC stats
972 *
973 **************************************************************************
974 *
975 */
976#define GRxGoodOct_offset 0x0
977#define GRxBadOct_offset 0x8
978#define GRxMissPkt_offset 0x10
979#define GRxFalseCRS_offset 0x14
980#define GRxPausePkt_offset 0x18
981#define GRxBadPkt_offset 0x1C
982#define GRxUcastPkt_offset 0x20
983#define GRxMcastPkt_offset 0x24
984#define GRxBcastPkt_offset 0x28
985#define GRxGoodLt64Pkt_offset 0x2C
986#define GRxBadLt64Pkt_offset 0x30
987#define GRx64Pkt_offset 0x34
988#define GRx65to127Pkt_offset 0x38
989#define GRx128to255Pkt_offset 0x3C
990#define GRx256to511Pkt_offset 0x40
991#define GRx512to1023Pkt_offset 0x44
992#define GRx1024to15xxPkt_offset 0x48
993#define GRx15xxtoJumboPkt_offset 0x4C
994#define GRxGtJumboPkt_offset 0x50
995#define GRxFcsErr64to15xxPkt_offset 0x54
996#define GRxFcsErr15xxtoJumboPkt_offset 0x58
997#define GRxFcsErrGtJumboPkt_offset 0x5C
998#define GTxGoodBadOct_offset 0x80
999#define GTxGoodOct_offset 0x88
1000#define GTxSglColPkt_offset 0x90
1001#define GTxMultColPkt_offset 0x94
1002#define GTxExColPkt_offset 0x98
1003#define GTxDefPkt_offset 0x9C
1004#define GTxLateCol_offset 0xA0
1005#define GTxExDefPkt_offset 0xA4
1006#define GTxPausePkt_offset 0xA8
1007#define GTxBadPkt_offset 0xAC
1008#define GTxUcastPkt_offset 0xB0
1009#define GTxMcastPkt_offset 0xB4
1010#define GTxBcastPkt_offset 0xB8
1011#define GTxLt64Pkt_offset 0xBC
1012#define GTx64Pkt_offset 0xC0
1013#define GTx65to127Pkt_offset 0xC4
1014#define GTx128to255Pkt_offset 0xC8
1015#define GTx256to511Pkt_offset 0xCC
1016#define GTx512to1023Pkt_offset 0xD0
1017#define GTx1024to15xxPkt_offset 0xD4
1018#define GTx15xxtoJumboPkt_offset 0xD8
1019#define GTxGtJumboPkt_offset 0xDC
1020#define GTxNonTcpUdpPkt_offset 0xE0
1021#define GTxMacSrcErrPkt_offset 0xE4
1022#define GTxIpSrcErrPkt_offset 0xE8
1023#define GDmaDone_offset 0xEC
1024
1025#define XgRxOctets_offset 0x0
1026#define XgRxOctets_WIDTH 48
1027#define XgRxOctetsOK_offset 0x8
1028#define XgRxOctetsOK_WIDTH 48
1029#define XgRxPkts_offset 0x10
1030#define XgRxPkts_WIDTH 32
1031#define XgRxPktsOK_offset 0x14
1032#define XgRxPktsOK_WIDTH 32
1033#define XgRxBroadcastPkts_offset 0x18
1034#define XgRxBroadcastPkts_WIDTH 32
1035#define XgRxMulticastPkts_offset 0x1C
1036#define XgRxMulticastPkts_WIDTH 32
1037#define XgRxUnicastPkts_offset 0x20
1038#define XgRxUnicastPkts_WIDTH 32
1039#define XgRxUndersizePkts_offset 0x24
1040#define XgRxUndersizePkts_WIDTH 32
1041#define XgRxOversizePkts_offset 0x28
1042#define XgRxOversizePkts_WIDTH 32
1043#define XgRxJabberPkts_offset 0x2C
1044#define XgRxJabberPkts_WIDTH 32
1045#define XgRxUndersizeFCSerrorPkts_offset 0x30
1046#define XgRxUndersizeFCSerrorPkts_WIDTH 32
1047#define XgRxDropEvents_offset 0x34
1048#define XgRxDropEvents_WIDTH 32
1049#define XgRxFCSerrorPkts_offset 0x38
1050#define XgRxFCSerrorPkts_WIDTH 32
1051#define XgRxAlignError_offset 0x3C
1052#define XgRxAlignError_WIDTH 32
1053#define XgRxSymbolError_offset 0x40
1054#define XgRxSymbolError_WIDTH 32
1055#define XgRxInternalMACError_offset 0x44
1056#define XgRxInternalMACError_WIDTH 32
1057#define XgRxControlPkts_offset 0x48
1058#define XgRxControlPkts_WIDTH 32
1059#define XgRxPausePkts_offset 0x4C
1060#define XgRxPausePkts_WIDTH 32
1061#define XgRxPkts64Octets_offset 0x50
1062#define XgRxPkts64Octets_WIDTH 32
1063#define XgRxPkts65to127Octets_offset 0x54
1064#define XgRxPkts65to127Octets_WIDTH 32
1065#define XgRxPkts128to255Octets_offset 0x58
1066#define XgRxPkts128to255Octets_WIDTH 32
1067#define XgRxPkts256to511Octets_offset 0x5C
1068#define XgRxPkts256to511Octets_WIDTH 32
1069#define XgRxPkts512to1023Octets_offset 0x60
1070#define XgRxPkts512to1023Octets_WIDTH 32
1071#define XgRxPkts1024to15xxOctets_offset 0x64
1072#define XgRxPkts1024to15xxOctets_WIDTH 32
1073#define XgRxPkts15xxtoMaxOctets_offset 0x68
1074#define XgRxPkts15xxtoMaxOctets_WIDTH 32
1075#define XgRxLengthError_offset 0x6C
1076#define XgRxLengthError_WIDTH 32
1077#define XgTxPkts_offset 0x80
1078#define XgTxPkts_WIDTH 32
1079#define XgTxOctets_offset 0x88
1080#define XgTxOctets_WIDTH 48
1081#define XgTxMulticastPkts_offset 0x90
1082#define XgTxMulticastPkts_WIDTH 32
1083#define XgTxBroadcastPkts_offset 0x94
1084#define XgTxBroadcastPkts_WIDTH 32
1085#define XgTxUnicastPkts_offset 0x98
1086#define XgTxUnicastPkts_WIDTH 32
1087#define XgTxControlPkts_offset 0x9C
1088#define XgTxControlPkts_WIDTH 32
1089#define XgTxPausePkts_offset 0xA0
1090#define XgTxPausePkts_WIDTH 32
1091#define XgTxPkts64Octets_offset 0xA4
1092#define XgTxPkts64Octets_WIDTH 32
1093#define XgTxPkts65to127Octets_offset 0xA8
1094#define XgTxPkts65to127Octets_WIDTH 32
1095#define XgTxPkts128to255Octets_offset 0xAC
1096#define XgTxPkts128to255Octets_WIDTH 32
1097#define XgTxPkts256to511Octets_offset 0xB0
1098#define XgTxPkts256to511Octets_WIDTH 32
1099#define XgTxPkts512to1023Octets_offset 0xB4
1100#define XgTxPkts512to1023Octets_WIDTH 32
1101#define XgTxPkts1024to15xxOctets_offset 0xB8
1102#define XgTxPkts1024to15xxOctets_WIDTH 32
1103#define XgTxPkts1519toMaxOctets_offset 0xBC
1104#define XgTxPkts1519toMaxOctets_WIDTH 32
1105#define XgTxUndersizePkts_offset 0xC0
1106#define XgTxUndersizePkts_WIDTH 32
1107#define XgTxOversizePkts_offset 0xC4
1108#define XgTxOversizePkts_WIDTH 32
1109#define XgTxNonTcpUdpPkt_offset 0xC8
1110#define XgTxNonTcpUdpPkt_WIDTH 16
1111#define XgTxMacSrcErrPkt_offset 0xCC
1112#define XgTxMacSrcErrPkt_WIDTH 16
1113#define XgTxIpSrcErrPkt_offset 0xD0
1114#define XgTxIpSrcErrPkt_WIDTH 16
1115#define XgDmaDone_offset 0xD4
1116
1117#define FALCON_STATS_NOT_DONE 0x00000000
1118#define FALCON_STATS_DONE 0xffffffff
1119
1120/* Interrupt status register bits */
1121#define FATAL_INT_LBN 64
1122#define FATAL_INT_WIDTH 1
1123#define INT_EVQS_LBN 40
1124#define INT_EVQS_WIDTH 4
1125
1126/**************************************************************************
1127 *
1128 * Falcon non-volatile configuration
1129 *
1130 **************************************************************************
1131 */
1132
1133/* Board configuration v2 (v1 is obsolete; later versions are compatible) */
1134struct falcon_nvconfig_board_v2 {
1135 __le16 nports;
1136 u8 port0_phy_addr;
1137 u8 port0_phy_type;
1138 u8 port1_phy_addr;
1139 u8 port1_phy_type;
1140 __le16 asic_sub_revision;
1141 __le16 board_revision;
Ben Hutchings24c28ed2008-05-16 21:19:21 +01001142} __packed;
Ben Hutchings8ceee662008-04-27 12:55:59 +01001143
Ben Hutchings4a5b5042008-09-01 12:47:16 +01001144/* Board configuration v3 extra information */
1145struct falcon_nvconfig_board_v3 {
1146 __le32 spi_device_type[2];
1147} __packed;
1148
1149/* Bit numbers for spi_device_type */
1150#define SPI_DEV_TYPE_SIZE_LBN 0
1151#define SPI_DEV_TYPE_SIZE_WIDTH 5
1152#define SPI_DEV_TYPE_ADDR_LEN_LBN 6
1153#define SPI_DEV_TYPE_ADDR_LEN_WIDTH 2
1154#define SPI_DEV_TYPE_ERASE_CMD_LBN 8
1155#define SPI_DEV_TYPE_ERASE_CMD_WIDTH 8
1156#define SPI_DEV_TYPE_ERASE_SIZE_LBN 16
1157#define SPI_DEV_TYPE_ERASE_SIZE_WIDTH 5
1158#define SPI_DEV_TYPE_BLOCK_SIZE_LBN 24
1159#define SPI_DEV_TYPE_BLOCK_SIZE_WIDTH 5
1160#define SPI_DEV_TYPE_FIELD(type, field) \
1161 (((type) >> EFX_LOW_BIT(field)) & EFX_MASK32(field))
1162
Ben Hutchings8ceee662008-04-27 12:55:59 +01001163#define NVCONFIG_BASE 0x300
1164#define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C
1165struct falcon_nvconfig {
1166 efx_oword_t ee_vpd_cfg_reg; /* 0x300 */
1167 u8 mac_address[2][8]; /* 0x310 */
1168 efx_oword_t pcie_sd_ctl0123_reg; /* 0x320 */
1169 efx_oword_t pcie_sd_ctl45_reg; /* 0x330 */
1170 efx_oword_t pcie_pcs_ctl_stat_reg; /* 0x340 */
1171 efx_oword_t hw_init_reg; /* 0x350 */
1172 efx_oword_t nic_stat_reg; /* 0x360 */
1173 efx_oword_t glb_ctl_reg; /* 0x370 */
1174 efx_oword_t srm_cfg_reg; /* 0x380 */
1175 efx_oword_t spare_reg; /* 0x390 */
1176 __le16 board_magic_num; /* 0x3A0 */
1177 __le16 board_struct_ver;
1178 __le16 board_checksum;
1179 struct falcon_nvconfig_board_v2 board_v2;
Ben Hutchings4a5b5042008-09-01 12:47:16 +01001180 efx_oword_t ee_base_page_reg; /* 0x3B0 */
1181 struct falcon_nvconfig_board_v3 board_v3;
Ben Hutchings24c28ed2008-05-16 21:19:21 +01001182} __packed;
Ben Hutchings8ceee662008-04-27 12:55:59 +01001183
1184#endif /* EFX_FALCON_HWDEFS_H */