From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH RFC 22/35] xen/arm: Create chosen node for DOM0 Date: Fri, 06 Feb 2015 08:29:58 +0800 Message-ID: <54D40B06.4010501@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> <1423058539-26403-23-git-send-email-parth.dixit@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , Parth Dixit Cc: ian.campbell@citrix.com, Naresh Bhat , tim@xen.org, xen-devel@lists.xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, christoffer.dall@linaro.org List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 06/02/2015 00:09, Stefano Stabellini wrote: > On Wed, 4 Feb 2015, parth.dixit@linaro.org wrote: >> 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; >> +} > > This is similar to setup_chosen_node in xen/arch/arm/efi/efi-boot.h. > It might make sense to refactor the code to avoid code duplication. I don't think it make sense to have a common function between efi-boot.h (which create the DT for Xen) and here (which create the DT for DOM0). The former one is adding a node into an existing device tree while the former creating the device tree. Futhermore, the rsdp property doesn't exist on EFI boot. Regads, -- Julien Grall