|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 22/35] xen/arm: Create chosen node for DOM0
On Wed, 4 Feb 2015, parth.dixit@xxxxxxxxxx wrote:
> From: Naresh Bhat <naresh.bhat@xxxxxxxxxx>
>
> Create a chosen node for DOM0 with
> - bootargs
> - rsdp
>
> Signed-off-by: Naresh Bhat <naresh.bhat@xxxxxxxxxx>
> Signed-off-by: Parth Dixit <parth.dixit@xxxxxxxxxx>
> ---
> 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 <asm/setup.h>
> #include <asm/cpufeature.h>
> #include <asm/acpi.h>
> +#include <xen/acpi.h>
>
> #include <asm/gic.h>
> #include <xen/irq.h>
> @@ -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.
> /*
> * 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
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |