xref: /csrg-svn/sys/tahoe/if/if_acereg.h (revision 49425)
1*49425Sbostic /*-
2*49425Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*49425Sbostic  * All rights reserved.
4*49425Sbostic  *
5*49425Sbostic  * This code is derived from software contributed to Berkeley by
6*49425Sbostic  * Computer Consoles Inc.
7*49425Sbostic  *
8*49425Sbostic  * %sccs.include.redist.c%
9*49425Sbostic  *
10*49425Sbostic  *	@(#)if_acereg.h	7.2 (Berkeley) 05/08/91
1134405Skarels  */
1224008Ssam 
1324008Ssam /*
1424008Ssam  * VERSAbus ACC ethernet controller definitions
1524008Ssam  */
1624008Ssam 
1724008Ssam /*
1824008Ssam  * Register definitions
1924008Ssam  */
2024008Ssam struct acedevice {
2124008Ssam 	short	station[6];		/* station address */
2224008Ssam 	short	bcastena[2];		/* broadcast enable */
2324008Ssam 	short	hash[8];		/* multicast hash codes */
2424008Ssam 	short	csr;			/* control and status register */
2524008Ssam 	short	tseg;			/* current transmit segment # */
2624008Ssam 	short	rseg;			/* current receive  segment # */
2724008Ssam 	short	segb;			/* segment boundary register */
2824008Ssam 	short	lrf;			/* lost receive frame counter */
2924008Ssam 	short	ivct;			/* interrupt vector register */
3024008Ssam 	short	resv;			/* reserved for future use */
3124008Ssam 	short	fcoll;			/* force collision register */
3224008Ssam };
3324008Ssam 
3424008Ssam /*
3524008Ssam  * Transmit segment in dual ported ram.
3624008Ssam  */
3724008Ssam struct tx_segment {
3824008Ssam 	short	tx_csr;		/* packet status */
3924008Ssam 	char	tx_data[2014];
4024008Ssam 	short	tx_backoff[16];	/* random backoff counters */
4124008Ssam };
4224008Ssam 
4324008Ssam /*
4424008Ssam  * Receive segment in dual ported ram.
4524008Ssam  */
4624008Ssam struct rx_segment {
4724008Ssam 	short	rx_csr;		/* packet status */
4824008Ssam 	char	rx_data[2046];
4924008Ssam };
5024008Ssam 
5124008Ssam /*
5224008Ssam  * ACC statistics block.
5324008Ssam  */
5424008Ssam struct ace_stats {
5524008Ssam 	int	rx_datagrams;		/* valid packets received */
5624008Ssam 	int	rx_crc_errors;		/* CRC errors */
5724008Ssam 	int	rx_overruns;		/* packets too large */
5824008Ssam 	int	rx_underruns;		/* packets too small */
5924008Ssam 	int	rx_align_errors;	/* packets w/ odd byte count */
6024008Ssam 	int	rx_reserved;
6124008Ssam 	int	rx_busy;		/* recv segment filled */
6224008Ssam 	int	rx_mbuf;		/* out of mbufs */
6324008Ssam 	int	rx_oddoff;		/* odd offset in mbuf */
6424008Ssam 	int	rx_rintcnt;		/* recvr interrupt */
6524008Ssam 
6624008Ssam 	int	tx_datagrams;		/* packets xmit'd */
6724008Ssam 	int	tx_retries;		/* collision retries */
6824008Ssam 	int	tx_discarded;		/* packets w/ max retries */
6924008Ssam 	int	tx_busy;		/* xmit segment filled in acestart */
7024008Ssam 	int	tx_cbusy;		/* xmit segment filled in acecint */
7124008Ssam 	int	tx_mbuf;		/* total mbufs */
7224008Ssam 	int	tx_oddoff;		/* odd offset in mbuf */
7324008Ssam 	int	tx_outcnt;		/* calls to aceoutput */
7424008Ssam 	int	tx_startcnt;		/* calls to acestart */
7524008Ssam 	int	tx_cintcnt;		/* xmit's completed */
7624008Ssam };
7724008Ssam 
7824008Ssam /*
7924008Ssam  * Control status definitions.
8024008Ssam  */
8124008Ssam #define CSR_OBCENA	0x0200	/* enable xmit of odd byte count */
8224008Ssam #define CSR_ACTIVE	0x0080	/* board active */
8324008Ssam #define CSR_RESET	0x0040	/* reset board */
8424008Ssam #define CSR_PROMISC	0x0020	/* enable promiscous mode */
8524008Ssam #define CSR_CRCDIS	0x0010	/* disable CRC generation */
8624008Ssam #define CSR_LOOP3	0x0008	/* enable loopback mode 3 */
8724008Ssam #define CSR_LOOP2	0x0004	/* enable loopback mode 2 */
8824008Ssam #define CSR_IENA	0x0002	/* interrupt enable */
8924008Ssam #define CSR_GO		0x0001	/* enable micro-engine */
9024008Ssam 
9124008Ssam #define	ACE_CSRBITS \
9224008Ssam     "\20\12OBCENA\10ACTIVE\7RESET\6PROMISC\5CRCDIS\4LOOP3\3LOOP2\2IENA\1GO"
9324008Ssam /*
9424008Ssam  * Transmit packet status definitions.
9524008Ssam  */
9624008Ssam #define TCS_TBFULL	(short)0x8000	/* buffer filled, send it */
9724008Ssam #define TCS_TBC		(short)0x07FF	/* byte count */
9824008Ssam #define TCS_TBMT	(short)0x8000	/* buffer empty */
9924008Ssam #define TCS_RTFAIL	(short)0x4000	/* retries failed */
10024008Ssam #define TCS_RTC		(short)0x000F	/* collision retry mask */
10124008Ssam 
10224008Ssam /*
10324008Ssam  * Receive packet status definitions.
10424008Ssam  */
10524008Ssam #define RCS_RBMT	0x8000		/* buffer ready for recv */
10624008Ssam #define RCS_RBFULL	0x8000		/* buffer full, take data */
10724008Ssam #define RCS_ROVRN	0x4000		/* overrun error */
10824008Ssam #define RCS_RCRC	0x2000		/* CRC error */
10924008Ssam #define RCS_RODD	0x1000		/* odd byte count error */
11024008Ssam #define RCS_RBC		0x07FF		/* byte count mask */
11124008Ssam 
11224008Ssam #define	ACE_RCSBITS	"\20\20RBFULL\17ROVRN\16RCSR\15RODD"
11324008Ssam 
11424008Ssam #define CRC_SIZE	4         /* number of bytes in a rx seg's CRC */
11524008Ssam #define RCW_SIZE	2         /* number of bytes in a rx seg's csr */
11624008Ssam #define SEG_MAX		15        /* largest valid segment number */
11724008Ssam #define ET_MINLEN       64        /* min frame size */
11824008Ssam #define ET_MAXLEN       1514      /* max frame size w/o CRC & RCW */
119