|
@@ -121,6 +121,9 @@ static void __init print_memory_map(void)
|
|
|
case BOOT_MEM_RAM:
|
|
|
printk(KERN_CONT "(usable)\n");
|
|
|
break;
|
|
|
+ case BOOT_MEM_INIT_RAM:
|
|
|
+ printk(KERN_CONT "(usable after init)\n");
|
|
|
+ break;
|
|
|
case BOOT_MEM_ROM_DATA:
|
|
|
printk(KERN_CONT "(ROM data)\n");
|
|
|
break;
|
|
@@ -361,15 +364,24 @@ static void __init bootmem_init(void)
|
|
|
for (i = 0; i < boot_mem_map.nr_map; i++) {
|
|
|
unsigned long start, end, size;
|
|
|
|
|
|
+ start = PFN_UP(boot_mem_map.map[i].addr);
|
|
|
+ end = PFN_DOWN(boot_mem_map.map[i].addr
|
|
|
+ + boot_mem_map.map[i].size);
|
|
|
+
|
|
|
/*
|
|
|
* Reserve usable memory.
|
|
|
*/
|
|
|
- if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
|
|
|
+ switch (boot_mem_map.map[i].type) {
|
|
|
+ case BOOT_MEM_RAM:
|
|
|
+ break;
|
|
|
+ case BOOT_MEM_INIT_RAM:
|
|
|
+ memory_present(0, start, end);
|
|
|
continue;
|
|
|
+ default:
|
|
|
+ /* Not usable memory */
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- start = PFN_UP(boot_mem_map.map[i].addr);
|
|
|
- end = PFN_DOWN(boot_mem_map.map[i].addr
|
|
|
- + boot_mem_map.map[i].size);
|
|
|
/*
|
|
|
* We are rounding up the start address of usable memory
|
|
|
* and at the end of the usable range downwards.
|
|
@@ -455,11 +467,33 @@ early_param("mem", early_parse_mem);
|
|
|
|
|
|
static void __init arch_mem_init(char **cmdline_p)
|
|
|
{
|
|
|
+ phys_t init_mem, init_end, init_size;
|
|
|
+
|
|
|
extern void plat_mem_setup(void);
|
|
|
|
|
|
/* call board setup routine */
|
|
|
plat_mem_setup();
|
|
|
|
|
|
+ init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT;
|
|
|
+ init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT;
|
|
|
+ init_size = init_end - init_mem;
|
|
|
+ if (init_size) {
|
|
|
+ /* Make sure it is in the boot_mem_map */
|
|
|
+ int i, found;
|
|
|
+ found = 0;
|
|
|
+ for (i = 0; i < boot_mem_map.nr_map; i++) {
|
|
|
+ if (init_mem >= boot_mem_map.map[i].addr &&
|
|
|
+ init_mem < (boot_mem_map.map[i].addr +
|
|
|
+ boot_mem_map.map[i].size)) {
|
|
|
+ found = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found)
|
|
|
+ add_memory_region(init_mem, init_size,
|
|
|
+ BOOT_MEM_INIT_RAM);
|
|
|
+ }
|
|
|
+
|
|
|
pr_info("Determined physical RAM map:\n");
|
|
|
print_memory_map();
|
|
|
|
|
@@ -523,6 +557,7 @@ static void __init resource_init(void)
|
|
|
res = alloc_bootmem(sizeof(struct resource));
|
|
|
switch (boot_mem_map.map[i].type) {
|
|
|
case BOOT_MEM_RAM:
|
|
|
+ case BOOT_MEM_INIT_RAM:
|
|
|
case BOOT_MEM_ROM_DATA:
|
|
|
res->name = "System RAM";
|
|
|
break;
|