diff options
author | Kumar Gala <galak@freescale.com> | 2005-09-21 17:52:55 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-09-22 07:03:34 -0400 |
commit | b671ad2befe37131af380183760862d5cbad858d (patch) | |
tree | c6c27d4adf742f360e5056f435601254f050781d | |
parent | fa2ac7a25f1b11c4a695c9288339d0476ecfaf38 (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>
-rw-r--r-- | include/asm-powerpc/hw_irq.h (renamed from include/asm-ppc64/hw_irq.h) | 63 | ||||
-rw-r--r-- | include/asm-ppc/hw_irq.h | 59 | ||||
-rw-r--r-- | include/asm-ppc/irq.h | 6 |
3 files changed, 43 insertions, 85 deletions
diff --git a/include/asm-ppc64/hw_irq.h b/include/asm-powerpc/hw_irq.h index c483897b8757..605a65e42063 100644 --- a/include/asm-ppc64/hw_irq.h +++ b/include/asm-powerpc/hw_irq.h | |||
@@ -1,19 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> | 2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> |
3 | * | ||
4 | * Use inline IRQs where possible - Anton Blanchard <anton@au.ibm.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | 3 | */ |
4 | #ifndef _ASM_POWERPC_HW_IRQ_H | ||
5 | #define _ASM_POWERPC_HW_IRQ_H | ||
6 | |||
11 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
12 | #ifndef _PPC64_HW_IRQ_H | ||
13 | #define _PPC64_HW_IRQ_H | ||
14 | 8 | ||
15 | #include <linux/config.h> | 9 | #include <linux/config.h> |
16 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <asm/ptrace.h> | ||
12 | #include <asm/processor.h> | ||
17 | #include <asm/irq.h> | 13 | #include <asm/irq.h> |
18 | 14 | ||
19 | extern void timer_interrupt(struct pt_regs *); | 15 | extern void timer_interrupt(struct pt_regs *); |
@@ -33,45 +29,60 @@ extern void local_irq_restore(unsigned long); | |||
33 | 29 | ||
34 | #else | 30 | #else |
35 | 31 | ||
36 | #define local_save_flags(flags) ((flags) = mfmsr()) | 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 { \ | 37 | #define local_irq_restore(flags) do { \ |
38 | __asm__ __volatile__("": : :"memory"); \ | 38 | __asm__ __volatile__("": : :"memory"); \ |
39 | __mtmsrd((flags), 1); \ | 39 | __mtmsrd((flags), 1); \ |
40 | } while(0) | 40 | } while(0) |
41 | #else | ||
42 | #define SET_MSR_EE(x) mtmsr(x) | ||
43 | #define local_irq_restore(flags) mtmsr(flags) | ||
44 | #endif | ||
41 | 45 | ||
42 | static inline void local_irq_disable(void) | 46 | static inline void local_irq_disable(void) |
43 | { | 47 | { |
48 | #ifdef CONFIG_BOOKE | ||
49 | __asm__ __volatile__("wrteei 0": : :"memory"); | ||
50 | #else | ||
44 | unsigned long msr; | 51 | unsigned long msr; |
45 | msr = mfmsr(); | ||
46 | __mtmsrd(msr & ~MSR_EE, 1); | ||
47 | __asm__ __volatile__("": : :"memory"); | 52 | __asm__ __volatile__("": : :"memory"); |
53 | msr = mfmsr(); | ||
54 | SET_MSR_EE(msr & ~MSR_EE); | ||
55 | #endif | ||
48 | } | 56 | } |
49 | 57 | ||
50 | static inline void local_irq_enable(void) | 58 | static inline void local_irq_enable(void) |
51 | { | 59 | { |
60 | #ifdef CONFIG_BOOKE | ||
61 | __asm__ __volatile__("wrteei 1": : :"memory"); | ||
62 | #else | ||
52 | unsigned long msr; | 63 | unsigned long msr; |
53 | __asm__ __volatile__("": : :"memory"); | 64 | __asm__ __volatile__("": : :"memory"); |
54 | msr = mfmsr(); | 65 | msr = mfmsr(); |
55 | __mtmsrd(msr | MSR_EE, 1); | 66 | SET_MSR_EE(msr | MSR_EE); |
67 | #endif | ||
56 | } | 68 | } |
57 | 69 | ||
58 | static inline void __do_save_and_cli(unsigned long *flags) | 70 | static inline void local_irq_save_ptr(unsigned long *flags) |
59 | { | 71 | { |
60 | unsigned long msr; | 72 | unsigned long msr; |
61 | msr = mfmsr(); | 73 | msr = mfmsr(); |
62 | *flags = msr; | 74 | *flags = msr; |
63 | __mtmsrd(msr & ~MSR_EE, 1); | 75 | #ifdef CONFIG_BOOKE |
76 | __asm__ __volatile__("wrteei 0": : :"memory"); | ||
77 | #else | ||
78 | SET_MSR_EE(msr & ~MSR_EE); | ||
79 | #endif | ||
64 | __asm__ __volatile__("": : :"memory"); | 80 | __asm__ __volatile__("": : :"memory"); |
65 | } | 81 | } |
66 | 82 | ||
67 | #define local_irq_save(flags) __do_save_and_cli(&flags) | 83 | #define local_save_flags(flags) ((flags) = mfmsr()) |
68 | 84 | #define local_irq_save(flags) local_irq_save_ptr(&flags) | |
69 | #define irqs_disabled() \ | 85 | #define irqs_disabled() ((mfmsr() & MSR_EE) == 0) |
70 | ({ \ | ||
71 | unsigned long flags; \ | ||
72 | local_save_flags(flags); \ | ||
73 | !(flags & MSR_EE); \ | ||
74 | }) | ||
75 | 86 | ||
76 | #endif /* CONFIG_PPC_ISERIES */ | 87 | #endif /* CONFIG_PPC_ISERIES */ |
77 | 88 | ||
@@ -99,6 +110,6 @@ static inline void __do_save_and_cli(unsigned long *flags) | |||
99 | */ | 110 | */ |
100 | struct hw_interrupt_type; | 111 | struct hw_interrupt_type; |
101 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} | 112 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} |
102 | 113 | ||
103 | #endif /* _PPC64_HW_IRQ_H */ | 114 | #endif /* __KERNEL__ */ |
104 | #endif /* __KERNEL__ */ | 115 | #endif /* _ASM_POWERPC_HW_IRQ_H */ |
diff --git a/include/asm-ppc/hw_irq.h b/include/asm-ppc/hw_irq.h deleted file mode 100644 index da0fa940adb3..000000000000 --- a/include/asm-ppc/hw_irq.h +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu> | ||
3 | */ | ||
4 | #ifdef __KERNEL__ | ||
5 | #ifndef _PPC_HW_IRQ_H | ||
6 | #define _PPC_HW_IRQ_H | ||
7 | |||
8 | #include <asm/ptrace.h> | ||
9 | #include <asm/reg.h> | ||
10 | #include <asm/irq.h> | ||
11 | |||
12 | extern void timer_interrupt(struct pt_regs *); | ||
13 | |||
14 | #define irqs_disabled() ((mfmsr() & MSR_EE) == 0) | ||
15 | |||
16 | static inline void local_irq_disable(void) | ||
17 | { | ||
18 | unsigned long msr; | ||
19 | msr = mfmsr(); | ||
20 | mtmsr(msr & ~MSR_EE); | ||
21 | __asm__ __volatile__("": : :"memory"); | ||
22 | } | ||
23 | |||
24 | static inline void local_irq_enable(void) | ||
25 | { | ||
26 | unsigned long msr; | ||
27 | __asm__ __volatile__("": : :"memory"); | ||
28 | msr = mfmsr(); | ||
29 | mtmsr(msr | MSR_EE); | ||
30 | } | ||
31 | |||
32 | static inline void local_irq_save_ptr(unsigned long *flags) | ||
33 | { | ||
34 | unsigned long msr; | ||
35 | msr = mfmsr(); | ||
36 | *flags = msr; | ||
37 | mtmsr(msr & ~MSR_EE); | ||
38 | __asm__ __volatile__("": : :"memory"); | ||
39 | } | ||
40 | |||
41 | #define local_save_flags(flags) ((flags) = mfmsr()) | ||
42 | #define local_irq_save(flags) local_irq_save_ptr(&flags) | ||
43 | #define local_irq_restore(flags) mtmsr(flags) | ||
44 | |||
45 | extern void do_lost_interrupts(unsigned long); | ||
46 | |||
47 | #define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);}) | ||
48 | #define unmask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->enable) irq_desc[irq].handler->enable(irq);}) | ||
49 | #define ack_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->ack) irq_desc[irq].handler->ack(irq);}) | ||
50 | |||
51 | /* Should we handle this via lost interrupts and IPIs or should we don't care like | ||
52 | * we do now ? --BenH. | ||
53 | */ | ||
54 | struct hw_interrupt_type; | ||
55 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} | ||
56 | |||
57 | |||
58 | #endif /* _PPC_HW_IRQ_H */ | ||
59 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index bd9674807f05..137ea0cf34d3 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h | |||
@@ -24,6 +24,12 @@ | |||
24 | */ | 24 | */ |
25 | #define ARCH_HAS_IRQ_PER_CPU | 25 | #define ARCH_HAS_IRQ_PER_CPU |
26 | 26 | ||
27 | #define get_irq_desc(irq) (&irq_desc[(irq)]) | ||
28 | |||
29 | /* Define a way to iterate across irqs. */ | ||
30 | #define for_each_irq(i) \ | ||
31 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | ||
32 | |||
27 | #if defined(CONFIG_40x) | 33 | #if defined(CONFIG_40x) |
28 | #include <asm/ibm4xx.h> | 34 | #include <asm/ibm4xx.h> |
29 | 35 | ||