Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[pandora-kernel.git] / include / asm-arm / arch-sa1100 / memory.h
1 /*
2  * linux/include/asm-arm/arch-sa1100/memory.h
3  *
4  * Copyright (C) 1999-2000 Nicolas Pitre <nico@cam.org>
5  */
6
7 #ifndef __ASM_ARCH_MEMORY_H
8 #define __ASM_ARCH_MEMORY_H
9
10 #include <linux/config.h>
11 #include <asm/sizes.h>
12
13 /*
14  * Physical DRAM offset is 0xc0000000 on the SA1100
15  */
16 #define PHYS_OFFSET     UL(0xc0000000)
17
18 #ifndef __ASSEMBLY__
19
20 #ifdef CONFIG_SA1111
21 void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
22
23 #define arch_adjust_zones(node, size, holes) \
24         sa1111_adjust_zones(node, size, holes)
25
26 #define ISA_DMA_THRESHOLD       (PHYS_OFFSET + SZ_1M - 1)
27
28 #endif
29 #endif
30
31 /*
32  * Virtual view <-> DMA view memory address translations
33  * virt_to_bus: Used to translate the virtual address to an
34  *              address suitable to be passed to set_dma_addr
35  * bus_to_virt: Used to convert an address for DMA operations
36  *              to an address that the kernel can use.
37  *
38  * On the SA1100, bus addresses are equivalent to physical addresses.
39  */
40 #define __virt_to_bus(x)         __virt_to_phys(x)
41 #define __bus_to_virt(x)         __phys_to_virt(x)
42
43 #ifdef CONFIG_DISCONTIGMEM
44 /*
45  * Because of the wide memory address space between physical RAM banks on the 
46  * SA1100, it's much convenient to use Linux's NUMA support to implement our 
47  * memory map representation.  Assuming all memory nodes have equal access 
48  * characteristics, we then have generic discontiguous memory support.
49  *
50  * Of course, all this isn't mandatory for SA1100 implementations with only
51  * one used memory bank.  For those, simply undefine CONFIG_DISCONTIGMEM.
52  *
53  * The nodes are matched with the physical memory bank addresses which are 
54  * incidentally the same as virtual addresses.
55  * 
56  *      node 0:  0xc0000000 - 0xc7ffffff
57  *      node 1:  0xc8000000 - 0xcfffffff
58  *      node 2:  0xd0000000 - 0xd7ffffff
59  *      node 3:  0xd8000000 - 0xdfffffff
60  */
61
62 /*
63  * Given a kernel address, find the home node of the underlying memory.
64  */
65 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
66
67 /*
68  * Given a page frame number, convert it to a node id.
69  */
70 #define PFN_TO_NID(pfn)         (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
71
72 /*
73  * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
74  * and return the mem_map of that node.
75  */
76 #define ADDR_TO_MAPBASE(kaddr)  NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
77
78 /*
79  * Given a page frame number, find the owning node of the memory
80  * and return the mem_map of that node.
81  */
82 #define PFN_TO_MAPBASE(pfn)     NODE_MEM_MAP(PFN_TO_NID(pfn))
83
84 /*
85  * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
86  * and returns the index corresponding to the appropriate page in the
87  * node's mem_map.
88  */
89 #define LOCAL_MAP_NR(addr) \
90         (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
91
92 #endif
93
94 /*
95  * Cache flushing area - SA1100 zero bank
96  */
97 #define FLUSH_BASE_PHYS         0xe0000000
98 #define FLUSH_BASE              0xf5000000
99 #define FLUSH_BASE_MINICACHE    0xf5100000
100
101 #endif