patch-2.1.12 linux/include/asm-m68k/io.h

Next file: linux/include/asm-m68k/ipc.h
Previous file: linux/include/asm-m68k/elf.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.11/linux/include/asm-m68k/io.h linux/include/asm-m68k/io.h
@@ -1,38 +1,41 @@
 #ifndef _M68K_IO_H
 #define _M68K_IO_H
 
-static inline unsigned char get_user_byte_io(const char * addr)
-{
-	register unsigned char _v;
+#ifdef __KERNEL__
 
-	__asm__ __volatile__ ("moveb %1,%0":"=dm" (_v):"m" (*addr));
-	return _v;
-}
-#define inb_p(addr) get_user_byte_io((char *)(addr))
-#define inb(addr) get_user_byte_io((char *)(addr))
+/*
+ * readX/writeX() are used to access memory mapped devices. On some
+ * architectures the memory mapped IO stuff needs to be accessed
+ * differently. On the m68k architecture, we just read/write the
+ * memory location directly.
+ */
+#define readb(addr) (*(volatile unsigned char *) (addr))
+#define readw(addr) (*(volatile unsigned short *) (addr))
+#define readl(addr) (*(volatile unsigned int *) (addr))
+
+#define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
+#define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
+#define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
+
+#define memset_io(a,b,c)	memset((void *)(a),(b),(c))
+#define memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
+#define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))
 
-static inline void put_user_byte_io(char val,char *addr)
-{
-	__asm__ __volatile__ ("moveb %0,%1"
-			      : /* no outputs */
-			      :"idm" (val),"m" (*addr)
-			      : "memory");
-}
-#define outb_p(x,addr) put_user_byte_io((x),(char *)(addr))
-#define outb(x,addr) put_user_byte_io((x),(char *)(addr))
+#define inb_p(addr) readb(addr)
+#define inb(addr) readb(addr)
+
+#define outb(x,addr) ((void) writeb(x,addr))
+#define outb_p(x,addr) outb(x,addr)
 
 /*
  * Change virtual addresses to physical addresses and vv.
- * These are trivial on the 1:1 Linux/i386 mapping (but if we ever
- * make the kernel segment mapped at 0, we need to do translation
- * on the i386 as well)
  */
-extern unsigned long mm_vtop(unsigned long addr);
-extern unsigned long mm_ptov(unsigned long addr);
+extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const));
+extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const));
 
 extern inline unsigned long virt_to_phys(volatile void * address)
 {
-	return (unsigned long) mm_vtop((unsigned long)address);
+	return mm_vtop((unsigned long)address);
 }
 
 extern inline void * phys_to_virt(unsigned long address)
@@ -41,10 +44,11 @@
 }
 
 /*
- * IO bus memory addresses are also 1:1 with the physical address
+ * IO bus memory addresses are 1:1 with the physical address
  */
 #define virt_to_bus virt_to_phys
 #define bus_to_virt phys_to_virt
 
+#endif /* __KERNEL__ */
 
 #endif /* _M68K_IO_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov