# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID b4594f072a893c0f3d3d20a4315c847b74bbac25
# Parent b5a89f01a4402eb0d47878d23707a84f595419c5
[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>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
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 b5a89f01a440 -r b4594f072a89 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 b5a89f01a440 -r b4594f072a89 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 b5a89f01a440 -r b4594f072a89 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 b5a89f01a440 -r b4594f072a89 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 b5a89f01a440 -r b4594f072a89 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
@@ -125,9 +125,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)
@@ -180,7 +188,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();
@@ -318,9 +329,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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|