summaryrefslogtreecommitdiffstats
path: root/sys/dev/sn
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-11-10 16:04:11 +0000
committerimp <imp@FreeBSD.org>2003-11-10 16:04:11 +0000
commit804e92af91c06459de3edf99a69de3e542a12c64 (patch)
tree7daf816769cac94805af8790c2392345a6c1c987 /sys/dev/sn
parent9d0c797a7de60eb98e5d0651d65be12ef1be2fb7 (diff)
downloadFreeBSD-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')
-rw-r--r--sys/dev/sn/if_sn.c18
-rw-r--r--sys/dev/sn/if_sn_isa.c5
2 files changed, 11 insertions, 12 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);
diff --git a/sys/dev/sn/if_sn_isa.c b/sys/dev/sn/if_sn_isa.c
index a793be2..f88f338 100644
--- a/sys/dev/sn/if_sn_isa.c
+++ b/sys/dev/sn/if_sn_isa.c
@@ -10,11 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Herb Peyerl.
- * 4. The name of Herb Peyerl may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OpenPOWER on IntegriCloud