cleanup
[linux-2.4.21-pre4.git] / include / asm-ppc64 / hw_irq.h
1 /*
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  */
11 #ifdef __KERNEL__
12 #ifndef _PPC64_HW_IRQ_H
13 #define _PPC64_HW_IRQ_H
14
15 #include <linux/config.h>
16 #include <asm/irq.h>
17
18 int timer_interrupt(struct pt_regs *);
19
20 #ifdef CONFIG_PPC_ISERIES
21
22 extern void __no_use_sti(void);
23 extern void __no_use_cli(void);
24 extern void __no_use_restore_flags(unsigned long);
25 extern unsigned long __no_use_save_flags(void);
26 extern void __no_use_set_lost(unsigned long);
27 extern void __no_lpq_restore_flags(unsigned long);
28
29 #define __cli()                 __no_use_cli()
30 #define __sti()                 __no_use_sti()
31 #define __save_flags(flags)     ((flags) = __no_use_save_flags())
32 #define __restore_flags(flags)  __no_use_restore_flags((unsigned long)flags)
33 #define __save_and_cli(flags)   ({__save_flags(flags);__cli();})
34 #define __save_and_sti(flags)   ({__save_flags(flags);__sti();})
35
36 #else
37
38 #define __save_flags(flags)     ((flags) = mfmsr())
39 #define __restore_flags(flags) do { \
40         __asm__ __volatile__("": : :"memory"); \
41         mtmsrd(flags); \
42 } while(0)
43
44 static inline void __cli(void)
45 {
46         unsigned long msr;
47         msr = mfmsr();
48         mtmsrd(msr & ~MSR_EE);
49         __asm__ __volatile__("": : :"memory");
50 }
51
52 static inline void __sti(void)
53 {
54         unsigned long msr;
55         __asm__ __volatile__("": : :"memory");
56         msr = mfmsr();
57         mtmsrd(msr | MSR_EE);
58 }
59
60 static inline void __do_save_and_cli(unsigned long *flags)
61 {
62         unsigned long msr;
63         msr = mfmsr();
64         *flags = msr;
65         mtmsrd(msr & ~MSR_EE);
66         __asm__ __volatile__("": : :"memory");
67 }
68
69 #define __save_and_cli(flags)          __do_save_and_cli(&flags)
70 #define __save_and_sti(flags)           ({__save_flags(flags);__sti();})
71
72 #endif /* CONFIG_PPC_ISERIES */
73
74 #define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);})
75 #define unmask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->enable) irq_desc[irq].handler->enable(irq);})
76 #define ack_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->ack) irq_desc[irq].handler->ack(irq);})
77
78 /* Should we handle this via lost interrupts and IPIs or should we don't care like
79  * we do now ? --BenH.
80  */
81 struct hw_interrupt_type;
82 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
83
84 #endif /* _PPC64_HW_IRQ_H */
85 #endif /* __KERNEL__ */