1 #ifndef _ASM_IA64_HARDIRQ_H
2 #define _ASM_IA64_HARDIRQ_H
3
4 /*
5 * Copyright (C) 1998-2000 Hewlett-Packard Co
6 * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
9 #include <linux/config.h>
10
11 #include <linux/threads.h>
12 #include <linux/irq.h>
13
14 /* entry.S is sensitive to the offsets of these fields */
15 typedef struct {
16 unsigned int __softirq_active;
17 unsigned int __softirq_mask;
18 unsigned int __local_irq_count;
19 unsigned int __local_bh_count;
20 unsigned int __syscall_count;
21 unsigned int __nmi_count; /* arch dependent */
22 } ____cacheline_aligned irq_cpustat_t;
23
24 #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
25
26 /*
27 * Are we in an interrupt context? Either doing bottom half
28 * or hardware interrupt processing?
29 */
30 #define in_interrupt() \
31 ({ \
32 int __cpu = smp_processor_id(); \
33 (local_irq_count(__cpu) + local_bh_count(__cpu)) != 0; \
34 })
35
36 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
37
38 #ifndef CONFIG_SMP
39 # define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
40 # define hardirq_endlock(cpu) do { } while (0)
41
42 # define irq_enter(cpu, irq) (local_irq_count(cpu)++)
43 # define irq_exit(cpu, irq) (local_irq_count(cpu)--)
44
45 # define synchronize_irq() barrier()
46 #else
47
48 #include <asm/atomic.h>
49 #include <asm/smp.h>
50
51 extern unsigned int global_irq_holder;
52 extern volatile unsigned long global_irq_lock;
53
54 static inline int irqs_running (void)
55 {
56 int i;
57
58 for (i = 0; i < smp_num_cpus; i++)
59 if (local_irq_count(i))
60 return 1;
61 return 0;
62 }
63
64 static inline void release_irqlock(int cpu)
65 {
66 /* if we didn't own the irq lock, just ignore.. */
67 if (global_irq_holder == cpu) {
68 global_irq_holder = NO_PROC_ID;
69 clear_bit(0,&global_irq_lock);
70 }
71 }
72
73 static inline void irq_enter(int cpu, int irq)
74 {
75 local_irq_count(cpu)++;
76
77 while (test_bit(0,&global_irq_lock)) {
78 /* nothing */;
79 }
80 }
81
82 static inline void irq_exit(int cpu, int irq)
83 {
84 local_irq_count(cpu)--;
85 }
86
87 static inline int hardirq_trylock(int cpu)
88 {
89 return !local_irq_count(cpu) && !test_bit(0,&global_irq_lock);
90 }
91
92 #define hardirq_endlock(cpu) do { } while (0)
93
94 extern void synchronize_irq(void);
95
96 #endif /* CONFIG_SMP */
97 #endif /* _ASM_IA64_HARDIRQ_H */
98
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.