Module Name:    xsrc
Committed By:   macallan
Date:           Wed Jan  4 23:55:43 UTC 2017

Modified Files:
        xsrc/external/mit/xf86-video-chips/dist/src: ct_driver.c

Log Message:
pci_device_map_legacy() doesn't help us when we need to map VL ranges - just
call mmap() directly on consoleFd for those. Now this works again on shark.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
    xsrc/external/mit/xf86-video-chips/dist/src/ct_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-chips/dist/src/ct_driver.c
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.24 xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.25
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.24	Wed Nov  2 15:56:01 2016
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c	Wed Jan  4 23:55:43 2017
@@ -77,6 +77,10 @@
 #include "xf86_OSproc.h"
 #include "xf86Priv.h"
 
+#if defined(HAVE_ISA)
+#include <sys/mman.h>
+#endif
+
 /* Everything using inb/outb, etc needs "compiler.h" */
 #include "compiler.h"
 
@@ -770,8 +774,10 @@ CHIPSAvailableOptions(int chipid, int bu
 
 #ifdef HAVE_ISA
     if (busid == BUS_ISA) {
-    	if ((chip == CHIPS_CT64200) || (chip == CHIPS_CT64300)) 
+    	if ((chip == CHIPS_CT64200) || (chip == CHIPS_CT64300)) { 
 	    return ChipsWingineOptions;
+	} else if ((chip >= CHIPS_CT65550) && (chip <= CHIPS_CT69030))
+	    return ChipsHiQVOptions;
     }
 #endif
     if (busid == BUS_PCI) {
@@ -4062,7 +4068,7 @@ CHIPSScreenInit(SCREEN_INIT_ARGS_DECL)
 	miDCInitialize (pScreen, xf86GetPointerScreenFuncs());
 
     } else
-#endif /* HAVE_ISA */
+#endif /* USE_MIBANK */
     {
     /* !!! Only support linear addressing for now. This might change */
 	/* Setup pointers to free space in video ram */
@@ -6861,14 +6867,16 @@ chipsMapMem(ScrnInfoPtr pScrn)
 						   PCI_DEV_MAP_FLAG_WRITABLE,
 						   result);
 		    } else {
-			err = pci_device_map_legacy(cPtr->PciInfo,
-						    cPtr->IOAddress,
-						    0x00020000U,
-						    PCI_DEV_MAP_FLAG_WRITABLE,
-						    result);
+			*result = mmap(NULL,
+			           0x00020000U,
+			           PROT_READ | PROT_WRITE,
+			           MAP_SHARED,
+			           xf86Info.consoleFd,
+			           cPtr->IOAddress);
+			err = (*result == MAP_FAILED);
 		    }
 		    if (err) {
-			xf86Msg(X_ERROR, "PCI mmap failed\n");
+			xf86Msg(X_ERROR, "PCI mmap registers failed\n");
 		        return FALSE;
 		    }
 		}
@@ -6894,11 +6902,13 @@ chipsMapMem(ScrnInfoPtr pScrn)
 						   PCI_DEV_MAP_FLAG_WRITABLE,
 						   result);
 		    } else {
-			err = pci_device_map_legacy(cPtr->PciInfo,
-						    cPtr->IOAddress,
-						    0x00010000U,
-						    PCI_DEV_MAP_FLAG_WRITABLE,
-						    result);
+			*result = mmap(NULL,
+			           0x00010000U,
+			           PROT_READ | PROT_WRITE,
+			           MAP_SHARED,
+			           xf86Info.consoleFd,
+			           cPtr->IOAddress);
+			err = (*result == MAP_FAILED);
 		    }
 		    if (err) {
 			xf86Msg(X_ERROR, "PCI mmap failed\n");
@@ -6950,12 +6960,13 @@ chipsMapMem(ScrnInfoPtr pScrn)
 					   PCI_DEV_MAP_FLAG_WRITE_COMBINE,
 					   result);
 	    } else
-		err = pci_device_map_legacy(cPtr->PciInfo,
-					    Addr,
-					    Map,
-					    PCI_DEV_MAP_FLAG_WRITABLE |
-					    PCI_DEV_MAP_FLAG_WRITE_COMBINE,
-					    result);
+			*result = mmap(NULL,
+			           Map,
+			           PROT_READ | PROT_WRITE,
+			           MAP_SHARED,
+			           xf86Info.consoleFd,
+			           Addr);
+			err = (*result == MAP_FAILED);
 	    if (err) {
 		xf86Msg(X_ERROR, "PCI mmap fb failed\n");
 		return FALSE;

Reply via email to