From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Russell King <linux@arm.linux.org.uk>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] ARM: zImage: Allow DTB to override broken ATAG_MEM
Date: Tue, 6 May 2014 22:16:16 -0700 [thread overview]
Message-ID: <1399439776-18535-1-git-send-email-bjorn.andersson@sonymobile.com> (raw)
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>
---
arch/arm/boot/compressed/atags_to_fdt.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
index d1153c8..b534cd6 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);
}
--
1.7.9.5
next reply other threads:[~2014-05-07 5:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 5:16 Bjorn Andersson [this message]
2014-05-07 5:32 ` Bjorn Andersson
2014-05-07 8:06 ` Uwe Kleine-König
2014-05-07 15:29 ` Bjorn Andersson
2014-05-07 21:24 ` Andreas Färber
2014-06-14 20:33 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399439776-18535-1-git-send-email-bjorn.andersson@sonymobile.com \
--to=bjorn.andersson@sonymobile.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®