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