2 * Copyright (c) 1995, David Greenman
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice unmodified, this list of conditions, and the following
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/socket.h>
37 #include <sys/kernel.h>
39 #include <sys/module.h>
41 #include <machine/bus.h>
43 #include <net/ethernet.h>
45 #include <net/if_arp.h>
46 #include <net/if_media.h>
47 #include <net/if_mib.h>
49 #include <isa/isavar.h>
51 #include <dev/ed/if_edvar.h>
52 #include <dev/ed/if_edreg.h>
54 static int ed_isa_probe(device_t);
55 static int ed_isa_attach(device_t);
57 static struct isa_pnp_id ed_ids[] = {
58 { 0x0131d805, NULL }, /* ANX3101 */
59 { 0x4cf48906, NULL }, /* ATIf44c */
60 { 0x01200507, NULL }, /* AXE2001 */
61 { 0x0115180e, NULL }, /* CPX1501 */
62 { 0x0090252a, NULL }, /* JQE9000 */
63 { 0x0020832e, NULL }, /* KTC2000 */
64 { 0xd680d041, NULL }, /* PNP80d6 */
65 { 0x6081d041, NULL }, /* PNP8160 */
66 { 0x19808c4a, NULL }, /* RTL8019 */
67 { 0x1684a34d, NULL }, /* SMC8416 */
68 { 0x1980635e, NULL }, /* WSC8019 */
73 ed_isa_probe_Novell(device_t dev)
75 struct ed_softc *sc = device_get_softc(dev);
76 int flags = device_get_flags(dev);
79 err = ed_probe_Novell(dev, 0, flags);
82 ed_Novell_read_mac(sc);
84 * Final sanity check for Gateway Ethernet cards before
85 * believing that they really are Gateway AT.
86 * XXX I think this is stale.
88 if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) &&
89 (sc->enaddr[2] == 0x86)) {
90 sc->type_str = "Gateway AT";
97 ed_isa_probe(device_t dev)
99 struct ed_softc *sc = device_get_softc(dev);
100 int flags = device_get_flags(dev);
103 /* Check isapnp ids */
104 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids);
106 /* If the card had a PnP ID that didn't match any we know about */
110 /* If we had some other problem. */
111 if (!(error == 0 || error == ENOENT))
114 /* Heuristic probes */
116 error = ed_probe_WD80x3(dev, 0, flags);
119 ed_release_resources(dev);
121 error = ed_probe_RTL80x9(dev, 0, flags);
123 ed_Novell_read_mac(sc);
126 ed_release_resources(dev);
129 error = ed_probe_3Com(dev, 0, flags);
132 ed_release_resources(dev);
136 error = ed_probe_SIC(dev, 0, flags);
139 ed_release_resources(dev);
141 error = ed_isa_probe_Novell(dev);
144 ed_release_resources(dev);
147 error = ed_probe_HP_pclanp(dev, 0, flags);
150 ed_release_resources(dev);
154 error = ed_alloc_irq(dev, 0, 0);
156 ed_release_resources(dev);
161 ed_isa_attach(device_t dev)
163 struct ed_softc *sc = device_get_softc(dev);
166 if (sc->port_used > 0)
167 ed_alloc_port(dev, 0, sc->port_used);
169 ed_alloc_memory(dev, 0, sc->mem_used);
170 ed_alloc_irq(dev, 0, 0);
172 if (sc->sc_media_ioctl == NULL)
173 ed_gen_ifmedia_init(sc);
174 error = ed_attach(dev);
176 ed_release_resources(dev);
179 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
180 NULL, edintr, sc, &sc->irq_handle);
182 ed_release_resources(dev);
186 static device_method_t ed_isa_methods[] = {
187 /* Device interface */
188 DEVMETHOD(device_probe, ed_isa_probe),
189 DEVMETHOD(device_attach, ed_isa_attach),
190 DEVMETHOD(device_detach, ed_detach),
195 static driver_t ed_isa_driver = {
198 sizeof(struct ed_softc)
201 DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0);
202 MODULE_DEPEND(ed, isa, 1, 1, 1);
203 MODULE_DEPEND(ed, ether, 1, 1, 1);