ARC: support external initrd
authorNoam Camus <noamc@ezchip.com>
Sun, 9 Sep 2012 08:37:40 +0000 (11:37 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Wed, 26 Mar 2014 09:01:27 +0000 (14:31 +0530)
Currently ARC only supports embedded initrd. This patch enables
external ones too.

[vgupta: Changed from "rt_start"=start/"rd_size"=sz to unified "initrd"=start,sz]
Signed-off-by: Noam Camus <noamc@ezchip.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/mm/init.c

index 55e0a85..5234123 100644 (file)
@@ -10,6 +10,9 @@
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/memblock.h>
+#ifdef CONFIG_BLK_DEV_INITRD
+#include <linux/initrd.h>
+#endif
 #include <linux/swap.h>
 #include <linux/module.h>
 #include <asm/page.h>
@@ -42,6 +45,24 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
        pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz));
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+static int __init early_initrd(char *p)
+{
+       unsigned long start, size;
+       char *endp;
+
+       start = memparse(p, &endp);
+       if (*endp == ',') {
+               size = memparse(endp + 1, NULL);
+
+               initrd_start = (unsigned long)__va(start);
+               initrd_end = (unsigned long)__va(start + size);
+       }
+       return 0;
+}
+early_param("initrd", early_initrd);
+#endif
+
 /*
  * First memory setup routine called from setup_arch()
  * 1. setup swapper's mm @init_mm
@@ -80,6 +101,12 @@ void __init setup_arch_memory(void)
        memblock_reserve(CONFIG_LINUX_LINK_BASE,
                         __pa(_end) - CONFIG_LINUX_LINK_BASE);
 
+#ifdef CONFIG_BLK_DEV_INITRD
+       /*------------- reserve initrd image -----------------------*/
+       if (initrd_start)
+               memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
+#endif
+
        memblock_dump_all();
 
        /*-------------- node setup --------------------------------*/