[PATCH 2/3] compiler.h: change MIPS IOPortBase to ioBase
Matt Turner
mattst88 at gmail.com
Thu May 10 11:20:34 PDT 2012
This will allow us to use the existing __powerpc__ code paths in
lnx_video.c.
Also remove unnecessary casts.
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
hw/xfree86/common/compiler.h | 33 ++++++++++++------------------
hw/xfree86/os-support/linux/lnx_video.c | 5 +++-
2 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 27bce92..9669df9 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -704,50 +704,43 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
}
#elif defined(__mips__)
-#define PORT_SIZE short
-_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
+extern _X_EXPORT volatile unsigned char *ioBase;
static __inline__ void
-outb(unsigned PORT_SIZE port, unsigned char val)
+outb(unsigned short port, unsigned char val)
{
- *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
- val;
+ *(volatile unsigned char *) (port + (uintptr_t)ioBase) = val;
}
static __inline__ void
-outw(unsigned PORT_SIZE port, unsigned short val)
+outw(unsigned short port, unsigned short val)
{
- *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
- val;
+ *(volatile unsigned short *) (port + (uintptr_t)ioBase) = val;
}
static __inline__ void
-outl(unsigned PORT_SIZE port, unsigned int val)
+outl(unsigned short port, unsigned int val)
{
- *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
- val;
+ *(volatile unsigned int *) (port + (uintptr_t)ioBase) = val;
}
static __inline__ unsigned int
-inb(unsigned PORT_SIZE port)
+inb(unsigned short port)
{
- return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) +
- IOPortBase);
+ return *(volatile unsigned char *) (port + (uintptr_t)ioBase);
}
static __inline__ unsigned int
-inw(unsigned PORT_SIZE port)
+inw(unsigned short port)
{
- return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) +
- IOPortBase);
+ return *(volatile unsigned short *) (port + (uintptr_t)ioBase);
}
static __inline__ unsigned int
-inl(unsigned PORT_SIZE port)
+inl(unsigned short port)
{
- return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) +
- IOPortBase);
+ return *(volatile unsigned int *) (port + (uintptr_t)ioBase);
}
#ifdef linux /* don't mess with other OSs */
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 3526a21..cd46f97 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -472,8 +472,11 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
/* I/O Permissions section */
/***************************************************************************/
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
volatile unsigned char *ioBase = NULL;
+#endif
+
+#if defined(__powerpc__)
#ifndef __NR_pciconfig_iobase
#define __NR_pciconfig_iobase 200
--
1.7.3.4
More information about the xorg-devel
mailing list