summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/xf86-video-siliconmotion-fix-ftbfs.patch
blob: 8aeec455d79ead61498a42a254d94fb81b8dc3f9 (about) (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From eee8fd4c489a693344da0bba14cfa54c54610b89 Mon Sep 17 00:00:00 2001
From: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Date: Thu, 9 Mar 2017 13:31:34 +0200
Subject: [PATCH] Fix build against xorg server 1.17 on certain architectures

Fixes at least arm64, likely also hppa, m68k, sh4.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
---
 src/regsmi.h       | 18 ++++++++++++++++++
 src/smi.h          |  2 ++
 src/smi_driver.c   | 19 +++++++++----------
 src/smilynx_crtc.c |  6 +++---
 src/smilynx_hw.c   |  5 ++---
 5 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/src/regsmi.h b/src/regsmi.h
index 5dd0320..69205ba 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -64,8 +64,13 @@ VGAIN8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index)
 	MMIO_OUT8(pSmi->IOBase, indexPort, index);
 	return(MMIO_IN8(pSmi->IOBase, dataPort));
     } else {
+#ifdef XSERVER_LIBPCIACCESS
+	pci_io_write8(pSmi->io, indexPort, index);
+	return pci_io_read8(pSmi->io, dataPort);
+#else
 	outb(pSmi->PIOBase + indexPort, index);
 	return(inb(pSmi->PIOBase + dataPort));
+#endif
     }
 }
 
@@ -76,8 +81,13 @@ VGAOUT8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index, CARD8 data)
 	MMIO_OUT8(pSmi->IOBase, indexPort, index);
 	MMIO_OUT8(pSmi->IOBase, dataPort, data);
     } else {
+#ifdef XSERVER_LIBPCIACCESS
+	pci_io_write8(pSmi->io, indexPort, index);
+	pci_io_write8(pSmi->io, dataPort, data);
+#else
 	outb(pSmi->PIOBase + indexPort, index);
 	outb(pSmi->PIOBase + dataPort, data);
+#endif
     }
 }
 
@@ -87,7 +97,11 @@ VGAIN8(SMIPtr pSmi, int port)
     if (pSmi->IOBase) {
 	return(MMIO_IN8(pSmi->IOBase, port));
     } else {
+#ifdef XSERVER_LIBPCIACCESS
+	return pci_io_read8(pSmi->io, port);
+#else
 	return(inb(pSmi->PIOBase + port));
+#endif
     }
 }
 
@@ -97,7 +111,11 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
     if (pSmi->IOBase) {
 	MMIO_OUT8(pSmi->IOBase, port, data);
     } else {
+#ifdef XSERVER_LIBPCIACCESS
+	pci_io_write8(pSmi->io, port, data);
+#else
 	outb(pSmi->PIOBase + port, data);
+#endif
     }
 }
 
diff --git a/src/smi.h b/src/smi.h
index 2742c8d..1f20a2d 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -171,6 +171,8 @@ typedef struct
     pciVideoPtr		PciInfo;	/* PCI info vars */
 #ifndef XSERVER_LIBPCIACCESS
     PCITAG		PciTag;
+#else
+    struct pci_io_handle *io;
 #endif
     int			Chipset;	/* Chip info, set using PCI
 					   above */
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 8949cae..6bdf64d 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -446,6 +446,9 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
 	pSmi->PIOBase = hwp->PIOOffset;
 #else
 	pSmi->PIOBase = 0;
+#ifdef XSERVER_LIBPCIACCESS
+	pSmi->io = hwp->io;
+#endif
 #endif
 
 	xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, "
@@ -2022,16 +2025,14 @@ SMI_EnableMmio(ScrnInfoPtr pScrn)
 	vgaHWSetStdFuncs(hwp);
 
 	/* Enable linear mode */
-	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
-	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
+	tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18);
 	pSmi->SR18Value = tmp;					/* PDR#521 */
-	outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x11);
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, tmp | 0x11);
 
 	/* Enable 2D/3D Engine and Video Processor */
-	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
-	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
+	tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
 	pSmi->SR21Value = tmp;					/* PDR#521 */
-	outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp & ~0x03);
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, tmp & ~0x03);
     }
 
     LEAVE();
@@ -2050,12 +2051,10 @@ SMI_DisableMmio(ScrnInfoPtr pScrn)
 	vgaHWSetStdFuncs(hwp);
 
 	/* Disable 2D/3D Engine and Video Processor */
-	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
-	outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR21Value);	/* PDR#521 */
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, pSmi->SR21Value);	/* PDR#521 */
 
 	/* Disable linear mode */
-	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
-	outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR18Value);	/* PDR#521 */
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, pSmi->SR18Value);	/* PDR#521 */
     }
 
     LEAVE();
diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c
index fb7183c..f4d8b4e 100644
--- a/src/smilynx_crtc.c
+++ b/src/smilynx_crtc.c
@@ -619,9 +619,9 @@ SMILynx_CrtcModeSet_bios(xf86CrtcPtr crtc,
     xf86ExecX86int10(pSmi->pInt10);
 
     /* Enable linear mode. */
-    outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
-    tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
-    outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01);
+    VGAOUT8(pSmi, VGA_SEQ_INDEX, 0x18);
+    tmp = VGAIN8(pSmi, VGA_SEQ_DATA);
+    VGAOUT8(pSmi, VGA_SEQ_DATA, tmp | 0x01);
 
     /* Enable DPR/VPR registers. */
     tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
diff --git a/src/smilynx_hw.c b/src/smilynx_hw.c
index b2ee8a5..40aa5a4 100644
--- a/src/smilynx_hw.c
+++ b/src/smilynx_hw.c
@@ -365,9 +365,8 @@ SMILynx_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
 	xf86ExecX86int10(pSmi->pInt10);
 
 	/* Enable linear mode. */
-	outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
-	tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
-	outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01);
+	tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18);
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, tmp | 0x01);
 
 	/* Enable DPR/VPR registers. */
 	tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
-- 
2.7.4