summaryrefslogtreecommitdiff
path: root/hw/xfree86/common
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2018-05-22 21:10:55 -0700
committerMatt Turner <mattst88@gmail.com>2018-06-11 14:05:04 -0700
commit166ac294aefe21a6cfcc0e7a4c9525eef49c2f0c (patch)
tree2d7f5205c55e06424b3ec77fa7a9a5c2138fc49e /hw/xfree86/common
parent1993f147d08170f07a72e43f0a0f27687e16967b (diff)
xfree86: Inline xf86{Read,Write}Mmio{8,16,32} on alpha
In commit 9db2af6f757e (xfree86: Remove xf86{Map,Unmap}VidMem) we somehow stopped exporting xf86{Read,Write}Mmio{8,16,32}. Since the function pointer indirection was intended to support dense vs sparse and sparse support is now gone, we can just make the functions static inline in compiler.h and avoid all of this. Bugzilla: https://bugs.gentoo.org/548906 Tested-by: Christopher May-Townsend <chris@maytownsend.co.uk> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r--hw/xfree86/common/compiler.h67
1 files changed, 49 insertions, 18 deletions
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index eea29dfb5..7144c6a27 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -986,33 +986,64 @@ inl(unsigned PORT_SIZE port)
#endif
#ifdef __alpha__
-/* entry points for Mmio memory access routines */
-extern _X_EXPORT int (*xf86ReadMmio8) (void *, unsigned long);
-extern _X_EXPORT int (*xf86ReadMmio16) (void *, unsigned long);
-extern _X_EXPORT int (*xf86ReadMmio32) (void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio8) (int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio16) (int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio32) (int, void *, unsigned long);
+static inline int
+xf86ReadMmio8(void *Base, unsigned long Offset)
+{
+ mem_barrier();
+ return *(CARD8 *) ((unsigned long) Base + (Offset));
+}
+
+static inline int
+xf86ReadMmio16(void *Base, unsigned long Offset)
+{
+ mem_barrier();
+ return *(CARD16 *) ((unsigned long) Base + (Offset));
+}
+
+static inline int
+xf86ReadMmio32(void *Base, unsigned long Offset)
+{
+ mem_barrier();
+ return *(CARD32 *) ((unsigned long) Base + (Offset));
+}
+
+static inline void
+xf86WriteMmio8(int Value, void *Base, unsigned long Offset)
+{
+ write_mem_barrier();
+ *(CARD8 *) ((unsigned long) Base + (Offset)) = Value;
+}
+
+static inline void
+xf86WriteMmio16(int Value, void *Base, unsigned long Offset)
+{
+ write_mem_barrier();
+ *(CARD16 *) ((unsigned long) Base + (Offset)) = Value;
+}
+
+static inline void
+xf86WriteMmio32(int Value, void *Base, unsigned long Offset)
+{
+ write_mem_barrier();
+ *(CARD32 *) ((unsigned long) Base + (Offset)) = Value;
+}
+
extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *,
int);
extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
/* Some macros to hide the system dependencies for MMIO accesses */
/* Changed to kill noise generated by gcc's -Wcast-align */
-#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
-#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
-#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-
-#define MMIO_OUT32(base, offset, val) \
- do { \
- write_mem_barrier(); \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
- } while (0)
+#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
+#define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
#define MMIO_OUT8(base, offset, val) \
- (*xf86WriteMmio8)((CARD8)(val), base, offset)
+ xf86WriteMmio8((CARD8)(val), base, offset)
#define MMIO_OUT16(base, offset, val) \
- (*xf86WriteMmio16)((CARD16)(val), base, offset)
+ xf86WriteMmio16((CARD16)(val), base, offset)
+#define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32((CARD32)(val), base, offset)
#elif defined(__powerpc__) || defined(__sparc__)
/*