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>
15 #define TASK_SIZE (0xbf000000UL)
16 #define TASK_SIZE_26 (0x04000000UL)
19 * This decides where the kernel will search for a free chunk of vm
20 * space during mmap's.
22 #define TASK_UNMAPPED_BASE (0x40000000)
27 #define PAGE_OFFSET (0xc0000000UL)
30 * Physical DRAM offset is 0xc0000000 on the SA1100
32 #define PHYS_OFFSET (0xc0000000UL)
35 * We take advantage of the fact that physical and virtual address can be the
36 * same. The NUMA code is handling the large holes that might exist between
39 #define __virt_to_phys__is_a_macro
40 #define __phys_to_virt__is_a_macro
41 #define __virt_to_phys(x) (x)
42 #define __phys_to_virt(x) (x)
45 * Virtual view <-> DMA view memory address translations
46 * virt_to_bus: Used to translate the virtual address to an
47 * address suitable to be passed to set_dma_addr
48 * bus_to_virt: Used to convert an address for DMA operations
49 * to an address that the kernel can use.
51 * On the SA1100, bus addresses are equivalent to physical addresses.
53 #define __virt_to_bus__is_a_macro
54 #define __bus_to_virt__is_a_macro
55 #define __virt_to_bus(x) __virt_to_phys(x)
56 #define __bus_to_virt(x) __phys_to_virt(x)
58 #ifdef CONFIG_DISCONTIGMEM
60 * Because of the wide memory address space between physical RAM banks on the
61 * SA1100, it's much convenient to use Linux's NUMA support to implement our
62 * memory map representation. Assuming all memory nodes have equal access
63 * characteristics, we then have generic discontiguous memory support.
65 * Of course, all this isn't mandatory for SA1100 implementations with only
66 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
68 * The nodes are matched with the physical memory bank addresses which are
69 * incidentally the same as virtual addresses.
71 * node 0: 0xc0000000 - 0xc7ffffff
72 * node 1: 0xc8000000 - 0xcfffffff
73 * node 2: 0xd0000000 - 0xd7ffffff
74 * node 3: 0xd8000000 - 0xdfffffff
78 * Given a kernel address, find the home node of the underlying memory.
80 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
83 * Given a page frame number, convert it to a node id.
85 #define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
88 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
89 * and return the mem_map of that node.
91 #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
94 * Given a page frame number, find the owning node of the memory
95 * and return the mem_map of that node.
97 #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
100 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
101 * and returns the index corresponding to the appropriate page in the
104 #define LOCAL_MAP_NR(addr) \
105 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
109 #define PFN_TO_NID(addr) (0)