1/*- 2 * Copyright (c) 1995, David Greenman 3 * 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 unmodified, this list of conditions, and the following 10 * disclaimer. 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. 14 * 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 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h>
| 1/*- 2 * Copyright (c) 1995, David Greenman 3 * 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 unmodified, this list of conditions, and the following 10 * disclaimer. 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. 14 * 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 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h>
|
61 { 0x0090252a, NULL }, /* JQE9000 */ 62 { 0x0020832e, NULL }, /* KTC2000 */ 63 { 0xd680d041, NULL }, /* PNP80d6 */ 64 { 0x6081d041, NULL }, /* PNP8160 */ 65 { 0x19808c4a, NULL }, /* RTL8019 */ 66 { 0x1684a34d, NULL }, /* SMC8416 */ 67 { 0x1980635e, NULL }, /* WSC8019 */ 68 { 0, NULL } 69}; 70 71static int 72ed_isa_probe_Novell(device_t dev) 73{ 74 struct ed_softc *sc = device_get_softc(dev); 75 int flags = device_get_flags(dev); 76 int err; 77 78 err = ed_probe_Novell(dev, 0, flags); 79 if (err) 80 return err; 81 ed_Novell_read_mac(sc); 82 /* 83 * Final sanity check for Gateway Ethernet cards before 84 * believing that they really are Gateway AT. 85 * XXX I think this is stale. 86 */ 87 if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) && 88 (sc->enaddr[2] == 0x86)) { 89 sc->type_str = "Gateway AT"; 90 } 91 92 return (0); 93} 94 95static int 96ed_isa_probe(device_t dev) 97{ 98 struct ed_softc *sc = device_get_softc(dev); 99 int flags = device_get_flags(dev); 100 int error = 0; 101 102 /* Check isapnp ids */ 103 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); 104 105 /* If the card had a PnP ID that didn't match any we know about */ 106 if (error == ENXIO) 107 goto end; 108 109 /* If we had some other problem. */ 110 if (!(error == 0 || error == ENOENT)) 111 goto end; 112 113 /* Heuristic probes */ 114 115 error = ed_probe_WD80x3(dev, 0, flags); 116 if (error == 0) 117 goto end; 118 ed_release_resources(dev); 119 120 error = ed_probe_RTL80x9(dev, 0, flags); 121 if (error == 0) { 122 ed_Novell_read_mac(sc); 123 goto end; 124 } 125 ed_release_resources(dev); 126 127#ifdef ED_3C503 128 error = ed_probe_3Com(dev, 0, flags); 129 if (error == 0) 130 goto end; 131 ed_release_resources(dev); 132#endif 133 134#ifdef ED_SIC 135 error = ed_probe_SIC(dev, 0, flags); 136 if (error == 0) 137 goto end; 138 ed_release_resources(dev); 139#endif 140 error = ed_isa_probe_Novell(dev); 141 if (error == 0) 142 goto end; 143 ed_release_resources(dev); 144 145#ifdef ED_HPP 146 error = ed_probe_HP_pclanp(dev, 0, flags); 147 if (error == 0) 148 goto end; 149 ed_release_resources(dev); 150#endif 151end: 152 if (error == 0) 153 error = ed_alloc_irq(dev, 0, 0); 154 155 ed_release_resources(dev); 156 return (error); 157} 158 159static int 160ed_isa_attach(device_t dev) 161{ 162 struct ed_softc *sc = device_get_softc(dev); 163 int error; 164 165 if (sc->port_used > 0) 166 ed_alloc_port(dev, 0, sc->port_used); 167 if (sc->mem_used) 168 ed_alloc_memory(dev, 0, sc->mem_used); 169 ed_alloc_irq(dev, 0, 0); 170 171 if (sc->sc_media_ioctl == NULL) 172 ed_gen_ifmedia_init(sc); 173 error = ed_attach(dev); 174 if (error) { 175 ed_release_resources(dev); 176 return (error); 177 } 178 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, 179 NULL, edintr, sc, &sc->irq_handle); 180 if (error) 181 ed_release_resources(dev); 182 return (error); 183} 184 185static device_method_t ed_isa_methods[] = { 186 /* Device interface */ 187 DEVMETHOD(device_probe, ed_isa_probe), 188 DEVMETHOD(device_attach, ed_isa_attach), 189 DEVMETHOD(device_detach, ed_detach), 190 191 { 0, 0 } 192}; 193 194static driver_t ed_isa_driver = { 195 "ed", 196 ed_isa_methods, 197 sizeof(struct ed_softc) 198}; 199 200DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); 201MODULE_DEPEND(ed, isa, 1, 1, 1); 202MODULE_DEPEND(ed, ether, 1, 1, 1);
| 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 */ 69 { 0, NULL } 70}; 71 72static int 73ed_isa_probe_Novell(device_t dev) 74{ 75 struct ed_softc *sc = device_get_softc(dev); 76 int flags = device_get_flags(dev); 77 int err; 78 79 err = ed_probe_Novell(dev, 0, flags); 80 if (err) 81 return err; 82 ed_Novell_read_mac(sc); 83 /* 84 * Final sanity check for Gateway Ethernet cards before 85 * believing that they really are Gateway AT. 86 * XXX I think this is stale. 87 */ 88 if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) && 89 (sc->enaddr[2] == 0x86)) { 90 sc->type_str = "Gateway AT"; 91 } 92 93 return (0); 94} 95 96static int 97ed_isa_probe(device_t dev) 98{ 99 struct ed_softc *sc = device_get_softc(dev); 100 int flags = device_get_flags(dev); 101 int error = 0; 102 103 /* Check isapnp ids */ 104 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); 105 106 /* If the card had a PnP ID that didn't match any we know about */ 107 if (error == ENXIO) 108 goto end; 109 110 /* If we had some other problem. */ 111 if (!(error == 0 || error == ENOENT)) 112 goto end; 113 114 /* Heuristic probes */ 115 116 error = ed_probe_WD80x3(dev, 0, flags); 117 if (error == 0) 118 goto end; 119 ed_release_resources(dev); 120 121 error = ed_probe_RTL80x9(dev, 0, flags); 122 if (error == 0) { 123 ed_Novell_read_mac(sc); 124 goto end; 125 } 126 ed_release_resources(dev); 127 128#ifdef ED_3C503 129 error = ed_probe_3Com(dev, 0, flags); 130 if (error == 0) 131 goto end; 132 ed_release_resources(dev); 133#endif 134 135#ifdef ED_SIC 136 error = ed_probe_SIC(dev, 0, flags); 137 if (error == 0) 138 goto end; 139 ed_release_resources(dev); 140#endif 141 error = ed_isa_probe_Novell(dev); 142 if (error == 0) 143 goto end; 144 ed_release_resources(dev); 145 146#ifdef ED_HPP 147 error = ed_probe_HP_pclanp(dev, 0, flags); 148 if (error == 0) 149 goto end; 150 ed_release_resources(dev); 151#endif 152end: 153 if (error == 0) 154 error = ed_alloc_irq(dev, 0, 0); 155 156 ed_release_resources(dev); 157 return (error); 158} 159 160static int 161ed_isa_attach(device_t dev) 162{ 163 struct ed_softc *sc = device_get_softc(dev); 164 int error; 165 166 if (sc->port_used > 0) 167 ed_alloc_port(dev, 0, sc->port_used); 168 if (sc->mem_used) 169 ed_alloc_memory(dev, 0, sc->mem_used); 170 ed_alloc_irq(dev, 0, 0); 171 172 if (sc->sc_media_ioctl == NULL) 173 ed_gen_ifmedia_init(sc); 174 error = ed_attach(dev); 175 if (error) { 176 ed_release_resources(dev); 177 return (error); 178 } 179 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, 180 NULL, edintr, sc, &sc->irq_handle); 181 if (error) 182 ed_release_resources(dev); 183 return (error); 184} 185 186static 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), 191 192 { 0, 0 } 193}; 194 195static driver_t ed_isa_driver = { 196 "ed", 197 ed_isa_methods, 198 sizeof(struct ed_softc) 199}; 200 201DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); 202MODULE_DEPEND(ed, isa, 1, 1, 1); 203MODULE_DEPEND(ed, ether, 1, 1, 1);
|