From: parth.dixit@linaro.org Subject: [PATCH RFC 22/35] xen/arm: Create chosen node for DOM0 Date: Wed, 4 Feb 2015 19:32:06 +0530 Message-ID: <1423058539-26403-23-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, Parth Dixit , christoffer.dall@linaro.org List-Id: xen-devel@lists.xenproject.org From: Naresh Bhat Create a chosen node for DOM0 with - bootargs - rsdp Signed-off-by: Naresh Bhat Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 30bebe5..d781c63 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -1199,6 +1200,41 @@ static int make_memory_node_acpi(const struct domain *d, return res; } +static int make_chosen_node(const struct domain *d, const struct kernel_info *kinfo) +{ + int res = 0; + const char *bootargs = NULL; + const struct bootmodule *mod = kinfo->kernel_bootmodule; + u64 a = acpi_os_get_root_pointer(); + void *fdt = kinfo->fdt; + __be32 val[2]; + __be32 *cellp; + + DPRINT("Create bootargs chosen node\n"); + + if ( mod && mod->cmdline[0] ) + bootargs = &mod->cmdline[0]; + + res = fdt_begin_node(fdt, "chosen"); + if ( res ) + return res; + + res = fdt_property(fdt, "bootargs", bootargs, (strlen(bootargs)+1)); + if ( res ) + return res; + + cellp = (__be32 *)val; + dt_set_cell(&cellp, ARRAY_SIZE(val), a); + + res = fdt_property(fdt, "rsdp", &val, sizeof(val)); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} + /* * Prepare a minimal DTB for DOM0 which contains * bootargs, memory information, @@ -1244,6 +1280,11 @@ static int prepare_dtb_acpi(struct domain *d, struct kernel_info *kinfo) if ( ret ) goto err; + /* Create a chosen node for DOM0 */ + ret = make_chosen_node(d, kinfo); + if ( ret ) + goto err; + ret = fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err; -- 1.9.1