aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-05-07 12:40:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-16 05:57:35 -0400
commitbe370302742ff9948f2a42b15cb2ba174d97b930 (patch)
tree977bfa71c1e1483c22a40d85dfd3b233e5ac5d06 /arch
parent7961239599de71130c852ecfa9a4140f3f60547b (diff)
ARM: Remove DISCONTIGMEM support
Everything should now be using sparsemem rather than discontigmem, so remove the code supporting discontigmem from ARM. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig13
-rw-r--r--arch/arm/include/asm/memory.h65
-rw-r--r--arch/arm/include/asm/mmzone.h30
-rw-r--r--arch/arm/include/asm/setup.h8
-rw-r--r--arch/arm/kernel/setup.c3
-rw-r--r--arch/arm/mach-aaec2000/include/mach/memory.h10
-rw-r--r--arch/arm/mach-clps711x/Kconfig1
-rw-r--r--arch/arm/mach-clps711x/clep7312.c1
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c2
-rw-r--r--arch/arm/mach-clps711x/fortunet.c1
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h2
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h2
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/memory.h44
-rw-r--r--arch/arm/mach-msm/board-trout.c1
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/eseries.c1
-rw-r--r--arch/arm/mach-pxa/generic.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/memory.h12
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c1
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c1
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c1
-rw-r--r--arch/arm/mach-sa1100/generic.h3
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/discontig.c45
-rw-r--r--arch/arm/mm/init.c266
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmu.c38
-rw-r--r--arch/arm/mm/nommu.c13
30 files changed, 143 insertions, 432 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 98922f7d2d12..410edd65f117 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -719,7 +719,6 @@ config ARCH_SHARK
719config ARCH_LH7A40X 719config ARCH_LH7A40X
720 bool "Sharp LH7A40X" 720 bool "Sharp LH7A40X"
721 select CPU_ARM922T 721 select CPU_ARM922T
722 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
723 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 722 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
724 select ARCH_USES_GETTIMEOFFSET 723 select ARCH_USES_GETTIMEOFFSET
725 help 724 help
@@ -1241,10 +1240,6 @@ config OABI_COMPAT
1241config ARCH_HAS_HOLES_MEMORYMODEL 1240config ARCH_HAS_HOLES_MEMORYMODEL
1242 bool 1241 bool
1243 1242
1244# Discontigmem is deprecated
1245config ARCH_DISCONTIGMEM_ENABLE
1246 bool
1247
1248config ARCH_SPARSEMEM_ENABLE 1243config ARCH_SPARSEMEM_ENABLE
1249 bool 1244 bool
1250 1245
@@ -1252,13 +1247,7 @@ config ARCH_SPARSEMEM_DEFAULT
1252 def_bool ARCH_SPARSEMEM_ENABLE 1247 def_bool ARCH_SPARSEMEM_ENABLE
1253 1248
1254config ARCH_SELECT_MEMORY_MODEL 1249config ARCH_SELECT_MEMORY_MODEL
1255 def_bool ARCH_DISCONTIGMEM_ENABLE && ARCH_SPARSEMEM_ENABLE 1250 def_bool ARCH_SPARSEMEM_ENABLE
1256
1257config NODES_SHIFT
1258 int
1259 default "4" if ARCH_LH7A40X
1260 default "2"
1261 depends on NEED_MULTIPLE_NODES
1262 1251
1263config HIGHMEM 1252config HIGHMEM
1264 bool "High Memory Support (EXPERIMENTAL)" 1253 bool "High Memory Support (EXPERIMENTAL)"
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 4312ee5e3d0b..e263ec7c5dcb 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -234,76 +234,11 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
234 * virt_to_page(k) convert a _valid_ virtual address to struct page * 234 * virt_to_page(k) convert a _valid_ virtual address to struct page *
235 * virt_addr_valid(k) indicates whether a virtual address is valid 235 * virt_addr_valid(k) indicates whether a virtual address is valid
236 */ 236 */
237#ifndef CONFIG_DISCONTIGMEM
238
239#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 237#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
240 238
241#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 239#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
242#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) 240#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
243 241
244#define PHYS_TO_NID(addr) (0)
245
246#else /* CONFIG_DISCONTIGMEM */
247
248/*
249 * This is more complex. We have a set of mem_map arrays spread
250 * around in memory.
251 */
252#include <linux/numa.h>
253
254#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
255#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
256
257#define virt_to_page(kaddr) \
258 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
259
260#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
261
262/*
263 * Common discontigmem stuff.
264 * PHYS_TO_NID is used by the ARM kernel/setup.c
265 */
266#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
267
268/*
269 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
270 * and returns the mem_map of that node.
271 */
272#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
273
274/*
275 * Given a page frame number, find the owning node of the memory
276 * and returns the mem_map of that node.
277 */
278#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
279
280#ifdef NODE_MEM_SIZE_BITS
281#define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1)
282
283/*
284 * Given a kernel address, find the home node of the underlying memory.
285 */
286#define KVADDR_TO_NID(addr) \
287 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS)
288
289/*
290 * Given a page frame number, convert it to a node id.
291 */
292#define PFN_TO_NID(pfn) \
293 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT))
294
295/*
296 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
297 * and returns the index corresponding to the appropriate page in the
298 * node's mem_map.
299 */
300#define LOCAL_MAP_NR(addr) \
301 (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT)
302
303#endif /* NODE_MEM_SIZE_BITS */
304
305#endif /* !CONFIG_DISCONTIGMEM */
306
307/* 242/*
308 * Optional coherency support. Currently used only by selected 243 * Optional coherency support. Currently used only by selected
309 * Intel XSC3-based systems. 244 * Intel XSC3-based systems.
diff --git a/arch/arm/include/asm/mmzone.h b/arch/arm/include/asm/mmzone.h
deleted file mode 100644
index ae63a4fd28c8..000000000000
--- a/arch/arm/include/asm/mmzone.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * arch/arm/include/asm/mmzone.h
3 *
4 * 1999-12-29 Nicolas Pitre Created
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_MMZONE_H
11#define __ASM_MMZONE_H
12
13/*
14 * Currently defined in arch/arm/mm/discontig.c
15 */
16extern pg_data_t discontig_node_data[];
17
18/*
19 * Return a pointer to the node data for node n.
20 */
21#define NODE_DATA(nid) (&discontig_node_data[nid])
22
23/*
24 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
25 */
26#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
27
28#include <mach/memory.h>
29
30#endif
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index f392fb4437af..f1e5a9bca249 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -201,8 +201,7 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }
201struct membank { 201struct membank {
202 unsigned long start; 202 unsigned long start;
203 unsigned long size; 203 unsigned long size;
204 unsigned short node; 204 unsigned int highmem;
205 unsigned short highmem;
206}; 205};
207 206
208struct meminfo { 207struct meminfo {
@@ -212,9 +211,8 @@ struct meminfo {
212 211
213extern struct meminfo meminfo; 212extern struct meminfo meminfo;
214 213
215#define for_each_nodebank(iter,mi,no) \ 214#define for_each_bank(iter,mi) \
216 for (iter = 0; iter < (mi)->nr_banks; iter++) \ 215 for (iter = 0; iter < (mi)->nr_banks; iter++)
217 if ((mi)->bank[iter].node == no)
218 216
219#define bank_pfn_start(bank) __phys_to_pfn((bank)->start) 217#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
220#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) 218#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 122d999bdc7c..387d2e9cb51f 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -402,13 +402,12 @@ static int __init arm_add_memory(unsigned long start, unsigned long size)
402 size -= start & ~PAGE_MASK; 402 size -= start & ~PAGE_MASK;
403 bank->start = PAGE_ALIGN(start); 403 bank->start = PAGE_ALIGN(start);
404 bank->size = size & PAGE_MASK; 404 bank->size = size & PAGE_MASK;
405 bank->node = PHYS_TO_NID(start);
406 405
407 /* 406 /*
408 * Check whether this memory region has non-zero size or 407 * Check whether this memory region has non-zero size or
409 * invalid node number. 408 * invalid node number.
410 */ 409 */
411 if (bank->size == 0 || bank->node >= MAX_NUMNODES) 410 if (bank->size == 0)
412 return -EINVAL; 411 return -EINVAL;
413 412
414 meminfo.nr_banks++; 413 meminfo.nr_banks++;
diff --git a/arch/arm/mach-aaec2000/include/mach/memory.h b/arch/arm/mach-aaec2000/include/mach/memory.h
index c00822543d9f..4f93c567a35a 100644
--- a/arch/arm/mach-aaec2000/include/mach/memory.h
+++ b/arch/arm/mach-aaec2000/include/mach/memory.h
@@ -14,14 +14,4 @@
14 14
15#define PHYS_OFFSET UL(0xf0000000) 15#define PHYS_OFFSET UL(0xf0000000)
16 16
17/*
18 * The nodes are the followings:
19 *
20 * node 0: 0xf000.0000 - 0xf3ff.ffff
21 * node 1: 0xf400.0000 - 0xf7ff.ffff
22 * node 2: 0xf800.0000 - 0xfbff.ffff
23 * node 3: 0xfc00.0000 - 0xffff.ffff
24 */
25#define NODE_MEM_SIZE_BITS 26
26
27#endif /* __ASM_ARCH_MEMORY_H */ 17#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index dbaae5f746a1..eb34bd1251d4 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -30,7 +30,6 @@ config ARCH_CLEP7312
30config ARCH_EDB7211 30config ARCH_EDB7211
31 bool "EDB7211" 31 bool "EDB7211"
32 select ISA 32 select ISA
33 select ARCH_DISCONTIGMEM_ENABLE
34 select ARCH_SPARSEMEM_ENABLE 33 select ARCH_SPARSEMEM_ENABLE
35 select ARCH_SELECT_MEMORY_MODEL 34 select ARCH_SELECT_MEMORY_MODEL
36 help 35 help
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index 09fb57e45213..3c3bf45039ff 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -32,7 +32,6 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags,
32 mi->nr_banks=1; 32 mi->nr_banks=1;
33 mi->bank[0].start = 0xc0000000; 33 mi->bank[0].start = 0xc0000000;
34 mi->bank[0].size = 0x01000000; 34 mi->bank[0].size = 0x01000000;
35 mi->bank[0].node = 0;
36} 35}
37 36
38 37
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index dc81cc68595d..41a4425617c1 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -43,10 +43,8 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags,
43 */ 43 */
44 mi->bank[0].start = 0xc0000000; 44 mi->bank[0].start = 0xc0000000;
45 mi->bank[0].size = 8*1024*1024; 45 mi->bank[0].size = 8*1024*1024;
46 mi->bank[0].node = 0;
47 mi->bank[1].start = 0xc1000000; 46 mi->bank[1].start = 0xc1000000;
48 mi->bank[1].size = 8*1024*1024; 47 mi->bank[1].size = 8*1024*1024;
49 mi->bank[1].node = 1;
50 mi->nr_banks = 2; 48 mi->nr_banks = 2;
51} 49}
52 50
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index 7430e4049d87..a696099aa4f8 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -39,7 +39,6 @@ struct meminfo memmap = {
39 { 39 {
40 .start = 0xC0000000, 40 .start = 0xC0000000,
41 .size = 0x01000000, 41 .size = 0x01000000,
42 .node = 0
43 }, 42 },
44 }, 43 },
45}; 44};
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index f70d52be48a2..f45c8e892cb5 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -20,7 +20,6 @@
20#ifndef __ASM_ARCH_MEMORY_H 20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H 21#define __ASM_ARCH_MEMORY_H
22 22
23
24/* 23/*
25 * Physical DRAM offset. 24 * Physical DRAM offset.
26 */ 25 */
@@ -72,7 +71,6 @@
72 * node 2: 0xd0000000 - 0xd7ffffff 71 * node 2: 0xd0000000 - 0xd7ffffff
73 * node 3: 0xd8000000 - 0xdfffffff 72 * node 3: 0xd8000000 - 0xdfffffff
74 */ 73 */
75#define NODE_MEM_SIZE_BITS 24
76#define SECTION_SIZE_BITS 24 74#define SECTION_SIZE_BITS 24
77#define MAX_PHYSMEM_BITS 32 75#define MAX_PHYSMEM_BITS 32
78 76
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index 25b1da9a5035..7415e4338651 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -69,6 +69,4 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
69#endif /* CONFIG_ARCH_IOP13XX */ 69#endif /* CONFIG_ARCH_IOP13XX */
70#endif /* !ASSEMBLY */ 70#endif /* !ASSEMBLY */
71 71
72#define PFN_TO_NID(addr) (0)
73
74#endif 72#endif
diff --git a/arch/arm/mach-lh7a40x/include/mach/memory.h b/arch/arm/mach-lh7a40x/include/mach/memory.h
index 189d20e543e7..edb8f5faf5d5 100644
--- a/arch/arm/mach-lh7a40x/include/mach/memory.h
+++ b/arch/arm/mach-lh7a40x/include/mach/memory.h
@@ -19,50 +19,6 @@
19 */ 19 */
20#define PHYS_OFFSET UL(0xc0000000) 20#define PHYS_OFFSET UL(0xc0000000)
21 21
22#ifdef CONFIG_DISCONTIGMEM
23
24/*
25 * Given a kernel address, find the home node of the underlying memory.
26 */
27
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)
35# endif
36
37/*
38 * Given a page frame number, convert it to a node id.
39 */
40
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))
48#endif
49
50/*
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
53 * node's mem_map.
54 */
55
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)
62# endif
63
64#endif
65
66/* 22/*
67 * Sparsemem version of the above 23 * Sparsemem version of the above
68 */ 24 */
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index dca5a5f062dc..e69a1502e4e8 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -50,7 +50,6 @@ static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
50{ 50{
51 mi->nr_banks = 1; 51 mi->nr_banks = 1;
52 mi->bank[0].start = PHYS_OFFSET; 52 mi->bank[0].start = PHYS_OFFSET;
53 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
54 mi->bank[0].size = (101*1024*1024); 53 mi->bank[0].size = (101*1024*1024);
55} 54}
56 55
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 3d1dcb9ac08f..95234fb4fcf8 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -715,7 +715,6 @@ static void __init fixup_corgi(struct machine_desc *desc,
715 sharpsl_save_param(); 715 sharpsl_save_param();
716 mi->nr_banks=1; 716 mi->nr_banks=1;
717 mi->bank[0].start = 0xa0000000; 717 mi->bank[0].start = 0xa0000000;
718 mi->bank[0].node = 0;
719 if (machine_is_corgi()) 718 if (machine_is_corgi())
720 mi->bank[0].size = (32*1024*1024); 719 mi->bank[0].size = (32*1024*1024);
721 else 720 else
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 96ed13081639..a0ab3082a000 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -34,7 +34,6 @@ void __init eseries_fixup(struct machine_desc *desc,
34{ 34{
35 mi->nr_banks=1; 35 mi->nr_banks=1;
36 mi->bank[0].start = 0xa0000000; 36 mi->bank[0].start = 0xa0000000;
37 mi->bank[0].node = 0;
38 if (machine_is_e800()) 37 if (machine_is_e800())
39 mi->bank[0].size = (128*1024*1024); 38 mi->bank[0].size = (128*1024*1024);
40 else 39 else
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 890fb90a672f..c6305c5b8a72 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -26,8 +26,7 @@ extern unsigned int get_clk_frequency_khz(int info);
26 26
27#define SET_BANK(__nr,__start,__size) \ 27#define SET_BANK(__nr,__start,__size) \
28 mi->bank[__nr].start = (__start), \ 28 mi->bank[__nr].start = (__start), \
29 mi->bank[__nr].size = (__size), \ 29 mi->bank[__nr].size = (__size)
30 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
31 30
32#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 31#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
33 32
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index f626730ee42e..81fd4a081c82 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -17,18 +17,6 @@
17 */ 17 */
18#define PHYS_OFFSET UL(0xa0000000) 18#define PHYS_OFFSET UL(0xa0000000)
19 19
20/*
21 * The nodes are matched with the physical SDRAM banks as follows:
22 *
23 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff
24 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff
25 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff
26 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
27 *
28 * This needs a node mem size of 26 bits.
29 */
30#define NODE_MEM_SIZE_BITS 26
31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) 20#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
33void cmx2xx_pci_adjust_zones(int node, unsigned long *size, 21void cmx2xx_pci_adjust_zones(int node, unsigned long *size,
34 unsigned long *holes); 22 unsigned long *holes);
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index f4abdaafdac4..bc2758b54446 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -463,7 +463,6 @@ static void __init fixup_poodle(struct machine_desc *desc,
463 sharpsl_save_param(); 463 sharpsl_save_param();
464 mi->nr_banks=1; 464 mi->nr_banks=1;
465 mi->bank[0].start = 0xa0000000; 465 mi->bank[0].start = 0xa0000000;
466 mi->bank[0].node = 0;
467 mi->bank[0].size = (32*1024*1024); 466 mi->bank[0].size = (32*1024*1024);
468} 467}
469 468
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index c1048a35f187..51756c723557 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -847,7 +847,6 @@ static void __init fixup_spitz(struct machine_desc *desc,
847 sharpsl_save_param(); 847 sharpsl_save_param();
848 mi->nr_banks = 1; 848 mi->nr_banks = 1;
849 mi->bank[0].start = 0xa0000000; 849 mi->bank[0].start = 0xa0000000;
850 mi->bank[0].node = 0;
851 mi->bank[0].size = (64*1024*1024); 850 mi->bank[0].size = (64*1024*1024);
852} 851}
853 852
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 7512b822c6ca..83cc3a18c2e9 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -948,7 +948,6 @@ static void __init fixup_tosa(struct machine_desc *desc,
948 sharpsl_save_param(); 948 sharpsl_save_param();
949 mi->nr_banks=1; 949 mi->nr_banks=1;
950 mi->bank[0].start = 0xa0000000; 950 mi->bank[0].start = 0xa0000000;
951 mi->bank[0].node = 0;
952 mi->bank[0].size = (64*1024*1024); 951 mi->bank[0].size = (64*1024*1024);
953} 952}
954 953
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index ba93a356a839..054c9f92232a 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -119,7 +119,6 @@ static void __init smdk2413_fixup(struct machine_desc *desc,
119 mi->nr_banks=1; 119 mi->nr_banks=1;
120 mi->bank[0].start = 0x30000000; 120 mi->bank[0].start = 0x30000000;
121 mi->bank[0].size = SZ_64M; 121 mi->bank[0].size = SZ_64M;
122 mi->bank[0].node = 0;
123 } 122 }
124} 123}
125 124
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 3ca9265b6997..f291ac25d312 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -137,7 +137,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
137 mi->nr_banks=1; 137 mi->nr_banks=1;
138 mi->bank[0].start = 0x30000000; 138 mi->bank[0].start = 0x30000000;
139 mi->bank[0].size = SZ_64M; 139 mi->bank[0].size = SZ_64M;
140 mi->bank[0].node = 0;
141 } 140 }
142} 141}
143 142
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index ec03f187c52b..b7a9a601c2d1 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -13,8 +13,7 @@ extern void __init sa1100_init_gpio(void);
13 13
14#define SET_BANK(__nr,__start,__size) \ 14#define SET_BANK(__nr,__start,__size) \
15 mi->bank[__nr].start = (__start), \ 15 mi->bank[__nr].start = (__start), \
16 mi->bank[__nr].size = (__size), \ 16 mi->bank[__nr].size = (__size)
17 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
18 17
19extern void (*sa1100fb_backlight_power)(int on); 18extern void (*sa1100fb_backlight_power)(int on);
20extern void (*sa1100fb_lcd_power)(int on); 19extern void (*sa1100fb_lcd_power)(int on);
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index e8d34a80851c..d63b6c413758 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -15,7 +15,6 @@ endif
15obj-$(CONFIG_MODULES) += proc-syms.o 15obj-$(CONFIG_MODULES) += proc-syms.o
16 16
17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
18obj-$(CONFIG_DISCONTIGMEM) += discontig.o
19obj-$(CONFIG_HIGHMEM) += highmem.o 18obj-$(CONFIG_HIGHMEM) += highmem.o
20 19
21obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o 20obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o
diff --git a/arch/arm/mm/discontig.c b/arch/arm/mm/discontig.c
deleted file mode 100644
index c8c0c4b0f0a3..000000000000
--- a/arch/arm/mm/discontig.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/arch/arm/mm/discontig.c
3 *
4 * Discontiguous memory support.
5 *
6 * Initial code: Copyright (C) 1999-2000 Nicolas Pitre
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/module.h>
13#include <linux/mmzone.h>
14#include <linux/bootmem.h>
15
16#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16
17# error Fix Me Please
18#endif
19
20/*
21 * Our node_data structure for discontiguous memory.
22 */
23
24pg_data_t discontig_node_data[MAX_NUMNODES] = {
25 { .bdata = &bootmem_node_data[0] },
26 { .bdata = &bootmem_node_data[1] },
27 { .bdata = &bootmem_node_data[2] },
28 { .bdata = &bootmem_node_data[3] },
29#if MAX_NUMNODES == 16
30 { .bdata = &bootmem_node_data[4] },
31 { .bdata = &bootmem_node_data[5] },
32 { .bdata = &bootmem_node_data[6] },
33 { .bdata = &bootmem_node_data[7] },
34 { .bdata = &bootmem_node_data[8] },
35 { .bdata = &bootmem_node_data[9] },
36 { .bdata = &bootmem_node_data[10] },
37 { .bdata = &bootmem_node_data[11] },
38 { .bdata = &bootmem_node_data[12] },
39 { .bdata = &bootmem_node_data[13] },
40 { .bdata = &bootmem_node_data[14] },
41 { .bdata = &bootmem_node_data[15] },
42#endif
43};
44
45EXPORT_SYMBOL(discontig_node_data);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f6a999465323..4011e524cb1d 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -79,38 +79,37 @@ struct meminfo meminfo;
79void show_mem(void) 79void show_mem(void)
80{ 80{
81 int free = 0, total = 0, reserved = 0; 81 int free = 0, total = 0, reserved = 0;
82 int shared = 0, cached = 0, slab = 0, node, i; 82 int shared = 0, cached = 0, slab = 0, i;
83 struct meminfo * mi = &meminfo; 83 struct meminfo * mi = &meminfo;
84 84
85 printk("Mem-info:\n"); 85 printk("Mem-info:\n");
86 show_free_areas(); 86 show_free_areas();
87 for_each_online_node(node) { 87
88 for_each_nodebank (i,mi,node) { 88 for_each_bank (i, mi) {
89 struct membank *bank = &mi->bank[i]; 89 struct membank *bank = &mi->bank[i];
90 unsigned int pfn1, pfn2; 90 unsigned int pfn1, pfn2;
91 struct page *page, *end; 91 struct page *page, *end;
92 92
93 pfn1 = bank_pfn_start(bank); 93 pfn1 = bank_pfn_start(bank);
94 pfn2 = bank_pfn_end(bank); 94 pfn2 = bank_pfn_end(bank);
95 95
96 page = pfn_to_page(pfn1); 96 page = pfn_to_page(pfn1);
97 end = pfn_to_page(pfn2 - 1) + 1; 97 end = pfn_to_page(pfn2 - 1) + 1;
98 98
99 do { 99 do {
100 total++; 100 total++;
101 if (PageReserved(page)) 101 if (PageReserved(page))
102 reserved++; 102 reserved++;
103 else if (PageSwapCache(page)) 103 else if (PageSwapCache(page))
104 cached++; 104 cached++;
105 else if (PageSlab(page)) 105 else if (PageSlab(page))
106 slab++; 106 slab++;
107 else if (!page_count(page)) 107 else if (!page_count(page))
108 free++; 108 free++;
109 else 109 else
110 shared += page_count(page) - 1; 110 shared += page_count(page) - 1;
111 page++; 111 page++;
112 } while (page < end); 112 } while (page < end);
113 }
114 } 113 }
115 114
116 printk("%d pages of RAM\n", total); 115 printk("%d pages of RAM\n", total);
@@ -121,7 +120,7 @@ void show_mem(void)
121 printk("%d pages swap cached\n", cached); 120 printk("%d pages swap cached\n", cached);
122} 121}
123 122
124static void __init find_node_limits(int node, struct meminfo *mi, 123static void __init find_limits(struct meminfo *mi,
125 unsigned long *min, unsigned long *max_low, unsigned long *max_high) 124 unsigned long *min, unsigned long *max_low, unsigned long *max_high)
126{ 125{
127 int i; 126 int i;
@@ -129,7 +128,7 @@ static void __init find_node_limits(int node, struct meminfo *mi,
129 *min = -1UL; 128 *min = -1UL;
130 *max_low = *max_high = 0; 129 *max_low = *max_high = 0;
131 130
132 for_each_nodebank(i, mi, node) { 131 for_each_bank (i, mi) {
133 struct membank *bank = &mi->bank[i]; 132 struct membank *bank = &mi->bank[i];
134 unsigned long start, end; 133 unsigned long start, end;
135 134
@@ -154,14 +153,14 @@ static void __init find_node_limits(int node, struct meminfo *mi,
154 * the end, we won't clash. 153 * the end, we won't clash.
155 */ 154 */
156static unsigned int __init 155static unsigned int __init
157find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages) 156find_bootmap_pfn(struct meminfo *mi, unsigned int bootmap_pages)
158{ 157{
159 unsigned int start_pfn, i, bootmap_pfn; 158 unsigned int start_pfn, i, bootmap_pfn;
160 159
161 start_pfn = PAGE_ALIGN(__pa(_end)) >> PAGE_SHIFT; 160 start_pfn = PAGE_ALIGN(__pa(_end)) >> PAGE_SHIFT;
162 bootmap_pfn = 0; 161 bootmap_pfn = 0;
163 162
164 for_each_nodebank(i, mi, node) { 163 for_each_bank(i, mi) {
165 struct membank *bank = &mi->bank[i]; 164 struct membank *bank = &mi->bank[i];
166 unsigned int start, end; 165 unsigned int start, end;
167 166
@@ -191,7 +190,7 @@ find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
191 190
192static int __init check_initrd(struct meminfo *mi) 191static int __init check_initrd(struct meminfo *mi)
193{ 192{
194 int initrd_node = -2; 193 int initrd = -2;
195#ifdef CONFIG_BLK_DEV_INITRD 194#ifdef CONFIG_BLK_DEV_INITRD
196 unsigned long end = phys_initrd_start + phys_initrd_size; 195 unsigned long end = phys_initrd_start + phys_initrd_size;
197 196
@@ -202,17 +201,17 @@ static int __init check_initrd(struct meminfo *mi)
202 if (phys_initrd_size) { 201 if (phys_initrd_size) {
203 unsigned int i; 202 unsigned int i;
204 203
205 initrd_node = -1; 204 initrd = -1;
206 205
207 for (i = 0; i < mi->nr_banks; i++) { 206 for (i = 0; i < mi->nr_banks; i++) {
208 struct membank *bank = &mi->bank[i]; 207 struct membank *bank = &mi->bank[i];
209 if (bank_phys_start(bank) <= phys_initrd_start && 208 if (bank_phys_start(bank) <= phys_initrd_start &&
210 end <= bank_phys_end(bank)) 209 end <= bank_phys_end(bank))
211 initrd_node = bank->node; 210 initrd = 0;
212 } 211 }
213 } 212 }
214 213
215 if (initrd_node == -1) { 214 if (initrd == -1) {
216 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond " 215 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
217 "physical memory - disabling initrd\n", 216 "physical memory - disabling initrd\n",
218 phys_initrd_start, phys_initrd_size); 217 phys_initrd_start, phys_initrd_size);
@@ -220,10 +219,10 @@ static int __init check_initrd(struct meminfo *mi)
220 } 219 }
221#endif 220#endif
222 221
223 return initrd_node; 222 return initrd;
224} 223}
225 224
226static void __init bootmem_init_node(int node, struct meminfo *mi, 225static void __init arm_bootmem_init(struct meminfo *mi,
227 unsigned long start_pfn, unsigned long end_pfn) 226 unsigned long start_pfn, unsigned long end_pfn)
228{ 227{
229 unsigned long boot_pfn; 228 unsigned long boot_pfn;
@@ -235,37 +234,36 @@ static void __init bootmem_init_node(int node, struct meminfo *mi,
235 * Allocate the bootmem bitmap page. 234 * Allocate the bootmem bitmap page.
236 */ 235 */
237 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 236 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
238 boot_pfn = find_bootmap_pfn(node, mi, boot_pages); 237 boot_pfn = find_bootmap_pfn(mi, boot_pages);
239 238
240 /* 239 /*
241 * Initialise the bootmem allocator for this node, handing the 240 * Initialise the bootmem allocator, handing the
242 * memory banks over to bootmem. 241 * memory banks over to bootmem.
243 */ 242 */
244 node_set_online(node); 243 node_set_online(0);
245 pgdat = NODE_DATA(node); 244 pgdat = NODE_DATA(0);
246 init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn); 245 init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn);
247 246
248 for_each_nodebank(i, mi, node) { 247 for_each_bank(i, mi) {
249 struct membank *bank = &mi->bank[i]; 248 struct membank *bank = &mi->bank[i];
250 if (!bank->highmem) 249 if (!bank->highmem)
251 free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); 250 free_bootmem(bank_phys_start(bank), bank_phys_size(bank));
252 } 251 }
253 252
254 /* 253 /*
255 * Reserve the bootmem bitmap for this node. 254 * Reserve the bootmem bitmap.
256 */ 255 */
257 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 256 reserve_bootmem(boot_pfn << PAGE_SHIFT,
258 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 257 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
259} 258}
260 259
261static void __init bootmem_reserve_initrd(int node) 260static void __init bootmem_reserve_initrd(void)
262{ 261{
263#ifdef CONFIG_BLK_DEV_INITRD 262#ifdef CONFIG_BLK_DEV_INITRD
264 pg_data_t *pgdat = NODE_DATA(node);
265 int res; 263 int res;
266 264
267 res = reserve_bootmem_node(pgdat, phys_initrd_start, 265 res = reserve_bootmem(phys_initrd_start,
268 phys_initrd_size, BOOTMEM_EXCLUSIVE); 266 phys_initrd_size, BOOTMEM_EXCLUSIVE);
269 267
270 if (res == 0) { 268 if (res == 0) {
271 initrd_start = __phys_to_virt(phys_initrd_start); 269 initrd_start = __phys_to_virt(phys_initrd_start);
@@ -279,23 +277,23 @@ static void __init bootmem_reserve_initrd(int node)
279#endif 277#endif
280} 278}
281 279
282static void __init bootmem_free_node(int node, struct meminfo *mi) 280static void __init arm_bootmem_free(struct meminfo *mi)
283{ 281{
284 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 282 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
285 unsigned long min, max_low, max_high; 283 unsigned long min, max_low, max_high;
286 int i; 284 int i;
287 285
288 find_node_limits(node, mi, &min, &max_low, &max_high); 286 find_limits(mi, &min, &max_low, &max_high);
289 287
290 /* 288 /*
291 * initialise the zones within this node. 289 * initialise the zones.
292 */ 290 */
293 memset(zone_size, 0, sizeof(zone_size)); 291 memset(zone_size, 0, sizeof(zone_size));
294 292
295 /* 293 /*
296 * The size of this node has already been determined. If we need 294 * The memory size has already been determined. If we need
297 * to do anything fancy with the allocation of this memory to the 295 * to do anything fancy with the allocation of this memory
298 * zones, now is the time to do it. 296 * to the zones, now is the time to do it.
299 */ 297 */
300 zone_size[0] = max_low - min; 298 zone_size[0] = max_low - min;
301#ifdef CONFIG_HIGHMEM 299#ifdef CONFIG_HIGHMEM
@@ -303,11 +301,11 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
303#endif 301#endif
304 302
305 /* 303 /*
306 * For each bank in this node, calculate the size of the holes. 304 * Calculate the size of the holes.
307 * holes = node_size - sum(bank_sizes_in_node) 305 * holes = node_size - sum(bank_sizes)
308 */ 306 */
309 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 307 memcpy(zhole_size, zone_size, sizeof(zhole_size));
310 for_each_nodebank(i, mi, node) { 308 for_each_bank(i, mi) {
311 int idx = 0; 309 int idx = 0;
312#ifdef CONFIG_HIGHMEM 310#ifdef CONFIG_HIGHMEM
313 if (mi->bank[i].highmem) 311 if (mi->bank[i].highmem)
@@ -320,9 +318,9 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
320 * Adjust the sizes according to any special requirements for 318 * Adjust the sizes according to any special requirements for
321 * this machine type. 319 * this machine type.
322 */ 320 */
323 arch_adjust_zones(node, zone_size, zhole_size); 321 arch_adjust_zones(0, zone_size, zhole_size);
324 322
325 free_area_init_node(node, zone_size, min, zhole_size); 323 free_area_init_node(0, zone_size, min, zhole_size);
326} 324}
327 325
328#ifndef CONFIG_SPARSEMEM 326#ifndef CONFIG_SPARSEMEM
@@ -346,16 +344,16 @@ int pfn_valid(unsigned long pfn)
346} 344}
347EXPORT_SYMBOL(pfn_valid); 345EXPORT_SYMBOL(pfn_valid);
348 346
349static void arm_memory_present(struct meminfo *mi, int node) 347static void arm_memory_present(struct meminfo *mi)
350{ 348{
351} 349}
352#else 350#else
353static void arm_memory_present(struct meminfo *mi, int node) 351static void arm_memory_present(struct meminfo *mi)
354{ 352{
355 int i; 353 int i;
356 for_each_nodebank(i, mi, node) { 354 for_each_bank(i, mi) {
357 struct membank *bank = &mi->bank[i]; 355 struct membank *bank = &mi->bank[i];
358 memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); 356 memory_present(0, bank_pfn_start(bank), bank_pfn_end(bank));
359 } 357 }
360} 358}
361#endif 359#endif
@@ -364,55 +362,35 @@ void __init bootmem_init(void)
364{ 362{
365 struct meminfo *mi = &meminfo; 363 struct meminfo *mi = &meminfo;
366 unsigned long min, max_low, max_high; 364 unsigned long min, max_low, max_high;
367 int node, initrd_node; 365 int initrd;
368 366
369 /* 367 /*
370 * Locate which node contains the ramdisk image, if any. 368 * Locate the ramdisk image, if any.
371 */ 369 */
372 initrd_node = check_initrd(mi); 370 initrd = check_initrd(mi);
373 371
374 max_low = max_high = 0; 372 max_low = max_high = 0;
375 373
376 /* 374 find_limits(mi, &min, &max_low, &max_high);
377 * Run through each node initialising the bootmem allocator.
378 */
379 for_each_node(node) {
380 unsigned long node_low, node_high;
381
382 find_node_limits(node, mi, &min, &node_low, &node_high);
383 375
384 if (node_low > max_low) 376 arm_bootmem_init(mi, min, max_low);
385 max_low = node_low;
386 if (node_high > max_high)
387 max_high = node_high;
388 377
389 /* 378 /*
390 * If there is no memory in this node, ignore it. 379 * Reserve any special regions.
391 * (We can't have nodes which have no lowmem) 380 */
392 */ 381 reserve_special_regions();
393 if (node_low == 0)
394 continue;
395
396 bootmem_init_node(node, mi, min, node_low);
397
398 /*
399 * Reserve any special node zero regions.
400 */
401 if (node == 0)
402 reserve_node_zero(NODE_DATA(node));
403 382
404 /* 383 /*
405 * If the initrd is in this node, reserve its memory. 384 * If the initrd is present, reserve its memory.
406 */ 385 */
407 if (node == initrd_node) 386 if (initrd == 0)
408 bootmem_reserve_initrd(node); 387 bootmem_reserve_initrd();
409 388
410 /* 389 /*
411 * Sparsemem tries to allocate bootmem in memory_present(), 390 * Sparsemem tries to allocate bootmem in memory_present(),
412 * so must be done after the fixed reservations 391 * so must be done after the fixed reservations
413 */ 392 */
414 arm_memory_present(mi, node); 393 arm_memory_present(mi);
415 }
416 394
417 /* 395 /*
418 * sparse_init() needs the bootmem allocator up and running. 396 * sparse_init() needs the bootmem allocator up and running.
@@ -420,12 +398,11 @@ void __init bootmem_init(void)
420 sparse_init(); 398 sparse_init();
421 399
422 /* 400 /*
423 * Now free memory in each node - free_area_init_node needs 401 * Now free the memory - free_area_init_node needs
424 * the sparse mem_map arrays initialized by sparse_init() 402 * the sparse mem_map arrays initialized by sparse_init()
425 * for memmap_init_zone(), otherwise all PFNs are invalid. 403 * for memmap_init_zone(), otherwise all PFNs are invalid.
426 */ 404 */
427 for_each_node(node) 405 arm_bootmem_free(mi);
428 bootmem_free_node(node, mi);
429 406
430 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 407 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
431 408
@@ -460,7 +437,7 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
460} 437}
461 438
462static inline void 439static inline void
463free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) 440free_memmap(unsigned long start_pfn, unsigned long end_pfn)
464{ 441{
465 struct page *start_pg, *end_pg; 442 struct page *start_pg, *end_pg;
466 unsigned long pg, pgend; 443 unsigned long pg, pgend;
@@ -483,13 +460,13 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
483 * free the section of the memmap array. 460 * free the section of the memmap array.
484 */ 461 */
485 if (pg < pgend) 462 if (pg < pgend)
486 free_bootmem_node(NODE_DATA(node), pg, pgend - pg); 463 free_bootmem(pg, pgend - pg);
487} 464}
488 465
489/* 466/*
490 * The mem_map array can get very big. Free the unused area of the memory map. 467 * The mem_map array can get very big. Free the unused area of the memory map.
491 */ 468 */
492static void __init free_unused_memmap_node(int node, struct meminfo *mi) 469static void __init free_unused_memmap(struct meminfo *mi)
493{ 470{
494 unsigned long bank_start, prev_bank_end = 0; 471 unsigned long bank_start, prev_bank_end = 0;
495 unsigned int i; 472 unsigned int i;
@@ -499,7 +476,7 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
499 * may not be the case, especially if the user has provided the 476 * may not be the case, especially if the user has provided the
500 * information on the command line. 477 * information on the command line.
501 */ 478 */
502 for_each_nodebank(i, mi, node) { 479 for_each_bank(i, mi) {
503 struct membank *bank = &mi->bank[i]; 480 struct membank *bank = &mi->bank[i];
504 481
505 bank_start = bank_pfn_start(bank); 482 bank_start = bank_pfn_start(bank);
@@ -514,7 +491,7 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
514 * between the current bank and the previous, free it. 491 * between the current bank and the previous, free it.
515 */ 492 */
516 if (prev_bank_end && prev_bank_end != bank_start) 493 if (prev_bank_end && prev_bank_end != bank_start)
517 free_memmap(node, prev_bank_end, bank_start); 494 free_memmap(prev_bank_end, bank_start);
518 495
519 prev_bank_end = bank_pfn_end(bank); 496 prev_bank_end = bank_pfn_end(bank);
520 } 497 }
@@ -528,21 +505,14 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
528void __init mem_init(void) 505void __init mem_init(void)
529{ 506{
530 unsigned long reserved_pages, free_pages; 507 unsigned long reserved_pages, free_pages;
531 int i, node; 508 int i;
532 509
533#ifndef CONFIG_DISCONTIGMEM
534 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 510 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
535#endif
536 511
537 /* this will put all unused low memory onto the freelists */ 512 /* this will put all unused low memory onto the freelists */
538 for_each_online_node(node) { 513 free_unused_memmap(&meminfo);
539 pg_data_t *pgdat = NODE_DATA(node);
540
541 free_unused_memmap_node(node, &meminfo);
542 514
543 if (pgdat->node_spanned_pages != 0) 515 totalram_pages += free_all_bootmem();
544 totalram_pages += free_all_bootmem_node(pgdat);
545 }
546 516
547#ifdef CONFIG_SA1111 517#ifdef CONFIG_SA1111
548 /* now that our DMA memory is actually so designated, we can free it */ 518 /* now that our DMA memory is actually so designated, we can free it */
@@ -552,39 +522,35 @@ void __init mem_init(void)
552 522
553#ifdef CONFIG_HIGHMEM 523#ifdef CONFIG_HIGHMEM
554 /* set highmem page free */ 524 /* set highmem page free */
555 for_each_online_node(node) { 525 for_each_bank (i, &meminfo) {
556 for_each_nodebank (i, &meminfo, node) { 526 unsigned long start = bank_pfn_start(&meminfo.bank[i]);
557 unsigned long start = bank_pfn_start(&meminfo.bank[i]); 527 unsigned long end = bank_pfn_end(&meminfo.bank[i]);
558 unsigned long end = bank_pfn_end(&meminfo.bank[i]); 528 if (start >= max_low_pfn + PHYS_PFN_OFFSET)
559 if (start >= max_low_pfn + PHYS_PFN_OFFSET) 529 totalhigh_pages += free_area(start, end, NULL);
560 totalhigh_pages += free_area(start, end, NULL);
561 }
562 } 530 }
563 totalram_pages += totalhigh_pages; 531 totalram_pages += totalhigh_pages;
564#endif 532#endif
565 533
566 reserved_pages = free_pages = 0; 534 reserved_pages = free_pages = 0;
567 535
568 for_each_online_node(node) { 536 for_each_bank(i, &meminfo) {
569 for_each_nodebank(i, &meminfo, node) { 537 struct membank *bank = &meminfo.bank[i];
570 struct membank *bank = &meminfo.bank[i]; 538 unsigned int pfn1, pfn2;
571 unsigned int pfn1, pfn2; 539 struct page *page, *end;
572 struct page *page, *end; 540
573 541 pfn1 = bank_pfn_start(bank);
574 pfn1 = bank_pfn_start(bank); 542 pfn2 = bank_pfn_end(bank);
575 pfn2 = bank_pfn_end(bank); 543
576 544 page = pfn_to_page(pfn1);
577 page = pfn_to_page(pfn1); 545 end = pfn_to_page(pfn2 - 1) + 1;
578 end = pfn_to_page(pfn2 - 1) + 1; 546
579 547 do {
580 do { 548 if (PageReserved(page))
581 if (PageReserved(page)) 549 reserved_pages++;
582 reserved_pages++; 550 else if (!page_count(page))
583 else if (!page_count(page)) 551 free_pages++;
584 free_pages++; 552 page++;
585 page++; 553 } while (page < end);
586 } while (page < end);
587 }
588 } 554 }
589 555
590 /* 556 /*
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 815d08eecbb0..7b19c90ab295 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -28,7 +28,5 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
28 28
29#endif 29#endif
30 30
31struct pglist_data;
32
33void __init bootmem_init(void); 31void __init bootmem_init(void);
34void reserve_node_zero(struct pglist_data *pgdat); 32void reserve_special_regions(void);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 6a08087ab022..ddb1bee6de73 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -827,9 +827,9 @@ static inline void prepare_page_table(void)
827} 827}
828 828
829/* 829/*
830 * Reserve the various regions of node 0 830 * Reserve the various regions
831 */ 831 */
832void __init reserve_node_zero(pg_data_t *pgdat) 832void __init reserve_special_regions(void)
833{ 833{
834 unsigned long res_size = 0; 834 unsigned long res_size = 0;
835 835
@@ -838,19 +838,17 @@ void __init reserve_node_zero(pg_data_t *pgdat)
838 * Note that this can only be in node 0. 838 * Note that this can only be in node 0.
839 */ 839 */
840#ifdef CONFIG_XIP_KERNEL 840#ifdef CONFIG_XIP_KERNEL
841 reserve_bootmem_node(pgdat, __pa(_data), _end - _data, 841 reserve_bootmem(__pa(_data), _end - _data, BOOTMEM_DEFAULT);
842 BOOTMEM_DEFAULT);
843#else 842#else
844 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext, 843 reserve_bootmem(__pa(_stext), _end - _stext, BOOTMEM_DEFAULT);
845 BOOTMEM_DEFAULT);
846#endif 844#endif
847 845
848 /* 846 /*
849 * Reserve the page tables. These are already in use, 847 * Reserve the page tables. These are already in use,
850 * and can only be in node 0. 848 * and can only be in node 0.
851 */ 849 */
852 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), 850 reserve_bootmem(__pa(swapper_pg_dir),
853 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT); 851 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
854 852
855 /* 853 /*
856 * Hmm... This should go elsewhere, but we really really need to 854 * Hmm... This should go elsewhere, but we really really need to
@@ -874,29 +872,22 @@ void __init reserve_node_zero(pg_data_t *pgdat)
874 872
875 if (machine_is_h1940() || machine_is_rx3715() 873 if (machine_is_h1940() || machine_is_rx3715()
876 || machine_is_rx1950()) { 874 || machine_is_rx1950()) {
877 reserve_bootmem_node(pgdat, 0x30003000, 0x1000, 875 reserve_bootmem(0x30003000, 0x1000, BOOTMEM_DEFAULT);
878 BOOTMEM_DEFAULT); 876 reserve_bootmem(0x30081000, 0x1000, BOOTMEM_DEFAULT);
879 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
880 BOOTMEM_DEFAULT);
881 } 877 }
882 878
883 if (machine_is_palmld() || machine_is_palmtx()) { 879 if (machine_is_palmld() || machine_is_palmtx()) {
884 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000, 880 reserve_bootmem(0xa0000000, 0x1000, BOOTMEM_EXCLUSIVE);
885 BOOTMEM_EXCLUSIVE); 881 reserve_bootmem(0xa0200000, 0x1000, BOOTMEM_EXCLUSIVE);
886 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000,
887 BOOTMEM_EXCLUSIVE);
888 } 882 }
889 883
890 if (machine_is_treo680() || machine_is_centro()) { 884 if (machine_is_treo680() || machine_is_centro()) {
891 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000, 885 reserve_bootmem(0xa0000000, 0x1000, BOOTMEM_EXCLUSIVE);
892 BOOTMEM_EXCLUSIVE); 886 reserve_bootmem(0xa2000000, 0x1000, BOOTMEM_EXCLUSIVE);
893 reserve_bootmem_node(pgdat, 0xa2000000, 0x1000,
894 BOOTMEM_EXCLUSIVE);
895 } 887 }
896 888
897 if (machine_is_palmt5()) 889 if (machine_is_palmt5())
898 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000, 890 reserve_bootmem(0xa0200000, 0x1000, BOOTMEM_EXCLUSIVE);
899 BOOTMEM_EXCLUSIVE);
900 891
901 /* 892 /*
902 * U300 - This platform family can share physical memory 893 * U300 - This platform family can share physical memory
@@ -920,8 +911,7 @@ void __init reserve_node_zero(pg_data_t *pgdat)
920 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; 911 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
921#endif 912#endif
922 if (res_size) 913 if (res_size)
923 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size, 914 reserve_bootmem(PHYS_OFFSET, res_size, BOOTMEM_DEFAULT);
924 BOOTMEM_DEFAULT);
925} 915}
926 916
927/* 917/*
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 33b327379f07..25376d480b8e 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -18,20 +18,18 @@
18#include "mm.h" 18#include "mm.h"
19 19
20/* 20/*
21 * Reserve the various regions of node 0 21 * Reserve the various regions
22 */ 22 */
23void __init reserve_node_zero(pg_data_t *pgdat) 23void __init reserve_special_regions(void)
24{ 24{
25 /* 25 /*
26 * Register the kernel text and data with bootmem. 26 * Register the kernel text and data with bootmem.
27 * Note that this can only be in node 0. 27 * Note that this can only be in node 0.
28 */ 28 */
29#ifdef CONFIG_XIP_KERNEL 29#ifdef CONFIG_XIP_KERNEL
30 reserve_bootmem_node(pgdat, __pa(_data), _end - _data, 30 reserve_bootmem(__pa(_data), _end - _data, BOOTMEM_DEFAULT);
31 BOOTMEM_DEFAULT);
32#else 31#else
33 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext, 32 reserve_bootmem(__pa(_stext), _end - _stext, BOOTMEM_DEFAULT);
34 BOOTMEM_DEFAULT);
35#endif 33#endif
36 34
37 /* 35 /*
@@ -39,8 +37,7 @@ void __init reserve_node_zero(pg_data_t *pgdat)
39 * some architectures which the DRAM is the exception vector to trap, 37 * some architectures which the DRAM is the exception vector to trap,
40 * alloc_page breaks with error, although it is not NULL, but "0." 38 * alloc_page breaks with error, although it is not NULL, but "0."
41 */ 39 */
42 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE, 40 reserve_bootmem(CONFIG_VECTORS_BASE, PAGE_SIZE, BOOTMEM_DEFAULT);
43 BOOTMEM_DEFAULT);
44} 41}
45 42
46/* 43/*