summaryrefslogtreecommitdiffstats
path: root/sys/dev/dpt/dpt_eisa.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-10-15 16:29:08 +0000
committerjhb <jhb@FreeBSD.org>2012-10-15 16:29:08 +0000
commit1cfcf4363cad81943fcff8c3fa4a7dafb9ee2ce4 (patch)
tree2a6110445d2c98f88fa835c85396cf1555a715ec /sys/dev/dpt/dpt_eisa.c
parentb7ae8b66cecbc88664583fc7dc1b0a15a416f161 (diff)
downloadFreeBSD-src-1cfcf4363cad81943fcff8c3fa4a7dafb9ee2ce4.zip
FreeBSD-src-1cfcf4363cad81943fcff8c3fa4a7dafb9ee2ce4.tar.gz
Add locking to the dpt(4) driver and mark it MPSAFE.
- Use device_printf() and device_get_unit() instead of storing the unit number in the softc. - Remove use of explicit bus space handles and tags. - Remove the global dpt_softcs list and use devclass_get_device() instead. - Use pci_enable_busmaster() rather than frobbing the PCI command register directly. Tested by: no one
Diffstat (limited to 'sys/dev/dpt/dpt_eisa.c')
-rw-r--r--sys/dev/dpt/dpt_eisa.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/dev/dpt/dpt_eisa.c b/sys/dev/dpt/dpt_eisa.c
index 9c367c4..6de3405 100644
--- a/sys/dev/dpt/dpt_eisa.c
+++ b/sys/dev/dpt/dpt_eisa.c
@@ -105,11 +105,11 @@ static int
dpt_eisa_attach (device_t dev)
{
dpt_softc_t * dpt;
- int s;
int error = 0;
dpt = device_get_softc(dev);
dpt->dev = dev;
+ dpt_alloc(dev);
dpt->io_rid = 0;
dpt->io_type = SYS_RES_IOPORT;
@@ -120,11 +120,8 @@ dpt_eisa_attach (device_t dev)
goto bad;
}
- dpt_alloc(dev);
-
/* Allocate a dmatag representing the capabilities of this attachment */
- /* XXX Should be a child of the EISA bus dma tag */
- if (bus_dma_tag_create( /* parent */ NULL,
+ if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(dev),
/* alignemnt */ 1,
/* boundary */ 0,
/* lowaddr */ BUS_SPACE_MAXADDR_32BIT,
@@ -135,17 +132,14 @@ dpt_eisa_attach (device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
- /* lockfunc */ busdma_lock_mutex,
- /* lockarg */ &Giant,
+ /* lockfunc */ NULL,
+ /* lockarg */ NULL,
&dpt->parent_dmat) != 0) {
error = ENXIO;
goto bad;
}
- s = splcam();
-
if (dpt_init(dpt) != 0) {
- splx(s);
error = ENXIO;
goto bad;
}
@@ -153,10 +147,8 @@ dpt_eisa_attach (device_t dev)
/* Register with the XPT */
dpt_attach(dpt);
- splx(s);
-
- if (bus_setup_intr(dev, dpt->irq_res, INTR_TYPE_CAM | INTR_ENTROPY,
- NULL, dpt_intr, dpt, &dpt->ih)) {
+ if (bus_setup_intr(dev, dpt->irq_res, INTR_TYPE_CAM | INTR_ENTROPY |
+ INTR_MPSAFE, NULL, dpt_intr, dpt, &dpt->ih)) {
device_printf(dev, "Unable to register interrupt handler\n");
error = ENXIO;
goto bad;
OpenPOWER on IntegriCloud