FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/if_lnc.h
1 /*
2 * Copyright (c) 1994, Paul Richards. This software may be used, modified,
3 * copied, distributed, and sold, in both source and binary form provided
4 * that the above copyright and these terms are retained. Under no
5 * circumstances is the author responsible for the proper functioning
6 * of this software, nor does the author assume any responsibility
7 * for damages incurred with its use.
8 *
9 */
10
11 #include <i386/isa/ic/Am7990.h>
12
13 /*
14 * Initialize multicast address hashing registers to accept
15 * all multicasts (only used when in promiscuous mode)
16 */
17 #if NBPFILTER > 0
18 #define MULTI_INIT_ADDR 0xff
19 #else
20 #define MULTI_INIT_ADDR 0
21 #endif
22
23 #define NORMAL 0
24
25 #define NRDRE 3
26 #define NTDRE 3
27 #define RECVBUFSIZE 1518 /* Packet size rounded to dword boundary */
28 #define TRANSBUFSIZE 1518
29 #define MBUF_CACHE_LIMIT 0
30
31 #define MEM_SLEW 8
32
33
34 /* BICC port addresses */
35 #define BICC_IOSIZE 16
36 #define BICC_RDP 0x0c /* Register Data Port */
37 #define BICC_RAP 0x0e /* Register Address Port */
38
39 /* NE2100 port addresses */
40 #define NE2100_IOSIZE 24
41 #define PCNET_RDP 0x10 /* Register Data Port */
42 #define PCNET_RAP 0x12 /* Register Address Port */
43 #define PCNET_RESET 0x14
44 #define PCNET_BDP 0x16
45 #define PCNET_VSW 0x18
46
47 /* DEPCA port addresses */
48 #define DEPCA_IOSIZE 16
49 #define DEPCA_CTRL 0x00 /* NIC Control and status register */
50 #define DEPCA_RDP 0x04 /* Register Data Port */
51 #define DEPCA_RAP 0x06 /* Register Address Port */
52 #define DEPCA_ADP 0x0c
53
54 /* DEPCA specific defines */
55 #define DEPCA_ADDR_ROM_SIZE 32
56
57 #ifdef PC98
58 /* C-NET(98)S port addresses */
59 #define CNET98S_RDP 0x400 /* Register Data Port */
60 #define CNET98S_RAP 0x402 /* Register Address Port */
61 #define CNET98S_RESET 0x404
62 #define CNET98S_IDP 0x406
63 #define CNET98S_EEPROM 0x40e
64 /*
65 * XXX - The I/O address range is fragmented in the C-NET(98)S.
66 * This is the number of regs at iobase.
67 */
68 #define CNET98S_IOSIZE 16 /* # of i/o addresses used. */
69 #endif
70
71 /* Chip types */
72 #define LANCE 1 /* Am7990 */
73 #define C_LANCE 2 /* Am79C90 */
74 #define PCnet_ISA 3 /* Am79C960 */
75 #define PCnet_ISAplus 4 /* Am79C961 */
76 #define PCnet_ISA_II 5 /* Am79C961A */
77 #define PCnet_32 6 /* Am79C965 */
78 #define PCnet_PCI 7 /* Am79C970 */
79 #define PCnet_PCI_II 8 /* Am79C970A */
80 #define PCnet_FAST 9 /* Am79C971 */
81 #define PCnet_FASTplus 10 /* Am79C972 */
82
83 /* CSR88-89: Chip ID masks */
84 #define AMD_MASK 0x003
85 #define PART_MASK 0xffff
86 #define Am79C960 0x0003
87 #define Am79C961 0x2260
88 #define Am79C961A 0x2261
89 #define Am79C965 0x2430
90 #define Am79C970 0x0242
91 #define Am79C970A 0x2621
92 #define Am79C971 0x2623
93 #define Am79C972 0x2624
94
95 /* Board types */
96 #define UNKNOWN 0
97 #define BICC 1
98 #define NE2100 2
99 #define DEPCA 3
100 #define CNET98S 4 /* PC-98 */
101
102 /* mem_mode values */
103 #define DMA_FIXED 1
104 #define DMA_MBUF 2
105 #define SHMEM 4
106
107 #define MEM_MODES \
108 "\2\3SHMEM\2DMA_MBUF\1DMA_FIXED"
109
110 #define CSR0_FLAGS \
111 "\2\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\
112 \10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
113
114 #define INIT_MODE \
115 "\2\20PROM\07INTL\06DRTY\05COLL\04DTCR\03LOOP\02DTX\01DRX"
116
117 #define RECV_MD1 \
118 "\2\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
119
120 #define TRANS_MD1 \
121 "\2\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
122
123 #define TRANS_MD3 \
124 "\2\6BUFF\5UFLO\4RES\3LCOL\2LCAR\1RTRY"
125
126 struct nic_info {
127 int ident; /* Type of card */
128 int ic; /* Type of ic, Am7990, Am79C960 etc. */
129 int mem_mode;
130 int iobase;
131 int mode; /* Mode setting at initialization */
132 };
133
134 struct host_ring_entry {
135 struct mds *md;
136 union {
137 struct mbuf *mbuf;
138 char *data;
139 }buff;
140 };
141
142 #ifdef LNC_KEEP_STATS
143 #define LNCSTATS_STRUCT \
144 struct lnc_stats { \
145 int idon; \
146 int rint; \
147 int tint; \
148 int cerr; \
149 int babl; \
150 int miss; \
151 int merr; \
152 int rxoff; \
153 int txoff; \
154 int terr; \
155 int lcol; \
156 int lcar; \
157 int tbuff; \
158 int def; \
159 int more; \
160 int one; \
161 int uflo; \
162 int rtry; \
163 int rerr; \
164 int fram; \
165 int oflo; \
166 int crc; \
167 int rbuff; \
168 int drop_packet; \
169 int trans_ring_full; \
170 } lnc_stats;
171 #define LNCSTATS(X) ++(sc->lnc_stats.X);
172 #else
173 #define LNCSTATS_STRUCT
174 #define LNCSTATS(X)
175 #endif
176
177 #define NDESC(len2) (1 << len2)
178
179 #define INC_MD_PTR(ptr, no_entries) \
180 if (++ptr >= NDESC(no_entries)) \
181 ptr = 0;
182
183 #define DEC_MD_PTR(ptr, no_entries) \
184 if (--ptr < 0) \
185 ptr = NDESC(no_entries) - 1;
186
187 #define RECV_NEXT (sc->recv_ring->base + sc->recv_next)
188 #define TRANS_NEXT (sc->trans_ring->base + sc->trans_next)
Cache object: 373900651f4e516326dca55147ad88e0
|