2 * linux/include/asm-arm/arch-sa1100/memory.h
4 * Copyright (C) 1999-2000 Nicolas Pitre <nico@cam.org>
7 #ifndef __ASM_ARCH_MEMORY_H
8 #define __ASM_ARCH_MEMORY_H
10 #include <linux/config.h>
13 * Physical DRAM offset is 0xc0000000 on the SA1100
15 #define PHYS_OFFSET (0xc0000000UL)
18 * Virtual view <-> DMA view memory address translations
19 * virt_to_bus: Used to translate the virtual address to an
20 * address suitable to be passed to set_dma_addr
21 * bus_to_virt: Used to convert an address for DMA operations
22 * to an address that the kernel can use.
24 * On the SA1100, bus addresses are equivalent to physical addresses.
26 #define __virt_to_bus(x) __virt_to_phys(x)
27 #define __bus_to_virt(x) __phys_to_virt(x)
29 #ifdef CONFIG_DISCONTIGMEM
31 * Because of the wide memory address space between physical RAM banks on the
32 * SA1100, it's much convenient to use Linux's NUMA support to implement our
33 * memory map representation. Assuming all memory nodes have equal access
34 * characteristics, we then have generic discontiguous memory support.
36 * Of course, all this isn't mandatory for SA1100 implementations with only
37 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
39 * The nodes are matched with the physical memory bank addresses which are
40 * incidentally the same as virtual addresses.
42 * node 0: 0xc0000000 - 0xc7ffffff
43 * node 1: 0xc8000000 - 0xcfffffff
44 * node 2: 0xd0000000 - 0xd7ffffff
45 * node 3: 0xd8000000 - 0xdfffffff
49 * Given a kernel address, find the home node of the underlying memory.
51 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
54 * Given a page frame number, convert it to a node id.
56 #define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
59 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
60 * and return the mem_map of that node.
62 #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
65 * Given a page frame number, find the owning node of the memory
66 * and return the mem_map of that node.
68 #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
71 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
72 * and returns the index corresponding to the appropriate page in the
75 #define LOCAL_MAP_NR(addr) \
76 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
80 #define PFN_TO_NID(addr) (0)