ia64/xen-unstable

changeset 12968:b4594f072a89

[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@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Mon Nov 27 17:17:07 2006 -0500 (2006-11-27)
parents b5a89f01a440
children 768bf8f273fb
files xen/arch/powerpc/boot_of.c xen/arch/powerpc/of-devtree.h xen/arch/powerpc/of-devwalk.c xen/arch/powerpc/ofd_fixup.c xen/arch/powerpc/setup.c
line diff
     1.1 --- a/xen/arch/powerpc/boot_of.c	Mon Nov 27 16:14:07 2006 -0500
     1.2 +++ b/xen/arch/powerpc/boot_of.c	Mon Nov 27 17:17:07 2006 -0500
     1.3 @@ -1069,7 +1069,7 @@ static void * __init boot_of_devtree(mod
     1.4      if (ofd_size(oft) > oft_sz)
     1.5           of_panic("Could not fit all devtree fixups\n");
     1.6  
     1.7 -    ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
     1.8 +    ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
     1.9  
    1.10      mod->mod_start = (ulong)oft;
    1.11      mod->mod_end = mod->mod_start + oft_sz;
     2.1 --- a/xen/arch/powerpc/of-devtree.h	Mon Nov 27 16:14:07 2006 -0500
     2.2 +++ b/xen/arch/powerpc/of-devtree.h	Mon Nov 27 17:17:07 2006 -0500
     2.3 @@ -115,10 +115,10 @@ extern u32 ofd_io_open(void *mem, ofdn_t
     2.4  extern void ofd_io_close(void *mem, ofdn_t n);
     2.5  
     2.6  
     2.7 -typedef void (*walk_fn)(void *m, ofdn_t p, int arg);
     2.8 -extern void ofd_dump_props(void *m, ofdn_t p, int dump);
     2.9 +typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
    2.10 +extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
    2.11  
    2.12 -extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg);
    2.13 +extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
    2.14  
    2.15  
    2.16  /* Recursively look up #address_cells and #size_cells properties */
     3.1 --- a/xen/arch/powerpc/of-devwalk.c	Mon Nov 27 16:14:07 2006 -0500
     3.2 +++ b/xen/arch/powerpc/of-devwalk.c	Mon Nov 27 17:17:07 2006 -0500
     3.3 @@ -80,7 +80,7 @@ void ofd_prop_print(
     3.4  #endif
     3.5  }
     3.6  
     3.7 -void ofd_dump_props(void *mem, ofdn_t n, int dump)
     3.8 +void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
     3.9  {
    3.10      ofdn_t p;
    3.11      char name[128];
    3.12 @@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n,
    3.13      }
    3.14  
    3.15      if (dump & OFD_DUMP_NAMES) {
    3.16 -        printk("of_walk: %s: phandle 0x%x\n", path, n);
    3.17 +        printk("%s: %s: phandle 0x%x\n", pre, path, n);
    3.18      }
    3.19  
    3.20      p = ofd_nextprop(mem, n, NULL, name);
    3.21 @@ -106,30 +106,30 @@ void ofd_dump_props(void *mem, ofdn_t n,
    3.22          }
    3.23  
    3.24          if ( dump & OFD_DUMP_VALUES ) {
    3.25 -            ofd_prop_print("of_walk", path, name, prop, sz);
    3.26 +            ofd_prop_print(pre, path, name, prop, sz);
    3.27          }
    3.28  
    3.29          p = ofd_nextprop(mem, n, name, name);
    3.30      }
    3.31  }
    3.32  
    3.33 -void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg)
    3.34 +void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
    3.35  {
    3.36      ofdn_t n;
    3.37  
    3.38      if ( fn != NULL ) {
    3.39 -        (*fn)(m, p, arg);
    3.40 +        (*fn)(m, pre, p, arg);
    3.41      }
    3.42  
    3.43      /* child */
    3.44      n = ofd_node_child(m, p);
    3.45      if ( n != 0 ) {
    3.46 -        ofd_walk(m, n, fn, arg);
    3.47 +        ofd_walk(m, pre, n, fn, arg);
    3.48      }
    3.49  
    3.50      /* peer */
    3.51      n = ofd_node_peer(m, p);
    3.52      if ( n != 0 ) {
    3.53 -        ofd_walk(m, n, fn, arg);
    3.54 +        ofd_walk(m, pre, n, fn, arg);
    3.55      }
    3.56  }
     4.1 --- a/xen/arch/powerpc/ofd_fixup.c	Mon Nov 27 16:14:07 2006 -0500
     4.2 +++ b/xen/arch/powerpc/ofd_fixup.c	Mon Nov 27 17:17:07 2006 -0500
     4.3 @@ -427,7 +427,7 @@ int ofd_dom0_fixup(struct domain *d, ulo
     4.4  
     4.5  
     4.6  #ifdef DEBUG
     4.7 -    ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
     4.8 +    ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
     4.9  #endif
    4.10      return 1;
    4.11  }
     5.1 --- a/xen/arch/powerpc/setup.c	Mon Nov 27 16:14:07 2006 -0500
     5.2 +++ b/xen/arch/powerpc/setup.c	Mon Nov 27 17:17:07 2006 -0500
     5.3 @@ -125,11 +125,19 @@ void noinline __attn(void)
     5.4      console_end_sync();
     5.5  }
     5.6  
     5.7 -static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
     5.8 +static void key_hw_probe_attn(unsigned char key)
     5.9  {
    5.10      __attn();
    5.11  }
    5.12  
    5.13 +static void key_ofdump(unsigned char key)
    5.14 +{
    5.15 +    printk("ofdump:\n");
    5.16 +    /* make sure the OF devtree is good */
    5.17 +    ofd_walk((void *)oftree, "devtree", OFD_ROOT,
    5.18 +             ofd_dump_props, OFD_DUMP_ALL);
    5.19 +}
    5.20 +
    5.21  static void percpu_init_areas(void)
    5.22  {
    5.23      unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
    5.24 @@ -180,7 +188,10 @@ static void __init start_of_day(void)
    5.25      /* Register another key that will allow for the the Harware Probe
    5.26       * to be contacted, this works with RiscWatch probes and should
    5.27       * work with Chronos and FSPs */
    5.28 -    register_irq_keyhandler('^', hw_probe_attn,   "Trap to Hardware Probe");
    5.29 +    register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe");
    5.30 +
    5.31 +    /* allow the dumping of the devtree */
    5.32 +    register_keyhandler('D', key_ofdump , "Dump OF Devtree");
    5.33  
    5.34      timer_init();
    5.35      serial_init_postirq();
    5.36 @@ -318,9 +329,7 @@ static void __init __start_xen(multiboot
    5.37      memory_init(mod, mbi->mods_count);
    5.38  
    5.39  #ifdef OF_DEBUG
    5.40 -    printk("ofdump:\n");
    5.41 -    /* make sure the OF devtree is good */
    5.42 -    ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
    5.43 +    key_ofdump(0);
    5.44  #endif
    5.45      percpu_init_areas();
    5.46