diff options
author | Matt Kraai <kraai@ftbfs.org> | 2011-10-15 21:35:35 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-16 13:31:46 -0700 |
commit | f1d95a9f09cfe11fd127d19baf7262b7df6ba772 (patch) | |
tree | 25dffe80783a656458d0aad29e4cf555a5b7be02 | |
parent | 48f2227d8e17bd4da1f9f241f1d50ded9269a04a (diff) |
xfree86: Add Loongson MIPS supportbus-cleanup
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41038
Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_video.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 18116bda6..7cdfa1fd4 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -120,42 +120,43 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) /***************************************************************************/ #if defined(__powerpc__) -volatile unsigned char *ioBase = NULL; - #ifndef __NR_pciconfig_iobase #define __NR_pciconfig_iobase 200 #endif - #endif Bool xf86EnableIO(void) { -#if defined(__powerpc__) +#if defined(__mips__) || defined(__powerpc__) int fd; - unsigned int ioBase_phys; + pointer ioBase_phys; #endif if (ExtendedEnabled) return TRUE; -#if defined(__powerpc__) +#if defined(__mips__) || defined(__powerpc__) + +# if defined(__mips__) + ioBase_phys = 0x1fd00000; +# elif defined(__powerpc__) ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0); +# endif fd = open("/dev/mem", O_RDWR); - if (ioBase == NULL) { - ioBase = (volatile unsigned char *)mmap(0, 0x20000, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, - ioBase_phys); -/* Should this be fatal or just a warning? */ -#if 0 - if (ioBase == MAP_FAILED) { - xf86Msg(X_WARNING, - "xf86EnableIOPorts: Failed to map iobase (%s)\n", - strerror(errno)); - return FALSE; + if (IOPortBase == 0) { + pointer base = (poiner)mmap(0, 0x20000, PROT_READ | PROT_WRITE, + MAP_SHARED, fd, ioBase_phys); + + if (base == MAP_FAILED) { + ErrorF("xf86EnableIOPorts: Failed to map iobase (%s)\n", + strerror(errno)); + close(fd); + return FALSE; } -#endif + + IOPortBase = base; } close(fd); #elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__) @@ -184,9 +185,9 @@ xf86DisableIO(void) { if (!ExtendedEnabled) return; -#if defined(__powerpc__) - munmap(ioBase, 0x20000); - ioBase = NULL; +#if defined(__powerpc__) || defined(__mips__) + munmap(IOPortBase, 0x20000); + IOPortBase = 0; #elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__) iopl(0); ioperm(0, 1024, 0); |