if_wmreg.h revision 1.40.2.1 1 /* $NetBSD: if_wmreg.h,v 1.40.2.1 2010/07/03 01:19:37 rmind 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 * Register description for the Intel i82542 (``Wiseman''),
40 * i82543 (``Livengood''), and i82544 (``Cordova'') Gigabit
41 * Ethernet chips.
42 */
43
44 /*
45 * The wiseman supports 64-bit PCI addressing. This structure
46 * describes the address in descriptors.
47 */
48 typedef struct wiseman_addr {
49 uint32_t wa_low; /* low-order 32 bits */
50 uint32_t wa_high; /* high-order 32 bits */
51 } __packed wiseman_addr_t;
52
53 /*
54 * The Wiseman receive descriptor.
55 *
56 * The receive descriptor ring must be aligned to a 4K boundary,
57 * and there must be an even multiple of 8 descriptors in the ring.
58 */
59 typedef struct wiseman_rxdesc {
60 wiseman_addr_t wrx_addr; /* buffer address */
61
62 uint16_t wrx_len; /* buffer length */
63 uint16_t wrx_cksum; /* checksum (starting at PCSS) */
64
65 uint8_t wrx_status; /* Rx status */
66 uint8_t wrx_errors; /* Rx errors */
67 uint16_t wrx_special; /* special field (VLAN, etc.) */
68 } __packed wiseman_rxdesc_t;
69
70 /* wrx_status bits */
71 #define WRX_ST_DD (1U << 0) /* descriptor done */
72 #define WRX_ST_EOP (1U << 1) /* end of packet */
73 #define WRX_ST_IXSM (1U << 2) /* ignore checksum indication */
74 #define WRX_ST_VP (1U << 3) /* VLAN packet */
75 #define WRX_ST_BPDU (1U << 4) /* ??? */
76 #define WRX_ST_TCPCS (1U << 5) /* TCP checksum performed */
77 #define WRX_ST_IPCS (1U << 6) /* IP checksum performed */
78 #define WRX_ST_PIF (1U << 7) /* passed in-exact filter */
79
80 /* wrx_error bits */
81 #define WRX_ER_CE (1U << 0) /* CRC error */
82 #define WRX_ER_SE (1U << 1) /* symbol error */
83 #define WRX_ER_SEQ (1U << 2) /* sequence error */
84 #define WRX_ER_ICE (1U << 3) /* ??? */
85 #define WRX_ER_CXE (1U << 4) /* carrier extension error */
86 #define WRX_ER_TCPE (1U << 5) /* TCP checksum error */
87 #define WRX_ER_IPE (1U << 6) /* IP checksum error */
88 #define WRX_ER_RXE (1U << 7) /* Rx data error */
89
90 /* wrx_special field for VLAN packets */
91 #define WRX_VLAN_ID(x) ((x) & 0x0fff) /* VLAN identifier */
92 #define WRX_VLAN_CFI (1U << 12) /* Canonical Form Indicator */
93 #define WRX_VLAN_PRI(x) (((x) >> 13) & 7)/* VLAN priority field */
94
95 /*
96 * The Wiseman transmit descriptor.
97 *
98 * The transmit descriptor ring must be aligned to a 4K boundary,
99 * and there must be an even multiple of 8 descriptors in the ring.
100 */
101 typedef struct wiseman_tx_fields {
102 uint8_t wtxu_status; /* Tx status */
103 uint8_t wtxu_options; /* options */
104 uint16_t wtxu_vlan; /* VLAN info */
105 } __packed wiseman_txfields_t;
106 typedef struct wiseman_txdesc {
107 wiseman_addr_t wtx_addr; /* buffer address */
108 uint32_t wtx_cmdlen; /* command and length */
109 wiseman_txfields_t wtx_fields; /* fields; see below */
110 } __packed wiseman_txdesc_t;
111
112 /* Commands for wtx_cmdlen */
113 #define WTX_CMD_EOP (1U << 24) /* end of packet */
114 #define WTX_CMD_IFCS (1U << 25) /* insert FCS */
115 #define WTX_CMD_RS (1U << 27) /* report status */
116 #define WTX_CMD_RPS (1U << 28) /* report packet sent */
117 #define WTX_CMD_DEXT (1U << 29) /* descriptor extension */
118 #define WTX_CMD_VLE (1U << 30) /* VLAN enable */
119 #define WTX_CMD_IDE (1U << 31) /* interrupt delay enable */
120
121 /* Descriptor types (if DEXT is set) */
122 #define WTX_DTYP_C (0U << 20) /* context */
123 #define WTX_DTYP_D (1U << 20) /* data */
124
125 /* wtx_fields status bits */
126 #define WTX_ST_DD (1U << 0) /* descriptor done */
127 #define WTX_ST_EC (1U << 1) /* excessive collisions */
128 #define WTX_ST_LC (1U << 2) /* late collision */
129 #define WTX_ST_TU (1U << 3) /* transmit underrun */
130
131 /* wtx_fields option bits for IP/TCP/UDP checksum offload */
132 #define WTX_IXSM (1U << 0) /* IP checksum offload */
133 #define WTX_TXSM (1U << 1) /* TCP/UDP checksum offload */
134
135 /* Maximum payload per Tx descriptor */
136 #define WTX_MAX_LEN 4096
137
138 /*
139 * The Livengood TCP/IP context descriptor.
140 */
141 struct livengood_tcpip_ctxdesc {
142 uint32_t tcpip_ipcs; /* IP checksum context */
143 uint32_t tcpip_tucs; /* TCP/UDP checksum context */
144 uint32_t tcpip_cmdlen;
145 uint32_t tcpip_seg; /* TCP segmentation context */
146 };
147
148 /* commands for context descriptors */
149 #define WTX_TCPIP_CMD_TCP (1U << 24) /* 1 = TCP, 0 = UDP */
150 #define WTX_TCPIP_CMD_IP (1U << 25) /* 1 = IPv4, 0 = IPv6 */
151 #define WTX_TCPIP_CMD_TSE (1U << 26) /* segmentation context valid */
152
153 #define WTX_TCPIP_IPCSS(x) ((x) << 0) /* checksum start */
154 #define WTX_TCPIP_IPCSO(x) ((x) << 8) /* checksum value offset */
155 #define WTX_TCPIP_IPCSE(x) ((x) << 16) /* checksum end */
156
157 #define WTX_TCPIP_TUCSS(x) ((x) << 0) /* checksum start */
158 #define WTX_TCPIP_TUCSO(x) ((x) << 8) /* checksum value offset */
159 #define WTX_TCPIP_TUCSE(x) ((x) << 16) /* checksum end */
160
161 #define WTX_TCPIP_SEG_STATUS(x) ((x) << 0)
162 #define WTX_TCPIP_SEG_HDRLEN(x) ((x) << 8)
163 #define WTX_TCPIP_SEG_MSS(x) ((x) << 16)
164
165 /*
166 * PCI config registers used by the Wiseman.
167 */
168 #define WM_PCI_MMBA PCI_MAPREG_START
169 /* registers for FLASH access on ICH8 */
170 #define WM_ICH8_FLASH 0x0014
171
172 /*
173 * Wiseman Control/Status Registers.
174 */
175 #define WMREG_CTRL 0x0000 /* Device Control Register */
176 #define CTRL_FD (1U << 0) /* full duplex */
177 #define CTRL_BEM (1U << 1) /* big-endian mode */
178 #define CTRL_PRIOR (1U << 2) /* 0 = receive, 1 = fair */
179 #define CTRL_LRST (1U << 3) /* link reset */
180 #define CTRL_GIO_M_DIS (1U << 3) /* disabl PCI master access */
181 #define CTRL_ASDE (1U << 5) /* auto speed detect enable */
182 #define CTRL_SLU (1U << 6) /* set link up */
183 #define CTRL_ILOS (1U << 7) /* invert loss of signal */
184 #define CTRL_SPEED(x) ((x) << 8) /* speed (Livengood) */
185 #define CTRL_SPEED_10 CTRL_SPEED(0)
186 #define CTRL_SPEED_100 CTRL_SPEED(1)
187 #define CTRL_SPEED_1000 CTRL_SPEED(2)
188 #define CTRL_SPEED_MASK CTRL_SPEED(3)
189 #define CTRL_FRCSPD (1U << 11) /* force speed (Livengood) */
190 #define CTRL_FRCFDX (1U << 12) /* force full-duplex (Livengood) */
191 #define CTRL_D_UD_EN (1U << 13) /* Dock/Undock enable */
192 #define CTRL_D_UD_POL (1U << 14) /* Defined polarity of Dock/Undock indication in SDP[0] */
193 #define CTRL_F_PHY_R (1U << 15) /* Reset both PHY ports, through PHYRST_N pin */
194 #define CTRL_EXT_LINK_EN (1U << 16) /* enable link status from external LINK_0 and LINK_1 pins */
195 #define CTRL_SWDPINS_SHIFT 18
196 #define CTRL_SWDPINS_MASK 0x0f
197 #define CTRL_SWDPIN(x) (1U << (CTRL_SWDPINS_SHIFT + (x)))
198 #define CTRL_SWDPIO_SHIFT 22
199 #define CTRL_SWDPIO_MASK 0x0f
200 #define CTRL_SWDPIO(x) (1U << (CTRL_SWDPIO_SHIFT + (x)))
201 #define CTRL_RST (1U << 26) /* device reset */
202 #define CTRL_RFCE (1U << 27) /* Rx flow control enable */
203 #define CTRL_TFCE (1U << 28) /* Tx flow control enable */
204 #define CTRL_VME (1U << 30) /* VLAN Mode Enable */
205 #define CTRL_PHY_RESET (1U << 31) /* PHY reset (Cordova) */
206
207 #define WMREG_CTRL_SHADOW 0x0004 /* Device Control Register (shadow) */
208
209 #define WMREG_STATUS 0x0008 /* Device Status Register */
210 #define STATUS_FD (1U << 0) /* full duplex */
211 #define STATUS_LU (1U << 1) /* link up */
212 #define STATUS_TCKOK (1U << 2) /* Tx clock running */
213 #define STATUS_RBCOK (1U << 3) /* Rx clock running */
214 #define STATUS_FUNCID_SHIFT 2 /* 82546 function ID */
215 #define STATUS_FUNCID_MASK 3 /* ... */
216 #define STATUS_TXOFF (1U << 4) /* Tx paused */
217 #define STATUS_TBIMODE (1U << 5) /* fiber mode (Livengood) */
218 #define STATUS_SPEED(x) ((x) << 6) /* speed indication */
219 #define STATUS_SPEED_10 STATUS_SPEED(0)
220 #define STATUS_SPEED_100 STATUS_SPEED(1)
221 #define STATUS_SPEED_1000 STATUS_SPEED(2)
222 #define STATUS_ASDV(x) ((x) << 8) /* auto speed det. val. (Livengood) */
223 #define STATUS_LAN_INIT_DONE (1U << 9) /* Lan Init Completion by NVM */
224 #define STATUS_MTXCKOK (1U << 10) /* MTXD clock running */
225 #define STATUS_PHYRA (1U << 10) /* PHY Reset Asserted (PCH) */
226 #define STATUS_PCI66 (1U << 11) /* 66MHz bus (Livengood) */
227 #define STATUS_BUS64 (1U << 12) /* 64-bit bus (Livengood) */
228 #define STATUS_PCIX_MODE (1U << 13) /* PCIX mode (Cordova) */
229 #define STATUS_PCIXSPD(x) ((x) << 14) /* PCIX speed indication (Cordova) */
230 #define STATUS_PCIXSPD_50_66 STATUS_PCIXSPD(0)
231 #define STATUS_PCIXSPD_66_100 STATUS_PCIXSPD(1)
232 #define STATUS_PCIXSPD_100_133 STATUS_PCIXSPD(2)
233 #define STATUS_PCIXSPD_MASK STATUS_PCIXSPD(3)
234 #define STATUS_GIO_M_ENA (1U << 19) /* GIO master enable */
235 #define STATUS_DEV_RST_SET (1U << 20) /* Device Reset Set */
236
237 #define WMREG_EECD 0x0010 /* EEPROM Control Register */
238 #define EECD_SK (1U << 0) /* clock */
239 #define EECD_CS (1U << 1) /* chip select */
240 #define EECD_DI (1U << 2) /* data in */
241 #define EECD_DO (1U << 3) /* data out */
242 #define EECD_FWE(x) ((x) << 4) /* flash write enable control */
243 #define EECD_FWE_DISABLED EECD_FWE(1)
244 #define EECD_FWE_ENABLED EECD_FWE(2)
245 #define EECD_EE_REQ (1U << 6) /* (shared) EEPROM request */
246 #define EECD_EE_GNT (1U << 7) /* (shared) EEPROM grant */
247 #define EECD_EE_PRES (1U << 8) /* EEPROM present */
248 #define EECD_EE_SIZE (1U << 9) /* EEPROM size
249 (0 = 64 word, 1 = 256 word) */
250 #define EECD_EE_AUTORD (1U << 9) /* auto read done */
251 #define EECD_EE_ABITS (1U << 10) /* EEPROM address bits
252 (based on type) */
253 #define EECD_EE_TYPE (1U << 13) /* EEPROM type
254 (0 = Microwire, 1 = SPI) */
255 #define EECD_SEC1VAL (1U << 22) /* Sector One Valid */
256
257 #define UWIRE_OPC_ERASE 0x04 /* MicroWire "erase" opcode */
258 #define UWIRE_OPC_WRITE 0x05 /* MicroWire "write" opcode */
259 #define UWIRE_OPC_READ 0x06 /* MicroWire "read" opcode */
260
261 #define SPI_OPC_WRITE 0x02 /* SPI "write" opcode */
262 #define SPI_OPC_READ 0x03 /* SPI "read" opcode */
263 #define SPI_OPC_A8 0x08 /* opcode bit 3 == address bit 8 */
264 #define SPI_OPC_WREN 0x06 /* SPI "set write enable" opcode */
265 #define SPI_OPC_WRDI 0x04 /* SPI "clear write enable" opcode */
266 #define SPI_OPC_RDSR 0x05 /* SPI "read status" opcode */
267 #define SPI_OPC_WRSR 0x01 /* SPI "write status" opcode */
268 #define SPI_MAX_RETRIES 5000 /* max wait of 5ms for RDY signal */
269
270 #define SPI_SR_RDY 0x01
271 #define SPI_SR_WEN 0x02
272 #define SPI_SR_BP0 0x04
273 #define SPI_SR_BP1 0x08
274 #define SPI_SR_WPEN 0x80
275
276 #define EEPROM_OFF_MACADDR 0x00 /* MAC address offset */
277 #define EEPROM_OFF_CFG1 0x0a /* config word 1 */
278 #define EEPROM_OFF_CFG2 0x0f /* config word 2 */
279 #define EEPROM_OFF_CFG3_PORTB 0x14 /* config word 3 */
280 #define EEPROM_INIT_3GIO_3 0x1a /* PCIe Initial Configuration Word 3 */
281 #define EEPROM_OFF_K1_CONFIG 0x1b /* NVM K1 Config */
282 #define EEPROM_OFF_SWDPIN 0x20 /* SWD Pins (Cordova) */
283 #define EEPROM_OFF_CFG3_PORTA 0x24 /* config word 3 */
284 #define EEPROM_ALT_MAC_ADDR_PTR 0x37 /* to the alternative MAC addresses */
285
286 #define EEPROM_CFG1_LVDID (1U << 0)
287 #define EEPROM_CFG1_LSSID (1U << 1)
288 #define EEPROM_CFG1_PME_CLOCK (1U << 2)
289 #define EEPROM_CFG1_PM (1U << 3)
290 #define EEPROM_CFG1_ILOS (1U << 4)
291 #define EEPROM_CFG1_SWDPIO_SHIFT 5
292 #define EEPROM_CFG1_SWDPIO_MASK (0xf << EEPROM_CFG1_SWDPIO_SHIFT)
293 #define EEPROM_CFG1_IPS1 (1U << 8)
294 #define EEPROM_CFG1_LRST (1U << 9)
295 #define EEPROM_CFG1_FD (1U << 10)
296 #define EEPROM_CFG1_FRCSPD (1U << 11)
297 #define EEPROM_CFG1_IPS0 (1U << 12)
298 #define EEPROM_CFG1_64_32_BAR (1U << 13)
299
300 #define EEPROM_CFG2_CSR_RD_SPLIT (1U << 1)
301 #define EEPROM_CFG2_82544_APM_EN (1U << 2)
302 #define EEPROM_CFG2_64_BIT (1U << 3)
303 #define EEPROM_CFG2_MAX_READ (1U << 4)
304 #define EEPROM_CFG2_DMCR_MAP (1U << 5)
305 #define EEPROM_CFG2_133_CAP (1U << 6)
306 #define EEPROM_CFG2_MSI_DIS (1U << 7)
307 #define EEPROM_CFG2_FLASH_DIS (1U << 8)
308 #define EEPROM_CFG2_FLASH_SIZE(x) (((x) & 3) >> 9)
309 #define EEPROM_CFG2_APM_EN (1U << 10)
310 #define EEPROM_CFG2_ANE (1U << 11)
311 #define EEPROM_CFG2_PAUSE(x) (((x) & 3) >> 12)
312 #define EEPROM_CFG2_ASDE (1U << 14)
313 #define EEPROM_CFG2_APM_PME (1U << 15)
314 #define EEPROM_CFG2_SWDPIO_SHIFT 4
315 #define EEPROM_CFG2_SWDPIO_MASK (0xf << EEPROM_CFG2_SWDPIO_SHIFT)
316 #define EEPROM_CFG2_MNGM_MASK (3U << 13) /* Manageability Operation mode */
317
318 #define EEPROM_K1_CONFIG_ENABLE 0x01
319
320 #define EEPROM_SWDPIN_MASK 0xdf
321 #define EEPROM_SWDPIN_SWDPIN_SHIFT 0
322 #define EEPROM_SWDPIN_SWDPIO_SHIFT 8
323
324 #define EEPROM_3GIO_3_ASPM_MASK (0x3 << 2) /* Active State PM Support */
325
326 #define EEPROM_CFG3_APME (1U << 10)
327
328 #define EEPROM_OFF_MACADDR_LAN1 3 /* macaddr offset from PTR (port 1) */
329 #define EEPROM_OFF_MACADDR_LAN2 6 /* macaddr offset from PTR (port 2) */
330 #define EEPROM_OFF_MACADDR_LAN3 9 /* macaddr offset from PTR (port 3) */
331
332 /*
333 * EEPROM Partitioning. See Table 6-1, "EEPROM Top Level Partitioning"
334 * in 82580's datasheet.
335 */
336 #define EEPROM_OFF_LAN1 0x0080 /* Offset for LAN1 (82580)*/
337 #define EEPROM_OFF_LAN2 0x00c0 /* Offset for LAN2 (82580)*/
338 #define EEPROM_OFF_LAN3 0x0100 /* Offset for LAN3 (82580)*/
339
340 #define WMREG_EERD 0x0014 /* EEPROM read */
341 #define EERD_DONE 0x02 /* done bit */
342 #define EERD_START 0x01 /* First bit for telling part to start operation */
343 #define EERD_ADDR_SHIFT 2 /* Shift to the address bits */
344 #define EERD_DATA_SHIFT 16 /* Offset to data in EEPROM read/write registers */
345
346 #define WMREG_CTRL_EXT 0x0018 /* Extended Device Control Register */
347 #define CTRL_EXT_GPI_EN(x) (1U << (x)) /* gpin interrupt enable */
348 #define CTRL_EXT_SWDPINS_SHIFT 4
349 #define CTRL_EXT_SWDPINS_MASK 0x0d
350 /* The bit order of the SW Definable pin is not 6543 but 3654! */
351 #define CTRL_EXT_SWDPIN(x) (1U << (CTRL_EXT_SWDPINS_SHIFT \
352 + ((x) == 3 ? 3 : ((x) - 4))))
353 #define CTRL_EXT_SWDPIO_SHIFT 8
354 #define CTRL_EXT_SWDPIO_MASK 0x0d
355 #define CTRL_EXT_SWDPIO(x) (1U << (CTRL_EXT_SWDPIO_SHIFT \
356 + ((x) == 3 ? 3 : ((x) - 4))))
357 #define CTRL_EXT_ASDCHK (1U << 12) /* ASD check */
358 #define CTRL_EXT_EE_RST (1U << 13) /* EEPROM reset */
359 #define CTRL_EXT_IPS (1U << 14) /* invert power state bit 0 */
360 #define CTRL_EXT_SPD_BYPS (1U << 15) /* speed select bypass */
361 #define CTRL_EXT_IPS1 (1U << 16) /* invert power state bit 1 */
362 #define CTRL_EXT_RO_DIS (1U << 17) /* relaxed ordering disabled */
363 #define CTRL_EXT_LINK_MODE_MASK 0x00C00000
364 #define CTRL_EXT_LINK_MODE_GMII 0x00000000
365 #define CTRL_EXT_LINK_MODE_KMRN 0x00000000
366 #define CTRL_EXT_LINK_MODE_1000KX 0x00400000
367 #define CTRL_EXT_LINK_MODE_SGMII 0x00800000
368 #define CTRL_EXT_LINK_MODE_PCIX_SERDES 0x00800000
369 #define CTRL_EXT_LINK_MODE_TBI 0x00C00000
370 #define CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
371 #define CTRL_EXT_PHYPDEN 0x00100000
372 #define CTRL_EXT_I2C_ENA 0x02000000 /* I2C enable */
373 #define CTRL_EXT_DRV_LOAD 0x10000000
374
375
376 #define WMREG_MDIC 0x0020 /* MDI Control Register */
377 #define MDIC_DATA(x) ((x) & 0xffff)
378 #define MDIC_REGADD(x) ((x) << 16)
379 #define MDIC_PHYADD(x) ((x) << 21)
380 #define MDIC_OP_WRITE (1U << 26)
381 #define MDIC_OP_READ (2U << 26)
382 #define MDIC_READY (1U << 28)
383 #define MDIC_I (1U << 29) /* interrupt on MDI complete */
384 #define MDIC_E (1U << 30) /* MDI error */
385
386 #define WMREG_SCTL 0x0024 /* SerDes Control - RW */
387 /*
388 * These 4 macros are also used for other 8bit control registers on the
389 * 82575
390 */
391 #define SCTL_CTL_READY (1U << 31)
392 #define SCTL_CTL_DATA_MASK 0x000000ff
393 #define SCTL_CTL_ADDR_SHIFT 8
394 #define SCTL_CTL_POLL_TIMEOUT 640
395
396 #define WMREG_FCAL 0x0028 /* Flow Control Address Low */
397 #define FCAL_CONST 0x00c28001 /* Flow Control MAC addr low */
398
399 #define WMREG_FCAH 0x002c /* Flow Control Address High */
400 #define FCAH_CONST 0x00000100 /* Flow Control MAC addr high */
401
402 #define WMREG_FCT 0x0030 /* Flow Control Type */
403
404 #define WMREG_VET 0x0038 /* VLAN Ethertype */
405
406 #define WMREG_RAL_BASE 0x0040 /* Receive Address List */
407 #define WMREG_CORDOVA_RAL_BASE 0x5400
408 #define WMREG_RAL_LO(b, x) ((b) + ((x) << 3))
409 #define WMREG_RAL_HI(b, x) (WMREG_RAL_LO(b, x) + 4)
410 /*
411 * Receive Address List: The LO part is the low-order 32-bits
412 * of the MAC address. The HI part is the high-order 16-bits
413 * along with a few control bits.
414 */
415 #define RAL_AS(x) ((x) << 16) /* address select */
416 #define RAL_AS_DEST RAL_AS(0) /* (cordova?) */
417 #define RAL_AS_SOURCE RAL_AS(1) /* (cordova?) */
418 #define RAL_RDR1 (1U << 30) /* put packet in alt. rx ring */
419 #define RAL_AV (1U << 31) /* entry is valid */
420
421 #define WM_RAL_TABSIZE 16
422 #define WM_ICH8_RAL_TABSIZE 7
423
424 #define WMREG_ICR 0x00c0 /* Interrupt Cause Register */
425 #define ICR_TXDW (1U << 0) /* Tx desc written back */
426 #define ICR_TXQE (1U << 1) /* Tx queue empty */
427 #define ICR_LSC (1U << 2) /* link status change */
428 #define ICR_RXSEQ (1U << 3) /* receive sequence error */
429 #define ICR_RXDMT0 (1U << 4) /* Rx ring 0 nearly empty */
430 #define ICR_RXO (1U << 6) /* Rx overrun */
431 #define ICR_RXT0 (1U << 7) /* Rx ring 0 timer */
432 #define ICR_MDAC (1U << 9) /* MDIO access complete */
433 #define ICR_RXCFG (1U << 10) /* Receiving /C/ */
434 #define ICR_GPI(x) (1U << (x)) /* general purpose interrupts */
435 #define ICR_INT (1U << 31) /* device generated an interrupt */
436
437 #define WMREG_ITR 0x00c4 /* Interrupt Throttling Register */
438 #define ITR_IVAL_MASK 0xffff /* Interval mask */
439 #define ITR_IVAL_SHIFT 0 /* Interval shift */
440
441 #define WMREG_ICS 0x00c8 /* Interrupt Cause Set Register */
442 /* See ICR bits. */
443
444 #define WMREG_IMS 0x00d0 /* Interrupt Mask Set Register */
445 /* See ICR bits. */
446
447 #define WMREG_IMC 0x00d8 /* Interrupt Mask Clear Register */
448 /* See ICR bits. */
449
450 #define WMREG_RCTL 0x0100 /* Receive Control */
451 #define RCTL_EN (1U << 1) /* receiver enable */
452 #define RCTL_SBP (1U << 2) /* store bad packets */
453 #define RCTL_UPE (1U << 3) /* unicast promisc. enable */
454 #define RCTL_MPE (1U << 4) /* multicast promisc. enable */
455 #define RCTL_LPE (1U << 5) /* large packet enable */
456 #define RCTL_LBM(x) ((x) << 6) /* loopback mode */
457 #define RCTL_LBM_NONE RCTL_LBM(0)
458 #define RCTL_LBM_PHY RCTL_LBM(3)
459 #define RCTL_RDMTS(x) ((x) << 8) /* receive desc. min thresh size */
460 #define RCTL_RDMTS_1_2 RCTL_RDMTS(0)
461 #define RCTL_RDMTS_1_4 RCTL_RDMTS(1)
462 #define RCTL_RDMTS_1_8 RCTL_RDMTS(2)
463 #define RCTL_RDMTS_MASK RCTL_RDMTS(3)
464 #define RCTL_MO(x) ((x) << 12) /* multicast offset */
465 #define RCTL_BAM (1U << 15) /* broadcast accept mode */
466 #define RCTL_2k (0 << 16) /* 2k Rx buffers */
467 #define RCTL_1k (1 << 16) /* 1k Rx buffers */
468 #define RCTL_512 (2 << 16) /* 512 byte Rx buffers */
469 #define RCTL_256 (3 << 16) /* 256 byte Rx buffers */
470 #define RCTL_BSEX_16k (1 << 16) /* 16k Rx buffers (BSEX) */
471 #define RCTL_BSEX_8k (2 << 16) /* 8k Rx buffers (BSEX) */
472 #define RCTL_BSEX_4k (3 << 16) /* 4k Rx buffers (BSEX) */
473 #define RCTL_DPF (1U << 22) /* discard pause frames */
474 #define RCTL_PMCF (1U << 23) /* pass MAC control frames */
475 #define RCTL_BSEX (1U << 25) /* buffer size extension (Livengood) */
476 #define RCTL_SECRC (1U << 26) /* strip Ethernet CRC */
477
478 #define WMREG_OLD_RDTR0 0x0108 /* Receive Delay Timer (ring 0) */
479 #define WMREG_RDTR 0x2820
480 #define RDTR_FPD (1U << 31) /* flush partial descriptor */
481
482 #define WMREG_RADV 0x282c /* Receive Interrupt Absolute Delay Timer */
483
484 #define WMREG_OLD_RDBAL0 0x0110 /* Receive Descriptor Base Low (ring 0) */
485 #define WMREG_RDBAL 0x2800
486 #define WMREG_RDBAL_2 0x0c00 /* for 82576 ... */
487
488 #define WMREG_OLD_RDBAH0 0x0114 /* Receive Descriptor Base High (ring 0) */
489 #define WMREG_RDBAH 0x2804
490 #define WMREG_RDBAH_2 0x0c04 /* for 82576 ... */
491
492 #define WMREG_OLD_RDLEN0 0x0118 /* Receive Descriptor Length (ring 0) */
493 #define WMREG_RDLEN 0x2808
494 #define WMREG_RDLEN_2 0x0c08 /* for 82576 ... */
495
496 #define WMREG_SRRCTL 0x280c /* additional recieve control used in 82575 ... */
497 #define WMREG_SRRCTL_2 0x0c0c /* for 82576 ... */
498 #define SRRCTL_BSIZEPKT_MASK 0x0000007f
499 #define SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
500 #define SRRCTL_BSIZEHDRSIZE_MASK 0x00000f00
501 #define SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
502 #define SRRCTL_DESCTYPE_LEGACY 0x00000000
503 #define SRRCTL_DESCTYPE_ADV_ONEBUF (1U << 25)
504 #define SRRCTL_DESCTYPE_HDR_SPLIT (2U << 25)
505 #define SRRCTL_DESCTYPE_HDR_REPLICATION (3U << 25)
506 #define SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT (4U << 25)
507 #define SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS (5U << 25) /* 82575 only */
508 #define SRRCTL_DESCTYPE_MASK (7U << 25)
509 #define SRRCTL_DROP_EN 0x80000000
510
511 #define WMREG_OLD_RDH0 0x0120 /* Receive Descriptor Head (ring 0) */
512 #define WMREG_RDH 0x2810
513 #define WMREG_RDH_2 0x0c10 /* for 82576 ... */
514
515 #define WMREG_OLD_RDT0 0x0128 /* Receive Descriptor Tail (ring 0) */
516 #define WMREG_RDT 0x2818
517 #define WMREG_RDT_2 0x0c18 /* for 82576 ... */
518
519 #define WMREG_RXDCTL 0x2828 /* Receive Descriptor Control */
520 #define WMREG_RXDCTL_2 0x0c28 /* for 82576 ... */
521 #define RXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
522 #define RXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
523 #define RXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
524 #define RXDCTL_GRAN (1U << 24) /* 0 = cacheline, 1 = descriptor */
525 /* flags used starting with 82575 ... */
526 #define RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
527 #define RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */
528
529 #define WMREG_OLD_RDTR1 0x0130 /* Receive Delay Timer (ring 1) */
530
531 #define WMREG_OLD_RDBA1_LO 0x0138 /* Receive Descriptor Base Low (ring 1) */
532
533 #define WMREG_OLD_RDBA1_HI 0x013c /* Receive Descriptor Base High (ring 1) */
534
535 #define WMREG_OLD_RDLEN1 0x0140 /* Receive Drscriptor Length (ring 1) */
536
537 #define WMREG_OLD_RDH1 0x0148
538
539 #define WMREG_OLD_RDT1 0x0150
540
541 #define WMREG_OLD_FCRTH 0x0160 /* Flow Control Rx Threshold Hi (OLD) */
542 #define WMREG_FCRTL 0x2160 /* Flow Control Rx Threshold Lo */
543 #define FCRTH_DFLT 0x00008000
544
545 #define WMREG_OLD_FCRTL 0x0168 /* Flow Control Rx Threshold Lo (OLD) */
546 #define WMREG_FCRTH 0x2168 /* Flow Control Rx Threhsold Hi */
547 #define FCRTL_DFLT 0x00004000
548 #define FCRTL_XONE 0x80000000 /* Enable XON frame transmission */
549
550 #define WMREG_FCTTV 0x0170 /* Flow Control Transmit Timer Value */
551 #define FCTTV_DFLT 0x00000600
552
553 #define WMREG_TXCW 0x0178 /* Transmit Configuration Word (TBI mode) */
554 /* See MII ANAR_X bits. */
555 #define TXCW_SYM_PAUSE (1U << 7) /* sym pause request */
556 #define TXCW_ASYM_PAUSE (1U << 8) /* asym pause request */
557 #define TXCW_TxConfig (1U << 30) /* Tx Config */
558 #define TXCW_ANE (1U << 31) /* Autonegotiate */
559
560 #define WMREG_RXCW 0x0180 /* Receive Configuration Word (TBI mode) */
561 /* See MII ANLPAR_X bits. */
562 #define RXCW_NC (1U << 26) /* no carrier */
563 #define RXCW_IV (1U << 27) /* config invalid */
564 #define RXCW_CC (1U << 28) /* config change */
565 #define RXCW_C (1U << 29) /* /C/ reception */
566 #define RXCW_SYNCH (1U << 30) /* synchronized */
567 #define RXCW_ANC (1U << 31) /* autonegotiation complete */
568
569 #define WMREG_MTA 0x0200 /* Multicast Table Array */
570 #define WMREG_CORDOVA_MTA 0x5200
571
572 #define WMREG_TCTL 0x0400 /* Transmit Control Register */
573 #define TCTL_EN (1U << 1) /* transmitter enable */
574 #define TCTL_PSP (1U << 3) /* pad short packets */
575 #define TCTL_CT(x) (((x) & 0xff) << 4) /* 4:11 - collision threshold */
576 #define TCTL_COLD(x) (((x) & 0x3ff) << 12) /* 12:21 - collision distance */
577 #define TCTL_SWXOFF (1U << 22) /* software XOFF */
578 #define TCTL_RTLC (1U << 24) /* retransmit on late collision */
579 #define TCTL_NRTU (1U << 25) /* no retransmit on underrun */
580 #define TCTL_MULR (1U << 28) /* multiple request */
581
582 #define TX_COLLISION_THRESHOLD 15
583 #define TX_COLLISION_DISTANCE_HDX 512
584 #define TX_COLLISION_DISTANCE_FDX 64
585
586 #define WMREG_TCTL_EXT 0x0404 /* Transmit Control Register */
587 #define TCTL_EXT_BST_MASK 0x000003FF /* Backoff Slot Time */
588 #define TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */
589
590 #define DEFAULT_80003ES2LAN_TCTL_EXT_GCEX 0x00010000
591
592 #define WMREG_TQSA_LO 0x0408
593
594 #define WMREG_TQSA_HI 0x040c
595
596 #define WMREG_TIPG 0x0410 /* Transmit IPG Register */
597 #define TIPG_IPGT(x) (x) /* IPG transmit time */
598 #define TIPG_IPGR1(x) ((x) << 10) /* IPG receive time 1 */
599 #define TIPG_IPGR2(x) ((x) << 20) /* IPG receive time 2 */
600
601 #define TIPG_WM_DFLT (TIPG_IPGT(0x0a) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x0a))
602 #define TIPG_LG_DFLT (TIPG_IPGT(0x06) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
603 #define TIPG_1000T_DFLT (TIPG_IPGT(0x08) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
604 #define TIPG_1000T_80003_DFLT \
605 (TIPG_IPGT(0x08) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
606 #define TIPG_10_100_80003_DFLT \
607 (TIPG_IPGT(0x09) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
608
609 #define WMREG_TQC 0x0418
610
611 #define WMREG_EEWR 0x102c /* EEPROM write */
612
613 #define WMREG_RDFH 0x2410 /* Receive Data FIFO Head */
614
615 #define WMREG_RDFT 0x2418 /* Receive Data FIFO Tail */
616
617 #define WMREG_RDFHS 0x2420 /* Receive Data FIFO Head Saved */
618
619 #define WMREG_RDFTS 0x2428 /* Receive Data FIFO Tail Saved */
620
621 #define WMREG_TDFH 0x3410 /* Transmit Data FIFO Head */
622
623 #define WMREG_TDFT 0x3418 /* Transmit Data FIFO Tail */
624
625 #define WMREG_TDFHS 0x3420 /* Transmit Data FIFO Head Saved */
626
627 #define WMREG_TDFTS 0x3428 /* Transmit Data FIFO Tail Saved */
628
629 #define WMREG_TDFPC 0x3430 /* Transmit Data FIFO Packet Count */
630
631 #define WMREG_OLD_TBDAL 0x0420 /* Transmit Descriptor Base Lo */
632 #define WMREG_TBDAL 0x3800
633
634 #define WMREG_OLD_TBDAH 0x0424 /* Transmit Descriptor Base Hi */
635 #define WMREG_TBDAH 0x3804
636
637 #define WMREG_OLD_TDLEN 0x0428 /* Transmit Descriptor Length */
638 #define WMREG_TDLEN 0x3808
639
640 #define WMREG_OLD_TDH 0x0430 /* Transmit Descriptor Head */
641 #define WMREG_TDH 0x3810
642
643 #define WMREG_OLD_TDT 0x0438 /* Transmit Descriptor Tail */
644 #define WMREG_TDT 0x3818
645
646 #define WMREG_OLD_TIDV 0x0440 /* Transmit Delay Interrupt Value */
647 #define WMREG_TIDV 0x3820
648
649 #define WMREG_TXDCTL 0x3828 /* Trandmit Descriptor Control */
650 #define TXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
651 #define TXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
652 #define TXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
653 /* flags used starting with 82575 ... */
654 #define TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
655 #define TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */
656 #define TXDCTL_PRIORITY 0x08000000
657
658 #define WMREG_TADV 0x382c /* Transmit Absolute Interrupt Delay Timer */
659
660 #define WMREG_AIT 0x0458 /* Adaptive IFS Throttle */
661
662 #define WMREG_VFTA 0x0600
663
664 #define WM_MC_TABSIZE 128
665 #define WM_ICH8_MC_TABSIZE 32
666 #define WM_VLAN_TABSIZE 128
667
668 #define WMREG_PBA 0x1000 /* Packet Buffer Allocation */
669 #define PBA_BYTE_SHIFT 10 /* KB -> bytes */
670 #define PBA_ADDR_SHIFT 7 /* KB -> quadwords */
671 #define PBA_8K 0x0008
672 #define PBA_10K 0x000a
673 #define PBA_12K 0x000c
674 #define PBA_16K 0x0010 /* 16K, default Tx allocation */
675 #define PBA_20K 0x0014
676 #define PBA_22K 0x0016
677 #define PBA_24K 0x0018
678 #define PBA_30K 0x001e
679 #define PBA_32K 0x0020
680 #define PBA_35K 0x0023
681 #define PBA_40K 0x0028
682 #define PBA_48K 0x0030 /* 48K, default Rx allocation */
683 #define PBA_64K 0x0040
684
685 #define WMREG_PBS 0x1008 /* Packet Buffer Size (ICH) */
686
687 #define WMREG_EEMNGCTL 0x1010 /* MNG EEprom Control */
688 #define EEMNGCTL_CFGDONE_0 0x040000 /* MNG config cycle done */
689 #define EEMNGCTL_CFGDONE_1 0x080000 /* 2nd port */
690
691 #define WMREG_I2CCMD 0x1028 /* SFPI2C Command Register - RW */
692 #define I2CCMD_REG_ADDR_SHIFT 16
693 #define I2CCMD_REG_ADDR 0x00ff0000
694 #define I2CCMD_PHY_ADDR_SHIFT 24
695 #define I2CCMD_PHY_ADDR 0x07000000
696 #define I2CCMD_OPCODE_READ 0x08000000
697 #define I2CCMD_OPCODE_WRITE 0x00000000
698 #define I2CCMD_RESET 0x10000000
699 #define I2CCMD_READY 0x20000000
700 #define I2CCMD_INTERRUPT_ENA 0x40000000
701 #define I2CCMD_ERROR 0x80000000
702 #define MAX_SGMII_PHY_REG_ADDR 255
703 #define I2CCMD_PHY_TIMEOUT 200
704
705 #define WMREG_EICS 0x01520 /* Ext. Interrupt Cause Set - WO */
706 #define WMREG_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */
707 #define WMREG_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */
708 #define WMREG_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */
709 #define WMREG_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */
710
711 #define WMREG_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */
712
713 #define EITR_RX_QUEUE0 0x00000001 /* Rx Queue 0 Interrupt */
714 #define EITR_RX_QUEUE1 0x00000002 /* Rx Queue 1 Interrupt */
715 #define EITR_RX_QUEUE2 0x00000004 /* Rx Queue 2 Interrupt */
716 #define EITR_RX_QUEUE3 0x00000008 /* Rx Queue 3 Interrupt */
717 #define EITR_TX_QUEUE0 0x00000100 /* Tx Queue 0 Interrupt */
718 #define EITR_TX_QUEUE1 0x00000200 /* Tx Queue 1 Interrupt */
719 #define EITR_TX_QUEUE2 0x00000400 /* Tx Queue 2 Interrupt */
720 #define EITR_TX_QUEUE3 0x00000800 /* Tx Queue 3 Interrupt */
721 #define EITR_TCP_TIMER 0x40000000 /* TCP Timer */
722 #define EITR_OTHER 0x80000000 /* Interrupt Cause Active */
723
724 #define WMREG_EITR(x) (0x01680 + (0x4 * (x)))
725 #define EITR_ITR_INT_MASK 0x0000ffff
726
727 #define WMREG_TXDMAC 0x3000 /* Transfer DMA Control */
728 #define TXDMAC_DPP (1U << 0) /* disable packet prefetch */
729
730 #define WMREG_KABGTXD 0x3004 /* AFE and Gap Transmit Ref Data */
731 #define KABGTXD_BGSQLBIAS 0x00050000
732
733 #define WMREG_TSPMT 0x3830 /* TCP Segmentation Pad and Minimum
734 Threshold (Cordova) */
735
736 #define WMREG_TARC0 0x3840 /* Tx arbitration count */
737
738 #define TSPMT_TSMT(x) (x) /* TCP seg min transfer */
739 #define TSPMT_TSPBP(x) ((x) << 16) /* TCP seg pkt buf padding */
740
741 #define WMREG_CRCERRS 0x4000 /* CRC Error Count */
742 #define WMREG_ALGNERRC 0x4004 /* Alignment Error Count */
743 #define WMREG_SYMERRC 0x4008 /* Symbol Error Count */
744 #define WMREG_RXERRC 0x400c /* receive error Count - R/clr */
745 #define WMREG_MPC 0x4010 /* Missed Packets Count - R/clr */
746 #define WMREG_COLC 0x4028 /* collision Count - R/clr */
747 #define WMREG_SEC 0x4038 /* Sequence Error Count */
748 #define WMREG_CEXTERR 0x403c /* Carrier Extension Error Count */
749 #define WMREG_RLEC 0x4040 /* Receive Length Error Count */
750 #define WMREG_XONRXC 0x4048 /* XON Rx Count - R/clr */
751 #define WMREG_XONTXC 0x404c /* XON Tx Count - R/clr */
752 #define WMREG_XOFFRXC 0x4050 /* XOFF Rx Count - R/clr */
753 #define WMREG_XOFFTXC 0x4054 /* XOFF Tx Count - R/clr */
754 #define WMREG_FCRUC 0x4058 /* Flow Control Rx Unsupported Count - R/clr */
755 #define WMREG_RNBC 0x40a0 /* Receive No Buffers Count */
756
757 #define WMREG_KUMCTRLSTA 0x0034 /* MAC-PHY interface - RW */
758 #define KUMCTRLSTA_MASK 0x0000FFFF
759 #define KUMCTRLSTA_OFFSET 0x001F0000
760 #define KUMCTRLSTA_OFFSET_SHIFT 16
761 #define KUMCTRLSTA_REN 0x00200000
762
763 #define KUMCTRLSTA_OFFSET_FIFO_CTRL 0x00000000
764 #define KUMCTRLSTA_OFFSET_CTRL 0x00000001
765 #define KUMCTRLSTA_OFFSET_INB_CTRL 0x00000002
766 #define KUMCTRLSTA_OFFSET_DIAG 0x00000003
767 #define KUMCTRLSTA_OFFSET_TIMEOUTS 0x00000004
768 #define KUMCTRLSTA_OFFSET_K1_CONFIG 0x00000007
769 #define KUMCTRLSTA_OFFSET_INB_PARAM 0x00000009
770 #define KUMCTRLSTA_OFFSET_HD_CTRL 0x00000010
771 #define KUMCTRLSTA_OFFSET_M2P_SERDES 0x0000001E
772 #define KUMCTRLSTA_OFFSET_M2P_MODES 0x0000001F
773
774 /* FIFO Control */
775 #define KUMCTRLSTA_FIFO_CTRL_RX_BYPASS 0x00000008
776 #define KUMCTRLSTA_FIFO_CTRL_TX_BYPASS 0x00000800
777
778 /* In-Band Control */
779 #define KUMCTRLSTA_INB_CTRL_LINK_TMOUT_DFLT 0x00000500
780 #define KUMCTRLSTA_INB_CTRL_DIS_PADDING 0x00000010
781
782 /* Diag */
783 #define KUMCTRLSTA_DIAG_NELPBK 0x1000
784
785 /* K1 Config */
786 #define KUMCTRLSTA_K1_ENABLE 0x0002
787
788 /* Half-Duplex Control */
789 #define KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x00000004
790 #define KUMCTRLSTA_HD_CTRL_1000_DEFAULT 0x00000000
791
792 #define WMREG_MDPHYA 0x003C /* PHY address - RW */
793
794 #define WMREG_RXCSUM 0x5000 /* Receive Checksum register */
795 #define RXCSUM_PCSS 0x000000ff /* Packet Checksum Start */
796 #define RXCSUM_IPOFL (1U << 8) /* IP checksum offload */
797 #define RXCSUM_TUOFL (1U << 9) /* TCP/UDP checksum offload */
798 #define RXCSUM_IPV6OFL (1U << 10) /* IPv6 checksum offload */
799
800 #define WMREG_RLPML 0x5004 /* Rx Long Packet Max Length */
801
802 #define WMREG_WUC 0x5800 /* Wakeup Control */
803 #define WUC_APME 0x00000001 /* APM Enable */
804 #define WUC_PME_EN 0x00000002 /* PME Enable */
805
806 #define WMREG_WUFC 0x5808 /* Wakeup Filter COntrol */
807 #define WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
808 #define WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
809 #define WUFC_MC 0x00000008 /* Directed Multicast Wakeup En */
810 #define WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
811 #define WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup En */
812 #define WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup En */
813 #define WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup En */
814
815 #define WMREG_MANC 0x5820 /* Management Control */
816 #define MANC_SMBUS_EN 0x00000001
817 #define MANC_ASF_EN 0x00000002
818 #define MANC_ARP_EN 0x00002000
819 #define MANC_RECV_TCO_EN 0x00020000
820 #define MANC_BLK_PHY_RST_ON_IDE 0x00040000
821 #define MANC_EN_MAC_ADDR_FILTER 0x00100000
822 #define MANC_EN_MNG2HOST 0x00200000
823
824 #define WMREG_MANC2H 0x5860 /* Manaegment Control To Host - RW */
825 #define MANC2H_PORT_623 (1 << 5)
826 #define MANC2H_PORT_624 (1 << 6)
827
828 #define WMREG_GCR 0x5b00 /* PCIe Control */
829 #define GCR_RXD_NO_SNOOP 0x00000001
830 #define GCR_RXDSCW_NO_SNOOP 0x00000002
831 #define GCR_RXDSCR_NO_SNOOP 0x00000004
832 #define GCR_TXD_NO_SNOOP 0x00000008
833 #define GCR_TXDSCW_NO_SNOOP 0x00000010
834 #define GCR_TXDSCR_NO_SNOOP 0x00000020
835 #define GCR_CMPL_TMOUT_MASK 0x0000f000
836 #define GCR_CMPL_TMOUT_10MS 0x00001000
837 #define GCR_CMPL_TMOUT_RESEND 0x00010000
838 #define GCR_CAP_VER2 0x00040000
839
840 #define WMREG_FACTPS 0x5b30 /* Function Active and Power State to MNG */
841 #define FACTPS_MNGCG 0x20000000
842 #define FACTPS_LFS 0x40000000 /* LAN Function Select */
843
844 #define WMREG_GIOCTL 0x5b44 /* GIO Analog Control Register */
845 #define WMREG_CCMCTL 0x5b48 /* CCM Control Register */
846 #define WMREG_SCCTL 0x5b4c /* PCIc PLL Configuration Register */
847
848 #define WMREG_SWSM 0x5b50 /* SW Semaphore */
849 #define SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
850 #define SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
851 #define SWSM_WMNG 0x00000004 /* Wake MNG Clock */
852 #define SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */
853
854 #define WMREG_FWSM 0x5b54 /* FW Semaphore */
855 #define FWSM_MODE_MASK 0xe
856 #define FWSM_MODE_SHIFT 0x1
857 #define MNG_ICH_IAMT_MODE 0x2 /* PT mode? */
858 #define MNG_IAMT_MODE 0x3
859 #define FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI reset */
860
861 #define WMREG_SW_FW_SYNC 0x5b5c /* software-firmware semaphore */
862 #define SWFW_EEP_SM 0x0001 /* eeprom access */
863 #define SWFW_PHY0_SM 0x0002 /* first ctrl phy access */
864 #define SWFW_PHY1_SM 0x0004 /* second ctrl phy access */
865 #define SWFW_MAC_CSR_SM 0x0008
866 #define SWFW_PHY2_SM 0x0020 /* first ctrl phy access */
867 #define SWFW_PHY3_SM 0x0040 /* first ctrl phy access */
868 #define SWFW_SOFT_SHIFT 0 /* software semaphores */
869 #define SWFW_FIRM_SHIFT 16 /* firmware semaphores */
870
871 #define WMREG_CRC_OFFSET 0x5f50
872
873 #define WMREG_EXTCNFCTR 0x0f00 /* Extended Configuration Control */
874 #define EXTCNFCTR_PCIE_WRITE_ENABLE 0x00000001
875 #define EXTCNFCTR_PHY_WRITE_ENABLE 0x00000002
876 #define EXTCNFCTR_D_UD_ENABLE 0x00000004
877 #define EXTCNFCTR_D_UD_LATENCY 0x00000008
878 #define EXTCNFCTR_D_UD_OWNER 0x00000010
879 #define EXTCNFCTR_MDIO_SW_OWNERSHIP 0x00000020
880 #define EXTCNFCTR_MDIO_HW_OWNERSHIP 0x00000040
881 #define EXTCNFCTR_EXT_CNF_POINTER 0x0FFF0000
882 #define E1000_EXTCNF_CTRL_SWFLAG EXTCNFCTR_MDIO_SW_OWNERSHIP
883
884 #define WMREG_PHY_CTRL 0x0f10 /* PHY control */
885 #define PHY_CTRL_SPD_EN (1 << 0)
886 #define PHY_CTRL_D0A_LPLU (1 << 1)
887 #define PHY_CTRL_NOND0A_LPLU (1 << 2)
888 #define PHY_CTRL_NOND0A_GBE_DIS (1 << 3)
889 #define PHY_CTRL_GBE_DIS (1 << 4)
890
891 /* ich8 flash control */
892 #define ICH_FLASH_COMMAND_TIMEOUT 5000 /* 5000 uSecs - adjusted */
893 #define ICH_FLASH_ERASE_TIMEOUT 3000000 /* Up to 3 seconds - worst case */
894 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10 /* 10 cycles */
895 #define ICH_FLASH_SEG_SIZE_256 256
896 #define ICH_FLASH_SEG_SIZE_4K 4096
897 #define ICH_FLASH_SEG_SIZE_64K 65536
898
899 #define ICH_CYCLE_READ 0x0
900 #define ICH_CYCLE_RESERVED 0x1
901 #define ICH_CYCLE_WRITE 0x2
902 #define ICH_CYCLE_ERASE 0x3
903
904 #define ICH_FLASH_GFPREG 0x0000
905 #define ICH_FLASH_HSFSTS 0x0004 /* Flash Status Register */
906 #define HSFSTS_DONE 0x0001 /* Flash Cycle Done */
907 #define HSFSTS_ERR 0x0002 /* Flash Cycle Error */
908 #define HSFSTS_DAEL 0x0004 /* Direct Access error Log */
909 #define HSFSTS_ERSZ_MASK 0x0018 /* Block/Sector Erase Size */
910 #define HSFSTS_ERSZ_SHIFT 3
911 #define HSFSTS_FLINPRO 0x0020 /* flash SPI cycle in Progress */
912 #define HSFSTS_FLDVAL 0x4000 /* Flash Descriptor Valid */
913 #define HSFSTS_FLLK 0x8000 /* Flash Configuration Lock-Down */
914 #define ICH_FLASH_HSFCTL 0x0006 /* Flash control Register */
915 #define HSFCTL_GO 0x0001 /* Flash Cycle Go */
916 #define HSFCTL_CYCLE_MASK 0x0006 /* Flash Cycle */
917 #define HSFCTL_CYCLE_SHIFT 1
918 #define HSFCTL_BCOUNT_MASK 0x0300 /* Data Byte Count */
919 #define HSFCTL_BCOUNT_SHIFT 8
920 #define ICH_FLASH_FADDR 0x0008
921 #define ICH_FLASH_FDATA0 0x0010
922 #define ICH_FLASH_FRACC 0x0050
923 #define ICH_FLASH_FREG0 0x0054
924 #define ICH_FLASH_FREG1 0x0058
925 #define ICH_FLASH_FREG2 0x005C
926 #define ICH_FLASH_FREG3 0x0060
927 #define ICH_FLASH_FPR0 0x0074
928 #define ICH_FLASH_FPR1 0x0078
929 #define ICH_FLASH_SSFSTS 0x0090
930 #define ICH_FLASH_SSFCTL 0x0092
931 #define ICH_FLASH_PREOP 0x0094
932 #define ICH_FLASH_OPTYPE 0x0096
933 #define ICH_FLASH_OPMENU 0x0098
934
935 #define ICH_FLASH_REG_MAPSIZE 0x00A0
936 #define ICH_FLASH_SECTOR_SIZE 4096
937 #define ICH_GFPREG_BASE_MASK 0x1FFF
938 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
939
940 #define ICH_NVM_SIG_WORD 0x13
941 #define ICH_NVM_SIG_MASK 0xc000
942
943 /* for PCI express Capability registers */
944 #define WM_PCI_PCIE_DCSR2_16MS 0x00000005
945