tech-x11 archive

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

NetBSD-local xf86-video-tdfx diff



Hi Michael!

I've reduced our local changes to xf86-video-tdfx to the attached diff
(vs. upstream git version).

If I read the code correctly, there are the following effective
changes (committed with the message that this makes the driver work on
macppc with one card):

* If there is only one card, the following code is not executed:

   (with the MMIOAddr with the lowest 256 bytes set to whatever)

        PCI_WRITE_LONG(pTDFX->MMIOAddr[i], CFG_MEM0BASE, i);

   (with the LinearAddr with the lowest 256 bytes set to whatever)

        PCI_WRITE_LONG(pTDFX->LinearAddr[i], CFG_MEM1BASE, i);

        PCI_WRITE_LONG(cfgbits, CFG_PCI_DECODE, i);
        PCI_WRITE_LONG(initbits, CFG_INIT_ENABLE, i);

* There's a complete reversal of an ifdef which I don't understand:

-#if USE_PCIVGAIO
+#ifndef USE_PCIVGAIO
+  /* access VGA registers through the IO BAR, not legacy decoding */
   hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300;
 #endif


I don't think I can feed this back upstream with what I know. Can you
please explain why the WRITE_LONG are bad, and why the ifdef needed to
become an ifndef?

Thanks,
 Thomas
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 03fa165..b15ff9c 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -661,7 +661,20 @@ 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) {
+      /*
+       * Do not fudge BARs with only one chip present.
+       */
+      pTDFX->MMIOAddr[0] = mem0base & 0xffffff00;
+      pTDFX->LinearAddr[0] = mem1base & 0xffffff00;
+      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]);
+    } else {
+      for (i = 0; i < pTDFX->numChips; i++) {
 	PCI_WRITE_LONG(initbits | BIT(10), CFG_INIT_ENABLE, i);
 
 #if 0
@@ -692,6 +705,7 @@ TDFXInitChips(ScrnInfoPtr pScrn)
 
 	PCI_WRITE_LONG(cfgbits, CFG_PCI_DECODE, i);
 	PCI_WRITE_LONG(initbits, CFG_INIT_ENABLE, i);
+      }
     }
 }
 
@@ -2230,7 +2244,8 @@ TDFXScreenInit(SCREEN_INIT_ARGS_DECL) {
 
   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);


Home | Main Index | Thread Index | Old Index