2 * include/asm-s390/hardirq.h
5 * Copyright (C) 1999 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)
9 * Derived from "include/asm-i386/hardirq.h"
12 #ifndef __ASM_HARDIRQ_H
13 #define __ASM_HARDIRQ_H
15 #include <linux/config.h>
16 #include <linux/threads.h>
17 #include <asm/lowcore.h>
18 #include <linux/sched.h>
20 /* entry.S is sensitive to the offsets of these fields */
22 unsigned int __softirq_pending;
23 unsigned int __local_irq_count;
24 unsigned int __local_bh_count;
25 unsigned int __syscall_count;
26 struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
27 } ____cacheline_aligned irq_cpustat_t;
29 #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
32 * Are we in an interrupt context? Either doing bottom half
33 * or hardware interrupt processing?
35 #define in_interrupt() ({ int __cpu = smp_processor_id(); \
36 (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
38 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
42 #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
43 #define hardirq_endlock(cpu) do { } while (0)
45 #define hardirq_enter(cpu) (local_irq_count(cpu)++)
46 #define hardirq_exit(cpu) (local_irq_count(cpu)--)
48 #define synchronize_irq() do { } while (0)
52 #include <asm/atomic.h>
55 extern atomic_t global_irq_holder;
56 extern atomic_t global_irq_lock;
57 extern atomic_t global_irq_count;
59 static inline void release_irqlock(int cpu)
61 /* if we didn't own the irq lock, just ignore.. */
62 if (atomic_read(&global_irq_holder) == cpu) {
63 atomic_set(&global_irq_holder,NO_PROC_ID);
64 atomic_set(&global_irq_lock,0);
68 static inline void hardirq_enter(int cpu)
70 ++local_irq_count(cpu);
71 atomic_inc(&global_irq_count);
74 static inline void hardirq_exit(int cpu)
76 atomic_dec(&global_irq_count);
77 --local_irq_count(cpu);
80 static inline int hardirq_trylock(int cpu)
82 return !atomic_read(&global_irq_count) &&
83 !atomic_read(&global_irq_lock);
86 #define hardirq_endlock(cpu) do { } while (0)
88 extern void synchronize_irq(void);
90 #endif /* CONFIG_SMP */
92 #endif /* __ASM_HARDIRQ_H */