[PATCH:xf86-video-tdfx] Don't mess with BARs if only one card is present.

Thomas Klausner wiz at NetBSD.org
Tue Jul 28 09:18:12 PDT 2015


From: Michael Lorenz <macallan at NetBSD.org>

Fixes this driver on NetBSD/macppc.

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 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



More information about the xorg-devel mailing list