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.

This commit is contained in:
Søren Schmidt 2008-06-11 06:44:58 +00:00
parent c9688a603b
commit 082b99a8b9
2 changed files with 5 additions and 6 deletions

View File

@ -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,

View File

@ -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