2 * linux/include/asm-arm/io.h
4 * Copyright (C) 1996-2000 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 * 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both
12 * constant addresses and variable addresses.
13 * 04-Dec-1997 RMK Moved a lot of this stuff to the new architecture
14 * specific IO header files.
15 * 27-Mar-1999 PJB Second parameter of memcpy_toio is const..
16 * 04-Apr-1999 PJB Added check_signature.
17 * 12-Dec-1999 RMK More cleanups
18 * 18-Jun-2000 RMK Removed virt_to_* and friends definitions
20 #ifndef __ASM_ARM_IO_H
21 #define __ASM_ARM_IO_H
23 #include <linux/types.h>
24 #include <asm/arch/hardware.h>
25 #include <asm/arch/io.h>
27 #define outb_p(val,port) outb((val),(port))
28 #define outw_p(val,port) outw((val),(port))
29 #define outl_p(val,port) outl((val),(port))
30 #define inb_p(port) inb((port))
31 #define inw_p(port) inw((port))
32 #define inl_p(port) inl((port))
34 extern void outsb(unsigned int port, const void *from, int len);
35 extern void outsw(unsigned int port, const void *from, int len);
36 extern void outsl(unsigned int port, const void *from, int len);
37 extern void insb(unsigned int port, void *from, int len);
38 extern void insw(unsigned int port, void *from, int len);
39 extern void insl(unsigned int port, void *from, int len);
41 #define outsb_p(port,from,len) outsb(port,from,len)
42 #define outsw_p(port,from,len) outsw(port,from,len)
43 #define outsl_p(port,from,len) outsl(port,from,len)
44 #define insb_p(port,to,len) insb(port,to,len)
45 #define insw_p(port,to,len) insw(port,to,len)
46 #define insl_p(port,to,len) insl(port,to,len)
50 #include <asm/memory.h>
52 /* the following macro is depreciated */
53 #define ioaddr(port) __ioaddr((port))
58 extern void * __ioremap(unsigned long offset, size_t size, unsigned long flags);
59 extern void __iounmap(void *addr);
61 #define ioremap(off,sz) __arch_ioremap((off),(sz),0)
62 #define ioremap_nocache(off,sz) __arch_ioremap((off),(sz),1)
63 #define iounmap(_addr) __iounmap(_addr)
66 * DMA-consistent mapping functions. These allocate/free a region of
67 * uncached, unwrite-buffered mapped memory space for use with DMA
68 * devices. This is the "generic" version. The PCI specific version
71 extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
72 extern void consistent_free(void *vaddr);
73 extern void consistent_sync(void *vaddr, size_t size, int rw);
75 extern void __readwrite_bug(const char *fn);
78 * String version of IO memory access ops:
80 extern void _memcpy_fromio(void *, unsigned long, size_t);
81 extern void _memcpy_toio(unsigned long, const void *, size_t);
82 extern void _memset_io(unsigned long, int, size_t);
84 #define __raw_writeb(val,addr) __arch_putb(val,addr)
85 #define __raw_writew(val,addr) __arch_putw(val,addr)
86 #define __raw_writel(val,addr) __arch_putl(val,addr)
88 #define __raw_readb(addr) __arch_getb(addr)
89 #define __raw_readw(addr) __arch_getw(addr)
90 #define __raw_readl(addr) __arch_getl(addr)
93 * If this architecture has PCI memory IO, then define the read/write
98 #define readb(addr) __arch_getb(__mem_pci(addr))
99 #define readw(addr) __arch_getw(__mem_pci(addr))
100 #define readl(addr) __arch_getl(__mem_pci(addr))
101 #define writeb(val,addr) __arch_putb(val,__mem_pci(addr))
102 #define writew(val,addr) __arch_putw(val,__mem_pci(addr))
103 #define writel(val,addr) __arch_putl(val,__mem_pci(addr))
105 #define memset_io(a,b,c) _memset_io(__mem_pci(a),(b),(c))
106 #define memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_pci(b),(c))
107 #define memcpy_toio(a,b,c) _memcpy_toio(__mem_pci(a),(b),(c))
109 #define eth_io_copy_and_sum(a,b,c,d) \
110 eth_copy_and_sum((a),__mem_pci(b),(c),(d))
113 check_signature(unsigned long io_addr, const unsigned char *signature,
118 if (readb(io_addr) != *signature)
129 #else /* __mem_pci */
131 #define readb(addr) (__readwrite_bug("readb"),0)
132 #define readw(addr) (__readwrite_bug("readw"),0)
133 #define readl(addr) (__readwrite_bug("readl"),0)
134 #define writeb(v,addr) __readwrite_bug("writeb")
135 #define writew(v,addr) __readwrite_bug("writew")
136 #define writel(v,addr) __readwrite_bug("writel")
138 #define eth_io_copy_and_sum(a,b,c,d) __readwrite_bug("eth_io_copy_and_sum")
140 #define check_signature(io,sig,len) (0)
142 #endif /* __mem_pci */
145 * If this architecture has ISA IO, then define the isa_read/isa_write
150 #define isa_readb(addr) __arch_getb(__mem_isa(addr))
151 #define isa_readw(addr) __arch_getw(__mem_isa(addr))
152 #define isa_readl(addr) __arch_getl(__mem_isa(addr))
153 #define isa_writeb(val,addr) __arch_putb(val,__mem_isa(addr))
154 #define isa_writew(val,addr) __arch_putw(val,__mem_isa(addr))
155 #define isa_writel(val,addr) __arch_putl(val,__mem_isa(addr))
156 #define isa_memset_io(a,b,c) _memset_io(__mem_isa(a),(b),(c))
157 #define isa_memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_isa(b),(c))
158 #define isa_memcpy_toio(a,b,c) _memcpy_toio(__mem_isa((a)),(b),(c))
160 #define isa_eth_io_copy_and_sum(a,b,c,d) \
161 eth_copy_and_sum((a),__mem_isa(b),(c),(d))
164 isa_check_signature(unsigned long io_addr, const unsigned char *signature,
169 if (isa_readb(io_addr) != *signature)
180 #else /* __mem_isa */
182 #define isa_readb(addr) (__readwrite_bug("isa_readb"),0)
183 #define isa_readw(addr) (__readwrite_bug("isa_readw"),0)
184 #define isa_readl(addr) (__readwrite_bug("isa_readl"),0)
185 #define isa_writeb(val,addr) __readwrite_bug("isa_writeb")
186 #define isa_writew(val,addr) __readwrite_bug("isa_writew")
187 #define isa_writel(val,addr) __readwrite_bug("isa_writel")
188 #define isa_memset_io(a,b,c) __readwrite_bug("isa_memset_io")
189 #define isa_memcpy_fromio(a,b,c) __readwrite_bug("isa_memcpy_fromio")
190 #define isa_memcpy_toio(a,b,c) __readwrite_bug("isa_memcpy_toio")
192 #define isa_eth_io_copy_and_sum(a,b,c,d) \
193 __readwrite_bug("isa_eth_io_copy_and_sum")
195 #define isa_check_signature(io,sig,len) (0)
197 #endif /* __mem_isa */
198 #endif /* __KERNEL__ */
199 #endif /* __ASM_ARM_IO_H */