1 /* arch/arm/mach-lh7a40x/include/mach/memory.h
3 * Copyright (C) 2004 Coastal Environmental Systems
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
10 * Refer to <file:Documentation/arm/Sharp-LH/SDRAM> for more information.
14 #ifndef __ASM_ARCH_MEMORY_H
15 #define __ASM_ARCH_MEMORY_H
18 * Physical DRAM offset.
20 #define PHYS_OFFSET UL(0xc0000000)
22 #ifdef CONFIG_DISCONTIGMEM
25 * Given a kernel address, find the home node of the underlying memory.
28 # ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
29 # define KVADDR_TO_NID(addr) \
30 ( ((((unsigned long) (addr) - PAGE_OFFSET) >> 24) & 1)\
31 | ((((unsigned long) (addr) - PAGE_OFFSET) >> 25) & ~1))
32 # else /* 2 banks per node */
33 # define KVADDR_TO_NID(addr) \
34 (((unsigned long) (addr) - PAGE_OFFSET) >> 26)
38 * Given a page frame number, convert it to a node id.
41 # ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
42 # define PFN_TO_NID(pfn) \
43 (((((pfn) - PHYS_PFN_OFFSET) >> (24 - PAGE_SHIFT)) & 1)\
44 | ((((pfn) - PHYS_PFN_OFFSET) >> (25 - PAGE_SHIFT)) & ~1))
45 # else /* 2 banks per node */
46 # define PFN_TO_NID(pfn) \
47 (((pfn) - PHYS_PFN_OFFSET) >> (26 - PAGE_SHIFT))
51 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
52 * and returns the index corresponding to the appropriate page in the
56 # ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
57 # define LOCAL_MAP_NR(addr) \
58 (((unsigned long)(addr) & 0x003fffff) >> PAGE_SHIFT)
59 # else /* 2 banks per node */
60 # define LOCAL_MAP_NR(addr) \
61 (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT)
67 * Sparsemem version of the above
69 #define MAX_PHYSMEM_BITS 32
70 #define SECTION_SIZE_BITS 24