1 /* hardirq.h: 32-bit Sparc hard IRQ support.
3 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
4 * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au)
7 #ifndef __SPARC_HARDIRQ_H
8 #define __SPARC_HARDIRQ_H
10 #include <linux/threads.h>
13 extern unsigned int local_irq_count
;
16 * Are we in an interrupt context? Either doing bottom half
17 * or hardware interrupt processing?
19 #define in_interrupt() ((local_irq_count + local_bh_count) != 0)
21 #define hardirq_trylock(cpu) (local_irq_count == 0)
22 #define hardirq_endlock(cpu) do { } while (0)
24 #define hardirq_enter(cpu) (local_irq_count++)
25 #define hardirq_exit(cpu) (local_irq_count--)
27 #define synchronize_irq() barrier()
31 #include <asm/atomic.h>
32 #include <asm/spinlock.h>
33 #include <asm/system.h>
36 extern unsigned int local_irq_count
[NR_CPUS
];
37 extern unsigned char global_irq_holder
;
38 extern spinlock_t global_irq_lock
;
39 extern atomic_t global_irq_count
;
42 * Are we in an interrupt context? Either doing bottom half
43 * or hardware interrupt processing?
45 #define in_interrupt() ({ int __cpu = smp_processor_id(); \
46 (local_irq_count[__cpu] + local_bh_count[__cpu] != 0); })
48 static inline void release_irqlock(int cpu
)
50 /* if we didn't own the irq lock, just ignore.. */
51 if (global_irq_holder
== (unsigned char) cpu
) {
52 global_irq_holder
= NO_PROC_ID
;
53 spin_unlock(&global_irq_lock
);
57 static inline void hardirq_enter(int cpu
)
59 ++local_irq_count
[cpu
];
60 atomic_inc(&global_irq_count
);
63 static inline void hardirq_exit(int cpu
)
65 atomic_dec(&global_irq_count
);
66 --local_irq_count
[cpu
];
69 static inline int hardirq_trylock(int cpu
)
71 return (! atomic_read(&global_irq_count
) &&
72 ! spin_is_locked (&global_irq_lock
));
75 #define hardirq_endlock(cpu) do { } while (0)
77 extern void synchronize_irq(void);
81 #endif /* __SPARC_HARDIRQ_H */