From db7d4daea91e105e3859cf461d7e53b9b77454b2 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sun, 13 Jun 1999 16:29:25 +0000 Subject: Merge with Linux 2.2.8. --- include/asm-arm/io.h | 71 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 15 deletions(-) (limited to 'include/asm-arm/io.h') diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index e87744b71..35db8e667 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -8,12 +8,35 @@ * constant addresses and variable addresses. * 04-Dec-1997 RMK Moved a lot of this stuff to the new architecture * specific IO header files. + * 27-Mar-1999 PJB Second parameter of memcpy_toio is const.. + * 04-Apr-1999 PJB Added check_signature. */ #ifndef __ASM_ARM_IO_H #define __ASM_ARM_IO_H +#ifdef __KERNEL__ + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); + +/* + * String version of IO memory access ops: + */ +extern void _memcpy_fromio(void *, unsigned long, unsigned long); +extern void _memcpy_toio(unsigned long, const void *, unsigned long); +extern void _memset_io(unsigned long, int, unsigned long); + +#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len)) +#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len)) +#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len)) + +#endif + #include -#include +#include #include #include @@ -168,25 +191,43 @@ __IO(l,"",long) #endif -#undef ARCH_IO_DELAY -#undef ARCH_IO_CONSTANT +#ifndef ARCH_READWRITE -#ifdef __KERNEL__ +/* for panic */ +#include -extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); +#define readb(p) (panic("readb called, but not implemented"),0) +#define readw(p) (panic("readw called, but not implemented"),0) +#define readl(p) (panic("readl called, but not implemented"),0) +#define writeb(v,p) panic("writeb called, but not implemented") +#define writew(v,p) panic("writew called, but not implemented") +#define writel(v,p) panic("writel called, but not implemented") + +#endif /* - * String version of IO memory access ops: + * This isn't especially architecture dependent so it seems like it + * might as well go here as anywhere. */ -extern void _memcpy_fromio(void *, unsigned long, unsigned long); -extern void _memcpy_toio(unsigned long, void *, unsigned long); -extern void _memset_io(unsigned long, int, unsigned long); - -#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len)) -#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len)) -#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len)) - -#endif +static inline int check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + do { + if (readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} + +#undef ARCH_READWRITE +#undef ARCH_IO_DELAY +#undef ARCH_IO_CONSTANT #endif -- cgit v1.2.3