|
|
1.1 root 1: /*-
2: * Copyright (c) 1991 The Regents of the University of California.
3: * All rights reserved.
4: *
5: * This code is derived from software contributed to Berkeley by
6: * Tim L. Tucker.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
1.1.1.4 ! root 36: * from: @(#)if_wereg.h 7.1 (Berkeley) 5/9/91
! 37: * if_wereg.h,v 1.5 1993/05/22 08:01:25 cgd Exp
1.1 root 38: */
39:
40: /*
41: * Western Digital 8003 ethernet/starlan adapter
42: */
43:
44: /*
45: * Memory Select Register (MSR)
46: */
47: union we_mem_sel {
48: struct memory_decode {
49: u_char msd_addr:6, /* Memory decode bits */
50: msd_enable:1, /* Memory (RAM) enable */
51: msd_reset:1; /* Software reset */
52: } msd_decode;
53: #define ms_addr msd_decode.msd_addr
54: #define ms_enable msd_decode.msd_enable
55: #define ms_reset msd_decode.msd_reset
56: u_char ms_byte; /* entire byte */
57: };
58:
59: /*
1.1.1.3 root 60: * LA Address Register (LAAR)
61: */
62: union we_laar {
63: struct lan_addr_reg {
64: u_char addr_l19_b:1, /* Address Line 19 for enabling */
65: /* 16 bit NIC access to shared RAM */
66: unused_b:5, /* unused (or unknown) bits */
67: lan_16_en_b:1, /* Enables 16bit shrd RAM for LAN */
68: mem_16_en_b:1; /* Enables 16bit shrd RAM for host */
69: } laar_decode;
70: #define addr_l19 laar_decode.addr_l19_b
71: #define lan_16_en laar_decode.lan_16_en_b
72: #define mem_16_en laar_decode.mem_16_en_b
73: u_char laar_byte; /* entire byte */
74: };
75:
76: /*
1.1 root 77: * receive ring discriptor
78: *
79: * The National Semiconductor DS8390 Network interface controller uses
80: * the following receive ring headers. The way this works is that the
81: * memory on the interface card is chopped up into 256 bytes blocks.
82: * A contiguous portion of those blocks are marked for receive packets
83: * by setting start and end block #'s in the NIC. For each packet that
84: * is put into the receive ring, one of these headers (4 bytes each) is
85: * tacked onto the front.
86: */
87: struct we_ring {
88: struct wer_status { /* received packet status */
89: u_char rs_prx:1, /* packet received intack */
90: rs_crc:1, /* crc error */
91: rs_fae:1, /* frame alignment error */
92: rs_fo:1, /* fifo overrun */
93: rs_mpa:1, /* packet received intack */
94: rs_phy:1, /* packet received intack */
95: rs_dis:1, /* packet received intack */
96: rs_dfr:1; /* packet received intack */
97: } we_rcv_status; /* received packet status */
98: u_char we_next_packet; /* pointer to next packet */
99: u_short we_count; /* bytes in packet (length + 4) */
100: };
101:
102: /*
103: * Command word definition
104: */
105: union we_command {
106: struct command_decode {
107: u_char csd_stp:1, /* STOP! */
108: csd_sta:1, /* START! */
109: csd_txp:1, /* Transmit packet */
110: csd_rd:3, /* Remote DMA command */
111: csd_ps:2; /* Page select */
112: } csd_decode;
113: #define cs_stp csd_decode.csd_stp
114: #define cs_sta csd_decode.csd_sta
115: #define cs_txp csd_decode.csd_txp
116: #define cs_rd csd_decode.csd_rd
117: #define cs_ps csd_decode.csd_ps
118: u_char cs_byte; /* entire command byte */
119: };
120:
121: /*
122: * Interrupt status definition
123: */
124: union we_interrupt {
125: struct interrupt_decode {
126: u_char isd_prx:1, /* Packet received */
127: isd_ptx:1, /* Packet transmitted */
128: isd_rxe:1, /* Receive error */
129: isd_txe:1, /* Transmit error */
130: isd_ovw:1, /* Overwrite warning */
131: isd_cnt:1, /* Counter overflow */
132: isd_rdc:1, /* Remote DMA complete */
133: isd_rst:1; /* Reset status */
134: } isd_decode;
135: #define is_prx isd_decode.isd_prx
136: #define is_ptx isd_decode.isd_ptx
137: #define is_rxe isd_decode.isd_rxe
138: #define is_txe isd_decode.isd_txe
139: #define is_ovw isd_decode.isd_ovw
140: #define is_cnt isd_decode.isd_cnt
141: #define is_rdc isd_decode.isd_rdc
142: #define is_rst isd_decode.isd_rst
143: u_char is_byte; /* entire interrupt byte */
144: };
145:
146: /*
147: * Status word definition (transmit)
148: */
149: union wet_status {
150: struct tstat {
151: u_char tsd_ptx:1, /* Packet transmitted intack */
152: tsd_dfr:1, /* Non deferred transmition */
153: tsd_col:1, /* Transmit Collided */
154: tsd_abt:1, /* Transmit Aborted (coll > 16) */
155: tsd_crs:1, /* Carrier Sense Lost */
156: tsd_fu:1, /* Fifo Underrun */
157: tsd_chd:1, /* CD Heartbeat */
158: tsd_owc:1; /* Out of Window Collision */
159: } tsd_decode;
160: #define ts_ptx tsd_decode.tsd_ptx
161: #define ts_dfr tsd_decode.tsd_dfr
162: #define ts_col tsd_decode.tsd_col
163: #define ts_abt tsd_decode.tsd_abt
164: #define ts_crs tsd_decode.tsd_crs
165: #define ts_fu tsd_decode.tsd_fu
166: #define ts_chd tsd_decode.tsd_chd
167: #define ts_owc tsd_decode.tsd_owc
168: u_char ts_byte; /* entire transmit byte */
169: };
170:
171: /*
172: * General constant definitions
173: */
1.1.1.2 root 174:
175: /* Bits in the REGE register */
176: #define WD_MICROCHANEL 0x80 /* Microchannel bus (vs. isa) */
177: #define WD_LARGERAM 0x40 /* Large RAM */
178: #define WD_SOFTCONFIG 0x20 /* Soft config */
179: #define WD_REVMASK 0x1e /* Revision mask */
180: #define WD_ETHERNET 0x01 /* Ethernet (vs. Starlan) */
181:
1.1 root 182: #define WD_CHECKSUM 0xFF /* Checksum byte */
183: #define WD_PAGE_SIZE 256 /* Size of RAM pages in bytes */
184: #define WD_TXBUF_SIZE 6 /* Size of TX buffer in pages */
185: #define WD_ROM_OFFSET 8 /* i/o base offset to ROM */
186: #define WD_IO_PORTS 32 /* # of i/o addresses used */
187: #define WD_NIC_OFFSET 16 /* i/o base offset to NIC */
188:
189: /*
190: * Page register offset values
191: */
192: #define WD_P0_COMMAND 0x00 /* Command register */
193: #define WD_P0_PSTART 0x01 /* Page Start register */
194: #define WD_P0_PSTOP 0x02 /* Page Stop register */
195: #define WD_P0_BNRY 0x03 /* Boundary Pointer */
196: #define WD_P0_TSR 0x04 /* Transmit Status (read-only) */
197: #define WD_P0_TPSR WD_P0_TSR /* Transmit Page (write-only) */
198: #define WD_P0_TBCR0 0x05 /* Transmit Byte count, low WO */
199: #define WD_P0_TBCR1 0x06 /* Transmit Byte count, high WO */
200: #define WD_P0_ISR 0x07 /* Interrupt status register */
201: #define WD_P0_RBCR0 0x0A /* Remote byte count low WO */
202: #define WD_P0_RBCR1 0x0B /* Remote byte count high WO */
203: #define WD_P0_RSR 0x0C /* Receive status RO */
204: #define WD_P0_RCR WD_P0_RSR /* Receive configuration WO */
205: #define WD_P0_TCR 0x0D /* Transmit configuration WO */
206: #define WD_P0_DCR 0x0E /* Data configuration WO */
207: #define WD_P0_IMR 0x0F /* Interrupt masks WO */
208: #define WD_P1_COMMAND 0x00 /* Command register */
209: #define WD_P1_PAR0 0x01 /* Physical address register 0 */
210: #define WD_P1_PAR1 0x02 /* Physical address register 1 */
211: #define WD_P1_PAR2 0x03 /* Physical address register 2 */
212: #define WD_P1_PAR3 0x04 /* Physical address register 3 */
213: #define WD_P1_PAR4 0x05 /* Physical address register 4 */
214: #define WD_P1_PAR5 0x06 /* Physical address register 5 */
215: #define WD_P1_CURR 0x07 /* Current page (receive unit) */
216: #define WD_P1_MAR0 0x08 /* Multicast address register 0 */
217:
218: /*
219: * Configuration constants (receive unit)
220: */
221: #define WD_R_SEP 0x01 /* Save error packets */
222: #define WD_R_AR 0x02 /* Accept Runt packets */
223: #define WD_R_AB 0x04 /* Accept Broadcast packets */
224: #define WD_R_AM 0x08 /* Accept Multicast packets */
225: #define WD_R_PRO 0x10 /* Promiscuous physical */
226: #define WD_R_MON 0x20 /* Monitor mode */
227: #define WD_R_RES1 0x40 /* reserved... */
228: #define WD_R_RES2 0x80 /* reserved... */
1.1.1.4 ! root 229: #ifdef ISO
! 230: /* Quick and dirty hack to enable reception of IS Hello packets */
! 231: /* This probably isn't the right way to do this... */
! 232: #define WD_R_CONFIG (WD_R_AB|WD_R_AM)
! 233: #else
1.1 root 234: #define WD_R_CONFIG (WD_R_AB)
1.1.1.4 ! root 235: #endif /* ISO */
1.1 root 236:
237: /*
238: * Configuration constants (transmit unit)
239: */
240: #define WD_T_CRC 0x01 /* Inhibit CRC */
241: #define WD_T_LB0 0x02 /* Encoded Loopback Control */
242: #define WD_T_LB1 0x04 /* Encoded Loopback Control */
243: #define WD_T_ATD 0x08 /* Auto Transmit Disable */
244: #define WD_T_OFST 0x10 /* Collision Offset Enable */
245: #define WD_T_RES1 0x20 /* reserved... */
246: #define WD_T_RES2 0x40 /* reserved... */
247: #define WD_T_RES3 0x80 /* reserved... */
248: #define WD_T_CONFIG (0)
249:
250: /*
251: * Configuration constants (data unit)
252: */
253: #define WD_D_WTS 0x01 /* Word Transfer Select */
254: #define WD_D_BOS 0x02 /* Byte Order Select */
255: #define WD_D_LAS 0x04 /* Long Address Select */
256: #define WD_D_BMS 0x08 /* Burst Mode Select */
257: #define WD_D_AR 0x10 /* Autoinitialize Remote */
258: #define WD_D_FT0 0x20 /* Fifo Threshold Select */
259: #define WD_D_FT1 0x40 /* Fifo Threshold Select */
260: #define WD_D_RES 0x80 /* reserved... */
261: #define WD_D_CONFIG (WD_D_FT1|WD_D_BMS)
1.1.1.3 root 262: #define WD_D_CONFIG16 (WD_D_FT1|WD_D_BMS|WD_D_LAS|WD_D_WTS)
1.1 root 263:
264: /*
265: * Configuration constants (interrupt mask register)
266: */
267: #define WD_I_PRXE 0x01 /* Packet received enable */
268: #define WD_I_PTXE 0x02 /* Packet transmitted enable */
269: #define WD_I_RXEE 0x04 /* Receive error enable */
270: #define WD_I_TXEE 0x08 /* Transmit error enable */
271: #define WD_I_OVWE 0x10 /* Overwrite warning enable */
272: #define WD_I_CNTE 0x20 /* Counter overflow enable */
273: #define WD_I_RDCE 0x40 /* Dma complete enable */
274: #define WD_I_RES 0x80 /* reserved... */
275: #define WD_I_CONFIG (WD_I_PRXE|WD_I_PTXE|WD_I_RXEE|WD_I_TXEE)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.