Fix forcing use of DMA mode for the generic pciide driver: default_chip_map()

is called from pciide_attach() and at this point we don't know which drives
are here. Just assume all drives are there and allocate DMA ressources for
all of them.
This commit is contained in:
bouyer 2006-01-04 22:10:10 +00:00
parent 4d09f9add9
commit 6ad7a02d77

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciide_common.c,v 1.28 2005/12/11 12:22:50 christos Exp $ */
/* $NetBSD: pciide_common.c,v 1.29 2006/01/04 22:10:10 bouyer Exp $ */
/*
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.28 2005/12/11 12:22:50 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.29 2006/01/04 22:10:10 bouyer Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -856,8 +856,7 @@ default_chip_map(sc, pa)
struct pciide_channel *cp;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
pcireg_t csr;
int channel, drive, s;
struct ata_drive_datas *drvp;
int channel, drive;
u_int8_t idedma_ctl;
bus_size_t cmdsize, ctlsize;
const char *failreason;
@ -970,12 +969,10 @@ next:
idedma_ctl = 0;
cp = &sc->pciide_channels[channel];
for (drive = 0; drive < cp->ata_channel.ch_ndrive; drive++) {
drvp = &cp->ata_channel.ch_drive[drive];
/* If no drive, skip */
if ((drvp->drive_flags & DRIVE) == 0)
continue;
if ((drvp->drive_flags & DRIVE_DMA) == 0)
continue;
/*
* we have not probed the drives yet, allocate
* ressources for all of them.
*/
if (pciide_dma_table_setup(sc, channel, drive) != 0) {
/* Abort DMA setup */
aprint_error(
@ -983,13 +980,11 @@ next:
"using PIO transfers\n",
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname,
channel, drive);
s = splbio();
drvp->drive_flags &= ~DRIVE_DMA;
splx(s);
sc->sc_dma_ok = 0;
sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA;
sc->sc_wdcdev.irqack = NULL;
break;
}
aprint_normal("%s:%d:%d: using DMA data transfers\n",
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname,
channel, drive);
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
}
if (idedma_ctl != 0) {