aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2006-06-23 04:16:03 -0400
committerPaul Mackerras <paulus@samba.org>2006-06-27 21:59:46 -0400
commit7a4571ae553e2972b7958306fd796a2fd24fd7d1 (patch)
tree62111278b4bf452e1c481a2e662b910758b8d123 /arch
parent1dce0e30471ac863fd141d137c98e3644817975e (diff)
[POWERPC] Export flat device tree via debugfs for debugging
If DEBUG is turned on in prom.c, export the flat device tree via debugfs. This has been handy on several occasions. To look at it: # mount -t debugfs none /sys/kernel/debug # od -a /sys/kernel/debug/powerpc/flat-device-tree and/or # dtc -fI dtb /sys/kernel/debug/powerpc/flat-device-tree -O dts Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/prom.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 483455c5bb02..efed4bc2b454 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -30,6 +30,7 @@
30#include <linux/bitops.h> 30#include <linux/bitops.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kexec.h> 32#include <linux/kexec.h>
33#include <linux/debugfs.h>
33 34
34#include <asm/prom.h> 35#include <asm/prom.h>
35#include <asm/rtas.h> 36#include <asm/rtas.h>
@@ -2148,3 +2149,27 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
2148 } 2149 }
2149 return NULL; 2150 return NULL;
2150} 2151}
2152
2153#ifdef DEBUG
2154static struct debugfs_blob_wrapper flat_dt_blob;
2155
2156static int __init export_flat_device_tree(void)
2157{
2158 struct dentry *d;
2159
2160 d = debugfs_create_dir("powerpc", NULL);
2161 if (!d)
2162 return 1;
2163
2164 flat_dt_blob.data = initial_boot_params;
2165 flat_dt_blob.size = initial_boot_params->totalsize;
2166
2167 d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
2168 d, &flat_dt_blob);
2169 if (!d)
2170 return 1;
2171
2172 return 0;
2173}
2174__initcall(export_flat_device_tree);
2175#endif