ebf677ae9c402134a2ae06d820a6c76a0202fd57
[gentoo.git] /
1 From eecedfffd40f0465d85347f14547ddc6b30e57df Mon Sep 17 00:00:00 2001
2 From: Matt Turner <mattst88@gmail.com>
3 Date: Tue, 22 May 2018 21:10:55 -0700
4 Subject: [PATCH xserver] xfree86: Inline xf86{Read,Write}Mmio{8,16,32} on
5  alpha
6
7 In commit 9db2af6f757e (xfree86: Remove xf86{Map,Unmap}VidMem) we
8 somehow stopped exporting xf86{Read,Write}Mmio{8,16,32}. Since the
9 function pointer indirection was intended to support dense vs sparse and
10 sparse support is now gone, we can just make the functions static inline
11 in compiler.h and avoid all of this.
12
13 Bugzilla: https://bugs.gentoo.org/548906
14 Tested-by: Christopher May-Townsend <chris@maytownsend.co.uk>
15 Reviewed-by: Adam Jackson <ajax@redhat.com>
16 Signed-off-by: Matt Turner <mattst88@gmail.com>
17 ---
18  configure.ac                            |  4 --
19  hw/xfree86/common/compiler.h            | 67 ++++++++++++++++++++++++---------
20  hw/xfree86/os-support/bsd/Makefile.am   |  3 +-
21  hw/xfree86/os-support/linux/Makefile.am | 12 ------
22  hw/xfree86/os-support/linux/lnx_video.c | 27 -------------
23  hw/xfree86/os-support/meson.build       |  1 -
24  6 files changed, 50 insertions(+), 64 deletions(-)
25
26 diff --git a/configure.ac b/configure.ac
27 index ddc47faa2..0075b6ace 100644
28 --- a/configure.ac
29 +++ b/configure.ac
30 @@ -1908,9 +1908,6 @@ if test "x$XORG" = xyes; then
31                 XORG_OS_SUBDIR="linux"
32                 linux_acpi="no"
33                 case $host_cpu in
34 -                 alpha*)
35 -                       linux_alpha=yes
36 -                       ;;
37                   i*86|amd64*|x86_64*|ia64*)
38                         linux_acpi=$enable_linux_acpi
39                         ;;
40 @@ -2075,7 +2072,6 @@ AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
41  AM_CONDITIONAL([XORG_BUS_PCI], [test "x$PCI" = xyes])
42  AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
43  AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
44 -AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
45  AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
46  AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes])
47  AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
48 diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
49 index eea29dfb5..7144c6a27 100644
50 --- a/hw/xfree86/common/compiler.h
51 +++ b/hw/xfree86/common/compiler.h
52 @@ -986,33 +986,64 @@ inl(unsigned PORT_SIZE port)
53  #endif
54  
55  #ifdef __alpha__
56 -/* entry points for Mmio memory access routines */
57 -extern _X_EXPORT int (*xf86ReadMmio8) (void *, unsigned long);
58 -extern _X_EXPORT int (*xf86ReadMmio16) (void *, unsigned long);
59 -extern _X_EXPORT int (*xf86ReadMmio32) (void *, unsigned long);
60 -extern _X_EXPORT void (*xf86WriteMmio8) (int, void *, unsigned long);
61 -extern _X_EXPORT void (*xf86WriteMmio16) (int, void *, unsigned long);
62 -extern _X_EXPORT void (*xf86WriteMmio32) (int, void *, unsigned long);
63 +static inline int
64 +xf86ReadMmio8(void *Base, unsigned long Offset)
65 +{
66 +    mem_barrier();
67 +    return *(CARD8 *) ((unsigned long) Base + (Offset));
68 +}
69 +
70 +static inline int
71 +xf86ReadMmio16(void *Base, unsigned long Offset)
72 +{
73 +    mem_barrier();
74 +    return *(CARD16 *) ((unsigned long) Base + (Offset));
75 +}
76 +
77 +static inline int
78 +xf86ReadMmio32(void *Base, unsigned long Offset)
79 +{
80 +    mem_barrier();
81 +    return *(CARD32 *) ((unsigned long) Base + (Offset));
82 +}
83 +
84 +static inline void
85 +xf86WriteMmio8(int Value, void *Base, unsigned long Offset)
86 +{
87 +    write_mem_barrier();
88 +    *(CARD8 *) ((unsigned long) Base + (Offset)) = Value;
89 +}
90 +
91 +static inline void
92 +xf86WriteMmio16(int Value, void *Base, unsigned long Offset)
93 +{
94 +    write_mem_barrier();
95 +    *(CARD16 *) ((unsigned long) Base + (Offset)) = Value;
96 +}
97 +
98 +static inline void
99 +xf86WriteMmio32(int Value, void *Base, unsigned long Offset)
100 +{
101 +    write_mem_barrier();
102 +    *(CARD32 *) ((unsigned long) Base + (Offset)) = Value;
103 +}
104 +
105  extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *,
106                                             int);
107  extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
108  
109  /* Some macros to hide the system dependencies for MMIO accesses */
110  /* Changed to kill noise generated by gcc's -Wcast-align */
111 -#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
112 -#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
113 -#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
114 -
115 -#define MMIO_OUT32(base, offset, val) \
116 -    do { \
117 -       write_mem_barrier(); \
118 -       *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
119 -    } while (0)
120 +#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
121 +#define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
122 +#define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
123  
124  #define MMIO_OUT8(base, offset, val) \
125 -    (*xf86WriteMmio8)((CARD8)(val), base, offset)
126 +    xf86WriteMmio8((CARD8)(val), base, offset)
127  #define MMIO_OUT16(base, offset, val) \
128 -    (*xf86WriteMmio16)((CARD16)(val), base, offset)
129 +    xf86WriteMmio16((CARD16)(val), base, offset)
130 +#define MMIO_OUT32(base, offset, val) \
131 +    xf86WriteMmio32((CARD32)(val), base, offset)
132  
133  #elif defined(__powerpc__) || defined(__sparc__)
134   /*
135 diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
136 index b01ea5bca..66ac83805 100644
137 --- a/hw/xfree86/os-support/bsd/Makefile.am
138 +++ b/hw/xfree86/os-support/bsd/Makefile.am
139 @@ -26,8 +26,7 @@ endif
140  if ALPHA_VIDEO
141  # Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
142  ARCH_SOURCES = \
143 -       alpha_video.c \
144 -       bsd_ev56.c
145 +       alpha_video.c
146  endif
147  
148  if ARM_VIDEO
149 diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
150 index 26e40bb93..9b4535b53 100644
151 --- a/hw/xfree86/os-support/linux/Makefile.am
152 +++ b/hw/xfree86/os-support/linux/Makefile.am
153 @@ -1,13 +1,5 @@
154  noinst_LTLIBRARIES = liblinux.la
155  
156 -if LINUX_ALPHA
157 -noinst_LTLIBRARIES += liblinuxev56.la
158 -
159 -liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
160 -
161 -liblinuxev56_la_SOURCES = lnx_ev56.c
162 -endif
163 -
164  if LNXACPI
165  ACPI_SRCS = lnx_acpi.c
166  if !LNXAPM
167 @@ -39,7 +31,3 @@ liblinux_la_SOURCES = linux.h lnx_init.c lnx_video.c \
168  AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
169  
170  AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
171 -
172 -if LINUX_ALPHA
173 -liblinux_la_LIBADD = liblinuxev56.la
174 -endif
175 diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
176 index c09d71947..04e45092a 100644
177 --- a/hw/xfree86/os-support/linux/lnx_video.c
178 +++ b/hw/xfree86/os-support/linux/lnx_video.c
179 @@ -166,30 +166,3 @@ xf86DisableIO(void)
180  
181      ExtendedEnabled = FALSE;
182  }
183 -
184 -#if defined (__alpha__)
185 -
186 -extern int readDense8(void *Base, register unsigned long Offset);
187 -extern int readDense16(void *Base, register unsigned long Offset);
188 -extern int readDense32(void *Base, register unsigned long Offset);
189 -extern void
190 - writeDense8(int Value, void *Base, register unsigned long Offset);
191 -extern void
192 - writeDense16(int Value, void *Base, register unsigned long Offset);
193 -extern void
194 - writeDense32(int Value, void *Base, register unsigned long Offset);
195 -
196 -void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
197 -    = writeDense8;
198 -void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
199 -    = writeDense16;
200 -void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
201 -    = writeDense32;
202 -int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
203 -    = readDense8;
204 -int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
205 -    = readDense16;
206 -int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
207 -    = readDense32;
208 -
209 -#endif                          /* __alpha__ */
210 diff --git a/hw/xfree86/os-support/meson.build b/hw/xfree86/os-support/meson.build
211 index 901422786..b6e5c975d 100644
212 --- a/hw/xfree86/os-support/meson.build
213 +++ b/hw/xfree86/os-support/meson.build
214 @@ -100,7 +100,6 @@ elif host_machine.system().endswith('bsd')
215          srcs_xorg_os_support += 'shared/ioperm_noop.c'
216      elif host_machine.cpu_family() == 'alpha'
217          srcs_xorg_os_support += 'bsd/alpha_video.c'
218 -        srcs_xorg_os_support += 'bsd/bsd_ev56.c'
219      endif
220  
221      if host_machine.system() == 'freebsd'
222 -- 
223 2.16.1
224