gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / xf86-video-siliconmotion-fix-ftbfs.patch
1 From eee8fd4c489a693344da0bba14cfa54c54610b89 Mon Sep 17 00:00:00 2001
2 From: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
3 Date: Thu, 9 Mar 2017 13:31:34 +0200
4 Subject: [PATCH] Fix build against xorg server 1.17 on certain architectures
5
6 Fixes at least arm64, likely also hppa, m68k, sh4.
7
8 Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
9 ---
10 src/regsmi.h | 18 ++++++++++++++++++
11 src/smi.h | 2 ++
12 src/smi_driver.c | 19 +++++++++----------
13 src/smilynx_crtc.c | 6 +++---
14 src/smilynx_hw.c | 5 ++---
15 5 files changed, 34 insertions(+), 16 deletions(-)
16
17 diff --git a/src/regsmi.h b/src/regsmi.h
18 index 5dd0320..69205ba 100644
19 --- a/src/regsmi.h
20 +++ b/src/regsmi.h
21 @@ -64,8 +64,13 @@ VGAIN8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index)
22 MMIO_OUT8(pSmi->IOBase, indexPort, index);
23 return(MMIO_IN8(pSmi->IOBase, dataPort));
24 } else {
25 +#ifdef XSERVER_LIBPCIACCESS
26 + pci_io_write8(pSmi->io, indexPort, index);
27 + return pci_io_read8(pSmi->io, dataPort);
28 +#else
29 outb(pSmi->PIOBase + indexPort, index);
30 return(inb(pSmi->PIOBase + dataPort));
31 +#endif
32 }
33 }
34
35 @@ -76,8 +81,13 @@ VGAOUT8_INDEX(SMIPtr pSmi, int indexPort, int dataPort, CARD8 index, CARD8 data)
36 MMIO_OUT8(pSmi->IOBase, indexPort, index);
37 MMIO_OUT8(pSmi->IOBase, dataPort, data);
38 } else {
39 +#ifdef XSERVER_LIBPCIACCESS
40 + pci_io_write8(pSmi->io, indexPort, index);
41 + pci_io_write8(pSmi->io, dataPort, data);
42 +#else
43 outb(pSmi->PIOBase + indexPort, index);
44 outb(pSmi->PIOBase + dataPort, data);
45 +#endif
46 }
47 }
48
49 @@ -87,7 +97,11 @@ VGAIN8(SMIPtr pSmi, int port)
50 if (pSmi->IOBase) {
51 return(MMIO_IN8(pSmi->IOBase, port));
52 } else {
53 +#ifdef XSERVER_LIBPCIACCESS
54 + return pci_io_read8(pSmi->io, port);
55 +#else
56 return(inb(pSmi->PIOBase + port));
57 +#endif
58 }
59 }
60
61 @@ -97,7 +111,11 @@ VGAOUT8(SMIPtr pSmi, int port, CARD8 data)
62 if (pSmi->IOBase) {
63 MMIO_OUT8(pSmi->IOBase, port, data);
64 } else {
65 +#ifdef XSERVER_LIBPCIACCESS
66 + pci_io_write8(pSmi->io, port, data);
67 +#else
68 outb(pSmi->PIOBase + port, data);
69 +#endif
70 }
71 }
72
73 diff --git a/src/smi.h b/src/smi.h
74 index 2742c8d..1f20a2d 100644
75 --- a/src/smi.h
76 +++ b/src/smi.h
77 @@ -171,6 +171,8 @@ typedef struct
78 pciVideoPtr PciInfo; /* PCI info vars */
79 #ifndef XSERVER_LIBPCIACCESS
80 PCITAG PciTag;
81 +#else
82 + struct pci_io_handle *io;
83 #endif
84 int Chipset; /* Chip info, set using PCI
85 above */
86 diff --git a/src/smi_driver.c b/src/smi_driver.c
87 index 8949cae..6bdf64d 100644
88 --- a/src/smi_driver.c
89 +++ b/src/smi_driver.c
90 @@ -446,6 +446,9 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
91 pSmi->PIOBase = hwp->PIOOffset;
92 #else
93 pSmi->PIOBase = 0;
94 +#ifdef XSERVER_LIBPCIACCESS
95 + pSmi->io = hwp->io;
96 +#endif
97 #endif
98
99 xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, "
100 @@ -2022,16 +2025,14 @@ SMI_EnableMmio(ScrnInfoPtr pScrn)
101 vgaHWSetStdFuncs(hwp);
102
103 /* Enable linear mode */
104 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
105 - tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
106 + tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18);
107 pSmi->SR18Value = tmp; /* PDR#521 */
108 - outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x11);
109 + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, tmp | 0x11);
110
111 /* Enable 2D/3D Engine and Video Processor */
112 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
113 - tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
114 + tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
115 pSmi->SR21Value = tmp; /* PDR#521 */
116 - outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp & ~0x03);
117 + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, tmp & ~0x03);
118 }
119
120 LEAVE();
121 @@ -2050,12 +2051,10 @@ SMI_DisableMmio(ScrnInfoPtr pScrn)
122 vgaHWSetStdFuncs(hwp);
123
124 /* Disable 2D/3D Engine and Video Processor */
125 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21);
126 - outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR21Value); /* PDR#521 */
127 + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, pSmi->SR21Value); /* PDR#521 */
128
129 /* Disable linear mode */
130 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
131 - outb(pSmi->PIOBase + VGA_SEQ_DATA, pSmi->SR18Value); /* PDR#521 */
132 + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, pSmi->SR18Value); /* PDR#521 */
133 }
134
135 LEAVE();
136 diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c
137 index fb7183c..f4d8b4e 100644
138 --- a/src/smilynx_crtc.c
139 +++ b/src/smilynx_crtc.c
140 @@ -619,9 +619,9 @@ SMILynx_CrtcModeSet_bios(xf86CrtcPtr crtc,
141 xf86ExecX86int10(pSmi->pInt10);
142
143 /* Enable linear mode. */
144 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
145 - tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
146 - outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01);
147 + VGAOUT8(pSmi, VGA_SEQ_INDEX, 0x18);
148 + tmp = VGAIN8(pSmi, VGA_SEQ_DATA);
149 + VGAOUT8(pSmi, VGA_SEQ_DATA, tmp | 0x01);
150
151 /* Enable DPR/VPR registers. */
152 tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
153 diff --git a/src/smilynx_hw.c b/src/smilynx_hw.c
154 index b2ee8a5..40aa5a4 100644
155 --- a/src/smilynx_hw.c
156 +++ b/src/smilynx_hw.c
157 @@ -365,9 +365,8 @@ SMILynx_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
158 xf86ExecX86int10(pSmi->pInt10);
159
160 /* Enable linear mode. */
161 - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x18);
162 - tmp = inb(pSmi->PIOBase + VGA_SEQ_DATA);
163 - outb(pSmi->PIOBase + VGA_SEQ_DATA, tmp | 0x01);
164 + tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18);
165 + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x18, tmp | 0x01);
166
167 /* Enable DPR/VPR registers. */
168 tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
169 --
170 2.7.4
171