1 #ifndef __ASM_HARDIRQ_H
2 #define __ASM_HARDIRQ_H
6 extern unsigned int ppc_local_irq_count
[NR_CPUS
];
9 * Are we in an interrupt context? Either doing bottom half
10 * or hardware interrupt processing?
12 #define in_interrupt() ({ int __cpu = smp_processor_id(); \
13 (ppc_local_irq_count[__cpu] + ppc_local_bh_count[__cpu] != 0); })
17 #define hardirq_trylock(cpu) (ppc_local_irq_count[cpu] == 0)
18 #define hardirq_endlock(cpu) do { } while (0)
20 #define hardirq_enter(cpu) (ppc_local_irq_count[cpu]++)
21 #define hardirq_exit(cpu) (ppc_local_irq_count[cpu]--)
23 #define synchronize_irq() do { } while (0)
27 #include <asm/atomic.h>
29 extern unsigned char global_irq_holder
;
30 extern unsigned volatile int global_irq_lock
;
31 extern atomic_t global_irq_count
;
33 static inline void release_irqlock(int cpu
)
35 /* if we didn't own the irq lock, just ignore.. */
36 if (global_irq_holder
== (unsigned char) cpu
) {
37 global_irq_holder
= NO_PROC_ID
;
38 clear_bit(0,&global_irq_lock
);
42 static inline void hardirq_enter(int cpu
)
44 ++ppc_local_irq_count
[cpu
];
45 atomic_inc(&global_irq_count
);
48 static inline void hardirq_exit(int cpu
)
50 atomic_dec(&global_irq_count
);
51 --ppc_local_irq_count
[cpu
];
54 static inline int hardirq_trylock(int cpu
)
56 return !atomic_read(&global_irq_count
) && !test_bit(0,&global_irq_lock
);
59 #define hardirq_endlock(cpu) do { } while (0)
61 extern void synchronize_irq(void);
65 #endif /* __ASM_HARDIRQ_H */