xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: patches@linaro.org, tim@xen.org, ian.campbell@citrix.com,
	Julien Grall <julien.grall@linaro.org>,
	stefano.stabellini@eu.citrix.com
Subject: [PATCH v3 5/5] xen/dts: Support Linux initrd DT bindings
Date: Fri, 27 Sep 2013 17:56:37 +0100	[thread overview]
Message-ID: <1380300997-28099-6-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1380300997-28099-1-git-send-email-julien.grall@linaro.org>

Linux uses the property linux,initrd-start and linux,initrd-end to know where
the initrd lives in memory.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/common/device_tree.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index ea8ed56..af0fb04 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -380,6 +380,29 @@ static void __init process_multiboot_node(const void *fdt, int node,
         early_info.modules.nr_mods = nr;
 }
 
+static void __init process_chosen_node(const void *fdt, int node,
+                                       const char *name,
+                                       u32 address_cells, u32 size_cells)
+{
+    struct dt_mb_module *mod = &early_info.modules.module[MOD_INITRD];
+    u32 start, end;
+
+    dt_printk("Checking for initrd in /chosen\n");
+
+    start = device_tree_get_u32(fdt, node, "linux,initrd-start", 0);
+    end = device_tree_get_u32(fdt, node, "linux,initrd-end", 0);
+
+    if ( !start || !end || (start >= end) )
+        return;
+
+    dt_printk("Initrd 0x%x-0x%x\n", start, end);
+
+    mod->start = start;
+    mod->size = end - start;
+
+    early_info.modules.nr_mods = MAX(MOD_INITRD, early_info.modules.nr_mods);
+}
+
 static int __init early_scan_node(const void *fdt,
                                   int node, const char *name, int depth,
                                   u32 address_cells, u32 size_cells,
@@ -389,6 +412,8 @@ static int __init early_scan_node(const void *fdt,
         process_memory_node(fdt, node, name, address_cells, size_cells);
     else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) )
         process_multiboot_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
+        process_chosen_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
 }
-- 
1.7.10.4

  parent reply	other threads:[~2013-09-27 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
2013-09-27 16:56 ` [PATCH v3 1/5] xen: Add macros MB and GB Julien Grall
2013-09-27 17:01   ` Andrew Cooper
2013-09-27 17:05     ` Julien Grall
2013-09-27 17:07       ` Andrew Cooper
2013-09-27 16:56 ` [PATCH v3 2/5] xen: Add macro ROUNDUP Julien Grall
2013-09-27 16:56 ` [PATCH v3 3/5] xen/dts: Use ROUNDUP macro instead of the internal ALIGN Julien Grall
2013-09-27 16:56 ` [PATCH v3 4/5] xen/arm: Add support to load initrd in dom0 Julien Grall
2013-09-27 16:56 ` Julien Grall [this message]
2013-10-03 13:14 ` xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd) Ian Campbell
2013-10-03 19:49   ` Keir Fraser
2013-10-08 15:02 ` [PATCH v3 0/5] ARM: Support initrd Ian Campbell

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=1380300997-28099-6-git-send-email-julien.grall@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=patches@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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).