Import 2.1.116pre2
[davej-history.git] / include / asm-m68k / softirq.h
blob0798b0d7d45a6e3a64dd093ca4a77ff704d04274
1 #ifndef __M68K_SOFTIRQ_H
2 #define __M68K_SOFTIRQ_H
4 /*
5 * Software interrupts.. no SMP here either.
6 */
8 #include <asm/atomic.h>
10 #define get_active_bhs() (bh_mask & bh_active)
11 #define clear_active_bhs(x) atomic_clear_mask((x),&bh_active)
13 extern inline void init_bh(int nr, void (*routine)(void))
15 bh_base[nr] = routine;
16 bh_mask_count[nr] = 0;
17 bh_mask |= 1 << nr;
20 extern inline void mark_bh(int nr)
22 set_bit(nr, &bh_active);
26 * These use a mask count to correctly handle
27 * nested disable/enable calls
29 extern inline void disable_bh(int nr)
31 bh_mask &= ~(1 << nr);
32 bh_mask_count[nr]++;
35 extern inline void enable_bh(int nr)
37 if (!--bh_mask_count[nr])
38 bh_mask |= 1 << nr;
41 extern inline void remove_bh(int nr)
43 bh_base[nr] = NULL;
44 bh_mask &= ~(1 << nr);
47 extern unsigned int local_bh_count[NR_CPUS];
49 extern inline void start_bh_atomic(void)
51 local_bh_count[smp_processor_id()]++;
52 barrier();
55 extern inline void end_bh_atomic(void)
57 barrier();
58 local_bh_count[smp_processor_id()]--;
61 /* These are for the irq's testing the lock */
62 #define softirq_trylock(cpu) (local_bh_count[cpu] ? 0 : (local_bh_count[cpu]=1))
63 #define softirq_endlock(cpu) (local_bh_count[cpu] = 0)
64 #define synchronize_bh() do { } while (0)
66 #endif