|
@@ -647,3 +647,128 @@ void __init mem_init(void)
|
|
|
unsigned long pages = memblock_region_memory_end_pfn(reg) -
|
|
|
memblock_region_memory_base_pfn(reg);
|
|
|
num_physpages += pages;
|
|
|
+ printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
|
|
|
+ }
|
|
|
+ printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
|
|
|
+
|
|
|
+ printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
|
|
|
+ nr_free_pages() << (PAGE_SHIFT-10),
|
|
|
+ free_pages << (PAGE_SHIFT-10),
|
|
|
+ reserved_pages << (PAGE_SHIFT-10),
|
|
|
+ totalhigh_pages << (PAGE_SHIFT-10));
|
|
|
+
|
|
|
+#define MLK(b, t) b, t, ((t) - (b)) >> 10
|
|
|
+#define MLM(b, t) b, t, ((t) - (b)) >> 20
|
|
|
+#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
|
|
|
+
|
|
|
+ printk(KERN_NOTICE "Virtual kernel memory layout:\n"
|
|
|
+ " vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
|
|
|
+#ifdef CONFIG_HAVE_TCM
|
|
|
+ " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
|
|
|
+ " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
|
|
|
+#endif
|
|
|
+ " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
|
|
|
+ " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
|
|
|
+ " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
|
|
|
+#ifdef CONFIG_HIGHMEM
|
|
|
+ " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
|
|
|
+#endif
|
|
|
+#ifdef CONFIG_MODULES
|
|
|
+ " modules : 0x%08lx - 0x%08lx (%4ld MB)\n"
|
|
|
+#endif
|
|
|
+ " .text : 0x%p" " - 0x%p" " (%4d kB)\n"
|
|
|
+ " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
|
|
|
+ " .data : 0x%p" " - 0x%p" " (%4d kB)\n"
|
|
|
+ " .bss : 0x%p" " - 0x%p" " (%4d kB)\n",
|
|
|
+
|
|
|
+ MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) +
|
|
|
+ (PAGE_SIZE)),
|
|
|
+#ifdef CONFIG_HAVE_TCM
|
|
|
+ MLK(DTCM_OFFSET, (unsigned long) dtcm_end),
|
|
|
+ MLK(ITCM_OFFSET, (unsigned long) itcm_end),
|
|
|
+#endif
|
|
|
+ MLK(FIXADDR_START, FIXADDR_TOP),
|
|
|
+ MLM(VMALLOC_START, VMALLOC_END),
|
|
|
+ MLM(PAGE_OFFSET, (unsigned long)high_memory),
|
|
|
+#ifdef CONFIG_HIGHMEM
|
|
|
+ MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) *
|
|
|
+ (PAGE_SIZE)),
|
|
|
+#endif
|
|
|
+#ifdef CONFIG_MODULES
|
|
|
+ MLM(MODULES_VADDR, MODULES_END),
|
|
|
+#endif
|
|
|
+
|
|
|
+ MLK_ROUNDUP(_text, _etext),
|
|
|
+ MLK_ROUNDUP(__init_begin, __init_end),
|
|
|
+ MLK_ROUNDUP(_sdata, _edata),
|
|
|
+ MLK_ROUNDUP(__bss_start, __bss_stop));
|
|
|
+
|
|
|
+#undef MLK
|
|
|
+#undef MLM
|
|
|
+#undef MLK_ROUNDUP
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Check boundaries twice: Some fundamental inconsistencies can
|
|
|
+ * be detected at build time already.
|
|
|
+ */
|
|
|
+#ifdef CONFIG_MMU
|
|
|
+ BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
|
|
|
+ BUG_ON(TASK_SIZE > MODULES_VADDR);
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef CONFIG_HIGHMEM
|
|
|
+ BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
|
|
|
+ BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
|
|
|
+#endif
|
|
|
+
|
|
|
+ if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
|
|
|
+ extern int sysctl_overcommit_memory;
|
|
|
+ /*
|
|
|
+ * On a machine this small we won't get
|
|
|
+ * anywhere without overcommit, so turn
|
|
|
+ * it on by default.
|
|
|
+ */
|
|
|
+ sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void free_initmem(void)
|
|
|
+{
|
|
|
+#ifdef CONFIG_HAVE_TCM
|
|
|
+ extern char __tcm_start, __tcm_end;
|
|
|
+
|
|
|
+ poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
|
|
|
+ totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
|
|
|
+ __phys_to_pfn(__pa(&__tcm_end)),
|
|
|
+ "TCM link");
|
|
|
+#endif
|
|
|
+
|
|
|
+ poison_init_mem(__init_begin, __init_end - __init_begin);
|
|
|
+ if (!machine_is_integrator() && !machine_is_cintegrator())
|
|
|
+ totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
|
|
|
+ __phys_to_pfn(__pa(__init_end)),
|
|
|
+ "init");
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef CONFIG_BLK_DEV_INITRD
|
|
|
+
|
|
|
+static int keep_initrd;
|
|
|
+
|
|
|
+void free_initrd_mem(unsigned long start, unsigned long end)
|
|
|
+{
|
|
|
+ if (!keep_initrd) {
|
|
|
+ poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
|
|
|
+ totalram_pages += free_area(__phys_to_pfn(__pa(start)),
|
|
|
+ __phys_to_pfn(__pa(end)),
|
|
|
+ "initrd");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static int __init keepinitrd_setup(char *__unused)
|
|
|
+{
|
|
|
+ keep_initrd = 1;
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+__setup("keepinitrd", keepinitrd_setup);
|
|
|
+#endif
|