diff options
author | John Williams <john.williams@petalogix.com> | 2009-06-22 00:02:09 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-07-27 01:39:53 -0400 |
commit | 909964ec89ba466d75d53250d5738d1891cc1a3d (patch) | |
tree | 5b0b2ce13b2d82e9193dd0398535f634d8c4d8e7 /arch/microblaze/kernel/head.S | |
parent | 1170902b343053f50d4caf8ec2aa745fd0ce5c84 (diff) |
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.S | 15 |
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 @@ | |||
31 | #include <linux/linkage.h> | 31 | #include <linux/linkage.h> |
32 | #include <asm/thread_info.h> | 32 | #include <asm/thread_info.h> |
33 | #include <asm/page.h> | 33 | #include <asm/page.h> |
34 | #include <asm/prom.h> /* for OF_DT_HEADER */ | ||
34 | 35 | ||
35 | #ifdef CONFIG_MMU | 36 | #ifdef CONFIG_MMU |
36 | #include <asm/setup.h> /* COMMAND_LINE_SIZE */ | 37 | #include <asm/setup.h> /* COMMAND_LINE_SIZE */ |
@@ -54,11 +55,16 @@ ENTRY(_start) | |||
54 | andi r1, r1, ~2 | 55 | andi r1, r1, ~2 |
55 | mts rmsr, r1 | 56 | mts rmsr, r1 |
56 | 57 | ||
57 | /* save fdt to kernel location */ | 58 | /* r7 may point to an FDT, or there may be one linked in. |
58 | /* r7 stores pointer to fdt blob */ | 59 | if it's in r7, we've got to save it away ASAP. |
59 | beqi r7, no_fdt_arg | 60 | We ensure r7 points to a valid FDT, just in case the bootloader |
61 | is broken or non-existent */ | ||
62 | beqi r7, no_fdt_arg /* NULL pointer? don't copy */ | ||
63 | lw r11, r0, r7 /* Does r7 point to a */ | ||
64 | rsubi r11, r11, OF_DT_HEADER /* valid FDT? */ | ||
65 | bnei r11, no_fdt_arg /* No - get out of here */ | ||
60 | or r11, r0, r0 /* incremment */ | 66 | or r11, r0, r0 /* incremment */ |
61 | ori r4, r0, TOPHYS(_fdt_start) /* save bram context */ | 67 | ori r4, r0, TOPHYS(_fdt_start) |
62 | ori r3, r0, (0x4000 - 4) | 68 | ori r3, r0, (0x4000 - 4) |
63 | _copy_fdt: | 69 | _copy_fdt: |
64 | lw r12, r7, r11 /* r12 = r7 + r11 */ | 70 | lw r12, r7, r11 /* r12 = r7 + r11 */ |
@@ -67,6 +73,7 @@ _copy_fdt: | |||
67 | bgtid r3, _copy_fdt /* loop for all entries */ | 73 | bgtid r3, _copy_fdt /* loop for all entries */ |
68 | addik r3, r3, -4 /* descrement loop */ | 74 | addik r3, r3, -4 /* descrement loop */ |
69 | no_fdt_arg: | 75 | no_fdt_arg: |
76 | add r7, r0, r0 /* Clear r7, just to be sure */ | ||
70 | 77 | ||
71 | #ifdef CONFIG_MMU | 78 | #ifdef CONFIG_MMU |
72 | 79 | ||