diff options
Diffstat (limited to 'include/asm-powerpc/hw_irq.h')
-rw-r--r-- | include/asm-powerpc/hw_irq.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h new file mode 100644 index 000000000000..26b89d859c56 --- /dev/null +++ b/include/asm-powerpc/hw_irq.h | |||
@@ -0,0 +1,113 @@ | |||
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 | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/errno.h> | ||
11 | #include <asm/ptrace.h> | ||
12 | #include <asm/processor.h> | ||
13 | |||
14 | extern void timer_interrupt(struct pt_regs *); | ||
15 | |||
16 | #ifdef CONFIG_PPC_ISERIES | ||
17 | |||
18 | extern unsigned long local_get_flags(void); | ||
19 | extern unsigned long local_irq_disable(void); | ||
20 | extern void local_irq_restore(unsigned long); | ||
21 | |||
22 | #define local_irq_enable() local_irq_restore(1) | ||
23 | #define local_save_flags(flags) ((flags) = local_get_flags()) | ||
24 | #define local_irq_save(flags) ((flags) = local_irq_disable()) | ||
25 | |||
26 | #define irqs_disabled() (local_get_flags() == 0) | ||
27 | |||
28 | #else | ||
29 | |||
30 | #if defined(CONFIG_BOOKE) | ||
31 | #define SET_MSR_EE(x) mtmsr(x) | ||
32 | #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory") | ||
33 | #elif defined(__powerpc64__) | ||
34 | #define SET_MSR_EE(x) __mtmsrd(x, 1) | ||
35 | #define local_irq_restore(flags) do { \ | ||
36 | __asm__ __volatile__("": : :"memory"); \ | ||
37 | __mtmsrd((flags), 1); \ | ||
38 | } while(0) | ||
39 | #else | ||
40 | #define SET_MSR_EE(x) mtmsr(x) | ||
41 | #define local_irq_restore(flags) mtmsr(flags) | ||
42 | #endif | ||
43 | |||
44 | static inline void local_irq_disable(void) | ||
45 | { | ||
46 | #ifdef CONFIG_BOOKE | ||
47 | __asm__ __volatile__("wrteei 0": : :"memory"); | ||
48 | #else | ||
49 | unsigned long msr; | ||
50 | __asm__ __volatile__("": : :"memory"); | ||
51 | msr = mfmsr(); | ||
52 | SET_MSR_EE(msr & ~MSR_EE); | ||
53 | #endif | ||
54 | } | ||
55 | |||
56 | static inline void local_irq_enable(void) | ||
57 | { | ||
58 | #ifdef CONFIG_BOOKE | ||
59 | __asm__ __volatile__("wrteei 1": : :"memory"); | ||
60 | #else | ||
61 | unsigned long msr; | ||
62 | __asm__ __volatile__("": : :"memory"); | ||
63 | msr = mfmsr(); | ||
64 | SET_MSR_EE(msr | MSR_EE); | ||
65 | #endif | ||
66 | } | ||
67 | |||
68 | static inline void local_irq_save_ptr(unsigned long *flags) | ||
69 | { | ||
70 | unsigned long msr; | ||
71 | msr = mfmsr(); | ||
72 | *flags = msr; | ||
73 | #ifdef CONFIG_BOOKE | ||
74 | __asm__ __volatile__("wrteei 0": : :"memory"); | ||
75 | #else | ||
76 | SET_MSR_EE(msr & ~MSR_EE); | ||
77 | #endif | ||
78 | __asm__ __volatile__("": : :"memory"); | ||
79 | } | ||
80 | |||
81 | #define local_save_flags(flags) ((flags) = mfmsr()) | ||
82 | #define local_irq_save(flags) local_irq_save_ptr(&flags) | ||
83 | #define irqs_disabled() ((mfmsr() & MSR_EE) == 0) | ||
84 | |||
85 | #endif /* CONFIG_PPC_ISERIES */ | ||
86 | |||
87 | #define mask_irq(irq) \ | ||
88 | ({ \ | ||
89 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
90 | if (desc->handler && desc->handler->disable) \ | ||
91 | desc->handler->disable(irq); \ | ||
92 | }) | ||
93 | #define unmask_irq(irq) \ | ||
94 | ({ \ | ||
95 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
96 | if (desc->handler && desc->handler->enable) \ | ||
97 | desc->handler->enable(irq); \ | ||
98 | }) | ||
99 | #define ack_irq(irq) \ | ||
100 | ({ \ | ||
101 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
102 | if (desc->handler && desc->handler->ack) \ | ||
103 | desc->handler->ack(irq); \ | ||
104 | }) | ||
105 | |||
106 | /* Should we handle this via lost interrupts and IPIs or should we don't care like | ||
107 | * we do now ? --BenH. | ||
108 | */ | ||
109 | struct hw_interrupt_type; | ||
110 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} | ||
111 | |||
112 | #endif /* __KERNEL__ */ | ||
113 | #endif /* _ASM_POWERPC_HW_IRQ_H */ | ||