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
105
106
107
108
109
110
111
112
|
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 2601693..b631ba4 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -866,42 +866,42 @@ static __inline__ void stw_u(unsigned long val, unsigned short *p)
# define PORT_SIZE short
# endif
-_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
+_X_EXPORT volatile unsigned char *ioBase; /* 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;
+ *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+ioBase) = val;
}
static __inline__ void
outw(unsigned PORT_SIZE port, unsigned short val)
{
- *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+ *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+ioBase) = val;
}
static __inline__ void
outl(unsigned PORT_SIZE port, unsigned int val)
{
- *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+ *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+ioBase) = val;
}
static __inline__ unsigned int
inb(unsigned PORT_SIZE port)
{
- return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+ioBase);
}
static __inline__ unsigned int
inw(unsigned PORT_SIZE port)
{
- return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+ioBase);
}
static __inline__ unsigned int
inl(unsigned PORT_SIZE port)
{
- return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+ return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+ioBase);
}
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index ed35766..f6df722 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -493,7 +493,7 @@ 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;
#ifndef __NR_pciconfig_iobase
@@ -505,7 +505,7 @@ volatile unsigned char *ioBase = NULL;
Bool
xf86EnableIO(void)
{
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
int fd;
unsigned int ioBase_phys;
#endif
@@ -513,8 +513,12 @@ xf86EnableIO(void)
if (ExtendedEnabled)
return TRUE;
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
+#ifdef __powerpc__
ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+#else
+ ioBase_phys = 0x1fd00000;
+#endif
fd = open("/dev/mem", O_RDWR);
if (ioBase == NULL) {
@@ -532,7 +536,7 @@ xf86EnableIO(void)
#endif
}
close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__)
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__)
if (ioperm(0, 1024, 1) || iopl(3)) {
if (errno == ENODEV)
ErrorF("xf86EnableIOPorts: no I/O ports found\n");
@@ -556,10 +560,10 @@ xf86DisableIO(void)
{
if (!ExtendedEnabled)
return;
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__mips__)
munmap(ioBase, 0x20000);
ioBase = NULL;
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__)
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__)
iopl(0);
ioperm(0, 1024, 0);
#endif
|