aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index b1cb8f87d7b4..058e964e7303 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -122,6 +122,9 @@ static void __init print_memory_map(void)
122 case BOOT_MEM_RAM: 122 case BOOT_MEM_RAM:
123 printk(KERN_CONT "(usable)\n"); 123 printk(KERN_CONT "(usable)\n");
124 break; 124 break;
125 case BOOT_MEM_INIT_RAM:
126 printk(KERN_CONT "(usable after init)\n");
127 break;
125 case BOOT_MEM_ROM_DATA: 128 case BOOT_MEM_ROM_DATA:
126 printk(KERN_CONT "(ROM data)\n"); 129 printk(KERN_CONT "(ROM data)\n");
127 break; 130 break;
@@ -362,15 +365,24 @@ static void __init bootmem_init(void)
362 for (i = 0; i < boot_mem_map.nr_map; i++) { 365 for (i = 0; i < boot_mem_map.nr_map; i++) {
363 unsigned long start, end, size; 366 unsigned long start, end, size;
364 367
368 start = PFN_UP(boot_mem_map.map[i].addr);
369 end = PFN_DOWN(boot_mem_map.map[i].addr
370 + boot_mem_map.map[i].size);
371
365 /* 372 /*
366 * Reserve usable memory. 373 * Reserve usable memory.
367 */ 374 */
368 if (boot_mem_map.map[i].type != BOOT_MEM_RAM) 375 switch (boot_mem_map.map[i].type) {
376 case BOOT_MEM_RAM:
377 break;
378 case BOOT_MEM_INIT_RAM:
379 memory_present(0, start, end);
369 continue; 380 continue;
381 default:
382 /* Not usable memory */
383 continue;
384 }
370 385
371 start = PFN_UP(boot_mem_map.map[i].addr);
372 end = PFN_DOWN(boot_mem_map.map[i].addr
373 + boot_mem_map.map[i].size);
374 /* 386 /*
375 * We are rounding up the start address of usable memory 387 * We are rounding up the start address of usable memory
376 * and at the end of the usable range downwards. 388 * and at the end of the usable range downwards.
@@ -456,11 +468,33 @@ early_param("mem", early_parse_mem);
456 468
457static void __init arch_mem_init(char **cmdline_p) 469static void __init arch_mem_init(char **cmdline_p)
458{ 470{
471 phys_t init_mem, init_end, init_size;
472
459 extern void plat_mem_setup(void); 473 extern void plat_mem_setup(void);
460 474
461 /* call board setup routine */ 475 /* call board setup routine */
462 plat_mem_setup(); 476 plat_mem_setup();
463 477
478 init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT;
479 init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT;
480 init_size = init_end - init_mem;
481 if (init_size) {
482 /* Make sure it is in the boot_mem_map */
483 int i, found;
484 found = 0;
485 for (i = 0; i < boot_mem_map.nr_map; i++) {
486 if (init_mem >= boot_mem_map.map[i].addr &&
487 init_mem < (boot_mem_map.map[i].addr +
488 boot_mem_map.map[i].size)) {
489 found = 1;
490 break;
491 }
492 }
493 if (!found)
494 add_memory_region(init_mem, init_size,
495 BOOT_MEM_INIT_RAM);
496 }
497
464 pr_info("Determined physical RAM map:\n"); 498 pr_info("Determined physical RAM map:\n");
465 print_memory_map(); 499 print_memory_map();
466 500
@@ -524,6 +558,7 @@ static void __init resource_init(void)
524 res = alloc_bootmem(sizeof(struct resource)); 558 res = alloc_bootmem(sizeof(struct resource));
525 switch (boot_mem_map.map[i].type) { 559 switch (boot_mem_map.map[i].type) {
526 case BOOT_MEM_RAM: 560 case BOOT_MEM_RAM:
561 case BOOT_MEM_INIT_RAM:
527 case BOOT_MEM_ROM_DATA: 562 case BOOT_MEM_ROM_DATA:
528 res->name = "System RAM"; 563 res->name = "System RAM";
529 break; 564 break;