1 /* 2 * Copyright (c) 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Digital Equipment Corp. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the University of California, Berkeley. The name of the 14 * University may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * 20 * @(#)if_qereg.h 7.2 (Berkeley) 08/04/88 21 */ 22 23 /* @(#)if_qereg.h 1.2 (ULTRIX) 1/3/85 */ 24 25 /**************************************************************** 26 * * 27 * Licensed from Digital Equipment Corporation * 28 * Copyright (c) * 29 * Digital Equipment Corporation * 30 * Maynard, Massachusetts * 31 * 1985, 1986 * 32 * All rights reserved. * 33 * * 34 * The Information in this software is subject to change * 35 * without notice and should not be construed as a commitment * 36 * by Digital Equipment Corporation. Digital makes no * 37 * representations about the suitability of this software for * 38 * any purpose. It is supplied "As Is" without expressed or * 39 * implied warranty. * 40 * * 41 * If the Regents of the University of California or its * 42 * licensees modify the software in a manner creating * 43 * diriviative copyright rights, appropriate copyright * 44 * legends may be placed on the drivative work in addition * 45 * to that set forth above. * 46 * * 47 ****************************************************************/ 48 /* --------------------------------------------------------------------- 49 * Modification History 50 * 51 * 13 Feb. 84 -- rjl 52 * 53 * Initial version of driver. derived from IL driver. 54 * 55 * --------------------------------------------------------------------- 56 */ 57 58 /* 59 * Digital Q-BUS to NI Adapter 60 */ 61 struct qedevice { 62 u_short qe_sta_addr[2]; /* Station address (actually 6 */ 63 u_short qe_rcvlist_lo; /* Receive list lo address */ 64 u_short qe_rcvlist_hi; /* Receive list hi address */ 65 u_short qe_xmtlist_lo; /* Transmit list lo address */ 66 u_short qe_xmtlist_hi; /* Transmit list hi address */ 67 u_short qe_vector; /* Interrupt vector */ 68 u_short qe_csr; /* Command and Status Register */ 69 }; 70 71 /* 72 * Command and status bits (csr) 73 */ 74 #define QE_RCV_ENABLE 0x0001 /* Receiver enable */ 75 #define QE_RESET 0x0002 /* Software reset */ 76 #define QE_NEX_MEM_INT 0x0004 /* Non existant mem interrupt */ 77 #define QE_LOAD_ROM 0x0008 /* Load boot/diag from rom */ 78 #define QE_XL_INVALID 0x0010 /* Transmit list invalid */ 79 #define QE_RL_INVALID 0x0020 /* Receive list invalid */ 80 #define QE_INT_ENABLE 0x0040 /* Interrupt enable */ 81 #define QE_XMIT_INT 0x0080 /* Transmit interrupt */ 82 #define QE_ILOOP 0x0100 /* Internal loopback */ 83 #define QE_ELOOP 0x0200 /* External loopback */ 84 #define QE_STIM_ENABLE 0x0400 /* Sanity timer enable */ 85 #define QE_POWERUP 0x1000 /* Tranceiver power on */ 86 #define QE_CARRIER 0x2000 /* Carrier detect */ 87 #define QE_RCV_INT 0x8000 /* Receiver interrupt */ 88 89 /* 90 * Transmit and receive ring discriptor --------------------------- 91 * 92 * The QNA uses the flag, status1 and the valid bit as a handshake/semiphore 93 * mechinism. 94 * 95 * The flag word is written on ( bits 15,15 set to 1 ) when it reads the 96 * descriptor. If the valid bit is set it considers the address to be valid. 97 * When it uses the buffer pointed to by the valid address it sets status word 98 * one. 99 */ 100 struct qe_ring { 101 u_short qe_flag; /* Buffer utilization flags */ 102 u_short qe_addr_hi:6, /* Hi order bits of buffer addr */ 103 qe_odd_begin:1, /* Odd byte begin and end (xmit)*/ 104 qe_odd_end:1, 105 qe_fill1:4, 106 qe_setup:1, /* Setup packet */ 107 qe_eomsg:1, /* End of message flag */ 108 qe_chain:1, /* Chain address instead of buf */ 109 qe_valid:1; /* Address field is valid */ 110 u_short qe_addr_lo; /* Low order bits of address */ 111 short qe_buf_len; /* Negative buffer length */ 112 u_short qe_status1; /* Status word one */ 113 u_short qe_status2; /* Status word two */ 114 }; 115 116 /* 117 * Status word definations (receive) 118 * word1 119 */ 120 #define QE_OVF 0x0001 /* Receiver overflow */ 121 #define QE_CRCERR 0x0002 /* CRC error */ 122 #define QE_FRAME 0x0004 /* Framing alignment error */ 123 #define QE_SHORT 0x0008 /* Packet size < 10 bytes */ 124 #define QE_RBL_HI 0x0700 /* Hi bits of receive len */ 125 #define QE_RUNT 0x0800 /* Runt packet */ 126 #define QE_DISCARD 0x1000 /* Discard the packet */ 127 #define QE_ESETUP 0x2000 /* Looped back setup or eloop */ 128 #define QE_ERROR 0x4000 /* Receiver error */ 129 #define QE_LASTNOT 0x8000 /* Not the last in the packet */ 130 /* word2 */ 131 #define QE_RBL_LO 0x00ff /* Low bits of receive len */ 132 133 /* 134 * Status word definations (transmit) 135 * word1 136 */ 137 #define QE_CCNT 0x00f0 /* Collision count this packet */ 138 #define QE_FAIL 0x0100 /* Heart beat check failure */ 139 #define QE_ABORT 0x0200 /* Transmission abort */ 140 #define QE_STE16 0x0400 /* Sanity timer default on */ 141 #define QE_NOCAR 0x0800 /* No carrier */ 142 #define QE_LOSS 0x1000 /* Loss of carrier while xmit */ 143 /* word2 */ 144 #define QE_TDR 0x3fff /* Time domain reflectometry */ 145 146 /* 147 * General constant definations 148 */ 149 #define QEALLOC 0 /* Allocate an mbuf */ 150 #define QENOALLOC 1 /* No mbuf allocation */ 151 #define QEDEALLOC 2 /* Release an mbuf chain */ 152 153 #define QE_NOTYET 0x8000 /* Descriptor not in use yet */ 154 #define QE_INUSE 0x4000 /* Descriptor being used by QNA */ 155 #define QE_MASK 0xc000 /* Lastnot/error/used mask */ 156