Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
[pv_ops_mirror.git] / include / asm-powerpc / hw_irq.h
bloba7b60bf639e0896f5b1099ee29c664c20fa0d33a
1 /*
2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
3 */
4 #ifndef _ASM_POWERPC_HW_IRQ_H
5 #define _ASM_POWERPC_HW_IRQ_H
7 #ifdef __KERNEL__
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 *);
16 #ifdef CONFIG_PPC64
17 #include <asm/paca.h>
19 static inline unsigned long local_get_flags(void)
21 unsigned long flags;
23 __asm__ __volatile__("lbz %0,%1(13)"
24 : "=r" (flags)
25 : "i" (offsetof(struct paca_struct, soft_enabled)));
27 return flags;
30 static inline unsigned long local_irq_disable(void)
32 unsigned long flags, zero;
34 __asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)"
35 : "=r" (flags), "=&r" (zero)
36 : "i" (offsetof(struct paca_struct, soft_enabled))
37 : "memory");
39 return flags;
42 extern void local_irq_restore(unsigned long);
43 extern void iseries_handle_interrupts(void);
45 #define local_irq_enable() local_irq_restore(1)
46 #define local_save_flags(flags) ((flags) = local_get_flags())
47 #define local_irq_save(flags) ((flags) = local_irq_disable())
49 #define irqs_disabled() (local_get_flags() == 0)
51 #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
52 #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
54 #define hard_irq_disable() \
55 do { \
56 __hard_irq_disable(); \
57 get_paca()->soft_enabled = 0; \
58 get_paca()->hard_enabled = 0; \
59 } while(0)
61 #else
63 #if defined(CONFIG_BOOKE)
64 #define SET_MSR_EE(x) mtmsr(x)
65 #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
66 #else
67 #define SET_MSR_EE(x) mtmsr(x)
68 #define local_irq_restore(flags) mtmsr(flags)
69 #endif
71 static inline void local_irq_disable(void)
73 #ifdef CONFIG_BOOKE
74 __asm__ __volatile__("wrteei 0": : :"memory");
75 #else
76 unsigned long msr;
77 __asm__ __volatile__("": : :"memory");
78 msr = mfmsr();
79 SET_MSR_EE(msr & ~MSR_EE);
80 #endif
83 static inline void local_irq_enable(void)
85 #ifdef CONFIG_BOOKE
86 __asm__ __volatile__("wrteei 1": : :"memory");
87 #else
88 unsigned long msr;
89 __asm__ __volatile__("": : :"memory");
90 msr = mfmsr();
91 SET_MSR_EE(msr | MSR_EE);
92 #endif
95 static inline void local_irq_save_ptr(unsigned long *flags)
97 unsigned long msr;
98 msr = mfmsr();
99 *flags = msr;
100 #ifdef CONFIG_BOOKE
101 __asm__ __volatile__("wrteei 0": : :"memory");
102 #else
103 SET_MSR_EE(msr & ~MSR_EE);
104 #endif
105 __asm__ __volatile__("": : :"memory");
108 #define local_save_flags(flags) ((flags) = mfmsr())
109 #define local_irq_save(flags) local_irq_save_ptr(&flags)
110 #define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
112 #define hard_irq_enable() local_irq_enable()
113 #define hard_irq_disable() local_irq_disable()
115 #endif /* CONFIG_PPC64 */
118 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
119 * or should we not care like we do now ? --BenH.
121 struct hw_interrupt_type;
123 #endif /* __KERNEL__ */
124 #endif /* _ASM_POWERPC_HW_IRQ_H */