[PATCH] tb0219: convert to the new platform device interface
[linux-2.6/verdex.git] / include / asm-arm / arch-sa1100 / memory.h
blob018a9f0e3986d2d8f2c53f7f33b7ef17cfb86dc2
1 /*
2 * linux/include/asm-arm/arch-sa1100/memory.h
4 * Copyright (C) 1999-2000 Nicolas Pitre <nico@cam.org>
5 */
7 #ifndef __ASM_ARCH_MEMORY_H
8 #define __ASM_ARCH_MEMORY_H
10 #include <linux/config.h>
11 #include <asm/sizes.h>
14 * Physical DRAM offset is 0xc0000000 on the SA1100
16 #define PHYS_OFFSET UL(0xc0000000)
18 #ifndef __ASSEMBLY__
20 #ifdef CONFIG_SA1111
21 void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
23 #define arch_adjust_zones(node, size, holes) \
24 sa1111_adjust_zones(node, size, holes)
26 #define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
28 #endif
29 #endif
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.
38 * On the SA1100, bus addresses are equivalent to physical addresses.
40 #define __virt_to_bus(x) __virt_to_phys(x)
41 #define __bus_to_virt(x) __phys_to_virt(x)
43 #ifdef CONFIG_DISCONTIGMEM
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.
50 * Of course, all this isn't mandatory for SA1100 implementations with only
51 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
53 * The nodes are matched with the physical memory bank addresses which are
54 * incidentally the same as virtual addresses.
56 * node 0: 0xc0000000 - 0xc7ffffff
57 * node 1: 0xc8000000 - 0xcfffffff
58 * node 2: 0xd0000000 - 0xd7ffffff
59 * node 3: 0xd8000000 - 0xdfffffff
63 * Given a kernel address, find the home node of the underlying memory.
65 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
68 * Given a page frame number, convert it to a node id.
70 #define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
73 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
74 * and return the mem_map of that node.
76 #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
79 * Given a page frame number, find the owning node of the memory
80 * and return the mem_map of that node.
82 #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
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.
89 #define LOCAL_MAP_NR(addr) \
90 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
92 #endif
94 #endif