aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r--arch/arm/mm/init.c72
1 files changed, 8 insertions, 64 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 1f7b19a47060..804d61566a53 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -92,9 +92,6 @@ void show_mem(unsigned int filter)
92 printk("Mem-info:\n"); 92 printk("Mem-info:\n");
93 show_free_areas(filter); 93 show_free_areas(filter);
94 94
95 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
96 return;
97
98 for_each_bank (i, mi) { 95 for_each_bank (i, mi) {
99 struct membank *bank = &mi->bank[i]; 96 struct membank *bank = &mi->bank[i];
100 unsigned int pfn1, pfn2; 97 unsigned int pfn1, pfn2;
@@ -145,58 +142,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
145 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); 142 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]);
146} 143}
147 144
148static void __init arm_bootmem_init(unsigned long start_pfn,
149 unsigned long end_pfn)
150{
151 struct memblock_region *reg;
152 unsigned int boot_pages;
153 phys_addr_t bitmap;
154 pg_data_t *pgdat;
155
156 /*
157 * Allocate the bootmem bitmap page. This must be in a region
158 * of memory which has already been mapped.
159 */
160 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
161 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
162 __pfn_to_phys(end_pfn));
163
164 /*
165 * Initialise the bootmem allocator, handing the
166 * memory banks over to bootmem.
167 */
168 node_set_online(0);
169 pgdat = NODE_DATA(0);
170 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
171
172 /* Free the lowmem regions from memblock into bootmem. */
173 for_each_memblock(memory, reg) {
174 unsigned long start = memblock_region_memory_base_pfn(reg);
175 unsigned long end = memblock_region_memory_end_pfn(reg);
176
177 if (end >= end_pfn)
178 end = end_pfn;
179 if (start >= end)
180 break;
181
182 free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
183 }
184
185 /* Reserve the lowmem memblock reserved regions in bootmem. */
186 for_each_memblock(reserved, reg) {
187 unsigned long start = memblock_region_reserved_base_pfn(reg);
188 unsigned long end = memblock_region_reserved_end_pfn(reg);
189
190 if (end >= end_pfn)
191 end = end_pfn;
192 if (start >= end)
193 break;
194
195 reserve_bootmem(__pfn_to_phys(start),
196 (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
197 }
198}
199
200#ifdef CONFIG_ZONE_DMA 145#ifdef CONFIG_ZONE_DMA
201 146
202phys_addr_t arm_dma_zone_size __read_mostly; 147phys_addr_t arm_dma_zone_size __read_mostly;
@@ -229,14 +174,14 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
229#ifdef CONFIG_ZONE_DMA 174#ifdef CONFIG_ZONE_DMA
230 if (mdesc->dma_zone_size) { 175 if (mdesc->dma_zone_size) {
231 arm_dma_zone_size = mdesc->dma_zone_size; 176 arm_dma_zone_size = mdesc->dma_zone_size;
232 arm_dma_limit = __pv_phys_offset + arm_dma_zone_size - 1; 177 arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
233 } else 178 } else
234 arm_dma_limit = 0xffffffff; 179 arm_dma_limit = 0xffffffff;
235 arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT; 180 arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
236#endif 181#endif
237} 182}
238 183
239static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, 184static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
240 unsigned long max_high) 185 unsigned long max_high)
241{ 186{
242 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 187 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
@@ -345,10 +290,11 @@ void __init arm_memblock_init(struct meminfo *mi,
345#endif 290#endif
346#ifdef CONFIG_BLK_DEV_INITRD 291#ifdef CONFIG_BLK_DEV_INITRD
347 /* FDT scan will populate initrd_start */ 292 /* FDT scan will populate initrd_start */
348 if (initrd_start) { 293 if (initrd_start && !phys_initrd_size) {
349 phys_initrd_start = __virt_to_phys(initrd_start); 294 phys_initrd_start = __virt_to_phys(initrd_start);
350 phys_initrd_size = initrd_end - initrd_start; 295 phys_initrd_size = initrd_end - initrd_start;
351 } 296 }
297 initrd_start = initrd_end = 0;
352 if (phys_initrd_size && 298 if (phys_initrd_size &&
353 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 299 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
354 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", 300 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
@@ -384,7 +330,6 @@ void __init arm_memblock_init(struct meminfo *mi,
384 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); 330 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
385 331
386 arm_memblock_steal_permitted = false; 332 arm_memblock_steal_permitted = false;
387 memblock_allow_resize();
388 memblock_dump_all(); 333 memblock_dump_all();
389} 334}
390 335
@@ -392,12 +337,11 @@ void __init bootmem_init(void)
392{ 337{
393 unsigned long min, max_low, max_high; 338 unsigned long min, max_low, max_high;
394 339
340 memblock_allow_resize();
395 max_low = max_high = 0; 341 max_low = max_high = 0;
396 342
397 find_limits(&min, &max_low, &max_high); 343 find_limits(&min, &max_low, &max_high);
398 344
399 arm_bootmem_init(min, max_low);
400
401 /* 345 /*
402 * Sparsemem tries to allocate bootmem in memory_present(), 346 * Sparsemem tries to allocate bootmem in memory_present(),
403 * so must be done after the fixed reservations 347 * so must be done after the fixed reservations
@@ -414,7 +358,7 @@ void __init bootmem_init(void)
414 * the sparse mem_map arrays initialized by sparse_init() 358 * the sparse mem_map arrays initialized by sparse_init()
415 * for memmap_init_zone(), otherwise all PFNs are invalid. 359 * for memmap_init_zone(), otherwise all PFNs are invalid.
416 */ 360 */
417 arm_bootmem_free(min, max_low, max_high); 361 zone_sizes_init(min, max_low, max_high);
418 362
419 /* 363 /*
420 * This doesn't seem to be used by the Linux memory manager any 364 * This doesn't seem to be used by the Linux memory manager any
@@ -461,7 +405,7 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
461 * free the section of the memmap array. 405 * free the section of the memmap array.
462 */ 406 */
463 if (pg < pgend) 407 if (pg < pgend)
464 free_bootmem(pg, pgend - pg); 408 memblock_free_early(pg, pgend - pg);
465} 409}
466 410
467/* 411/*
@@ -587,7 +531,7 @@ void __init mem_init(void)
587 extern u32 itcm_end; 531 extern u32 itcm_end;
588#endif 532#endif
589 533
590 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 534 set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
591 535
592 /* this will put all unused low memory onto the freelists */ 536 /* this will put all unused low memory onto the freelists */
593 free_unused_memmap(&meminfo); 537 free_unused_memmap(&meminfo);