2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c:
5 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
8 #include "linux/config.h"
9 #include "linux/kernel.h"
10 #include "linux/module.h"
11 #include "linux/smp.h"
12 #include "linux/irq.h"
13 #include "linux/kernel_stat.h"
14 #include "linux/interrupt.h"
15 #include "linux/random.h"
16 #include "linux/slab.h"
17 #include "linux/file.h"
18 #include "linux/proc_fs.h"
19 #include "linux/init.h"
20 #include "linux/seq_file.h"
21 #include "linux/profile.h"
22 #include "linux/hardirq.h"
24 #include "asm/hw_irq.h"
25 #include "asm/atomic.h"
26 #include "asm/signal.h"
27 #include "asm/system.h"
28 #include "asm/errno.h"
29 #include "asm/uaccess.h"
30 #include "user_util.h"
31 #include "kern_util.h"
37 * Generic, controller-independent functions:
40 int show_interrupts(struct seq_file *p, void *v)
42 int i = *(loff_t *) v, j;
43 struct irqaction * action;
48 for (j=0; j<NR_CPUS; j++)
50 seq_printf(p, "CPU%d ",j);
55 spin_lock_irqsave(&irq_desc[i].lock, flags);
56 action = irq_desc[i].action;
59 seq_printf(p, "%3d: ",i);
61 seq_printf(p, "%10u ", kstat_irqs(i));
63 for (j = 0; j < NR_CPUS; j++)
65 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
67 seq_printf(p, " %14s", irq_desc[i].handler->typename);
68 seq_printf(p, " %s", action->name);
70 for (action=action->next; action; action = action->next)
71 seq_printf(p, ", %s", action->name);
75 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
76 } else if (i == NR_IRQS) {
84 * do_IRQ handles all normal device IRQ's (the special
85 * SMP cross-CPU interrupts have their own specific
88 unsigned int do_IRQ(int irq, union uml_pt_regs *regs)
91 __do_IRQ(irq, (struct pt_regs *) regs);
96 int um_request_irq(unsigned int irq, int fd, int type,
97 irqreturn_t (*handler)(int, void *, struct pt_regs *),
98 unsigned long irqflags, const char * devname,
103 err = request_irq(irq, handler, irqflags, devname, dev_id);
108 err = activate_fd(irq, fd, type, dev_id);
111 EXPORT_SYMBOL(um_request_irq);
112 EXPORT_SYMBOL(reactivate_fd);
114 static spinlock_t irq_spinlock = SPIN_LOCK_UNLOCKED;
116 unsigned long irq_lock(void)
120 spin_lock_irqsave(&irq_spinlock, flags);
124 void irq_unlock(unsigned long flags)
126 spin_unlock_irqrestore(&irq_spinlock, flags);
129 /* presently hw_interrupt_type must define (startup || enable) &&
131 static void dummy(unsigned int irq)
135 static struct hw_interrupt_type SIGIO_irq_type = {
143 static struct hw_interrupt_type SIGVTALRM_irq_type = {
144 .typename = "SIGVTALRM",
145 .shutdown = dummy, /* never called */
152 void __init init_IRQ(void)
156 irq_desc[TIMER_IRQ].status = IRQ_DISABLED;
157 irq_desc[TIMER_IRQ].action = 0;
158 irq_desc[TIMER_IRQ].depth = 1;
159 irq_desc[TIMER_IRQ].handler = &SIGVTALRM_irq_type;
160 enable_irq(TIMER_IRQ);
161 for(i=1;i<NR_IRQS;i++){
162 irq_desc[i].status = IRQ_DISABLED;
163 irq_desc[i].action = 0;
164 irq_desc[i].depth = 1;
165 irq_desc[i].handler = &SIGIO_irq_type;
172 * Overrides for Emacs so that we follow Linus's tabbing style.
173 * Emacs will notice this stuff at the end of the file and automatically
174 * adjust the settings for this buffer only. This must remain at the end
176 * ---------------------------------------------------------------------------
178 * c-file-style: "linux"