From 6ad7a02d77ad57422cb69e5b8f08f5f03f057eb0 Mon Sep 17 00:00:00 2001 From: bouyer Date: Wed, 4 Jan 2006 22:10:10 +0000 Subject: [PATCH] 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. --- sys/dev/pci/pciide_common.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c index b4263e189891..bb7259621b00 100644 --- a/sys/dev/pci/pciide_common.c +++ b/sys/dev/pci/pciide_common.c @@ -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 -__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 #include @@ -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) {