This source file includes following definitions.
- ep_eisa_match
- ep_eisa_attach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 #include "bpfilter.h"
36
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/mbuf.h>
40 #include <sys/socket.h>
41 #include <sys/ioctl.h>
42 #include <sys/errno.h>
43 #include <sys/syslog.h>
44 #include <sys/selinfo.h>
45 #include <sys/timeout.h>
46 #include <sys/device.h>
47
48 #include <net/if.h>
49 #include <net/if_dl.h>
50 #include <net/if_types.h>
51 #include <net/netisr.h>
52 #include <net/if_media.h>
53
54 #ifdef INET
55 #include <netinet/in.h>
56 #include <netinet/in_systm.h>
57 #include <netinet/in_var.h>
58 #include <netinet/ip.h>
59 #include <netinet/if_ether.h>
60 #endif
61
62 #if NBPFILTER > 0
63 #include <net/bpf.h>
64 #endif
65
66 #include <machine/cpu.h>
67 #include <machine/bus.h>
68 #include <machine/intr.h>
69
70 #include <dev/mii/mii.h>
71 #include <dev/mii/miivar.h>
72
73 #include <dev/ic/elink3var.h>
74 #include <dev/ic/elink3reg.h>
75
76 #include <dev/eisa/eisareg.h>
77 #include <dev/eisa/eisavar.h>
78 #include <dev/eisa/eisadevs.h>
79
80 int ep_eisa_match(struct device *, void *, void *);
81 void ep_eisa_attach(struct device *, struct device *, void *);
82
83 struct cfattach ep_eisa_ca = {
84 sizeof(struct ep_softc), ep_eisa_match, ep_eisa_attach
85 };
86
87
88 #define EISA_CONTROL 0x0c84
89 #define EISA_RESET 0x04
90 #define EISA_ERROR 0x02
91 #define EISA_ENABLE 0x01
92
93 int
94 ep_eisa_match(parent, match, aux)
95 struct device *parent;
96 void *match, *aux;
97 {
98 struct eisa_attach_args *ea = aux;
99
100
101 if (strcmp(ea->ea_idstring, "TCM5090") &&
102 strcmp(ea->ea_idstring, "TCM5091") &&
103 strcmp(ea->ea_idstring, "TCM5092") &&
104 strcmp(ea->ea_idstring, "TCM5093") &&
105 strcmp(ea->ea_idstring, "TCM5094") &&
106 strcmp(ea->ea_idstring, "TCM5095") &&
107 strcmp(ea->ea_idstring, "TCM5098") &&
108 strcmp(ea->ea_idstring, "TCM5920") &&
109 strcmp(ea->ea_idstring, "TCM5970") &&
110 strcmp(ea->ea_idstring, "TCM5971") &&
111 strcmp(ea->ea_idstring, "TCM5972"))
112 return (0);
113
114 return (1);
115 }
116
117 void
118 ep_eisa_attach(parent, self, aux)
119 struct device *parent, *self;
120 void *aux;
121 {
122 struct ep_softc *sc = (void *)self;
123 struct eisa_attach_args *ea = aux;
124 bus_space_tag_t iot = ea->ea_iot;
125 bus_space_handle_t ioh;
126 u_int16_t k;
127 eisa_chipset_tag_t ec = ea->ea_ec;
128 eisa_intr_handle_t ih;
129 const char *model, *intrstr;
130 int chipset;
131 u_int irq;
132
133
134 if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot),
135 EISA_SLOT_SIZE, 0, &ioh))
136 panic(": can't map i/o space");
137
138 sc->bustype = EP_BUS_EISA;
139 sc->sc_ioh = ioh;
140 sc->sc_iot = iot;
141
142 bus_space_write_1(iot, ioh, EISA_CONTROL, EISA_ENABLE);
143 delay(4000);
144
145
146 k = bus_space_read_2(iot, ioh, EP_W0_ADDRESS_CFG);
147 k = (k & 0x1f) * 0x10 + 0x200;
148
149
150 irq = bus_space_read_2(iot, ioh, EP_W0_RESOURCE_CFG) >> 12;
151
152 chipset = EP_CHIPSET_3C509;
153 if (strcmp(ea->ea_idstring, "TCM5090") == 0)
154 model = EISA_PRODUCT_TCM5090;
155 else if (strcmp(ea->ea_idstring, "TCM5091") == 0)
156 model = EISA_PRODUCT_TCM5091;
157 else if (strcmp(ea->ea_idstring, "TCM5092") == 0)
158 model = EISA_PRODUCT_TCM5092;
159 else if (strcmp(ea->ea_idstring, "TCM5093") == 0)
160 model = EISA_PRODUCT_TCM5093;
161 else if (strcmp(ea->ea_idstring, "TCM5094") == 0)
162 model = EISA_PRODUCT_TCM5094;
163 else if (strcmp(ea->ea_idstring, "TCM5095") == 0)
164 model = EISA_PRODUCT_TCM5095;
165 else if (strcmp(ea->ea_idstring, "TCM5098") == 0)
166 model = EISA_PRODUCT_TCM5098;
167 else if (strcmp(ea->ea_idstring, "TCM5920") == 0) {
168 model = EISA_PRODUCT_TCM5920;
169 chipset = EP_CHIPSET_VORTEX;
170 } else if (strcmp(ea->ea_idstring, "TCM5970") == 0) {
171 model = EISA_PRODUCT_TCM5970;
172 chipset = EP_CHIPSET_VORTEX;
173 } else if (strcmp(ea->ea_idstring, "TCM5971") == 0) {
174 model = EISA_PRODUCT_TCM5971;
175 chipset = EP_CHIPSET_VORTEX;
176 } else if (strcmp(ea->ea_idstring, "TCM5972") == 0) {
177 model = EISA_PRODUCT_TCM5972;
178 chipset = EP_CHIPSET_VORTEX;
179 } else
180 model = "unknown model!";
181
182 if (eisa_intr_map(ec, irq, &ih)) {
183 printf(": couldn't map interrupt (%u)\n", irq);
184 bus_space_unmap(iot, ioh, EISA_SLOT_SIZE);
185 return;
186 }
187 intrstr = eisa_intr_string(ec, ih);
188 sc->sc_ih = eisa_intr_establish(ec, ih, IST_EDGE, IPL_NET,
189 epintr, sc, sc->sc_dev.dv_xname);
190 if (sc->sc_ih == NULL) {
191 printf(": couldn't establish interrupt");
192 if (intrstr != NULL)
193 printf(" at %s", intrstr);
194 printf("\n");
195 bus_space_unmap(iot, ioh, EISA_SLOT_SIZE);
196 return;
197 }
198
199 printf(": %s,", model);
200 if (intrstr != NULL)
201 printf(" %s,", intrstr);
202
203 epconfig(sc, chipset, NULL);
204
205 if (chipset == EP_CHIPSET_VORTEX)
206 printf("\n");
207 }