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
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.
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>
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(-)
26 diff --git a/configure.ac b/configure.ac
27 index ddc47faa2..0075b6ace 100644
30 @@ -1908,9 +1908,6 @@ if test "x$XORG" = xyes; then
31 XORG_OS_SUBDIR="linux"
37 i*86|amd64*|x86_64*|ia64*)
38 linux_acpi=$enable_linux_acpi
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)
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);
64 +xf86ReadMmio8(void *Base, unsigned long Offset)
67 + return *(CARD8 *) ((unsigned long) Base + (Offset));
71 +xf86ReadMmio16(void *Base, unsigned long Offset)
74 + return *(CARD16 *) ((unsigned long) Base + (Offset));
78 +xf86ReadMmio32(void *Base, unsigned long Offset)
81 + return *(CARD32 *) ((unsigned long) Base + (Offset));
85 +xf86WriteMmio8(int Value, void *Base, unsigned long Offset)
87 + write_mem_barrier();
88 + *(CARD8 *) ((unsigned long) Base + (Offset)) = Value;
92 +xf86WriteMmio16(int Value, void *Base, unsigned long Offset)
94 + write_mem_barrier();
95 + *(CARD16 *) ((unsigned long) Base + (Offset)) = Value;
99 +xf86WriteMmio32(int Value, void *Base, unsigned long Offset)
101 + write_mem_barrier();
102 + *(CARD32 *) ((unsigned long) Base + (Offset)) = Value;
105 extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *,
107 extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
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)
115 -#define MMIO_OUT32(base, offset, val) \
117 - write_mem_barrier(); \
118 - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
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)
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)
133 #elif defined(__powerpc__) || defined(__sparc__)
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
141 # Cheat here and piggyback other alpha bits on ALPHA_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
154 noinst_LTLIBRARIES = liblinux.la
157 -noinst_LTLIBRARIES += liblinuxev56.la
159 -liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
161 -liblinuxev56_la_SOURCES = lnx_ev56.c
165 ACPI_SRCS = lnx_acpi.c
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)
170 AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
173 -liblinux_la_LIBADD = liblinuxev56.la
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)
181 ExtendedEnabled = FALSE;
184 -#if defined (__alpha__)
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);
190 - writeDense8(int Value, void *Base, register unsigned long Offset);
192 - writeDense16(int Value, void *Base, register unsigned long Offset);
194 - writeDense32(int Value, void *Base, register unsigned long Offset);
196 -void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
198 -void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
200 -void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
202 -int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
204 -int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
206 -int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
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'
221 if host_machine.system() == 'freebsd'