[PATCH 1/2] xfree86: Fix type of IOPortBase to be a pointer

Jeremy Huddleston jeremyhu at apple.com
Sat Oct 15 21:38:05 PDT 2011


This addresses issues on 64bit systems where the IOPortBase is higher in
memory space.

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41038

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
 hw/xfree86/common/compiler.h          |    2 +-
 hw/xfree86/os-support/bsd/arm_video.c |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 9e00d75..e4856a2 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -714,7 +714,7 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
 #     define PORT_SIZE short
 #    endif
 
-_X_EXPORT unsigned int IOPortBase;  /* Memory mapped I/O port area */
+_X_EXPORT pointer IOPortBase;  /* Memory mapped I/O port area */
 
 static __inline__ void
 outb(unsigned PORT_SIZE port, unsigned char val)
diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index b59c8e0..dac6587 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -475,7 +475,7 @@ int ScreenNum;
 #endif
 
 #ifdef __arm32__
-	IOPortBase = (unsigned int)-1;
+	IOPortBase = (pointer)-1;
 
 	if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL)
 	{
@@ -487,8 +487,7 @@ int ScreenNum;
 	     * actually mmap the start of the page, then the start of video
 	     * I/O space is added as an internal offset.
 	     */
-	    IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP,
-						      (caddr_t)0x0, 0L) 
+	    IOPortBase = (pointer)xf86MapInfoMap(memInfoP, (caddr_t)0x0, 0L)
 		- memInfoP->memInfo.u.map_info_mmap.internal_offset;
 	    ExtendedEnabled = TRUE;
 	    return TRUE;
@@ -502,10 +501,10 @@ int ScreenNum;
 				 MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE);
 
 	    if (base != (pointer)-1)
-		IOPortBase = (unsigned int)base;
+		IOPortBase = base;
 	}
 
-        if (IOPortBase == (unsigned int)-1)
+        if (IOPortBase == (pointer)-1)
 	{	
 	    xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
 Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
@@ -551,7 +550,7 @@ int ScreenNum;
 			return;
 
 	munmap((caddr_t)IOPortBase, 0x400);
-	IOPortBase = (unsigned int)-1;
+	IOPortBase = (pointer)-1;
 	ExtendedEnabled = FALSE;
 #endif
 
-- 
1.7.6.1




More information about the xorg-devel mailing list