[Skiboot] [PATCH v12 06/23] core/fdt: Allow to exclude root node
Gavin Shan
gwshan at linux.vnet.ibm.com
Fri Jun 10 15:03:35 AEST 2016
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 at linux.vnet.ibm.com>
---
core/fdt.c | 29 ++++++++++++++++++-----------
core/init.c | 2 +-
include/skiboot.h | 2 +-
3 files changed, 20 insertions(+), 13 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;
diff --git a/core/init.c b/core/init.c
index 4542a1d..67b539b 100644
--- a/core/init.c
+++ b/core/init.c
@@ -452,7 +452,7 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
op_display(OP_LOG, OP_MOD_INIT, 0x000B);
/* Create the device tree blob to boot OS. */
- fdt = create_dtb(dt_root);
+ fdt = create_dtb(dt_root, false);
if (!fdt) {
op_display(OP_FATAL, OP_MOD_INIT, 2);
abort();
diff --git a/include/skiboot.h b/include/skiboot.h
index a878d21..ded6bb8 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -251,7 +251,7 @@ extern void prd_init(void);
extern void prd_register_reserved_memory(void);
/* Flatten device-tree */
-extern void *create_dtb(const struct dt_node *root);
+extern void *create_dtb(const struct dt_node *root, bool exclusive);
/* SLW reinit function for switching core settings */
extern int64_t slw_reinit(uint64_t flags);
--
2.1.0
More information about the Skiboot
mailing list