2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
4 * Use inline IRQs where possible - Anton Blanchard <anton@au.ibm.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #ifndef _PPC64_HW_IRQ_H
13 #define _PPC64_HW_IRQ_H
15 #include <linux/config.h>
18 int timer_interrupt(struct pt_regs *);
20 #ifdef CONFIG_PPC_ISERIES
22 extern void __no_use_sti(void);
23 extern void __no_use_cli(void);
24 extern void __no_use_restore_flags(unsigned long);
25 extern unsigned long __no_use_save_flags(void);
26 extern void __no_use_set_lost(unsigned long);
27 extern void __no_lpq_restore_flags(unsigned long);
29 #define __cli() __no_use_cli()
30 #define __sti() __no_use_sti()
31 #define __save_flags(flags) ((flags) = __no_use_save_flags())
32 #define __restore_flags(flags) __no_use_restore_flags((unsigned long)flags)
33 #define __save_and_cli(flags) ({__save_flags(flags);__cli();})
34 #define __save_and_sti(flags) ({__save_flags(flags);__sti();})
38 #define __save_flags(flags) ((flags) = mfmsr())
39 #define __restore_flags(flags) do { \
40 __asm__ __volatile__("": : :"memory"); \
44 static inline void __cli(void)
48 mtmsrd(msr & ~MSR_EE);
49 __asm__ __volatile__("": : :"memory");
52 static inline void __sti(void)
55 __asm__ __volatile__("": : :"memory");
60 static inline void __do_save_and_cli(unsigned long *flags)
65 mtmsrd(msr & ~MSR_EE);
66 __asm__ __volatile__("": : :"memory");
69 #define __save_and_cli(flags) __do_save_and_cli(&flags)
70 #define __save_and_sti(flags) ({__save_flags(flags);__sti();})
72 #endif /* CONFIG_PPC_ISERIES */
74 #define mask_irq(irq) ({ \
75 irq_desc_t *desc = irqdesc(irq); \
76 if (desc->handler && desc->handler->disable) \
77 desc->handler->disable(irq); \
79 #define unmask_irq(irq) ({ \
80 irq_desc_t *desc = irqdesc(irq); \
81 if (desc->handler && desc->handler->enable) \
82 desc->handler->enable(irq); \
84 #define ack_irq(irq) ({ \
85 irq_desc_t *desc = irqdesc(irq); \
86 if (desc->handler && desc->handler->ack) \
87 desc->handler->ack(irq); \
90 /* Should we handle this via lost interrupts and IPIs or should we don't care like
93 struct hw_interrupt_type;
94 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
96 #endif /* _PPC64_HW_IRQ_H */
97 #endif /* __KERNEL__ */