# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID cc45282daf3d242fdcf6e858c0b18b7f1086a318
# Parent 02aaaf00a9229b6564e860618f329bd2f9303a1e
[XEN][POWERPC] OFD dump prefix screen and hook into keyhandler
This patch adds the ability to view the devtree from the Xen console.
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
xen/arch/powerpc/boot_of.c | 2 +-
xen/arch/powerpc/of-devtree.h | 6 +++---
xen/arch/powerpc/of-devwalk.c | 14 +++++++-------
xen/arch/powerpc/ofd_fixup.c | 2 +-
xen/arch/powerpc/setup.c | 19 ++++++++++++++-----
5 files changed, 26 insertions(+), 17 deletions(-)
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/boot_of.c Mon Nov 27 17:17:07 2006 -0500
@@ -1069,7 +1069,7 @@ static void * __init boot_of_devtree(mod
if (ofd_size(oft) > oft_sz)
of_panic("Could not fit all devtree fixups\n");
- ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
+ ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
mod->mod_start = (ulong)oft;
mod->mod_end = mod->mod_start + oft_sz;
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/of-devtree.h
--- a/xen/arch/powerpc/of-devtree.h Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/of-devtree.h Mon Nov 27 17:17:07 2006 -0500
@@ -115,10 +115,10 @@ extern void ofd_io_close(void *mem, ofdn
extern void ofd_io_close(void *mem, ofdn_t n);
-typedef void (*walk_fn)(void *m, ofdn_t p, int arg);
-extern void ofd_dump_props(void *m, ofdn_t p, int dump);
+typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
+extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
-extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg);
+extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
/* Recursively look up #address_cells and #size_cells properties */
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/of-devwalk.c
--- a/xen/arch/powerpc/of-devwalk.c Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/of-devwalk.c Mon Nov 27 17:17:07 2006 -0500
@@ -80,7 +80,7 @@ void ofd_prop_print(
#endif
}
-void ofd_dump_props(void *mem, ofdn_t n, int dump)
+void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
{
ofdn_t p;
char name[128];
@@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n,
}
if (dump & OFD_DUMP_NAMES) {
- printk("of_walk: %s: phandle 0x%x\n", path, n);
+ printk("%s: %s: phandle 0x%x\n", pre, path, n);
}
p = ofd_nextprop(mem, n, NULL, name);
@@ -106,30 +106,30 @@ void ofd_dump_props(void *mem, ofdn_t n,
}
if ( dump & OFD_DUMP_VALUES ) {
- ofd_prop_print("of_walk", path, name, prop, sz);
+ ofd_prop_print(pre, path, name, prop, sz);
}
p = ofd_nextprop(mem, n, name, name);
}
}
-void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg)
+void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
{
ofdn_t n;
if ( fn != NULL ) {
- (*fn)(m, p, arg);
+ (*fn)(m, pre, p, arg);
}
/* child */
n = ofd_node_child(m, p);
if ( n != 0 ) {
- ofd_walk(m, n, fn, arg);
+ ofd_walk(m, pre, n, fn, arg);
}
/* peer */
n = ofd_node_peer(m, p);
if ( n != 0 ) {
- ofd_walk(m, n, fn, arg);
+ ofd_walk(m, pre, n, fn, arg);
}
}
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/ofd_fixup.c Mon Nov 27 17:17:07 2006 -0500
@@ -427,7 +427,7 @@ int ofd_dom0_fixup(struct domain *d, ulo
#ifdef DEBUG
- ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+ ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
#endif
return 1;
}
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/setup.c Mon Nov 27 17:17:07 2006 -0500
@@ -123,9 +123,17 @@ void noinline __attn(void)
console_end_sync();
}
-static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+static void key_hw_probe_attn(unsigned char key)
{
__attn();
+}
+
+static void key_ofdump(unsigned char key)
+{
+ printk("ofdump:\n");
+ /* make sure the OF devtree is good */
+ ofd_walk((void *)oftree, "devtree", OFD_ROOT,
+ ofd_dump_props, OFD_DUMP_ALL);
}
static void percpu_init_areas(void)
@@ -178,7 +186,10 @@ static void __init start_of_day(void)
/* Register another key that will allow for the the Harware Probe
* to be contacted, this works with RiscWatch probes and should
* work with Chronos and FSPs */
- register_irq_keyhandler('^', hw_probe_attn, "Trap to Hardware Probe");
+ register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe");
+
+ /* allow the dumping of the devtree */
+ register_keyhandler('D', key_ofdump , "Dump OF Devtree");
timer_init();
serial_init_postirq();
@@ -331,9 +342,7 @@ static void __init __start_xen(multiboot
memory_init(mod, mbi->mods_count);
#ifdef OF_DEBUG
- printk("ofdump:\n");
- /* make sure the OF devtree is good */
- ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+ key_ofdump(0);
#endif
percpu_init_areas();
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|