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>
11 #include <asm/sizes.h>
14 * Physical DRAM offset is 0xc0000000 on the SA1100
16 #define PHYS_OFFSET (0xc0000000UL)
22 __arch_adjust_zones(int node
, unsigned long *size
, unsigned long *holes
)
24 unsigned int sz
= SZ_1M
>> PAGE_SHIFT
;
29 size
[1] = size
[0] - sz
;
33 #define arch_adjust_zones(node, size, holes) \
34 __arch_adjust_zones(node, size, holes)
36 #define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
42 * Virtual view <-> DMA view memory address translations
43 * virt_to_bus: Used to translate the virtual address to an
44 * address suitable to be passed to set_dma_addr
45 * bus_to_virt: Used to convert an address for DMA operations
46 * to an address that the kernel can use.
48 * On the SA1100, bus addresses are equivalent to physical addresses.
50 #define __virt_to_bus(x) __virt_to_phys(x)
51 #define __bus_to_virt(x) __phys_to_virt(x)
53 #ifdef CONFIG_DISCONTIGMEM
55 * Because of the wide memory address space between physical RAM banks on the
56 * SA1100, it's much convenient to use Linux's NUMA support to implement our
57 * memory map representation. Assuming all memory nodes have equal access
58 * characteristics, we then have generic discontiguous memory support.
60 * Of course, all this isn't mandatory for SA1100 implementations with only
61 * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM.
63 * The nodes are matched with the physical memory bank addresses which are
64 * incidentally the same as virtual addresses.
66 * node 0: 0xc0000000 - 0xc7ffffff
67 * node 1: 0xc8000000 - 0xcfffffff
68 * node 2: 0xd0000000 - 0xd7ffffff
69 * node 3: 0xd8000000 - 0xdfffffff
73 * Given a kernel address, find the home node of the underlying memory.
75 #define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
78 * Given a page frame number, convert it to a node id.
80 #define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
83 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
84 * and return the mem_map of that node.
86 #define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
89 * Given a page frame number, find the owning node of the memory
90 * and return the mem_map of that node.
92 #define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
95 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
96 * and returns the index corresponding to the appropriate page in the
99 #define LOCAL_MAP_NR(addr) \
100 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
104 #define PFN_TO_NID(addr) (0)