blob: 3b566a5b3cc73e19d2487931283da12a0b008d65 [file] [log] [blame]
Heiko Carstens1f194a42006-07-03 00:24:46 -07001/*
2 * include/asm-s390/irqflags.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H
10
11#ifdef __KERNEL__
12
13/* interrupt control.. */
14#define raw_local_irq_enable() ({ \
15 unsigned long __dummy; \
16 __asm__ __volatile__ ( \
17 "stosm 0(%1),0x03" \
18 : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \
19 })
20
21#define raw_local_irq_disable() ({ \
22 unsigned long __flags; \
23 __asm__ __volatile__ ( \
24 "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
25 __flags; \
26 })
27
Heiko Carstens63f4f9e2006-07-12 16:39:47 +020028#define raw_local_save_flags(x) \
29do { \
30 typecheck(unsigned long, x); \
31 __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) ); \
32} while (0)
Heiko Carstens1f194a42006-07-03 00:24:46 -070033
Heiko Carstens63f4f9e2006-07-12 16:39:47 +020034#define raw_local_irq_restore(x) \
35do { \
36 typecheck(unsigned long, x); \
37 __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory"); \
38} while (0)
Heiko Carstens1f194a42006-07-03 00:24:46 -070039
40#define raw_irqs_disabled() \
41({ \
42 unsigned long flags; \
Heiko Carstens63f4f9e2006-07-12 16:39:47 +020043 raw_local_save_flags(flags); \
Heiko Carstens1f194a42006-07-03 00:24:46 -070044 !((flags >> __FLAG_SHIFT) & 3); \
45})
46
47static inline int raw_irqs_disabled_flags(unsigned long flags)
48{
49 return !((flags >> __FLAG_SHIFT) & 3);
50}
51
52/* For spinlocks etc */
53#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
54
55#endif /* __KERNEL__ */
56#endif /* __ASM_IRQFLAGS_H */