irq.c (a3ea8e8f2474c35b4c3e22262991afddb93c4c0e) irq.c (476eb4912601a8c01e6702b9a029f476b4b131d2)
1/*
2 * Derived from arch/i386/kernel/irq.c
3 * Copyright (C) 1992 Linus Torvalds
4 * Adapted from arch/i386 by Gary Thomas
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
7 * Copyright (C) 1996-2001 Cort Dougan
8 * Adapted for Power Macintosh by Paul Mackerras

--- 383 unchanged lines hidden (view full) ---

392#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
393struct thread_info *critirq_ctx[NR_CPUS] __read_mostly;
394struct thread_info *dbgirq_ctx[NR_CPUS] __read_mostly;
395struct thread_info *mcheckirq_ctx[NR_CPUS] __read_mostly;
396
397void exc_lvl_ctx_init(void)
398{
399 struct thread_info *tp;
1/*
2 * Derived from arch/i386/kernel/irq.c
3 * Copyright (C) 1992 Linus Torvalds
4 * Adapted from arch/i386 by Gary Thomas
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
7 * Copyright (C) 1996-2001 Cort Dougan
8 * Adapted for Power Macintosh by Paul Mackerras

--- 383 unchanged lines hidden (view full) ---

392#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
393struct thread_info *critirq_ctx[NR_CPUS] __read_mostly;
394struct thread_info *dbgirq_ctx[NR_CPUS] __read_mostly;
395struct thread_info *mcheckirq_ctx[NR_CPUS] __read_mostly;
396
397void exc_lvl_ctx_init(void)
398{
399 struct thread_info *tp;
400 int i, hw_cpu;
400 int i, cpu_nr;
401
402 for_each_possible_cpu(i) {
401
402 for_each_possible_cpu(i) {
403 hw_cpu = get_hard_smp_processor_id(i);
404 memset((void *)critirq_ctx[hw_cpu], 0, THREAD_SIZE);
405 tp = critirq_ctx[hw_cpu];
406 tp->cpu = i;
403#ifdef CONFIG_PPC64
404 cpu_nr = i;
405#else
406 cpu_nr = get_hard_smp_processor_id(i);
407#endif
408 memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE);
409 tp = critirq_ctx[cpu_nr];
410 tp->cpu = cpu_nr;
407 tp->preempt_count = 0;
408
409#ifdef CONFIG_BOOKE
411 tp->preempt_count = 0;
412
413#ifdef CONFIG_BOOKE
410 memset((void *)dbgirq_ctx[hw_cpu], 0, THREAD_SIZE);
411 tp = dbgirq_ctx[hw_cpu];
412 tp->cpu = i;
414 memset((void *)dbgirq_ctx[cpu_nr], 0, THREAD_SIZE);
415 tp = dbgirq_ctx[cpu_nr];
416 tp->cpu = cpu_nr;
413 tp->preempt_count = 0;
414
417 tp->preempt_count = 0;
418
415 memset((void *)mcheckirq_ctx[hw_cpu], 0, THREAD_SIZE);
416 tp = mcheckirq_ctx[hw_cpu];
417 tp->cpu = i;
419 memset((void *)mcheckirq_ctx[cpu_nr], 0, THREAD_SIZE);
420 tp = mcheckirq_ctx[cpu_nr];
421 tp->cpu = cpu_nr;
418 tp->preempt_count = HARDIRQ_OFFSET;
419#endif
420 }
421}
422#endif
423
424struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
425struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;

--- 46 unchanged lines hidden (view full) ---

472 local_irq_restore(flags);
473}
474
475
476/*
477 * IRQ controller and virtual interrupts
478 */
479
422 tp->preempt_count = HARDIRQ_OFFSET;
423#endif
424 }
425}
426#endif
427
428struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
429struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;

--- 46 unchanged lines hidden (view full) ---

476 local_irq_restore(flags);
477}
478
479
480/*
481 * IRQ controller and virtual interrupts
482 */
483
484/* The main irq map itself is an array of NR_IRQ entries containing the
485 * associate host and irq number. An entry with a host of NULL is free.
486 * An entry can be allocated if it's free, the allocator always then sets
487 * hwirq first to the host's invalid irq number and then fills ops.
488 */
489struct irq_map_entry {
490 irq_hw_number_t hwirq;
491 struct irq_host *host;
492};
493
480static LIST_HEAD(irq_hosts);
481static DEFINE_RAW_SPINLOCK(irq_big_lock);
482static unsigned int revmap_trees_allocated;
483static DEFINE_MUTEX(revmap_trees_mutex);
494static LIST_HEAD(irq_hosts);
495static DEFINE_RAW_SPINLOCK(irq_big_lock);
496static unsigned int revmap_trees_allocated;
497static DEFINE_MUTEX(revmap_trees_mutex);
484struct irq_map_entry irq_map[NR_IRQS];
498static struct irq_map_entry irq_map[NR_IRQS];
485static unsigned int irq_virq_count = NR_IRQS;
486static struct irq_host *irq_default_host;
487
499static unsigned int irq_virq_count = NR_IRQS;
500static struct irq_host *irq_default_host;
501
502irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
503{
504 return irq_map[d->irq].hwirq;
505}
506EXPORT_SYMBOL_GPL(irqd_to_hwirq);
507
488irq_hw_number_t virq_to_hw(unsigned int virq)
489{
490 return irq_map[virq].hwirq;
491}
492EXPORT_SYMBOL_GPL(virq_to_hw);
493
508irq_hw_number_t virq_to_hw(unsigned int virq)
509{
510 return irq_map[virq].hwirq;
511}
512EXPORT_SYMBOL_GPL(virq_to_hw);
513
514struct irq_host *virq_to_host(unsigned int virq)
515{
516 return irq_map[virq].host;
517}
518EXPORT_SYMBOL_GPL(virq_to_host);
519
494static int default_irq_host_match(struct irq_host *h, struct device_node *np)
495{
496 return h->of_node != NULL && h->of_node == np;
497}
498
499struct irq_host *irq_alloc_host(struct device_node *of_node,
500 unsigned int revmap_type,
501 unsigned int revmap_arg,

--- 575 unchanged lines hidden (view full) ---

1077
1078#ifdef CONFIG_VIRQ_DEBUG
1079static int virq_debug_show(struct seq_file *m, void *private)
1080{
1081 unsigned long flags;
1082 struct irq_desc *desc;
1083 const char *p;
1084 static const char none[] = "none";
520static int default_irq_host_match(struct irq_host *h, struct device_node *np)
521{
522 return h->of_node != NULL && h->of_node == np;
523}
524
525struct irq_host *irq_alloc_host(struct device_node *of_node,
526 unsigned int revmap_type,
527 unsigned int revmap_arg,

--- 575 unchanged lines hidden (view full) ---

1103
1104#ifdef CONFIG_VIRQ_DEBUG
1105static int virq_debug_show(struct seq_file *m, void *private)
1106{
1107 unsigned long flags;
1108 struct irq_desc *desc;
1109 const char *p;
1110 static const char none[] = "none";
1111 void *data;
1085 int i;
1086
1112 int i;
1113
1087 seq_printf(m, "%-5s %-7s %-15s %s\n", "virq", "hwirq",
1088 "chip name", "host name");
1114 seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq",
1115 "chip name", "chip data", "host name");
1089
1090 for (i = 1; i < nr_irqs; i++) {
1091 desc = irq_to_desc(i);
1092 if (!desc)
1093 continue;
1094
1095 raw_spin_lock_irqsave(&desc->lock, flags);
1096
1097 if (desc->action && desc->action->handler) {
1098 struct irq_chip *chip;
1099
1100 seq_printf(m, "%5d ", i);
1116
1117 for (i = 1; i < nr_irqs; i++) {
1118 desc = irq_to_desc(i);
1119 if (!desc)
1120 continue;
1121
1122 raw_spin_lock_irqsave(&desc->lock, flags);
1123
1124 if (desc->action && desc->action->handler) {
1125 struct irq_chip *chip;
1126
1127 seq_printf(m, "%5d ", i);
1101 seq_printf(m, "0x%05lx ", virq_to_hw(i));
1128 seq_printf(m, "0x%05lx ", irq_map[i].hwirq);
1102
1103 chip = irq_desc_get_chip(desc);
1104 if (chip && chip->name)
1105 p = chip->name;
1106 else
1107 p = none;
1108 seq_printf(m, "%-15s ", p);
1109
1129
1130 chip = irq_desc_get_chip(desc);
1131 if (chip && chip->name)
1132 p = chip->name;
1133 else
1134 p = none;
1135 seq_printf(m, "%-15s ", p);
1136
1137 data = irq_desc_get_chip_data(desc);
1138 seq_printf(m, "0x%16p ", data);
1139
1110 if (irq_map[i].host && irq_map[i].host->of_node)
1111 p = irq_map[i].host->of_node->full_name;
1112 else
1113 p = none;
1114 seq_printf(m, "%s\n", p);
1115 }
1116
1117 raw_spin_unlock_irqrestore(&desc->lock, flags);

--- 37 unchanged lines hidden ---
1140 if (irq_map[i].host && irq_map[i].host->of_node)
1141 p = irq_map[i].host->of_node->full_name;
1142 else
1143 p = none;
1144 seq_printf(m, "%s\n", p);
1145 }
1146
1147 raw_spin_unlock_irqrestore(&desc->lock, flags);

--- 37 unchanged lines hidden ---