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 <linux/compiler.h>
11 #include <asm/ptrace.h>
12 #include <asm/processor.h>
14 extern void timer_interrupt(struct pt_regs
*);
19 static inline unsigned long arch_local_save_flags(void)
26 : "i" (offsetof(struct paca_struct
, soft_enabled
)));
31 static inline unsigned long arch_local_irq_disable(void)
33 unsigned long flags
, zero
;
36 "li %1,0; lbz %0,%2(13); stb %1,%2(13)"
37 : "=r" (flags
), "=&r" (zero
)
38 : "i" (offsetof(struct paca_struct
, soft_enabled
))
44 extern void arch_local_irq_restore(unsigned long);
45 extern void iseries_handle_interrupts(void);
47 static inline void arch_local_irq_enable(void)
49 arch_local_irq_restore(1);
52 static inline unsigned long arch_local_irq_save(void)
54 return arch_local_irq_disable();
57 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
62 static inline bool arch_irqs_disabled(void)
64 return arch_irqs_disabled_flags(arch_local_save_flags());
67 #ifdef CONFIG_PPC_BOOK3E
68 #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory");
69 #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory");
71 #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
72 #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
75 #define hard_irq_disable() \
77 __hard_irq_disable(); \
78 get_paca()->soft_enabled = 0; \
79 get_paca()->hard_enabled = 0; \
82 #else /* CONFIG_PPC64 */
84 #define SET_MSR_EE(x) mtmsr(x)
86 static inline unsigned long arch_local_save_flags(void)
91 static inline void arch_local_irq_restore(unsigned long flags
)
93 #if defined(CONFIG_BOOKE)
94 asm volatile("wrtee %0" : : "r" (flags
) : "memory");
100 static inline unsigned long arch_local_irq_save(void)
102 unsigned long flags
= arch_local_save_flags();
104 asm volatile("wrteei 0" : : : "memory");
106 SET_MSR_EE(flags
& ~MSR_EE
);
111 static inline void arch_local_irq_disable(void)
114 asm volatile("wrteei 0" : : : "memory");
116 arch_local_irq_save();
120 static inline void arch_local_irq_enable(void)
123 asm volatile("wrteei 1" : : : "memory");
125 unsigned long msr
= mfmsr();
126 SET_MSR_EE(msr
| MSR_EE
);
130 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
132 return (flags
& MSR_EE
) == 0;
135 static inline bool arch_irqs_disabled(void)
137 return arch_irqs_disabled_flags(arch_local_save_flags());
140 #define hard_irq_disable() arch_local_irq_disable()
142 #endif /* CONFIG_PPC64 */
144 #define ARCH_IRQ_INIT_FLAGS IRQ_NOREQUEST
147 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
148 * or should we not care like we do now ? --BenH.
152 #endif /* __KERNEL__ */
153 #endif /* _ASM_POWERPC_HW_IRQ_H */