diff options
author | Bjorn Andersson <bjorn.andersson@sonymobile.com> | 2014-05-06 22:16:16 -0700 |
---|---|---|
committer | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2014-05-19 17:04:03 +0100 |
commit | 175b3017e8a9c89c11af26db967a30532ec33512 (patch) | |
tree | 67d9573dd9a05527a04a7099eef10e0ac06f3b14 | |
parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) |
ARM: zImage: Allow DTB to override broken ATAG_MEM
Support overriding ATAG_MEM, by specifying non-zero content of the /memory/reg
property in the appended DTB. This is needed to work around bootloaders passing
broken tags.
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
-rw-r--r-- | arch/arm/boot/compressed/atags_to_fdt.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index d1153c8a765a0..b534cd61b6f0d 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -95,6 +95,22 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) setprop_string(fdt, "/chosen", "bootargs", cmdline); } +static int fdt_overrides_atag_mem(void *fdt) +{ + const char *memory; + int len = 0; + + memory = getprop(fdt, "/memory", "reg", &len); + if (memory) { + while (len--) { + if (*memory != '\0') + return 1; + } + } + + return 0; +} + /* * Convert and fold provided ATAGs into the provided FDT. * @@ -180,7 +196,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) } } - if (memcount) { + if (memcount && !fdt_overrides_atag_mem(fdt)) { setprop(fdt, "/memory", "reg", mem_reg_property, 4 * memcount * memsize); } |