2 * Handle interrupts from the SRM, assuming no additional weirdness.
5 #include <linux/init.h>
6 #include <linux/sched.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
);
21 srm_enable_irq(unsigned int irq
)
23 spin_lock(&srm_irq_lock
);
25 spin_unlock(&srm_irq_lock
);
29 srm_disable_irq(unsigned int irq
)
31 spin_lock(&srm_irq_lock
);
33 spin_unlock(&srm_irq_lock
);
37 srm_startup_irq(unsigned int irq
)
44 srm_end_irq(unsigned int irq
)
46 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
50 /* Handle interrupts from the SRM, assuming no additional weirdness. */
51 static struct hw_interrupt_type srm_irq_type
= {
53 .startup
= srm_startup_irq
,
54 .shutdown
= srm_disable_irq
,
55 .enable
= srm_enable_irq
,
56 .disable
= srm_disable_irq
,
57 .ack
= srm_disable_irq
,
62 init_srm_irqs(long max
, unsigned long ignore_mask
)
66 for (i
= 16; i
< max
; ++i
) {
67 if (i
< 64 && ((ignore_mask
>> i
) & 1))
69 irq_desc
[i
].status
= IRQ_DISABLED
| IRQ_LEVEL
;
70 irq_desc
[i
].handler
= &srm_irq_type
;
75 srm_device_interrupt(unsigned long vector
, struct pt_regs
* regs
)
77 int irq
= (vector
- 0x800) >> 4;
78 handle_irq(irq
, regs
);