Subject: Re: "bus-master DMA support present, but unused (couldn't map
To: None <port-i386@netbsd.org>
From: Steve Woodford <steve@mctavish.co.uk>
List: port-i386
Date: 07/18/2001 18:57:15
On Wed, 18 Jul 2001, Henry Nelson wrote:

[OPTi pciide DMA problems]

> Are there a lot of changes to be made?  If it is just a matter of patching
> one or two files (or replacing them with current ones) and then recompiling
> the kernel, I'd like to give it a shot.  I'd really appreciate brief
> instructions on what files to patch/replace, and where to get the patches
> or files, if it's not overly complex.  Thanks.

Here is a patch against 1.5.1's sys/dev/pci/pciide.c ...

Cheers, Steve


Index: pciide.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pciide.c,v
retrieving revision 1.68.2.25
diff -u -r1.68.2.25 pciide.c
--- pciide.c	2001/07/02 13:47:25	1.68.2.25
+++ pciide.c	2001/07/18 17:56:39
@@ -3534,11 +3534,26 @@
 		return;
 	printf("%s: bus-master DMA support present",
 	    sc->sc_wdcdev.sc_dev.dv_xname);
-	pciide_mapreg_dma(sc, pa);
+
+	/*
+	 * XXXSCW:
+	 * There seem to be a couple of buggy revisions/implementations
+	 * of the OPTi pciide chipset. This kludge seems to fix one of
+	 * the reported problems (PR/11644) but still fails for the
+	 * other (PR/13151), although the latter may be due to other
+	 * issues too...
+	 */
+	if (PCI_REVISION(pa->pa_class) <= 0x12) {
+		printf(" but disabled due to chip rev. <= 0x12");
+		sc->sc_dma_ok = 0;
+		sc->sc_wdcdev.cap = 0;
+	} else {
+		sc->sc_wdcdev.cap = WDC_CAPABILITY_DATA32;
+		pciide_mapreg_dma(sc, pa);
+	}
 	printf("\n");

-	sc->sc_wdcdev.cap = WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 |
-	    WDC_CAPABILITY_MODE;
+	sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_MODE;
 	sc->sc_wdcdev.PIO_cap = 4;
 	if (sc->sc_dma_ok) {
 		sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA | WDC_CAPABILITY_IRQACK;