aboutsummaryrefslogtreecommitdiff
path: root/core/fdt.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-06-10 15:03:35 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-06-14 16:00:16 +1000
commit229c79d4903ae6d292354eebef56039f7d8219d6 (patch)
tree115f6bef8a313d90d036278d78ab6b1399c45697 /core/fdt.c
parent108988a1497f23bbce6cc419e48e616648bbdfba (diff)
downloadskiboot-229c79d4903ae6d292354eebef56039f7d8219d6.zip
skiboot-229c79d4903ae6d292354eebef56039f7d8219d6.tar.gz
skiboot-229c79d4903ae6d292354eebef56039f7d8219d6.tar.bz2
core/fdt: Allow to exclude root node
The root node is excluded in the device sub-tree created during PCI hot add time. This adds one extra argument @exclusive to flatten_dt_node(), __create_dtb() and create_dtb() to indicate the root node should be excluded or not. The changes are going to be used by PCI hot add path and it's not affecting anything at present. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/fdt.c')
-rw-r--r--core/fdt.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/core/fdt.c b/core/fdt.c
index fbfbac6..71149fe 100644
--- a/core/fdt.c
+++ b/core/fdt.c
@@ -130,17 +130,22 @@ static void flatten_dt_properties(void *fdt, const struct dt_node *dn)
}
}
-static void flatten_dt_node(void *fdt, const struct dt_node *root)
+static void flatten_dt_node(void *fdt, const struct dt_node *root,
+ bool exclusive)
{
const struct dt_node *i;
- FDT_DBG("node: %s\n", root->name);
- dt_begin_node(fdt, root);
- flatten_dt_properties(fdt, root);
+ if (!exclusive) {
+ FDT_DBG("node: %s\n", root->name);
+ dt_begin_node(fdt, root);
+ flatten_dt_properties(fdt, root);
+ }
+
list_for_each(&root->children, i, list)
- flatten_dt_node(fdt, i);
+ flatten_dt_node(fdt, i, false);
- dt_end_node(fdt);
+ if (!exclusive)
+ dt_end_node(fdt);
}
static void create_dtb_reservemap(void *fdt, const struct dt_node *root)
@@ -166,11 +171,13 @@ static void create_dtb_reservemap(void *fdt, const struct dt_node *root)
}
static int __create_dtb(void *fdt, size_t len,
- const struct dt_node *root)
+ const struct dt_node *root,
+ bool exclusive)
{
fdt_create(fdt, len);
- create_dtb_reservemap(fdt, root);
- flatten_dt_node(fdt, root);
+ if (root == dt_root && !exclusive)
+ create_dtb_reservemap(fdt, root);
+ flatten_dt_node(fdt, root, exclusive);
save_err(fdt_finish(fdt));
if (fdt_error) {
@@ -182,7 +189,7 @@ static int __create_dtb(void *fdt, size_t len,
return 0;
}
-void *create_dtb(const struct dt_node *root)
+void *create_dtb(const struct dt_node *root, bool exclusive)
{
void *fdt = NULL;
size_t len = DEVICE_TREE_MAX_SIZE;
@@ -198,7 +205,7 @@ void *create_dtb(const struct dt_node *root)
return NULL;
}
- ret = __create_dtb(fdt, len, root);
+ ret = __create_dtb(fdt, len, root, exclusive);
if (ret) {
free(fdt);
fdt = NULL;