ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / arch-nexuspci / io.h
1 /*
2  * linux/include/asm-arm/arch-nexuspci/io.h
3  *
4  * Copyright (C) 1997-1999 Russell King
5  * Copyright (C) 2000 FutureTV Labs Ltd.
6  */
7 #ifndef __ASM_ARM_ARCH_IO_H
8 #define __ASM_ARM_ARCH_IO_H
9
10 #define IO_SPACE_LIMIT 0xffff
11
12 /*
13  * Translation of various region addresses to virtual addresses
14  */
15 #define __io(a)                 (PCIO_BASE + (a))
16 #if 1
17 #define __mem_pci(a)            ((unsigned long)(a))
18 #define __mem_isa(a)            (PCIMEM_BASE + (unsigned long)(a))
19 #else
20
21 static inline unsigned long ___mem_pci(unsigned long a)
22 {
23         /* PCI addresses must have been ioremapped */
24         if (a <= 0xc0000000 || a >= 0xe0000000)
25                 *((int *)0) = 0;
26         return a;
27 }
28
29 static inline unsigned long ___mem_isa(unsigned long a)
30 {
31         BUG_ON(a >= 16*1048576);
32         return PCIMEM_BASE + a;
33 }
34 #define __mem_pci(a)            ___mem_pci((unsigned long)(a))
35 #define __mem_isa(a)            ___mem_isa((unsigned long)(a))
36 #endif
37
38 /*
39  * ioremap support - validate a PCI memory address,
40  * and convert a PCI memory address to a physical
41  * address for the page tables.
42  */
43 #define iomem_valid_addr(iomem,sz)      \
44         ((iomem) < 0x80000000 && (iomem) + (sz) <= 0x80000000)
45 #define iomem_to_phys(iomem)    ((iomem) + PLX_MEM_START)
46
47 #define __arch_ioremap(off,sz,nocache)                          \
48  ({                                                             \
49         unsigned long _off = (off), _size = (sz);               \
50         void *_ret = (void *)0;                                 \
51         if (iomem_valid_addr(_off, _size))                      \
52                 _ret = __ioremap(iomem_to_phys(_off),_size,0);  \
53         _ret;                                                   \
54  })
55
56 #define __arch_iounmap __iounmap
57
58 #endif