aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/irq.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-08-28 04:47:57 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-13 11:33:20 -0400
commit60b332e755da7dbf32f1660973ce4f97ebf05d05 (patch)
tree0f13a0e4c80b668c386cbb5a3766cb607e8166f8 /arch/powerpc/kernel/irq.c
parent7866291d4cabf5491d4ecb62787308f8b8958f59 (diff)
[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 <wei.zhang@freescale.com> Signed-off-by: Chen Gong <G.Chen@freescale.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r--arch/powerpc/kernel/irq.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1339f32b44b5..0e47c8cfc979 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -52,6 +52,7 @@
52#include <linux/mutex.h> 52#include <linux/mutex.h>
53#include <linux/bootmem.h> 53#include <linux/bootmem.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/debugfs.h>
55 56
56#include <asm/uaccess.h> 57#include <asm/uaccess.h>
57#include <asm/system.h> 58#include <asm/system.h>
@@ -1006,6 +1007,68 @@ static int irq_late_init(void)
1006} 1007}
1007arch_initcall(irq_late_init); 1008arch_initcall(irq_late_init);
1008 1009
1010#ifdef CONFIG_VIRQ_DEBUG
1011static int virq_debug_show(struct seq_file *m, void *private)
1012{
1013 unsigned long flags;
1014 irq_desc_t *desc;
1015 const char *p;
1016 char none[] = "none";
1017 int i;
1018
1019 seq_printf(m, "%-5s %-7s %-15s %s\n", "virq", "hwirq",
1020 "chip name", "host name");
1021
1022 for (i = 1; i < NR_IRQS; i++) {
1023 desc = get_irq_desc(i);
1024 spin_lock_irqsave(&desc->lock, flags);
1025
1026 if (desc->action && desc->action->handler) {
1027 seq_printf(m, "%5d ", i);
1028 seq_printf(m, "0x%05lx ", virq_to_hw(i));
1029
1030 if (desc->chip && desc->chip->typename)
1031 p = desc->chip->typename;
1032 else
1033 p = none;
1034 seq_printf(m, "%-15s ", p);
1035
1036 if (irq_map[i].host && irq_map[i].host->of_node)
1037 p = irq_map[i].host->of_node->full_name;
1038 else
1039 p = none;
1040 seq_printf(m, "%s\n", p);
1041 }
1042
1043 spin_unlock_irqrestore(&desc->lock, flags);
1044 }
1045
1046 return 0;
1047}
1048
1049static int virq_debug_open(struct inode *inode, struct file *file)
1050{
1051 return single_open(file, virq_debug_show, inode->i_private);
1052}
1053
1054static const struct file_operations virq_debug_fops = {
1055 .open = virq_debug_open,
1056 .read = seq_read,
1057 .llseek = seq_lseek,
1058 .release = single_release,
1059};
1060
1061static int __init irq_debugfs_init(void)
1062{
1063 if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
1064 NULL, &virq_debug_fops))
1065 return -ENOMEM;
1066
1067 return 0;
1068}
1069__initcall(irq_debugfs_init);
1070#endif /* CONFIG_VIRQ_DEBUG */
1071
1009#endif /* CONFIG_PPC_MERGE */ 1072#endif /* CONFIG_PPC_MERGE */
1010 1073
1011#ifdef CONFIG_PPC64 1074#ifdef CONFIG_PPC64