FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/if_lnc.h
1 /*-
2 * Copyright (c) 1994-1998
3 * Paul Richards. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * verbatim and that no modifications are made prior to this
11 * point in the file.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Paul Richards.
18 * 4. The name Paul Richards may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD$
34 */
35
36 #include <i386/isa/ic/Am7990.h>
37
38 /*
39 * Initialize multicast address hashing registers to accept
40 * all multicasts (only used when in promiscuous mode)
41 */
42 #if NBPFILTER > 0
43 #define MULTI_INIT_ADDR 0xff
44 #else
45 #define MULTI_INIT_ADDR 0
46 #endif
47
48 #define NORMAL 0
49
50 #define NRDRE 3
51 #define NTDRE 3
52 #define RECVBUFSIZE 1518 /* Packet size rounded to dword boundary */
53 #define TRANSBUFSIZE 1518
54 #define MBUF_CACHE_LIMIT 0
55
56 #define MEM_SLEW 8
57
58 /* LNC Flags */
59 #define LNC_INITIALISED 1
60 #define LNC_ALLMULTI 2
61
62 /* BICC port addresses */
63 #define BICC_IOSIZE 16
64 #define BICC_RDP 0x0c /* Register Data Port */
65 #define BICC_RAP 0x0e /* Register Address Port */
66
67 /* NE2100 port addresses */
68 #define NE2100_IOSIZE 24
69 #define PCNET_RDP 0x10 /* Register Data Port */
70 #define PCNET_RAP 0x12 /* Register Address Port */
71 #define PCNET_RESET 0x14
72 #define PCNET_BDP 0x16
73 #define PCNET_VSW 0x18
74
75 /* DEPCA port addresses */
76 #define DEPCA_IOSIZE 16
77 #define DEPCA_CTRL 0x00 /* NIC Control and status register */
78 #define DEPCA_RDP 0x04 /* Register Data Port */
79 #define DEPCA_RAP 0x06 /* Register Address Port */
80 #define DEPCA_ADP 0x0c
81
82 /* DEPCA specific defines */
83 #define DEPCA_ADDR_ROM_SIZE 32
84
85 #ifdef PC98
86 /* C-NET(98)S port addresses */
87 #define CNET98S_RDP 0x400 /* Register Data Port */
88 #define CNET98S_RAP 0x402 /* Register Address Port */
89 #define CNET98S_RESET 0x404
90 #define CNET98S_IDP 0x406
91 #define CNET98S_EEPROM 0x40e
92 /*
93 * XXX - The I/O address range is fragmented in the C-NET(98)S.
94 * This is the number of regs at iobase.
95 */
96 #define CNET98S_IOSIZE 16 /* # of i/o addresses used. */
97 #endif
98
99 /* Chip types */
100 #define LANCE 1 /* Am7990 */
101 #define C_LANCE 2 /* Am79C90 */
102 #define PCnet_ISA 3 /* Am79C960 */
103 #define PCnet_ISAplus 4 /* Am79C961 */
104 #define PCnet_ISA_II 5 /* Am79C961A */
105 #define PCnet_32 6 /* Am79C965 */
106 #define PCnet_PCI 7 /* Am79C970 */
107 #define PCnet_PCI_II 8 /* Am79C970A */
108 #define PCnet_FAST 9 /* Am79C971 */
109 #define PCnet_FASTplus 10 /* Am79C972 */
110 #define PCnet_Home 11 /* Am79C978 */
111 #define PCnet_FAST_III 12 /* Am79C973, Am79C975 */
112
113
114 /* CSR88-89: Chip ID masks */
115 #define AMD_MASK 0x003
116 #define PART_MASK 0xffff
117 #define Am79C960 0x0003
118 #define Am79C961 0x2260
119 #define Am79C961A 0x2261
120 #define Am79C965 0x2430
121 #define Am79C970 0x0242
122 #define Am79C970A 0x2621
123 #define Am79C971 0x2623
124 #define Am79C972 0x2624
125 #define Am79C973 0x2625
126 #define Am79C978 0x2626
127 #define Am79C975 0x2627
128
129 /* Board types */
130 #define UNKNOWN 0
131 #define BICC 1
132 #define NE2100 2
133 #define DEPCA 3
134 #define CNET98S 4 /* PC-98 */
135
136 /* mem_mode values */
137 #define DMA_FIXED 1
138 #define DMA_MBUF 2
139 #define SHMEM 4
140
141 #define MEM_MODES \
142 "\2\3SHMEM\2DMA_MBUF\1DMA_FIXED"
143
144 #define CSR0_FLAGS \
145 "\2\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\
146 \10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
147
148 #define INIT_MODE \
149 "\2\20PROM\07INTL\06DRTY\05COLL\04DTCR\03LOOP\02DTX\01DRX"
150
151 #define RECV_MD1 \
152 "\2\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
153
154 #define TRANS_MD1 \
155 "\2\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
156
157 #define TRANS_MD3 \
158 "\2\6BUFF\5UFLO\4RES\3LCOL\2LCAR\1RTRY"
159
160 struct nic_info {
161 int ident; /* Type of card */
162 int ic; /* Type of ic, Am7990, Am79C960 etc. */
163 int mem_mode;
164 int iobase;
165 int mode; /* Mode setting at initialization */
166 };
167
168 struct host_ring_entry {
169 struct mds *md;
170 union {
171 struct mbuf *mbuf;
172 char *data;
173 }buff;
174 };
175
176 #ifdef LNC_KEEP_STATS
177 #define LNCSTATS_STRUCT \
178 struct lnc_stats { \
179 int idon; \
180 int rint; \
181 int tint; \
182 int cerr; \
183 int babl; \
184 int miss; \
185 int merr; \
186 int rxoff; \
187 int txoff; \
188 int terr; \
189 int lcol; \
190 int lcar; \
191 int tbuff; \
192 int def; \
193 int more; \
194 int one; \
195 int uflo; \
196 int rtry; \
197 int rerr; \
198 int fram; \
199 int oflo; \
200 int crc; \
201 int rbuff; \
202 int drop_packet; \
203 int trans_ring_full; \
204 } lnc_stats;
205 #define LNCSTATS(X) ++(sc->lnc_stats.X);
206 #else
207 #define LNCSTATS_STRUCT
208 #define LNCSTATS(X)
209 #endif
210
211 #define NDESC(len2) (1 << len2)
212
213 #define INC_MD_PTR(ptr, no_entries) \
214 if (++ptr >= NDESC(no_entries)) \
215 ptr = 0;
216
217 #define DEC_MD_PTR(ptr, no_entries) \
218 if (--ptr < 0) \
219 ptr = NDESC(no_entries) - 1;
220
221 #define RECV_NEXT (sc->recv_ring->base + sc->recv_next)
222 #define TRANS_NEXT (sc->trans_ring->base + sc->trans_next)
Cache object: 2f0fcaa57edfbd5a64a11eb5e5a2667c
|