static int an_attach_isa(device_t dev) { struct an_softc *sc = device_get_softc(dev); int flags = device_get_flags(dev); int error; an_alloc_port(dev, sc->port_rid, 1); an_alloc_irq(dev, sc->irq_rid, 0); sc->an_dev = dev; error = an_attach(sc, flags); if (error) { an_release_resources(dev); return (error); } error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, NULL, an_intr, sc, &sc->irq_handle); if (error) { an_release_resources(dev); return (error); } return (0); }
static int an_attach_isa(device_t dev) { struct an_softc *sc = device_get_softc(dev); struct ifnet *ifp = &sc->arpcom.ac_if; int flags = device_get_flags(dev); int error; an_alloc_port(dev, sc->port_rid, 1); an_alloc_irq(dev, sc->irq_rid, 0); sc->an_bhandle = rman_get_bushandle(sc->port_res); sc->an_btag = rman_get_bustag(sc->port_res); error = an_attach(sc, dev, flags); if (error) goto fail; error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE, an_intr, sc, &sc->irq_handle, sc->arpcom.ac_if.if_serializer); if (error) { ether_ifdetach(&sc->arpcom.ac_if); ifmedia_removeall(&sc->an_ifmedia); goto fail; } ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->irq_res)); return (0); fail: an_release_resources(dev); return(error); }
static int an_pccard_attach(device_t dev) { struct an_softc *sc = device_get_softc(dev); struct ifnet *ifp = &sc->arpcom.ac_if; int flags = device_get_flags(dev); int error; an_alloc_port(dev, sc->port_rid, AN_IOSIZ); an_alloc_irq(dev, sc->irq_rid, 0); sc->an_bhandle = rman_get_bushandle(sc->port_res); sc->an_btag = rman_get_bustag(sc->port_res); error = an_attach(sc, dev, flags); if (error) goto fail; /* * Must setup the interrupt after the an_attach to prevent racing. */ error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE, an_intr, sc, &sc->irq_handle, sc->arpcom.ac_if.if_serializer); if (error) { ether_ifdetach(&sc->arpcom.ac_if); ifmedia_removeall(&sc->an_ifmedia); goto fail; } ifp->if_cpuid = rman_get_cpuid(sc->irq_res); KKASSERT(ifp->if_cpuid >= 0 && ifp->if_cpuid < ncpus); return 0; fail: an_release_resources(dev); return (error); }