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