Linux 4.8-rc8
[linux/fpc-iii.git] / arch / alpha / kernel / irq_srm.c
bloba79fa30e75528cac1bedb940482f4388d99aca1a
1 /*
2 * Handle interrupts from the SRM, assuming no additional weirdness.
3 */
5 #include <linux/init.h>
6 #include <linux/sched.h>
7 #include <linux/irq.h>
9 #include "proto.h"
10 #include "irq_impl.h"
14 * Is the palcode SMP safe? In other words: can we call cserve_ena/dis
15 * at the same time in multiple CPUs? To be safe I added a spinlock
16 * but it can be removed trivially if the palcode is robust against smp.
18 DEFINE_SPINLOCK(srm_irq_lock);
20 static inline void
21 srm_enable_irq(struct irq_data *d)
23 spin_lock(&srm_irq_lock);
24 cserve_ena(d->irq - 16);
25 spin_unlock(&srm_irq_lock);
28 static void
29 srm_disable_irq(struct irq_data *d)
31 spin_lock(&srm_irq_lock);
32 cserve_dis(d->irq - 16);
33 spin_unlock(&srm_irq_lock);
36 /* Handle interrupts from the SRM, assuming no additional weirdness. */
37 static struct irq_chip srm_irq_type = {
38 .name = "SRM",
39 .irq_unmask = srm_enable_irq,
40 .irq_mask = srm_disable_irq,
41 .irq_mask_ack = srm_disable_irq,
44 void __init
45 init_srm_irqs(long max, unsigned long ignore_mask)
47 long i;
49 if (NR_IRQS <= 16)
50 return;
51 for (i = 16; i < max; ++i) {
52 if (i < 64 && ((ignore_mask >> i) & 1))
53 continue;
54 irq_set_chip_and_handler(i, &srm_irq_type, handle_level_irq);
55 irq_set_status_flags(i, IRQ_LEVEL);
59 void
60 srm_device_interrupt(unsigned long vector)
62 int irq = (vector - 0x800) >> 4;
63 handle_irq(irq);