aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2013-02-12 14:41:47 -0500
committerJohn Crispin <blogic@openwrt.org>2013-02-19 03:36:15 -0500
commitd3ff9338023236f39332b07b3afed76c490a5041 (patch)
tree865e0b0563402d0ca52f65d27930a9ed8ee5c615 /arch/mips
parent90a938d1add4859ad3e43c3dd5ee54bd0627e42d (diff)
mips: Make sure kernel memory is in iomem
Kernel memory isn't necessarily added to the memory tables, so it wouldn't show up in /proc/iomem. This was breaking kdump, which requires these memory addresses to work correctly. Signed-off-by: Corey Minyard <cminyard@mvista.com> Acked-by: David Daney <ddaney@caviumnetworks.com> Cc: Ralf Baechle <ralf@linux-mips.org> Patchwork: http://patchwork.linux-mips.org/patch/4937/
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/setup.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8c41187801ce..53462500c3cd 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -480,34 +480,44 @@ 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) 483static void __init arch_mem_addpart(phys_t mem, phys_t end, int type)
484{ 484{
485 phys_t init_mem, init_end, init_size; 485 phys_t size;
486 int i;
487
488 size = end - mem;
489 if (!size)
490 return;
491
492 /* Make sure it is in the boot_mem_map */
493 for (i = 0; i < boot_mem_map.nr_map; i++) {
494 if (mem >= boot_mem_map.map[i].addr &&
495 mem < (boot_mem_map.map[i].addr +
496 boot_mem_map.map[i].size))
497 return;
498 }
499 add_memory_region(mem, size, type);
500}
486 501
502static void __init arch_mem_init(char **cmdline_p)
503{
487 extern void plat_mem_setup(void); 504 extern void plat_mem_setup(void);
488 505
489 /* call board setup routine */ 506 /* call board setup routine */
490 plat_mem_setup(); 507 plat_mem_setup();
491 508
492 init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT; 509 /*
493 init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT; 510 * Make sure all kernel memory is in the maps. The "UP" and
494 init_size = init_end - init_mem; 511 * "DOWN" are opposite for initdata since if it crosses over
495 if (init_size) { 512 * into another memory section you don't want that to be
496 /* Make sure it is in the boot_mem_map */ 513 * freed when the initdata is freed.
497 int i, found; 514 */
498 found = 0; 515 arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
499 for (i = 0; i < boot_mem_map.nr_map; i++) { 516 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
500 if (init_mem >= boot_mem_map.map[i].addr && 517 BOOT_MEM_RAM);
501 init_mem < (boot_mem_map.map[i].addr + 518 arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
502 boot_mem_map.map[i].size)) { 519 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
503 found = 1; 520 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 521
512 pr_info("Determined physical RAM map:\n"); 522 pr_info("Determined physical RAM map:\n");
513 print_memory_map(); 523 print_memory_map();