Home | History | Annotate | Line # | Download | only in pci
      1  1.42     skrll /*	$NetBSD: if_bgevar.h,v 1.42 2024/08/28 05:58:11 skrll Exp $	*/
      2   1.1   msaitoh /*
      3   1.1   msaitoh  * Copyright (c) 2001 Wind River Systems
      4   1.1   msaitoh  * Copyright (c) 1997, 1998, 1999, 2001
      5   1.1   msaitoh  *	Bill Paul <wpaul (at) windriver.com>.  All rights reserved.
      6   1.1   msaitoh  *
      7   1.1   msaitoh  * Redistribution and use in source and binary forms, with or without
      8   1.1   msaitoh  * modification, are permitted provided that the following conditions
      9   1.1   msaitoh  * are met:
     10   1.1   msaitoh  * 1. Redistributions of source code must retain the above copyright
     11   1.1   msaitoh  *    notice, this list of conditions and the following disclaimer.
     12   1.1   msaitoh  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1   msaitoh  *    notice, this list of conditions and the following disclaimer in the
     14   1.1   msaitoh  *    documentation and/or other materials provided with the distribution.
     15   1.1   msaitoh  * 3. All advertising materials mentioning features or use of this software
     16   1.1   msaitoh  *    must display the following acknowledgement:
     17   1.1   msaitoh  *	This product includes software developed by Bill Paul.
     18   1.1   msaitoh  * 4. Neither the name of the author nor the names of any co-contributors
     19   1.1   msaitoh  *    may be used to endorse or promote products derived from this software
     20   1.1   msaitoh  *    without specific prior written permission.
     21   1.1   msaitoh  *
     22   1.1   msaitoh  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
     23   1.1   msaitoh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.1   msaitoh  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.1   msaitoh  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
     26   1.1   msaitoh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27   1.1   msaitoh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28   1.1   msaitoh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29   1.1   msaitoh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30   1.1   msaitoh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31   1.1   msaitoh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     32   1.1   msaitoh  * THE POSSIBILITY OF SUCH DAMAGE.
     33   1.1   msaitoh  *
     34   1.1   msaitoh  * $FreeBSD: if_bgereg.h,v 1.1.2.7 2002/11/02 18:17:55 mp Exp $
     35   1.1   msaitoh  */
     36   1.1   msaitoh 
     37   1.1   msaitoh /*
     38   1.1   msaitoh  * BCM570x memory map. The internal memory layout varies somewhat
     39   1.1   msaitoh  * depending on whether or not we have external SSRAM attached.
     40   1.1   msaitoh  * The BCM5700 can have up to 16MB of external memory. The BCM5701
     41   1.1   msaitoh  * is apparently not designed to use external SSRAM. The mappings
     42   1.1   msaitoh  * up to the first 4 send rings are the same for both internal and
     43   1.1   msaitoh  * external memory configurations. Note that mini RX ring space is
     44   1.1   msaitoh  * only available with external SSRAM configurations, which means
     45   1.1   msaitoh  * the mini RX ring is not supported on the BCM5701.
     46   1.1   msaitoh  *
     47   1.1   msaitoh  * The NIC's memory can be accessed by the host in one of 3 ways:
     48   1.1   msaitoh  *
     49   1.1   msaitoh  * 1) Indirect register access. The MEMWIN_BASEADDR and MEMWIN_DATA
     50   1.1   msaitoh  *    registers in PCI config space can be used to read any 32-bit
     51   1.1   msaitoh  *    address within the NIC's memory.
     52   1.1   msaitoh  *
     53   1.1   msaitoh  * 2) Memory window access. The MEMWIN_BASEADDR register in PCI config
     54   1.1   msaitoh  *    space can be used in conjunction with the memory window in the
     55   1.1   msaitoh  *    device register space at offset 0x8000 to read any 32K chunk
     56   1.1   msaitoh  *    of NIC memory.
     57   1.1   msaitoh  *
     58   1.1   msaitoh  * 3) Flat mode. If the 'flat mode' bit in the PCI state register is
     59   1.1   msaitoh  *    set, the device I/O mapping consumes 32MB of host address space,
     60   1.1   msaitoh  *    allowing all of the registers and internal NIC memory to be
     61   1.1   msaitoh  *    accessed directly. NIC memory addresses are offset by 0x01000000.
     62   1.1   msaitoh  *    Flat mode consumes so much host address space that it is not
     63   1.1   msaitoh  *    recommended.
     64   1.1   msaitoh  */
     65   1.1   msaitoh 
     66   1.1   msaitoh #ifndef _DEV_PCI_IF_BGEVAR_H_
     67   1.1   msaitoh #define _DEV_PCI_IF_BGEVAR_H_
     68   1.1   msaitoh 
     69   1.7    dyoung #include <sys/bus.h>
     70  1.18  riastrad #include <sys/rndsource.h>
     71  1.33     skrll #include <sys/time.h>
     72  1.32     skrll 
     73   1.1   msaitoh #include <net/if_ether.h>
     74  1.32     skrll 
     75   1.1   msaitoh #include <dev/pci/pcivar.h>
     76   1.1   msaitoh 
     77  1.32     skrll #define BGE_HOSTADDR(x, y)						      \
     78  1.32     skrll 	do {								      \
     79  1.32     skrll 		(x).bge_addr_lo = BUS_ADDR_LO32(y);			      \
     80  1.32     skrll 		if (sizeof (bus_addr_t) == 8)				      \
     81  1.32     skrll 			(x).bge_addr_hi = BUS_ADDR_HI32(y);		      \
     82  1.32     skrll 		else							      \
     83  1.32     skrll 			(x).bge_addr_hi = 0;				      \
     84   1.2   msaitoh 	} while(0)
     85   1.1   msaitoh 
     86  1.32     skrll #define RCB_WRITE_4(sc, rcb, offset, val)				      \
     87  1.32     skrll 	bus_space_write_4(sc->bge_btag, sc->bge_bhandle,		      \
     88   1.1   msaitoh 			  rcb + offsetof(struct bge_rcb, offset), val)
     89   1.1   msaitoh 
     90   1.1   msaitoh /*
     91   1.1   msaitoh  * Other utility macros.
     92   1.1   msaitoh  */
     93   1.1   msaitoh #define BGE_INC(x, y)	(x) = (x + 1) % y
     94   1.1   msaitoh 
     95   1.1   msaitoh /*
     96   1.1   msaitoh  * Register access macros. The Tigon always uses memory mapped register
     97   1.1   msaitoh  * accesses and all registers must be accessed with 32 bit operations.
     98   1.1   msaitoh  */
     99   1.1   msaitoh 
    100  1.39     skrll #define CSR_WRITE_4(sc, reg, val)					      \
    101   1.1   msaitoh 	bus_space_write_4(sc->bge_btag, sc->bge_bhandle, reg, val)
    102   1.1   msaitoh 
    103  1.39     skrll #define CSR_READ_4(sc, reg)						      \
    104   1.1   msaitoh 	bus_space_read_4(sc->bge_btag, sc->bge_bhandle, reg)
    105   1.1   msaitoh 
    106  1.39     skrll #define CSR_WRITE_4_FLUSH(sc, reg, val)					      \
    107  1.39     skrll 	do {								      \
    108  1.39     skrll 		CSR_WRITE_4(sc, reg, val);				      \
    109  1.39     skrll 		CSR_READ_4(sc, reg);					      \
    110  1.39     skrll 	} while (0)
    111  1.11   msaitoh 
    112  1.39     skrll #define BGE_SETBIT(sc, reg, x)						      \
    113  1.10   msaitoh 	CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) | (x)))
    114  1.39     skrll #define BGE_SETBIT_FLUSH(sc, reg, x)					      \
    115  1.39     skrll 	do {								      \
    116  1.39     skrll 		BGE_SETBIT(sc, reg, x);					      \
    117  1.39     skrll 		CSR_READ_4(sc, reg);					      \
    118  1.39     skrll 	} while (0)
    119  1.39     skrll #define BGE_CLRBIT(sc, reg, x)						      \
    120  1.10   msaitoh 	CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) & ~(x)))
    121  1.39     skrll #define BGE_CLRBIT_FLUSH(sc, reg, x)					      \
    122  1.39     skrll 	do {								      \
    123  1.39     skrll 		BGE_CLRBIT(sc, reg, x);					      \
    124  1.39     skrll 		CSR_READ_4(sc, reg);					      \
    125  1.39     skrll 	} while (0)
    126   1.1   msaitoh 
    127  1.12   msaitoh /* BAR2 APE register access macros. */
    128  1.39     skrll #define	APE_WRITE_4(sc, reg, val)					      \
    129  1.12   msaitoh 	bus_space_write_4(sc->bge_apetag, sc->bge_apehandle, reg, val)
    130  1.12   msaitoh 
    131  1.39     skrll #define	APE_READ_4(sc, reg)						      \
    132  1.12   msaitoh 	bus_space_read_4(sc->bge_apetag, sc->bge_apehandle, reg)
    133  1.12   msaitoh 
    134  1.39     skrll #define	APE_WRITE_4_FLUSH(sc, reg, val)					      \
    135  1.39     skrll 	do {								      \
    136  1.39     skrll 		APE_WRITE_4(sc, reg, val);				      \
    137  1.39     skrll 		APE_READ_4(sc, reg);					      \
    138  1.39     skrll 	} while (0)
    139  1.12   msaitoh 
    140  1.12   msaitoh #define	APE_SETBIT(sc, reg, x)						      \
    141  1.12   msaitoh 	APE_WRITE_4(sc, reg, (APE_READ_4(sc, reg) | (x)))
    142  1.39     skrll #define	APE_CLRBIT(sc, reg, x)						      \
    143  1.12   msaitoh 	APE_WRITE_4(sc, reg, (APE_READ_4(sc, reg) & ~(x)))
    144  1.12   msaitoh 
    145  1.12   msaitoh #define PCI_SETBIT(pc, tag, reg, x)					      \
    146  1.10   msaitoh 	pci_conf_write(pc, tag, reg, (pci_conf_read(pc, tag, reg) | (x)))
    147  1.39     skrll #define PCI_CLRBIT(pc, tag, reg, x)					      \
    148  1.10   msaitoh 	pci_conf_write(pc, tag, reg, (pci_conf_read(pc, tag, reg) & ~(x)))
    149   1.1   msaitoh 
    150   1.1   msaitoh /*
    151   1.1   msaitoh  * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS
    152   1.1   msaitoh  * values are tuneable. They control the actual amount of buffers
    153   1.1   msaitoh  * allocated for the standard, mini and jumbo receive rings.
    154   1.1   msaitoh  */
    155   1.1   msaitoh 
    156   1.1   msaitoh #define BGE_SSLOTS	256
    157   1.1   msaitoh #define BGE_MSLOTS	256
    158   1.1   msaitoh #define BGE_JSLOTS	384
    159   1.1   msaitoh 
    160  1.39     skrll #define BGE_JRAWLEN	(BGE_JUMBO_FRAMELEN + ETHER_ALIGN)
    161  1.39     skrll #define BGE_JLEN	(BGE_JRAWLEN + (sizeof(uint64_t) - 		      \
    162  1.39     skrll 			    (BGE_JRAWLEN % sizeof(uint64_t))))
    163  1.39     skrll #define BGE_JPAGESZ 	PAGE_SIZE
    164  1.39     skrll #define BGE_RESID 	(BGE_JPAGESZ - (BGE_JLEN * BGE_JSLOTS) % BGE_JPAGESZ)
    165  1.39     skrll #define BGE_JMEM 	((BGE_JLEN * BGE_JSLOTS) + BGE_RESID)
    166   1.1   msaitoh 
    167   1.1   msaitoh /*
    168   1.1   msaitoh  * Ring structures. Most of these reside in host memory and we tell
    169   1.1   msaitoh  * the NIC where they are via the ring control blocks. The exceptions
    170   1.1   msaitoh  * are the tx and command rings, which live in NIC memory and which
    171   1.1   msaitoh  * we access via the shared memory window.
    172   1.1   msaitoh  */
    173   1.1   msaitoh struct bge_ring_data {
    174   1.1   msaitoh 	struct bge_rx_bd	bge_rx_std_ring[BGE_STD_RX_RING_CNT];
    175   1.1   msaitoh 	struct bge_rx_bd	bge_rx_jumbo_ring[BGE_JUMBO_RX_RING_CNT];
    176   1.1   msaitoh 	struct bge_rx_bd	bge_rx_return_ring[BGE_RETURN_RING_CNT];
    177   1.1   msaitoh 	struct bge_tx_bd	bge_tx_ring[BGE_TX_RING_CNT];
    178   1.1   msaitoh 	struct bge_status_block	bge_status_block;
    179   1.1   msaitoh 	struct bge_tx_desc	*bge_tx_ring_nic;/* pointer to shared mem */
    180   1.1   msaitoh 	struct bge_cmd_desc	*bge_cmd_ring;	/* pointer to shared mem */
    181   1.1   msaitoh 	struct bge_gib		bge_info;
    182   1.1   msaitoh };
    183   1.1   msaitoh 
    184  1.32     skrll #define BGE_RING_DMA_ADDR(sc, offset)					      \
    185  1.32     skrll 	((sc)->bge_ring_map->dm_segs[0].ds_addr +			      \
    186   1.1   msaitoh 	offsetof(struct bge_ring_data, offset))
    187   1.1   msaitoh 
    188   1.1   msaitoh /*
    189   1.1   msaitoh  * Number of DMA segments in a TxCB. Note that this is carefully
    190   1.1   msaitoh  * chosen to make the total struct size an even power of two. It's
    191   1.1   msaitoh  * critical that no TxCB be split across a page boundary since
    192   1.1   msaitoh  * no attempt is made to allocate physically contiguous memory.
    193   1.1   msaitoh  *
    194   1.1   msaitoh  */
    195   1.1   msaitoh #if 0	/* pre-TSO values */
    196   1.1   msaitoh #define BGE_TXDMA_MAX	ETHER_MAX_LEN_JUMBO
    197   1.1   msaitoh #ifdef _LP64
    198   1.1   msaitoh #define BGE_NTXSEG	30
    199   1.1   msaitoh #else
    200   1.1   msaitoh #define BGE_NTXSEG	31
    201   1.1   msaitoh #endif
    202   1.1   msaitoh #else	/* TSO values */
    203   1.1   msaitoh #define BGE_TXDMA_MAX	(round_page(IP_MAXPACKET))	/* for TSO */
    204   1.1   msaitoh #ifdef _LP64
    205   1.1   msaitoh #define BGE_NTXSEG	120	/* XXX just a guess */
    206   1.1   msaitoh #else
    207   1.1   msaitoh #define BGE_NTXSEG	124	/* XXX just a guess */
    208   1.1   msaitoh #endif
    209   1.1   msaitoh #endif	/* TSO values */
    210   1.1   msaitoh 
    211  1.12   msaitoh #define	BGE_STATUS_BLK_SZ	sizeof (struct bge_status_block)
    212   1.1   msaitoh 
    213   1.1   msaitoh /*
    214   1.1   msaitoh  * Mbuf pointers. We need these to keep track of the virtual addresses
    215   1.1   msaitoh  * of our mbuf chains since we can only convert from physical to virtual,
    216   1.1   msaitoh  * not the other way around.
    217   1.1   msaitoh  */
    218   1.1   msaitoh struct bge_chain_data {
    219   1.1   msaitoh 	struct mbuf		*bge_tx_chain[BGE_TX_RING_CNT];
    220   1.1   msaitoh 	struct mbuf		*bge_rx_std_chain[BGE_STD_RX_RING_CNT];
    221   1.1   msaitoh 	struct mbuf		*bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT];
    222   1.1   msaitoh 	bus_dmamap_t		bge_rx_std_map[BGE_STD_RX_RING_CNT];
    223   1.1   msaitoh 	bus_dmamap_t		bge_rx_jumbo_map;
    224  1.31     skrll 	bus_dma_segment_t	bge_rx_jumbo_seg;
    225   1.1   msaitoh 	/* Stick the jumbo mem management stuff here too. */
    226   1.1   msaitoh 	void *			bge_jslots[BGE_JSLOTS];
    227   1.1   msaitoh 	void *			bge_jumbo_buf;
    228   1.1   msaitoh };
    229   1.1   msaitoh 
    230   1.1   msaitoh #define BGE_JUMBO_DMA_ADDR(sc, m) \
    231   1.1   msaitoh 	((sc)->bge_cdata.bge_rx_jumbo_map->dm_segs[0].ds_addr + \
    232   1.1   msaitoh 	 (mtod((m), char *) - (char *)(sc)->bge_cdata.bge_jumbo_buf))
    233   1.1   msaitoh 
    234   1.1   msaitoh struct bge_type {
    235   1.5   msaitoh 	uint16_t		bge_vid;
    236   1.5   msaitoh 	uint16_t		bge_did;
    237   1.1   msaitoh 	char			*bge_name;
    238   1.1   msaitoh };
    239   1.1   msaitoh 
    240   1.2   msaitoh #define BGE_TIMEOUT		100000
    241   1.1   msaitoh #define BGE_TXCONS_UNSET		0xFFFF	/* impossible value */
    242   1.1   msaitoh 
    243   1.1   msaitoh struct bge_jpool_entry {
    244   1.1   msaitoh 	int				slot;
    245   1.1   msaitoh 	SLIST_ENTRY(bge_jpool_entry)	jpool_entries;
    246   1.1   msaitoh };
    247   1.1   msaitoh 
    248   1.1   msaitoh struct bge_bcom_hack {
    249   1.1   msaitoh 	int			reg;
    250   1.1   msaitoh 	int			val;
    251   1.1   msaitoh };
    252   1.1   msaitoh 
    253   1.1   msaitoh struct txdmamap_pool_entry {
    254   1.1   msaitoh 	bus_dmamap_t dmamap;
    255  1.24    bouyer 	bus_dmamap_t dmamap32;
    256  1.24    bouyer 	bool is_dma32;
    257   1.1   msaitoh 	SLIST_ENTRY(txdmamap_pool_entry) link;
    258   1.1   msaitoh };
    259   1.1   msaitoh 
    260   1.3   msaitoh #define	ASF_ENABLE		1
    261   1.3   msaitoh #define	ASF_NEW_HANDSHAKE	2
    262   1.3   msaitoh #define	ASF_STACKUP		4
    263   1.3   msaitoh 
    264  1.42     skrll /*
    265  1.42     skrll  * Locking notes:
    266  1.42     skrll  *
    267  1.42     skrll  *	n		IFNET_LOCK
    268  1.42     skrll  *	m		sc_mcast_lock
    269  1.42     skrll  *	i		sc_intr_lock
    270  1.42     skrll  *	i/n		while down, IFNET_LOCK; while up, sc_intr_lock
    271  1.42     skrll  *
    272  1.42     skrll  * Otherwise, stable from attach to detach.
    273  1.42     skrll  *
    274  1.42     skrll  * Lock order:
    275  1.42     skrll  *
    276  1.42     skrll  *	IFNET_LOCK -> sc_intr_lock
    277  1.42     skrll  *	IFNET_LOCK -> sc_mcast_lock
    278  1.42     skrll  */
    279   1.1   msaitoh struct bge_softc {
    280   1.1   msaitoh 	device_t		bge_dev;
    281   1.5   msaitoh 	struct ethercom		ethercom;	/* interface info */
    282   1.1   msaitoh 	bus_space_handle_t	bge_bhandle;
    283   1.1   msaitoh 	bus_space_tag_t		bge_btag;
    284  1.14   msaitoh 	bus_size_t		bge_bsize;
    285  1.12   msaitoh 	bus_space_handle_t	bge_apehandle;
    286  1.12   msaitoh 	bus_space_tag_t		bge_apetag;
    287  1.14   msaitoh 	bus_size_t		bge_apesize;
    288   1.1   msaitoh 	void			*bge_intrhand;
    289  1.19   msaitoh 	pci_intr_handle_t	*bge_pihp;
    290   1.1   msaitoh 	pci_chipset_tag_t	sc_pc;
    291   1.1   msaitoh 	pcitag_t		sc_pcitag;
    292   1.1   msaitoh 
    293  1.12   msaitoh 	struct pci_attach_args	bge_pa;
    294  1.42     skrll 	struct mii_data		bge_mii;	/* i: mii data */
    295  1.42     skrll 	struct ifmedia		bge_ifmedia;	/* i: media info */
    296   1.5   msaitoh 	uint32_t		bge_return_ring_cnt;
    297  1.42     skrll 	uint32_t		bge_tx_prodidx; /* i: tx producer idx */
    298   1.1   msaitoh 	bus_dma_tag_t		bge_dmatag;
    299  1.24    bouyer 	bus_dma_tag_t		bge_dmatag32;
    300  1.24    bouyer 	bool			bge_dma64;
    301   1.4   msaitoh 	uint32_t		bge_pcixcap;
    302   1.4   msaitoh 	uint32_t		bge_pciecap;
    303  1.16   msaitoh 	uint16_t		bge_mps;
    304  1.12   msaitoh 	int			bge_expmrq;
    305  1.42     skrll 	uint32_t		bge_lasttag;	/* i: last status tag */
    306  1.28     skrll 	uint32_t		bge_mfw_flags;  /* Management F/W flags */
    307  1.28     skrll #define	BGE_MFW_ON_RXCPU	__BIT(0)
    308  1.28     skrll #define	BGE_MFW_ON_APE		__BIT(1)
    309  1.28     skrll #define	BGE_MFW_TYPE_NCSI	__BIT(2)
    310  1.28     skrll #define	BGE_MFW_TYPE_DASH	__BIT(3)
    311  1.12   msaitoh 	int			bge_phy_ape_lock;
    312  1.12   msaitoh 	int			bge_phy_addr;
    313   1.5   msaitoh 	uint32_t		bge_chipid;
    314   1.3   msaitoh 	uint8_t			bge_asf_mode;
    315  1.42     skrll 	uint8_t			bge_asf_count;	/* i: XXX ??? */
    316   1.1   msaitoh 	struct bge_ring_data	*bge_rdata;	/* rings */
    317   1.1   msaitoh 	struct bge_chain_data	bge_cdata;	/* mbufs */
    318   1.1   msaitoh 	bus_dmamap_t		bge_ring_map;
    319  1.14   msaitoh 	bus_dma_segment_t	bge_ring_seg;
    320  1.14   msaitoh 	int			bge_ring_rseg;
    321  1.42     skrll 	uint16_t		bge_tx_saved_considx; /* i: tx consumer idx */
    322  1.42     skrll 	uint16_t		bge_rx_saved_considx; /* i: rx consumer idx */
    323  1.42     skrll 	uint16_t		bge_std;	/* i: current std ring head */
    324  1.42     skrll 	uint16_t		bge_std_cnt;	/* i: number of std mbufs */
    325  1.42     skrll 	uint16_t		bge_jumbo;
    326  1.42     skrll 					/* i: current jumbo ring head */
    327   1.1   msaitoh 	SLIST_HEAD(__bge_jfreehead, bge_jpool_entry)	bge_jfree_listhead;
    328  1.42     skrll 					/* i: list of free jumbo mbufs */
    329   1.1   msaitoh 	SLIST_HEAD(__bge_jinusehead, bge_jpool_entry)	bge_jinuse_listhead;
    330  1.42     skrll 					/* i: list of jumbo mbufs in use */
    331   1.5   msaitoh 	uint32_t		bge_stat_ticks;
    332  1.42     skrll 	uint32_t		bge_rx_coal_ticks;	/* i */
    333  1.42     skrll 	uint32_t		bge_tx_coal_ticks;	/* i */
    334  1.42     skrll 	uint32_t		bge_rx_max_coal_bds;	/* i */
    335  1.42     skrll 	uint32_t		bge_tx_max_coal_bds;	/* i */
    336  1.42     skrll 	uint32_t		bge_sts;	/* i/n: link status */
    337  1.30     skrll #define BGE_STS_LINK		__BIT(0)	/* MAC link status */
    338  1.30     skrll #define BGE_STS_LINK_EVT	__BIT(1)	/* pending link event */
    339  1.30     skrll #define BGE_STS_AUTOPOLL	__BIT(2)	/* PHY auto-polling  */
    340   1.1   msaitoh #define BGE_STS_BIT(sc, x)	((sc)->bge_sts & (x))
    341   1.1   msaitoh #define BGE_STS_SETBIT(sc, x)	((sc)->bge_sts |= (x))
    342   1.1   msaitoh #define BGE_STS_CLRBIT(sc, x)	((sc)->bge_sts &= ~(x))
    343  1.42     skrll 	u_short			bge_if_flags;	/* m: if_flags cache */
    344  1.42     skrll 	uint32_t		bge_flags;	/* i/n */
    345  1.17   msaitoh 	uint32_t		bge_phy_flags;
    346  1.42     skrll 	int			bge_flowflags;	/* i */
    347  1.33     skrll 	time_t			bge_tx_lastsent;
    348  1.42     skrll 						/* i: time of last tx */
    349  1.40     skrll 	bool			bge_txrx_stopping;
    350  1.42     skrll 						/* i: true when going down */
    351  1.42     skrll 	bool			bge_tx_sending;	/* i: true when tx inflight */
    352  1.33     skrll 
    353   1.1   msaitoh #ifdef BGE_EVENT_COUNTERS
    354   1.1   msaitoh 	/*
    355   1.1   msaitoh 	 * Event counters.
    356   1.1   msaitoh 	 */
    357  1.42     skrll 	struct evcnt bge_ev_intr;	/* i: interrupts */
    358  1.42     skrll 	struct evcnt bge_ev_intr_spurious;
    359  1.42     skrll 					/* i: spurious intr. (tagged status) */
    360  1.42     skrll 	struct evcnt bge_ev_intr_spurious2; /* i: spurious interrupts */
    361  1.42     skrll 	struct evcnt bge_ev_tx_xoff;	/* i: send PAUSE(len>0) packets */
    362  1.42     skrll 	struct evcnt bge_ev_tx_xon;	/* i: send PAUSE(len=0) packets */
    363  1.42     skrll 	struct evcnt bge_ev_rx_xoff;	/* i: receive PAUSE(len>0) packets */
    364  1.42     skrll 	struct evcnt bge_ev_rx_xon;	/* i: receive PAUSE(len=0) packets */
    365  1.42     skrll 	struct evcnt bge_ev_rx_macctl;	/* i: receive MAC control packets */
    366  1.42     skrll 	struct evcnt bge_ev_xoffentered;/* i: XOFF state entered */
    367   1.1   msaitoh #endif /* BGE_EVENT_COUNTERS */
    368  1.42     skrll 	uint64_t		bge_if_collisions;	/* i */
    369  1.42     skrll 	int			bge_txcnt;	/* i: # tx descs in use */
    370  1.42     skrll 	struct callout		bge_timeout;	/* i: tx timeout */
    371  1.38     skrll 	bool			bge_pending_rxintr_change;
    372  1.42     skrll 						/* i: change pending to
    373  1.42     skrll 						 * rx_coal_ticks and
    374  1.42     skrll 						 * rx_max_coal_bds */
    375  1.42     skrll 	bool			bge_attached;
    376  1.42     skrll 	bool			bge_detaching;	/* n */
    377  1.42     skrll 	SLIST_HEAD(, txdmamap_pool_entry) txdma_list;		/* i */
    378  1.42     skrll 	struct txdmamap_pool_entry *txdma[BGE_TX_RING_CNT];	/* i */
    379   1.1   msaitoh 
    380   1.6    jruoho 	struct sysctllog	*bge_log;
    381   1.6    jruoho 
    382   1.8       tls 	krndsource_t	rnd_source;	/* random source */
    383  1.33     skrll 
    384  1.42     skrll 	kmutex_t *sc_mcast_lock;	/* m: lock for SIOCADD/DELMULTI */
    385  1.42     skrll 	kmutex_t *sc_intr_lock;		/* i: lock for interrupt operations */
    386  1.33     skrll 	struct workqueue *sc_reset_wq;
    387  1.42     skrll 	struct work sc_reset_work;	/* i */
    388  1.33     skrll 	volatile unsigned sc_reset_pending;
    389  1.33     skrll 
    390  1.42     skrll 	bool sc_trigger_reset;		/* i */
    391   1.1   msaitoh };
    392   1.1   msaitoh 
    393   1.1   msaitoh #endif /* _DEV_PCI_IF_BGEVAR_H_ */
    394