X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-m68k%2Fio.h;h=c963b138a142bb4e2306059a11722cc9e4f385b8;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=a50a4776b92571dac0534fdad3236a99e7446d7f;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index a50a4776b..c963b138a 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-m68k/io.h + * linux/include/asm-m68k/io.h * * 4/1/00 RZ: - rewritten to avoid clashes between ISA/PCI and other * IO access @@ -62,7 +62,7 @@ extern unsigned long gg2_isa_base; #ifndef MULTI_ISA #define MULTI_ISA 0 -#else +#else #undef MULTI_ISA #define MULTI_ISA 1 #endif @@ -76,7 +76,7 @@ extern unsigned long gg2_isa_base; #ifndef MULTI_ISA #define MULTI_ISA 0 -#else +#else #undef MULTI_ISA #define MULTI_ISA 1 #endif @@ -101,7 +101,7 @@ extern unsigned long gg2_isa_base; #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA) #define ISA_TYPE AG_ISA #define ISA_SEX 1 -#endif +#endif #if defined(CONFIG_GG2) && !defined(MULTI_ISA) #define ISA_TYPE GG2_ISA #define ISA_SEX 0 @@ -120,7 +120,7 @@ extern int isa_sex; * be compiled in so the case statement will be optimised away */ -static inline u8 *isa_itb(long addr) +static inline u8 *isa_itb(unsigned long addr) { switch(ISA_TYPE) { @@ -136,7 +136,7 @@ static inline u8 *isa_itb(long addr) default: return 0; /* avoid warnings, just in case */ } } -static inline u16 *isa_itw(long addr) +static inline u16 *isa_itw(unsigned long addr) { switch(ISA_TYPE) { @@ -152,7 +152,7 @@ static inline u16 *isa_itw(long addr) default: return 0; /* avoid warnings, just in case */ } } -static inline u8 *isa_mtb(long addr) +static inline u8 *isa_mtb(unsigned long addr) { switch(ISA_TYPE) { @@ -168,7 +168,7 @@ static inline u8 *isa_mtb(long addr) default: return 0; /* avoid warnings, just in case */ } } -static inline u16 *isa_mtw(long addr) +static inline u16 *isa_mtw(unsigned long addr) { switch(ISA_TYPE) { @@ -191,10 +191,14 @@ static inline u16 *isa_mtw(long addr) #define isa_outb(val,port) out_8(isa_itb(port),(val)) #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) -#define isa_readb(p) in_8(isa_mtb(p)) -#define isa_readw(p) (ISA_SEX ? in_be16(isa_mtw(p)) : in_le16(isa_mtw(p))) -#define isa_writeb(val,p) out_8(isa_mtb(p),(val)) -#define isa_writew(val,p) (ISA_SEX ? out_be16(isa_mtw(p),(val)) : out_le16(isa_mtw(p),(val))) +#define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) +#define isa_readw(p) \ + (ISA_SEX ? in_be16(isa_mtw((unsigned long)(p))) \ + : in_le16(isa_mtw((unsigned long)(p)))) +#define isa_writeb(val,p) out_8(isa_mtb((unsigned long)(p)),(val)) +#define isa_writew(val,p) \ + (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ + : out_le16(isa_mtw((unsigned long)(p)),(val))) static inline void isa_delay(void) { @@ -215,29 +219,37 @@ static inline void isa_delay(void) #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;}) #define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();}) +#define isa_inw_p(p) ({u16 v=isa_inw(p);isa_delay();v;}) +#define isa_outw_p(v,p) ({isa_outw((v),(p));isa_delay();}) +#define isa_inl_p(p) ({u32 v=isa_inl(p);isa_delay();v;}) +#define isa_outl_p(v,p) ({isa_outl((v),(p));isa_delay();}) -#define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (buf), (nr)) -#define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (buf), (nr)) +#define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (u8 *)(buf), (nr)) +#define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (u8 *)(buf), (nr)) #define isa_insw(port, buf, nr) \ - (ISA_SEX ? raw_insw(isa_itw(port), (buf), (nr)) : \ - raw_insw_swapw(isa_itw(port), (buf), (nr))) + (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #define isa_outsw(port, buf, nr) \ - (ISA_SEX ? raw_outsw(isa_itw(port), (buf), (nr)) : \ - raw_outsw_swapw(isa_itw(port), (buf), (nr))) + (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #endif /* CONFIG_ISA */ -#if defined(CONFIG_ISA) && !defined(CONFIG_PCI) +#if defined(CONFIG_ISA) && !defined(CONFIG_PCI) #define inb isa_inb #define inb_p isa_inb_p #define outb isa_outb #define outb_p isa_outb_p #define inw isa_inw +#define inw_p isa_inw_p #define outw isa_outw +#define outw_p isa_outw_p #define inl isa_inw +#define inl_p isa_inw_p #define outl isa_outw +#define outl_p isa_outw_p #define insb isa_insb #define insw isa_insw #define outsb isa_outsb @@ -273,21 +285,46 @@ static inline void isa_delay(void) #else /* - * kernel with both ISA and PCI compiled in, those have - * conflicting defs for in/out. Simply consider port < 1024 + * kernel with both ISA and PCI compiled in, those have + * conflicting defs for in/out. Simply consider port < 1024 * ISA and everything else PCI. read,write not defined * in this case */ #define inb(port) ((port)<1024 ? isa_inb(port) : in_8(port)) #define inb_p(port) ((port)<1024 ? isa_inb_p(port) : in_8(port)) #define inw(port) ((port)<1024 ? isa_inw(port) : in_le16(port)) +#define inw_p(port) ((port)<1024 ? isa_inw_p(port) : in_le16(port)) +#define inl(port) ((port)<1024 ? isa_inl(port) : in_le32(port)) +#define inl_p(port) ((port)<1024 ? isa_inl_p(port) : in_le32(port)) #define outb(val,port) ((port)<1024 ? isa_outb((val),(port)) : out_8((port),(val))) #define outb_p(val,port) ((port)<1024 ? isa_outb_p((val),(port)) : out_8((port),(val))) #define outw(val,port) ((port)<1024 ? isa_outw((val),(port)) : out_le16((port),(val))) +#define outw_p(val,port) ((port)<1024 ? isa_outw_p((val),(port)) : out_le16((port),(val))) +#define outl(val,port) ((port)<1024 ? isa_outl((val),(port)) : out_le32((port),(val))) +#define outl_p(val,port) ((port)<1024 ? isa_outl_p((val),(port)) : out_le32((port),(val))) #endif #endif /* CONFIG_PCI */ +#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && defined(CONFIG_HP300) +/* + * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link + */ +#define inb(port) 0xff +#define inb_p(port) 0xff +#define outb(val,port) do { } while (0) +#define outb_p(val,port) do { } while (0) + +/* + * These should be valid on any ioremap()ed region + */ +#define readb(addr) in_8(addr) +#define writeb(val,addr) out_8((addr),(val)) +#define readl(addr) in_le32(addr) +#define writel(val,addr) out_le32((addr),(val)) +#endif + +#define mmiowb() static inline void *ioremap(unsigned long physaddr, unsigned long size) {