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>
|
30__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed_isa.c 141557 2005-02-09 05:55:54Z imp $");
| 30__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed_isa.c 141586 2005-02-09 20:03:40Z imp $");
|
31
| 31
|
| 32#include "opt_ed.h" 33
|
32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/socket.h> 35#include <sys/kernel.h> 36 37#include <sys/module.h> 38#include <sys/bus.h> 39#include <machine/bus.h> 40 41#include <net/if.h> 42#include <net/if_arp.h> 43#include <net/if_mib.h> 44 45#include <isa/isavar.h> 46 47#include <dev/ed/if_edvar.h> 48 49static int ed_isa_probe (device_t); 50static int ed_isa_attach (device_t); 51 52static struct isa_pnp_id ed_ids[] = { 53 { 0x1684a34d, NULL }, /* SMC8416 */ 54 { 0xd680d041, NULL }, /* PNP80d6 */ 55 { 0x1980635e, NULL }, /* WSC8019 */ 56 { 0x0131d805, NULL }, /* ANX3101 */ 57 { 0x01200507, NULL }, /* AXE2001 */ 58 { 0x19808c4a, NULL }, /* RTL8019 */ 59 { 0x0090252a, NULL }, /* JQE9000 */ 60 { 0x0020832e, NULL }, /* KTC2000 */ 61 { 0x4cf48906, NULL }, /* ATIf44c */ 62 { 0, NULL } 63}; 64 65static int 66ed_isa_probe(dev) 67 device_t dev; 68{ 69 int flags = device_get_flags(dev); 70 int error = 0; 71 72 /* Check isapnp ids */ 73 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); 74 75 /* If the card had a PnP ID that didn't match any we know about */ 76 if (error == ENXIO) { 77 goto end; 78 } 79 80 /* If we had some other problem. */ 81 if (!(error == 0 || error == ENOENT)) { 82 goto end; 83 } 84 85 /* Heuristic probes */ 86 87 error = ed_probe_WD80x3(dev, 0, flags); 88 if (error == 0) 89 goto end; 90 ed_release_resources(dev); 91
| 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/socket.h> 37#include <sys/kernel.h> 38 39#include <sys/module.h> 40#include <sys/bus.h> 41#include <machine/bus.h> 42 43#include <net/if.h> 44#include <net/if_arp.h> 45#include <net/if_mib.h> 46 47#include <isa/isavar.h> 48 49#include <dev/ed/if_edvar.h> 50 51static int ed_isa_probe (device_t); 52static int ed_isa_attach (device_t); 53 54static struct isa_pnp_id ed_ids[] = { 55 { 0x1684a34d, NULL }, /* SMC8416 */ 56 { 0xd680d041, NULL }, /* PNP80d6 */ 57 { 0x1980635e, NULL }, /* WSC8019 */ 58 { 0x0131d805, NULL }, /* ANX3101 */ 59 { 0x01200507, NULL }, /* AXE2001 */ 60 { 0x19808c4a, NULL }, /* RTL8019 */ 61 { 0x0090252a, NULL }, /* JQE9000 */ 62 { 0x0020832e, NULL }, /* KTC2000 */ 63 { 0x4cf48906, NULL }, /* ATIf44c */ 64 { 0, NULL } 65}; 66 67static int 68ed_isa_probe(dev) 69 device_t dev; 70{ 71 int flags = device_get_flags(dev); 72 int error = 0; 73 74 /* Check isapnp ids */ 75 error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); 76 77 /* If the card had a PnP ID that didn't match any we know about */ 78 if (error == ENXIO) { 79 goto end; 80 } 81 82 /* If we had some other problem. */ 83 if (!(error == 0 || error == ENOENT)) { 84 goto end; 85 } 86 87 /* Heuristic probes */ 88 89 error = ed_probe_WD80x3(dev, 0, flags); 90 if (error == 0) 91 goto end; 92 ed_release_resources(dev); 93
|
| 94#ifdef ED_3C503
|
92 error = ed_probe_3Com(dev, 0, flags); 93 if (error == 0) 94 goto end; 95 ed_release_resources(dev);
| 95 error = ed_probe_3Com(dev, 0, flags); 96 if (error == 0) 97 goto end; 98 ed_release_resources(dev);
|
| 99#endif
|
96
| 100
|
| 101#ifdef ED_SIC
|
97 error = ed_probe_SIC(dev, 0, flags); 98 if (error == 0) 99 goto end; 100 ed_release_resources(dev);
| 102 error = ed_probe_SIC(dev, 0, flags); 103 if (error == 0) 104 goto end; 105 ed_release_resources(dev);
|
101
| 106#endif
|
102 error = ed_probe_Novell(dev, 0, flags); 103 if (error == 0) 104 goto end; 105 ed_release_resources(dev); 106
| 107 error = ed_probe_Novell(dev, 0, flags); 108 if (error == 0) 109 goto end; 110 ed_release_resources(dev); 111
|
| 112#ifdef ED_HPP
|
107 error = ed_probe_HP_pclanp(dev, 0, flags); 108 if (error == 0) 109 goto end; 110 ed_release_resources(dev);
| 113 error = ed_probe_HP_pclanp(dev, 0, flags); 114 if (error == 0) 115 goto end; 116 ed_release_resources(dev);
|
111
| 117#endif
|
112end: 113 if (error == 0) 114 error = ed_alloc_irq(dev, 0, 0); 115 116 ed_release_resources(dev); 117 return (error); 118} 119 120static int 121ed_isa_attach(dev) 122 device_t dev; 123{ 124 struct ed_softc *sc = device_get_softc(dev); 125 int error; 126 127 if (sc->port_used > 0) 128 ed_alloc_port(dev, sc->port_rid, sc->port_used); 129 if (sc->mem_used) 130 ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); 131 132 ed_alloc_irq(dev, sc->irq_rid, 0); 133 134 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, 135 edintr, sc, &sc->irq_handle); 136 if (error) { 137 ed_release_resources(dev); 138 return (error); 139 } 140 141 return ed_attach(dev); 142} 143 144static device_method_t ed_isa_methods[] = { 145 /* Device interface */ 146 DEVMETHOD(device_probe, ed_isa_probe), 147 DEVMETHOD(device_attach, ed_isa_attach), 148 DEVMETHOD(device_detach, ed_detach), 149 150 { 0, 0 } 151}; 152 153static driver_t ed_isa_driver = { 154 "ed", 155 ed_isa_methods, 156 sizeof(struct ed_softc) 157}; 158 159DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); 160MODULE_DEPEND(ed, isa, 1, 1, 1); 161MODULE_DEPEND(ed, ether, 1, 1, 1);
| 118end: 119 if (error == 0) 120 error = ed_alloc_irq(dev, 0, 0); 121 122 ed_release_resources(dev); 123 return (error); 124} 125 126static int 127ed_isa_attach(dev) 128 device_t dev; 129{ 130 struct ed_softc *sc = device_get_softc(dev); 131 int error; 132 133 if (sc->port_used > 0) 134 ed_alloc_port(dev, sc->port_rid, sc->port_used); 135 if (sc->mem_used) 136 ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); 137 138 ed_alloc_irq(dev, sc->irq_rid, 0); 139 140 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, 141 edintr, sc, &sc->irq_handle); 142 if (error) { 143 ed_release_resources(dev); 144 return (error); 145 } 146 147 return ed_attach(dev); 148} 149 150static device_method_t ed_isa_methods[] = { 151 /* Device interface */ 152 DEVMETHOD(device_probe, ed_isa_probe), 153 DEVMETHOD(device_attach, ed_isa_attach), 154 DEVMETHOD(device_detach, ed_detach), 155 156 { 0, 0 } 157}; 158 159static driver_t ed_isa_driver = { 160 "ed", 161 ed_isa_methods, 162 sizeof(struct ed_softc) 163}; 164 165DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); 166MODULE_DEPEND(ed, isa, 1, 1, 1); 167MODULE_DEPEND(ed, ether, 1, 1, 1);
|