From: Michael Lorenz <[email protected]>

Fixes this driver on NetBSD/macppc.

Signed-off-by: Thomas Klausner <[email protected]>
---
 src/tdfx_driver.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

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);
-- 
2.4.6

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to