--- xorg-server-1.7.6.orig/hw/xfree86/os-support/linux/lnx_video.c	2010-03-12 05:38:22.000000000 +0100
+++ xorg-server-1.7.6/hw/xfree86/os-support/linux/lnx_video.c	2010-05-14 19:06:06.873473002 +0200
@@ -64,6 +64,8 @@ static Bool ExtendedEnabled = FALSE;
       !defined(__mips__) && \
       !defined(__arm__)
 
+#include "compiler.h"
+
 /*
  * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
  * these.
@@ -497,7 +499,7 @@ volatile unsigned char *ioBase = NULL;
 Bool
 xf86EnableIO(void)
 {
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
 	int fd;
 	unsigned int ioBase_phys;
 #endif
@@ -524,6 +526,20 @@ xf86EnableIO(void)
 #endif
 	}
 	close(fd);
+#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(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__)
         if (ioperm(0, 1024, 1) || iopl(3)) {
                 if (errno == ENODEV)
