[Skiboot] [PATCH v12 03/23] core/fdt: Introduce flatten_dt_properties()
Gavin Shan
gwshan at linux.vnet.ibm.com
Fri Jun 10 15:03:32 AEST 2016
We need unflatten the child nodes of the specified one during PCI
hot add time. After it, the FDT blob is transferred to kernel and
unflattened there. A device sub-tree is represented by the FDT blob
and it excludes the specified (root) node.
This introduces helper function flatten_dt_properties() to flatten
the properties of the specified node. In the path to create the
device sub-tree, the root's properties is skipped in subsequent
patch. In the mean time, the node tag is created in flatten_dt_node()
so that the function is self-contained. No functional changes introduced.
Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
core/fdt.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/core/fdt.c b/core/fdt.c
index 4ef470d..a934e08 100644
--- a/core/fdt.c
+++ b/core/fdt.c
@@ -118,25 +118,30 @@ static void dump_fdt(void)
static inline void dump_fdt(void) { }
#endif
-static void flatten_dt_node(const struct dt_node *root)
+static void flatten_dt_properties(const struct dt_node *dn)
{
- const struct dt_node *i;
const struct dt_property *p;
- FDT_DBG("node: %s\n", root->name);
- list_for_each(&root->properties, p, list) {
+ list_for_each(&dn->properties, p, list) {
if (strstarts(p->name, DT_PRIVATE))
continue;
FDT_DBG(" prop: %s size: %ld\n", p->name, p->len);
dt_property(p);
}
+}
- list_for_each(&root->children, i, list) {
- dt_begin_node(i);
+static void flatten_dt_node(const struct dt_node *root)
+{
+ const struct dt_node *i;
+
+ FDT_DBG("node: %s\n", root->name);
+ dt_begin_node(root);
+ flatten_dt_properties(root);
+ list_for_each(&root->children, i, list)
flatten_dt_node(i);
- dt_end_node();
- }
+
+ dt_end_node();
}
static void create_dtb_reservemap(const struct dt_node *root)
@@ -181,15 +186,9 @@ void *create_dtb(const struct dt_node *root)
create_dtb_reservemap(root);
- /* Open root node */
- dt_begin_node(root);
-
/* Unflatten our live tree */
flatten_dt_node(root);
- /* Close root node */
- dt_end_node();
-
save_err(fdt_finish(fdt));
if (!fdt_error)
--
2.1.0
More information about the Skiboot
mailing list