if_hme_pci.c (93043) | if_hme_pci.c (108976) |
---|---|
1/* 2 * Copyright (c) 2000 Matthew R. Green 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 --- 13 unchanged lines hidden (view full) --- 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from: NetBSD: if_hme_pci.c,v 1.4 2001/08/27 22:18:49 augustss Exp 29 * | 1/* 2 * Copyright (c) 2000 Matthew R. Green 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 --- 13 unchanged lines hidden (view full) --- 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from: NetBSD: if_hme_pci.c,v 1.4 2001/08/27 22:18:49 augustss Exp 29 * |
30 * $FreeBSD: head/sys/dev/hme/if_hme_pci.c 93043 2002-03-23 19:37:11Z tmm $ | 30 * $FreeBSD: head/sys/dev/hme/if_hme_pci.c 108976 2003-01-09 00:45:10Z tmm $ |
31 */ 32 33/* 34 * PCI front-end device driver for the HME ethernet device. 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> --- 33 unchanged lines hidden (view full) --- 72 int hsc_irid; 73 bus_space_tag_t hsc_memt; 74 bus_space_handle_t hsc_memh; 75 void *hsc_ih; 76}; 77 78static int hme_pci_probe(device_t); 79static int hme_pci_attach(device_t); | 31 */ 32 33/* 34 * PCI front-end device driver for the HME ethernet device. 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> --- 33 unchanged lines hidden (view full) --- 72 int hsc_irid; 73 bus_space_tag_t hsc_memt; 74 bus_space_handle_t hsc_memh; 75 void *hsc_ih; 76}; 77 78static int hme_pci_probe(device_t); 79static int hme_pci_attach(device_t); |
80static int hme_pci_detach(device_t); 81static int hme_pci_suspend(device_t); 82static int hme_pci_resume(device_t); |
|
80 81static device_method_t hme_pci_methods[] = { 82 /* Device interface */ 83 DEVMETHOD(device_probe, hme_pci_probe), 84 DEVMETHOD(device_attach, hme_pci_attach), | 83 84static device_method_t hme_pci_methods[] = { 85 /* Device interface */ 86 DEVMETHOD(device_probe, hme_pci_probe), 87 DEVMETHOD(device_attach, hme_pci_attach), |
88 DEVMETHOD(device_detach, hme_pci_detach), 89 DEVMETHOD(device_suspend, hme_pci_suspend), 90 DEVMETHOD(device_resume, hme_pci_resume), 91 /* Can just use the suspend method here. */ 92 DEVMETHOD(device_shutdown, hme_pci_suspend), |
|
85 86 /* bus interface */ 87 DEVMETHOD(bus_print_child, bus_generic_print_child), 88 DEVMETHOD(bus_driver_added, bus_generic_driver_added), 89 90 /* MII interface */ 91 DEVMETHOD(miibus_readreg, hme_mii_readreg), 92 DEVMETHOD(miibus_writereg, hme_mii_writereg), --- 84 unchanged lines hidden (view full) --- 177 if ((error = hme_config(sc)) != 0) { 178 device_printf(dev, "could not be configured\n"); 179 goto fail_ires; 180 } 181 182 if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET, hme_intr, 183 sc, &hsc->hsc_ih)) != 0) { 184 device_printf(dev, "couldn't establish interrupt\n"); | 93 94 /* bus interface */ 95 DEVMETHOD(bus_print_child, bus_generic_print_child), 96 DEVMETHOD(bus_driver_added, bus_generic_driver_added), 97 98 /* MII interface */ 99 DEVMETHOD(miibus_readreg, hme_mii_readreg), 100 DEVMETHOD(miibus_writereg, hme_mii_writereg), --- 84 unchanged lines hidden (view full) --- 185 if ((error = hme_config(sc)) != 0) { 186 device_printf(dev, "could not be configured\n"); 187 goto fail_ires; 188 } 189 190 if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET, hme_intr, 191 sc, &hsc->hsc_ih)) != 0) { 192 device_printf(dev, "couldn't establish interrupt\n"); |
193 hme_detach(sc); |
|
185 goto fail_ires; 186 } 187 return (0); 188 189fail_ires: 190 bus_release_resource(dev, SYS_RES_IRQ, hsc->hsc_irid, hsc->hsc_ires); 191fail_sres: 192 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_srid, hsc->hsc_sres); 193 return (ENXIO); 194} | 194 goto fail_ires; 195 } 196 return (0); 197 198fail_ires: 199 bus_release_resource(dev, SYS_RES_IRQ, hsc->hsc_irid, hsc->hsc_ires); 200fail_sres: 201 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_srid, hsc->hsc_sres); 202 return (ENXIO); 203} |
204 205static int 206hme_pci_detach(device_t dev) 207{ 208 struct hme_pci_softc *hsc = device_get_softc(dev); 209 struct hme_softc *sc = &hsc->hsc_hme; 210 211 hme_detach(sc); 212 213 bus_teardown_intr(dev, hsc->hsc_ires, hsc->hsc_ih); 214 bus_release_resource(dev, SYS_RES_IRQ, hsc->hsc_irid, hsc->hsc_ires); 215 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_srid, hsc->hsc_sres); 216 return (0); 217} 218 219static int 220hme_pci_suspend(device_t dev) 221{ 222 struct hme_pci_softc *hsc = device_get_softc(dev); 223 struct hme_softc *sc = &hsc->hsc_hme; 224 225 hme_suspend(sc); 226 return (0); 227} 228 229static int 230hme_pci_resume(device_t dev) 231{ 232 struct hme_pci_softc *hsc = device_get_softc(dev); 233 struct hme_softc *sc = &hsc->hsc_hme; 234 235 hme_resume(sc); 236 return (0); 237} |
|