diff options
author | imp <imp@FreeBSD.org> | 2003-11-10 16:04:11 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2003-11-10 16:04:11 +0000 |
commit | 804e92af91c06459de3edf99a69de3e542a12c64 (patch) | |
tree | 7daf816769cac94805af8790c2392345a6c1c987 /sys/dev/sn/if_sn.c | |
parent | 9d0c797a7de60eb98e5d0651d65be12ef1be2fb7 (diff) | |
download | FreeBSD-src-804e92af91c06459de3edf99a69de3e542a12c64.zip FreeBSD-src-804e92af91c06459de3edf99a69de3e542a12c64.tar.gz |
Don't establish the ISR in the sn_activate routine. I've had two
crashes that had sn0 as the irq that's being serviced, when there was
no sn0 in the system. This seems to prevent them. Also, we want to
wait until after we've registered with the network layer before we
turn on the interrupt spigot to avoid races.
Diffstat (limited to 'sys/dev/sn/if_sn.c')
-rw-r--r-- | sys/dev/sn/if_sn.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 49cd843..5d5c05c 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -165,6 +165,7 @@ sn_attach(device_t dev) int rev; uint16_t address; int j; + int err; sc->dev = dev; sn_activate(dev); @@ -234,6 +235,16 @@ sn_attach(device_t dev) bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN); } + /* + * Activate the interrupt so we can get card interrupts. This + * needs to be done last so that we don't have/hold the lock + * during startup to avoid LORs in the network layer. + */ + if ((err = bus_setup_intr(dev, sc->irq_res, + INTR_TYPE_NET | INTR_MPSAFE, sn_intr, sc, &sc->intrhand)) != 0) { + sn_detach(dev); + return err; + } return 0; } @@ -1223,7 +1234,6 @@ int sn_activate(device_t dev) { struct sn_softc *sc = device_get_softc(dev); - int err; sc->port_rid = 0; sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, @@ -1243,12 +1253,6 @@ sn_activate(device_t dev) sn_deactivate(dev); return ENOMEM; } - if ((err = bus_setup_intr(dev, sc->irq_res, - INTR_TYPE_NET | INTR_MPSAFE, sn_intr, sc, &sc->intrhand)) != 0) { - sn_deactivate(dev); - return err; - } - sc->bst = rman_get_bustag(sc->port_res); sc->bsh = rman_get_bushandle(sc->port_res); return (0); |