2 * linux/include/asm-arm/arch-sa1100/mmzone.h
4 * (C) 1999-2000, Nicolas Pitre <nico@cam.org>
5 * (inspired by Kanoj Sarcar's code)
7 * Because of the wide memory address space between physical RAM banks on the
8 * SA1100, it's much convenient to use Linux's NUMA support to implement our
9 * memory map representation. Assuming all memory nodes have equal access
10 * characteristics, we then have generic discontigous memory support.
12 * Of course, all this isn't mandatory for SA1100 implementations with only
13 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
15 * The nodes are matched with the physical memory bank addresses which are
16 * incidentally the same as virtual addresses.
18 * node 0: 0xc0000000 - 0xc7ffffff
19 * node 1: 0xc8000000 - 0xcfffffff
20 * node 2: 0xd0000000 - 0xd7ffffff
21 * node 3: 0xd8000000 - 0xdfffffff
26 * Currently defined in arch/arm/mm/mm-sa1100.c
28 extern pg_data_t sa1100_node_data[];
31 * Return a pointer to the node data for node n.
33 #define NODE_DATA(nid) (&sa1100_node_data[nid])
36 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
38 #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
41 * Given a kernel address, find the home node of the underlying memory.
43 #define KVADDR_TO_NID(addr) \
44 (((unsigned long)(addr) & 0x18000000) >> 27)
47 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
48 * and returns the the mem_map of that node.
50 #define ADDR_TO_MAPBASE(kaddr) \
51 NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
54 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
55 * and returns the index corresponding to the appropriate page in the
58 #define LOCAL_MAP_NR(kvaddr) \
59 (((unsigned long)(kvaddr) & 0x07ffffff) >> PAGE_SHIFT)
62 * Given a kaddr, virt_to_page returns a pointer to the corresponding
65 #define virt_to_page(kaddr) \
66 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
69 * Didn't find the best way to validate a page pointer yet...
72 #define VALID_PAGE(page) (1)