[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/8] device tree: add device_tree_dump() to print a flat device tree
On Tue, 2012-02-28 at 16:54 +0000, David Vrabel wrote: > From: David Vrabel <david.vrabel@xxxxxxxxxx> > > Add a device_tree_dump() function which prints to main structure and > properties names of a flat device tree (but not the properties values > yet). > > This will be useful for debugging problems with the device tree > generated for dom0. > > Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx> Other than coding style issues (which I'm not going to comment on any more): Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> > --- > xen/common/device_tree.c | 38 ++++++++++++++++++++++++++++++++++++++ > xen/include/xen/device_tree.h | 1 + > 2 files changed, 39 insertions(+), 0 deletions(-) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index e95ff3c..dbc4f61 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -101,6 +101,44 @@ int device_tree_for_each_node(const void *fdt, > return 0; > } > > +static int dump_node(const void *fdt, int node, const char *name, int depth, > + u32 address_cells, u32 size_cells, void *data) > +{ > + char prefix[2*MAX_DEPTH + 1] = ""; > + int i; > + int prop; > + > + for (i = 0; i < depth; i++) > + safe_strcat(prefix, " "); > + > + if (name[0] == '\0') > + name = "/"; > + printk("%s%s:\n", prefix, name); > + > + for (prop = fdt_first_property_offset(fdt, node); > + prop >= 0; > + prop = fdt_next_property_offset(fdt, prop)) > + { > + const struct fdt_property *p; > + > + p = fdt_get_property_by_offset(fdt, prop, NULL); > + > + printk("%s %s\n", prefix, fdt_string(fdt, > fdt32_to_cpu(p->nameoff))); > + } > + > + return 0; > +} > + > +/** > + * device_tree_dump - print a text representation of a device tree > + * @fdt: flat device tree to print > + */ > +void device_tree_dump(const void *fdt) > +{ > + device_tree_for_each_node(fdt, dump_node, NULL); > +} > + > + > static void __init process_memory_node(const void *fdt, int node, const char > *name, > u32 address_cells, u32 size_cells) > { > diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h > index 505f3e3..b91b39f 100644 > --- a/xen/include/xen/device_tree.h > +++ b/xen/include/xen/device_tree.h > @@ -41,5 +41,6 @@ paddr_t device_tree_get_xen_paddr(void); > > int device_tree_for_each_node(const void *fdt, > device_tree_node_func func, void *data); > +void device_tree_dump(const void *fdt); > > #endif _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |