diff options
Diffstat (limited to 'include')
155 files changed, 2789 insertions, 2612 deletions
diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h index 80780dba9986..8197c69eff44 100644 --- a/include/asm-alpha/spinlock.h +++ b/include/asm-alpha/spinlock.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <asm/current.h> | 7 | #include <asm/current.h> |
8 | 8 | ||
9 | |||
10 | /* | 9 | /* |
11 | * Simple spin lock operations. There are two variants, one clears IRQ's | 10 | * Simple spin lock operations. There are two variants, one clears IRQ's |
12 | * on the local processor, one does not. | 11 | * on the local processor, one does not. |
@@ -14,43 +13,18 @@ | |||
14 | * We make no fairness assumptions. They have a cost. | 13 | * We make no fairness assumptions. They have a cost. |
15 | */ | 14 | */ |
16 | 15 | ||
17 | typedef struct { | 16 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
18 | volatile unsigned int lock; | 17 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
19 | #ifdef CONFIG_DEBUG_SPINLOCK | 18 | #define __raw_spin_unlock_wait(x) \ |
20 | int on_cpu; | 19 | do { cpu_relax(); } while ((x)->lock) |
21 | int line_no; | 20 | |
22 | void *previous; | 21 | static inline void __raw_spin_unlock(raw_spinlock_t * lock) |
23 | struct task_struct * task; | ||
24 | const char *base_file; | ||
25 | #endif | ||
26 | } spinlock_t; | ||
27 | |||
28 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
29 | #define SPIN_LOCK_UNLOCKED (spinlock_t){ 0, -1, 0, NULL, NULL, NULL } | ||
30 | #else | ||
31 | #define SPIN_LOCK_UNLOCKED (spinlock_t){ 0 } | ||
32 | #endif | ||
33 | |||
34 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
35 | #define spin_is_locked(x) ((x)->lock != 0) | ||
36 | #define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) | ||
37 | |||
38 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
39 | extern void _raw_spin_unlock(spinlock_t * lock); | ||
40 | extern void debug_spin_lock(spinlock_t * lock, const char *, int); | ||
41 | extern int debug_spin_trylock(spinlock_t * lock, const char *, int); | ||
42 | #define _raw_spin_lock(LOCK) \ | ||
43 | debug_spin_lock(LOCK, __BASE_FILE__, __LINE__) | ||
44 | #define _raw_spin_trylock(LOCK) \ | ||
45 | debug_spin_trylock(LOCK, __BASE_FILE__, __LINE__) | ||
46 | #else | ||
47 | static inline void _raw_spin_unlock(spinlock_t * lock) | ||
48 | { | 22 | { |
49 | mb(); | 23 | mb(); |
50 | lock->lock = 0; | 24 | lock->lock = 0; |
51 | } | 25 | } |
52 | 26 | ||
53 | static inline void _raw_spin_lock(spinlock_t * lock) | 27 | static inline void __raw_spin_lock(raw_spinlock_t * lock) |
54 | { | 28 | { |
55 | long tmp; | 29 | long tmp; |
56 | 30 | ||
@@ -70,80 +44,64 @@ static inline void _raw_spin_lock(spinlock_t * lock) | |||
70 | : "m"(lock->lock) : "memory"); | 44 | : "m"(lock->lock) : "memory"); |
71 | } | 45 | } |
72 | 46 | ||
73 | static inline int _raw_spin_trylock(spinlock_t *lock) | 47 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
74 | { | 48 | { |
75 | return !test_and_set_bit(0, &lock->lock); | 49 | return !test_and_set_bit(0, &lock->lock); |
76 | } | 50 | } |
77 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
78 | |||
79 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
80 | 51 | ||
81 | /***********************************************************/ | 52 | /***********************************************************/ |
82 | 53 | ||
83 | typedef struct { | 54 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) |
84 | volatile unsigned int lock; | ||
85 | } rwlock_t; | ||
86 | |||
87 | #define RW_LOCK_UNLOCKED (rwlock_t){ 0 } | ||
88 | |||
89 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
90 | |||
91 | static inline int read_can_lock(rwlock_t *lock) | ||
92 | { | 55 | { |
93 | return (lock->lock & 1) == 0; | 56 | return (lock->lock & 1) == 0; |
94 | } | 57 | } |
95 | 58 | ||
96 | static inline int write_can_lock(rwlock_t *lock) | 59 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) |
97 | { | 60 | { |
98 | return lock->lock == 0; | 61 | return lock->lock == 0; |
99 | } | 62 | } |
100 | 63 | ||
101 | #ifdef CONFIG_DEBUG_RWLOCK | 64 | static inline void __raw_read_lock(raw_rwlock_t *lock) |
102 | extern void _raw_write_lock(rwlock_t * lock); | ||
103 | extern void _raw_read_lock(rwlock_t * lock); | ||
104 | #else | ||
105 | static inline void _raw_write_lock(rwlock_t * lock) | ||
106 | { | 65 | { |
107 | long regx; | 66 | long regx; |
108 | 67 | ||
109 | __asm__ __volatile__( | 68 | __asm__ __volatile__( |
110 | "1: ldl_l %1,%0\n" | 69 | "1: ldl_l %1,%0\n" |
111 | " bne %1,6f\n" | 70 | " blbs %1,6f\n" |
112 | " lda %1,1\n" | 71 | " subl %1,2,%1\n" |
113 | " stl_c %1,%0\n" | 72 | " stl_c %1,%0\n" |
114 | " beq %1,6f\n" | 73 | " beq %1,6f\n" |
115 | " mb\n" | 74 | " mb\n" |
116 | ".subsection 2\n" | 75 | ".subsection 2\n" |
117 | "6: ldl %1,%0\n" | 76 | "6: ldl %1,%0\n" |
118 | " bne %1,6b\n" | 77 | " blbs %1,6b\n" |
119 | " br 1b\n" | 78 | " br 1b\n" |
120 | ".previous" | 79 | ".previous" |
121 | : "=m" (*lock), "=&r" (regx) | 80 | : "=m" (*lock), "=&r" (regx) |
122 | : "m" (*lock) : "memory"); | 81 | : "m" (*lock) : "memory"); |
123 | } | 82 | } |
124 | 83 | ||
125 | static inline void _raw_read_lock(rwlock_t * lock) | 84 | static inline void __raw_write_lock(raw_rwlock_t *lock) |
126 | { | 85 | { |
127 | long regx; | 86 | long regx; |
128 | 87 | ||
129 | __asm__ __volatile__( | 88 | __asm__ __volatile__( |
130 | "1: ldl_l %1,%0\n" | 89 | "1: ldl_l %1,%0\n" |
131 | " blbs %1,6f\n" | 90 | " bne %1,6f\n" |
132 | " subl %1,2,%1\n" | 91 | " lda %1,1\n" |
133 | " stl_c %1,%0\n" | 92 | " stl_c %1,%0\n" |
134 | " beq %1,6f\n" | 93 | " beq %1,6f\n" |
135 | " mb\n" | 94 | " mb\n" |
136 | ".subsection 2\n" | 95 | ".subsection 2\n" |
137 | "6: ldl %1,%0\n" | 96 | "6: ldl %1,%0\n" |
138 | " blbs %1,6b\n" | 97 | " bne %1,6b\n" |
139 | " br 1b\n" | 98 | " br 1b\n" |
140 | ".previous" | 99 | ".previous" |
141 | : "=m" (*lock), "=&r" (regx) | 100 | : "=m" (*lock), "=&r" (regx) |
142 | : "m" (*lock) : "memory"); | 101 | : "m" (*lock) : "memory"); |
143 | } | 102 | } |
144 | #endif /* CONFIG_DEBUG_RWLOCK */ | ||
145 | 103 | ||
146 | static inline int _raw_read_trylock(rwlock_t * lock) | 104 | static inline int __raw_read_trylock(raw_rwlock_t * lock) |
147 | { | 105 | { |
148 | long regx; | 106 | long regx; |
149 | int success; | 107 | int success; |
@@ -165,7 +123,7 @@ static inline int _raw_read_trylock(rwlock_t * lock) | |||
165 | return success; | 123 | return success; |
166 | } | 124 | } |
167 | 125 | ||
168 | static inline int _raw_write_trylock(rwlock_t * lock) | 126 | static inline int __raw_write_trylock(raw_rwlock_t * lock) |
169 | { | 127 | { |
170 | long regx; | 128 | long regx; |
171 | int success; | 129 | int success; |
@@ -187,13 +145,7 @@ static inline int _raw_write_trylock(rwlock_t * lock) | |||
187 | return success; | 145 | return success; |
188 | } | 146 | } |
189 | 147 | ||
190 | static inline void _raw_write_unlock(rwlock_t * lock) | 148 | static inline void __raw_read_unlock(raw_rwlock_t * lock) |
191 | { | ||
192 | mb(); | ||
193 | lock->lock = 0; | ||
194 | } | ||
195 | |||
196 | static inline void _raw_read_unlock(rwlock_t * lock) | ||
197 | { | 149 | { |
198 | long regx; | 150 | long regx; |
199 | __asm__ __volatile__( | 151 | __asm__ __volatile__( |
@@ -209,4 +161,10 @@ static inline void _raw_read_unlock(rwlock_t * lock) | |||
209 | : "m" (*lock) : "memory"); | 161 | : "m" (*lock) : "memory"); |
210 | } | 162 | } |
211 | 163 | ||
164 | static inline void __raw_write_unlock(raw_rwlock_t * lock) | ||
165 | { | ||
166 | mb(); | ||
167 | lock->lock = 0; | ||
168 | } | ||
169 | |||
212 | #endif /* _ALPHA_SPINLOCK_H */ | 170 | #endif /* _ALPHA_SPINLOCK_H */ |
diff --git a/include/asm-alpha/spinlock_types.h b/include/asm-alpha/spinlock_types.h new file mode 100644 index 000000000000..8141eb5ebf0d --- /dev/null +++ b/include/asm-alpha/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _ALPHA_SPINLOCK_TYPES_H | ||
2 | #define _ALPHA_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h index 27d71e9d413b..21c0e16dce5f 100644 --- a/include/asm-arm/arch-pxa/pxafb.h +++ b/include/asm-arm/arch-pxa/pxafb.h | |||
@@ -66,3 +66,4 @@ struct pxafb_mach_info { | |||
66 | 66 | ||
67 | }; | 67 | }; |
68 | void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); | 68 | void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); |
69 | unsigned long pxafb_get_hsync_time(struct device *dev); | ||
diff --git a/include/asm-arm/arch-s3c2410/fb.h b/include/asm-arm/arch-s3c2410/fb.h new file mode 100644 index 000000000000..ac57bc887d82 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/fb.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* linux/include/asm/arch-s3c2410/fb.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org> | ||
4 | * | ||
5 | * Inspired by pxafb.h | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * | ||
12 | * Changelog: | ||
13 | * 07-Sep-2004 RTP Created file | ||
14 | * 03-Nov-2004 BJD Updated and minor cleanups | ||
15 | * 03-Aug-2005 RTP Renamed to fb.h | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARM_FB_H | ||
19 | #define __ASM_ARM_FB_H | ||
20 | |||
21 | #include <asm/arch/regs-lcd.h> | ||
22 | |||
23 | struct s3c2410fb_val { | ||
24 | unsigned int defval; | ||
25 | unsigned int min; | ||
26 | unsigned int max; | ||
27 | }; | ||
28 | |||
29 | struct s3c2410fb_hw { | ||
30 | unsigned long lcdcon1; | ||
31 | unsigned long lcdcon2; | ||
32 | unsigned long lcdcon3; | ||
33 | unsigned long lcdcon4; | ||
34 | unsigned long lcdcon5; | ||
35 | }; | ||
36 | |||
37 | struct s3c2410fb_mach_info { | ||
38 | unsigned char fixed_syncs; /* do not update sync/border */ | ||
39 | |||
40 | /* Screen size */ | ||
41 | int width; | ||
42 | int height; | ||
43 | |||
44 | /* Screen info */ | ||
45 | struct s3c2410fb_val xres; | ||
46 | struct s3c2410fb_val yres; | ||
47 | struct s3c2410fb_val bpp; | ||
48 | |||
49 | /* lcd configuration registers */ | ||
50 | struct s3c2410fb_hw regs; | ||
51 | |||
52 | /* GPIOs */ | ||
53 | |||
54 | unsigned long gpcup; | ||
55 | unsigned long gpcup_mask; | ||
56 | unsigned long gpccon; | ||
57 | unsigned long gpccon_mask; | ||
58 | unsigned long gpdup; | ||
59 | unsigned long gpdup_mask; | ||
60 | unsigned long gpdcon; | ||
61 | unsigned long gpdcon_mask; | ||
62 | |||
63 | /* lpc3600 control register */ | ||
64 | unsigned long lpcsel; | ||
65 | }; | ||
66 | |||
67 | void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info); | ||
68 | |||
69 | #endif /* __ASM_ARM_FB_H */ | ||
diff --git a/include/asm-arm/arch-s3c2410/regs-lcd.h b/include/asm-arm/arch-s3c2410/regs-lcd.h index 7f882ea92b2a..b6b1b4e8bbeb 100644 --- a/include/asm-arm/arch-s3c2410/regs-lcd.h +++ b/include/asm-arm/arch-s3c2410/regs-lcd.h | |||
@@ -51,21 +51,32 @@ | |||
51 | 51 | ||
52 | #define S3C2410_LCDCON1_ENVID (1) | 52 | #define S3C2410_LCDCON1_ENVID (1) |
53 | 53 | ||
54 | #define S3C2410_LCDCON1_MODEMASK 0x1E | ||
55 | |||
54 | #define S3C2410_LCDCON2_VBPD(x) ((x) << 24) | 56 | #define S3C2410_LCDCON2_VBPD(x) ((x) << 24) |
55 | #define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14) | 57 | #define S3C2410_LCDCON2_LINEVAL(x) ((x) << 14) |
56 | #define S3C2410_LCDCON2_VFPD(x) ((x) << 6) | 58 | #define S3C2410_LCDCON2_VFPD(x) ((x) << 6) |
57 | #define S3C2410_LCDCON2_VSPW(x) ((x) << 0) | 59 | #define S3C2410_LCDCON2_VSPW(x) ((x) << 0) |
58 | 60 | ||
61 | #define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF) | ||
62 | #define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >> 6) & 0xFF) | ||
63 | #define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >> 0) & 0x3F) | ||
64 | |||
59 | #define S3C2410_LCDCON3_HBPD(x) ((x) << 19) | 65 | #define S3C2410_LCDCON3_HBPD(x) ((x) << 19) |
60 | #define S3C2410_LCDCON3_WDLY(x) ((x) << 19) | 66 | #define S3C2410_LCDCON3_WDLY(x) ((x) << 19) |
61 | #define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8) | 67 | #define S3C2410_LCDCON3_HOZVAL(x) ((x) << 8) |
62 | #define S3C2410_LCDCON3_HFPD(x) ((x) << 0) | 68 | #define S3C2410_LCDCON3_HFPD(x) ((x) << 0) |
63 | #define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0) | 69 | #define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0) |
64 | 70 | ||
71 | #define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F) | ||
72 | #define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >> 0) & 0xFF) | ||
73 | |||
65 | #define S3C2410_LCDCON4_MVAL(x) ((x) << 8) | 74 | #define S3C2410_LCDCON4_MVAL(x) ((x) << 8) |
66 | #define S3C2410_LCDCON4_HSPW(x) ((x) << 0) | 75 | #define S3C2410_LCDCON4_HSPW(x) ((x) << 0) |
67 | #define S3C2410_LCDCON4_WLH(x) ((x) << 0) | 76 | #define S3C2410_LCDCON4_WLH(x) ((x) << 0) |
68 | 77 | ||
78 | #define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >> 0) & 0xFF) | ||
79 | |||
69 | #define S3C2410_LCDCON5_BPP24BL (1<<12) | 80 | #define S3C2410_LCDCON5_BPP24BL (1<<12) |
70 | #define S3C2410_LCDCON5_FRM565 (1<<11) | 81 | #define S3C2410_LCDCON5_FRM565 (1<<11) |
71 | #define S3C2410_LCDCON5_INVVCLK (1<<10) | 82 | #define S3C2410_LCDCON5_INVVCLK (1<<10) |
@@ -100,10 +111,16 @@ | |||
100 | #define S3C2410_DITHMODE S3C2410_LCDREG(0x4C) | 111 | #define S3C2410_DITHMODE S3C2410_LCDREG(0x4C) |
101 | #define S3C2410_TPAL S3C2410_LCDREG(0x50) | 112 | #define S3C2410_TPAL S3C2410_LCDREG(0x50) |
102 | 113 | ||
114 | #define S3C2410_TPAL_EN (1<<24) | ||
115 | |||
103 | /* interrupt info */ | 116 | /* interrupt info */ |
104 | #define S3C2410_LCDINTPND S3C2410_LCDREG(0x54) | 117 | #define S3C2410_LCDINTPND S3C2410_LCDREG(0x54) |
105 | #define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58) | 118 | #define S3C2410_LCDSRCPND S3C2410_LCDREG(0x58) |
106 | #define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C) | 119 | #define S3C2410_LCDINTMSK S3C2410_LCDREG(0x5C) |
120 | #define S3C2410_LCDINT_FIWSEL (1<<2) | ||
121 | #define S3C2410_LCDINT_FRSYNC (1<<1) | ||
122 | #define S3C2410_LCDINT_FICNT (1<<0) | ||
123 | |||
107 | #define S3C2410_LPCSEL S3C2410_LCDREG(0x60) | 124 | #define S3C2410_LPCSEL S3C2410_LCDREG(0x60) |
108 | 125 | ||
109 | #define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) | 126 | #define S3C2410_TFTPAL(x) S3C2410_LCDREG((0x400 + (x)*4)) |
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index 1f906d09b688..cb4906b45555 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h | |||
@@ -16,21 +16,14 @@ | |||
16 | * Unlocked value: 0 | 16 | * Unlocked value: 0 |
17 | * Locked value: 1 | 17 | * Locked value: 1 |
18 | */ | 18 | */ |
19 | typedef struct { | ||
20 | volatile unsigned int lock; | ||
21 | #ifdef CONFIG_PREEMPT | ||
22 | unsigned int break_lock; | ||
23 | #endif | ||
24 | } spinlock_t; | ||
25 | 19 | ||
26 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | 20 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
21 | #define __raw_spin_unlock_wait(lock) \ | ||
22 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | ||
27 | 23 | ||
28 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while (0) | 24 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
29 | #define spin_is_locked(x) ((x)->lock != 0) | ||
30 | #define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x)) | ||
31 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
32 | 25 | ||
33 | static inline void _raw_spin_lock(spinlock_t *lock) | 26 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
34 | { | 27 | { |
35 | unsigned long tmp; | 28 | unsigned long tmp; |
36 | 29 | ||
@@ -47,7 +40,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
47 | smp_mb(); | 40 | smp_mb(); |
48 | } | 41 | } |
49 | 42 | ||
50 | static inline int _raw_spin_trylock(spinlock_t *lock) | 43 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
51 | { | 44 | { |
52 | unsigned long tmp; | 45 | unsigned long tmp; |
53 | 46 | ||
@@ -67,7 +60,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) | |||
67 | } | 60 | } |
68 | } | 61 | } |
69 | 62 | ||
70 | static inline void _raw_spin_unlock(spinlock_t *lock) | 63 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
71 | { | 64 | { |
72 | smp_mb(); | 65 | smp_mb(); |
73 | 66 | ||
@@ -80,23 +73,14 @@ static inline void _raw_spin_unlock(spinlock_t *lock) | |||
80 | 73 | ||
81 | /* | 74 | /* |
82 | * RWLOCKS | 75 | * RWLOCKS |
83 | */ | 76 | * |
84 | typedef struct { | 77 | * |
85 | volatile unsigned int lock; | ||
86 | #ifdef CONFIG_PREEMPT | ||
87 | unsigned int break_lock; | ||
88 | #endif | ||
89 | } rwlock_t; | ||
90 | |||
91 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
92 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0) | ||
93 | #define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0) | ||
94 | |||
95 | /* | ||
96 | * Write locks are easy - we just set bit 31. When unlocking, we can | 78 | * Write locks are easy - we just set bit 31. When unlocking, we can |
97 | * just write zero since the lock is exclusively held. | 79 | * just write zero since the lock is exclusively held. |
98 | */ | 80 | */ |
99 | static inline void _raw_write_lock(rwlock_t *rw) | 81 | #define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0) |
82 | |||
83 | static inline void __raw_write_lock(rwlock_t *rw) | ||
100 | { | 84 | { |
101 | unsigned long tmp; | 85 | unsigned long tmp; |
102 | 86 | ||
@@ -113,7 +97,7 @@ static inline void _raw_write_lock(rwlock_t *rw) | |||
113 | smp_mb(); | 97 | smp_mb(); |
114 | } | 98 | } |
115 | 99 | ||
116 | static inline int _raw_write_trylock(rwlock_t *rw) | 100 | static inline int __raw_write_trylock(rwlock_t *rw) |
117 | { | 101 | { |
118 | unsigned long tmp; | 102 | unsigned long tmp; |
119 | 103 | ||
@@ -133,7 +117,7 @@ static inline int _raw_write_trylock(rwlock_t *rw) | |||
133 | } | 117 | } |
134 | } | 118 | } |
135 | 119 | ||
136 | static inline void _raw_write_unlock(rwlock_t *rw) | 120 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
137 | { | 121 | { |
138 | smp_mb(); | 122 | smp_mb(); |
139 | 123 | ||
@@ -156,7 +140,7 @@ static inline void _raw_write_unlock(rwlock_t *rw) | |||
156 | * currently active. However, we know we won't have any write | 140 | * currently active. However, we know we won't have any write |
157 | * locks. | 141 | * locks. |
158 | */ | 142 | */ |
159 | static inline void _raw_read_lock(rwlock_t *rw) | 143 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
160 | { | 144 | { |
161 | unsigned long tmp, tmp2; | 145 | unsigned long tmp, tmp2; |
162 | 146 | ||
@@ -173,7 +157,7 @@ static inline void _raw_read_lock(rwlock_t *rw) | |||
173 | smp_mb(); | 157 | smp_mb(); |
174 | } | 158 | } |
175 | 159 | ||
176 | static inline void _raw_read_unlock(rwlock_t *rw) | 160 | static inline void __raw_read_unlock(rwlock_t *rw) |
177 | { | 161 | { |
178 | unsigned long tmp, tmp2; | 162 | unsigned long tmp, tmp2; |
179 | 163 | ||
@@ -190,6 +174,6 @@ static inline void _raw_read_unlock(rwlock_t *rw) | |||
190 | : "cc"); | 174 | : "cc"); |
191 | } | 175 | } |
192 | 176 | ||
193 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 177 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
194 | 178 | ||
195 | #endif /* __ASM_SPINLOCK_H */ | 179 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-arm/spinlock_types.h b/include/asm-arm/spinlock_types.h new file mode 100644 index 000000000000..43e83f6d2ee5 --- /dev/null +++ b/include/asm-arm/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-arm26/hardirq.h b/include/asm-arm26/hardirq.h index 791ee1da9bfa..dc28daab8aa8 100644 --- a/include/asm-arm26/hardirq.h +++ b/include/asm-arm26/hardirq.h | |||
@@ -22,8 +22,6 @@ typedef struct { | |||
22 | # error HARDIRQ_BITS is too low! | 22 | # error HARDIRQ_BITS is too low! |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #define irq_enter() (preempt_count() += HARDIRQ_OFFSET) | ||
26 | |||
27 | #ifndef CONFIG_SMP | 25 | #ifndef CONFIG_SMP |
28 | 26 | ||
29 | extern asmlinkage void __do_softirq(void); | 27 | extern asmlinkage void __do_softirq(void); |
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h index 28ed8b296afc..75c67c785bb8 100644 --- a/include/asm-i386/div64.h +++ b/include/asm-i386/div64.h | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | #define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) | 36 | #define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) |
37 | 37 | ||
38 | extern inline long | 38 | static inline long |
39 | div_ll_X_l_rem(long long divs, long div, long *rem) | 39 | div_ll_X_l_rem(long long divs, long div, long *rem) |
40 | { | 40 | { |
41 | long dum2; | 41 | long dum2; |
diff --git a/include/asm-i386/mach-default/mach_reboot.h b/include/asm-i386/mach-default/mach_reboot.h index 521e227db679..06ae4d81ba6a 100644 --- a/include/asm-i386/mach-default/mach_reboot.h +++ b/include/asm-i386/mach-default/mach_reboot.h | |||
@@ -22,7 +22,15 @@ static inline void mach_reboot(void) | |||
22 | for (i = 0; i < 100; i++) { | 22 | for (i = 0; i < 100; i++) { |
23 | kb_wait(); | 23 | kb_wait(); |
24 | udelay(50); | 24 | udelay(50); |
25 | outb(0xfe, 0x64); /* pulse reset low */ | 25 | outb(0x60, 0x64); /* write Controller Command Byte */ |
26 | udelay(50); | ||
27 | kb_wait(); | ||
28 | udelay(50); | ||
29 | outb(0x14, 0x60); /* set "System flag" */ | ||
30 | udelay(50); | ||
31 | kb_wait(); | ||
32 | udelay(50); | ||
33 | outb(0xfe, 0x64); /* pulse reset low */ | ||
26 | udelay(50); | 34 | udelay(50); |
27 | } | 35 | } |
28 | } | 36 | } |
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 516421300ea2..348fe3a4879d 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -29,7 +29,7 @@ static inline void get_memcfg_numa(void) | |||
29 | #ifdef CONFIG_X86_NUMAQ | 29 | #ifdef CONFIG_X86_NUMAQ |
30 | if (get_memcfg_numaq()) | 30 | if (get_memcfg_numaq()) |
31 | return; | 31 | return; |
32 | #elif CONFIG_ACPI_SRAT | 32 | #elif defined(CONFIG_ACPI_SRAT) |
33 | if (get_memcfg_from_srat()) | 33 | if (get_memcfg_from_srat()) |
34 | return; | 34 | return; |
35 | #endif | 35 | #endif |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 37bef8ed7bed..0a4ec764377c 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -679,7 +679,7 @@ static inline void rep_nop(void) | |||
679 | However we don't do prefetches for pre XP Athlons currently | 679 | However we don't do prefetches for pre XP Athlons currently |
680 | That should be fixed. */ | 680 | That should be fixed. */ |
681 | #define ARCH_HAS_PREFETCH | 681 | #define ARCH_HAS_PREFETCH |
682 | extern inline void prefetch(const void *x) | 682 | static inline void prefetch(const void *x) |
683 | { | 683 | { |
684 | alternative_input(ASM_NOP4, | 684 | alternative_input(ASM_NOP4, |
685 | "prefetchnta (%1)", | 685 | "prefetchnta (%1)", |
@@ -693,7 +693,7 @@ extern inline void prefetch(const void *x) | |||
693 | 693 | ||
694 | /* 3dnow! prefetch to get an exclusive cache line. Useful for | 694 | /* 3dnow! prefetch to get an exclusive cache line. Useful for |
695 | spinlocks to avoid one state transition in the cache coherency protocol. */ | 695 | spinlocks to avoid one state transition in the cache coherency protocol. */ |
696 | extern inline void prefetchw(const void *x) | 696 | static inline void prefetchw(const void *x) |
697 | { | 697 | { |
698 | alternative_input(ASM_NOP4, | 698 | alternative_input(ASM_NOP4, |
699 | "prefetchw (%1)", | 699 | "prefetchw (%1)", |
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index f9ff31f40036..23604350cdf4 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h | |||
@@ -7,46 +7,21 @@ | |||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | 9 | ||
10 | asmlinkage int printk(const char * fmt, ...) | ||
11 | __attribute__ ((format (printf, 1, 2))); | ||
12 | |||
13 | /* | 10 | /* |
14 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 11 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
15 | */ | 12 | * |
16 | |||
17 | typedef struct { | ||
18 | volatile unsigned int slock; | ||
19 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
20 | unsigned magic; | ||
21 | #endif | ||
22 | #ifdef CONFIG_PREEMPT | ||
23 | unsigned int break_lock; | ||
24 | #endif | ||
25 | } spinlock_t; | ||
26 | |||
27 | #define SPINLOCK_MAGIC 0xdead4ead | ||
28 | |||
29 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
30 | #define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC | ||
31 | #else | ||
32 | #define SPINLOCK_MAGIC_INIT /* */ | ||
33 | #endif | ||
34 | |||
35 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } | ||
36 | |||
37 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
38 | |||
39 | /* | ||
40 | * Simple spin lock operations. There are two variants, one clears IRQ's | 13 | * Simple spin lock operations. There are two variants, one clears IRQ's |
41 | * on the local processor, one does not. | 14 | * on the local processor, one does not. |
42 | * | 15 | * |
43 | * We make no fairness assumptions. They have a cost. | 16 | * We make no fairness assumptions. They have a cost. |
17 | * | ||
18 | * (the type definitions are in asm/spinlock_types.h) | ||
44 | */ | 19 | */ |
45 | 20 | ||
46 | #define spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0) | 21 | #define __raw_spin_is_locked(x) \ |
47 | #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) | 22 | (*(volatile signed char *)(&(x)->slock) <= 0) |
48 | 23 | ||
49 | #define spin_lock_string \ | 24 | #define __raw_spin_lock_string \ |
50 | "\n1:\t" \ | 25 | "\n1:\t" \ |
51 | "lock ; decb %0\n\t" \ | 26 | "lock ; decb %0\n\t" \ |
52 | "jns 3f\n" \ | 27 | "jns 3f\n" \ |
@@ -57,7 +32,7 @@ typedef struct { | |||
57 | "jmp 1b\n" \ | 32 | "jmp 1b\n" \ |
58 | "3:\n\t" | 33 | "3:\n\t" |
59 | 34 | ||
60 | #define spin_lock_string_flags \ | 35 | #define __raw_spin_lock_string_flags \ |
61 | "\n1:\t" \ | 36 | "\n1:\t" \ |
62 | "lock ; decb %0\n\t" \ | 37 | "lock ; decb %0\n\t" \ |
63 | "jns 4f\n\t" \ | 38 | "jns 4f\n\t" \ |
@@ -73,86 +48,71 @@ typedef struct { | |||
73 | "jmp 1b\n" \ | 48 | "jmp 1b\n" \ |
74 | "4:\n\t" | 49 | "4:\n\t" |
75 | 50 | ||
51 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | ||
52 | { | ||
53 | __asm__ __volatile__( | ||
54 | __raw_spin_lock_string | ||
55 | :"=m" (lock->slock) : : "memory"); | ||
56 | } | ||
57 | |||
58 | static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | ||
59 | { | ||
60 | __asm__ __volatile__( | ||
61 | __raw_spin_lock_string_flags | ||
62 | :"=m" (lock->slock) : "r" (flags) : "memory"); | ||
63 | } | ||
64 | |||
65 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | ||
66 | { | ||
67 | char oldval; | ||
68 | __asm__ __volatile__( | ||
69 | "xchgb %b0,%1" | ||
70 | :"=q" (oldval), "=m" (lock->slock) | ||
71 | :"0" (0) : "memory"); | ||
72 | return oldval > 0; | ||
73 | } | ||
74 | |||
76 | /* | 75 | /* |
77 | * This works. Despite all the confusion. | 76 | * __raw_spin_unlock based on writing $1 to the low byte. |
78 | * (except on PPro SMP or if we are using OOSTORE) | 77 | * This method works. Despite all the confusion. |
78 | * (except on PPro SMP or if we are using OOSTORE, so we use xchgb there) | ||
79 | * (PPro errata 66, 92) | 79 | * (PPro errata 66, 92) |
80 | */ | 80 | */ |
81 | 81 | ||
82 | #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) | 82 | #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) |
83 | 83 | ||
84 | #define spin_unlock_string \ | 84 | #define __raw_spin_unlock_string \ |
85 | "movb $1,%0" \ | 85 | "movb $1,%0" \ |
86 | :"=m" (lock->slock) : : "memory" | 86 | :"=m" (lock->slock) : : "memory" |
87 | 87 | ||
88 | 88 | ||
89 | static inline void _raw_spin_unlock(spinlock_t *lock) | 89 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
90 | { | 90 | { |
91 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
92 | BUG_ON(lock->magic != SPINLOCK_MAGIC); | ||
93 | BUG_ON(!spin_is_locked(lock)); | ||
94 | #endif | ||
95 | __asm__ __volatile__( | 91 | __asm__ __volatile__( |
96 | spin_unlock_string | 92 | __raw_spin_unlock_string |
97 | ); | 93 | ); |
98 | } | 94 | } |
99 | 95 | ||
100 | #else | 96 | #else |
101 | 97 | ||
102 | #define spin_unlock_string \ | 98 | #define __raw_spin_unlock_string \ |
103 | "xchgb %b0, %1" \ | 99 | "xchgb %b0, %1" \ |
104 | :"=q" (oldval), "=m" (lock->slock) \ | 100 | :"=q" (oldval), "=m" (lock->slock) \ |
105 | :"0" (oldval) : "memory" | 101 | :"0" (oldval) : "memory" |
106 | 102 | ||
107 | static inline void _raw_spin_unlock(spinlock_t *lock) | 103 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
108 | { | 104 | { |
109 | char oldval = 1; | 105 | char oldval = 1; |
110 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
111 | BUG_ON(lock->magic != SPINLOCK_MAGIC); | ||
112 | BUG_ON(!spin_is_locked(lock)); | ||
113 | #endif | ||
114 | __asm__ __volatile__( | ||
115 | spin_unlock_string | ||
116 | ); | ||
117 | } | ||
118 | 106 | ||
119 | #endif | ||
120 | |||
121 | static inline int _raw_spin_trylock(spinlock_t *lock) | ||
122 | { | ||
123 | char oldval; | ||
124 | __asm__ __volatile__( | 107 | __asm__ __volatile__( |
125 | "xchgb %b0,%1" | 108 | __raw_spin_unlock_string |
126 | :"=q" (oldval), "=m" (lock->slock) | 109 | ); |
127 | :"0" (0) : "memory"); | ||
128 | return oldval > 0; | ||
129 | } | 110 | } |
130 | 111 | ||
131 | static inline void _raw_spin_lock(spinlock_t *lock) | ||
132 | { | ||
133 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
134 | if (unlikely(lock->magic != SPINLOCK_MAGIC)) { | ||
135 | printk("eip: %p\n", __builtin_return_address(0)); | ||
136 | BUG(); | ||
137 | } | ||
138 | #endif | 112 | #endif |
139 | __asm__ __volatile__( | ||
140 | spin_lock_string | ||
141 | :"=m" (lock->slock) : : "memory"); | ||
142 | } | ||
143 | 113 | ||
144 | static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) | 114 | #define __raw_spin_unlock_wait(lock) \ |
145 | { | 115 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) |
146 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
147 | if (unlikely(lock->magic != SPINLOCK_MAGIC)) { | ||
148 | printk("eip: %p\n", __builtin_return_address(0)); | ||
149 | BUG(); | ||
150 | } | ||
151 | #endif | ||
152 | __asm__ __volatile__( | ||
153 | spin_lock_string_flags | ||
154 | :"=m" (lock->slock) : "r" (flags) : "memory"); | ||
155 | } | ||
156 | 116 | ||
157 | /* | 117 | /* |
158 | * Read-write spinlocks, allowing multiple readers | 118 | * Read-write spinlocks, allowing multiple readers |
@@ -163,72 +123,41 @@ static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) | |||
163 | * can "mix" irq-safe locks - any writer needs to get a | 123 | * can "mix" irq-safe locks - any writer needs to get a |
164 | * irq-safe write-lock, but readers can get non-irqsafe | 124 | * irq-safe write-lock, but readers can get non-irqsafe |
165 | * read-locks. | 125 | * read-locks. |
126 | * | ||
127 | * On x86, we implement read-write locks as a 32-bit counter | ||
128 | * with the high bit (sign) being the "contended" bit. | ||
129 | * | ||
130 | * The inline assembly is non-obvious. Think about it. | ||
131 | * | ||
132 | * Changed to use the same technique as rw semaphores. See | ||
133 | * semaphore.h for details. -ben | ||
134 | * | ||
135 | * the helpers are in arch/i386/kernel/semaphore.c | ||
166 | */ | 136 | */ |
167 | typedef struct { | ||
168 | volatile unsigned int lock; | ||
169 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
170 | unsigned magic; | ||
171 | #endif | ||
172 | #ifdef CONFIG_PREEMPT | ||
173 | unsigned int break_lock; | ||
174 | #endif | ||
175 | } rwlock_t; | ||
176 | |||
177 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
178 | |||
179 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
180 | #define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC | ||
181 | #else | ||
182 | #define RWLOCK_MAGIC_INIT /* */ | ||
183 | #endif | ||
184 | |||
185 | #define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } | ||
186 | |||
187 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
188 | 137 | ||
189 | /** | 138 | /** |
190 | * read_can_lock - would read_trylock() succeed? | 139 | * read_can_lock - would read_trylock() succeed? |
191 | * @lock: the rwlock in question. | 140 | * @lock: the rwlock in question. |
192 | */ | 141 | */ |
193 | #define read_can_lock(x) ((int)(x)->lock > 0) | 142 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) |
194 | 143 | ||
195 | /** | 144 | /** |
196 | * write_can_lock - would write_trylock() succeed? | 145 | * write_can_lock - would write_trylock() succeed? |
197 | * @lock: the rwlock in question. | 146 | * @lock: the rwlock in question. |
198 | */ | 147 | */ |
199 | #define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 148 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) |
200 | 149 | ||
201 | /* | 150 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
202 | * On x86, we implement read-write locks as a 32-bit counter | ||
203 | * with the high bit (sign) being the "contended" bit. | ||
204 | * | ||
205 | * The inline assembly is non-obvious. Think about it. | ||
206 | * | ||
207 | * Changed to use the same technique as rw semaphores. See | ||
208 | * semaphore.h for details. -ben | ||
209 | */ | ||
210 | /* the spinlock helpers are in arch/i386/kernel/semaphore.c */ | ||
211 | |||
212 | static inline void _raw_read_lock(rwlock_t *rw) | ||
213 | { | 151 | { |
214 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
215 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
216 | #endif | ||
217 | __build_read_lock(rw, "__read_lock_failed"); | 152 | __build_read_lock(rw, "__read_lock_failed"); |
218 | } | 153 | } |
219 | 154 | ||
220 | static inline void _raw_write_lock(rwlock_t *rw) | 155 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
221 | { | 156 | { |
222 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
223 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
224 | #endif | ||
225 | __build_write_lock(rw, "__write_lock_failed"); | 157 | __build_write_lock(rw, "__write_lock_failed"); |
226 | } | 158 | } |
227 | 159 | ||
228 | #define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") | 160 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
229 | #define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") | ||
230 | |||
231 | static inline int _raw_read_trylock(rwlock_t *lock) | ||
232 | { | 161 | { |
233 | atomic_t *count = (atomic_t *)lock; | 162 | atomic_t *count = (atomic_t *)lock; |
234 | atomic_dec(count); | 163 | atomic_dec(count); |
@@ -238,7 +167,7 @@ static inline int _raw_read_trylock(rwlock_t *lock) | |||
238 | return 0; | 167 | return 0; |
239 | } | 168 | } |
240 | 169 | ||
241 | static inline int _raw_write_trylock(rwlock_t *lock) | 170 | static inline int __raw_write_trylock(raw_rwlock_t *lock) |
242 | { | 171 | { |
243 | atomic_t *count = (atomic_t *)lock; | 172 | atomic_t *count = (atomic_t *)lock; |
244 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) | 173 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) |
@@ -247,4 +176,15 @@ static inline int _raw_write_trylock(rwlock_t *lock) | |||
247 | return 0; | 176 | return 0; |
248 | } | 177 | } |
249 | 178 | ||
179 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | ||
180 | { | ||
181 | asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); | ||
182 | } | ||
183 | |||
184 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | ||
185 | { | ||
186 | asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0" | ||
187 | : "=m" (rw->lock) : : "memory"); | ||
188 | } | ||
189 | |||
250 | #endif /* __ASM_SPINLOCK_H */ | 190 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-i386/spinlock_types.h b/include/asm-i386/spinlock_types.h new file mode 100644 index 000000000000..59efe849f351 --- /dev/null +++ b/include/asm-i386/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int slock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index e2cb9fa6f563..8fbf791651bf 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h | |||
@@ -48,7 +48,7 @@ struct thread_info { | |||
48 | 48 | ||
49 | #else /* !__ASSEMBLY__ */ | 49 | #else /* !__ASSEMBLY__ */ |
50 | 50 | ||
51 | #include <asm/asm_offsets.h> | 51 | #include <asm/asm-offsets.h> |
52 | 52 | ||
53 | #endif | 53 | #endif |
54 | 54 | ||
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 0bef19538406..c8766def9ee6 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/config.h> | 57 | #include <linux/config.h> |
58 | 58 | ||
59 | #include <asm/fpu.h> | 59 | #include <asm/fpu.h> |
60 | #include <asm/offsets.h> | 60 | #include <asm/asm-offsets.h> |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * Base-2 logarithm of number of pages to allocate per task structure | 63 | * Base-2 logarithm of number of pages to allocate per task structure |
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h index d2430aa0d49d..5b78611411c3 100644 --- a/include/asm-ia64/spinlock.h +++ b/include/asm-ia64/spinlock.h | |||
@@ -17,28 +17,20 @@ | |||
17 | #include <asm/intrinsics.h> | 17 | #include <asm/intrinsics.h> |
18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
19 | 19 | ||
20 | typedef struct { | 20 | #define __raw_spin_lock_init(x) ((x)->lock = 0) |
21 | volatile unsigned int lock; | ||
22 | #ifdef CONFIG_PREEMPT | ||
23 | unsigned int break_lock; | ||
24 | #endif | ||
25 | } spinlock_t; | ||
26 | |||
27 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
28 | #define spin_lock_init(x) ((x)->lock = 0) | ||
29 | 21 | ||
30 | #ifdef ASM_SUPPORTED | 22 | #ifdef ASM_SUPPORTED |
31 | /* | 23 | /* |
32 | * Try to get the lock. If we fail to get the lock, make a non-standard call to | 24 | * Try to get the lock. If we fail to get the lock, make a non-standard call to |
33 | * ia64_spinlock_contention(). We do not use a normal call because that would force all | 25 | * ia64_spinlock_contention(). We do not use a normal call because that would force all |
34 | * callers of spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is | 26 | * callers of __raw_spin_lock() to be non-leaf routines. Instead, ia64_spinlock_contention() is |
35 | * carefully coded to touch only those registers that spin_lock() marks "clobbered". | 27 | * carefully coded to touch only those registers that __raw_spin_lock() marks "clobbered". |
36 | */ | 28 | */ |
37 | 29 | ||
38 | #define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory" | 30 | #define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory" |
39 | 31 | ||
40 | static inline void | 32 | static inline void |
41 | _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) | 33 | __raw_spin_lock_flags (raw_spinlock_t *lock, unsigned long flags) |
42 | { | 34 | { |
43 | register volatile unsigned int *ptr asm ("r31") = &lock->lock; | 35 | register volatile unsigned int *ptr asm ("r31") = &lock->lock; |
44 | 36 | ||
@@ -94,17 +86,17 @@ _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) | |||
94 | #endif | 86 | #endif |
95 | } | 87 | } |
96 | 88 | ||
97 | #define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0) | 89 | #define __raw_spin_lock(lock) __raw_spin_lock_flags(lock, 0) |
98 | 90 | ||
99 | /* Unlock by doing an ordered store and releasing the cacheline with nta */ | 91 | /* Unlock by doing an ordered store and releasing the cacheline with nta */ |
100 | static inline void _raw_spin_unlock(spinlock_t *x) { | 92 | static inline void __raw_spin_unlock(raw_spinlock_t *x) { |
101 | barrier(); | 93 | barrier(); |
102 | asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x)); | 94 | asm volatile ("st4.rel.nta [%0] = r0\n\t" :: "r"(x)); |
103 | } | 95 | } |
104 | 96 | ||
105 | #else /* !ASM_SUPPORTED */ | 97 | #else /* !ASM_SUPPORTED */ |
106 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 98 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
107 | # define _raw_spin_lock(x) \ | 99 | # define __raw_spin_lock(x) \ |
108 | do { \ | 100 | do { \ |
109 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ | 101 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ |
110 | __u64 ia64_spinlock_val; \ | 102 | __u64 ia64_spinlock_val; \ |
@@ -117,29 +109,20 @@ do { \ | |||
117 | } while (ia64_spinlock_val); \ | 109 | } while (ia64_spinlock_val); \ |
118 | } \ | 110 | } \ |
119 | } while (0) | 111 | } while (0) |
120 | #define _raw_spin_unlock(x) do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0) | 112 | #define __raw_spin_unlock(x) do { barrier(); ((raw_spinlock_t *) x)->lock = 0; } while (0) |
121 | #endif /* !ASM_SUPPORTED */ | 113 | #endif /* !ASM_SUPPORTED */ |
122 | 114 | ||
123 | #define spin_is_locked(x) ((x)->lock != 0) | 115 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
124 | #define _raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) | 116 | #define __raw_spin_trylock(x) (cmpxchg_acq(&(x)->lock, 0, 1) == 0) |
125 | #define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) | 117 | #define __raw_spin_unlock_wait(lock) \ |
126 | 118 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | |
127 | typedef struct { | ||
128 | volatile unsigned int read_counter : 24; | ||
129 | volatile unsigned int write_lock : 8; | ||
130 | #ifdef CONFIG_PREEMPT | ||
131 | unsigned int break_lock; | ||
132 | #endif | ||
133 | } rwlock_t; | ||
134 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } | ||
135 | 119 | ||
136 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | 120 | #define __raw_read_can_lock(rw) (*(volatile int *)(rw) >= 0) |
137 | #define read_can_lock(rw) (*(volatile int *)(rw) >= 0) | 121 | #define __raw_write_can_lock(rw) (*(volatile int *)(rw) == 0) |
138 | #define write_can_lock(rw) (*(volatile int *)(rw) == 0) | ||
139 | 122 | ||
140 | #define _raw_read_lock(rw) \ | 123 | #define __raw_read_lock(rw) \ |
141 | do { \ | 124 | do { \ |
142 | rwlock_t *__read_lock_ptr = (rw); \ | 125 | raw_rwlock_t *__read_lock_ptr = (rw); \ |
143 | \ | 126 | \ |
144 | while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ | 127 | while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ |
145 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ | 128 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ |
@@ -148,14 +131,14 @@ do { \ | |||
148 | } \ | 131 | } \ |
149 | } while (0) | 132 | } while (0) |
150 | 133 | ||
151 | #define _raw_read_unlock(rw) \ | 134 | #define __raw_read_unlock(rw) \ |
152 | do { \ | 135 | do { \ |
153 | rwlock_t *__read_lock_ptr = (rw); \ | 136 | raw_rwlock_t *__read_lock_ptr = (rw); \ |
154 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ | 137 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ |
155 | } while (0) | 138 | } while (0) |
156 | 139 | ||
157 | #ifdef ASM_SUPPORTED | 140 | #ifdef ASM_SUPPORTED |
158 | #define _raw_write_lock(rw) \ | 141 | #define __raw_write_lock(rw) \ |
159 | do { \ | 142 | do { \ |
160 | __asm__ __volatile__ ( \ | 143 | __asm__ __volatile__ ( \ |
161 | "mov ar.ccv = r0\n" \ | 144 | "mov ar.ccv = r0\n" \ |
@@ -170,7 +153,7 @@ do { \ | |||
170 | :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ | 153 | :: "r"(rw) : "ar.ccv", "p7", "r2", "r29", "memory"); \ |
171 | } while(0) | 154 | } while(0) |
172 | 155 | ||
173 | #define _raw_write_trylock(rw) \ | 156 | #define __raw_write_trylock(rw) \ |
174 | ({ \ | 157 | ({ \ |
175 | register long result; \ | 158 | register long result; \ |
176 | \ | 159 | \ |
@@ -182,7 +165,7 @@ do { \ | |||
182 | (result == 0); \ | 165 | (result == 0); \ |
183 | }) | 166 | }) |
184 | 167 | ||
185 | static inline void _raw_write_unlock(rwlock_t *x) | 168 | static inline void __raw_write_unlock(raw_rwlock_t *x) |
186 | { | 169 | { |
187 | u8 *y = (u8 *)x; | 170 | u8 *y = (u8 *)x; |
188 | barrier(); | 171 | barrier(); |
@@ -191,7 +174,7 @@ static inline void _raw_write_unlock(rwlock_t *x) | |||
191 | 174 | ||
192 | #else /* !ASM_SUPPORTED */ | 175 | #else /* !ASM_SUPPORTED */ |
193 | 176 | ||
194 | #define _raw_write_lock(l) \ | 177 | #define __raw_write_lock(l) \ |
195 | ({ \ | 178 | ({ \ |
196 | __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ | 179 | __u64 ia64_val, ia64_set_val = ia64_dep_mi(-1, 0, 31, 1); \ |
197 | __u32 *ia64_write_lock_ptr = (__u32 *) (l); \ | 180 | __u32 *ia64_write_lock_ptr = (__u32 *) (l); \ |
@@ -202,7 +185,7 @@ static inline void _raw_write_unlock(rwlock_t *x) | |||
202 | } while (ia64_val); \ | 185 | } while (ia64_val); \ |
203 | }) | 186 | }) |
204 | 187 | ||
205 | #define _raw_write_trylock(rw) \ | 188 | #define __raw_write_trylock(rw) \ |
206 | ({ \ | 189 | ({ \ |
207 | __u64 ia64_val; \ | 190 | __u64 ia64_val; \ |
208 | __u64 ia64_set_val = ia64_dep_mi(-1, 0, 31,1); \ | 191 | __u64 ia64_set_val = ia64_dep_mi(-1, 0, 31,1); \ |
@@ -210,7 +193,7 @@ static inline void _raw_write_unlock(rwlock_t *x) | |||
210 | (ia64_val == 0); \ | 193 | (ia64_val == 0); \ |
211 | }) | 194 | }) |
212 | 195 | ||
213 | static inline void _raw_write_unlock(rwlock_t *x) | 196 | static inline void __raw_write_unlock(raw_rwlock_t *x) |
214 | { | 197 | { |
215 | barrier(); | 198 | barrier(); |
216 | x->write_lock = 0; | 199 | x->write_lock = 0; |
@@ -218,6 +201,6 @@ static inline void _raw_write_unlock(rwlock_t *x) | |||
218 | 201 | ||
219 | #endif /* !ASM_SUPPORTED */ | 202 | #endif /* !ASM_SUPPORTED */ |
220 | 203 | ||
221 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 204 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
222 | 205 | ||
223 | #endif /* _ASM_IA64_SPINLOCK_H */ | 206 | #endif /* _ASM_IA64_SPINLOCK_H */ |
diff --git a/include/asm-ia64/spinlock_types.h b/include/asm-ia64/spinlock_types.h new file mode 100644 index 000000000000..474e46f1ab4a --- /dev/null +++ b/include/asm-ia64/spinlock_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_IA64_SPINLOCK_TYPES_H | ||
2 | #define _ASM_IA64_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int read_counter : 31; | ||
16 | volatile unsigned int write_lock : 1; | ||
17 | } raw_rwlock_t; | ||
18 | |||
19 | #define __RAW_RW_LOCK_UNLOCKED { 0, 0 } | ||
20 | |||
21 | #endif | ||
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 33256db4a7cf..635235fa1e32 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h | |||
@@ -275,6 +275,7 @@ extern void ia64_load_extra (struct task_struct *task); | |||
275 | */ | 275 | */ |
276 | #define __ARCH_WANT_UNLOCKED_CTXSW | 276 | #define __ARCH_WANT_UNLOCKED_CTXSW |
277 | 277 | ||
278 | #define ARCH_HAS_PREFETCH_SWITCH_STACK | ||
278 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) | 279 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) |
279 | 280 | ||
280 | void cpu_idle_wait(void); | 281 | void cpu_idle_wait(void); |
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 7dc8951708a3..b2c79f0694f8 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #ifndef _ASM_IA64_THREAD_INFO_H | 5 | #ifndef _ASM_IA64_THREAD_INFO_H |
6 | #define _ASM_IA64_THREAD_INFO_H | 6 | #define _ASM_IA64_THREAD_INFO_H |
7 | 7 | ||
8 | #include <asm/offsets.h> | 8 | #include <asm/asm-offsets.h> |
9 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
10 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
11 | 11 | ||
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h index 6608d8371c50..7de7def28da9 100644 --- a/include/asm-m32r/spinlock.h +++ b/include/asm-m32r/spinlock.h | |||
@@ -14,57 +14,30 @@ | |||
14 | #include <asm/atomic.h> | 14 | #include <asm/atomic.h> |
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | 16 | ||
17 | extern int printk(const char * fmt, ...) | ||
18 | __attribute__ ((format (printf, 1, 2))); | ||
19 | |||
20 | #define RW_LOCK_BIAS 0x01000000 | ||
21 | #define RW_LOCK_BIAS_STR "0x01000000" | ||
22 | |||
23 | /* | 17 | /* |
24 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 18 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
25 | */ | 19 | * |
26 | 20 | * (the type definitions are in asm/spinlock_types.h) | |
27 | typedef struct { | 21 | * |
28 | volatile int slock; | ||
29 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
30 | unsigned magic; | ||
31 | #endif | ||
32 | #ifdef CONFIG_PREEMPT | ||
33 | unsigned int break_lock; | ||
34 | #endif | ||
35 | } spinlock_t; | ||
36 | |||
37 | #define SPINLOCK_MAGIC 0xdead4ead | ||
38 | |||
39 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
40 | #define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC | ||
41 | #else | ||
42 | #define SPINLOCK_MAGIC_INIT /* */ | ||
43 | #endif | ||
44 | |||
45 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } | ||
46 | |||
47 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
48 | |||
49 | /* | ||
50 | * Simple spin lock operations. There are two variants, one clears IRQ's | 22 | * Simple spin lock operations. There are two variants, one clears IRQ's |
51 | * on the local processor, one does not. | 23 | * on the local processor, one does not. |
52 | * | 24 | * |
53 | * We make no fairness assumptions. They have a cost. | 25 | * We make no fairness assumptions. They have a cost. |
54 | */ | 26 | */ |
55 | 27 | ||
56 | #define spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) | 28 | #define __raw_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) |
57 | #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) | 29 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
58 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 30 | #define __raw_spin_unlock_wait(x) \ |
31 | do { cpu_relax(); } while (__raw_spin_is_locked(x)) | ||
59 | 32 | ||
60 | /** | 33 | /** |
61 | * _raw_spin_trylock - Try spin lock and return a result | 34 | * __raw_spin_trylock - Try spin lock and return a result |
62 | * @lock: Pointer to the lock variable | 35 | * @lock: Pointer to the lock variable |
63 | * | 36 | * |
64 | * _raw_spin_trylock() tries to get the lock and returns a result. | 37 | * __raw_spin_trylock() tries to get the lock and returns a result. |
65 | * On the m32r, the result value is 1 (= Success) or 0 (= Failure). | 38 | * On the m32r, the result value is 1 (= Success) or 0 (= Failure). |
66 | */ | 39 | */ |
67 | static inline int _raw_spin_trylock(spinlock_t *lock) | 40 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
68 | { | 41 | { |
69 | int oldval; | 42 | int oldval; |
70 | unsigned long tmp1, tmp2; | 43 | unsigned long tmp1, tmp2; |
@@ -78,7 +51,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) | |||
78 | * } | 51 | * } |
79 | */ | 52 | */ |
80 | __asm__ __volatile__ ( | 53 | __asm__ __volatile__ ( |
81 | "# spin_trylock \n\t" | 54 | "# __raw_spin_trylock \n\t" |
82 | "ldi %1, #0; \n\t" | 55 | "ldi %1, #0; \n\t" |
83 | "mvfc %2, psw; \n\t" | 56 | "mvfc %2, psw; \n\t" |
84 | "clrpsw #0x40 -> nop; \n\t" | 57 | "clrpsw #0x40 -> nop; \n\t" |
@@ -97,16 +70,10 @@ static inline int _raw_spin_trylock(spinlock_t *lock) | |||
97 | return (oldval > 0); | 70 | return (oldval > 0); |
98 | } | 71 | } |
99 | 72 | ||
100 | static inline void _raw_spin_lock(spinlock_t *lock) | 73 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
101 | { | 74 | { |
102 | unsigned long tmp0, tmp1; | 75 | unsigned long tmp0, tmp1; |
103 | 76 | ||
104 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
105 | if (unlikely(lock->magic != SPINLOCK_MAGIC)) { | ||
106 | printk("pc: %p\n", __builtin_return_address(0)); | ||
107 | BUG(); | ||
108 | } | ||
109 | #endif | ||
110 | /* | 77 | /* |
111 | * lock->slock : =1 : unlock | 78 | * lock->slock : =1 : unlock |
112 | * : <=0 : lock | 79 | * : <=0 : lock |
@@ -118,7 +85,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
118 | * } | 85 | * } |
119 | */ | 86 | */ |
120 | __asm__ __volatile__ ( | 87 | __asm__ __volatile__ ( |
121 | "# spin_lock \n\t" | 88 | "# __raw_spin_lock \n\t" |
122 | ".fillinsn \n" | 89 | ".fillinsn \n" |
123 | "1: \n\t" | 90 | "1: \n\t" |
124 | "mvfc %1, psw; \n\t" | 91 | "mvfc %1, psw; \n\t" |
@@ -145,12 +112,8 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
145 | ); | 112 | ); |
146 | } | 113 | } |
147 | 114 | ||
148 | static inline void _raw_spin_unlock(spinlock_t *lock) | 115 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
149 | { | 116 | { |
150 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
151 | BUG_ON(lock->magic != SPINLOCK_MAGIC); | ||
152 | BUG_ON(!spin_is_locked(lock)); | ||
153 | #endif | ||
154 | mb(); | 117 | mb(); |
155 | lock->slock = 1; | 118 | lock->slock = 1; |
156 | } | 119 | } |
@@ -164,59 +127,32 @@ static inline void _raw_spin_unlock(spinlock_t *lock) | |||
164 | * can "mix" irq-safe locks - any writer needs to get a | 127 | * can "mix" irq-safe locks - any writer needs to get a |
165 | * irq-safe write-lock, but readers can get non-irqsafe | 128 | * irq-safe write-lock, but readers can get non-irqsafe |
166 | * read-locks. | 129 | * read-locks. |
130 | * | ||
131 | * On x86, we implement read-write locks as a 32-bit counter | ||
132 | * with the high bit (sign) being the "contended" bit. | ||
133 | * | ||
134 | * The inline assembly is non-obvious. Think about it. | ||
135 | * | ||
136 | * Changed to use the same technique as rw semaphores. See | ||
137 | * semaphore.h for details. -ben | ||
167 | */ | 138 | */ |
168 | typedef struct { | ||
169 | volatile int lock; | ||
170 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
171 | unsigned magic; | ||
172 | #endif | ||
173 | #ifdef CONFIG_PREEMPT | ||
174 | unsigned int break_lock; | ||
175 | #endif | ||
176 | } rwlock_t; | ||
177 | |||
178 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
179 | |||
180 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
181 | #define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC | ||
182 | #else | ||
183 | #define RWLOCK_MAGIC_INIT /* */ | ||
184 | #endif | ||
185 | |||
186 | #define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } | ||
187 | |||
188 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
189 | 139 | ||
190 | /** | 140 | /** |
191 | * read_can_lock - would read_trylock() succeed? | 141 | * read_can_lock - would read_trylock() succeed? |
192 | * @lock: the rwlock in question. | 142 | * @lock: the rwlock in question. |
193 | */ | 143 | */ |
194 | #define read_can_lock(x) ((int)(x)->lock > 0) | 144 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) |
195 | 145 | ||
196 | /** | 146 | /** |
197 | * write_can_lock - would write_trylock() succeed? | 147 | * write_can_lock - would write_trylock() succeed? |
198 | * @lock: the rwlock in question. | 148 | * @lock: the rwlock in question. |
199 | */ | 149 | */ |
200 | #define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 150 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) |
201 | |||
202 | /* | ||
203 | * On x86, we implement read-write locks as a 32-bit counter | ||
204 | * with the high bit (sign) being the "contended" bit. | ||
205 | * | ||
206 | * The inline assembly is non-obvious. Think about it. | ||
207 | * | ||
208 | * Changed to use the same technique as rw semaphores. See | ||
209 | * semaphore.h for details. -ben | ||
210 | */ | ||
211 | /* the spinlock helpers are in arch/i386/kernel/semaphore.c */ | ||
212 | 151 | ||
213 | static inline void _raw_read_lock(rwlock_t *rw) | 152 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
214 | { | 153 | { |
215 | unsigned long tmp0, tmp1; | 154 | unsigned long tmp0, tmp1; |
216 | 155 | ||
217 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
218 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
219 | #endif | ||
220 | /* | 156 | /* |
221 | * rw->lock : >0 : unlock | 157 | * rw->lock : >0 : unlock |
222 | * : <=0 : lock | 158 | * : <=0 : lock |
@@ -264,13 +200,10 @@ static inline void _raw_read_lock(rwlock_t *rw) | |||
264 | ); | 200 | ); |
265 | } | 201 | } |
266 | 202 | ||
267 | static inline void _raw_write_lock(rwlock_t *rw) | 203 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
268 | { | 204 | { |
269 | unsigned long tmp0, tmp1, tmp2; | 205 | unsigned long tmp0, tmp1, tmp2; |
270 | 206 | ||
271 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
272 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
273 | #endif | ||
274 | /* | 207 | /* |
275 | * rw->lock : =RW_LOCK_BIAS_STR : unlock | 208 | * rw->lock : =RW_LOCK_BIAS_STR : unlock |
276 | * : !=RW_LOCK_BIAS_STR : lock | 209 | * : !=RW_LOCK_BIAS_STR : lock |
@@ -320,7 +253,7 @@ static inline void _raw_write_lock(rwlock_t *rw) | |||
320 | ); | 253 | ); |
321 | } | 254 | } |
322 | 255 | ||
323 | static inline void _raw_read_unlock(rwlock_t *rw) | 256 | static inline void __raw_read_unlock(raw_rwlock_t *rw) |
324 | { | 257 | { |
325 | unsigned long tmp0, tmp1; | 258 | unsigned long tmp0, tmp1; |
326 | 259 | ||
@@ -342,7 +275,7 @@ static inline void _raw_read_unlock(rwlock_t *rw) | |||
342 | ); | 275 | ); |
343 | } | 276 | } |
344 | 277 | ||
345 | static inline void _raw_write_unlock(rwlock_t *rw) | 278 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
346 | { | 279 | { |
347 | unsigned long tmp0, tmp1, tmp2; | 280 | unsigned long tmp0, tmp1, tmp2; |
348 | 281 | ||
@@ -366,9 +299,9 @@ static inline void _raw_write_unlock(rwlock_t *rw) | |||
366 | ); | 299 | ); |
367 | } | 300 | } |
368 | 301 | ||
369 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 302 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
370 | 303 | ||
371 | static inline int _raw_write_trylock(rwlock_t *lock) | 304 | static inline int __raw_write_trylock(raw_rwlock_t *lock) |
372 | { | 305 | { |
373 | atomic_t *count = (atomic_t *)lock; | 306 | atomic_t *count = (atomic_t *)lock; |
374 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) | 307 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) |
diff --git a/include/asm-m32r/spinlock_types.h b/include/asm-m32r/spinlock_types.h new file mode 100644 index 000000000000..7e9941c45f40 --- /dev/null +++ b/include/asm-m32r/spinlock_types.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _ASM_M32R_SPINLOCK_TYPES_H | ||
2 | #define _ASM_M32R_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile int slock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define RW_LOCK_BIAS 0x01000000 | ||
19 | #define RW_LOCK_BIAS_STR "0x01000000" | ||
20 | |||
21 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | ||
22 | |||
23 | #endif | ||
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h index ac8823df2554..11daf5ceb7b4 100644 --- a/include/asm-mips/asmmacro-32.h +++ b/include/asm-mips/asmmacro-32.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #ifndef _ASM_ASMMACRO_32_H | 7 | #ifndef _ASM_ASMMACRO_32_H |
8 | #define _ASM_ASMMACRO_32_H | 8 | #define _ASM_ASMMACRO_32_H |
9 | 9 | ||
10 | #include <asm/offset.h> | 10 | #include <asm/asm-offsets.h> |
11 | #include <asm/regdef.h> | 11 | #include <asm/regdef.h> |
12 | #include <asm/fpregdef.h> | 12 | #include <asm/fpregdef.h> |
13 | #include <asm/mipsregs.h> | 13 | #include <asm/mipsregs.h> |
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h index bbed35511f5a..559c355b9b86 100644 --- a/include/asm-mips/asmmacro-64.h +++ b/include/asm-mips/asmmacro-64.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #ifndef _ASM_ASMMACRO_64_H | 8 | #ifndef _ASM_ASMMACRO_64_H |
9 | #define _ASM_ASMMACRO_64_H | 9 | #define _ASM_ASMMACRO_64_H |
10 | 10 | ||
11 | #include <asm/offset.h> | 11 | #include <asm/asm-offsets.h> |
12 | #include <asm/regdef.h> | 12 | #include <asm/regdef.h> |
13 | #include <asm/fpregdef.h> | 13 | #include <asm/fpregdef.h> |
14 | #include <asm/mipsregs.h> | 14 | #include <asm/mipsregs.h> |
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h index b90b11d0b886..3f2470e9e678 100644 --- a/include/asm-mips/irq.h +++ b/include/asm-mips/irq.h | |||
@@ -49,7 +49,4 @@ do { \ | |||
49 | 49 | ||
50 | extern void arch_init_irq(void); | 50 | extern void arch_init_irq(void); |
51 | 51 | ||
52 | struct irqaction; | ||
53 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
54 | |||
55 | #endif /* _ASM_IRQ_H */ | 52 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h index 3ccfe09fa744..9c2af1b00e19 100644 --- a/include/asm-mips/sim.h +++ b/include/asm-mips/sim.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | 13 | ||
14 | #include <asm/offset.h> | 14 | #include <asm/asm-offsets.h> |
15 | 15 | ||
16 | #define __str2(x) #x | 16 | #define __str2(x) #x |
17 | #define __str(x) __str2(x) | 17 | #define __str(x) __str2(x) |
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h index 114d3eb98a6a..4d0135b11156 100644 --- a/include/asm-mips/spinlock.h +++ b/include/asm-mips/spinlock.h | |||
@@ -16,20 +16,10 @@ | |||
16 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 16 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
17 | */ | 17 | */ |
18 | 18 | ||
19 | typedef struct { | 19 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
20 | volatile unsigned int lock; | 20 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
21 | #ifdef CONFIG_PREEMPT | 21 | #define __raw_spin_unlock_wait(x) \ |
22 | unsigned int break_lock; | 22 | do { cpu_relax(); } while ((x)->lock) |
23 | #endif | ||
24 | } spinlock_t; | ||
25 | |||
26 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
27 | |||
28 | #define spin_lock_init(x) do { (x)->lock = 0; } while(0) | ||
29 | |||
30 | #define spin_is_locked(x) ((x)->lock != 0) | ||
31 | #define spin_unlock_wait(x) do { barrier(); } while ((x)->lock) | ||
32 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
33 | 23 | ||
34 | /* | 24 | /* |
35 | * Simple spin lock operations. There are two variants, one clears IRQ's | 25 | * Simple spin lock operations. There are two variants, one clears IRQ's |
@@ -38,13 +28,13 @@ typedef struct { | |||
38 | * We make no fairness assumptions. They have a cost. | 28 | * We make no fairness assumptions. They have a cost. |
39 | */ | 29 | */ |
40 | 30 | ||
41 | static inline void _raw_spin_lock(spinlock_t *lock) | 31 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
42 | { | 32 | { |
43 | unsigned int tmp; | 33 | unsigned int tmp; |
44 | 34 | ||
45 | if (R10000_LLSC_WAR) { | 35 | if (R10000_LLSC_WAR) { |
46 | __asm__ __volatile__( | 36 | __asm__ __volatile__( |
47 | " .set noreorder # _raw_spin_lock \n" | 37 | " .set noreorder # __raw_spin_lock \n" |
48 | "1: ll %1, %2 \n" | 38 | "1: ll %1, %2 \n" |
49 | " bnez %1, 1b \n" | 39 | " bnez %1, 1b \n" |
50 | " li %1, 1 \n" | 40 | " li %1, 1 \n" |
@@ -58,7 +48,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
58 | : "memory"); | 48 | : "memory"); |
59 | } else { | 49 | } else { |
60 | __asm__ __volatile__( | 50 | __asm__ __volatile__( |
61 | " .set noreorder # _raw_spin_lock \n" | 51 | " .set noreorder # __raw_spin_lock \n" |
62 | "1: ll %1, %2 \n" | 52 | "1: ll %1, %2 \n" |
63 | " bnez %1, 1b \n" | 53 | " bnez %1, 1b \n" |
64 | " li %1, 1 \n" | 54 | " li %1, 1 \n" |
@@ -72,10 +62,10 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
72 | } | 62 | } |
73 | } | 63 | } |
74 | 64 | ||
75 | static inline void _raw_spin_unlock(spinlock_t *lock) | 65 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
76 | { | 66 | { |
77 | __asm__ __volatile__( | 67 | __asm__ __volatile__( |
78 | " .set noreorder # _raw_spin_unlock \n" | 68 | " .set noreorder # __raw_spin_unlock \n" |
79 | " sync \n" | 69 | " sync \n" |
80 | " sw $0, %0 \n" | 70 | " sw $0, %0 \n" |
81 | " .set\treorder \n" | 71 | " .set\treorder \n" |
@@ -84,13 +74,13 @@ static inline void _raw_spin_unlock(spinlock_t *lock) | |||
84 | : "memory"); | 74 | : "memory"); |
85 | } | 75 | } |
86 | 76 | ||
87 | static inline unsigned int _raw_spin_trylock(spinlock_t *lock) | 77 | static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock) |
88 | { | 78 | { |
89 | unsigned int temp, res; | 79 | unsigned int temp, res; |
90 | 80 | ||
91 | if (R10000_LLSC_WAR) { | 81 | if (R10000_LLSC_WAR) { |
92 | __asm__ __volatile__( | 82 | __asm__ __volatile__( |
93 | " .set noreorder # _raw_spin_trylock \n" | 83 | " .set noreorder # __raw_spin_trylock \n" |
94 | "1: ll %0, %3 \n" | 84 | "1: ll %0, %3 \n" |
95 | " ori %2, %0, 1 \n" | 85 | " ori %2, %0, 1 \n" |
96 | " sc %2, %1 \n" | 86 | " sc %2, %1 \n" |
@@ -104,7 +94,7 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock) | |||
104 | : "memory"); | 94 | : "memory"); |
105 | } else { | 95 | } else { |
106 | __asm__ __volatile__( | 96 | __asm__ __volatile__( |
107 | " .set noreorder # _raw_spin_trylock \n" | 97 | " .set noreorder # __raw_spin_trylock \n" |
108 | "1: ll %0, %3 \n" | 98 | "1: ll %0, %3 \n" |
109 | " ori %2, %0, 1 \n" | 99 | " ori %2, %0, 1 \n" |
110 | " sc %2, %1 \n" | 100 | " sc %2, %1 \n" |
@@ -129,24 +119,13 @@ static inline unsigned int _raw_spin_trylock(spinlock_t *lock) | |||
129 | * read-locks. | 119 | * read-locks. |
130 | */ | 120 | */ |
131 | 121 | ||
132 | typedef struct { | 122 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
133 | volatile unsigned int lock; | ||
134 | #ifdef CONFIG_PREEMPT | ||
135 | unsigned int break_lock; | ||
136 | #endif | ||
137 | } rwlock_t; | ||
138 | |||
139 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
140 | |||
141 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
142 | |||
143 | static inline void _raw_read_lock(rwlock_t *rw) | ||
144 | { | 123 | { |
145 | unsigned int tmp; | 124 | unsigned int tmp; |
146 | 125 | ||
147 | if (R10000_LLSC_WAR) { | 126 | if (R10000_LLSC_WAR) { |
148 | __asm__ __volatile__( | 127 | __asm__ __volatile__( |
149 | " .set noreorder # _raw_read_lock \n" | 128 | " .set noreorder # __raw_read_lock \n" |
150 | "1: ll %1, %2 \n" | 129 | "1: ll %1, %2 \n" |
151 | " bltz %1, 1b \n" | 130 | " bltz %1, 1b \n" |
152 | " addu %1, 1 \n" | 131 | " addu %1, 1 \n" |
@@ -160,7 +139,7 @@ static inline void _raw_read_lock(rwlock_t *rw) | |||
160 | : "memory"); | 139 | : "memory"); |
161 | } else { | 140 | } else { |
162 | __asm__ __volatile__( | 141 | __asm__ __volatile__( |
163 | " .set noreorder # _raw_read_lock \n" | 142 | " .set noreorder # __raw_read_lock \n" |
164 | "1: ll %1, %2 \n" | 143 | "1: ll %1, %2 \n" |
165 | " bltz %1, 1b \n" | 144 | " bltz %1, 1b \n" |
166 | " addu %1, 1 \n" | 145 | " addu %1, 1 \n" |
@@ -177,13 +156,13 @@ static inline void _raw_read_lock(rwlock_t *rw) | |||
177 | /* Note the use of sub, not subu which will make the kernel die with an | 156 | /* Note the use of sub, not subu which will make the kernel die with an |
178 | overflow exception if we ever try to unlock an rwlock that is already | 157 | overflow exception if we ever try to unlock an rwlock that is already |
179 | unlocked or is being held by a writer. */ | 158 | unlocked or is being held by a writer. */ |
180 | static inline void _raw_read_unlock(rwlock_t *rw) | 159 | static inline void __raw_read_unlock(raw_rwlock_t *rw) |
181 | { | 160 | { |
182 | unsigned int tmp; | 161 | unsigned int tmp; |
183 | 162 | ||
184 | if (R10000_LLSC_WAR) { | 163 | if (R10000_LLSC_WAR) { |
185 | __asm__ __volatile__( | 164 | __asm__ __volatile__( |
186 | "1: ll %1, %2 # _raw_read_unlock \n" | 165 | "1: ll %1, %2 # __raw_read_unlock \n" |
187 | " sub %1, 1 \n" | 166 | " sub %1, 1 \n" |
188 | " sc %1, %0 \n" | 167 | " sc %1, %0 \n" |
189 | " beqzl %1, 1b \n" | 168 | " beqzl %1, 1b \n" |
@@ -193,7 +172,7 @@ static inline void _raw_read_unlock(rwlock_t *rw) | |||
193 | : "memory"); | 172 | : "memory"); |
194 | } else { | 173 | } else { |
195 | __asm__ __volatile__( | 174 | __asm__ __volatile__( |
196 | " .set noreorder # _raw_read_unlock \n" | 175 | " .set noreorder # __raw_read_unlock \n" |
197 | "1: ll %1, %2 \n" | 176 | "1: ll %1, %2 \n" |
198 | " sub %1, 1 \n" | 177 | " sub %1, 1 \n" |
199 | " sc %1, %0 \n" | 178 | " sc %1, %0 \n" |
@@ -206,13 +185,13 @@ static inline void _raw_read_unlock(rwlock_t *rw) | |||
206 | } | 185 | } |
207 | } | 186 | } |
208 | 187 | ||
209 | static inline void _raw_write_lock(rwlock_t *rw) | 188 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
210 | { | 189 | { |
211 | unsigned int tmp; | 190 | unsigned int tmp; |
212 | 191 | ||
213 | if (R10000_LLSC_WAR) { | 192 | if (R10000_LLSC_WAR) { |
214 | __asm__ __volatile__( | 193 | __asm__ __volatile__( |
215 | " .set noreorder # _raw_write_lock \n" | 194 | " .set noreorder # __raw_write_lock \n" |
216 | "1: ll %1, %2 \n" | 195 | "1: ll %1, %2 \n" |
217 | " bnez %1, 1b \n" | 196 | " bnez %1, 1b \n" |
218 | " lui %1, 0x8000 \n" | 197 | " lui %1, 0x8000 \n" |
@@ -226,7 +205,7 @@ static inline void _raw_write_lock(rwlock_t *rw) | |||
226 | : "memory"); | 205 | : "memory"); |
227 | } else { | 206 | } else { |
228 | __asm__ __volatile__( | 207 | __asm__ __volatile__( |
229 | " .set noreorder # _raw_write_lock \n" | 208 | " .set noreorder # __raw_write_lock \n" |
230 | "1: ll %1, %2 \n" | 209 | "1: ll %1, %2 \n" |
231 | " bnez %1, 1b \n" | 210 | " bnez %1, 1b \n" |
232 | " lui %1, 0x8000 \n" | 211 | " lui %1, 0x8000 \n" |
@@ -241,26 +220,26 @@ static inline void _raw_write_lock(rwlock_t *rw) | |||
241 | } | 220 | } |
242 | } | 221 | } |
243 | 222 | ||
244 | static inline void _raw_write_unlock(rwlock_t *rw) | 223 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
245 | { | 224 | { |
246 | __asm__ __volatile__( | 225 | __asm__ __volatile__( |
247 | " sync # _raw_write_unlock \n" | 226 | " sync # __raw_write_unlock \n" |
248 | " sw $0, %0 \n" | 227 | " sw $0, %0 \n" |
249 | : "=m" (rw->lock) | 228 | : "=m" (rw->lock) |
250 | : "m" (rw->lock) | 229 | : "m" (rw->lock) |
251 | : "memory"); | 230 | : "memory"); |
252 | } | 231 | } |
253 | 232 | ||
254 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 233 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
255 | 234 | ||
256 | static inline int _raw_write_trylock(rwlock_t *rw) | 235 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
257 | { | 236 | { |
258 | unsigned int tmp; | 237 | unsigned int tmp; |
259 | int ret; | 238 | int ret; |
260 | 239 | ||
261 | if (R10000_LLSC_WAR) { | 240 | if (R10000_LLSC_WAR) { |
262 | __asm__ __volatile__( | 241 | __asm__ __volatile__( |
263 | " .set noreorder # _raw_write_trylock \n" | 242 | " .set noreorder # __raw_write_trylock \n" |
264 | " li %2, 0 \n" | 243 | " li %2, 0 \n" |
265 | "1: ll %1, %3 \n" | 244 | "1: ll %1, %3 \n" |
266 | " bnez %1, 2f \n" | 245 | " bnez %1, 2f \n" |
@@ -277,7 +256,7 @@ static inline int _raw_write_trylock(rwlock_t *rw) | |||
277 | : "memory"); | 256 | : "memory"); |
278 | } else { | 257 | } else { |
279 | __asm__ __volatile__( | 258 | __asm__ __volatile__( |
280 | " .set noreorder # _raw_write_trylock \n" | 259 | " .set noreorder # __raw_write_trylock \n" |
281 | " li %2, 0 \n" | 260 | " li %2, 0 \n" |
282 | "1: ll %1, %3 \n" | 261 | "1: ll %1, %3 \n" |
283 | " bnez %1, 2f \n" | 262 | " bnez %1, 2f \n" |
diff --git a/include/asm-mips/spinlock_types.h b/include/asm-mips/spinlock_types.h new file mode 100644 index 000000000000..ce26c5048b15 --- /dev/null +++ b/include/asm-mips/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _ASM_SPINLOCK_TYPES_H | ||
2 | #define _ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h index fb42f99f8527..7b5e64600bc8 100644 --- a/include/asm-mips/stackframe.h +++ b/include/asm-mips/stackframe.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <asm/asm.h> | 16 | #include <asm/asm.h> |
17 | #include <asm/mipsregs.h> | 17 | #include <asm/mipsregs.h> |
18 | #include <asm/offset.h> | 18 | #include <asm/asm-offsets.h> |
19 | 19 | ||
20 | .macro SAVE_AT | 20 | .macro SAVE_AT |
21 | .set push | 21 | .set push |
diff --git a/include/asm-mips/vr41xx/tb0287.h b/include/asm-mips/vr41xx/tb0287.h new file mode 100644 index 000000000000..dd9832313afe --- /dev/null +++ b/include/asm-mips/vr41xx/tb0287.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * tb0287.h, Include file for TANBAC TB0287 mini-ITX board. | ||
3 | * | ||
4 | * Copyright (C) 2005 Media Lab Inc. <ito@mlb.co.jp> | ||
5 | * | ||
6 | * This code is largely based on tb0219.h. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #ifndef __TANBAC_TB0287_H | ||
23 | #define __TANBAC_TB0287_H | ||
24 | |||
25 | #include <asm/vr41xx/vr41xx.h> | ||
26 | |||
27 | /* | ||
28 | * General-Purpose I/O Pin Number | ||
29 | */ | ||
30 | #define TB0287_PCI_SLOT_PIN 2 | ||
31 | #define TB0287_SM501_PIN 3 | ||
32 | #define TB0287_SIL680A_PIN 8 | ||
33 | #define TB0287_RTL8110_PIN 13 | ||
34 | |||
35 | /* | ||
36 | * Interrupt Number | ||
37 | */ | ||
38 | #define TB0287_PCI_SLOT_IRQ GIU_IRQ(TB0287_PCI_SLOT_PIN) | ||
39 | #define TB0287_SM501_IRQ GIU_IRQ(TB0287_SM501_PIN) | ||
40 | #define TB0287_SIL680A_IRQ GIU_IRQ(TB0287_SIL680A_PIN) | ||
41 | #define TB0287_RTL8110_IRQ GIU_IRQ(TB0287_RTL8110_PIN) | ||
42 | |||
43 | #endif /* __TANBAC_TB0287_H */ | ||
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h index cbc286f49b36..30b023411fef 100644 --- a/include/asm-parisc/assembly.h +++ b/include/asm-parisc/assembly.h | |||
@@ -63,7 +63,7 @@ | |||
63 | .level 2.0w | 63 | .level 2.0w |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #include <asm/offsets.h> | 66 | #include <asm/asm-offsets.h> |
67 | #include <asm/page.h> | 67 | #include <asm/page.h> |
68 | 68 | ||
69 | #include <asm/asmregs.h> | 69 | #include <asm/asmregs.h> |
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h index e24f7579adb0..048a2c7fd0c0 100644 --- a/include/asm-parisc/atomic.h +++ b/include/asm-parisc/atomic.h | |||
@@ -24,19 +24,19 @@ | |||
24 | # define ATOMIC_HASH_SIZE 4 | 24 | # define ATOMIC_HASH_SIZE 4 |
25 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) | 25 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) |
26 | 26 | ||
27 | extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; | 27 | extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; |
28 | 28 | ||
29 | /* Can't use _raw_spin_lock_irq because of #include problems, so | 29 | /* Can't use raw_spin_lock_irq because of #include problems, so |
30 | * this is the substitute */ | 30 | * this is the substitute */ |
31 | #define _atomic_spin_lock_irqsave(l,f) do { \ | 31 | #define _atomic_spin_lock_irqsave(l,f) do { \ |
32 | spinlock_t *s = ATOMIC_HASH(l); \ | 32 | raw_spinlock_t *s = ATOMIC_HASH(l); \ |
33 | local_irq_save(f); \ | 33 | local_irq_save(f); \ |
34 | _raw_spin_lock(s); \ | 34 | __raw_spin_lock(s); \ |
35 | } while(0) | 35 | } while(0) |
36 | 36 | ||
37 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ | 37 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ |
38 | spinlock_t *s = ATOMIC_HASH(l); \ | 38 | raw_spinlock_t *s = ATOMIC_HASH(l); \ |
39 | _raw_spin_unlock(s); \ | 39 | __raw_spin_unlock(s); \ |
40 | local_irq_restore(f); \ | 40 | local_irq_restore(f); \ |
41 | } while(0) | 41 | } while(0) |
42 | 42 | ||
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 928e5ef850bd..af7db694b22d 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _PARISC_BITOPS_H | 2 | #define _PARISC_BITOPS_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <asm/system.h> | 5 | #include <asm/spinlock.h> |
6 | #include <asm/byteorder.h> | 6 | #include <asm/byteorder.h> |
7 | #include <asm/atomic.h> | 7 | #include <asm/atomic.h> |
8 | 8 | ||
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h index 06732719d927..aa592d8c0e39 100644 --- a/include/asm-parisc/cacheflush.h +++ b/include/asm-parisc/cacheflush.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <asm/cache.h> /* for flush_user_dcache_range_asm() proto */ | ||
6 | 7 | ||
7 | /* The usual comment is "Caches aren't brain-dead on the <architecture>". | 8 | /* The usual comment is "Caches aren't brain-dead on the <architecture>". |
8 | * Unfortunately, that doesn't apply to PA-RISC. */ | 9 | * Unfortunately, that doesn't apply to PA-RISC. */ |
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h index 0b61f51d8467..a9dfadd05658 100644 --- a/include/asm-parisc/processor.h +++ b/include/asm-parisc/processor.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
14 | #include <linux/spinlock_types.h> | ||
14 | 15 | ||
15 | #include <asm/hardware.h> | 16 | #include <asm/hardware.h> |
16 | #include <asm/page.h> | 17 | #include <asm/page.h> |
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h index 679ea1c651ef..43eaa6e742e0 100644 --- a/include/asm-parisc/spinlock.h +++ b/include/asm-parisc/spinlock.h | |||
@@ -2,30 +2,25 @@ | |||
2 | #define __ASM_SPINLOCK_H | 2 | #define __ASM_SPINLOCK_H |
3 | 3 | ||
4 | #include <asm/system.h> | 4 | #include <asm/system.h> |
5 | #include <asm/processor.h> | ||
6 | #include <asm/spinlock_types.h> | ||
5 | 7 | ||
6 | /* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked | 8 | /* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked |
7 | * since it only has load-and-zero. Moreover, at least on some PA processors, | 9 | * since it only has load-and-zero. Moreover, at least on some PA processors, |
8 | * the semaphore address has to be 16-byte aligned. | 10 | * the semaphore address has to be 16-byte aligned. |
9 | */ | 11 | */ |
10 | 12 | ||
11 | #ifndef CONFIG_DEBUG_SPINLOCK | 13 | static inline int __raw_spin_is_locked(raw_spinlock_t *x) |
12 | |||
13 | #define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } } | ||
14 | #undef SPIN_LOCK_UNLOCKED | ||
15 | #define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED | ||
16 | |||
17 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
18 | |||
19 | static inline int spin_is_locked(spinlock_t *x) | ||
20 | { | 14 | { |
21 | volatile unsigned int *a = __ldcw_align(x); | 15 | volatile unsigned int *a = __ldcw_align(x); |
22 | return *a == 0; | 16 | return *a == 0; |
23 | } | 17 | } |
24 | 18 | ||
25 | #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) | 19 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
26 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 20 | #define __raw_spin_unlock_wait(x) \ |
21 | do { cpu_relax(); } while (__raw_spin_is_locked(x)) | ||
27 | 22 | ||
28 | static inline void _raw_spin_lock(spinlock_t *x) | 23 | static inline void __raw_spin_lock(raw_spinlock_t *x) |
29 | { | 24 | { |
30 | volatile unsigned int *a; | 25 | volatile unsigned int *a; |
31 | 26 | ||
@@ -36,7 +31,7 @@ static inline void _raw_spin_lock(spinlock_t *x) | |||
36 | mb(); | 31 | mb(); |
37 | } | 32 | } |
38 | 33 | ||
39 | static inline void _raw_spin_unlock(spinlock_t *x) | 34 | static inline void __raw_spin_unlock(raw_spinlock_t *x) |
40 | { | 35 | { |
41 | volatile unsigned int *a; | 36 | volatile unsigned int *a; |
42 | mb(); | 37 | mb(); |
@@ -45,7 +40,7 @@ static inline void _raw_spin_unlock(spinlock_t *x) | |||
45 | mb(); | 40 | mb(); |
46 | } | 41 | } |
47 | 42 | ||
48 | static inline int _raw_spin_trylock(spinlock_t *x) | 43 | static inline int __raw_spin_trylock(raw_spinlock_t *x) |
49 | { | 44 | { |
50 | volatile unsigned int *a; | 45 | volatile unsigned int *a; |
51 | int ret; | 46 | int ret; |
@@ -57,131 +52,38 @@ static inline int _raw_spin_trylock(spinlock_t *x) | |||
57 | 52 | ||
58 | return ret; | 53 | return ret; |
59 | } | 54 | } |
60 | |||
61 | #define spin_lock_own(LOCK, LOCATION) ((void)0) | ||
62 | |||
63 | #else /* !(CONFIG_DEBUG_SPINLOCK) */ | ||
64 | |||
65 | #define SPINLOCK_MAGIC 0x1D244B3C | ||
66 | |||
67 | #define __SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 }, SPINLOCK_MAGIC, 10, __FILE__ , NULL, 0, -1, NULL, NULL } | ||
68 | #undef SPIN_LOCK_UNLOCKED | ||
69 | #define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED | ||
70 | |||
71 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
72 | |||
73 | #define CHECK_LOCK(x) \ | ||
74 | do { \ | ||
75 | if (unlikely((x)->magic != SPINLOCK_MAGIC)) { \ | ||
76 | printk(KERN_ERR "%s:%d: spin_is_locked" \ | ||
77 | " on uninitialized spinlock %p.\n", \ | ||
78 | __FILE__, __LINE__, (x)); \ | ||
79 | } \ | ||
80 | } while(0) | ||
81 | |||
82 | #define spin_is_locked(x) \ | ||
83 | ({ \ | ||
84 | CHECK_LOCK(x); \ | ||
85 | volatile unsigned int *a = __ldcw_align(x); \ | ||
86 | if (unlikely((*a == 0) && (x)->babble)) { \ | ||
87 | (x)->babble--; \ | ||
88 | printk("KERN_WARNING \ | ||
89 | %s:%d: spin_is_locked(%s/%p) already" \ | ||
90 | " locked by %s:%d in %s at %p(%d)\n", \ | ||
91 | __FILE__,__LINE__, (x)->module, (x), \ | ||
92 | (x)->bfile, (x)->bline, (x)->task->comm,\ | ||
93 | (x)->previous, (x)->oncpu); \ | ||
94 | } \ | ||
95 | *a == 0; \ | ||
96 | }) | ||
97 | |||
98 | #define spin_unlock_wait(x) \ | ||
99 | do { \ | ||
100 | CHECK_LOCK(x); \ | ||
101 | volatile unsigned int *a = __ldcw_align(x); \ | ||
102 | if (unlikely((*a == 0) && (x)->babble)) { \ | ||
103 | (x)->babble--; \ | ||
104 | printk("KERN_WARNING \ | ||
105 | %s:%d: spin_unlock_wait(%s/%p)" \ | ||
106 | " owned by %s:%d in %s at %p(%d)\n", \ | ||
107 | __FILE__,__LINE__, (x)->module, (x), \ | ||
108 | (x)->bfile, (x)->bline, (x)->task->comm,\ | ||
109 | (x)->previous, (x)->oncpu); \ | ||
110 | } \ | ||
111 | barrier(); \ | ||
112 | } while (*((volatile unsigned char *)(__ldcw_align(x))) == 0) | ||
113 | |||
114 | extern void _dbg_spin_lock(spinlock_t *lock, const char *base_file, int line_no); | ||
115 | extern void _dbg_spin_unlock(spinlock_t *lock, const char *, int); | ||
116 | extern int _dbg_spin_trylock(spinlock_t * lock, const char *, int); | ||
117 | |||
118 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
119 | |||
120 | #define _raw_spin_unlock(lock) _dbg_spin_unlock(lock, __FILE__, __LINE__) | ||
121 | #define _raw_spin_lock(lock) _dbg_spin_lock(lock, __FILE__, __LINE__) | ||
122 | #define _raw_spin_trylock(lock) _dbg_spin_trylock(lock, __FILE__, __LINE__) | ||
123 | |||
124 | /* just in case we need it */ | ||
125 | #define spin_lock_own(LOCK, LOCATION) \ | ||
126 | do { \ | ||
127 | volatile unsigned int *a = __ldcw_align(LOCK); \ | ||
128 | if (!((*a == 0) && ((LOCK)->oncpu == smp_processor_id()))) \ | ||
129 | printk("KERN_WARNING \ | ||
130 | %s: called on %d from %p but lock %s on %d\n", \ | ||
131 | LOCATION, smp_processor_id(), \ | ||
132 | __builtin_return_address(0), \ | ||
133 | (*a == 0) ? "taken" : "freed", (LOCK)->on_cpu); \ | ||
134 | } while (0) | ||
135 | |||
136 | #endif /* !(CONFIG_DEBUG_SPINLOCK) */ | ||
137 | 55 | ||
138 | /* | 56 | /* |
139 | * Read-write spinlocks, allowing multiple readers | 57 | * Read-write spinlocks, allowing multiple readers |
140 | * but only one writer. | 58 | * but only one writer. |
141 | */ | 59 | */ |
142 | typedef struct { | ||
143 | spinlock_t lock; | ||
144 | volatile int counter; | ||
145 | #ifdef CONFIG_PREEMPT | ||
146 | unsigned int break_lock; | ||
147 | #endif | ||
148 | } rwlock_t; | ||
149 | |||
150 | #define RW_LOCK_UNLOCKED (rwlock_t) { __SPIN_LOCK_UNLOCKED, 0 } | ||
151 | |||
152 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while (0) | ||
153 | 60 | ||
154 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 61 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
155 | 62 | ||
156 | /* read_lock, read_unlock are pretty straightforward. Of course it somehow | 63 | /* read_lock, read_unlock are pretty straightforward. Of course it somehow |
157 | * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */ | 64 | * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */ |
158 | 65 | ||
159 | #ifdef CONFIG_DEBUG_RWLOCK | 66 | static __inline__ void __raw_read_lock(raw_rwlock_t *rw) |
160 | extern void _dbg_read_lock(rwlock_t * rw, const char *bfile, int bline); | ||
161 | #define _raw_read_lock(rw) _dbg_read_lock(rw, __FILE__, __LINE__) | ||
162 | #else | ||
163 | static __inline__ void _raw_read_lock(rwlock_t *rw) | ||
164 | { | 67 | { |
165 | unsigned long flags; | 68 | unsigned long flags; |
166 | local_irq_save(flags); | 69 | local_irq_save(flags); |
167 | _raw_spin_lock(&rw->lock); | 70 | __raw_spin_lock(&rw->lock); |
168 | 71 | ||
169 | rw->counter++; | 72 | rw->counter++; |
170 | 73 | ||
171 | _raw_spin_unlock(&rw->lock); | 74 | __raw_spin_unlock(&rw->lock); |
172 | local_irq_restore(flags); | 75 | local_irq_restore(flags); |
173 | } | 76 | } |
174 | #endif /* CONFIG_DEBUG_RWLOCK */ | ||
175 | 77 | ||
176 | static __inline__ void _raw_read_unlock(rwlock_t *rw) | 78 | static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) |
177 | { | 79 | { |
178 | unsigned long flags; | 80 | unsigned long flags; |
179 | local_irq_save(flags); | 81 | local_irq_save(flags); |
180 | _raw_spin_lock(&rw->lock); | 82 | __raw_spin_lock(&rw->lock); |
181 | 83 | ||
182 | rw->counter--; | 84 | rw->counter--; |
183 | 85 | ||
184 | _raw_spin_unlock(&rw->lock); | 86 | __raw_spin_unlock(&rw->lock); |
185 | local_irq_restore(flags); | 87 | local_irq_restore(flags); |
186 | } | 88 | } |
187 | 89 | ||
@@ -194,20 +96,17 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw) | |||
194 | * writers) in interrupt handlers someone fucked up and we'd dead-lock | 96 | * writers) in interrupt handlers someone fucked up and we'd dead-lock |
195 | * sooner or later anyway. prumpf */ | 97 | * sooner or later anyway. prumpf */ |
196 | 98 | ||
197 | #ifdef CONFIG_DEBUG_RWLOCK | 99 | static __inline__ void __raw_write_lock(raw_rwlock_t *rw) |
198 | extern void _dbg_write_lock(rwlock_t * rw, const char *bfile, int bline); | ||
199 | #define _raw_write_lock(rw) _dbg_write_lock(rw, __FILE__, __LINE__) | ||
200 | #else | ||
201 | static __inline__ void _raw_write_lock(rwlock_t *rw) | ||
202 | { | 100 | { |
203 | retry: | 101 | retry: |
204 | _raw_spin_lock(&rw->lock); | 102 | __raw_spin_lock(&rw->lock); |
205 | 103 | ||
206 | if(rw->counter != 0) { | 104 | if(rw->counter != 0) { |
207 | /* this basically never happens */ | 105 | /* this basically never happens */ |
208 | _raw_spin_unlock(&rw->lock); | 106 | __raw_spin_unlock(&rw->lock); |
209 | 107 | ||
210 | while(rw->counter != 0); | 108 | while (rw->counter != 0) |
109 | cpu_relax(); | ||
211 | 110 | ||
212 | goto retry; | 111 | goto retry; |
213 | } | 112 | } |
@@ -215,26 +114,21 @@ retry: | |||
215 | /* got it. now leave without unlocking */ | 114 | /* got it. now leave without unlocking */ |
216 | rw->counter = -1; /* remember we are locked */ | 115 | rw->counter = -1; /* remember we are locked */ |
217 | } | 116 | } |
218 | #endif /* CONFIG_DEBUG_RWLOCK */ | ||
219 | 117 | ||
220 | /* write_unlock is absolutely trivial - we don't have to wait for anything */ | 118 | /* write_unlock is absolutely trivial - we don't have to wait for anything */ |
221 | 119 | ||
222 | static __inline__ void _raw_write_unlock(rwlock_t *rw) | 120 | static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) |
223 | { | 121 | { |
224 | rw->counter = 0; | 122 | rw->counter = 0; |
225 | _raw_spin_unlock(&rw->lock); | 123 | __raw_spin_unlock(&rw->lock); |
226 | } | 124 | } |
227 | 125 | ||
228 | #ifdef CONFIG_DEBUG_RWLOCK | 126 | static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) |
229 | extern int _dbg_write_trylock(rwlock_t * rw, const char *bfile, int bline); | ||
230 | #define _raw_write_trylock(rw) _dbg_write_trylock(rw, __FILE__, __LINE__) | ||
231 | #else | ||
232 | static __inline__ int _raw_write_trylock(rwlock_t *rw) | ||
233 | { | 127 | { |
234 | _raw_spin_lock(&rw->lock); | 128 | __raw_spin_lock(&rw->lock); |
235 | if (rw->counter != 0) { | 129 | if (rw->counter != 0) { |
236 | /* this basically never happens */ | 130 | /* this basically never happens */ |
237 | _raw_spin_unlock(&rw->lock); | 131 | __raw_spin_unlock(&rw->lock); |
238 | 132 | ||
239 | return 0; | 133 | return 0; |
240 | } | 134 | } |
@@ -243,14 +137,13 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw) | |||
243 | rw->counter = -1; /* remember we are locked */ | 137 | rw->counter = -1; /* remember we are locked */ |
244 | return 1; | 138 | return 1; |
245 | } | 139 | } |
246 | #endif /* CONFIG_DEBUG_RWLOCK */ | ||
247 | 140 | ||
248 | static __inline__ int is_read_locked(rwlock_t *rw) | 141 | static __inline__ int __raw_is_read_locked(raw_rwlock_t *rw) |
249 | { | 142 | { |
250 | return rw->counter > 0; | 143 | return rw->counter > 0; |
251 | } | 144 | } |
252 | 145 | ||
253 | static __inline__ int is_write_locked(rwlock_t *rw) | 146 | static __inline__ int __raw_is_write_locked(raw_rwlock_t *rw) |
254 | { | 147 | { |
255 | return rw->counter < 0; | 148 | return rw->counter < 0; |
256 | } | 149 | } |
diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h new file mode 100644 index 000000000000..785bba822fbf --- /dev/null +++ b/include/asm-parisc/spinlock_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock[4]; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } } | ||
13 | |||
14 | typedef struct { | ||
15 | raw_spinlock_t lock; | ||
16 | volatile int counter; | ||
17 | } raw_rwlock_t; | ||
18 | |||
19 | #define __RAW_RW_LOCK_UNLOCKED { __RAW_SPIN_LOCK_UNLOCKED, 0 } | ||
20 | |||
21 | #endif | ||
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h index 81c543339036..26ff844a21c1 100644 --- a/include/asm-parisc/system.h +++ b/include/asm-parisc/system.h | |||
@@ -160,29 +160,7 @@ static inline void set_eiem(unsigned long val) | |||
160 | }) | 160 | }) |
161 | 161 | ||
162 | #ifdef CONFIG_SMP | 162 | #ifdef CONFIG_SMP |
163 | /* | 163 | # define __lock_aligned __attribute__((__section__(".data.lock_aligned"))) |
164 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | ||
165 | */ | ||
166 | |||
167 | typedef struct { | ||
168 | volatile unsigned int lock[4]; | ||
169 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
170 | unsigned long magic; | ||
171 | volatile unsigned int babble; | ||
172 | const char *module; | ||
173 | char *bfile; | ||
174 | int bline; | ||
175 | int oncpu; | ||
176 | void *previous; | ||
177 | struct task_struct * task; | ||
178 | #endif | ||
179 | #ifdef CONFIG_PREEMPT | ||
180 | unsigned int break_lock; | ||
181 | #endif | ||
182 | } spinlock_t; | ||
183 | |||
184 | #define __lock_aligned __attribute__((__section__(".data.lock_aligned"))) | ||
185 | |||
186 | #endif | 164 | #endif |
187 | 165 | ||
188 | #define KERNEL_START (0x10100000 - 0x1000) | 166 | #define KERNEL_START (0x10100000 - 0x1000) |
diff --git a/include/asm-powerpc/8253pit.h b/include/asm-powerpc/8253pit.h index 862708a749b0..b70d6e53b303 100644 --- a/include/asm-powerpc/8253pit.h +++ b/include/asm-powerpc/8253pit.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _ASM_POWERPC_8253PIT_H | ||
2 | #define _ASM_POWERPC_8253PIT_H | ||
3 | |||
1 | /* | 4 | /* |
2 | * 8253/8254 Programmable Interval Timer | 5 | * 8253/8254 Programmable Interval Timer |
3 | */ | 6 | */ |
4 | 7 | ||
5 | #ifndef _8253PIT_H | ||
6 | #define _8253PIT_H | ||
7 | |||
8 | #define PIT_TICK_RATE 1193182UL | 8 | #define PIT_TICK_RATE 1193182UL |
9 | 9 | ||
10 | #endif | 10 | #endif /* _ASM_POWERPC_8253PIT_H */ |
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h index ca9e423307f4..885b4631a6cf 100644 --- a/include/asm-powerpc/agp.h +++ b/include/asm-powerpc/agp.h | |||
@@ -1,10 +1,8 @@ | |||
1 | #ifndef AGP_H | 1 | #ifndef _ASM_POWERPC_AGP_H |
2 | #define AGP_H 1 | 2 | #define _ASM_POWERPC_AGP_H |
3 | 3 | ||
4 | #include <asm/io.h> | 4 | #include <asm/io.h> |
5 | 5 | ||
6 | /* nothing much needed here */ | ||
7 | |||
8 | #define map_page_into_agp(page) | 6 | #define map_page_into_agp(page) |
9 | #define unmap_page_from_agp(page) | 7 | #define unmap_page_from_agp(page) |
10 | #define flush_agp_mappings() | 8 | #define flush_agp_mappings() |
@@ -20,4 +18,4 @@ | |||
20 | #define free_gatt_pages(table, order) \ | 18 | #define free_gatt_pages(table, order) \ |
21 | free_pages((unsigned long)(table), (order)) | 19 | free_pages((unsigned long)(table), (order)) |
22 | 20 | ||
23 | #endif | 21 | #endif /* _ASM_POWERPC_AGP_H */ |
diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h index 310187d0e33a..42fdb73e3068 100644 --- a/include/asm-powerpc/bugs.h +++ b/include/asm-powerpc/bugs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_BUGS_H | 1 | #ifndef _ASM_POWERPC_BUGS_H |
2 | #define _POWERPC_BUGS_H | 2 | #define _ASM_POWERPC_BUGS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -13,6 +13,6 @@ | |||
13 | * architecture-dependent bugs. | 13 | * architecture-dependent bugs. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | extern void check_bugs(void); | 16 | static inline void check_bugs(void) { } |
17 | 17 | ||
18 | #endif /* _POWERPC_BUGS_H */ | 18 | #endif /* _ASM_POWERPC_BUGS_H */ |
diff --git a/include/asm-powerpc/errno.h b/include/asm-powerpc/errno.h index 19f20bd41ae6..8c145fd17d86 100644 --- a/include/asm-powerpc/errno.h +++ b/include/asm-powerpc/errno.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC_ERRNO_H | 1 | #ifndef _ASM_POWERPC_ERRNO_H |
2 | #define _PPC_ERRNO_H | 2 | #define _ASM_POWERPC_ERRNO_H |
3 | 3 | ||
4 | #include <asm-generic/errno.h> | 4 | #include <asm-generic/errno.h> |
5 | 5 | ||
@@ -8,4 +8,4 @@ | |||
8 | 8 | ||
9 | #define _LAST_ERRNO 516 | 9 | #define _LAST_ERRNO 516 |
10 | 10 | ||
11 | #endif | 11 | #endif /* _ASM_POWERPC_ERRNO_H */ |
diff --git a/include/asm-powerpc/ioctl.h b/include/asm-powerpc/ioctl.h index 93c6acfdd0fd..8eb99848c402 100644 --- a/include/asm-powerpc/ioctl.h +++ b/include/asm-powerpc/ioctl.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC_IOCTL_H | 1 | #ifndef _ASM_POWERPC_IOCTL_H |
2 | #define _PPC_IOCTL_H | 2 | #define _ASM_POWERPC_IOCTL_H |
3 | 3 | ||
4 | 4 | ||
5 | /* | 5 | /* |
@@ -66,4 +66,4 @@ extern unsigned int __invalid_size_argument_for_IOC; | |||
66 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | 66 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) |
67 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | 67 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) |
68 | 68 | ||
69 | #endif | 69 | #endif /* _ASM_POWERPC_IOCTL_H */ |
diff --git a/include/asm-powerpc/ioctls.h b/include/asm-powerpc/ioctls.h index f5b7f2b055e7..5b94ff489b8b 100644 --- a/include/asm-powerpc/ioctls.h +++ b/include/asm-powerpc/ioctls.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_PPC_IOCTLS_H | 1 | #ifndef _ASM_POWERPC_IOCTLS_H |
2 | #define _ASM_PPC_IOCTLS_H | 2 | #define _ASM_POWERPC_IOCTLS_H |
3 | 3 | ||
4 | #include <asm/ioctl.h> | 4 | #include <asm/ioctl.h> |
5 | 5 | ||
@@ -104,4 +104,4 @@ | |||
104 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | 104 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ |
105 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | 105 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ |
106 | 106 | ||
107 | #endif /* _ASM_PPC_IOCTLS_H */ | 107 | #endif /* _ASM_POWERPC_IOCTLS_H */ |
diff --git a/include/asm-powerpc/linkage.h b/include/asm-powerpc/linkage.h index 291c2d01c44f..e1c4ac1cc4ba 100644 --- a/include/asm-powerpc/linkage.h +++ b/include/asm-powerpc/linkage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | 1 | #ifndef _ASM_POWERPC_LINKAGE_H |
2 | #define __ASM_LINKAGE_H | 2 | #define _ASM_POWERPC_LINKAGE_H |
3 | 3 | ||
4 | /* Nothing to see here... */ | 4 | /* Nothing to see here... */ |
5 | 5 | ||
6 | #endif | 6 | #endif /* _ASM_POWERPC_LINKAGE_H */ |
diff --git a/include/asm-powerpc/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h index a5619a2a1393..f2741c8b59a1 100644 --- a/include/asm-powerpc/mc146818rtc.h +++ b/include/asm-powerpc/mc146818rtc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_MC146818RTC_H | 1 | #ifndef _ASM_POWERPC_MC146818RTC_H |
2 | #define _POWERPC_MC146818RTC_H | 2 | #define _ASM_POWERPC_MC146818RTC_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Machine dependent access functions for RTC registers. | 5 | * Machine dependent access functions for RTC registers. |
@@ -33,4 +33,4 @@ outb_p((val),RTC_PORT(1)); \ | |||
33 | }) | 33 | }) |
34 | 34 | ||
35 | #endif /* __KERNEL__ */ | 35 | #endif /* __KERNEL__ */ |
36 | #endif /* _POWERPC_MC146818RTC_H */ | 36 | #endif /* _ASM_POWERPC_MC146818RTC_H */ |
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h index f2d55988d749..f5e5342fcac5 100644 --- a/include/asm-powerpc/mman.h +++ b/include/asm-powerpc/mman.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_MMAN_H | 1 | #ifndef _ASM_POWERPC_MMAN_H |
2 | #define _POWERPC_MMAN_H | 2 | #define _ASM_POWERPC_MMAN_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -49,4 +49,4 @@ | |||
49 | #define MAP_ANON MAP_ANONYMOUS | 49 | #define MAP_ANON MAP_ANONYMOUS |
50 | #define MAP_FILE 0 | 50 | #define MAP_FILE 0 |
51 | 51 | ||
52 | #endif /* _POWERPC_MMAN_H */ | 52 | #endif /* _ASM_POWERPC_MMAN_H */ |
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h index 4438f4fd6524..7ecd05e03051 100644 --- a/include/asm-powerpc/module.h +++ b/include/asm-powerpc/module.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_MODULE_H | 1 | #ifndef _ASM_POWERPC_MODULE_H |
2 | #define _POWERPC_MODULE_H | 2 | #define _ASM_POWERPC_MODULE_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -74,4 +74,4 @@ struct exception_table_entry; | |||
74 | void sort_ex_table(struct exception_table_entry *start, | 74 | void sort_ex_table(struct exception_table_entry *start, |
75 | struct exception_table_entry *finish); | 75 | struct exception_table_entry *finish); |
76 | 76 | ||
77 | #endif /* _POWERPC_MODULE_H */ | 77 | #endif /* _ASM_POWERPC_MODULE_H */ |
diff --git a/include/asm-ppc/msgbuf.h b/include/asm-powerpc/msgbuf.h index 1053452a9376..dd76743c7537 100644 --- a/include/asm-ppc/msgbuf.h +++ b/include/asm-powerpc/msgbuf.h | |||
@@ -1,17 +1,25 @@ | |||
1 | #ifndef _PPC_MSGBUF_H | 1 | #ifndef _ASM_POWERPC_MSGBUF_H |
2 | #define _PPC_MSGBUF_H | 2 | #define _ASM_POWERPC_MSGBUF_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * The msqid64_ds structure for the PPC architecture. | 5 | * The msqid64_ds structure for the PowerPC architecture. |
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
6 | */ | 8 | */ |
7 | 9 | ||
8 | struct msqid64_ds { | 10 | struct msqid64_ds { |
9 | struct ipc64_perm msg_perm; | 11 | struct ipc64_perm msg_perm; |
12 | #ifndef __powerpc64__ | ||
10 | unsigned int __unused1; | 13 | unsigned int __unused1; |
14 | #endif | ||
11 | __kernel_time_t msg_stime; /* last msgsnd time */ | 15 | __kernel_time_t msg_stime; /* last msgsnd time */ |
16 | #ifndef __powerpc64__ | ||
12 | unsigned int __unused2; | 17 | unsigned int __unused2; |
18 | #endif | ||
13 | __kernel_time_t msg_rtime; /* last msgrcv time */ | 19 | __kernel_time_t msg_rtime; /* last msgrcv time */ |
20 | #ifndef __powerpc64__ | ||
14 | unsigned int __unused3; | 21 | unsigned int __unused3; |
22 | #endif | ||
15 | __kernel_time_t msg_ctime; /* last change time */ | 23 | __kernel_time_t msg_ctime; /* last change time */ |
16 | unsigned long msg_cbytes; /* current number of bytes on queue */ | 24 | unsigned long msg_cbytes; /* current number of bytes on queue */ |
17 | unsigned long msg_qnum; /* number of messages in queue */ | 25 | unsigned long msg_qnum; /* number of messages in queue */ |
@@ -22,4 +30,4 @@ struct msqid64_ds { | |||
22 | unsigned long __unused5; | 30 | unsigned long __unused5; |
23 | }; | 31 | }; |
24 | 32 | ||
25 | #endif /* _PPC_MSGBUF_H */ | 33 | #endif /* _ASM_POWERPC_MSGBUF_H */ |
diff --git a/include/asm-powerpc/namei.h b/include/asm-powerpc/namei.h index 29c9ec832133..657443474a6a 100644 --- a/include/asm-powerpc/namei.h +++ b/include/asm-powerpc/namei.h | |||
@@ -1,14 +1,14 @@ | |||
1 | #ifndef _ASM_POWERPC_NAMEI_H | ||
2 | #define _ASM_POWERPC_NAMEI_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
1 | /* | 6 | /* |
2 | * include/asm-ppc/namei.h | ||
3 | * Adapted from include/asm-alpha/namei.h | 7 | * Adapted from include/asm-alpha/namei.h |
4 | * | 8 | * |
5 | * Included from fs/namei.c | 9 | * Included from fs/namei.c |
6 | */ | 10 | */ |
7 | 11 | ||
8 | #ifdef __KERNEL__ | ||
9 | #ifndef __PPC_NAMEI_H | ||
10 | #define __PPC_NAMEI_H | ||
11 | |||
12 | /* This dummy routine maybe changed to something useful | 12 | /* This dummy routine maybe changed to something useful |
13 | * for /usr/gnemul/ emulation stuff. | 13 | * for /usr/gnemul/ emulation stuff. |
14 | * Look at asm-sparc/namei.h for details. | 14 | * Look at asm-sparc/namei.h for details. |
@@ -16,5 +16,5 @@ | |||
16 | 16 | ||
17 | #define __emul_prefix() NULL | 17 | #define __emul_prefix() NULL |
18 | 18 | ||
19 | #endif /* __PPC_NAMEI_H */ | 19 | #endif /* __KERNEL__ */ |
20 | #endif /* __KERNEL__ */ | 20 | #endif /* _ASM_POWERPC_NAMEI_H */ |
diff --git a/include/asm-ppc/param.h b/include/asm-powerpc/param.h index 6198b1657a45..bdc724f70884 100644 --- a/include/asm-ppc/param.h +++ b/include/asm-powerpc/param.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _ASM_PPC_PARAM_H | 1 | #ifndef _ASM_POWERPC_PARAM_H |
2 | #define _ASM_PPC_PARAM_H | 2 | #define _ASM_POWERPC_PARAM_H |
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
7 | #define HZ CONFIG_HZ /* internal timer frequency */ | 7 | #define HZ CONFIG_HZ /* internal kernel timer frequency */ |
8 | #define USER_HZ 100 /* for user interfaces in "ticks" */ | 8 | #define USER_HZ 100 /* for user interfaces in "ticks" */ |
9 | #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ | 9 | #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ |
10 | #endif /* __KERNEL__ */ | 10 | #endif /* __KERNEL__ */ |
@@ -21,4 +21,4 @@ | |||
21 | 21 | ||
22 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | 22 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ |
23 | 23 | ||
24 | #endif | 24 | #endif /* _ASM_POWERPC_PARAM_H */ |
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h index be5024913c62..edd2054da86b 100644 --- a/include/asm-powerpc/poll.h +++ b/include/asm-powerpc/poll.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __PPC_POLL_H | 1 | #ifndef _ASM_POWERPC_POLL_H |
2 | #define __PPC_POLL_H | 2 | #define _ASM_POWERPC_POLL_H |
3 | 3 | ||
4 | #define POLLIN 0x0001 | 4 | #define POLLIN 0x0001 |
5 | #define POLLPRI 0x0002 | 5 | #define POLLPRI 0x0002 |
@@ -20,4 +20,4 @@ struct pollfd { | |||
20 | short revents; | 20 | short revents; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | #endif | 23 | #endif /* _ASM_POWERPC_POLL_H */ |
diff --git a/include/asm-powerpc/sembuf.h b/include/asm-powerpc/sembuf.h index c98fc18fe805..99a41938ae3d 100644 --- a/include/asm-powerpc/sembuf.h +++ b/include/asm-powerpc/sembuf.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_SEMBUF_H | 1 | #ifndef _ASM_POWERPC_SEMBUF_H |
2 | #define _POWERPC_SEMBUF_H | 2 | #define _ASM_POWERPC_SEMBUF_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -33,4 +33,4 @@ struct semid64_ds { | |||
33 | unsigned long __unused4; | 33 | unsigned long __unused4; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif /* _POWERPC_SEMBUF_H */ | 36 | #endif /* _ASM_POWERPC_SEMBUF_H */ |
diff --git a/include/asm-powerpc/setup.h b/include/asm-powerpc/setup.h new file mode 100644 index 000000000000..3d9740aae018 --- /dev/null +++ b/include/asm-powerpc/setup.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_POWERPC_SETUP_H | ||
2 | #define _ASM_POWERPC_SETUP_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #define COMMAND_LINE_SIZE 512 | ||
7 | |||
8 | #endif /* __KERNEL__ */ | ||
9 | #endif /* _ASM_POWERPC_SETUP_H */ | ||
diff --git a/include/asm-powerpc/shmbuf.h b/include/asm-powerpc/shmbuf.h index 29632db3b178..8efa39698b6c 100644 --- a/include/asm-powerpc/shmbuf.h +++ b/include/asm-powerpc/shmbuf.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_SHMBUF_H | 1 | #ifndef _ASM_POWERPC_SHMBUF_H |
2 | #define _POWERPC_SHMBUF_H | 2 | #define _ASM_POWERPC_SHMBUF_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -21,19 +21,19 @@ | |||
21 | 21 | ||
22 | struct shmid64_ds { | 22 | struct shmid64_ds { |
23 | struct ipc64_perm shm_perm; /* operation perms */ | 23 | struct ipc64_perm shm_perm; /* operation perms */ |
24 | #ifndef __power64__ | 24 | #ifndef __powerpc64__ |
25 | unsigned long __unused1; | 25 | unsigned long __unused1; |
26 | #endif | 26 | #endif |
27 | __kernel_time_t shm_atime; /* last attach time */ | 27 | __kernel_time_t shm_atime; /* last attach time */ |
28 | #ifndef __power64__ | 28 | #ifndef __powerpc64__ |
29 | unsigned long __unused2; | 29 | unsigned long __unused2; |
30 | #endif | 30 | #endif |
31 | __kernel_time_t shm_dtime; /* last detach time */ | 31 | __kernel_time_t shm_dtime; /* last detach time */ |
32 | #ifndef __power64__ | 32 | #ifndef __powerpc64__ |
33 | unsigned long __unused3; | 33 | unsigned long __unused3; |
34 | #endif | 34 | #endif |
35 | __kernel_time_t shm_ctime; /* last change time */ | 35 | __kernel_time_t shm_ctime; /* last change time */ |
36 | #ifndef __power64__ | 36 | #ifndef __powerpc64__ |
37 | unsigned long __unused4; | 37 | unsigned long __unused4; |
38 | #endif | 38 | #endif |
39 | size_t shm_segsz; /* size of segment (bytes) */ | 39 | size_t shm_segsz; /* size of segment (bytes) */ |
@@ -56,4 +56,4 @@ struct shminfo64 { | |||
56 | unsigned long __unused4; | 56 | unsigned long __unused4; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | #endif /* _POWERPC_SHMBUF_H */ | 59 | #endif /* _ASM_POWERPC_SHMBUF_H */ |
diff --git a/include/asm-powerpc/shmparam.h b/include/asm-powerpc/shmparam.h index d6250602ae64..5cda42a6d39e 100644 --- a/include/asm-powerpc/shmparam.h +++ b/include/asm-powerpc/shmparam.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _PPC_SHMPARAM_H | 1 | #ifndef _ASM_POWERPC_SHMPARAM_H |
2 | #define _PPC_SHMPARAM_H | 2 | #define _ASM_POWERPC_SHMPARAM_H |
3 | 3 | ||
4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | 4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ |
5 | 5 | ||
6 | #endif /* _PPC_SHMPARAM_H */ | 6 | #endif /* _ASM_POWERPC_SHMPARAM_H */ |
diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h index ae70b8010b19..538ea8ef509b 100644 --- a/include/asm-powerpc/siginfo.h +++ b/include/asm-powerpc/siginfo.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_SIGINFO_H | 1 | #ifndef _ASM_POWERPC_SIGINFO_H |
2 | #define _POWERPC_SIGINFO_H | 2 | #define _ASM_POWERPC_SIGINFO_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -15,4 +15,4 @@ | |||
15 | 15 | ||
16 | #include <asm-generic/siginfo.h> | 16 | #include <asm-generic/siginfo.h> |
17 | 17 | ||
18 | #endif /* _POWERPC_SIGINFO_H */ | 18 | #endif /* _ASM_POWERPC_SIGINFO_H */ |
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h index 51a0cf5ee9f0..e4b8177d4acc 100644 --- a/include/asm-powerpc/socket.h +++ b/include/asm-powerpc/socket.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_SOCKET_H | 1 | #ifndef _ASM_POWERPC_SOCKET_H |
2 | #define _POWERPC_SOCKET_H | 2 | #define _ASM_POWERPC_SOCKET_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -56,4 +56,4 @@ | |||
56 | 56 | ||
57 | #define SO_PEERSEC 31 | 57 | #define SO_PEERSEC 31 |
58 | 58 | ||
59 | #endif /* _POWERPC_SOCKET_H */ | 59 | #endif /* _ASM_POWERPC_SOCKET_H */ |
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h index ef7ff664167e..590078d8ed28 100644 --- a/include/asm-powerpc/sockios.h +++ b/include/asm-powerpc/sockios.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_SOCKIOS_H | 1 | #ifndef _ASM_POWERPC_SOCKIOS_H |
2 | #define _POWERPC_SOCKIOS_H | 2 | #define _ASM_POWERPC_SOCKIOS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -16,4 +16,4 @@ | |||
16 | #define SIOCATMARK 0x8905 | 16 | #define SIOCATMARK 0x8905 |
17 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 17 | #define SIOCGSTAMP 0x8906 /* Get stamp */ |
18 | 18 | ||
19 | #endif /* _POWERPC_SOCKIOS_H */ | 19 | #endif /* _ASM_POWERPC_SOCKIOS_H */ |
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h index 225575997392..8606a696c088 100644 --- a/include/asm-powerpc/string.h +++ b/include/asm-powerpc/string.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC_STRING_H_ | 1 | #ifndef _ASM_POWERPC_STRING_H |
2 | #define _PPC_STRING_H_ | 2 | #define _ASM_POWERPC_STRING_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
@@ -29,4 +29,4 @@ extern void * memchr(const void *,int,__kernel_size_t); | |||
29 | 29 | ||
30 | #endif /* __KERNEL__ */ | 30 | #endif /* __KERNEL__ */ |
31 | 31 | ||
32 | #endif | 32 | #endif /* _ASM_POWERPC_STRING_H */ |
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h index 2c5bf85a8c3c..ebf6055481dc 100644 --- a/include/asm-powerpc/termbits.h +++ b/include/asm-powerpc/termbits.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_TERMBITS_H | 1 | #ifndef _ASM_POWERPC_TERMBITS_H |
2 | #define _POWERPC_TERMBITS_H | 2 | #define _ASM_POWERPC_TERMBITS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -188,4 +188,4 @@ struct termios { | |||
188 | #define TCSADRAIN 1 | 188 | #define TCSADRAIN 1 |
189 | #define TCSAFLUSH 2 | 189 | #define TCSAFLUSH 2 |
190 | 190 | ||
191 | #endif /* _POWERPC_TERMBITS_H */ | 191 | #endif /* _ASM_POWERPC_TERMBITS_H */ |
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h index 237533bb0e9f..c5b8e5358f83 100644 --- a/include/asm-powerpc/termios.h +++ b/include/asm-powerpc/termios.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _POWERPC_TERMIOS_H | 1 | #ifndef _ASM_POWERPC_TERMIOS_H |
2 | #define _POWERPC_TERMIOS_H | 2 | #define _ASM_POWERPC_TERMIOS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Liberally adapted from alpha/termios.h. In particular, the c_cc[] | 5 | * Liberally adapted from alpha/termios.h. In particular, the c_cc[] |
@@ -233,4 +233,4 @@ struct termio { | |||
233 | 233 | ||
234 | #endif /* __KERNEL__ */ | 234 | #endif /* __KERNEL__ */ |
235 | 235 | ||
236 | #endif /* _POWERPC_TERMIOS_H */ | 236 | #endif /* _ASM_POWERPC_TERMIOS_H */ |
diff --git a/include/asm-ppc/timex.h b/include/asm-powerpc/timex.h index cffc8712077c..51c5b316be55 100644 --- a/include/asm-ppc/timex.h +++ b/include/asm-powerpc/timex.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef _ASM_POWERPC_TIMEX_H | ||
2 | #define _ASM_POWERPC_TIMEX_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
1 | /* | 6 | /* |
2 | * include/asm-ppc/timex.h | 7 | * PowerPC architecture timex specifications |
3 | * | ||
4 | * ppc architecture timex specifications | ||
5 | */ | 8 | */ |
6 | #ifdef __KERNEL__ | ||
7 | #ifndef _ASMppc_TIMEX_H | ||
8 | #define _ASMppc_TIMEX_H | ||
9 | 9 | ||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <asm/cputable.h> | 11 | #include <asm/cputable.h> |
@@ -14,14 +14,21 @@ | |||
14 | 14 | ||
15 | typedef unsigned long cycles_t; | 15 | typedef unsigned long cycles_t; |
16 | 16 | ||
17 | /* | ||
18 | * For the "cycle" counter we use the timebase lower half. | ||
19 | * Currently only used on SMP. | ||
20 | */ | ||
21 | |||
22 | static inline cycles_t get_cycles(void) | 17 | static inline cycles_t get_cycles(void) |
23 | { | 18 | { |
24 | cycles_t ret = 0; | 19 | cycles_t ret; |
20 | |||
21 | #ifdef __powerpc64__ | ||
22 | |||
23 | __asm__ __volatile__("mftb %0" : "=r" (ret) : ); | ||
24 | |||
25 | #else | ||
26 | /* | ||
27 | * For the "cycle" counter we use the timebase lower half. | ||
28 | * Currently only used on SMP. | ||
29 | */ | ||
30 | |||
31 | ret = 0; | ||
25 | 32 | ||
26 | __asm__ __volatile__( | 33 | __asm__ __volatile__( |
27 | "98: mftb %0\n" | 34 | "98: mftb %0\n" |
@@ -33,8 +40,10 @@ static inline cycles_t get_cycles(void) | |||
33 | " .long 99b\n" | 40 | " .long 99b\n" |
34 | ".previous" | 41 | ".previous" |
35 | : "=r" (ret) : "i" (CPU_FTR_601)); | 42 | : "=r" (ret) : "i" (CPU_FTR_601)); |
43 | #endif | ||
44 | |||
36 | return ret; | 45 | return ret; |
37 | } | 46 | } |
38 | 47 | ||
39 | #endif | 48 | #endif /* __KERNEL__ */ |
40 | #endif /* __KERNEL__ */ | 49 | #endif /* _ASM_POWERPC_TIMEX_H */ |
diff --git a/include/asm-ppc64/topology.h b/include/asm-powerpc/topology.h index 1e9b19073230..2512e3836bf4 100644 --- a/include/asm-ppc64/topology.h +++ b/include/asm-powerpc/topology.h | |||
@@ -1,11 +1,12 @@ | |||
1 | #ifndef _ASM_PPC64_TOPOLOGY_H | 1 | #ifndef _ASM_POWERPC_TOPOLOGY_H |
2 | #define _ASM_PPC64_TOPOLOGY_H | 2 | #define _ASM_POWERPC_TOPOLOGY_H |
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | #include <asm/mmzone.h> | ||
6 | 5 | ||
7 | #ifdef CONFIG_NUMA | 6 | #ifdef CONFIG_NUMA |
8 | 7 | ||
8 | #include <asm/mmzone.h> | ||
9 | |||
9 | static inline int cpu_to_node(int cpu) | 10 | static inline int cpu_to_node(int cpu) |
10 | { | 11 | { |
11 | int node; | 12 | int node; |
@@ -66,4 +67,4 @@ static inline int node_to_first_cpu(int node) | |||
66 | 67 | ||
67 | #endif /* CONFIG_NUMA */ | 68 | #endif /* CONFIG_NUMA */ |
68 | 69 | ||
69 | #endif /* _ASM_PPC64_TOPOLOGY_H */ | 70 | #endif /* _ASM_POWERPC_TOPOLOGY_H */ |
diff --git a/include/asm-powerpc/unaligned.h b/include/asm-powerpc/unaligned.h index 45520d9b85d1..6c95dfa2652f 100644 --- a/include/asm-powerpc/unaligned.h +++ b/include/asm-powerpc/unaligned.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ASM_POWERPC_UNALIGNED_H | ||
2 | #define _ASM_POWERPC_UNALIGNED_H | ||
3 | |||
1 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
2 | #ifndef __PPC_UNALIGNED_H | ||
3 | #define __PPC_UNALIGNED_H | ||
4 | 5 | ||
5 | /* | 6 | /* |
6 | * The PowerPC can do unaligned accesses itself in big endian mode. | 7 | * The PowerPC can do unaligned accesses itself in big endian mode. |
@@ -14,5 +15,5 @@ | |||
14 | 15 | ||
15 | #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) | 16 | #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) |
16 | 17 | ||
17 | #endif | 18 | #endif /* __KERNEL__ */ |
18 | #endif /* __KERNEL__ */ | 19 | #endif /* _ASM_POWERPC_UNALIGNED_H */ |
diff --git a/include/asm-ppc/user.h b/include/asm-powerpc/user.h index d662b2151370..e59ade4b3dfb 100644 --- a/include/asm-ppc/user.h +++ b/include/asm-powerpc/user.h | |||
@@ -1,13 +1,14 @@ | |||
1 | #ifdef __KERNEL__ | 1 | #ifndef _ASM_POWERPC_USER_H |
2 | #ifndef _PPC_USER_H | 2 | #define _ASM_POWERPC_USER_H |
3 | #define _PPC_USER_H | ||
4 | 3 | ||
5 | /* Adapted from <asm-alpha/user.h> */ | 4 | #ifdef __KERNEL__ |
6 | 5 | ||
7 | #include <linux/ptrace.h> | 6 | #include <asm/ptrace.h> |
8 | #include <asm/page.h> | 7 | #include <asm/page.h> |
9 | 8 | ||
10 | /* | 9 | /* |
10 | * Adapted from <asm-alpha/user.h> | ||
11 | * | ||
11 | * Core file format: The core file is written in such a way that gdb | 12 | * Core file format: The core file is written in such a way that gdb |
12 | * can understand it and provide useful information to the user (under | 13 | * can understand it and provide useful information to the user (under |
13 | * linux we use the `trad-core' bfd, NOT the osf-core). The file contents | 14 | * linux we use the `trad-core' bfd, NOT the osf-core). The file contents |
@@ -50,5 +51,5 @@ struct user { | |||
50 | #define HOST_DATA_START_ADDR (u.start_data) | 51 | #define HOST_DATA_START_ADDR (u.start_data) |
51 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | 52 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) |
52 | 53 | ||
53 | #endif /* _PPC_USER_H */ | 54 | #endif /* __KERNEL__ */ |
54 | #endif /* __KERNEL__ */ | 55 | #endif /* _ASM_POWERPC_USER_H */ |
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index b4b270457edd..55752474d0d9 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h | |||
@@ -404,9 +404,5 @@ extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | |||
404 | extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | 404 | extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; |
405 | extern atomic_t ppc_n_lost_interrupts; | 405 | extern atomic_t ppc_n_lost_interrupts; |
406 | 406 | ||
407 | struct irqaction; | ||
408 | struct pt_regs; | ||
409 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
410 | |||
411 | #endif /* _ASM_IRQ_H */ | 407 | #endif /* _ASM_IRQ_H */ |
412 | #endif /* __KERNEL__ */ | 408 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h index 88b4222154d4..73c33e3ef9c6 100644 --- a/include/asm-ppc/reg.h +++ b/include/asm-ppc/reg.h | |||
@@ -366,12 +366,6 @@ | |||
366 | #define PVR_STB03XXX 0x40310000 | 366 | #define PVR_STB03XXX 0x40310000 |
367 | #define PVR_NP405H 0x41410000 | 367 | #define PVR_NP405H 0x41410000 |
368 | #define PVR_NP405L 0x41610000 | 368 | #define PVR_NP405L 0x41610000 |
369 | #define PVR_440GP_RB 0x40120440 | ||
370 | #define PVR_440GP_RC1 0x40120481 | ||
371 | #define PVR_440GP_RC2 0x40200481 | ||
372 | #define PVR_440GX_RA 0x51b21850 | ||
373 | #define PVR_440GX_RB 0x51b21851 | ||
374 | #define PVR_440GX_RC 0x51b21892 | ||
375 | #define PVR_601 0x00010000 | 369 | #define PVR_601 0x00010000 |
376 | #define PVR_602 0x00050000 | 370 | #define PVR_602 0x00050000 |
377 | #define PVR_603 0x00030000 | 371 | #define PVR_603 0x00030000 |
diff --git a/include/asm-ppc/setup.h b/include/asm-ppc/setup.h deleted file mode 100644 index d2d19ee103df..000000000000 --- a/include/asm-ppc/setup.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | #ifndef _PPC_SETUP_H | ||
3 | #define _PPC_SETUP_H | ||
4 | |||
5 | #define m68k_num_memory num_memory | ||
6 | #define m68k_memory memory | ||
7 | |||
8 | #include <asm-m68k/setup.h> | ||
9 | /* We have a bigger command line buffer. */ | ||
10 | #undef COMMAND_LINE_SIZE | ||
11 | #define COMMAND_LINE_SIZE 512 | ||
12 | |||
13 | #endif /* _PPC_SETUP_H */ | ||
14 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 17530c232c76..829481c0a9dc 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h | |||
@@ -41,6 +41,10 @@ extern void smp_send_xmon_break(int cpu); | |||
41 | struct pt_regs; | 41 | struct pt_regs; |
42 | extern void smp_message_recv(int, struct pt_regs *); | 42 | extern void smp_message_recv(int, struct pt_regs *); |
43 | 43 | ||
44 | extern int __cpu_disable(void); | ||
45 | extern void __cpu_die(unsigned int cpu); | ||
46 | extern void cpu_die(void) __attribute__((noreturn)); | ||
47 | |||
44 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 48 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
45 | #define PROC_CHANGE_PENALTY 20 | 49 | #define PROC_CHANGE_PENALTY 20 |
46 | 50 | ||
@@ -64,6 +68,8 @@ extern struct klock_info_struct klock_info; | |||
64 | 68 | ||
65 | #else /* !(CONFIG_SMP) */ | 69 | #else /* !(CONFIG_SMP) */ |
66 | 70 | ||
71 | static inline void cpu_die(void) { } | ||
72 | |||
67 | #endif /* !(CONFIG_SMP) */ | 73 | #endif /* !(CONFIG_SMP) */ |
68 | 74 | ||
69 | #endif /* !(_PPC_SMP_H) */ | 75 | #endif /* !(_PPC_SMP_H) */ |
diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index 909199aae104..20edcf2a6e0c 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h | |||
@@ -5,41 +5,21 @@ | |||
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Simple spin lock operations. | 7 | * Simple spin lock operations. |
8 | * | ||
9 | * (the type definitions are in asm/raw_spinlock_types.h) | ||
8 | */ | 10 | */ |
9 | 11 | ||
10 | typedef struct { | 12 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
11 | volatile unsigned long lock; | 13 | #define __raw_spin_unlock_wait(lock) \ |
12 | #ifdef CONFIG_DEBUG_SPINLOCK | 14 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) |
13 | volatile unsigned long owner_pc; | 15 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
14 | volatile unsigned long owner_cpu; | 16 | |
15 | #endif | 17 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
16 | #ifdef CONFIG_PREEMPT | ||
17 | unsigned int break_lock; | ||
18 | #endif | ||
19 | } spinlock_t; | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
23 | #define SPINLOCK_DEBUG_INIT , 0, 0 | ||
24 | #else | ||
25 | #define SPINLOCK_DEBUG_INIT /* */ | ||
26 | #endif | ||
27 | |||
28 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 SPINLOCK_DEBUG_INIT } | ||
29 | |||
30 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
31 | #define spin_is_locked(x) ((x)->lock != 0) | ||
32 | #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) | ||
33 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
34 | |||
35 | #ifndef CONFIG_DEBUG_SPINLOCK | ||
36 | |||
37 | static inline void _raw_spin_lock(spinlock_t *lock) | ||
38 | { | 18 | { |
39 | unsigned long tmp; | 19 | unsigned long tmp; |
40 | 20 | ||
41 | __asm__ __volatile__( | 21 | __asm__ __volatile__( |
42 | "b 1f # spin_lock\n\ | 22 | "b 1f # __raw_spin_lock\n\ |
43 | 2: lwzx %0,0,%1\n\ | 23 | 2: lwzx %0,0,%1\n\ |
44 | cmpwi 0,%0,0\n\ | 24 | cmpwi 0,%0,0\n\ |
45 | bne+ 2b\n\ | 25 | bne+ 2b\n\ |
@@ -55,21 +35,13 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
55 | : "cr0", "memory"); | 35 | : "cr0", "memory"); |
56 | } | 36 | } |
57 | 37 | ||
58 | static inline void _raw_spin_unlock(spinlock_t *lock) | 38 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
59 | { | 39 | { |
60 | __asm__ __volatile__("eieio # spin_unlock": : :"memory"); | 40 | __asm__ __volatile__("eieio # __raw_spin_unlock": : :"memory"); |
61 | lock->lock = 0; | 41 | lock->lock = 0; |
62 | } | 42 | } |
63 | 43 | ||
64 | #define _raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock)) | 44 | #define __raw_spin_trylock(l) (!test_and_set_bit(0,&(l)->lock)) |
65 | |||
66 | #else | ||
67 | |||
68 | extern void _raw_spin_lock(spinlock_t *lock); | ||
69 | extern void _raw_spin_unlock(spinlock_t *lock); | ||
70 | extern int _raw_spin_trylock(spinlock_t *lock); | ||
71 | |||
72 | #endif | ||
73 | 45 | ||
74 | /* | 46 | /* |
75 | * Read-write spinlocks, allowing multiple readers | 47 | * Read-write spinlocks, allowing multiple readers |
@@ -81,22 +53,11 @@ extern int _raw_spin_trylock(spinlock_t *lock); | |||
81 | * irq-safe write-lock, but readers can get non-irqsafe | 53 | * irq-safe write-lock, but readers can get non-irqsafe |
82 | * read-locks. | 54 | * read-locks. |
83 | */ | 55 | */ |
84 | typedef struct { | ||
85 | volatile signed int lock; | ||
86 | #ifdef CONFIG_PREEMPT | ||
87 | unsigned int break_lock; | ||
88 | #endif | ||
89 | } rwlock_t; | ||
90 | 56 | ||
91 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | 57 | #define __raw_read_can_lock(rw) ((rw)->lock >= 0) |
92 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) | 58 | #define __raw_write_can_lock(rw) (!(rw)->lock) |
93 | 59 | ||
94 | #define read_can_lock(rw) ((rw)->lock >= 0) | 60 | static __inline__ int __raw_read_trylock(raw_rwlock_t *rw) |
95 | #define write_can_lock(rw) (!(rw)->lock) | ||
96 | |||
97 | #ifndef CONFIG_DEBUG_SPINLOCK | ||
98 | |||
99 | static __inline__ int _raw_read_trylock(rwlock_t *rw) | ||
100 | { | 61 | { |
101 | signed int tmp; | 62 | signed int tmp; |
102 | 63 | ||
@@ -116,7 +77,7 @@ static __inline__ int _raw_read_trylock(rwlock_t *rw) | |||
116 | return tmp > 0; | 77 | return tmp > 0; |
117 | } | 78 | } |
118 | 79 | ||
119 | static __inline__ void _raw_read_lock(rwlock_t *rw) | 80 | static __inline__ void __raw_read_lock(raw_rwlock_t *rw) |
120 | { | 81 | { |
121 | signed int tmp; | 82 | signed int tmp; |
122 | 83 | ||
@@ -137,7 +98,7 @@ static __inline__ void _raw_read_lock(rwlock_t *rw) | |||
137 | : "cr0", "memory"); | 98 | : "cr0", "memory"); |
138 | } | 99 | } |
139 | 100 | ||
140 | static __inline__ void _raw_read_unlock(rwlock_t *rw) | 101 | static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) |
141 | { | 102 | { |
142 | signed int tmp; | 103 | signed int tmp; |
143 | 104 | ||
@@ -153,7 +114,7 @@ static __inline__ void _raw_read_unlock(rwlock_t *rw) | |||
153 | : "cr0", "memory"); | 114 | : "cr0", "memory"); |
154 | } | 115 | } |
155 | 116 | ||
156 | static __inline__ int _raw_write_trylock(rwlock_t *rw) | 117 | static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) |
157 | { | 118 | { |
158 | signed int tmp; | 119 | signed int tmp; |
159 | 120 | ||
@@ -173,7 +134,7 @@ static __inline__ int _raw_write_trylock(rwlock_t *rw) | |||
173 | return tmp == 0; | 134 | return tmp == 0; |
174 | } | 135 | } |
175 | 136 | ||
176 | static __inline__ void _raw_write_lock(rwlock_t *rw) | 137 | static __inline__ void __raw_write_lock(raw_rwlock_t *rw) |
177 | { | 138 | { |
178 | signed int tmp; | 139 | signed int tmp; |
179 | 140 | ||
@@ -194,22 +155,10 @@ static __inline__ void _raw_write_lock(rwlock_t *rw) | |||
194 | : "cr0", "memory"); | 155 | : "cr0", "memory"); |
195 | } | 156 | } |
196 | 157 | ||
197 | static __inline__ void _raw_write_unlock(rwlock_t *rw) | 158 | static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) |
198 | { | 159 | { |
199 | __asm__ __volatile__("eieio # write_unlock": : :"memory"); | 160 | __asm__ __volatile__("eieio # write_unlock": : :"memory"); |
200 | rw->lock = 0; | 161 | rw->lock = 0; |
201 | } | 162 | } |
202 | 163 | ||
203 | #else | ||
204 | |||
205 | extern void _raw_read_lock(rwlock_t *rw); | ||
206 | extern void _raw_read_unlock(rwlock_t *rw); | ||
207 | extern void _raw_write_lock(rwlock_t *rw); | ||
208 | extern void _raw_write_unlock(rwlock_t *rw); | ||
209 | extern int _raw_read_trylock(rwlock_t *rw); | ||
210 | extern int _raw_write_trylock(rwlock_t *rw); | ||
211 | |||
212 | #endif | ||
213 | |||
214 | #endif /* __ASM_SPINLOCK_H */ | 164 | #endif /* __ASM_SPINLOCK_H */ |
215 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-ppc/spinlock_types.h b/include/asm-ppc/spinlock_types.h new file mode 100644 index 000000000000..7919ccc75b8a --- /dev/null +++ b/include/asm-ppc/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned long lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile signed int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 513a334c5810..d754ab570fe0 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h | |||
@@ -88,6 +88,7 @@ extern void *cacheable_memcpy(void *, const void *, unsigned int); | |||
88 | extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); | 88 | extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); |
89 | extern void bad_page_fault(struct pt_regs *, unsigned long, int); | 89 | extern void bad_page_fault(struct pt_regs *, unsigned long, int); |
90 | extern void die(const char *, struct pt_regs *, long); | 90 | extern void die(const char *, struct pt_regs *, long); |
91 | extern void _exception(int, struct pt_regs *, int, unsigned long); | ||
91 | #ifdef CONFIG_BOOKE_WDT | 92 | #ifdef CONFIG_BOOKE_WDT |
92 | extern u32 booke_wdt_enabled; | 93 | extern u32 booke_wdt_enabled; |
93 | extern u32 booke_wdt_period; | 94 | extern u32 booke_wdt_period; |
diff --git a/include/asm-ppc/topology.h b/include/asm-ppc/topology.h deleted file mode 100644 index 6a029bbba6e1..000000000000 --- a/include/asm-ppc/topology.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _ASM_PPC_TOPOLOGY_H | ||
2 | #define _ASM_PPC_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_PPC_TOPOLOGY_H */ | ||
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h index 94298b106a4b..40c8eb57493e 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-ppc64/eeh.h | |||
@@ -219,23 +219,24 @@ static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) | |||
219 | static inline void eeh_memset_io(volatile void __iomem *addr, int c, | 219 | static inline void eeh_memset_io(volatile void __iomem *addr, int c, |
220 | unsigned long n) | 220 | unsigned long n) |
221 | { | 221 | { |
222 | void *p = (void __force *)addr; | ||
222 | u32 lc = c; | 223 | u32 lc = c; |
223 | lc |= lc << 8; | 224 | lc |= lc << 8; |
224 | lc |= lc << 16; | 225 | lc |= lc << 16; |
225 | 226 | ||
226 | while(n && !EEH_CHECK_ALIGN(addr, 4)) { | 227 | while(n && !EEH_CHECK_ALIGN(p, 4)) { |
227 | *((volatile u8 *)addr) = c; | 228 | *((volatile u8 *)p) = c; |
228 | addr = (void *)((unsigned long)addr + 1); | 229 | p++; |
229 | n--; | 230 | n--; |
230 | } | 231 | } |
231 | while(n >= 4) { | 232 | while(n >= 4) { |
232 | *((volatile u32 *)addr) = lc; | 233 | *((volatile u32 *)p) = lc; |
233 | addr = (void *)((unsigned long)addr + 4); | 234 | p += 4; |
234 | n -= 4; | 235 | n -= 4; |
235 | } | 236 | } |
236 | while(n) { | 237 | while(n) { |
237 | *((volatile u8 *)addr) = c; | 238 | *((volatile u8 *)p) = c; |
238 | addr = (void *)((unsigned long)addr + 1); | 239 | p++; |
239 | n--; | 240 | n--; |
240 | } | 241 | } |
241 | __asm__ __volatile__ ("sync" : : : "memory"); | 242 | __asm__ __volatile__ ("sync" : : : "memory"); |
@@ -250,22 +251,22 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr | |||
250 | while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { | 251 | while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { |
251 | *((u8 *)dest) = *((volatile u8 *)vsrc); | 252 | *((u8 *)dest) = *((volatile u8 *)vsrc); |
252 | __asm__ __volatile__ ("eieio" : : : "memory"); | 253 | __asm__ __volatile__ ("eieio" : : : "memory"); |
253 | vsrc = (void *)((unsigned long)vsrc + 1); | 254 | vsrc++; |
254 | dest = (void *)((unsigned long)dest + 1); | 255 | dest++; |
255 | n--; | 256 | n--; |
256 | } | 257 | } |
257 | while(n > 4) { | 258 | while(n > 4) { |
258 | *((u32 *)dest) = *((volatile u32 *)vsrc); | 259 | *((u32 *)dest) = *((volatile u32 *)vsrc); |
259 | __asm__ __volatile__ ("eieio" : : : "memory"); | 260 | __asm__ __volatile__ ("eieio" : : : "memory"); |
260 | vsrc = (void *)((unsigned long)vsrc + 4); | 261 | vsrc += 4; |
261 | dest = (void *)((unsigned long)dest + 4); | 262 | dest += 4; |
262 | n -= 4; | 263 | n -= 4; |
263 | } | 264 | } |
264 | while(n) { | 265 | while(n) { |
265 | *((u8 *)dest) = *((volatile u8 *)vsrc); | 266 | *((u8 *)dest) = *((volatile u8 *)vsrc); |
266 | __asm__ __volatile__ ("eieio" : : : "memory"); | 267 | __asm__ __volatile__ ("eieio" : : : "memory"); |
267 | vsrc = (void *)((unsigned long)vsrc + 1); | 268 | vsrc++; |
268 | dest = (void *)((unsigned long)dest + 1); | 269 | dest++; |
269 | n--; | 270 | n--; |
270 | } | 271 | } |
271 | __asm__ __volatile__ ("sync" : : : "memory"); | 272 | __asm__ __volatile__ ("sync" : : : "memory"); |
@@ -286,20 +287,20 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, | |||
286 | 287 | ||
287 | while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { | 288 | while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { |
288 | *((volatile u8 *)vdest) = *((u8 *)src); | 289 | *((volatile u8 *)vdest) = *((u8 *)src); |
289 | src = (void *)((unsigned long)src + 1); | 290 | src++; |
290 | vdest = (void *)((unsigned long)vdest + 1); | 291 | vdest++; |
291 | n--; | 292 | n--; |
292 | } | 293 | } |
293 | while(n > 4) { | 294 | while(n > 4) { |
294 | *((volatile u32 *)vdest) = *((volatile u32 *)src); | 295 | *((volatile u32 *)vdest) = *((volatile u32 *)src); |
295 | src = (void *)((unsigned long)src + 4); | 296 | src += 4; |
296 | vdest = (void *)((unsigned long)vdest + 4); | 297 | vdest += 4; |
297 | n-=4; | 298 | n-=4; |
298 | } | 299 | } |
299 | while(n) { | 300 | while(n) { |
300 | *((volatile u8 *)vdest) = *((u8 *)src); | 301 | *((volatile u8 *)vdest) = *((u8 *)src); |
301 | src = (void *)((unsigned long)src + 1); | 302 | src++; |
302 | vdest = (void *)((unsigned long)vdest + 1); | 303 | vdest++; |
303 | n--; | 304 | n--; |
304 | } | 305 | } |
305 | __asm__ __volatile__ ("sync" : : : "memory"); | 306 | __asm__ __volatile__ ("sync" : : : "memory"); |
diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h index aba1dfa388ba..59c958aea4db 100644 --- a/include/asm-ppc64/io.h +++ b/include/asm-ppc64/io.h | |||
@@ -20,10 +20,10 @@ | |||
20 | 20 | ||
21 | #include <asm-generic/iomap.h> | 21 | #include <asm-generic/iomap.h> |
22 | 22 | ||
23 | #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) | 23 | #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) |
24 | #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) | 24 | #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) |
25 | #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) | 25 | #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) |
26 | #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 *)(p), (a), (c)) | 26 | #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) |
27 | 27 | ||
28 | 28 | ||
29 | #define SIO_CONFIG_RA 0x398 | 29 | #define SIO_CONFIG_RA 0x398 |
@@ -71,8 +71,8 @@ extern unsigned long io_page_mask; | |||
71 | * Neither do the standard versions now, these are just here | 71 | * Neither do the standard versions now, these are just here |
72 | * for older code. | 72 | * for older code. |
73 | */ | 73 | */ |
74 | #define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | 74 | #define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) |
75 | #define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | 75 | #define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) |
76 | #else | 76 | #else |
77 | 77 | ||
78 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) | 78 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) |
@@ -136,9 +136,9 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |||
136 | #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) | 136 | #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) |
137 | #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) | 137 | #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) |
138 | 138 | ||
139 | #define outsb(port, buf, ns) _outsb((u8 *)((port)+pci_io_base), (buf), (ns)) | 139 | #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) |
140 | #define outsw(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | 140 | #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) |
141 | #define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | 141 | #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) |
142 | 142 | ||
143 | #endif | 143 | #endif |
144 | 144 | ||
@@ -147,16 +147,16 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |||
147 | #define readl_relaxed(addr) readl(addr) | 147 | #define readl_relaxed(addr) readl(addr) |
148 | #define readq_relaxed(addr) readq(addr) | 148 | #define readq_relaxed(addr) readq(addr) |
149 | 149 | ||
150 | extern void _insb(volatile u8 *port, void *buf, int ns); | 150 | extern void _insb(volatile u8 __iomem *port, void *buf, int ns); |
151 | extern void _outsb(volatile u8 *port, const void *buf, int ns); | 151 | extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); |
152 | extern void _insw(volatile u16 *port, void *buf, int ns); | 152 | extern void _insw(volatile u16 __iomem *port, void *buf, int ns); |
153 | extern void _outsw(volatile u16 *port, const void *buf, int ns); | 153 | extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); |
154 | extern void _insl(volatile u32 *port, void *buf, int nl); | 154 | extern void _insl(volatile u32 __iomem *port, void *buf, int nl); |
155 | extern void _outsl(volatile u32 *port, const void *buf, int nl); | 155 | extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); |
156 | extern void _insw_ns(volatile u16 *port, void *buf, int ns); | 156 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); |
157 | extern void _outsw_ns(volatile u16 *port, const void *buf, int ns); | 157 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); |
158 | extern void _insl_ns(volatile u32 *port, void *buf, int nl); | 158 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); |
159 | extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); | 159 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); |
160 | 160 | ||
161 | #define mmiowb() | 161 | #define mmiowb() |
162 | 162 | ||
@@ -176,8 +176,8 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); | |||
176 | * Neither do the standard versions now, these are just here | 176 | * Neither do the standard versions now, these are just here |
177 | * for older code. | 177 | * for older code. |
178 | */ | 178 | */ |
179 | #define outsw_ns(port, buf, ns) _outsw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) | 179 | #define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) |
180 | #define outsl_ns(port, buf, nl) _outsl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) | 180 | #define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) |
181 | 181 | ||
182 | 182 | ||
183 | #define IO_SPACE_LIMIT ~(0UL) | 183 | #define IO_SPACE_LIMIT ~(0UL) |
diff --git a/include/asm-ppc64/msgbuf.h b/include/asm-ppc64/msgbuf.h deleted file mode 100644 index 31c1cbf133cc..000000000000 --- a/include/asm-ppc64/msgbuf.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #ifndef _PPC64_MSGBUF_H | ||
2 | #define _PPC64_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for the PPC architecture. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | struct msqid64_ds { | ||
14 | struct ipc64_perm msg_perm; | ||
15 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
16 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
17 | __kernel_time_t msg_ctime; /* last change time */ | ||
18 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
19 | unsigned long msg_qnum; /* number of messages in queue */ | ||
20 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
21 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
22 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
23 | unsigned long __unused1; | ||
24 | unsigned long __unused2; | ||
25 | }; | ||
26 | |||
27 | #endif /* _PPC64_MSGBUF_H */ | ||
diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h deleted file mode 100644 index 76c212d475b3..000000000000 --- a/include/asm-ppc64/param.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #ifndef _ASM_PPC64_PARAM_H | ||
2 | #define _ASM_PPC64_PARAM_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ | ||
15 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
16 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
17 | #endif | ||
18 | |||
19 | #ifndef HZ | ||
20 | #define HZ 100 | ||
21 | #endif | ||
22 | |||
23 | #define EXEC_PAGESIZE 4096 | ||
24 | |||
25 | #ifndef NOGROUP | ||
26 | #define NOGROUP (-1) | ||
27 | #endif | ||
28 | |||
29 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
30 | |||
31 | #endif /* _ASM_PPC64_PARAM_H */ | ||
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index c4f9023ea5ed..6b4a5b1f695e 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h | |||
@@ -48,19 +48,52 @@ struct pci_controller { | |||
48 | unsigned long dma_window_size; | 48 | unsigned long dma_window_size; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* | ||
52 | * PCI stuff, for nodes representing PCI devices, pointed to | ||
53 | * by device_node->data. | ||
54 | */ | ||
55 | struct pci_controller; | ||
56 | struct iommu_table; | ||
57 | |||
58 | struct pci_dn { | ||
59 | int busno; /* for pci devices */ | ||
60 | int bussubno; /* for pci devices */ | ||
61 | int devfn; /* for pci devices */ | ||
62 | int eeh_mode; /* See eeh.h for possible EEH_MODEs */ | ||
63 | int eeh_config_addr; | ||
64 | int eeh_capable; /* from firmware */ | ||
65 | int eeh_check_count; /* # times driver ignored error */ | ||
66 | int eeh_freeze_count; /* # times this device froze up. */ | ||
67 | int eeh_is_bridge; /* device is pci-to-pci bridge */ | ||
68 | |||
69 | int pci_ext_config_space; /* for pci devices */ | ||
70 | struct pci_controller *phb; /* for pci devices */ | ||
71 | struct iommu_table *iommu_table; /* for phb's or bridges */ | ||
72 | struct pci_dev *pcidev; /* back-pointer to the pci device */ | ||
73 | struct device_node *node; /* back-pointer to the device_node */ | ||
74 | u32 config_space[16]; /* saved PCI config space */ | ||
75 | }; | ||
76 | |||
77 | /* Get the pointer to a device_node's pci_dn */ | ||
78 | #define PCI_DN(dn) ((struct pci_dn *) (dn)->data) | ||
79 | |||
51 | struct device_node *fetch_dev_dn(struct pci_dev *dev); | 80 | struct device_node *fetch_dev_dn(struct pci_dev *dev); |
52 | 81 | ||
53 | /* Get a device_node from a pci_dev. This code must be fast except in the case | 82 | /* Get a device_node from a pci_dev. This code must be fast except |
54 | * where the sysdata is incorrect and needs to be fixed up (hopefully just once) | 83 | * in the case where the sysdata is incorrect and needs to be fixed |
84 | * up (this will only happen once). | ||
85 | * In this case the sysdata will have been inherited from a PCI host | ||
86 | * bridge or a PCI-PCI bridge further up the tree, so it will point | ||
87 | * to a valid struct pci_dn, just not the one we want. | ||
55 | */ | 88 | */ |
56 | static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) | 89 | static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) |
57 | { | 90 | { |
58 | struct device_node *dn = dev->sysdata; | 91 | struct device_node *dn = dev->sysdata; |
92 | struct pci_dn *pdn = dn->data; | ||
59 | 93 | ||
60 | if (dn->devfn == dev->devfn && dn->busno == dev->bus->number) | 94 | if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number) |
61 | return dn; /* fast path. sysdata is good */ | 95 | return dn; /* fast path. sysdata is good */ |
62 | else | 96 | return fetch_dev_dn(dev); |
63 | return fetch_dev_dn(dev); | ||
64 | } | 97 | } |
65 | 98 | ||
66 | static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) | 99 | static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) |
@@ -83,7 +116,7 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) | |||
83 | struct device_node *busdn = bus->sysdata; | 116 | struct device_node *busdn = bus->sysdata; |
84 | 117 | ||
85 | BUG_ON(busdn == NULL); | 118 | BUG_ON(busdn == NULL); |
86 | return busdn->phb; | 119 | return PCI_DN(busdn)->phb; |
87 | } | 120 | } |
88 | 121 | ||
89 | #endif | 122 | #endif |
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h index dc5330b39509..c02ec1d6b909 100644 --- a/include/asm-ppc64/prom.h +++ b/include/asm-ppc64/prom.h | |||
@@ -116,14 +116,6 @@ struct property { | |||
116 | struct property *next; | 116 | struct property *next; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | /* NOTE: the device_node contains PCI specific info for pci devices. | ||
120 | * This perhaps could be hung off the device_node with another struct, | ||
121 | * but for now it is directly in the node. The phb ptr is a good | ||
122 | * indication of a real PCI node. Other nodes leave these fields zeroed. | ||
123 | */ | ||
124 | struct pci_controller; | ||
125 | struct iommu_table; | ||
126 | |||
127 | struct device_node { | 119 | struct device_node { |
128 | char *name; | 120 | char *name; |
129 | char *type; | 121 | char *type; |
@@ -135,16 +127,6 @@ struct device_node { | |||
135 | struct interrupt_info *intrs; | 127 | struct interrupt_info *intrs; |
136 | char *full_name; | 128 | char *full_name; |
137 | 129 | ||
138 | /* PCI stuff probably doesn't belong here */ | ||
139 | int busno; /* for pci devices */ | ||
140 | int bussubno; /* for pci devices */ | ||
141 | int devfn; /* for pci devices */ | ||
142 | int eeh_mode; /* See eeh.h for possible EEH_MODEs */ | ||
143 | int eeh_config_addr; | ||
144 | int pci_ext_config_space; /* for pci devices */ | ||
145 | struct pci_controller *phb; /* for pci devices */ | ||
146 | struct iommu_table *iommu_table; /* for phb's or bridges */ | ||
147 | |||
148 | struct property *properties; | 130 | struct property *properties; |
149 | struct device_node *parent; | 131 | struct device_node *parent; |
150 | struct device_node *child; | 132 | struct device_node *child; |
@@ -154,6 +136,7 @@ struct device_node { | |||
154 | struct proc_dir_entry *pde; /* this node's proc directory */ | 136 | struct proc_dir_entry *pde; /* this node's proc directory */ |
155 | struct kref kref; | 137 | struct kref kref; |
156 | unsigned long _flags; | 138 | unsigned long _flags; |
139 | void *data; | ||
157 | }; | 140 | }; |
158 | 141 | ||
159 | extern struct device_node *of_chosen; | 142 | extern struct device_node *of_chosen; |
diff --git a/include/asm-ppc64/segment.h b/include/asm-ppc64/segment.h deleted file mode 100644 index d80fb68cc79e..000000000000 --- a/include/asm-ppc64/segment.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __PPC64_SEGMENT_H | ||
2 | #define __PPC64_SEGMENT_H | ||
3 | |||
4 | /* Only here because we have some old header files that expect it.. */ | ||
5 | |||
6 | #endif /* __PPC64_SEGMENT_H */ | ||
diff --git a/include/asm-ppc64/setup.h b/include/asm-ppc64/setup.h deleted file mode 100644 index b257b8348c73..000000000000 --- a/include/asm-ppc64/setup.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _PPC_SETUP_H | ||
2 | #define _PPC_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 512 | ||
5 | |||
6 | #endif /* _PPC_SETUP_H */ | ||
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h index acd11564dd75..14cb895bb607 100644 --- a/include/asm-ppc64/spinlock.h +++ b/include/asm-ppc64/spinlock.h | |||
@@ -15,36 +15,42 @@ | |||
15 | * modify it under the terms of the GNU General Public License | 15 | * modify it under the terms of the GNU General Public License |
16 | * as published by the Free Software Foundation; either version | 16 | * as published by the Free Software Foundation; either version |
17 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
18 | * | ||
19 | * (the type definitions are in asm/spinlock_types.h) | ||
18 | */ | 20 | */ |
19 | #include <linux/config.h> | 21 | #include <linux/config.h> |
20 | #include <asm/paca.h> | 22 | #include <asm/paca.h> |
21 | #include <asm/hvcall.h> | 23 | #include <asm/hvcall.h> |
22 | #include <asm/iSeries/HvCall.h> | 24 | #include <asm/iSeries/HvCall.h> |
23 | 25 | ||
24 | typedef struct { | 26 | #define __raw_spin_is_locked(x) ((x)->slock != 0) |
25 | volatile unsigned int lock; | ||
26 | #ifdef CONFIG_PREEMPT | ||
27 | unsigned int break_lock; | ||
28 | #endif | ||
29 | } spinlock_t; | ||
30 | 27 | ||
31 | typedef struct { | 28 | /* |
32 | volatile signed int lock; | 29 | * This returns the old value in the lock, so we succeeded |
33 | #ifdef CONFIG_PREEMPT | 30 | * in getting the lock if the return value is 0. |
34 | unsigned int break_lock; | 31 | */ |
35 | #endif | 32 | static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock) |
36 | } rwlock_t; | 33 | { |
34 | unsigned long tmp, tmp2; | ||
37 | 35 | ||
38 | #ifdef __KERNEL__ | 36 | __asm__ __volatile__( |
39 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | 37 | " lwz %1,%3(13) # __spin_trylock\n\ |
38 | 1: lwarx %0,0,%2\n\ | ||
39 | cmpwi 0,%0,0\n\ | ||
40 | bne- 2f\n\ | ||
41 | stwcx. %1,0,%2\n\ | ||
42 | bne- 1b\n\ | ||
43 | isync\n\ | ||
44 | 2:" : "=&r" (tmp), "=&r" (tmp2) | ||
45 | : "r" (&lock->slock), "i" (offsetof(struct paca_struct, lock_token)) | ||
46 | : "cr0", "memory"); | ||
40 | 47 | ||
41 | #define spin_is_locked(x) ((x)->lock != 0) | 48 | return tmp; |
42 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | 49 | } |
43 | 50 | ||
44 | static __inline__ void _raw_spin_unlock(spinlock_t *lock) | 51 | static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock) |
45 | { | 52 | { |
46 | __asm__ __volatile__("lwsync # spin_unlock": : :"memory"); | 53 | return __spin_trylock(lock) == 0; |
47 | lock->lock = 0; | ||
48 | } | 54 | } |
49 | 55 | ||
50 | /* | 56 | /* |
@@ -64,44 +70,15 @@ static __inline__ void _raw_spin_unlock(spinlock_t *lock) | |||
64 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) | 70 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) |
65 | /* We only yield to the hypervisor if we are in shared processor mode */ | 71 | /* We only yield to the hypervisor if we are in shared processor mode */ |
66 | #define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) | 72 | #define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) |
67 | extern void __spin_yield(spinlock_t *lock); | 73 | extern void __spin_yield(raw_spinlock_t *lock); |
68 | extern void __rw_yield(rwlock_t *lock); | 74 | extern void __rw_yield(raw_rwlock_t *lock); |
69 | #else /* SPLPAR || ISERIES */ | 75 | #else /* SPLPAR || ISERIES */ |
70 | #define __spin_yield(x) barrier() | 76 | #define __spin_yield(x) barrier() |
71 | #define __rw_yield(x) barrier() | 77 | #define __rw_yield(x) barrier() |
72 | #define SHARED_PROCESSOR 0 | 78 | #define SHARED_PROCESSOR 0 |
73 | #endif | 79 | #endif |
74 | extern void spin_unlock_wait(spinlock_t *lock); | ||
75 | |||
76 | /* | ||
77 | * This returns the old value in the lock, so we succeeded | ||
78 | * in getting the lock if the return value is 0. | ||
79 | */ | ||
80 | static __inline__ unsigned long __spin_trylock(spinlock_t *lock) | ||
81 | { | ||
82 | unsigned long tmp, tmp2; | ||
83 | |||
84 | __asm__ __volatile__( | ||
85 | " lwz %1,%3(13) # __spin_trylock\n\ | ||
86 | 1: lwarx %0,0,%2\n\ | ||
87 | cmpwi 0,%0,0\n\ | ||
88 | bne- 2f\n\ | ||
89 | stwcx. %1,0,%2\n\ | ||
90 | bne- 1b\n\ | ||
91 | isync\n\ | ||
92 | 2:" : "=&r" (tmp), "=&r" (tmp2) | ||
93 | : "r" (&lock->lock), "i" (offsetof(struct paca_struct, lock_token)) | ||
94 | : "cr0", "memory"); | ||
95 | |||
96 | return tmp; | ||
97 | } | ||
98 | |||
99 | static int __inline__ _raw_spin_trylock(spinlock_t *lock) | ||
100 | { | ||
101 | return __spin_trylock(lock) == 0; | ||
102 | } | ||
103 | 80 | ||
104 | static void __inline__ _raw_spin_lock(spinlock_t *lock) | 81 | static void __inline__ __raw_spin_lock(raw_spinlock_t *lock) |
105 | { | 82 | { |
106 | while (1) { | 83 | while (1) { |
107 | if (likely(__spin_trylock(lock) == 0)) | 84 | if (likely(__spin_trylock(lock) == 0)) |
@@ -110,12 +87,12 @@ static void __inline__ _raw_spin_lock(spinlock_t *lock) | |||
110 | HMT_low(); | 87 | HMT_low(); |
111 | if (SHARED_PROCESSOR) | 88 | if (SHARED_PROCESSOR) |
112 | __spin_yield(lock); | 89 | __spin_yield(lock); |
113 | } while (unlikely(lock->lock != 0)); | 90 | } while (unlikely(lock->slock != 0)); |
114 | HMT_medium(); | 91 | HMT_medium(); |
115 | } | 92 | } |
116 | } | 93 | } |
117 | 94 | ||
118 | static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) | 95 | static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) |
119 | { | 96 | { |
120 | unsigned long flags_dis; | 97 | unsigned long flags_dis; |
121 | 98 | ||
@@ -128,12 +105,20 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag | |||
128 | HMT_low(); | 105 | HMT_low(); |
129 | if (SHARED_PROCESSOR) | 106 | if (SHARED_PROCESSOR) |
130 | __spin_yield(lock); | 107 | __spin_yield(lock); |
131 | } while (unlikely(lock->lock != 0)); | 108 | } while (unlikely(lock->slock != 0)); |
132 | HMT_medium(); | 109 | HMT_medium(); |
133 | local_irq_restore(flags_dis); | 110 | local_irq_restore(flags_dis); |
134 | } | 111 | } |
135 | } | 112 | } |
136 | 113 | ||
114 | static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) | ||
115 | { | ||
116 | __asm__ __volatile__("lwsync # __raw_spin_unlock": : :"memory"); | ||
117 | lock->slock = 0; | ||
118 | } | ||
119 | |||
120 | extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); | ||
121 | |||
137 | /* | 122 | /* |
138 | * Read-write spinlocks, allowing multiple readers | 123 | * Read-write spinlocks, allowing multiple readers |
139 | * but only one writer. | 124 | * but only one writer. |
@@ -144,24 +129,15 @@ static void __inline__ _raw_spin_lock_flags(spinlock_t *lock, unsigned long flag | |||
144 | * irq-safe write-lock, but readers can get non-irqsafe | 129 | * irq-safe write-lock, but readers can get non-irqsafe |
145 | * read-locks. | 130 | * read-locks. |
146 | */ | 131 | */ |
147 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
148 | 132 | ||
149 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | 133 | #define __raw_read_can_lock(rw) ((rw)->lock >= 0) |
150 | 134 | #define __raw_write_can_lock(rw) (!(rw)->lock) | |
151 | #define read_can_lock(rw) ((rw)->lock >= 0) | ||
152 | #define write_can_lock(rw) (!(rw)->lock) | ||
153 | |||
154 | static __inline__ void _raw_write_unlock(rwlock_t *rw) | ||
155 | { | ||
156 | __asm__ __volatile__("lwsync # write_unlock": : :"memory"); | ||
157 | rw->lock = 0; | ||
158 | } | ||
159 | 135 | ||
160 | /* | 136 | /* |
161 | * This returns the old value in the lock + 1, | 137 | * This returns the old value in the lock + 1, |
162 | * so we got a read lock if the return value is > 0. | 138 | * so we got a read lock if the return value is > 0. |
163 | */ | 139 | */ |
164 | static long __inline__ __read_trylock(rwlock_t *rw) | 140 | static long __inline__ __read_trylock(raw_rwlock_t *rw) |
165 | { | 141 | { |
166 | long tmp; | 142 | long tmp; |
167 | 143 | ||
@@ -180,45 +156,11 @@ static long __inline__ __read_trylock(rwlock_t *rw) | |||
180 | return tmp; | 156 | return tmp; |
181 | } | 157 | } |
182 | 158 | ||
183 | static int __inline__ _raw_read_trylock(rwlock_t *rw) | ||
184 | { | ||
185 | return __read_trylock(rw) > 0; | ||
186 | } | ||
187 | |||
188 | static void __inline__ _raw_read_lock(rwlock_t *rw) | ||
189 | { | ||
190 | while (1) { | ||
191 | if (likely(__read_trylock(rw) > 0)) | ||
192 | break; | ||
193 | do { | ||
194 | HMT_low(); | ||
195 | if (SHARED_PROCESSOR) | ||
196 | __rw_yield(rw); | ||
197 | } while (unlikely(rw->lock < 0)); | ||
198 | HMT_medium(); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | static void __inline__ _raw_read_unlock(rwlock_t *rw) | ||
203 | { | ||
204 | long tmp; | ||
205 | |||
206 | __asm__ __volatile__( | ||
207 | "eieio # read_unlock\n\ | ||
208 | 1: lwarx %0,0,%1\n\ | ||
209 | addic %0,%0,-1\n\ | ||
210 | stwcx. %0,0,%1\n\ | ||
211 | bne- 1b" | ||
212 | : "=&r"(tmp) | ||
213 | : "r"(&rw->lock) | ||
214 | : "cr0", "memory"); | ||
215 | } | ||
216 | |||
217 | /* | 159 | /* |
218 | * This returns the old value in the lock, | 160 | * This returns the old value in the lock, |
219 | * so we got the write lock if the return value is 0. | 161 | * so we got the write lock if the return value is 0. |
220 | */ | 162 | */ |
221 | static __inline__ long __write_trylock(rwlock_t *rw) | 163 | static __inline__ long __write_trylock(raw_rwlock_t *rw) |
222 | { | 164 | { |
223 | long tmp, tmp2; | 165 | long tmp, tmp2; |
224 | 166 | ||
@@ -237,12 +179,21 @@ static __inline__ long __write_trylock(rwlock_t *rw) | |||
237 | return tmp; | 179 | return tmp; |
238 | } | 180 | } |
239 | 181 | ||
240 | static int __inline__ _raw_write_trylock(rwlock_t *rw) | 182 | static void __inline__ __raw_read_lock(raw_rwlock_t *rw) |
241 | { | 183 | { |
242 | return __write_trylock(rw) == 0; | 184 | while (1) { |
185 | if (likely(__read_trylock(rw) > 0)) | ||
186 | break; | ||
187 | do { | ||
188 | HMT_low(); | ||
189 | if (SHARED_PROCESSOR) | ||
190 | __rw_yield(rw); | ||
191 | } while (unlikely(rw->lock < 0)); | ||
192 | HMT_medium(); | ||
193 | } | ||
243 | } | 194 | } |
244 | 195 | ||
245 | static void __inline__ _raw_write_lock(rwlock_t *rw) | 196 | static void __inline__ __raw_write_lock(raw_rwlock_t *rw) |
246 | { | 197 | { |
247 | while (1) { | 198 | while (1) { |
248 | if (likely(__write_trylock(rw) == 0)) | 199 | if (likely(__write_trylock(rw) == 0)) |
@@ -256,5 +207,35 @@ static void __inline__ _raw_write_lock(rwlock_t *rw) | |||
256 | } | 207 | } |
257 | } | 208 | } |
258 | 209 | ||
259 | #endif /* __KERNEL__ */ | 210 | static int __inline__ __raw_read_trylock(raw_rwlock_t *rw) |
211 | { | ||
212 | return __read_trylock(rw) > 0; | ||
213 | } | ||
214 | |||
215 | static int __inline__ __raw_write_trylock(raw_rwlock_t *rw) | ||
216 | { | ||
217 | return __write_trylock(rw) == 0; | ||
218 | } | ||
219 | |||
220 | static void __inline__ __raw_read_unlock(raw_rwlock_t *rw) | ||
221 | { | ||
222 | long tmp; | ||
223 | |||
224 | __asm__ __volatile__( | ||
225 | "eieio # read_unlock\n\ | ||
226 | 1: lwarx %0,0,%1\n\ | ||
227 | addic %0,%0,-1\n\ | ||
228 | stwcx. %0,0,%1\n\ | ||
229 | bne- 1b" | ||
230 | : "=&r"(tmp) | ||
231 | : "r"(&rw->lock) | ||
232 | : "cr0", "memory"); | ||
233 | } | ||
234 | |||
235 | static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) | ||
236 | { | ||
237 | __asm__ __volatile__("lwsync # write_unlock": : :"memory"); | ||
238 | rw->lock = 0; | ||
239 | } | ||
240 | |||
260 | #endif /* __ASM_SPINLOCK_H */ | 241 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-ppc64/spinlock_types.h b/include/asm-ppc64/spinlock_types.h new file mode 100644 index 000000000000..a37c8eabb9f2 --- /dev/null +++ b/include/asm-ppc64/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int slock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile signed int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-ppc64/timex.h b/include/asm-ppc64/timex.h deleted file mode 100644 index 8db4da4064cd..000000000000 --- a/include/asm-ppc64/timex.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/asm-ppc/timex.h | ||
3 | * | ||
4 | * PPC64 architecture timex specifications | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef _ASMPPC64_TIMEX_H | ||
12 | #define _ASMPPC64_TIMEX_H | ||
13 | |||
14 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ | ||
15 | |||
16 | typedef unsigned long cycles_t; | ||
17 | |||
18 | static inline cycles_t get_cycles(void) | ||
19 | { | ||
20 | cycles_t ret; | ||
21 | |||
22 | __asm__ __volatile__("mftb %0" : "=r" (ret) : ); | ||
23 | return ret; | ||
24 | } | ||
25 | |||
26 | #endif | ||
diff --git a/include/asm-ppc64/user.h b/include/asm-ppc64/user.h deleted file mode 100644 index d7d6554a421f..000000000000 --- a/include/asm-ppc64/user.h +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #ifndef _PPC_USER_H | ||
2 | #define _PPC_USER_H | ||
3 | |||
4 | /* Adapted from <asm-alpha/user.h> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <asm/ptrace.h> | ||
13 | #include <asm/page.h> | ||
14 | |||
15 | /* | ||
16 | * Core file format: The core file is written in such a way that gdb | ||
17 | * can understand it and provide useful information to the user (under | ||
18 | * linux we use the `trad-core' bfd, NOT the osf-core). The file contents | ||
19 | * are as follows: | ||
20 | * | ||
21 | * upage: 1 page consisting of a user struct that tells gdb | ||
22 | * what is present in the file. Directly after this is a | ||
23 | * copy of the task_struct, which is currently not used by gdb, | ||
24 | * but it may come in handy at some point. All of the registers | ||
25 | * are stored as part of the upage. The upage should always be | ||
26 | * only one page long. | ||
27 | * data: The data segment follows next. We use current->end_text to | ||
28 | * current->brk to pick up all of the user variables, plus any memory | ||
29 | * that may have been sbrk'ed. No attempt is made to determine if a | ||
30 | * page is demand-zero or if a page is totally unused, we just cover | ||
31 | * the entire range. All of the addresses are rounded in such a way | ||
32 | * that an integral number of pages is written. | ||
33 | * stack: We need the stack information in order to get a meaningful | ||
34 | * backtrace. We need to write the data from usp to | ||
35 | * current->start_stack, so we round each of these in order to be able | ||
36 | * to write an integer number of pages. | ||
37 | */ | ||
38 | struct user { | ||
39 | struct pt_regs regs; /* entire machine state */ | ||
40 | size_t u_tsize; /* text size (pages) */ | ||
41 | size_t u_dsize; /* data size (pages) */ | ||
42 | size_t u_ssize; /* stack size (pages) */ | ||
43 | unsigned long start_code; /* text starting address */ | ||
44 | unsigned long start_data; /* data starting address */ | ||
45 | unsigned long start_stack; /* stack starting address */ | ||
46 | long int signal; /* signal causing core dump */ | ||
47 | struct regs * u_ar0; /* help gdb find registers */ | ||
48 | unsigned long magic; /* identifies a core file */ | ||
49 | char u_comm[32]; /* user command name */ | ||
50 | }; | ||
51 | |||
52 | #define NBPG PAGE_SIZE | ||
53 | #define UPAGES 1 | ||
54 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
55 | #define HOST_DATA_START_ADDR (u.start_data) | ||
56 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
57 | |||
58 | #endif /* _PPC_USER_H */ | ||
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h index 321b23bba1ec..273dbecf8ace 100644 --- a/include/asm-s390/spinlock.h +++ b/include/asm-s390/spinlock.h | |||
@@ -27,25 +27,19 @@ _raw_compare_and_swap(volatile unsigned int *lock, | |||
27 | * on the local processor, one does not. | 27 | * on the local processor, one does not. |
28 | * | 28 | * |
29 | * We make no fairness assumptions. They have a cost. | 29 | * We make no fairness assumptions. They have a cost. |
30 | * | ||
31 | * (the type definitions are in asm/spinlock_types.h) | ||
30 | */ | 32 | */ |
31 | 33 | ||
32 | typedef struct { | 34 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
33 | volatile unsigned int lock; | 35 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
34 | #ifdef CONFIG_PREEMPT | 36 | #define __raw_spin_unlock_wait(lock) \ |
35 | unsigned int break_lock; | 37 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) |
36 | #endif | ||
37 | } __attribute__ ((aligned (4))) spinlock_t; | ||
38 | |||
39 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
40 | #define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) | ||
41 | #define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock) | ||
42 | #define spin_is_locked(x) ((x)->lock != 0) | ||
43 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
44 | 38 | ||
45 | extern void _raw_spin_lock_wait(spinlock_t *lp, unsigned int pc); | 39 | extern void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc); |
46 | extern int _raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc); | 40 | extern int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc); |
47 | 41 | ||
48 | static inline void _raw_spin_lock(spinlock_t *lp) | 42 | static inline void __raw_spin_lock(raw_spinlock_t *lp) |
49 | { | 43 | { |
50 | unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); | 44 | unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); |
51 | 45 | ||
@@ -53,7 +47,7 @@ static inline void _raw_spin_lock(spinlock_t *lp) | |||
53 | _raw_spin_lock_wait(lp, pc); | 47 | _raw_spin_lock_wait(lp, pc); |
54 | } | 48 | } |
55 | 49 | ||
56 | static inline int _raw_spin_trylock(spinlock_t *lp) | 50 | static inline int __raw_spin_trylock(raw_spinlock_t *lp) |
57 | { | 51 | { |
58 | unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); | 52 | unsigned long pc = 1 | (unsigned long) __builtin_return_address(0); |
59 | 53 | ||
@@ -62,7 +56,7 @@ static inline int _raw_spin_trylock(spinlock_t *lp) | |||
62 | return _raw_spin_trylock_retry(lp, pc); | 56 | return _raw_spin_trylock_retry(lp, pc); |
63 | } | 57 | } |
64 | 58 | ||
65 | static inline void _raw_spin_unlock(spinlock_t *lp) | 59 | static inline void __raw_spin_unlock(raw_spinlock_t *lp) |
66 | { | 60 | { |
67 | _raw_compare_and_swap(&lp->lock, lp->lock, 0); | 61 | _raw_compare_and_swap(&lp->lock, lp->lock, 0); |
68 | } | 62 | } |
@@ -77,36 +71,25 @@ static inline void _raw_spin_unlock(spinlock_t *lp) | |||
77 | * irq-safe write-lock, but readers can get non-irqsafe | 71 | * irq-safe write-lock, but readers can get non-irqsafe |
78 | * read-locks. | 72 | * read-locks. |
79 | */ | 73 | */ |
80 | typedef struct { | ||
81 | volatile unsigned int lock; | ||
82 | volatile unsigned long owner_pc; | ||
83 | #ifdef CONFIG_PREEMPT | ||
84 | unsigned int break_lock; | ||
85 | #endif | ||
86 | } rwlock_t; | ||
87 | |||
88 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } | ||
89 | |||
90 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
91 | 74 | ||
92 | /** | 75 | /** |
93 | * read_can_lock - would read_trylock() succeed? | 76 | * read_can_lock - would read_trylock() succeed? |
94 | * @lock: the rwlock in question. | 77 | * @lock: the rwlock in question. |
95 | */ | 78 | */ |
96 | #define read_can_lock(x) ((int)(x)->lock >= 0) | 79 | #define __raw_read_can_lock(x) ((int)(x)->lock >= 0) |
97 | 80 | ||
98 | /** | 81 | /** |
99 | * write_can_lock - would write_trylock() succeed? | 82 | * write_can_lock - would write_trylock() succeed? |
100 | * @lock: the rwlock in question. | 83 | * @lock: the rwlock in question. |
101 | */ | 84 | */ |
102 | #define write_can_lock(x) ((x)->lock == 0) | 85 | #define __raw_write_can_lock(x) ((x)->lock == 0) |
103 | 86 | ||
104 | extern void _raw_read_lock_wait(rwlock_t *lp); | 87 | extern void _raw_read_lock_wait(raw_rwlock_t *lp); |
105 | extern int _raw_read_trylock_retry(rwlock_t *lp); | 88 | extern int _raw_read_trylock_retry(raw_rwlock_t *lp); |
106 | extern void _raw_write_lock_wait(rwlock_t *lp); | 89 | extern void _raw_write_lock_wait(raw_rwlock_t *lp); |
107 | extern int _raw_write_trylock_retry(rwlock_t *lp); | 90 | extern int _raw_write_trylock_retry(raw_rwlock_t *lp); |
108 | 91 | ||
109 | static inline void _raw_read_lock(rwlock_t *rw) | 92 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
110 | { | 93 | { |
111 | unsigned int old; | 94 | unsigned int old; |
112 | old = rw->lock & 0x7fffffffU; | 95 | old = rw->lock & 0x7fffffffU; |
@@ -114,7 +97,7 @@ static inline void _raw_read_lock(rwlock_t *rw) | |||
114 | _raw_read_lock_wait(rw); | 97 | _raw_read_lock_wait(rw); |
115 | } | 98 | } |
116 | 99 | ||
117 | static inline void _raw_read_unlock(rwlock_t *rw) | 100 | static inline void __raw_read_unlock(raw_rwlock_t *rw) |
118 | { | 101 | { |
119 | unsigned int old, cmp; | 102 | unsigned int old, cmp; |
120 | 103 | ||
@@ -125,18 +108,18 @@ static inline void _raw_read_unlock(rwlock_t *rw) | |||
125 | } while (cmp != old); | 108 | } while (cmp != old); |
126 | } | 109 | } |
127 | 110 | ||
128 | static inline void _raw_write_lock(rwlock_t *rw) | 111 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
129 | { | 112 | { |
130 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) | 113 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) |
131 | _raw_write_lock_wait(rw); | 114 | _raw_write_lock_wait(rw); |
132 | } | 115 | } |
133 | 116 | ||
134 | static inline void _raw_write_unlock(rwlock_t *rw) | 117 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
135 | { | 118 | { |
136 | _raw_compare_and_swap(&rw->lock, 0x80000000, 0); | 119 | _raw_compare_and_swap(&rw->lock, 0x80000000, 0); |
137 | } | 120 | } |
138 | 121 | ||
139 | static inline int _raw_read_trylock(rwlock_t *rw) | 122 | static inline int __raw_read_trylock(raw_rwlock_t *rw) |
140 | { | 123 | { |
141 | unsigned int old; | 124 | unsigned int old; |
142 | old = rw->lock & 0x7fffffffU; | 125 | old = rw->lock & 0x7fffffffU; |
@@ -145,7 +128,7 @@ static inline int _raw_read_trylock(rwlock_t *rw) | |||
145 | return _raw_read_trylock_retry(rw); | 128 | return _raw_read_trylock_retry(rw); |
146 | } | 129 | } |
147 | 130 | ||
148 | static inline int _raw_write_trylock(rwlock_t *rw) | 131 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
149 | { | 132 | { |
150 | if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) | 133 | if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) |
151 | return 1; | 134 | return 1; |
diff --git a/include/asm-s390/spinlock_types.h b/include/asm-s390/spinlock_types.h new file mode 100644 index 000000000000..f79a2216204f --- /dev/null +++ b/include/asm-s390/spinlock_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int lock; | ||
10 | } __attribute__ ((aligned (4))) raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | volatile unsigned int owner_pc; | ||
17 | } raw_rwlock_t; | ||
18 | |||
19 | #define __RAW_RW_LOCK_UNLOCKED { 0, 0 } | ||
20 | |||
21 | #endif | ||
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index 831e52ee45b5..614a8c13b721 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h | |||
@@ -587,10 +587,6 @@ static inline int generic_irq_demux(int irq) | |||
587 | #define irq_canonicalize(irq) (irq) | 587 | #define irq_canonicalize(irq) (irq) |
588 | #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) | 588 | #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) |
589 | 589 | ||
590 | struct irqaction; | ||
591 | struct pt_regs; | ||
592 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
593 | |||
594 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) | 590 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) |
595 | #include <asm/irq-sh73180.h> | 591 | #include <asm/irq-sh73180.h> |
596 | #endif | 592 | #endif |
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h index e770b55649eb..846322d4c35d 100644 --- a/include/asm-sh/spinlock.h +++ b/include/asm-sh/spinlock.h | |||
@@ -15,20 +15,11 @@ | |||
15 | /* | 15 | /* |
16 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 16 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
17 | */ | 17 | */ |
18 | typedef struct { | ||
19 | volatile unsigned long lock; | ||
20 | #ifdef CONFIG_PREEMPT | ||
21 | unsigned int break_lock; | ||
22 | #endif | ||
23 | } spinlock_t; | ||
24 | 18 | ||
25 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | 19 | #define __raw_spin_is_locked(x) ((x)->lock != 0) |
26 | 20 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) | |
27 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | 21 | #define __raw_spin_unlock_wait(x) \ |
28 | 22 | do { cpu_relax(); } while (__raw_spin_is_locked(x)) | |
29 | #define spin_is_locked(x) ((x)->lock != 0) | ||
30 | #define spin_unlock_wait(x) do { barrier(); } while (spin_is_locked(x)) | ||
31 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
32 | 23 | ||
33 | /* | 24 | /* |
34 | * Simple spin lock operations. There are two variants, one clears IRQ's | 25 | * Simple spin lock operations. There are two variants, one clears IRQ's |
@@ -36,7 +27,7 @@ typedef struct { | |||
36 | * | 27 | * |
37 | * We make no fairness assumptions. They have a cost. | 28 | * We make no fairness assumptions. They have a cost. |
38 | */ | 29 | */ |
39 | static inline void _raw_spin_lock(spinlock_t *lock) | 30 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
40 | { | 31 | { |
41 | __asm__ __volatile__ ( | 32 | __asm__ __volatile__ ( |
42 | "1:\n\t" | 33 | "1:\n\t" |
@@ -49,14 +40,14 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
49 | ); | 40 | ); |
50 | } | 41 | } |
51 | 42 | ||
52 | static inline void _raw_spin_unlock(spinlock_t *lock) | 43 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
53 | { | 44 | { |
54 | assert_spin_locked(lock); | 45 | assert_spin_locked(lock); |
55 | 46 | ||
56 | lock->lock = 0; | 47 | lock->lock = 0; |
57 | } | 48 | } |
58 | 49 | ||
59 | #define _raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) | 50 | #define __raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) |
60 | 51 | ||
61 | /* | 52 | /* |
62 | * Read-write spinlocks, allowing multiple readers but only one writer. | 53 | * Read-write spinlocks, allowing multiple readers but only one writer. |
@@ -66,51 +57,40 @@ static inline void _raw_spin_unlock(spinlock_t *lock) | |||
66 | * needs to get a irq-safe write-lock, but readers can get non-irqsafe | 57 | * needs to get a irq-safe write-lock, but readers can get non-irqsafe |
67 | * read-locks. | 58 | * read-locks. |
68 | */ | 59 | */ |
69 | typedef struct { | 60 | |
70 | spinlock_t lock; | 61 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
71 | atomic_t counter; | ||
72 | #ifdef CONFIG_PREEMPT | ||
73 | unsigned int break_lock; | ||
74 | #endif | ||
75 | } rwlock_t; | ||
76 | |||
77 | #define RW_LOCK_BIAS 0x01000000 | ||
78 | #define RW_LOCK_UNLOCKED (rwlock_t) { { 0 }, { RW_LOCK_BIAS } } | ||
79 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while (0) | ||
80 | |||
81 | static inline void _raw_read_lock(rwlock_t *rw) | ||
82 | { | 62 | { |
83 | _raw_spin_lock(&rw->lock); | 63 | __raw_spin_lock(&rw->lock); |
84 | 64 | ||
85 | atomic_inc(&rw->counter); | 65 | atomic_inc(&rw->counter); |
86 | 66 | ||
87 | _raw_spin_unlock(&rw->lock); | 67 | __raw_spin_unlock(&rw->lock); |
88 | } | 68 | } |
89 | 69 | ||
90 | static inline void _raw_read_unlock(rwlock_t *rw) | 70 | static inline void __raw_read_unlock(raw_rwlock_t *rw) |
91 | { | 71 | { |
92 | _raw_spin_lock(&rw->lock); | 72 | __raw_spin_lock(&rw->lock); |
93 | 73 | ||
94 | atomic_dec(&rw->counter); | 74 | atomic_dec(&rw->counter); |
95 | 75 | ||
96 | _raw_spin_unlock(&rw->lock); | 76 | __raw_spin_unlock(&rw->lock); |
97 | } | 77 | } |
98 | 78 | ||
99 | static inline void _raw_write_lock(rwlock_t *rw) | 79 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
100 | { | 80 | { |
101 | _raw_spin_lock(&rw->lock); | 81 | __raw_spin_lock(&rw->lock); |
102 | atomic_set(&rw->counter, -1); | 82 | atomic_set(&rw->counter, -1); |
103 | } | 83 | } |
104 | 84 | ||
105 | static inline void _raw_write_unlock(rwlock_t *rw) | 85 | static inline void __raw_write_unlock(raw_rwlock_t *rw) |
106 | { | 86 | { |
107 | atomic_set(&rw->counter, 0); | 87 | atomic_set(&rw->counter, 0); |
108 | _raw_spin_unlock(&rw->lock); | 88 | __raw_spin_unlock(&rw->lock); |
109 | } | 89 | } |
110 | 90 | ||
111 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | 91 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
112 | 92 | ||
113 | static inline int _raw_write_trylock(rwlock_t *rw) | 93 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
114 | { | 94 | { |
115 | if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter)) | 95 | if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter)) |
116 | return 1; | 96 | return 1; |
@@ -121,4 +101,3 @@ static inline int _raw_write_trylock(rwlock_t *rw) | |||
121 | } | 101 | } |
122 | 102 | ||
123 | #endif /* __ASM_SH_SPINLOCK_H */ | 103 | #endif /* __ASM_SH_SPINLOCK_H */ |
124 | |||
diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h new file mode 100644 index 000000000000..8c41b6c3aac8 --- /dev/null +++ b/include/asm-sh/spinlock_types.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __ASM_SH_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SH_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned long lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | raw_spinlock_t lock; | ||
16 | atomic_t counter; | ||
17 | } raw_rwlock_t; | ||
18 | |||
19 | #define RW_LOCK_BIAS 0x01000000 | ||
20 | #define __RAW_RW_LOCK_UNLOCKED { { 0 }, { RW_LOCK_BIAS } } | ||
21 | |||
22 | #endif | ||
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h index dd9d94d7e0ae..a8ecb2d6977a 100644 --- a/include/asm-sparc/ptrace.h +++ b/include/asm-sparc/ptrace.h | |||
@@ -73,11 +73,11 @@ extern void show_regs(struct pt_regs *); | |||
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * The asm_offsets.h is a generated file, so we cannot include it. | 76 | * The asm-offsets.h is a generated file, so we cannot include it. |
77 | * It may be OK for glibc headers, but it's utterly pointless for C code. | 77 | * It may be OK for glibc headers, but it's utterly pointless for C code. |
78 | * The assembly code using those offsets has to include it explicitly. | 78 | * The assembly code using those offsets has to include it explicitly. |
79 | */ | 79 | */ |
80 | /* #include <asm/asm_offsets.h> */ | 80 | /* #include <asm/asm-offsets.h> */ |
81 | 81 | ||
82 | /* These are for pt_regs. */ | 82 | /* These are for pt_regs. */ |
83 | #define PT_PSR 0x0 | 83 | #define PT_PSR 0x0 |
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index 0cbd87ad4912..111727a2bb4e 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h | |||
@@ -12,96 +12,12 @@ | |||
12 | 12 | ||
13 | #include <asm/psr.h> | 13 | #include <asm/psr.h> |
14 | 14 | ||
15 | #ifdef CONFIG_DEBUG_SPINLOCK | 15 | #define __raw_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) |
16 | struct _spinlock_debug { | ||
17 | unsigned char lock; | ||
18 | unsigned long owner_pc; | ||
19 | #ifdef CONFIG_PREEMPT | ||
20 | unsigned int break_lock; | ||
21 | #endif | ||
22 | }; | ||
23 | typedef struct _spinlock_debug spinlock_t; | ||
24 | |||
25 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 } | ||
26 | #define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) | ||
27 | #define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0) | ||
28 | #define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock)) | ||
29 | |||
30 | extern void _do_spin_lock(spinlock_t *lock, char *str); | ||
31 | extern int _spin_trylock(spinlock_t *lock); | ||
32 | extern void _do_spin_unlock(spinlock_t *lock); | ||
33 | |||
34 | #define _raw_spin_trylock(lp) _spin_trylock(lp) | ||
35 | #define _raw_spin_lock(lock) _do_spin_lock(lock, "spin_lock") | ||
36 | #define _raw_spin_unlock(lock) _do_spin_unlock(lock) | ||
37 | |||
38 | struct _rwlock_debug { | ||
39 | volatile unsigned int lock; | ||
40 | unsigned long owner_pc; | ||
41 | unsigned long reader_pc[NR_CPUS]; | ||
42 | #ifdef CONFIG_PREEMPT | ||
43 | unsigned int break_lock; | ||
44 | #endif | ||
45 | }; | ||
46 | typedef struct _rwlock_debug rwlock_t; | ||
47 | |||
48 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, {0} } | ||
49 | |||
50 | #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) | ||
51 | |||
52 | extern void _do_read_lock(rwlock_t *rw, char *str); | ||
53 | extern void _do_read_unlock(rwlock_t *rw, char *str); | ||
54 | extern void _do_write_lock(rwlock_t *rw, char *str); | ||
55 | extern void _do_write_unlock(rwlock_t *rw); | ||
56 | |||
57 | #define _raw_read_lock(lock) \ | ||
58 | do { unsigned long flags; \ | ||
59 | local_irq_save(flags); \ | ||
60 | _do_read_lock(lock, "read_lock"); \ | ||
61 | local_irq_restore(flags); \ | ||
62 | } while(0) | ||
63 | |||
64 | #define _raw_read_unlock(lock) \ | ||
65 | do { unsigned long flags; \ | ||
66 | local_irq_save(flags); \ | ||
67 | _do_read_unlock(lock, "read_unlock"); \ | ||
68 | local_irq_restore(flags); \ | ||
69 | } while(0) | ||
70 | |||
71 | #define _raw_write_lock(lock) \ | ||
72 | do { unsigned long flags; \ | ||
73 | local_irq_save(flags); \ | ||
74 | _do_write_lock(lock, "write_lock"); \ | ||
75 | local_irq_restore(flags); \ | ||
76 | } while(0) | ||
77 | |||
78 | #define _raw_write_unlock(lock) \ | ||
79 | do { unsigned long flags; \ | ||
80 | local_irq_save(flags); \ | ||
81 | _do_write_unlock(lock); \ | ||
82 | local_irq_restore(flags); \ | ||
83 | } while(0) | ||
84 | |||
85 | #else /* !CONFIG_DEBUG_SPINLOCK */ | ||
86 | |||
87 | typedef struct { | ||
88 | unsigned char lock; | ||
89 | #ifdef CONFIG_PREEMPT | ||
90 | unsigned int break_lock; | ||
91 | #endif | ||
92 | } spinlock_t; | ||
93 | |||
94 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
95 | |||
96 | #define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0) | ||
97 | #define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) | ||
98 | 16 | ||
99 | #define spin_unlock_wait(lock) \ | 17 | #define __raw_spin_unlock_wait(lock) \ |
100 | do { \ | 18 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) |
101 | barrier(); \ | ||
102 | } while(*((volatile unsigned char *)lock)) | ||
103 | 19 | ||
104 | extern __inline__ void _raw_spin_lock(spinlock_t *lock) | 20 | extern __inline__ void __raw_spin_lock(raw_spinlock_t *lock) |
105 | { | 21 | { |
106 | __asm__ __volatile__( | 22 | __asm__ __volatile__( |
107 | "\n1:\n\t" | 23 | "\n1:\n\t" |
@@ -121,7 +37,7 @@ extern __inline__ void _raw_spin_lock(spinlock_t *lock) | |||
121 | : "g2", "memory", "cc"); | 37 | : "g2", "memory", "cc"); |
122 | } | 38 | } |
123 | 39 | ||
124 | extern __inline__ int _raw_spin_trylock(spinlock_t *lock) | 40 | extern __inline__ int __raw_spin_trylock(raw_spinlock_t *lock) |
125 | { | 41 | { |
126 | unsigned int result; | 42 | unsigned int result; |
127 | __asm__ __volatile__("ldstub [%1], %0" | 43 | __asm__ __volatile__("ldstub [%1], %0" |
@@ -131,7 +47,7 @@ extern __inline__ int _raw_spin_trylock(spinlock_t *lock) | |||
131 | return (result == 0); | 47 | return (result == 0); |
132 | } | 48 | } |
133 | 49 | ||
134 | extern __inline__ void _raw_spin_unlock(spinlock_t *lock) | 50 | extern __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) |
135 | { | 51 | { |
136 | __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); | 52 | __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); |
137 | } | 53 | } |
@@ -147,23 +63,11 @@ extern __inline__ void _raw_spin_unlock(spinlock_t *lock) | |||
147 | * | 63 | * |
148 | * XXX This might create some problems with my dual spinlock | 64 | * XXX This might create some problems with my dual spinlock |
149 | * XXX scheme, deadlocks etc. -DaveM | 65 | * XXX scheme, deadlocks etc. -DaveM |
150 | */ | 66 | * |
151 | typedef struct { | 67 | * Sort of like atomic_t's on Sparc, but even more clever. |
152 | volatile unsigned int lock; | ||
153 | #ifdef CONFIG_PREEMPT | ||
154 | unsigned int break_lock; | ||
155 | #endif | ||
156 | } rwlock_t; | ||
157 | |||
158 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
159 | |||
160 | #define rwlock_init(lp) do { *(lp)= RW_LOCK_UNLOCKED; } while(0) | ||
161 | |||
162 | |||
163 | /* Sort of like atomic_t's on Sparc, but even more clever. | ||
164 | * | 68 | * |
165 | * ------------------------------------ | 69 | * ------------------------------------ |
166 | * | 24-bit counter | wlock | rwlock_t | 70 | * | 24-bit counter | wlock | raw_rwlock_t |
167 | * ------------------------------------ | 71 | * ------------------------------------ |
168 | * 31 8 7 0 | 72 | * 31 8 7 0 |
169 | * | 73 | * |
@@ -174,9 +78,9 @@ typedef struct { | |||
174 | * | 78 | * |
175 | * Unfortunately this scheme limits us to ~16,000,000 cpus. | 79 | * Unfortunately this scheme limits us to ~16,000,000 cpus. |
176 | */ | 80 | */ |
177 | extern __inline__ void _read_lock(rwlock_t *rw) | 81 | extern __inline__ void __read_lock(raw_rwlock_t *rw) |
178 | { | 82 | { |
179 | register rwlock_t *lp asm("g1"); | 83 | register raw_rwlock_t *lp asm("g1"); |
180 | lp = rw; | 84 | lp = rw; |
181 | __asm__ __volatile__( | 85 | __asm__ __volatile__( |
182 | "mov %%o7, %%g4\n\t" | 86 | "mov %%o7, %%g4\n\t" |
@@ -187,16 +91,16 @@ extern __inline__ void _read_lock(rwlock_t *rw) | |||
187 | : "g2", "g4", "memory", "cc"); | 91 | : "g2", "g4", "memory", "cc"); |
188 | } | 92 | } |
189 | 93 | ||
190 | #define _raw_read_lock(lock) \ | 94 | #define __raw_read_lock(lock) \ |
191 | do { unsigned long flags; \ | 95 | do { unsigned long flags; \ |
192 | local_irq_save(flags); \ | 96 | local_irq_save(flags); \ |
193 | _read_lock(lock); \ | 97 | __raw_read_lock(lock); \ |
194 | local_irq_restore(flags); \ | 98 | local_irq_restore(flags); \ |
195 | } while(0) | 99 | } while(0) |
196 | 100 | ||
197 | extern __inline__ void _read_unlock(rwlock_t *rw) | 101 | extern __inline__ void __read_unlock(raw_rwlock_t *rw) |
198 | { | 102 | { |
199 | register rwlock_t *lp asm("g1"); | 103 | register raw_rwlock_t *lp asm("g1"); |
200 | lp = rw; | 104 | lp = rw; |
201 | __asm__ __volatile__( | 105 | __asm__ __volatile__( |
202 | "mov %%o7, %%g4\n\t" | 106 | "mov %%o7, %%g4\n\t" |
@@ -207,16 +111,16 @@ extern __inline__ void _read_unlock(rwlock_t *rw) | |||
207 | : "g2", "g4", "memory", "cc"); | 111 | : "g2", "g4", "memory", "cc"); |
208 | } | 112 | } |
209 | 113 | ||
210 | #define _raw_read_unlock(lock) \ | 114 | #define __raw_read_unlock(lock) \ |
211 | do { unsigned long flags; \ | 115 | do { unsigned long flags; \ |
212 | local_irq_save(flags); \ | 116 | local_irq_save(flags); \ |
213 | _read_unlock(lock); \ | 117 | __raw_read_unlock(lock); \ |
214 | local_irq_restore(flags); \ | 118 | local_irq_restore(flags); \ |
215 | } while(0) | 119 | } while(0) |
216 | 120 | ||
217 | extern __inline__ void _raw_write_lock(rwlock_t *rw) | 121 | extern __inline__ void __raw_write_lock(raw_rwlock_t *rw) |
218 | { | 122 | { |
219 | register rwlock_t *lp asm("g1"); | 123 | register raw_rwlock_t *lp asm("g1"); |
220 | lp = rw; | 124 | lp = rw; |
221 | __asm__ __volatile__( | 125 | __asm__ __volatile__( |
222 | "mov %%o7, %%g4\n\t" | 126 | "mov %%o7, %%g4\n\t" |
@@ -227,11 +131,9 @@ extern __inline__ void _raw_write_lock(rwlock_t *rw) | |||
227 | : "g2", "g4", "memory", "cc"); | 131 | : "g2", "g4", "memory", "cc"); |
228 | } | 132 | } |
229 | 133 | ||
230 | #define _raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) | 134 | #define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) |
231 | |||
232 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
233 | 135 | ||
234 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 136 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
235 | 137 | ||
236 | #endif /* !(__ASSEMBLY__) */ | 138 | #endif /* !(__ASSEMBLY__) */ |
237 | 139 | ||
diff --git a/include/asm-sparc/spinlock_types.h b/include/asm-sparc/spinlock_types.h new file mode 100644 index 000000000000..0a0fb116c4ec --- /dev/null +++ b/include/asm-sparc/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __SPARC_SPINLOCK_TYPES_H | ||
2 | #define __SPARC_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | unsigned char lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index a02c4370eb42..ec85d12d73b9 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h | |||
@@ -29,24 +29,13 @@ | |||
29 | * must be pre-V9 branches. | 29 | * must be pre-V9 branches. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef CONFIG_DEBUG_SPINLOCK | 32 | #define __raw_spin_is_locked(lp) ((lp)->lock != 0) |
33 | 33 | ||
34 | typedef struct { | 34 | #define __raw_spin_unlock_wait(lp) \ |
35 | volatile unsigned char lock; | 35 | do { rmb(); \ |
36 | #ifdef CONFIG_PREEMPT | 36 | } while((lp)->lock) |
37 | unsigned int break_lock; | ||
38 | #endif | ||
39 | } spinlock_t; | ||
40 | #define SPIN_LOCK_UNLOCKED (spinlock_t) {0,} | ||
41 | 37 | ||
42 | #define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) | 38 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
43 | #define spin_is_locked(lp) ((lp)->lock != 0) | ||
44 | |||
45 | #define spin_unlock_wait(lp) \ | ||
46 | do { rmb(); \ | ||
47 | } while((lp)->lock) | ||
48 | |||
49 | static inline void _raw_spin_lock(spinlock_t *lock) | ||
50 | { | 39 | { |
51 | unsigned long tmp; | 40 | unsigned long tmp; |
52 | 41 | ||
@@ -67,7 +56,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
67 | : "memory"); | 56 | : "memory"); |
68 | } | 57 | } |
69 | 58 | ||
70 | static inline int _raw_spin_trylock(spinlock_t *lock) | 59 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
71 | { | 60 | { |
72 | unsigned long result; | 61 | unsigned long result; |
73 | 62 | ||
@@ -81,7 +70,7 @@ static inline int _raw_spin_trylock(spinlock_t *lock) | |||
81 | return (result == 0UL); | 70 | return (result == 0UL); |
82 | } | 71 | } |
83 | 72 | ||
84 | static inline void _raw_spin_unlock(spinlock_t *lock) | 73 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
85 | { | 74 | { |
86 | __asm__ __volatile__( | 75 | __asm__ __volatile__( |
87 | " membar #StoreStore | #LoadStore\n" | 76 | " membar #StoreStore | #LoadStore\n" |
@@ -91,7 +80,7 @@ static inline void _raw_spin_unlock(spinlock_t *lock) | |||
91 | : "memory"); | 80 | : "memory"); |
92 | } | 81 | } |
93 | 82 | ||
94 | static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) | 83 | static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) |
95 | { | 84 | { |
96 | unsigned long tmp1, tmp2; | 85 | unsigned long tmp1, tmp2; |
97 | 86 | ||
@@ -115,51 +104,9 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) | |||
115 | : "memory"); | 104 | : "memory"); |
116 | } | 105 | } |
117 | 106 | ||
118 | #else /* !(CONFIG_DEBUG_SPINLOCK) */ | ||
119 | |||
120 | typedef struct { | ||
121 | volatile unsigned char lock; | ||
122 | unsigned int owner_pc, owner_cpu; | ||
123 | #ifdef CONFIG_PREEMPT | ||
124 | unsigned int break_lock; | ||
125 | #endif | ||
126 | } spinlock_t; | ||
127 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff } | ||
128 | #define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) | ||
129 | #define spin_is_locked(__lock) ((__lock)->lock != 0) | ||
130 | #define spin_unlock_wait(__lock) \ | ||
131 | do { \ | ||
132 | rmb(); \ | ||
133 | } while((__lock)->lock) | ||
134 | |||
135 | extern void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller); | ||
136 | extern void _do_spin_unlock(spinlock_t *lock); | ||
137 | extern int _do_spin_trylock(spinlock_t *lock, unsigned long caller); | ||
138 | |||
139 | #define _raw_spin_trylock(lp) \ | ||
140 | _do_spin_trylock(lp, (unsigned long) __builtin_return_address(0)) | ||
141 | #define _raw_spin_lock(lock) \ | ||
142 | _do_spin_lock(lock, "spin_lock", \ | ||
143 | (unsigned long) __builtin_return_address(0)) | ||
144 | #define _raw_spin_unlock(lock) _do_spin_unlock(lock) | ||
145 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
146 | |||
147 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
148 | |||
149 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ | 107 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ |
150 | 108 | ||
151 | #ifndef CONFIG_DEBUG_SPINLOCK | 109 | static void inline __read_lock(raw_rwlock_t *lock) |
152 | |||
153 | typedef struct { | ||
154 | volatile unsigned int lock; | ||
155 | #ifdef CONFIG_PREEMPT | ||
156 | unsigned int break_lock; | ||
157 | #endif | ||
158 | } rwlock_t; | ||
159 | #define RW_LOCK_UNLOCKED (rwlock_t) {0,} | ||
160 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) | ||
161 | |||
162 | static void inline __read_lock(rwlock_t *lock) | ||
163 | { | 110 | { |
164 | unsigned long tmp1, tmp2; | 111 | unsigned long tmp1, tmp2; |
165 | 112 | ||
@@ -184,7 +131,7 @@ static void inline __read_lock(rwlock_t *lock) | |||
184 | : "memory"); | 131 | : "memory"); |
185 | } | 132 | } |
186 | 133 | ||
187 | static void inline __read_unlock(rwlock_t *lock) | 134 | static void inline __read_unlock(raw_rwlock_t *lock) |
188 | { | 135 | { |
189 | unsigned long tmp1, tmp2; | 136 | unsigned long tmp1, tmp2; |
190 | 137 | ||
@@ -201,7 +148,7 @@ static void inline __read_unlock(rwlock_t *lock) | |||
201 | : "memory"); | 148 | : "memory"); |
202 | } | 149 | } |
203 | 150 | ||
204 | static void inline __write_lock(rwlock_t *lock) | 151 | static void inline __write_lock(raw_rwlock_t *lock) |
205 | { | 152 | { |
206 | unsigned long mask, tmp1, tmp2; | 153 | unsigned long mask, tmp1, tmp2; |
207 | 154 | ||
@@ -228,7 +175,7 @@ static void inline __write_lock(rwlock_t *lock) | |||
228 | : "memory"); | 175 | : "memory"); |
229 | } | 176 | } |
230 | 177 | ||
231 | static void inline __write_unlock(rwlock_t *lock) | 178 | static void inline __write_unlock(raw_rwlock_t *lock) |
232 | { | 179 | { |
233 | __asm__ __volatile__( | 180 | __asm__ __volatile__( |
234 | " membar #LoadStore | #StoreStore\n" | 181 | " membar #LoadStore | #StoreStore\n" |
@@ -238,7 +185,7 @@ static void inline __write_unlock(rwlock_t *lock) | |||
238 | : "memory"); | 185 | : "memory"); |
239 | } | 186 | } |
240 | 187 | ||
241 | static int inline __write_trylock(rwlock_t *lock) | 188 | static int inline __write_trylock(raw_rwlock_t *lock) |
242 | { | 189 | { |
243 | unsigned long mask, tmp1, tmp2, result; | 190 | unsigned long mask, tmp1, tmp2, result; |
244 | 191 | ||
@@ -263,78 +210,15 @@ static int inline __write_trylock(rwlock_t *lock) | |||
263 | return result; | 210 | return result; |
264 | } | 211 | } |
265 | 212 | ||
266 | #define _raw_read_lock(p) __read_lock(p) | 213 | #define __raw_read_lock(p) __read_lock(p) |
267 | #define _raw_read_unlock(p) __read_unlock(p) | 214 | #define __raw_read_unlock(p) __read_unlock(p) |
268 | #define _raw_write_lock(p) __write_lock(p) | 215 | #define __raw_write_lock(p) __write_lock(p) |
269 | #define _raw_write_unlock(p) __write_unlock(p) | 216 | #define __raw_write_unlock(p) __write_unlock(p) |
270 | #define _raw_write_trylock(p) __write_trylock(p) | 217 | #define __raw_write_trylock(p) __write_trylock(p) |
271 | 218 | ||
272 | #else /* !(CONFIG_DEBUG_SPINLOCK) */ | 219 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) |
273 | 220 | #define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) | |
274 | typedef struct { | 221 | #define __raw_write_can_lock(rw) (!(rw)->lock) |
275 | volatile unsigned long lock; | ||
276 | unsigned int writer_pc, writer_cpu; | ||
277 | unsigned int reader_pc[NR_CPUS]; | ||
278 | #ifdef CONFIG_PREEMPT | ||
279 | unsigned int break_lock; | ||
280 | #endif | ||
281 | } rwlock_t; | ||
282 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } | ||
283 | #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) | ||
284 | |||
285 | extern void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller); | ||
286 | extern void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller); | ||
287 | extern void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller); | ||
288 | extern void _do_write_unlock(rwlock_t *rw, unsigned long caller); | ||
289 | extern int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller); | ||
290 | |||
291 | #define _raw_read_lock(lock) \ | ||
292 | do { unsigned long flags; \ | ||
293 | local_irq_save(flags); \ | ||
294 | _do_read_lock(lock, "read_lock", \ | ||
295 | (unsigned long) __builtin_return_address(0)); \ | ||
296 | local_irq_restore(flags); \ | ||
297 | } while(0) | ||
298 | |||
299 | #define _raw_read_unlock(lock) \ | ||
300 | do { unsigned long flags; \ | ||
301 | local_irq_save(flags); \ | ||
302 | _do_read_unlock(lock, "read_unlock", \ | ||
303 | (unsigned long) __builtin_return_address(0)); \ | ||
304 | local_irq_restore(flags); \ | ||
305 | } while(0) | ||
306 | |||
307 | #define _raw_write_lock(lock) \ | ||
308 | do { unsigned long flags; \ | ||
309 | local_irq_save(flags); \ | ||
310 | _do_write_lock(lock, "write_lock", \ | ||
311 | (unsigned long) __builtin_return_address(0)); \ | ||
312 | local_irq_restore(flags); \ | ||
313 | } while(0) | ||
314 | |||
315 | #define _raw_write_unlock(lock) \ | ||
316 | do { unsigned long flags; \ | ||
317 | local_irq_save(flags); \ | ||
318 | _do_write_unlock(lock, \ | ||
319 | (unsigned long) __builtin_return_address(0)); \ | ||
320 | local_irq_restore(flags); \ | ||
321 | } while(0) | ||
322 | |||
323 | #define _raw_write_trylock(lock) \ | ||
324 | ({ unsigned long flags; \ | ||
325 | int val; \ | ||
326 | local_irq_save(flags); \ | ||
327 | val = _do_write_trylock(lock, "write_trylock", \ | ||
328 | (unsigned long) __builtin_return_address(0)); \ | ||
329 | local_irq_restore(flags); \ | ||
330 | val; \ | ||
331 | }) | ||
332 | |||
333 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
334 | |||
335 | #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) | ||
336 | #define read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) | ||
337 | #define write_can_lock(rw) (!(rw)->lock) | ||
338 | 222 | ||
339 | #endif /* !(__ASSEMBLY__) */ | 223 | #endif /* !(__ASSEMBLY__) */ |
340 | 224 | ||
diff --git a/include/asm-sparc64/spinlock_types.h b/include/asm-sparc64/spinlock_types.h new file mode 100644 index 000000000000..e128112a0d7c --- /dev/null +++ b/include/asm-sparc64/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __SPARC64_SPINLOCK_TYPES_H | ||
2 | #define __SPARC64_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned char lock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-x86_64/current.h b/include/asm-x86_64/current.h index 7db560ee6f70..bc8adecee66d 100644 --- a/include/asm-x86_64/current.h +++ b/include/asm-x86_64/current.h | |||
@@ -17,7 +17,7 @@ static inline struct task_struct *get_current(void) | |||
17 | #else | 17 | #else |
18 | 18 | ||
19 | #ifndef ASM_OFFSET_H | 19 | #ifndef ASM_OFFSET_H |
20 | #include <asm/offset.h> | 20 | #include <asm/asm-offsets.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg | 23 | #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg |
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 4482657777bb..fb724ba37ae6 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h | |||
@@ -48,10 +48,6 @@ static __inline__ int irq_canonicalize(int irq) | |||
48 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ | 48 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | struct irqaction; | ||
52 | struct pt_regs; | ||
53 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
54 | |||
55 | #ifdef CONFIG_HOTPLUG_CPU | 51 | #ifdef CONFIG_HOTPLUG_CPU |
56 | #include <linux/cpumask.h> | 52 | #include <linux/cpumask.h> |
57 | extern void fixup_irqs(cpumask_t map); | 53 | extern void fixup_irqs(cpumask_t map); |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 6c813eb521f3..f7574196424e 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -8,7 +8,6 @@ | |||
8 | struct cpuinfo_x86; | 8 | struct cpuinfo_x86; |
9 | struct pt_regs; | 9 | struct pt_regs; |
10 | 10 | ||
11 | extern void get_cpu_vendor(struct cpuinfo_x86*); | ||
12 | extern void start_kernel(void); | 11 | extern void start_kernel(void); |
13 | extern void pda_init(int); | 12 | extern void pda_init(int); |
14 | 13 | ||
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h index 5aeb57a3baad..69636831ad2f 100644 --- a/include/asm-x86_64/spinlock.h +++ b/include/asm-x86_64/spinlock.h | |||
@@ -6,47 +6,21 @@ | |||
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | 8 | ||
9 | extern int printk(const char * fmt, ...) | ||
10 | __attribute__ ((format (printf, 1, 2))); | ||
11 | |||
12 | /* | 9 | /* |
13 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 10 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
14 | */ | 11 | * |
15 | |||
16 | typedef struct { | ||
17 | volatile unsigned int lock; | ||
18 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
19 | unsigned magic; | ||
20 | #endif | ||
21 | #ifdef CONFIG_PREEMPT | ||
22 | unsigned int break_lock; | ||
23 | #endif | ||
24 | } spinlock_t; | ||
25 | |||
26 | #define SPINLOCK_MAGIC 0xdead4ead | ||
27 | |||
28 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
29 | #define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC | ||
30 | #else | ||
31 | #define SPINLOCK_MAGIC_INIT /* */ | ||
32 | #endif | ||
33 | |||
34 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } | ||
35 | |||
36 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) | ||
37 | |||
38 | /* | ||
39 | * Simple spin lock operations. There are two variants, one clears IRQ's | 12 | * Simple spin lock operations. There are two variants, one clears IRQ's |
40 | * on the local processor, one does not. | 13 | * on the local processor, one does not. |
41 | * | 14 | * |
42 | * We make no fairness assumptions. They have a cost. | 15 | * We make no fairness assumptions. They have a cost. |
16 | * | ||
17 | * (the type definitions are in asm/spinlock_types.h) | ||
43 | */ | 18 | */ |
44 | 19 | ||
45 | #define spin_is_locked(x) (*(volatile signed char *)(&(x)->lock) <= 0) | 20 | #define __raw_spin_is_locked(x) \ |
46 | #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) | 21 | (*(volatile signed char *)(&(x)->slock) <= 0) |
47 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | ||
48 | 22 | ||
49 | #define spin_lock_string \ | 23 | #define __raw_spin_lock_string \ |
50 | "\n1:\t" \ | 24 | "\n1:\t" \ |
51 | "lock ; decb %0\n\t" \ | 25 | "lock ; decb %0\n\t" \ |
52 | "js 2f\n" \ | 26 | "js 2f\n" \ |
@@ -58,74 +32,40 @@ typedef struct { | |||
58 | "jmp 1b\n" \ | 32 | "jmp 1b\n" \ |
59 | LOCK_SECTION_END | 33 | LOCK_SECTION_END |
60 | 34 | ||
61 | /* | 35 | #define __raw_spin_unlock_string \ |
62 | * This works. Despite all the confusion. | ||
63 | * (except on PPro SMP or if we are using OOSTORE) | ||
64 | * (PPro errata 66, 92) | ||
65 | */ | ||
66 | |||
67 | #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) | ||
68 | |||
69 | #define spin_unlock_string \ | ||
70 | "movb $1,%0" \ | 36 | "movb $1,%0" \ |
71 | :"=m" (lock->lock) : : "memory" | 37 | :"=m" (lock->slock) : : "memory" |
72 | |||
73 | |||
74 | static inline void _raw_spin_unlock(spinlock_t *lock) | ||
75 | { | ||
76 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
77 | BUG_ON(lock->magic != SPINLOCK_MAGIC); | ||
78 | assert_spin_locked(lock); | ||
79 | #endif | ||
80 | __asm__ __volatile__( | ||
81 | spin_unlock_string | ||
82 | ); | ||
83 | } | ||
84 | |||
85 | #else | ||
86 | |||
87 | #define spin_unlock_string \ | ||
88 | "xchgb %b0, %1" \ | ||
89 | :"=q" (oldval), "=m" (lock->lock) \ | ||
90 | :"0" (oldval) : "memory" | ||
91 | 38 | ||
92 | static inline void _raw_spin_unlock(spinlock_t *lock) | 39 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
93 | { | 40 | { |
94 | char oldval = 1; | ||
95 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
96 | BUG_ON(lock->magic != SPINLOCK_MAGIC); | ||
97 | assert_spin_locked(lock); | ||
98 | #endif | ||
99 | __asm__ __volatile__( | 41 | __asm__ __volatile__( |
100 | spin_unlock_string | 42 | __raw_spin_lock_string |
101 | ); | 43 | :"=m" (lock->slock) : : "memory"); |
102 | } | 44 | } |
103 | 45 | ||
104 | #endif | 46 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
105 | 47 | ||
106 | static inline int _raw_spin_trylock(spinlock_t *lock) | 48 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
107 | { | 49 | { |
108 | char oldval; | 50 | char oldval; |
51 | |||
109 | __asm__ __volatile__( | 52 | __asm__ __volatile__( |
110 | "xchgb %b0,%1" | 53 | "xchgb %b0,%1" |
111 | :"=q" (oldval), "=m" (lock->lock) | 54 | :"=q" (oldval), "=m" (lock->slock) |
112 | :"0" (0) : "memory"); | 55 | :"0" (0) : "memory"); |
56 | |||
113 | return oldval > 0; | 57 | return oldval > 0; |
114 | } | 58 | } |
115 | 59 | ||
116 | static inline void _raw_spin_lock(spinlock_t *lock) | 60 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
117 | { | 61 | { |
118 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
119 | if (lock->magic != SPINLOCK_MAGIC) { | ||
120 | printk("eip: %p\n", __builtin_return_address(0)); | ||
121 | BUG(); | ||
122 | } | ||
123 | #endif | ||
124 | __asm__ __volatile__( | 62 | __asm__ __volatile__( |
125 | spin_lock_string | 63 | __raw_spin_unlock_string |
126 | :"=m" (lock->lock) : : "memory"); | 64 | ); |
127 | } | 65 | } |
128 | 66 | ||
67 | #define __raw_spin_unlock_wait(lock) \ | ||
68 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | ||
129 | 69 | ||
130 | /* | 70 | /* |
131 | * Read-write spinlocks, allowing multiple readers | 71 | * Read-write spinlocks, allowing multiple readers |
@@ -136,33 +76,7 @@ static inline void _raw_spin_lock(spinlock_t *lock) | |||
136 | * can "mix" irq-safe locks - any writer needs to get a | 76 | * can "mix" irq-safe locks - any writer needs to get a |
137 | * irq-safe write-lock, but readers can get non-irqsafe | 77 | * irq-safe write-lock, but readers can get non-irqsafe |
138 | * read-locks. | 78 | * read-locks. |
139 | */ | 79 | * |
140 | typedef struct { | ||
141 | volatile unsigned int lock; | ||
142 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
143 | unsigned magic; | ||
144 | #endif | ||
145 | #ifdef CONFIG_PREEMPT | ||
146 | unsigned int break_lock; | ||
147 | #endif | ||
148 | } rwlock_t; | ||
149 | |||
150 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
151 | |||
152 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
153 | #define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC | ||
154 | #else | ||
155 | #define RWLOCK_MAGIC_INIT /* */ | ||
156 | #endif | ||
157 | |||
158 | #define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } | ||
159 | |||
160 | #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) | ||
161 | |||
162 | #define read_can_lock(x) ((int)(x)->lock > 0) | ||
163 | #define write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | ||
164 | |||
165 | /* | ||
166 | * On x86, we implement read-write locks as a 32-bit counter | 80 | * On x86, we implement read-write locks as a 32-bit counter |
167 | * with the high bit (sign) being the "contended" bit. | 81 | * with the high bit (sign) being the "contended" bit. |
168 | * | 82 | * |
@@ -170,29 +84,24 @@ typedef struct { | |||
170 | * | 84 | * |
171 | * Changed to use the same technique as rw semaphores. See | 85 | * Changed to use the same technique as rw semaphores. See |
172 | * semaphore.h for details. -ben | 86 | * semaphore.h for details. -ben |
87 | * | ||
88 | * the helpers are in arch/i386/kernel/semaphore.c | ||
173 | */ | 89 | */ |
174 | /* the spinlock helpers are in arch/i386/kernel/semaphore.c */ | ||
175 | 90 | ||
176 | static inline void _raw_read_lock(rwlock_t *rw) | 91 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) |
92 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | ||
93 | |||
94 | static inline void __raw_read_lock(raw_rwlock_t *rw) | ||
177 | { | 95 | { |
178 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
179 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
180 | #endif | ||
181 | __build_read_lock(rw, "__read_lock_failed"); | 96 | __build_read_lock(rw, "__read_lock_failed"); |
182 | } | 97 | } |
183 | 98 | ||
184 | static inline void _raw_write_lock(rwlock_t *rw) | 99 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
185 | { | 100 | { |
186 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
187 | BUG_ON(rw->magic != RWLOCK_MAGIC); | ||
188 | #endif | ||
189 | __build_write_lock(rw, "__write_lock_failed"); | 101 | __build_write_lock(rw, "__write_lock_failed"); |
190 | } | 102 | } |
191 | 103 | ||
192 | #define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") | 104 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
193 | #define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") | ||
194 | |||
195 | static inline int _raw_read_trylock(rwlock_t *lock) | ||
196 | { | 105 | { |
197 | atomic_t *count = (atomic_t *)lock; | 106 | atomic_t *count = (atomic_t *)lock; |
198 | atomic_dec(count); | 107 | atomic_dec(count); |
@@ -202,7 +111,7 @@ static inline int _raw_read_trylock(rwlock_t *lock) | |||
202 | return 0; | 111 | return 0; |
203 | } | 112 | } |
204 | 113 | ||
205 | static inline int _raw_write_trylock(rwlock_t *lock) | 114 | static inline int __raw_write_trylock(raw_rwlock_t *lock) |
206 | { | 115 | { |
207 | atomic_t *count = (atomic_t *)lock; | 116 | atomic_t *count = (atomic_t *)lock; |
208 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) | 117 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) |
@@ -211,4 +120,15 @@ static inline int _raw_write_trylock(rwlock_t *lock) | |||
211 | return 0; | 120 | return 0; |
212 | } | 121 | } |
213 | 122 | ||
123 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | ||
124 | { | ||
125 | asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); | ||
126 | } | ||
127 | |||
128 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | ||
129 | { | ||
130 | asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0" | ||
131 | : "=m" (rw->lock) : : "memory"); | ||
132 | } | ||
133 | |||
214 | #endif /* __ASM_SPINLOCK_H */ | 134 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/include/asm-x86_64/spinlock_types.h b/include/asm-x86_64/spinlock_types.h new file mode 100644 index 000000000000..59efe849f351 --- /dev/null +++ b/include/asm-x86_64/spinlock_types.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_SPINLOCK_TYPES_H | ||
2 | #define __ASM_SPINLOCK_TYPES_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | typedef struct { | ||
9 | volatile unsigned int slock; | ||
10 | } raw_spinlock_t; | ||
11 | |||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | ||
13 | |||
14 | typedef struct { | ||
15 | volatile unsigned int lock; | ||
16 | } raw_rwlock_t; | ||
17 | |||
18 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h index 2848a5ff8349..aa4fd7fb3ce7 100644 --- a/include/asm-xtensa/ptrace.h +++ b/include/asm-xtensa/ptrace.h | |||
@@ -127,7 +127,7 @@ extern void show_regs(struct pt_regs *); | |||
127 | #else /* __ASSEMBLY__ */ | 127 | #else /* __ASSEMBLY__ */ |
128 | 128 | ||
129 | #ifdef __KERNEL__ | 129 | #ifdef __KERNEL__ |
130 | # include <asm/offsets.h> | 130 | # include <asm/asm-offsets.h> |
131 | #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) | 131 | #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) |
132 | #endif | 132 | #endif |
133 | 133 | ||
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h index fc268ac923c0..06a22b83ba17 100644 --- a/include/asm-xtensa/uaccess.h +++ b/include/asm-xtensa/uaccess.h | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #define _ASMLANGUAGE | 26 | #define _ASMLANGUAGE |
27 | #include <asm/current.h> | 27 | #include <asm/current.h> |
28 | #include <asm/offsets.h> | 28 | #include <asm/asm-offsets.h> |
29 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
30 | 30 | ||
31 | /* | 31 | /* |
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index f7f0913cd110..c1237aa92e38 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h | |||
@@ -14,8 +14,9 @@ | |||
14 | #define BFS_INODES_PER_BLOCK 8 | 14 | #define BFS_INODES_PER_BLOCK 8 |
15 | 15 | ||
16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ | 16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ |
17 | #define BFS_VDIR 2 | 17 | #define BFS_VDIR 2L |
18 | #define BFS_VREG 1 | 18 | #define BFS_VREG 1L |
19 | |||
19 | 20 | ||
20 | /* BFS inode layout on disk */ | 21 | /* BFS inode layout on disk */ |
21 | struct bfs_inode { | 22 | struct bfs_inode { |
@@ -58,22 +59,22 @@ struct bfs_super_block { | |||
58 | __u32 s_padding[118]; | 59 | __u32 s_padding[118]; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | #define BFS_NZFILESIZE(ip) \ | ||
62 | (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE) | ||
63 | |||
64 | #define BFS_FILESIZE(ip) \ | ||
65 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
66 | |||
67 | #define BFS_FILEBLOCKS(ip) \ | ||
68 | ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock) | ||
69 | 62 | ||
70 | #define BFS_OFF2INO(offset) \ | 63 | #define BFS_OFF2INO(offset) \ |
71 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) | 64 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) |
72 | 65 | ||
73 | #define BFS_INO2OFF(ino) \ | 66 | #define BFS_INO2OFF(ino) \ |
74 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) | 67 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) |
68 | #define BFS_NZFILESIZE(ip) \ | ||
69 | ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) | ||
70 | |||
71 | #define BFS_FILESIZE(ip) \ | ||
72 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
75 | 73 | ||
74 | #define BFS_FILEBLOCKS(ip) \ | ||
75 | ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) | ||
76 | #define BFS_UNCLEAN(bfs_sb, sb) \ | 76 | #define BFS_UNCLEAN(bfs_sb, sb) \ |
77 | ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) | 77 | ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) |
78 | |||
78 | 79 | ||
79 | #endif /* _LINUX_BFS_FS_H */ | 80 | #endif /* _LINUX_BFS_FS_H */ |
diff --git a/include/linux/bio.h b/include/linux/bio.h index cdaf03a14a51..6e1c79c8b6bf 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -314,9 +314,8 @@ void zero_fill_bio(struct bio *bio); | |||
314 | * bvec_kmap_irq and bvec_kunmap_irq!! | 314 | * bvec_kmap_irq and bvec_kunmap_irq!! |
315 | * | 315 | * |
316 | * This function MUST be inlined - it plays with the CPU interrupt flags. | 316 | * This function MUST be inlined - it plays with the CPU interrupt flags. |
317 | * Hence the `extern inline'. | ||
318 | */ | 317 | */ |
319 | extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | 318 | static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) |
320 | { | 319 | { |
321 | unsigned long addr; | 320 | unsigned long addr; |
322 | 321 | ||
@@ -332,7 +331,7 @@ extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
332 | return (char *) addr + bvec->bv_offset; | 331 | return (char *) addr + bvec->bv_offset; |
333 | } | 332 | } |
334 | 333 | ||
335 | extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | 334 | static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) |
336 | { | 335 | { |
337 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 336 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
338 | 337 | ||
@@ -345,7 +344,7 @@ extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
345 | #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) | 344 | #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) |
346 | #endif | 345 | #endif |
347 | 346 | ||
348 | extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | 347 | static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, |
349 | unsigned long *flags) | 348 | unsigned long *flags) |
350 | { | 349 | { |
351 | return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); | 350 | return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); |
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h new file mode 100644 index 000000000000..6b20af0bbb79 --- /dev/null +++ b/include/linux/bit_spinlock.h | |||
@@ -0,0 +1,77 @@ | |||
1 | #ifndef __LINUX_BIT_SPINLOCK_H | ||
2 | #define __LINUX_BIT_SPINLOCK_H | ||
3 | |||
4 | /* | ||
5 | * bit-based spin_lock() | ||
6 | * | ||
7 | * Don't use this unless you really need to: spin_lock() and spin_unlock() | ||
8 | * are significantly faster. | ||
9 | */ | ||
10 | static inline void bit_spin_lock(int bitnum, unsigned long *addr) | ||
11 | { | ||
12 | /* | ||
13 | * Assuming the lock is uncontended, this never enters | ||
14 | * the body of the outer loop. If it is contended, then | ||
15 | * within the inner loop a non-atomic test is used to | ||
16 | * busywait with less bus contention for a good time to | ||
17 | * attempt to acquire the lock bit. | ||
18 | */ | ||
19 | preempt_disable(); | ||
20 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
21 | while (test_and_set_bit(bitnum, addr)) { | ||
22 | while (test_bit(bitnum, addr)) { | ||
23 | preempt_enable(); | ||
24 | cpu_relax(); | ||
25 | preempt_disable(); | ||
26 | } | ||
27 | } | ||
28 | #endif | ||
29 | __acquire(bitlock); | ||
30 | } | ||
31 | |||
32 | /* | ||
33 | * Return true if it was acquired | ||
34 | */ | ||
35 | static inline int bit_spin_trylock(int bitnum, unsigned long *addr) | ||
36 | { | ||
37 | preempt_disable(); | ||
38 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
39 | if (test_and_set_bit(bitnum, addr)) { | ||
40 | preempt_enable(); | ||
41 | return 0; | ||
42 | } | ||
43 | #endif | ||
44 | __acquire(bitlock); | ||
45 | return 1; | ||
46 | } | ||
47 | |||
48 | /* | ||
49 | * bit-based spin_unlock() | ||
50 | */ | ||
51 | static inline void bit_spin_unlock(int bitnum, unsigned long *addr) | ||
52 | { | ||
53 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
54 | BUG_ON(!test_bit(bitnum, addr)); | ||
55 | smp_mb__before_clear_bit(); | ||
56 | clear_bit(bitnum, addr); | ||
57 | #endif | ||
58 | preempt_enable(); | ||
59 | __release(bitlock); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Return true if the lock is held. | ||
64 | */ | ||
65 | static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) | ||
66 | { | ||
67 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
68 | return test_bit(bitnum, addr); | ||
69 | #elif defined CONFIG_PREEMPT | ||
70 | return preempt_count(); | ||
71 | #else | ||
72 | return 1; | ||
73 | #endif | ||
74 | } | ||
75 | |||
76 | #endif /* __LINUX_BIT_SPINLOCK_H */ | ||
77 | |||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aefa26fbae8a..efdc9b5bc05c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -728,7 +728,7 @@ static inline unsigned int blksize_bits(unsigned int size) | |||
728 | return bits; | 728 | return bits; |
729 | } | 729 | } |
730 | 730 | ||
731 | extern inline unsigned int block_size(struct block_device *bdev) | 731 | static inline unsigned int block_size(struct block_device *bdev) |
732 | { | 732 | { |
733 | return bdev->bd_block_size; | 733 | return bdev->bd_block_size; |
734 | } | 734 | } |
diff --git a/include/linux/chio.h b/include/linux/chio.h index 63035ae67e63..a404c111c937 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h | |||
@@ -96,7 +96,7 @@ struct changer_position { | |||
96 | */ | 96 | */ |
97 | struct changer_element_status { | 97 | struct changer_element_status { |
98 | int ces_type; | 98 | int ces_type; |
99 | unsigned char *ces_data; | 99 | unsigned char __user *ces_data; |
100 | }; | 100 | }; |
101 | #define CESTATUS_FULL 0x01 /* full */ | 101 | #define CESTATUS_FULL 0x01 /* full */ |
102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ | 102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 007c290f74d4..8bf4bacb5051 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -432,7 +432,10 @@ struct dccp_sock { | |||
432 | struct ccid *dccps_hc_rx_ccid; | 432 | struct ccid *dccps_hc_rx_ccid; |
433 | struct ccid *dccps_hc_tx_ccid; | 433 | struct ccid *dccps_hc_tx_ccid; |
434 | struct dccp_options_received dccps_options_received; | 434 | struct dccp_options_received dccps_options_received; |
435 | struct timeval dccps_epoch; | ||
435 | enum dccp_role dccps_role:2; | 436 | enum dccp_role dccps_role:2; |
437 | __u8 dccps_hc_rx_insert_options:1; | ||
438 | __u8 dccps_hc_tx_insert_options:1; | ||
436 | }; | 439 | }; |
437 | 440 | ||
438 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) | 441 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) |
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index e60bfdac348d..4932ee5c77f0 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h | |||
@@ -19,7 +19,8 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, | |||
19 | 19 | ||
20 | void dma_pool_destroy(struct dma_pool *pool); | 20 | void dma_pool_destroy(struct dma_pool *pool); |
21 | 21 | ||
22 | void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle); | 22 | void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, |
23 | dma_addr_t *handle); | ||
23 | 24 | ||
24 | void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); | 25 | void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); |
25 | 26 | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24beeed971..82e39cd0c4fb 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -107,6 +107,8 @@ | |||
107 | #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ | 107 | #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ |
108 | #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ | 108 | #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ |
109 | #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ | 109 | #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ |
110 | #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ | ||
111 | #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ | ||
110 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ | 112 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ |
111 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ | 113 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ |
112 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ | 114 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ |
@@ -495,6 +497,9 @@ struct fb_cursor_user { | |||
495 | #define FB_EVENT_BLANK 0x08 | 497 | #define FB_EVENT_BLANK 0x08 |
496 | /* Private modelist is to be replaced */ | 498 | /* Private modelist is to be replaced */ |
497 | #define FB_EVENT_NEW_MODELIST 0x09 | 499 | #define FB_EVENT_NEW_MODELIST 0x09 |
500 | /* The resolution of the passed in fb_info about to change and | ||
501 | all vc's should be changed */ | ||
502 | #define FB_EVENT_MODE_CHANGE_ALL 0x0A | ||
498 | 503 | ||
499 | struct fb_event { | 504 | struct fb_event { |
500 | struct fb_info *info; | 505 | struct fb_info *info; |
@@ -820,13 +825,29 @@ extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, | |||
820 | u32 height, u32 shift_high, u32 shift_low, u32 mod); | 825 | u32 height, u32 shift_high, u32 shift_low, u32 mod); |
821 | extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); | 826 | extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); |
822 | extern void fb_set_suspend(struct fb_info *info, int state); | 827 | extern void fb_set_suspend(struct fb_info *info, int state); |
823 | extern int fb_get_color_depth(struct fb_var_screeninfo *var); | 828 | extern int fb_get_color_depth(struct fb_var_screeninfo *var, |
829 | struct fb_fix_screeninfo *fix); | ||
824 | extern int fb_get_options(char *name, char **option); | 830 | extern int fb_get_options(char *name, char **option); |
825 | extern int fb_new_modelist(struct fb_info *info); | 831 | extern int fb_new_modelist(struct fb_info *info); |
826 | 832 | ||
827 | extern struct fb_info *registered_fb[FB_MAX]; | 833 | extern struct fb_info *registered_fb[FB_MAX]; |
828 | extern int num_registered_fb; | 834 | extern int num_registered_fb; |
829 | 835 | ||
836 | static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, | ||
837 | u8 *src, u32 s_pitch, u32 height) | ||
838 | { | ||
839 | int i, j; | ||
840 | |||
841 | d_pitch -= s_pitch; | ||
842 | |||
843 | for (i = height; i--; ) { | ||
844 | /* s_pitch is a few bytes at the most, memcpy is suboptimal */ | ||
845 | for (j = 0; j < s_pitch; j++) | ||
846 | *dst++ = *src++; | ||
847 | dst += d_pitch; | ||
848 | } | ||
849 | } | ||
850 | |||
830 | /* drivers/video/fbsysfs.c */ | 851 | /* drivers/video/fbsysfs.c */ |
831 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); | 852 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); |
832 | extern void framebuffer_release(struct fb_info *info); | 853 | extern void framebuffer_release(struct fb_info *info); |
@@ -856,8 +877,11 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, | |||
856 | extern int fb_validate_mode(const struct fb_var_screeninfo *var, | 877 | extern int fb_validate_mode(const struct fb_var_screeninfo *var, |
857 | struct fb_info *info); | 878 | struct fb_info *info); |
858 | extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); | 879 | extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); |
859 | extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs); | 880 | extern const unsigned char *fb_firmware_edid(struct device *device); |
881 | extern void fb_edid_to_monspecs(unsigned char *edid, | ||
882 | struct fb_monspecs *specs); | ||
860 | extern void fb_destroy_modedb(struct fb_videomode *modedb); | 883 | extern void fb_destroy_modedb(struct fb_videomode *modedb); |
884 | extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); | ||
861 | 885 | ||
862 | /* drivers/video/modedb.c */ | 886 | /* drivers/video/modedb.c */ |
863 | #define VESA_MODEDB_SIZE 34 | 887 | #define VESA_MODEDB_SIZE 34 |
diff --git a/include/linux/file.h b/include/linux/file.h index 5206beb9a80e..f5bbd4c508b3 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/posix_types.h> | 9 | #include <linux/posix_types.h> |
10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
12 | #include <linux/rcupdate.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * The default fd array needs to be at least BITS_PER_LONG, | 15 | * The default fd array needs to be at least BITS_PER_LONG, |
@@ -16,23 +17,33 @@ | |||
16 | */ | 17 | */ |
17 | #define NR_OPEN_DEFAULT BITS_PER_LONG | 18 | #define NR_OPEN_DEFAULT BITS_PER_LONG |
18 | 19 | ||
20 | struct fdtable { | ||
21 | unsigned int max_fds; | ||
22 | int max_fdset; | ||
23 | int next_fd; | ||
24 | struct file ** fd; /* current fd array */ | ||
25 | fd_set *close_on_exec; | ||
26 | fd_set *open_fds; | ||
27 | struct rcu_head rcu; | ||
28 | struct files_struct *free_files; | ||
29 | struct fdtable *next; | ||
30 | }; | ||
31 | |||
19 | /* | 32 | /* |
20 | * Open file table structure | 33 | * Open file table structure |
21 | */ | 34 | */ |
22 | struct files_struct { | 35 | struct files_struct { |
23 | atomic_t count; | 36 | atomic_t count; |
24 | spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ | 37 | spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ |
25 | int max_fds; | 38 | struct fdtable *fdt; |
26 | int max_fdset; | 39 | struct fdtable fdtab; |
27 | int next_fd; | ||
28 | struct file ** fd; /* current fd array */ | ||
29 | fd_set *close_on_exec; | ||
30 | fd_set *open_fds; | ||
31 | fd_set close_on_exec_init; | 40 | fd_set close_on_exec_init; |
32 | fd_set open_fds_init; | 41 | fd_set open_fds_init; |
33 | struct file * fd_array[NR_OPEN_DEFAULT]; | 42 | struct file * fd_array[NR_OPEN_DEFAULT]; |
34 | }; | 43 | }; |
35 | 44 | ||
45 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | ||
46 | |||
36 | extern void FASTCALL(__fput(struct file *)); | 47 | extern void FASTCALL(__fput(struct file *)); |
37 | extern void FASTCALL(fput(struct file *)); | 48 | extern void FASTCALL(fput(struct file *)); |
38 | 49 | ||
@@ -59,13 +70,16 @@ extern fd_set *alloc_fdset(int); | |||
59 | extern void free_fdset(fd_set *, int); | 70 | extern void free_fdset(fd_set *, int); |
60 | 71 | ||
61 | extern int expand_files(struct files_struct *, int nr); | 72 | extern int expand_files(struct files_struct *, int nr); |
73 | extern void free_fdtable(struct fdtable *fdt); | ||
74 | extern void __init files_defer_init(void); | ||
62 | 75 | ||
63 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | 76 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) |
64 | { | 77 | { |
65 | struct file * file = NULL; | 78 | struct file * file = NULL; |
79 | struct fdtable *fdt = files_fdtable(files); | ||
66 | 80 | ||
67 | if (fd < files->max_fds) | 81 | if (fd < fdt->max_fds) |
68 | file = files->fd[fd]; | 82 | file = rcu_dereference(fdt->fd[fd]); |
69 | return file; | 83 | return file; |
70 | } | 84 | } |
71 | 85 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index fd93ab7da905..e0b77c5af9a0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
10 | #include <linux/limits.h> | 10 | #include <linux/limits.h> |
11 | #include <linux/ioctl.h> | 11 | #include <linux/ioctl.h> |
12 | #include <linux/rcuref.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 15 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change |
@@ -597,12 +598,13 @@ struct file { | |||
597 | spinlock_t f_ep_lock; | 598 | spinlock_t f_ep_lock; |
598 | #endif /* #ifdef CONFIG_EPOLL */ | 599 | #endif /* #ifdef CONFIG_EPOLL */ |
599 | struct address_space *f_mapping; | 600 | struct address_space *f_mapping; |
601 | struct rcu_head f_rcuhead; | ||
600 | }; | 602 | }; |
601 | extern spinlock_t files_lock; | 603 | extern spinlock_t files_lock; |
602 | #define file_list_lock() spin_lock(&files_lock); | 604 | #define file_list_lock() spin_lock(&files_lock); |
603 | #define file_list_unlock() spin_unlock(&files_lock); | 605 | #define file_list_unlock() spin_unlock(&files_lock); |
604 | 606 | ||
605 | #define get_file(x) atomic_inc(&(x)->f_count) | 607 | #define get_file(x) rcuref_inc(&(x)->f_count) |
606 | #define file_count(x) atomic_read(&(x)->f_count) | 608 | #define file_count(x) atomic_read(&(x)->f_count) |
607 | 609 | ||
608 | #define MAX_NON_LFS ((1UL<<31) - 1) | 610 | #define MAX_NON_LFS ((1UL<<31) - 1) |
@@ -1507,8 +1509,6 @@ extern void do_generic_mapping_read(struct address_space *mapping, | |||
1507 | loff_t *, read_descriptor_t *, read_actor_t); | 1509 | loff_t *, read_descriptor_t *, read_actor_t); |
1508 | extern void | 1510 | extern void |
1509 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 1511 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
1510 | extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb, | ||
1511 | const struct iovec *iov, loff_t offset, unsigned long nr_segs); | ||
1512 | extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, | 1512 | extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, |
1513 | unsigned long nr_segs, loff_t *ppos); | 1513 | unsigned long nr_segs, loff_t *ppos); |
1514 | ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, | 1514 | ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h new file mode 100644 index 000000000000..acbeb96a3353 --- /dev/null +++ b/include/linux/fuse.h | |||
@@ -0,0 +1,259 @@ | |||
1 | /* | ||
2 | FUSE: Filesystem in Userspace | ||
3 | Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> | ||
4 | |||
5 | This program can be distributed under the terms of the GNU GPL. | ||
6 | See the file COPYING. | ||
7 | */ | ||
8 | |||
9 | /* This file defines the kernel interface of FUSE */ | ||
10 | |||
11 | #include <asm/types.h> | ||
12 | |||
13 | /** Version number of this interface */ | ||
14 | #define FUSE_KERNEL_VERSION 7 | ||
15 | |||
16 | /** Minor version number of this interface */ | ||
17 | #define FUSE_KERNEL_MINOR_VERSION 2 | ||
18 | |||
19 | /** The node ID of the root inode */ | ||
20 | #define FUSE_ROOT_ID 1 | ||
21 | |||
22 | /** The major number of the fuse character device */ | ||
23 | #define FUSE_MAJOR 10 | ||
24 | |||
25 | /** The minor number of the fuse character device */ | ||
26 | #define FUSE_MINOR 229 | ||
27 | |||
28 | /* Make sure all structures are padded to 64bit boundary, so 32bit | ||
29 | userspace works under 64bit kernels */ | ||
30 | |||
31 | struct fuse_attr { | ||
32 | __u64 ino; | ||
33 | __u64 size; | ||
34 | __u64 blocks; | ||
35 | __u64 atime; | ||
36 | __u64 mtime; | ||
37 | __u64 ctime; | ||
38 | __u32 atimensec; | ||
39 | __u32 mtimensec; | ||
40 | __u32 ctimensec; | ||
41 | __u32 mode; | ||
42 | __u32 nlink; | ||
43 | __u32 uid; | ||
44 | __u32 gid; | ||
45 | __u32 rdev; | ||
46 | }; | ||
47 | |||
48 | struct fuse_kstatfs { | ||
49 | __u64 blocks; | ||
50 | __u64 bfree; | ||
51 | __u64 bavail; | ||
52 | __u64 files; | ||
53 | __u64 ffree; | ||
54 | __u32 bsize; | ||
55 | __u32 namelen; | ||
56 | }; | ||
57 | |||
58 | #define FATTR_MODE (1 << 0) | ||
59 | #define FATTR_UID (1 << 1) | ||
60 | #define FATTR_GID (1 << 2) | ||
61 | #define FATTR_SIZE (1 << 3) | ||
62 | #define FATTR_ATIME (1 << 4) | ||
63 | #define FATTR_MTIME (1 << 5) | ||
64 | #define FATTR_CTIME (1 << 6) | ||
65 | |||
66 | /** | ||
67 | * Flags returned by the OPEN request | ||
68 | * | ||
69 | * FOPEN_DIRECT_IO: bypass page cache for this open file | ||
70 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | ||
71 | */ | ||
72 | #define FOPEN_DIRECT_IO (1 << 0) | ||
73 | #define FOPEN_KEEP_CACHE (1 << 1) | ||
74 | |||
75 | enum fuse_opcode { | ||
76 | FUSE_LOOKUP = 1, | ||
77 | FUSE_FORGET = 2, /* no reply */ | ||
78 | FUSE_GETATTR = 3, | ||
79 | FUSE_SETATTR = 4, | ||
80 | FUSE_READLINK = 5, | ||
81 | FUSE_SYMLINK = 6, | ||
82 | FUSE_MKNOD = 8, | ||
83 | FUSE_MKDIR = 9, | ||
84 | FUSE_UNLINK = 10, | ||
85 | FUSE_RMDIR = 11, | ||
86 | FUSE_RENAME = 12, | ||
87 | FUSE_LINK = 13, | ||
88 | FUSE_OPEN = 14, | ||
89 | FUSE_READ = 15, | ||
90 | FUSE_WRITE = 16, | ||
91 | FUSE_STATFS = 17, | ||
92 | FUSE_RELEASE = 18, | ||
93 | FUSE_FSYNC = 20, | ||
94 | FUSE_SETXATTR = 21, | ||
95 | FUSE_GETXATTR = 22, | ||
96 | FUSE_LISTXATTR = 23, | ||
97 | FUSE_REMOVEXATTR = 24, | ||
98 | FUSE_FLUSH = 25, | ||
99 | FUSE_INIT = 26, | ||
100 | FUSE_OPENDIR = 27, | ||
101 | FUSE_READDIR = 28, | ||
102 | FUSE_RELEASEDIR = 29, | ||
103 | FUSE_FSYNCDIR = 30 | ||
104 | }; | ||
105 | |||
106 | /* Conservative buffer size for the client */ | ||
107 | #define FUSE_MAX_IN 8192 | ||
108 | |||
109 | #define FUSE_NAME_MAX 1024 | ||
110 | #define FUSE_SYMLINK_MAX 4096 | ||
111 | #define FUSE_XATTR_SIZE_MAX 4096 | ||
112 | |||
113 | struct fuse_entry_out { | ||
114 | __u64 nodeid; /* Inode ID */ | ||
115 | __u64 generation; /* Inode generation: nodeid:gen must | ||
116 | be unique for the fs's lifetime */ | ||
117 | __u64 entry_valid; /* Cache timeout for the name */ | ||
118 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
119 | __u32 entry_valid_nsec; | ||
120 | __u32 attr_valid_nsec; | ||
121 | struct fuse_attr attr; | ||
122 | }; | ||
123 | |||
124 | struct fuse_forget_in { | ||
125 | __u64 nlookup; | ||
126 | }; | ||
127 | |||
128 | struct fuse_attr_out { | ||
129 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
130 | __u32 attr_valid_nsec; | ||
131 | __u32 dummy; | ||
132 | struct fuse_attr attr; | ||
133 | }; | ||
134 | |||
135 | struct fuse_mknod_in { | ||
136 | __u32 mode; | ||
137 | __u32 rdev; | ||
138 | }; | ||
139 | |||
140 | struct fuse_mkdir_in { | ||
141 | __u32 mode; | ||
142 | __u32 padding; | ||
143 | }; | ||
144 | |||
145 | struct fuse_rename_in { | ||
146 | __u64 newdir; | ||
147 | }; | ||
148 | |||
149 | struct fuse_link_in { | ||
150 | __u64 oldnodeid; | ||
151 | }; | ||
152 | |||
153 | struct fuse_setattr_in { | ||
154 | __u32 valid; | ||
155 | __u32 padding; | ||
156 | struct fuse_attr attr; | ||
157 | }; | ||
158 | |||
159 | struct fuse_open_in { | ||
160 | __u32 flags; | ||
161 | __u32 padding; | ||
162 | }; | ||
163 | |||
164 | struct fuse_open_out { | ||
165 | __u64 fh; | ||
166 | __u32 open_flags; | ||
167 | __u32 padding; | ||
168 | }; | ||
169 | |||
170 | struct fuse_release_in { | ||
171 | __u64 fh; | ||
172 | __u32 flags; | ||
173 | __u32 padding; | ||
174 | }; | ||
175 | |||
176 | struct fuse_flush_in { | ||
177 | __u64 fh; | ||
178 | __u32 flush_flags; | ||
179 | __u32 padding; | ||
180 | }; | ||
181 | |||
182 | struct fuse_read_in { | ||
183 | __u64 fh; | ||
184 | __u64 offset; | ||
185 | __u32 size; | ||
186 | __u32 padding; | ||
187 | }; | ||
188 | |||
189 | struct fuse_write_in { | ||
190 | __u64 fh; | ||
191 | __u64 offset; | ||
192 | __u32 size; | ||
193 | __u32 write_flags; | ||
194 | }; | ||
195 | |||
196 | struct fuse_write_out { | ||
197 | __u32 size; | ||
198 | __u32 padding; | ||
199 | }; | ||
200 | |||
201 | struct fuse_statfs_out { | ||
202 | struct fuse_kstatfs st; | ||
203 | }; | ||
204 | |||
205 | struct fuse_fsync_in { | ||
206 | __u64 fh; | ||
207 | __u32 fsync_flags; | ||
208 | __u32 padding; | ||
209 | }; | ||
210 | |||
211 | struct fuse_setxattr_in { | ||
212 | __u32 size; | ||
213 | __u32 flags; | ||
214 | }; | ||
215 | |||
216 | struct fuse_getxattr_in { | ||
217 | __u32 size; | ||
218 | __u32 padding; | ||
219 | }; | ||
220 | |||
221 | struct fuse_getxattr_out { | ||
222 | __u32 size; | ||
223 | __u32 padding; | ||
224 | }; | ||
225 | |||
226 | struct fuse_init_in_out { | ||
227 | __u32 major; | ||
228 | __u32 minor; | ||
229 | }; | ||
230 | |||
231 | struct fuse_in_header { | ||
232 | __u32 len; | ||
233 | __u32 opcode; | ||
234 | __u64 unique; | ||
235 | __u64 nodeid; | ||
236 | __u32 uid; | ||
237 | __u32 gid; | ||
238 | __u32 pid; | ||
239 | __u32 padding; | ||
240 | }; | ||
241 | |||
242 | struct fuse_out_header { | ||
243 | __u32 len; | ||
244 | __s32 error; | ||
245 | __u64 unique; | ||
246 | }; | ||
247 | |||
248 | struct fuse_dirent { | ||
249 | __u64 ino; | ||
250 | __u64 off; | ||
251 | __u32 namelen; | ||
252 | __u32 type; | ||
253 | char name[0]; | ||
254 | }; | ||
255 | |||
256 | #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) | ||
257 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | ||
258 | #define FUSE_DIRENT_SIZE(d) \ | ||
259 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | ||
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index c727c195a91a..68ab5f2ab9cd 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -2,17 +2,27 @@ | |||
2 | #define _LINUX__INIT_TASK_H | 2 | #define _LINUX__INIT_TASK_H |
3 | 3 | ||
4 | #include <linux/file.h> | 4 | #include <linux/file.h> |
5 | #include <linux/rcupdate.h> | ||
5 | 6 | ||
6 | #define INIT_FILES \ | 7 | #define INIT_FDTABLE \ |
7 | { \ | 8 | { \ |
8 | .count = ATOMIC_INIT(1), \ | ||
9 | .file_lock = SPIN_LOCK_UNLOCKED, \ | ||
10 | .max_fds = NR_OPEN_DEFAULT, \ | 9 | .max_fds = NR_OPEN_DEFAULT, \ |
11 | .max_fdset = __FD_SETSIZE, \ | 10 | .max_fdset = __FD_SETSIZE, \ |
12 | .next_fd = 0, \ | 11 | .next_fd = 0, \ |
13 | .fd = &init_files.fd_array[0], \ | 12 | .fd = &init_files.fd_array[0], \ |
14 | .close_on_exec = &init_files.close_on_exec_init, \ | 13 | .close_on_exec = &init_files.close_on_exec_init, \ |
15 | .open_fds = &init_files.open_fds_init, \ | 14 | .open_fds = &init_files.open_fds_init, \ |
15 | .rcu = RCU_HEAD_INIT, \ | ||
16 | .free_files = NULL, \ | ||
17 | .next = NULL, \ | ||
18 | } | ||
19 | |||
20 | #define INIT_FILES \ | ||
21 | { \ | ||
22 | .count = ATOMIC_INIT(1), \ | ||
23 | .file_lock = SPIN_LOCK_UNLOCKED, \ | ||
24 | .fdt = &init_files.fdtab, \ | ||
25 | .fdtab = INIT_FDTABLE, \ | ||
16 | .close_on_exec_init = { { 0, } }, \ | 26 | .close_on_exec_init = { { 0, } }, \ |
17 | .open_fds_init = { { 0, } }, \ | 27 | .open_fds_init = { { 0, } }, \ |
18 | .fd_array = { NULL, } \ | 28 | .fd_array = { NULL, } \ |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 84321a4cac93..de097269bd7f 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | #include <linux/journal-head.h> | 29 | #include <linux/journal-head.h> |
30 | #include <linux/stddef.h> | 30 | #include <linux/stddef.h> |
31 | #include <linux/bit_spinlock.h> | ||
31 | #include <asm/semaphore.h> | 32 | #include <asm/semaphore.h> |
32 | #endif | 33 | #endif |
33 | 34 | ||
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index d7a2555a886c..6acfdbba734b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void) | |||
254 | */ | 254 | */ |
255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) | 255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) |
256 | { | 256 | { |
257 | #if HZ <= 1000 && !(1000 % HZ) | 257 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
258 | return (1000 / HZ) * j; | 258 | return (MSEC_PER_SEC / HZ) * j; |
259 | #elif HZ > 1000 && !(HZ % 1000) | 259 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
260 | return (j + (HZ / 1000) - 1)/(HZ / 1000); | 260 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); |
261 | #else | 261 | #else |
262 | return (j * 1000) / HZ; | 262 | return (j * MSEC_PER_SEC) / HZ; |
263 | #endif | 263 | #endif |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) | 266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) |
267 | { | 267 | { |
268 | #if HZ <= 1000000 && !(1000000 % HZ) | 268 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
269 | return (1000000 / HZ) * j; | 269 | return (USEC_PER_SEC / HZ) * j; |
270 | #elif HZ > 1000000 && !(HZ % 1000000) | 270 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
271 | return (j + (HZ / 1000000) - 1)/(HZ / 1000000); | 271 | return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); |
272 | #else | 272 | #else |
273 | return (j * 1000000) / HZ; | 273 | return (j * USEC_PER_SEC) / HZ; |
274 | #endif | 274 | #endif |
275 | } | 275 | } |
276 | 276 | ||
@@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m) | |||
278 | { | 278 | { |
279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) | 279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) |
280 | return MAX_JIFFY_OFFSET; | 280 | return MAX_JIFFY_OFFSET; |
281 | #if HZ <= 1000 && !(1000 % HZ) | 281 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
282 | return (m + (1000 / HZ) - 1) / (1000 / HZ); | 282 | return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); |
283 | #elif HZ > 1000 && !(HZ % 1000) | 283 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
284 | return m * (HZ / 1000); | 284 | return m * (HZ / MSEC_PER_SEC); |
285 | #else | 285 | #else |
286 | return (m * HZ + 999) / 1000; | 286 | return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; |
287 | #endif | 287 | #endif |
288 | } | 288 | } |
289 | 289 | ||
@@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u) | |||
291 | { | 291 | { |
292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) | 292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) |
293 | return MAX_JIFFY_OFFSET; | 293 | return MAX_JIFFY_OFFSET; |
294 | #if HZ <= 1000000 && !(1000000 % HZ) | 294 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
295 | return (u + (1000000 / HZ) - 1) / (1000000 / HZ); | 295 | return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ); |
296 | #elif HZ > 1000000 && !(HZ % 1000000) | 296 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
297 | return u * (HZ / 1000000); | 297 | return u * (HZ / USEC_PER_SEC); |
298 | #else | 298 | #else |
299 | return (u * HZ + 999999) / 1000000; | 299 | return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC; |
300 | #endif | 300 | #endif |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 6caaba0af469..7349058ed778 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -315,8 +315,11 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s | |||
315 | pci_bus_add_devices(root_bus); | 315 | pci_bus_add_devices(root_bus); |
316 | return root_bus; | 316 | return root_bus; |
317 | } | 317 | } |
318 | struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | ||
319 | struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); | ||
318 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 320 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
319 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 321 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); |
322 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | ||
320 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 323 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
321 | void pci_bus_add_device(struct pci_dev *dev); | 324 | void pci_bus_add_device(struct pci_dev *dev); |
322 | void pci_read_bridge_bases(struct pci_bus *child); | 325 | void pci_read_bridge_bases(struct pci_bus *child); |
@@ -326,6 +329,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
326 | extern void pci_dev_put(struct pci_dev *dev); | 329 | extern void pci_dev_put(struct pci_dev *dev); |
327 | extern void pci_remove_bus(struct pci_bus *b); | 330 | extern void pci_remove_bus(struct pci_bus *b); |
328 | extern void pci_remove_bus_device(struct pci_dev *dev); | 331 | extern void pci_remove_bus_device(struct pci_dev *dev); |
332 | void pci_setup_cardbus(struct pci_bus *bus); | ||
329 | 333 | ||
330 | /* Generic PCI functions exported to card drivers */ | 334 | /* Generic PCI functions exported to card drivers */ |
331 | 335 | ||
@@ -391,8 +395,8 @@ int pci_assign_resource(struct pci_dev *dev, int i); | |||
391 | void pci_restore_bars(struct pci_dev *dev); | 395 | void pci_restore_bars(struct pci_dev *dev); |
392 | 396 | ||
393 | /* ROM control related routines */ | 397 | /* ROM control related routines */ |
394 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); | 398 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
395 | void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); | 399 | void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); |
396 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 400 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
397 | void pci_remove_rom(struct pci_dev *pdev); | 401 | void pci_remove_rom(struct pci_dev *pdev); |
398 | 402 | ||
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 8081a281fa5e..9c51917b1cce 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | struct radix_tree_root { | 25 | struct radix_tree_root { |
26 | unsigned int height; | 26 | unsigned int height; |
27 | int gfp_mask; | 27 | unsigned int gfp_mask; |
28 | struct radix_tree_node *rnode; | 28 | struct radix_tree_node *rnode; |
29 | }; | 29 | }; |
30 | 30 | ||
@@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); | |||
50 | unsigned int | 50 | unsigned int |
51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | 51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
52 | unsigned long first_index, unsigned int max_items); | 52 | unsigned long first_index, unsigned int max_items); |
53 | int radix_tree_preload(int gfp_mask); | 53 | int radix_tree_preload(unsigned int __nocast gfp_mask); |
54 | void radix_tree_init(void); | 54 | void radix_tree_init(void); |
55 | void *radix_tree_tag_set(struct radix_tree_root *root, | 55 | void *radix_tree_tag_set(struct radix_tree_root *root, |
56 | unsigned long index, int tag); | 56 | unsigned long index, int tag); |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 4bf1659f8aa8..9de99198caf1 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define BITMAP_H 1 | 7 | #define BITMAP_H 1 |
8 | 8 | ||
9 | #define BITMAP_MAJOR 3 | 9 | #define BITMAP_MAJOR 3 |
10 | #define BITMAP_MINOR 38 | 10 | #define BITMAP_MINOR 39 |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * in-memory bitmap: | 13 | * in-memory bitmap: |
@@ -147,8 +147,9 @@ typedef struct bitmap_super_s { | |||
147 | __u32 state; /* 48 bitmap state information */ | 147 | __u32 state; /* 48 bitmap state information */ |
148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ | 148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ |
149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ | 149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ |
150 | __u32 write_behind; /* 60 number of outstanding write-behind writes */ | ||
150 | 151 | ||
151 | __u8 pad[256 - 60]; /* set to zero */ | 152 | __u8 pad[256 - 64]; /* set to zero */ |
152 | } bitmap_super_t; | 153 | } bitmap_super_t; |
153 | 154 | ||
154 | /* notes: | 155 | /* notes: |
@@ -226,6 +227,9 @@ struct bitmap { | |||
226 | 227 | ||
227 | unsigned long flags; | 228 | unsigned long flags; |
228 | 229 | ||
230 | unsigned long max_write_behind; /* write-behind mode */ | ||
231 | atomic_t behind_writes; | ||
232 | |||
229 | /* | 233 | /* |
230 | * the bitmap daemon - periodically wakes up and sweeps the bitmap | 234 | * the bitmap daemon - periodically wakes up and sweeps the bitmap |
231 | * file, cleaning up bits and flushing out pages to disk as necessary | 235 | * file, cleaning up bits and flushing out pages to disk as necessary |
@@ -260,9 +264,10 @@ int bitmap_setallbits(struct bitmap *bitmap); | |||
260 | void bitmap_write_all(struct bitmap *bitmap); | 264 | void bitmap_write_all(struct bitmap *bitmap); |
261 | 265 | ||
262 | /* these are exported */ | 266 | /* these are exported */ |
263 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); | 267 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, |
264 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | 268 | unsigned long sectors, int behind); |
265 | int success); | 269 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, |
270 | unsigned long sectors, int success, int behind); | ||
266 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); | 271 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); |
267 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); | 272 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); |
268 | void bitmap_close_sync(struct bitmap *bitmap); | 273 | void bitmap_close_sync(struct bitmap *bitmap); |
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index e04c4fe45b53..7eaf290e10e7 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h | |||
@@ -14,8 +14,8 @@ typedef struct dev_info dev_info_t; | |||
14 | struct linear_private_data | 14 | struct linear_private_data |
15 | { | 15 | { |
16 | dev_info_t **hash_table; | 16 | dev_info_t **hash_table; |
17 | dev_info_t *smallest; | 17 | sector_t hash_spacing; |
18 | int nr_zones; | 18 | int preshift; /* shift before dividing by hash_spacing */ |
19 | dev_info_t disks[0]; | 19 | dev_info_t disks[0]; |
20 | }; | 20 | }; |
21 | 21 | ||
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c14ba565a45..ebce949b1443 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; | |||
86 | #define MAX_CHUNK_SIZE (4096*1024) | 86 | #define MAX_CHUNK_SIZE (4096*1024) |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * default readahead | ||
90 | */ | ||
91 | |||
92 | static inline int disk_faulty(mdp_disk_t * d) | ||
93 | { | ||
94 | return d->state & (1 << MD_DISK_FAULTY); | ||
95 | } | ||
96 | |||
97 | static inline int disk_active(mdp_disk_t * d) | ||
98 | { | ||
99 | return d->state & (1 << MD_DISK_ACTIVE); | ||
100 | } | ||
101 | |||
102 | static inline int disk_sync(mdp_disk_t * d) | ||
103 | { | ||
104 | return d->state & (1 << MD_DISK_SYNC); | ||
105 | } | ||
106 | |||
107 | static inline int disk_spare(mdp_disk_t * d) | ||
108 | { | ||
109 | return !disk_sync(d) && !disk_active(d) && !disk_faulty(d); | ||
110 | } | ||
111 | |||
112 | static inline int disk_removed(mdp_disk_t * d) | ||
113 | { | ||
114 | return d->state & (1 << MD_DISK_REMOVED); | ||
115 | } | ||
116 | |||
117 | static inline void mark_disk_faulty(mdp_disk_t * d) | ||
118 | { | ||
119 | d->state |= (1 << MD_DISK_FAULTY); | ||
120 | } | ||
121 | |||
122 | static inline void mark_disk_active(mdp_disk_t * d) | ||
123 | { | ||
124 | d->state |= (1 << MD_DISK_ACTIVE); | ||
125 | } | ||
126 | |||
127 | static inline void mark_disk_sync(mdp_disk_t * d) | ||
128 | { | ||
129 | d->state |= (1 << MD_DISK_SYNC); | ||
130 | } | ||
131 | |||
132 | static inline void mark_disk_spare(mdp_disk_t * d) | ||
133 | { | ||
134 | d->state = 0; | ||
135 | } | ||
136 | |||
137 | static inline void mark_disk_removed(mdp_disk_t * d) | ||
138 | { | ||
139 | d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED); | ||
140 | } | ||
141 | |||
142 | static inline void mark_disk_inactive(mdp_disk_t * d) | ||
143 | { | ||
144 | d->state &= ~(1 << MD_DISK_ACTIVE); | ||
145 | } | ||
146 | |||
147 | static inline void mark_disk_nonsync(mdp_disk_t * d) | ||
148 | { | ||
149 | d->state &= ~(1 << MD_DISK_SYNC); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * MD's 'extended' device | 89 | * MD's 'extended' device |
154 | */ | 90 | */ |
155 | struct mdk_rdev_s | 91 | struct mdk_rdev_s |
@@ -166,6 +102,7 @@ struct mdk_rdev_s | |||
166 | int sb_loaded; | 102 | int sb_loaded; |
167 | sector_t data_offset; /* start of data in array */ | 103 | sector_t data_offset; /* start of data in array */ |
168 | sector_t sb_offset; | 104 | sector_t sb_offset; |
105 | int sb_size; /* bytes in the superblock */ | ||
169 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
170 | 107 | ||
171 | /* A device can be in one of three states based on two flags: | 108 | /* A device can be in one of three states based on two flags: |
@@ -181,6 +118,9 @@ struct mdk_rdev_s | |||
181 | int faulty; /* if faulty do not issue IO requests */ | 118 | int faulty; /* if faulty do not issue IO requests */ |
182 | int in_sync; /* device is a full member of the array */ | 119 | int in_sync; /* device is a full member of the array */ |
183 | 120 | ||
121 | unsigned long flags; /* Should include faulty and in_sync here. */ | ||
122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | ||
123 | |||
184 | int desc_nr; /* descriptor index in the superblock */ | 124 | int desc_nr; /* descriptor index in the superblock */ |
185 | int raid_disk; /* role of device in array */ | 125 | int raid_disk; /* role of device in array */ |
186 | int saved_raid_disk; /* role that device used to have in the | 126 | int saved_raid_disk; /* role that device used to have in the |
@@ -272,12 +212,19 @@ struct mddev_s | |||
272 | atomic_t writes_pending; | 212 | atomic_t writes_pending; |
273 | request_queue_t *queue; /* for plugging ... */ | 213 | request_queue_t *queue; /* for plugging ... */ |
274 | 214 | ||
215 | atomic_t write_behind; /* outstanding async IO */ | ||
216 | unsigned int max_write_behind; /* 0 = sync */ | ||
217 | |||
275 | struct bitmap *bitmap; /* the bitmap for the device */ | 218 | struct bitmap *bitmap; /* the bitmap for the device */ |
276 | struct file *bitmap_file; /* the bitmap file */ | 219 | struct file *bitmap_file; /* the bitmap file */ |
277 | long bitmap_offset; /* offset from superblock of | 220 | long bitmap_offset; /* offset from superblock of |
278 | * start of bitmap. May be | 221 | * start of bitmap. May be |
279 | * negative, but not '0' | 222 | * negative, but not '0' |
280 | */ | 223 | */ |
224 | long default_bitmap_offset; /* this is the offset to use when | ||
225 | * hot-adding a bitmap. It should | ||
226 | * eventually be settable by sysfs. | ||
227 | */ | ||
281 | 228 | ||
282 | struct list_head all_mddevs; | 229 | struct list_head all_mddevs; |
283 | }; | 230 | }; |
@@ -314,6 +261,12 @@ struct mdk_personality_s | |||
314 | int (*resize) (mddev_t *mddev, sector_t sectors); | 261 | int (*resize) (mddev_t *mddev, sector_t sectors); |
315 | int (*reshape) (mddev_t *mddev, int raid_disks); | 262 | int (*reshape) (mddev_t *mddev, int raid_disks); |
316 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 263 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
264 | /* quiesce moves between quiescence states | ||
265 | * 0 - fully active | ||
266 | * 1 - no new requests allowed | ||
267 | * others - reserved | ||
268 | */ | ||
269 | void (*quiesce) (mddev_t *mddev, int state); | ||
317 | }; | 270 | }; |
318 | 271 | ||
319 | 272 | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index dc65cd435494..c100fa5d4bfa 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -79,6 +79,11 @@ | |||
79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ | 79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ |
80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ | 80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ |
81 | 81 | ||
82 | #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. | ||
83 | * read requests will only be sent here in | ||
84 | * dire need | ||
85 | */ | ||
86 | |||
82 | typedef struct mdp_device_descriptor_s { | 87 | typedef struct mdp_device_descriptor_s { |
83 | __u32 number; /* 0 Device number in the entire set */ | 88 | __u32 number; /* 0 Device number in the entire set */ |
84 | __u32 major; /* 1 Device major number */ | 89 | __u32 major; /* 1 Device major number */ |
@@ -193,7 +198,7 @@ struct mdp_superblock_1 { | |||
193 | 198 | ||
194 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ | 199 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ |
195 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ | 200 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ |
196 | __u32 layout; /* only for raid5 currently */ | 201 | __u32 layout; /* only for raid5 and raid10 currently */ |
197 | __u64 size; /* used size of component devices, in 512byte sectors */ | 202 | __u64 size; /* used size of component devices, in 512byte sectors */ |
198 | 203 | ||
199 | __u32 chunksize; /* in 512byte sectors */ | 204 | __u32 chunksize; /* in 512byte sectors */ |
@@ -212,7 +217,9 @@ struct mdp_superblock_1 { | |||
212 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ | 217 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ |
213 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ | 218 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ |
214 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ | 219 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ |
215 | __u8 pad2[64-56]; /* set to 0 when writing */ | 220 | __u8 devflags; /* per-device flags. Only one defined...*/ |
221 | #define WriteMostly1 1 /* mask for writemostly flag in above */ | ||
222 | __u8 pad2[64-57]; /* set to 0 when writing */ | ||
216 | 223 | ||
217 | /* array state information - 64 bytes */ | 224 | /* array state information - 64 bytes */ |
218 | __u64 utime; /* 40 bits second, 24 btes microseconds */ | 225 | __u64 utime; /* 40 bits second, 24 btes microseconds */ |
@@ -231,5 +238,10 @@ struct mdp_superblock_1 { | |||
231 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ | 238 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ |
232 | }; | 239 | }; |
233 | 240 | ||
241 | /* feature_map bits */ | ||
242 | #define MD_FEATURE_BITMAP_OFFSET 1 | ||
243 | |||
244 | #define MD_FEATURE_ALL 1 | ||
245 | |||
234 | #endif | 246 | #endif |
235 | 247 | ||
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 9d93cf12e890..60e19b667548 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
@@ -80,6 +80,9 @@ struct r1bio_s { | |||
80 | atomic_t remaining; /* 'have we finished' count, | 80 | atomic_t remaining; /* 'have we finished' count, |
81 | * used from IRQ handlers | 81 | * used from IRQ handlers |
82 | */ | 82 | */ |
83 | atomic_t behind_remaining; /* number of write-behind ios remaining | ||
84 | * in this BehindIO request | ||
85 | */ | ||
83 | sector_t sector; | 86 | sector_t sector; |
84 | int sectors; | 87 | int sectors; |
85 | unsigned long state; | 88 | unsigned long state; |
@@ -107,4 +110,14 @@ struct r1bio_s { | |||
107 | #define R1BIO_Uptodate 0 | 110 | #define R1BIO_Uptodate 0 |
108 | #define R1BIO_IsSync 1 | 111 | #define R1BIO_IsSync 1 |
109 | #define R1BIO_Degraded 2 | 112 | #define R1BIO_Degraded 2 |
113 | #define R1BIO_BehindIO 3 | ||
114 | /* For write-behind requests, we call bi_end_io when | ||
115 | * the last non-write-behind device completes, providing | ||
116 | * any write was successful. Otherwise we call when | ||
117 | * any write-behind write succeeds, otherwise we call | ||
118 | * with failure when last write completes (and all failed). | ||
119 | * Record that bi_end_io was called with this flag... | ||
120 | */ | ||
121 | #define R1BIO_Returned 4 | ||
122 | |||
110 | #endif | 123 | #endif |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index d63ddcb4afad..176fc653c284 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -134,6 +134,7 @@ struct stripe_head { | |||
134 | unsigned long state; /* state flags */ | 134 | unsigned long state; /* state flags */ |
135 | atomic_t count; /* nr of active thread/requests */ | 135 | atomic_t count; /* nr of active thread/requests */ |
136 | spinlock_t lock; | 136 | spinlock_t lock; |
137 | int bm_seq; /* sequence number for bitmap flushes */ | ||
137 | struct r5dev { | 138 | struct r5dev { |
138 | struct bio req; | 139 | struct bio req; |
139 | struct bio_vec vec; | 140 | struct bio_vec vec; |
@@ -165,12 +166,13 @@ struct stripe_head { | |||
165 | /* | 166 | /* |
166 | * Stripe state | 167 | * Stripe state |
167 | */ | 168 | */ |
168 | #define STRIPE_ERROR 1 | ||
169 | #define STRIPE_HANDLE 2 | 169 | #define STRIPE_HANDLE 2 |
170 | #define STRIPE_SYNCING 3 | 170 | #define STRIPE_SYNCING 3 |
171 | #define STRIPE_INSYNC 4 | 171 | #define STRIPE_INSYNC 4 |
172 | #define STRIPE_PREREAD_ACTIVE 5 | 172 | #define STRIPE_PREREAD_ACTIVE 5 |
173 | #define STRIPE_DELAYED 6 | 173 | #define STRIPE_DELAYED 6 |
174 | #define STRIPE_DEGRADED 7 | ||
175 | #define STRIPE_BIT_DELAY 8 | ||
174 | 176 | ||
175 | /* | 177 | /* |
176 | * Plugging: | 178 | * Plugging: |
@@ -210,10 +212,20 @@ struct raid5_private_data { | |||
210 | 212 | ||
211 | struct list_head handle_list; /* stripes needing handling */ | 213 | struct list_head handle_list; /* stripes needing handling */ |
212 | struct list_head delayed_list; /* stripes that have plugged requests */ | 214 | struct list_head delayed_list; /* stripes that have plugged requests */ |
215 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ | ||
213 | atomic_t preread_active_stripes; /* stripes with scheduled io */ | 216 | atomic_t preread_active_stripes; /* stripes with scheduled io */ |
214 | 217 | ||
215 | char cache_name[20]; | 218 | char cache_name[20]; |
216 | kmem_cache_t *slab_cache; /* for allocating stripes */ | 219 | kmem_cache_t *slab_cache; /* for allocating stripes */ |
220 | |||
221 | int seq_flush, seq_write; | ||
222 | int quiesce; | ||
223 | |||
224 | int fullsync; /* set to 1 if a full sync is needed, | ||
225 | * (fresh device added). | ||
226 | * Cleared when a sync completes. | ||
227 | */ | ||
228 | |||
217 | /* | 229 | /* |
218 | * Free stripes pool | 230 | * Free stripes pool |
219 | */ | 231 | */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index fd276adf0fd5..4e65eb44adfd 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -52,8 +52,8 @@ struct rcu_head { | |||
52 | void (*func)(struct rcu_head *head); | 52 | void (*func)(struct rcu_head *head); |
53 | }; | 53 | }; |
54 | 54 | ||
55 | #define RCU_HEAD_INIT(head) { .next = NULL, .func = NULL } | 55 | #define RCU_HEAD_INIT { .next = NULL, .func = NULL } |
56 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT(head) | 56 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT |
57 | #define INIT_RCU_HEAD(ptr) do { \ | 57 | #define INIT_RCU_HEAD(ptr) do { \ |
58 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 58 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
59 | } while (0) | 59 | } while (0) |
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h new file mode 100644 index 000000000000..e1adbba14b67 --- /dev/null +++ b/include/linux/rcuref.h | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * rcuref.h | ||
3 | * | ||
4 | * Reference counting for elements of lists/arrays protected by | ||
5 | * RCU. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | * Copyright (C) IBM Corporation, 2005 | ||
22 | * | ||
23 | * Author: Dipankar Sarma <dipankar@in.ibm.com> | ||
24 | * Ravikiran Thirumalai <kiran_th@gmail.com> | ||
25 | * | ||
26 | * See Documentation/RCU/rcuref.txt for detailed user guide. | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | #ifndef _RCUREF_H_ | ||
31 | #define _RCUREF_H_ | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | #include <linux/types.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/spinlock.h> | ||
38 | #include <asm/atomic.h> | ||
39 | |||
40 | /* | ||
41 | * These APIs work on traditional atomic_t counters used in the | ||
42 | * kernel for reference counting. Under special circumstances | ||
43 | * where a lock-free get() operation races with a put() operation | ||
44 | * these APIs can be used. See Documentation/RCU/rcuref.txt. | ||
45 | */ | ||
46 | |||
47 | #ifdef __HAVE_ARCH_CMPXCHG | ||
48 | |||
49 | /** | ||
50 | * rcuref_inc - increment refcount for object. | ||
51 | * @rcuref: reference counter in the object in question. | ||
52 | * | ||
53 | * This should be used only for objects where we use RCU and | ||
54 | * use the rcuref_inc_lf() api to acquire a reference | ||
55 | * in a lock-free reader-side critical section. | ||
56 | */ | ||
57 | static inline void rcuref_inc(atomic_t *rcuref) | ||
58 | { | ||
59 | atomic_inc(rcuref); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * rcuref_dec - decrement refcount for object. | ||
64 | * @rcuref: reference counter in the object in question. | ||
65 | * | ||
66 | * This should be used only for objects where we use RCU and | ||
67 | * use the rcuref_inc_lf() api to acquire a reference | ||
68 | * in a lock-free reader-side critical section. | ||
69 | */ | ||
70 | static inline void rcuref_dec(atomic_t *rcuref) | ||
71 | { | ||
72 | atomic_dec(rcuref); | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * rcuref_dec_and_test - decrement refcount for object and test | ||
77 | * @rcuref: reference counter in the object. | ||
78 | * @release: pointer to the function that will clean up the object | ||
79 | * when the last reference to the object is released. | ||
80 | * This pointer is required. | ||
81 | * | ||
82 | * Decrement the refcount, and if 0, return 1. Else return 0. | ||
83 | * | ||
84 | * This should be used only for objects where we use RCU and | ||
85 | * use the rcuref_inc_lf() api to acquire a reference | ||
86 | * in a lock-free reader-side critical section. | ||
87 | */ | ||
88 | static inline int rcuref_dec_and_test(atomic_t *rcuref) | ||
89 | { | ||
90 | return atomic_dec_and_test(rcuref); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * cmpxchg is needed on UP too, if deletions to the list/array can happen | ||
95 | * in interrupt context. | ||
96 | */ | ||
97 | |||
98 | /** | ||
99 | * rcuref_inc_lf - Take reference to an object in a read-side | ||
100 | * critical section protected by RCU. | ||
101 | * @rcuref: reference counter in the object in question. | ||
102 | * | ||
103 | * Try and increment the refcount by 1. The increment might fail if | ||
104 | * the reference counter has been through a 1 to 0 transition and | ||
105 | * is no longer part of the lock-free list. | ||
106 | * Returns non-zero on successful increment and zero otherwise. | ||
107 | */ | ||
108 | static inline int rcuref_inc_lf(atomic_t *rcuref) | ||
109 | { | ||
110 | int c, old; | ||
111 | c = atomic_read(rcuref); | ||
112 | while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c) | ||
113 | c = old; | ||
114 | return c; | ||
115 | } | ||
116 | |||
117 | #else /* !__HAVE_ARCH_CMPXCHG */ | ||
118 | |||
119 | extern spinlock_t __rcuref_hash[]; | ||
120 | |||
121 | /* | ||
122 | * Use a hash table of locks to protect the reference count | ||
123 | * since cmpxchg is not available in this arch. | ||
124 | */ | ||
125 | #ifdef CONFIG_SMP | ||
126 | #define RCUREF_HASH_SIZE 4 | ||
127 | #define RCUREF_HASH(k) \ | ||
128 | (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)]) | ||
129 | #else | ||
130 | #define RCUREF_HASH_SIZE 1 | ||
131 | #define RCUREF_HASH(k) &__rcuref_hash[0] | ||
132 | #endif /* CONFIG_SMP */ | ||
133 | |||
134 | /** | ||
135 | * rcuref_inc - increment refcount for object. | ||
136 | * @rcuref: reference counter in the object in question. | ||
137 | * | ||
138 | * This should be used only for objects where we use RCU and | ||
139 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
140 | * reader-side critical section. | ||
141 | */ | ||
142 | static inline void rcuref_inc(atomic_t *rcuref) | ||
143 | { | ||
144 | unsigned long flags; | ||
145 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
146 | rcuref->counter += 1; | ||
147 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * rcuref_dec - decrement refcount for object. | ||
152 | * @rcuref: reference counter in the object in question. | ||
153 | * | ||
154 | * This should be used only for objects where we use RCU and | ||
155 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
156 | * reader-side critical section. | ||
157 | */ | ||
158 | static inline void rcuref_dec(atomic_t *rcuref) | ||
159 | { | ||
160 | unsigned long flags; | ||
161 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
162 | rcuref->counter -= 1; | ||
163 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
164 | } | ||
165 | |||
166 | /** | ||
167 | * rcuref_dec_and_test - decrement refcount for object and test | ||
168 | * @rcuref: reference counter in the object. | ||
169 | * @release: pointer to the function that will clean up the object | ||
170 | * when the last reference to the object is released. | ||
171 | * This pointer is required. | ||
172 | * | ||
173 | * Decrement the refcount, and if 0, return 1. Else return 0. | ||
174 | * | ||
175 | * This should be used only for objects where we use RCU and | ||
176 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
177 | * reader-side critical section. | ||
178 | */ | ||
179 | static inline int rcuref_dec_and_test(atomic_t *rcuref) | ||
180 | { | ||
181 | unsigned long flags; | ||
182 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
183 | rcuref->counter--; | ||
184 | if (!rcuref->counter) { | ||
185 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
186 | return 1; | ||
187 | } else { | ||
188 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
189 | return 0; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * rcuref_inc_lf - Take reference to an object of a lock-free collection | ||
195 | * by traversing a lock-free list/array. | ||
196 | * @rcuref: reference counter in the object in question. | ||
197 | * | ||
198 | * Try and increment the refcount by 1. The increment might fail if | ||
199 | * the reference counter has been through a 1 to 0 transition and | ||
200 | * object is no longer part of the lock-free list. | ||
201 | * Returns non-zero on successful increment and zero otherwise. | ||
202 | */ | ||
203 | static inline int rcuref_inc_lf(atomic_t *rcuref) | ||
204 | { | ||
205 | int ret; | ||
206 | unsigned long flags; | ||
207 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
208 | if (rcuref->counter) | ||
209 | ret = rcuref->counter++; | ||
210 | else | ||
211 | ret = 0; | ||
212 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | |||
217 | #endif /* !__HAVE_ARCH_CMPXCHG */ | ||
218 | |||
219 | #endif /* __KERNEL__ */ | ||
220 | #endif /* _RCUREF_H_ */ | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 17e458e17e2b..af00b10294cd 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -2097,7 +2097,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, | |||
2097 | b_blocknr_t, int for_unformatted); | 2097 | b_blocknr_t, int for_unformatted); |
2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, | 2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, |
2099 | int); | 2099 | int); |
2100 | extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | 2100 | static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, |
2101 | b_blocknr_t * new_blocknrs, | 2101 | b_blocknr_t * new_blocknrs, |
2102 | int amount_needed) | 2102 | int amount_needed) |
2103 | { | 2103 | { |
@@ -2113,7 +2113,7 @@ extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | |||
2113 | 0); | 2113 | 0); |
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | 2116 | static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle |
2117 | *th, struct inode *inode, | 2117 | *th, struct inode *inode, |
2118 | b_blocknr_t * new_blocknrs, | 2118 | b_blocknr_t * new_blocknrs, |
2119 | struct path *path, long block) | 2119 | struct path *path, long block) |
@@ -2130,7 +2130,7 @@ extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | |||
2130 | } | 2130 | } |
2131 | 2131 | ||
2132 | #ifdef REISERFS_PREALLOCATE | 2132 | #ifdef REISERFS_PREALLOCATE |
2133 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle | 2133 | static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle |
2134 | *th, struct inode *inode, | 2134 | *th, struct inode *inode, |
2135 | b_blocknr_t * new_blocknrs, | 2135 | b_blocknr_t * new_blocknrs, |
2136 | struct path *path, long block) | 2136 | struct path *path, long block) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ea1b5f32ec5c..4b83cb230006 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -114,6 +114,7 @@ extern unsigned long nr_iowait(void); | |||
114 | #define TASK_TRACED 8 | 114 | #define TASK_TRACED 8 |
115 | #define EXIT_ZOMBIE 16 | 115 | #define EXIT_ZOMBIE 16 |
116 | #define EXIT_DEAD 32 | 116 | #define EXIT_DEAD 32 |
117 | #define TASK_NONINTERACTIVE 64 | ||
117 | 118 | ||
118 | #define __set_task_state(tsk, state_value) \ | 119 | #define __set_task_state(tsk, state_value) \ |
119 | do { (tsk)->state = (state_value); } while (0) | 120 | do { (tsk)->state = (state_value); } while (0) |
@@ -202,6 +203,8 @@ extern int in_sched_functions(unsigned long addr); | |||
202 | 203 | ||
203 | #define MAX_SCHEDULE_TIMEOUT LONG_MAX | 204 | #define MAX_SCHEDULE_TIMEOUT LONG_MAX |
204 | extern signed long FASTCALL(schedule_timeout(signed long timeout)); | 205 | extern signed long FASTCALL(schedule_timeout(signed long timeout)); |
206 | extern signed long schedule_timeout_interruptible(signed long timeout); | ||
207 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | ||
205 | asmlinkage void schedule(void); | 208 | asmlinkage void schedule(void); |
206 | 209 | ||
207 | struct namespace; | 210 | struct namespace; |
@@ -604,6 +607,11 @@ extern int groups_search(struct group_info *group_info, gid_t grp); | |||
604 | #define GROUP_AT(gi, i) \ | 607 | #define GROUP_AT(gi, i) \ |
605 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) | 608 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) |
606 | 609 | ||
610 | #ifdef ARCH_HAS_PREFETCH_SWITCH_STACK | ||
611 | extern void prefetch_stack(struct task_struct*); | ||
612 | #else | ||
613 | static inline void prefetch_stack(struct task_struct *t) { } | ||
614 | #endif | ||
607 | 615 | ||
608 | struct audit_context; /* See audit.c */ | 616 | struct audit_context; /* See audit.c */ |
609 | struct mempolicy; | 617 | struct mempolicy; |
@@ -777,6 +785,7 @@ struct task_struct { | |||
777 | short il_next; | 785 | short il_next; |
778 | #endif | 786 | #endif |
779 | #ifdef CONFIG_CPUSETS | 787 | #ifdef CONFIG_CPUSETS |
788 | short cpuset_sem_nest_depth; | ||
780 | struct cpuset *cpuset; | 789 | struct cpuset *cpuset; |
781 | nodemask_t mems_allowed; | 790 | nodemask_t mems_allowed; |
782 | int cpuset_mems_generation; | 791 | int cpuset_mems_generation; |
diff --git a/include/linux/security.h b/include/linux/security.h index 7aab6ab7c57f..55b02e1c73f4 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -250,29 +250,37 @@ struct swap_info_struct; | |||
250 | * @inode contains the inode structure. | 250 | * @inode contains the inode structure. |
251 | * Deallocate the inode security structure and set @inode->i_security to | 251 | * Deallocate the inode security structure and set @inode->i_security to |
252 | * NULL. | 252 | * NULL. |
253 | * @inode_init_security: | ||
254 | * Obtain the security attribute name suffix and value to set on a newly | ||
255 | * created inode and set up the incore security field for the new inode. | ||
256 | * This hook is called by the fs code as part of the inode creation | ||
257 | * transaction and provides for atomic labeling of the inode, unlike | ||
258 | * the post_create/mkdir/... hooks called by the VFS. The hook function | ||
259 | * is expected to allocate the name and value via kmalloc, with the caller | ||
260 | * being responsible for calling kfree after using them. | ||
261 | * If the security module does not use security attributes or does | ||
262 | * not wish to put a security attribute on this particular inode, | ||
263 | * then it should return -EOPNOTSUPP to skip this processing. | ||
264 | * @inode contains the inode structure of the newly created inode. | ||
265 | * @dir contains the inode structure of the parent directory. | ||
266 | * @name will be set to the allocated name suffix (e.g. selinux). | ||
267 | * @value will be set to the allocated attribute value. | ||
268 | * @len will be set to the length of the value. | ||
269 | * Returns 0 if @name and @value have been successfully set, | ||
270 | * -EOPNOTSUPP if no security attribute is needed, or | ||
271 | * -ENOMEM on memory allocation failure. | ||
253 | * @inode_create: | 272 | * @inode_create: |
254 | * Check permission to create a regular file. | 273 | * Check permission to create a regular file. |
255 | * @dir contains inode structure of the parent of the new file. | 274 | * @dir contains inode structure of the parent of the new file. |
256 | * @dentry contains the dentry structure for the file to be created. | 275 | * @dentry contains the dentry structure for the file to be created. |
257 | * @mode contains the file mode of the file to be created. | 276 | * @mode contains the file mode of the file to be created. |
258 | * Return 0 if permission is granted. | 277 | * Return 0 if permission is granted. |
259 | * @inode_post_create: | ||
260 | * Set the security attributes on a newly created regular file. This hook | ||
261 | * is called after a file has been successfully created. | ||
262 | * @dir contains the inode structure of the parent directory of the new file. | ||
263 | * @dentry contains the the dentry structure for the newly created file. | ||
264 | * @mode contains the file mode. | ||
265 | * @inode_link: | 278 | * @inode_link: |
266 | * Check permission before creating a new hard link to a file. | 279 | * Check permission before creating a new hard link to a file. |
267 | * @old_dentry contains the dentry structure for an existing link to the file. | 280 | * @old_dentry contains the dentry structure for an existing link to the file. |
268 | * @dir contains the inode structure of the parent directory of the new link. | 281 | * @dir contains the inode structure of the parent directory of the new link. |
269 | * @new_dentry contains the dentry structure for the new link. | 282 | * @new_dentry contains the dentry structure for the new link. |
270 | * Return 0 if permission is granted. | 283 | * Return 0 if permission is granted. |
271 | * @inode_post_link: | ||
272 | * Set security attributes for a new hard link to a file. | ||
273 | * @old_dentry contains the dentry structure for the existing link. | ||
274 | * @dir contains the inode structure of the parent directory of the new file. | ||
275 | * @new_dentry contains the dentry structure for the new file link. | ||
276 | * @inode_unlink: | 284 | * @inode_unlink: |
277 | * Check the permission to remove a hard link to a file. | 285 | * Check the permission to remove a hard link to a file. |
278 | * @dir contains the inode structure of parent directory of the file. | 286 | * @dir contains the inode structure of parent directory of the file. |
@@ -284,13 +292,6 @@ struct swap_info_struct; | |||
284 | * @dentry contains the dentry structure of the symbolic link. | 292 | * @dentry contains the dentry structure of the symbolic link. |
285 | * @old_name contains the pathname of file. | 293 | * @old_name contains the pathname of file. |
286 | * Return 0 if permission is granted. | 294 | * Return 0 if permission is granted. |
287 | * @inode_post_symlink: | ||
288 | * @dir contains the inode structure of the parent directory of the new link. | ||
289 | * @dentry contains the dentry structure of new symbolic link. | ||
290 | * @old_name contains the pathname of file. | ||
291 | * Set security attributes for a newly created symbolic link. Note that | ||
292 | * @dentry->d_inode may be NULL, since the filesystem might not | ||
293 | * instantiate the dentry (e.g. NFS). | ||
294 | * @inode_mkdir: | 295 | * @inode_mkdir: |
295 | * Check permissions to create a new directory in the existing directory | 296 | * Check permissions to create a new directory in the existing directory |
296 | * associated with inode strcture @dir. | 297 | * associated with inode strcture @dir. |
@@ -298,11 +299,6 @@ struct swap_info_struct; | |||
298 | * @dentry contains the dentry structure of new directory. | 299 | * @dentry contains the dentry structure of new directory. |
299 | * @mode contains the mode of new directory. | 300 | * @mode contains the mode of new directory. |
300 | * Return 0 if permission is granted. | 301 | * Return 0 if permission is granted. |
301 | * @inode_post_mkdir: | ||
302 | * Set security attributes on a newly created directory. | ||
303 | * @dir contains the inode structure of parent of the directory to be created. | ||
304 | * @dentry contains the dentry structure of new directory. | ||
305 | * @mode contains the mode of new directory. | ||
306 | * @inode_rmdir: | 302 | * @inode_rmdir: |
307 | * Check the permission to remove a directory. | 303 | * Check the permission to remove a directory. |
308 | * @dir contains the inode structure of parent of the directory to be removed. | 304 | * @dir contains the inode structure of parent of the directory to be removed. |
@@ -318,13 +314,6 @@ struct swap_info_struct; | |||
318 | * @mode contains the mode of the new file. | 314 | * @mode contains the mode of the new file. |
319 | * @dev contains the the device number. | 315 | * @dev contains the the device number. |
320 | * Return 0 if permission is granted. | 316 | * Return 0 if permission is granted. |
321 | * @inode_post_mknod: | ||
322 | * Set security attributes on a newly created special file (or socket or | ||
323 | * fifo file created via the mknod system call). | ||
324 | * @dir contains the inode structure of parent of the new node. | ||
325 | * @dentry contains the dentry structure of the new node. | ||
326 | * @mode contains the mode of the new node. | ||
327 | * @dev contains the the device number. | ||
328 | * @inode_rename: | 317 | * @inode_rename: |
329 | * Check for permission to rename a file or directory. | 318 | * Check for permission to rename a file or directory. |
330 | * @old_dir contains the inode structure for parent of the old link. | 319 | * @old_dir contains the inode structure for parent of the old link. |
@@ -332,12 +321,6 @@ struct swap_info_struct; | |||
332 | * @new_dir contains the inode structure for parent of the new link. | 321 | * @new_dir contains the inode structure for parent of the new link. |
333 | * @new_dentry contains the dentry structure of the new link. | 322 | * @new_dentry contains the dentry structure of the new link. |
334 | * Return 0 if permission is granted. | 323 | * Return 0 if permission is granted. |
335 | * @inode_post_rename: | ||
336 | * Set security attributes on a renamed file or directory. | ||
337 | * @old_dir contains the inode structure for parent of the old link. | ||
338 | * @old_dentry contains the dentry structure of the old link. | ||
339 | * @new_dir contains the inode structure for parent of the new link. | ||
340 | * @new_dentry contains the dentry structure of the new link. | ||
341 | * @inode_readlink: | 324 | * @inode_readlink: |
342 | * Check the permission to read the symbolic link. | 325 | * Check the permission to read the symbolic link. |
343 | * @dentry contains the dentry structure for the file link. | 326 | * @dentry contains the dentry structure for the file link. |
@@ -1080,34 +1063,21 @@ struct security_operations { | |||
1080 | 1063 | ||
1081 | int (*inode_alloc_security) (struct inode *inode); | 1064 | int (*inode_alloc_security) (struct inode *inode); |
1082 | void (*inode_free_security) (struct inode *inode); | 1065 | void (*inode_free_security) (struct inode *inode); |
1066 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | ||
1067 | char **name, void **value, size_t *len); | ||
1083 | int (*inode_create) (struct inode *dir, | 1068 | int (*inode_create) (struct inode *dir, |
1084 | struct dentry *dentry, int mode); | 1069 | struct dentry *dentry, int mode); |
1085 | void (*inode_post_create) (struct inode *dir, | ||
1086 | struct dentry *dentry, int mode); | ||
1087 | int (*inode_link) (struct dentry *old_dentry, | 1070 | int (*inode_link) (struct dentry *old_dentry, |
1088 | struct inode *dir, struct dentry *new_dentry); | 1071 | struct inode *dir, struct dentry *new_dentry); |
1089 | void (*inode_post_link) (struct dentry *old_dentry, | ||
1090 | struct inode *dir, struct dentry *new_dentry); | ||
1091 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); | 1072 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); |
1092 | int (*inode_symlink) (struct inode *dir, | 1073 | int (*inode_symlink) (struct inode *dir, |
1093 | struct dentry *dentry, const char *old_name); | 1074 | struct dentry *dentry, const char *old_name); |
1094 | void (*inode_post_symlink) (struct inode *dir, | ||
1095 | struct dentry *dentry, | ||
1096 | const char *old_name); | ||
1097 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); | 1075 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); |
1098 | void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry, | ||
1099 | int mode); | ||
1100 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); | 1076 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); |
1101 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, | 1077 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, |
1102 | int mode, dev_t dev); | 1078 | int mode, dev_t dev); |
1103 | void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry, | ||
1104 | int mode, dev_t dev); | ||
1105 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, | 1079 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, |
1106 | struct inode *new_dir, struct dentry *new_dentry); | 1080 | struct inode *new_dir, struct dentry *new_dentry); |
1107 | void (*inode_post_rename) (struct inode *old_dir, | ||
1108 | struct dentry *old_dentry, | ||
1109 | struct inode *new_dir, | ||
1110 | struct dentry *new_dentry); | ||
1111 | int (*inode_readlink) (struct dentry *dentry); | 1081 | int (*inode_readlink) (struct dentry *dentry); |
1112 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1082 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
1113 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); | 1083 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); |
@@ -1442,6 +1412,17 @@ static inline void security_inode_free (struct inode *inode) | |||
1442 | return; | 1412 | return; |
1443 | security_ops->inode_free_security (inode); | 1413 | security_ops->inode_free_security (inode); |
1444 | } | 1414 | } |
1415 | |||
1416 | static inline int security_inode_init_security (struct inode *inode, | ||
1417 | struct inode *dir, | ||
1418 | char **name, | ||
1419 | void **value, | ||
1420 | size_t *len) | ||
1421 | { | ||
1422 | if (unlikely (IS_PRIVATE (inode))) | ||
1423 | return -EOPNOTSUPP; | ||
1424 | return security_ops->inode_init_security (inode, dir, name, value, len); | ||
1425 | } | ||
1445 | 1426 | ||
1446 | static inline int security_inode_create (struct inode *dir, | 1427 | static inline int security_inode_create (struct inode *dir, |
1447 | struct dentry *dentry, | 1428 | struct dentry *dentry, |
@@ -1452,15 +1433,6 @@ static inline int security_inode_create (struct inode *dir, | |||
1452 | return security_ops->inode_create (dir, dentry, mode); | 1433 | return security_ops->inode_create (dir, dentry, mode); |
1453 | } | 1434 | } |
1454 | 1435 | ||
1455 | static inline void security_inode_post_create (struct inode *dir, | ||
1456 | struct dentry *dentry, | ||
1457 | int mode) | ||
1458 | { | ||
1459 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
1460 | return; | ||
1461 | security_ops->inode_post_create (dir, dentry, mode); | ||
1462 | } | ||
1463 | |||
1464 | static inline int security_inode_link (struct dentry *old_dentry, | 1436 | static inline int security_inode_link (struct dentry *old_dentry, |
1465 | struct inode *dir, | 1437 | struct inode *dir, |
1466 | struct dentry *new_dentry) | 1438 | struct dentry *new_dentry) |
@@ -1470,15 +1442,6 @@ static inline int security_inode_link (struct dentry *old_dentry, | |||
1470 | return security_ops->inode_link (old_dentry, dir, new_dentry); | 1442 | return security_ops->inode_link (old_dentry, dir, new_dentry); |
1471 | } | 1443 | } |
1472 | 1444 | ||
1473 | static inline void security_inode_post_link (struct dentry *old_dentry, | ||
1474 | struct inode *dir, | ||
1475 | struct dentry *new_dentry) | ||
1476 | { | ||
1477 | if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode))) | ||
1478 | return; | ||
1479 | security_ops->inode_post_link (old_dentry, dir, new_dentry); | ||
1480 | } | ||
1481 | |||
1482 | static inline int security_inode_unlink (struct inode *dir, | 1445 | static inline int security_inode_unlink (struct inode *dir, |
1483 | struct dentry *dentry) | 1446 | struct dentry *dentry) |
1484 | { | 1447 | { |
@@ -1496,15 +1459,6 @@ static inline int security_inode_symlink (struct inode *dir, | |||
1496 | return security_ops->inode_symlink (dir, dentry, old_name); | 1459 | return security_ops->inode_symlink (dir, dentry, old_name); |
1497 | } | 1460 | } |
1498 | 1461 | ||
1499 | static inline void security_inode_post_symlink (struct inode *dir, | ||
1500 | struct dentry *dentry, | ||
1501 | const char *old_name) | ||
1502 | { | ||
1503 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
1504 | return; | ||
1505 | security_ops->inode_post_symlink (dir, dentry, old_name); | ||
1506 | } | ||
1507 | |||
1508 | static inline int security_inode_mkdir (struct inode *dir, | 1462 | static inline int security_inode_mkdir (struct inode *dir, |
1509 | struct dentry *dentry, | 1463 | struct dentry *dentry, |
1510 | int mode) | 1464 | int mode) |
@@ -1514,15 +1468,6 @@ static inline int security_inode_mkdir (struct inode *dir, | |||
1514 | return security_ops->inode_mkdir (dir, dentry, mode); | 1468 | return security_ops->inode_mkdir (dir, dentry, mode); |
1515 | } | 1469 | } |
1516 | 1470 | ||
1517 | static inline void security_inode_post_mkdir (struct inode *dir, | ||
1518 | struct dentry *dentry, | ||
1519 | int mode) | ||
1520 | { | ||
1521 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
1522 | return; | ||
1523 | security_ops->inode_post_mkdir (dir, dentry, mode); | ||
1524 | } | ||
1525 | |||
1526 | static inline int security_inode_rmdir (struct inode *dir, | 1471 | static inline int security_inode_rmdir (struct inode *dir, |
1527 | struct dentry *dentry) | 1472 | struct dentry *dentry) |
1528 | { | 1473 | { |
@@ -1540,15 +1485,6 @@ static inline int security_inode_mknod (struct inode *dir, | |||
1540 | return security_ops->inode_mknod (dir, dentry, mode, dev); | 1485 | return security_ops->inode_mknod (dir, dentry, mode, dev); |
1541 | } | 1486 | } |
1542 | 1487 | ||
1543 | static inline void security_inode_post_mknod (struct inode *dir, | ||
1544 | struct dentry *dentry, | ||
1545 | int mode, dev_t dev) | ||
1546 | { | ||
1547 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
1548 | return; | ||
1549 | security_ops->inode_post_mknod (dir, dentry, mode, dev); | ||
1550 | } | ||
1551 | |||
1552 | static inline int security_inode_rename (struct inode *old_dir, | 1488 | static inline int security_inode_rename (struct inode *old_dir, |
1553 | struct dentry *old_dentry, | 1489 | struct dentry *old_dentry, |
1554 | struct inode *new_dir, | 1490 | struct inode *new_dir, |
@@ -1561,18 +1497,6 @@ static inline int security_inode_rename (struct inode *old_dir, | |||
1561 | new_dir, new_dentry); | 1497 | new_dir, new_dentry); |
1562 | } | 1498 | } |
1563 | 1499 | ||
1564 | static inline void security_inode_post_rename (struct inode *old_dir, | ||
1565 | struct dentry *old_dentry, | ||
1566 | struct inode *new_dir, | ||
1567 | struct dentry *new_dentry) | ||
1568 | { | ||
1569 | if (unlikely (IS_PRIVATE (old_dentry->d_inode) || | ||
1570 | (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode)))) | ||
1571 | return; | ||
1572 | security_ops->inode_post_rename (old_dir, old_dentry, | ||
1573 | new_dir, new_dentry); | ||
1574 | } | ||
1575 | |||
1576 | static inline int security_inode_readlink (struct dentry *dentry) | 1500 | static inline int security_inode_readlink (struct dentry *dentry) |
1577 | { | 1501 | { |
1578 | if (unlikely (IS_PRIVATE (dentry->d_inode))) | 1502 | if (unlikely (IS_PRIVATE (dentry->d_inode))) |
@@ -2171,6 +2095,15 @@ static inline int security_inode_alloc (struct inode *inode) | |||
2171 | 2095 | ||
2172 | static inline void security_inode_free (struct inode *inode) | 2096 | static inline void security_inode_free (struct inode *inode) |
2173 | { } | 2097 | { } |
2098 | |||
2099 | static inline int security_inode_init_security (struct inode *inode, | ||
2100 | struct inode *dir, | ||
2101 | char **name, | ||
2102 | void **value, | ||
2103 | size_t *len) | ||
2104 | { | ||
2105 | return -EOPNOTSUPP; | ||
2106 | } | ||
2174 | 2107 | ||
2175 | static inline int security_inode_create (struct inode *dir, | 2108 | static inline int security_inode_create (struct inode *dir, |
2176 | struct dentry *dentry, | 2109 | struct dentry *dentry, |
@@ -2179,11 +2112,6 @@ static inline int security_inode_create (struct inode *dir, | |||
2179 | return 0; | 2112 | return 0; |
2180 | } | 2113 | } |
2181 | 2114 | ||
2182 | static inline void security_inode_post_create (struct inode *dir, | ||
2183 | struct dentry *dentry, | ||
2184 | int mode) | ||
2185 | { } | ||
2186 | |||
2187 | static inline int security_inode_link (struct dentry *old_dentry, | 2115 | static inline int security_inode_link (struct dentry *old_dentry, |
2188 | struct inode *dir, | 2116 | struct inode *dir, |
2189 | struct dentry *new_dentry) | 2117 | struct dentry *new_dentry) |
@@ -2191,11 +2119,6 @@ static inline int security_inode_link (struct dentry *old_dentry, | |||
2191 | return 0; | 2119 | return 0; |
2192 | } | 2120 | } |
2193 | 2121 | ||
2194 | static inline void security_inode_post_link (struct dentry *old_dentry, | ||
2195 | struct inode *dir, | ||
2196 | struct dentry *new_dentry) | ||
2197 | { } | ||
2198 | |||
2199 | static inline int security_inode_unlink (struct inode *dir, | 2122 | static inline int security_inode_unlink (struct inode *dir, |
2200 | struct dentry *dentry) | 2123 | struct dentry *dentry) |
2201 | { | 2124 | { |
@@ -2209,11 +2132,6 @@ static inline int security_inode_symlink (struct inode *dir, | |||
2209 | return 0; | 2132 | return 0; |
2210 | } | 2133 | } |
2211 | 2134 | ||
2212 | static inline void security_inode_post_symlink (struct inode *dir, | ||
2213 | struct dentry *dentry, | ||
2214 | const char *old_name) | ||
2215 | { } | ||
2216 | |||
2217 | static inline int security_inode_mkdir (struct inode *dir, | 2135 | static inline int security_inode_mkdir (struct inode *dir, |
2218 | struct dentry *dentry, | 2136 | struct dentry *dentry, |
2219 | int mode) | 2137 | int mode) |
@@ -2221,11 +2139,6 @@ static inline int security_inode_mkdir (struct inode *dir, | |||
2221 | return 0; | 2139 | return 0; |
2222 | } | 2140 | } |
2223 | 2141 | ||
2224 | static inline void security_inode_post_mkdir (struct inode *dir, | ||
2225 | struct dentry *dentry, | ||
2226 | int mode) | ||
2227 | { } | ||
2228 | |||
2229 | static inline int security_inode_rmdir (struct inode *dir, | 2142 | static inline int security_inode_rmdir (struct inode *dir, |
2230 | struct dentry *dentry) | 2143 | struct dentry *dentry) |
2231 | { | 2144 | { |
@@ -2239,11 +2152,6 @@ static inline int security_inode_mknod (struct inode *dir, | |||
2239 | return 0; | 2152 | return 0; |
2240 | } | 2153 | } |
2241 | 2154 | ||
2242 | static inline void security_inode_post_mknod (struct inode *dir, | ||
2243 | struct dentry *dentry, | ||
2244 | int mode, dev_t dev) | ||
2245 | { } | ||
2246 | |||
2247 | static inline int security_inode_rename (struct inode *old_dir, | 2155 | static inline int security_inode_rename (struct inode *old_dir, |
2248 | struct dentry *old_dentry, | 2156 | struct dentry *old_dentry, |
2249 | struct inode *new_dir, | 2157 | struct inode *new_dir, |
@@ -2252,12 +2160,6 @@ static inline int security_inode_rename (struct inode *old_dir, | |||
2252 | return 0; | 2160 | return 0; |
2253 | } | 2161 | } |
2254 | 2162 | ||
2255 | static inline void security_inode_post_rename (struct inode *old_dir, | ||
2256 | struct dentry *old_dentry, | ||
2257 | struct inode *new_dir, | ||
2258 | struct dentry *new_dentry) | ||
2259 | { } | ||
2260 | |||
2261 | static inline int security_inode_readlink (struct dentry *dentry) | 2163 | static inline int security_inode_readlink (struct dentry *dentry) |
2262 | { | 2164 | { |
2263 | return 0; | 2165 | return 0; |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 42a6bea58af3..1f356f3bbc64 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -118,7 +118,8 @@ extern void kfree(const void *); | |||
118 | extern unsigned int ksize(const void *); | 118 | extern unsigned int ksize(const void *); |
119 | 119 | ||
120 | #ifdef CONFIG_NUMA | 120 | #ifdef CONFIG_NUMA |
121 | extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); | 121 | extern void *kmem_cache_alloc_node(kmem_cache_t *, |
122 | unsigned int __nocast flags, int node); | ||
122 | extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); | 123 | extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); |
123 | #else | 124 | #else |
124 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) | 125 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index d6ba068719b6..cdc99a27840d 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -2,7 +2,48 @@ | |||
2 | #define __LINUX_SPINLOCK_H | 2 | #define __LINUX_SPINLOCK_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * include/linux/spinlock.h - generic locking declarations | 5 | * include/linux/spinlock.h - generic spinlock/rwlock declarations |
6 | * | ||
7 | * here's the role of the various spinlock/rwlock related include files: | ||
8 | * | ||
9 | * on SMP builds: | ||
10 | * | ||
11 | * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the | ||
12 | * initializers | ||
13 | * | ||
14 | * linux/spinlock_types.h: | ||
15 | * defines the generic type and initializers | ||
16 | * | ||
17 | * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel | ||
18 | * implementations, mostly inline assembly code | ||
19 | * | ||
20 | * (also included on UP-debug builds:) | ||
21 | * | ||
22 | * linux/spinlock_api_smp.h: | ||
23 | * contains the prototypes for the _spin_*() APIs. | ||
24 | * | ||
25 | * linux/spinlock.h: builds the final spin_*() APIs. | ||
26 | * | ||
27 | * on UP builds: | ||
28 | * | ||
29 | * linux/spinlock_type_up.h: | ||
30 | * contains the generic, simplified UP spinlock type. | ||
31 | * (which is an empty structure on non-debug builds) | ||
32 | * | ||
33 | * linux/spinlock_types.h: | ||
34 | * defines the generic type and initializers | ||
35 | * | ||
36 | * linux/spinlock_up.h: | ||
37 | * contains the __raw_spin_*()/etc. version of UP | ||
38 | * builds. (which are NOPs on non-debug, non-preempt | ||
39 | * builds) | ||
40 | * | ||
41 | * (included on UP-non-debug builds:) | ||
42 | * | ||
43 | * linux/spinlock_api_up.h: | ||
44 | * builds the _spin_*() APIs. | ||
45 | * | ||
46 | * linux/spinlock.h: builds the final spin_*() APIs. | ||
6 | */ | 47 | */ |
7 | 48 | ||
8 | #include <linux/config.h> | 49 | #include <linux/config.h> |
@@ -13,7 +54,6 @@ | |||
13 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
14 | #include <linux/stringify.h> | 55 | #include <linux/stringify.h> |
15 | 56 | ||
16 | #include <asm/processor.h> /* for cpu relax */ | ||
17 | #include <asm/system.h> | 57 | #include <asm/system.h> |
18 | 58 | ||
19 | /* | 59 | /* |
@@ -35,423 +75,84 @@ | |||
35 | #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) | 75 | #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) |
36 | 76 | ||
37 | /* | 77 | /* |
38 | * If CONFIG_SMP is set, pull in the _raw_* definitions | 78 | * Pull the raw_spinlock_t and raw_rwlock_t definitions: |
39 | */ | 79 | */ |
40 | #ifdef CONFIG_SMP | 80 | #include <linux/spinlock_types.h> |
41 | |||
42 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | ||
43 | #include <asm/spinlock.h> | ||
44 | |||
45 | int __lockfunc _spin_trylock(spinlock_t *lock); | ||
46 | int __lockfunc _read_trylock(rwlock_t *lock); | ||
47 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
48 | |||
49 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); | ||
50 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
51 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
52 | |||
53 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); | ||
54 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
55 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
56 | |||
57 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) __acquires(spinlock_t); | ||
58 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); | ||
59 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); | ||
60 | |||
61 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); | ||
62 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); | ||
63 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
64 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
65 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
66 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
67 | |||
68 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) __releases(spinlock_t); | ||
69 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); | ||
70 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); | ||
71 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); | ||
72 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
73 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
74 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); | ||
75 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
76 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
77 | |||
78 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
79 | int __lockfunc generic_raw_read_trylock(rwlock_t *lock); | ||
80 | int in_lock_functions(unsigned long addr); | ||
81 | |||
82 | #else | ||
83 | 81 | ||
84 | #define in_lock_functions(ADDR) 0 | 82 | extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock); |
85 | 83 | ||
86 | #if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK) | ||
87 | # define _atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic) | ||
88 | # define ATOMIC_DEC_AND_LOCK | ||
89 | #endif | ||
90 | |||
91 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
92 | |||
93 | #define SPINLOCK_MAGIC 0x1D244B3C | ||
94 | typedef struct { | ||
95 | unsigned long magic; | ||
96 | volatile unsigned long lock; | ||
97 | volatile unsigned int babble; | ||
98 | const char *module; | ||
99 | char *owner; | ||
100 | int oline; | ||
101 | } spinlock_t; | ||
102 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { SPINLOCK_MAGIC, 0, 10, __FILE__ , NULL, 0} | ||
103 | |||
104 | #define spin_lock_init(x) \ | ||
105 | do { \ | ||
106 | (x)->magic = SPINLOCK_MAGIC; \ | ||
107 | (x)->lock = 0; \ | ||
108 | (x)->babble = 5; \ | ||
109 | (x)->module = __FILE__; \ | ||
110 | (x)->owner = NULL; \ | ||
111 | (x)->oline = 0; \ | ||
112 | } while (0) | ||
113 | |||
114 | #define CHECK_LOCK(x) \ | ||
115 | do { \ | ||
116 | if ((x)->magic != SPINLOCK_MAGIC) { \ | ||
117 | printk(KERN_ERR "%s:%d: spin_is_locked on uninitialized spinlock %p.\n", \ | ||
118 | __FILE__, __LINE__, (x)); \ | ||
119 | } \ | ||
120 | } while(0) | ||
121 | |||
122 | #define _raw_spin_lock(x) \ | ||
123 | do { \ | ||
124 | CHECK_LOCK(x); \ | ||
125 | if ((x)->lock&&(x)->babble) { \ | ||
126 | (x)->babble--; \ | ||
127 | printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \ | ||
128 | __FILE__,__LINE__, (x)->module, \ | ||
129 | (x), (x)->owner, (x)->oline); \ | ||
130 | } \ | ||
131 | (x)->lock = 1; \ | ||
132 | (x)->owner = __FILE__; \ | ||
133 | (x)->oline = __LINE__; \ | ||
134 | } while (0) | ||
135 | |||
136 | /* without debugging, spin_is_locked on UP always says | ||
137 | * FALSE. --> printk if already locked. */ | ||
138 | #define spin_is_locked(x) \ | ||
139 | ({ \ | ||
140 | CHECK_LOCK(x); \ | ||
141 | if ((x)->lock&&(x)->babble) { \ | ||
142 | (x)->babble--; \ | ||
143 | printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \ | ||
144 | __FILE__,__LINE__, (x)->module, \ | ||
145 | (x), (x)->owner, (x)->oline); \ | ||
146 | } \ | ||
147 | 0; \ | ||
148 | }) | ||
149 | |||
150 | /* with debugging, assert_spin_locked() on UP does check | ||
151 | * the lock value properly */ | ||
152 | #define assert_spin_locked(x) \ | ||
153 | ({ \ | ||
154 | CHECK_LOCK(x); \ | ||
155 | BUG_ON(!(x)->lock); \ | ||
156 | }) | ||
157 | |||
158 | /* without debugging, spin_trylock on UP always says | ||
159 | * TRUE. --> printk if already locked. */ | ||
160 | #define _raw_spin_trylock(x) \ | ||
161 | ({ \ | ||
162 | CHECK_LOCK(x); \ | ||
163 | if ((x)->lock&&(x)->babble) { \ | ||
164 | (x)->babble--; \ | ||
165 | printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \ | ||
166 | __FILE__,__LINE__, (x)->module, \ | ||
167 | (x), (x)->owner, (x)->oline); \ | ||
168 | } \ | ||
169 | (x)->lock = 1; \ | ||
170 | (x)->owner = __FILE__; \ | ||
171 | (x)->oline = __LINE__; \ | ||
172 | 1; \ | ||
173 | }) | ||
174 | |||
175 | #define spin_unlock_wait(x) \ | ||
176 | do { \ | ||
177 | CHECK_LOCK(x); \ | ||
178 | if ((x)->lock&&(x)->babble) { \ | ||
179 | (x)->babble--; \ | ||
180 | printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \ | ||
181 | __FILE__,__LINE__, (x)->module, (x), \ | ||
182 | (x)->owner, (x)->oline); \ | ||
183 | }\ | ||
184 | } while (0) | ||
185 | |||
186 | #define _raw_spin_unlock(x) \ | ||
187 | do { \ | ||
188 | CHECK_LOCK(x); \ | ||
189 | if (!(x)->lock&&(x)->babble) { \ | ||
190 | (x)->babble--; \ | ||
191 | printk("%s:%d: spin_unlock(%s:%p) not locked\n", \ | ||
192 | __FILE__,__LINE__, (x)->module, (x));\ | ||
193 | } \ | ||
194 | (x)->lock = 0; \ | ||
195 | } while (0) | ||
196 | #else | ||
197 | /* | 84 | /* |
198 | * gcc versions before ~2.95 have a nasty bug with empty initializers. | 85 | * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): |
199 | */ | 86 | */ |
200 | #if (__GNUC__ > 2) | 87 | #if defined(CONFIG_SMP) |
201 | typedef struct { } spinlock_t; | 88 | # include <asm/spinlock.h> |
202 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { } | ||
203 | #else | 89 | #else |
204 | typedef struct { int gcc_is_buggy; } spinlock_t; | 90 | # include <linux/spinlock_up.h> |
205 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
206 | #endif | 91 | #endif |
207 | 92 | ||
93 | #define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) | ||
94 | #define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) | ||
95 | |||
96 | #define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) | ||
97 | |||
98 | /** | ||
99 | * spin_unlock_wait - wait until the spinlock gets unlocked | ||
100 | * @lock: the spinlock in question. | ||
101 | */ | ||
102 | #define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) | ||
103 | |||
208 | /* | 104 | /* |
209 | * If CONFIG_SMP is unset, declare the _raw_* definitions as nops | 105 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: |
210 | */ | 106 | */ |
211 | #define spin_lock_init(lock) do { (void)(lock); } while(0) | 107 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
212 | #define _raw_spin_lock(lock) do { (void)(lock); } while(0) | 108 | # include <linux/spinlock_api_smp.h> |
213 | #define spin_is_locked(lock) ((void)(lock), 0) | ||
214 | #define assert_spin_locked(lock) do { (void)(lock); } while(0) | ||
215 | #define _raw_spin_trylock(lock) (((void)(lock), 1)) | ||
216 | #define spin_unlock_wait(lock) (void)(lock) | ||
217 | #define _raw_spin_unlock(lock) do { (void)(lock); } while(0) | ||
218 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
219 | |||
220 | /* RW spinlocks: No debug version */ | ||
221 | |||
222 | #if (__GNUC__ > 2) | ||
223 | typedef struct { } rwlock_t; | ||
224 | #define RW_LOCK_UNLOCKED (rwlock_t) { } | ||
225 | #else | 109 | #else |
226 | typedef struct { int gcc_is_buggy; } rwlock_t; | 110 | # include <linux/spinlock_api_up.h> |
227 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
228 | #endif | 111 | #endif |
229 | 112 | ||
230 | #define rwlock_init(lock) do { (void)(lock); } while(0) | 113 | #ifdef CONFIG_DEBUG_SPINLOCK |
231 | #define _raw_read_lock(lock) do { (void)(lock); } while(0) | 114 | extern void _raw_spin_lock(spinlock_t *lock); |
232 | #define _raw_read_unlock(lock) do { (void)(lock); } while(0) | 115 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) |
233 | #define _raw_write_lock(lock) do { (void)(lock); } while(0) | 116 | extern int _raw_spin_trylock(spinlock_t *lock); |
234 | #define _raw_write_unlock(lock) do { (void)(lock); } while(0) | 117 | extern void _raw_spin_unlock(spinlock_t *lock); |
235 | #define read_can_lock(lock) (((void)(lock), 1)) | 118 | |
236 | #define write_can_lock(lock) (((void)(lock), 1)) | 119 | extern void _raw_read_lock(rwlock_t *lock); |
237 | #define _raw_read_trylock(lock) ({ (void)(lock); (1); }) | 120 | extern int _raw_read_trylock(rwlock_t *lock); |
238 | #define _raw_write_trylock(lock) ({ (void)(lock); (1); }) | 121 | extern void _raw_read_unlock(rwlock_t *lock); |
239 | 122 | extern void _raw_write_lock(rwlock_t *lock); | |
240 | #define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \ | 123 | extern int _raw_write_trylock(rwlock_t *lock); |
241 | 1 : ({preempt_enable(); 0;});}) | 124 | extern void _raw_write_unlock(rwlock_t *lock); |
242 | 125 | #else | |
243 | #define _read_trylock(lock) ({preempt_disable();_raw_read_trylock(lock) ? \ | 126 | # define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) |
244 | 1 : ({preempt_enable(); 0;});}) | 127 | # define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) |
245 | 128 | # define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) | |
246 | #define _write_trylock(lock) ({preempt_disable(); _raw_write_trylock(lock) ? \ | 129 | # define _raw_spin_lock_flags(lock, flags) \ |
247 | 1 : ({preempt_enable(); 0;});}) | 130 | __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) |
248 | 131 | # define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) | |
249 | #define _spin_trylock_bh(lock) ({preempt_disable(); local_bh_disable(); \ | 132 | # define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) |
250 | _raw_spin_trylock(lock) ? \ | 133 | # define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) |
251 | 1 : ({preempt_enable_no_resched(); local_bh_enable(); 0;});}) | 134 | # define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) |
252 | 135 | # define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) | |
253 | #define _spin_lock(lock) \ | 136 | # define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) |
254 | do { \ | 137 | #endif |
255 | preempt_disable(); \ | ||
256 | _raw_spin_lock(lock); \ | ||
257 | __acquire(lock); \ | ||
258 | } while(0) | ||
259 | |||
260 | #define _write_lock(lock) \ | ||
261 | do { \ | ||
262 | preempt_disable(); \ | ||
263 | _raw_write_lock(lock); \ | ||
264 | __acquire(lock); \ | ||
265 | } while(0) | ||
266 | |||
267 | #define _read_lock(lock) \ | ||
268 | do { \ | ||
269 | preempt_disable(); \ | ||
270 | _raw_read_lock(lock); \ | ||
271 | __acquire(lock); \ | ||
272 | } while(0) | ||
273 | |||
274 | #define _spin_unlock(lock) \ | ||
275 | do { \ | ||
276 | _raw_spin_unlock(lock); \ | ||
277 | preempt_enable(); \ | ||
278 | __release(lock); \ | ||
279 | } while (0) | ||
280 | |||
281 | #define _write_unlock(lock) \ | ||
282 | do { \ | ||
283 | _raw_write_unlock(lock); \ | ||
284 | preempt_enable(); \ | ||
285 | __release(lock); \ | ||
286 | } while(0) | ||
287 | |||
288 | #define _read_unlock(lock) \ | ||
289 | do { \ | ||
290 | _raw_read_unlock(lock); \ | ||
291 | preempt_enable(); \ | ||
292 | __release(lock); \ | ||
293 | } while(0) | ||
294 | |||
295 | #define _spin_lock_irqsave(lock, flags) \ | ||
296 | do { \ | ||
297 | local_irq_save(flags); \ | ||
298 | preempt_disable(); \ | ||
299 | _raw_spin_lock(lock); \ | ||
300 | __acquire(lock); \ | ||
301 | } while (0) | ||
302 | |||
303 | #define _spin_lock_irq(lock) \ | ||
304 | do { \ | ||
305 | local_irq_disable(); \ | ||
306 | preempt_disable(); \ | ||
307 | _raw_spin_lock(lock); \ | ||
308 | __acquire(lock); \ | ||
309 | } while (0) | ||
310 | |||
311 | #define _spin_lock_bh(lock) \ | ||
312 | do { \ | ||
313 | local_bh_disable(); \ | ||
314 | preempt_disable(); \ | ||
315 | _raw_spin_lock(lock); \ | ||
316 | __acquire(lock); \ | ||
317 | } while (0) | ||
318 | |||
319 | #define _read_lock_irqsave(lock, flags) \ | ||
320 | do { \ | ||
321 | local_irq_save(flags); \ | ||
322 | preempt_disable(); \ | ||
323 | _raw_read_lock(lock); \ | ||
324 | __acquire(lock); \ | ||
325 | } while (0) | ||
326 | |||
327 | #define _read_lock_irq(lock) \ | ||
328 | do { \ | ||
329 | local_irq_disable(); \ | ||
330 | preempt_disable(); \ | ||
331 | _raw_read_lock(lock); \ | ||
332 | __acquire(lock); \ | ||
333 | } while (0) | ||
334 | |||
335 | #define _read_lock_bh(lock) \ | ||
336 | do { \ | ||
337 | local_bh_disable(); \ | ||
338 | preempt_disable(); \ | ||
339 | _raw_read_lock(lock); \ | ||
340 | __acquire(lock); \ | ||
341 | } while (0) | ||
342 | |||
343 | #define _write_lock_irqsave(lock, flags) \ | ||
344 | do { \ | ||
345 | local_irq_save(flags); \ | ||
346 | preempt_disable(); \ | ||
347 | _raw_write_lock(lock); \ | ||
348 | __acquire(lock); \ | ||
349 | } while (0) | ||
350 | 138 | ||
351 | #define _write_lock_irq(lock) \ | 139 | #define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) |
352 | do { \ | 140 | #define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) |
353 | local_irq_disable(); \ | ||
354 | preempt_disable(); \ | ||
355 | _raw_write_lock(lock); \ | ||
356 | __acquire(lock); \ | ||
357 | } while (0) | ||
358 | |||
359 | #define _write_lock_bh(lock) \ | ||
360 | do { \ | ||
361 | local_bh_disable(); \ | ||
362 | preempt_disable(); \ | ||
363 | _raw_write_lock(lock); \ | ||
364 | __acquire(lock); \ | ||
365 | } while (0) | ||
366 | |||
367 | #define _spin_unlock_irqrestore(lock, flags) \ | ||
368 | do { \ | ||
369 | _raw_spin_unlock(lock); \ | ||
370 | local_irq_restore(flags); \ | ||
371 | preempt_enable(); \ | ||
372 | __release(lock); \ | ||
373 | } while (0) | ||
374 | |||
375 | #define _spin_unlock_irq(lock) \ | ||
376 | do { \ | ||
377 | _raw_spin_unlock(lock); \ | ||
378 | local_irq_enable(); \ | ||
379 | preempt_enable(); \ | ||
380 | __release(lock); \ | ||
381 | } while (0) | ||
382 | |||
383 | #define _spin_unlock_bh(lock) \ | ||
384 | do { \ | ||
385 | _raw_spin_unlock(lock); \ | ||
386 | preempt_enable_no_resched(); \ | ||
387 | local_bh_enable(); \ | ||
388 | __release(lock); \ | ||
389 | } while (0) | ||
390 | |||
391 | #define _write_unlock_bh(lock) \ | ||
392 | do { \ | ||
393 | _raw_write_unlock(lock); \ | ||
394 | preempt_enable_no_resched(); \ | ||
395 | local_bh_enable(); \ | ||
396 | __release(lock); \ | ||
397 | } while (0) | ||
398 | |||
399 | #define _read_unlock_irqrestore(lock, flags) \ | ||
400 | do { \ | ||
401 | _raw_read_unlock(lock); \ | ||
402 | local_irq_restore(flags); \ | ||
403 | preempt_enable(); \ | ||
404 | __release(lock); \ | ||
405 | } while (0) | ||
406 | |||
407 | #define _write_unlock_irqrestore(lock, flags) \ | ||
408 | do { \ | ||
409 | _raw_write_unlock(lock); \ | ||
410 | local_irq_restore(flags); \ | ||
411 | preempt_enable(); \ | ||
412 | __release(lock); \ | ||
413 | } while (0) | ||
414 | |||
415 | #define _read_unlock_irq(lock) \ | ||
416 | do { \ | ||
417 | _raw_read_unlock(lock); \ | ||
418 | local_irq_enable(); \ | ||
419 | preempt_enable(); \ | ||
420 | __release(lock); \ | ||
421 | } while (0) | ||
422 | |||
423 | #define _read_unlock_bh(lock) \ | ||
424 | do { \ | ||
425 | _raw_read_unlock(lock); \ | ||
426 | preempt_enable_no_resched(); \ | ||
427 | local_bh_enable(); \ | ||
428 | __release(lock); \ | ||
429 | } while (0) | ||
430 | |||
431 | #define _write_unlock_irq(lock) \ | ||
432 | do { \ | ||
433 | _raw_write_unlock(lock); \ | ||
434 | local_irq_enable(); \ | ||
435 | preempt_enable(); \ | ||
436 | __release(lock); \ | ||
437 | } while (0) | ||
438 | |||
439 | #endif /* !SMP */ | ||
440 | 141 | ||
441 | /* | 142 | /* |
442 | * Define the various spin_lock and rw_lock methods. Note we define these | 143 | * Define the various spin_lock and rw_lock methods. Note we define these |
443 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | 144 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various |
444 | * methods are defined as nops in the case they are not required. | 145 | * methods are defined as nops in the case they are not required. |
445 | */ | 146 | */ |
446 | #define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) | 147 | #define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) |
447 | #define read_trylock(lock) __cond_lock(_read_trylock(lock)) | 148 | #define read_trylock(lock) __cond_lock(_read_trylock(lock)) |
448 | #define write_trylock(lock) __cond_lock(_write_trylock(lock)) | 149 | #define write_trylock(lock) __cond_lock(_write_trylock(lock)) |
449 | 150 | ||
450 | #define spin_lock(lock) _spin_lock(lock) | 151 | #define spin_lock(lock) _spin_lock(lock) |
451 | #define write_lock(lock) _write_lock(lock) | 152 | #define write_lock(lock) _write_lock(lock) |
452 | #define read_lock(lock) _read_lock(lock) | 153 | #define read_lock(lock) _read_lock(lock) |
453 | 154 | ||
454 | #ifdef CONFIG_SMP | 155 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
455 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) | 156 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) |
456 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) | 157 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) |
457 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) | 158 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) |
@@ -470,137 +171,59 @@ do { \ | |||
470 | #define write_lock_irq(lock) _write_lock_irq(lock) | 171 | #define write_lock_irq(lock) _write_lock_irq(lock) |
471 | #define write_lock_bh(lock) _write_lock_bh(lock) | 172 | #define write_lock_bh(lock) _write_lock_bh(lock) |
472 | 173 | ||
473 | #define spin_unlock(lock) _spin_unlock(lock) | 174 | #define spin_unlock(lock) _spin_unlock(lock) |
474 | #define write_unlock(lock) _write_unlock(lock) | 175 | #define write_unlock(lock) _write_unlock(lock) |
475 | #define read_unlock(lock) _read_unlock(lock) | 176 | #define read_unlock(lock) _read_unlock(lock) |
476 | 177 | ||
477 | #define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) | 178 | #define spin_unlock_irqrestore(lock, flags) \ |
179 | _spin_unlock_irqrestore(lock, flags) | ||
478 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) | 180 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) |
479 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | 181 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) |
480 | 182 | ||
481 | #define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) | 183 | #define read_unlock_irqrestore(lock, flags) \ |
482 | #define read_unlock_irq(lock) _read_unlock_irq(lock) | 184 | _read_unlock_irqrestore(lock, flags) |
483 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | 185 | #define read_unlock_irq(lock) _read_unlock_irq(lock) |
186 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | ||
484 | 187 | ||
485 | #define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) | 188 | #define write_unlock_irqrestore(lock, flags) \ |
486 | #define write_unlock_irq(lock) _write_unlock_irq(lock) | 189 | _write_unlock_irqrestore(lock, flags) |
487 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | 190 | #define write_unlock_irq(lock) _write_unlock_irq(lock) |
191 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | ||
488 | 192 | ||
489 | #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) | 193 | #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) |
490 | 194 | ||
491 | #define spin_trylock_irq(lock) \ | 195 | #define spin_trylock_irq(lock) \ |
492 | ({ \ | 196 | ({ \ |
493 | local_irq_disable(); \ | 197 | local_irq_disable(); \ |
494 | _spin_trylock(lock) ? \ | 198 | _spin_trylock(lock) ? \ |
495 | 1 : ({local_irq_enable(); 0; }); \ | 199 | 1 : ({ local_irq_enable(); 0; }); \ |
496 | }) | 200 | }) |
497 | 201 | ||
498 | #define spin_trylock_irqsave(lock, flags) \ | 202 | #define spin_trylock_irqsave(lock, flags) \ |
499 | ({ \ | 203 | ({ \ |
500 | local_irq_save(flags); \ | 204 | local_irq_save(flags); \ |
501 | _spin_trylock(lock) ? \ | 205 | _spin_trylock(lock) ? \ |
502 | 1 : ({local_irq_restore(flags); 0;}); \ | 206 | 1 : ({ local_irq_restore(flags); 0; }); \ |
503 | }) | 207 | }) |
504 | 208 | ||
505 | #ifdef CONFIG_LOCKMETER | ||
506 | extern void _metered_spin_lock (spinlock_t *lock); | ||
507 | extern void _metered_spin_unlock (spinlock_t *lock); | ||
508 | extern int _metered_spin_trylock(spinlock_t *lock); | ||
509 | extern void _metered_read_lock (rwlock_t *lock); | ||
510 | extern void _metered_read_unlock (rwlock_t *lock); | ||
511 | extern void _metered_write_lock (rwlock_t *lock); | ||
512 | extern void _metered_write_unlock (rwlock_t *lock); | ||
513 | extern int _metered_read_trylock (rwlock_t *lock); | ||
514 | extern int _metered_write_trylock(rwlock_t *lock); | ||
515 | #endif | ||
516 | |||
517 | /* "lock on reference count zero" */ | ||
518 | #ifndef ATOMIC_DEC_AND_LOCK | ||
519 | #include <asm/atomic.h> | ||
520 | extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); | ||
521 | #endif | ||
522 | |||
523 | #define atomic_dec_and_lock(atomic,lock) __cond_lock(_atomic_dec_and_lock(atomic,lock)) | ||
524 | |||
525 | /* | ||
526 | * bit-based spin_lock() | ||
527 | * | ||
528 | * Don't use this unless you really need to: spin_lock() and spin_unlock() | ||
529 | * are significantly faster. | ||
530 | */ | ||
531 | static inline void bit_spin_lock(int bitnum, unsigned long *addr) | ||
532 | { | ||
533 | /* | ||
534 | * Assuming the lock is uncontended, this never enters | ||
535 | * the body of the outer loop. If it is contended, then | ||
536 | * within the inner loop a non-atomic test is used to | ||
537 | * busywait with less bus contention for a good time to | ||
538 | * attempt to acquire the lock bit. | ||
539 | */ | ||
540 | preempt_disable(); | ||
541 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
542 | while (test_and_set_bit(bitnum, addr)) { | ||
543 | while (test_bit(bitnum, addr)) { | ||
544 | preempt_enable(); | ||
545 | cpu_relax(); | ||
546 | preempt_disable(); | ||
547 | } | ||
548 | } | ||
549 | #endif | ||
550 | __acquire(bitlock); | ||
551 | } | ||
552 | |||
553 | /* | 209 | /* |
554 | * Return true if it was acquired | 210 | * Pull the atomic_t declaration: |
211 | * (asm-mips/atomic.h needs above definitions) | ||
555 | */ | 212 | */ |
556 | static inline int bit_spin_trylock(int bitnum, unsigned long *addr) | 213 | #include <asm/atomic.h> |
557 | { | 214 | /** |
558 | preempt_disable(); | 215 | * atomic_dec_and_lock - lock on reaching reference count zero |
559 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 216 | * @atomic: the atomic counter |
560 | if (test_and_set_bit(bitnum, addr)) { | 217 | * @lock: the spinlock in question |
561 | preempt_enable(); | ||
562 | return 0; | ||
563 | } | ||
564 | #endif | ||
565 | __acquire(bitlock); | ||
566 | return 1; | ||
567 | } | ||
568 | |||
569 | /* | ||
570 | * bit-based spin_unlock() | ||
571 | */ | ||
572 | static inline void bit_spin_unlock(int bitnum, unsigned long *addr) | ||
573 | { | ||
574 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
575 | BUG_ON(!test_bit(bitnum, addr)); | ||
576 | smp_mb__before_clear_bit(); | ||
577 | clear_bit(bitnum, addr); | ||
578 | #endif | ||
579 | preempt_enable(); | ||
580 | __release(bitlock); | ||
581 | } | ||
582 | |||
583 | /* | ||
584 | * Return true if the lock is held. | ||
585 | */ | 218 | */ |
586 | static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) | 219 | extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); |
587 | { | 220 | #define atomic_dec_and_lock(atomic, lock) \ |
588 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 221 | __cond_lock(_atomic_dec_and_lock(atomic, lock)) |
589 | return test_bit(bitnum, addr); | ||
590 | #elif defined CONFIG_PREEMPT | ||
591 | return preempt_count(); | ||
592 | #else | ||
593 | return 1; | ||
594 | #endif | ||
595 | } | ||
596 | |||
597 | #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED | ||
598 | #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED | ||
599 | 222 | ||
600 | /** | 223 | /** |
601 | * spin_can_lock - would spin_trylock() succeed? | 224 | * spin_can_lock - would spin_trylock() succeed? |
602 | * @lock: the spinlock in question. | 225 | * @lock: the spinlock in question. |
603 | */ | 226 | */ |
604 | #define spin_can_lock(lock) (!spin_is_locked(lock)) | 227 | #define spin_can_lock(lock) (!spin_is_locked(lock)) |
605 | 228 | ||
606 | #endif /* __LINUX_SPINLOCK_H */ | 229 | #endif /* __LINUX_SPINLOCK_H */ |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h new file mode 100644 index 000000000000..78e6989ffb54 --- /dev/null +++ b/include/linux/spinlock_api_smp.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef __LINUX_SPINLOCK_API_SMP_H | ||
2 | #define __LINUX_SPINLOCK_API_SMP_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * include/linux/spinlock_api_smp.h | ||
10 | * | ||
11 | * spinlock API declarations on SMP (and debug) | ||
12 | * (implemented in kernel/spinlock.c) | ||
13 | * | ||
14 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
15 | * Released under the General Public License (GPL). | ||
16 | */ | ||
17 | |||
18 | int in_lock_functions(unsigned long addr); | ||
19 | |||
20 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | ||
21 | |||
22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); | ||
23 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
24 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
25 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); | ||
26 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
27 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
28 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); | ||
29 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
30 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
31 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | ||
32 | __acquires(spinlock_t); | ||
33 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | ||
34 | __acquires(rwlock_t); | ||
35 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | ||
36 | __acquires(rwlock_t); | ||
37 | int __lockfunc _spin_trylock(spinlock_t *lock); | ||
38 | int __lockfunc _read_trylock(rwlock_t *lock); | ||
39 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
40 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
41 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); | ||
42 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
43 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
44 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); | ||
45 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
46 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
47 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); | ||
48 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
49 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
50 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
51 | __releases(spinlock_t); | ||
52 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
53 | __releases(rwlock_t); | ||
54 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
55 | __releases(rwlock_t); | ||
56 | |||
57 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ | ||
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h new file mode 100644 index 000000000000..cd81cee566f4 --- /dev/null +++ b/include/linux/spinlock_api_up.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef __LINUX_SPINLOCK_API_UP_H | ||
2 | #define __LINUX_SPINLOCK_API_UP_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * include/linux/spinlock_api_up.h | ||
10 | * | ||
11 | * spinlock API implementation on UP-nondebug (inlined implementation) | ||
12 | * | ||
13 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
14 | * Released under the General Public License (GPL). | ||
15 | */ | ||
16 | |||
17 | #define in_lock_functions(ADDR) 0 | ||
18 | |||
19 | #define assert_spin_locked(lock) do { (void)(lock); } while (0) | ||
20 | |||
21 | /* | ||
22 | * In the UP-nondebug case there's no real locking going on, so the | ||
23 | * only thing we have to do is to keep the preempt counts and irq | ||
24 | * flags straight, to supress compiler warnings of unused lock | ||
25 | * variables, and to add the proper checker annotations: | ||
26 | */ | ||
27 | #define __LOCK(lock) \ | ||
28 | do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) | ||
29 | |||
30 | #define __LOCK_BH(lock) \ | ||
31 | do { local_bh_disable(); __LOCK(lock); } while (0) | ||
32 | |||
33 | #define __LOCK_IRQ(lock) \ | ||
34 | do { local_irq_disable(); __LOCK(lock); } while (0) | ||
35 | |||
36 | #define __LOCK_IRQSAVE(lock, flags) \ | ||
37 | do { local_irq_save(flags); __LOCK(lock); } while (0) | ||
38 | |||
39 | #define __UNLOCK(lock) \ | ||
40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) | ||
41 | |||
42 | #define __UNLOCK_BH(lock) \ | ||
43 | do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) | ||
44 | |||
45 | #define __UNLOCK_IRQ(lock) \ | ||
46 | do { local_irq_enable(); __UNLOCK(lock); } while (0) | ||
47 | |||
48 | #define __UNLOCK_IRQRESTORE(lock, flags) \ | ||
49 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) | ||
50 | |||
51 | #define _spin_lock(lock) __LOCK(lock) | ||
52 | #define _read_lock(lock) __LOCK(lock) | ||
53 | #define _write_lock(lock) __LOCK(lock) | ||
54 | #define _spin_lock_bh(lock) __LOCK_BH(lock) | ||
55 | #define _read_lock_bh(lock) __LOCK_BH(lock) | ||
56 | #define _write_lock_bh(lock) __LOCK_BH(lock) | ||
57 | #define _spin_lock_irq(lock) __LOCK_IRQ(lock) | ||
58 | #define _read_lock_irq(lock) __LOCK_IRQ(lock) | ||
59 | #define _write_lock_irq(lock) __LOCK_IRQ(lock) | ||
60 | #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
61 | #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
62 | #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
63 | #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) | ||
64 | #define _read_trylock(lock) ({ __LOCK(lock); 1; }) | ||
65 | #define _write_trylock(lock) ({ __LOCK(lock); 1; }) | ||
66 | #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) | ||
67 | #define _spin_unlock(lock) __UNLOCK(lock) | ||
68 | #define _read_unlock(lock) __UNLOCK(lock) | ||
69 | #define _write_unlock(lock) __UNLOCK(lock) | ||
70 | #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) | ||
71 | #define _write_unlock_bh(lock) __UNLOCK_BH(lock) | ||
72 | #define _read_unlock_bh(lock) __UNLOCK_BH(lock) | ||
73 | #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
74 | #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
75 | #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
76 | #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
77 | #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
78 | #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
79 | |||
80 | #endif /* __LINUX_SPINLOCK_API_UP_H */ | ||
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h new file mode 100644 index 000000000000..9cb51e070390 --- /dev/null +++ b/include/linux/spinlock_types.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
2 | #define __LINUX_SPINLOCK_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * include/linux/spinlock_types.h - generic spinlock type definitions | ||
6 | * and initializers | ||
7 | * | ||
8 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
9 | * Released under the General Public License (GPL). | ||
10 | */ | ||
11 | |||
12 | #if defined(CONFIG_SMP) | ||
13 | # include <asm/spinlock_types.h> | ||
14 | #else | ||
15 | # include <linux/spinlock_types_up.h> | ||
16 | #endif | ||
17 | |||
18 | typedef struct { | ||
19 | raw_spinlock_t raw_lock; | ||
20 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) | ||
21 | unsigned int break_lock; | ||
22 | #endif | ||
23 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
24 | unsigned int magic, owner_cpu; | ||
25 | void *owner; | ||
26 | #endif | ||
27 | } spinlock_t; | ||
28 | |||
29 | #define SPINLOCK_MAGIC 0xdead4ead | ||
30 | |||
31 | typedef struct { | ||
32 | raw_rwlock_t raw_lock; | ||
33 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) | ||
34 | unsigned int break_lock; | ||
35 | #endif | ||
36 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
37 | unsigned int magic, owner_cpu; | ||
38 | void *owner; | ||
39 | #endif | ||
40 | } rwlock_t; | ||
41 | |||
42 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
43 | |||
44 | #define SPINLOCK_OWNER_INIT ((void *)-1L) | ||
45 | |||
46 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
47 | # define SPIN_LOCK_UNLOCKED \ | ||
48 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | ||
49 | .magic = SPINLOCK_MAGIC, \ | ||
50 | .owner = SPINLOCK_OWNER_INIT, \ | ||
51 | .owner_cpu = -1 } | ||
52 | #define RW_LOCK_UNLOCKED \ | ||
53 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | ||
54 | .magic = RWLOCK_MAGIC, \ | ||
55 | .owner = SPINLOCK_OWNER_INIT, \ | ||
56 | .owner_cpu = -1 } | ||
57 | #else | ||
58 | # define SPIN_LOCK_UNLOCKED \ | ||
59 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } | ||
60 | #define RW_LOCK_UNLOCKED \ | ||
61 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } | ||
62 | #endif | ||
63 | |||
64 | #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED | ||
65 | #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED | ||
66 | |||
67 | #endif /* __LINUX_SPINLOCK_TYPES_H */ | ||
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h new file mode 100644 index 000000000000..def2d173a8db --- /dev/null +++ b/include/linux/spinlock_types_up.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef __LINUX_SPINLOCK_TYPES_UP_H | ||
2 | #define __LINUX_SPINLOCK_TYPES_UP_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * include/linux/spinlock_types_up.h - spinlock type definitions for UP | ||
10 | * | ||
11 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
12 | * Released under the General Public License (GPL). | ||
13 | */ | ||
14 | |||
15 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
16 | |||
17 | typedef struct { | ||
18 | volatile unsigned int slock; | ||
19 | } raw_spinlock_t; | ||
20 | |||
21 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | ||
22 | |||
23 | #else | ||
24 | |||
25 | /* | ||
26 | * All gcc 2.95 versions and early versions of 2.96 have a nasty bug | ||
27 | * with empty initializers. | ||
28 | */ | ||
29 | #if (__GNUC__ > 2) | ||
30 | typedef struct { } raw_spinlock_t; | ||
31 | |||
32 | #define __RAW_SPIN_LOCK_UNLOCKED { } | ||
33 | #else | ||
34 | typedef struct { int gcc_is_buggy; } raw_spinlock_t; | ||
35 | #define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 } | ||
36 | #endif | ||
37 | |||
38 | #endif | ||
39 | |||
40 | #if (__GNUC__ > 2) | ||
41 | typedef struct { | ||
42 | /* no debug version on UP */ | ||
43 | } raw_rwlock_t; | ||
44 | |||
45 | #define __RAW_RW_LOCK_UNLOCKED { } | ||
46 | #else | ||
47 | typedef struct { int gcc_is_buggy; } raw_rwlock_t; | ||
48 | #define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 } | ||
49 | #endif | ||
50 | |||
51 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ | ||
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h new file mode 100644 index 000000000000..31accf2f0b13 --- /dev/null +++ b/include/linux/spinlock_up.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #ifndef __LINUX_SPINLOCK_UP_H | ||
2 | #define __LINUX_SPINLOCK_UP_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * include/linux/spinlock_up.h - UP-debug version of spinlocks. | ||
10 | * | ||
11 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
12 | * Released under the General Public License (GPL). | ||
13 | * | ||
14 | * In the debug case, 1 means unlocked, 0 means locked. (the values | ||
15 | * are inverted, to catch initialization bugs) | ||
16 | * | ||
17 | * No atomicity anywhere, we are on UP. | ||
18 | */ | ||
19 | |||
20 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
21 | |||
22 | #define __raw_spin_is_locked(x) ((x)->slock == 0) | ||
23 | |||
24 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | ||
25 | { | ||
26 | lock->slock = 0; | ||
27 | } | ||
28 | |||
29 | static inline void | ||
30 | __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | ||
31 | { | ||
32 | local_irq_save(flags); | ||
33 | lock->slock = 0; | ||
34 | } | ||
35 | |||
36 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | ||
37 | { | ||
38 | char oldval = lock->slock; | ||
39 | |||
40 | lock->slock = 0; | ||
41 | |||
42 | return oldval > 0; | ||
43 | } | ||
44 | |||
45 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | ||
46 | { | ||
47 | lock->slock = 1; | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Read-write spinlocks. No debug version. | ||
52 | */ | ||
53 | #define __raw_read_lock(lock) do { (void)(lock); } while (0) | ||
54 | #define __raw_write_lock(lock) do { (void)(lock); } while (0) | ||
55 | #define __raw_read_trylock(lock) ({ (void)(lock); 1; }) | ||
56 | #define __raw_write_trylock(lock) ({ (void)(lock); 1; }) | ||
57 | #define __raw_read_unlock(lock) do { (void)(lock); } while (0) | ||
58 | #define __raw_write_unlock(lock) do { (void)(lock); } while (0) | ||
59 | |||
60 | #else /* DEBUG_SPINLOCK */ | ||
61 | #define __raw_spin_is_locked(lock) ((void)(lock), 0) | ||
62 | /* for sched.c and kernel_lock.c: */ | ||
63 | # define __raw_spin_lock(lock) do { (void)(lock); } while (0) | ||
64 | # define __raw_spin_unlock(lock) do { (void)(lock); } while (0) | ||
65 | # define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) | ||
66 | #endif /* DEBUG_SPINLOCK */ | ||
67 | |||
68 | #define __raw_read_can_lock(lock) (((void)(lock), 1)) | ||
69 | #define __raw_write_can_lock(lock) (((void)(lock), 1)) | ||
70 | |||
71 | #define __raw_spin_unlock_wait(lock) \ | ||
72 | do { cpu_relax(); } while (__raw_spin_is_locked(lock)) | ||
73 | |||
74 | #endif /* __LINUX_SPINLOCK_UP_H */ | ||
diff --git a/include/linux/time.h b/include/linux/time.h index c10d4c21c183..8e83f4e778bb 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -28,17 +28,10 @@ struct timezone { | |||
28 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
29 | 29 | ||
30 | /* Parameters used to convert the timespec values */ | 30 | /* Parameters used to convert the timespec values */ |
31 | #ifndef USEC_PER_SEC | 31 | #define MSEC_PER_SEC (1000L) |
32 | #define USEC_PER_SEC (1000000L) | 32 | #define USEC_PER_SEC (1000000L) |
33 | #endif | ||
34 | |||
35 | #ifndef NSEC_PER_SEC | ||
36 | #define NSEC_PER_SEC (1000000000L) | 33 | #define NSEC_PER_SEC (1000000000L) |
37 | #endif | ||
38 | |||
39 | #ifndef NSEC_PER_USEC | ||
40 | #define NSEC_PER_USEC (1000L) | 34 | #define NSEC_PER_USEC (1000L) |
41 | #endif | ||
42 | 35 | ||
43 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) | 36 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) |
44 | { | 37 | { |
diff --git a/include/linux/timer.h b/include/linux/timer.h index 221f81ac2002..3340f3bd135d 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -32,6 +32,10 @@ extern struct timer_base_s __init_timer_base; | |||
32 | .magic = TIMER_MAGIC, \ | 32 | .magic = TIMER_MAGIC, \ |
33 | } | 33 | } |
34 | 34 | ||
35 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ | ||
36 | struct timer_list _name = \ | ||
37 | TIMER_INITIALIZER(_function, _expires, _data) | ||
38 | |||
35 | void fastcall init_timer(struct timer_list * timer); | 39 | void fastcall init_timer(struct timer_list * timer); |
36 | 40 | ||
37 | /*** | 41 | /*** |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 59ff42c629ec..1267f88ece6e 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -74,7 +74,8 @@ struct screen_info { | |||
74 | u16 vesapm_off; /* 0x30 */ | 74 | u16 vesapm_off; /* 0x30 */ |
75 | u16 pages; /* 0x32 */ | 75 | u16 pages; /* 0x32 */ |
76 | u16 vesa_attributes; /* 0x34 */ | 76 | u16 vesa_attributes; /* 0x34 */ |
77 | /* 0x36 -- 0x3f reserved for future expansion */ | 77 | u32 capabilities; /* 0x36 */ |
78 | /* 0x3a -- 0x3f reserved for future expansion */ | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | extern struct screen_info screen_info; | 81 | extern struct screen_info screen_info; |
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 9d6fbde3d29c..1cc8c31b7988 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/version.h> | ||
7 | 6 | ||
8 | #define HAVE_V4L2 1 | 7 | #define HAVE_V4L2 1 |
9 | #include <linux/videodev2.h> | 8 | #include <linux/videodev2.h> |
@@ -29,7 +28,6 @@ struct video_device | |||
29 | void (*release)(struct video_device *vfd); | 28 | void (*release)(struct video_device *vfd); |
30 | 29 | ||
31 | 30 | ||
32 | #if 1 /* to be removed in 2.7.x */ | ||
33 | /* obsolete -- fops->owner is used instead */ | 31 | /* obsolete -- fops->owner is used instead */ |
34 | struct module *owner; | 32 | struct module *owner; |
35 | /* dev->driver_data will be used instead some day. | 33 | /* dev->driver_data will be used instead some day. |
@@ -37,7 +35,6 @@ struct video_device | |||
37 | * so the switch over will be transparent for you. | 35 | * so the switch over will be transparent for you. |
38 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ | 36 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ |
39 | void *priv; | 37 | void *priv; |
40 | #endif | ||
41 | 38 | ||
42 | /* for videodev.c intenal usage -- please don't touch */ | 39 | /* for videodev.c intenal usage -- please don't touch */ |
43 | int users; /* video_exclusive_{open|close} ... */ | 40 | int users; /* video_exclusive_{open|close} ... */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index acbfc525576d..f623a33b9abe 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -270,7 +270,6 @@ struct v4l2_timecode | |||
270 | /* The above is based on SMPTE timecodes */ | 270 | /* The above is based on SMPTE timecodes */ |
271 | 271 | ||
272 | 272 | ||
273 | #if 1 | ||
274 | /* | 273 | /* |
275 | * M P E G C O M P R E S S I O N P A R A M E T E R S | 274 | * M P E G C O M P R E S S I O N P A R A M E T E R S |
276 | * | 275 | * |
@@ -357,7 +356,6 @@ struct v4l2_mpeg_compression { | |||
357 | /* I don't expect the above being perfect yet ;) */ | 356 | /* I don't expect the above being perfect yet ;) */ |
358 | __u32 reserved_5[8]; | 357 | __u32 reserved_5[8]; |
359 | }; | 358 | }; |
360 | #endif | ||
361 | 359 | ||
362 | struct v4l2_jpegcompression | 360 | struct v4l2_jpegcompression |
363 | { | 361 | { |
@@ -871,10 +869,8 @@ struct v4l2_streamparm | |||
871 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) | 869 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) |
872 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) | 870 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) |
873 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) | 871 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) |
874 | #if 1 /* experimental */ | ||
875 | #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) | 872 | #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) |
876 | #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) | 873 | #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) |
877 | #endif | ||
878 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) | 874 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) |
879 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) | 875 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) |
880 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) | 876 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 542dbaee6512..343d883d69c5 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -109,8 +109,6 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); | |||
109 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); | 109 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); |
110 | int sync_page_range(struct inode *inode, struct address_space *mapping, | 110 | int sync_page_range(struct inode *inode, struct address_space *mapping, |
111 | loff_t pos, size_t count); | 111 | loff_t pos, size_t count); |
112 | int sync_page_range_nolock(struct inode *inode, struct address_space | ||
113 | *mapping, loff_t pos, size_t count); | ||
114 | 112 | ||
115 | /* pdflush.c */ | 113 | /* pdflush.c */ |
116 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl | 114 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index cd831168fdc1..a7ceee9fc5e9 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: audiochip.h,v 1.5 2005/06/16 22:59:16 hhackmann Exp $ | ||
3 | */ | 2 | */ |
4 | 3 | ||
5 | #ifndef AUDIOCHIP_H | 4 | #ifndef AUDIOCHIP_H |
diff --git a/include/media/id.h b/include/media/id.h index 801ddef301aa..6d02c94cdc0d 100644 --- a/include/media/id.h +++ b/include/media/id.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: id.h,v 1.4 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | 2 | */ |
4 | 3 | ||
5 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ | 4 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 698670547f16..01b56822df4d 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.h,v 1.9 2005/05/15 19:01:26 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * some common structs and functions to handle infrared remotes via | 3 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 4 | * input layer ... |
@@ -21,11 +20,11 @@ | |||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | */ | 21 | */ |
23 | 22 | ||
24 | #include <linux/version.h> | ||
25 | #include <linux/input.h> | 23 | #include <linux/input.h> |
26 | 24 | ||
27 | 25 | ||
28 | #define IR_TYPE_RC5 1 | 26 | #define IR_TYPE_RC5 1 |
27 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ | ||
29 | #define IR_TYPE_OTHER 99 | 28 | #define IR_TYPE_OTHER 99 |
30 | 29 | ||
31 | #define IR_KEYTAB_TYPE u32 | 30 | #define IR_KEYTAB_TYPE u32 |
@@ -60,6 +59,7 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | |||
60 | u32 ir_extract_bits(u32 data, u32 mask); | 59 | u32 ir_extract_bits(u32 data, u32 mask); |
61 | int ir_dump_samples(u32 *samples, int count); | 60 | int ir_dump_samples(u32 *samples, int count); |
62 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | 61 | int ir_decode_biphase(u32 *samples, int count, int low, int high); |
62 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); | ||
63 | 63 | ||
64 | /* | 64 | /* |
65 | * Local variables: | 65 | * Local variables: |
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 3dfb8d670eb7..2a897c3a6a9a 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __SAA7146__ | 1 | #ifndef __SAA7146__ |
2 | #define __SAA7146__ | 2 | #define __SAA7146__ |
3 | 3 | ||
4 | #include <linux/version.h> /* for version macros */ | ||
5 | #include <linux/module.h> /* for module-version */ | 4 | #include <linux/module.h> /* for module-version */ |
6 | #include <linux/delay.h> /* for delay-stuff */ | 5 | #include <linux/delay.h> /* for delay-stuff */ |
7 | #include <linux/slab.h> /* for kmalloc/kfree */ | 6 | #include <linux/slab.h> /* for kmalloc/kfree */ |
@@ -15,12 +14,7 @@ | |||
15 | #include <linux/vmalloc.h> /* for vmalloc() */ | 14 | #include <linux/vmalloc.h> /* for vmalloc() */ |
16 | #include <linux/mm.h> /* for vmalloc_to_page() */ | 15 | #include <linux/mm.h> /* for vmalloc_to_page() */ |
17 | 16 | ||
18 | /* ugly, but necessary to build the dvb stuff under 2.4. */ | 17 | #define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ |
19 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) | ||
20 | #include "dvb_functions.h" | ||
21 | #endif | ||
22 | |||
23 | #define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0) | ||
24 | 18 | ||
25 | #define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) | 19 | #define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) |
26 | #define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) | 20 | #define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) |
@@ -33,13 +27,8 @@ extern unsigned int saa7146_debug; | |||
33 | #define DEBUG_VARIABLE saa7146_debug | 27 | #define DEBUG_VARIABLE saa7146_debug |
34 | #endif | 28 | #endif |
35 | 29 | ||
36 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) | ||
37 | #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_BASENAME),__FUNCTION__) | ||
38 | #define INFO(x) { printk("%s: ",__stringify(KBUILD_BASENAME)); printk x; } | ||
39 | #else | ||
40 | #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) | 30 | #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) |
41 | #define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } | 31 | #define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } |
42 | #endif | ||
43 | 32 | ||
44 | #define ERR(x) { DEBUG_PROLOG; printk x; } | 33 | #define ERR(x) { DEBUG_PROLOG; printk x; } |
45 | 34 | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h index eeaa15ddee85..4ad08e24a1aa 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -1,6 +1,4 @@ | |||
1 | 1 | /* | |
2 | /* $Id: tuner.h,v 1.45 2005/07/28 18:41:21 mchehab Exp $ | ||
3 | * | ||
4 | tuner.h - definition for different tuners | 2 | tuner.h - definition for different tuners |
5 | 3 | ||
6 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) | 4 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) |
@@ -28,88 +26,90 @@ | |||
28 | 26 | ||
29 | #define ADDR_UNSET (255) | 27 | #define ADDR_UNSET (255) |
30 | 28 | ||
31 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ | 29 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ |
32 | #define TUNER_PHILIPS_PAL_I 1 | 30 | #define TUNER_PHILIPS_PAL_I 1 |
33 | #define TUNER_PHILIPS_NTSC 2 | 31 | #define TUNER_PHILIPS_NTSC 2 |
34 | #define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ | 32 | #define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ |
35 | 33 | ||
36 | #define TUNER_ABSENT 4 | 34 | #define TUNER_ABSENT 4 |
37 | #define TUNER_PHILIPS_PAL 5 | 35 | #define TUNER_PHILIPS_PAL 5 |
38 | #define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ | 36 | #define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ |
39 | #define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ | 37 | #define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ |
40 | 38 | ||
41 | #define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ | 39 | #define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ |
42 | #define TUNER_ALPS_TSBH1_NTSC 9 | 40 | #define TUNER_ALPS_TSBH1_NTSC 9 |
43 | #define TUNER_ALPS_TSBE1_PAL 10 | 41 | #define TUNER_ALPS_TSBE1_PAL 10 |
44 | #define TUNER_ALPS_TSBB5_PAL_I 11 | 42 | #define TUNER_ALPS_TSBB5_PAL_I 11 |
45 | 43 | ||
46 | #define TUNER_ALPS_TSBE5_PAL 12 | 44 | #define TUNER_ALPS_TSBE5_PAL 12 |
47 | #define TUNER_ALPS_TSBC5_PAL 13 | 45 | #define TUNER_ALPS_TSBC5_PAL 13 |
48 | #define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ | 46 | #define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ |
49 | #define TUNER_ALPS_TSHC6_NTSC 15 | 47 | #define TUNER_ALPS_TSHC6_NTSC 15 |
50 | 48 | ||
51 | #define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ | 49 | #define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ |
52 | #define TUNER_PHILIPS_NTSC_M 17 | 50 | #define TUNER_PHILIPS_NTSC_M 17 |
53 | #define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ | 51 | #define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ |
54 | #define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/ | 52 | #define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657) */ |
55 | 53 | ||
56 | #define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/ | 54 | #define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711) */ |
57 | #define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/ | 55 | #define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732) */ |
58 | #define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/ | 56 | #define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104) */ |
59 | #define TUNER_PHILIPS_PAL_DK 23 | 57 | #define TUNER_PHILIPS_PAL_DK 23 |
60 | 58 | ||
61 | #define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ | 59 | #define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ |
62 | #define TUNER_LG_PAL_I_FM 25 | 60 | #define TUNER_LG_PAL_I_FM 25 |
63 | #define TUNER_LG_PAL_I 26 | 61 | #define TUNER_LG_PAL_I 26 |
64 | #define TUNER_LG_NTSC_FM 27 | 62 | #define TUNER_LG_NTSC_FM 27 |
65 | 63 | ||
66 | #define TUNER_LG_PAL_FM 28 | 64 | #define TUNER_LG_PAL_FM 28 |
67 | #define TUNER_LG_PAL 29 | 65 | #define TUNER_LG_PAL 29 |
68 | #define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/ | 66 | #define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163) */ |
69 | #define TUNER_SHARP_2U5JF5540_NTSC 31 | 67 | #define TUNER_SHARP_2U5JF5540_NTSC 31 |
70 | 68 | ||
71 | #define TUNER_Samsung_PAL_TCPM9091PD27 32 | 69 | #define TUNER_Samsung_PAL_TCPM9091PD27 32 |
72 | #define TUNER_MT2032 33 | 70 | #define TUNER_MT2032 33 |
73 | #define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/ | 71 | #define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865) */ |
74 | #define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/ | 72 | #define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099) */ |
75 | 73 | ||
76 | #define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/ | 74 | #define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746) */ |
77 | #define TUNER_LG_PAL_NEW_TAPC 37 | 75 | #define TUNER_LG_PAL_NEW_TAPC 37 |
78 | #define TUNER_PHILIPS_FM1216ME_MK3 38 | 76 | #define TUNER_PHILIPS_FM1216ME_MK3 38 |
79 | #define TUNER_LG_NTSC_NEW_TAPC 39 | 77 | #define TUNER_LG_NTSC_NEW_TAPC 39 |
80 | 78 | ||
81 | #define TUNER_HITACHI_NTSC 40 | 79 | #define TUNER_HITACHI_NTSC 40 |
82 | #define TUNER_PHILIPS_PAL_MK 41 | 80 | #define TUNER_PHILIPS_PAL_MK 41 |
83 | #define TUNER_PHILIPS_ATSC 42 | 81 | #define TUNER_PHILIPS_ATSC 42 |
84 | #define TUNER_PHILIPS_FM1236_MK3 43 | 82 | #define TUNER_PHILIPS_FM1236_MK3 43 |
85 | 83 | ||
86 | #define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ | 84 | #define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ |
87 | /* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ | 85 | /* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ |
88 | #define TUNER_MICROTUNE_4049FM5 45 | 86 | #define TUNER_MICROTUNE_4049FM5 45 |
89 | #define TUNER_LG_NTSC_TAPE 47 | 87 | #define TUNER_MICROTUNE_4042_FI5 46 |
90 | 88 | #define TUNER_LG_NTSC_TAPE 47 | |
91 | #define TUNER_TNF_8831BGFF 48 | 89 | |
92 | #define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ | 90 | #define TUNER_TNF_8831BGFF 48 |
93 | #define TUNER_TCL_2002N 50 | 91 | #define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ |
94 | #define TUNER_PHILIPS_FM1256_IH3 51 | 92 | #define TUNER_TCL_2002N 50 |
95 | 93 | #define TUNER_PHILIPS_FM1256_IH3 51 | |
96 | #define TUNER_THOMSON_DTT7610 52 | 94 | |
97 | #define TUNER_PHILIPS_FQ1286 53 | 95 | #define TUNER_THOMSON_DTT7610 52 |
98 | #define TUNER_PHILIPS_TDA8290 54 | 96 | #define TUNER_PHILIPS_FQ1286 53 |
99 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ | 97 | #define TUNER_PHILIPS_TDA8290 54 |
100 | 98 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ | |
101 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | 99 | |
102 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | 100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ |
103 | 101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | |
104 | #define TUNER_YMEC_TVF_8531MF 58 | 102 | #define TUNER_YMEC_TVF_8531MF 58 |
105 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ | 103 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ |
106 | #define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ | 104 | |
107 | #define TUNER_TENA_9533_DI 61 | 105 | #define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ |
108 | 106 | #define TUNER_TENA_9533_DI 61 | |
109 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ | 107 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ |
110 | #define TUNER_PHILIPS_FMD1216ME_MK3 63 | 108 | #define TUNER_PHILIPS_FMD1216ME_MK3 63 |
111 | #define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ | 109 | |
112 | #define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ | 110 | #define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ |
111 | #define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ | ||
112 | #define TUNER_LG_NTSC_TALN_MINI 66 | ||
113 | 113 | ||
114 | #define NOTUNER 0 | 114 | #define NOTUNER 0 |
115 | #define PAL 1 /* PAL_BG */ | 115 | #define PAL 1 /* PAL_BG */ |
@@ -117,7 +117,7 @@ | |||
117 | #define NTSC 3 | 117 | #define NTSC 3 |
118 | #define SECAM 4 | 118 | #define SECAM 4 |
119 | #define ATSC 5 | 119 | #define ATSC 5 |
120 | #define RADIO 6 | 120 | #define RADIO 6 |
121 | 121 | ||
122 | #define NoTuner 0 | 122 | #define NoTuner 0 |
123 | #define Philips 1 | 123 | #define Philips 1 |
@@ -134,6 +134,7 @@ | |||
134 | #define THOMSON 12 | 134 | #define THOMSON 12 |
135 | 135 | ||
136 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) | 136 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) |
137 | #define TUNER_SET_STANDBY _IOW('T',4,int) | ||
137 | #define TDA9887_SET_CONFIG _IOW('t',5,int) | 138 | #define TDA9887_SET_CONFIG _IOW('t',5,int) |
138 | 139 | ||
139 | /* tv card specific */ | 140 | /* tv card specific */ |
@@ -153,9 +154,6 @@ | |||
153 | 154 | ||
154 | #ifdef __KERNEL__ | 155 | #ifdef __KERNEL__ |
155 | 156 | ||
156 | #define I2C_ADDR_TDA8290 0x4b | ||
157 | #define I2C_ADDR_TDA8275 0x61 | ||
158 | |||
159 | enum tuner_mode { | 157 | enum tuner_mode { |
160 | T_UNINITIALIZED = 0, | 158 | T_UNINITIALIZED = 0, |
161 | T_RADIO = 1 << V4L2_TUNER_RADIO, | 159 | T_RADIO = 1 << V4L2_TUNER_RADIO, |
@@ -165,21 +163,21 @@ enum tuner_mode { | |||
165 | }; | 163 | }; |
166 | 164 | ||
167 | struct tuner_setup { | 165 | struct tuner_setup { |
168 | unsigned short addr; | 166 | unsigned short addr; |
169 | unsigned int type; | 167 | unsigned int type; |
170 | unsigned int mode_mask; | 168 | unsigned int mode_mask; |
171 | }; | 169 | }; |
172 | 170 | ||
173 | struct tuner { | 171 | struct tuner { |
174 | /* device */ | 172 | /* device */ |
175 | struct i2c_client i2c; | 173 | struct i2c_client i2c; |
176 | 174 | ||
177 | unsigned int type; /* chip type */ | 175 | unsigned int type; /* chip type */ |
178 | 176 | ||
179 | unsigned int mode; | 177 | unsigned int mode; |
180 | unsigned int mode_mask; /* Combination of allowable modes */ | 178 | unsigned int mode_mask; /* Combination of allowable modes */ |
181 | 179 | ||
182 | unsigned int freq; /* keep track of the current settings */ | 180 | unsigned int freq; /* keep track of the current settings */ |
183 | unsigned int audmode; | 181 | unsigned int audmode; |
184 | v4l2_std_id std; | 182 | v4l2_std_id std; |
185 | 183 | ||
@@ -198,6 +196,7 @@ struct tuner { | |||
198 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); | 196 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); |
199 | int (*has_signal)(struct i2c_client *c); | 197 | int (*has_signal)(struct i2c_client *c); |
200 | int (*is_stereo)(struct i2c_client *c); | 198 | int (*is_stereo)(struct i2c_client *c); |
199 | void (*standby)(struct i2c_client *c); | ||
201 | }; | 200 | }; |
202 | 201 | ||
203 | extern unsigned int tuner_debug; | 202 | extern unsigned int tuner_debug; |
@@ -209,16 +208,20 @@ extern int tea5767_tuner_init(struct i2c_client *c); | |||
209 | extern int default_tuner_init(struct i2c_client *c); | 208 | extern int default_tuner_init(struct i2c_client *c); |
210 | extern int tea5767_autodetection(struct i2c_client *c); | 209 | extern int tea5767_autodetection(struct i2c_client *c); |
211 | 210 | ||
212 | #define tuner_warn(fmt, arg...) \ | 211 | #define tuner_warn(fmt, arg...) do {\ |
213 | dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) | 212 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ |
214 | #define tuner_info(fmt, arg...) \ | 213 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
215 | dev_printk(KERN_INFO , &t->i2c.dev , fmt , ## arg) | 214 | #define tuner_info(fmt, arg...) do {\ |
216 | #define tuner_dbg(fmt, arg...) \ | 215 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ |
217 | if (tuner_debug) dev_printk(KERN_DEBUG , &t->i2c.dev , fmt , ## arg) | 216 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
217 | #define tuner_dbg(fmt, arg...) do {\ | ||
218 | if (tuner_debug) \ | ||
219 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ | ||
220 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | ||
218 | 221 | ||
219 | #endif /* __KERNEL__ */ | 222 | #endif /* __KERNEL__ */ |
220 | 223 | ||
221 | #endif | 224 | #endif /* _TUNER_H */ |
222 | 225 | ||
223 | /* | 226 | /* |
224 | * Overrides for Emacs so that we follow Linus's tabbing style. | 227 | * Overrides for Emacs so that we follow Linus's tabbing style. |
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h index 854a2c2f105b..e2035c7da094 100644 --- a/include/media/tveeprom.h +++ b/include/media/tveeprom.h | |||
@@ -1,18 +1,21 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tveeprom.h,v 1.2 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | 2 | */ |
4 | 3 | ||
5 | struct tveeprom { | 4 | struct tveeprom { |
6 | u32 has_radio; | 5 | u32 has_radio; |
6 | u32 has_ir; /* 0: no IR, 1: IR present, 2: unknown */ | ||
7 | 7 | ||
8 | u32 tuner_type; | 8 | u32 tuner_type; |
9 | u32 tuner_formats; | 9 | u32 tuner_formats; |
10 | 10 | ||
11 | u32 tuner2_type; | ||
12 | u32 tuner2_formats; | ||
13 | |||
11 | u32 digitizer; | 14 | u32 digitizer; |
12 | u32 digitizer_formats; | 15 | u32 digitizer_formats; |
13 | 16 | ||
14 | u32 audio_processor; | 17 | u32 audio_processor; |
15 | /* a_p_fmts? */ | 18 | u32 decoder_processor; |
16 | 19 | ||
17 | u32 model; | 20 | u32 model; |
18 | u32 revision; | 21 | u32 revision; |
@@ -20,7 +23,7 @@ struct tveeprom { | |||
20 | char rev_str[5]; | 23 | char rev_str[5]; |
21 | }; | 24 | }; |
22 | 25 | ||
23 | void tveeprom_hauppauge_analog(struct tveeprom *tvee, | 26 | void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, |
24 | unsigned char *eeprom_data); | 27 | unsigned char *eeprom_data); |
25 | 28 | ||
26 | int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); | 29 | int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); |
diff --git a/include/media/video-buf.h b/include/media/video-buf.h index ae6da6de98de..ae8d7a000440 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: video-buf.h,v 1.9 2004/11/07 13:17:15 kraxel Exp $ | ||
3 | * | 2 | * |
4 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
5 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index b707a603351b..cb8b6e6ce66c 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -151,6 +151,8 @@ struct pcmcia_device { | |||
151 | uniquely define a pcmcia_device */ | 151 | uniquely define a pcmcia_device */ |
152 | struct pcmcia_socket *socket; | 152 | struct pcmcia_socket *socket; |
153 | 153 | ||
154 | char *devname; | ||
155 | |||
154 | u8 device_no; | 156 | u8 device_no; |
155 | 157 | ||
156 | /* the hardware "function" device; certain subdevices can | 158 | /* the hardware "function" device; certain subdevices can |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 389e8ebe9c19..d6361dab0370 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -910,11 +910,10 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format); | |||
910 | * Returns 1 if the given PCM format is CPU-endian, 0 if | 910 | * Returns 1 if the given PCM format is CPU-endian, 0 if |
911 | * opposite, or a negative error code if endian not specified. | 911 | * opposite, or a negative error code if endian not specified. |
912 | */ | 912 | */ |
913 | /* int snd_pcm_format_cpu_endian(snd_pcm_format_t format); */ | ||
914 | #ifdef SNDRV_LITTLE_ENDIAN | 913 | #ifdef SNDRV_LITTLE_ENDIAN |
915 | #define snd_pcm_format_cpu_endian snd_pcm_format_little_endian | 914 | #define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format) |
916 | #else | 915 | #else |
917 | #define snd_pcm_format_cpu_endian snd_pcm_format_big_endian | 916 | #define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format) |
918 | #endif | 917 | #endif |
919 | int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ | 918 | int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ |
920 | int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ | 919 | int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ |
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index ad3c3be33c03..b82e408e758f 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h | |||
@@ -34,9 +34,7 @@ struct snd_tea575x_ops { | |||
34 | struct snd_tea575x { | 34 | struct snd_tea575x { |
35 | snd_card_t *card; | 35 | snd_card_t *card; |
36 | struct video_device vd; /* video device */ | 36 | struct video_device vd; /* video device */ |
37 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) | ||
38 | struct file_operations fops; | 37 | struct file_operations fops; |
39 | #endif | ||
40 | int dev_nr; /* requested device number + 1 */ | 38 | int dev_nr; /* requested device number + 1 */ |
41 | int vd_registered; /* video device is registered */ | 39 | int vd_registered; /* video device is registered */ |
42 | int tea5759; /* 5759 chip is present */ | 40 | int tea5759; /* 5759 chip is present */ |
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h new file mode 100644 index 000000000000..a9948232b131 --- /dev/null +++ b/include/video/cyblafb.h | |||
@@ -0,0 +1,171 @@ | |||
1 | |||
2 | #ifndef CYBLAFB_DEBUG | ||
3 | #define CYBLAFB_DEBUG 0 | ||
4 | #endif | ||
5 | |||
6 | #if CYBLAFB_DEBUG | ||
7 | #define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a); | ||
8 | #else | ||
9 | #define debug(f,a...) | ||
10 | #endif | ||
11 | |||
12 | #define output(f, a...) printk("cyblafb: " f, ## a) | ||
13 | |||
14 | #define Kb (1024) | ||
15 | #define Mb (Kb*Kb) | ||
16 | |||
17 | /* PCI IDS of supported cards temporarily here */ | ||
18 | |||
19 | #define CYBERBLADEi1 0x8500 | ||
20 | |||
21 | /* these defines are for 'lcd' variable */ | ||
22 | #define LCD_STRETCH 0 | ||
23 | #define LCD_CENTER 1 | ||
24 | #define LCD_BIOS 2 | ||
25 | |||
26 | /* display types */ | ||
27 | #define DISPLAY_CRT 0 | ||
28 | #define DISPLAY_FP 1 | ||
29 | |||
30 | #define ROP_S 0xCC | ||
31 | |||
32 | #define point(x,y) ((y)<<16|(x)) | ||
33 | |||
34 | // | ||
35 | // Attribute Regs, ARxx, 3c0/3c1 | ||
36 | // | ||
37 | #define AR00 0x00 | ||
38 | #define AR01 0x01 | ||
39 | #define AR02 0x02 | ||
40 | #define AR03 0x03 | ||
41 | #define AR04 0x04 | ||
42 | #define AR05 0x05 | ||
43 | #define AR06 0x06 | ||
44 | #define AR07 0x07 | ||
45 | #define AR08 0x08 | ||
46 | #define AR09 0x09 | ||
47 | #define AR0A 0x0A | ||
48 | #define AR0B 0x0B | ||
49 | #define AR0C 0x0C | ||
50 | #define AR0D 0x0D | ||
51 | #define AR0E 0x0E | ||
52 | #define AR0F 0x0F | ||
53 | #define AR10 0x10 | ||
54 | #define AR12 0x12 | ||
55 | #define AR13 0x13 | ||
56 | |||
57 | // | ||
58 | // Sequencer Regs, SRxx, 3c4/3c5 | ||
59 | // | ||
60 | #define SR00 0x00 | ||
61 | #define SR01 0x01 | ||
62 | #define SR02 0x02 | ||
63 | #define SR03 0x03 | ||
64 | #define SR04 0x04 | ||
65 | #define SR0D 0x0D | ||
66 | #define SR0E 0x0E | ||
67 | #define SR11 0x11 | ||
68 | #define SR18 0x18 | ||
69 | #define SR19 0x19 | ||
70 | |||
71 | // | ||
72 | // | ||
73 | // | ||
74 | #define CR00 0x00 | ||
75 | #define CR01 0x01 | ||
76 | #define CR02 0x02 | ||
77 | #define CR03 0x03 | ||
78 | #define CR04 0x04 | ||
79 | #define CR05 0x05 | ||
80 | #define CR06 0x06 | ||
81 | #define CR07 0x07 | ||
82 | #define CR08 0x08 | ||
83 | #define CR09 0x09 | ||
84 | #define CR0A 0x0A | ||
85 | #define CR0B 0x0B | ||
86 | #define CR0C 0x0C | ||
87 | #define CR0D 0x0D | ||
88 | #define CR0E 0x0E | ||
89 | #define CR0F 0x0F | ||
90 | #define CR10 0x10 | ||
91 | #define CR11 0x11 | ||
92 | #define CR12 0x12 | ||
93 | #define CR13 0x13 | ||
94 | #define CR14 0x14 | ||
95 | #define CR15 0x15 | ||
96 | #define CR16 0x16 | ||
97 | #define CR17 0x17 | ||
98 | #define CR18 0x18 | ||
99 | #define CR19 0x19 | ||
100 | #define CR1A 0x1A | ||
101 | #define CR1B 0x1B | ||
102 | #define CR1C 0x1C | ||
103 | #define CR1D 0x1D | ||
104 | #define CR1E 0x1E | ||
105 | #define CR1F 0x1F | ||
106 | #define CR20 0x20 | ||
107 | #define CR21 0x21 | ||
108 | #define CR27 0x27 | ||
109 | #define CR29 0x29 | ||
110 | #define CR2A 0x2A | ||
111 | #define CR2B 0x2B | ||
112 | #define CR2D 0x2D | ||
113 | #define CR2F 0x2F | ||
114 | #define CR36 0x36 | ||
115 | #define CR38 0x38 | ||
116 | #define CR39 0x39 | ||
117 | #define CR3A 0x3A | ||
118 | #define CR55 0x55 | ||
119 | #define CR56 0x56 | ||
120 | #define CR57 0x57 | ||
121 | #define CR58 0x58 | ||
122 | |||
123 | // | ||
124 | // | ||
125 | // | ||
126 | |||
127 | #define GR00 0x01 | ||
128 | #define GR01 0x01 | ||
129 | #define GR02 0x02 | ||
130 | #define GR03 0x03 | ||
131 | #define GR04 0x04 | ||
132 | #define GR05 0x05 | ||
133 | #define GR06 0x06 | ||
134 | #define GR07 0x07 | ||
135 | #define GR08 0x08 | ||
136 | #define GR0F 0x0F | ||
137 | #define GR20 0x20 | ||
138 | #define GR23 0x23 | ||
139 | #define GR2F 0x2F | ||
140 | #define GR30 0x30 | ||
141 | #define GR31 0x31 | ||
142 | #define GR33 0x33 | ||
143 | #define GR52 0x52 | ||
144 | #define GR53 0x53 | ||
145 | #define GR5D 0x5d | ||
146 | |||
147 | |||
148 | // | ||
149 | // Graphics Engine | ||
150 | // | ||
151 | #define GEBase 0x2100 // could be mapped elsewhere if we like it | ||
152 | #define GE00 (GEBase+0x00) // source 1, p 111 | ||
153 | #define GE04 (GEBase+0x04) // source 2, p 111 | ||
154 | #define GE08 (GEBase+0x08) // destination 1, p 111 | ||
155 | #define GE0C (GEBase+0x0C) // destination 2, p 112 | ||
156 | #define GE20 (GEBase+0x20) // engine status, p 113 | ||
157 | #define GE24 (GEBase+0x24) // reset all GE pointers | ||
158 | #define GE44 (GEBase+0x44) // command register, p 126 | ||
159 | #define GE48 (GEBase+0x48) // raster operation, p 127 | ||
160 | #define GE60 (GEBase+0x60) // foreground color, p 128 | ||
161 | #define GE64 (GEBase+0x64) // background color, p 128 | ||
162 | #define GE6C (GEBase+0x6C) // Pattern and Style, p 129, ok | ||
163 | #define GE9C (GEBase+0x9C) // pixel engine data port, p 125 | ||
164 | #define GEB8 (GEBase+0xB8) // Destination Stride / Buffer Base 0, p 133 | ||
165 | #define GEBC (GEBase+0xBC) // Destination Stride / Buffer Base 1, p 133 | ||
166 | #define GEC0 (GEBase+0xC0) // Destination Stride / Buffer Base 2, p 133 | ||
167 | #define GEC4 (GEBase+0xC4) // Destination Stride / Buffer Base 3, p 133 | ||
168 | #define GEC8 (GEBase+0xC8) // Source Stride / Buffer Base 0, p 133 | ||
169 | #define GECC (GEBase+0xCC) // Source Stride / Buffer Base 1, p 133 | ||
170 | #define GED0 (GEBase+0xD0) // Source Stride / Buffer Base 2, p 133 | ||
171 | #define GED4 (GEBase+0xD4) // Source Stride / Buffer Base 3, p 133 | ||
diff --git a/include/video/sisfb.h b/include/video/sisfb.h index 136bf791643d..e402eb5b3c7a 100644 --- a/include/video/sisfb.h +++ b/include/video/sisfb.h | |||
@@ -1,5 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. | 2 | * sisfb.h - definitions for the SiS framebuffer driver |
3 | * | ||
4 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. | ||
3 | * | 5 | * |
4 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -16,8 +18,8 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
17 | */ | 19 | */ |
18 | 20 | ||
19 | #ifndef _LINUX_SISFB | 21 | #ifndef _LINUX_SISFB_H_ |
20 | #define _LINUX_SISFB | 22 | #define _LINUX_SISFB_H_ |
21 | 23 | ||
22 | #include <asm/ioctl.h> | 24 | #include <asm/ioctl.h> |
23 | #include <asm/types.h> | 25 | #include <asm/types.h> |
@@ -26,47 +28,35 @@ | |||
26 | /* PUBLIC */ | 28 | /* PUBLIC */ |
27 | /**********************************************/ | 29 | /**********************************************/ |
28 | 30 | ||
29 | /* vbflags */ | 31 | /* vbflags, public (others in sis.h) */ |
30 | #define CRT2_DEFAULT 0x00000001 | 32 | #define CRT2_DEFAULT 0x00000001 |
31 | #define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */ | 33 | #define CRT2_LCD 0x00000002 |
32 | #define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */ | 34 | #define CRT2_TV 0x00000004 |
33 | #define CRT2_VGA 0x00000008 | 35 | #define CRT2_VGA 0x00000008 |
34 | #define TV_NTSC 0x00000010 | 36 | #define TV_NTSC 0x00000010 |
35 | #define TV_PAL 0x00000020 | 37 | #define TV_PAL 0x00000020 |
36 | #define TV_HIVISION 0x00000040 | 38 | #define TV_HIVISION 0x00000040 |
37 | #define TV_YPBPR 0x00000080 | 39 | #define TV_YPBPR 0x00000080 |
38 | #define TV_AVIDEO 0x00000100 | 40 | #define TV_AVIDEO 0x00000100 |
39 | #define TV_SVIDEO 0x00000200 | 41 | #define TV_SVIDEO 0x00000200 |
40 | #define TV_SCART 0x00000400 | 42 | #define TV_SCART 0x00000400 |
41 | #define VB_CONEXANT 0x00000800 /* 661 series only */ | 43 | #define TV_PALM 0x00001000 |
42 | #define VB_TRUMPION VB_CONEXANT /* 300 series only */ | 44 | #define TV_PALN 0x00002000 |
43 | #define TV_PALM 0x00001000 | ||
44 | #define TV_PALN 0x00002000 | ||
45 | #define TV_NTSCJ 0x00001000 | 45 | #define TV_NTSCJ 0x00001000 |
46 | #define VB_302ELV 0x00004000 | 46 | #define TV_CHSCART 0x00008000 |
47 | #define TV_CHSCART 0x00008000 | 47 | #define TV_CHYPBPR525I 0x00010000 |
48 | #define TV_CHYPBPR525I 0x00010000 | ||
49 | #define CRT1_VGA 0x00000000 | 48 | #define CRT1_VGA 0x00000000 |
50 | #define CRT1_LCDA 0x00020000 | 49 | #define CRT1_LCDA 0x00020000 |
51 | #define VGA2_CONNECTED 0x00040000 | 50 | #define VGA2_CONNECTED 0x00040000 |
52 | #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ | 51 | #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ |
53 | #define VB_301 0x00100000 /* Video bridge type */ | 52 | #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ |
54 | #define VB_301B 0x00200000 | 53 | #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ |
55 | #define VB_302B 0x00400000 | 54 | #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ |
56 | #define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */ | ||
57 | #define VB_LVDS 0x01000000 | ||
58 | #define VB_CHRONTEL 0x02000000 | ||
59 | #define VB_301LV 0x04000000 | ||
60 | #define VB_302LV 0x08000000 | ||
61 | #define VB_301C 0x10000000 | ||
62 | #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ | ||
63 | #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ | ||
64 | #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ | ||
65 | 55 | ||
66 | /* Aliases: */ | 56 | /* Aliases: */ |
67 | #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) | 57 | #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) |
68 | #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) | 58 | #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) |
69 | #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) | 59 | #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) |
70 | 60 | ||
71 | /* Only if TV_YPBPR is set: */ | 61 | /* Only if TV_YPBPR is set: */ |
72 | #define TV_YPBPR525I TV_NTSC | 62 | #define TV_YPBPR525I TV_NTSC |
@@ -75,89 +65,118 @@ | |||
75 | #define TV_YPBPR1080I TV_PALN | 65 | #define TV_YPBPR1080I TV_PALN |
76 | #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) | 66 | #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) |
77 | 67 | ||
78 | #define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV) | ||
79 | #define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV) | ||
80 | #define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT) | ||
81 | |||
82 | #define VB_DISPTYPE_DISP2 CRT2_ENABLE | 68 | #define VB_DISPTYPE_DISP2 CRT2_ENABLE |
83 | #define VB_DISPTYPE_CRT2 CRT2_ENABLE | 69 | #define VB_DISPTYPE_CRT2 CRT2_ENABLE |
84 | #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 | 70 | #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 |
85 | #define VB_DISPMODE_SINGLE VB_SINGLE_MODE | 71 | #define VB_DISPMODE_SINGLE VB_SINGLE_MODE |
86 | #define VB_DISPMODE_MIRROR VB_MIRROR_MODE | 72 | #define VB_DISPMODE_MIRROR VB_MIRROR_MODE |
87 | #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE | 73 | #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE |
88 | #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) | 74 | #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) |
89 | 75 | ||
90 | /* Structure argument for SISFB_GET_INFO ioctl */ | 76 | /* Structure argument for SISFB_GET_INFO ioctl */ |
91 | typedef struct _SISFB_INFO sisfb_info, *psisfb_info; | 77 | struct sisfb_info { |
92 | 78 | __u32 sisfb_id; /* for identifying sisfb */ | |
93 | struct _SISFB_INFO { | ||
94 | __u32 sisfb_id; /* for identifying sisfb */ | ||
95 | #ifndef SISFB_ID | 79 | #ifndef SISFB_ID |
96 | #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ | 80 | #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ |
97 | #endif | 81 | #endif |
98 | __u32 chip_id; /* PCI-ID of detected chip */ | 82 | __u32 chip_id; /* PCI-ID of detected chip */ |
99 | __u32 memory; /* video memory in KB which sisfb manages */ | 83 | __u32 memory; /* total video memory in KB */ |
100 | __u32 heapstart; /* heap start (= sisfb "mem" argument) in KB */ | 84 | __u32 heapstart; /* heap start offset in KB */ |
101 | __u8 fbvidmode; /* current sisfb mode */ | 85 | __u8 fbvidmode; /* current sisfb mode */ |
102 | 86 | ||
103 | __u8 sisfb_version; | 87 | __u8 sisfb_version; |
104 | __u8 sisfb_revision; | 88 | __u8 sisfb_revision; |
105 | __u8 sisfb_patchlevel; | 89 | __u8 sisfb_patchlevel; |
106 | 90 | ||
107 | __u8 sisfb_caps; /* sisfb capabilities */ | 91 | __u8 sisfb_caps; /* sisfb capabilities */ |
108 | 92 | ||
109 | __u32 sisfb_tqlen; /* turbo queue length (in KB) */ | 93 | __u32 sisfb_tqlen; /* turbo queue length (in KB) */ |
110 | 94 | ||
111 | __u32 sisfb_pcibus; /* The card's PCI ID */ | 95 | __u32 sisfb_pcibus; /* The card's PCI ID */ |
112 | __u32 sisfb_pcislot; | 96 | __u32 sisfb_pcislot; |
113 | __u32 sisfb_pcifunc; | 97 | __u32 sisfb_pcifunc; |
98 | |||
99 | __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ | ||
100 | |||
101 | __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ | ||
102 | |||
103 | __u32 sisfb_vbflags; | ||
104 | __u32 sisfb_currentvbflags; | ||
105 | |||
106 | __u32 sisfb_scalelcd; | ||
107 | __u32 sisfb_specialtiming; | ||
108 | |||
109 | __u8 sisfb_haveemi; | ||
110 | __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; | ||
111 | __u8 sisfb_haveemilcd; | ||
114 | 112 | ||
115 | __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ | 113 | __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ |
116 | 114 | ||
117 | __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ | 115 | __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ |
118 | 116 | ||
119 | __u32 sisfb_vbflags; | 117 | __u32 sisfb_heapsize; /* heap size (in KB) */ |
120 | __u32 sisfb_currentvbflags; | 118 | __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ |
121 | 119 | ||
122 | __u32 sisfb_scalelcd; | 120 | __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ |
123 | __u32 sisfb_specialtiming; | 121 | __u32 sisfb_curdstn; |
124 | 122 | ||
125 | __u8 sisfb_haveemi; | 123 | __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ |
126 | __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; | ||
127 | __u8 sisfb_haveemilcd; | ||
128 | 124 | ||
129 | __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ | 125 | __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ |
130 | 126 | ||
131 | __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ | 127 | __u8 sisfb_can_post; /* sisfb can POST this card */ |
128 | __u8 sisfb_card_posted; /* card is POSTED */ | ||
129 | __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ | ||
132 | 130 | ||
133 | __u8 reserved[208]; /* for future use */ | 131 | __u8 reserved[183]; /* for future use */ |
132 | }; | ||
133 | |||
134 | #define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ | ||
135 | #define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ | ||
136 | /* more to come */ | ||
137 | |||
138 | #define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ | ||
139 | #define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ | ||
140 | #define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ | ||
141 | #define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ | ||
142 | #define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ | ||
143 | /* more to come */ | ||
144 | #define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ | ||
145 | #define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ | ||
146 | |||
147 | /* Argument for SISFB_CMD ioctl */ | ||
148 | struct sisfb_cmd { | ||
149 | __u32 sisfb_cmd; | ||
150 | __u32 sisfb_arg[16]; | ||
151 | __u32 sisfb_result[4]; | ||
134 | }; | 152 | }; |
135 | 153 | ||
136 | /* Addtional IOCTLs for communication sisfb <> X driver */ | 154 | /* Addtional IOCTLs for communication sisfb <> X driver */ |
137 | /* If changing this, vgatypes.h must also be changed (for X driver) */ | 155 | /* If changing this, vgatypes.h must also be changed (for X driver) */ |
138 | 156 | ||
139 | /* ioctl for identifying and giving some info (esp. memory heap start) */ | 157 | /* ioctl for identifying and giving some info (esp. memory heap start) */ |
140 | #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) | 158 | #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) |
141 | #define SISFB_GET_INFO _IOR(0xF3,0x01,struct _SISFB_INFO) | 159 | #define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) |
142 | 160 | ||
143 | /* ioctrl to get current vertical retrace status */ | 161 | /* ioctrl to get current vertical retrace status */ |
144 | #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) | 162 | #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) |
145 | 163 | ||
146 | /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ | 164 | /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ |
147 | #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) | 165 | #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) |
148 | #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) | 166 | #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) |
149 | 167 | ||
150 | /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ | 168 | /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ |
151 | #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) | 169 | #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) |
152 | #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) | 170 | #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) |
171 | |||
172 | /* ioctl for internal sisfb commands (sisfbctrl) */ | ||
173 | #define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) | ||
153 | 174 | ||
154 | /* ioctl for locking sisfb (no register access during lock) */ | 175 | /* ioctl for locking sisfb (no register access during lock) */ |
155 | /* As of now, only used to avoid register access during | 176 | /* As of now, only used to avoid register access during |
156 | * the ioctls listed above. | 177 | * the ioctls listed above. |
157 | */ | 178 | */ |
158 | #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) | 179 | #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) |
159 | |||
160 | /* more to come soon */ | ||
161 | 180 | ||
162 | /* ioctls 0xF3 up to 0x3F reserved for sisfb */ | 181 | /* ioctls 0xF3 up to 0x3F reserved for sisfb */ |
163 | 182 | ||
@@ -165,7 +184,7 @@ struct _SISFB_INFO { | |||
165 | /* The following are deprecated and should not be used anymore: */ | 184 | /* The following are deprecated and should not be used anymore: */ |
166 | /****************************************************************/ | 185 | /****************************************************************/ |
167 | /* ioctl for identifying and giving some info (esp. memory heap start) */ | 186 | /* ioctl for identifying and giving some info (esp. memory heap start) */ |
168 | #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) | 187 | #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) |
169 | /* ioctrl to get current vertical retrace status */ | 188 | /* ioctrl to get current vertical retrace status */ |
170 | #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) | 189 | #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) |
171 | /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ | 190 | /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ |
@@ -177,8 +196,8 @@ struct _SISFB_INFO { | |||
177 | 196 | ||
178 | /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ | 197 | /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ |
179 | struct sis_memreq { | 198 | struct sis_memreq { |
180 | __u32 offset; | 199 | __u32 offset; |
181 | __u32 size; | 200 | __u32 size; |
182 | }; | 201 | }; |
183 | 202 | ||
184 | /**********************************************/ | 203 | /**********************************************/ |
@@ -187,12 +206,19 @@ struct sis_memreq { | |||
187 | /**********************************************/ | 206 | /**********************************************/ |
188 | 207 | ||
189 | #ifdef __KERNEL__ | 208 | #ifdef __KERNEL__ |
209 | |||
210 | #include <linux/pci.h> | ||
211 | |||
190 | #define UNKNOWN_VGA 0 | 212 | #define UNKNOWN_VGA 0 |
191 | #define SIS_300_VGA 1 | 213 | #define SIS_300_VGA 1 |
192 | #define SIS_315_VGA 2 | 214 | #define SIS_315_VGA 2 |
193 | 215 | ||
216 | #define SISFB_HAVE_MALLOC_NEW | ||
194 | extern void sis_malloc(struct sis_memreq *req); | 217 | extern void sis_malloc(struct sis_memreq *req); |
218 | extern void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req); | ||
219 | |||
195 | extern void sis_free(u32 base); | 220 | extern void sis_free(u32 base); |
221 | extern void sis_free_new(struct pci_dev *pdev, u32 base); | ||
196 | #endif | 222 | #endif |
197 | 223 | ||
198 | #endif | 224 | #endif |