From: pali.rohar@gmail.com (Pali Rohár)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] arm: devtree: Read ATAGs structure from DT "/chosen/linux, atags" entry
Date: Mon, 6 Jul 2015 22:26:12 +0200 [thread overview]
Message-ID: <1436214373-12969-5-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1436214373-12969-1-git-send-email-pali.rohar@gmail.com>
With this patch when linux kernel is compiled with ARM_ATAG_DTB_COMPAT it
reads ATAGs structure from "/chosen/linux,atags" entry and store it into
/proc/atags file. ATAGs structure is not parsed or evaluated, just kernel
exports it to userspace via procfs. It is needed for legacy userspace
application which expect some data from bootloader in /proc/atags file.
This patch keeps them running also on DT kernel if DT "/chosen/linux,atags"
entry exists.
TODO: add documentation
Signed-off-by: Pali Roh?r <pali.rohar@gmail.com>
---
arch/arm/kernel/devtree.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 7d82749..69ff048 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -20,6 +20,7 @@
#include <linux/of_platform.h>
#include <linux/smp.h>
#include <linux/libfdt_env.h>
+#include <linux/libfdt.h>
#include <asm/cputype.h>
#include <asm/setup.h>
@@ -29,6 +30,7 @@
#include <asm/mach-types.h>
#include <asm/system_info.h>
+#include "atags.h"
#ifdef CONFIG_SMP
extern struct of_cpu_method __cpu_method_of_table[];
@@ -208,6 +210,11 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
const struct machine_desc *mdesc, *mdesc_best = NULL;
unsigned long dt_root;
const u32 *rev;
+ void *dt_virt;
+#ifdef CONFIG_ARM_ATAG_DTB_COMPAT
+ const void *atags;
+ unsigned long dt_chosen;
+#endif
#ifdef CONFIG_ARCH_MULTIPLATFORM
DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -216,7 +223,12 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
mdesc_best = &__mach_desc_GENERIC_DT;
#endif
- if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
+ if (!dt_phys)
+ return NULL;
+
+ dt_virt = phys_to_virt(dt_phys);
+
+ if (!early_init_dt_verify(dt_virt))
return NULL;
dt_root = of_get_flat_dt_root();
@@ -254,5 +266,15 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
if (rev)
system_rev = fdt32_to_cpu(*rev);
+#ifdef CONFIG_ARM_ATAG_DTB_COMPAT
+ /* Store DT /chosen/linux,atags into /proc/atags */
+ dt_chosen = fdt_path_offset(dt_virt, "/chosen");
+ if (dt_chosen >= 0) {
+ atags = of_get_flat_dt_prop(dt_chosen, "linux,atags", NULL);
+ if (atags)
+ save_atags(atags);
+ }
+#endif
+
return mdesc;
}
--
1.7.9.5
next prev parent reply other threads:[~2015-07-06 20:26 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 20:26 [PATCH 0/5] ATAGs to DT patches Pali Rohár
2015-07-06 20:26 ` [PATCH 1/5] arm: devtree: Set system_rev from DT "/revision" Pali Rohár
2015-12-24 19:02 ` Pali Rohár
2015-12-28 21:01 ` Frank Rowand
2015-12-28 22:27 ` Arnd Bergmann
2016-01-05 11:37 ` Pali Rohár
2016-01-05 11:45 ` Arnd Bergmann
2016-02-05 18:15 ` [PATCH] ARM: RX51: Set system_rev from ATAGS Ivaylo Dimitrov
2016-02-08 20:48 ` Tony Lindgren
2016-02-08 21:10 ` Pali Rohár
2016-02-09 16:17 ` Tony Lindgren
2016-02-10 18:23 ` [PATCH v1] " Ivaylo Dimitrov
2016-02-11 0:19 ` Tony Lindgren
2015-07-06 20:26 ` [PATCH 2/5] arm: boot: convert ATAG_REVISION to DT "/revision" entry Pali Rohár
2015-07-06 20:26 ` [PATCH 3/5] arm: atags: Fix declaration of function save_atags Pali Rohár
2015-07-06 20:26 ` Pali Rohár [this message]
2015-07-06 20:26 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Pali Rohár
2015-07-07 11:32 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Russell King - ARM Linux
2015-07-07 11:58 ` Pali Rohár
2015-07-13 13:19 ` Tony Lindgren
2015-10-12 20:16 ` Tony Lindgren
2015-10-12 20:25 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Pali Rohár
2015-10-12 20:45 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Tony Lindgren
2015-10-13 14:37 ` Pali Rohár
2015-11-05 11:40 ` Pali Rohár
2015-11-05 16:17 ` Tony Lindgren
2015-11-12 1:10 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Frank Rowand
2015-11-22 6:51 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Pavel Machek
2015-11-23 14:45 ` Pali Rohár
2015-11-25 18:16 ` Tony Lindgren
2015-11-25 19:48 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Arnd Bergmann
2015-11-25 21:03 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Tony Lindgren
2015-11-25 21:29 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Arnd Bergmann
2015-11-25 21:44 ` Pali Rohár
2015-11-25 21:51 ` Arnd Bergmann
2015-11-25 22:00 ` Pali Rohár
2015-11-26 4:19 ` Frank Rowand
2015-11-26 9:07 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Pali Rohár
2015-11-26 20:39 ` Tony Lindgren
2015-11-26 21:12 ` Ivaylo Dimitrov
2015-11-27 8:38 ` Pali Rohár
2015-11-27 8:44 ` Michael Trimarchi
2015-11-27 8:52 ` Michael Trimarchi
2015-11-27 14:51 ` Tony Lindgren
2015-11-27 13:27 ` Russell King - ARM Linux
2015-11-27 19:51 ` Russell King - ARM Linux
2015-11-27 21:06 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Arnd Bergmann
2015-11-27 23:28 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Nicolas Pitre
2015-11-28 12:27 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Arnd Bergmann
2015-11-28 12:54 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Russell King - ARM Linux
2015-11-28 12:33 ` Russell King - ARM Linux
2015-11-28 17:34 ` Nicolas Pitre
2015-11-28 21:02 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Frank Rowand
2015-11-29 18:09 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Russell King - ARM Linux
2015-11-29 18:19 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Pali Rohár
2015-11-29 23:13 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Russell King - ARM Linux
2015-11-30 0:09 ` Nicolas Pitre
2015-11-30 0:15 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Pali Rohár
2015-11-30 15:23 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Tony Lindgren
2015-11-30 15:39 ` Pali Rohár
2015-11-30 16:09 ` Nicolas Pitre
2015-12-15 9:33 ` Pali Rohár
2015-12-15 11:04 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux, atags" entry Arnd Bergmann
2015-12-15 12:20 ` [PATCH 5/5] arm: boot: store ATAGs structure into DT "/chosen/linux,atags" entry Russell King - ARM Linux
2015-12-15 17:24 ` Nicolas Pitre
2015-12-23 14:54 ` Ivaylo Dimitrov
2015-11-28 4:06 ` [PATCH 0/5] ATAGs to DT patches Frank Rowand
2015-11-28 5:55 ` Frank Rowand
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=1436214373-12969-5-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).