[PATCH 8/8] apus: update zorro bus access functions

Roman Zippel zippel at linux-m68k.org
Sun Sep 25 08:44:51 EST 2005


APUS only needs an eieio() to synchronize IO access, also a simple C
construct to access memory mapped IO is sufficient.

---

 include/asm-ppc/zorro.h |   52 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 44 insertions(+), 8 deletions(-)

Index: linux/include/asm-ppc/zorro.h
===================================================================
--- linux.orig/include/asm-ppc/zorro.h	2005-09-23 15:52:38.000000000 +0200
+++ linux/include/asm-ppc/zorro.h	2005-09-23 16:45:08.000000000 +0200
@@ -3,13 +3,50 @@
 
 #include <asm/io.h>
 
-#define z_readb in_8
-#define z_readw in_be16
-#define z_readl in_be32
-
-#define z_writeb(val, port) out_8((port), (val))
-#define z_writew(val, port) out_be16((port), (val))
-#define z_writel(val, port) out_be32((port), (val))
+static inline unsigned int z_readb(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u8 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline unsigned int z_readw(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u16 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline unsigned int z_readl(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u32 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline void z_writeb(unsigned int val, unsigned long addr)
+{
+	*(volatile u8 *)addr = val;
+	eieio();
+}
+
+static inline void z_writew(unsigned int val, unsigned long addr)
+{
+	*(volatile u16 *)addr = val;
+	eieio();
+}
+
+static inline void z_writel(unsigned int val,unsigned long addr)
+{
+	*(volatile u32 *)addr = val;
+	eieio();
+}
 
 #define z_memset_io(a,b,c)	memset((void *)(a),(b),(c))
 #define z_memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
@@ -19,7 +56,6 @@ extern void *__ioremap(unsigned long add
 		       unsigned long flags);
 
 extern void *ioremap(unsigned long address, unsigned long size);
-extern void iounmap(void *addr);
 
 extern void *__ioremap(unsigned long address, unsigned long size,
                        unsigned long flags);



More information about the Linuxppc-dev mailing list