1 /*
2 * include/asm-s390/hardirq.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
8 *
9 * Derived from "include/asm-i386/hardirq.h"
10 */
11
12 #ifndef __ASM_HARDIRQ_H
13 #define __ASM_HARDIRQ_H
14
15 #include <linux/config.h>
16 #include <linux/threads.h>
17 #include <asm/lowcore.h>
18 #include <linux/sched.h>
19
20 /* No irq_cpustat_t for s390, the data is held directly in S390_lowcore */
21
22 /*
23 * Simple wrappers reducing source bloat. S390 specific because each
24 * cpu stores its data in S390_lowcore (PSA) instead of using a cache
25 * aligned array element like most architectures.
26 */
27
28 #ifdef CONFIG_SMP
29
30 #define softirq_active(cpu) (safe_get_cpu_lowcore(cpu).__softirq_active)
31 #define softirq_mask(cpu) (safe_get_cpu_lowcore(cpu).__softirq_mask)
32 #define local_irq_count(cpu) (safe_get_cpu_lowcore(cpu).__local_irq_count)
33 #define local_bh_count(cpu) (safe_get_cpu_lowcore(cpu).__local_bh_count)
34 #define syscall_count(cpu) (safe_get_cpu_lowcore(cpu).__syscall_count)
35
36 #else /* CONFIG_SMP */
37
38 /* Optimize away the cpu calculation, it is always current PSA */
39 #define softirq_active(cpu) ((void)(cpu), S390_lowcore.__softirq_active)
40 #define softirq_mask(cpu) ((void)(cpu), S390_lowcore.__softirq_mask)
41 #define local_irq_count(cpu) ((void)(cpu), S390_lowcore.__local_irq_count)
42 #define local_bh_count(cpu) ((void)(cpu), S390_lowcore.__local_bh_count)
43 #define syscall_count(cpu) ((void)(cpu), S390_lowcore.__syscall_count)
44
45 #endif /* CONFIG_SMP */
46
47 /*
48 * Are we in an interrupt context? Either doing bottom half
49 * or hardware interrupt processing?
50 * Special definitions for s390, always access current PSA.
51 */
52 #define in_interrupt() ((S390_lowcore.__local_irq_count + S390_lowcore.__local_bh_count) != 0)
53
54 #define in_irq() (S390_lowcore.__local_irq_count != 0)
55
56 #ifndef CONFIG_SMP
57
58 #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
59 #define hardirq_endlock(cpu) do { } while (0)
60
61 #define hardirq_enter(cpu) (local_irq_count(cpu)++)
62 #define hardirq_exit(cpu) (local_irq_count(cpu)--)
63
64 #define synchronize_irq() do { } while (0)
65
66 #else
67
68 #include <asm/atomic.h>
69 #include <asm/smp.h>
70
71 extern atomic_t global_irq_holder;
72 extern atomic_t global_irq_lock;
73 extern atomic_t global_irq_count;
74
75 static inline void release_irqlock(int cpu)
76 {
77 /* if we didn't own the irq lock, just ignore.. */
78 if (atomic_read(&global_irq_holder) == cpu) {
79 atomic_set(&global_irq_holder,NO_PROC_ID);
80 clear_bit(0,&global_irq_lock);
81 }
82 }
83
84 static inline void hardirq_enter(int cpu)
85 {
86 ++local_irq_count(cpu);
87 atomic_inc(&global_irq_count);
88 }
89
90 static inline void hardirq_exit(int cpu)
91 {
92 atomic_dec(&global_irq_count);
93 --local_irq_count(cpu);
94 }
95
96 static inline int hardirq_trylock(int cpu)
97 {
98 return !atomic_read(&global_irq_count) && !test_bit(0,&global_irq_lock);
99 }
100
101 #define hardirq_endlock(cpu) do { } while (0)
102
103 extern void synchronize_irq(void);
104
105 #endif /* CONFIG_SMP */
106
107 #endif /* __ASM_HARDIRQ_H */
108
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.