ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / kernel / irq.c
1 /* 
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
6  */
7
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 "asm/irq.h"
22 #include "asm/hw_irq.h"
23 #include "asm/hardirq.h"
24 #include "asm/atomic.h"
25 #include "asm/signal.h"
26 #include "asm/system.h"
27 #include "asm/errno.h"
28 #include "asm/uaccess.h"
29 #include "user_util.h"
30 #include "kern_util.h"
31 #include "irq_user.h"
32
33 static void register_irq_proc (unsigned int irq);
34
35 irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
36         [0 ... NR_IRQS-1] = {
37                 .handler = &no_irq_type,
38                 .lock = SPIN_LOCK_UNLOCKED
39         }
40 };
41
42 /*
43  * Generic no controller code
44  */
45
46 static void enable_none(unsigned int irq) { }
47 static unsigned int startup_none(unsigned int irq) { return 0; }
48 static void disable_none(unsigned int irq) { }
49 static void ack_none(unsigned int irq)
50 {
51 /*
52  * 'what should we do if we get a hw irq event on an illegal vector'.
53  * each architecture has to answer this themselves, it doesn't deserve
54  * a generic callback i think.
55  */
56 #ifdef CONFIG_X86
57         printk(KERN_ERR "unexpected IRQ trap at vector %02x\n", irq);
58 #ifdef CONFIG_X86_LOCAL_APIC
59         /*
60          * Currently unexpected vectors happen only on SMP and APIC.
61          * We _must_ ack these because every local APIC has only N
62          * irq slots per priority level, and a 'hanging, unacked' IRQ
63          * holds up an irq slot - in excessive cases (when multiple
64          * unexpected vectors occur) that might lock up the APIC
65          * completely.
66          */
67         ack_APIC_irq();
68 #endif
69 #endif
70 }
71
72 /* startup is the same as "enable", shutdown is same as "disable" */
73 #define shutdown_none   disable_none
74 #define end_none        enable_none
75
76 struct hw_interrupt_type no_irq_type = {
77         "none",
78         startup_none,
79         shutdown_none,
80         enable_none,
81         disable_none,
82         ack_none,
83         end_none
84 };
85
86 /* Not changed */
87 volatile unsigned long irq_err_count;
88
89 /*
90  * Generic, controller-independent functions:
91  */
92
93 int get_irq_list(char *buf)
94 {
95         int i, j;
96         unsigned long flags;
97         struct irqaction * action;
98         char *p = buf;
99
100         p += sprintf(p, "           ");
101         for (j=0; j<num_online_cpus(); j++)
102                 p += sprintf(p, "CPU%d       ",j);
103         *p++ = '\n';
104
105         for (i = 0 ; i < NR_IRQS ; i++) {
106                 spin_lock_irqsave(&irq_desc[i].lock, flags);
107                 action = irq_desc[i].action;
108                 if (!action) 
109                         goto end;
110                 p += sprintf(p, "%3d: ",i);
111 #ifndef CONFIG_SMP
112                 p += sprintf(p, "%10u ", kstat_irqs(i));
113 #else
114                 for (j = 0; j < num_online_cpus(); j++)
115                         p += sprintf(p, "%10u ",
116                                 kstat_cpu(cpu_logical_map(j)).irqs[i]);
117 #endif
118                 p += sprintf(p, " %14s", irq_desc[i].handler->typename);
119                 p += sprintf(p, "  %s", action->name);
120
121                 for (action=action->next; action; action = action->next)
122                         p += sprintf(p, ", %s", action->name);
123                 *p++ = '\n';
124         end:
125                 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
126         }
127         p += sprintf(p, "\n");
128 #ifdef notdef
129 #ifdef CONFIG_SMP
130         p += sprintf(p, "LOC: ");
131         for (j = 0; j < num_online_cpus(); j++)
132                 p += sprintf(p, "%10u ",
133                         apic_timer_irqs[cpu_logical_map(j)]);
134         p += sprintf(p, "\n");
135 #endif
136 #endif
137         p += sprintf(p, "ERR: %10lu\n", irq_err_count);
138         return p - buf;
139 }
140
141
142 int show_interrupts(struct seq_file *p, void *v)
143 {
144         return(0);
145 }
146
147 /*
148  * This should really return information about whether
149  * we should do bottom half handling etc. Right now we
150  * end up _always_ checking the bottom half, which is a
151  * waste of time and is not what some drivers would
152  * prefer.
153  */
154 int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, 
155                      struct irqaction * action)
156 {
157         int status = 1; /* Force the "do bottom halves" bit */
158
159         if (!(action->flags & SA_INTERRUPT))
160                 local_irq_enable();
161
162         do {
163                 status |= action->flags;
164                 action->handler(irq, action->dev_id, regs);
165                 action = action->next;
166         } while (action);
167         if (status & SA_SAMPLE_RANDOM)
168                 add_interrupt_randomness(irq);
169
170         local_irq_disable();
171
172         return status;
173 }
174
175 /*
176  * Generic enable/disable code: this just calls
177  * down into the PIC-specific version for the actual
178  * hardware disable after having gotten the irq
179  * controller lock. 
180  */
181  
182 /**
183  *      disable_irq_nosync - disable an irq without waiting
184  *      @irq: Interrupt to disable
185  *
186  *      Disable the selected interrupt line. Disables of an interrupt
187  *      stack. Unlike disable_irq(), this function does not ensure existing
188  *      instances of the IRQ handler have completed before returning.
189  *
190  *      This function may be called from IRQ context.
191  */
192  
193 inline void disable_irq_nosync(unsigned int irq)
194 {
195         irq_desc_t *desc = irq_desc + irq;
196         unsigned long flags;
197
198         spin_lock_irqsave(&desc->lock, flags);
199         if (!desc->depth++) {
200                 desc->status |= IRQ_DISABLED;
201                 desc->handler->disable(irq);
202         }
203         spin_unlock_irqrestore(&desc->lock, flags);
204 }
205
206 #ifdef CONFIG_SMP
207 inline void synchronize_irq(unsigned int irq)
208 {
209         /* is there anything to synchronize with? */
210         if (!irq_desc[irq].action)
211                 return;
212  
213         while (irq_desc[irq].status & IRQ_INPROGRESS)
214                 cpu_relax();
215 }
216 #endif
217
218 /**
219  *      disable_irq - disable an irq and wait for completion
220  *      @irq: Interrupt to disable
221  *
222  *      Disable the selected interrupt line. Disables of an interrupt
223  *      stack. That is for two disables you need two enables. This
224  *      function waits for any pending IRQ handlers for this interrupt
225  *      to complete before returning. If you use this function while
226  *      holding a resource the IRQ handler may need you will deadlock.
227  *
228  *      This function may be called - with care - from IRQ context.
229  */
230  
231 void disable_irq(unsigned int irq)
232 {
233         disable_irq_nosync(irq);
234         synchronize_irq(irq);
235 }
236
237 /**
238  *      enable_irq - enable interrupt handling on an irq
239  *      @irq: Interrupt to enable
240  *
241  *      Re-enables the processing of interrupts on this IRQ line
242  *      providing no disable_irq calls are now in effect.
243  *
244  *      This function may be called from IRQ context.
245  */
246  
247 void enable_irq(unsigned int irq)
248 {
249         irq_desc_t *desc = irq_desc + irq;
250         unsigned long flags;
251
252         spin_lock_irqsave(&desc->lock, flags);
253         switch (desc->depth) {
254         case 1: {
255                 unsigned int status = desc->status & ~IRQ_DISABLED;
256                 desc->status = status;
257                 if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
258                         desc->status = status | IRQ_REPLAY;
259                         hw_resend_irq(desc->handler,irq);
260                 }
261                 desc->handler->enable(irq);
262                 /* fall-through */
263         }
264         default:
265                 desc->depth--;
266                 break;
267         case 0:
268                 printk(KERN_ERR "enable_irq() unbalanced from %p\n",
269                        __builtin_return_address(0));
270         }
271         spin_unlock_irqrestore(&desc->lock, flags);
272 }
273
274 /*
275  * do_IRQ handles all normal device IRQ's (the special
276  * SMP cross-CPU interrupts have their own specific
277  * handlers).
278  */
279 unsigned int do_IRQ(int irq, union uml_pt_regs *regs)
280 {       
281         /* 
282          * 0 return value means that this irq is already being
283          * handled by some other CPU. (or is disabled)
284          */
285         int cpu = smp_processor_id();
286         irq_desc_t *desc = irq_desc + irq;
287         struct irqaction * action;
288         unsigned int status;
289
290         irq_enter();
291         kstat_cpu(cpu).irqs[irq]++;
292         spin_lock(&desc->lock);
293         desc->handler->ack(irq);
294         /*
295            REPLAY is when Linux resends an IRQ that was dropped earlier
296            WAITING is used by probe to mark irqs that are being tested
297            */
298         status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
299         status |= IRQ_PENDING; /* we _want_ to handle it */
300
301         /*
302          * If the IRQ is disabled for whatever reason, we cannot
303          * use the action we have.
304          */
305         action = NULL;
306         if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
307                 action = desc->action;
308                 status &= ~IRQ_PENDING; /* we commit to handling */
309                 status |= IRQ_INPROGRESS; /* we are handling it */
310         }
311         desc->status = status;
312
313         /*
314          * If there is no IRQ handler or it was disabled, exit early.
315            Since we set PENDING, if another processor is handling
316            a different instance of this same irq, the other processor
317            will take care of it.
318          */
319         if (!action)
320                 goto out;
321
322         /*
323          * Edge triggered interrupts need to remember
324          * pending events.
325          * This applies to any hw interrupts that allow a second
326          * instance of the same irq to arrive while we are in do_IRQ
327          * or in the handler. But the code here only handles the _second_
328          * instance of the irq, not the third or fourth. So it is mostly
329          * useful for irq hardware that does not mask cleanly in an
330          * SMP environment.
331          */
332         for (;;) {
333                 spin_unlock(&desc->lock);
334                 handle_IRQ_event(irq, (struct pt_regs *) regs, action);
335                 spin_lock(&desc->lock);
336                 
337                 if (!(desc->status & IRQ_PENDING))
338                         break;
339                 desc->status &= ~IRQ_PENDING;
340         }
341         desc->status &= ~IRQ_INPROGRESS;
342 out:
343         /*
344          * The ->end() handler has to deal with interrupts which got
345          * disabled while the handler was running.
346          */
347         desc->handler->end(irq);
348         spin_unlock(&desc->lock);
349
350         irq_exit();
351
352         return 1;
353 }
354
355 /**
356  *      request_irq - allocate an interrupt line
357  *      @irq: Interrupt line to allocate
358  *      @handler: Function to be called when the IRQ occurs
359  *      @irqflags: Interrupt type flags
360  *      @devname: An ascii name for the claiming device
361  *      @dev_id: A cookie passed back to the handler function
362  *
363  *      This call allocates interrupt resources and enables the
364  *      interrupt line and IRQ handling. From the point this
365  *      call is made your handler function may be invoked. Since
366  *      your handler function must clear any interrupt the board 
367  *      raises, you must take care both to initialise your hardware
368  *      and to set up the interrupt handler in the right order.
369  *
370  *      Dev_id must be globally unique. Normally the address of the
371  *      device data structure is used as the cookie. Since the handler
372  *      receives this value it makes sense to use it.
373  *
374  *      If your interrupt is shared you must pass a non NULL dev_id
375  *      as this is required when freeing the interrupt.
376  *
377  *      Flags:
378  *
379  *      SA_SHIRQ                Interrupt is shared
380  *
381  *      SA_INTERRUPT            Disable local interrupts while processing
382  *
383  *      SA_SAMPLE_RANDOM        The interrupt can be used for entropy
384  *
385  */
386  
387 int request_irq(unsigned int irq,
388                 void (*handler)(int, void *, struct pt_regs *),
389                 unsigned long irqflags, 
390                 const char * devname,
391                 void *dev_id)
392 {
393         int retval;
394         struct irqaction * action;
395
396 #if 1
397         /*
398          * Sanity-check: shared interrupts should REALLY pass in
399          * a real dev-ID, otherwise we'll have trouble later trying
400          * to figure out which interrupt is which (messes up the
401          * interrupt freeing logic etc).
402          */
403         if (irqflags & SA_SHIRQ) {
404                 if (!dev_id)
405                         printk(KERN_ERR "Bad boy: %s (at 0x%x) called us "
406                                "without a dev_id!\n", devname, (&irq)[-1]);
407         }
408 #endif
409
410         if (irq >= NR_IRQS)
411                 return -EINVAL;
412         if (!handler)
413                 return -EINVAL;
414
415         action = (struct irqaction *)
416                         kmalloc(sizeof(struct irqaction), GFP_KERNEL);
417         if (!action)
418                 return -ENOMEM;
419
420         action->handler = handler;
421         action->flags = irqflags;
422         action->mask = 0;
423         action->name = devname;
424         action->next = NULL;
425         action->dev_id = dev_id;
426
427         retval = setup_irq(irq, action);
428         if (retval)
429                 kfree(action);
430         return retval;
431 }
432
433 EXPORT_SYMBOL(request_irq);
434
435 int um_request_irq(unsigned int irq, int fd, int type,
436                    void (*handler)(int, void *, struct pt_regs *),
437                    unsigned long irqflags, const char * devname,
438                    void *dev_id)
439 {
440         int retval;
441
442         retval = request_irq(irq, handler, irqflags, devname, dev_id);
443         if(retval) return(retval);
444         return(activate_fd(irq, fd, type, dev_id));
445 }
446
447 /* this was setup_x86_irq but it seems pretty generic */
448 int setup_irq(unsigned int irq, struct irqaction * new)
449 {
450         int shared = 0;
451         unsigned long flags;
452         struct irqaction *old, **p;
453         irq_desc_t *desc = irq_desc + irq;
454
455         /*
456          * Some drivers like serial.c use request_irq() heavily,
457          * so we have to be careful not to interfere with a
458          * running system.
459          */
460         if (new->flags & SA_SAMPLE_RANDOM) {
461                 /*
462                  * This function might sleep, we want to call it first,
463                  * outside of the atomic block.
464                  * Yes, this might clear the entropy pool if the wrong
465                  * driver is attempted to be loaded, without actually
466                  * installing a new handler, but is this really a problem,
467                  * only the sysadmin is able to do this.
468                  */
469                 rand_initialize_irq(irq);
470         }
471
472         /*
473          * The following block of code has to be executed atomically
474          */
475         spin_lock_irqsave(&desc->lock,flags);
476         p = &desc->action;
477         if ((old = *p) != NULL) {
478                 /* Can't share interrupts unless both agree to */
479                 if (!(old->flags & new->flags & SA_SHIRQ)) {
480                         spin_unlock_irqrestore(&desc->lock,flags);
481                         return -EBUSY;
482                 }
483
484                 /* add new interrupt at end of irq queue */
485                 do {
486                         p = &old->next;
487                         old = *p;
488                 } while (old);
489                 shared = 1;
490         }
491
492         *p = new;
493
494         if (!shared) {
495                 desc->depth = 0;
496                 desc->status &= ~IRQ_DISABLED;
497                 desc->handler->startup(irq);
498         }
499         spin_unlock_irqrestore(&desc->lock,flags);
500
501         register_irq_proc(irq);
502         return 0;
503 }
504
505 /**
506  *      free_irq - free an interrupt
507  *      @irq: Interrupt line to free
508  *      @dev_id: Device identity to free
509  *
510  *      Remove an interrupt handler. The handler is removed and if the
511  *      interrupt line is no longer in use by any driver it is disabled.
512  *      On a shared IRQ the caller must ensure the interrupt is disabled
513  *      on the card it drives before calling this function. The function
514  *      does not return until any executing interrupts for this IRQ
515  *      have completed.
516  *
517  *      This function may be called from interrupt context. 
518  *
519  *      Bugs: Attempting to free an irq in a handler for the same irq hangs
520  *            the machine.
521  */
522  
523 void free_irq(unsigned int irq, void *dev_id)
524 {
525         irq_desc_t *desc;
526         struct irqaction **p;
527         unsigned long flags;
528
529         if (irq >= NR_IRQS)
530                 return;
531
532         desc = irq_desc + irq;
533         spin_lock_irqsave(&desc->lock,flags);
534         p = &desc->action;
535         for (;;) {
536                 struct irqaction * action = *p;
537                 if (action) {
538                         struct irqaction **pp = p;
539                         p = &action->next;
540                         if (action->dev_id != dev_id)
541                                 continue;
542
543                         /* Found it - now remove it from the list of entries */
544                         *pp = action->next;
545                         if (!desc->action) {
546                                 desc->status |= IRQ_DISABLED;
547                                 desc->handler->shutdown(irq);
548                         }
549                         free_irq_by_irq_and_dev(irq, dev_id);
550                         spin_unlock_irqrestore(&desc->lock,flags);
551
552                         /* Wait to make sure it's not being used on another CPU */
553                         synchronize_irq(irq);
554                         kfree(action);
555                         return;
556                 }
557                 printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
558                 spin_unlock_irqrestore(&desc->lock,flags);
559                 return;
560         }
561 }
562
563 EXPORT_SYMBOL(free_irq);
564
565 /* These are initialized by sysctl_init, which is called from init/main.c */
566 static struct proc_dir_entry * root_irq_dir;
567 static struct proc_dir_entry * irq_dir [NR_IRQS];
568 static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
569
570 /* These are read and written as longs, so a read won't see a partial write
571  * even during a race.
572  */
573 static cpumask_t irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
574
575 static int irq_affinity_read_proc (char *page, char **start, off_t off,
576                         int count, int *eof, void *data)
577 {
578         int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
579         if (count - len < 2)
580                 return -EINVAL;
581         len += sprintf(page + len, "\n");
582         return len;
583 }
584
585 static int irq_affinity_write_proc (struct file *file, const char *buffer,
586                                         unsigned long count, void *data)
587 {
588         int irq = (long) data, full_count = count, err;
589         cpumask_t new_value, tmp;
590
591         if (!irq_desc[irq].handler->set_affinity)
592                 return -EIO;
593
594         err = cpumask_parse(buffer, count, new_value);
595
596 #ifdef CONFIG_SMP
597         /*
598          * Do not allow disabling IRQs completely - it's a too easy
599          * way to make the system unusable accidentally :-) At least
600          * one online CPU still has to be targeted.
601          */
602         cpus_and(tmp, new_value, cpu_online_map);
603         if (cpus_empty(tmp))
604                 return -EINVAL;
605 #endif
606
607         irq_affinity[irq] = new_value;
608         irq_desc[irq].handler->set_affinity(irq, new_value);
609
610         return full_count;
611 }
612
613 static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
614                         int count, int *eof, void *data)
615 {
616         int len = cpumask_scnprintf(page, count, *(cpumask_t *)data);
617         if (count - len < 2)
618                 return -EINVAL;
619         len += sprintf(page + len, "\n");
620         return len;
621 }
622
623 static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
624                                         unsigned long count, void *data)
625 {
626         cpumask_t *mask = (cpumask_t *)data, new_value;
627         unsigned long full_count = count, err;
628
629         err = cpumask_parse(buffer, count, new_value);
630         if (err)
631                 return err;
632
633         *mask = new_value;
634         return full_count;
635 }
636
637 #define MAX_NAMELEN 10
638
639 static void register_irq_proc (unsigned int irq)
640 {
641         struct proc_dir_entry *entry;
642         char name [MAX_NAMELEN];
643
644         if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) ||
645             irq_dir[irq])
646                 return;
647
648         memset(name, 0, MAX_NAMELEN);
649         sprintf(name, "%d", irq);
650
651         /* create /proc/irq/1234 */
652         irq_dir[irq] = proc_mkdir(name, root_irq_dir);
653
654         /* create /proc/irq/1234/smp_affinity */
655         entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]);
656
657         entry->nlink = 1;
658         entry->data = (void *)(long)irq;
659         entry->read_proc = irq_affinity_read_proc;
660         entry->write_proc = irq_affinity_write_proc;
661
662         smp_affinity_entry[irq] = entry;
663 }
664
665 /* Read and written as a long */
666 cpumask_t prof_cpu_mask = CPU_MASK_ALL;
667
668 void __init init_irq_proc (void)
669 {
670         struct proc_dir_entry *entry;
671         int i;
672
673         /* create /proc/irq */
674         root_irq_dir = proc_mkdir("irq", 0);
675
676         /* create /proc/irq/prof_cpu_mask */
677         entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
678
679         entry->nlink = 1;
680         entry->data = (void *)&prof_cpu_mask;
681         entry->read_proc = prof_cpu_mask_read_proc;
682         entry->write_proc = prof_cpu_mask_write_proc;
683
684         /*
685          * Create entries for all existing IRQs.
686          */
687         for (i = 0; i < NR_IRQS; i++)
688                 register_irq_proc(i);
689 }
690
691 static spinlock_t irq_spinlock = SPIN_LOCK_UNLOCKED;
692
693 unsigned long irq_lock(void)
694 {
695         unsigned long flags;
696
697         spin_lock_irqsave(&irq_spinlock, flags);
698         return(flags);
699 }
700
701 void irq_unlock(unsigned long flags)
702 {
703         spin_unlock_irqrestore(&irq_spinlock, flags);
704 }
705
706 unsigned long probe_irq_on(void)
707 {
708         return(0);
709 }
710
711 EXPORT_SYMBOL(probe_irq_on);
712
713 int probe_irq_off(unsigned long val)
714 {
715         return(0);
716 }
717
718 EXPORT_SYMBOL(probe_irq_off);
719
720 static unsigned int startup_SIGIO_irq(unsigned int irq)
721 {
722         return(0);
723 }
724
725 static void shutdown_SIGIO_irq(unsigned int irq)
726 {
727 }
728
729 static void enable_SIGIO_irq(unsigned int irq)
730 {
731 }
732
733 static void disable_SIGIO_irq(unsigned int irq)
734 {
735 }
736
737 static void mask_and_ack_SIGIO(unsigned int irq)
738 {
739 }
740
741 static void end_SIGIO_irq(unsigned int irq)
742 {
743 }
744
745 static unsigned int startup_SIGVTALRM_irq(unsigned int irq)
746 {
747         return(0);
748 }
749
750 static void shutdown_SIGVTALRM_irq(unsigned int irq)
751 {
752 }
753
754 static void enable_SIGVTALRM_irq(unsigned int irq)
755 {
756 }
757
758 static void disable_SIGVTALRM_irq(unsigned int irq)
759 {
760 }
761
762 static void mask_and_ack_SIGVTALRM(unsigned int irq)
763 {
764 }
765
766 static void end_SIGVTALRM_irq(unsigned int irq)
767 {
768 }
769
770 static struct hw_interrupt_type SIGIO_irq_type = {
771         "SIGIO",
772         startup_SIGIO_irq,
773         shutdown_SIGIO_irq,
774         enable_SIGIO_irq,
775         disable_SIGIO_irq,
776         mask_and_ack_SIGIO,
777         end_SIGIO_irq,
778         NULL
779 };
780
781 static struct hw_interrupt_type SIGVTALRM_irq_type = {
782         "SIGVTALRM",
783         startup_SIGVTALRM_irq,
784         shutdown_SIGVTALRM_irq,
785         enable_SIGVTALRM_irq,
786         disable_SIGVTALRM_irq,
787         mask_and_ack_SIGVTALRM,
788         end_SIGVTALRM_irq,
789         NULL
790 };
791
792 void __init init_IRQ(void)
793 {
794         int i;
795
796         irq_desc[TIMER_IRQ].status = IRQ_DISABLED;
797         irq_desc[TIMER_IRQ].action = 0;
798         irq_desc[TIMER_IRQ].depth = 1;
799         irq_desc[TIMER_IRQ].handler = &SIGVTALRM_irq_type;
800         enable_irq(TIMER_IRQ);
801         for(i=1;i<NR_IRQS;i++){
802                 irq_desc[i].status = IRQ_DISABLED;
803                 irq_desc[i].action = 0;
804                 irq_desc[i].depth = 1;
805                 irq_desc[i].handler = &SIGIO_irq_type;
806                 enable_irq(i);
807         }
808         init_irq_signals(0);
809 }
810
811 /*
812  * Overrides for Emacs so that we follow Linus's tabbing style.
813  * Emacs will notice this stuff at the end of the file and automatically
814  * adjust the settings for this buffer only.  This must remain at the end
815  * of the file.
816  * ---------------------------------------------------------------------------
817  * Local variables:
818  * c-file-style: "linux"
819  * End:
820  */