if_aereg.h revision 1.1 1 /*
2 * National Semiconductor DS8390 NIC register definitions
3 *
4 * $Id: if_aereg.h,v 1.1 1993/11/29 00:32:46 briggs Exp $
5 *
6 * Modification history
7 *
8 * $Log: if_aereg.h,v $
9 * Revision 1.1 1993/11/29 00:32:46 briggs
10 * Update to current work in progress. This includes an update to
11 * use config.new.
12 * Numerous updates to console so it works better on the SE/30 screen.
13 * Some nice changes from Brad Parker for handling NuBUS and an ethernet
14 * driver that I haven't worked on, yet.
15 *
16 *
17 */
18
19 /*
20 * Page 0 register offsets
21 */
22 #define AE_P0_CR 0x00 /* Command Register */
23
24 #define AE_P0_CLDA0 0x01 /* Current Local DMA Addr low (read) */
25 #define AE_P0_PSTART 0x01 /* Page Start register (write) */
26
27 #define AE_P0_CLDA1 0x02 /* Current Local DMA Addr high (read) */
28 #define AE_P0_PSTOP 0x02 /* Page Stop register (write) */
29
30 #define AE_P0_BNRY 0x03 /* Boundary Pointer */
31
32 #define AE_P0_TSR 0x04 /* Transmit Status Register (read) */
33 #define AE_P0_TPSR 0x04 /* Transmit Page Start (write) */
34
35 #define AE_P0_NCR 0x05 /* Number of Collisions Reg (read) */
36 #define AE_P0_TBCR0 0x05 /* Transmit Byte count, low (write) */
37
38 #define AE_P0_FIFO 0x06 /* FIFO register (read) */
39 #define AE_P0_TBCR1 0x06 /* Transmit Byte count, high (write) */
40
41 #define AE_P0_ISR 0x07 /* Interrupt Status Register */
42
43 #define AE_P0_CRDA0 0x08 /* Current Remote DMA Addr low (read) */
44 #define AE_P0_RSAR0 0x08 /* Remote Start Address low (write) */
45
46 #define AE_P0_CRDA1 0x09 /* Current Remote DMA Addr high (read) */
47 #define AE_P0_RSAR1 0x09 /* Remote Start Address high (write) */
48
49 #define AE_P0_RBCR0 0x0a /* Remote Byte Count low (write) */
50
51 #define AE_P0_RBCR1 0x0b /* Remote Byte Count high (write) */
52
53 #define AE_P0_RSR 0x0c /* Receive Status (read) */
54 #define AE_P0_RCR 0x0c /* Receive Configuration Reg (write) */
55
56 #define AE_P0_CNTR0 0x0d /* frame alignment error counter (read) */
57 #define AE_P0_TCR 0x0d /* Transmit Configuration Reg (write) */
58
59 #define AE_P0_CNTR1 0x0e /* CRC error counter (read) */
60 #define AE_P0_DCR 0x0e /* Data Configuration Reg (write) */
61
62 #define AE_P0_CNTR2 0x0f /* missed packet counter (read) */
63 #define AE_P0_IMR 0x0f /* Interrupt Mask Register (write) */
64
65 /*
66 * Page 1 register offsets
67 */
68 #define AE_P1_CR 0x00 /* Command Register */
69 #define AE_P1_PAR0 0x01 /* Physical Address Register 0 */
70 #define AE_P1_PAR1 0x02 /* Physical Address Register 1 */
71 #define AE_P1_PAR2 0x03 /* Physical Address Register 2 */
72 #define AE_P1_PAR3 0x04 /* Physical Address Register 3 */
73 #define AE_P1_PAR4 0x05 /* Physical Address Register 4 */
74 #define AE_P1_PAR5 0x06 /* Physical Address Register 5 */
75 #define AE_P1_CURR 0x07 /* Current RX ring-buffer page */
76 #define AE_P1_MAR0 0x08 /* Multicast Address Register 0 */
77 #define AE_P1_MAR1 0x09 /* Multicast Address Register 1 */
78 #define AE_P1_MAR2 0x0a /* Multicast Address Register 2 */
79 #define AE_P1_MAR3 0x0b /* Multicast Address Register 3 */
80 #define AE_P1_MAR4 0x0c /* Multicast Address Register 4 */
81 #define AE_P1_MAR5 0x0d /* Multicast Address Register 5 */
82 #define AE_P1_MAR6 0x0e /* Multicast Address Register 6 */
83 #define AE_P1_MAR7 0x0f /* Multicast Address Register 7 */
84
85 /*
86 * Page 2 register offsets
87 */
88 #define AE_P2_CR 0x00 /* Command Register */
89 #define AE_P2_PSTART 0x01 /* Page Start (read) */
90 #define AE_P2_CLDA0 0x01 /* Current Local DMA Addr 0 (write) */
91 #define AE_P2_PSTOP 0x02 /* Page Stop (read) */
92 #define AE_P2_CLDA1 0x02 /* Current Local DMA Addr 1 (write) */
93 #define AE_P2_RNPP 0x03 /* Remote Next Packet Pointer */
94 #define AE_P2_TPSR 0x04 /* Transmit Page Start (read) */
95 #define AE_P2_LNPP 0x05 /* Local Next Packet Pointer */
96 #define AE_P2_ACU 0x06 /* Address Counter Upper */
97 #define AE_P2_ACL 0x07 /* Address Counter Lower */
98 #define AE_P2_RCR 0x0c /* Receive Configuration Register (read) */
99 #define AE_P2_TCR 0x0d /* Transmit Configuration Register (read) */
100 #define AE_P2_DCR 0x0e /* Data Configuration Register (read) */
101 #define AE_P2_IMR 0x0f /* Interrupt Mask Register (read) */
102
103 /*
104 * Command Register (CR) definitions
105 */
106
107 /*
108 * STP: SToP. Software reset command. Takes the controller offline. No
109 * packets will be received or transmitted. Any reception or
110 * transmission in progress will continue to completion before
111 * entering reset state. To exit this state, the STP bit must
112 * reset and the STA bit must be set. The software reset has
113 * executed only when indicated by the RST bit in the ISR being
114 * set.
115 */
116 #define AE_CR_STP 0x01
117
118 /*
119 * STA: STArt. This bit is used to activate the NIC after either power-up,
120 * or when the NIC has been put in reset mode by software command
121 * or error.
122 */
123 #define AE_CR_STA 0x02
124
125 /*
126 * TXP: Transmit Packet. This bit must be set to indicate transmission of
127 * a packet. TXP is internally reset either after the transmission is
128 * completed or aborted. This bit should be set only after the Transmit
129 * Byte Count and Transmit Page Start register have been programmed.
130 */
131 #define AE_CR_TXP 0x04
132
133 /*
134 * RD0, RD1, RD2: Remote DMA Command. These three bits control the operation
135 * of the remote DMA channel. RD2 can be set to abort any remote DMA
136 * command in progress. The Remote Byte Count registers should be cleared
137 * when a remote DMA has been aborted. The Remote Start Addresses are not
138 * restored to the starting address if the remote DMA is aborted.
139 *
140 * RD2 RD1 RD0 function
141 * 0 0 0 not allowed
142 * 0 0 1 remote read
143 * 0 1 0 remote write
144 * 0 1 1 send packet
145 * 1 X X abort
146 */
147 #define AE_CR_RD0 0x08
148 #define AE_CR_RD1 0x10
149 #define AE_CR_RD2 0x20
150
151 /*
152 * PS0, PS1: Page Select. The two bits select which register set or 'page' to
153 * access.
154 *
155 * PS1 PS0 page
156 * 0 0 0
157 * 0 1 1
158 * 1 0 2
159 * 1 1 reserved
160 */
161 #define AE_CR_PS0 0x40
162 #define AE_CR_PS1 0x80
163 /* bit encoded aliases */
164 #define AE_CR_PAGE_0 0x00 /* (for consistency) */
165 #define AE_CR_PAGE_1 0x40
166 #define AE_CR_PAGE_2 0x80
167
168 /*
169 * Interrupt Status Register (ISR) definitions
170 */
171
172 /*
173 * PRX: Packet Received. Indicates packet received with no errors.
174 */
175 #define AE_ISR_PRX 0x01
176
177 /*
178 * PTX: Packet Transmitted. Indicates packet transmitted with no errors.
179 */
180 #define AE_ISR_PTX 0x02
181
182 /*
183 * RXE: Receive Error. Indicates that a packet was received with one or more
184 * the following errors: CRC error, frame alignment error, FIFO overrun,
185 * missed packet.
186 */
187 #define AE_ISR_RXE 0x04
188
189 /*
190 * TXE: Transmission Error. Indicates that an attempt to transmit a packet
191 * resulted in one or more of the following errors: excessive
192 * collisions, FIFO underrun.
193 */
194 #define AE_ISR_TXE 0x08
195
196 /*
197 * OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network
198 * would exceed (has exceeded?) the boundry pointer, resulting in data
199 * that was previously received and not yet read from the buffer to be
200 * overwritten.
201 */
202 #define AE_ISR_OVW 0x10
203
204 /*
205 * CNT: Counter Overflow. Set when the MSB of one or more of the Network Talley
206 * Counters has been set.
207 */
208 #define AE_ISR_CNT 0x20
209
210 /*
211 * RDC: Remote Data Complete. Indicates that a Remote DMA operation has completed.
212 */
213 #define AE_ISR_RDC 0x40
214
215 /*
216 * RST: Reset status. Set when the NIC enters the reset state and cleared when a
217 * Start Command is issued to the CR. This bit is also set when a receive
218 * ring-buffer overrun (OverWrite) occurs and is cleared when one or more
219 * packets have been removed from the ring. This is a read-only bit.
220 */
221 #define AE_ISR_RST 0x80
222
223 /*
224 * Interrupt Mask Register (IMR) definitions
225 */
226
227 /*
228 * PRXE: Packet Received interrupt Enable. If set, a received packet will cause
229 * an interrupt.
230 */
231 #define AE_IMR_PRXE 0x01
232
233 /*
234 * PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated when
235 * a packet transmission completes.
236 */
237 #define AE_IMR_PTXE 0x02
238
239 /*
240 * RXEE: Receive Error interrupt Enable. If set, an interrupt will occur whenever a
241 * packet is received with an error.
242 */
243 #define AE_IMR_RXEE 0x04
244
245 /*
246 * TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur whenever
247 * a transmission results in an error.
248 */
249 #define AE_IMR_TXEE 0x08
250
251 /*
252 * OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated whenever
253 * the receive ring-buffer is overrun. i.e. when the boundry pointer is exceeded.
254 */
255 #define AE_IMR_OVWE 0x10
256
257 /*
258 * CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated whenever
259 * the MSB of one or more of the Network Statistics counters has been set.
260 */
261 #define AE_IMR_CNTE 0x20
262
263 /*
264 * RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is generated
265 * when a remote DMA transfer has completed.
266 */
267 #define AE_IMR_RDCE 0x40
268
269 /*
270 * bit 7 is unused/reserved
271 */
272
273 /*
274 * Data Configuration Register (DCR) definitions
275 */
276
277 /*
278 * WTS: Word Transfer Select. WTS establishes byte or word transfers for
279 * both remote and local DMA transfers
280 */
281 #define AE_DCR_WTS 0x01
282
283 /*
284 * BOS: Byte Order Select. BOS sets the byte order for the host.
285 * Should be 0 for 80x86, and 1 for 68000 series processors
286 */
287 #define AE_DCR_BOS 0x02
288
289 /*
290 * LAS: Long Address Select. When LAS is 1, the contents of the remote
291 * DMA registers RSAR0 and RSAR1 are used to provide A16-A31
292 */
293 #define AE_DCR_LAS 0x04
294
295 #ifdef huh
296 /*
297 * LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2
298 * of the TCR must also be programmed for loopback operation.
299 * When 1, normal operation is selected.
300 */
301 #define AE_DCR_LS 0x08
302 #endif
303 /*
304 * BMS: Burst Mode Select
305 */
306 #define AE_DCR_BMS 0x08
307
308 /*
309 * AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer
310 * under program control. When 1, remote DMA is automatically initiated
311 * and the boundry pointer is automatically updated
312 */
313 #define AE_DCR_AR 0x10
314
315 /*
316 * FT0, FT1: Fifo Threshold select.
317 * FT1 FT0 Word-width Byte-width
318 * 0 0 1 word 2 bytes
319 * 0 1 2 words 4 bytes
320 * 1 0 4 words 8 bytes
321 * 1 1 8 words 12 bytes
322 *
323 * During transmission, the FIFO threshold indicates the number of bytes
324 * or words that the FIFO has filled from the local DMA before BREQ is
325 * asserted. The transmission threshold is 16 bytes minus the receiver
326 * threshold.
327 */
328 #define AE_DCR_FT0 0x20
329 #define AE_DCR_FT1 0x40
330
331 /*
332 * bit 7 (0x80) is unused/reserved
333 */
334
335 /*
336 * Transmit Configuration Register (TCR) definitions
337 */
338
339 /*
340 * CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC
341 * is not appended by the transmitter.
342 */
343 #define AE_TCR_CRC 0x01
344
345 /*
346 * LB0, LB1: Loopback control. These two bits set the type of loopback that is
347 * to be performed.
348 *
349 * LB1 LB0 mode
350 * 0 0 0 - normal operation (DCR_LS = 0)
351 * 0 1 1 - internal loopback (DCR_LS = 0)
352 * 1 0 2 - external loopback (DCR_LS = 1)
353 * 1 1 3 - external loopback (DCR_LS = 0)
354 */
355 #define AE_TCR_LB0 0x02
356 #define AE_TCR_LB1 0x04
357
358 /*
359 * ATD: Auto Transmit Disable. Clear for normal operation. When set, allows
360 * another station to disable the NIC's transmitter by transmitting to
361 * a multicast address hashing to bit 62. Reception of a multicast address
362 * hashing to bit 63 enables the transmitter.
363 */
364 #define AE_TCR_ATD 0x08
365
366 /*
367 * OFST: Collision Offset enable. This bit when set modifies the backoff
368 * algorithm to allow prioritization of nodes.
369 */
370 #define AE_TCR_OFST 0x10
371
372 /*
373 * bits 5, 6, and 7 are unused/reserved
374 */
375
376 /*
377 * Transmit Status Register (TSR) definitions
378 */
379
380 /*
381 * PTX: Packet Transmitted. Indicates successful transmission of packet.
382 */
383 #define AE_TSR_PTX 0x01
384
385 /*
386 * bit 1 (0x02) is unused/reserved
387 */
388
389 /*
390 * COL: Transmit Collided. Indicates that the transmission collided at least
391 * once with another station on the network.
392 */
393 #define AE_TSR_COL 0x04
394
395 /*
396 * ABT: Transmit aborted. Indicates that the transmission was aborted due to
397 * excessive collisions.
398 */
399 #define AE_TSR_ABT 0x08
400
401 /*
402 * CRS: Carrier Sense Lost. Indicates that carrier was lost during the
403 * transmission of the packet. (Transmission is not aborted because
404 * of a loss of carrier)
405 */
406 #define AE_TSR_CRS 0x10
407
408 /*
409 * FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/
410 * transmission memory before the FIFO emptied. Transmission of the
411 * packet was aborted.
412 */
413 #define AE_TSR_FU 0x20
414
415 /*
416 * CDH: CD Heartbeat. Indicates that the collision detection circuitry
417 * isn't working correctly during a collision heartbeat test.
418 */
419 #define AE_TSR_CDH 0x40
420
421 /*
422 * OWC: Out of Window Collision: Indicates that a collision occurred after
423 * a slot time (51.2us). The transmission is rescheduled just as in
424 * normal collisions.
425 */
426 #define AE_TSR_OWC 0x80
427
428 /*
429 * Receiver Configuration Register (RCR) definitions
430 */
431
432 /*
433 * SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1,
434 * packets with CRC and frame errors are not discarded.
435 */
436 #define AE_RCR_SEP 0x01
437
438 /*
439 * AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded.
440 * If set to 1, packets with less than 64 byte are not discarded.
441 */
442 #define AE_RCR_AR 0x02
443
444 /*
445 * AB: Accept Broadcast. If set, packets sent to the broadcast address will be
446 * accepted.
447 */
448 #define AE_RCR_AB 0x04
449
450 /*
451 * AM: Accept Multicast. If set, packets sent to a multicast address are checked
452 * for a match in the hashing array. If clear, multicast packets are ignored.
453 */
454 #define AE_RCR_AM 0x08
455
456 /*
457 * PRO: Promiscuous Physical. If set, all packets with a physical addresses are
458 * accepted. If clear, a physical destination address must match this
459 * station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM
460 * must also be set. In addition, the multicast hashing array must be set
461 * to all 1's so that all multicast addresses are accepted.
462 */
463 #define AE_RCR_PRO 0x10
464
465 /*
466 * MON: Monitor Mode. If set, packets will be checked for good CRC and framing,
467 * but are not stored in the ring-buffer. If clear, packets are stored (normal
468 * operation).
469 */
470 #define AE_RCR_MON 0x20
471
472 /*
473 * bits 6 and 7 are unused/reserved.
474 */
475
476 /*
477 * Receiver Status Register (RSR) definitions
478 */
479
480 /*
481 * PRX: Packet Received without error.
482 */
483 #define AE_RSR_PRX 0x01
484
485 /*
486 * CRC: CRC error. Indicates that a packet has a CRC error. Also set for frame
487 * alignment errors.
488 */
489 #define AE_RSR_CRC 0x02
490
491 /*
492 * FAE: Frame Alignment Error. Indicates that the incoming packet did not end on
493 * a byte boundry and the CRC did not match at the last byte boundry.
494 */
495 #define AE_RSR_FAE 0x04
496
497 /*
498 * FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local DMA)
499 * causing it to overrun. Reception of the packet is aborted.
500 */
501 #define AE_RSR_FO 0x08
502
503 /*
504 * MPA: Missed Packet. Indicates that the received packet couldn't be stored in
505 * the ring-buffer because of insufficient buffer space (exceeding the
506 * boundry pointer), or because the transfer to the ring-buffer was inhibited
507 * by RCR_MON - monitor mode.
508 */
509 #define AE_RSR_MPA 0x10
510
511 /*
512 * PHY: Physical address. If 0, the packet received was sent to a physical address.
513 * If 1, the packet was accepted because of a multicast/broadcast address
514 * match.
515 */
516 #define AE_RSR_PHY 0x20
517
518 /*
519 * DIS: Receiver Disabled. Set to indicate that the receiver has enetered monitor
520 * mode. Cleared when the receiver exits monitor mode.
521 */
522 #define AE_RSR_DIS 0x40
523
524 /*
525 * DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL inputs
526 * are active, and the transceiver has set the CD line as a result of the
527 * jabber.
528 */
529 #define AE_RSR_DFR 0x80
530
531 /*
532 * receive ring discriptor
533 *
534 * The National Semiconductor DS8390 Network interface controller uses
535 * the following receive ring headers. The way this works is that the
536 * memory on the interface card is chopped up into 256 bytes blocks.
537 * A contiguous portion of those blocks are marked for receive packets
538 * by setting start and end block #'s in the NIC. For each packet that
539 * is put into the receive ring, one of these headers (4 bytes each) is
540 * tacked onto the front.
541 */
542 struct ae_ring {
543 u_char rcv_status; /* received packet status */
544 u_char next_packet; /* pointer to next packet */
545 u_char count[2]; /* bytes in packet (length + 4) */
546 };
547
548 /*
549 * Common constants
550 */
551 #define AE_PAGE_SIZE 256 /* Size of RAM pages in bytes */
552 #define AE_TXBUF_SIZE 6 /* Size of TX buffer in pages */
553
554 /*
555 * Vendor types
556 */
557 #define AE_VENDOR_APPLE 0x00 /* Apple Ethernet card */
558 #define AE_VENDOR_INTERLAN 0x01 /* Interlan A310 card (GatorCard) */
559
560 /*
561 * Compile-time config flags
562 */
563 /*
564 * this sets the default for enabling/disablng the tranceiver
565 */
566 #define AE_FLAGS_DISABLE_TRANCEIVER 0x01
567
568 /*
569 * This disables the use of double transmit buffers.
570 */
571 #define AE_FLAGS_NO_DOUBLE_BUFFERING 0x08
572
573 /* */
574 #define GC_RESET_OFFSET 0x000c0000 /* writes here reset NIC */
575 #define GC_ROM_OFFSET 0x000c0000 /* address prom */
576 #define GC_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */
577 #define GC_NIC_OFFSET 0x000e0000 /* Offset to NIC registers */
578
579 #define AE_ROM_OFFSET 0x000f0000
580 #define AE_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */
581 #define AE_NIC_OFFSET 0x000e0000 /* Offset to NIC registers */
582