diff options
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r-- | arch/arm/mm/init.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index ea36186f32c3..52c40d155672 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -273,7 +273,6 @@ static void __init bootmem_init_node(int node, struct meminfo *mi, | |||
273 | struct membank *bank = &mi->bank[i]; | 273 | struct membank *bank = &mi->bank[i]; |
274 | if (!bank->highmem) | 274 | if (!bank->highmem) |
275 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); | 275 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); |
276 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); | ||
277 | } | 276 | } |
278 | 277 | ||
279 | /* | 278 | /* |
@@ -370,6 +369,19 @@ int pfn_valid(unsigned long pfn) | |||
370 | return 0; | 369 | return 0; |
371 | } | 370 | } |
372 | EXPORT_SYMBOL(pfn_valid); | 371 | EXPORT_SYMBOL(pfn_valid); |
372 | |||
373 | static void arm_memory_present(struct meminfo *mi, int node) | ||
374 | { | ||
375 | } | ||
376 | #else | ||
377 | static void arm_memory_present(struct meminfo *mi, int node) | ||
378 | { | ||
379 | int i; | ||
380 | for_each_nodebank(i, mi, node) { | ||
381 | struct membank *bank = &mi->bank[i]; | ||
382 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); | ||
383 | } | ||
384 | } | ||
373 | #endif | 385 | #endif |
374 | 386 | ||
375 | static int __init meminfo_cmp(const void *_a, const void *_b) | 387 | static int __init meminfo_cmp(const void *_a, const void *_b) |
@@ -427,6 +439,12 @@ void __init bootmem_init(void) | |||
427 | */ | 439 | */ |
428 | if (node == initrd_node) | 440 | if (node == initrd_node) |
429 | bootmem_reserve_initrd(node); | 441 | bootmem_reserve_initrd(node); |
442 | |||
443 | /* | ||
444 | * Sparsemem tries to allocate bootmem in memory_present(), | ||
445 | * so must be done after the fixed reservations | ||
446 | */ | ||
447 | arm_memory_present(mi, node); | ||
430 | } | 448 | } |
431 | 449 | ||
432 | /* | 450 | /* |
@@ -483,7 +501,7 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) | |||
483 | /* | 501 | /* |
484 | * Convert start_pfn/end_pfn to a struct page pointer. | 502 | * Convert start_pfn/end_pfn to a struct page pointer. |
485 | */ | 503 | */ |
486 | start_pg = pfn_to_page(start_pfn); | 504 | start_pg = pfn_to_page(start_pfn - 1) + 1; |
487 | end_pg = pfn_to_page(end_pfn); | 505 | end_pg = pfn_to_page(end_pfn); |
488 | 506 | ||
489 | /* | 507 | /* |
@@ -596,8 +614,8 @@ void __init mem_init(void) | |||
596 | 614 | ||
597 | printk(KERN_NOTICE "Memory: %luKB available (%dK code, " | 615 | printk(KERN_NOTICE "Memory: %luKB available (%dK code, " |
598 | "%dK data, %dK init, %luK highmem)\n", | 616 | "%dK data, %dK init, %luK highmem)\n", |
599 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | 617 | nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10, |
600 | codesize >> 10, datasize >> 10, initsize >> 10, | 618 | datasize >> 10, initsize >> 10, |
601 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 619 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); |
602 | 620 | ||
603 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 621 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { |
@@ -613,6 +631,14 @@ void __init mem_init(void) | |||
613 | 631 | ||
614 | void free_initmem(void) | 632 | void free_initmem(void) |
615 | { | 633 | { |
634 | #ifdef CONFIG_HAVE_TCM | ||
635 | extern char *__tcm_start, *__tcm_end; | ||
636 | |||
637 | totalram_pages += free_area(__phys_to_pfn(__pa(__tcm_start)), | ||
638 | __phys_to_pfn(__pa(__tcm_end)), | ||
639 | "TCM link"); | ||
640 | #endif | ||
641 | |||
616 | if (!machine_is_integrator() && !machine_is_cintegrator()) | 642 | if (!machine_is_integrator() && !machine_is_cintegrator()) |
617 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), | 643 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), |
618 | __phys_to_pfn(__pa(__init_end)), | 644 | __phys_to_pfn(__pa(__init_end)), |