i2c: Kerneldoc for most I/O calls
[linux-ginger.git] / include / asm-powerpc / hw_irq.h
blobad8c9f7fd0e359f8edb08db45e645b4632b9c5c8
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 raw_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 raw_local_irq_restore(unsigned long);
43 extern void iseries_handle_interrupts(void);
45 #define raw_local_irq_enable() raw_local_irq_restore(1)
46 #define raw_local_save_flags(flags) ((flags) = local_get_flags())
47 #define raw_local_irq_save(flags) ((flags) = raw_local_irq_disable())
49 #define raw_irqs_disabled() (local_get_flags() == 0)
50 #define raw_irqs_disabled_flags(flags) ((flags) == 0)
52 #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
53 #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
55 #define hard_irq_disable() \
56 do { \
57 __hard_irq_disable(); \
58 get_paca()->soft_enabled = 0; \
59 get_paca()->hard_enabled = 0; \
60 } while(0)
62 #else
64 #if defined(CONFIG_BOOKE)
65 #define SET_MSR_EE(x) mtmsr(x)
66 #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
67 #else
68 #define SET_MSR_EE(x) mtmsr(x)
69 #define local_irq_restore(flags) mtmsr(flags)
70 #endif
72 static inline void local_irq_disable(void)
74 #ifdef CONFIG_BOOKE
75 __asm__ __volatile__("wrteei 0": : :"memory");
76 #else
77 unsigned long msr;
78 __asm__ __volatile__("": : :"memory");
79 msr = mfmsr();
80 SET_MSR_EE(msr & ~MSR_EE);
81 #endif
84 static inline void local_irq_enable(void)
86 #ifdef CONFIG_BOOKE
87 __asm__ __volatile__("wrteei 1": : :"memory");
88 #else
89 unsigned long msr;
90 __asm__ __volatile__("": : :"memory");
91 msr = mfmsr();
92 SET_MSR_EE(msr | MSR_EE);
93 #endif
96 static inline void local_irq_save_ptr(unsigned long *flags)
98 unsigned long msr;
99 msr = mfmsr();
100 *flags = msr;
101 #ifdef CONFIG_BOOKE
102 __asm__ __volatile__("wrteei 0": : :"memory");
103 #else
104 SET_MSR_EE(msr & ~MSR_EE);
105 #endif
106 __asm__ __volatile__("": : :"memory");
109 #define local_save_flags(flags) ((flags) = mfmsr())
110 #define local_irq_save(flags) local_irq_save_ptr(&flags)
111 #define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
113 #define hard_irq_enable() local_irq_enable()
114 #define hard_irq_disable() local_irq_disable()
116 #endif /* CONFIG_PPC64 */
119 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
120 * or should we not care like we do now ? --BenH.
122 struct hw_interrupt_type;
124 #endif /* __KERNEL__ */
125 #endif /* _ASM_POWERPC_HW_IRQ_H */