23 #include <linux/compiler.h>
25 #include <asm/virtconvert.h>
41 #define q40_isa_io_base 0xff400000
42 #define q40_isa_mem_base 0xff800000
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)))
52 #ifdef CONFIG_AMIGA_PCMCIA
55 #define AG_ISA_IO_B(ioaddr) ( GAYLE_IO+(ioaddr)+(((ioaddr)&1)*GAYLE_ODD) )
56 #define AG_ISA_IO_W(ioaddr) ( GAYLE_IO+(ioaddr) )
68 #if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE)
70 #define HAVE_ARCH_PIO_SIZE
72 #define PIO_MASK 0xffff
73 #define PIO_RESERVED 0x10000
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
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
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))
114 #elif defined(CONFIG_ISA)
120 #define ISA_TYPE_Q40 (1)
121 #define ISA_TYPE_AG (2)
123 #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
124 #define ISA_TYPE ISA_TYPE_Q40
127 #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
128 #define ISA_TYPE ISA_TYPE_AG
136 #define ISA_TYPE isa_type
137 #define ISA_SEX isa_sex
150 case ISA_TYPE_Q40:
return (
u8 __iomem *)Q40_ISA_IO_B(addr);
152 #ifdef CONFIG_AMIGA_PCMCIA
153 case ISA_TYPE_AG:
return (
u8 __iomem *)AG_ISA_IO_B(addr);
155 default:
return NULL;
158 static inline u16 __iomem *isa_itw(
unsigned long addr)
163 case ISA_TYPE_Q40:
return (
u16 __iomem *)Q40_ISA_IO_W(addr);
165 #ifdef CONFIG_AMIGA_PCMCIA
166 case ISA_TYPE_AG:
return (
u16 __iomem *)AG_ISA_IO_W(addr);
168 default:
return NULL;
171 static inline u32 __iomem *isa_itl(
unsigned long addr)
175 #ifdef CONFIG_AMIGA_PCMCIA
176 case ISA_TYPE_AG:
return (
u32 __iomem *)AG_ISA_IO_W(addr);
181 static inline u8 __iomem *isa_mtb(
unsigned long addr)
186 case ISA_TYPE_Q40:
return (
u8 __iomem *)Q40_ISA_MEM_B(addr);
188 #ifdef CONFIG_AMIGA_PCMCIA
191 default:
return NULL;
194 static inline u16 __iomem *isa_mtw(
unsigned long addr)
199 case ISA_TYPE_Q40:
return (
u16 __iomem *)Q40_ISA_MEM_W(addr);
201 #ifdef CONFIG_AMIGA_PCMCIA
204 default:
return NULL;
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)))
211 #define isa_inl(port) (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
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)))
214 #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
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)))
225 static inline void isa_delay(
void)
230 case ISA_TYPE_Q40: isa_outb(0,0x80);
break;
232 #ifdef CONFIG_AMIGA_PCMCIA
233 case ISA_TYPE_AG:
break;
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();})
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))
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)))
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)))
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))
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))
267 #define inb_p isa_inb_p
268 #define outb isa_outb
269 #define outb_p isa_outb_p
271 #define inw_p isa_inw_p
272 #define outw isa_outw
273 #define outw_p isa_outw_p
275 #define inl_p isa_inl_p
276 #define outl isa_outl
277 #define outl_p isa_outl_p
278 #define insb isa_insb
279 #define insw isa_insw
280 #define insl isa_insl
281 #define outsb isa_outsb
282 #define outsw isa_outsw
283 #define outsl isa_outsl
284 #define readb isa_readb
285 #define readw isa_readw
286 #define writeb isa_writeb
287 #define writew isa_writew
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
299 #define inw_p(port) 0xffff
300 #define outw(val,port) ((void)0)
301 #define outw_p(val,port) ((void)0)
302 #define inl(port) 0xffffffffUL
303 #define inl_p(port) 0xffffffffUL
304 #define outl(val,port) ((void)0)
305 #define outl_p(val,port) ((void)0)
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)
317 #define readb(addr) in_8(addr)
318 #define writeb(val,addr) out_8((addr),(val))
319 #define readw(addr) in_le16(addr)
320 #define writew(val,addr) out_le16((addr),(val))
324 #define readl(addr) in_le32(addr)
325 #define writel(val,addr) out_le32((addr),(val))
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))
338 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
342 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
347 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
352 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
357 __builtin_memset((
void __force *) addr, val, count);
361 __builtin_memcpy(dst, (
void __force *) src, count);
363 static inline void memcpy_toio(
volatile void __iomem *dst,
const void *src,
int count)
365 __builtin_memcpy((
void __force *) dst, src, count);
369 #define IO_SPACE_LIMIT 0xffff
371 #define IO_SPACE_LIMIT 0x0fffffff
376 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
382 #define xlate_dev_mem_ptr(p) __va(p)
387 #define xlate_dev_kmem_ptr(p) p
389 #define ioport_map(port, nr) ((void __iomem *)(port))