summaryrefslogtreecommitdiffstats
path: root/sys/dev/ncv/ncr53c500_pccard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ncv/ncr53c500_pccard.c')
-rw-r--r--sys/dev/ncv/ncr53c500_pccard.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/sys/dev/ncv/ncr53c500_pccard.c b/sys/dev/ncv/ncr53c500_pccard.c
index 72df586..23c207a 100644
--- a/sys/dev/ncv/ncr53c500_pccard.c
+++ b/sys/dev/ncv/ncr53c500_pccard.c
@@ -98,7 +98,12 @@ static const struct ncv_product {
static void
ncv_pccard_intr(void * arg)
{
+ struct ncv_softc *sc;
+
+ sc = arg;
+ SCSI_LOW_LOCK(&sc->sc_sclow);
ncvintr(arg);
+ SCSI_LOW_UNLOCK(&sc->sc_sclow);
}
static void
@@ -129,6 +134,7 @@ ncv_release_resource(device_t dev)
bus_release_resource(dev, SYS_RES_MEMORY,
sc->mem_rid, sc->mem_res);
}
+ mtx_destroy(&sc->sc_sclow.sl_lock);
}
static int
@@ -148,6 +154,7 @@ ncv_alloc_resource(device_t dev)
return(ENOMEM);
}
+ mtx_init(&sc->sc_sclow.sl_lock, "ncv", NULL, MTX_DEF);
sc->port_rid = 0;
sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid,
ioaddr+offset, ioaddr+iosize-offset,
@@ -223,7 +230,7 @@ ncv_pccard_probe(device_t dev)
strncmp(prodstr, "SOUND/SCSI2 CARD", 16) == 0) {
device_set_desc(dev, "RATOC REX-5572");
device_set_flags(dev, FLAGS_REX5572);
- return (0);
+ return (BUS_PROBE_DEFAULT);
}
return(EIO);
}
@@ -234,8 +241,6 @@ ncv_pccard_attach(device_t dev)
struct ncv_softc *sc = device_get_softc(dev);
int error;
- bzero(sc, sizeof(struct ncv_softc));
-
error = ncv_alloc_resource(dev);
if (error) {
return(error);
@@ -245,8 +250,8 @@ ncv_pccard_attach(device_t dev)
ncv_release_resource(dev);
return(ENXIO);
}
- error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CAM | INTR_ENTROPY,
- NULL, ncv_pccard_intr, (void *)sc, &sc->ncv_intrhand);
+ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CAM | INTR_ENTROPY |
+ INTR_MPSAFE, NULL, ncv_pccard_intr, sc, &sc->ncv_intrhand);
if (error) {
ncv_release_resource(dev);
return(error);
@@ -293,12 +298,9 @@ static void
ncv_card_unload(device_t devi)
{
struct ncv_softc *sc = device_get_softc(devi);
- intrmask_t s;
- s = splcam();
- scsi_low_deactivate((struct scsi_low_softc *)sc);
- scsi_low_dettach(&sc->sc_sclow);
- splx(s);
+ scsi_low_deactivate(&sc->sc_sclow);
+ scsi_low_detach(&sc->sc_sclow);
}
static int
@@ -308,8 +310,7 @@ ncvprobe(device_t devi)
struct ncv_softc *sc = device_get_softc(devi);
u_int32_t flags = device_get_flags(devi);
- rv = ncvprobesubr(rman_get_bustag(sc->port_res),
- rman_get_bushandle(sc->port_res),
+ rv = ncvprobesubr(sc->port_res,
flags, NCV_HOSTID);
return rv;
@@ -321,27 +322,15 @@ ncvattach(device_t devi)
struct ncv_softc *sc;
struct scsi_low_softc *slp;
u_int32_t flags = device_get_flags(devi);
- intrmask_t s;
- char dvname[16]; /* SCSI_LOW_DVNAME_LEN */
-
- strcpy(dvname, "ncv");
sc = device_get_softc(devi);
- if (sc == NULL) {
- return(0);
- }
slp = &sc->sc_sclow;
slp->sl_dev = devi;
- sc->sc_iot = rman_get_bustag(sc->port_res);
- sc->sc_ioh = rman_get_bushandle(sc->port_res);
-
slp->sl_hostid = NCV_HOSTID;
slp->sl_cfgflags = flags;
- s = splcam();
ncvattachsubr(sc);
- splx(s);
return(NCVIOSZ);
}
OpenPOWER on IntegriCloud