1#ifndef __ASM_HARDIRQ_H 2#define __ASM_HARDIRQ_H 3 4#include <linux/config.h> 5#include <linux/cache.h> 6#include <linux/threads.h> 7 8/* softirq.h is sensitive to the offsets of these fields */ 9typedef struct { 10 unsigned int __softirq_pending; 11 unsigned int __local_irq_count; 12 unsigned int __local_bh_count; 13 unsigned int __syscall_count; 14 struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ 15} ____cacheline_aligned irq_cpustat_t; 16 17#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 18 19/* 20 * Are we in an interrupt context? Either doing bottom half 21 * or hardware interrupt processing? 22 */ 23#define in_interrupt() ({ const int __cpu = smp_processor_id(); \ 24 (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) 25 26#define in_irq() (local_irq_count(smp_processor_id()) != 0) 27 28#ifndef CONFIG_SMP 29 30#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) 31#define hardirq_endlock(cpu) do { } while (0) 32 33#define irq_enter(cpu,irq) (local_irq_count(cpu)++) 34#define irq_exit(cpu,irq) (local_irq_count(cpu)--) 35 36#define synchronize_irq() do { } while (0) 37 38#else 39#error SMP not supported 40#endif /* CONFIG_SMP */ 41 42#endif /* __ASM_HARDIRQ_H */ 43