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/errno.h>
10 #include <asm/ptrace.h>
11 #include <asm/processor.h>
13 extern void timer_interrupt(struct pt_regs
*);
15 #ifdef CONFIG_PPC_ISERIES
17 extern unsigned long local_get_flags(void);
18 extern unsigned long local_irq_disable(void);
19 extern void local_irq_restore(unsigned long);
21 #define local_irq_enable() local_irq_restore(1)
22 #define local_save_flags(flags) ((flags) = local_get_flags())
23 #define local_irq_save(flags) ((flags) = local_irq_disable())
25 #define irqs_disabled() (local_get_flags() == 0)
29 #if defined(CONFIG_BOOKE)
30 #define SET_MSR_EE(x) mtmsr(x)
31 #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
32 #elif defined(__powerpc64__)
33 #define SET_MSR_EE(x) __mtmsrd(x, 1)
34 #define local_irq_restore(flags) do { \
35 __asm__ __volatile__("": : :"memory"); \
36 __mtmsrd((flags), 1); \
39 #define SET_MSR_EE(x) mtmsr(x)
40 #define local_irq_restore(flags) mtmsr(flags)
43 static inline void local_irq_disable(void)
46 __asm__
__volatile__("wrteei 0": : :"memory");
49 __asm__
__volatile__("": : :"memory");
51 SET_MSR_EE(msr
& ~MSR_EE
);
55 static inline void local_irq_enable(void)
58 __asm__
__volatile__("wrteei 1": : :"memory");
61 __asm__
__volatile__("": : :"memory");
63 SET_MSR_EE(msr
| MSR_EE
);
67 static inline void local_irq_save_ptr(unsigned long *flags
)
73 __asm__
__volatile__("wrteei 0": : :"memory");
75 SET_MSR_EE(msr
& ~MSR_EE
);
77 __asm__
__volatile__("": : :"memory");
80 #define local_save_flags(flags) ((flags) = mfmsr())
81 #define local_irq_save(flags) local_irq_save_ptr(&flags)
82 #define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
84 #endif /* CONFIG_PPC_ISERIES */
86 #define mask_irq(irq) \
88 irq_desc_t *desc = get_irq_desc(irq); \
89 if (desc->chip && desc->chip->disable) \
90 desc->chip->disable(irq); \
92 #define unmask_irq(irq) \
94 irq_desc_t *desc = get_irq_desc(irq); \
95 if (desc->chip && desc->chip->enable) \
96 desc->chip->enable(irq); \
98 #define ack_irq(irq) \
100 irq_desc_t *desc = get_irq_desc(irq); \
101 if (desc->chip && desc->chip->ack) \
102 desc->chip->ack(irq); \
106 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
107 * or should we not care like we do now ? --BenH.
109 struct hw_interrupt_type
;
111 #endif /* __KERNEL__ */
112 #endif /* _ASM_POWERPC_HW_IRQ_H */