summaryrefslogtreecommitdiffstats
path: root/drivers/of/fdt.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-11-23 19:44:23 -0700
committerGrant Likely <grant.likely@secretlab.ca>2009-11-23 19:44:23 -0700
commit819d2819303654c6829d572e698e2d0021c08599 (patch)
tree8e98224edfc837a630625b9e05c74121c7fa9b3f /drivers/of/fdt.c
parentc8cb7a59842c0b512b44f6f818cdb0b5a3ddc89e (diff)
downloadop-kernel-dev-819d2819303654c6829d572e698e2d0021c08599.zip
op-kernel-dev-819d2819303654c6829d572e698e2d0021c08599.tar.gz
of/flattree: merge of_get_flat_dt_root
Merge common code between PowerPC and MicroBlaze Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Tested-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r--drivers/of/fdt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dd9057c..f41d739 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -83,3 +83,19 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
return rc;
}
+
+/**
+ * of_get_flat_dt_root - find the root node in the flat blob
+ */
+unsigned long __init of_get_flat_dt_root(void)
+{
+ unsigned long p = ((unsigned long)initial_boot_params) +
+ initial_boot_params->off_dt_struct;
+
+ while (*((u32 *)p) == OF_DT_NOP)
+ p += 4;
+ BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE);
+ p += 4;
+ return _ALIGN(p + strlen((char *)p) + 1, 4);
+}
+
OpenPOWER on IntegriCloud