2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
4 #ifndef _ASM_POWERPC_HW_IRQ_H
5 #define _ASM_POWERPC_HW_IRQ_H
9 #include <linux/config.h>
10 #include <linux/errno.h>
11 #include <asm/ptrace.h>
12 #include <asm/processor.h>
14 extern void timer_interrupt(struct pt_regs *);
16 #ifdef CONFIG_PPC_ISERIES
18 extern unsigned long local_get_flags(void);
19 extern unsigned long local_irq_disable(void);
20 extern void local_irq_restore(unsigned long);
22 #define local_irq_enable() local_irq_restore(1)
23 #define local_save_flags(flags) ((flags) = local_get_flags())
24 #define local_irq_save(flags) ((flags) = local_irq_disable())
26 #define irqs_disabled() (local_get_flags() == 0)
30 #if defined(CONFIG_BOOKE)
31 #define SET_MSR_EE(x) mtmsr(x)
32 #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
33 #elif defined(__powerpc64__)
34 #define SET_MSR_EE(x) __mtmsrd(x, 1)
35 #define local_irq_restore(flags) do { \
36 __asm__ __volatile__("": : :"memory"); \
37 __mtmsrd((flags), 1); \
40 #define SET_MSR_EE(x) mtmsr(x)
41 #define local_irq_restore(flags) mtmsr(flags)
44 static inline void local_irq_disable(void)
47 __asm__ __volatile__("wrteei 0": : :"memory");
50 __asm__ __volatile__("": : :"memory");
52 SET_MSR_EE(msr & ~MSR_EE);
56 static inline void local_irq_enable(void)
59 __asm__ __volatile__("wrteei 1": : :"memory");
62 __asm__ __volatile__("": : :"memory");
64 SET_MSR_EE(msr | MSR_EE);
68 static inline void local_irq_save_ptr(unsigned long *flags)
74 __asm__ __volatile__("wrteei 0": : :"memory");
76 SET_MSR_EE(msr & ~MSR_EE);
78 __asm__ __volatile__("": : :"memory");
81 #define local_save_flags(flags) ((flags) = mfmsr())
82 #define local_irq_save(flags) local_irq_save_ptr(&flags)
83 #define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
85 #endif /* CONFIG_PPC_ISERIES */
87 #define mask_irq(irq) \
89 irq_desc_t *desc = get_irq_desc(irq); \
90 if (desc->handler && desc->handler->disable) \
91 desc->handler->disable(irq); \
93 #define unmask_irq(irq) \
95 irq_desc_t *desc = get_irq_desc(irq); \
96 if (desc->handler && desc->handler->enable) \
97 desc->handler->enable(irq); \
99 #define ack_irq(irq) \
101 irq_desc_t *desc = get_irq_desc(irq); \
102 if (desc->handler && desc->handler->ack) \
103 desc->handler->ack(irq); \
106 /* Should we handle this via lost interrupts and IPIs or should we don't care like
107 * we do now ? --BenH.
109 struct hw_interrupt_type;
110 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
112 #endif /* __KERNEL__ */
113 #endif /* _ASM_POWERPC_HW_IRQ_H */