Home | History | Annotate | Line # | Download | only in pci
if_wmreg.h revision 1.128.2.2
      1  1.128.2.2    martin /*	$NetBSD: if_wmreg.h,v 1.128.2.2 2024/02/23 18:54:36 martin 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.53   msaitoh /******************************************************************************
     39       1.53   msaitoh 
     40      1.122     skrll   Copyright (c) 2001-2012, Intel Corporation
     41       1.53   msaitoh   All rights reserved.
     42      1.122     skrll 
     43      1.122     skrll   Redistribution and use in source and binary forms, with or without
     44       1.53   msaitoh   modification, are permitted provided that the following conditions are met:
     45      1.122     skrll 
     46      1.122     skrll    1. Redistributions of source code must retain the above copyright notice,
     47       1.53   msaitoh       this list of conditions and the following disclaimer.
     48      1.122     skrll 
     49      1.122     skrll    2. Redistributions in binary form must reproduce the above copyright
     50      1.122     skrll       notice, this list of conditions and the following disclaimer in the
     51       1.53   msaitoh       documentation and/or other materials provided with the distribution.
     52      1.122     skrll 
     53      1.122     skrll    3. Neither the name of the Intel Corporation nor the names of its
     54      1.122     skrll       contributors may be used to endorse or promote products derived from
     55       1.53   msaitoh       this software without specific prior written permission.
     56      1.122     skrll 
     57       1.53   msaitoh   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     58      1.122     skrll   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     59      1.122     skrll   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     60      1.122     skrll   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     61      1.122     skrll   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     62      1.122     skrll   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     63      1.122     skrll   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     64      1.122     skrll   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     65      1.122     skrll   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     66       1.53   msaitoh   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     67       1.53   msaitoh   POSSIBILITY OF SUCH DAMAGE.
     68       1.53   msaitoh 
     69       1.53   msaitoh ******************************************************************************/
     70       1.53   msaitoh 
     71        1.1   thorpej /*
     72        1.4      yamt  * Register description for the Intel i82542 (``Wiseman''),
     73        1.1   thorpej  * i82543 (``Livengood''), and i82544 (``Cordova'') Gigabit
     74        1.1   thorpej  * Ethernet chips.
     75        1.1   thorpej  */
     76        1.1   thorpej 
     77        1.1   thorpej /*
     78        1.1   thorpej  * The wiseman supports 64-bit PCI addressing.  This structure
     79        1.1   thorpej  * describes the address in descriptors.
     80        1.1   thorpej  */
     81        1.1   thorpej typedef struct wiseman_addr {
     82        1.1   thorpej 	uint32_t	wa_low;		/* low-order 32 bits */
     83        1.1   thorpej 	uint32_t	wa_high;	/* high-order 32 bits */
     84       1.24     perry } __packed wiseman_addr_t;
     85        1.1   thorpej 
     86        1.1   thorpej /*
     87        1.1   thorpej  * The Wiseman receive descriptor.
     88        1.1   thorpej  *
     89        1.1   thorpej  * The receive descriptor ring must be aligned to a 4K boundary,
     90        1.1   thorpej  * and there must be an even multiple of 8 descriptors in the ring.
     91        1.1   thorpej  */
     92        1.1   thorpej typedef struct wiseman_rxdesc {
     93       1.46    dyoung 	volatile wiseman_addr_t	wrx_addr;	/* buffer address */
     94        1.1   thorpej 
     95       1.46    dyoung 	volatile uint16_t	wrx_len;	/* buffer length */
     96       1.46    dyoung 	volatile uint16_t	wrx_cksum;	/* checksum (starting at PCSS)*/
     97        1.1   thorpej 
     98       1.46    dyoung 	volatile uint8_t	wrx_status;	/* Rx status */
     99       1.46    dyoung 	volatile uint8_t	wrx_errors;	/* Rx errors */
    100       1.46    dyoung 	volatile uint16_t	wrx_special;	/* special field (VLAN, etc.) */
    101       1.24     perry } __packed wiseman_rxdesc_t;
    102        1.1   thorpej 
    103        1.1   thorpej /* wrx_status bits */
    104      1.123     skrll #define	WRX_ST_DD	__BIT(0)	/* descriptor done */
    105      1.123     skrll #define	WRX_ST_EOP	__BIT(1)	/* end of packet */
    106      1.123     skrll #define	WRX_ST_IXSM	__BIT(2)	/* ignore checksum indication */
    107      1.123     skrll #define	WRX_ST_VP	__BIT(3)	/* VLAN packet */
    108      1.123     skrll #define	WRX_ST_BPDU	__BIT(4)	/* ??? */
    109      1.123     skrll #define	WRX_ST_TCPCS	__BIT(5)	/* TCP checksum performed */
    110      1.123     skrll #define	WRX_ST_IPCS	__BIT(6)	/* IP checksum performed */
    111      1.123     skrll #define	WRX_ST_PIF	__BIT(7)	/* passed in-exact filter */
    112        1.1   thorpej 
    113        1.1   thorpej /* wrx_error bits */
    114      1.123     skrll #define	WRX_ER_CE	__BIT(0)	/* CRC error */
    115      1.123     skrll #define	WRX_ER_SE	__BIT(1)	/* symbol error */
    116      1.123     skrll #define	WRX_ER_SEQ	__BIT(2)	/* sequence error */
    117      1.123     skrll #define	WRX_ER_ICE	__BIT(3)	/* ??? */
    118      1.123     skrll #define	WRX_ER_CXE	__BIT(4)	/* carrier extension error */
    119      1.123     skrll #define	WRX_ER_TCPE	__BIT(5)	/* TCP checksum error */
    120      1.123     skrll #define	WRX_ER_IPE	__BIT(6)	/* IP checksum error */
    121      1.123     skrll #define	WRX_ER_RXE	__BIT(7)	/* Rx data error */
    122        1.1   thorpej 
    123        1.1   thorpej /* wrx_special field for VLAN packets */
    124        1.1   thorpej #define	WRX_VLAN_ID(x)	((x) & 0x0fff)	/* VLAN identifier */
    125      1.123     skrll #define	WRX_VLAN_CFI	__BIT(12)	/* Canonical Form Indicator */
    126        1.1   thorpej #define	WRX_VLAN_PRI(x)	(((x) >> 13) & 7)/* VLAN priority field */
    127        1.1   thorpej 
    128       1.95  knakahar /* extended RX descriptor for 82574 */
    129       1.95  knakahar typedef union ext_rxdesc {
    130       1.96  knakahar 	struct {
    131       1.96  knakahar 		uint64_t erxd_addr;	/* Packet Buffer Address */
    132       1.96  knakahar 		uint64_t erxd_dd;	/* 63:1 reserved, 0 DD */
    133       1.96  knakahar 	} erx_data;
    134       1.96  knakahar 	struct {
    135       1.96  knakahar 		uint32_t erxc_mrq;	/*
    136       1.96  knakahar 					 * 31:13 reserved
    137       1.96  knakahar 					 * 12:8 Rx queue associated with the packet
    138       1.96  knakahar 					 * 7:4 reserved 3:0 RSS Type
    139       1.96  knakahar 					 */
    140       1.96  knakahar 		uint32_t erxc_rsshash;	/* RSS Hash or {Fragment Checksum, IP identification } */
    141       1.96  knakahar 		uint32_t erxc_err_stat;	/* 31:20 Extended Error, 19:0 Extened Status */
    142       1.96  knakahar 		uint16_t erxc_pktlen;	/* PKT_LEN */
    143       1.96  knakahar 		uint16_t erxc_vlan;	/* VLAN Tag */
    144       1.96  knakahar 	} erx_ctx;
    145       1.95  knakahar } __packed ext_rxdesc_t;
    146       1.95  knakahar 
    147      1.124     skrll #define	EXTRXD_DD_MASK		__BIT(0)
    148       1.95  knakahar 
    149       1.95  knakahar /*
    150       1.95  knakahar  * erxc_rsshash is used for below 2 patterns
    151       1.95  knakahar  *     (1) Fragment Checksum and IP identification
    152       1.95  knakahar  *         - Fragment Checksum is valid
    153       1.95  knakahar  *           when RXCSUM.PCSD cleared and RXCSUM.IPPCSE bit is set
    154       1.95  knakahar  *         - IP identification is valid
    155       1.95  knakahar  *           when RXCSUM.PCSD cleared and RXCSUM.IPPCSE bit is set
    156       1.95  knakahar  *     (2) RSS Hash
    157       1.95  knakahar  *         when RXCSUM.PCSD bit is set
    158       1.95  knakahar  */
    159      1.124     skrll #define	EXTRXC_IP_ID_MASK	__BITS(15,0)
    160      1.124     skrll #define	EXTRXC_FRAG_CSUM_MASK	__BITS(31,16)
    161      1.124     skrll #define	EXTRXC_IP_ID(rsshash)	__SHIFTOUT(rsshash,ERXC_IP_ID_MASK)
    162      1.124     skrll #define	EXTRXC_FRAG_CSUM(rsshash) __SHIFTOUT(rsshash,ERXC_FRAG_CSUM_MASK)
    163       1.95  knakahar 
    164       1.95  knakahar /* macros for nrxc_mrq */
    165      1.124     skrll #define	EXTRXC_RSS_TYPE_MASK		__BITS(3,0)
    166       1.95  knakahar /* __BITS(7,4) is reserved */
    167      1.124     skrll #define	EXTRXC_QUEUE_MASK		__BITS(12,8)
    168       1.95  knakahar /* __BITS(31,13) is reserved */
    169      1.124     skrll #define	EXTRXC_RSS_TYPE(mrq)	__SHIFTOUT(mrq,EXTRXC_RSS_TYPE_MASK)
    170      1.124     skrll #define	EXTRXC_QUEUE(mrq)	__SHIFTOUT(mrq,EXTRXC_QUEUE_MASK)
    171       1.95  knakahar 
    172      1.124     skrll #define	EXTRXC_RSS_TYPE_NONE		0x0 /* No hash computation done. */
    173      1.124     skrll #define	EXTRXC_RSS_TYPE_TCP_IPV4	0x1
    174      1.124     skrll #define	EXTRXC_RSS_TYPE_IPV4		0x2
    175      1.124     skrll #define	EXTRXC_RSS_TYPE_TCP_IPV6	0x3
    176      1.124     skrll #define	EXTRXC_RSS_TYPE_IPV6_EX		0x4
    177      1.124     skrll #define	EXTRXC_RSS_TYPE_IPV6		0x5
    178       1.95  knakahar /*0x6:0xF is reserved. */
    179       1.95  knakahar 
    180      1.124     skrll #define	EXTRXC_STATUS_MASK	__BITS(19,0)
    181      1.124     skrll #define	EXTRXC_ERROR_MASK	__BITS(31,20)
    182      1.124     skrll #define	EXTRXC_STATUS(err_stat)	__SHIFTOUT(err_stat,EXTRXC_STATUS_MASK)
    183      1.124     skrll #define	EXTRXC_ERROR(err_stat)	__SHIFTOUT(err_stat,EXTRXC_ERROR_MASK)
    184       1.95  knakahar 
    185       1.95  knakahar /* 3:0 is reserved. */
    186      1.124     skrll #define	EXTRXC_ERROR_CE		__BIT(4) /* The same as WRX_ER_CE. */
    187      1.124     skrll #define	EXTRXC_ERROR_SE		__BIT(5) /* The same as WRX_ER_SE. */
    188      1.124     skrll #define	EXTRXC_ERROR_SEQ	__BIT(6) /* The same as WRX_ER_SEQ. */
    189       1.95  knakahar /* 7 is reserved. */
    190      1.124     skrll #define	EXTRXC_ERROR_CXE	__BIT(8) /* The same as WRX_ER_CXE. */
    191      1.124     skrll #define	EXTRXC_ERROR_TCPE	__BIT(9) /* The same as WRX_ER_TCPE. */
    192      1.124     skrll #define	EXTRXC_ERROR_IPE	__BIT(10) /* The same as WRX_ER_IPE. */
    193      1.124     skrll #define	EXTRXC_ERROR_RXE	__BIT(11) /* The same as WRX_ER_RXE. */
    194       1.95  knakahar 
    195      1.124     skrll #define	EXTRXC_STATUS_DD		__BIT(0) /* The same as WRX_ST_DD. */
    196      1.124     skrll #define	EXTRXC_STATUS_EOP		__BIT(1) /* The same as WRX_ST_EOP. */
    197       1.95  knakahar /* 2 is reserved. */
    198      1.124     skrll #define	EXTRXC_STATUS_VP		__BIT(3) /* The same as WRX_ST_VP. */
    199      1.124     skrll #define	EXTRXC_STATUS_UDPCS		__BIT(4) /* UDP checksum calculated on packet. */
    200      1.124     skrll #define	EXTRXC_STATUS_TCPCS		__BIT(5) /* The same as WRX_ST_TCPCS. */
    201      1.124     skrll #define	EXTRXC_STATUS_IPCS		__BIT(6) /* The same as WRX_ST_IPCS. */
    202       1.95  knakahar /* 7 is reserved. */
    203      1.124     skrll #define	EXTRXC_STATUS_TST		__BIT(8) /* Time stamp taken. */
    204      1.124     skrll #define	EXTRXC_STATUS_IPIDV		__BIT(9) /* IP identification valid. */
    205      1.124     skrll #define	EXTRXC_STATUS_UDPV		__BIT(10) /* Valid UDP XSUM. */
    206       1.95  knakahar /* 14:11 is reserved. */
    207      1.124     skrll #define	EXTRXC_STATUS_ACK		__BIT(15) /* ACK packet indication. */
    208      1.124     skrll #define	EXTRXC_STATUS_PKTTYPE_MASK	__BITS(19,16)
    209      1.124     skrll #define	EXTRXC_STATUS_PKTTYPE(status)	__SHIFTOUT(status,EXTRXC_STATUS_PKTTYPE_MASK)
    210       1.95  knakahar 
    211       1.95  knakahar /* advanced RX descriptor for 82575 and newer */
    212       1.95  knakahar typedef union nq_rxdesc {
    213       1.96  knakahar 	struct {
    214       1.96  knakahar 		uint64_t nrxd_paddr;	/* 63:1 Packet Buffer Address, 0 A0/NSE */
    215       1.96  knakahar 		uint64_t nrxd_haddr;	/* 63:1 HEader Buffer Address, 0 DD */
    216       1.96  knakahar 	} nqrx_data;
    217       1.96  knakahar 	struct {
    218       1.96  knakahar 		uint32_t nrxc_misc;	/*
    219       1.96  knakahar 					 * 31: SPH, 30:21 HDR_LEN[9:0],
    220       1.96  knakahar 					 * 20:19 HDR_LEN[11:10], 18:17 RSV,
    221       1.96  knakahar 					 * 16:4 Packet Type 3:0 RSS Type
    222       1.96  knakahar 					 */
    223       1.96  knakahar 		uint32_t nrxc_rsshash;	/* RSS Hash or {Fragment Checksum, IP identification } */
    224       1.96  knakahar 		uint32_t nrxc_err_stat;	/* 31:20 Extended Error, 19:0 Extened Status */
    225       1.96  knakahar 		uint16_t nrxc_pktlen;	/* PKT_LEN */
    226       1.96  knakahar 		uint16_t nrxc_vlan;	/* VLAN Tag */
    227       1.96  knakahar 	} nqrx_ctx;
    228       1.95  knakahar } __packed nq_rxdesc_t;
    229       1.95  knakahar 
    230       1.95  knakahar /* for nrxd_paddr macros */
    231      1.124     skrll #define	NQRXD_A0_MASK		__BIT(0)
    232      1.124     skrll #define	NQRXD_NSE_MASK		__BIT(0)
    233      1.124     skrll #define	NQRXD_ADDR_MASK		__BITS(63,1)
    234       1.95  knakahar /* for nrxd_haddr macros */
    235      1.124     skrll #define	NQRXD_DD_MASK		__BIT(0)
    236       1.95  knakahar 
    237       1.95  knakahar /*
    238       1.95  knakahar  * nrxc_rsshash is used for below 2 patterns
    239       1.95  knakahar  *     (1) Fragment Checksum and IP identification
    240       1.95  knakahar  *         - Fragment Checksum is valid
    241       1.95  knakahar  *           when RXCSUM.PCSD cleared and RXCSUM.IPPCSE bit is set
    242       1.95  knakahar  *         - IP identification is valid
    243       1.95  knakahar  *           when RXCSUM.PCSD cleared and RXCSUM.IPPCSE bit is set
    244       1.95  knakahar  *     (2) RSS Hash
    245       1.95  knakahar  *         when RXCSUM.PCSD bit is set
    246       1.95  knakahar  */
    247      1.124     skrll #define	NQRXC_IP_ID_MASK	__BITS(15,0)
    248      1.124     skrll #define	NQRXC_FRAG_CSUM_MASK	__BITS(31,16)
    249      1.124     skrll #define	NQRXC_IP_ID(rsshash)	__SHIFTOUT(rsshash,NRXC_IP_ID_MASK)
    250      1.124     skrll #define	NQRXC_FRAG_CSUM(rsshash) __SHIFTOUT(rsshash,NRXC_FRAG_CSUM_MASK)
    251       1.95  knakahar 
    252       1.95  knakahar /* macros for nrxc_misc */
    253      1.124     skrll #define	NQRXC_RSS_TYPE_MASK		__BITS(3,0)
    254      1.124     skrll #define	NQRXC_PKT_TYPE_ID_MASK		__BITS(11,4)
    255      1.124     skrll #define	NQRXC_PKT_TYPE_ETQF_INDEX_MASK	__BITS(11,4)
    256      1.124     skrll #define	NQRXC_PKT_TYPE_ETQF_VALID_MASK	__BIT(15)
    257      1.124     skrll #define	NQRXC_PKT_TYPE_VLAN_MASK 	__BIT(16)
    258      1.124     skrll #define	NQRXC_PKT_TYPE_MASK		__BITS(16,4)
    259       1.95  knakahar /* __BITS(18,17) is reserved */
    260      1.124     skrll #define	NQRXC_HDRLEN_HIGH_MASK		__BITS(20,19)
    261      1.124     skrll #define	NQRXC_HDRLEN_LOW_MASK		__BITS(30,21)
    262      1.124     skrll #define	NQRXC_SPH_MASK			__BIT(31)
    263       1.95  knakahar 
    264      1.124     skrll #define	NQRXC_RSS_TYPE(misc)	__SHIFTOUT(misc,NQRXC_RSS_TYPE_MASK)
    265      1.124     skrll #define	NQRXC_PKT_TYPE_ID(pkttype) \
    266       1.95  knakahar 		__SHIFTOUT(pkttype,NQRXC_PKT_TYPE_ID_MASK)
    267      1.124     skrll #define	NQRXC_PKT_TYPE(misc)	__SHIFTOUT(misc,NQRXC_PKT_TYPE_MASK)
    268      1.124     skrll #define	NQRXC_PKT_TYPE_ETQF_INDEX(pkttype) \
    269       1.95  knakahar 		__SHIFTOUT(pkttype,NQRXC_PKT_TYPE_ETQF_INDEX_MASK)
    270      1.124     skrll #define	NQRXC_PKT_TYPE_ETQF_VALID NQRXC_PKT_TYPE_ETQF_VALID_MASK
    271      1.124     skrll #define	NQRXC_PKT_TYPE_VLAN	NQRXC_PKT_TYPE_VLAN_MASK
    272      1.124     skrll #define	NQRXC_HEADER_LEN(misc)	(__SHIFTOUT(misc,NQRXC_HDRLEN_LOW_MASK) \
    273       1.95  knakahar 		| __SHIFTOUT(misc,NQRXC_HDRLEN_HIGH_MASK) << 10)
    274      1.124     skrll #define	NQRXC_SPH		NQRXC_SPH_MASK
    275       1.95  knakahar 
    276      1.124     skrll #define	NQRXC_RSS_TYPE_NONE		0x0 /* No hash computation done. */
    277      1.124     skrll #define	NQRXC_RSS_TYPE_TCP_IPV4		0x1
    278      1.124     skrll #define	NQRXC_RSS_TYPE_IPV4		0x2
    279      1.124     skrll #define	NQRXC_RSS_TYPE_TCP_IPV6		0x3
    280      1.124     skrll #define	NQRXC_RSS_TYPE_IPV6_EX		0x4
    281      1.124     skrll #define	NQRXC_RSS_TYPE_IPV6		0x5
    282      1.124     skrll #define	NQRXC_RSS_TYPE_TCP_IPV6_EX	0x6
    283      1.124     skrll #define	NQRXC_RSS_TYPE_UDP_IPV4		0x7
    284      1.124     skrll #define	NQRXC_RSS_TYPE_UDP_IPV6		0x8
    285      1.124     skrll #define	NQRXC_RSS_TYPE_UDP_IPV6_EX	0x9
    286       1.95  knakahar /*0xA:0xF is reserved. */
    287       1.95  knakahar 
    288      1.124     skrll #define	NQRXC_PKT_TYPE_IPV4		__BIT(0)
    289      1.124     skrll #define	NQRXC_PKT_TYPE_IPV4E		__BIT(1)
    290      1.124     skrll #define	NQRXC_PKT_TYPE_IPV6		__BIT(2)
    291      1.124     skrll #define	NQRXC_PKT_TYPE_IPV6E		__BIT(3)
    292      1.124     skrll #define	NQRXC_PKT_TYPE_TCP		__BIT(4)
    293      1.124     skrll #define	NQRXC_PKT_TYPE_UDP		__BIT(5)
    294      1.124     skrll #define	NQRXC_PKT_TYPE_SCTP		__BIT(6)
    295      1.124     skrll #define	NQRXC_PKT_TYPE_NFS		__BIT(7)
    296      1.124     skrll 
    297      1.124     skrll #define	NQRXC_STATUS_MASK	__BITS(19,0)
    298      1.124     skrll #define	NQRXC_ERROR_MASK	__BITS(31,20)
    299      1.124     skrll #define	NQRXC_STATUS(err_stat)	__SHIFTOUT(err_stat,NQRXC_STATUS_MASK)
    300      1.124     skrll #define	NQRXC_ERROR(err_stat)	__SHIFTOUT(err_stat,NQRXC_ERROR_MASK)
    301       1.95  knakahar 
    302       1.95  knakahar /* 2:0 is reserved. */
    303      1.124     skrll #define	NQRXC_ERROR_HB0		__BIT(3) /* Header Buffer Overflow. */
    304       1.95  knakahar /* 6:4 is reserved. */
    305       1.95  knakahar /* 8:7 is reserved. */
    306      1.124     skrll #define	NQRXC_ERROR_L4E		__BIT(9) /* L4 error indication. */
    307      1.124     skrll #define	NQRXC_ERROR_IPE		__BIT(10) /* The same as WRX_ER_IPE. */
    308      1.124     skrll #define	NQRXC_ERROR_RXE		__BIT(11) /* The same as WRX_ER_RXE. */
    309       1.95  knakahar /* XXX Where is WRX_ER_CE, WRX_ER_SE, WRX_ER_SEQ, WRX_ER_CXE error? */
    310       1.95  knakahar 
    311      1.124     skrll #define	NQRXC_STATUS_DD		__BIT(0) /* The same as WRX_ST_DD. */
    312      1.124     skrll #define	NQRXC_STATUS_EOP	__BIT(1) /* The same as WRX_ST_EOP. */
    313       1.95  knakahar /* 2 is reserved */
    314      1.124     skrll #define	NQRXC_STATUS_VP		__BIT(3) /* The same as WRX_ST_VP. */
    315      1.124     skrll #define	NQRXC_STATUS_UDPCS	__BIT(4) /* UDP checksum or IP payload checksum. */
    316       1.95  knakahar 					 /* XXX in I210 spec, this bit is the same as WRX_ST_BPDU(is "???" comment) */
    317      1.124     skrll #define	NQRXC_STATUS_L4I	__BIT(5) /* L4 integrity check was done. */
    318      1.124     skrll #define	NQRXC_STATUS_IPCS	__BIT(6) /* The same as WRX_ST_IPCS. */
    319      1.124     skrll #define	NQRXC_STATUS_PIF	__BIT(7) /* The same as WRX_ST_PIF. */
    320       1.95  knakahar /* 8 is reserved */
    321      1.124     skrll #define	NQRXC_STATUS_VEXT	__BIT(9) /* First VLAN is found on a bouble VLAN packet. */
    322      1.124     skrll #define	NQRXC_STATUS_UDPV	__BIT(10) /* The packet contains a valid checksum field in a first fragment UDP IPv4 packet. */
    323      1.124     skrll #define	NQRXC_STATUS_LLINT	__BIT(11) /* The packet caused an immediate interrupt. */
    324      1.124     skrll #define	NQRXC_STATUS_STRIPCRC	__BIT(12) /* Ethernet CRC is stripped. */
    325       1.95  knakahar /* 14:13 is reserved */
    326      1.124     skrll #define	NQRXC_STATUS_TSIP	__BIT(15) /* Timestamp in packet. */
    327      1.124     skrll #define	NQRXC_STATUS_TS		__BIT(16) /* Time stamped packet. */
    328       1.95  knakahar /* 17 is reserved */
    329      1.124     skrll #define	NQRXC_STATUS_LB		__BIT(18) /* Sent by a local virtual machine (VM to VM switch indication). */
    330      1.124     skrll #define	NQRXC_STATUS_MC		__BIT(19) /* Packet received from Manageability Controller */
    331       1.95  knakahar 					  /* "MBC" in i350 spec */
    332       1.95  knakahar 
    333        1.1   thorpej /*
    334        1.1   thorpej  * The Wiseman transmit descriptor.
    335        1.1   thorpej  *
    336        1.1   thorpej  * The transmit descriptor ring must be aligned to a 4K boundary,
    337        1.1   thorpej  * and there must be an even multiple of 8 descriptors in the ring.
    338        1.1   thorpej  */
    339        1.9   tsutsui typedef struct wiseman_tx_fields {
    340        1.9   tsutsui 	uint8_t wtxu_status;		/* Tx status */
    341        1.9   tsutsui 	uint8_t wtxu_options;		/* options */
    342        1.9   tsutsui 	uint16_t wtxu_vlan;		/* VLAN info */
    343       1.24     perry } __packed wiseman_txfields_t;
    344        1.1   thorpej typedef struct wiseman_txdesc {
    345        1.1   thorpej 	wiseman_addr_t	wtx_addr;	/* buffer address */
    346        1.1   thorpej 	uint32_t	wtx_cmdlen;	/* command and length */
    347        1.1   thorpej 	wiseman_txfields_t wtx_fields;	/* fields; see below */
    348       1.24     perry } __packed wiseman_txdesc_t;
    349        1.1   thorpej 
    350        1.9   tsutsui /* Commands for wtx_cmdlen */
    351      1.123     skrll #define	WTX_CMD_EOP	__BIT(24)	/* end of packet */
    352      1.123     skrll #define	WTX_CMD_IFCS	__BIT(25)	/* insert FCS */
    353      1.123     skrll #define	WTX_CMD_RS	__BIT(27)	/* report status */
    354      1.123     skrll #define	WTX_CMD_RPS	__BIT(28)	/* report packet sent */
    355      1.123     skrll #define	WTX_CMD_DEXT	__BIT(29)	/* descriptor extension */
    356      1.123     skrll #define	WTX_CMD_VLE	__BIT(30)	/* VLAN enable */
    357      1.123     skrll #define	WTX_CMD_IDE	__BIT(31)	/* interrupt delay enable */
    358        1.1   thorpej 
    359        1.1   thorpej /* Descriptor types (if DEXT is set) */
    360      1.123     skrll #define	WTX_DTYP_MASK	__BIT(20)
    361      1.123     skrll #define	WTX_DTYP_C	__SHIFTIN(0, WTX_DTYP_MASK)	/* context */
    362      1.123     skrll #define	WTX_DTYP_D	__SHIFTIN(1, WTX_DTYP_MASK)	/* data */
    363        1.1   thorpej 
    364        1.1   thorpej /* wtx_fields status bits */
    365      1.123     skrll #define	WTX_ST_DD	__BIT(0)	/* descriptor done */
    366      1.123     skrll #define	WTX_ST_EC	__BIT(1)	/* excessive collisions */
    367      1.123     skrll #define	WTX_ST_LC	__BIT(2)	/* late collision */
    368      1.123     skrll #define	WTX_ST_TU	__BIT(3)	/* transmit underrun */
    369        1.1   thorpej 
    370        1.9   tsutsui /* wtx_fields option bits for IP/TCP/UDP checksum offload */
    371      1.123     skrll #define	WTX_IXSM	__BIT(0)	/* IP checksum offload */
    372      1.123     skrll #define	WTX_TXSM	__BIT(1)	/* TCP/UDP checksum offload */
    373        1.1   thorpej 
    374       1.13   thorpej /* Maximum payload per Tx descriptor */
    375       1.13   thorpej #define	WTX_MAX_LEN	4096
    376       1.13   thorpej 
    377        1.1   thorpej /*
    378        1.1   thorpej  * The Livengood TCP/IP context descriptor.
    379        1.1   thorpej  */
    380        1.1   thorpej struct livengood_tcpip_ctxdesc {
    381        1.1   thorpej 	uint32_t	tcpip_ipcs;	/* IP checksum context */
    382        1.1   thorpej 	uint32_t	tcpip_tucs;	/* TCP/UDP checksum context */
    383        1.1   thorpej 	uint32_t	tcpip_cmdlen;
    384        1.1   thorpej 	uint32_t	tcpip_seg;	/* TCP segmentation context */
    385        1.1   thorpej };
    386        1.1   thorpej 
    387        1.1   thorpej /* commands for context descriptors */
    388      1.123     skrll #define	WTX_TCPIP_CMD_TCP	__BIT(24)	/* 1 = TCP, 0 = UDP */
    389      1.123     skrll #define	WTX_TCPIP_CMD_IP	__BIT(25)	/* 1 = IPv4, 0 = IPv6 */
    390      1.123     skrll #define	WTX_TCPIP_CMD_TSE	__BIT(26)	/* segmentation context valid */
    391        1.1   thorpej 
    392        1.1   thorpej #define	WTX_TCPIP_IPCSS(x)	((x) << 0)	/* checksum start */
    393        1.1   thorpej #define	WTX_TCPIP_IPCSO(x)	((x) << 8)	/* checksum value offset */
    394        1.1   thorpej #define	WTX_TCPIP_IPCSE(x)	((x) << 16)	/* checksum end */
    395        1.1   thorpej 
    396        1.1   thorpej #define	WTX_TCPIP_TUCSS(x)	((x) << 0)	/* checksum start */
    397        1.1   thorpej #define	WTX_TCPIP_TUCSO(x)	((x) << 8)	/* checksum value offset */
    398        1.1   thorpej #define	WTX_TCPIP_TUCSE(x)	((x) << 16)	/* checksum end */
    399        1.1   thorpej 
    400        1.1   thorpej #define	WTX_TCPIP_SEG_STATUS(x)	((x) << 0)
    401        1.1   thorpej #define	WTX_TCPIP_SEG_HDRLEN(x)	((x) << 8)
    402        1.1   thorpej #define	WTX_TCPIP_SEG_MSS(x)	((x) << 16)
    403        1.1   thorpej 
    404        1.1   thorpej /*
    405        1.1   thorpej  * PCI config registers used by the Wiseman.
    406        1.1   thorpej  */
    407        1.1   thorpej #define	WM_PCI_MMBA	PCI_MAPREG_START
    408       1.22    bouyer /* registers for FLASH access on ICH8 */
    409      1.124     skrll #define	WM_ICH8_FLASH	0x0014
    410        1.1   thorpej 
    411      1.124     skrll #define	WM_PCI_LTR_CAP_LPT	0xa8
    412       1.92   msaitoh 
    413       1.89   msaitoh /* XXX Only for PCH_SPT? */
    414      1.124     skrll #define	WM_PCI_DESCRING_STATUS	0xe4
    415      1.124     skrll #define	DESCRING_STATUS_FLUSH_REQ	__BIT(8)
    416       1.89   msaitoh 
    417        1.1   thorpej /*
    418        1.1   thorpej  * Wiseman Control/Status Registers.
    419        1.1   thorpej  */
    420        1.1   thorpej #define	WMREG_CTRL	0x0000	/* Device Control Register */
    421      1.123     skrll #define	CTRL_FD		__BIT(0)	/* full duplex */
    422      1.123     skrll #define	CTRL_BEM	__BIT(1)	/* big-endian mode */
    423      1.123     skrll #define	CTRL_PRIOR	__BIT(2)	/* 0 = receive, 1 = fair */
    424      1.123     skrll #define	CTRL_GIO_M_DIS	__BIT(2)	/* disabl PCI master access */
    425      1.123     skrll #define	CTRL_LRST	__BIT(3)	/* link reset */
    426      1.123     skrll #define	CTRL_ASDE	__BIT(5)	/* auto speed detect enable */
    427      1.123     skrll #define	CTRL_SLU	__BIT(6)	/* set link up */
    428      1.123     skrll #define	CTRL_ILOS	__BIT(7)	/* invert loss of signal */
    429        1.1   thorpej #define	CTRL_SPEED(x)	((x) << 8)	/* speed (Livengood) */
    430        1.1   thorpej #define	CTRL_SPEED_10	CTRL_SPEED(0)
    431        1.1   thorpej #define	CTRL_SPEED_100	CTRL_SPEED(1)
    432        1.1   thorpej #define	CTRL_SPEED_1000	CTRL_SPEED(2)
    433        1.1   thorpej #define	CTRL_SPEED_MASK	CTRL_SPEED(3)
    434      1.123     skrll #define	CTRL_FRCSPD	__BIT(11)	/* force speed (Livengood) */
    435      1.123     skrll #define	CTRL_FRCFDX	__BIT(12)	/* force full-duplex (Livengood) */
    436      1.124     skrll #define	CTRL_D_UD_EN	__BIT(13)	/* Dock/Undock enable */
    437      1.124     skrll #define	CTRL_D_UD_POL	__BIT(14)	/* Defined polarity of Dock/Undock indication in SDP[0] */
    438      1.124     skrll #define	CTRL_F_PHY_R 	__BIT(15)	/* Reset both PHY ports, through PHYRST_N pin */
    439      1.124     skrll #define	CTRL_EXTLINK_EN __BIT(16)	/* enable link status from external LINK_0 and LINK_1 pins */
    440      1.124     skrll #define	CTRL_LANPHYPC_OVERRIDE __BIT(16) /* SW control of LANPHYPC */
    441      1.124     skrll #define	CTRL_LANPHYPC_VALUE __BIT(17)	/* SW value of LANPHYPC */
    442        1.1   thorpej #define	CTRL_SWDPINS_SHIFT	18
    443        1.1   thorpej #define	CTRL_SWDPINS_MASK	0x0f
    444        1.1   thorpej #define	CTRL_SWDPIN(x)		(1U << (CTRL_SWDPINS_SHIFT + (x)))
    445        1.1   thorpej #define	CTRL_SWDPIO_SHIFT	22
    446        1.1   thorpej #define	CTRL_SWDPIO_MASK	0x0f
    447        1.1   thorpej #define	CTRL_SWDPIO(x)		(1U << (CTRL_SWDPIO_SHIFT + (x)))
    448      1.124     skrll #define	CTRL_MEHE	__BIT(19)	/* Memory Error Handling Enable(I217)*/
    449      1.123     skrll #define	CTRL_RST	__BIT(26)	/* device reset */
    450      1.123     skrll #define	CTRL_RFCE	__BIT(27)	/* Rx flow control enable */
    451      1.123     skrll #define	CTRL_TFCE	__BIT(28)	/* Tx flow control enable */
    452      1.123     skrll #define	CTRL_VME	__BIT(30)	/* VLAN Mode Enable */
    453      1.123     skrll #define	CTRL_PHY_RESET	__BIT(31)	/* PHY reset (Cordova) */
    454        1.1   thorpej 
    455        1.7   thorpej #define	WMREG_CTRL_SHADOW 0x0004	/* Device Control Register (shadow) */
    456        1.6   thorpej 
    457        1.1   thorpej #define	WMREG_STATUS	0x0008	/* Device Status Register */
    458      1.123     skrll #define	STATUS_FD	__BIT(0)	/* full duplex */
    459      1.123     skrll #define	STATUS_LU	__BIT(1)	/* link up */
    460      1.123     skrll #define	STATUS_TCKOK	__BIT(2)	/* Tx clock running */
    461      1.123     skrll #define	STATUS_RBCOK	__BIT(3)	/* Rx clock running */
    462        1.3   thorpej #define	STATUS_FUNCID_SHIFT 2		/* 82546 function ID */
    463        1.3   thorpej #define	STATUS_FUNCID_MASK  3		/* ... */
    464      1.123     skrll #define	STATUS_TXOFF	__BIT(4)	/* Tx paused */
    465      1.123     skrll #define	STATUS_TBIMODE	__BIT(5)	/* fiber mode (Livengood) */
    466       1.92   msaitoh #define	STATUS_SPEED	__BITS(7, 6)	/* speed indication */
    467       1.92   msaitoh #define	STATUS_SPEED_10	  0
    468       1.92   msaitoh #define	STATUS_SPEED_100  1
    469       1.92   msaitoh #define	STATUS_SPEED_1000 2
    470        1.1   thorpej #define	STATUS_ASDV(x)	((x) << 8)	/* auto speed det. val. (Livengood) */
    471      1.123     skrll #define	STATUS_LAN_INIT_DONE __BIT(9)	/* Lan Init Completion by NVM */
    472      1.123     skrll #define	STATUS_MTXCKOK	__BIT(10)	/* MTXD clock running */
    473      1.123     skrll #define	STATUS_PHYRA	__BIT(10)	/* PHY Reset Asserted (PCH) */
    474      1.123     skrll #define	STATUS_PCI66	__BIT(11)	/* 66MHz bus (Livengood) */
    475      1.123     skrll #define	STATUS_BUS64	__BIT(12)	/* 64-bit bus (Livengood) */
    476       1.94   msaitoh #define	STATUS_2P5_SKU	__BIT(12)	/* Value of the 2.5GBE SKU strap */
    477      1.123     skrll #define	STATUS_PCIX_MODE __BIT(13)	/* PCIX mode (Cordova) */
    478       1.94   msaitoh #define	STATUS_2P5_SKU_OVER __BIT(13)	/* Value of the 2.5GBE SKU override */
    479        1.1   thorpej #define	STATUS_PCIXSPD(x) ((x) << 14)	/* PCIX speed indication (Cordova) */
    480        1.1   thorpej #define	STATUS_PCIXSPD_50_66   STATUS_PCIXSPD(0)
    481        1.1   thorpej #define	STATUS_PCIXSPD_66_100  STATUS_PCIXSPD(1)
    482        1.1   thorpej #define	STATUS_PCIXSPD_100_133 STATUS_PCIXSPD(2)
    483        1.8   thorpej #define	STATUS_PCIXSPD_MASK    STATUS_PCIXSPD(3)
    484      1.123     skrll #define	STATUS_GIO_M_ENA __BIT(19)	/* GIO master enable */
    485      1.123     skrll #define	STATUS_DEV_RST_SET __BIT(20)	/* Device Reset Set */
    486        1.1   thorpej 
    487       1.89   msaitoh /* Strapping Option Register (PCH_SPT and newer) */
    488      1.124     skrll #define	WMREG_STRAP	0x000c
    489      1.124     skrll #define	STRAP_NVMSIZE	__BITS(1, 6)
    490      1.124     skrll #define	STRAP_FREQ	__BITS(12, 13)
    491      1.124     skrll #define	STRAP_SMBUSADDR	__BITS(17, 23)
    492       1.89   msaitoh 
    493        1.1   thorpej #define	WMREG_EECD	0x0010	/* EEPROM Control Register */
    494      1.123     skrll #define	EECD_SK		__BIT(0)	/* clock */
    495      1.123     skrll #define	EECD_CS		__BIT(1)	/* chip select */
    496      1.123     skrll #define	EECD_DI		__BIT(2)	/* data in */
    497      1.123     skrll #define	EECD_DO		__BIT(3)	/* data out */
    498        1.1   thorpej #define	EECD_FWE(x)	((x) << 4)	/* flash write enable control */
    499        1.1   thorpej #define	EECD_FWE_DISABLED EECD_FWE(1)
    500        1.1   thorpej #define	EECD_FWE_ENABLED  EECD_FWE(2)
    501      1.123     skrll #define	EECD_EE_REQ	__BIT(6)	/* (shared) EEPROM request */
    502      1.123     skrll #define	EECD_EE_GNT	__BIT(7)	/* (shared) EEPROM grant */
    503      1.123     skrll #define	EECD_EE_PRES	__BIT(8)	/* EEPROM present */
    504      1.123     skrll #define	EECD_EE_SIZE	__BIT(9)	/* EEPROM size
    505        1.3   thorpej 					   (0 = 64 word, 1 = 256 word) */
    506      1.123     skrll #define	EECD_EE_AUTORD	__BIT(9)	/* auto read done */
    507      1.123     skrll #define	EECD_EE_ABITS	__BIT(10)	/* EEPROM address bits
    508        1.6   thorpej 					   (based on type) */
    509       1.62   msaitoh #define	EECD_EE_SIZE_EX_MASK __BITS(14,11) /* EEPROM size for new devices */
    510      1.123     skrll #define	EECD_EE_TYPE	__BIT(13)	/* EEPROM type
    511        1.6   thorpej 					   (0 = Microwire, 1 = SPI) */
    512      1.124     skrll #define	EECD_SEC1VAL	__BIT(22)	/* Sector One Valid */
    513      1.124     skrll #define	EECD_SEC1VAL_VALMASK (EECD_EE_AUTORD | EECD_EE_PRES) /* Valid Mask */
    514        1.1   thorpej 
    515      1.107   msaitoh #define	WMREG_FEXTNVM6	0x0010	/* Future Extended NVM 6 */
    516      1.108   msaitoh #define	FEXTNVM6_REQ_PLL_CLK	__BIT(8)
    517      1.108   msaitoh #define	FEXTNVM6_ENABLE_K1_ENTRY_CONDITION __BIT(9)
    518      1.107   msaitoh #define	FEXTNVM6_K1_OFF_ENABLE	__BIT(31)
    519      1.107   msaitoh 
    520       1.17   msaitoh #define	WMREG_EERD	0x0014	/* EEPROM read */
    521       1.17   msaitoh #define	EERD_DONE	0x02    /* done bit */
    522       1.17   msaitoh #define	EERD_START	0x01	/* First bit for telling part to start operation */
    523       1.17   msaitoh #define	EERD_ADDR_SHIFT	2	/* Shift to the address bits */
    524       1.17   msaitoh #define	EERD_DATA_SHIFT	16	/* Offset to data in EEPROM read/write registers */
    525       1.17   msaitoh 
    526        1.1   thorpej #define	WMREG_CTRL_EXT	0x0018	/* Extended Device Control Register */
    527       1.78   msaitoh #define	CTRL_EXT_NSICR		__BIT(0) /* Non Interrupt clear on read */
    528        1.1   thorpej #define	CTRL_EXT_GPI_EN(x)	(1U << (x)) /* gpin interrupt enable */
    529      1.124     skrll #define	CTRL_EXT_NVMVS		__BITS(0, 1) /* NVM valid sector */
    530      1.124     skrll #define	CTRL_EXT_LPCD		__BIT(2) /* LCD Power Cycle Done */
    531        1.1   thorpej #define	CTRL_EXT_SWDPINS_SHIFT	4
    532        1.1   thorpej #define	CTRL_EXT_SWDPINS_MASK	0x0d
    533       1.42   msaitoh /* The bit order of the SW Definable pin is not 6543 but 3654! */
    534       1.42   msaitoh #define	CTRL_EXT_SWDPIN(x)	(1U << (CTRL_EXT_SWDPINS_SHIFT \
    535       1.42   msaitoh 		+ ((x) == 3 ? 3 : ((x) - 4))))
    536        1.1   thorpej #define	CTRL_EXT_SWDPIO_SHIFT	8
    537        1.1   thorpej #define	CTRL_EXT_SWDPIO_MASK	0x0d
    538       1.42   msaitoh #define	CTRL_EXT_SWDPIO(x)	(1U << (CTRL_EXT_SWDPIO_SHIFT \
    539       1.42   msaitoh 		+ ((x) == 3 ? 3 : ((x) - 4))))
    540       1.89   msaitoh #define	CTRL_EXT_FORCE_SMBUS	__BIT(11)  /* Force SMBus mode */
    541      1.123     skrll #define	CTRL_EXT_ASDCHK		__BIT(12) /* ASD check */
    542      1.123     skrll #define	CTRL_EXT_EE_RST		__BIT(13) /* EEPROM reset */
    543      1.123     skrll #define	CTRL_EXT_IPS		__BIT(14) /* invert power state bit 0 */
    544      1.123     skrll #define	CTRL_EXT_SPD_BYPS	__BIT(15) /* speed select bypass */
    545      1.123     skrll #define	CTRL_EXT_IPS1		__BIT(16) /* invert power state bit 1 */
    546      1.123     skrll #define	CTRL_EXT_RO_DIS		__BIT(17) /* relaxed ordering disabled */
    547      1.123     skrll #define	CTRL_EXT_SDLPE		__BIT(18) /* SerDes Low Power Enable */
    548      1.123     skrll #define	CTRL_EXT_DMA_DYN_CLK	__BIT(19) /* DMA Dynamic Gating Enable */
    549       1.87   msaitoh #define	CTRL_EXT_PHYPDEN	__BIT(20)
    550      1.107   msaitoh #define	CTRL_EXT_LINK_MODE_MASK		0x00c00000
    551       1.38   msaitoh #define	CTRL_EXT_LINK_MODE_GMII		0x00000000
    552       1.38   msaitoh #define	CTRL_EXT_LINK_MODE_KMRN		0x00000000
    553       1.38   msaitoh #define	CTRL_EXT_LINK_MODE_1000KX	0x00400000
    554       1.38   msaitoh #define	CTRL_EXT_LINK_MODE_SGMII	0x00800000
    555       1.38   msaitoh #define	CTRL_EXT_LINK_MODE_PCIX_SERDES	0x00800000
    556      1.107   msaitoh #define	CTRL_EXT_LINK_MODE_TBI		0x00c00000
    557      1.107   msaitoh #define	CTRL_EXT_LINK_MODE_PCIE_SERDES	0x00c00000
    558       1.78   msaitoh #define	CTRL_EXT_EIAME		__BIT(24) /* Extended Interrupt Auto Mask En */
    559      1.124     skrll #define	CTRL_EXT_I2C_ENA	0x02000000  /* I2C enable */
    560       1.26   msaitoh #define	CTRL_EXT_DRV_LOAD	0x10000000
    561       1.78   msaitoh #define	CTRL_EXT_PBA		__BIT(31) /* PBA Support */
    562       1.20    bouyer 
    563        1.1   thorpej #define	WMREG_MDIC	0x0020	/* MDI Control Register */
    564        1.1   thorpej #define	MDIC_DATA(x)	((x) & 0xffff)
    565        1.1   thorpej #define	MDIC_REGADD(x)	((x) << 16)
    566       1.55   msaitoh #define	MDIC_PHY_SHIFT	21
    567       1.55   msaitoh #define	MDIC_PHY_MASK	__BITS(25, 21)
    568        1.1   thorpej #define	MDIC_PHYADD(x)	((x) << 21)
    569      1.123     skrll 
    570      1.123     skrll #define	MDIC_OP_RW_MASK	__BITS(27, 26)
    571      1.123     skrll #define	MDIC_OP_WRITE	__SHIFTIN(1, MDIC_OP_RW_MASK)
    572      1.123     skrll #define	MDIC_OP_READ	__SHIFTIN(2, MDIC_OP_RW_MASK)
    573      1.123     skrll #define	MDIC_READY	__BIT(28)
    574      1.123     skrll #define	MDIC_I		__BIT(29)	/* interrupt on MDI complete */
    575      1.123     skrll #define	MDIC_E		__BIT(30)	/* MDI error */
    576      1.123     skrll #define	MDIC_DEST	__BIT(31)	/* Destination */
    577        1.1   thorpej 
    578      1.124     skrll #define	WMREG_SCTL	0x0024	/* SerDes Control - RW */
    579       1.38   msaitoh /*
    580       1.38   msaitoh  * These 4 macros are also used for other 8bit control registers on the
    581       1.38   msaitoh  * 82575
    582       1.38   msaitoh  */
    583      1.124     skrll #define	SCTL_CTL_READY  __BIT(31)
    584      1.124     skrll #define	SCTL_CTL_DATA_MASK 0x000000ff
    585      1.124     skrll #define	SCTL_CTL_ADDR_SHIFT 8
    586      1.124     skrll #define	SCTL_CTL_POLL_TIMEOUT 640
    587      1.124     skrll #define	SCTL_DISABLE_SERDES_LOOPBACK 0x0400
    588      1.124     skrll 
    589      1.124     skrll #define	WMREG_FEXTNVM4	0x0024	/* Future Extended NVM 4 - RW */
    590      1.124     skrll #define	FEXTNVM4_BEACON_DURATION	__BITS(2, 0)
    591      1.124     skrll #define	FEXTNVM4_BEACON_DURATION_8US	0x7
    592      1.124     skrll #define	FEXTNVM4_BEACON_DURATION_16US	0x3
    593       1.92   msaitoh 
    594        1.1   thorpej #define	WMREG_FCAL	0x0028	/* Flow Control Address Low */
    595        1.1   thorpej #define	FCAL_CONST	0x00c28001	/* Flow Control MAC addr low */
    596        1.1   thorpej 
    597      1.102   msaitoh #define	WMREG_FEXTNVM	0x0028	/* Future Extended NVM register */
    598      1.106   msaitoh #define	FEXTNVM_SW_CONFIG	__BIT(0)  /* SW PHY Config En (ICH8 B0) */
    599      1.106   msaitoh #define	FEXTNVM_SW_CONFIG_ICH8M	__BIT(27) /* SW PHY Config En (>= ICH8 B1) */
    600      1.102   msaitoh 
    601        1.1   thorpej #define	WMREG_FCAH	0x002c	/* Flow Control Address High */
    602        1.1   thorpej #define	FCAH_CONST	0x00000100	/* Flow Control MAC addr high */
    603        1.1   thorpej 
    604        1.1   thorpej #define	WMREG_FCT	0x0030	/* Flow Control Type */
    605        1.1   thorpej 
    606       1.58   msaitoh #define	WMREG_KUMCTRLSTA 0x0034	/* MAC-PHY interface - RW */
    607      1.107   msaitoh #define	KUMCTRLSTA_MASK			0x0000ffff
    608      1.107   msaitoh #define	KUMCTRLSTA_OFFSET		0x001f0000
    609       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_SHIFT		16
    610       1.58   msaitoh #define	KUMCTRLSTA_REN			0x00200000
    611       1.58   msaitoh 
    612       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_FIFO_CTRL	0x00000000
    613       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_CTRL		0x00000001
    614       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_INB_CTRL	0x00000002
    615       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_DIAG		0x00000003
    616       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_TIMEOUTS	0x00000004
    617       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_K1_CONFIG	0x00000007
    618       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_INB_PARAM	0x00000009
    619       1.58   msaitoh #define	KUMCTRLSTA_OFFSET_HD_CTRL	0x00000010
    620      1.107   msaitoh #define	KUMCTRLSTA_OFFSET_M2P_SERDES	0x0000001e
    621      1.107   msaitoh #define	KUMCTRLSTA_OFFSET_M2P_MODES	0x0000001f
    622       1.58   msaitoh 
    623       1.58   msaitoh /* FIFO Control */
    624      1.103   msaitoh #define	KUMCTRLSTA_FIFO_CTRL_RX_BYPASS	0x0008
    625      1.103   msaitoh #define	KUMCTRLSTA_FIFO_CTRL_TX_BYPASS	0x0800
    626       1.58   msaitoh 
    627       1.58   msaitoh /* In-Band Control */
    628      1.103   msaitoh #define	KUMCTRLSTA_INB_CTRL_LINK_TMOUT_DFLT 0x0500
    629      1.103   msaitoh #define	KUMCTRLSTA_INB_CTRL_DIS_PADDING	0x0010
    630       1.58   msaitoh 
    631       1.58   msaitoh /* Diag */
    632       1.58   msaitoh #define	KUMCTRLSTA_DIAG_NELPBK	0x1000
    633       1.58   msaitoh 
    634       1.58   msaitoh /* K1 Config */
    635       1.58   msaitoh #define	KUMCTRLSTA_K1_ENABLE	0x0002
    636       1.58   msaitoh 
    637       1.58   msaitoh /* Half-Duplex Control */
    638      1.103   msaitoh #define	KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004
    639      1.103   msaitoh #define	KUMCTRLSTA_HD_CTRL_1000_DEFAULT	0x0000
    640      1.103   msaitoh 
    641      1.103   msaitoh /* M2P Modes */
    642      1.103   msaitoh #define	KUMCTRLSTA_OPMODE_MASK	0x000c
    643      1.103   msaitoh #define	KUMCTRLSTA_OPMODE_INBAND_MDIO 0x0004
    644       1.58   msaitoh 
    645      1.116   msaitoh #define	WMREG_CONNSW	0x0034	/* Copper/Fiber Switch Control (>= 82575) */
    646      1.116   msaitoh #define	CONNSW_AUTOSENSE_EN	__BIT(0)	/* Auto Sense Enable */
    647      1.116   msaitoh #define	CONNSW_AUTOSENSE_CONF	__BIT(1)	/* Auto Sense Config Mode */
    648      1.116   msaitoh #define	CONNSW_ENRGSRC		__BIT(2)	/* SerDes Energy Detect Src */
    649      1.116   msaitoh #define	CONNSW_SERDESD		__BIT(9)	/* SerDes Signal Detect Ind. */
    650      1.116   msaitoh #define	CONNSW_PHYSD		__BIT(10)	/* PHY Signal Detect Ind. */
    651      1.116   msaitoh #define	CONNSW_PHY_PDN		__BIT(11)	/* Internal PHY in powerdown */
    652      1.116   msaitoh 
    653        1.1   thorpej #define	WMREG_VET	0x0038	/* VLAN Ethertype */
    654      1.107   msaitoh #define	WMREG_MDPHYA	0x003c	/* PHY address - RW */
    655       1.93   msaitoh 
    656      1.124     skrll #define	WMREG_FEXTNVM3	0x003c	/* Future Extended NVM 3 */
    657      1.124     skrll #define	FEXTNVM3_PHY_CFG_COUNTER_MASK	__BITS(27, 26)
    658      1.124     skrll #define	FEXTNVM3_PHY_CFG_COUNTER_50MS	__BIT(27)
    659       1.93   msaitoh 
    660       1.99   msaitoh #define	WMREG_RAL(x)		(0x0040	+ ((x) * 8)) /* Receive Address List */
    661       1.99   msaitoh #define	WMREG_RAH(x)		(WMREG_RAL(x) + 4)
    662       1.99   msaitoh #define	WMREG_CORDOVA_RAL(x)	(((x) <= 15) ? (0x5400 + ((x) * 8)) : \
    663       1.99   msaitoh 	    (0x54e0 + (((x) - 16) * 8)))
    664       1.99   msaitoh #define	WMREG_CORDOVA_RAH(x)	(WMREG_CORDOVA_RAL(x) + 4)
    665       1.99   msaitoh #define	WMREG_SHRAL(x)		(0x5438 + ((x) * 8))
    666       1.99   msaitoh #define	WMREG_SHRAH(x)		(WMREG_PCH_LPT_SHRAL(x) + 4)
    667       1.99   msaitoh #define	WMREG_PCH_LPT_SHRAL(x)	(0x5408 + ((x) * 8))
    668       1.99   msaitoh #define	WMREG_PCH_LPT_SHRAH(x)	(WMREG_PCH_LPT_SHRAL(x) + 4)
    669        1.1   thorpej #define	WMREG_RAL_LO(b, x) ((b) + ((x) << 3))
    670        1.1   thorpej #define	WMREG_RAL_HI(b, x) (WMREG_RAL_LO(b, x) + 4)
    671        1.1   thorpej 	/*
    672        1.1   thorpej 	 * Receive Address List: The LO part is the low-order 32-bits
    673        1.1   thorpej 	 * of the MAC address.  The HI part is the high-order 16-bits
    674        1.1   thorpej 	 * along with a few control bits.
    675        1.1   thorpej 	 */
    676        1.1   thorpej #define	RAL_AS(x)	((x) << 16)	/* address select */
    677        1.1   thorpej #define	RAL_AS_DEST	RAL_AS(0)	/* (cordova?) */
    678        1.1   thorpej #define	RAL_AS_SOURCE	RAL_AS(1)	/* (cordova?) */
    679      1.123     skrll #define	RAL_RDR1	__BIT(30)	/* put packet in alt. rx ring */
    680      1.123     skrll #define	RAL_AV		__BIT(31)	/* entry is valid */
    681        1.1   thorpej 
    682       1.49   msaitoh #define	WM_RAL_TABSIZE		15	/* RAL size for old devices */
    683       1.49   msaitoh #define	WM_RAL_TABSIZE_ICH8	7	/* RAL size for ICH* and PCH* */
    684       1.88   msaitoh #define	WM_RAL_TABSIZE_PCH2	5	/* RAL size for PCH2 */
    685       1.88   msaitoh #define	WM_RAL_TABSIZE_PCH_LPT	12	/* RAL size for PCH_LPT */
    686       1.49   msaitoh #define	WM_RAL_TABSIZE_82575	16	/* RAL size for 82575 */
    687       1.49   msaitoh #define	WM_RAL_TABSIZE_82576	24	/* RAL size for 82576 and 82580 */
    688       1.49   msaitoh #define	WM_RAL_TABSIZE_I350	32	/* RAL size for I350 */
    689        1.1   thorpej 
    690        1.1   thorpej #define	WMREG_ICR	0x00c0	/* Interrupt Cause Register */
    691      1.123     skrll #define	ICR_TXDW	__BIT(0)	/* Tx desc written back */
    692      1.123     skrll #define	ICR_TXQE	__BIT(1)	/* Tx queue empty */
    693      1.123     skrll #define	ICR_LSC		__BIT(2)	/* link status change */
    694      1.123     skrll #define	ICR_RXSEQ	__BIT(3)	/* receive sequence error */
    695      1.123     skrll #define	ICR_RXDMT0	__BIT(4)	/* Rx ring 0 nearly empty */
    696      1.123     skrll #define	ICR_RXO		__BIT(6)	/* Rx overrun */
    697      1.123     skrll #define	ICR_RXT0	__BIT(7)	/* Rx ring 0 timer */
    698      1.123     skrll #define	ICR_MDAC	__BIT(9)	/* MDIO access complete */
    699      1.123     skrll #define	ICR_RXCFG	__BIT(10)	/* Receiving /C/ */
    700      1.118   msaitoh #define	ICR_GPI(x)	__BIT(11+(x))	/* general purpose interrupts */
    701       1.83  knakahar #define	ICR_RXQ(x)	__BIT(20+(x))	/* 82574: Rx queue x interrupt x=0,1 */
    702       1.83  knakahar #define	ICR_TXQ(x)	__BIT(22+(x))	/* 82574: Tx queue x interrupt x=0,1 */
    703       1.78   msaitoh #define	ICR_OTHER	__BIT(24)	/* 82574: Other interrupt */
    704      1.123     skrll #define	ICR_INT		__BIT(31)	/* device generated an interrupt */
    705        1.1   thorpej 
    706      1.124     skrll #define	WMREG_ITR	0x00c4	/* Interrupt Throttling Register */
    707      1.124     skrll #define	ITR_IVAL_MASK	0xffff		/* Interval mask */
    708      1.124     skrll #define	ITR_IVAL_SHIFT	0		/* Interval shift */
    709       1.14    briggs 
    710        1.1   thorpej #define	WMREG_ICS	0x00c8	/* Interrupt Cause Set Register */
    711        1.1   thorpej 	/* See ICR bits. */
    712        1.1   thorpej 
    713       1.91   msaitoh #define	WMREG_IMS	0x00d0	/* Interrupt Mask Set Register */
    714       1.91   msaitoh 	/* See ICR bits. */
    715       1.91   msaitoh 
    716       1.91   msaitoh #define	WMREG_IMC	0x00d8	/* Interrupt Mask Clear Register */
    717       1.91   msaitoh 	/* See ICR bits. */
    718       1.91   msaitoh 
    719       1.91   msaitoh #define	WMREG_EIAC_82574 0x00dc	/* Interrupt Auto Clear Register */
    720       1.91   msaitoh #define	WMREG_EIAC_82574_MSIX_MASK	(ICR_RXQ(0) | ICR_RXQ(1)	\
    721       1.91   msaitoh 	    | ICR_TXQ(0) | ICR_TXQ(1) | ICR_OTHER)
    722       1.91   msaitoh 
    723      1.124     skrll #define	WMREG_FEXTNVM7	0x00e4  /* Future Extended NVM 7 */
    724      1.124     skrll #define	FEXTNVM7_SIDE_CLK_UNGATE __BIT(2)
    725      1.124     skrll #define	FEXTNVM7_DIS_SMB_PERST	__BIT(5)
    726      1.124     skrll #define	FEXTNVM7_DIS_PB_READ	__BIT(18)
    727      1.124     skrll 
    728      1.124     skrll #define	WMREG_IVAR	0x00e4  /* Interrupt Vector Allocation Register */
    729      1.124     skrll #define	WMREG_IVAR0	0x01700 /* Interrupt Vector Allocation */
    730      1.124     skrll #define	IVAR_ALLOC_MASK  __BITS(0, 6)	/* Bit 5 and 6 are reserved */
    731      1.124     skrll #define	IVAR_VALID       __BIT(7)
    732       1.78   msaitoh /* IVAR definitions for 82580 and newer */
    733      1.124     skrll #define	WMREG_IVAR_Q(x)	(WMREG_IVAR0 + ((x) / 2) * 4)
    734      1.124     skrll #define	IVAR_TX_MASK_Q(x) (0x000000ffUL << (((x) % 2) == 0 ? 8 : 24))
    735      1.124     skrll #define	IVAR_RX_MASK_Q(x) (0x000000ffUL << (((x) % 2) == 0 ? 0 : 16))
    736       1.78   msaitoh /* IVAR definitions for 82576 */
    737      1.124     skrll #define	WMREG_IVAR_Q_82576(x)	(WMREG_IVAR0 + ((x) & 0x7) * 4)
    738      1.124     skrll #define	IVAR_TX_MASK_Q_82576(x) (0x000000ffUL << (((x) / 8) == 0 ? 8 : 24))
    739      1.124     skrll #define	IVAR_RX_MASK_Q_82576(x) (0x000000ffUL << (((x) / 8) == 0 ? 0 : 16))
    740       1.78   msaitoh /* IVAR definitions for 82574 */
    741      1.124     skrll #define	IVAR_ALLOC_MASK_82574	__BITS(0, 2)
    742      1.124     skrll #define	IVAR_VALID_82574	__BIT(3)
    743      1.124     skrll #define	IVAR_TX_MASK_Q_82574(x) (0x0000000fUL << ((x) == 0 ? 8 : 12))
    744      1.124     skrll #define	IVAR_RX_MASK_Q_82574(x) (0x0000000fUL << ((x) == 0 ? 0 : 4))
    745      1.124     skrll #define	IVAR_OTHER_MASK		__BITS(16, 19)
    746      1.124     skrll #define	IVAR_INT_ON_ALL_WB	__BIT(31)
    747      1.124     skrll 
    748      1.124     skrll #define	WMREG_IVAR_MISC	0x01740 /* IVAR for other causes */
    749      1.124     skrll #define	IVAR_MISC_TCPTIMER __BITS(0, 7)
    750      1.124     skrll #define	IVAR_MISC_OTHER	__BITS(8, 15)
    751       1.78   msaitoh 
    752      1.100   msaitoh #define	WMREG_SVCR	0x00f0
    753      1.100   msaitoh #define	SVCR_OFF_EN		__BIT(0)
    754      1.100   msaitoh #define	SVCR_OFF_MASKINT	__BIT(12)
    755      1.100   msaitoh 
    756      1.100   msaitoh #define	WMREG_SVT	0x00f4
    757      1.100   msaitoh #define	SVT_OFF_HWM		__BITS(4, 0)
    758      1.100   msaitoh 
    759       1.92   msaitoh #define	WMREG_LTRV	0x00f8	/* Latency Tolerance Reporting */
    760       1.92   msaitoh #define	LTRV_VALUE	__BITS(9, 0)
    761       1.92   msaitoh #define	LTRV_SCALE	__BITS(12, 10)
    762       1.92   msaitoh #define	LTRV_SCALE_MAX	5
    763       1.92   msaitoh #define	LTRV_SNOOP_REQ	__BIT(15)
    764       1.92   msaitoh #define	LTRV_SEND	__BIT(30)
    765       1.92   msaitoh #define	LTRV_NONSNOOP	__BITS(31, 16)
    766       1.92   msaitoh #define	LTRV_NONSNOOP_REQ __BIT(31)
    767       1.92   msaitoh 
    768        1.1   thorpej #define	WMREG_RCTL	0x0100	/* Receive Control */
    769      1.123     skrll #define	RCTL_EN		__BIT(1)	/* receiver enable */
    770      1.123     skrll #define	RCTL_SBP	__BIT(2)	/* store bad packets */
    771      1.123     skrll #define	RCTL_UPE	__BIT(3)	/* unicast promisc. enable */
    772      1.123     skrll #define	RCTL_MPE	__BIT(4)	/* multicast promisc. enable */
    773      1.123     skrll #define	RCTL_LPE	__BIT(5)	/* large packet enable */
    774        1.1   thorpej #define	RCTL_LBM(x)	((x) << 6)	/* loopback mode */
    775        1.1   thorpej #define	RCTL_LBM_NONE	RCTL_LBM(0)
    776        1.1   thorpej #define	RCTL_LBM_PHY	RCTL_LBM(3)
    777        1.1   thorpej #define	RCTL_RDMTS(x)	((x) << 8)	/* receive desc. min thresh size */
    778        1.1   thorpej #define	RCTL_RDMTS_1_2	RCTL_RDMTS(0)
    779        1.1   thorpej #define	RCTL_RDMTS_1_4	RCTL_RDMTS(1)
    780        1.1   thorpej #define	RCTL_RDMTS_1_8	RCTL_RDMTS(2)
    781        1.1   thorpej #define	RCTL_RDMTS_MASK	RCTL_RDMTS(3)
    782      1.124     skrll #define	RCTL_DTYP_MASK	__BITS(11,10)	/* descriptor type. 82574 only */
    783      1.124     skrll #define	RCTL_DTYP(x)	__SHIFTIN(x,RCTL_DTYP_MASK)
    784      1.124     skrll #define	RCTL_DTYP_ONEBUF RCTL_DTYP(0)	/* use one buffer(not split header). */
    785      1.124     skrll #define	RCTL_DTYP_SPH	RCTL_DTYP(1)	/* split header buffer. */
    786       1.95  knakahar 					/* RCTL_DTYP(2) and RCTL_DTYP(3) are reserved. */
    787      1.111   msaitoh #define	RCTL_MO		__BITS(13, 12)	/* multicast offset */
    788      1.123     skrll #define	RCTL_BAM	__BIT(15)	/* broadcast accept mode */
    789       1.89   msaitoh #define	RCTL_RDMTS_HEX	__BIT(16)
    790        1.1   thorpej #define	RCTL_2k		(0 << 16)	/* 2k Rx buffers */
    791        1.1   thorpej #define	RCTL_1k		(1 << 16)	/* 1k Rx buffers */
    792        1.1   thorpej #define	RCTL_512	(2 << 16)	/* 512 byte Rx buffers */
    793        1.1   thorpej #define	RCTL_256	(3 << 16)	/* 256 byte Rx buffers */
    794        1.1   thorpej #define	RCTL_BSEX_16k	(1 << 16)	/* 16k Rx buffers (BSEX) */
    795        1.1   thorpej #define	RCTL_BSEX_8k	(2 << 16)	/* 8k Rx buffers (BSEX) */
    796        1.1   thorpej #define	RCTL_BSEX_4k	(3 << 16)	/* 4k Rx buffers (BSEX) */
    797      1.123     skrll #define	RCTL_DPF	__BIT(22)	/* discard pause frames */
    798      1.123     skrll #define	RCTL_PMCF	__BIT(23)	/* pass MAC control frames */
    799      1.123     skrll #define	RCTL_BSEX	__BIT(25)	/* buffer size extension (Livengood) */
    800      1.123     skrll #define	RCTL_SECRC	__BIT(26)	/* strip Ethernet CRC */
    801        1.1   thorpej 
    802        1.1   thorpej #define	WMREG_OLD_RDTR0	0x0108	/* Receive Delay Timer (ring 0) */
    803        1.1   thorpej #define	WMREG_RDTR	0x2820
    804      1.123     skrll #define	RDTR_FPD	__BIT(31)	/* flush partial descriptor */
    805        1.1   thorpej 
    806      1.124     skrll #define	WMREG_LTRC	0x01a0	/* Latency Tolerance Reportiong Control */
    807       1.14    briggs 
    808        1.1   thorpej #define	WMREG_OLD_RDBAL0 0x0110	/* Receive Descriptor Base Low (ring 0) */
    809       1.83  knakahar #define	WMREG_RDBAL(x) \
    810       1.83  knakahar 	((x) < 4 ? (0x02800 + ((x) * 0x100)) :	\
    811      1.107   msaitoh 	    (0x0c000 + ((x) * 0x40)))
    812        1.1   thorpej 
    813        1.1   thorpej #define	WMREG_OLD_RDBAH0 0x0114	/* Receive Descriptor Base High (ring 0) */
    814       1.83  knakahar #define	WMREG_RDBAH(x) \
    815       1.83  knakahar 	((x) < 4 ? (0x02804 + ((x) * 0x100)) :	\
    816       1.83  knakahar 	    (0x0c004 + ((x) * 0x40)))
    817        1.1   thorpej 
    818        1.1   thorpej #define	WMREG_OLD_RDLEN0 0x0118	/* Receive Descriptor Length (ring 0) */
    819       1.83  knakahar #define	WMREG_RDLEN(x) \
    820       1.83  knakahar 	((x) < 4 ? (0x02808 + ((x) * 0x100)) :  \
    821       1.83  knakahar 	    (0x0c008 + ((x) * 0x40)))
    822       1.83  knakahar 
    823       1.83  knakahar #define	WMREG_SRRCTL(x) \
    824       1.83  knakahar 	((x) < 4 ? (0x0280c + ((x) * 0x100)) :	\
    825       1.83  knakahar 	    (0x0c00c + ((x) * 0x40)))	/* additional recv control used in 82575 ... */
    826      1.124     skrll #define	SRRCTL_BSIZEPKT_MASK		0x0000007f
    827      1.124     skrll #define	SRRCTL_BSIZEPKT_SHIFT		10	/* Shift _right_ */
    828      1.124     skrll #define	SRRCTL_BSIZEHDRSIZE_MASK	0x00000f00
    829      1.124     skrll #define	SRRCTL_BSIZEHDRSIZE_SHIFT	2	/* Shift _left_ */
    830      1.124     skrll #define	SRRCTL_DESCTYPE_LEGACY		0x00000000
    831      1.124     skrll #define	SRRCTL_DESCTYPE_ADV_ONEBUF	(1U << 25)
    832      1.124     skrll #define	SRRCTL_DESCTYPE_HDR_SPLIT	(2U << 25)
    833      1.124     skrll #define	SRRCTL_DESCTYPE_HDR_REPLICATION	(3U << 25)
    834      1.124     skrll #define	SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT (4U << 25)
    835      1.124     skrll #define	SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS (5U << 25) /* 82575 only */
    836      1.124     skrll #define	SRRCTL_DESCTYPE_MASK		(7U << 25)
    837      1.124     skrll #define	SRRCTL_DROP_EN			0x80000000
    838        1.1   thorpej 
    839        1.1   thorpej #define	WMREG_OLD_RDH0	0x0120	/* Receive Descriptor Head (ring 0) */
    840       1.83  knakahar #define	WMREG_RDH(x) \
    841       1.83  knakahar 	((x) < 4 ? (0x02810 + ((x) * 0x100)) :  \
    842      1.107   msaitoh 	    (0x0c010 + ((x) * 0x40)))
    843        1.1   thorpej 
    844        1.1   thorpej #define	WMREG_OLD_RDT0	0x0128	/* Receive Descriptor Tail (ring 0) */
    845       1.83  knakahar #define	WMREG_RDT(x) \
    846       1.83  knakahar 	((x) < 4 ? (0x02818 + ((x) * 0x100)) :	\
    847      1.107   msaitoh 	    (0x0c018 + ((x) * 0x40)))
    848       1.83  knakahar 
    849       1.83  knakahar #define	WMREG_RXDCTL(x) \
    850       1.83  knakahar 	((x) < 4 ? (0x02828 + ((x) * 0x100)) :	\
    851       1.83  knakahar 	    (0x0c028 + ((x) * 0x40)))	/* Receive Descriptor Control */
    852        1.1   thorpej #define	RXDCTL_PTHRESH(x) ((x) << 0)	/* prefetch threshold */
    853        1.1   thorpej #define	RXDCTL_HTHRESH(x) ((x) << 8)	/* host threshold */
    854        1.1   thorpej #define	RXDCTL_WTHRESH(x) ((x) << 16)	/* write back threshold */
    855      1.123     skrll #define	RXDCTL_GRAN	__BIT(24)	/* 0 = cacheline, 1 = descriptor */
    856       1.38   msaitoh /* flags used starting with 82575 ... */
    857      1.124     skrll #define	RXDCTL_QUEUE_ENABLE  0x02000000 /* Enable specific Tx Queue */
    858      1.124     skrll #define	RXDCTL_SWFLSH        0x04000000 /* Rx Desc. write-back flushing */
    859        1.1   thorpej 
    860  1.128.2.2    martin #define	WMREG_RQDPC(x)	(((x) < 4) ? (0x2830 + (0x100 * (x))) :		\
    861  1.128.2.2    martin 	    (0xc030 + (0x40 * (x)))) /* Receive Queue Drop Packet Count */
    862  1.128.2.2    martin 
    863        1.1   thorpej #define	WMREG_OLD_RDTR1	0x0130	/* Receive Delay Timer (ring 1) */
    864        1.1   thorpej #define	WMREG_OLD_RDBA1_LO 0x0138 /* Receive Descriptor Base Low (ring 1) */
    865        1.1   thorpej #define	WMREG_OLD_RDBA1_HI 0x013c /* Receive Descriptor Base High (ring 1) */
    866        1.1   thorpej #define	WMREG_OLD_RDLEN1 0x0140	/* Receive Drscriptor Length (ring 1) */
    867        1.1   thorpej #define	WMREG_OLD_RDH1	0x0148
    868        1.1   thorpej #define	WMREG_OLD_RDT1	0x0150
    869        1.1   thorpej #define	WMREG_OLD_FCRTH 0x0160	/* Flow Control Rx Threshold Hi (OLD) */
    870      1.107   msaitoh #define	WMREG_FCRTH	0x2168	/* Flow Control Rx Threhsold Hi */
    871        1.1   thorpej #define	FCRTH_DFLT	0x00008000
    872        1.1   thorpej 
    873        1.1   thorpej #define	WMREG_OLD_FCRTL 0x0168	/* Flow Control Rx Threshold Lo (OLD) */
    874      1.107   msaitoh #define	WMREG_FCRTL	0x2160	/* Flow Control Rx Threshold Lo */
    875        1.1   thorpej #define	FCRTL_DFLT	0x00004000
    876       1.11   thorpej #define	FCRTL_XONE	0x80000000	/* Enable XON frame transmission */
    877        1.1   thorpej 
    878        1.1   thorpej #define	WMREG_FCTTV	0x0170	/* Flow Control Transmit Timer Value */
    879       1.11   thorpej #define	FCTTV_DFLT	0x00000600
    880        1.1   thorpej 
    881        1.1   thorpej #define	WMREG_TXCW	0x0178	/* Transmit Configuration Word (TBI mode) */
    882        1.1   thorpej 	/* See MII ANAR_X bits. */
    883      1.123     skrll #define	TXCW_FD		__BIT(5)	/* Full Duplex */
    884      1.123     skrll #define	TXCW_HD		__BIT(6)	/* Half Duplex */
    885      1.123     skrll #define	TXCW_SYM_PAUSE	__BIT(7)	/* sym pause request */
    886      1.123     skrll #define	TXCW_ASYM_PAUSE	__BIT(8)	/* asym pause request */
    887      1.123     skrll #define	TXCW_TxConfig	__BIT(30)	/* Tx Config */
    888      1.123     skrll #define	TXCW_ANE	__BIT(31)	/* Autonegotiate */
    889        1.1   thorpej 
    890        1.1   thorpej #define	WMREG_RXCW	0x0180	/* Receive Configuration Word (TBI mode) */
    891        1.1   thorpej 	/* See MII ANLPAR_X bits. */
    892      1.123     skrll #define	RXCW_NC		__BIT(26)	/* no carrier */
    893      1.123     skrll #define	RXCW_IV		__BIT(27)	/* config invalid */
    894      1.123     skrll #define	RXCW_CC		__BIT(28)	/* config change */
    895      1.123     skrll #define	RXCW_C		__BIT(29)	/* /C/ reception */
    896      1.123     skrll #define	RXCW_SYNCH	__BIT(30)	/* synchronized */
    897      1.123     skrll #define	RXCW_ANC	__BIT(31)	/* autonegotiation complete */
    898        1.1   thorpej 
    899        1.1   thorpej #define	WMREG_MTA	0x0200	/* Multicast Table Array */
    900        1.1   thorpej #define	WMREG_CORDOVA_MTA 0x5200
    901        1.1   thorpej 
    902        1.1   thorpej #define	WMREG_TCTL	0x0400	/* Transmit Control Register */
    903      1.123     skrll #define	TCTL_EN		__BIT(1)	/* transmitter enable */
    904      1.123     skrll #define	TCTL_PSP	__BIT(3)	/* pad short packets */
    905        1.1   thorpej #define	TCTL_CT(x)	(((x) & 0xff) << 4)   /* 4:11 - collision threshold */
    906        1.1   thorpej #define	TCTL_COLD(x)	(((x) & 0x3ff) << 12) /* 12:21 - collision distance */
    907      1.123     skrll #define	TCTL_SWXOFF	__BIT(22)	/* software XOFF */
    908      1.123     skrll #define	TCTL_RTLC	__BIT(24)	/* retransmit on late collision */
    909      1.123     skrll #define	TCTL_NRTU	__BIT(25)	/* no retransmit on underrun */
    910      1.123     skrll #define	TCTL_MULR	__BIT(28)	/* multiple request */
    911        1.1   thorpej 
    912        1.1   thorpej #define	TX_COLLISION_THRESHOLD		15
    913       1.17   msaitoh #define	TX_COLLISION_DISTANCE_HDX	512
    914       1.17   msaitoh #define	TX_COLLISION_DISTANCE_FDX	64
    915        1.1   thorpej 
    916       1.20    bouyer #define	WMREG_TCTL_EXT	0x0404	/* Transmit Control Register */
    917      1.107   msaitoh #define	TCTL_EXT_BST_MASK	0x000003ff /* Backoff Slot Time */
    918      1.107   msaitoh #define	TCTL_EXT_GCEX_MASK	0x000ffc00 /* Gigabit Carry Extend Padding */
    919       1.20    bouyer 
    920       1.20    bouyer #define	DEFAULT_80003ES2LAN_TCTL_EXT_GCEX 0x00010000
    921       1.20    bouyer 
    922        1.1   thorpej #define	WMREG_TIPG	0x0410	/* Transmit IPG Register */
    923      1.112   msaitoh #define	TIPG_IPGT_MASK	__BITS(0, 9)	/* IPG transmit time MASK */
    924      1.112   msaitoh #define	TIPG_IPGT(x)	__SHIFTIN((x), TIPG_IPGT_MASK) /* IPG transmit time */
    925        1.1   thorpej #define	TIPG_IPGR1(x)	((x) << 10)	/* IPG receive time 1 */
    926        1.1   thorpej #define	TIPG_IPGR2(x)	((x) << 20)	/* IPG receive time 2 */
    927        1.1   thorpej #define	TIPG_WM_DFLT	(TIPG_IPGT(0x0a) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x0a))
    928        1.1   thorpej #define	TIPG_LG_DFLT	(TIPG_IPGT(0x06) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
    929        1.1   thorpej #define	TIPG_1000T_DFLT	(TIPG_IPGT(0x08) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
    930       1.20    bouyer #define	TIPG_1000T_80003_DFLT \
    931       1.20    bouyer     (TIPG_IPGT(0x08) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
    932       1.20    bouyer #define	TIPG_10_100_80003_DFLT \
    933       1.20    bouyer     (TIPG_IPGT(0x09) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x07))
    934        1.1   thorpej 
    935        1.1   thorpej #define	WMREG_TQC	0x0418
    936        1.1   thorpej 
    937       1.44   msaitoh #define	WMREG_OLD_TDBAL	0x0420	/* Transmit Descriptor Base Lo */
    938       1.83  knakahar #define	WMREG_TDBAL(x) \
    939       1.83  knakahar 	((x) < 4 ? (0x03800 + ((x) * 0x100)) :	\
    940      1.107   msaitoh 	    (0x0e000 + ((x) * 0x40)))
    941        1.1   thorpej 
    942       1.44   msaitoh #define	WMREG_OLD_TDBAH	0x0424	/* Transmit Descriptor Base Hi */
    943       1.83  knakahar #define	WMREG_TDBAH(x)\
    944       1.83  knakahar 	((x) < 4 ? (0x03804 + ((x) * 0x100)) :	\
    945      1.107   msaitoh 	    (0x0e004 + ((x) * 0x40)))
    946        1.1   thorpej 
    947        1.1   thorpej #define	WMREG_OLD_TDLEN	0x0428	/* Transmit Descriptor Length */
    948       1.83  knakahar #define	WMREG_TDLEN(x) \
    949       1.83  knakahar 	((x) < 4 ? (0x03808 + ((x) * 0x100)) :	\
    950      1.107   msaitoh 	    (0x0e008 + ((x) * 0x40)))
    951        1.1   thorpej 
    952        1.1   thorpej #define	WMREG_OLD_TDH	0x0430	/* Transmit Descriptor Head */
    953       1.83  knakahar #define	WMREG_TDH(x) \
    954       1.83  knakahar 	((x) < 4 ? (0x03810 + ((x) * 0x100)) :	\
    955      1.107   msaitoh 	    (0x0e010 + ((x) * 0x40)))
    956        1.1   thorpej 
    957        1.1   thorpej #define	WMREG_OLD_TDT	0x0438	/* Transmit Descriptor Tail */
    958      1.124     skrll #define	WMREG_TDT(x) \
    959       1.83  knakahar 	((x) < 4 ? (0x03818 + ((x) * 0x100)) :	\
    960      1.107   msaitoh 	    (0x0e018 + ((x) * 0x40)))
    961        1.1   thorpej 
    962        1.1   thorpej #define	WMREG_OLD_TIDV	0x0440	/* Transmit Delay Interrupt Value */
    963        1.1   thorpej #define	WMREG_TIDV	0x3820
    964        1.1   thorpej 
    965        1.1   thorpej #define	WMREG_AIT	0x0458	/* Adaptive IFS Throttle */
    966        1.1   thorpej #define	WMREG_VFTA	0x0600
    967        1.1   thorpej 
    968      1.102   msaitoh #define	WMREG_LEDCTL	0x0e00	/* LED Control - RW */
    969      1.102   msaitoh 
    970       1.55   msaitoh #define	WMREG_MDICNFG	0x0e04	/* MDC/MDIO Configuration Register */
    971      1.124     skrll #define	MDICNFG_PHY_SHIFT	21
    972      1.124     skrll #define	MDICNFG_PHY_MASK	__BITS(25, 21)
    973      1.124     skrll #define	MDICNFG_COM_MDIO	__BIT(30)
    974      1.124     skrll #define	MDICNFG_DEST		__BIT(31)
    975       1.55   msaitoh 
    976        1.1   thorpej #define	WM_MC_TABSIZE	128
    977       1.22    bouyer #define	WM_ICH8_MC_TABSIZE 32
    978        1.1   thorpej #define	WM_VLAN_TABSIZE	128
    979        1.1   thorpej 
    980       1.59   msaitoh #define	WMREG_PHPM	0x0e14	/* PHY Power Management */
    981      1.101   msaitoh #define	PHPM_SPD_EN		__BIT(0)	/* Smart Power Down */
    982      1.101   msaitoh #define	PHPM_D0A_LPLU		__BIT(1)	/* D0 Low Power Link Up */
    983      1.121   msaitoh #define	PHPM_NOND0A_LPLU	__BIT(2)	/* Non-D0a LPLU */
    984      1.121   msaitoh #define	PHPM_NOND0A_GBE_DIS	__BIT(3)	/* Disable 1G in non-D0a */
    985       1.59   msaitoh #define	PHPM_GO_LINK_D		__BIT(5)	/* Go Link Disconnect */
    986       1.59   msaitoh 
    987      1.124     skrll #define	WMREG_EEER	0x0e30	/* Energy Efficiency Ethernet "EEE" */
    988      1.124     skrll #define	EEER_TX_LPI_EN		0x00010000 /* EEER Tx LPI Enable */
    989      1.124     skrll #define	EEER_RX_LPI_EN		0x00020000 /* EEER Rx LPI Enable */
    990      1.124     skrll #define	EEER_LPI_FC		0x00040000 /* EEER Ena on Flow Cntrl */
    991      1.124     skrll #define	EEER_EEER_NEG		0x20000000 /* EEER capability nego */
    992      1.124     skrll #define	EEER_EEER_RX_LPI_STATUS	0x40000000 /* EEER Rx in LPI state */
    993      1.124     skrll #define	EEER_EEER_TX_LPI_STATUS	0x80000000 /* EEER Tx in LPI state */
    994      1.124     skrll #define	WMREG_EEE_SU	0x0e34	/* EEE Setup */
    995      1.124     skrll #define	WMREG_IPCNFG	0x0e38	/* Internal PHY Configuration */
    996      1.124     skrll #define	IPCNFG_10BASE_TE	0x00000002 /* IPCNFG 10BASE-Te low power op. */
    997      1.124     skrll #define	IPCNFG_EEE_100M_AN	0x00000004 /* IPCNFG EEE Ena 100M AN */
    998      1.124     skrll #define	IPCNFG_EEE_1G_AN	0x00000008 /* IPCNFG EEE Ena 1G AN */
    999      1.124     skrll 
   1000      1.124     skrll #define	WMREG_EXTCNFCTR	0x0f00  /* Extended Configuration Control */
   1001      1.124     skrll #define	EXTCNFCTR_PCIE_WRITE_ENABLE	0x00000001
   1002      1.124     skrll #define	EXTCNFCTR_OEM_WRITE_ENABLE	0x00000008
   1003      1.124     skrll #define	EXTCNFCTR_MDIO_SW_OWNERSHIP	0x00000020
   1004      1.124     skrll #define	EXTCNFCTR_MDIO_HW_OWNERSHIP	0x00000040
   1005      1.124     skrll #define	EXTCNFCTR_GATE_PHY_CFG		0x00000080
   1006      1.124     skrll #define	EXTCNFCTR_EXT_CNF_POINTER	0x0fff0000
   1007       1.58   msaitoh 
   1008      1.124     skrll #define	WMREG_EXTCNFSIZE 0x0f08  /* Extended Configuration Size */
   1009      1.124     skrll #define	EXTCNFSIZE_LENGTH	__BITS(23, 16)
   1010      1.102   msaitoh 
   1011       1.58   msaitoh #define	WMREG_PHY_CTRL	0x0f10	/* PHY control */
   1012       1.58   msaitoh #define	PHY_CTRL_SPD_EN		(1 << 0)
   1013       1.58   msaitoh #define	PHY_CTRL_D0A_LPLU	(1 << 1)
   1014       1.58   msaitoh #define	PHY_CTRL_NOND0A_LPLU	(1 << 2)
   1015       1.58   msaitoh #define	PHY_CTRL_NOND0A_GBE_DIS	(1 << 3)
   1016       1.86   msaitoh #define	PHY_CTRL_GBE_DIS	(1 << 6)
   1017       1.58   msaitoh 
   1018       1.92   msaitoh #define	WMREG_PCIEANACFG 0x0f18	/* PCIE Analog Config */
   1019       1.92   msaitoh 
   1020       1.89   msaitoh #define	WMREG_IOSFPC	0x0f28	/* Tx corrupted data */
   1021       1.89   msaitoh 
   1022        1.1   thorpej #define	WMREG_PBA	0x1000	/* Packet Buffer Allocation */
   1023       1.12   thorpej #define	PBA_BYTE_SHIFT	10		/* KB -> bytes */
   1024       1.12   thorpej #define	PBA_ADDR_SHIFT	7		/* KB -> quadwords */
   1025       1.22    bouyer #define	PBA_8K		0x0008
   1026       1.23   msaitoh #define	PBA_10K		0x000a
   1027       1.19   msaitoh #define	PBA_12K		0x000c
   1028       1.68   msaitoh #define	PBA_14K		0x000e
   1029       1.12   thorpej #define	PBA_16K		0x0010		/* 16K, default Tx allocation */
   1030       1.29   msaitoh #define	PBA_20K		0x0014
   1031       1.12   thorpej #define	PBA_22K		0x0016
   1032       1.12   thorpej #define	PBA_24K		0x0018
   1033       1.45   msaitoh #define	PBA_26K		0x001a
   1034       1.12   thorpej #define	PBA_30K		0x001e
   1035       1.19   msaitoh #define	PBA_32K		0x0020
   1036       1.51   msaitoh #define	PBA_34K		0x0022
   1037       1.38   msaitoh #define	PBA_35K		0x0023
   1038       1.12   thorpej #define	PBA_40K		0x0028
   1039       1.12   thorpej #define	PBA_48K		0x0030		/* 48K, default Rx allocation */
   1040       1.38   msaitoh #define	PBA_64K		0x0040
   1041       1.92   msaitoh #define	PBA_RXA_MASK	__BITS(15, 0)
   1042        1.1   thorpej 
   1043       1.31   msaitoh #define	WMREG_PBS	0x1008	/* Packet Buffer Size (ICH) */
   1044       1.22    bouyer 
   1045       1.53   msaitoh #define	WMREG_PBECCSTS	0x100c	/* Packet Buffer ECC Status (PCH_LPT) */
   1046       1.53   msaitoh #define	PBECCSTS_CORR_ERR_CNT_MASK	0x000000ff
   1047       1.53   msaitoh #define	PBECCSTS_UNCORR_ERR_CNT_MASK	0x0000ff00
   1048       1.53   msaitoh #define	PBECCSTS_UNCORR_ECC_ENABLE	0x00010000
   1049       1.53   msaitoh 
   1050      1.124     skrll #define	WMREG_EEMNGCTL	0x1010	/* MNG EEprom Control */
   1051      1.124     skrll #define	EEMNGCTL_CFGDONE_0 0x040000	/* MNG config cycle done */
   1052      1.124     skrll #define	EEMNGCTL_CFGDONE_1 0x080000	/*  2nd port */
   1053      1.124     skrll 
   1054      1.124     skrll #define	WMREG_I2CCMD	0x1028	/* SFPI2C Command Register - RW */
   1055      1.124     skrll #define	I2CCMD_REG_ADDR_SHIFT	16
   1056      1.124     skrll #define	I2CCMD_REG_ADDR		0x00ff0000
   1057      1.124     skrll #define	I2CCMD_PHY_ADDR_SHIFT	24
   1058      1.124     skrll #define	I2CCMD_PHY_ADDR		0x07000000
   1059      1.124     skrll #define	I2CCMD_OPCODE_READ	0x08000000
   1060      1.124     skrll #define	I2CCMD_OPCODE_WRITE	0x00000000
   1061      1.124     skrll #define	I2CCMD_RESET		0x10000000
   1062      1.124     skrll #define	I2CCMD_READY		0x20000000
   1063      1.124     skrll #define	I2CCMD_INTERRUPT_ENA	0x40000000
   1064      1.124     skrll #define	I2CCMD_ERROR		0x80000000
   1065      1.124     skrll #define	MAX_SGMII_PHY_REG_ADDR	255
   1066      1.124     skrll #define	I2CCMD_PHY_TIMEOUT	200
   1067       1.38   msaitoh 
   1068       1.58   msaitoh #define	WMREG_EEWR	0x102c	/* EEPROM write */
   1069       1.58   msaitoh 
   1070      1.124     skrll #define	WMREG_PBA_ECC	0x01100	/* PBA ECC */
   1071      1.124     skrll #define	PBA_ECC_COUNTER_MASK	0xfff00000 /* ECC counter mask */
   1072      1.124     skrll #define	PBA_ECC_COUNTER_SHIFT	20	   /* ECC counter shift value */
   1073       1.53   msaitoh #define	PBA_ECC_CORR_EN		0x00000001 /* Enable ECC error correction */
   1074       1.53   msaitoh #define	PBA_ECC_STAT_CLR	0x00000002 /* Clear ECC error counter */
   1075       1.53   msaitoh #define	PBA_ECC_INT_EN		0x00000004 /* Enable ICR bit 5 on ECC error */
   1076       1.53   msaitoh 
   1077      1.124     skrll #define	WMREG_GPIE	0x01514 /* General Purpose Interrupt Enable */
   1078      1.124     skrll #define	GPIE_NSICR	__BIT(0)	/* Non Selective Interrupt Clear */
   1079      1.124     skrll #define	GPIE_MULTI_MSIX	__BIT(4)	/* Multiple MSIX */
   1080      1.124     skrll #define	GPIE_EIAME	__BIT(30)	/* Extended Interrupt Auto Mask Ena. */
   1081      1.124     skrll #define	GPIE_PBA	__BIT(31)	/* PBA support */
   1082      1.124     skrll 
   1083      1.124     skrll #define	WMREG_EICS	0x01520  /* Ext. Interrupt Cause Set - WO */
   1084      1.124     skrll #define	WMREG_EIMS	0x01524  /* Ext. Interrupt Mask Set/Read - RW */
   1085      1.124     skrll #define	WMREG_EIMC	0x01528  /* Ext. Interrupt Mask Clear - WO */
   1086      1.124     skrll #define	WMREG_EIAC	0x0152c  /* Ext. Interrupt Auto Clear - RW */
   1087      1.124     skrll #define	WMREG_EIAM	0x01530  /* Ext. Interrupt Ack Auto Clear Mask - RW */
   1088      1.124     skrll 
   1089      1.124     skrll #define	WMREG_EICR	0x01580  /* Ext. Interrupt Cause Read - R/clr */
   1090      1.124     skrll 
   1091      1.124     skrll #define	WMREG_MSIXBM(x)	(0x1600 + (x) * 4) /* MSI-X Allocation */
   1092      1.124     skrll 
   1093      1.124     skrll #define	EITR_RX_QUEUE(x)	__BIT(0+(x)) /* Rx Queue x Interrupt x=[0-3] */
   1094      1.124     skrll #define	EITR_TX_QUEUE(x)	__BIT(8+(x)) /* Tx Queue x Interrupt x=[0-3] */
   1095      1.124     skrll #define	EITR_TCP_TIMER	0x40000000 /* TCP Timer */
   1096      1.124     skrll #define	EITR_OTHER	0x80000000 /* Interrupt Cause Active */
   1097      1.124     skrll 
   1098      1.124     skrll #define	WMREG_EITR(x)	(0x01680 + (0x4 * (x)))
   1099      1.124     skrll #define	EITR_ITR_INT_MASK	__BITS(14,2)
   1100      1.124     skrll #define	EITR_COUNTER_MASK_82575	__BITS(31,16)
   1101      1.124     skrll #define	EITR_CNT_INGR		__BIT(31) /* does not overwrite counter */
   1102       1.98  knakahar 
   1103      1.124     skrll #define	WMREG_EITR_82574(x)	(0x000e8 + (0x4 * (x)))
   1104      1.124     skrll #define	EITR_ITR_INT_MASK_82574	__BITS(15, 0)
   1105       1.38   msaitoh 
   1106       1.69   msaitoh #define	WMREG_RXPBS	0x2404	/* Rx Packet Buffer Size  */
   1107      1.124     skrll #define	RXPBS_SIZE_MASK_82576	0x0000007f
   1108       1.69   msaitoh 
   1109       1.58   msaitoh #define	WMREG_RDFH	0x2410	/* Receive Data FIFO Head */
   1110       1.58   msaitoh #define	WMREG_RDFT	0x2418	/* Receive Data FIFO Tail */
   1111       1.58   msaitoh #define	WMREG_RDFHS	0x2420	/* Receive Data FIFO Head Saved */
   1112       1.58   msaitoh #define	WMREG_RDFTS	0x2428	/* Receive Data FIFO Tail Saved */
   1113       1.58   msaitoh #define	WMREG_RADV	0x282c	/* Receive Interrupt Absolute Delay Timer */
   1114       1.58   msaitoh 
   1115        1.1   thorpej #define	WMREG_TXDMAC	0x3000	/* Transfer DMA Control */
   1116      1.123     skrll #define	TXDMAC_DPP	__BIT(0)	/* disable packet prefetch */
   1117        1.1   thorpej 
   1118      1.124     skrll #define	WMREG_KABGTXD	0x3004	/* AFE and Gap Transmit Ref Data */
   1119       1.28   msaitoh #define	KABGTXD_BGSQLBIAS 0x00050000
   1120       1.28   msaitoh 
   1121       1.58   msaitoh #define	WMREG_TDFH	0x3410	/* Transmit Data FIFO Head */
   1122       1.58   msaitoh #define	WMREG_TDFT	0x3418	/* Transmit Data FIFO Tail */
   1123       1.58   msaitoh #define	WMREG_TDFHS	0x3420	/* Transmit Data FIFO Head Saved */
   1124       1.58   msaitoh #define	WMREG_TDFTS	0x3428	/* Transmit Data FIFO Tail Saved */
   1125       1.58   msaitoh #define	WMREG_TDFPC	0x3430	/* Transmit Data FIFO Packet Count */
   1126       1.58   msaitoh 
   1127       1.66   msaitoh #define	WMREG_TXDCTL(n)		/* Trandmit Descriptor Control */ \
   1128       1.66   msaitoh 	(((n) < 4) ? (0x3828 + ((n) * 0x100)) : (0xe028 + ((n) * 0x40)))
   1129       1.58   msaitoh #define	TXDCTL_PTHRESH(x) ((x) << 0)	/* prefetch threshold */
   1130       1.58   msaitoh #define	TXDCTL_HTHRESH(x) ((x) << 8)	/* host threshold */
   1131       1.58   msaitoh #define	TXDCTL_WTHRESH(x) ((x) << 16)	/* write back threshold */
   1132       1.58   msaitoh /* flags used starting with 82575 ... */
   1133      1.124     skrll #define	TXDCTL_COUNT_DESC	__BIT(22) /* Enable the counting of desc.
   1134       1.66   msaitoh 					   still to be processed. */
   1135      1.124     skrll #define	TXDCTL_QUEUE_ENABLE  0x02000000 /* Enable specific Tx Queue */
   1136      1.124     skrll #define	TXDCTL_SWFLSH        0x04000000 /* Tx Desc. write-back flushing */
   1137      1.124     skrll #define	TXDCTL_PRIORITY      0x08000000
   1138       1.58   msaitoh 
   1139       1.58   msaitoh #define	WMREG_TADV	0x382c	/* Transmit Absolute Interrupt Delay Timer */
   1140        1.1   thorpej #define	WMREG_TSPMT	0x3830	/* TCP Segmentation Pad and Minimum
   1141        1.1   thorpej 				   Threshold (Cordova) */
   1142        1.1   thorpej #define	TSPMT_TSMT(x)	(x)		/* TCP seg min transfer */
   1143        1.1   thorpej #define	TSPMT_TSPBP(x)	((x) << 16)	/* TCP seg pkt buf padding */
   1144        1.1   thorpej 
   1145       1.66   msaitoh #define	WMREG_TARC0	0x3840	/* Tx arbitration count (0) */
   1146       1.66   msaitoh #define	WMREG_TARC1	0x3940	/* Tx arbitration count (1) */
   1147       1.66   msaitoh 
   1148       1.36   msaitoh #define	WMREG_CRCERRS	0x4000	/* CRC Error Count */
   1149       1.36   msaitoh #define	WMREG_ALGNERRC	0x4004	/* Alignment Error Count */
   1150       1.36   msaitoh #define	WMREG_SYMERRC	0x4008	/* Symbol Error Count */
   1151      1.126   msaitoh #define	WMREG_RXERRC	0x400c	/* Receive error Count - R/clr */
   1152       1.36   msaitoh #define	WMREG_MPC	0x4010	/* Missed Packets Count - R/clr */
   1153      1.127   msaitoh #define	WMREG_SCC	0x4014	/* Single Collision Count - R/clr */
   1154      1.127   msaitoh #define	WMREG_ECOL	0x4018	/* Excessive Collisions Count - R/clr */
   1155      1.127   msaitoh #define	WMREG_MCC	0x401c	/* Multiple Collision Count - R/clr */
   1156      1.127   msaitoh #define	WMREG_LATECOL	0x4020	/* Late Collisions Count - R/clr */
   1157      1.126   msaitoh #define	WMREG_COLC	0x4028	/* Collision Count - R/clr */
   1158  1.128.2.1    martin #define	WMREG_CBTMPC	0x402c	/* Circuit Breaker Tx Manageability Packet */
   1159      1.127   msaitoh #define	WMREG_DC	0x4030	/* Defer Count - R/clr */
   1160      1.127   msaitoh #define	WMREG_TNCRS	0x4034	/* Tx with No CRS - R/clr */
   1161       1.36   msaitoh #define	WMREG_SEC	0x4038	/* Sequence Error Count */
   1162  1.128.2.1    martin 
   1163  1.128.2.1    martin /* Old */
   1164       1.36   msaitoh #define	WMREG_CEXTERR	0x403c	/* Carrier Extension Error Count */
   1165  1.128.2.1    martin /* New */
   1166  1.128.2.1    martin #define	WMREG_HTDPMC	0x403c	/* Host Tx Discarded Packets by MAC Count */
   1167  1.128.2.1    martin 
   1168       1.36   msaitoh #define	WMREG_RLEC	0x4040	/* Receive Length Error Count */
   1169  1.128.2.1    martin #define	WMREG_CBRDPC	0x4044	/* Circuit Breaker Rx Dropped Packet Count */
   1170       1.11   thorpej #define	WMREG_XONRXC	0x4048	/* XON Rx Count - R/clr */
   1171       1.11   thorpej #define	WMREG_XONTXC	0x404c	/* XON Tx Count - R/clr */
   1172       1.11   thorpej #define	WMREG_XOFFRXC	0x4050	/* XOFF Rx Count - R/clr */
   1173       1.11   thorpej #define	WMREG_XOFFTXC	0x4054	/* XOFF Tx Count - R/clr */
   1174       1.11   thorpej #define	WMREG_FCRUC	0x4058	/* Flow Control Rx Unsupported Count - R/clr */
   1175      1.127   msaitoh #define	WMREG_PRC64	0x405c	/* Packets Rx (64 bytes) - R/clr */
   1176      1.127   msaitoh #define	WMREG_PRC127	0x4060	/* Packets Rx (65-127 bytes) - R/clr */
   1177      1.127   msaitoh #define	WMREG_PRC255	0x4064	/* Packets Rx (128-255 bytes) - R/clr */
   1178      1.127   msaitoh #define	WMREG_PRC511	0x4068	/* Packets Rx (255-511 bytes) - R/clr */
   1179      1.127   msaitoh #define	WMREG_PRC1023	0x406c	/* Packets Rx (512-1023 bytes) - R/clr */
   1180      1.127   msaitoh #define	WMREG_PRC1522	0x4070	/* Packets Rx (1024-1522 bytes) - R/clr */
   1181      1.127   msaitoh #define	WMREG_GPRC	0x4074	/* Good Packets Rx Count - R/clr */
   1182      1.127   msaitoh #define	WMREG_BPRC	0x4078	/* Broadcast Packets Rx Count - R/clr */
   1183      1.127   msaitoh #define	WMREG_MPRC	0x407c	/* Multicast Packets Rx Count - R/clr */
   1184      1.127   msaitoh #define	WMREG_GPTC	0x4080	/* Good Packets Tx Count - R/clr */
   1185      1.127   msaitoh #define	WMREG_GORCL	0x4088	/* Good Octets Rx Count Low - R/clr */
   1186      1.127   msaitoh #define	WMREG_GORCH	0x408c	/* Good Octets Rx Count High - R/clr */
   1187      1.127   msaitoh #define	WMREG_GOTCL	0x4090	/* Good Octets Tx Count Low - R/clr */
   1188      1.127   msaitoh #define	WMREG_GOTCH	0x4094	/* Good Octets Tx Count High - R/clr */
   1189      1.124     skrll #define	WMREG_RNBC	0x40a0	/* Receive No Buffers Count */
   1190      1.127   msaitoh #define	WMREG_RUC	0x40a4	/* Rx Undersize Count - R/clr */
   1191      1.127   msaitoh #define	WMREG_RFC	0x40a8	/* Rx Fragment Count - R/clr */
   1192      1.127   msaitoh #define	WMREG_ROC	0x40ac	/* Rx Oversize Count - R/clr */
   1193      1.127   msaitoh #define	WMREG_RJC	0x40b0	/* Rx Jabber Count - R/clr */
   1194      1.127   msaitoh #define	WMREG_MGTPRC	0x40b4	/* Management Packets RX Count - R/clr */
   1195      1.127   msaitoh #define	WMREG_MGTPDC	0x40b8	/* Management Packets Dropped Count - R/clr */
   1196      1.127   msaitoh #define	WMREG_MGTPTC	0x40bc	/* Management Packets TX Count - R/clr */
   1197      1.127   msaitoh #define	WMREG_TORL	0x40c0	/* Total Octets Rx Low - R/clr */
   1198      1.127   msaitoh #define	WMREG_TORH	0x40c4	/* Total Octets Rx High - R/clr */
   1199      1.127   msaitoh #define	WMREG_TOTL	0x40c8	/* Total Octets Tx Low - R/clr */
   1200      1.127   msaitoh #define	WMREG_TOTH	0x40cc	/* Total Octets Tx High - R/clr */
   1201      1.127   msaitoh #define	WMREG_TPR	0x40d0	/* Total Packets Rx - R/clr */
   1202      1.127   msaitoh #define	WMREG_TPT	0x40d4	/* Total Packets Tx - R/clr */
   1203      1.127   msaitoh #define	WMREG_PTC64	0x40d8	/* Packets Tx (64 bytes) - R/clr */
   1204      1.127   msaitoh #define	WMREG_PTC127	0x40dc	/* Packets Tx (65-127 bytes) - R/clr */
   1205      1.127   msaitoh #define	WMREG_PTC255	0x40e0	/* Packets Tx (128-255 bytes) - R/clr */
   1206      1.127   msaitoh #define	WMREG_PTC511	0x40e4	/* Packets Tx (256-511 bytes) - R/clr */
   1207      1.127   msaitoh #define	WMREG_PTC1023	0x40e8	/* Packets Tx (512-1023 bytes) - R/clr */
   1208      1.127   msaitoh #define	WMREG_PTC1522	0x40ec	/* Packets Tx (1024-1522 Bytes) - R/clr */
   1209      1.127   msaitoh #define	WMREG_MPTC	0x40f0	/* Multicast Packets Tx Count - R/clr */
   1210      1.127   msaitoh #define	WMREG_BPTC	0x40f4	/* Broadcast Packets Tx Count */
   1211      1.127   msaitoh #define	WMREG_TSCTC	0x40f8	/* TCP Segmentation Context Tx */
   1212  1.128.2.1    martin 
   1213  1.128.2.1    martin /* Old */
   1214      1.127   msaitoh #define	WMREG_TSCTFC	0x40fc	/* TCP Segmentation Context Tx Fail */
   1215  1.128.2.1    martin /* New */
   1216  1.128.2.1    martin #define	WMREG_CBRMPC	0x40fc	/* Circuit Breaker Rx Manageability Packet */
   1217  1.128.2.1    martin 
   1218      1.127   msaitoh #define	WMREG_IAC	0x4100	/* Interrupt Assertion Count */
   1219  1.128.2.1    martin 
   1220  1.128.2.1    martin /* Old */
   1221      1.127   msaitoh #define	WMREG_ICRXPTC	0x4104	/* Interrupt Cause Rx Pkt Timer Expire Count */
   1222      1.127   msaitoh #define	WMREG_ICRXATC	0x4108	/* Interrupt Cause Rx Abs Timer Expire Count */
   1223      1.127   msaitoh #define	WMREG_ICTXPTC	0x410c	/* Interrupt Cause Tx Pkt Timer Expire Count */
   1224      1.127   msaitoh #define	WMREG_ICTXATC	0x4110	/* Interrupt Cause Tx Abs Timer Expire Count */
   1225      1.127   msaitoh #define	WMREG_ICTXQEC	0x4118	/* Interrupt Cause Tx Queue Empty Count */
   1226      1.127   msaitoh #define	WMREG_ICTXQMTC	0x411c	/* Interrupt Cause Tx Queue Min Thresh Count */
   1227      1.127   msaitoh #define	WMREG_ICRXDMTC	0x4120	/* Interrupt Cause Rx Desc Min Thresh Count */
   1228      1.127   msaitoh #define	WMREG_ICRXOC	0x4124	/* Interrupt Cause Receiver Overrun Count */
   1229  1.128.2.1    martin /* New */
   1230  1.128.2.1    martin #define	WMREG_RPTHC	0x4104	/* Rx Pkt To Host Count */
   1231  1.128.2.1    martin #define	WMREG_DEBUG1	0x4108	/* Debug Counter 1 */
   1232  1.128.2.1    martin #define	WMREG_DEBUG2	0x410c	/* Debug Counter 2 */
   1233  1.128.2.1    martin #define	WMREG_DEBUG3	0x4110	/* Debug Counter 3 */
   1234  1.128.2.1    martin #define	WMREG_HGPTC	0x4118	/* Host Good Packets Tx Count (>=82576?) */
   1235  1.128.2.1    martin #define	WMREG_DEBUG4	0x411c	/* Debug Counter 4 */
   1236  1.128.2.1    martin #define	WMREG_RXDMTC	0x4120	/* Rx Desc Min Thresh Count */
   1237  1.128.2.1    martin #define	WMREG_HTCBDPC	0x4124	/* Host Tx Circuit Breaker Dropped Pkt. Cnt. */
   1238  1.128.2.1    martin #define	WMREG_HGORCL	0x4128	/* Host Good Octets Rx Count Low (>=82576?) */
   1239  1.128.2.1    martin #define	WMREG_HGORCH	0x412c	/* Host Good Octets Rx Count High (>=82576?) */
   1240  1.128.2.1    martin #define	WMREG_HGOTCL	0x4130	/* Host Good Octets Tx Count Low (>=82576?) */
   1241  1.128.2.1    martin #define	WMREG_HGOTCH	0x4134	/* Host Good Octets Tx Count High (>=82576?) */
   1242  1.128.2.1    martin #define	WMREG_LENERRS	0x4138	/* Length Errors Count (>=82576?) */
   1243  1.128.2.1    martin 
   1244      1.124     skrll #define	WMREG_TLPIC	0x4148	/* EEE Tx LPI Count */
   1245      1.124     skrll #define	WMREG_RLPIC	0x414c	/* EEE Rx LPI Count */
   1246      1.127   msaitoh #define	WMREG_B2OGPRC	0x4158	/* BMC2OS packets received by host */
   1247      1.127   msaitoh #define	WMREG_O2BSPC	0x415c	/* OS2BMC packets transmitted by host */
   1248       1.20    bouyer 
   1249       1.73   msaitoh #define	WMREG_PCS_CFG	0x4200	/* PCS Configuration */
   1250       1.73   msaitoh #define	PCS_CFG_PCS_EN	__BIT(3)
   1251       1.73   msaitoh 
   1252       1.73   msaitoh #define	WMREG_PCS_LCTL	0x4208	/* PCS Link Control */
   1253      1.116   msaitoh #define	PCS_LCTL_FLV_LINK_UP	__BIT(0)	/* Forced Link Value */
   1254      1.116   msaitoh #define	PCS_LCTL_FSV_MASK	__BITS(2, 1)	/* Forced Speed Value */
   1255      1.116   msaitoh #define	PCS_LCTL_FSV_10			0		/* 10Mbps */
   1256      1.116   msaitoh #define	PCS_LCTL_FSV_100		__BIT(1)	/* 100Mbps */
   1257      1.116   msaitoh #define	PCS_LCTL_FSV_1000		__BIT(2)	/* 1Gpbs */
   1258      1.116   msaitoh #define	PCS_LCTL_FDV_FULL	__BIT(3)	/* Force Duplex Value */
   1259      1.116   msaitoh #define	PCS_LCTL_FSD		__BIT(4)	/* Force Speed and Duplex */
   1260      1.116   msaitoh #define	PCS_LCTL_FORCE_LINK	__BIT(5)	/* Force Link */
   1261      1.116   msaitoh #define	PCS_LCTL_LINK_LATCH_LOW	__BIT(6)	/* Link Latch Low */
   1262      1.116   msaitoh #define	PCS_LCTL_FORCE_FC	__BIT(7)	/* Force Flow Control */
   1263      1.116   msaitoh #define	PCS_LCTL_AN_ENABLE	__BIT(16)	/* AN enable */
   1264      1.116   msaitoh #define	PCS_LCTL_AN_RESTART	__BIT(17)	/* AN restart */
   1265      1.116   msaitoh #define	PCS_LCTL_AN_TIMEOUT	__BIT(18)	/* AN Timeout Enable */
   1266      1.116   msaitoh #define	PCS_LCTL_AN_SGMII_BYP	__BIT(19)	/* AN SGMII Bypass */
   1267      1.116   msaitoh #define	PCS_LCTL_AN_SGMII_TRIG	__BIT(20)	/* AN SGMII Trigger */
   1268      1.116   msaitoh #define	PCS_LCTL_FAST_LINKTIMER	__BIT(24)	/* Fast Link Timer */
   1269      1.116   msaitoh #define	PCS_LCTL_LINK_OK_FIX_EN	__BIT(25)	/* Link OK Fix Enable */
   1270       1.73   msaitoh 
   1271       1.73   msaitoh #define	WMREG_PCS_LSTS	0x420c	/* PCS Link Status */
   1272      1.124     skrll #define	PCS_LSTS_LINKOK	__BIT(0)
   1273      1.124     skrll #define	PCS_LSTS_SPEED	__BITS(2, 1)
   1274      1.124     skrll #define	PCS_LSTS_SPEED_10	0
   1275      1.124     skrll #define	PCS_LSTS_SPEED_100	1
   1276      1.124     skrll #define	PCS_LSTS_SPEED_1000	2
   1277      1.124     skrll #define	PCS_LSTS_FDX	__BIT(3)
   1278      1.124     skrll #define	PCS_LSTS_AN_COMP __BIT(16)
   1279       1.73   msaitoh 
   1280       1.73   msaitoh #define	WMREG_PCS_ANADV	0x4218	/* AN Advertsement */
   1281       1.73   msaitoh #define	WMREG_PCS_LPAB	0x421c	/* Link Partnet Ability */
   1282      1.116   msaitoh #define	WMREG_PCS_NPTX	0x4220	/* Next Page Transmit */
   1283  1.128.2.1    martin #define	WMREG_SCVPC	0x4228	/* SerDes/SGMII Code Violation Packet Count */
   1284       1.73   msaitoh 
   1285       1.38   msaitoh #define	WMREG_RXCSUM	0x5000	/* Receive Checksum register */
   1286       1.38   msaitoh #define	RXCSUM_PCSS	0x000000ff	/* Packet Checksum Start */
   1287      1.123     skrll #define	RXCSUM_IPOFL	__BIT(8)	/* IP checksum offload */
   1288      1.123     skrll #define	RXCSUM_TUOFL	__BIT(9)	/* TCP/UDP checksum offload */
   1289      1.123     skrll #define	RXCSUM_IPV6OFL	__BIT(10)	/* IPv6 checksum offload */
   1290      1.123     skrll #define	RXCSUM_CRCOFL	__BIT(11)	/* SCTP CRC32 checksum offload */
   1291      1.123     skrll #define	RXCSUM_IPPCSE	__BIT(12)	/* IP payload checksum enable */
   1292      1.123     skrll #define	RXCSUM_PCSD	__BIT(13)	/* packet checksum disabled */
   1293       1.38   msaitoh 
   1294      1.124     skrll #define	WMREG_RLPML	0x5004	/* Rx Long Packet Max Length */
   1295       1.38   msaitoh 
   1296      1.124     skrll #define	WMREG_RFCTL	0x5008	/* Receive Filter Control */
   1297      1.124     skrll #define	WMREG_RFCTL_NFSWDIS	__BIT(6)  /* NFS Write Disable */
   1298      1.124     skrll #define	WMREG_RFCTL_NFSRDIS	__BIT(7)  /* NFS Read Disable */
   1299      1.124     skrll #define	WMREG_RFCTL_ACKDIS	__BIT(12) /* ACK Accelerate Disable */
   1300      1.124     skrll #define	WMREG_RFCTL_ACKD_DIS	__BIT(13) /* ACK data Disable */
   1301      1.124     skrll #define	WMREG_RFCTL_EXSTEN	__BIT(15) /* Extended status Enable. 82574 only. */
   1302      1.124     skrll #define	WMREG_RFCTL_IPV6EXDIS	__BIT(16) /* IPv6 Extension Header Disable */
   1303      1.124     skrll #define	WMREG_RFCTL_NEWIPV6EXDIS __BIT(17) /* New IPv6 Extension Header */
   1304       1.66   msaitoh 
   1305       1.38   msaitoh #define	WMREG_WUC	0x5800	/* Wakeup Control */
   1306       1.40   msaitoh #define	WUC_APME		0x00000001 /* APM Enable */
   1307       1.40   msaitoh #define	WUC_PME_EN		0x00000002 /* PME Enable */
   1308      1.124     skrll #define	WUC_PME_STATUS		0x00000004 /* PME Status */
   1309      1.124     skrll #define	WUC_APMPME		0x00000008 /* Assert PME on APM Wakeup */
   1310      1.124     skrll #define	WUC_PHY_WAKE		0x00000100 /* if PHY supports wakeup */
   1311       1.40   msaitoh 
   1312       1.97   msaitoh #define	WMREG_WUFC	0x5808	/* Wakeup Filter Control */
   1313      1.124     skrll #define	WUFC_LNKC	__BIT(0)	/* Link Status Change Wakeup Enable */
   1314      1.124     skrll #define	WUFC_MAG	__BIT(1)	/* Magic Packet Wakeup Enable */
   1315      1.124     skrll #define	WUFC_EX		__BIT(2)	/* Directed Exact Wakeup Enable */
   1316      1.124     skrll #define	WUFC_MC		__BIT(3)	/* Directed Multicast Wakeup En */
   1317      1.124     skrll #define	WUFC_BC		__BIT(4)	/* Broadcast Wakeup Enable */
   1318      1.124     skrll #define	WUFC_ARPDIR	__BIT(5)	/* ARP Request Packet Wakeup En */
   1319      1.124     skrll #define	WUFC_IPV4	__BIT(6)	/* Directed IPv4 Packet Wakeup En */
   1320      1.124     skrll #define	WUFC_IPV6	__BIT(7)	/* Directed IPv6 Packet Wakeup En */
   1321      1.124     skrll #define	WUFC_NS		__BIT(9)	/* NS Wakeup En */
   1322      1.124     skrll #define	WUFC_NSDIR	__BIT(10)	/* NS Directed En */
   1323      1.124     skrll #define	WUFC_ARP	__BIT(11)	/* ARP request En */
   1324      1.124     skrll #define	WUFC_FLEX_HQ	__BIT(14)	/* Flex Filters Host Queueing En */
   1325      1.124     skrll #define	WUFC_NOTCO	__BIT(15)	/* ? */
   1326      1.124     skrll #define	WUFC_FLX	__BITS(23, 16)	/* Flexible Filter [0-7] En */
   1327      1.124     skrll #define	WUFC_FLXACT	__BITS(27, 24)	/* Flexible Filter [0-3] Action */
   1328      1.124     skrll #define	WUFC_FW_RST_WK	__BIT(31)	/* Wake on Firmware Reset Assert En */
   1329      1.110   msaitoh 
   1330      1.110   msaitoh #define	WMREG_WUS	0x5810	/* Wakeup Status (R/W1C) */
   1331      1.110   msaitoh 	/* Bit 30-24 and 15-12 are reserved */
   1332      1.124     skrll #define	WUS_MNG		__BIT(8)	/* Manageability event */
   1333      1.124     skrll #define	WUS_FLAGS	"\20"						\
   1334      1.110   msaitoh 	"\1LINKC"	"\2MAG"		"\3EX"		"\4MC"		\
   1335      1.110   msaitoh 	"\5BC"		"\6ARPDIR"	"\7IPV4"	"\10IPV6"	\
   1336      1.110   msaitoh 	"\11MNG"	"\12NS"		"\13NSDIR"	"\14ARP"	\
   1337      1.110   msaitoh 	"\21FLX0"	"\22FLX1"	"\23FLX2"	"\24FLX3"	\
   1338      1.110   msaitoh 	"\25FLX4"	"\26FLX5"	"\27FLX6"	"\30FLX7"	\
   1339      1.110   msaitoh 							"\40FW_RST_WK"
   1340       1.38   msaitoh 
   1341      1.124     skrll #define	WMREG_MRQC	0x5818	/* Multiple Receive Queues Command */
   1342      1.124     skrll #define	MRQC_DISABLE_RSS	0x00000000
   1343      1.124     skrll #define	MRQC_ENABLE_RSS_MQ_82574	__BIT(0) /* enable RSS for 82574 */
   1344      1.124     skrll #define	MRQC_ENABLE_RSS_MQ	__BIT(1) /* enable hardware max RSS without VMDq */
   1345      1.124     skrll #define	MRQC_ENABLE_RSS_VMDQ	__BITS(1, 0) /* enable RSS with VMDq */
   1346      1.124     skrll #define	MRQC_DEFQ_MASK		__BITS(5, 3)
   1347       1.84  knakahar 				/*
   1348       1.84  knakahar 				 * Defines the default queue in non VMDq
   1349       1.84  knakahar 				 * mode according to value of the Multiple Receive
   1350       1.84  knakahar 				 * Queues Enable field.
   1351       1.84  knakahar 				 */
   1352      1.124     skrll #define	MRQC_DEFQ_NOT_RSS_FLT	__SHFTIN(__BIT(1), MRQC_DEFQ_MASK)
   1353       1.84  knakahar 				/*
   1354       1.84  knakahar 				 * the destination of all packets
   1355       1.84  knakahar 				 * not forwarded by RSS or filters
   1356       1.84  knakahar 				 */
   1357      1.124     skrll #define	MRQC_DEFQ_NOT_MAC_ETH	__SHFTIN(__BITS(1, 0), MRQC_DEFQ_MASK)
   1358       1.84  knakahar 				/*
   1359       1.84  knakahar 				 * Def_Q field is ignored. Queueing
   1360       1.84  knakahar 				 * decision of all packets not forwarded
   1361       1.84  knakahar 				 * by MAC address and Ether-type filters
   1362       1.84  knakahar 				 * is according to VT_CTL.DEF_PL field.
   1363       1.84  knakahar 				 */
   1364      1.124     skrll #define	MRQC_DEFQ_IGNORED1	__SHFTIN(__BIT(2), MRQC_DEFQ_MASK)
   1365       1.84  knakahar 				/* Def_Q field is ignored */
   1366      1.124     skrll #define	MRQC_DEFQ_IGNORED2	__SHFTIN(__BIT(2)|__BIT(0), MRQC_DEFQ_MASK)
   1367       1.84  knakahar 				/* Def_Q field is ignored */
   1368      1.124     skrll #define	MRQC_DEFQ_VMDQ		__SHFTIN(__BITS(2, 1), MRQC_DEFQ_MASK)
   1369       1.84  knakahar 				/* for VMDq mode */
   1370      1.124     skrll #define	MRQC_RSS_FIELD_IPV4_TCP		__BIT(16)
   1371      1.124     skrll #define	MRQC_RSS_FIELD_IPV4		__BIT(17)
   1372      1.124     skrll #define	MRQC_RSS_FIELD_IPV6_TCP_EX	__BIT(18)
   1373      1.124     skrll #define	MRQC_RSS_FIELD_IPV6_EX		__BIT(19)
   1374      1.124     skrll #define	MRQC_RSS_FIELD_IPV6		__BIT(20)
   1375      1.124     skrll #define	MRQC_RSS_FIELD_IPV6_TCP		__BIT(21)
   1376      1.124     skrll #define	MRQC_RSS_FIELD_IPV4_UDP		__BIT(22)
   1377      1.124     skrll #define	MRQC_RSS_FIELD_IPV6_UDP		__BIT(23)
   1378      1.124     skrll #define	MRQC_RSS_FIELD_IPV6_UDP_EX	__BIT(24)
   1379      1.124     skrll 
   1380      1.124     skrll #define	WMREG_RETA_Q(x)		(0x5c00 + ((x) >> 2) * 4) /* Redirection Table */
   1381      1.124     skrll #define	RETA_NUM_ENTRIES	128
   1382      1.124     skrll #define	RETA_ENTRY_MASK_Q(x)	(0x000000ffUL << (((x) % 4) * 8)) /* Redirection Table */
   1383      1.124     skrll #define	RETA_ENT_QINDEX_MASK		__BITS(3,0) /*queue index for 82580 and newer */
   1384      1.124     skrll #define	RETA_ENT_QINDEX0_MASK_82575	__BITS(3,2) /*queue index for pool0 */
   1385      1.124     skrll #define	RETA_ENT_QINDEX1_MASK_82575	__BITS(7,6) /*queue index for pool1 and regular RSS */
   1386      1.124     skrll #define	RETA_ENT_QINDEX_MASK_82574	__BIT(7) /*queue index for 82574 */
   1387       1.84  knakahar 
   1388      1.124     skrll #define	WMREG_RSSRK(x)		(0x5c80 + (x) * 4) /* RSS Random Key Register */
   1389      1.124     skrll #define	RSSRK_NUM_REGS		10
   1390       1.84  knakahar 
   1391       1.32   msaitoh #define	WMREG_MANC	0x5820	/* Management Control */
   1392      1.126   msaitoh #define	MANC_SMBUS_EN		__BIT(0)
   1393      1.126   msaitoh #define	MANC_ASF_EN		__BIT(1)
   1394      1.126   msaitoh #define	MANC_ARP_EN		__BIT(13)
   1395      1.126   msaitoh #define	MANC_RECV_TCO_RESET	__BIT(16)
   1396      1.126   msaitoh #define	MANC_RECV_TCO_EN	__BIT(17)
   1397      1.126   msaitoh #define	MANC_BLK_PHY_RST_ON_IDE	__BIT(18)
   1398      1.126   msaitoh #define	MANC_RECV_ALL		__BIT(19)
   1399      1.126   msaitoh #define	MANC_EN_MAC_ADDR_FILTER	__BIT(20)
   1400      1.126   msaitoh #define	MANC_EN_MNG2HOST	__BIT(21)
   1401      1.127   msaitoh #define	MANC_EN_BMC2OS		__BIT(28)
   1402       1.32   msaitoh 
   1403       1.88   msaitoh #define	WMREG_MANC2H	0x5860	/* Management Control To Host - RW */
   1404      1.124     skrll #define	MANC2H_PORT_623		(1 << 5)
   1405      1.124     skrll #define	MANC2H_PORT_624		(1 << 6)
   1406       1.20    bouyer 
   1407      1.124     skrll #define	WMREG_GCR	0x5b00	/* PCIe Control */
   1408      1.124     skrll #define	GCR_RXD_NO_SNOOP	0x00000001
   1409      1.124     skrll #define	GCR_RXDSCW_NO_SNOOP	0x00000002
   1410      1.124     skrll #define	GCR_RXDSCR_NO_SNOOP	0x00000004
   1411      1.124     skrll #define	GCR_TXD_NO_SNOOP	0x00000008
   1412      1.124     skrll #define	GCR_TXDSCW_NO_SNOOP	0x00000010
   1413      1.124     skrll #define	GCR_TXDSCR_NO_SNOOP	0x00000020
   1414      1.124     skrll #define	GCR_CMPL_TMOUT_MASK	0x0000f000
   1415      1.124     skrll #define	GCR_CMPL_TMOUT_10MS	0x00001000
   1416      1.124     skrll #define	GCR_CMPL_TMOUT_RESEND	0x00010000
   1417      1.124     skrll #define	GCR_CAP_VER2		0x00040000
   1418      1.124     skrll #define	GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
   1419      1.124     skrll #define	GCR_NO_SNOOP_ALL (GCR_RXD_NO_SNOOP | \
   1420      1.109   msaitoh 	    GCR_RXDSCW_NO_SNOOP |	     \
   1421      1.109   msaitoh 	    GCR_RXDSCR_NO_SNOOP |	     \
   1422      1.109   msaitoh 	    GCR_TXD_NO_SNOOP |		     \
   1423      1.109   msaitoh 	    GCR_TXDSCW_NO_SNOOP |	     \
   1424      1.109   msaitoh 	    GCR_TXDSCR_NO_SNOOP)
   1425       1.40   msaitoh 
   1426      1.124     skrll #define	WMREG_FACTPS	0x5b30	/* Function Active and Power State to MNG */
   1427      1.124     skrll #define	FACTPS_MNGCG		0x20000000
   1428      1.124     skrll #define	FACTPS_LFS		0x40000000	/* LAN Function Select */
   1429      1.124     skrll 
   1430      1.124     skrll #define	WMREG_GIOCTL	0x5b44	/* GIO Analog Control Register */
   1431      1.124     skrll #define	WMREG_CCMCTL	0x5b48	/* CCM Control Register */
   1432      1.124     skrll #define	WMREG_SCCTL	0x5b4c	/* PCIc PLL Configuration Register */
   1433       1.38   msaitoh 
   1434       1.18  uebayasi #define	WMREG_SWSM	0x5b50	/* SW Semaphore */
   1435       1.17   msaitoh #define	SWSM_SMBI	0x00000001	/* Driver Semaphore bit */
   1436       1.17   msaitoh #define	SWSM_SWESMBI	0x00000002	/* FW Semaphore bit */
   1437       1.17   msaitoh #define	SWSM_WMNG	0x00000004	/* Wake MNG Clock */
   1438       1.17   msaitoh #define	SWSM_DRV_LOAD	0x00000008	/* Driver Loaded Bit */
   1439       1.93   msaitoh /* Intel driver defines H2ME register at 0x5b50 */
   1440       1.93   msaitoh #define	WMREG_H2ME	0x5b50	/* SW Semaphore */
   1441      1.124     skrll #define	H2ME_ULP		__BIT(11)
   1442      1.124     skrll #define	H2ME_ENFORCE_SETTINGS	__BIT(12)
   1443       1.20    bouyer 
   1444       1.26   msaitoh #define	WMREG_FWSM	0x5b54	/* FW Semaphore */
   1445       1.88   msaitoh #define	FWSM_MODE		__BITS(1, 3)
   1446       1.40   msaitoh #define	MNG_ICH_IAMT_MODE	0x2	/* PT mode? */
   1447       1.26   msaitoh #define	MNG_IAMT_MODE		0x3
   1448      1.124     skrll #define	FWSM_RSPCIPHY		__BIT(6)  /* Reset PHY on PCI reset */
   1449      1.124     skrll #define	FWSM_WLOCK_MAC		__BITS(7, 9)
   1450      1.124     skrll #define	FWSM_ULP_CFG_DONE	__BIT(10)
   1451      1.124     skrll #define	FWSM_FW_VALID		__BIT(15) /* FW established a valid mode */
   1452       1.26   msaitoh 
   1453       1.57   msaitoh #define	WMREG_SWSM2	0x5b58	/* SW Semaphore 2 */
   1454      1.124     skrll #define	SWSM2_LOCK		0x00000002 /* Secondary driver semaphore bit */
   1455       1.57   msaitoh 
   1456       1.20    bouyer #define	WMREG_SW_FW_SYNC 0x5b5c	/* software-firmware semaphore */
   1457       1.20    bouyer #define	SWFW_EEP_SM		0x0001 /* eeprom access */
   1458       1.20    bouyer #define	SWFW_PHY0_SM		0x0002 /* first ctrl phy access */
   1459       1.20    bouyer #define	SWFW_PHY1_SM		0x0004 /* second ctrl phy access */
   1460       1.20    bouyer #define	SWFW_MAC_CSR_SM		0x0008
   1461       1.38   msaitoh #define	SWFW_PHY2_SM		0x0020 /* first ctrl phy access */
   1462       1.38   msaitoh #define	SWFW_PHY3_SM		0x0040 /* first ctrl phy access */
   1463       1.20    bouyer #define	SWFW_SOFT_SHIFT		0	/* software semaphores */
   1464       1.20    bouyer #define	SWFW_FIRM_SHIFT		16	/* firmware semaphores */
   1465       1.22    bouyer 
   1466      1.124     skrll #define	WMREG_GCR2	0x5b64	/* 3GPIO Control Register 2 */
   1467      1.124     skrll #define	WMREG_FEXTNVM9	0x5bb4	/* Future Extended NVM 9 */
   1468      1.124     skrll #define	FEXTNVM9_IOSFSB_CLKGATE_DIS __BIT(11)
   1469      1.124     skrll #define	FEXTNVM9_IOSFSB_CLKREQ_DIS __BIT(12)
   1470      1.124     skrll #define	WMREG_FEXTNVM11	0x5bbc	/* Future Extended NVM 11 */
   1471      1.124     skrll #define	FEXTNVM11_DIS_MULRFIX	__BIT(13)	/* Disable MULR fix */
   1472      1.124     skrll 
   1473      1.124     skrll #define	WMREG_FFLT_DBG	0x05F04 /* Debug Register */
   1474      1.124     skrll 
   1475      1.124     skrll #define	WMREG_CRC_OFFSET 0x5f50
   1476      1.124     skrll #define	WMREG_PCH_RAICC(x)	(WMREG_CRC_OFFSET + (x) * 4)
   1477      1.124     skrll 
   1478      1.127   msaitoh #define	WMREG_B2OSPC	0x8fe0	/* BMC2OS packets sent by BMC */
   1479      1.127   msaitoh #define	WMREG_O2BGPTC	0x8fe4	/* OS2BMC packets received by BMC */
   1480      1.127   msaitoh 
   1481  1.128.2.1    martin #define	WMREG_HRMPC	0xa018	/* Header Redirection Missed Packet Count */
   1482  1.128.2.1    martin 
   1483      1.124     skrll #define	WMREG_EEC	0x12010
   1484      1.124     skrll #define	EEC_FLASH_DETECTED __BIT(19)	/* FLASH */
   1485      1.124     skrll #define	EEC_FLUPD	__BIT(23)	/* Update FLASH */
   1486       1.71   msaitoh 
   1487      1.124     skrll #define	WMREG_EEARBC_I210 0x12024
   1488       1.71   msaitoh 
   1489       1.58   msaitoh /*
   1490       1.58   msaitoh  * NVM related values.
   1491       1.58   msaitoh  *  Microwire, SPI, and flash
   1492       1.58   msaitoh  */
   1493       1.58   msaitoh #define	UWIRE_OPC_ERASE	0x04		/* MicroWire "erase" opcode */
   1494       1.58   msaitoh #define	UWIRE_OPC_WRITE	0x05		/* MicroWire "write" opcode */
   1495       1.58   msaitoh #define	UWIRE_OPC_READ	0x06		/* MicroWire "read" opcode */
   1496       1.58   msaitoh 
   1497       1.58   msaitoh #define	SPI_OPC_WRITE	0x02		/* SPI "write" opcode */
   1498       1.58   msaitoh #define	SPI_OPC_READ	0x03		/* SPI "read" opcode */
   1499       1.58   msaitoh #define	SPI_OPC_A8	0x08		/* opcode bit 3 == address bit 8 */
   1500       1.58   msaitoh #define	SPI_OPC_WREN	0x06		/* SPI "set write enable" opcode */
   1501       1.58   msaitoh #define	SPI_OPC_WRDI	0x04		/* SPI "clear write enable" opcode */
   1502       1.58   msaitoh #define	SPI_OPC_RDSR	0x05		/* SPI "read status" opcode */
   1503       1.58   msaitoh #define	SPI_OPC_WRSR	0x01		/* SPI "write status" opcode */
   1504       1.58   msaitoh #define	SPI_MAX_RETRIES	5000		/* max wait of 5ms for RDY signal */
   1505       1.58   msaitoh 
   1506       1.58   msaitoh #define	SPI_SR_RDY	0x01
   1507       1.58   msaitoh #define	SPI_SR_WEN	0x02
   1508       1.58   msaitoh #define	SPI_SR_BP0	0x04
   1509       1.58   msaitoh #define	SPI_SR_BP1	0x08
   1510       1.58   msaitoh #define	SPI_SR_WPEN	0x80
   1511       1.58   msaitoh 
   1512      1.124     skrll #define	NVM_CHECKSUM		0xBABA
   1513      1.124     skrll #define	NVM_SIZE		0x0040
   1514      1.124     skrll #define	NVM_WORD_SIZE_BASE_SHIFT 6
   1515       1.61   msaitoh 
   1516       1.71   msaitoh #define	NVM_OFF_MACADDR		0x0000	/* MAC address offset 0 */
   1517       1.71   msaitoh #define	NVM_OFF_MACADDR1	0x0001	/* MAC address offset 1 */
   1518       1.71   msaitoh #define	NVM_OFF_MACADDR2	0x0002	/* MAC address offset 2 */
   1519      1.124     skrll #define	NVM_OFF_COMPAT		0x0003
   1520      1.124     skrll #define	NVM_OFF_ID_LED_SETTINGS	0x0004
   1521      1.124     skrll #define	NVM_OFF_VERSION		0x0005
   1522       1.61   msaitoh #define	NVM_OFF_CFG1		0x000a	/* config word 1 */
   1523       1.61   msaitoh #define	NVM_OFF_CFG2		0x000f	/* config word 2 */
   1524       1.62   msaitoh #define	NVM_OFF_EEPROM_SIZE	0x0012	/* NVM SIZE */
   1525       1.71   msaitoh #define	NVM_OFF_CFG4		0x0013	/* config word 4 */
   1526       1.61   msaitoh #define	NVM_OFF_CFG3_PORTB	0x0014	/* config word 3 */
   1527      1.124     skrll #define	NVM_OFF_FUTURE_INIT_WORD1 0x0019
   1528       1.61   msaitoh #define	NVM_OFF_INIT_3GIO_3	0x001a	/* PCIe Initial Configuration Word 3 */
   1529       1.61   msaitoh #define	NVM_OFF_K1_CONFIG	0x001b	/* NVM K1 Config */
   1530       1.71   msaitoh #define	NVM_OFF_LED_1_CFG	0x001c
   1531       1.71   msaitoh #define	NVM_OFF_LED_0_2_CFG	0x001f
   1532       1.61   msaitoh #define	NVM_OFF_SWDPIN		0x0020	/* SWD Pins (Cordova) */
   1533       1.61   msaitoh #define	NVM_OFF_CFG3_PORTA	0x0024	/* config word 3 */
   1534      1.124     skrll #define	NVM_OFF_ALT_MAC_ADDR_PTR 0x0037	/* to the alternative MAC addresses */
   1535      1.124     skrll #define	NVM_OFF_COMB_VER_PTR	0x003d
   1536      1.124     skrll #define	NVM_OFF_IMAGE_UID0	0x0042
   1537      1.124     skrll #define	NVM_OFF_IMAGE_UID1	0x0043
   1538       1.61   msaitoh 
   1539      1.124     skrll #define	NVM_COMPAT_VALID_CHECKSUM	0x0001
   1540       1.61   msaitoh 
   1541      1.123     skrll #define	NVM_CFG1_LVDID		__BIT(0)
   1542      1.123     skrll #define	NVM_CFG1_LSSID		__BIT(1)
   1543      1.123     skrll #define	NVM_CFG1_PME_CLOCK	__BIT(2)
   1544      1.123     skrll #define	NVM_CFG1_PM		__BIT(3)
   1545      1.123     skrll #define	NVM_CFG1_ILOS		__BIT(4)	/* Invert loss of signal */
   1546       1.61   msaitoh #define	NVM_CFG1_SWDPIO_SHIFT	5
   1547       1.61   msaitoh #define	NVM_CFG1_SWDPIO_MASK	(0xf << NVM_CFG1_SWDPIO_SHIFT)
   1548      1.123     skrll #define	NVM_CFG1_IPS1		__BIT(8)
   1549      1.123     skrll #define	NVM_CFG1_LRST		__BIT(9)
   1550      1.123     skrll #define	NVM_CFG1_FD		__BIT(10)
   1551      1.123     skrll #define	NVM_CFG1_FRCSPD		__BIT(11)
   1552      1.123     skrll #define	NVM_CFG1_IPS0		__BIT(12)
   1553      1.123     skrll #define	NVM_CFG1_64_32_BAR	__BIT(13)
   1554      1.123     skrll 
   1555      1.123     skrll #define	NVM_CFG2_CSR_RD_SPLIT	__BIT(1)
   1556      1.123     skrll #define	NVM_CFG2_82544_APM_EN	__BIT(2)
   1557      1.123     skrll #define	NVM_CFG2_64_BIT		__BIT(3)
   1558      1.123     skrll #define	NVM_CFG2_MAX_READ	__BIT(4)
   1559      1.123     skrll #define	NVM_CFG2_DMCR_MAP	__BIT(5)
   1560      1.123     skrll #define	NVM_CFG2_133_CAP	__BIT(6)
   1561      1.123     skrll #define	NVM_CFG2_MSI_DIS	__BIT(7)
   1562      1.123     skrll #define	NVM_CFG2_FLASH_DIS	__BIT(8)
   1563       1.61   msaitoh #define	NVM_CFG2_FLASH_SIZE(x)	(((x) & 3) >> 9)
   1564      1.123     skrll #define	NVM_CFG2_APM_EN		__BIT(10)
   1565      1.123     skrll #define	NVM_CFG2_ANE		__BIT(11)
   1566       1.61   msaitoh #define	NVM_CFG2_PAUSE(x)	(((x) & 3) >> 12)
   1567      1.123     skrll #define	NVM_CFG2_ASDE		__BIT(14)
   1568      1.123     skrll #define	NVM_CFG2_APM_PME	__BIT(15)
   1569       1.61   msaitoh #define	NVM_CFG2_SWDPIO_SHIFT	4
   1570       1.61   msaitoh #define	NVM_CFG2_SWDPIO_MASK	(0xf << NVM_CFG2_SWDPIO_SHIFT)
   1571       1.61   msaitoh #define	NVM_CFG2_MNGM_SHIFT	13	/* Manageability Operation mode */
   1572       1.61   msaitoh #define	NVM_CFG2_MNGM_MASK	(3U << NVM_CFG2_MNGM_SHIFT)
   1573       1.61   msaitoh #define	NVM_CFG2_MNGM_DIS	0
   1574       1.61   msaitoh #define	NVM_CFG2_MNGM_NCSI	1
   1575       1.61   msaitoh #define	NVM_CFG2_MNGM_PT	2
   1576       1.61   msaitoh 
   1577      1.118   msaitoh #define	NVM_COMPAT_MAS_EN(x)		__BIT(x) /* Media Auto Sense Enable */
   1578       1.73   msaitoh #define	NVM_COMPAT_SERDES_FORCE_MODE	__BIT(14) /* Don't use autonego */
   1579       1.73   msaitoh 
   1580      1.124     skrll #define	NVM_FUTURE_INIT_WORD1_VALID_CHECKSUM	0x0040
   1581       1.61   msaitoh 
   1582       1.61   msaitoh #define	NVM_K1_CONFIG_ENABLE	0x01
   1583       1.61   msaitoh 
   1584       1.61   msaitoh #define	NVM_SWDPIN_MASK		0xdf
   1585       1.61   msaitoh #define	NVM_SWDPIN_SWDPIN_SHIFT 0
   1586       1.61   msaitoh #define	NVM_SWDPIN_SWDPIO_SHIFT 8
   1587       1.61   msaitoh 
   1588      1.124     skrll #define	NVM_3GIO_3_ASPM_MASK	(0x3 << 2)	/* Active State PM Support */
   1589       1.61   msaitoh 
   1590      1.124     skrll #define	NVM_CFG3_PORTA_EXT_MDIO	__BIT(2)	/* External MDIO Interface */
   1591      1.124     skrll #define	NVM_CFG3_PORTA_COM_MDIO	__BIT(3)	/* MDIO Interface is shared */
   1592      1.124     skrll #define	NVM_CFG3_APME		__BIT(10)	/* APM Enable */
   1593      1.124     skrll #define	NVM_CFG3_ILOS		__BIT(13)	/* Invert loss of signal */
   1594       1.61   msaitoh 
   1595       1.64   msaitoh #define	NVM_OFF_MACADDR_82571(x)	(3 * (x))
   1596       1.34   msaitoh 
   1597       1.58   msaitoh /*
   1598       1.58   msaitoh  * EEPROM Partitioning. See Table 6-1, "EEPROM Top Level Partitioning"
   1599       1.58   msaitoh  * in 82580's datasheet.
   1600       1.58   msaitoh  */
   1601      1.124     skrll #define	NVM_OFF_LAN_FUNC_82580(x)	((x) ? (0x40 + (0x40 * (x))) : 0)
   1602       1.47   msaitoh 
   1603      1.124     skrll #define	NVM_COMBO_VER_OFF	0x0083
   1604       1.76   msaitoh 
   1605      1.124     skrll #define	NVM_MAJOR_MASK		0xf000
   1606      1.124     skrll #define	NVM_MAJOR_SHIFT		12
   1607      1.124     skrll #define	NVM_MINOR_MASK		0x0ff0
   1608      1.124     skrll #define	NVM_MINOR_SHIFT		4
   1609      1.124     skrll #define	NVM_BUILD_MASK		0x000f
   1610      1.124     skrll #define	NVM_UID_VALID		0x8000
   1611       1.76   msaitoh 
   1612       1.71   msaitoh /* iNVM Registers for i21[01] */
   1613      1.124     skrll #define	WM_INVM_DATA_REG(reg)	(0x12120 + 4*(reg))
   1614      1.124     skrll #define	INVM_SIZE			64 /* Number of INVM Data Registers */
   1615       1.71   msaitoh 
   1616      1.113   khorben /* iNVM default value */
   1617      1.124     skrll #define	NVM_INIT_CTRL_2_DEFAULT_I211	0x7243
   1618      1.124     skrll #define	NVM_INIT_CTRL_4_DEFAULT_I211	0x00c1
   1619      1.124     skrll #define	NVM_LED_1_CFG_DEFAULT_I211	0x0184
   1620      1.124     skrll #define	NVM_LED_0_2_CFG_DEFAULT_I211	0x200c
   1621      1.124     skrll #define	NVM_RESERVED_WORD		0xffff
   1622      1.124     skrll 
   1623      1.124     skrll #define	INVM_DWORD_TO_RECORD_TYPE(dword)	((dword) & 0x7)
   1624      1.124     skrll #define	INVM_DWORD_TO_WORD_ADDRESS(dword)	(((dword) & 0x0000FE00) >> 9)
   1625      1.124     skrll #define	INVM_DWORD_TO_WORD_DATA(dword)		(((dword) & 0xFFFF0000) >> 16)
   1626      1.124     skrll 
   1627      1.124     skrll #define	INVM_UNINITIALIZED_STRUCTURE		0x0
   1628      1.124     skrll #define	INVM_WORD_AUTOLOAD_STRUCTURE		0x1
   1629      1.124     skrll #define	INVM_CSR_AUTOLOAD_STRUCTURE		0x2
   1630      1.124     skrll #define	INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE	0x3
   1631      1.124     skrll #define	INVM_RSA_KEY_SHA256_STRUCTURE		0x4
   1632      1.124     skrll #define	INVM_INVALIDATED_STRUCTURE		0xf
   1633      1.124     skrll 
   1634      1.124     skrll #define	INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS	8
   1635      1.124     skrll #define	INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS	1
   1636      1.124     skrll 
   1637      1.124     skrll #define	INVM_DEFAULT_AL		0x202f
   1638      1.124     skrll #define	INVM_AUTOLOAD		0x0a
   1639      1.124     skrll #define	INVM_PLL_WO_VAL		0x0010
   1640       1.77   msaitoh 
   1641       1.79   msaitoh /* Version and Image Type field */
   1642      1.124     skrll #define	INVM_VER_1	__BITS(12,3)
   1643      1.124     skrll #define	INVM_VER_2	__BITS(22,13)
   1644      1.124     skrll #define	INVM_IMGTYPE	__BITS(28,23)
   1645      1.124     skrll #define	INVM_MINOR	__BITS(3,0)
   1646      1.124     skrll #define	INVM_MAJOR	__BITS(9,4)
   1647       1.79   msaitoh 
   1648       1.71   msaitoh /* Word definitions for ID LED Settings */
   1649      1.124     skrll #define	ID_LED_RESERVED_FFFF 0xffff
   1650       1.71   msaitoh 
   1651       1.22    bouyer /* ich8 flash control */
   1652      1.124     skrll #define	ICH_FLASH_COMMAND_TIMEOUT            5000    /* 5000 uSecs - adjusted */
   1653      1.124     skrll #define	ICH_FLASH_ERASE_TIMEOUT              3000000 /* Up to 3 seconds - worst case */
   1654      1.124     skrll #define	ICH_FLASH_CYCLE_REPEAT_COUNT         10      /* 10 cycles */
   1655      1.124     skrll #define	ICH_FLASH_SEG_SIZE_256               256
   1656      1.124     skrll #define	ICH_FLASH_SEG_SIZE_4K                4096
   1657      1.124     skrll #define	ICH_FLASH_SEG_SIZE_64K               65536
   1658      1.124     skrll 
   1659      1.124     skrll #define	ICH_CYCLE_READ                       0x0
   1660      1.124     skrll #define	ICH_CYCLE_RESERVED                   0x1
   1661      1.124     skrll #define	ICH_CYCLE_WRITE                      0x2
   1662      1.124     skrll #define	ICH_CYCLE_ERASE                      0x3
   1663      1.124     skrll 
   1664      1.124     skrll #define	ICH_FLASH_GFPREG   0x0000
   1665      1.124     skrll #define	ICH_FLASH_HSFSTS   0x0004 /* Flash Status Register */
   1666      1.124     skrll #define	HSFSTS_DONE		0x0001 /* Flash Cycle Done */
   1667      1.124     skrll #define	HSFSTS_ERR		0x0002 /* Flash Cycle Error */
   1668      1.124     skrll #define	HSFSTS_DAEL		0x0004 /* Direct Access error Log */
   1669      1.124     skrll #define	HSFSTS_ERSZ_MASK	0x0018 /* Block/Sector Erase Size */
   1670      1.124     skrll #define	HSFSTS_ERSZ_SHIFT	3
   1671      1.124     skrll #define	HSFSTS_FLINPRO		0x0020 /* flash SPI cycle in Progress */
   1672      1.124     skrll #define	HSFSTS_FLDVAL		0x4000 /* Flash Descriptor Valid */
   1673      1.124     skrll #define	HSFSTS_FLLK		0x8000 /* Flash Configuration Lock-Down */
   1674      1.124     skrll #define	ICH_FLASH_HSFCTL   0x0006 /* Flash control Register */
   1675      1.124     skrll #define	HSFCTL_GO		0x0001 /* Flash Cycle Go */
   1676      1.124     skrll #define	HSFCTL_CYCLE_MASK	0x0006 /* Flash Cycle */
   1677      1.124     skrll #define	HSFCTL_CYCLE_SHIFT	1
   1678      1.124     skrll #define	HSFCTL_BCOUNT_MASK	0x0300 /* Data Byte Count */
   1679      1.124     skrll #define	HSFCTL_BCOUNT_SHIFT	8
   1680      1.124     skrll #define	ICH_FLASH_FADDR    0x0008
   1681      1.124     skrll #define	ICH_FLASH_FDATA0   0x0010
   1682      1.124     skrll #define	ICH_FLASH_FRACC    0x0050
   1683      1.124     skrll #define	ICH_FLASH_FREG0    0x0054
   1684      1.124     skrll #define	ICH_FLASH_FREG1    0x0058
   1685      1.124     skrll #define	ICH_FLASH_FREG2    0x005c
   1686      1.124     skrll #define	ICH_FLASH_FREG3    0x0060
   1687      1.124     skrll #define	ICH_FLASH_FPR0     0x0074
   1688      1.124     skrll #define	ICH_FLASH_FPR1     0x0078
   1689      1.124     skrll #define	ICH_FLASH_SSFSTS   0x0090
   1690      1.124     skrll #define	ICH_FLASH_SSFCTL   0x0092
   1691      1.124     skrll #define	ICH_FLASH_PREOP    0x0094
   1692      1.124     skrll #define	ICH_FLASH_OPTYPE   0x0096
   1693      1.124     skrll #define	ICH_FLASH_OPMENU   0x0098
   1694      1.124     skrll 
   1695      1.124     skrll #define	ICH_FLASH_REG_MAPSIZE      0x00a0
   1696      1.124     skrll #define	ICH_FLASH_SECTOR_SIZE      4096
   1697      1.124     skrll #define	ICH_GFPREG_BASE_MASK       0x1fff
   1698      1.124     skrll #define	ICH_FLASH_LINEAR_ADDR_MASK 0x00ffffff
   1699      1.124     skrll 
   1700      1.124     skrll #define	ICH_NVM_SIG_WORD	0x13
   1701      1.124     skrll #define	ICH_NVM_SIG_MASK	0xc000
   1702      1.124     skrll #define	ICH_NVM_VALID_SIG_MASK	0xc0
   1703      1.124     skrll #define	ICH_NVM_SIG_VALUE	0x80
   1704       1.38   msaitoh 
   1705      1.124     skrll #define	NVM_SIZE_MULTIPLIER 4096	/* multiplier for NVMS field */
   1706      1.124     skrll #define	WM_PCH_SPT_FLASHOFFSET	0xe000	/* offset of NVM access regs(PCH_SPT)*/
   1707       1.89   msaitoh 
   1708       1.38   msaitoh /* for PCI express Capability registers */
   1709       1.52   msaitoh #define	WM_PCIE_DCSR2_16MS	0x00000005
   1710       1.48    bouyer 
   1711       1.63   msaitoh /* SFF SFP ROM data */
   1712      1.124     skrll #define	SFF_SFP_ID_OFF		0x00
   1713      1.124     skrll #define	SFF_SFP_ID_UNKNOWN	0x00	/* Unknown */
   1714      1.124     skrll #define	SFF_SFP_ID_SFF		0x02	/* Module soldered to motherboard */
   1715      1.124     skrll #define	SFF_SFP_ID_SFP		0x03	/* SFP transceiver */
   1716      1.124     skrll 
   1717      1.124     skrll #define	SFF_SFP_ETH_FLAGS_OFF	0x06
   1718      1.124     skrll #define	SFF_SFP_ETH_FLAGS_1000SX	0x01
   1719      1.124     skrll #define	SFF_SFP_ETH_FLAGS_1000LX	0x02
   1720      1.124     skrll #define	SFF_SFP_ETH_FLAGS_1000CX	0x04
   1721      1.124     skrll #define	SFF_SFP_ETH_FLAGS_1000T		0x08
   1722      1.124     skrll #define	SFF_SFP_ETH_FLAGS_100LX		0x10
   1723      1.124     skrll #define	SFF_SFP_ETH_FLAGS_100FX		0x20
   1724       1.63   msaitoh 
   1725       1.77   msaitoh /* I21[01] PHY related definitions */
   1726      1.124     skrll #define	GS40G_PAGE_SELECT	0x16
   1727      1.124     skrll #define	GS40G_PAGE_SHIFT	16
   1728      1.124     skrll #define	GS40G_OFFSET_MASK	0xffff
   1729      1.124     skrll #define	GS40G_PHY_PLL_FREQ_PAGE	0xfc0000
   1730      1.124     skrll #define	GS40G_PHY_PLL_FREQ_REG	0x000e
   1731      1.124     skrll #define	GS40G_PHY_PLL_UNCONF	0xff
   1732       1.63   msaitoh 
   1733       1.48    bouyer /* advanced TX descriptor for 82575 and newer */
   1734       1.48    bouyer typedef union nq_txdesc {
   1735       1.48    bouyer 	struct {
   1736       1.48    bouyer 		uint64_t nqtxd_addr;
   1737       1.48    bouyer 		uint32_t nqtxd_cmdlen;
   1738       1.48    bouyer 		uint32_t nqtxd_fields;
   1739       1.48    bouyer 	} nqtx_data;
   1740       1.48    bouyer 	struct {
   1741       1.48    bouyer 		uint32_t nqtxc_vl_len;
   1742       1.48    bouyer 		uint32_t nqtxc_sn;
   1743       1.48    bouyer 		uint32_t nqtxc_cmd;
   1744       1.48    bouyer 		uint32_t nqtxc_mssidx;
   1745      1.128   msaitoh 	} nqtx_ctx;
   1746       1.48    bouyer } __packed nq_txdesc_t;
   1747       1.48    bouyer 
   1748       1.48    bouyer 
   1749       1.48    bouyer /* Commands for nqtxd_cmdlen and nqtxc_cmd */
   1750      1.123     skrll #define	NQTX_CMD_EOP	__BIT(24)	/* end of packet */
   1751      1.123     skrll #define	NQTX_CMD_IFCS	__BIT(25)	/* insert FCS */
   1752      1.123     skrll #define	NQTX_CMD_RS	__BIT(27)	/* report status */
   1753      1.123     skrll #define	NQTX_CMD_DEXT	__BIT(29)	/* descriptor extension */
   1754      1.123     skrll #define	NQTX_CMD_VLE	__BIT(30)	/* VLAN enable */
   1755      1.123     skrll #define	NQTX_CMD_TSE	__BIT(31)	/* TCP segmentation enable */
   1756       1.48    bouyer 
   1757       1.48    bouyer /* Descriptor types (if DEXT is set) */
   1758       1.48    bouyer #define	NQTX_DTYP_C	(2U << 20)	/* context */
   1759       1.48    bouyer #define	NQTX_DTYP_D	(3U << 20)	/* data */
   1760       1.48    bouyer 
   1761      1.124     skrll #define	NQTXD_FIELDS_IDX_SHIFT		4	/* context index shift */
   1762      1.124     skrll #define	NQTXD_FIELDS_IDX_MASK		0xf
   1763      1.124     skrll #define	NQTXD_FIELDS_PAYLEN_SHIFT	14	/* payload len shift */
   1764      1.124     skrll #define	NQTXD_FIELDS_PAYLEN_MASK	0x3ffff
   1765      1.124     skrll 
   1766      1.124     skrll #define	NQTXD_FIELDS_IXSM		__BIT(8) /* do IP checksum */
   1767      1.124     skrll #define	NQTXD_FIELDS_TUXSM		__BIT(9) /* do TCP/UDP checksum */
   1768      1.124     skrll 
   1769      1.124     skrll #define	NQTXC_VLLEN_IPLEN_SHIFT		0	/* IP header len */
   1770      1.124     skrll #define	NQTXC_VLLEN_IPLEN_MASK		0x1ff
   1771      1.124     skrll #define	NQTXC_VLLEN_MACLEN_SHIFT	9	/* MAC header len */
   1772      1.124     skrll #define	NQTXC_VLLEN_MACLEN_MASK		0x7f
   1773      1.124     skrll #define	NQTXC_VLLEN_VLAN_SHIFT		16	/* vlan number */
   1774      1.124     skrll #define	NQTXC_VLLEN_VLAN_MASK		0xffff
   1775      1.124     skrll 
   1776      1.124     skrll #define	NQTXC_CMD_MKRLOC_SHIFT		0	/* IP checksum offset */
   1777      1.124     skrll #define	NQTXC_CMD_MKRLOC_MASK		0x1ff
   1778      1.124     skrll #define	NQTXC_CMD_SNAP			__BIT(9)
   1779      1.124     skrll #define	NQTXC_CMD_IPV_MASK		__BIT(10)
   1780      1.124     skrll #define	NQTXC_CMD_IP4			__SHIFTIN(1, NQTXC_CMD_IPV_MASK)
   1781      1.124     skrll #define	NQTXC_CMD_IP6			__SHIFTIN(0, NQTXC_CMD_IPV_MASK)
   1782      1.125     skrll #define	NQTXC_CMD_TP_MASK		__BIT(11)
   1783      1.125     skrll #define	NQTXC_CMD_TCP			__SHIFTIN(1, NQTXC_CMD_TP_MASK)
   1784      1.125     skrll #define	NQTXC_CMD_UDP			__SHIFTIN(0, NQTXC_CMD_TP_MASK)
   1785      1.124     skrll #define	NQTXC_MSSIDX_IDX_SHIFT		4	/* context index shift */
   1786      1.124     skrll #define	NQTXC_MSSIDX_IDX_MASK		0xf
   1787      1.124     skrll #define	NQTXC_MSSIDX_L4LEN_SHIFT	8	/* L4 header len shift */
   1788      1.124     skrll #define	NQTXC_MSSIDX_L4LEN_MASK		0xff
   1789      1.124     skrll #define	NQTXC_MSSIDX_MSS_SHIFT		16	/* MSS */
   1790      1.124     skrll #define	NQTXC_MSSIDX_MSS_MASK		0xffff
   1791