diff options
author | Michal Simek <monstr@monstr.eu> | 2011-01-26 07:41:05 -0500 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2011-01-28 08:04:36 -0500 |
commit | 026a2078791b64aede220b1b1a3e4dfe4ab175e7 (patch) | |
tree | 069d401f5149a429736da6620d2c731d4186f399 /arch/microblaze/kernel | |
parent | 1f0324caefd39985e9fe052fac97da31694db31e (diff) |
microblaze: Fix DTB passing from bootloader
Little endian system needs to check OF_DT_HEADER
but it is swapped because it is in big-endian.
Microblaze LE provides lwr instruction which loads
magic number in BIG endian format which can be compared.
There is used the fact that if you write 0x1 as word
and load it as byte then you get for big-endian zero
and 1 for little-endian.
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r-- | arch/microblaze/kernel/head.S | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S index 42434008209e..0db20b5abb54 100644 --- a/arch/microblaze/kernel/head.S +++ b/arch/microblaze/kernel/head.S | |||
@@ -77,8 +77,18 @@ real_start: | |||
77 | We ensure r7 points to a valid FDT, just in case the bootloader | 77 | We ensure r7 points to a valid FDT, just in case the bootloader |
78 | is broken or non-existent */ | 78 | is broken or non-existent */ |
79 | beqi r7, no_fdt_arg /* NULL pointer? don't copy */ | 79 | beqi r7, no_fdt_arg /* NULL pointer? don't copy */ |
80 | lw r11, r0, r7 /* Does r7 point to a */ | 80 | /* Does r7 point to a valid FDT? Load HEADER magic number */ |
81 | rsubi r11, r11, OF_DT_HEADER /* valid FDT? */ | 81 | /* Run time Big/Little endian platform */ |
82 | /* Save 1 as word and load byte - 0 - BIG, 1 - LITTLE */ | ||
83 | addik r11, r0, 0x1 /* BIG/LITTLE checking value */ | ||
84 | /* __bss_start will be zeroed later - it is just temp location */ | ||
85 | swi r11, r0, TOPHYS(__bss_start) | ||
86 | lbui r11, r0, TOPHYS(__bss_start) | ||
87 | beqid r11, big_endian /* DO NOT break delay stop dependency */ | ||
88 | lw r11, r0, r7 /* Big endian load in delay slot */ | ||
89 | lwr r11, r0, r7 /* Little endian load */ | ||
90 | big_endian: | ||
91 | rsubi r11, r11, OF_DT_HEADER /* Check FDT header */ | ||
82 | beqi r11, _prepare_copy_fdt | 92 | beqi r11, _prepare_copy_fdt |
83 | or r7, r0, r0 /* clear R7 when not valid DTB */ | 93 | or r7, r0, r0 /* clear R7 when not valid DTB */ |
84 | bnei r11, no_fdt_arg /* No - get out of here */ | 94 | bnei r11, no_fdt_arg /* No - get out of here */ |