diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2016-06-10 15:03:32 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-06-14 16:00:15 +1000 |
commit | 8321721723a19c7ec75365550711ee5a2c745f38 (patch) | |
tree | ab94be1285f467761d80596a460a80e2db4d6196 | |
parent | 6d9cba43710a56beaa5e1232c6cddd35e809ce92 (diff) | |
download | skiboot-8321721723a19c7ec75365550711ee5a2c745f38.zip skiboot-8321721723a19c7ec75365550711ee5a2c745f38.tar.gz skiboot-8321721723a19c7ec75365550711ee5a2c745f38.tar.bz2 |
core/fdt: Introduce flatten_dt_properties()
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@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/fdt.c | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -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) |