Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> |
| 3 | */ |
| 4 | #ifdef __KERNEL__ |
| 5 | #ifndef _PPC_HW_IRQ_H |
| 6 | #define _PPC_HW_IRQ_H |
| 7 | |
| 8 | #include <asm/ptrace.h> |
| 9 | #include <asm/reg.h> |
| 10 | |
| 11 | extern void timer_interrupt(struct pt_regs *); |
| 12 | |
| 13 | #define INLINE_IRQS |
| 14 | |
| 15 | #define irqs_disabled() ((mfmsr() & MSR_EE) == 0) |
| 16 | |
| 17 | #ifdef INLINE_IRQS |
| 18 | |
| 19 | static inline void local_irq_disable(void) |
| 20 | { |
| 21 | unsigned long msr; |
| 22 | msr = mfmsr(); |
| 23 | mtmsr(msr & ~MSR_EE); |
| 24 | __asm__ __volatile__("": : :"memory"); |
| 25 | } |
| 26 | |
| 27 | static inline void local_irq_enable(void) |
| 28 | { |
| 29 | unsigned long msr; |
| 30 | __asm__ __volatile__("": : :"memory"); |
| 31 | msr = mfmsr(); |
| 32 | mtmsr(msr | MSR_EE); |
| 33 | } |
| 34 | |
| 35 | static inline void local_irq_save_ptr(unsigned long *flags) |
| 36 | { |
| 37 | unsigned long msr; |
| 38 | msr = mfmsr(); |
| 39 | *flags = msr; |
| 40 | mtmsr(msr & ~MSR_EE); |
| 41 | __asm__ __volatile__("": : :"memory"); |
| 42 | } |
| 43 | |
| 44 | #define local_save_flags(flags) ((flags) = mfmsr()) |
| 45 | #define local_irq_save(flags) local_irq_save_ptr(&flags) |
| 46 | #define local_irq_restore(flags) mtmsr(flags) |
| 47 | |
| 48 | #else |
| 49 | |
| 50 | extern void local_irq_enable(void); |
| 51 | extern void local_irq_disable(void); |
| 52 | extern void local_irq_restore(unsigned long); |
| 53 | extern void local_save_flags_ptr(unsigned long *); |
| 54 | |
| 55 | #define local_save_flags(flags) local_save_flags_ptr(&flags) |
| 56 | #define local_irq_save(flags) ({local_save_flags(flags);local_irq_disable();}) |
| 57 | |
| 58 | #endif |
| 59 | |
| 60 | extern void do_lost_interrupts(unsigned long); |
| 61 | |
| 62 | #define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);}) |
| 63 | #define unmask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->enable) irq_desc[irq].handler->enable(irq);}) |
| 64 | #define ack_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->ack) irq_desc[irq].handler->ack(irq);}) |
| 65 | |
| 66 | /* Should we handle this via lost interrupts and IPIs or should we don't care like |
| 67 | * we do now ? --BenH. |
| 68 | */ |
| 69 | struct hw_interrupt_type; |
| 70 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} |
| 71 | |
| 72 | |
| 73 | #endif /* _PPC_HW_IRQ_H */ |
| 74 | #endif /* __KERNEL__ */ |