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 12 /* 13 * Task size: 3GB 14 */ 15 #define TASK_SIZE (0xc0000000UL) 16 #define TASK_SIZE_26 (0x04000000UL) 17 18 /* 19 * This decides where the kernel will search for a free chunk of vm 20 * space during mmap's. 21 */ 22 #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) 23 24 /* 25 * Page offset: 3GB 26 */ 27 #define PAGE_OFFSET (0xc0000000UL) 28 29 /* 30 * Physical DRAM offset is 0xc0000000 on the SA1100 31 */ 32 #define PHYS_OFFSET (0xc0000000UL) 33 34 /* 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 37 * all memory banks. 38 */ 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) 43 44 /* 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. 50 * 51 * On the SA1100, bus addresses are equivalent to physical addresses. 52 */ 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) 57 58 #ifdef CONFIG_DISCONTIGMEM 59 /* 60 * Because of the wide memory address space between physical RAM banks on the 61 * SA1100, it's much more convenient to use Linux's NUMA support to implement 62 * our memory map representation. Assuming all memory nodes have equal access 63 * characteristics, we then have generic discontiguous memory support. 64 * 65 * Of course, all this isn't mandatory for SA1100 implementations with only 66 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM. 67 * 68 * The nodes are matched with the physical memory bank addresses which are 69 * incidentally the same as virtual addresses. 70 * 71 * node 0: 0xc0000000 - 0xc7ffffff 72 * node 1: 0xc8000000 - 0xcfffffff 73 * node 2: 0xd0000000 - 0xd7ffffff 74 * node 3: 0xd8000000 - 0xdfffffff 75 */ 76 77 #define NR_NODES 4 78 79 /* 80 * Given a kernel address, find the home node of the underlying memory. 81 */ 82 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27) 83 84 /* 85 * Given a page frame number, convert it to a node id. 86 */ 87 #define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT)) 88 89 /* 90 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory 91 * and returns the mem_map of that node. 92 */ 93 #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr)) 94 95 /* 96 * Given a page frame number, find the owning node of the memory 97 * and returns the mem_map of that node. 98 */ 99 #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn)) 100 101 /* 102 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory 103 * and returns the index corresponding to the appropriate page in the 104 * node's mem_map. 105 */ 106 #define LOCAL_MAP_NR(addr) \ 107 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT) 108 109 #else 110 111 #define PFN_TO_NID(addr) (0) 112 113 #endif 114 115 #endif 116