aboutsummaryrefslogtreecommitdiff
path: root/livetree.c
diff options
context:
space:
mode:
Diffstat (limited to 'livetree.c')
-rw-r--r--livetree.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/livetree.c b/livetree.c
index 9a482a8..0230949 100644
--- a/livetree.c
+++ b/livetree.c
@@ -318,3 +318,26 @@ cell_t get_node_phandle(struct node *root, struct node *node)
return node->phandle;
}
+
+uint32_t guess_boot_cpuid(struct node *tree)
+{
+ struct node *cpus, *bootcpu;
+ struct property *reg;
+
+ cpus = get_node_by_path(tree, "/cpus");
+ if (!cpus)
+ return 0;
+
+
+ bootcpu = cpus->children;
+ if (!bootcpu)
+ return 0;
+
+ reg = get_property(bootcpu, "reg");
+ if (!reg || (reg->val.len != sizeof(uint32_t)))
+ return 0;
+
+ /* FIXME: Sanity check node? */
+
+ return propval_cell(reg);
+}