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:
parent
c9688a603b
commit
082b99a8b9
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user