diff options
Diffstat (limited to 'include/asm-s390')
-rw-r--r-- | include/asm-s390/Kbuild | 4 | ||||
-rw-r--r-- | include/asm-s390/irqflags.h | 50 | ||||
-rw-r--r-- | include/asm-s390/percpu.h | 1 | ||||
-rw-r--r-- | include/asm-s390/rwsem.h | 31 | ||||
-rw-r--r-- | include/asm-s390/semaphore.h | 3 | ||||
-rw-r--r-- | include/asm-s390/system.h | 32 |
6 files changed, 87 insertions, 34 deletions
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild new file mode 100644 index 000000000000..ed8955f49e47 --- /dev/null +++ b/include/asm-s390/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
3 | unifdef-y += cmb.h debug.h | ||
4 | header-y += dasd.h qeth.h tape390.h ucontext.h vtoc.h z90crypt.h | ||
diff --git a/include/asm-s390/irqflags.h b/include/asm-s390/irqflags.h new file mode 100644 index 000000000000..65f4db627e7a --- /dev/null +++ b/include/asm-s390/irqflags.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
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 | |||
28 | #define raw_local_save_flags(x) \ | ||
29 | __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) ) | ||
30 | |||
31 | #define raw_local_irq_restore(x) \ | ||
32 | __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory") | ||
33 | |||
34 | #define raw_irqs_disabled() \ | ||
35 | ({ \ | ||
36 | unsigned long flags; \ | ||
37 | local_save_flags(flags); \ | ||
38 | !((flags >> __FLAG_SHIFT) & 3); \ | ||
39 | }) | ||
40 | |||
41 | static inline int raw_irqs_disabled_flags(unsigned long flags) | ||
42 | { | ||
43 | return !((flags >> __FLAG_SHIFT) & 3); | ||
44 | } | ||
45 | |||
46 | /* For spinlocks etc */ | ||
47 | #define raw_local_irq_save(x) ((x) = raw_local_irq_disable()) | ||
48 | |||
49 | #endif /* __KERNEL__ */ | ||
50 | #endif /* __ASM_IRQFLAGS_H */ | ||
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h index d9a8cca9b653..28b3517e787c 100644 --- a/include/asm-s390/percpu.h +++ b/include/asm-s390/percpu.h | |||
@@ -42,6 +42,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
42 | #define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) | 42 | #define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) |
43 | #define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) | 43 | #define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) |
44 | #define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) | 44 | #define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) |
45 | #define per_cpu_offset(x) (__per_cpu_offset[x]) | ||
45 | 46 | ||
46 | /* A macro to avoid #include hell... */ | 47 | /* A macro to avoid #include hell... */ |
47 | #define percpu_modcopy(pcpudst, src, size) \ | 48 | #define percpu_modcopy(pcpudst, src, size) \ |
diff --git a/include/asm-s390/rwsem.h b/include/asm-s390/rwsem.h index 0422a085dd56..13ec16965150 100644 --- a/include/asm-s390/rwsem.h +++ b/include/asm-s390/rwsem.h | |||
@@ -61,6 +61,9 @@ struct rw_semaphore { | |||
61 | signed long count; | 61 | signed long count; |
62 | spinlock_t wait_lock; | 62 | spinlock_t wait_lock; |
63 | struct list_head wait_list; | 63 | struct list_head wait_list; |
64 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
65 | struct lockdep_map dep_map; | ||
66 | #endif | ||
64 | }; | 67 | }; |
65 | 68 | ||
66 | #ifndef __s390x__ | 69 | #ifndef __s390x__ |
@@ -80,8 +83,16 @@ struct rw_semaphore { | |||
80 | /* | 83 | /* |
81 | * initialisation | 84 | * initialisation |
82 | */ | 85 | */ |
86 | |||
87 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
88 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
89 | #else | ||
90 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
91 | #endif | ||
92 | |||
83 | #define __RWSEM_INITIALIZER(name) \ | 93 | #define __RWSEM_INITIALIZER(name) \ |
84 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } | 94 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ |
95 | __RWSEM_DEP_MAP_INIT(name) } | ||
85 | 96 | ||
86 | #define DECLARE_RWSEM(name) \ | 97 | #define DECLARE_RWSEM(name) \ |
87 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 98 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
@@ -93,6 +104,17 @@ static inline void init_rwsem(struct rw_semaphore *sem) | |||
93 | INIT_LIST_HEAD(&sem->wait_list); | 104 | INIT_LIST_HEAD(&sem->wait_list); |
94 | } | 105 | } |
95 | 106 | ||
107 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
108 | struct lock_class_key *key); | ||
109 | |||
110 | #define init_rwsem(sem) \ | ||
111 | do { \ | ||
112 | static struct lock_class_key __key; \ | ||
113 | \ | ||
114 | __init_rwsem((sem), #sem, &__key); \ | ||
115 | } while (0) | ||
116 | |||
117 | |||
96 | /* | 118 | /* |
97 | * lock for reading | 119 | * lock for reading |
98 | */ | 120 | */ |
@@ -155,7 +177,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) | |||
155 | /* | 177 | /* |
156 | * lock for writing | 178 | * lock for writing |
157 | */ | 179 | */ |
158 | static inline void __down_write(struct rw_semaphore *sem) | 180 | static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) |
159 | { | 181 | { |
160 | signed long old, new, tmp; | 182 | signed long old, new, tmp; |
161 | 183 | ||
@@ -181,6 +203,11 @@ static inline void __down_write(struct rw_semaphore *sem) | |||
181 | rwsem_down_write_failed(sem); | 203 | rwsem_down_write_failed(sem); |
182 | } | 204 | } |
183 | 205 | ||
206 | static inline void __down_write(struct rw_semaphore *sem) | ||
207 | { | ||
208 | __down_write_nested(sem, 0); | ||
209 | } | ||
210 | |||
184 | /* | 211 | /* |
185 | * trylock for writing -- returns 1 if successful, 0 if contention | 212 | * trylock for writing -- returns 1 if successful, 0 if contention |
186 | */ | 213 | */ |
diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h index 702cf436698c..32cdc69f39f4 100644 --- a/include/asm-s390/semaphore.h +++ b/include/asm-s390/semaphore.h | |||
@@ -37,7 +37,8 @@ struct semaphore { | |||
37 | 37 | ||
38 | static inline void sema_init (struct semaphore *sem, int val) | 38 | static inline void sema_init (struct semaphore *sem, int val) |
39 | { | 39 | { |
40 | *sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val); | 40 | atomic_set(&sem->count, val); |
41 | init_waitqueue_head(&sem->wait); | ||
41 | } | 42 | } |
42 | 43 | ||
43 | static inline void init_MUTEX (struct semaphore *sem) | 44 | static inline void init_MUTEX (struct semaphore *sem) |
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 71a0732cd518..9ab186ffde23 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -301,34 +301,6 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
301 | #define set_mb(var, value) do { var = value; mb(); } while (0) | 301 | #define set_mb(var, value) do { var = value; mb(); } while (0) |
302 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | 302 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) |
303 | 303 | ||
304 | /* interrupt control.. */ | ||
305 | #define local_irq_enable() ({ \ | ||
306 | unsigned long __dummy; \ | ||
307 | __asm__ __volatile__ ( \ | ||
308 | "stosm 0(%1),0x03" \ | ||
309 | : "=m" (__dummy) : "a" (&__dummy) : "memory" ); \ | ||
310 | }) | ||
311 | |||
312 | #define local_irq_disable() ({ \ | ||
313 | unsigned long __flags; \ | ||
314 | __asm__ __volatile__ ( \ | ||
315 | "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \ | ||
316 | __flags; \ | ||
317 | }) | ||
318 | |||
319 | #define local_save_flags(x) \ | ||
320 | __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x), "m" (x) ) | ||
321 | |||
322 | #define local_irq_restore(x) \ | ||
323 | __asm__ __volatile__("ssm 0(%0)" : : "a" (&x), "m" (x) : "memory") | ||
324 | |||
325 | #define irqs_disabled() \ | ||
326 | ({ \ | ||
327 | unsigned long flags; \ | ||
328 | local_save_flags(flags); \ | ||
329 | !((flags >> __FLAG_SHIFT) & 3); \ | ||
330 | }) | ||
331 | |||
332 | #ifdef __s390x__ | 304 | #ifdef __s390x__ |
333 | 305 | ||
334 | #define __ctl_load(array, low, high) ({ \ | 306 | #define __ctl_load(array, low, high) ({ \ |
@@ -442,8 +414,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
442 | }) | 414 | }) |
443 | #endif /* __s390x__ */ | 415 | #endif /* __s390x__ */ |
444 | 416 | ||
445 | /* For spinlocks etc */ | 417 | #include <linux/irqflags.h> |
446 | #define local_irq_save(x) ((x) = local_irq_disable()) | ||
447 | 418 | ||
448 | /* | 419 | /* |
449 | * Use to set psw mask except for the first byte which | 420 | * Use to set psw mask except for the first byte which |
@@ -482,4 +453,3 @@ extern void (*_machine_power_off)(void); | |||
482 | #endif /* __KERNEL__ */ | 453 | #endif /* __KERNEL__ */ |
483 | 454 | ||
484 | #endif | 455 | #endif |
485 | |||