summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/head.S
diff options
context:
space:
mode:
authorJohn Williams <john.williams@petalogix.com>2009-06-22 06:02:09 +0200
committerMichal Simek <monstr@monstr.eu>2009-07-27 07:39:53 +0200
commit909964ec89ba466d75d53250d5738d1891cc1a3d (patch)
tree5b0b2ce13b2d82e9193dd0398535f634d8c4d8e7 /arch/microblaze/kernel/head.S
parentmicroblaze: remove duplicated #include (diff)
downloadlinux-909964ec89ba466d75d53250d5738d1891cc1a3d.tar.xz
linux-909964ec89ba466d75d53250d5738d1891cc1a3d.zip
microblaze: Final support for statically linked DTB
If r7 is zero at kernel boot, or does not point to a valid DTB, then we fall back to a DTB (assumed to be) linked statically in the kernel, instead of blindly copying bogus cruft into the kernel DTB memory region Signed-off-by: John Williams <john.williams@petalogix.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel/head.S')
-rw-r--r--arch/microblaze/kernel/head.S15
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index e568d6ec621b..815bcaae99c3 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -31,6 +31,7 @@
#include <linux/linkage.h>
#include <asm/thread_info.h>
#include <asm/page.h>
+#include <asm/prom.h> /* for OF_DT_HEADER */
#ifdef CONFIG_MMU
#include <asm/setup.h> /* COMMAND_LINE_SIZE */
@@ -54,11 +55,16 @@ ENTRY(_start)
andi r1, r1, ~2
mts rmsr, r1
-/* save fdt to kernel location */
-/* r7 stores pointer to fdt blob */
- beqi r7, no_fdt_arg
+/* r7 may point to an FDT, or there may be one linked in.
+ if it's in r7, we've got to save it away ASAP.
+ We ensure r7 points to a valid FDT, just in case the bootloader
+ is broken or non-existent */
+ beqi r7, no_fdt_arg /* NULL pointer? don't copy */
+ lw r11, r0, r7 /* Does r7 point to a */
+ rsubi r11, r11, OF_DT_HEADER /* valid FDT? */
+ bnei r11, no_fdt_arg /* No - get out of here */
or r11, r0, r0 /* incremment */
- ori r4, r0, TOPHYS(_fdt_start) /* save bram context */
+ ori r4, r0, TOPHYS(_fdt_start)
ori r3, r0, (0x4000 - 4)
_copy_fdt:
lw r12, r7, r11 /* r12 = r7 + r11 */
@@ -67,6 +73,7 @@ _copy_fdt:
bgtid r3, _copy_fdt /* loop for all entries */
addik r3, r3, -4 /* descrement loop */
no_fdt_arg:
+ add r7, r0, r0 /* Clear r7, just to be sure */
#ifdef CONFIG_MMU