Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / mach-realview / include / mach / memory.h
blobdb09170e3832fca5b8bef1f5c87374aac991e04c
1 /*
2 * arch/arm/mach-realview/include/mach/memory.h
4 * Copyright (C) 2003 ARM Limited
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef __ASM_ARCH_MEMORY_H
21 #define __ASM_ARCH_MEMORY_H
24 * Physical DRAM offset.
26 #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
27 #define PLAT_PHYS_OFFSET UL(0x70000000)
28 #else
29 #define PLAT_PHYS_OFFSET UL(0x00000000)
30 #endif
32 #ifdef CONFIG_SPARSEMEM
35 * Sparsemem definitions for RealView PBX.
37 * The RealView PBX board has another block of 512MB of RAM at 0x20000000,
38 * however only the block at 0x70000000 (or the 256MB mirror at 0x00000000)
39 * may be used for DMA.
41 * The macros below define a section size of 256MB and a non-linear virtual to
42 * physical mapping:
44 * 256MB @ 0x00000000 -> PAGE_OFFSET
45 * 512MB @ 0x20000000 -> PAGE_OFFSET + 0x10000000
46 * 256MB @ 0x80000000 -> PAGE_OFFSET + 0x30000000
48 #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
49 #error "SPARSEMEM not available with REALVIEW_HIGH_PHYS_OFFSET"
50 #endif
52 #define MAX_PHYSMEM_BITS 32
53 #define SECTION_SIZE_BITS 28
55 /* bank page offsets */
56 #define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000)
57 #define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000)
59 #define PHYS_OFFSET PLAT_PHYS_OFFSET
61 #define __phys_to_virt(phys) \
62 ((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \
63 (phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \
64 (phys) + PAGE_OFFSET)
66 #define __virt_to_phys(virt) \
67 ((virt) >= PAGE_OFFSET2 ? (virt) - PAGE_OFFSET2 + 0x80000000 : \
68 (virt) >= PAGE_OFFSET1 ? (virt) - PAGE_OFFSET1 + 0x20000000 : \
69 (virt) - PAGE_OFFSET)
71 #endif /* CONFIG_SPARSEMEM */
73 #endif