[PATCH 1/3] compiler.h: split MIPS and ARM code
Matt Turner
mattst88 at gmail.com
Thu May 10 11:20:33 PDT 2012
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
hw/xfree86/common/compiler.h | 55 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 0abdfb6..27bce92 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -703,12 +703,8 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
:"r"(val), "r"(addr), "i"(ASI_PL));
}
-#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
-#ifdef __arm32__
-#define PORT_SIZE long
-#else
+#elif defined(__mips__)
#define PORT_SIZE short
-#endif
_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
@@ -754,7 +750,6 @@ inl(unsigned PORT_SIZE port)
IOPortBase);
}
-#if defined(__mips__)
#ifdef linux /* don't mess with other OSs */
#if X_BYTE_ORDER == X_BIG_ENDIAN
static __inline__ unsigned int
@@ -780,7 +775,53 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
}
#endif
#endif /* !linux */
-#endif /* __mips__ */
+
+#elif (defined(__arm32__) && !defined(__linux__))
+#define PORT_SIZE long
+
+_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
+
+static __inline__ void
+outb(unsigned PORT_SIZE port, unsigned char val)
+{
+ *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
+}
+
+static __inline__ void
+outw(unsigned PORT_SIZE port, unsigned short val)
+{
+ *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
+}
+
+static __inline__ void
+outl(unsigned PORT_SIZE port, unsigned int val)
+{
+ *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) + IOPortBase) =
+ val;
+}
+
+static __inline__ unsigned int
+inb(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned char *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
+}
+
+static __inline__ unsigned int
+inw(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned short *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
+}
+
+static __inline__ unsigned int
+inl(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned int *) (((unsigned PORT_SIZE) (port)) +
+ IOPortBase);
+}
#elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
--
1.7.3.4
More information about the xorg-devel
mailing list