Module Name:    xsrc
Committed By:   macallan
Date:           Sun Jan 22 18:26:42 UTC 2012

Modified Files:
        xsrc/external/mit/xf86-video-tdfx/dist/src: tdfx_driver.c

Log Message:
don't mess with BARs if only one card is present
now this works again on macppc
While there, move USE_INT10 and USE_PCIVGAIO to the reachover Makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
    xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c
diff -u xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c:1.1.1.4 xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c:1.2
--- xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c:1.1.1.4	Sat Aug 22 00:10:18 2009
+++ xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c	Sun Jan 22 18:26:42 2012
@@ -6,9 +6,6 @@
 #include <inttypes.h>
 #endif
 
-#define USE_INT10 1
-#define USE_PCIVGAIO 1
-
 /**************************************************************************
 
 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -658,23 +655,28 @@ TDFXInitChips(ScrnInfoPtr pScrn)
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
 		   "TDFXInitChips: cfgbits = 0x%08lx\n", cfgbits);
 
-    for (i = 0; i < pTDFX->numChips; i++) {
+    if (pTDFX->numChips == 1) {
+      /*
+       * XXX
+       * Do not fudge BARs with only one chip present.
+       * Now this works again on NetBSD/macppc.
+       */
+      pTDFX->MMIOAddr[0] = mem0base & 0xffffff00;
+      pTDFX->LinearAddr[0] = mem1base & 0xffffff00;
+    } else {
+      for (i = 0; i < pTDFX->numChips; i++) {
 	PCI_WRITE_LONG(initbits | BIT(10), CFG_INIT_ENABLE, i);
-
-#if 0
-	v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
-	if (!i)
-	    pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v | 0x3);
-	else
-	    pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v | 0x2);
-#endif
-
+	
+	#if 0
+		v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
+		if (!i)
+		    pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v | 0x3);
+		else
+		    pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v | 0x2);
+	#endif
+	
 	pTDFX->MMIOAddr[i] = mem0base + (i * mem0size);
 
-	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
-		       "TDFXInitChips: MMIOAddr[%d] = 0x%08lx\n",
-		       i, pTDFX->MMIOAddr[i]);
-
 	PCI_WRITE_LONG(pTDFX->MMIOAddr[i], CFG_MEM0BASE, i);
 
 	pTDFX->MMIOAddr[i] &= 0xFFFFFF00;
@@ -682,14 +684,18 @@ TDFXInitChips(ScrnInfoPtr pScrn)
 
 	PCI_WRITE_LONG(pTDFX->LinearAddr[i], CFG_MEM1BASE, i);
 
-	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
-		       "TDFXInitChips: LinearAddr[%d] = 0x%08lx\n",
-		       i, pTDFX->LinearAddr[i]);
 	pTDFX->LinearAddr[i] &= 0xFFFFFF00;
 
 	PCI_WRITE_LONG(cfgbits, CFG_PCI_DECODE, i);
 	PCI_WRITE_LONG(initbits, CFG_INIT_ENABLE, i);
+      }
     }
+    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+		       "TDFXInitChips: MMIOAddr[%d] = 0x%08lx\n",
+		       0, pTDFX->MMIOAddr[0]);
+    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+		       "TDFXInitChips: LinearAddr[%d] = 0x%08lx\n",
+		       0, pTDFX->LinearAddr[0]);
 }
 
 void
@@ -2214,7 +2220,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr 
 
   if (!pTDFX->usePIO) TDFXSetMMIOAccess(pTDFX);
 
-#if USE_PCIVGAIO
+#ifndef USE_PCIVGAIO
+  /* access VGA registers through the IO BAR, not legacy decoding */
   hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300;
 #endif
   vgaHWGetIOBase(hwp);

Reply via email to