1 #ifndef __ASM_SH_SMPLOCK_H
2 #define __ASM_SH_SMPLOCK_H
3
4 /*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10 #include <linux/config.h>
11
12 #ifndef CONFIG_SMP
13
14 #define lock_kernel() do { } while(0)
15 #define unlock_kernel() do { } while(0)
16 #define release_kernel_lock(task, cpu, depth) ((depth) = 1)
17 #define reacquire_kernel_lock(task, cpu, depth) do { } while(0)
18
19 #else
20
21 #error "We do not support SMP on SH yet"
22 /*
23 * Default SMP lock implementation
24 */
25
26 #include <linux/interrupt.h>
27 #include <asm/spinlock.h>
28
29 extern spinlock_t kernel_flag;
30
31 /*
32 * Getting the big kernel lock.
33 *
34 * This cannot happen asynchronously,
35 * so we only need to worry about other
36 * CPU's.
37 */
38 extern __inline__ void lock_kernel(void)
39 {
40 if (!++current->lock_depth)
41 spin_lock(&kernel_flag);
42 }
43
44 extern __inline__ void unlock_kernel(void)
45 {
46 if (--current->lock_depth < 0)
47 spin_unlock(&kernel_flag);
48 }
49
50 /*
51 * Release global kernel lock and global interrupt lock
52 */
53 #define release_kernel_lock(task, cpu) \
54 do { \
55 if (task->lock_depth >= 0) \
56 spin_unlock(&kernel_flag); \
57 release_irqlock(cpu); \
58 __sti(); \
59 } while (0)
60
61 /*
62 * Re-acquire the kernel lock
63 */
64 #define reacquire_kernel_lock(task) \
65 do { \
66 if (task->lock_depth >= 0) \
67 spin_lock(&kernel_flag); \
68 } while (0)
69
70 #endif /* CONFIG_SMP */
71
72 #endif /* __ASM_SH_SMPLOCK_H */
73
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.