MIPS: store the appended dtb address in a variable
authorJonas Gorski <jogo@openwrt.org>
Mon, 20 Jun 2016 09:27:37 +0000 (11:27 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 2 Aug 2016 12:00:16 +0000 (14:00 +0200)
Instead of rewriting the arguments to match the UHI spec, store the
address of a appended or UHI supplied dtb in fw_supplied_dtb.

That way the original bootloader arugments are kept intact while still
making the use of an appended dtb invisible for mach code.

Mach code can still find out if it is an appended dtb by comparing
fw_arg1 with fw_supplied_dtb.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: John Crispin <john@phrozen.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Alban Bedel <albeu@free.fr>
Cc: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13699/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/ath79/setup.c
arch/mips/bmips/setup.c
arch/mips/include/asm/bootinfo.h
arch/mips/kernel/head.S
arch/mips/kernel/setup.c
arch/mips/lantiq/prom.c
arch/mips/pic32/pic32mzda/init.c

index 7adab180e0ca61e32f6e4e811d09f041ddd1a4ee..2ec9100356c8cddd7d93ce278ca03436a8e4933e 100644 (file)
@@ -204,8 +204,8 @@ void __init plat_mem_setup(void)
        fdt_start = fw_getenvl("fdt_start");
        if (fdt_start)
                __dt_setup_arch((void *)KSEG0ADDR(fdt_start));
-       else if (fw_arg0 == -2)
-               __dt_setup_arch((void *)KSEG0ADDR(fw_arg1));
+       else if (fw_passed_dtb)
+               __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb));
 
        if (mips_machtype != ATH79_MACH_GENERIC_OF) {
                ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
index f146d1219bde86b71c5e69d037c51d4d27d74651..6776042679dd263a9c862e79942946afaff9a37e 100644 (file)
@@ -162,8 +162,8 @@ void __init plat_mem_setup(void)
        /* intended to somewhat resemble ARM; see Documentation/arm/Booting */
        if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
                dtb = phys_to_virt(fw_arg2);
-       else if (fw_arg0 == -2) /* UHI interface */
-               dtb = (void *)fw_arg1;
+       else if (fw_passed_dtb) /* UHI interface */
+               dtb = (void *)fw_passed_dtb;
        else if (__dtb_start != __dtb_end)
                dtb = (void *)__dtb_start;
        else
index 9f67033961a638acb4d845ba8e0f5fd204409929..ee9f5f2d18fc00e0f51705c745174c7d95bbccf4 100644 (file)
@@ -127,6 +127,10 @@ extern char arcs_cmdline[COMMAND_LINE_SIZE];
  */
 extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
 
+#ifdef CONFIG_USE_OF
+extern unsigned long fw_passed_dtb;
+#endif
+
 /*
  * Platform memory detection hook called by setup_arch
  */
index 56e8fede3fd80504fa081dc1531235cad9f91f15..cf052204eb0ae50460de00055994cc229694d854 100644 (file)
@@ -93,21 +93,24 @@ NESTED(kernel_entry, 16, sp)                        # kernel entry point
        jr      t0
 0:
 
+#ifdef CONFIG_USE_OF
 #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
-       PTR_LA          t0, __appended_dtb
+       PTR_LA          t2, __appended_dtb
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
        li              t1, 0xd00dfeed
 #else
        li              t1, 0xedfe0dd0
 #endif
-       lw              t2, (t0)
-       bne             t1, t2, not_found
-        nop
+       lw              t0, (t2)
+       beq             t0, t1, dtb_found
+#endif
+       li              t1, -2
+       beq             a0, t1, dtb_found
+       move            t2, a1
 
-       move            a1, t0
-       PTR_LI          a0, -2
-not_found:
+       li              t2, 0
+dtb_found:
 #endif
        PTR_LA          t0, __bss_start         # clear .bss
        LONG_S          zero, (t0)
@@ -122,6 +125,10 @@ not_found:
        LONG_S          a2, fw_arg2
        LONG_S          a3, fw_arg3
 
+#ifdef CONFIG_USE_OF
+       LONG_S          t2, fw_passed_dtb
+#endif
+
        MTC0            zero, CP0_CONTEXT       # clear context register
        PTR_LA          $28, init_thread_union
        /* Set the SP after an empty pt_regs.  */
index ef408a03e818860bf18dc95ed08adb3084892401..36cf8d65c47dbef02c408fd9b30428a8a4828998 100644 (file)
@@ -875,6 +875,10 @@ void __init setup_arch(char **cmdline_p)
 unsigned long kernelsp[NR_CPUS];
 unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
 
+#ifdef CONFIG_USE_OF
+unsigned long fw_passed_dtb;
+#endif
+
 #ifdef CONFIG_DEBUG_FS
 struct dentry *mips_debugfs_dir;
 static int __init debugfs_mips(void)
index 5f693ac77a0df2a979f0ec2d75717d81397bbead..4cbb000e778e3f0fcfcc57942a325d8e318ab343 100644 (file)
@@ -74,8 +74,8 @@ void __init plat_mem_setup(void)
 
        set_io_port_base((unsigned long) KSEG1);
 
-       if (fw_arg0 == -2) /* UHI interface */
-               dtb = (void *)fw_arg1;
+       if (fw_passed_dtb) /* UHI interface */
+               dtb = (void *)fw_passed_dtb;
        else if (__dtb_start != __dtb_end)
                dtb = (void *)__dtb_start;
        else
index 775ff90a99621904afdd2a5ac2bcc63d6959917e..a794037a2d814cf32ccb31ac6a38ed58666403fb 100644 (file)
@@ -33,8 +33,8 @@ static ulong get_fdtaddr(void)
 {
        ulong ftaddr = 0;
 
-       if ((fw_arg0 == -2) && fw_arg1 && !fw_arg2 && !fw_arg3)
-               return (ulong)fw_arg1;
+       if (fw_passed_dtb && !fw_arg2 && !fw_arg3)
+               return (ulong)fw_passed_dtb;
 
        if (__dtb_start < __dtb_end)
                ftaddr = (ulong)__dtb_start;
This page took 0.029363 seconds and 5 git commands to generate.