diff options
author | sos <sos@FreeBSD.org> | 2008-06-11 06:44:58 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2008-06-11 06:44:58 +0000 |
commit | 6fdb33f67f30e3be620213816a0a37968119589e (patch) | |
tree | 11a66ceb59dec3746ff1c5e0c626af3070422713 /sys/dev | |
parent | 4f61d04fd875738269e8ba5c57aac378c2d5051e (diff) | |
download | FreeBSD-src-6fdb33f67f30e3be620213816a0a37968119589e.zip FreeBSD-src-6fdb33f67f30e3be620213816a0a37968119589e.tar.gz |
Rearrange how to call dma.alloc() so that we have resources alloc'd when need but also late enough to know how many to create.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/ata-all.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/ata-pci.c | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index a881f23..efdd27e 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -129,6 +129,10 @@ ata_attach(device_t dev) ATA_RESET(dev); ATA_LOCKING(dev, ATA_LF_UNLOCK); + /* allocate DMA resources if DMA HW present*/ + if (ch->dma.alloc) + ch->dma.alloc(dev); + /* setup interrupt delivery */ rid = ATA_IRQ_RID; ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 0b9d526..a3cb7990 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -611,7 +611,6 @@ static int ata_pcichannel_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); int error; if (ctlr->dmainit) @@ -620,11 +619,7 @@ ata_pcichannel_attach(device_t dev) if ((error = ctlr->allocate(dev))) return error; - if ((error = ata_attach(dev))) - return error; - - ch->dma.alloc(dev); - return 0; + return ata_attach(dev); } static int |