1 /* $Id: hardirq.h,v 1.8 2000/03/02 02:37:13 ralf Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 #ifndef _ASM_HARDIRQ_H
11 #define _ASM_HARDIRQ_H
13 #include <linux/config.h>
14 #include <linux/threads.h>
15 #include <linux/irq.h>
18 unsigned int __local_irq_count
;
19 unsigned int __local_bh_count
;
20 } ____cacheline_aligned irq_cpustat_t
;
22 extern irq_cpustat_t irq_stat
[NR_CPUS
];
25 * Simple wrappers reducing source bloat
27 #define local_irq_count(cpu) (irq_stat[(cpu)].__local_irq_count)
28 #define local_bh_count(cpu) (irq_stat[(cpu)].__local_bh_count)
31 * Are we in an interrupt context? Either doing bottom half
32 * or hardware interrupt processing?
34 #define in_interrupt() ({ int __cpu = smp_processor_id(); \
35 (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
36 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
40 #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
41 #define hardirq_endlock(cpu) do { } while (0)
43 #define irq_enter(cpu) (local_irq_count(cpu)++)
44 #define irq_exit(cpu) (local_irq_count(cpu)--)
46 #define synchronize_irq() barrier();
50 #error No habla MIPS SMP
52 #endif /* CONFIG_SMP */
53 #endif /* _ASM_HARDIRQ_H */