Home | History | Annotate | Line # | Download | only in pci
if_nfereg.h revision 1.1.20.1
      1  1.1.20.1   ad /*	$NetBSD: if_nfereg.h,v 1.1.20.1 2007/01/12 00:57:41 ad Exp $	*/
      2       1.1  chs /*	$OpenBSD: if_nfereg.h,v 1.16 2006/02/22 19:23:44 damien Exp $	*/
      3       1.1  chs 
      4       1.1  chs /*-
      5       1.1  chs  * Copyright (c) 2005 Jonathan Gray <jsg (at) openbsd.org>
      6       1.1  chs  *
      7       1.1  chs  * Permission to use, copy, modify, and distribute this software for any
      8       1.1  chs  * purpose with or without fee is hereby granted, provided that the above
      9       1.1  chs  * copyright notice and this permission notice appear in all copies.
     10       1.1  chs  *
     11       1.1  chs  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12       1.1  chs  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13       1.1  chs  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14       1.1  chs  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15       1.1  chs  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16       1.1  chs  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17       1.1  chs  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18       1.1  chs  */
     19       1.1  chs 
     20       1.1  chs #define NFE_PCI_BA		0x10
     21       1.1  chs 
     22       1.1  chs #define NFE_RX_RING_COUNT	128
     23       1.1  chs #define NFE_TX_RING_COUNT	64
     24       1.1  chs 
     25       1.1  chs #define	ETHER_ALIGN		2
     26       1.1  chs #define NFE_JBYTES		(ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
     27       1.1  chs #define NFE_JPOOL_COUNT		(NFE_RX_RING_COUNT + 64)
     28       1.1  chs #define NFE_JPOOL_SIZE		(NFE_JPOOL_COUNT * NFE_JBYTES)
     29       1.1  chs 
     30       1.1  chs #define NFE_MAX_SCATTER		(NFE_TX_RING_COUNT - 2)
     31       1.1  chs 
     32       1.1  chs #define NFE_IRQ_STATUS		0x000
     33       1.1  chs #define NFE_IRQ_MASK		0x004
     34       1.1  chs #define NFE_SETUP_R6		0x008
     35       1.1  chs #define NFE_IMTIMER		0x00c
     36       1.1  chs #define NFE_MISC1		0x080
     37       1.1  chs #define NFE_TX_CTL		0x084
     38       1.1  chs #define NFE_TX_STATUS		0x088
     39       1.1  chs #define NFE_RXFILTER		0x08c
     40       1.1  chs #define NFE_RXBUFSZ		0x090
     41       1.1  chs #define NFE_RX_CTL		0x094
     42       1.1  chs #define NFE_RX_STATUS		0x098
     43       1.1  chs #define NFE_RNDSEED		0x09c
     44       1.1  chs #define NFE_SETUP_R1		0x0a0
     45       1.1  chs #define NFE_SETUP_R2		0x0a4
     46       1.1  chs #define NFE_MACADDR_HI		0x0a8
     47       1.1  chs #define NFE_MACADDR_LO		0x0ac
     48       1.1  chs #define NFE_MULTIADDR_HI	0x0b0
     49       1.1  chs #define NFE_MULTIADDR_LO	0x0b4
     50       1.1  chs #define NFE_MULTIMASK_HI	0x0b8
     51       1.1  chs #define NFE_MULTIMASK_LO	0x0bc
     52       1.1  chs #define NFE_PHY_IFACE		0x0c0
     53       1.1  chs #define NFE_TX_RING_ADDR_LO	0x100
     54       1.1  chs #define NFE_RX_RING_ADDR_LO	0x104
     55       1.1  chs #define NFE_RING_SIZE		0x108
     56       1.1  chs #define NFE_TX_UNK		0x10c
     57       1.1  chs #define NFE_LINKSPEED		0x110
     58       1.1  chs #define NFE_SETUP_R5		0x130
     59       1.1  chs #define NFE_SETUP_R3		0x13C
     60       1.1  chs #define NFE_SETUP_R7		0x140
     61       1.1  chs #define NFE_RXTX_CTL		0x144
     62       1.1  chs #define NFE_TX_RING_ADDR_HI	0x148
     63       1.1  chs #define NFE_RX_RING_ADDR_HI	0x14c
     64       1.1  chs #define NFE_PHY_STATUS		0x180
     65       1.1  chs #define NFE_SETUP_R4		0x184
     66       1.1  chs #define NFE_STATUS		0x188
     67       1.1  chs #define NFE_PHY_SPEED		0x18c
     68       1.1  chs #define NFE_PHY_CTL		0x190
     69       1.1  chs #define NFE_PHY_DATA		0x194
     70       1.1  chs #define NFE_WOL_CTL		0x200
     71       1.1  chs #define NFE_PATTERN_CRC		0x204
     72       1.1  chs #define NFE_PATTERN_MASK	0x208
     73       1.1  chs #define NFE_PWR_CAP		0x268
     74       1.1  chs #define NFE_PWR_STATE		0x26c
     75       1.1  chs #define NFE_VTAG_CTL		0x300
     76       1.1  chs 
     77       1.1  chs #define NFE_PHY_ERROR		0x00001
     78       1.1  chs #define NFE_PHY_WRITE		0x00400
     79       1.1  chs #define NFE_PHY_BUSY		0x08000
     80       1.1  chs #define NFE_PHYADD_SHIFT	5
     81       1.1  chs 
     82       1.1  chs #define NFE_STATUS_MAGIC	0x140000
     83       1.1  chs 
     84       1.1  chs #define NFE_R1_MAGIC		0x16070f
     85       1.1  chs #define NFE_R2_MAGIC		0x16
     86       1.1  chs #define NFE_R4_MAGIC		0x08
     87       1.1  chs #define NFE_R6_MAGIC		0x03
     88  1.1.20.1   ad #define NFE_WOL_MAGIC		0x1111
     89       1.1  chs #define NFE_RX_START		0x01
     90       1.1  chs #define NFE_TX_START		0x01
     91       1.1  chs 
     92       1.1  chs #define NFE_IRQ_RXERR		0x0001
     93       1.1  chs #define NFE_IRQ_RX		0x0002
     94       1.1  chs #define NFE_IRQ_RX_NOBUF	0x0004
     95       1.1  chs #define NFE_IRQ_TXERR		0x0008
     96       1.1  chs #define NFE_IRQ_TX_DONE		0x0010
     97       1.1  chs #define NFE_IRQ_TIMER		0x0020
     98       1.1  chs #define NFE_IRQ_LINK		0x0040
     99       1.1  chs #define NFE_IRQ_TXERR2		0x0080
    100       1.1  chs #define NFE_IRQ_TX1		0x0100
    101       1.1  chs 
    102       1.1  chs #define NFE_IRQ_WANTED							\
    103       1.1  chs 	(NFE_IRQ_RXERR | NFE_IRQ_RX_NOBUF | NFE_IRQ_RX |		\
    104       1.1  chs 	 NFE_IRQ_TXERR | NFE_IRQ_TXERR2 | NFE_IRQ_TX_DONE |		\
    105       1.1  chs 	 NFE_IRQ_LINK)
    106       1.1  chs 
    107       1.1  chs #define NFE_RXTX_KICKTX		0x0001
    108       1.1  chs #define NFE_RXTX_BIT1		0x0002
    109       1.1  chs #define NFE_RXTX_BIT2		0x0004
    110       1.1  chs #define NFE_RXTX_RESET		0x0010
    111       1.1  chs #define NFE_RXTX_VTAG_STRIP	0x0040
    112       1.1  chs #define NFE_RXTX_VTAG_INSERT	0x0080
    113       1.1  chs #define NFE_RXTX_RXCSUM		0x0400
    114       1.1  chs #define NFE_RXTX_V2MAGIC	0x2100
    115       1.1  chs #define NFE_RXTX_V3MAGIC	0x2200
    116       1.1  chs #define NFE_RXFILTER_MAGIC	0x007f0008
    117       1.1  chs #define NFE_U2M			(1 << 5)
    118       1.1  chs #define NFE_PROMISC		(1 << 7)
    119       1.1  chs 
    120       1.1  chs /* default interrupt moderation timer of 128us */
    121       1.1  chs #define NFE_IM_DEFAULT	((128 * 100) / 1024)
    122       1.1  chs 
    123       1.1  chs #define NFE_VTAG_ENABLE		(1 << 13)
    124       1.1  chs 
    125       1.1  chs #define NFE_PWR_VALID		(1 << 8)
    126       1.1  chs #define NFE_PWR_WAKEUP		(1 << 15)
    127       1.1  chs 
    128       1.1  chs #define NFE_MEDIA_SET		0x10000
    129       1.1  chs #define	NFE_MEDIA_1000T		0x00032
    130       1.1  chs #define NFE_MEDIA_100TX		0x00064
    131       1.1  chs #define NFE_MEDIA_10T		0x003e8
    132       1.1  chs 
    133       1.1  chs #define NFE_PHY_100TX		(1 << 0)
    134       1.1  chs #define NFE_PHY_1000T		(1 << 1)
    135       1.1  chs #define NFE_PHY_HDX		(1 << 8)
    136       1.1  chs 
    137       1.1  chs #define NFE_MISC1_MAGIC		0x003b0f3c
    138       1.1  chs #define NFE_MISC1_HDX		(1 << 1)
    139       1.1  chs 
    140       1.1  chs #define NFE_SEED_MASK		0x0003ff00
    141       1.1  chs #define NFE_SEED_10T		0x00007f00
    142       1.1  chs #define NFE_SEED_100TX		0x00002d00
    143       1.1  chs #define NFE_SEED_1000T		0x00007400
    144       1.1  chs 
    145       1.1  chs /* Rx/Tx descriptor */
    146       1.1  chs struct nfe_desc32 {
    147       1.1  chs 	uint32_t	physaddr;
    148       1.1  chs 	uint16_t	length;
    149       1.1  chs 	uint16_t	flags;
    150       1.1  chs #define NFE_RX_FIXME_V1		0x6004
    151       1.1  chs #define NFE_RX_VALID_V1		(1 << 0)
    152       1.1  chs #define NFE_TX_ERROR_V1		0x7808
    153       1.1  chs #define NFE_TX_LASTFRAG_V1	(1 << 0)
    154       1.1  chs } __packed;
    155       1.1  chs 
    156       1.1  chs /* V2 Rx/Tx descriptor */
    157       1.1  chs struct nfe_desc64 {
    158       1.1  chs 	uint32_t	physaddr[2];
    159       1.1  chs 	uint32_t	vtag;
    160       1.1  chs #define NFE_RX_VTAG		(1 << 16)
    161       1.1  chs #define NFE_TX_VTAG		(1 << 18)
    162       1.1  chs 	uint16_t	length;
    163       1.1  chs 	uint16_t	flags;
    164       1.1  chs #define NFE_RX_FIXME_V2		0x4300
    165       1.1  chs #define NFE_RX_VALID_V2		(1 << 13)
    166  1.1.20.1   ad #define NFE_RX_IP_CSUMOK	(1 << 12)
    167  1.1.20.1   ad #define NFE_RX_UDP_CSUMOK	(1 << 11)
    168  1.1.20.1   ad #define NFE_RX_TCP_CSUMOK	(1 << 10)
    169       1.1  chs #define NFE_TX_ERROR_V2		0x5c04
    170       1.1  chs #define NFE_TX_LASTFRAG_V2	(1 << 13)
    171  1.1.20.1   ad #define NFE_TX_IP_CSUM		(1 << 11)
    172  1.1.20.1   ad #define NFE_TX_TCP_CSUM		(1 << 10)
    173       1.1  chs } __packed;
    174       1.1  chs 
    175       1.1  chs /* flags common to V1/V2 descriptors */
    176       1.1  chs #define NFE_RX_ERROR		(1 << 14)
    177       1.1  chs #define NFE_RX_READY		(1 << 15)
    178       1.1  chs #define NFE_TX_VALID		(1 << 15)
    179       1.1  chs 
    180       1.1  chs #define NFE_READ(sc, reg) \
    181       1.1  chs 	bus_space_read_4((sc)->sc_memt, (sc)->sc_memh, (reg))
    182       1.1  chs 
    183       1.1  chs #define NFE_WRITE(sc, reg, val) \
    184       1.1  chs 	bus_space_write_4((sc)->sc_memt, (sc)->sc_memh, (reg), (val))
    185