import of upstream 2.4.34.4 from kernel.org
[linux-2.4.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         if (a >= 16*1048576)
32                 BUG();
33         return PCIMEM_BASE + a;
34 }
35 #define __mem_pci(a)            ___mem_pci((unsigned long)(a))
36 #define __mem_isa(a)            ___mem_isa((unsigned long)(a))
37 #endif
38
39 /*
40  * Generic virtual read/write
41  */
42 #define __arch_getw(a)          (*(volatile unsigned short *)(a))
43 #define __arch_putw(v,a)        (*(volatile unsigned short *)(a) = (v))
44
45 /*
46  * ioremap support - validate a PCI memory address,
47  * and convert a PCI memory address to a physical
48  * address for the page tables.
49  */
50 #define iomem_valid_addr(iomem,sz)      \
51         ((iomem) < 0x80000000 && (iomem) + (sz) <= 0x80000000)
52 #define iomem_to_phys(iomem)    ((iomem) + PLX_MEM_START)
53
54 #endif