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