[PATCH 12/12] xfree86: Convert xf86{Read, Write}Mmio{8, 16, 32} on alpha to functions

Adam Jackson ajax at redhat.com
Tue Jul 29 12:00:19 PDT 2014


... instead of function pointers.  Since the sparse mapping support is
gone these never vary anymore.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/common/compiler.h            | 35 ++++++++++-----------------------
 hw/xfree86/os-support/bsd/alpha_video.c | 23 ----------------------
 hw/xfree86/os-support/bsd/bsd_ev56.c    | 22 ++++++---------------
 hw/xfree86/os-support/linux/lnx_ev56.c  | 22 ++++++---------------
 hw/xfree86/os-support/linux/lnx_video.c | 27 -------------------------
 5 files changed, 22 insertions(+), 107 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 5325129..93052a0 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1034,36 +1034,21 @@ inl(unsigned short port)
 
 #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);
-
-#ifndef STANDALONE_MMIO
-extern _X_EXPORT int (*xf86ReadMmio32) (void *, unsigned long);
-#else
-/* Some DRI 3D drivers need MMIO_IN32. */
-static __inline__ int
-xf86ReadMmio32(void *Base, unsigned long Offset)
-{
-    mem_barrier();
-    return *(volatile unsigned int *) ((unsigned long) Base + (Offset));
-}
-#endif
-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);
+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);
 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)
-#ifndef STANDALONE_MMIO
-#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-#else
+#define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
 #define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
-#endif
 
 #define MMIO_OUT32(base, offset, val) \
     do { \
@@ -1072,9 +1057,9 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
     } while (0)
 
 #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)
 
 #elif defined(__powerpc__) || defined(__sparc__)
  /* 
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index b98c585..84c68f6 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -80,26 +80,3 @@ xf86DisableIO()
 }
 
 #endif                          /* USE_ALPHA_PIO */
-
-extern int readDense8(void *Base, register unsigned long Offset);
-extern int readDense16(void *Base, register unsigned long Offset);
-extern int readDense32(void *Base, register unsigned long Offset);
-extern void
- writeDense8(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDense16(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDense32(int Value, void *Base, register unsigned long Offset);
-
-void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
-    = writeDense8;
-void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
-    = writeDense16;
-void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
-    = writeDense32;
-int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
-    = readDense8;
-int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
-    = readDense16;
-int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
-    = readDense32;
diff --git a/hw/xfree86/os-support/bsd/bsd_ev56.c b/hw/xfree86/os-support/bsd/bsd_ev56.c
index 8a00273..f843687 100644
--- a/hw/xfree86/os-support/bsd/bsd_ev56.c
+++ b/hw/xfree86/os-support/bsd/bsd_ev56.c
@@ -21,53 +21,43 @@
  */
 __asm(".arch ev56");
 
-int readDense8(void *Base, register unsigned long Offset);
-int readDense16(void *Base, register unsigned long Offset);
-int readDense32(void *Base, register unsigned long Offset);
-void
- writeDense8(int Value, void *Base, register unsigned long Offset);
-void
- writeDense16(int Value, void *Base, register unsigned long Offset);
-void
- writeDense32(int Value, void *Base, register unsigned long Offset);
-
 int
-readDense8(void *Base, register unsigned long Offset)
+xf86ReadMmio8(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return (alpha_ldbu((void *) ((unsigned long) Base + (Offset))));
 }
 
 int
-readDense16(void *Base, register unsigned long Offset)
+xf86ReadMmio16(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return (alpha_ldwu((void *) ((unsigned long) Base + (Offset))));
 }
 
 int
-readDense32(void *Base, register unsigned long Offset)
+xf86ReadMmio32(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD32 *) ((unsigned long) Base + (Offset));
 }
 
 void
-writeDense8(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     alpha_stb((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDense16(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio16(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     alpha_stw((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDense32(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio32(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
diff --git a/hw/xfree86/os-support/linux/lnx_ev56.c b/hw/xfree86/os-support/linux/lnx_ev56.c
index 4e886b6..ef4bb30 100644
--- a/hw/xfree86/os-support/linux/lnx_ev56.c
+++ b/hw/xfree86/os-support/linux/lnx_ev56.c
@@ -6,53 +6,43 @@
 #include "xf86.h"
 #include "compiler.h"
 
-int readDense8(void *Base, register unsigned long Offset);
-int readDense16(void *Base, register unsigned long Offset);
-int readDense32(void *Base, register unsigned long Offset);
-void
- writeDense8(int Value, void *Base, register unsigned long Offset);
-void
- writeDense16(int Value, void *Base, register unsigned long Offset);
-void
- writeDense32(int Value, void *Base, register unsigned long Offset);
-
 int
-readDense8(void *Base, register unsigned long Offset)
+xf86ReadMmio8(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD8 *) ((unsigned long) Base + (Offset));
 }
 
 int
-readDense16(void *Base, register unsigned long Offset)
+xf86ReadMmio16(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD16 *) ((unsigned long) Base + (Offset));
 }
 
 int
-readDense32(void *Base, register unsigned long Offset)
+xf86ReadMmio32(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD32 *) ((unsigned long) Base + (Offset));
 }
 
 void
-writeDense8(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense16(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio16(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense32(int Value, void *Base, register unsigned long Offset)
+xf86WriteMmio32(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 423a99a..e0df9d6 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -155,30 +155,3 @@ xf86DisableIO(void)
 
     ExtendedEnabled = FALSE;
 }
-
-#if defined (__alpha__)
-
-extern int readDense8(void *Base, register unsigned long Offset);
-extern int readDense16(void *Base, register unsigned long Offset);
-extern int readDense32(void *Base, register unsigned long Offset);
-extern void
- writeDense8(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDense16(int Value, void *Base, register unsigned long Offset);
-extern void
- writeDense32(int Value, void *Base, register unsigned long Offset);
-
-void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
-    = writeDense8;
-void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
-    = writeDense16;
-void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
-    = writeDense32;
-int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
-    = readDense8;
-int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
-    = readDense16;
-int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
-    = readDense32;
-
-#endif                          /* __alpha__ */
-- 
1.9.3



More information about the xorg-devel mailing list