From: Ian Campbell Subject: Re: [PATCH 3/5] arm: use bootargs for the command line Date: Fri, 30 Mar 2012 17:00:09 +0100 Message-ID: <1333123209.15932.114.camel@zakaz.uk.xensource.com> References: <1332443876-28506-1-git-send-email-david.vrabel@citrix.com> <1332443876-28506-4-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1332443876-28506-4-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Thu, 2012-03-22 at 19:17 +0000, David Vrabel wrote: > From: David Vrabel > > Use the /chosen node's bootargs parameter for the Xen command line. > Parse it early on before the serial console is setup. > > Signed-off-by: David Vrabel Acked-by: Ian Campbell > --- > xen/arch/arm/setup.c | 2 ++ > xen/common/device_tree.c | 20 ++++++++++++++++++++ > xen/include/xen/device_tree.h | 1 + > 3 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c > index 777f8fb..f89a1f7 100644 > --- a/xen/arch/arm/setup.c > +++ b/xen/arch/arm/setup.c > @@ -152,6 +152,8 @@ void __init start_xen(unsigned long boot_phys_offset, > + (atag_paddr & ((1 << SECOND_SHIFT) - 1)); > fdt_size = device_tree_early_init(fdt); > > + cmdline_parse(device_tree_bootargs(fdt)); > + > setup_pagetables(boot_phys_offset); > > #ifdef EARLY_UART_ADDRESS > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index 715fbf6..8fb6d46 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -118,6 +118,26 @@ int device_tree_for_each_node(const void *fdt, > return 0; > } > > +/** > + * device_tree_bootargs - return the bootargs (the Xen command line) > + * @fdt flat device tree. > + */ > +const char *device_tree_bootargs(const void *fdt) > +{ > + int node; > + const struct fdt_property *prop; > + > + node = fdt_path_offset(fdt, "/chosen"); > + if ( node < 0 ) > + return NULL; > + > + prop = fdt_get_property(fdt, node, "bootargs", NULL); > + if ( prop == NULL ) > + return NULL; > + > + return prop->data; > +} > + > static int dump_node(const void *fdt, int node, const char *name, int depth, > u32 address_cells, u32 size_cells, void *data) > { > diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h > index 510b5b4..8e1626c 100644 > --- a/xen/include/xen/device_tree.h > +++ b/xen/include/xen/device_tree.h > @@ -49,6 +49,7 @@ u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name); > bool_t device_tree_node_matches(const void *fdt, int node, const char *match); > int device_tree_for_each_node(const void *fdt, > device_tree_node_func func, void *data); > +const char *device_tree_bootargs(const void *fdt); > void device_tree_dump(const void *fdt); > > #endif