Home | History | Annotate | Line # | Download | only in qbus
if_ilreg.h revision 1.2
      1 /*	$NetBSD: if_ilreg.h,v 1.2 2003/05/03 18:11:38 wiz Exp $	*/
      2 /*
      3  * Copyright (c) 1982, 1986 Regents of the University of California.
      4  * All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by the University of
     17  *	California, Berkeley and its contributors.
     18  * 4. Neither the name of the University nor the names of its contributors
     19  *    may be used to endorse or promote products derived from this software
     20  *    without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  * SUCH DAMAGE.
     33  *
     34  *	@(#)if_ilreg.h	7.3 (Berkeley) 6/28/90
     35  */
     36 
     37 /*
     38  * Interlan Ethernet Communications Controller interface
     39  */
     40 #ifdef notdef
     41 struct ildevice {
     42 	short	il_csr;		/* Command and Status Register */
     43 	short	il_bar;		/* Buffer Address Register */
     44 	short	il_bcr;		/* Byte Count Register */
     45 };
     46 #endif
     47 
     48 #define	IL_CSR	0
     49 #define	IL_BAR	2
     50 #define	IL_BCR	4
     51 
     52 /*
     53  * Command and status bits
     54  */
     55 #define	IL_EUA		0xc000		/* Extended Unibus Address */
     56 #define	IL_CMD		0x3f00		/* Command Function Code */
     57 #define	IL_CDONE	0x0080		/* Command Done */
     58 #define	IL_CIE		0x0040		/* Command Interrupt Enable */
     59 #define	IL_RDONE	0x0020		/* Receive DMA Done */
     60 #define	IL_RIE		0x0010		/* Receive Interrupt Enable */
     61 #define	IL_STATUS	0x000f		/* Command Status Code */
     62 
     63 #define	IL_BITS		"\20\10CDONE\7CIE\6RDONE\5RIE"
     64 
     65 /* command definitions */
     66 #define	ILC_MLPBAK	0x0100		/* Set Module Interface Loopback Mode */
     67 #define	ILC_ILPBAK	0x0200		/* Set Internal Loopback Mode */
     68 #define	ILC_CLPBAK	0x0300		/* Clear Loopback Mode */
     69 #define	ILC_PRMSC	0x0400		/* Set Promiscuous Receive Mode */
     70 #define	ILC_CLPRMSC	0x0500		/* Clear Promiscuous Receive Mode */
     71 #define	ILC_RCVERR	0x0600		/* Set Receive-On-Error Bit */
     72 #define	ILC_CRCVERR	0x0700		/* Clear Receive-On-Error Bit */
     73 #define	ILC_OFFLINE	0x0800		/* Go Offline */
     74 #define	ILC_ONLINE	0x0900		/* Go Online */
     75 #define	ILC_DIAG	0x0a00		/* Run On-board Diagnostics */
     76 #define	ILC_ISA		0x0d00		/* Set Insert Source Address Mode */
     77 #define	ILC_CISA	0x0e00		/* Clear Insert Source Address Mode */
     78 #define	ILC_DEFPA	0x0f00		/* Set Physical Address to Default */
     79 #define	ILC_ALLMC	0x1000		/* Set Receive All Multicast Packets */
     80 #define	ILC_CALLMC	0x1100		/* Clear Receive All Multicast */
     81 #define	ILC_STAT	0x1800		/* Report and Reset Statistics */
     82 #define	ILC_DELAYS	0x1900		/* Report Collision Delay Times */
     83 #define	ILC_RCV		0x2000		/* Supply Receive Buffer */
     84 #define	ILC_LDXMIT	0x2800		/* Load Transmit Data */
     85 #define	ILC_XMIT	0x2900		/* Load Transmit Data and Send */
     86 #define	ILC_LDGRPS	0x2a00		/* Load Group Addresses */
     87 #define	ILC_RMGRPS	0x2b00		/* Delete Group Addresses */
     88 #define	ILC_LDPA	0x2c00		/* Load Physical Address */
     89 #define	ILC_FLUSH	0x3000		/* Flush Receive BAR/BCR Queue */
     90 #define	ILC_RESET	0x3f00		/* Reset */
     91 
     92 /*
     93  * Error codes found in the status bits of the csr.
     94  */
     95 #define	ILERR_SUCCESS		0	/* command successful */
     96 #define	ILERR_RETRIES		1	/* " " with retries */
     97 #define	ILERR_BADCMD		2	/* illegal command */
     98 #define	ILERR_INVCMD		3	/* invalid command */
     99 #define	ILERR_RECVERR		4	/* receiver error */
    100 #define	ILERR_BUFSIZ		5	/* buffer size too big */
    101 #define	ILERR_FRAMESIZ		6	/* frame size too small */
    102 #define	ILERR_COLLISIONS	8	/* excessive collisions */
    103 #define	ILERR_BUFALIGNMENT	10	/* buffer not word aligned */
    104 #define	ILERR_NXM		15	/* non-existent memory */
    105 
    106 #define	NILERRS			16
    107 #ifdef ILERRS
    108 char *ilerrs[NILERRS] = {
    109 	"success",			/*  0 */
    110 	"success with retries", 	/*  1 */
    111 	"illegal command",		/*  2 */
    112 	"inappropriate command",	/*  3 */
    113 	"failure",			/*  4 */
    114 	"buffer size exceeded",		/*  5 */
    115 	"frame too small",		/*  6 */
    116 	0,				/*  7 */
    117 	"excessive collisions",		/*  8 */
    118 	0,				/*  9 */
    119 	"buffer alignment error",	/* 10 */
    120 	0,				/* 11 */
    121 	0,				/* 12 */
    122 	0,				/* 13 */
    123 	0,				/* 14 */
    124 	"non-existent memory"		/* 15 */
    125 };
    126 #endif
    127 
    128 /*
    129  * Diagnostics codes.
    130  */
    131 #define	ILDIAG_SUCCESS		0	/* no problems */
    132 #define	ILDIAG_CHKSUMERR	1	/* ROM/RAM checksum error */
    133 #define	ILDIAG_DMAERR		2	/* DMA not working */
    134 #define	ILDIAG_XMITERR		3	/* xmit circuitry failure */
    135 #define	ILDIAG_RECVERR		4	/* rcvr circuitry failure */
    136 #define	ILDIAG_LOOPBACK		5	/* loopback test failed */
    137 
    138 #define	NILDIAGS		6
    139 #ifdef ILDIAGS
    140 char *ildiag[NILDIAGS] = {
    141 	"success",			/* 0 */
    142 	"checksum error",		/* 1 */
    143 	"NM10 DMA error",		/* 2 */
    144 	"transmitter error",		/* 3 */
    145 	"receiver error",		/* 4 */
    146 	"loopback failure",		/* 5 */
    147 };
    148 #endif
    149 
    150 /*
    151  * Frame status bits, returned in frame status byte
    152  * at the top of each received packet.
    153  */
    154 #define	ILFSTAT_C	0x1		/* CRC error */
    155 #define	ILFSTAT_A	0x2		/* alignment error */
    156 #define	ILFSTAT_L	0x4		/* 1+ frames lost just before */
    157