arch: Make phys_initrd_start and phys_initrd_size global variables
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 5 Nov 2018 22:54:27 +0000 (14:54 -0800)
committerRob Herring <robh@kernel.org>
Mon, 26 Nov 2018 21:50:02 +0000 (15:50 -0600)
Make phys_initrd_start and phys_initrd_size global variables declared in
init/do_mounts_initrd.c such that we can later have generic code in
drivers/of/fdt.c populate those variables for us.

This requires both the ARM and unicore32 implementations to be properly
guarded against CONFIG_BLK_DEV_INITRD, and also initialize the variables
to the expected default values (unicore32).

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
arch/arm/mm/init.c
arch/unicore32/mm/init.c
include/linux/initrd.h
init/do_mounts_initrd.c

index 32e4845af2b66fe1af4c1b43601b05b1fd1c51f8..438625764ccd2835d3b9d447127b4a9d47ebd249 100644 (file)
@@ -50,9 +50,7 @@ unsigned long __init __clear_cr(unsigned long mask)
 }
 #endif
 
-static phys_addr_t phys_initrd_start __initdata = 0;
-static unsigned long phys_initrd_size __initdata = 0;
-
+#ifdef CONFIG_BLK_DEV_INITRD
 static int __init early_initrd(char *p)
 {
        phys_addr_t start;
@@ -89,6 +87,7 @@ static int __init parse_tag_initrd2(const struct tag *tag)
 }
 
 __tagtable(ATAG_INITRD2, parse_tag_initrd2);
+#endif
 
 static void __init find_limits(unsigned long *min, unsigned long *max_low,
                               unsigned long *max_high)
index cf4eb9481fd667358c73f65178b4ee5039f232ec..02aa2c0b295e2763d3eaf22a35a26ad781712671 100644 (file)
@@ -30,9 +30,7 @@
 
 #include "mm.h"
 
-static unsigned long phys_initrd_start __initdata = 0x01000000;
-static unsigned long phys_initrd_size __initdata = SZ_8M;
-
+#ifdef CONFIG_BLK_DEV_INITRD
 static int __init early_initrd(char *p)
 {
        unsigned long start, size;
@@ -48,6 +46,7 @@ static int __init early_initrd(char *p)
        return 0;
 }
 early_param("initrd", early_initrd);
+#endif
 
 /*
  * This keeps memory configuration data used by a couple memory
@@ -156,6 +155,11 @@ void __init uc32_memblock_init(struct meminfo *mi)
        memblock_reserve(__pa(_text), _end - _text);
 
 #ifdef CONFIG_BLK_DEV_INITRD
+       if (!phys_initrd_size) {
+               phys_initrd_start = 0x01000000;
+               phys_initrd_size = SZ_8M;
+       }
+
        if (phys_initrd_size) {
                memblock_reserve(phys_initrd_start, phys_initrd_size);
 
index 84b423044088728feeccd7d1e468ac747f91cede..14beaff9b4458b697748fc78eaf8f84279df40d3 100644 (file)
@@ -21,4 +21,7 @@ extern int initrd_below_start_ok;
 extern unsigned long initrd_start, initrd_end;
 extern void free_initrd_mem(unsigned long, unsigned long);
 
+extern phys_addr_t phys_initrd_start;
+extern unsigned long phys_initrd_size;
+
 extern unsigned int real_root_dev;
index d1a5d885ce13eb566667b5d32de782c6c4694944..45865b72f4eaa65ab898d296488ac64c72150345 100644 (file)
@@ -16,6 +16,9 @@ int initrd_below_start_ok;
 unsigned int real_root_dev;    /* do_proc_dointvec cannot handle kdev_t */
 static int __initdata mount_initrd = 1;
 
+phys_addr_t phys_initrd_start __initdata;
+unsigned long phys_initrd_size __initdata;
+
 static int __init no_initrd(char *str)
 {
        mount_initrd = 0;