Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix forcing use of DMA mode for the generic pcii...



details:   https://anonhg.NetBSD.org/src/rev/52a9ac2085af
branches:  trunk
changeset: 586898:52a9ac2085af
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Jan 04 22:10:10 2006 +0000

description:
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.

diffstat:

 sys/dev/pci/pciide_common.c |  27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diffs (63 lines):

diff -r 1b94de90ec38 -r 52a9ac2085af sys/dev/pci/pciide_common.c
--- a/sys/dev/pci/pciide_common.c       Wed Jan 04 22:05:26 2006 +0000
+++ b/sys/dev/pci/pciide_common.c       Wed Jan 04 22:10:10 2006 +0000
@@ -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 @@
        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 @@
                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 @@
                                    "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) {



Home | Main Index | Thread Index | Old Index