Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-m68k/io.h |
| 3 | * |
| 4 | * 4/1/00 RZ: - rewritten to avoid clashes between ISA/PCI and other |
| 5 | * IO access |
| 6 | * - added Q40 support |
| 7 | * - added skeleton for GG-II and Amiga PCMCIA |
| 8 | * 2/3/01 RZ: - moved a few more defs into raw_io.h |
| 9 | * |
Adrian Bunk | 2171a19 | 2008-10-13 21:59:00 +0200 | [diff] [blame] | 10 | * inX/outX should not be used by any driver unless it does |
| 11 | * ISA access. Other drivers should use function defined in raw_io.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | * or define its own macros on top of these. |
| 13 | * |
Adrian Bunk | 2171a19 | 2008-10-13 21:59:00 +0200 | [diff] [blame] | 14 | * inX(),outX() are for ISA I/O |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | * isa_readX(),isa_writeX() are for ISA memory |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #ifndef _IO_H |
| 19 | #define _IO_H |
| 20 | |
| 21 | #ifdef __KERNEL__ |
| 22 | |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 23 | #include <linux/compiler.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <asm/raw_io.h> |
| 25 | #include <asm/virtconvert.h> |
| 26 | |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 27 | #include <asm-generic/iomap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | #ifdef CONFIG_ATARI |
| 30 | #include <asm/atarihw.h> |
| 31 | #endif |
| 32 | |
| 33 | |
| 34 | /* |
| 35 | * IO/MEM definitions for various ISA bridges |
| 36 | */ |
| 37 | |
| 38 | |
| 39 | #ifdef CONFIG_Q40 |
| 40 | |
| 41 | #define q40_isa_io_base 0xff400000 |
| 42 | #define q40_isa_mem_base 0xff800000 |
| 43 | |
| 44 | #define Q40_ISA_IO_B(ioaddr) (q40_isa_io_base+1+4*((unsigned long)(ioaddr))) |
| 45 | #define Q40_ISA_IO_W(ioaddr) (q40_isa_io_base+ 4*((unsigned long)(ioaddr))) |
| 46 | #define Q40_ISA_MEM_B(madr) (q40_isa_mem_base+1+4*((unsigned long)(madr))) |
| 47 | #define Q40_ISA_MEM_W(madr) (q40_isa_mem_base+ 4*((unsigned long)(madr))) |
| 48 | |
| 49 | #define MULTI_ISA 0 |
| 50 | #endif /* Q40 */ |
| 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #ifdef CONFIG_AMIGA_PCMCIA |
| 53 | #include <asm/amigayle.h> |
| 54 | |
| 55 | #define AG_ISA_IO_B(ioaddr) ( GAYLE_IO+(ioaddr)+(((ioaddr)&1)*GAYLE_ODD) ) |
| 56 | #define AG_ISA_IO_W(ioaddr) ( GAYLE_IO+(ioaddr) ) |
| 57 | |
| 58 | #ifndef MULTI_ISA |
| 59 | #define MULTI_ISA 0 |
| 60 | #else |
| 61 | #undef MULTI_ISA |
| 62 | #define MULTI_ISA 1 |
| 63 | #endif |
| 64 | #endif /* AMIGA_PCMCIA */ |
| 65 | |
| 66 | |
| 67 | |
Greg Ungerer | 9ff601a | 2012-06-29 00:03:27 +1000 | [diff] [blame] | 68 | #if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE) |
| 69 | |
| 70 | #define HAVE_ARCH_PIO_SIZE |
| 71 | #define PIO_OFFSET 0 |
| 72 | #define PIO_MASK 0xffff |
| 73 | #define PIO_RESERVED 0x10000 |
| 74 | |
| 75 | u8 mcf_pci_inb(u32 addr); |
| 76 | u16 mcf_pci_inw(u32 addr); |
| 77 | u32 mcf_pci_inl(u32 addr); |
| 78 | void mcf_pci_insb(u32 addr, u8 *buf, u32 len); |
| 79 | void mcf_pci_insw(u32 addr, u16 *buf, u32 len); |
| 80 | void mcf_pci_insl(u32 addr, u32 *buf, u32 len); |
| 81 | |
| 82 | void mcf_pci_outb(u8 v, u32 addr); |
| 83 | void mcf_pci_outw(u16 v, u32 addr); |
| 84 | void mcf_pci_outl(u32 v, u32 addr); |
| 85 | void mcf_pci_outsb(u32 addr, const u8 *buf, u32 len); |
| 86 | void mcf_pci_outsw(u32 addr, const u16 *buf, u32 len); |
| 87 | void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len); |
| 88 | |
| 89 | #define inb mcf_pci_inb |
| 90 | #define inb_p mcf_pci_inb |
| 91 | #define inw mcf_pci_inw |
| 92 | #define inw_p mcf_pci_inw |
| 93 | #define inl mcf_pci_inl |
| 94 | #define inl_p mcf_pci_inl |
| 95 | #define insb mcf_pci_insb |
| 96 | #define insw mcf_pci_insw |
| 97 | #define insl mcf_pci_insl |
| 98 | |
| 99 | #define outb mcf_pci_outb |
| 100 | #define outb_p mcf_pci_outb |
| 101 | #define outw mcf_pci_outw |
| 102 | #define outw_p mcf_pci_outw |
| 103 | #define outl mcf_pci_outl |
| 104 | #define outl_p mcf_pci_outl |
| 105 | #define outsb mcf_pci_outsb |
| 106 | #define outsw mcf_pci_outsw |
| 107 | #define outsl mcf_pci_outsl |
| 108 | |
| 109 | #define readb(addr) in_8(addr) |
| 110 | #define writeb(v, addr) out_8((addr), (v)) |
| 111 | #define readw(addr) in_le16(addr) |
| 112 | #define writew(v, addr) out_le16((addr), (v)) |
| 113 | |
| 114 | #elif defined(CONFIG_ISA) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | #if MULTI_ISA == 0 |
| 117 | #undef MULTI_ISA |
| 118 | #endif |
| 119 | |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 120 | #define ISA_TYPE_Q40 (1) |
Christian Dietrich | 808fa62 | 2010-08-04 14:41:34 +0200 | [diff] [blame] | 121 | #define ISA_TYPE_AG (2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | |
| 123 | #if defined(CONFIG_Q40) && !defined(MULTI_ISA) |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 124 | #define ISA_TYPE ISA_TYPE_Q40 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | #define ISA_SEX 0 |
| 126 | #endif |
| 127 | #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA) |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 128 | #define ISA_TYPE ISA_TYPE_AG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | #define ISA_SEX 1 |
| 130 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | |
| 132 | #ifdef MULTI_ISA |
| 133 | extern int isa_type; |
| 134 | extern int isa_sex; |
| 135 | |
| 136 | #define ISA_TYPE isa_type |
| 137 | #define ISA_SEX isa_sex |
| 138 | #endif |
| 139 | |
| 140 | /* |
| 141 | * define inline addr translation functions. Normally only one variant will |
| 142 | * be compiled in so the case statement will be optimised away |
| 143 | */ |
| 144 | |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 145 | static inline u8 __iomem *isa_itb(unsigned long addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | { |
| 147 | switch(ISA_TYPE) |
| 148 | { |
| 149 | #ifdef CONFIG_Q40 |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 150 | case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 153 | case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | #endif |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 155 | default: return NULL; /* avoid warnings, just in case */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | } |
| 157 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 158 | static inline u16 __iomem *isa_itw(unsigned long addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | { |
| 160 | switch(ISA_TYPE) |
| 161 | { |
| 162 | #ifdef CONFIG_Q40 |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 163 | case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 166 | case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | #endif |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 168 | default: return NULL; /* avoid warnings, just in case */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | } |
| 170 | } |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 171 | static inline u32 __iomem *isa_itl(unsigned long addr) |
| 172 | { |
| 173 | switch(ISA_TYPE) |
| 174 | { |
| 175 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 176 | case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr); |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 177 | #endif |
| 178 | default: return 0; /* avoid warnings, just in case */ |
| 179 | } |
| 180 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 181 | static inline u8 __iomem *isa_mtb(unsigned long addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | { |
| 183 | switch(ISA_TYPE) |
| 184 | { |
| 185 | #ifdef CONFIG_Q40 |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 186 | case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 189 | case ISA_TYPE_AG: return (u8 __iomem *)addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | #endif |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 191 | default: return NULL; /* avoid warnings, just in case */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | } |
| 193 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 194 | static inline u16 __iomem *isa_mtw(unsigned long addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | { |
| 196 | switch(ISA_TYPE) |
| 197 | { |
| 198 | #ifdef CONFIG_Q40 |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 199 | case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 202 | case ISA_TYPE_AG: return (u16 __iomem *)addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | #endif |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 204 | default: return NULL; /* avoid warnings, just in case */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
| 208 | |
| 209 | #define isa_inb(port) in_8(isa_itb(port)) |
| 210 | #define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port))) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 211 | #define isa_inl(port) (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | #define isa_outb(val,port) out_8(isa_itb(port),(val)) |
| 213 | #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 214 | #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | #define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) |
| 217 | #define isa_readw(p) \ |
| 218 | (ISA_SEX ? in_be16(isa_mtw((unsigned long)(p))) \ |
| 219 | : in_le16(isa_mtw((unsigned long)(p)))) |
| 220 | #define isa_writeb(val,p) out_8(isa_mtb((unsigned long)(p)),(val)) |
| 221 | #define isa_writew(val,p) \ |
| 222 | (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ |
| 223 | : out_le16(isa_mtw((unsigned long)(p)),(val))) |
| 224 | |
| 225 | static inline void isa_delay(void) |
| 226 | { |
| 227 | switch(ISA_TYPE) |
| 228 | { |
| 229 | #ifdef CONFIG_Q40 |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 230 | case ISA_TYPE_Q40: isa_outb(0,0x80); break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | #ifdef CONFIG_AMIGA_PCMCIA |
Geert Uytterhoeven | 52de114 | 2008-05-18 20:47:21 +0200 | [diff] [blame] | 233 | case ISA_TYPE_AG: break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | #endif |
| 235 | default: break; /* avoid warnings */ |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;}) |
| 240 | #define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();}) |
| 241 | #define isa_inw_p(p) ({u16 v=isa_inw(p);isa_delay();v;}) |
| 242 | #define isa_outw_p(v,p) ({isa_outw((v),(p));isa_delay();}) |
| 243 | #define isa_inl_p(p) ({u32 v=isa_inl(p);isa_delay();v;}) |
| 244 | #define isa_outl_p(v,p) ({isa_outl((v),(p));isa_delay();}) |
| 245 | |
| 246 | #define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (u8 *)(buf), (nr)) |
| 247 | #define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (u8 *)(buf), (nr)) |
| 248 | |
| 249 | #define isa_insw(port, buf, nr) \ |
| 250 | (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ |
| 251 | raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) |
| 252 | |
| 253 | #define isa_outsw(port, buf, nr) \ |
| 254 | (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ |
| 255 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 256 | |
| 257 | #define isa_insl(port, buf, nr) \ |
| 258 | (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \ |
| 259 | raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) |
| 260 | |
| 261 | #define isa_outsl(port, buf, nr) \ |
| 262 | (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ |
| 263 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) |
| 264 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | #define inb isa_inb |
| 267 | #define inb_p isa_inb_p |
| 268 | #define outb isa_outb |
| 269 | #define outb_p isa_outb_p |
| 270 | #define inw isa_inw |
| 271 | #define inw_p isa_inw_p |
| 272 | #define outw isa_outw |
| 273 | #define outw_p isa_outw_p |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 274 | #define inl isa_inl |
| 275 | #define inl_p isa_inl_p |
| 276 | #define outl isa_outl |
| 277 | #define outl_p isa_outl_p |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | #define insb isa_insb |
| 279 | #define insw isa_insw |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 280 | #define insl isa_insl |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | #define outsb isa_outsb |
| 282 | #define outsw isa_outsw |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 283 | #define outsl isa_outsl |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | #define readb isa_readb |
| 285 | #define readw isa_readw |
| 286 | #define writeb isa_writeb |
| 287 | #define writew isa_writew |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | |
Adrian Bunk | 2171a19 | 2008-10-13 21:59:00 +0200 | [diff] [blame] | 289 | #else /* CONFIG_ISA */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | /* |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 292 | * We need to define dummy functions for GENERIC_IOMAP support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | */ |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 294 | #define inb(port) 0xff |
| 295 | #define inb_p(port) 0xff |
| 296 | #define outb(val,port) ((void)0) |
| 297 | #define outb_p(val,port) ((void)0) |
| 298 | #define inw(port) 0xffff |
Thorsten Glaser | 779b7e6 | 2010-10-03 18:48:51 +0000 | [diff] [blame] | 299 | #define inw_p(port) 0xffff |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 300 | #define outw(val,port) ((void)0) |
Thorsten Glaser | 779b7e6 | 2010-10-03 18:48:51 +0000 | [diff] [blame] | 301 | #define outw_p(val,port) ((void)0) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 302 | #define inl(port) 0xffffffffUL |
Thorsten Glaser | 779b7e6 | 2010-10-03 18:48:51 +0000 | [diff] [blame] | 303 | #define inl_p(port) 0xffffffffUL |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 304 | #define outl(val,port) ((void)0) |
Thorsten Glaser | 779b7e6 | 2010-10-03 18:48:51 +0000 | [diff] [blame] | 305 | #define outl_p(val,port) ((void)0) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 306 | |
| 307 | #define insb(port,buf,nr) ((void)0) |
| 308 | #define outsb(port,buf,nr) ((void)0) |
| 309 | #define insw(port,buf,nr) ((void)0) |
| 310 | #define outsw(port,buf,nr) ((void)0) |
| 311 | #define insl(port,buf,nr) ((void)0) |
| 312 | #define outsl(port,buf,nr) ((void)0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* |
| 315 | * These should be valid on any ioremap()ed region |
| 316 | */ |
| 317 | #define readb(addr) in_8(addr) |
| 318 | #define writeb(val,addr) out_8((addr),(val)) |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 319 | #define readw(addr) in_le16(addr) |
| 320 | #define writew(val,addr) out_le16((addr),(val)) |
Adrian Bunk | 2171a19 | 2008-10-13 21:59:00 +0200 | [diff] [blame] | 321 | |
| 322 | #endif /* CONFIG_ISA */ |
| 323 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | #define readl(addr) in_le32(addr) |
| 325 | #define writel(val,addr) out_le32((addr),(val)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Geert Uytterhoeven | f5db9c6 | 2012-04-15 20:37:39 +0200 | [diff] [blame] | 327 | #define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr)) |
| 328 | #define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr)) |
| 329 | #define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr)) |
| 330 | #define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr)) |
| 331 | #define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr)) |
| 332 | #define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr)) |
| 333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | #define mmiowb() |
| 335 | |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 336 | static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | { |
| 338 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); |
| 339 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 340 | static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
| 342 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); |
| 343 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 344 | static inline void __iomem *ioremap_writethrough(unsigned long physaddr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | unsigned long size) |
| 346 | { |
| 347 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); |
| 348 | } |
Al Viro | ad9ec4f | 2006-01-12 01:06:24 -0800 | [diff] [blame] | 349 | static inline void __iomem *ioremap_fullcache(unsigned long physaddr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | unsigned long size) |
| 351 | { |
| 352 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); |
| 353 | } |
| 354 | |
Al Viro | f9569e1 | 2007-07-20 04:32:58 +0100 | [diff] [blame] | 355 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) |
| 356 | { |
| 357 | __builtin_memset((void __force *) addr, val, count); |
| 358 | } |
| 359 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) |
| 360 | { |
| 361 | __builtin_memcpy(dst, (void __force *) src, count); |
| 362 | } |
| 363 | static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) |
| 364 | { |
| 365 | __builtin_memcpy((void __force *) dst, src, count); |
| 366 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | |
| 368 | #ifndef CONFIG_SUN3 |
| 369 | #define IO_SPACE_LIMIT 0xffff |
| 370 | #else |
| 371 | #define IO_SPACE_LIMIT 0x0fffffff |
| 372 | #endif |
| 373 | |
| 374 | #endif /* __KERNEL__ */ |
| 375 | |
| 376 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 |
| 377 | |
| 378 | /* |
| 379 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
| 380 | * access |
| 381 | */ |
| 382 | #define xlate_dev_mem_ptr(p) __va(p) |
| 383 | |
| 384 | /* |
| 385 | * Convert a virtual cached pointer to an uncached pointer |
| 386 | */ |
| 387 | #define xlate_dev_kmem_ptr(p) p |
| 388 | |
Greg Ungerer | e93a6bb | 2011-11-28 16:32:49 +1000 | [diff] [blame] | 389 | #define ioport_map(port, nr) ((void __iomem *)(port)) |
| 390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | #endif /* _IO_H */ |