[PATCH] LSM: remove BSD secure level security module
[usb.git] / include / asm-powerpc / hw_irq.h
blobd40359204abaa1ff38743c718a72e40ba22d3f96
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/errno.h>
10 #include <asm/ptrace.h>
11 #include <asm/processor.h>
13 extern void timer_interrupt(struct pt_regs *);
15 #ifdef CONFIG_PPC_ISERIES
17 extern unsigned long local_get_flags(void);
18 extern unsigned long local_irq_disable(void);
19 extern void local_irq_restore(unsigned long);
21 #define local_irq_enable() local_irq_restore(1)
22 #define local_save_flags(flags) ((flags) = local_get_flags())
23 #define local_irq_save(flags) ((flags) = local_irq_disable())
25 #define irqs_disabled() (local_get_flags() == 0)
27 #else
29 #if defined(CONFIG_BOOKE)
30 #define SET_MSR_EE(x) mtmsr(x)
31 #define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
32 #elif defined(__powerpc64__)
33 #define SET_MSR_EE(x) __mtmsrd(x, 1)
34 #define local_irq_restore(flags) do { \
35 __asm__ __volatile__("": : :"memory"); \
36 __mtmsrd((flags), 1); \
37 } while(0)
38 #else
39 #define SET_MSR_EE(x) mtmsr(x)
40 #define local_irq_restore(flags) mtmsr(flags)
41 #endif
43 static inline void local_irq_disable(void)
45 #ifdef CONFIG_BOOKE
46 __asm__ __volatile__("wrteei 0": : :"memory");
47 #else
48 unsigned long msr;
49 __asm__ __volatile__("": : :"memory");
50 msr = mfmsr();
51 SET_MSR_EE(msr & ~MSR_EE);
52 #endif
55 static inline void local_irq_enable(void)
57 #ifdef CONFIG_BOOKE
58 __asm__ __volatile__("wrteei 1": : :"memory");
59 #else
60 unsigned long msr;
61 __asm__ __volatile__("": : :"memory");
62 msr = mfmsr();
63 SET_MSR_EE(msr | MSR_EE);
64 #endif
67 static inline void local_irq_save_ptr(unsigned long *flags)
69 unsigned long msr;
70 msr = mfmsr();
71 *flags = msr;
72 #ifdef CONFIG_BOOKE
73 __asm__ __volatile__("wrteei 0": : :"memory");
74 #else
75 SET_MSR_EE(msr & ~MSR_EE);
76 #endif
77 __asm__ __volatile__("": : :"memory");
80 #define local_save_flags(flags) ((flags) = mfmsr())
81 #define local_irq_save(flags) local_irq_save_ptr(&flags)
82 #define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
84 #endif /* CONFIG_PPC_ISERIES */
86 #define mask_irq(irq) \
87 ({ \
88 irq_desc_t *desc = get_irq_desc(irq); \
89 if (desc->chip && desc->chip->disable) \
90 desc->chip->disable(irq); \
92 #define unmask_irq(irq) \
93 ({ \
94 irq_desc_t *desc = get_irq_desc(irq); \
95 if (desc->chip && desc->chip->enable) \
96 desc->chip->enable(irq); \
98 #define ack_irq(irq) \
99 ({ \
100 irq_desc_t *desc = get_irq_desc(irq); \
101 if (desc->chip && desc->chip->ack) \
102 desc->chip->ack(irq); \
106 * interrupt-retrigger: should we handle this via lost interrupts and IPIs
107 * or should we not care like we do now ? --BenH.
109 struct hw_interrupt_type;
111 #endif /* __KERNEL__ */
112 #endif /* _ASM_POWERPC_HW_IRQ_H */