aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/hw_irq.h
diff options
context:
space:
mode:
authorKumar Gala <galak@freescale.com>2005-09-21 17:52:55 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-22 07:03:34 -0400
commitb671ad2befe37131af380183760862d5cbad858d (patch)
treec6c27d4adf742f360e5056f435601254f050781d /include/asm-powerpc/hw_irq.h
parentfa2ac7a25f1b11c4a695c9288339d0476ecfaf38 (diff)
[PATCH] powerpc: merged hw_irq.h
Merged hw_irq.h between ppc32 & ppc64. Added support to use the Book-E wrtee[i] instructions that allow modifying MSR[EE] atomically. Additionally, added get_irq_desc() macros to ppc32 to allow mask_irq(), unmask_irq(), and ack_irq() to be common between ppc32 & ppc64. Note: because 64-bit Book-E implementations only have a 32-bit MSR the macro's for Book-E need to come before the PPC64 macro's to ensure the right thing happends for 64-bit Book-E processors. Signed-off-by: Kumar Gala <kumar.gala@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/hw_irq.h')
-rw-r--r--include/asm-powerpc/hw_irq.h115
1 files changed, 115 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..605a65e42063
--- /dev/null
+++ b/include/asm-powerpc/hw_irq.h
@@ -0,0 +1,115 @@
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#include <asm/irq.h>
14
15extern void timer_interrupt(struct pt_regs *);
16extern void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq);
17
18#ifdef CONFIG_PPC_ISERIES
19
20extern unsigned long local_get_flags(void);
21extern unsigned long local_irq_disable(void);
22extern void local_irq_restore(unsigned long);
23
24#define local_irq_enable() local_irq_restore(1)
25#define local_save_flags(flags) ((flags) = local_get_flags())
26#define local_irq_save(flags) ((flags) = local_irq_disable())
27
28#define irqs_disabled() (local_get_flags() == 0)
29
30#else
31
32#if defined(CONFIG_BOOKE)
33#define SET_MSR_EE(x) mtmsr(x)
34#define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
35#elif defined(__powerpc64__)
36#define SET_MSR_EE(x) __mtmsrd(x, 1)
37#define local_irq_restore(flags) do { \
38 __asm__ __volatile__("": : :"memory"); \
39 __mtmsrd((flags), 1); \
40} while(0)
41#else
42#define SET_MSR_EE(x) mtmsr(x)
43#define local_irq_restore(flags) mtmsr(flags)
44#endif
45
46static inline void local_irq_disable(void)
47{
48#ifdef CONFIG_BOOKE
49 __asm__ __volatile__("wrteei 0": : :"memory");
50#else
51 unsigned long msr;
52 __asm__ __volatile__("": : :"memory");
53 msr = mfmsr();
54 SET_MSR_EE(msr & ~MSR_EE);
55#endif
56}
57
58static inline void local_irq_enable(void)
59{
60#ifdef CONFIG_BOOKE
61 __asm__ __volatile__("wrteei 1": : :"memory");
62#else
63 unsigned long msr;
64 __asm__ __volatile__("": : :"memory");
65 msr = mfmsr();
66 SET_MSR_EE(msr | MSR_EE);
67#endif
68}
69
70static inline void local_irq_save_ptr(unsigned long *flags)
71{
72 unsigned long msr;
73 msr = mfmsr();
74 *flags = msr;
75#ifdef CONFIG_BOOKE
76 __asm__ __volatile__("wrteei 0": : :"memory");
77#else
78 SET_MSR_EE(msr & ~MSR_EE);
79#endif
80 __asm__ __volatile__("": : :"memory");
81}
82
83#define local_save_flags(flags) ((flags) = mfmsr())
84#define local_irq_save(flags) local_irq_save_ptr(&flags)
85#define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
86
87#endif /* CONFIG_PPC_ISERIES */
88
89#define mask_irq(irq) \
90 ({ \
91 irq_desc_t *desc = get_irq_desc(irq); \
92 if (desc->handler && desc->handler->disable) \
93 desc->handler->disable(irq); \
94 })
95#define unmask_irq(irq) \
96 ({ \
97 irq_desc_t *desc = get_irq_desc(irq); \
98 if (desc->handler && desc->handler->enable) \
99 desc->handler->enable(irq); \
100 })
101#define ack_irq(irq) \
102 ({ \
103 irq_desc_t *desc = get_irq_desc(irq); \
104 if (desc->handler && desc->handler->ack) \
105 desc->handler->ack(irq); \
106 })
107
108/* Should we handle this via lost interrupts and IPIs or should we don't care like
109 * we do now ? --BenH.
110 */
111struct hw_interrupt_type;
112static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
113
114#endif /* __KERNEL__ */
115#endif /* _ASM_POWERPC_HW_IRQ_H */