if_wmreg.h revision 1.60.2.7 1 /* $NetBSD: if_wmreg.h,v 1.60.2.7 2016/12/18 07:53:09 snj Exp $ */
2
3 /*
4 * Copyright (c) 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by
20 * Wasabi Systems, Inc.
21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 * or promote products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 /******************************************************************************
39
40 Copyright (c) 2001-2012, Intel Corporation
41 All rights reserved.
42
43 Redistribution and use in source and binary forms, with or without
44 modification, are permitted provided that the following conditions are met:
45
46 1. Redistributions of source code must retain the above copyright notice,
47 this list of conditions and the following disclaimer.
48
49 2. Redistributions in binary form must reproduce the above copyright
50 notice, this list of conditions and the following disclaimer in the
51 documentation and/or other materials provided with the distribution.
52
53 3. Neither the name of the Intel Corporation nor the names of its
54 contributors may be used to endorse or promote products derived from
55 this software without specific prior written permission.
56
57 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
58 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
61 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
67 POSSIBILITY OF SUCH DAMAGE.
68
69 ******************************************************************************/
70
71 /*
72 * Register description for the Intel i82542 (``Wiseman''),
73 * i82543 (``Livengood''), and i82544 (``Cordova'') Gigabit
74 * Ethernet chips.
75 */
76
77 /*
78 * The wiseman supports 64-bit PCI addressing. This structure
79 * describes the address in descriptors.
80 */
81 typedef struct wiseman_addr {
82 uint32_t wa_low; /* low-order 32 bits */
83 uint32_t wa_high; /* high-order 32 bits */
84 } __packed wiseman_addr_t;
85
86 /*
87 * The Wiseman receive descriptor.
88 *
89 * The receive descriptor ring must be aligned to a 4K boundary,
90 * and there must be an even multiple of 8 descriptors in the ring.
91 */
92 typedef struct wiseman_rxdesc {
93 volatile wiseman_addr_t wrx_addr; /* buffer address */
94
95 volatile uint16_t wrx_len; /* buffer length */
96 volatile uint16_t wrx_cksum; /* checksum (starting at PCSS)*/
97
98 volatile uint8_t wrx_status; /* Rx status */
99 volatile uint8_t wrx_errors; /* Rx errors */
100 volatile uint16_t wrx_special; /* special field (VLAN, etc.) */
101 } __packed wiseman_rxdesc_t;
102
103 /* wrx_status bits */
104 #define WRX_ST_DD (1U << 0) /* descriptor done */
105 #define WRX_ST_EOP (1U << 1) /* end of packet */
106 #define WRX_ST_IXSM (1U << 2) /* ignore checksum indication */
107 #define WRX_ST_VP (1U << 3) /* VLAN packet */
108 #define WRX_ST_BPDU (1U << 4) /* ??? */
109 #define WRX_ST_TCPCS (1U << 5) /* TCP checksum performed */
110 #define WRX_ST_IPCS (1U << 6) /* IP checksum performed */
111 #define WRX_ST_PIF (1U << 7) /* passed in-exact filter */
112
113 /* wrx_error bits */
114 #define WRX_ER_CE (1U << 0) /* CRC error */
115 #define WRX_ER_SE (1U << 1) /* symbol error */
116 #define WRX_ER_SEQ (1U << 2) /* sequence error */
117 #define WRX_ER_ICE (1U << 3) /* ??? */
118 #define WRX_ER_CXE (1U << 4) /* carrier extension error */
119 #define WRX_ER_TCPE (1U << 5) /* TCP checksum error */
120 #define WRX_ER_IPE (1U << 6) /* IP checksum error */
121 #define WRX_ER_RXE (1U << 7) /* Rx data error */
122
123 /* wrx_special field for VLAN packets */
124 #define WRX_VLAN_ID(x) ((x) & 0x0fff) /* VLAN identifier */
125 #define WRX_VLAN_CFI (1U << 12) /* Canonical Form Indicator */
126 #define WRX_VLAN_PRI(x) (((x) >> 13) & 7)/* VLAN priority field */
127
128 /*
129 * The Wiseman transmit descriptor.
130 *
131 * The transmit descriptor ring must be aligned to a 4K boundary,
132 * and there must be an even multiple of 8 descriptors in the ring.
133 */
134 typedef struct wiseman_tx_fields {
135 uint8_t wtxu_status; /* Tx status */
136 uint8_t wtxu_options; /* options */
137 uint16_t wtxu_vlan; /* VLAN info */
138 } __packed wiseman_txfields_t;
139 typedef struct wiseman_txdesc {
140 wiseman_addr_t wtx_addr; /* buffer address */
141 uint32_t wtx_cmdlen; /* command and length */
142 wiseman_txfields_t wtx_fields; /* fields; see below */
143 } __packed wiseman_txdesc_t;
144
145 /* Commands for wtx_cmdlen */
146 #define WTX_CMD_EOP (1U << 24) /* end of packet */
147 #define WTX_CMD_IFCS (1U << 25) /* insert FCS */
148 #define WTX_CMD_RS (1U << 27) /* report status */
149 #define WTX_CMD_RPS (1U << 28) /* report packet sent */
150 #define WTX_CMD_DEXT (1U << 29) /* descriptor extension */
151 #define WTX_CMD_VLE (1U << 30) /* VLAN enable */
152 #define WTX_CMD_IDE (1U << 31) /* interrupt delay enable */
153
154 /* Descriptor types (if DEXT is set) */
155 #define WTX_DTYP_C (0U << 20) /* context */
156 #define WTX_DTYP_D (1U << 20) /* data */
157
158 /* wtx_fields status bits */
159 #define WTX_ST_DD (1U << 0) /* descriptor done */
160 #define WTX_ST_EC (1U << 1) /* excessive collisions */
161 #define WTX_ST_LC (1U << 2) /* late collision */
162 #define WTX_ST_TU (1U << 3) /* transmit underrun */
163
164 /* wtx_fields option bits for IP/TCP/UDP checksum offload */
165 #define WTX_IXSM (1U << 0) /* IP checksum offload */
166 #define WTX_TXSM (1U << 1) /* TCP/UDP checksum offload */
167
168 /* Maximum payload per Tx descriptor */
169 #define WTX_MAX_LEN 4096
170
171 /*
172 * The Livengood TCP/IP context descriptor.
173 */
174 struct livengood_tcpip_ctxdesc {
175 uint32_t tcpip_ipcs; /* IP checksum context */
176 uint32_t tcpip_tucs; /* TCP/UDP checksum context */
177 uint32_t tcpip_cmdlen;
178 uint32_t tcpip_seg; /* TCP segmentation context */
179 };
180
181 /* commands for context descriptors */
182 #define WTX_TCPIP_CMD_TCP (1U << 24) /* 1 = TCP, 0 = UDP */
183 #define WTX_TCPIP_CMD_IP (1U << 25) /* 1 = IPv4, 0 = IPv6 */
184 #define WTX_TCPIP_CMD_TSE (1U << 26) /* segmentation context valid */
185
186 #define WTX_TCPIP_IPCSS(x) ((x) << 0) /* checksum start */
187 #define WTX_TCPIP_IPCSO(x) ((x) << 8) /* checksum value offset */
188 #define WTX_TCPIP_IPCSE(x) ((x) << 16) /* checksum end */
189
190 #define WTX_TCPIP_TUCSS(x) ((x) << 0) /* checksum start */
191 #define WTX_TCPIP_TUCSO(x) ((x) << 8) /* checksum value offset */
192 #define WTX_TCPIP_TUCSE(x) ((x) << 16) /* checksum end */
193
194 #define WTX_TCPIP_SEG_STATUS(x) ((x) << 0)
195 #define WTX_TCPIP_SEG_HDRLEN(x) ((x) << 8)
196 #define WTX_TCPIP_SEG_MSS(x) ((x) << 16)
197
198 /*
199 * PCI config registers used by the Wiseman.
200 */
201 #define WM_PCI_MMBA PCI_MAPREG_START
202 /* registers for FLASH access on ICH8 */
203 #define WM_ICH8_FLASH 0x0014
204
205 #define WM_PCI_LTR_CAP_LPT 0xa8
206
207 /* XXX Only for PCH_SPT? */
208 #define WM_PCI_DESCRING_STATUS 0xe4
209 #define DESCRING_STATUS_FLUSH_REQ __BIT(8)
210
211 /*
212 * Wiseman Control/Status Registers.
213 */
214 #define WMREG_CTRL 0x0000 /* Device Control Register */
215 #define CTRL_FD (1U << 0) /* full duplex */
216 #define CTRL_BEM (1U << 1) /* big-endian mode */
217 #define CTRL_PRIOR (1U << 2) /* 0 = receive, 1 = fair */
218 #define CTRL_GIO_M_DIS (1U << 2) /* disabl PCI master access */
219 #define CTRL_LRST (1U << 3) /* link reset */
220 #define CTRL_ASDE (1U << 5) /* auto speed detect enable */
221 #define CTRL_SLU (1U << 6) /* set link up */
222 #define CTRL_ILOS (1U << 7) /* invert loss of signal */
223 #define CTRL_SPEED(x) ((x) << 8) /* speed (Livengood) */
224 #define CTRL_SPEED_10 CTRL_SPEED(0)
225 #define CTRL_SPEED_100 CTRL_SPEED(1)
226 #define CTRL_SPEED_1000 CTRL_SPEED(2)
227 #define CTRL_SPEED_MASK CTRL_SPEED(3)
228 #define CTRL_FRCSPD (1U << 11) /* force speed (Livengood) */
229 #define CTRL_FRCFDX (1U << 12) /* force full-duplex (Livengood) */
230 #define CTRL_D_UD_EN (1U << 13) /* Dock/Undock enable */
231 #define CTRL_D_UD_POL (1U << 14) /* Defined polarity of Dock/Undock indication in SDP[0] */
232 #define CTRL_F_PHY_R (1U << 15) /* Reset both PHY ports, through PHYRST_N pin */
233 #define CTRL_EXT_LINK_EN (1U << 16) /* enable link status from external LINK_0 and LINK_1 pins */
234 #define CTRL_LANPHYPC_OVERRIDE (1U << 16) /* SW control of LANPHYPC */
235 #define CTRL_LANPHYPC_VALUE (1U << 17) /* SW value of LANPHYPC */
236 #define CTRL_SWDPINS_SHIFT 18
237 #define CTRL_SWDPINS_MASK 0x0f
238 #define CTRL_SWDPIN(x) (1U << (CTRL_SWDPINS_SHIFT + (x)))
239 #define CTRL_SWDPIO_SHIFT 22
240 #define CTRL_SWDPIO_MASK 0x0f
241 #define CTRL_SWDPIO(x) (1U << (CTRL_SWDPIO_SHIFT + (x)))
242 #define CTRL_MEHE (1U << 19) /* Memory Error Handling Enable(I217)*/
243 #define CTRL_RST (1U << 26) /* device reset */
244 #define CTRL_RFCE (1U << 27) /* Rx flow control enable */
245 #define CTRL_TFCE (1U << 28) /* Tx flow control enable */
246 #define CTRL_VME (1U << 30) /* VLAN Mode Enable */
247 #define CTRL_PHY_RESET (1U << 31) /* PHY reset (Cordova) */
248
249 #define WMREG_CTRL_SHADOW 0x0004 /* Device Control Register (shadow) */
250
251 #define WMREG_STATUS 0x0008 /* Device Status Register */
252 #define STATUS_FD (1U << 0) /* full duplex */
253 #define STATUS_LU (1U << 1) /* link up */
254 #define STATUS_TCKOK (1U << 2) /* Tx clock running */
255 #define STATUS_RBCOK (1U << 3) /* Rx clock running */
256 #define STATUS_FUNCID_SHIFT 2 /* 82546 function ID */
257 #define STATUS_FUNCID_MASK 3 /* ... */
258 #define STATUS_TXOFF (1U << 4) /* Tx paused */
259 #define STATUS_TBIMODE (1U << 5) /* fiber mode (Livengood) */
260 #define STATUS_SPEED __BITS(7, 6) /* speed indication */
261 #define STATUS_SPEED_10 0
262 #define STATUS_SPEED_100 1
263 #define STATUS_SPEED_1000 2
264 #define STATUS_ASDV(x) ((x) << 8) /* auto speed det. val. (Livengood) */
265 #define STATUS_LAN_INIT_DONE (1U << 9) /* Lan Init Completion by NVM */
266 #define STATUS_MTXCKOK (1U << 10) /* MTXD clock running */
267 #define STATUS_PHYRA (1U << 10) /* PHY Reset Asserted (PCH) */
268 #define STATUS_PCI66 (1U << 11) /* 66MHz bus (Livengood) */
269 #define STATUS_BUS64 (1U << 12) /* 64-bit bus (Livengood) */
270 #define STATUS_2P5_SKU __BIT(12) /* Value of the 2.5GBE SKU strap */
271 #define STATUS_PCIX_MODE (1U << 13) /* PCIX mode (Cordova) */
272 #define STATUS_2P5_SKU_OVER __BIT(13) /* Value of the 2.5GBE SKU override */
273 #define STATUS_PCIXSPD(x) ((x) << 14) /* PCIX speed indication (Cordova) */
274 #define STATUS_PCIXSPD_50_66 STATUS_PCIXSPD(0)
275 #define STATUS_PCIXSPD_66_100 STATUS_PCIXSPD(1)
276 #define STATUS_PCIXSPD_100_133 STATUS_PCIXSPD(2)
277 #define STATUS_PCIXSPD_MASK STATUS_PCIXSPD(3)
278 #define STATUS_GIO_M_ENA (1U << 19) /* GIO master enable */
279 #define STATUS_DEV_RST_SET (1U << 20) /* Device Reset Set */
280
281 /* Strapping Option Register (PCH_SPT and newer) */
282 #define WMREG_STRAP 0x000c
283 #define STRAP_NVMSIZE __BITS(1, 6)
284 #define STRAP_FREQ __BITS(12, 13)
285 #define STRAP_SMBUSADDR __BITS(17, 23)
286
287 #define WMREG_EECD 0x0010 /* EEPROM Control Register */
288 #define EECD_SK (1U << 0) /* clock */
289 #define EECD_CS (1U << 1) /* chip select */
290 #define EECD_DI (1U << 2) /* data in */
291 #define EECD_DO (1U << 3) /* data out */
292 #define EECD_FWE(x) ((x) << 4) /* flash write enable control */
293 #define EECD_FWE_DISABLED EECD_FWE(1)
294 #define EECD_FWE_ENABLED EECD_FWE(2)
295 #define EECD_EE_REQ (1U << 6) /* (shared) EEPROM request */
296 #define EECD_EE_GNT (1U << 7) /* (shared) EEPROM grant */
297 #define EECD_EE_PRES (1U << 8) /* EEPROM present */
298 #define EECD_EE_SIZE (1U << 9) /* EEPROM size
299 (0 = 64 word, 1 = 256 word) */
300 #define EECD_EE_AUTORD (1U << 9) /* auto read done */
301 #define EECD_EE_ABITS (1U << 10) /* EEPROM address bits
302 (based on type) */
303 #define EECD_EE_SIZE_EX_MASK __BITS(14,11) /* EEPROM size for new devices */
304 #define EECD_EE_TYPE (1U << 13) /* EEPROM type
305 (0 = Microwire, 1 = SPI) */
306 #define EECD_SEC1VAL (1U << 22) /* Sector One Valid */
307 #define EECD_SEC1VAL_VALMASK (EECD_EE_AUTORD | EECD_EE_PRES) /* Valid Mask */
308
309 #define WMREG_EERD 0x0014 /* EEPROM read */
310 #define EERD_DONE 0x02 /* done bit */
311 #define EERD_START 0x01 /* First bit for telling part to start operation */
312 #define EERD_ADDR_SHIFT 2 /* Shift to the address bits */
313 #define EERD_DATA_SHIFT 16 /* Offset to data in EEPROM read/write registers */
314
315 #define WMREG_FEXTNVM6 0x0010 /* Future Extended NVM 6 */
316 #define FEXTNVM6_K1_OFF_ENABLE __BIT(31)
317
318 #define WMREG_CTRL_EXT 0x0018 /* Extended Device Control Register */
319 #define CTRL_EXT_GPI_EN(x) (1U << (x)) /* gpin interrupt enable */
320 #define CTRL_EXT_NVMVS __BITS(0, 1) /* NVM valid sector */
321 #define CTRL_EXT_LPCD __BIT(2) /* LCD Power Cycle Done */
322 #define CTRL_EXT_SWDPINS_SHIFT 4
323 #define CTRL_EXT_SWDPINS_MASK 0x0d
324 /* The bit order of the SW Definable pin is not 6543 but 3654! */
325 #define CTRL_EXT_SWDPIN(x) (1U << (CTRL_EXT_SWDPINS_SHIFT \
326 + ((x) == 3 ? 3 : ((x) - 4))))
327 #define CTRL_EXT_SWDPIO_SHIFT 8
328 #define CTRL_EXT_SWDPIO_MASK 0x0d
329 #define CTRL_EXT_SWDPIO(x) (1U << (CTRL_EXT_SWDPIO_SHIFT \
330 + ((x) == 3 ? 3 : ((x) - 4))))
331 #define CTRL_EXT_FORCE_SMBUS __BIT(11) /* Force SMBus mode */
332 #define CTRL_EXT_ASDCHK (1U << 12) /* ASD check */
333 #define CTRL_EXT_EE_RST (1U << 13) /* EEPROM reset */
334 #define CTRL_EXT_IPS (1U << 14) /* invert power state bit 0 */
335 #define CTRL_EXT_SPD_BYPS (1U << 15) /* speed select bypass */
336 #define CTRL_EXT_IPS1 (1U << 16) /* invert power state bit 1 */
337 #define CTRL_EXT_RO_DIS (1U << 17) /* relaxed ordering disabled */
338 #define CTRL_EXT_SDLPE (1U << 18) /* SerDes Low Power Enable */
339 #define CTRL_EXT_DMA_DYN_CLK (1U << 19) /* DMA Dynamic Gating Enable */
340 #define CTRL_EXT_PHYPDEN __BIT(20)
341 #define CTRL_EXT_LINK_MODE_MASK 0x00C00000
342 #define CTRL_EXT_LINK_MODE_GMII 0x00000000
343 #define CTRL_EXT_LINK_MODE_KMRN 0x00000000
344 #define CTRL_EXT_LINK_MODE_1000KX 0x00400000
345 #define CTRL_EXT_LINK_MODE_SGMII 0x00800000
346 #define CTRL_EXT_LINK_MODE_PCIX_SERDES 0x00800000
347 #define CTRL_EXT_LINK_MODE_TBI 0x00C00000
348 #define CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
349 #define CTRL_EXT_I2C_ENA 0x02000000 /* I2C enable */
350 #define CTRL_EXT_DRV_LOAD 0x10000000
351
352 #define WMREG_MDIC 0x0020 /* MDI Control Register */
353 #define MDIC_DATA(x) ((x) & 0xffff)
354 #define MDIC_REGADD(x) ((x) << 16)
355 #define MDIC_PHY_SHIFT 21
356 #define MDIC_PHY_MASK __BITS(25, 21)
357 #define MDIC_PHYADD(x) ((x) << 21)
358 #define MDIC_OP_WRITE (1U << 26)
359 #define MDIC_OP_READ (2U << 26)
360 #define MDIC_READY (1U << 28)
361 #define MDIC_I (1U << 29) /* interrupt on MDI complete */
362 #define MDIC_E (1U << 30) /* MDI error */
363 #define MDIC_DEST (1U << 31) /* Destination */
364
365 #define WMREG_SCTL 0x0024 /* SerDes Control - RW */
366 /*
367 * These 4 macros are also used for other 8bit control registers on the
368 * 82575
369 */
370 #define SCTL_CTL_READY (1U << 31)
371 #define SCTL_CTL_DATA_MASK 0x000000ff
372 #define SCTL_CTL_ADDR_SHIFT 8
373 #define SCTL_CTL_POLL_TIMEOUT 640
374 #define SCTL_DISABLE_SERDES_LOOPBACK 0x0400
375
376 #define WMREG_FEXTNVM4 0x0024 /* Future Extended NVM 4 - RW */
377 #define FEXTNVM4_BEACON_DURATION __BITS(2, 0)
378 #define FEXTNVM4_BEACON_DURATION_8US 0x7
379 #define FEXTNVM4_BEACON_DURATION_16US 0x3
380
381 #define WMREG_FCAL 0x0028 /* Flow Control Address Low */
382 #define FCAL_CONST 0x00c28001 /* Flow Control MAC addr low */
383
384 #define WMREG_FCAH 0x002c /* Flow Control Address High */
385 #define FCAH_CONST 0x00000100 /* Flow Control MAC addr high */
386
387 #define WMREG_FCT 0x0030 /* Flow Control Type */
388
389 #define WMREG_KUMCTRLSTA 0x0034 /* MAC-PHY interface - RW */
390 #define KUMCTRLSTA_MASK 0x0000FFFF
391 #define KUMCTRLSTA_OFFSET 0x001F0000
392 #define KUMCTRLSTA_OFFSET_SHIFT 16
393 #define KUMCTRLSTA_REN 0x00200000
394
395 #define KUMCTRLSTA_OFFSET_FIFO_CTRL 0x00000000
396 #define KUMCTRLSTA_OFFSET_CTRL 0x00000001
397 #define KUMCTRLSTA_OFFSET_INB_CTRL 0x00000002
398 #define KUMCTRLSTA_OFFSET_DIAG 0x00000003
399 #define KUMCTRLSTA_OFFSET_TIMEOUTS 0x00000004
400 #define KUMCTRLSTA_OFFSET_K1_CONFIG 0x00000007
401 #define KUMCTRLSTA_OFFSET_INB_PARAM 0x00000009
402 #define KUMCTRLSTA_OFFSET_HD_CTRL 0x00000010
403 #define KUMCTRLSTA_OFFSET_M2P_SERDES 0x0000001E
404 #define KUMCTRLSTA_OFFSET_M2P_MODES 0x0000001F
405
406 /* FIFO Control */
407 #define KUMCTRLSTA_FIFO_CTRL_RX_BYPASS 0x00000008
408 #define KUMCTRLSTA_FIFO_CTRL_TX_BYPASS 0x00000800
409
410 /* In-Band Control */
411 #define KUMCTRLSTA_INB_CTRL_LINK_TMOUT_DFLT 0x00000500
412 #define KUMCTRLSTA_INB_CTRL_DIS_PADDING 0x00000010
413
414 /* Diag */
415 #define KUMCTRLSTA_DIAG_NELPBK 0x1000
416
417 /* K1 Config */
418 #define KUMCTRLSTA_K1_ENABLE 0x0002
419
420 /* Half-Duplex Control */
421 #define KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x00000004
422 #define KUMCTRLSTA_HD_CTRL_1000_DEFAULT 0x00000000
423
424 #define WMREG_VET 0x0038 /* VLAN Ethertype */
425 #define WMREG_MDPHYA 0x003C /* PHY address - RW */
426
427 #define WMREG_FEXTNVM3 0x003c /* Future Extended NVM 3 */
428 #define FEXTNVM3_PHY_CFG_COUNTER_MASK __BITS(27, 26)
429 #define FEXTNVM3_PHY_CFG_COUNTER_50MS __BIT(27)
430
431 #define WMREG_RAL_BASE 0x0040 /* Receive Address List */
432 #define WMREG_CORDOVA_RAL_BASE 0x5400
433 #define WMREG_RAL_LO(b, x) ((b) + ((x) << 3))
434 #define WMREG_RAL_HI(b, x) (WMREG_RAL_LO(b, x) + 4)
435 /*
436 * Receive Address List: The LO part is the low-order 32-bits
437 * of the MAC address. The HI part is the high-order 16-bits
438 * along with a few control bits.
439 */
440 #define RAL_AS(x) ((x) << 16) /* address select */
441 #define RAL_AS_DEST RAL_AS(0) /* (cordova?) */
442 #define RAL_AS_SOURCE RAL_AS(1) /* (cordova?) */
443 #define RAL_RDR1 (1U << 30) /* put packet in alt. rx ring */
444 #define RAL_AV (1U << 31) /* entry is valid */
445
446 #define WM_RAL_TABSIZE 15 /* RAL size for old devices */
447 #define WM_RAL_TABSIZE_ICH8 7 /* RAL size for ICH* and PCH* */
448 #define WM_RAL_TABSIZE_PCH2 5 /* RAL size for PCH2 */
449 #define WM_RAL_TABSIZE_PCH_LPT 12 /* RAL size for PCH_LPT */
450 #define WM_RAL_TABSIZE_82575 16 /* RAL size for 82575 */
451 #define WM_RAL_TABSIZE_82576 24 /* RAL size for 82576 and 82580 */
452 #define WM_RAL_TABSIZE_I350 32 /* RAL size for I350 */
453
454 #define WMREG_ICR 0x00c0 /* Interrupt Cause Register */
455 #define ICR_TXDW (1U << 0) /* Tx desc written back */
456 #define ICR_TXQE (1U << 1) /* Tx queue empty */
457 #define ICR_LSC (1U << 2) /* link status change */
458 #define ICR_RXSEQ (1U << 3) /* receive sequence error */
459 #define ICR_RXDMT0 (1U << 4) /* Rx ring 0 nearly empty */
460 #define ICR_RXO (1U << 6) /* Rx overrun */
461 #define ICR_RXT0 (1U << 7) /* Rx ring 0 timer */
462 #define ICR_MDAC (1U << 9) /* MDIO access complete */
463 #define ICR_RXCFG (1U << 10) /* Receiving /C/ */
464 #define ICR_GPI(x) (1U << (x)) /* general purpose interrupts */
465 #define ICR_INT (1U << 31) /* device generated an interrupt */
466
467 #define WMREG_ITR 0x00c4 /* Interrupt Throttling Register */
468 #define ITR_IVAL_MASK 0xffff /* Interval mask */
469 #define ITR_IVAL_SHIFT 0 /* Interval shift */
470
471 #define WMREG_ICS 0x00c8 /* Interrupt Cause Set Register */
472 /* See ICR bits. */
473
474 #define WMREG_IMS 0x00d0 /* Interrupt Mask Set Register */
475 /* See ICR bits. */
476
477 #define WMREG_IMC 0x00d8 /* Interrupt Mask Clear Register */
478 /* See ICR bits. */
479
480 #define WMREG_FEXTNVM7 0x00e4 /* Future Extended NVM 7 */
481 #define FEXTNVM7_SIDE_CLK_UNGATE __BIT(2)
482 #define FEXTNVM7_DIS_SMB_PERST __BIT(5)
483 #define FEXTNVM7_DIS_PB_READ __BIT(18)
484
485 #define WMREG_LTRV 0x00f8 /* Latency Tolerance Reporting */
486 #define LTRV_VALUE __BITS(9, 0)
487 #define LTRV_SCALE __BITS(12, 10)
488 #define LTRV_SCALE_MAX 5
489 #define LTRV_SNOOP_REQ __BIT(15)
490 #define LTRV_SEND __BIT(30)
491 #define LTRV_NONSNOOP __BITS(31, 16)
492 #define LTRV_NONSNOOP_REQ __BIT(31)
493
494 #define WMREG_RCTL 0x0100 /* Receive Control */
495 #define RCTL_EN (1U << 1) /* receiver enable */
496 #define RCTL_SBP (1U << 2) /* store bad packets */
497 #define RCTL_UPE (1U << 3) /* unicast promisc. enable */
498 #define RCTL_MPE (1U << 4) /* multicast promisc. enable */
499 #define RCTL_LPE (1U << 5) /* large packet enable */
500 #define RCTL_LBM(x) ((x) << 6) /* loopback mode */
501 #define RCTL_LBM_NONE RCTL_LBM(0)
502 #define RCTL_LBM_PHY RCTL_LBM(3)
503 #define RCTL_RDMTS(x) ((x) << 8) /* receive desc. min thresh size */
504 #define RCTL_RDMTS_1_2 RCTL_RDMTS(0)
505 #define RCTL_RDMTS_1_4 RCTL_RDMTS(1)
506 #define RCTL_RDMTS_1_8 RCTL_RDMTS(2)
507 #define RCTL_RDMTS_MASK RCTL_RDMTS(3)
508 #define RCTL_MO(x) ((x) << 12) /* multicast offset */
509 #define RCTL_BAM (1U << 15) /* broadcast accept mode */
510 #define RCTL_RDMTS_HEX __BIT(16)
511 #define RCTL_2k (0 << 16) /* 2k Rx buffers */
512 #define RCTL_1k (1 << 16) /* 1k Rx buffers */
513 #define RCTL_512 (2 << 16) /* 512 byte Rx buffers */
514 #define RCTL_256 (3 << 16) /* 256 byte Rx buffers */
515 #define RCTL_BSEX_16k (1 << 16) /* 16k Rx buffers (BSEX) */
516 #define RCTL_BSEX_8k (2 << 16) /* 8k Rx buffers (BSEX) */
517 #define RCTL_BSEX_4k (3 << 16) /* 4k Rx buffers (BSEX) */
518 #define RCTL_DPF (1U << 22) /* discard pause frames */
519 #define RCTL_PMCF (1U << 23) /* pass MAC control frames */
520 #define RCTL_BSEX (1U << 25) /* buffer size extension (Livengood) */
521 #define RCTL_SECRC (1U << 26) /* strip Ethernet CRC */
522
523 #define WMREG_OLD_RDTR0 0x0108 /* Receive Delay Timer (ring 0) */
524 #define WMREG_RDTR 0x2820
525 #define RDTR_FPD (1U << 31) /* flush partial descriptor */
526
527 #define WMREG_LTRC 0x01a0 /* Latency Tolerance Reportiong Control */
528
529 #define WMREG_OLD_RDBAL0 0x0110 /* Receive Descriptor Base Low (ring 0) */
530 #define WMREG_RDBAL 0x2800
531 #define WMREG_RDBAL_2 0x0c00 /* for 82576 ... */
532
533 #define WMREG_OLD_RDBAH0 0x0114 /* Receive Descriptor Base High (ring 0) */
534 #define WMREG_RDBAH 0x2804
535 #define WMREG_RDBAH_2 0x0c04 /* for 82576 ... */
536
537 #define WMREG_OLD_RDLEN0 0x0118 /* Receive Descriptor Length (ring 0) */
538 #define WMREG_RDLEN 0x2808
539 #define WMREG_RDLEN_2 0x0c08 /* for 82576 ... */
540
541 #define WMREG_SRRCTL 0x280c /* additional recv control used in 82575 ... */
542 #define WMREG_SRRCTL_2 0x0c0c /* for 82576 ... */
543 #define SRRCTL_BSIZEPKT_MASK 0x0000007f
544 #define SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
545 #define SRRCTL_BSIZEHDRSIZE_MASK 0x00000f00
546 #define SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
547 #define SRRCTL_DESCTYPE_LEGACY 0x00000000
548 #define SRRCTL_DESCTYPE_ADV_ONEBUF (1U << 25)
549 #define SRRCTL_DESCTYPE_HDR_SPLIT (2U << 25)
550 #define SRRCTL_DESCTYPE_HDR_REPLICATION (3U << 25)
551 #define SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT (4U << 25)
552 #define SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS (5U << 25) /* 82575 only */
553 #define SRRCTL_DESCTYPE_MASK (7U << 25)
554 #define SRRCTL_DROP_EN 0x80000000
555
556 #define WMREG_OLD_RDH0 0x0120 /* Receive Descriptor Head (ring 0) */
557 #define WMREG_RDH 0x2810
558 #define WMREG_RDH_2 0x0c10 /* for 82576 ... */
559
560 #define WMREG_OLD_RDT0 0x0128 /* Receive Descriptor Tail (ring 0) */
561 #define WMREG_RDT 0x2818
562 #define WMREG_RDT_2 0x0c18 /* for 82576 ... */
563
564 #define WMREG_RXDCTL 0x2828 /* Receive Descriptor Control */
565 #define WMREG_RXDCTL_2 0x0c28 /* for 82576 ... */
566 #define RXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
567 #define RXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
568 #define RXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
569 #define RXDCTL_GRAN (1U << 24) /* 0 = cacheline, 1 = descriptor */
570 /* flags used starting with 82575 ... */
571 #define RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
572 #define RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */
573
574 #define WMREG_OLD_RDTR1 0x0130 /* Receive Delay Timer (ring 1) */
575 #define WMREG_OLD_RDBA1_LO 0x0138 /* Receive Descriptor Base Low (ring 1) */
576 #define WMREG_OLD_RDBA1_HI 0x013c /* Receive Descriptor Base High (ring 1) */
577 #define WMREG_OLD_RDLEN1 0x0140 /* Receive Drscriptor Length (ring 1) */
578 #define WMREG_OLD_RDH1 0x0148
579 #define WMREG_OLD_RDT1 0x0150
580 #define WMREG_OLD_FCRTH 0x0160 /* Flow Control Rx Threshold Hi (OLD) */
581 #define WMREG_FCRTL 0x2160 /* Flow Control Rx Threshold Lo */
582 #define FCRTH_DFLT 0x00008000
583
584 #define WMREG_OLD_FCRTL 0x0168 /* Flow Control Rx Threshold Lo (OLD) */
585 #define WMREG_FCRTH 0x2168 /* Flow Control Rx Threhsold Hi */
586 #define FCRTL_DFLT 0x00004000
587 #define FCRTL_XONE 0x80000000 /* Enable XON frame transmission */
588
589 #define WMREG_FCTTV 0x0170 /* Flow Control Transmit Timer Value */
590 #define FCTTV_DFLT 0x00000600
591
592 #define WMREG_TXCW 0x0178 /* Transmit Configuration Word (TBI mode) */
593 /* See MII ANAR_X bits. */
594 #define TXCW_FD (1U << 5) /* Full Duplex */
595 #define TXCW_HD (1U << 6) /* Half Duplex */
596 #define TXCW_SYM_PAUSE (1U << 7) /* sym pause request */
597 #define TXCW_ASYM_PAUSE (1U << 8) /* asym pause request */
598 #define TXCW_TxConfig (1U << 30) /* Tx Config */
599 #define TXCW_ANE (1U << 31) /* Autonegotiate */
600
601 #define WMREG_RXCW 0x0180 /* Receive Configuration Word (TBI mode) */
602 /* See MII ANLPAR_X bits. */
603 #define RXCW_NC (1U << 26) /* no carrier */
604 #define RXCW_IV (1U << 27) /* config invalid */
605 #define RXCW_CC (1U << 28) /* config change */
606 #define RXCW_C (1U << 29) /* /C/ reception */
607 #define RXCW_SYNCH (1U << 30) /* synchronized */
608 #define RXCW_ANC (1U << 31) /* autonegotiation complete */
609
610 #define WMREG_MTA 0x0200 /* Multicast Table Array */
611 #define WMREG_CORDOVA_MTA 0x5200
612
613 #define WMREG_TCTL 0x0400 /* Transmit Control Register */
614 #define TCTL_EN (1U << 1) /* transmitter enable */
615 #define TCTL_PSP (1U << 3) /* pad short packets */
616 #define TCTL_CT(x) (((x) & 0xff) << 4) /* 4:11 - collision threshold */
617 #define TCTL_COLD(x) (((x) & 0x3ff) << 12) /* 12:21 - collision distance */
618 #define TCTL_SWXOFF (1U << 22) /* software XOFF */
619 #define TCTL_RTLC (1U << 24) /* retransmit on late collision */
620 #define TCTL_NRTU (1U << 25) /* no retransmit on underrun */
621 #define TCTL_MULR (1U << 28) /* multiple request */
622
623 #define TX_COLLISION_THRESHOLD 15
624 #define TX_COLLISION_DISTANCE_HDX 512
625 #define TX_COLLISION_DISTANCE_FDX 64
626
627 #define WMREG_TCTL_EXT 0x0404 /* Transmit Control Register */
628 #define TCTL_EXT_BST_MASK 0x000003FF /* Backoff Slot Time */
629 #define TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */
630
631 #define DEFAULT_80003ES2LAN_TCTL_EXT_GCEX 0x00010000
632
633 #define WMREG_TQSA_LO 0x0408
634 #define WMREG_TQSA_HI 0x040c
635
636 #define WMREG_TIPG 0x0410 /* Transmit IPG Register */
637 #define TIPG_IPGT(x) (x) /* IPG transmit time */
638 #define TIPG_IPGR1(x) ((x) << 10) /* IPG receive time 1 */
639 #define TIPG_IPGR2(x) ((x) << 20) /* IPG receive time 2 */
640 #define TIPG_WM_DFLT (TIPG_IPGT(0x0a) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x0a))
641 #define TIPG_LG_DFLT (TIPG_IPGT(0x06) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
642 #define TIPG_1000T_DFLT (TIPG_IPGT(0x08) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
643 #define TIPG_1000T_80003_DFLT \
644 (TIPG_IPGT(0x08) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
645 #define TIPG_10_100_80003_DFLT \
646 (TIPG_IPGT(0x09) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
647
648 #define WMREG_TQC 0x0418
649
650 #define WMREG_OLD_TDBAL 0x0420 /* Transmit Descriptor Base Lo */
651 #define WMREG_TDBAL 0x3800
652
653 #define WMREG_OLD_TDBAH 0x0424 /* Transmit Descriptor Base Hi */
654 #define WMREG_TDBAH 0x3804
655
656 #define WMREG_OLD_TDLEN 0x0428 /* Transmit Descriptor Length */
657 #define WMREG_TDLEN 0x3808
658
659 #define WMREG_OLD_TDH 0x0430 /* Transmit Descriptor Head */
660 #define WMREG_TDH 0x3810
661
662 #define WMREG_OLD_TDT 0x0438 /* Transmit Descriptor Tail */
663 #define WMREG_TDT 0x3818
664
665 #define WMREG_OLD_TIDV 0x0440 /* Transmit Delay Interrupt Value */
666 #define WMREG_TIDV 0x3820
667
668 #define WMREG_AIT 0x0458 /* Adaptive IFS Throttle */
669 #define WMREG_VFTA 0x0600
670
671 #define WMREG_MDICNFG 0x0e04 /* MDC/MDIO Configuration Register */
672 #define MDICNFG_PHY_SHIFT 21
673 #define MDICNFG_PHY_MASK __BITS(25, 21)
674 #define MDICNFG_COM_MDIO __BIT(30)
675 #define MDICNFG_DEST __BIT(31)
676
677 #define WM_MC_TABSIZE 128
678 #define WM_ICH8_MC_TABSIZE 32
679 #define WM_VLAN_TABSIZE 128
680
681 #define WMREG_PHPM 0x0e14 /* PHY Power Management */
682 #define PHPM_GO_LINK_D __BIT(5) /* Go Link Disconnect */
683
684 #define WMREG_EEER 0x0e30 /* Energy Efficiency Ethernet "EEE" */
685 #define EEER_TX_LPI_EN 0x00010000 /* EEER Tx LPI Enable */
686 #define EEER_RX_LPI_EN 0x00020000 /* EEER Rx LPI Enable */
687 #define EEER_LPI_FC 0x00040000 /* EEER Ena on Flow Cntrl */
688 #define EEER_EEER_NEG 0x20000000 /* EEER capability nego */
689 #define EEER_EEER_RX_LPI_STATUS 0x40000000 /* EEER Rx in LPI state */
690 #define EEER_EEER_TX_LPI_STATUS 0x80000000 /* EEER Tx in LPI state */
691 #define WMREG_EEE_SU 0x0e34 /* EEE Setup */
692 #define WMREG_IPCNFG 0x0e38 /* Internal PHY Configuration */
693 #define IPCNFG_10BASE_TE 0x00000002 /* IPCNFG 10BASE-Te low power op. */
694 #define IPCNFG_EEE_100M_AN 0x00000004 /* IPCNFG EEE Ena 100M AN */
695 #define IPCNFG_EEE_1G_AN 0x00000008 /* IPCNFG EEE Ena 1G AN */
696
697 #define WMREG_EXTCNFCTR 0x0f00 /* Extended Configuration Control */
698 #define EXTCNFCTR_PCIE_WRITE_ENABLE 0x00000001
699 #define EXTCNFCTR_PHY_WRITE_ENABLE 0x00000002
700 #define EXTCNFCTR_D_UD_ENABLE 0x00000004
701 #define EXTCNFCTR_D_UD_LATENCY 0x00000008
702 #define EXTCNFCTR_D_UD_OWNER 0x00000010
703 #define EXTCNFCTR_MDIO_SW_OWNERSHIP 0x00000020
704 #define EXTCNFCTR_MDIO_HW_OWNERSHIP 0x00000040
705 #define EXTCNFCTR_GATE_PHY_CFG 0x00000080
706 #define EXTCNFCTR_EXT_CNF_POINTER 0x0FFF0000
707
708 #define WMREG_PHY_CTRL 0x0f10 /* PHY control */
709 #define PHY_CTRL_SPD_EN (1 << 0)
710 #define PHY_CTRL_D0A_LPLU (1 << 1)
711 #define PHY_CTRL_NOND0A_LPLU (1 << 2)
712 #define PHY_CTRL_NOND0A_GBE_DIS (1 << 3)
713 #define PHY_CTRL_GBE_DIS (1 << 6)
714
715 #define WMREG_PCIEANACFG 0x0f18 /* PCIE Analog Config */
716
717 #define WMREG_IOSFPC 0x0f28 /* Tx corrupted data */
718
719 #define WMREG_PBA 0x1000 /* Packet Buffer Allocation */
720 #define PBA_BYTE_SHIFT 10 /* KB -> bytes */
721 #define PBA_ADDR_SHIFT 7 /* KB -> quadwords */
722 #define PBA_8K 0x0008
723 #define PBA_10K 0x000a
724 #define PBA_12K 0x000c
725 #define PBA_14K 0x000e
726 #define PBA_16K 0x0010 /* 16K, default Tx allocation */
727 #define PBA_20K 0x0014
728 #define PBA_22K 0x0016
729 #define PBA_24K 0x0018
730 #define PBA_26K 0x001a
731 #define PBA_30K 0x001e
732 #define PBA_32K 0x0020
733 #define PBA_34K 0x0022
734 #define PBA_35K 0x0023
735 #define PBA_40K 0x0028
736 #define PBA_48K 0x0030 /* 48K, default Rx allocation */
737 #define PBA_64K 0x0040
738 #define PBA_RXA_MASK __BITS(15, 0)
739
740 #define WMREG_PBS 0x1008 /* Packet Buffer Size (ICH) */
741
742 #define WMREG_PBECCSTS 0x100c /* Packet Buffer ECC Status (PCH_LPT) */
743 #define PBECCSTS_CORR_ERR_CNT_MASK 0x000000ff
744 #define PBECCSTS_UNCORR_ERR_CNT_MASK 0x0000ff00
745 #define PBECCSTS_UNCORR_ECC_ENABLE 0x00010000
746
747 #define WMREG_EEMNGCTL 0x1010 /* MNG EEprom Control */
748 #define EEMNGCTL_CFGDONE_0 0x040000 /* MNG config cycle done */
749 #define EEMNGCTL_CFGDONE_1 0x080000 /* 2nd port */
750
751 #define WMREG_I2CCMD 0x1028 /* SFPI2C Command Register - RW */
752 #define I2CCMD_REG_ADDR_SHIFT 16
753 #define I2CCMD_REG_ADDR 0x00ff0000
754 #define I2CCMD_PHY_ADDR_SHIFT 24
755 #define I2CCMD_PHY_ADDR 0x07000000
756 #define I2CCMD_OPCODE_READ 0x08000000
757 #define I2CCMD_OPCODE_WRITE 0x00000000
758 #define I2CCMD_RESET 0x10000000
759 #define I2CCMD_READY 0x20000000
760 #define I2CCMD_INTERRUPT_ENA 0x40000000
761 #define I2CCMD_ERROR 0x80000000
762 #define MAX_SGMII_PHY_REG_ADDR 255
763 #define I2CCMD_PHY_TIMEOUT 200
764
765 #define WMREG_EEWR 0x102c /* EEPROM write */
766
767 #define WMREG_PBA_ECC 0x01100 /* PBA ECC */
768 #define PBA_ECC_COUNTER_MASK 0xfff00000 /* ECC counter mask */
769 #define PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */
770 #define PBA_ECC_CORR_EN 0x00000001 /* Enable ECC error correction */
771 #define PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */
772 #define PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 on ECC error */
773
774 #define WMREG_EICS 0x01520 /* Ext. Interrupt Cause Set - WO */
775 #define WMREG_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */
776 #define WMREG_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */
777 #define WMREG_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */
778 #define WMREG_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */
779
780 #define WMREG_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */
781
782 #define EITR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */
783 #define EITR_RX_QUEUE1 0x00000002 /* Rx Queue 1 Interrupt */
784 #define EITR_RX_QUEUE2 0x00000004 /* Rx Queue 2 Interrupt */
785 #define EITR_RX_QUEUE3 0x00000008 /* Rx Queue 3 Interrupt */
786 #define EITR_TX_QUEUE0 0x00000100 /* Tx Queue 0 Interrupt */
787 #define EITR_TX_QUEUE1 0x00000200 /* Tx Queue 1 Interrupt */
788 #define EITR_TX_QUEUE2 0x00000400 /* Tx Queue 2 Interrupt */
789 #define EITR_TX_QUEUE3 0x00000800 /* Tx Queue 3 Interrupt */
790 #define EITR_TCP_TIMER 0x40000000 /* TCP Timer */
791 #define EITR_OTHER 0x80000000 /* Interrupt Cause Active */
792
793 #define WMREG_EITR(x) (0x01680 + (0x4 * (x)))
794 #define EITR_ITR_INT_MASK 0x0000ffff
795
796 #define WMREG_RXPBS 0x2404 /* Rx Packet Buffer Size */
797 #define RXPBS_SIZE_MASK_82576 0x0000007F
798
799 #define WMREG_RDFH 0x2410 /* Receive Data FIFO Head */
800 #define WMREG_RDFT 0x2418 /* Receive Data FIFO Tail */
801 #define WMREG_RDFHS 0x2420 /* Receive Data FIFO Head Saved */
802 #define WMREG_RDFTS 0x2428 /* Receive Data FIFO Tail Saved */
803 #define WMREG_RADV 0x282c /* Receive Interrupt Absolute Delay Timer */
804
805 #define WMREG_TXDMAC 0x3000 /* Transfer DMA Control */
806 #define TXDMAC_DPP (1U << 0) /* disable packet prefetch */
807
808 #define WMREG_KABGTXD 0x3004 /* AFE and Gap Transmit Ref Data */
809 #define KABGTXD_BGSQLBIAS 0x00050000
810
811 #define WMREG_TDFH 0x3410 /* Transmit Data FIFO Head */
812 #define WMREG_TDFT 0x3418 /* Transmit Data FIFO Tail */
813 #define WMREG_TDFHS 0x3420 /* Transmit Data FIFO Head Saved */
814 #define WMREG_TDFTS 0x3428 /* Transmit Data FIFO Tail Saved */
815 #define WMREG_TDFPC 0x3430 /* Transmit Data FIFO Packet Count */
816
817 #define WMREG_TXDCTL(n) /* Trandmit Descriptor Control */ \
818 (((n) < 4) ? (0x3828 + ((n) * 0x100)) : (0xe028 + ((n) * 0x40)))
819 #define TXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
820 #define TXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
821 #define TXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
822 /* flags used starting with 82575 ... */
823 #define TXDCTL_COUNT_DESC __BIT(22) /* Enable the counting of desc.
824 still to be processed. */
825 #define TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
826 #define TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */
827 #define TXDCTL_PRIORITY 0x08000000
828
829 #define WMREG_TADV 0x382c /* Transmit Absolute Interrupt Delay Timer */
830 #define WMREG_TSPMT 0x3830 /* TCP Segmentation Pad and Minimum
831 Threshold (Cordova) */
832 #define TSPMT_TSMT(x) (x) /* TCP seg min transfer */
833 #define TSPMT_TSPBP(x) ((x) << 16) /* TCP seg pkt buf padding */
834
835 #define WMREG_TARC0 0x3840 /* Tx arbitration count (0) */
836 #define WMREG_TARC1 0x3940 /* Tx arbitration count (1) */
837
838 #define WMREG_CRCERRS 0x4000 /* CRC Error Count */
839 #define WMREG_ALGNERRC 0x4004 /* Alignment Error Count */
840 #define WMREG_SYMERRC 0x4008 /* Symbol Error Count */
841 #define WMREG_RXERRC 0x400c /* receive error Count - R/clr */
842 #define WMREG_MPC 0x4010 /* Missed Packets Count - R/clr */
843 #define WMREG_COLC 0x4028 /* collision Count - R/clr */
844 #define WMREG_SEC 0x4038 /* Sequence Error Count */
845 #define WMREG_CEXTERR 0x403c /* Carrier Extension Error Count */
846 #define WMREG_RLEC 0x4040 /* Receive Length Error Count */
847 #define WMREG_XONRXC 0x4048 /* XON Rx Count - R/clr */
848 #define WMREG_XONTXC 0x404c /* XON Tx Count - R/clr */
849 #define WMREG_XOFFRXC 0x4050 /* XOFF Rx Count - R/clr */
850 #define WMREG_XOFFTXC 0x4054 /* XOFF Tx Count - R/clr */
851 #define WMREG_FCRUC 0x4058 /* Flow Control Rx Unsupported Count - R/clr */
852 #define WMREG_RNBC 0x40a0 /* Receive No Buffers Count */
853 #define WMREG_TLPIC 0x4148 /* EEE Tx LPI Count */
854 #define WMREG_RLPIC 0x414c /* EEE Rx LPI Count */
855
856 #define WMREG_PCS_CFG 0x4200 /* PCS Configuration */
857 #define PCS_CFG_PCS_EN __BIT(3)
858
859 #define WMREG_PCS_LCTL 0x4208 /* PCS Link Control */
860 #define PCS_LCTL_FSV_1000 __BIT(2) /* AN Timeout Enable */
861 #define PCS_LCTL_FDV_FULL __BIT(3) /* AN Timeout Enable */
862 #define PCS_LCTL_FSD __BIT(4) /* AN Timeout Enable */
863 #define PCS_LCTL_FORCE_FC __BIT(7) /* AN Timeout Enable */
864 #define PCS_LCTL_AN_ENABLE __BIT(16) /* AN Timeout Enable */
865 #define PCS_LCTL_AN_RESTART __BIT(17) /* AN Timeout Enable */
866 #define PCS_LCTL_AN_TIMEOUT __BIT(18) /* AN Timeout Enable */
867
868 #define WMREG_PCS_LSTS 0x420c /* PCS Link Status */
869 #define PCS_LSTS_LINKOK __BIT(0)
870 #define PCS_LSTS_SPEED __BITS(2, 1)
871 #define PCS_LSTS_SPEED_10 0
872 #define PCS_LSTS_SPEED_100 1
873 #define PCS_LSTS_SPEED_1000 2
874 #define PCS_LSTS_FDX __BIT(3)
875 #define PCS_LSTS_AN_COMP __BIT(16)
876
877 #define WMREG_PCS_ANADV 0x4218 /* AN Advertsement */
878 #define WMREG_PCS_LPAB 0x421c /* Link Partnet Ability */
879
880 #define WMREG_RXCSUM 0x5000 /* Receive Checksum register */
881 #define RXCSUM_PCSS 0x000000ff /* Packet Checksum Start */
882 #define RXCSUM_IPOFL (1U << 8) /* IP checksum offload */
883 #define RXCSUM_TUOFL (1U << 9) /* TCP/UDP checksum offload */
884 #define RXCSUM_IPV6OFL (1U << 10) /* IPv6 checksum offload */
885
886 #define WMREG_RLPML 0x5004 /* Rx Long Packet Max Length */
887
888 #define WMREG_RFCTL 0x5008 /* Receive Filter Control */
889 #define WMREG_RFCTL_NFSWDIS __BIT(6) /* NFS Write Disable */
890 #define WMREG_RFCTL_NFSRDIS __BIT(7) /* NFS Read Disable */
891 #define WMREG_RFCTL_ACKDIS __BIT(12) /* ACK Accelerate Disable */
892 #define WMREG_RFCTL_ACKD_DIS __BIT(13) /* ACK data Disable */
893 #define WMREG_RFCTL_IPV6EXDIS __BIT(16) /* IPv6 Extension Header Disable */
894 #define WMREG_RFCTL_NEWIPV6EXDIS __BIT(17) /* New IPv6 Extension Header */
895
896 #define WMREG_WUC 0x5800 /* Wakeup Control */
897 #define WUC_APME 0x00000001 /* APM Enable */
898 #define WUC_PME_EN 0x00000002 /* PME Enable */
899
900 #define WMREG_WUFC 0x5808 /* Wakeup Filter COntrol */
901 #define WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
902 #define WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
903 #define WUFC_MC 0x00000008 /* Directed Multicast Wakeup En */
904 #define WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
905 #define WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup En */
906 #define WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup En */
907 #define WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup En */
908
909 #define WMREG_MANC 0x5820 /* Management Control */
910 #define MANC_SMBUS_EN 0x00000001
911 #define MANC_ASF_EN 0x00000002
912 #define MANC_ARP_EN 0x00002000
913 #define MANC_RECV_TCO_RESET 0x00010000
914 #define MANC_RECV_TCO_EN 0x00020000
915 #define MANC_BLK_PHY_RST_ON_IDE 0x00040000
916 #define MANC_RECV_ALL 0x00080000
917 #define MANC_EN_MAC_ADDR_FILTER 0x00100000
918 #define MANC_EN_MNG2HOST 0x00200000
919
920 #define WMREG_MANC2H 0x5860 /* Management Control To Host - RW */
921 #define MANC2H_PORT_623 (1 << 5)
922 #define MANC2H_PORT_624 (1 << 6)
923
924 #define WMREG_GCR 0x5b00 /* PCIe Control */
925 #define GCR_RXD_NO_SNOOP 0x00000001
926 #define GCR_RXDSCW_NO_SNOOP 0x00000002
927 #define GCR_RXDSCR_NO_SNOOP 0x00000004
928 #define GCR_TXD_NO_SNOOP 0x00000008
929 #define GCR_TXDSCW_NO_SNOOP 0x00000010
930 #define GCR_TXDSCR_NO_SNOOP 0x00000020
931 #define GCR_CMPL_TMOUT_MASK 0x0000f000
932 #define GCR_CMPL_TMOUT_10MS 0x00001000
933 #define GCR_CMPL_TMOUT_RESEND 0x00010000
934 #define GCR_CAP_VER2 0x00040000
935 #define GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
936
937 #define WMREG_FACTPS 0x5b30 /* Function Active and Power State to MNG */
938 #define FACTPS_MNGCG 0x20000000
939 #define FACTPS_LFS 0x40000000 /* LAN Function Select */
940
941 #define WMREG_GIOCTL 0x5b44 /* GIO Analog Control Register */
942 #define WMREG_CCMCTL 0x5b48 /* CCM Control Register */
943 #define WMREG_SCCTL 0x5b4c /* PCIc PLL Configuration Register */
944
945 #define WMREG_SWSM 0x5b50 /* SW Semaphore */
946 #define SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
947 #define SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
948 #define SWSM_WMNG 0x00000004 /* Wake MNG Clock */
949 #define SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */
950 /* Intel driver defines H2ME register at 0x5b50 */
951 #define WMREG_H2ME 0x5b50 /* SW Semaphore */
952 #define H2ME_ULP __BIT(11)
953 #define H2ME_ENFORCE_SETTINGS __BIT(12)
954
955 #define WMREG_FWSM 0x5b54 /* FW Semaphore */
956 #define FWSM_MODE __BITS(1, 3)
957 #define MNG_ICH_IAMT_MODE 0x2 /* PT mode? */
958 #define MNG_IAMT_MODE 0x3
959 #define FWSM_RSPCIPHY __BIT(6) /* Reset PHY on PCI reset */
960 #define FWSM_WLOCK_MAC __BITS(7, 9) /* Reset PHY on PCI reset */
961 #define FWSM_ULP_CFG_DONE __BIT(10)
962 #define FWSM_FW_VALID __BIT(15) /* FW established a valid mode */
963
964 #define WMREG_SWSM2 0x5b58 /* SW Semaphore 2 */
965 #define SWSM2_LOCK 0x00000002 /* Secondary driver semaphore bit */
966
967 #define WMREG_SW_FW_SYNC 0x5b5c /* software-firmware semaphore */
968 #define SWFW_EEP_SM 0x0001 /* eeprom access */
969 #define SWFW_PHY0_SM 0x0002 /* first ctrl phy access */
970 #define SWFW_PHY1_SM 0x0004 /* second ctrl phy access */
971 #define SWFW_MAC_CSR_SM 0x0008
972 #define SWFW_PHY2_SM 0x0020 /* first ctrl phy access */
973 #define SWFW_PHY3_SM 0x0040 /* first ctrl phy access */
974 #define SWFW_SOFT_SHIFT 0 /* software semaphores */
975 #define SWFW_FIRM_SHIFT 16 /* firmware semaphores */
976
977 #define WMREG_GCR2 0x5b64 /* 3GPIO Control Register 2 */
978 #define WMREG_FEXTNVM9 0x5bb4 /* Future Extended NVM 9 */
979 #define WMREG_FEXTNVM11 0x5bbc /* Future Extended NVM 11 */
980 #define FEXTNVM11_DIS_MULRFIX __BIT(13) /* Disable MULR fix */
981
982 #define WMREG_CRC_OFFSET 0x5f50
983
984 #define WMREG_EEC 0x12010
985 #define EEC_FLASH_DETECTED (1U << 19) /* FLASH */
986 #define EEC_FLUPD (1U << 23) /* Update FLASH */
987
988 #define WMREG_EEARBC_I210 0x12024
989
990 /*
991 * NVM related values.
992 * Microwire, SPI, and flash
993 */
994 #define UWIRE_OPC_ERASE 0x04 /* MicroWire "erase" opcode */
995 #define UWIRE_OPC_WRITE 0x05 /* MicroWire "write" opcode */
996 #define UWIRE_OPC_READ 0x06 /* MicroWire "read" opcode */
997
998 #define SPI_OPC_WRITE 0x02 /* SPI "write" opcode */
999 #define SPI_OPC_READ 0x03 /* SPI "read" opcode */
1000 #define SPI_OPC_A8 0x08 /* opcode bit 3 == address bit 8 */
1001 #define SPI_OPC_WREN 0x06 /* SPI "set write enable" opcode */
1002 #define SPI_OPC_WRDI 0x04 /* SPI "clear write enable" opcode */
1003 #define SPI_OPC_RDSR 0x05 /* SPI "read status" opcode */
1004 #define SPI_OPC_WRSR 0x01 /* SPI "write status" opcode */
1005 #define SPI_MAX_RETRIES 5000 /* max wait of 5ms for RDY signal */
1006
1007 #define SPI_SR_RDY 0x01
1008 #define SPI_SR_WEN 0x02
1009 #define SPI_SR_BP0 0x04
1010 #define SPI_SR_BP1 0x08
1011 #define SPI_SR_WPEN 0x80
1012
1013 #define NVM_CHECKSUM 0xBABA
1014 #define NVM_SIZE 0x0040
1015 #define NVM_WORD_SIZE_BASE_SHIFT 6
1016
1017 #define NVM_OFF_MACADDR 0x0000 /* MAC address offset 0 */
1018 #define NVM_OFF_MACADDR1 0x0001 /* MAC address offset 1 */
1019 #define NVM_OFF_MACADDR2 0x0002 /* MAC address offset 2 */
1020 #define NVM_OFF_COMPAT 0x0003
1021 #define NVM_OFF_ID_LED_SETTINGS 0x0004
1022 #define NVM_OFF_VERSION 0x0005
1023 #define NVM_OFF_CFG1 0x000a /* config word 1 */
1024 #define NVM_OFF_CFG2 0x000f /* config word 2 */
1025 #define NVM_OFF_EEPROM_SIZE 0x0012 /* NVM SIZE */
1026 #define NVM_OFF_CFG4 0x0013 /* config word 4 */
1027 #define NVM_OFF_CFG3_PORTB 0x0014 /* config word 3 */
1028 #define NVM_OFF_FUTURE_INIT_WORD1 0x0019
1029 #define NVM_OFF_INIT_3GIO_3 0x001a /* PCIe Initial Configuration Word 3 */
1030 #define NVM_OFF_K1_CONFIG 0x001b /* NVM K1 Config */
1031 #define NVM_OFF_LED_1_CFG 0x001c
1032 #define NVM_OFF_LED_0_2_CFG 0x001f
1033 #define NVM_OFF_SWDPIN 0x0020 /* SWD Pins (Cordova) */
1034 #define NVM_OFF_CFG3_PORTA 0x0024 /* config word 3 */
1035 #define NVM_OFF_ALT_MAC_ADDR_PTR 0x0037 /* to the alternative MAC addresses */
1036 #define NVM_OFF_COMB_VER_PTR 0x003d
1037 #define NVM_OFF_IMAGE_UID0 0x0042
1038 #define NVM_OFF_IMAGE_UID1 0x0043
1039
1040 #define NVM_COMPAT_VALID_CHECKSUM 0x0001
1041
1042 #define NVM_CFG1_LVDID (1U << 0)
1043 #define NVM_CFG1_LSSID (1U << 1)
1044 #define NVM_CFG1_PME_CLOCK (1U << 2)
1045 #define NVM_CFG1_PM (1U << 3)
1046 #define NVM_CFG1_ILOS (1U << 4)
1047 #define NVM_CFG1_SWDPIO_SHIFT 5
1048 #define NVM_CFG1_SWDPIO_MASK (0xf << NVM_CFG1_SWDPIO_SHIFT)
1049 #define NVM_CFG1_IPS1 (1U << 8)
1050 #define NVM_CFG1_LRST (1U << 9)
1051 #define NVM_CFG1_FD (1U << 10)
1052 #define NVM_CFG1_FRCSPD (1U << 11)
1053 #define NVM_CFG1_IPS0 (1U << 12)
1054 #define NVM_CFG1_64_32_BAR (1U << 13)
1055
1056 #define NVM_CFG2_CSR_RD_SPLIT (1U << 1)
1057 #define NVM_CFG2_82544_APM_EN (1U << 2)
1058 #define NVM_CFG2_64_BIT (1U << 3)
1059 #define NVM_CFG2_MAX_READ (1U << 4)
1060 #define NVM_CFG2_DMCR_MAP (1U << 5)
1061 #define NVM_CFG2_133_CAP (1U << 6)
1062 #define NVM_CFG2_MSI_DIS (1U << 7)
1063 #define NVM_CFG2_FLASH_DIS (1U << 8)
1064 #define NVM_CFG2_FLASH_SIZE(x) (((x) & 3) >> 9)
1065 #define NVM_CFG2_APM_EN (1U << 10)
1066 #define NVM_CFG2_ANE (1U << 11)
1067 #define NVM_CFG2_PAUSE(x) (((x) & 3) >> 12)
1068 #define NVM_CFG2_ASDE (1U << 14)
1069 #define NVM_CFG2_APM_PME (1U << 15)
1070 #define NVM_CFG2_SWDPIO_SHIFT 4
1071 #define NVM_CFG2_SWDPIO_MASK (0xf << NVM_CFG2_SWDPIO_SHIFT)
1072 #define NVM_CFG2_MNGM_SHIFT 13 /* Manageability Operation mode */
1073 #define NVM_CFG2_MNGM_MASK (3U << NVM_CFG2_MNGM_SHIFT)
1074 #define NVM_CFG2_MNGM_DIS 0
1075 #define NVM_CFG2_MNGM_NCSI 1
1076 #define NVM_CFG2_MNGM_PT 2
1077
1078 #define NVM_COMPAT_SERDES_FORCE_MODE __BIT(14) /* Don't use autonego */
1079
1080 #define NVM_FUTURE_INIT_WORD1_VALID_CHECKSUM 0x0040
1081
1082 #define NVM_K1_CONFIG_ENABLE 0x01
1083
1084 #define NVM_SWDPIN_MASK 0xdf
1085 #define NVM_SWDPIN_SWDPIN_SHIFT 0
1086 #define NVM_SWDPIN_SWDPIO_SHIFT 8
1087
1088 #define NVM_3GIO_3_ASPM_MASK (0x3 << 2) /* Active State PM Support */
1089
1090 #define NVM_CFG3_APME (1U << 10)
1091 #define NVM_CFG3_PORTA_EXT_MDIO (1U << 2) /* External MDIO Interface */
1092 #define NVM_CFG3_PORTA_COM_MDIO (1U << 3) /* MDIO Interface is shared */
1093
1094 #define NVM_OFF_MACADDR_82571(x) (3 * (x))
1095
1096 /*
1097 * EEPROM Partitioning. See Table 6-1, "EEPROM Top Level Partitioning"
1098 * in 82580's datasheet.
1099 */
1100 #define NVM_OFF_LAN_FUNC_82580(x) ((x) ? (0x40 + (0x40 * (x))) : 0)
1101
1102 #define NVM_COMBO_VER_OFF 0x0083
1103
1104 #define NVM_MAJOR_MASK 0xf000
1105 #define NVM_MAJOR_SHIFT 12
1106 #define NVM_MINOR_MASK 0x0ff0
1107 #define NVM_MINOR_SHIFT 4
1108 #define NVM_BUILD_MASK 0x000f
1109 #define NVM_UID_VALID 0x8000
1110
1111 /* iNVM Registers for i21[01] */
1112 #define WM_INVM_DATA_REG(reg) (0x12120 + 4*(reg))
1113 #define INVM_SIZE 64 /* Number of INVM Data Registers */
1114
1115 /* iNVM default vaule */
1116 #define NVM_INIT_CTRL_2_DEFAULT_I211 0x7243
1117 #define NVM_INIT_CTRL_4_DEFAULT_I211 0x00c1
1118 #define NVM_LED_1_CFG_DEFAULT_I211 0x0184
1119 #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200c
1120 #define NVM_RESERVED_WORD 0xffff
1121
1122 #define INVM_DWORD_TO_RECORD_TYPE(dword) ((dword) & 0x7)
1123 #define INVM_DWORD_TO_WORD_ADDRESS(dword) (((dword) & 0x0000FE00) >> 9)
1124 #define INVM_DWORD_TO_WORD_DATA(dword) (((dword) & 0xFFFF0000) >> 16)
1125
1126 #define INVM_UNINITIALIZED_STRUCTURE 0x0
1127 #define INVM_WORD_AUTOLOAD_STRUCTURE 0x1
1128 #define INVM_CSR_AUTOLOAD_STRUCTURE 0x2
1129 #define INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE 0x3
1130 #define INVM_RSA_KEY_SHA256_STRUCTURE 0x4
1131 #define INVM_INVALIDATED_STRUCTURE 0xf
1132
1133 #define INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS 8
1134 #define INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS 1
1135
1136 #define INVM_DEFAULT_AL 0x202f
1137 #define INVM_AUTOLOAD 0x0a
1138 #define INVM_PLL_WO_VAL 0x0010
1139
1140 /* Version and Image Type field */
1141 #define INVM_VER_1 __BITS(12,3)
1142 #define INVM_VER_2 __BITS(22,13)
1143 #define INVM_IMGTYPE __BITS(28,23)
1144 #define INVM_MINOR __BITS(3,0)
1145 #define INVM_MAJOR __BITS(9,4)
1146
1147 /* Word definitions for ID LED Settings */
1148 #define ID_LED_RESERVED_FFFF 0xFFFF
1149
1150 /* ich8 flash control */
1151 #define ICH_FLASH_COMMAND_TIMEOUT 5000 /* 5000 uSecs - adjusted */
1152 #define ICH_FLASH_ERASE_TIMEOUT 3000000 /* Up to 3 seconds - worst case */
1153 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10 /* 10 cycles */
1154 #define ICH_FLASH_SEG_SIZE_256 256
1155 #define ICH_FLASH_SEG_SIZE_4K 4096
1156 #define ICH_FLASH_SEG_SIZE_64K 65536
1157
1158 #define ICH_CYCLE_READ 0x0
1159 #define ICH_CYCLE_RESERVED 0x1
1160 #define ICH_CYCLE_WRITE 0x2
1161 #define ICH_CYCLE_ERASE 0x3
1162
1163 #define ICH_FLASH_GFPREG 0x0000
1164 #define ICH_FLASH_HSFSTS 0x0004 /* Flash Status Register */
1165 #define HSFSTS_DONE 0x0001 /* Flash Cycle Done */
1166 #define HSFSTS_ERR 0x0002 /* Flash Cycle Error */
1167 #define HSFSTS_DAEL 0x0004 /* Direct Access error Log */
1168 #define HSFSTS_ERSZ_MASK 0x0018 /* Block/Sector Erase Size */
1169 #define HSFSTS_ERSZ_SHIFT 3
1170 #define HSFSTS_FLINPRO 0x0020 /* flash SPI cycle in Progress */
1171 #define HSFSTS_FLDVAL 0x4000 /* Flash Descriptor Valid */
1172 #define HSFSTS_FLLK 0x8000 /* Flash Configuration Lock-Down */
1173 #define ICH_FLASH_HSFCTL 0x0006 /* Flash control Register */
1174 #define HSFCTL_GO 0x0001 /* Flash Cycle Go */
1175 #define HSFCTL_CYCLE_MASK 0x0006 /* Flash Cycle */
1176 #define HSFCTL_CYCLE_SHIFT 1
1177 #define HSFCTL_BCOUNT_MASK 0x0300 /* Data Byte Count */
1178 #define HSFCTL_BCOUNT_SHIFT 8
1179 #define ICH_FLASH_FADDR 0x0008
1180 #define ICH_FLASH_FDATA0 0x0010
1181 #define ICH_FLASH_FRACC 0x0050
1182 #define ICH_FLASH_FREG0 0x0054
1183 #define ICH_FLASH_FREG1 0x0058
1184 #define ICH_FLASH_FREG2 0x005C
1185 #define ICH_FLASH_FREG3 0x0060
1186 #define ICH_FLASH_FPR0 0x0074
1187 #define ICH_FLASH_FPR1 0x0078
1188 #define ICH_FLASH_SSFSTS 0x0090
1189 #define ICH_FLASH_SSFCTL 0x0092
1190 #define ICH_FLASH_PREOP 0x0094
1191 #define ICH_FLASH_OPTYPE 0x0096
1192 #define ICH_FLASH_OPMENU 0x0098
1193
1194 #define ICH_FLASH_REG_MAPSIZE 0x00A0
1195 #define ICH_FLASH_SECTOR_SIZE 4096
1196 #define ICH_GFPREG_BASE_MASK 0x1FFF
1197 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
1198
1199 #define ICH_NVM_SIG_WORD 0x13
1200 #define ICH_NVM_SIG_MASK 0xc000
1201 #define ICH_NVM_VALID_SIG_MASK 0xc0
1202 #define ICH_NVM_SIG_VALUE 0x80
1203
1204 #define NVM_SIZE_MULTIPLIER 4096 /* multiplier for NVMS field */
1205 #define WM_PCH_SPT_FLASHOFFSET 0xe000 /* offset of NVM access regs(PCH_SPT)*/
1206
1207 /* for PCI express Capability registers */
1208 #define WM_PCIE_DCSR2_16MS 0x00000005
1209
1210 /* SFF SFP ROM data */
1211 #define SFF_SFP_ID_OFF 0x00
1212 #define SFF_SFP_ID_UNKNOWN 0x00 /* Unknown */
1213 #define SFF_SFP_ID_SFF 0x02 /* Module soldered to motherboard */
1214 #define SFF_SFP_ID_SFP 0x03 /* SFP transceiver */
1215
1216 #define SFF_SFP_ETH_FLAGS_OFF 0x06
1217 #define SFF_SFP_ETH_FLAGS_1000SX 0x01
1218 #define SFF_SFP_ETH_FLAGS_1000LX 0x02
1219 #define SFF_SFP_ETH_FLAGS_1000CX 0x04
1220 #define SFF_SFP_ETH_FLAGS_1000T 0x08
1221 #define SFF_SFP_ETH_FLAGS_100FX 0x10
1222
1223 /* I21[01] PHY related definitions */
1224 #define GS40G_PAGE_SELECT 0x16
1225 #define GS40G_PAGE_SHIFT 16
1226 #define GS40G_OFFSET_MASK 0xffff
1227 #define GS40G_PHY_PLL_FREQ_PAGE 0xfc0000
1228 #define GS40G_PHY_PLL_FREQ_REG 0x000e
1229 #define GS40G_PHY_PLL_UNCONF 0xff
1230
1231 /* advanced TX descriptor for 82575 and newer */
1232 typedef union nq_txdesc {
1233 struct {
1234 uint64_t nqtxd_addr;
1235 uint32_t nqtxd_cmdlen;
1236 uint32_t nqtxd_fields;
1237 } nqtx_data;
1238 struct {
1239 uint32_t nqtxc_vl_len;
1240 uint32_t nqtxc_sn;
1241 uint32_t nqtxc_cmd;
1242 uint32_t nqtxc_mssidx;
1243 } nqrx_ctx;
1244 } __packed nq_txdesc_t;
1245
1246
1247 /* Commands for nqtxd_cmdlen and nqtxc_cmd */
1248 #define NQTX_CMD_EOP (1U << 24) /* end of packet */
1249 #define NQTX_CMD_IFCS (1U << 25) /* insert FCS */
1250 #define NQTX_CMD_RS (1U << 27) /* report status */
1251 #define NQTX_CMD_DEXT (1U << 29) /* descriptor extension */
1252 #define NQTX_CMD_VLE (1U << 30) /* VLAN enable */
1253 #define NQTX_CMD_TSE (1U << 31) /* TCP segmentation enable */
1254
1255 /* Descriptor types (if DEXT is set) */
1256 #define NQTX_DTYP_C (2U << 20) /* context */
1257 #define NQTX_DTYP_D (3U << 20) /* data */
1258
1259 #define NQTXD_FIELDS_IDX_SHIFT 4 /* context index shift */
1260 #define NQTXD_FIELDS_IDX_MASK 0xf
1261 #define NQTXD_FIELDS_PAYLEN_SHIFT 14 /* payload len shift */
1262 #define NQTXD_FIELDS_PAYLEN_MASK 0x3ffff
1263
1264 #define NQTXD_FIELDS_IXSM (1U << 8) /* do IP checksum */
1265 #define NQTXD_FIELDS_TUXSM (1U << 9) /* do TCP/UDP checksum */
1266
1267 #define NQTXC_VLLEN_IPLEN_SHIFT 0 /* IP header len */
1268 #define NQTXC_VLLEN_IPLEN_MASK 0x1ff
1269 #define NQTXC_VLLEN_MACLEN_SHIFT 9 /* MAC header len */
1270 #define NQTXC_VLLEN_MACLEN_MASK 0x7f
1271 #define NQTXC_VLLEN_VLAN_SHIFT 16 /* vlan number */
1272 #define NQTXC_VLLEN_VLAN_MASK 0xffff
1273
1274 #define NQTXC_CMD_MKRLOC_SHIFT 0 /* IP checksum offset */
1275 #define NQTXC_CMD_MKRLOC_MASK 0x1ff
1276 #define NQTXC_CMD_SNAP (1U << 9)
1277 #define NQTXC_CMD_IP4 (1U << 10)
1278 #define NQTXC_CMD_IP6 (0U << 10)
1279 #define NQTXC_CMD_TCP (1U << 11)
1280 #define NQTXC_CMD_UDP (0U << 11)
1281 #define NQTXC_MSSIDX_IDX_SHIFT 4 /* context index shift */
1282 #define NQTXC_MSSIDX_IDX_MASK 0xf
1283 #define NQTXC_MSSIDX_L4LEN_SHIFT 8 /* L4 header len shift */
1284 #define NQTXC_MSSIDX_L4LEN_MASK 0xff
1285 #define NQTXC_MSSIDX_MSS_SHIFT 16 /* MSS */
1286 #define NQTXC_MSSIDX_MSS_MASK 0xffff
1287