aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-02-21 06:51:33 -0500
committerRalf Baechle <ralf@linux-mips.org>2013-02-21 06:51:33 -0500
commit8bfc245f9ad7bd4e461179e4e7852ef99b8b6144 (patch)
tree0ad091f645fbc8318634599d278966a53d3922ee /arch/mips/kernel/setup.c
parent612663a974065c3445e641d046769fe4c55a6438 (diff)
parent535237cecab2b078114be712c67e89a0db61965f (diff)
Merge branch 'mips-next-3.9' of git://git.linux-mips.org/pub/scm/john/linux-john into mips-for-linux-next
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c91
1 files changed, 70 insertions, 21 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 653197e151d5..4c774d5d5087 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -480,34 +480,75 @@ static int __init early_parse_mem(char *p)
480} 480}
481early_param("mem", early_parse_mem); 481early_param("mem", early_parse_mem);
482 482
483static void __init arch_mem_init(char **cmdline_p) 483#ifdef CONFIG_PROC_VMCORE
484unsigned long setup_elfcorehdr, setup_elfcorehdr_size;
485static int __init early_parse_elfcorehdr(char *p)
486{
487 int i;
488
489 setup_elfcorehdr = memparse(p, &p);
490
491 for (i = 0; i < boot_mem_map.nr_map; i++) {
492 unsigned long start = boot_mem_map.map[i].addr;
493 unsigned long end = (boot_mem_map.map[i].addr +
494 boot_mem_map.map[i].size);
495 if (setup_elfcorehdr >= start && setup_elfcorehdr < end) {
496 /*
497 * Reserve from the elf core header to the end of
498 * the memory segment, that should all be kdump
499 * reserved memory.
500 */
501 setup_elfcorehdr_size = end - setup_elfcorehdr;
502 break;
503 }
504 }
505 /*
506 * If we don't find it in the memory map, then we shouldn't
507 * have to worry about it, as the new kernel won't use it.
508 */
509 return 0;
510}
511early_param("elfcorehdr", early_parse_elfcorehdr);
512#endif
513
514static void __init arch_mem_addpart(phys_t mem, phys_t end, int type)
484{ 515{
485 phys_t init_mem, init_end, init_size; 516 phys_t size;
517 int i;
486 518
519 size = end - mem;
520 if (!size)
521 return;
522
523 /* Make sure it is in the boot_mem_map */
524 for (i = 0; i < boot_mem_map.nr_map; i++) {
525 if (mem >= boot_mem_map.map[i].addr &&
526 mem < (boot_mem_map.map[i].addr +
527 boot_mem_map.map[i].size))
528 return;
529 }
530 add_memory_region(mem, size, type);
531}
532
533static void __init arch_mem_init(char **cmdline_p)
534{
487 extern void plat_mem_setup(void); 535 extern void plat_mem_setup(void);
488 536
489 /* call board setup routine */ 537 /* call board setup routine */
490 plat_mem_setup(); 538 plat_mem_setup();
491 539
492 init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT; 540 /*
493 init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT; 541 * Make sure all kernel memory is in the maps. The "UP" and
494 init_size = init_end - init_mem; 542 * "DOWN" are opposite for initdata since if it crosses over
495 if (init_size) { 543 * into another memory section you don't want that to be
496 /* Make sure it is in the boot_mem_map */ 544 * freed when the initdata is freed.
497 int i, found; 545 */
498 found = 0; 546 arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
499 for (i = 0; i < boot_mem_map.nr_map; i++) { 547 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
500 if (init_mem >= boot_mem_map.map[i].addr && 548 BOOT_MEM_RAM);
501 init_mem < (boot_mem_map.map[i].addr + 549 arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
502 boot_mem_map.map[i].size)) { 550 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
503 found = 1; 551 BOOT_MEM_INIT_RAM);
504 break;
505 }
506 }
507 if (!found)
508 add_memory_region(init_mem, init_size,
509 BOOT_MEM_INIT_RAM);
510 }
511 552
512 pr_info("Determined physical RAM map:\n"); 553 pr_info("Determined physical RAM map:\n");
513 print_memory_map(); 554 print_memory_map();
@@ -537,6 +578,14 @@ static void __init arch_mem_init(char **cmdline_p)
537 } 578 }
538 579
539 bootmem_init(); 580 bootmem_init();
581#ifdef CONFIG_PROC_VMCORE
582 if (setup_elfcorehdr && setup_elfcorehdr_size) {
583 printk(KERN_INFO "kdump reserved memory at %lx-%lx\n",
584 setup_elfcorehdr, setup_elfcorehdr_size);
585 reserve_bootmem(setup_elfcorehdr, setup_elfcorehdr_size,
586 BOOTMEM_DEFAULT);
587 }
588#endif
540#ifdef CONFIG_KEXEC 589#ifdef CONFIG_KEXEC
541 if (crashk_res.start != crashk_res.end) 590 if (crashk_res.start != crashk_res.end)
542 reserve_bootmem(crashk_res.start, 591 reserve_bootmem(crashk_res.start,