Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=60b332e755da7dbf32f1660973ce4f97ebf05d05
Commit:     60b332e755da7dbf32f1660973ce4f97ebf05d05
Parent:     7866291d4cabf5491d4ecb62787308f8b8958f59
Author:     Michael Ellerman <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 28 18:47:57 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Fri Sep 14 01:33:20 2007 +1000

    [POWERPC] Export virq mapping via debugfs
    
    This adds a debugfs file "powerpc/virq_mapping", which shows the virtual
    to real mapping of irq numbers.  Enable it with CONFIG_VIRQ_DEBUG.
    
    Signed-off-by: Zhang Wei <[EMAIL PROTECTED]>
    Signed-off-by: Chen Gong <[EMAIL PROTECTED]>
    Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig.debug |   10 +++++++
 arch/powerpc/kernel/irq.c  |   63 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 22acece..c38bc22 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -124,6 +124,16 @@ config IRQSTACKS
          for handling hard and soft interrupts.  This can help avoid
          overflowing the process kernel stacks.
 
+config VIRQ_DEBUG
+       bool "Expose hardware/virtual IRQ mapping via debugfs"
+       depends on DEBUG_FS && PPC_MERGE
+       help
+         This option will show the mapping relationship between hardware irq
+         numbers and virtual irq numbers. The mapping is exposed via debugfs
+         in the file powerpc/virq_mapping.
+
+         If you don't know what this means you don't need it.
+
 config BDI_SWITCH
        bool "Include BDI-2000 user context switcher"
        depends on DEBUG_KERNEL && PPC32
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1339f32..0e47c8c 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -52,6 +52,7 @@
 #include <linux/mutex.h>
 #include <linux/bootmem.h>
 #include <linux/pci.h>
+#include <linux/debugfs.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -1006,6 +1007,68 @@ static int irq_late_init(void)
 }
 arch_initcall(irq_late_init);
 
+#ifdef CONFIG_VIRQ_DEBUG
+static int virq_debug_show(struct seq_file *m, void *private)
+{
+       unsigned long flags;
+       irq_desc_t *desc;
+       const char *p;
+       char none[] = "none";
+       int i;
+
+       seq_printf(m, "%-5s  %-7s  %-15s  %s\n", "virq", "hwirq",
+                     "chip name", "host name");
+
+       for (i = 1; i < NR_IRQS; i++) {
+               desc = get_irq_desc(i);
+               spin_lock_irqsave(&desc->lock, flags);
+
+               if (desc->action && desc->action->handler) {
+                       seq_printf(m, "%5d  ", i);
+                       seq_printf(m, "0x%05lx  ", virq_to_hw(i));
+
+                       if (desc->chip && desc->chip->typename)
+                               p = desc->chip->typename;
+                       else
+                               p = none;
+                       seq_printf(m, "%-15s  ", p);
+
+                       if (irq_map[i].host && irq_map[i].host->of_node)
+                               p = irq_map[i].host->of_node->full_name;
+                       else
+                               p = none;
+                       seq_printf(m, "%s\n", p);
+               }
+
+               spin_unlock_irqrestore(&desc->lock, flags);
+       }
+
+       return 0;
+}
+
+static int virq_debug_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, virq_debug_show, inode->i_private);
+}
+
+static const struct file_operations virq_debug_fops = {
+       .open = virq_debug_open,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
+};
+
+static int __init irq_debugfs_init(void)
+{
+       if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
+                                NULL, &virq_debug_fops))
+               return -ENOMEM;
+
+       return 0;
+}
+__initcall(irq_debugfs_init);
+#endif /* CONFIG_VIRQ_DEBUG */
+
 #endif /* CONFIG_PPC_MERGE */
 
 #ifdef CONFIG_PPC64
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to