[PATCH] xfree86: Add Loongson MIPS support

Matt Kraai kraai at ftbfs.org
Tue Oct 11 23:58:11 PDT 2011


Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41038
---
 hw/xfree86/dri/sarea.h                  |    2 ++
 hw/xfree86/os-support/linux/lnx_video.c |   20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

 I asked the person that I received this patch from,
 liushiwei at gmail.com, to certify the Developer's Certificate of
 Origin.  They said that this patch was available under the GPL2+ and
 was written by zhangfx at lemote.com.  The modified files are not
 licensed under the GPL.  Do I need to ask them to relicense the
 patch?

diff --git a/hw/xfree86/dri/sarea.h b/hw/xfree86/dri/sarea.h
index 1528cc1..6be12b9 100644
--- a/hw/xfree86/dri/sarea.h
+++ b/hw/xfree86/dri/sarea.h
@@ -42,6 +42,8 @@
 /* SAREA area needs to be at least a page */
 #if defined(__alpha__)
 #define SAREA_MAX 			0x2000
+#elif defined(__mips__)
+#define SAREA_MAX			0x4000
 #elif defined(__ia64__)
 #define SAREA_MAX			0x10000		/* 64kB */
 #else
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 3d45511..3e16898 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -493,9 +493,10 @@ volatile unsigned char *ioBase = NULL;
 Bool
 xf86EnableIO(void)
 {
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
 	int fd;
 	unsigned int ioBase_phys;
+	extern unsigned int IOPortBase;
 #endif
 
 	if (ExtendedEnabled)
@@ -520,7 +521,22 @@ xf86EnableIO(void)
 #endif
 	}
 	close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
+#elif defined(__mips__)
+	fd = open("/dev/mem", O_RDWR);
+	IOPortBase = (volatile unsigned char *)mmap(0, 0x20000,
+			PROT_READ | PROT_WRITE, MAP_SHARED, fd,
+			0x1fd00000);
+	if (IOPortBase == MAP_FAILED) {
+		xf86Msg(X_WARNING,
+				"xf86EnableIOPorts: Failed to map iobase (%s)\n",
+				strerror(errno));
+		return FALSE;
+	}
+	close(fd);
+	xf86Msg(X_WARNING,
+	       "xf86EnableIOPorts: map iobase (%x)\n",
+	        IOPortBase);
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
         if (ioperm(0, 1024, 1) || iopl(3)) {
                 if (errno == ENODEV)
                         ErrorF("xf86EnableIOPorts: no I/O ports found\n");
-- 
1.7.6.3



More information about the xorg-devel mailing list