TCP: Fix and simplify microsecond rtt sampling
[linux/fpc-iii.git] / include / asm-powerpc / hw_irq.h
blob26b89d859c56e24245a72cdad5e314a1612f5ef5
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
7 #ifdef __KERNEL__
9 #include <linux/config.h>
10 #include <linux/errno.h>
11 #include <asm/ptrace.h>
12 #include <asm/processor.h>
14 extern void timer_interrupt(struct pt_regs *);
16 #ifdef CONFIG_PPC_ISERIES
18 extern unsigned long local_get_flags(void);
19 extern unsigned long local_irq_disable(void);
20 extern void local_irq_restore(unsigned long);
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())
26 #define irqs_disabled() (local_get_flags() == 0)
28 #else
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
44 static inline void local_irq_disable(void)
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
56 static inline void local_irq_enable(void)
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
68 static inline void local_irq_save_ptr(unsigned long *flags)
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");
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)
85 #endif /* CONFIG_PPC_ISERIES */
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); \
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); \
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); \
106 /* Should we handle this via lost interrupts and IPIs or should we don't care like
107 * we do now ? --BenH.
109 struct hw_interrupt_type;
110 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
112 #endif /* __KERNEL__ */
113 #endif /* _ASM_POWERPC_HW_IRQ_H */