summaryrefslogtreecommitdiff
blob: a6bee61be947759bcb4fb444e434782ef0230936 (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
95
96
97
98
99
100
101
102
103
104
From d83874593b04258cc5b866eb57d4d085eed67fae Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Thu, 10 May 2012 13:21:20 -0400
Subject: [PATCH 2/3] compiler.h: change MIPS IOPortBase to ioBase

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@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