xref: /openbsd/sys/arch/luna88k/stand/boot/lance.h (revision d415bd75)
1 /*	$OpenBSD: lance.h,v 1.1 2013/10/28 22:13:12 miod Exp $	*/
2 /*	$NetBSD: lance.h,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
3 
4 /*-
5  * Copyright (c) 1982, 1992, 1993
6  *	The Regents of the University of California.  All rights reserved.
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. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * @(#)if_lereg.h	8.2 (Berkeley) 10/30/93
33  */
34 
35 #define	LEMTU		1518
36 #define	LEMINSIZE	60	/* should be 64 if mode DTCR is set */
37 #define	LERBUF		8
38 #define	LERBUFLOG2	3
39 #define	LE_RLEN		(LERBUFLOG2 << 13)
40 #define	LE_NEXTRMD(x)	(((x) + 1) & (LERBUF - 1))
41 #define	LETBUF		1
42 #define	LETBUFLOG2	0
43 #define	LE_TLEN		(LETBUFLOG2 << 13)
44 #define	LE_NEXTTMD(x)	(((x) + 1) & (LETBUF - 1))
45 
46 /* Local Area Network Controller for Ethernet (LANCE) registers */
47 struct lereg {
48 	volatile uint16_t	ler_rdp;	/* register data port */
49 	uint16_t unused;
50 	volatile uint16_t	ler_rap;	/* register address port */
51 };
52 
53 /*
54  * lance memory
55  */
56 
57 /* receive message descriptors. bits/hadr are byte order dependent. */
58 struct	lermd_v {
59 	volatile uint16_t rmd0;		/* low address of packet */
60 #if BYTE_ORDER == BIG_ENDIAN
61 	volatile uint8_t  rmd1_bits;	/* descriptor bits */
62 	volatile uint8_t  rmd1_hadr;	/* high address of packet */
63 #else
64 	volatile uint8_t  rmd1_hadr;	/* high address of packet */
65 	volatile uint8_t  rmd1_bits;	/* descriptor bits */
66 #endif
67 	volatile int16_t  rmd2;		/* buffer byte count */
68 	volatile uint16_t rmd3;		/* message byte count */
69 };
70 
71 /* transmit message descriptors */
72 struct	letmd_v {
73 	volatile uint16_t tmd0;		/* low address of packet */
74 #if BYTE_ORDER == BIG_ENDIAN
75 	volatile uint8_t  tmd1_bits;	/* descriptor bits */
76 	volatile uint8_t  tmd1_hadr;	/* high address of packet */
77 #else
78 	volatile uint8_t  tmd1_hadr;	/* high address of packet */
79 	volatile uint8_t  tmd1_bits;	/* descriptor bits */
80 #endif
81 	volatile int16_t  tmd2;		/* buffer byte count */
82 	volatile uint16_t tmd3;		/* transmit error bits */
83 };
84 
85 struct lemem {
86 	/* initialization block */
87 	volatile uint16_t	lem_mode;	/* mode */
88 	volatile uint16_t	lem_padr[3];	/* physical address */
89 	volatile uint16_t	lem_ladrf[4];	/* logical address filter */
90 	volatile uint16_t	lem_rdra;	/* receive descriptor addr */
91 	volatile uint16_t	lem_rlen;	/* rda high and ring size */
92 	volatile uint16_t	lem_tdra;	/* transmit descriptor addr */
93 	volatile uint16_t	lem_tlen;	/* tda high and ring size */
94 	uint16_t		lem_pad0[4];
95 	struct lermd_v		lem_rmd[LERBUF];
96 	struct letmd_v		lem_tmd[LETBUF];
97 	volatile uint8_t	lem_rbuf[LERBUF][LEMTU];
98 	volatile uint8_t	lem_tbuf[LETBUF][LEMTU];
99 };
100 
101 struct le_softc {
102 	struct lereg *sc_reg;
103 	struct lemem *sc_mem;
104 	uint8_t sc_enaddr[6];
105 	int sc_curtmd;
106 	int sc_currmd;
107 };
108