]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> | |
1da177e4 | 3 | */ |
b671ad2b KG |
4 | #ifndef _ASM_POWERPC_HW_IRQ_H |
5 | #define _ASM_POWERPC_HW_IRQ_H | |
6 | ||
1da177e4 | 7 | #ifdef __KERNEL__ |
1da177e4 | 8 | |
1da177e4 | 9 | #include <linux/errno.h> |
d04c56f7 | 10 | #include <linux/compiler.h> |
b671ad2b KG |
11 | #include <asm/ptrace.h> |
12 | #include <asm/processor.h> | |
1da177e4 | 13 | |
c7aeffc4 | 14 | extern void timer_interrupt(struct pt_regs *); |
1da177e4 | 15 | |
d04c56f7 PM |
16 | #ifdef CONFIG_PPC64 |
17 | #include <asm/paca.h> | |
18 | ||
19 | static inline unsigned long local_get_flags(void) | |
20 | { | |
ef2b343e HD |
21 | unsigned long flags; |
22 | ||
23 | __asm__ __volatile__("lbz %0,%1(13)" | |
24 | : "=r" (flags) | |
25 | : "i" (offsetof(struct paca_struct, soft_enabled))); | |
26 | ||
27 | return flags; | |
d04c56f7 PM |
28 | } |
29 | ||
30 | static inline unsigned long local_irq_disable(void) | |
31 | { | |
ef2b343e HD |
32 | unsigned long flags, zero; |
33 | ||
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"); | |
38 | ||
39 | return flags; | |
d04c56f7 | 40 | } |
1da177e4 | 41 | |
1da177e4 | 42 | extern void local_irq_restore(unsigned long); |
d04c56f7 | 43 | extern void iseries_handle_interrupts(void); |
1da177e4 LT |
44 | |
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()) | |
48 | ||
49 | #define irqs_disabled() (local_get_flags() == 0) | |
50 | ||
d04c56f7 PM |
51 | #define hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) |
52 | #define hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) | |
53 | ||
1da177e4 LT |
54 | #else |
55 | ||
b671ad2b KG |
56 | #if defined(CONFIG_BOOKE) |
57 | #define SET_MSR_EE(x) mtmsr(x) | |
58 | #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory") | |
b671ad2b KG |
59 | #else |
60 | #define SET_MSR_EE(x) mtmsr(x) | |
61 | #define local_irq_restore(flags) mtmsr(flags) | |
62 | #endif | |
1da177e4 LT |
63 | |
64 | static inline void local_irq_disable(void) | |
65 | { | |
b671ad2b KG |
66 | #ifdef CONFIG_BOOKE |
67 | __asm__ __volatile__("wrteei 0": : :"memory"); | |
68 | #else | |
1da177e4 | 69 | unsigned long msr; |
1da177e4 | 70 | __asm__ __volatile__("": : :"memory"); |
b671ad2b KG |
71 | msr = mfmsr(); |
72 | SET_MSR_EE(msr & ~MSR_EE); | |
73 | #endif | |
1da177e4 LT |
74 | } |
75 | ||
76 | static inline void local_irq_enable(void) | |
77 | { | |
b671ad2b KG |
78 | #ifdef CONFIG_BOOKE |
79 | __asm__ __volatile__("wrteei 1": : :"memory"); | |
80 | #else | |
1da177e4 LT |
81 | unsigned long msr; |
82 | __asm__ __volatile__("": : :"memory"); | |
83 | msr = mfmsr(); | |
b671ad2b KG |
84 | SET_MSR_EE(msr | MSR_EE); |
85 | #endif | |
1da177e4 LT |
86 | } |
87 | ||
b671ad2b | 88 | static inline void local_irq_save_ptr(unsigned long *flags) |
1da177e4 LT |
89 | { |
90 | unsigned long msr; | |
91 | msr = mfmsr(); | |
92 | *flags = msr; | |
b671ad2b KG |
93 | #ifdef CONFIG_BOOKE |
94 | __asm__ __volatile__("wrteei 0": : :"memory"); | |
95 | #else | |
96 | SET_MSR_EE(msr & ~MSR_EE); | |
97 | #endif | |
1da177e4 LT |
98 | __asm__ __volatile__("": : :"memory"); |
99 | } | |
100 | ||
b671ad2b KG |
101 | #define local_save_flags(flags) ((flags) = mfmsr()) |
102 | #define local_irq_save(flags) local_irq_save_ptr(&flags) | |
103 | #define irqs_disabled() ((mfmsr() & MSR_EE) == 0) | |
1da177e4 | 104 | |
143db67a ME |
105 | #define hard_irq_enable() local_irq_enable() |
106 | #define hard_irq_disable() local_irq_disable() | |
107 | ||
d04c56f7 | 108 | #endif /* CONFIG_PPC64 */ |
1da177e4 | 109 | |
c0ad90a3 IM |
110 | /* |
111 | * interrupt-retrigger: should we handle this via lost interrupts and IPIs | |
112 | * or should we not care like we do now ? --BenH. | |
1da177e4 LT |
113 | */ |
114 | struct hw_interrupt_type; | |
b671ad2b KG |
115 | |
116 | #endif /* __KERNEL__ */ | |
117 | #endif /* _ASM_POWERPC_HW_IRQ_H */ |