1 1.6 is /* $NetBSD: i82586.h,v 1.6 1997/03/15 18:10:48 is Exp $ */ 2 1.1 gwr 3 1.1 gwr /*- 4 1.1 gwr * Copyright (c) 1992, University of Vermont and State Agricultural College. 5 1.1 gwr * Copyright (c) 1992, Garrett A. Wollman. 6 1.1 gwr * All rights reserved. 7 1.1 gwr * 8 1.1 gwr * Redistribution and use in source and binary forms, with or without 9 1.1 gwr * modification, are permitted provided that the following conditions 10 1.1 gwr * are met: 11 1.1 gwr * 1. Redistributions of source code must retain the above copyright 12 1.1 gwr * notice, this list of conditions and the following disclaimer. 13 1.1 gwr * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 gwr * notice, this list of conditions and the following disclaimer in the 15 1.1 gwr * documentation and/or other materials provided with the distribution. 16 1.1 gwr * 3. All advertising materials mentioning features or use of this software 17 1.1 gwr * must display the following acknowledgement: 18 1.1 gwr * This product includes software developed by the University of 19 1.1 gwr * Vermont and State Agricultural College and Garrett A. Wollman. 20 1.1 gwr * 4. Neither the name of the University nor the name of the author 21 1.1 gwr * may be used to endorse or promote products derived from this software 22 1.1 gwr * without specific prior written permission. 23 1.1 gwr * 24 1.1 gwr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 1.1 gwr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 1.1 gwr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 1.1 gwr * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE 28 1.1 gwr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 1.1 gwr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 1.1 gwr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 1.1 gwr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 1.1 gwr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 1.1 gwr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 1.1 gwr * SUCH DAMAGE. 35 1.1 gwr */ 36 1.1 gwr 37 1.1 gwr /* 38 1.1 gwr * Intel 82586 Ethernet chip 39 1.1 gwr * Register, bit, and structure definitions. 40 1.1 gwr * 41 1.1 gwr * Written by GAW with reference to the Clarkson Packet Driver code for this 42 1.1 gwr * chip written by Russ Nelson and others. 43 1.1 gwr * 44 1.1 gwr * Sun support added by Charles D. Cranor, 25-Oct-94 45 1.3 gwr * 46 1.3 gwr * XXX: This is very much like dev/ic/i82586reg.h except for 47 1.3 gwr * XXX: the SWAP() macro used here to byte-swap word constants. 48 1.3 gwr * XXX: (This should probably replace the version in dev/ic) 49 1.1 gwr */ 50 1.1 gwr 51 1.1 gwr struct ie_en_addr { 52 1.1 gwr u_char data[6]; 53 1.1 gwr }; 54 1.1 gwr 55 1.1 gwr /* 56 1.1 gwr * This is the master configuration block. It tells the hardware where all 57 1.1 gwr * the rest of the stuff is. 58 1.1 gwr */ 59 1.1 gwr struct ie_sys_conf_ptr { 60 1.1 gwr u_short mbz; /* must be zero (alignment) */ 61 1.1 gwr u_char ie_bus_use; /* true if 8-bit only */ 62 1.1 gwr u_char mbz2[5]; /* must be zero */ 63 1.5 gwr u_int ie_iscp_ptr; /* 24-bit physaddr of ISCP */ 64 1.1 gwr }; 65 1.1 gwr 66 1.1 gwr /* 67 1.1 gwr * Note that this is wired in hardware; the SCP is always located here, no 68 1.1 gwr * matter what. 69 1.1 gwr */ 70 1.1 gwr #define IE_SCP_ADDR 0xfffff4 71 1.1 gwr 72 1.1 gwr /* 73 1.1 gwr * The tells the hardware where all the rest of the stuff is, too. 74 1.1 gwr * FIXME: some of these should be re-commented after we figure out their 75 1.1 gwr * REAL function. 76 1.1 gwr */ 77 1.1 gwr struct ie_int_sys_conf_ptr { 78 1.1 gwr u_char ie_busy; /* zeroed after init */ 79 1.1 gwr u_char mbz; 80 1.1 gwr u_short ie_scb_offset; /* 16-bit physaddr of next struct */ 81 1.5 gwr u_int ie_base; /* 24-bit physaddr for all 16-bit vars */ 82 1.1 gwr }; 83 1.1 gwr 84 1.1 gwr /* 85 1.1 gwr * This FINALLY tells the hardware what to do and where to put it. 86 1.1 gwr */ 87 1.1 gwr struct ie_sys_ctl_block { 88 1.1 gwr u_short ie_status; /* status word */ 89 1.1 gwr u_short ie_command; /* command word */ 90 1.1 gwr u_short ie_command_list; /* 16-pointer to command block list */ 91 1.1 gwr u_short ie_recv_list; /* 16-pointer to receive frame list */ 92 1.1 gwr u_short ie_err_crc; /* CRC errors */ 93 1.1 gwr u_short ie_err_align; /* Alignment errors */ 94 1.1 gwr u_short ie_err_resource; /* Resource errors */ 95 1.1 gwr u_short ie_err_overrun; /* Overrun errors */ 96 1.1 gwr }; 97 1.1 gwr 98 1.1 gwr /* Command values */ 99 1.1 gwr #define IE_RU_COMMAND SWAP(0x0070) /* mask for RU command */ 100 1.1 gwr #define IE_RU_NOP SWAP(0) /* for completeness */ 101 1.1 gwr #define IE_RU_START SWAP(0x0010) /* start receive unit command */ 102 1.1 gwr #define IE_RU_ENABLE SWAP(0x0020) /* enable receiver command */ 103 1.1 gwr #define IE_RU_DISABLE SWAP(0x0030) /* disable receiver command */ 104 1.1 gwr #define IE_RU_ABORT SWAP(0x0040) /* abort current receive operation */ 105 1.1 gwr 106 1.1 gwr #define IE_CU_COMMAND SWAP(0x0700) /* mask for CU command */ 107 1.1 gwr #define IE_CU_NOP SWAP(0) /* included for completeness */ 108 1.1 gwr #define IE_CU_START SWAP(0x0100) /* do-command command */ 109 1.1 gwr #define IE_CU_RESUME SWAP(0x0200) /* resume a suspended cmd list */ 110 1.1 gwr #define IE_CU_STOP SWAP(0x0300) /* SUSPEND was already taken */ 111 1.1 gwr #define IE_CU_ABORT SWAP(0x0400) /* abort current command */ 112 1.1 gwr 113 1.1 gwr #define IE_ACK_COMMAND SWAP(0xf000) /* mask for ACK command */ 114 1.1 gwr #define IE_ACK_CX SWAP(0x8000) /* ack IE_ST_DONE */ 115 1.1 gwr #define IE_ACK_FR SWAP(0x4000) /* ack IE_ST_RECV */ 116 1.1 gwr #define IE_ACK_CNA SWAP(0x2000) /* ack IE_ST_ALLDONE */ 117 1.1 gwr #define IE_ACK_RNR SWAP(0x1000) /* ack IE_ST_RNR */ 118 1.1 gwr 119 1.1 gwr #define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START) 120 1.1 gwr /* is this command an action command? */ 121 1.1 gwr 122 1.1 gwr /* Status values */ 123 1.1 gwr #define IE_ST_WHENCE SWAP(0xf000) /* mask for cause of interrupt */ 124 1.1 gwr #define IE_ST_DONE SWAP(0x8000) /* command with I bit completed */ 125 1.1 gwr #define IE_ST_RECV SWAP(0x4000) /* frame received */ 126 1.1 gwr #define IE_ST_ALLDONE SWAP(0x2000) /* all commands completed */ 127 1.1 gwr #define IE_ST_RNR SWAP(0x1000) /* receive not ready */ 128 1.1 gwr 129 1.1 gwr #define IE_CU_STATUS SWAP(0x700) /* mask for command unit status */ 130 1.1 gwr #define IE_CU_ACTIVE SWAP(0x200) /* command unit is active */ 131 1.1 gwr #define IE_CU_SUSPEND SWAP(0x100) /* command unit is suspended */ 132 1.1 gwr 133 1.1 gwr #define IE_RU_STATUS SWAP(0x70) /* mask for receiver unit status */ 134 1.1 gwr #define IE_RU_SUSPEND SWAP(0x10) /* receiver is suspended */ 135 1.1 gwr #define IE_RU_NOSPACE SWAP(0x20) /* receiver has no resources */ 136 1.1 gwr #define IE_RU_READY SWAP(0x40) /* reveiver is ready */ 137 1.1 gwr 138 1.1 gwr /* 139 1.1 gwr * This is filled in partially by the chip, partially by us. 140 1.1 gwr */ 141 1.1 gwr struct ie_recv_frame_desc { 142 1.1 gwr u_short ie_fd_status; /* status for this frame */ 143 1.1 gwr u_short ie_fd_last; /* end of frame list flag */ 144 1.1 gwr u_short ie_fd_next; /* 16-pointer to next RFD */ 145 1.1 gwr u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */ 146 1.1 gwr struct ie_en_addr dest; /* destination ether */ 147 1.1 gwr struct ie_en_addr src; /* source ether */ 148 1.1 gwr u_short ie_length; /* 802 length/Ether type */ 149 1.1 gwr u_short mbz; /* must be zero */ 150 1.1 gwr }; 151 1.1 gwr 152 1.1 gwr #define IE_FD_LAST SWAP(0x8000) /* last rfd in list */ 153 1.1 gwr #define IE_FD_SUSP SWAP(0x4000) /* suspend RU after receipt */ 154 1.1 gwr 155 1.1 gwr #define IE_FD_COMPLETE SWAP(0x8000) /* frame is complete */ 156 1.1 gwr #define IE_FD_BUSY SWAP(0x4000) /* frame is busy */ 157 1.1 gwr #define IE_FD_OK SWAP(0x2000) /* frame is bad */ 158 1.1 gwr #define IE_FD_RNR SWAP(0x0200) /* receiver out of resources here */ 159 1.1 gwr 160 1.1 gwr /* 161 1.1 gwr * linked list of buffers... 162 1.1 gwr */ 163 1.1 gwr struct ie_recv_buf_desc { 164 1.1 gwr u_short ie_rbd_actual; /* status for this buffer */ 165 1.1 gwr u_short ie_rbd_next; /* 16-pointer to next RBD */ 166 1.5 gwr u_int ie_rbd_buffer; /* 24-pointer to buffer for this RBD */ 167 1.1 gwr u_short ie_rbd_length; /* length of the buffer */ 168 1.1 gwr u_short mbz; /* must be zero */ 169 1.1 gwr }; 170 1.1 gwr 171 1.1 gwr #define IE_RBD_LAST SWAP(0x8000) /* last buffer */ 172 1.1 gwr #define IE_RBD_USED SWAP(0x4000) /* this buffer has data */ 173 1.1 gwr /* 174 1.1 gwr * All commands share this in common. 175 1.1 gwr */ 176 1.1 gwr struct ie_cmd_common { 177 1.1 gwr u_short ie_cmd_status; /* status of this command */ 178 1.1 gwr u_short ie_cmd_cmd; /* command word */ 179 1.1 gwr u_short ie_cmd_link; /* link to next command */ 180 1.1 gwr }; 181 1.1 gwr 182 1.1 gwr #define IE_STAT_COMPL SWAP(0x8000) /* command is completed */ 183 1.1 gwr #define IE_STAT_BUSY SWAP(0x4000) /* command is running now */ 184 1.1 gwr #define IE_STAT_OK SWAP(0x2000) /* command completed successfully */ 185 1.2 gwr #define IE_STAT_ABORT SWAP(0x1000) /* command was aborted */ 186 1.1 gwr 187 1.1 gwr #define IE_CMD_NOP SWAP(0x0000) /* NOP */ 188 1.1 gwr #define IE_CMD_IASETUP SWAP(0x0001) /* initial address setup */ 189 1.1 gwr #define IE_CMD_CONFIG SWAP(0x0002) /* configure command */ 190 1.1 gwr #define IE_CMD_MCAST SWAP(0x0003) /* multicast setup command */ 191 1.1 gwr #define IE_CMD_XMIT SWAP(0x0004) /* transmit command */ 192 1.1 gwr #define IE_CMD_TDR SWAP(0x0005) /* time-domain reflectometer command */ 193 1.1 gwr #define IE_CMD_DUMP SWAP(0x0006) /* dump command */ 194 1.1 gwr #define IE_CMD_DIAGNOSE SWAP(0x0007) /* diagnostics command */ 195 1.1 gwr 196 1.1 gwr #define IE_CMD_LAST SWAP(0x8000) /* this is the last command in the list */ 197 1.1 gwr #define IE_CMD_SUSPEND SWAP(0x4000) /* suspend CU after this command */ 198 1.1 gwr #define IE_CMD_INTR SWAP(0x2000) /* post an interrupt after completion */ 199 1.1 gwr 200 1.1 gwr /* 201 1.1 gwr * This is the command to transmit a frame. 202 1.1 gwr */ 203 1.1 gwr struct ie_xmit_cmd { 204 1.1 gwr struct ie_cmd_common com; /* common part */ 205 1.1 gwr #define ie_xmit_status com.ie_cmd_status 206 1.1 gwr 207 1.1 gwr u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */ 208 1.1 gwr struct ie_en_addr ie_xmit_addr; /* destination address */ 209 1.1 gwr 210 1.1 gwr u_short ie_xmit_length; /* 802.3 length/Ether type field */ 211 1.1 gwr }; 212 1.1 gwr 213 1.1 gwr #define IE_XS_MAXCOLL SWAP(0x000f) /* number of collisions during transmit */ 214 1.1 gwr #define IE_XS_EXCMAX SWAP(0x0020) /* exceeded maximum number of collisions */ 215 1.1 gwr #define IE_XS_SQE SWAP(0x0040) /* SQE positive */ 216 1.1 gwr #define IE_XS_DEFERRED SWAP(0x0080) /* transmission deferred */ 217 1.1 gwr #define IE_XS_UNDERRUN SWAP(0x0100) /* DMA underrun */ 218 1.1 gwr #define IE_XS_LOSTCTS SWAP(0x0200) /* Lost CTS */ 219 1.1 gwr #define IE_XS_NOCARRIER SWAP(0x0400) /* No Carrier */ 220 1.1 gwr #define IE_XS_LATECOLL SWAP(0x0800) /* Late collision */ 221 1.1 gwr 222 1.1 gwr /* 223 1.1 gwr * This is a buffer descriptor for a frame to be transmitted. 224 1.1 gwr */ 225 1.1 gwr 226 1.1 gwr struct ie_xmit_buf { 227 1.1 gwr u_short ie_xmit_flags; /* see below */ 228 1.1 gwr u_short ie_xmit_next; /* 16-pointer to next desc. */ 229 1.5 gwr u_int ie_xmit_buf; /* 24-pointer to the actual buffer */ 230 1.1 gwr }; 231 1.1 gwr 232 1.1 gwr #define IE_XMIT_LAST SWAP(0x8000) /* this TBD is the last one */ 233 1.1 gwr /* The rest of the `flags' word is actually the length. */ 234 1.1 gwr 235 1.1 gwr /* 236 1.1 gwr * Multicast setup command. 237 1.5 gwr * The command must fit in a transmit buffer (1536). 238 1.5 gwr * Also, would like size of ie_mcast_addrs to be even. 239 1.1 gwr */ 240 1.1 gwr 241 1.5 gwr #define MAXMCAST 247 242 1.1 gwr 243 1.1 gwr struct ie_mcast_cmd { 244 1.1 gwr struct ie_cmd_common com; /* common part */ 245 1.1 gwr #define ie_mcast_status com.ie_cmd_status 246 1.1 gwr 247 1.1 gwr u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */ 248 1.1 gwr struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */ 249 1.1 gwr }; 250 1.1 gwr 251 1.1 gwr /* 252 1.1 gwr * Time Domain Reflectometer command. 253 1.1 gwr */ 254 1.1 gwr 255 1.1 gwr struct ie_tdr_cmd { 256 1.1 gwr struct ie_cmd_common com; /* common part */ 257 1.1 gwr #define ie_tdr_status com.ie_cmd_status 258 1.1 gwr 259 1.1 gwr u_short ie_tdr_time; /* error bits and time */ 260 1.1 gwr }; 261 1.1 gwr 262 1.1 gwr #define IE_TDR_SUCCESS SWAP(0x8000) /* TDR succeeded without error */ 263 1.1 gwr #define IE_TDR_XCVR SWAP(0x4000) /* detected a transceiver problem */ 264 1.1 gwr #define IE_TDR_OPEN SWAP(0x2000) /* detected an open */ 265 1.1 gwr #define IE_TDR_SHORT SWAP(0x1000) /* TDR detected a short */ 266 1.1 gwr #define IE_TDR_TIME SWAP(0x07ff) /* mask for reflection time */ 267 1.1 gwr 268 1.1 gwr /* 269 1.1 gwr * Initial Address Setup command 270 1.1 gwr */ 271 1.1 gwr struct ie_iasetup_cmd { 272 1.1 gwr struct ie_cmd_common com; 273 1.1 gwr #define ie_iasetup_status com.ie_cmd_status 274 1.1 gwr 275 1.1 gwr struct ie_en_addr ie_address; 276 1.1 gwr }; 277 1.1 gwr 278 1.1 gwr /* 279 1.1 gwr * Configuration command 280 1.1 gwr */ 281 1.1 gwr struct ie_config_cmd { 282 1.1 gwr struct ie_cmd_common com; /* common part */ 283 1.1 gwr #define ie_config_status com.ie_cmd_status 284 1.1 gwr 285 1.1 gwr u_char ie_config_count; /* byte count (0x0c) */ 286 1.1 gwr u_char ie_fifo; /* fifo (8) */ 287 1.1 gwr u_char ie_save_bad; /* save bad frames (0x40) */ 288 1.1 gwr u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */ 289 1.1 gwr u_char ie_priority; /* priority and backoff (0x0) */ 290 1.1 gwr u_char ie_ifs; /* inter-frame spacing (0x60) */ 291 1.1 gwr u_char ie_slot_low; /* slot time, LSB (0x0) */ 292 1.1 gwr u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */ 293 1.1 gwr u_char ie_promisc; /* 1 if promiscuous, else 0 */ 294 1.1 gwr u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */ 295 1.1 gwr u_char ie_min_len; /* min frame length (0x40) */ 296 1.1 gwr u_char ie_junk; /* stuff for 82596 (0xff) */ 297 1.1 gwr }; 298