summaryrefslogtreecommitdiff
blob: b858ecb5a402c6ea2758270226acb725901e1c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 66482b79cf539e53a522787fce7fdfe74989a0e4 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Thu, 10 May 2012 13:11:12 -0400
Subject: [PATCH 1/3] compiler.h: split MIPS and ARM code

Signed-off-by: Matt Turner <mattst88@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