| 1 | /* |
| 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
| 3 | * All rights reserved. The Berkeley software License Agreement |
| 4 | * specifies the terms and conditions for redistribution. |
| 5 | * |
| 6 | * @(#)if_ilreg.h 7.1 (Berkeley) 6/5/86 |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * Interlan Ethernet Communications Controller interface |
| 11 | */ |
| 12 | struct ildevice { |
| 13 | short il_csr; /* Command and Status Register */ |
| 14 | short il_bar; /* Buffer Address Register */ |
| 15 | short il_bcr; /* Byte Count Register */ |
| 16 | }; |
| 17 | |
| 18 | /* |
| 19 | * Command and status bits |
| 20 | */ |
| 21 | #define IL_EUA 0xc000 /* Extended Unibus Address */ |
| 22 | #define IL_CMD 0x3f00 /* Command Function Code */ |
| 23 | #define IL_CDONE 0x0080 /* Command Done */ |
| 24 | #define IL_CIE 0x0040 /* Command Interrupt Enable */ |
| 25 | #define IL_RDONE 0x0020 /* Receive DMA Done */ |
| 26 | #define IL_RIE 0x0010 /* Receive Interrupt Enable */ |
| 27 | #define IL_STATUS 0x000f /* Command Status Code */ |
| 28 | |
| 29 | #define IL_BITS "\20\10CDONE\7CIE\6RDONE\5RIE" |
| 30 | |
| 31 | /* command definitions */ |
| 32 | #define ILC_MLPBAK 0x0100 /* Set Module Interface Loopback Mode */ |
| 33 | #define ILC_ILPBAK 0x0200 /* Set Internal Loopback Mode */ |
| 34 | #define ILC_CLPBAK 0x0300 /* Clear Loopback Mode */ |
| 35 | #define ILC_PRMSC 0x0400 /* Set Promiscuous Receive Mode */ |
| 36 | #define ILC_CLPRMSC 0x0500 /* Clear Promiscuous Receive Mode */ |
| 37 | #define ILC_RCVERR 0x0600 /* Set Receive-On-Error Bit */ |
| 38 | #define ILC_CRCVERR 0x0700 /* Clear Receive-On-Error Bit */ |
| 39 | #define ILC_OFFLINE 0x0800 /* Go Offline */ |
| 40 | #define ILC_ONLINE 0x0900 /* Go Online */ |
| 41 | #define ILC_DIAG 0x0a00 /* Run On-board Diagnostics */ |
| 42 | #define ILC_ISA 0x0d00 /* Set Insert Source Address Mode */ |
| 43 | #define ILC_CISA 0x0e00 /* Clear Insert Source Address Mode */ |
| 44 | #define ILC_DEFPA 0x0f00 /* Set Physical Address to Default */ |
| 45 | #define ILC_ALLMC 0x1000 /* Set Receive All Multicast Packets */ |
| 46 | #define ILC_CALLMC 0x1100 /* Clear Receive All Multicast */ |
| 47 | #define ILC_STAT 0x1800 /* Report and Reset Statistics */ |
| 48 | #define ILC_DELAYS 0x1900 /* Report Collision Delay Times */ |
| 49 | #define ILC_RCV 0x2000 /* Supply Receive Buffer */ |
| 50 | #define ILC_LDXMIT 0x2800 /* Load Transmit Data */ |
| 51 | #define ILC_XMIT 0x2900 /* Load Transmit Data and Send */ |
| 52 | #define ILC_LDGRPS 0x2a00 /* Load Group Addresses */ |
| 53 | #define ILC_RMGRPS 0x2b00 /* Delete Group Addresses */ |
| 54 | #define ILC_LDPA 0x2c00 /* Load Physical Address */ |
| 55 | #define ILC_FLUSH 0x3000 /* Flush Receive BAR/BCR Queue */ |
| 56 | #define ILC_RESET 0x3f00 /* Reset */ |
| 57 | |
| 58 | /* |
| 59 | * Error codes found in the status bits of the csr. |
| 60 | */ |
| 61 | #define ILERR_SUCCESS 0 /* command successful */ |
| 62 | #define ILERR_RETRIES 1 /* " " with retries */ |
| 63 | #define ILERR_BADCMD 2 /* illegal command */ |
| 64 | #define ILERR_INVCMD 3 /* invalid command */ |
| 65 | #define ILERR_RECVERR 4 /* receiver error */ |
| 66 | #define ILERR_BUFSIZ 5 /* buffer size too big */ |
| 67 | #define ILERR_FRAMESIZ 6 /* frame size too small */ |
| 68 | #define ILERR_COLLISIONS 8 /* excessive collisions */ |
| 69 | #define ILERR_BUFALIGNMENT 10 /* buffer not word aligned */ |
| 70 | #define ILERR_NXM 15 /* non-existent memory */ |
| 71 | |
| 72 | #define NILERRS 16 |
| 73 | #ifdef ILERRS |
| 74 | char *ilerrs[NILERRS] = { |
| 75 | "success", /* 0 */ |
| 76 | "success with retries", /* 1 */ |
| 77 | "illegal command", /* 2 */ |
| 78 | "inappropriate command", /* 3 */ |
| 79 | "failure", /* 4 */ |
| 80 | "buffer size exceeded", /* 5 */ |
| 81 | "frame too small", /* 6 */ |
| 82 | 0, /* 7 */ |
| 83 | "excessive collisions", /* 8 */ |
| 84 | 0, /* 9 */ |
| 85 | "buffer alignment error", /* 10 */ |
| 86 | 0, /* 11 */ |
| 87 | 0, /* 12 */ |
| 88 | 0, /* 13 */ |
| 89 | 0, /* 14 */ |
| 90 | "non-existent memory" /* 15 */ |
| 91 | }; |
| 92 | #endif |
| 93 | |
| 94 | /* |
| 95 | * Diagnostics codes. |
| 96 | */ |
| 97 | #define ILDIAG_SUCCESS 0 /* no problems */ |
| 98 | #define ILDIAG_CHKSUMERR 1 /* ROM/RAM checksum error */ |
| 99 | #define ILDIAG_DMAERR 2 /* DMA not working */ |
| 100 | #define ILDIAG_XMITERR 3 /* xmit circuitry failure */ |
| 101 | #define ILDIAG_RECVERR 4 /* rcvr circuitry failure */ |
| 102 | #define ILDIAG_LOOPBACK 5 /* loopback test failed */ |
| 103 | |
| 104 | #define NILDIAGS 6 |
| 105 | #ifdef ILDIAGS |
| 106 | char *ildiag[NILDIAGS] = { |
| 107 | "success", /* 0 */ |
| 108 | "checksum error", /* 1 */ |
| 109 | "NM10 dma error", /* 2 */ |
| 110 | "transmitter error", /* 3 */ |
| 111 | "receiver error", /* 4 */ |
| 112 | "loopback failure", /* 5 */ |
| 113 | }; |
| 114 | #endif |
| 115 | |
| 116 | /* |
| 117 | * Frame status bits, returned in frame status byte |
| 118 | * at the top of each received packet. |
| 119 | */ |
| 120 | #define ILFSTAT_C 0x1 /* CRC error */ |
| 121 | #define ILFSTAT_A 0x2 /* alignment error */ |
| 122 | #define ILFSTAT_L 0x4 /* 1+ frames lost just before */ |