Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Apply patch from David Sainty <David.Sainty@opti...



details:   https://anonhg.NetBSD.org/src/rev/81818457e612
branches:  trunk
changeset: 494336:81818457e612
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Jul 05 18:58:41 2000 +0000

description:
Apply patch from David Sainty <David.Sainty%optimation.co.nz@localhost>:
Some AMD controllers have a bug which can look up the machine when using DMA, so
disable DMA for some revisions (info provided by AMD).
"options PCIIDE_AMD756_ENABLEDMA" can be used to force DMA on these chips.

diffstat:

 sys/dev/pci/pciide.c |  41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)

diffs (63 lines):

diff -r d3db78dd4924 -r 81818457e612 sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c      Wed Jul 05 18:56:20 2000 +0000
+++ b/sys/dev/pci/pciide.c      Wed Jul 05 18:58:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciide.c,v 1.75 2000/07/05 16:11:35 bouyer Exp $       */
+/*     $NetBSD: pciide.c,v 1.76 2000/07/05 18:58:41 bouyer Exp $       */
 
 
 /*
@@ -1713,21 +1713,46 @@
        struct pci_attach_args *pa;
 {
        struct pciide_channel *cp;
-       pcireg_t interface = PCI_INTERFACE(pa->pa_class);
-       int channel;
+       pcireg_t classreg, interface;
+       int channel, dmacap;
        pcireg_t chanenable;
        bus_size_t cmdsize, ctlsize;
 
        if (pciide_chipen(sc, pa) == 0)
                return;
-       printf("%s: bus-master DMA support present",
-           sc->sc_wdcdev.sc_dev.dv_xname);
-       pciide_mapreg_dma(sc, pa);
-       printf("\n");
+
+       classreg = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_CLASS_REG);
+       interface = PCI_INTERFACE(classreg);
+
+
+#ifndef PCIIDE_AMD756_ENABLEDMA
+       /*
+        * The AMD756 chip revision D2 has a bug affecting DMA (but
+        * not UDMA) modes.  The workaround documented by AMD is to
+        * not use DMA on any drive which does not support UDMA modes,
+        * but this does not appear to be necessary on all drives.
+        * The bug, if triggered, will cause a total system hang.
+        *
+        * http://www.amd.com/products/cpg/athlon/techdocs/pdf/22591.pdf
+        */
+       if (AMD756_CHIPREV_DISABLEDMA(PCI_REVISION(classreg))) {
+               printf("%s: multi-word DMA disabled due to chip revision\n",
+                   sc->sc_wdcdev.sc_dev.dv_xname);
+               dmacap = 0;
+       } else
+#endif /* PCIIDE_AMD756_ENABLEDMA */
+       {
+               dmacap = WDC_CAPABILITY_DMA | WDC_CAPABILITY_UDMA;
+               printf("%s: bus-master DMA support present",
+                   sc->sc_wdcdev.sc_dev.dv_xname);
+               pciide_mapreg_dma(sc, pa);
+               printf("\n");
+       }
+
        sc->sc_wdcdev.cap = WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 |
            WDC_CAPABILITY_MODE;
        if (sc->sc_dma_ok) {
-               sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA | WDC_CAPABILITY_UDMA;
+               sc->sc_wdcdev.cap |= dmacap;
                sc->sc_wdcdev.cap |= WDC_CAPABILITY_IRQACK;
                sc->sc_wdcdev.irqack = pciide_irqack;
        }



Home | Main Index | Thread Index | Old Index