if_lereg.h revision 1.5
11.5Smsaitoh/*	$NetBSD: if_lereg.h,v 1.5 2021/12/05 03:04:41 msaitoh Exp $ */
21.1Schuck
31.1Schuck/*-
41.1Schuck * Copyright (c) 1982, 1992, 1993
51.1Schuck *	The Regents of the University of California.  All rights reserved.
61.1Schuck *
71.1Schuck * Redistribution and use in source and binary forms, with or without
81.1Schuck * modification, are permitted provided that the following conditions
91.1Schuck * are met:
101.1Schuck * 1. Redistributions of source code must retain the above copyright
111.1Schuck *    notice, this list of conditions and the following disclaimer.
121.1Schuck * 2. Redistributions in binary form must reproduce the above copyright
131.1Schuck *    notice, this list of conditions and the following disclaimer in the
141.1Schuck *    documentation and/or other materials provided with the distribution.
151.3Sagc * 3. Neither the name of the University nor the names of its contributors
161.1Schuck *    may be used to endorse or promote products derived from this software
171.1Schuck *    without specific prior written permission.
181.1Schuck *
191.1Schuck * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
201.1Schuck * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211.1Schuck * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221.1Schuck * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
231.1Schuck * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241.1Schuck * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
251.1Schuck * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261.1Schuck * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
271.1Schuck * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
281.1Schuck * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
291.1Schuck * SUCH DAMAGE.
301.1Schuck *
311.1Schuck * @(#)if_lereg.h	8.2 (Berkeley) 10/30/93
321.1Schuck */
331.1Schuck
341.1Schuck#define	LEMTU		1518
351.1Schuck#define	LEMINSIZE	60	/* should be 64 if mode DTCR is set */
361.1Schuck#define	LERBUF		8
371.1Schuck#define	LERBUFLOG2	3
381.1Schuck#define	LE_RLEN		(LERBUFLOG2 << 13)
391.1Schuck#define	LETBUF		1
401.1Schuck#define	LETBUFLOG2	0
411.1Schuck#define	LE_TLEN		(LETBUFLOG2 << 13)
421.1Schuck
431.1Schuck/* Local Area Network Controller for Ethernet (LANCE) registers */
441.1Schuckstruct lereg1 {
451.1Schuck	volatile u_short	ler1_rdp;	/* register data port */
461.1Schuck	volatile u_short	ler1_rap;	/* register address port */
471.1Schuck};
481.1Schuck
491.1Schuck/* register addresses */
501.1Schuck#define	LE_CSR0		0		/* Control and status register */
511.1Schuck#define	LE_CSR1		1		/* low address of init block */
521.1Schuck#define	LE_CSR2		2		/* high address of init block */
531.1Schuck#define	LE_CSR3		3		/* Bus master and control */
541.1Schuck
551.1Schuck/* Control and status register 0 (csr0) */
561.1Schuck#define	LE_C0_ERR	0x8000		/* error summary */
571.1Schuck#define	LE_C0_BABL	0x4000		/* transmitter timeout error */
581.1Schuck#define	LE_C0_CERR	0x2000		/* collision */
591.1Schuck#define	LE_C0_MISS	0x1000		/* missed a packet */
601.1Schuck#define	LE_C0_MERR	0x0800		/* memory error */
611.1Schuck#define	LE_C0_RINT	0x0400		/* receiver interrupt */
621.1Schuck#define	LE_C0_TINT	0x0200		/* transmitter interrupt */
631.2Swiz#define	LE_C0_IDON	0x0100		/* initialization done */
641.1Schuck#define	LE_C0_INTR	0x0080		/* interrupt condition */
651.1Schuck#define	LE_C0_INEA	0x0040		/* interrupt enable */
661.1Schuck#define	LE_C0_RXON	0x0020		/* receiver on */
671.1Schuck#define	LE_C0_TXON	0x0010		/* transmitter on */
681.1Schuck#define	LE_C0_TDMD	0x0008		/* transmit demand */
691.1Schuck#define	LE_C0_STOP	0x0004		/* disable all external activity */
701.1Schuck#define	LE_C0_STRT	0x0002		/* enable external activity */
711.2Swiz#define	LE_C0_INIT	0x0001		/* begin initialization */
721.1Schuck
731.1Schuck#define LE_C0_BITS \
741.1Schuck    "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
751.1Schuck\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
761.1Schuck
771.1Schuck/* Control and status register 3 (csr3) */
781.1Schuck#define	LE_C3_BSWP	0x4		/* byte swap */
791.1Schuck#define	LE_C3_ACON	0x2		/* ALE control, eh? */
801.1Schuck#define	LE_C3_BCON	0x1		/* byte control */
811.1Schuck/*
821.1Schuck * Current size is 13,758 bytes with 8 x 1518 receive buffers and
831.1Schuck * 1 x 1518 transmit buffer.
841.1Schuck */
851.1Schuckstruct lereg2 {
861.1Schuck	/* initialization block */
871.1Schuck	volatile u_short	ler2_mode;		/* mode */
881.1Schuck	volatile u_char	ler2_padr[6];		/* physical address */
891.1Schuck#ifdef new_code
901.1Schuck	volatile u_short	ler2_ladrf[4];	/* logical address filter */
911.1Schuck#else
921.1Schuck	volatile u_long	ler2_ladrf0;		/* logical address filter */
931.1Schuck	volatile u_long	ler2_ladrf1;		/* logical address filter */
941.1Schuck#endif
951.1Schuck	volatile u_short	ler2_rdra;	/* receive descriptor addr */
961.1Schuck	volatile u_short	ler2_rlen;	/* rda high and ring size */
971.1Schuck	volatile u_short	ler2_tdra;	/* transmit descriptor addr */
981.1Schuck	volatile u_short	ler2_tlen;	/* tda high and ring size */
991.1Schuck	/* receive message descriptors. bits/hadr are byte order dependent. */
1001.1Schuck	struct	lermd {
1011.1Schuck		volatile u_short	rmd0;	/* low address of packet */
1021.1Schuck		volatile u_char	rmd1_bits;	/* descriptor bits */
1031.1Schuck		volatile u_char	rmd1_hadr;	/* high address of packet */
1041.1Schuck		volatile short	rmd2;		/* buffer byte count */
1051.1Schuck		volatile u_short	rmd3;	/* message byte count */
1061.1Schuck	} ler2_rmd[LERBUF];
1071.1Schuck	/* transmit message descriptors */
1081.1Schuck	struct	letmd {
1091.1Schuck		volatile u_short	tmd0;	/* low address of packet */
1101.1Schuck		volatile u_char	tmd1_bits;	/* descriptor bits */
1111.1Schuck		volatile u_char	tmd1_hadr;	/* high address of packet */
1121.1Schuck		volatile short	tmd2;		/* buffer byte count */
1131.1Schuck		volatile u_short tmd3;		/* transmit error bits */
1141.1Schuck	} ler2_tmd[LETBUF];
1151.1Schuck	volatile char	ler2_rbuf[LERBUF][LEMTU];
1161.1Schuck	volatile char	ler2_tbuf[LETBUF][LEMTU];
1171.1Schuck};
1181.1Schuck
1191.5Smsaitoh/* Initialization block (mode) */
1201.1Schuck#define	LE_MODE_PROM	0x8000		/* promiscuous mode */
1211.1Schuck/*			0x7f80		   reserved, must be zero */
1221.1Schuck#define	LE_MODE_INTL	0x0040		/* internal loopback */
1231.1Schuck#define	LE_MODE_DRTY	0x0020		/* disable retry */
1241.1Schuck#define	LE_MODE_COLL	0x0010		/* force a collision */
1251.1Schuck#define	LE_MODE_DTCR	0x0008		/* disable transmit CRC */
1261.1Schuck#define	LE_MODE_LOOP	0x0004		/* loopback mode */
1271.1Schuck#define	LE_MODE_DTX	0x0002		/* disable transmitter */
1281.1Schuck#define	LE_MODE_DRX	0x0001		/* disable receiver */
1291.1Schuck#define	LE_MODE_NORMAL	0		/* none of the above */
1301.1Schuck
1311.1Schuck
1321.1Schuck/* Receive message descriptor 1 (rmd1_bits) */
1331.1Schuck#define	LE_R1_OWN	0x80		/* LANCE owns the packet */
1341.1Schuck#define	LE_R1_ERR	0x40		/* error summary */
1351.1Schuck#define	LE_R1_FRAM	0x20		/* framing error */
1361.1Schuck#define	LE_R1_OFLO	0x10		/* overflow error */
1371.1Schuck#define	LE_R1_CRC	0x08		/* CRC error */
1381.1Schuck#define	LE_R1_BUFF	0x04		/* buffer error */
1391.1Schuck#define	LE_R1_STP	0x02		/* start of packet */
1401.1Schuck#define	LE_R1_ENP	0x01		/* end of packet */
1411.1Schuck
1421.1Schuck#define LE_R1_BITS \
1431.1Schuck    "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
1441.1Schuck
1451.1Schuck/* Transmit message descriptor 1 (tmd1_bits) */
1461.1Schuck#define	LE_T1_OWN	0x80		/* LANCE owns the packet */
1471.1Schuck#define	LE_T1_ERR	0x40		/* error summary */
1481.1Schuck#define	LE_T1_MORE	0x10		/* multiple collisions */
1491.1Schuck#define	LE_T1_ONE	0x08		/* single collision */
1501.1Schuck#define	LE_T1_DEF	0x04		/* defferred transmit */
1511.1Schuck#define	LE_T1_STP	0x02		/* start of packet */
1521.1Schuck#define	LE_T1_ENP	0x01		/* end of packet */
1531.1Schuck
1541.1Schuck#define LE_T1_BITS \
1551.1Schuck    "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
1561.1Schuck
1571.1Schuck/* Transmit message descriptor 3 (tmd3) */
1581.1Schuck#define	LE_T3_BUFF	0x8000		/* buffer error */
1591.1Schuck#define	LE_T3_UFLO	0x4000		/* underflow error */
1601.1Schuck#define	LE_T3_LCOL	0x1000		/* late collision */
1611.1Schuck#define	LE_T3_LCAR	0x0800		/* loss of carrier */
1621.1Schuck#define	LE_T3_RTRY	0x0400		/* retry error */
1631.1Schuck#define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
1641.1Schuck
1651.1Schuck#define LE_XMD2_ONES	0xf000
1661.1Schuck
1671.1Schuck#define LE_T3_BITS \
1681.1Schuck    "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
1691.1Schuck
1701.1Schuck
1711.1Schuck#define LE_ADDR_LOW_MASK (0xffff)
1721.1Schuck
173