* [PATCH] powerpc: Export flat device tree via debugfs for debugging
@ 2006-05-01 7:40 Michael Ellerman
2006-05-01 17:54 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2006-05-01 7:40 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
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>
---
arch/powerpc/kernel/prom.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
Index: to-merge/arch/powerpc/kernel/prom.c
===================================================================
--- to-merge.orig/arch/powerpc/kernel/prom.c
+++ to-merge/arch/powerpc/kernel/prom.c
@@ -30,6 +30,7 @@
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/kexec.h>
+#include <linux/debugfs.h>
#include <asm/prom.h>
#include <asm/rtas.h>
@@ -2009,3 +2010,27 @@ void kdump_move_device_tree(void)
/* XXX should we unreserve the old DT? */
}
#endif /* CONFIG_KEXEC */
+
+#ifdef DEBUG
+static struct debugfs_blob_wrapper flat_dt_blob;
+
+static int __init export_flat_device_tree(void)
+{
+ struct dentry *d;
+
+ d = debugfs_create_dir("powerpc", NULL);
+ if (!d)
+ return 1;
+
+ flat_dt_blob.data = initial_boot_params;
+ flat_dt_blob.size = initial_boot_params->totalsize;
+
+ d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
+ d, &flat_dt_blob);
+ if (!d)
+ return 1;
+
+ return 0;
+}
+__initcall(export_flat_device_tree);
+#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Export flat device tree via debugfs for debugging
2006-05-01 7:40 [PATCH] powerpc: Export flat device tree via debugfs for debugging Michael Ellerman
@ 2006-05-01 17:54 ` Kumar Gala
2006-05-02 0:20 ` Michael Ellerman
0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2006-05-01 17:54 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras
On May 1, 2006, at 2:40 AM, Michael Ellerman wrote:
> 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>
> ---
>
> arch/powerpc/kernel/prom.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> Index: to-merge/arch/powerpc/kernel/prom.c
> ===================================================================
> --- to-merge.orig/arch/powerpc/kernel/prom.c
> +++ to-merge/arch/powerpc/kernel/prom.c
> @@ -30,6 +30,7 @@
> #include <linux/bitops.h>
> #include <linux/module.h>
> #include <linux/kexec.h>
> +#include <linux/debugfs.h>
>
> #include <asm/prom.h>
> #include <asm/rtas.h>
> @@ -2009,3 +2010,27 @@ void kdump_move_device_tree(void)
> /* XXX should we unreserve the old DT? */
> }
> #endif /* CONFIG_KEXEC */
> +
> +#ifdef DEBUG
Shouldn't this also depend on DEBUGFS being built in.
> +static struct debugfs_blob_wrapper flat_dt_blob;
> +
> +static int __init export_flat_device_tree(void)
> +{
> + struct dentry *d;
> +
> + d = debugfs_create_dir("powerpc", NULL);
> + if (!d)
> + return 1;
> +
> + flat_dt_blob.data = initial_boot_params;
> + flat_dt_blob.size = initial_boot_params->totalsize;
> +
> + d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
> + d, &flat_dt_blob);
> + if (!d)
> + return 1;
> +
> + return 0;
> +}
> +__initcall(export_flat_device_tree);
> +#endif
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Export flat device tree via debugfs for debugging
2006-05-01 17:54 ` Kumar Gala
@ 2006-05-02 0:20 ` Michael Ellerman
2006-05-02 5:53 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2006-05-02 0:20 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1635 bytes --]
On Mon, 2006-05-01 at 12:54 -0500, Kumar Gala wrote:
> On May 1, 2006, at 2:40 AM, Michael Ellerman wrote:
>
> > 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>
> > ---
> >
> > arch/powerpc/kernel/prom.c | 25 +++++++++++++++++++++++++
> > 1 file changed, 25 insertions(+)
> >
> > Index: to-merge/arch/powerpc/kernel/prom.c
> > ===================================================================
> > --- to-merge.orig/arch/powerpc/kernel/prom.c
> > +++ to-merge/arch/powerpc/kernel/prom.c
> > @@ -30,6 +30,7 @@
> > #include <linux/bitops.h>
> > #include <linux/module.h>
> > #include <linux/kexec.h>
> > +#include <linux/debugfs.h>
> >
> > #include <asm/prom.h>
> > #include <asm/rtas.h>
> > @@ -2009,3 +2010,27 @@ void kdump_move_device_tree(void)
> > /* XXX should we unreserve the old DT? */
> > }
> > #endif /* CONFIG_KEXEC */
> > +
> > +#ifdef DEBUG
>
> Shouldn't this also depend on DEBUGFS being built in.
It could, but DEBUG_FS is written so that you don't have to care, so I
didn't :)
cheers
--
Michael Ellerman
IBM OzLabs
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Export flat device tree via debugfs for debugging
2006-05-02 0:20 ` Michael Ellerman
@ 2006-05-02 5:53 ` Kumar Gala
0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2006-05-02 5:53 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras
On May 1, 2006, at 7:20 PM, Michael Ellerman wrote:
> On Mon, 2006-05-01 at 12:54 -0500, Kumar Gala wrote:
>> On May 1, 2006, at 2:40 AM, Michael Ellerman wrote:
>>
>>> 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>
>>> ---
>>>
>>> arch/powerpc/kernel/prom.c | 25 +++++++++++++++++++++++++
>>> 1 file changed, 25 insertions(+)
>>>
>>> Index: to-merge/arch/powerpc/kernel/prom.c
>>> ===================================================================
>>> --- to-merge.orig/arch/powerpc/kernel/prom.c
>>> +++ to-merge/arch/powerpc/kernel/prom.c
>>> @@ -30,6 +30,7 @@
>>> #include <linux/bitops.h>
>>> #include <linux/module.h>
>>> #include <linux/kexec.h>
>>> +#include <linux/debugfs.h>
>>>
>>> #include <asm/prom.h>
>>> #include <asm/rtas.h>
>>> @@ -2009,3 +2010,27 @@ void kdump_move_device_tree(void)
>>> /* XXX should we unreserve the old DT? */
>>> }
>>> #endif /* CONFIG_KEXEC */
>>> +
>>> +#ifdef DEBUG
>>
>> Shouldn't this also depend on DEBUGFS being built in.
>
> It could, but DEBUG_FS is written so that you don't have to care, so I
> didn't :)
Cool. Haven't messed with DEBUG_FS.
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-05-02 5:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-01 7:40 [PATCH] powerpc: Export flat device tree via debugfs for debugging Michael Ellerman
2006-05-01 17:54 ` Kumar Gala
2006-05-02 0:20 ` Michael Ellerman
2006-05-02 5:53 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).