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