summaryrefslogtreecommitdiffstats
path: root/sys/dev/ips/ips_pci.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-01-28 05:02:13 +0000
committerscottl <scottl@FreeBSD.org>2005-01-28 05:02:13 +0000
commitbad78b265c4a0765532ab7d2ac5493c0a2e39191 (patch)
tree16fadd7614f98d4101435336cd7d5d0a95bbb58d /sys/dev/ips/ips_pci.c
parenta52d6034c25c293be752e89574f77b0c7059ae46 (diff)
downloadFreeBSD-src-bad78b265c4a0765532ab7d2ac5493c0a2e39191.zip
FreeBSD-src-bad78b265c4a0765532ab7d2ac5493c0a2e39191.tar.gz
Lock the IPS driver and bring it out from under Giant. Also do some
significant clean up and optimizations: - don't call bioq_disksort() on every command, the hardware will do that for us. - remove all of the complicated bio deferral code. bio's that can't be serviced immediately can just wait on the bioq. - Only reserve one command object for doing control commands to the card. This simplifies a lot of code and significantly reduces the size of the command struct. - Allocate commands out of a slab instead of embedding them into the softc. - Call the command action method directly instead of having ips_get_free_cmd() call it indirectly. MFC After: 1 week
Diffstat (limited to 'sys/dev/ips/ips_pci.c')
-rw-r--r--sys/dev/ips/ips_pci.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/ips/ips_pci.c b/sys/dev/ips/ips_pci.c
index 5431c96..3b76c93 100644
--- a/sys/dev/ips/ips_pci.c
+++ b/sys/dev/ips/ips_pci.c
@@ -123,7 +123,7 @@ static int ips_pci_attach(device_t dev)
device_printf(dev, "irq allocation failed\n");
goto error;
}
- if(bus_setup_intr(dev, sc->irqres, INTR_TYPE_BIO, sc->ips_adapter_intr, sc, &sc->irqcookie)){
+ if(bus_setup_intr(dev, sc->irqres, INTR_TYPE_BIO|INTR_MPSAFE, sc->ips_adapter_intr, sc, &sc->irqcookie)){
device_printf(dev, "irq setup failed\n");
goto error;
}
@@ -138,8 +138,8 @@ static int ips_pci_attach(device_t dev)
/* numsegs */ IPS_MAX_SG_ELEMENTS,
/* maxsegsize*/ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
- /* lockfunc */ busdma_lock_mutex,
- /* lockarg */ &Giant,
+ /* lockfunc */ NULL,
+ /* lockarg */ NULL,
&sc->adapter_dmatag) != 0) {
printf("IPS can't alloc dma tag\n");
goto error;
@@ -147,6 +147,7 @@ static int ips_pci_attach(device_t dev)
sc->ips_ich.ich_func = ips_intrhook;
sc->ips_ich.ich_arg = sc;
mtx_init(&sc->queue_mtx, "IPS bioqueue lock", MTX_DEF, 0);
+ sema_init(&sc->cmd_sema, 0, "IPS Command Semaphore");
bioq_init(&sc->queue);
if (config_intrhook_establish(&sc->ips_ich) != 0) {
printf("IPS can't establish configuration hook\n");
@@ -181,6 +182,8 @@ static int ips_pci_free(ips_softc_t *sc)
if(sc->iores)
bus_release_resource(sc->dev, sc->iotype, sc->rid, sc->iores);
sc->configured = 0;
+ mtx_destroy(&sc->queue_mtx);
+ sema_destroy(&sc->cmd_sema);
return 0;
}
OpenPOWER on IntegriCloud