linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matthew McClintock <msm@freescale.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Matthew McClintock <msm@freescale.com>,
	Kumar Gala <kumar.gala@freescale.com>,
	Timur Tabi <timur@freescale.com>
Subject: [PATCH V4] powerpc/prom: Export device tree physical address via proc
Date: Wed, 14 Jul 2010 10:18:53 -0500	[thread overview]
Message-ID: <1279120733-13584-1-git-send-email-msm@freescale.com> (raw)

To build a proper flat device tree for kexec we need to know which
memreserve region was used for the device tree for the currently
running kernel, so we can remove it and replace it with the new
memreserve for the kexec'ed kernel

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
V4: Fixed misspelling

V3: Remove unneeded cast, and fixed indentation screw up

V2: messed up changes

 arch/powerpc/kernel/prom.c |   45 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fd9359a..ff3e240 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -32,6 +32,7 @@
 #include <linux/debugfs.h>
 #include <linux/irq.h>
 #include <linux/lmb.h>
+#include <linux/bootmem.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -911,3 +912,47 @@ static int __init export_flat_device_tree(void)
 }
 __initcall(export_flat_device_tree);
 #endif
+
+#ifdef CONFIG_KEXEC
+static phys_addr_t flat_dt_start;
+static phys_addr_t flat_dt_end;
+
+static struct property flat_dt_start_prop = {
+	.name = "linux,devicetree-start",
+	.length = sizeof(phys_addr_t),
+	.value = &flat_dt_start,
+};
+
+static struct property flat_dt_end_prop = {
+	.name = "linux,devicetree-end",
+	.length = sizeof(phys_addr_t),
+	.value = &flat_dt_end,
+};
+
+static int __init export_flat_device_tree_phys_addr(void)
+{
+	struct property *prop;
+	struct device_node *node;
+
+	node = of_find_node_by_path("/chosen");
+	if (!node)
+		return -ENOENT;
+
+	prop = of_find_property(node, "linux,devicetree-start", NULL);
+	if (prop)
+		prom_remove_property(node, prop);
+
+	prop = of_find_property(node, "linux,devicetree-end", NULL);
+	if (prop)
+		prom_remove_property(node, prop);
+
+	flat_dt_start = virt_to_phys(initial_boot_params);
+	flat_dt_end = virt_to_phys(initial_boot_params)
+				+ initial_boot_params->totalsize;
+	prom_add_property(node, &flat_dt_start_prop);
+	prom_add_property(node, &flat_dt_end_prop);
+
+	return 0;
+}
+__initcall(export_flat_device_tree_phys_addr);
+#endif
-- 
1.6.6.1

             reply	other threads:[~2010-07-14 15:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14 15:18 Matthew McClintock [this message]
2010-07-14 15:33 ` [PATCH V4] powerpc/prom: Export device tree physical address via proc Tabi Timur-B04825
2010-07-14 15:35 ` Segher Boessenkool
2010-07-14 15:42   ` Matthew McClintock
2010-07-14 15:46     ` Segher Boessenkool
2010-07-15  6:17       ` Matthew McClintock
2010-07-15  6:21 ` Grant Likely
2010-07-15 15:19   ` Matthew McClintock
2010-07-15 16:22     ` Grant Likely
2010-07-15 16:39       ` Matthew McClintock
2010-07-15 16:57         ` Grant Likely
2010-07-15 18:03           ` Matthew McClintock
2010-07-15 18:37             ` Grant Likely
2010-07-15 18:58               ` Matthew McClintock
2010-07-15 19:18                 ` Grant Likely
2010-07-16  5:44                   ` Mitch Bradley
2010-07-17 16:41                   ` Segher Boessenkool
2010-07-19  4:24                     ` Matthew McClintock
2010-07-30  1:38                   ` David Gibson
2010-07-30  1:23         ` David Gibson
2010-07-19  0:09       ` Benjamin Herrenschmidt
2010-07-19  4:34         ` Matthew McClintock
2010-07-18 23:41   ` Benjamin Herrenschmidt
2010-07-19  4:28     ` Matthew McClintock
2010-07-19  4:32       ` Grant Likely
2010-07-19 16:57         ` Scott Wood

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=1279120733-13584-1-git-send-email-msm@freescale.com \
    --to=msm@freescale.com \
    --cc=kumar.gala@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=timur@freescale.com \
    /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).