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