diff options
Diffstat (limited to 'include')
450 files changed, 11144 insertions, 6728 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 5c823d5ab783..d814da4b5365 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -85,7 +85,8 @@ | |||
85 | #define ACPI_LV_INIT 0x00000001 | 85 | #define ACPI_LV_INIT 0x00000001 |
86 | #define ACPI_LV_DEBUG_OBJECT 0x00000002 | 86 | #define ACPI_LV_DEBUG_OBJECT 0x00000002 |
87 | #define ACPI_LV_INFO 0x00000004 | 87 | #define ACPI_LV_INFO 0x00000004 |
88 | #define ACPI_LV_ALL_EXCEPTIONS 0x00000007 | 88 | #define ACPI_LV_REPAIR 0x00000008 |
89 | #define ACPI_LV_ALL_EXCEPTIONS 0x0000000F | ||
89 | 90 | ||
90 | /* Trace verbosity level 1 [Standard Trace Level] */ | 91 | /* Trace verbosity level 1 [Standard Trace Level] */ |
91 | 92 | ||
@@ -143,6 +144,7 @@ | |||
143 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | 144 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
144 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | 145 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
145 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) | 146 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) |
147 | #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) | ||
146 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) | 148 | #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) |
147 | 149 | ||
148 | /* Trace level -- also used in the global "DebugLevel" */ | 150 | /* Trace level -- also used in the global "DebugLevel" */ |
@@ -174,8 +176,8 @@ | |||
174 | 176 | ||
175 | /* Defaults for debug_level, debug and normal */ | 177 | /* Defaults for debug_level, debug and normal */ |
176 | 178 | ||
177 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO) | 179 | #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR) |
178 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) | 180 | #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) |
179 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) | 181 | #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) |
180 | 182 | ||
181 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) | 183 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) |
diff --git a/include/acpi/acpi_hest.h b/include/acpi/acpi_hest.h new file mode 100644 index 000000000000..63194d03cb2d --- /dev/null +++ b/include/acpi/acpi_hest.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ACPI_HEST_H | ||
2 | #define __ACPI_HEST_H | ||
3 | |||
4 | #include <linux/pci.h> | ||
5 | |||
6 | #ifdef CONFIG_ACPI | ||
7 | extern int acpi_hest_firmware_first_pci(struct pci_dev *pci); | ||
8 | #else | ||
9 | static inline int acpi_hest_firmware_first_pci(struct pci_dev *pci) { return 0; } | ||
10 | #endif | ||
11 | |||
12 | #endif | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index e723b0fd8e41..86e9735a96bd 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20090903 | 50 | #define ACPI_CA_VERSION 0x20091214 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
@@ -154,7 +154,8 @@ acpi_status | |||
154 | acpi_walk_namespace(acpi_object_type type, | 154 | acpi_walk_namespace(acpi_object_type type, |
155 | acpi_handle start_object, | 155 | acpi_handle start_object, |
156 | u32 max_depth, | 156 | u32 max_depth, |
157 | acpi_walk_callback user_function, | 157 | acpi_walk_callback pre_order_visit, |
158 | acpi_walk_callback post_order_visit, | ||
158 | void *context, void **return_value); | 159 | void *context, void **return_value); |
159 | 160 | ||
160 | acpi_status | 161 | acpi_status |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 9d7febde10a1..09469971472f 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
152 | #include <linux/hardirq.h> | 152 | #include <linux/hardirq.h> |
153 | #define ACPI_PREEMPTION_POINT() \ | 153 | #define ACPI_PREEMPTION_POINT() \ |
154 | do { \ | 154 | do { \ |
155 | if (!in_atomic_preempt_off()) \ | 155 | if (!in_atomic_preempt_off() && !irqs_disabled()) \ |
156 | cond_resched(); \ | 156 | cond_resched(); \ |
157 | } while (0) | 157 | } while (0) |
158 | 158 | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 740ac3ad8fd0..0ea5ef4eb6a9 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -224,8 +224,6 @@ struct acpi_processor { | |||
224 | struct acpi_processor_throttling throttling; | 224 | struct acpi_processor_throttling throttling; |
225 | struct acpi_processor_limit limit; | 225 | struct acpi_processor_limit limit; |
226 | struct thermal_cooling_device *cdev; | 226 | struct thermal_cooling_device *cdev; |
227 | /* the _PDC objects for this processor, if any */ | ||
228 | struct acpi_object_list *pdc; | ||
229 | }; | 227 | }; |
230 | 228 | ||
231 | struct acpi_processor_errata { | 229 | struct acpi_processor_errata { |
@@ -257,9 +255,6 @@ int acpi_processor_notify_smm(struct module *calling_module); | |||
257 | DECLARE_PER_CPU(struct acpi_processor *, processors); | 255 | DECLARE_PER_CPU(struct acpi_processor *, processors); |
258 | extern struct acpi_processor_errata errata; | 256 | extern struct acpi_processor_errata errata; |
259 | 257 | ||
260 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr); | ||
261 | void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr); | ||
262 | |||
263 | #ifdef ARCH_HAS_POWER_INIT | 258 | #ifdef ARCH_HAS_POWER_INIT |
264 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, | 259 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, |
265 | unsigned int cpu); | 260 | unsigned int cpu); |
@@ -294,7 +289,8 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx | |||
294 | #ifdef CONFIG_CPU_FREQ | 289 | #ifdef CONFIG_CPU_FREQ |
295 | void acpi_processor_ppc_init(void); | 290 | void acpi_processor_ppc_init(void); |
296 | void acpi_processor_ppc_exit(void); | 291 | void acpi_processor_ppc_exit(void); |
297 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr); | 292 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); |
293 | extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); | ||
298 | #else | 294 | #else |
299 | static inline void acpi_processor_ppc_init(void) | 295 | static inline void acpi_processor_ppc_init(void) |
300 | { | 296 | { |
@@ -304,7 +300,8 @@ static inline void acpi_processor_ppc_exit(void) | |||
304 | { | 300 | { |
305 | return; | 301 | return; |
306 | } | 302 | } |
307 | static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | 303 | static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr, |
304 | int event_flag) | ||
308 | { | 305 | { |
309 | static unsigned int printout = 1; | 306 | static unsigned int printout = 1; |
310 | if (printout) { | 307 | if (printout) { |
@@ -316,8 +313,16 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |||
316 | } | 313 | } |
317 | return 0; | 314 | return 0; |
318 | } | 315 | } |
316 | static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) | ||
317 | { | ||
318 | return -ENODEV; | ||
319 | } | ||
320 | |||
319 | #endif /* CONFIG_CPU_FREQ */ | 321 | #endif /* CONFIG_CPU_FREQ */ |
320 | 322 | ||
323 | /* in processor_pdc.c */ | ||
324 | void acpi_processor_set_pdc(acpi_handle handle); | ||
325 | |||
321 | /* in processor_throttling.c */ | 326 | /* in processor_throttling.c */ |
322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 327 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 328 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h index c8946465e63a..ecc44a8e2b44 100644 --- a/include/asm-generic/bitops/atomic.h +++ b/include/asm-generic/bitops/atomic.h | |||
@@ -15,19 +15,19 @@ | |||
15 | # define ATOMIC_HASH_SIZE 4 | 15 | # define ATOMIC_HASH_SIZE 4 |
16 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) | 16 | # define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) |
17 | 17 | ||
18 | extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; | 18 | extern arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; |
19 | 19 | ||
20 | /* Can't use raw_spin_lock_irq because of #include problems, so | 20 | /* Can't use raw_spin_lock_irq because of #include problems, so |
21 | * this is the substitute */ | 21 | * this is the substitute */ |
22 | #define _atomic_spin_lock_irqsave(l,f) do { \ | 22 | #define _atomic_spin_lock_irqsave(l,f) do { \ |
23 | raw_spinlock_t *s = ATOMIC_HASH(l); \ | 23 | arch_spinlock_t *s = ATOMIC_HASH(l); \ |
24 | local_irq_save(f); \ | 24 | local_irq_save(f); \ |
25 | __raw_spin_lock(s); \ | 25 | arch_spin_lock(s); \ |
26 | } while(0) | 26 | } while(0) |
27 | 27 | ||
28 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ | 28 | #define _atomic_spin_unlock_irqrestore(l,f) do { \ |
29 | raw_spinlock_t *s = ATOMIC_HASH(l); \ | 29 | arch_spinlock_t *s = ATOMIC_HASH(l); \ |
30 | __raw_spin_unlock(s); \ | 30 | arch_spin_unlock(s); \ |
31 | local_irq_restore(f); \ | 31 | local_irq_restore(f); \ |
32 | } while(0) | 32 | } while(0) |
33 | 33 | ||
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 4b6755984d24..18c435d7c082 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -113,22 +113,22 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #define WARN_ON_ONCE(condition) ({ \ | 115 | #define WARN_ON_ONCE(condition) ({ \ |
116 | static int __warned; \ | 116 | static bool __warned; \ |
117 | int __ret_warn_once = !!(condition); \ | 117 | int __ret_warn_once = !!(condition); \ |
118 | \ | 118 | \ |
119 | if (unlikely(__ret_warn_once)) \ | 119 | if (unlikely(__ret_warn_once)) \ |
120 | if (WARN_ON(!__warned)) \ | 120 | if (WARN_ON(!__warned)) \ |
121 | __warned = 1; \ | 121 | __warned = true; \ |
122 | unlikely(__ret_warn_once); \ | 122 | unlikely(__ret_warn_once); \ |
123 | }) | 123 | }) |
124 | 124 | ||
125 | #define WARN_ONCE(condition, format...) ({ \ | 125 | #define WARN_ONCE(condition, format...) ({ \ |
126 | static int __warned; \ | 126 | static bool __warned; \ |
127 | int __ret_warn_once = !!(condition); \ | 127 | int __ret_warn_once = !!(condition); \ |
128 | \ | 128 | \ |
129 | if (unlikely(__ret_warn_once)) \ | 129 | if (unlikely(__ret_warn_once)) \ |
130 | if (WARN(!__warned, format)) \ | 130 | if (WARN(!__warned, format)) \ |
131 | __warned = 1; \ | 131 | __warned = true; \ |
132 | unlikely(__ret_warn_once); \ | 132 | unlikely(__ret_warn_once); \ |
133 | }) | 133 | }) |
134 | 134 | ||
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index 495dc8af4044..fcd268ce0674 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
7 | located on an ext2 file system */ | ||
8 | #define O_ACCMODE 00000003 | 6 | #define O_ACCMODE 00000003 |
9 | #define O_RDONLY 00000000 | 7 | #define O_RDONLY 00000000 |
10 | #define O_WRONLY 00000001 | 8 | #define O_WRONLY 00000001 |
@@ -27,8 +25,8 @@ | |||
27 | #ifndef O_NONBLOCK | 25 | #ifndef O_NONBLOCK |
28 | #define O_NONBLOCK 00004000 | 26 | #define O_NONBLOCK 00004000 |
29 | #endif | 27 | #endif |
30 | #ifndef O_SYNC | 28 | #ifndef O_DSYNC |
31 | #define O_SYNC 00010000 | 29 | #define O_DSYNC 00010000 /* used to be O_SYNC, see below */ |
32 | #endif | 30 | #endif |
33 | #ifndef FASYNC | 31 | #ifndef FASYNC |
34 | #define FASYNC 00020000 /* fcntl, for BSD compatibility */ | 32 | #define FASYNC 00020000 /* fcntl, for BSD compatibility */ |
@@ -51,6 +49,25 @@ | |||
51 | #ifndef O_CLOEXEC | 49 | #ifndef O_CLOEXEC |
52 | #define O_CLOEXEC 02000000 /* set close_on_exec */ | 50 | #define O_CLOEXEC 02000000 /* set close_on_exec */ |
53 | #endif | 51 | #endif |
52 | |||
53 | /* | ||
54 | * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using | ||
55 | * the O_SYNC flag. We continue to use the existing numerical value | ||
56 | * for O_DSYNC semantics now, but using the correct symbolic name for it. | ||
57 | * This new value is used to request true Posix O_SYNC semantics. It is | ||
58 | * defined in this strange way to make sure applications compiled against | ||
59 | * new headers get at least O_DSYNC semantics on older kernels. | ||
60 | * | ||
61 | * This has the nice side-effect that we can simply test for O_DSYNC | ||
62 | * wherever we do not care if O_DSYNC or O_SYNC is used. | ||
63 | * | ||
64 | * Note: __O_SYNC must never be used directly. | ||
65 | */ | ||
66 | #ifndef O_SYNC | ||
67 | #define __O_SYNC 04000000 | ||
68 | #define O_SYNC (__O_SYNC|O_DSYNC) | ||
69 | #endif | ||
70 | |||
54 | #ifndef O_NDELAY | 71 | #ifndef O_NDELAY |
55 | #define O_NDELAY O_NONBLOCK | 72 | #define O_NDELAY O_NONBLOCK |
56 | #endif | 73 | #endif |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 66d6106a2067..485eeb6c4ef3 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number) | |||
28 | return ((unsigned)number) < ARCH_NR_GPIOS; | 28 | return ((unsigned)number) < ARCH_NR_GPIOS; |
29 | } | 29 | } |
30 | 30 | ||
31 | struct device; | ||
31 | struct seq_file; | 32 | struct seq_file; |
32 | struct module; | 33 | struct module; |
33 | 34 | ||
@@ -144,6 +145,7 @@ extern int __gpio_to_irq(unsigned gpio); | |||
144 | extern int gpio_export(unsigned gpio, bool direction_may_change); | 145 | extern int gpio_export(unsigned gpio, bool direction_may_change); |
145 | extern int gpio_export_link(struct device *dev, const char *name, | 146 | extern int gpio_export_link(struct device *dev, const char *name, |
146 | unsigned gpio); | 147 | unsigned gpio); |
148 | extern int gpio_sysfs_set_active_low(unsigned gpio, int value); | ||
147 | extern void gpio_unexport(unsigned gpio); | 149 | extern void gpio_unexport(unsigned gpio); |
148 | 150 | ||
149 | #endif /* CONFIG_GPIO_SYSFS */ | 151 | #endif /* CONFIG_GPIO_SYSFS */ |
@@ -181,6 +183,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |||
181 | 183 | ||
182 | #ifndef CONFIG_GPIO_SYSFS | 184 | #ifndef CONFIG_GPIO_SYSFS |
183 | 185 | ||
186 | struct device; | ||
187 | |||
184 | /* sysfs support is only available with gpiolib, where it's optional */ | 188 | /* sysfs support is only available with gpiolib, where it's optional */ |
185 | 189 | ||
186 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | 190 | static inline int gpio_export(unsigned gpio, bool direction_may_change) |
@@ -194,6 +198,11 @@ static inline int gpio_export_link(struct device *dev, const char *name, | |||
194 | return -ENOSYS; | 198 | return -ENOSYS; |
195 | } | 199 | } |
196 | 200 | ||
201 | static inline int gpio_sysfs_set_active_low(unsigned gpio, int value) | ||
202 | { | ||
203 | return -ENOSYS; | ||
204 | } | ||
205 | |||
197 | static inline void gpio_unexport(unsigned gpio) | 206 | static inline void gpio_unexport(unsigned gpio) |
198 | { | 207 | { |
199 | } | 208 | } |
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h index 4c8d0afae711..fb2d63f13f4c 100644 --- a/include/asm-generic/memory_model.h +++ b/include/asm-generic/memory_model.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | #elif defined(CONFIG_SPARSEMEM_VMEMMAP) | 48 | #elif defined(CONFIG_SPARSEMEM_VMEMMAP) |
49 | 49 | ||
50 | /* memmap is virtually contigious. */ | 50 | /* memmap is virtually contiguous. */ |
51 | #define __pfn_to_page(pfn) (vmemmap + (pfn)) | 51 | #define __pfn_to_page(pfn) (vmemmap + (pfn)) |
52 | #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) | 52 | #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) |
53 | 53 | ||
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h index 5ee13b2fd223..3da9e2742fa0 100644 --- a/include/asm-generic/mman-common.h +++ b/include/asm-generic/mman-common.h | |||
@@ -19,6 +19,11 @@ | |||
19 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | 19 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ |
20 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | 20 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ |
21 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | 21 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ |
22 | #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED | ||
23 | # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ | ||
24 | #else | ||
25 | # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ | ||
26 | #endif | ||
22 | 27 | ||
23 | #define MS_ASYNC 1 /* sync memory asynchronously */ | 28 | #define MS_ASYNC 1 /* sync memory asynchronously */ |
24 | #define MS_INVALIDATE 2 /* invalidate the caches */ | 29 | #define MS_INVALIDATE 2 /* invalidate the caches */ |
@@ -35,6 +40,7 @@ | |||
35 | #define MADV_DONTFORK 10 /* don't inherit across fork */ | 40 | #define MADV_DONTFORK 10 /* don't inherit across fork */ |
36 | #define MADV_DOFORK 11 /* do inherit across fork */ | 41 | #define MADV_DOFORK 11 /* do inherit across fork */ |
37 | #define MADV_HWPOISON 100 /* poison a page for testing */ | 42 | #define MADV_HWPOISON 100 /* poison a page for testing */ |
43 | #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ | ||
38 | 44 | ||
39 | #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ | 45 | #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ |
40 | #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ | 46 | #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 90079c373f1c..8087b90d4673 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -56,6 +56,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
56 | #define __raw_get_cpu_var(var) \ | 56 | #define __raw_get_cpu_var(var) \ |
57 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) | 57 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) |
58 | 58 | ||
59 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) | ||
60 | #define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) | ||
61 | |||
59 | 62 | ||
60 | #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA | 63 | #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA |
61 | extern void setup_per_cpu_areas(void); | 64 | extern void setup_per_cpu_areas(void); |
@@ -66,6 +69,8 @@ extern void setup_per_cpu_areas(void); | |||
66 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) | 69 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) |
67 | #define __get_cpu_var(var) per_cpu_var(var) | 70 | #define __get_cpu_var(var) per_cpu_var(var) |
68 | #define __raw_get_cpu_var(var) per_cpu_var(var) | 71 | #define __raw_get_cpu_var(var) per_cpu_var(var) |
72 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | ||
73 | #define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) | ||
69 | 74 | ||
70 | #endif /* SMP */ | 75 | #endif /* SMP */ |
71 | 76 | ||
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index d76b66acea95..6a0b30f78a62 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -622,16 +622,20 @@ __SYSCALL(__NR_move_pages, sys_move_pages) | |||
622 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) | 622 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) |
623 | #define __NR_perf_event_open 241 | 623 | #define __NR_perf_event_open 241 |
624 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) | 624 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) |
625 | #define __NR_accept4 242 | ||
626 | __SYSCALL(__NR_accept4, sys_accept4) | ||
627 | #define __NR_recvmmsg 243 | ||
628 | __SYSCALL(__NR_recvmmsg, sys_recvmmsg) | ||
625 | 629 | ||
626 | #undef __NR_syscalls | 630 | #undef __NR_syscalls |
627 | #define __NR_syscalls 242 | 631 | #define __NR_syscalls 244 |
628 | 632 | ||
629 | /* | 633 | /* |
630 | * All syscalls below here should go away really, | 634 | * All syscalls below here should go away really, |
631 | * these are provided for both review and as a porting | 635 | * these are provided for both review and as a porting |
632 | * help for the C library version. | 636 | * help for the C library version. |
633 | * | 637 | * |
634 | * Last chance: are any of these important enought to | 638 | * Last chance: are any of these important enough to |
635 | * enable by default? | 639 | * enable by default? |
636 | */ | 640 | */ |
637 | #ifdef __ARCH_WANT_SYSCALL_NO_AT | 641 | #ifdef __ARCH_WANT_SYSCALL_NO_AT |
@@ -802,7 +806,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall) | |||
802 | #define __NR_statfs __NR3264_statfs | 806 | #define __NR_statfs __NR3264_statfs |
803 | #define __NR_fstatfs __NR3264_fstatfs | 807 | #define __NR_fstatfs __NR3264_fstatfs |
804 | #define __NR_truncate __NR3264_truncate | 808 | #define __NR_truncate __NR3264_truncate |
805 | #define __NR_ftruncate __NR3264_truncate | 809 | #define __NR_ftruncate __NR3264_ftruncate |
806 | #define __NR_lseek __NR3264_lseek | 810 | #define __NR_lseek __NR3264_lseek |
807 | #define __NR_sendfile __NR3264_sendfile | 811 | #define __NR_sendfile __NR3264_sendfile |
808 | #define __NR_newfstatat __NR3264_fstatat | 812 | #define __NR_newfstatat __NR3264_fstatat |
@@ -818,7 +822,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall) | |||
818 | #define __NR_statfs64 __NR3264_statfs | 822 | #define __NR_statfs64 __NR3264_statfs |
819 | #define __NR_fstatfs64 __NR3264_fstatfs | 823 | #define __NR_fstatfs64 __NR3264_fstatfs |
820 | #define __NR_truncate64 __NR3264_truncate | 824 | #define __NR_truncate64 __NR3264_truncate |
821 | #define __NR_ftruncate64 __NR3264_truncate | 825 | #define __NR_ftruncate64 __NR3264_ftruncate |
822 | #define __NR_llseek __NR3264_lseek | 826 | #define __NR_llseek __NR3264_lseek |
823 | #define __NR_sendfile64 __NR3264_sendfile | 827 | #define __NR_sendfile64 __NR3264_sendfile |
824 | #define __NR_fstatat64 __NR3264_fstatat | 828 | #define __NR_fstatat64 __NR3264_fstatat |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b6e818f4b247..67e652068e0e 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -52,8 +52,12 @@ | |||
52 | #define LOAD_OFFSET 0 | 52 | #define LOAD_OFFSET 0 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #ifndef VMLINUX_SYMBOL | 55 | #ifndef SYMBOL_PREFIX |
56 | #define VMLINUX_SYMBOL(_sym_) _sym_ | 56 | #define VMLINUX_SYMBOL(sym) sym |
57 | #else | ||
58 | #define PASTE2(x,y) x##y | ||
59 | #define PASTE(x,y) PASTE2(x,y) | ||
60 | #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym) | ||
57 | #endif | 61 | #endif |
58 | 62 | ||
59 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 63 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 1ffb53f74d37..fc0d575c71e0 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -106,7 +106,6 @@ struct blkcipher_walk { | |||
106 | extern const struct crypto_type crypto_ablkcipher_type; | 106 | extern const struct crypto_type crypto_ablkcipher_type; |
107 | extern const struct crypto_type crypto_aead_type; | 107 | extern const struct crypto_type crypto_aead_type; |
108 | extern const struct crypto_type crypto_blkcipher_type; | 108 | extern const struct crypto_type crypto_blkcipher_type; |
109 | extern const struct crypto_type crypto_hash_type; | ||
110 | 109 | ||
111 | void crypto_mod_put(struct crypto_alg *alg); | 110 | void crypto_mod_put(struct crypto_alg *alg); |
112 | 111 | ||
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h index 2f65a6e8ea4d..1c96b255017c 100644 --- a/include/crypto/cryptd.h +++ b/include/crypto/cryptd.h | |||
@@ -39,6 +39,7 @@ static inline struct cryptd_ahash *__cryptd_ahash_cast( | |||
39 | struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, | 39 | struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, |
40 | u32 type, u32 mask); | 40 | u32 type, u32 mask); |
41 | struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); | 41 | struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); |
42 | struct shash_desc *cryptd_shash_desc(struct ahash_request *req); | ||
42 | void cryptd_free_ahash(struct cryptd_ahash *tfm); | 43 | void cryptd_free_ahash(struct cryptd_ahash *tfm); |
43 | 44 | ||
44 | #endif | 45 | #endif |
diff --git a/include/drm/Kbuild b/include/drm/Kbuild index b940fdfa3b25..bd3a1c2fbdb4 100644 --- a/include/drm/Kbuild +++ b/include/drm/Kbuild | |||
@@ -7,4 +7,6 @@ unifdef-y += r128_drm.h | |||
7 | unifdef-y += radeon_drm.h | 7 | unifdef-y += radeon_drm.h |
8 | unifdef-y += sis_drm.h | 8 | unifdef-y += sis_drm.h |
9 | unifdef-y += savage_drm.h | 9 | unifdef-y += savage_drm.h |
10 | unifdef-y += vmwgfx_drm.h | ||
10 | unifdef-y += via_drm.h | 11 | unifdef-y += via_drm.h |
12 | unifdef-y += nouveau_drm.h | ||
diff --git a/include/drm/drm.h b/include/drm/drm.h index 7cb50bdde46d..e3f46e0cb7dc 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -36,17 +36,27 @@ | |||
36 | #ifndef _DRM_H_ | 36 | #ifndef _DRM_H_ |
37 | #define _DRM_H_ | 37 | #define _DRM_H_ |
38 | 38 | ||
39 | #if defined(__linux__) | ||
40 | |||
39 | #include <linux/types.h> | 41 | #include <linux/types.h> |
40 | #include <asm/ioctl.h> /* For _IO* macros */ | 42 | #include <asm/ioctl.h> |
41 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | 43 | typedef unsigned int drm_handle_t; |
42 | #define DRM_IOC_VOID _IOC_NONE | ||
43 | #define DRM_IOC_READ _IOC_READ | ||
44 | #define DRM_IOC_WRITE _IOC_WRITE | ||
45 | #define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE | ||
46 | #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) | ||
47 | 44 | ||
48 | #define DRM_MAJOR 226 | 45 | #else /* One of the BSDs */ |
49 | #define DRM_MAX_MINOR 15 | 46 | |
47 | #include <sys/ioccom.h> | ||
48 | #include <sys/types.h> | ||
49 | typedef int8_t __s8; | ||
50 | typedef uint8_t __u8; | ||
51 | typedef int16_t __s16; | ||
52 | typedef uint16_t __u16; | ||
53 | typedef int32_t __s32; | ||
54 | typedef uint32_t __u32; | ||
55 | typedef int64_t __s64; | ||
56 | typedef uint64_t __u64; | ||
57 | typedef unsigned long drm_handle_t; | ||
58 | |||
59 | #endif | ||
50 | 60 | ||
51 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ | 61 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ |
52 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ | 62 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ |
@@ -59,7 +69,6 @@ | |||
59 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) | 69 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) |
60 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) | 70 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) |
61 | 71 | ||
62 | typedef unsigned int drm_handle_t; | ||
63 | typedef unsigned int drm_context_t; | 72 | typedef unsigned int drm_context_t; |
64 | typedef unsigned int drm_drawable_t; | 73 | typedef unsigned int drm_drawable_t; |
65 | typedef unsigned int drm_magic_t; | 74 | typedef unsigned int drm_magic_t; |
@@ -454,6 +463,7 @@ struct drm_irq_busid { | |||
454 | enum drm_vblank_seq_type { | 463 | enum drm_vblank_seq_type { |
455 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | 464 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ |
456 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | 465 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ |
466 | _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ | ||
457 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | 467 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ |
458 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | 468 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ |
459 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | 469 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ |
@@ -461,8 +471,8 @@ enum drm_vblank_seq_type { | |||
461 | }; | 471 | }; |
462 | 472 | ||
463 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) | 473 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) |
464 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ | 474 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ |
465 | _DRM_VBLANK_NEXTONMISS) | 475 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) |
466 | 476 | ||
467 | struct drm_wait_vblank_request { | 477 | struct drm_wait_vblank_request { |
468 | enum drm_vblank_seq_type type; | 478 | enum drm_vblank_seq_type type; |
@@ -686,6 +696,8 @@ struct drm_gem_open { | |||
686 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) | 696 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) |
687 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) | 697 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) |
688 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) | 698 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) |
699 | #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) | ||
700 | #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) | ||
689 | 701 | ||
690 | /** | 702 | /** |
691 | * Device specific ioctls should only be in their respective headers | 703 | * Device specific ioctls should only be in their respective headers |
@@ -698,6 +710,35 @@ struct drm_gem_open { | |||
698 | #define DRM_COMMAND_BASE 0x40 | 710 | #define DRM_COMMAND_BASE 0x40 |
699 | #define DRM_COMMAND_END 0xA0 | 711 | #define DRM_COMMAND_END 0xA0 |
700 | 712 | ||
713 | /** | ||
714 | * Header for events written back to userspace on the drm fd. The | ||
715 | * type defines the type of event, the length specifies the total | ||
716 | * length of the event (including the header), and user_data is | ||
717 | * typically a 64 bit value passed with the ioctl that triggered the | ||
718 | * event. A read on the drm fd will always only return complete | ||
719 | * events, that is, if for example the read buffer is 100 bytes, and | ||
720 | * there are two 64 byte events pending, only one will be returned. | ||
721 | * | ||
722 | * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and | ||
723 | * up are chipset specific. | ||
724 | */ | ||
725 | struct drm_event { | ||
726 | __u32 type; | ||
727 | __u32 length; | ||
728 | }; | ||
729 | |||
730 | #define DRM_EVENT_VBLANK 0x01 | ||
731 | #define DRM_EVENT_FLIP_COMPLETE 0x02 | ||
732 | |||
733 | struct drm_event_vblank { | ||
734 | struct drm_event base; | ||
735 | __u64 user_data; | ||
736 | __u32 tv_sec; | ||
737 | __u32 tv_usec; | ||
738 | __u32 sequence; | ||
739 | __u32 reserved; | ||
740 | }; | ||
741 | |||
701 | /* typedef area */ | 742 | /* typedef area */ |
702 | #ifndef __KERNEL__ | 743 | #ifndef __KERNEL__ |
703 | typedef struct drm_clip_rect drm_clip_rect_t; | 744 | typedef struct drm_clip_rect drm_clip_rect_t; |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c8e64bbadbcf..ffac157fb5b2 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -245,16 +245,6 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
245 | 245 | ||
246 | #endif | 246 | #endif |
247 | 247 | ||
248 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) | ||
249 | |||
250 | #define DRM_PROC_PRINT(fmt, arg...) \ | ||
251 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
252 | if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; } | ||
253 | |||
254 | #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ | ||
255 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
256 | if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; } | ||
257 | |||
258 | /*@}*/ | 248 | /*@}*/ |
259 | 249 | ||
260 | /***********************************************************************/ | 250 | /***********************************************************************/ |
@@ -265,19 +255,8 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
265 | 255 | ||
266 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) | 256 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) |
267 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) | 257 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) |
268 | #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) | ||
269 | 258 | ||
270 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | 259 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
271 | /** | ||
272 | * Get the private SAREA mapping. | ||
273 | * | ||
274 | * \param _dev DRM device. | ||
275 | * \param _ctx context number. | ||
276 | * \param _map output mapping. | ||
277 | */ | ||
278 | #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ | ||
279 | (_map) = (_dev)->context_sareas[_ctx]; \ | ||
280 | } while(0) | ||
281 | 260 | ||
282 | /** | 261 | /** |
283 | * Test that the hardware lock is held by the caller, returning otherwise. | 262 | * Test that the hardware lock is held by the caller, returning otherwise. |
@@ -297,18 +276,6 @@ do { \ | |||
297 | } while (0) | 276 | } while (0) |
298 | 277 | ||
299 | /** | 278 | /** |
300 | * Copy and IOCTL return string to user space | ||
301 | */ | ||
302 | #define DRM_COPY( name, value ) \ | ||
303 | len = strlen( value ); \ | ||
304 | if ( len > name##_len ) len = name##_len; \ | ||
305 | name##_len = strlen( value ); \ | ||
306 | if ( len && name ) { \ | ||
307 | if ( copy_to_user( name, value, len ) ) \ | ||
308 | return -EFAULT; \ | ||
309 | } | ||
310 | |||
311 | /** | ||
312 | * Ioctl function type. | 279 | * Ioctl function type. |
313 | * | 280 | * |
314 | * \param inode device inode. | 281 | * \param inode device inode. |
@@ -322,10 +289,14 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data, | |||
322 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 289 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
323 | unsigned long arg); | 290 | unsigned long arg); |
324 | 291 | ||
292 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | ||
293 | #define DRM_MAJOR 226 | ||
294 | |||
325 | #define DRM_AUTH 0x1 | 295 | #define DRM_AUTH 0x1 |
326 | #define DRM_MASTER 0x2 | 296 | #define DRM_MASTER 0x2 |
327 | #define DRM_ROOT_ONLY 0x4 | 297 | #define DRM_ROOT_ONLY 0x4 |
328 | #define DRM_CONTROL_ALLOW 0x8 | 298 | #define DRM_CONTROL_ALLOW 0x8 |
299 | #define DRM_UNLOCKED 0x10 | ||
329 | 300 | ||
330 | struct drm_ioctl_desc { | 301 | struct drm_ioctl_desc { |
331 | unsigned int cmd; | 302 | unsigned int cmd; |
@@ -426,6 +397,14 @@ struct drm_buf_entry { | |||
426 | struct drm_freelist freelist; | 397 | struct drm_freelist freelist; |
427 | }; | 398 | }; |
428 | 399 | ||
400 | /* Event queued up for userspace to read */ | ||
401 | struct drm_pending_event { | ||
402 | struct drm_event *event; | ||
403 | struct list_head link; | ||
404 | struct drm_file *file_priv; | ||
405 | void (*destroy)(struct drm_pending_event *event); | ||
406 | }; | ||
407 | |||
429 | /** File private data */ | 408 | /** File private data */ |
430 | struct drm_file { | 409 | struct drm_file { |
431 | int authenticated; | 410 | int authenticated; |
@@ -449,6 +428,10 @@ struct drm_file { | |||
449 | struct drm_master *master; /* master this node is currently associated with | 428 | struct drm_master *master; /* master this node is currently associated with |
450 | N.B. not always minor->master */ | 429 | N.B. not always minor->master */ |
451 | struct list_head fbs; | 430 | struct list_head fbs; |
431 | |||
432 | wait_queue_head_t event_wait; | ||
433 | struct list_head event_list; | ||
434 | int event_space; | ||
452 | }; | 435 | }; |
453 | 436 | ||
454 | /** Wait queue */ | 437 | /** Wait queue */ |
@@ -795,6 +778,15 @@ struct drm_driver { | |||
795 | /* Master routines */ | 778 | /* Master routines */ |
796 | int (*master_create)(struct drm_device *dev, struct drm_master *master); | 779 | int (*master_create)(struct drm_device *dev, struct drm_master *master); |
797 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); | 780 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); |
781 | /** | ||
782 | * master_set is called whenever the minor master is set. | ||
783 | * master_drop is called whenever the minor master is dropped. | ||
784 | */ | ||
785 | |||
786 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, | ||
787 | bool from_open); | ||
788 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, | ||
789 | bool from_release); | ||
798 | 790 | ||
799 | int (*proc_init)(struct drm_minor *minor); | 791 | int (*proc_init)(struct drm_minor *minor); |
800 | void (*proc_cleanup)(struct drm_minor *minor); | 792 | void (*proc_cleanup)(struct drm_minor *minor); |
@@ -900,6 +892,12 @@ struct drm_minor { | |||
900 | struct drm_mode_group mode_group; | 892 | struct drm_mode_group mode_group; |
901 | }; | 893 | }; |
902 | 894 | ||
895 | struct drm_pending_vblank_event { | ||
896 | struct drm_pending_event base; | ||
897 | int pipe; | ||
898 | struct drm_event_vblank event; | ||
899 | }; | ||
900 | |||
903 | /** | 901 | /** |
904 | * DRM device structure. This structure represent a complete card that | 902 | * DRM device structure. This structure represent a complete card that |
905 | * may contain multiple heads. | 903 | * may contain multiple heads. |
@@ -999,6 +997,12 @@ struct drm_device { | |||
999 | 997 | ||
1000 | u32 max_vblank_count; /**< size of vblank counter register */ | 998 | u32 max_vblank_count; /**< size of vblank counter register */ |
1001 | 999 | ||
1000 | /** | ||
1001 | * List of events | ||
1002 | */ | ||
1003 | struct list_head vblank_event_list; | ||
1004 | spinlock_t event_lock; | ||
1005 | |||
1002 | /*@} */ | 1006 | /*@} */ |
1003 | cycles_t ctx_start; | 1007 | cycles_t ctx_start; |
1004 | cycles_t lck_start; | 1008 | cycles_t lck_start; |
@@ -1125,8 +1129,8 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, | |||
1125 | /* Driver support (drm_drv.h) */ | 1129 | /* Driver support (drm_drv.h) */ |
1126 | extern int drm_init(struct drm_driver *driver); | 1130 | extern int drm_init(struct drm_driver *driver); |
1127 | extern void drm_exit(struct drm_driver *driver); | 1131 | extern void drm_exit(struct drm_driver *driver); |
1128 | extern int drm_ioctl(struct inode *inode, struct file *filp, | 1132 | extern long drm_ioctl(struct file *filp, |
1129 | unsigned int cmd, unsigned long arg); | 1133 | unsigned int cmd, unsigned long arg); |
1130 | extern long drm_compat_ioctl(struct file *filp, | 1134 | extern long drm_compat_ioctl(struct file *filp, |
1131 | unsigned int cmd, unsigned long arg); | 1135 | unsigned int cmd, unsigned long arg); |
1132 | extern int drm_lastclose(struct drm_device *dev); | 1136 | extern int drm_lastclose(struct drm_device *dev); |
@@ -1135,6 +1139,8 @@ extern int drm_lastclose(struct drm_device *dev); | |||
1135 | extern int drm_open(struct inode *inode, struct file *filp); | 1139 | extern int drm_open(struct inode *inode, struct file *filp); |
1136 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 1140 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
1137 | extern int drm_fasync(int fd, struct file *filp, int on); | 1141 | extern int drm_fasync(int fd, struct file *filp, int on); |
1142 | extern ssize_t drm_read(struct file *filp, char __user *buffer, | ||
1143 | size_t count, loff_t *offset); | ||
1138 | extern int drm_release(struct inode *inode, struct file *filp); | 1144 | extern int drm_release(struct inode *inode, struct file *filp); |
1139 | 1145 | ||
1140 | /* Mapping support (drm_vm.h) */ | 1146 | /* Mapping support (drm_vm.h) */ |
@@ -1295,6 +1301,7 @@ extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | |||
1295 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1301 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); |
1296 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1302 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1297 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1303 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1304 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | ||
1298 | extern void drm_vblank_cleanup(struct drm_device *dev); | 1305 | extern void drm_vblank_cleanup(struct drm_device *dev); |
1299 | /* Modesetting support */ | 1306 | /* Modesetting support */ |
1300 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); | 1307 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
@@ -1401,7 +1408,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev, | |||
1401 | struct drm_ati_pcigart_info * gart_info); | 1408 | struct drm_ati_pcigart_info * gart_info); |
1402 | 1409 | ||
1403 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, | 1410 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, |
1404 | size_t align, dma_addr_t maxaddr); | 1411 | size_t align); |
1405 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1412 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
1406 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1413 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
1407 | 1414 | ||
@@ -1519,14 +1526,27 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map) | |||
1519 | 1526 | ||
1520 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) | 1527 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) |
1521 | { | 1528 | { |
1529 | if (size != 0 && nmemb > ULONG_MAX / size) | ||
1530 | return NULL; | ||
1531 | |||
1522 | if (size * nmemb <= PAGE_SIZE) | 1532 | if (size * nmemb <= PAGE_SIZE) |
1523 | return kcalloc(nmemb, size, GFP_KERNEL); | 1533 | return kcalloc(nmemb, size, GFP_KERNEL); |
1524 | 1534 | ||
1535 | return __vmalloc(size * nmemb, | ||
1536 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); | ||
1537 | } | ||
1538 | |||
1539 | /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ | ||
1540 | static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) | ||
1541 | { | ||
1525 | if (size != 0 && nmemb > ULONG_MAX / size) | 1542 | if (size != 0 && nmemb > ULONG_MAX / size) |
1526 | return NULL; | 1543 | return NULL; |
1527 | 1544 | ||
1545 | if (size * nmemb <= PAGE_SIZE) | ||
1546 | return kmalloc(nmemb * size, GFP_KERNEL); | ||
1547 | |||
1528 | return __vmalloc(size * nmemb, | 1548 | return __vmalloc(size * nmemb, |
1529 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); | 1549 | GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL); |
1530 | } | 1550 | } |
1531 | 1551 | ||
1532 | static __inline void drm_free_large(void *ptr) | 1552 | static __inline void drm_free_large(void *ptr) |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index b69347b8904f..fdf43abc36db 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -123,7 +123,7 @@ struct drm_display_mode { | |||
123 | int type; | 123 | int type; |
124 | 124 | ||
125 | /* Proposed mode values */ | 125 | /* Proposed mode values */ |
126 | int clock; | 126 | int clock; /* in kHz */ |
127 | int hdisplay; | 127 | int hdisplay; |
128 | int hsync_start; | 128 | int hsync_start; |
129 | int hsync_end; | 129 | int hsync_end; |
@@ -164,8 +164,8 @@ struct drm_display_mode { | |||
164 | int *private; | 164 | int *private; |
165 | int private_flags; | 165 | int private_flags; |
166 | 166 | ||
167 | int vrefresh; | 167 | int vrefresh; /* in Hz */ |
168 | float hsync; | 168 | int hsync; /* in kHz */ |
169 | }; | 169 | }; |
170 | 170 | ||
171 | enum drm_connector_status { | 171 | enum drm_connector_status { |
@@ -242,6 +242,21 @@ struct drm_framebuffer_funcs { | |||
242 | int (*create_handle)(struct drm_framebuffer *fb, | 242 | int (*create_handle)(struct drm_framebuffer *fb, |
243 | struct drm_file *file_priv, | 243 | struct drm_file *file_priv, |
244 | unsigned int *handle); | 244 | unsigned int *handle); |
245 | /** | ||
246 | * Optinal callback for the dirty fb ioctl. | ||
247 | * | ||
248 | * Userspace can notify the driver via this callback | ||
249 | * that a area of the framebuffer has changed and should | ||
250 | * be flushed to the display hardware. | ||
251 | * | ||
252 | * See documentation in drm_mode.h for the struct | ||
253 | * drm_mode_fb_dirty_cmd for more information as all | ||
254 | * the semantics and arguments have a one to one mapping | ||
255 | * on this function. | ||
256 | */ | ||
257 | int (*dirty)(struct drm_framebuffer *framebuffer, unsigned flags, | ||
258 | unsigned color, struct drm_clip_rect *clips, | ||
259 | unsigned num_clips); | ||
245 | }; | 260 | }; |
246 | 261 | ||
247 | struct drm_framebuffer { | 262 | struct drm_framebuffer { |
@@ -256,7 +271,7 @@ struct drm_framebuffer { | |||
256 | unsigned int depth; | 271 | unsigned int depth; |
257 | int bits_per_pixel; | 272 | int bits_per_pixel; |
258 | int flags; | 273 | int flags; |
259 | void *fbdev; | 274 | struct fb_info *fbdev; |
260 | u32 pseudo_palette[17]; | 275 | u32 pseudo_palette[17]; |
261 | struct list_head filp_head; | 276 | struct list_head filp_head; |
262 | /* if you are using the helper */ | 277 | /* if you are using the helper */ |
@@ -290,6 +305,7 @@ struct drm_property { | |||
290 | struct drm_crtc; | 305 | struct drm_crtc; |
291 | struct drm_connector; | 306 | struct drm_connector; |
292 | struct drm_encoder; | 307 | struct drm_encoder; |
308 | struct drm_pending_vblank_event; | ||
293 | 309 | ||
294 | /** | 310 | /** |
295 | * drm_crtc_funcs - control CRTCs for a given device | 311 | * drm_crtc_funcs - control CRTCs for a given device |
@@ -333,6 +349,19 @@ struct drm_crtc_funcs { | |||
333 | void (*destroy)(struct drm_crtc *crtc); | 349 | void (*destroy)(struct drm_crtc *crtc); |
334 | 350 | ||
335 | int (*set_config)(struct drm_mode_set *set); | 351 | int (*set_config)(struct drm_mode_set *set); |
352 | |||
353 | /* | ||
354 | * Flip to the given framebuffer. This implements the page | ||
355 | * flip ioctl descibed in drm_mode.h, specifically, the | ||
356 | * implementation must return immediately and block all | ||
357 | * rendering to the current fb until the flip has completed. | ||
358 | * If userspace set the event flag in the ioctl, the event | ||
359 | * argument will point to an event to send back when the flip | ||
360 | * completes, otherwise it will be NULL. | ||
361 | */ | ||
362 | int (*page_flip)(struct drm_crtc *crtc, | ||
363 | struct drm_framebuffer *fb, | ||
364 | struct drm_pending_vblank_event *event); | ||
336 | }; | 365 | }; |
337 | 366 | ||
338 | /** | 367 | /** |
@@ -596,6 +625,7 @@ struct drm_mode_config { | |||
596 | /* Optional properties */ | 625 | /* Optional properties */ |
597 | struct drm_property *scaling_mode_property; | 626 | struct drm_property *scaling_mode_property; |
598 | struct drm_property *dithering_mode_property; | 627 | struct drm_property *dithering_mode_property; |
628 | struct drm_property *dirty_info_property; | ||
599 | }; | 629 | }; |
600 | 630 | ||
601 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | 631 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
@@ -667,6 +697,7 @@ extern void drm_mode_validate_size(struct drm_device *dev, | |||
667 | extern void drm_mode_prune_invalid(struct drm_device *dev, | 697 | extern void drm_mode_prune_invalid(struct drm_device *dev, |
668 | struct list_head *mode_list, bool verbose); | 698 | struct list_head *mode_list, bool verbose); |
669 | extern void drm_mode_sort(struct list_head *mode_list); | 699 | extern void drm_mode_sort(struct list_head *mode_list); |
700 | extern int drm_mode_hsync(struct drm_display_mode *mode); | ||
670 | extern int drm_mode_vrefresh(struct drm_display_mode *mode); | 701 | extern int drm_mode_vrefresh(struct drm_display_mode *mode); |
671 | extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, | 702 | extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
672 | int adjust_flags); | 703 | int adjust_flags); |
@@ -703,6 +734,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats | |||
703 | char *formats[]); | 734 | char *formats[]); |
704 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | 735 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
705 | extern int drm_mode_create_dithering_property(struct drm_device *dev); | 736 | extern int drm_mode_create_dithering_property(struct drm_device *dev); |
737 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | ||
706 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); | 738 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); |
707 | 739 | ||
708 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | 740 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
@@ -711,7 +743,8 @@ extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, | |||
711 | struct drm_encoder *encoder); | 743 | struct drm_encoder *encoder); |
712 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, | 744 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, |
713 | int gamma_size); | 745 | int gamma_size); |
714 | extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type); | 746 | extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
747 | uint32_t id, uint32_t type); | ||
715 | /* IOCTLs */ | 748 | /* IOCTLs */ |
716 | extern int drm_mode_getresources(struct drm_device *dev, | 749 | extern int drm_mode_getresources(struct drm_device *dev, |
717 | void *data, struct drm_file *file_priv); | 750 | void *data, struct drm_file *file_priv); |
@@ -730,6 +763,8 @@ extern int drm_mode_rmfb(struct drm_device *dev, | |||
730 | void *data, struct drm_file *file_priv); | 763 | void *data, struct drm_file *file_priv); |
731 | extern int drm_mode_getfb(struct drm_device *dev, | 764 | extern int drm_mode_getfb(struct drm_device *dev, |
732 | void *data, struct drm_file *file_priv); | 765 | void *data, struct drm_file *file_priv); |
766 | extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | ||
767 | void *data, struct drm_file *file_priv); | ||
733 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, | 768 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, |
734 | void *data, struct drm_file *file_priv); | 769 | void *data, struct drm_file *file_priv); |
735 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, | 770 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, |
@@ -756,6 +791,8 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |||
756 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | 791 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
757 | void *data, struct drm_file *file_priv); | 792 | void *data, struct drm_file *file_priv); |
758 | extern bool drm_detect_hdmi_monitor(struct edid *edid); | 793 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
794 | extern int drm_mode_page_flip_ioctl(struct drm_device *dev, | ||
795 | void *data, struct drm_file *file_priv); | ||
759 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, | 796 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
760 | int hdisplay, int vdisplay, int vrefresh, | 797 | int hdisplay, int vdisplay, int vrefresh, |
761 | bool reduced, bool interlaced, bool margins); | 798 | bool reduced, bool interlaced, bool margins); |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h new file mode 100644 index 000000000000..a49e791db0b0 --- /dev/null +++ b/include/drm/drm_dp_helper.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * Copyright © 2008 Keith Packard | ||
3 | * | ||
4 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
5 | * documentation for any purpose is hereby granted without fee, provided that | ||
6 | * the above copyright notice appear in all copies and that both that copyright | ||
7 | * notice and this permission notice appear in supporting documentation, and | ||
8 | * that the name of the copyright holders not be used in advertising or | ||
9 | * publicity pertaining to distribution of the software without specific, | ||
10 | * written prior permission. The copyright holders make no representations | ||
11 | * about the suitability of this software for any purpose. It is provided "as | ||
12 | * is" without express or implied warranty. | ||
13 | * | ||
14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||
20 | * OF THIS SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef _DRM_DP_HELPER_H_ | ||
24 | #define _DRM_DP_HELPER_H_ | ||
25 | |||
26 | /* From the VESA DisplayPort spec */ | ||
27 | |||
28 | #define AUX_NATIVE_WRITE 0x8 | ||
29 | #define AUX_NATIVE_READ 0x9 | ||
30 | #define AUX_I2C_WRITE 0x0 | ||
31 | #define AUX_I2C_READ 0x1 | ||
32 | #define AUX_I2C_STATUS 0x2 | ||
33 | #define AUX_I2C_MOT 0x4 | ||
34 | |||
35 | #define AUX_NATIVE_REPLY_ACK (0x0 << 4) | ||
36 | #define AUX_NATIVE_REPLY_NACK (0x1 << 4) | ||
37 | #define AUX_NATIVE_REPLY_DEFER (0x2 << 4) | ||
38 | #define AUX_NATIVE_REPLY_MASK (0x3 << 4) | ||
39 | |||
40 | #define AUX_I2C_REPLY_ACK (0x0 << 6) | ||
41 | #define AUX_I2C_REPLY_NACK (0x1 << 6) | ||
42 | #define AUX_I2C_REPLY_DEFER (0x2 << 6) | ||
43 | #define AUX_I2C_REPLY_MASK (0x3 << 6) | ||
44 | |||
45 | /* AUX CH addresses */ | ||
46 | /* DPCD */ | ||
47 | #define DP_DPCD_REV 0x000 | ||
48 | |||
49 | #define DP_MAX_LINK_RATE 0x001 | ||
50 | |||
51 | #define DP_MAX_LANE_COUNT 0x002 | ||
52 | # define DP_MAX_LANE_COUNT_MASK 0x1f | ||
53 | # define DP_ENHANCED_FRAME_CAP (1 << 7) | ||
54 | |||
55 | #define DP_MAX_DOWNSPREAD 0x003 | ||
56 | # define DP_NO_AUX_HANDSHAKE_LINK_TRAINING (1 << 6) | ||
57 | |||
58 | #define DP_NORP 0x004 | ||
59 | |||
60 | #define DP_DOWNSTREAMPORT_PRESENT 0x005 | ||
61 | # define DP_DWN_STRM_PORT_PRESENT (1 << 0) | ||
62 | # define DP_DWN_STRM_PORT_TYPE_MASK 0x06 | ||
63 | /* 00b = DisplayPort */ | ||
64 | /* 01b = Analog */ | ||
65 | /* 10b = TMDS or HDMI */ | ||
66 | /* 11b = Other */ | ||
67 | # define DP_FORMAT_CONVERSION (1 << 3) | ||
68 | |||
69 | #define DP_MAIN_LINK_CHANNEL_CODING 0x006 | ||
70 | |||
71 | /* link configuration */ | ||
72 | #define DP_LINK_BW_SET 0x100 | ||
73 | # define DP_LINK_BW_1_62 0x06 | ||
74 | # define DP_LINK_BW_2_7 0x0a | ||
75 | |||
76 | #define DP_LANE_COUNT_SET 0x101 | ||
77 | # define DP_LANE_COUNT_MASK 0x0f | ||
78 | # define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7) | ||
79 | |||
80 | #define DP_TRAINING_PATTERN_SET 0x102 | ||
81 | # define DP_TRAINING_PATTERN_DISABLE 0 | ||
82 | # define DP_TRAINING_PATTERN_1 1 | ||
83 | # define DP_TRAINING_PATTERN_2 2 | ||
84 | # define DP_TRAINING_PATTERN_MASK 0x3 | ||
85 | |||
86 | # define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) | ||
87 | # define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2) | ||
88 | # define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2) | ||
89 | # define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2) | ||
90 | # define DP_LINK_QUAL_PATTERN_MASK (3 << 2) | ||
91 | |||
92 | # define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) | ||
93 | # define DP_LINK_SCRAMBLING_DISABLE (1 << 5) | ||
94 | |||
95 | # define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6) | ||
96 | # define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6) | ||
97 | # define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6) | ||
98 | # define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6) | ||
99 | |||
100 | #define DP_TRAINING_LANE0_SET 0x103 | ||
101 | #define DP_TRAINING_LANE1_SET 0x104 | ||
102 | #define DP_TRAINING_LANE2_SET 0x105 | ||
103 | #define DP_TRAINING_LANE3_SET 0x106 | ||
104 | |||
105 | # define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 | ||
106 | # define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 | ||
107 | # define DP_TRAIN_MAX_SWING_REACHED (1 << 2) | ||
108 | # define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0) | ||
109 | # define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0) | ||
110 | # define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0) | ||
111 | # define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0) | ||
112 | |||
113 | # define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) | ||
114 | # define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3) | ||
115 | # define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3) | ||
116 | # define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3) | ||
117 | # define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3) | ||
118 | |||
119 | # define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 | ||
120 | # define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) | ||
121 | |||
122 | #define DP_DOWNSPREAD_CTRL 0x107 | ||
123 | # define DP_SPREAD_AMP_0_5 (1 << 4) | ||
124 | |||
125 | #define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 | ||
126 | # define DP_SET_ANSI_8B10B (1 << 0) | ||
127 | |||
128 | #define DP_LANE0_1_STATUS 0x202 | ||
129 | #define DP_LANE2_3_STATUS 0x203 | ||
130 | # define DP_LANE_CR_DONE (1 << 0) | ||
131 | # define DP_LANE_CHANNEL_EQ_DONE (1 << 1) | ||
132 | # define DP_LANE_SYMBOL_LOCKED (1 << 2) | ||
133 | |||
134 | #define DP_CHANNEL_EQ_BITS (DP_LANE_CR_DONE | \ | ||
135 | DP_LANE_CHANNEL_EQ_DONE | \ | ||
136 | DP_LANE_SYMBOL_LOCKED) | ||
137 | |||
138 | #define DP_LANE_ALIGN_STATUS_UPDATED 0x204 | ||
139 | |||
140 | #define DP_INTERLANE_ALIGN_DONE (1 << 0) | ||
141 | #define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6) | ||
142 | #define DP_LINK_STATUS_UPDATED (1 << 7) | ||
143 | |||
144 | #define DP_SINK_STATUS 0x205 | ||
145 | |||
146 | #define DP_RECEIVE_PORT_0_STATUS (1 << 0) | ||
147 | #define DP_RECEIVE_PORT_1_STATUS (1 << 1) | ||
148 | |||
149 | #define DP_ADJUST_REQUEST_LANE0_1 0x206 | ||
150 | #define DP_ADJUST_REQUEST_LANE2_3 0x207 | ||
151 | # define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03 | ||
152 | # define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0 | ||
153 | # define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c | ||
154 | # define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2 | ||
155 | # define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30 | ||
156 | # define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4 | ||
157 | # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0 | ||
158 | # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 | ||
159 | |||
160 | #define DP_SET_POWER 0x600 | ||
161 | # define DP_SET_POWER_D0 0x1 | ||
162 | # define DP_SET_POWER_D3 0x2 | ||
163 | |||
164 | #define MODE_I2C_START 1 | ||
165 | #define MODE_I2C_WRITE 2 | ||
166 | #define MODE_I2C_READ 4 | ||
167 | #define MODE_I2C_STOP 8 | ||
168 | |||
169 | struct i2c_algo_dp_aux_data { | ||
170 | bool running; | ||
171 | u16 address; | ||
172 | int (*aux_ch) (struct i2c_adapter *adapter, | ||
173 | int mode, uint8_t write_byte, | ||
174 | uint8_t *read_byte); | ||
175 | }; | ||
176 | |||
177 | int | ||
178 | i2c_dp_aux_add_bus(struct i2c_adapter *adapter); | ||
179 | |||
180 | #endif /* _DRM_DP_HELPER_H_ */ | ||
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 7d6c9a2dfcbb..d33c3e038606 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -106,6 +106,10 @@ struct detailed_data_color_point { | |||
106 | u8 wpindex2[3]; | 106 | u8 wpindex2[3]; |
107 | } __attribute__((packed)); | 107 | } __attribute__((packed)); |
108 | 108 | ||
109 | struct cvt_timing { | ||
110 | u8 code[3]; | ||
111 | } __attribute__((packed)); | ||
112 | |||
109 | struct detailed_non_pixel { | 113 | struct detailed_non_pixel { |
110 | u8 pad1; | 114 | u8 pad1; |
111 | u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name | 115 | u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name |
@@ -117,9 +121,13 @@ struct detailed_non_pixel { | |||
117 | struct detailed_data_monitor_range range; | 121 | struct detailed_data_monitor_range range; |
118 | struct detailed_data_wpindex color; | 122 | struct detailed_data_wpindex color; |
119 | struct std_timing timings[5]; | 123 | struct std_timing timings[5]; |
124 | struct cvt_timing cvt[4]; | ||
120 | } data; | 125 | } data; |
121 | } __attribute__((packed)); | 126 | } __attribute__((packed)); |
122 | 127 | ||
128 | #define EDID_DETAIL_EST_TIMINGS 0xf7 | ||
129 | #define EDID_DETAIL_CVT_3BYTE 0xf8 | ||
130 | #define EDID_DETAIL_COLOR_MGMT_DATA 0xf9 | ||
123 | #define EDID_DETAIL_STD_MODES 0xfa | 131 | #define EDID_DETAIL_STD_MODES 0xfa |
124 | #define EDID_DETAIL_MONITOR_CPDATA 0xfb | 132 | #define EDID_DETAIL_MONITOR_CPDATA 0xfb |
125 | #define EDID_DETAIL_MONITOR_NAME 0xfc | 133 | #define EDID_DETAIL_MONITOR_NAME 0xfc |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 62329f9a42cb..4c10be39a43b 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -66,6 +66,13 @@ extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node, | |||
66 | unsigned long size, | 66 | unsigned long size, |
67 | unsigned alignment, | 67 | unsigned alignment, |
68 | int atomic); | 68 | int atomic); |
69 | extern struct drm_mm_node *drm_mm_get_block_range_generic( | ||
70 | struct drm_mm_node *node, | ||
71 | unsigned long size, | ||
72 | unsigned alignment, | ||
73 | unsigned long start, | ||
74 | unsigned long end, | ||
75 | int atomic); | ||
69 | static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, | 76 | static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, |
70 | unsigned long size, | 77 | unsigned long size, |
71 | unsigned alignment) | 78 | unsigned alignment) |
@@ -78,11 +85,38 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *pa | |||
78 | { | 85 | { |
79 | return drm_mm_get_block_generic(parent, size, alignment, 1); | 86 | return drm_mm_get_block_generic(parent, size, alignment, 1); |
80 | } | 87 | } |
88 | static inline struct drm_mm_node *drm_mm_get_block_range( | ||
89 | struct drm_mm_node *parent, | ||
90 | unsigned long size, | ||
91 | unsigned alignment, | ||
92 | unsigned long start, | ||
93 | unsigned long end) | ||
94 | { | ||
95 | return drm_mm_get_block_range_generic(parent, size, alignment, | ||
96 | start, end, 0); | ||
97 | } | ||
98 | static inline struct drm_mm_node *drm_mm_get_block_atomic_range( | ||
99 | struct drm_mm_node *parent, | ||
100 | unsigned long size, | ||
101 | unsigned alignment, | ||
102 | unsigned long start, | ||
103 | unsigned long end) | ||
104 | { | ||
105 | return drm_mm_get_block_range_generic(parent, size, alignment, | ||
106 | start, end, 1); | ||
107 | } | ||
81 | extern void drm_mm_put_block(struct drm_mm_node *cur); | 108 | extern void drm_mm_put_block(struct drm_mm_node *cur); |
82 | extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, | 109 | extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, |
83 | unsigned long size, | 110 | unsigned long size, |
84 | unsigned alignment, | 111 | unsigned alignment, |
85 | int best_match); | 112 | int best_match); |
113 | extern struct drm_mm_node *drm_mm_search_free_in_range( | ||
114 | const struct drm_mm *mm, | ||
115 | unsigned long size, | ||
116 | unsigned alignment, | ||
117 | unsigned long start, | ||
118 | unsigned long end, | ||
119 | int best_match); | ||
86 | extern int drm_mm_init(struct drm_mm *mm, unsigned long start, | 120 | extern int drm_mm_init(struct drm_mm *mm, unsigned long start, |
87 | unsigned long size); | 121 | unsigned long size); |
88 | extern void drm_mm_takedown(struct drm_mm *mm); | 122 | extern void drm_mm_takedown(struct drm_mm *mm); |
@@ -99,6 +133,7 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | |||
99 | return block->mm; | 133 | return block->mm; |
100 | } | 134 | } |
101 | 135 | ||
136 | extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); | ||
102 | #ifdef CONFIG_DEBUG_FS | 137 | #ifdef CONFIG_DEBUG_FS |
103 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); | 138 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); |
104 | #endif | 139 | #endif |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 1f908416aedb..c5ba1636613c 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -27,9 +27,6 @@ | |||
27 | #ifndef _DRM_MODE_H | 27 | #ifndef _DRM_MODE_H |
28 | #define _DRM_MODE_H | 28 | #define _DRM_MODE_H |
29 | 29 | ||
30 | #include <linux/kernel.h> | ||
31 | #include <linux/types.h> | ||
32 | |||
33 | #define DRM_DISPLAY_INFO_LEN 32 | 30 | #define DRM_DISPLAY_INFO_LEN 32 |
34 | #define DRM_CONNECTOR_NAME_LEN 32 | 31 | #define DRM_CONNECTOR_NAME_LEN 32 |
35 | #define DRM_DISPLAY_MODE_LEN 32 | 32 | #define DRM_DISPLAY_MODE_LEN 32 |
@@ -78,12 +75,17 @@ | |||
78 | #define DRM_MODE_DITHERING_OFF 0 | 75 | #define DRM_MODE_DITHERING_OFF 0 |
79 | #define DRM_MODE_DITHERING_ON 1 | 76 | #define DRM_MODE_DITHERING_ON 1 |
80 | 77 | ||
78 | /* Dirty info options */ | ||
79 | #define DRM_MODE_DIRTY_OFF 0 | ||
80 | #define DRM_MODE_DIRTY_ON 1 | ||
81 | #define DRM_MODE_DIRTY_ANNOTATE 2 | ||
82 | |||
81 | struct drm_mode_modeinfo { | 83 | struct drm_mode_modeinfo { |
82 | __u32 clock; | 84 | __u32 clock; |
83 | __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; | 85 | __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; |
84 | __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; | 86 | __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; |
85 | 87 | ||
86 | __u32 vrefresh; /* vertical refresh * 1000 */ | 88 | __u32 vrefresh; |
87 | 89 | ||
88 | __u32 flags; | 90 | __u32 flags; |
89 | __u32 type; | 91 | __u32 type; |
@@ -158,6 +160,7 @@ struct drm_mode_get_encoder { | |||
158 | #define DRM_MODE_CONNECTOR_HDMIA 11 | 160 | #define DRM_MODE_CONNECTOR_HDMIA 11 |
159 | #define DRM_MODE_CONNECTOR_HDMIB 12 | 161 | #define DRM_MODE_CONNECTOR_HDMIB 12 |
160 | #define DRM_MODE_CONNECTOR_TV 13 | 162 | #define DRM_MODE_CONNECTOR_TV 13 |
163 | #define DRM_MODE_CONNECTOR_eDP 14 | ||
161 | 164 | ||
162 | struct drm_mode_get_connector { | 165 | struct drm_mode_get_connector { |
163 | 166 | ||
@@ -225,6 +228,45 @@ struct drm_mode_fb_cmd { | |||
225 | __u32 handle; | 228 | __u32 handle; |
226 | }; | 229 | }; |
227 | 230 | ||
231 | #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 | ||
232 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 | ||
233 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 | ||
234 | |||
235 | /* | ||
236 | * Mark a region of a framebuffer as dirty. | ||
237 | * | ||
238 | * Some hardware does not automatically update display contents | ||
239 | * as a hardware or software draw to a framebuffer. This ioctl | ||
240 | * allows userspace to tell the kernel and the hardware what | ||
241 | * regions of the framebuffer have changed. | ||
242 | * | ||
243 | * The kernel or hardware is free to update more then just the | ||
244 | * region specified by the clip rects. The kernel or hardware | ||
245 | * may also delay and/or coalesce several calls to dirty into a | ||
246 | * single update. | ||
247 | * | ||
248 | * Userspace may annotate the updates, the annotates are a | ||
249 | * promise made by the caller that the change is either a copy | ||
250 | * of pixels or a fill of a single color in the region specified. | ||
251 | * | ||
252 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then | ||
253 | * the number of updated regions are half of num_clips given, | ||
254 | * where the clip rects are paired in src and dst. The width and | ||
255 | * height of each one of the pairs must match. | ||
256 | * | ||
257 | * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller | ||
258 | * promises that the region specified of the clip rects is filled | ||
259 | * completely with a single color as given in the color argument. | ||
260 | */ | ||
261 | |||
262 | struct drm_mode_fb_dirty_cmd { | ||
263 | __u32 fb_id; | ||
264 | __u32 flags; | ||
265 | __u32 color; | ||
266 | __u32 num_clips; | ||
267 | __u64 clips_ptr; | ||
268 | }; | ||
269 | |||
228 | struct drm_mode_mode_cmd { | 270 | struct drm_mode_mode_cmd { |
229 | __u32 connector_id; | 271 | __u32 connector_id; |
230 | struct drm_mode_modeinfo mode; | 272 | struct drm_mode_modeinfo mode; |
@@ -268,4 +310,37 @@ struct drm_mode_crtc_lut { | |||
268 | __u64 blue; | 310 | __u64 blue; |
269 | }; | 311 | }; |
270 | 312 | ||
313 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | ||
314 | #define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT | ||
315 | |||
316 | /* | ||
317 | * Request a page flip on the specified crtc. | ||
318 | * | ||
319 | * This ioctl will ask KMS to schedule a page flip for the specified | ||
320 | * crtc. Once any pending rendering targeting the specified fb (as of | ||
321 | * ioctl time) has completed, the crtc will be reprogrammed to display | ||
322 | * that fb after the next vertical refresh. The ioctl returns | ||
323 | * immediately, but subsequent rendering to the current fb will block | ||
324 | * in the execbuffer ioctl until the page flip happens. If a page | ||
325 | * flip is already pending as the ioctl is called, EBUSY will be | ||
326 | * returned. | ||
327 | * | ||
328 | * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will | ||
329 | * request that drm sends back a vblank event (see drm.h: struct | ||
330 | * drm_event_vblank) when the page flip is done. The user_data field | ||
331 | * passed in with this ioctl will be returned as the user_data field | ||
332 | * in the vblank event struct. | ||
333 | * | ||
334 | * The reserved field must be zero until we figure out something | ||
335 | * clever to use it for. | ||
336 | */ | ||
337 | |||
338 | struct drm_mode_crtc_page_flip { | ||
339 | __u32 crtc_id; | ||
340 | __u32 fb_id; | ||
341 | __u32 flags; | ||
342 | __u32 reserved; | ||
343 | __u64 user_data; | ||
344 | }; | ||
345 | |||
271 | #endif | 346 | #endif |
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 26641e95e0a4..393369147a2d 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h | |||
@@ -123,5 +123,5 @@ do { \ | |||
123 | remove_wait_queue(&(queue), &entry); \ | 123 | remove_wait_queue(&(queue), &entry); \ |
124 | } while (0) | 124 | } while (0) |
125 | 125 | ||
126 | #define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) | 126 | #define DRM_WAKEUP( queue ) wake_up( queue ) |
127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) | 127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) |
diff --git a/include/drm/i2c/ch7006.h b/include/drm/i2c/ch7006.h new file mode 100644 index 000000000000..8390b437a1f8 --- /dev/null +++ b/include/drm/i2c/ch7006.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Francisco Jerez. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
6 | * a copy of this software and associated documentation files (the | ||
7 | * "Software"), to deal in the Software without restriction, including | ||
8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
10 | * permit persons to whom the Software is furnished to do so, subject to | ||
11 | * the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the | ||
14 | * next paragraph) shall be included in all copies or substantial | ||
15 | * portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #ifndef __DRM_I2C_CH7006_H__ | ||
28 | #define __DRM_I2C_CH7006_H__ | ||
29 | |||
30 | /** | ||
31 | * struct ch7006_encoder_params | ||
32 | * | ||
33 | * Describes how the ch7006 is wired up with the GPU. It should be | ||
34 | * used as the @params parameter of its @set_config method. | ||
35 | * | ||
36 | * See "http://www.chrontel.com/pdf/7006.pdf" for their precise | ||
37 | * meaning. | ||
38 | */ | ||
39 | struct ch7006_encoder_params { | ||
40 | enum { | ||
41 | CH7006_FORMAT_RGB16 = 0, | ||
42 | CH7006_FORMAT_YCrCb24m16, | ||
43 | CH7006_FORMAT_RGB24m16, | ||
44 | CH7006_FORMAT_RGB15, | ||
45 | CH7006_FORMAT_RGB24m12C, | ||
46 | CH7006_FORMAT_RGB24m12I, | ||
47 | CH7006_FORMAT_RGB24m8, | ||
48 | CH7006_FORMAT_RGB16m8, | ||
49 | CH7006_FORMAT_RGB15m8, | ||
50 | CH7006_FORMAT_YCrCb24m8, | ||
51 | } input_format; | ||
52 | |||
53 | enum { | ||
54 | CH7006_CLOCK_SLAVE = 0, | ||
55 | CH7006_CLOCK_MASTER, | ||
56 | } clock_mode; | ||
57 | |||
58 | enum { | ||
59 | CH7006_CLOCK_EDGE_NEG = 0, | ||
60 | CH7006_CLOCK_EDGE_POS, | ||
61 | } clock_edge; | ||
62 | |||
63 | int xcm, pcm; | ||
64 | |||
65 | enum { | ||
66 | CH7006_SYNC_SLAVE = 0, | ||
67 | CH7006_SYNC_MASTER, | ||
68 | } sync_direction; | ||
69 | |||
70 | enum { | ||
71 | CH7006_SYNC_SEPARATED = 0, | ||
72 | CH7006_SYNC_EMBEDDED, | ||
73 | } sync_encoding; | ||
74 | |||
75 | enum { | ||
76 | CH7006_POUT_1_8V = 0, | ||
77 | CH7006_POUT_3_3V, | ||
78 | } pout_level; | ||
79 | |||
80 | enum { | ||
81 | CH7006_ACTIVE_HSYNC = 0, | ||
82 | CH7006_ACTIVE_DSTART, | ||
83 | } active_detect; | ||
84 | }; | ||
85 | |||
86 | #endif | ||
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index 7e0cb1da92e6..b64a8d7cdf6d 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -27,11 +27,11 @@ | |||
27 | #ifndef _I915_DRM_H_ | 27 | #ifndef _I915_DRM_H_ |
28 | #define _I915_DRM_H_ | 28 | #define _I915_DRM_H_ |
29 | 29 | ||
30 | #include "drm.h" | ||
31 | |||
30 | /* Please note that modifications to all structs defined here are | 32 | /* Please note that modifications to all structs defined here are |
31 | * subject to backwards-compatibility constraints. | 33 | * subject to backwards-compatibility constraints. |
32 | */ | 34 | */ |
33 | #include <linux/types.h> | ||
34 | #include "drm.h" | ||
35 | 35 | ||
36 | /* Each region is a minimum of 16k, and there are at most 255 of them. | 36 | /* Each region is a minimum of 16k, and there are at most 255 of them. |
37 | */ | 37 | */ |
@@ -186,6 +186,9 @@ typedef struct _drm_i915_sarea { | |||
186 | #define DRM_I915_GEM_MMAP_GTT 0x24 | 186 | #define DRM_I915_GEM_MMAP_GTT 0x24 |
187 | #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 | 187 | #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 |
188 | #define DRM_I915_GEM_MADVISE 0x26 | 188 | #define DRM_I915_GEM_MADVISE 0x26 |
189 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 | ||
190 | #define DRM_I915_OVERLAY_ATTRS 0x28 | ||
191 | #define DRM_I915_GEM_EXECBUFFER2 0x29 | ||
189 | 192 | ||
190 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 193 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
191 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 194 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -205,6 +208,7 @@ typedef struct _drm_i915_sarea { | |||
205 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) | 208 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) |
206 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) | 209 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) |
207 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) | 210 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) |
211 | #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) | ||
208 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) | 212 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) |
209 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) | 213 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) |
210 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) | 214 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) |
@@ -221,8 +225,10 @@ typedef struct _drm_i915_sarea { | |||
221 | #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) | 225 | #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) |
222 | #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) | 226 | #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) |
223 | #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) | 227 | #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) |
224 | #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id) | 228 | #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) |
225 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) | 229 | #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) |
230 | #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image) | ||
231 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) | ||
226 | 232 | ||
227 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 233 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
228 | * on the security mechanisms provided by hardware. | 234 | * on the security mechanisms provided by hardware. |
@@ -266,6 +272,9 @@ typedef struct drm_i915_irq_wait { | |||
266 | #define I915_PARAM_CHIPSET_ID 4 | 272 | #define I915_PARAM_CHIPSET_ID 4 |
267 | #define I915_PARAM_HAS_GEM 5 | 273 | #define I915_PARAM_HAS_GEM 5 |
268 | #define I915_PARAM_NUM_FENCES_AVAIL 6 | 274 | #define I915_PARAM_NUM_FENCES_AVAIL 6 |
275 | #define I915_PARAM_HAS_OVERLAY 7 | ||
276 | #define I915_PARAM_HAS_PAGEFLIPPING 8 | ||
277 | #define I915_PARAM_HAS_EXECBUF2 9 | ||
269 | 278 | ||
270 | typedef struct drm_i915_getparam { | 279 | typedef struct drm_i915_getparam { |
271 | int param; | 280 | int param; |
@@ -561,6 +570,57 @@ struct drm_i915_gem_execbuffer { | |||
561 | __u64 cliprects_ptr; | 570 | __u64 cliprects_ptr; |
562 | }; | 571 | }; |
563 | 572 | ||
573 | struct drm_i915_gem_exec_object2 { | ||
574 | /** | ||
575 | * User's handle for a buffer to be bound into the GTT for this | ||
576 | * operation. | ||
577 | */ | ||
578 | __u32 handle; | ||
579 | |||
580 | /** Number of relocations to be performed on this buffer */ | ||
581 | __u32 relocation_count; | ||
582 | /** | ||
583 | * Pointer to array of struct drm_i915_gem_relocation_entry containing | ||
584 | * the relocations to be performed in this buffer. | ||
585 | */ | ||
586 | __u64 relocs_ptr; | ||
587 | |||
588 | /** Required alignment in graphics aperture */ | ||
589 | __u64 alignment; | ||
590 | |||
591 | /** | ||
592 | * Returned value of the updated offset of the object, for future | ||
593 | * presumed_offset writes. | ||
594 | */ | ||
595 | __u64 offset; | ||
596 | |||
597 | #define EXEC_OBJECT_NEEDS_FENCE (1<<0) | ||
598 | __u64 flags; | ||
599 | __u64 rsvd1; | ||
600 | __u64 rsvd2; | ||
601 | }; | ||
602 | |||
603 | struct drm_i915_gem_execbuffer2 { | ||
604 | /** | ||
605 | * List of gem_exec_object2 structs | ||
606 | */ | ||
607 | __u64 buffers_ptr; | ||
608 | __u32 buffer_count; | ||
609 | |||
610 | /** Offset in the batchbuffer to start execution from. */ | ||
611 | __u32 batch_start_offset; | ||
612 | /** Bytes used in batchbuffer from batch_start_offset */ | ||
613 | __u32 batch_len; | ||
614 | __u32 DR1; | ||
615 | __u32 DR4; | ||
616 | __u32 num_cliprects; | ||
617 | /** This is a struct drm_clip_rect *cliprects */ | ||
618 | __u64 cliprects_ptr; | ||
619 | __u64 flags; /* currently unused */ | ||
620 | __u64 rsvd1; | ||
621 | __u64 rsvd2; | ||
622 | }; | ||
623 | |||
564 | struct drm_i915_gem_pin { | 624 | struct drm_i915_gem_pin { |
565 | /** Handle of the buffer to be pinned. */ | 625 | /** Handle of the buffer to be pinned. */ |
566 | __u32 handle; | 626 | __u32 handle; |
@@ -686,4 +746,70 @@ struct drm_i915_gem_madvise { | |||
686 | __u32 retained; | 746 | __u32 retained; |
687 | }; | 747 | }; |
688 | 748 | ||
749 | /* flags */ | ||
750 | #define I915_OVERLAY_TYPE_MASK 0xff | ||
751 | #define I915_OVERLAY_YUV_PLANAR 0x01 | ||
752 | #define I915_OVERLAY_YUV_PACKED 0x02 | ||
753 | #define I915_OVERLAY_RGB 0x03 | ||
754 | |||
755 | #define I915_OVERLAY_DEPTH_MASK 0xff00 | ||
756 | #define I915_OVERLAY_RGB24 0x1000 | ||
757 | #define I915_OVERLAY_RGB16 0x2000 | ||
758 | #define I915_OVERLAY_RGB15 0x3000 | ||
759 | #define I915_OVERLAY_YUV422 0x0100 | ||
760 | #define I915_OVERLAY_YUV411 0x0200 | ||
761 | #define I915_OVERLAY_YUV420 0x0300 | ||
762 | #define I915_OVERLAY_YUV410 0x0400 | ||
763 | |||
764 | #define I915_OVERLAY_SWAP_MASK 0xff0000 | ||
765 | #define I915_OVERLAY_NO_SWAP 0x000000 | ||
766 | #define I915_OVERLAY_UV_SWAP 0x010000 | ||
767 | #define I915_OVERLAY_Y_SWAP 0x020000 | ||
768 | #define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 | ||
769 | |||
770 | #define I915_OVERLAY_FLAGS_MASK 0xff000000 | ||
771 | #define I915_OVERLAY_ENABLE 0x01000000 | ||
772 | |||
773 | struct drm_intel_overlay_put_image { | ||
774 | /* various flags and src format description */ | ||
775 | __u32 flags; | ||
776 | /* source picture description */ | ||
777 | __u32 bo_handle; | ||
778 | /* stride values and offsets are in bytes, buffer relative */ | ||
779 | __u16 stride_Y; /* stride for packed formats */ | ||
780 | __u16 stride_UV; | ||
781 | __u32 offset_Y; /* offset for packet formats */ | ||
782 | __u32 offset_U; | ||
783 | __u32 offset_V; | ||
784 | /* in pixels */ | ||
785 | __u16 src_width; | ||
786 | __u16 src_height; | ||
787 | /* to compensate the scaling factors for partially covered surfaces */ | ||
788 | __u16 src_scan_width; | ||
789 | __u16 src_scan_height; | ||
790 | /* output crtc description */ | ||
791 | __u32 crtc_id; | ||
792 | __u16 dst_x; | ||
793 | __u16 dst_y; | ||
794 | __u16 dst_width; | ||
795 | __u16 dst_height; | ||
796 | }; | ||
797 | |||
798 | /* flags */ | ||
799 | #define I915_OVERLAY_UPDATE_ATTRS (1<<0) | ||
800 | #define I915_OVERLAY_UPDATE_GAMMA (1<<1) | ||
801 | struct drm_intel_overlay_attrs { | ||
802 | __u32 flags; | ||
803 | __u32 color_key; | ||
804 | __s32 brightness; | ||
805 | __u32 contrast; | ||
806 | __u32 saturation; | ||
807 | __u32 gamma0; | ||
808 | __u32 gamma1; | ||
809 | __u32 gamma2; | ||
810 | __u32 gamma3; | ||
811 | __u32 gamma4; | ||
812 | __u32 gamma5; | ||
813 | }; | ||
814 | |||
689 | #endif /* _I915_DRM_H_ */ | 815 | #endif /* _I915_DRM_H_ */ |
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h index 325fd6fb4a42..3ffbc4798afa 100644 --- a/include/drm/mga_drm.h +++ b/include/drm/mga_drm.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #ifndef __MGA_DRM_H__ | 35 | #ifndef __MGA_DRM_H__ |
36 | #define __MGA_DRM_H__ | 36 | #define __MGA_DRM_H__ |
37 | 37 | ||
38 | #include <linux/types.h> | 38 | #include "drm.h" |
39 | 39 | ||
40 | /* WARNING: If you change any of these defines, make sure to change the | 40 | /* WARNING: If you change any of these defines, make sure to change the |
41 | * defines in the Xserver file (mga_sarea.h) | 41 | * defines in the Xserver file (mga_sarea.h) |
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h new file mode 100644 index 000000000000..f745948b61e4 --- /dev/null +++ b/include/drm/nouveau_drm.h | |||
@@ -0,0 +1,221 @@ | |||
1 | /* | ||
2 | * Copyright 2005 Stephane Marchesin. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the next | ||
13 | * paragraph) shall be included in all copies or substantial portions of the | ||
14 | * Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
22 | * OTHER DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #ifndef __NOUVEAU_DRM_H__ | ||
26 | #define __NOUVEAU_DRM_H__ | ||
27 | |||
28 | #define NOUVEAU_DRM_HEADER_PATCHLEVEL 15 | ||
29 | |||
30 | struct drm_nouveau_channel_alloc { | ||
31 | uint32_t fb_ctxdma_handle; | ||
32 | uint32_t tt_ctxdma_handle; | ||
33 | |||
34 | int channel; | ||
35 | |||
36 | /* Notifier memory */ | ||
37 | uint32_t notifier_handle; | ||
38 | |||
39 | /* DRM-enforced subchannel assignments */ | ||
40 | struct { | ||
41 | uint32_t handle; | ||
42 | uint32_t grclass; | ||
43 | } subchan[8]; | ||
44 | uint32_t nr_subchan; | ||
45 | }; | ||
46 | |||
47 | struct drm_nouveau_channel_free { | ||
48 | int channel; | ||
49 | }; | ||
50 | |||
51 | struct drm_nouveau_grobj_alloc { | ||
52 | int channel; | ||
53 | uint32_t handle; | ||
54 | int class; | ||
55 | }; | ||
56 | |||
57 | struct drm_nouveau_notifierobj_alloc { | ||
58 | uint32_t channel; | ||
59 | uint32_t handle; | ||
60 | uint32_t size; | ||
61 | uint32_t offset; | ||
62 | }; | ||
63 | |||
64 | struct drm_nouveau_gpuobj_free { | ||
65 | int channel; | ||
66 | uint32_t handle; | ||
67 | }; | ||
68 | |||
69 | /* FIXME : maybe unify {GET,SET}PARAMs */ | ||
70 | #define NOUVEAU_GETPARAM_PCI_VENDOR 3 | ||
71 | #define NOUVEAU_GETPARAM_PCI_DEVICE 4 | ||
72 | #define NOUVEAU_GETPARAM_BUS_TYPE 5 | ||
73 | #define NOUVEAU_GETPARAM_FB_PHYSICAL 6 | ||
74 | #define NOUVEAU_GETPARAM_AGP_PHYSICAL 7 | ||
75 | #define NOUVEAU_GETPARAM_FB_SIZE 8 | ||
76 | #define NOUVEAU_GETPARAM_AGP_SIZE 9 | ||
77 | #define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 | ||
78 | #define NOUVEAU_GETPARAM_CHIPSET_ID 11 | ||
79 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 | ||
80 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 | ||
81 | struct drm_nouveau_getparam { | ||
82 | uint64_t param; | ||
83 | uint64_t value; | ||
84 | }; | ||
85 | |||
86 | struct drm_nouveau_setparam { | ||
87 | uint64_t param; | ||
88 | uint64_t value; | ||
89 | }; | ||
90 | |||
91 | #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) | ||
92 | #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) | ||
93 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) | ||
94 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) | ||
95 | |||
96 | struct drm_nouveau_gem_info { | ||
97 | uint32_t handle; | ||
98 | uint32_t domain; | ||
99 | uint64_t size; | ||
100 | uint64_t offset; | ||
101 | uint64_t map_handle; | ||
102 | uint32_t tile_mode; | ||
103 | uint32_t tile_flags; | ||
104 | }; | ||
105 | |||
106 | struct drm_nouveau_gem_new { | ||
107 | struct drm_nouveau_gem_info info; | ||
108 | uint32_t channel_hint; | ||
109 | uint32_t align; | ||
110 | }; | ||
111 | |||
112 | struct drm_nouveau_gem_pushbuf_bo { | ||
113 | uint64_t user_priv; | ||
114 | uint32_t handle; | ||
115 | uint32_t read_domains; | ||
116 | uint32_t write_domains; | ||
117 | uint32_t valid_domains; | ||
118 | uint32_t presumed_ok; | ||
119 | uint32_t presumed_domain; | ||
120 | uint64_t presumed_offset; | ||
121 | }; | ||
122 | |||
123 | #define NOUVEAU_GEM_RELOC_LOW (1 << 0) | ||
124 | #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) | ||
125 | #define NOUVEAU_GEM_RELOC_OR (1 << 2) | ||
126 | struct drm_nouveau_gem_pushbuf_reloc { | ||
127 | uint32_t bo_index; | ||
128 | uint32_t reloc_index; | ||
129 | uint32_t flags; | ||
130 | uint32_t data; | ||
131 | uint32_t vor; | ||
132 | uint32_t tor; | ||
133 | }; | ||
134 | |||
135 | #define NOUVEAU_GEM_MAX_BUFFERS 1024 | ||
136 | #define NOUVEAU_GEM_MAX_RELOCS 1024 | ||
137 | |||
138 | struct drm_nouveau_gem_pushbuf { | ||
139 | uint32_t channel; | ||
140 | uint32_t nr_dwords; | ||
141 | uint32_t nr_buffers; | ||
142 | uint32_t nr_relocs; | ||
143 | uint64_t dwords; | ||
144 | uint64_t buffers; | ||
145 | uint64_t relocs; | ||
146 | }; | ||
147 | |||
148 | struct drm_nouveau_gem_pushbuf_call { | ||
149 | uint32_t channel; | ||
150 | uint32_t handle; | ||
151 | uint32_t offset; | ||
152 | uint32_t nr_buffers; | ||
153 | uint32_t nr_relocs; | ||
154 | uint32_t nr_dwords; | ||
155 | uint64_t buffers; | ||
156 | uint64_t relocs; | ||
157 | uint32_t suffix0; | ||
158 | uint32_t suffix1; | ||
159 | /* below only accessed for CALL2 */ | ||
160 | uint64_t vram_available; | ||
161 | uint64_t gart_available; | ||
162 | }; | ||
163 | |||
164 | struct drm_nouveau_gem_pin { | ||
165 | uint32_t handle; | ||
166 | uint32_t domain; | ||
167 | uint64_t offset; | ||
168 | }; | ||
169 | |||
170 | struct drm_nouveau_gem_unpin { | ||
171 | uint32_t handle; | ||
172 | }; | ||
173 | |||
174 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 | ||
175 | #define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002 | ||
176 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 | ||
177 | struct drm_nouveau_gem_cpu_prep { | ||
178 | uint32_t handle; | ||
179 | uint32_t flags; | ||
180 | }; | ||
181 | |||
182 | struct drm_nouveau_gem_cpu_fini { | ||
183 | uint32_t handle; | ||
184 | }; | ||
185 | |||
186 | struct drm_nouveau_gem_tile { | ||
187 | uint32_t handle; | ||
188 | uint32_t offset; | ||
189 | uint32_t size; | ||
190 | uint32_t tile_mode; | ||
191 | uint32_t tile_flags; | ||
192 | }; | ||
193 | |||
194 | enum nouveau_bus_type { | ||
195 | NV_AGP = 0, | ||
196 | NV_PCI = 1, | ||
197 | NV_PCIE = 2, | ||
198 | }; | ||
199 | |||
200 | struct drm_nouveau_sarea { | ||
201 | }; | ||
202 | |||
203 | #define DRM_NOUVEAU_CARD_INIT 0x00 | ||
204 | #define DRM_NOUVEAU_GETPARAM 0x01 | ||
205 | #define DRM_NOUVEAU_SETPARAM 0x02 | ||
206 | #define DRM_NOUVEAU_CHANNEL_ALLOC 0x03 | ||
207 | #define DRM_NOUVEAU_CHANNEL_FREE 0x04 | ||
208 | #define DRM_NOUVEAU_GROBJ_ALLOC 0x05 | ||
209 | #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x06 | ||
210 | #define DRM_NOUVEAU_GPUOBJ_FREE 0x07 | ||
211 | #define DRM_NOUVEAU_GEM_NEW 0x40 | ||
212 | #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 | ||
213 | #define DRM_NOUVEAU_GEM_PUSHBUF_CALL 0x42 | ||
214 | #define DRM_NOUVEAU_GEM_PIN 0x43 /* !KMS only */ | ||
215 | #define DRM_NOUVEAU_GEM_UNPIN 0x44 /* !KMS only */ | ||
216 | #define DRM_NOUVEAU_GEM_CPU_PREP 0x45 | ||
217 | #define DRM_NOUVEAU_GEM_CPU_FINI 0x46 | ||
218 | #define DRM_NOUVEAU_GEM_INFO 0x47 | ||
219 | #define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48 | ||
220 | |||
221 | #endif /* __NOUVEAU_DRM_H__ */ | ||
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 3b9932ab1756..39537f3cf98a 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #ifndef __RADEON_DRM_H__ | 33 | #ifndef __RADEON_DRM_H__ |
34 | #define __RADEON_DRM_H__ | 34 | #define __RADEON_DRM_H__ |
35 | 35 | ||
36 | #include <linux/types.h> | 36 | #include "drm.h" |
37 | 37 | ||
38 | /* WARNING: If you change any of these defines, make sure to change the | 38 | /* WARNING: If you change any of these defines, make sure to change the |
39 | * defines in the X server file (radeon_sarea.h) | 39 | * defines in the X server file (radeon_sarea.h) |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 491146170522..81eb9f45883c 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -44,6 +44,29 @@ struct ttm_bo_device; | |||
44 | 44 | ||
45 | struct drm_mm_node; | 45 | struct drm_mm_node; |
46 | 46 | ||
47 | |||
48 | /** | ||
49 | * struct ttm_placement | ||
50 | * | ||
51 | * @fpfn: first valid page frame number to put the object | ||
52 | * @lpfn: last valid page frame number to put the object | ||
53 | * @num_placement: number of prefered placements | ||
54 | * @placement: prefered placements | ||
55 | * @num_busy_placement: number of prefered placements when need to evict buffer | ||
56 | * @busy_placement: prefered placements when need to evict buffer | ||
57 | * | ||
58 | * Structure indicating the placement you request for an object. | ||
59 | */ | ||
60 | struct ttm_placement { | ||
61 | unsigned fpfn; | ||
62 | unsigned lpfn; | ||
63 | unsigned num_placement; | ||
64 | const uint32_t *placement; | ||
65 | unsigned num_busy_placement; | ||
66 | const uint32_t *busy_placement; | ||
67 | }; | ||
68 | |||
69 | |||
47 | /** | 70 | /** |
48 | * struct ttm_mem_reg | 71 | * struct ttm_mem_reg |
49 | * | 72 | * |
@@ -109,10 +132,6 @@ struct ttm_tt; | |||
109 | * the object is destroyed. | 132 | * the object is destroyed. |
110 | * @event_queue: Queue for processes waiting on buffer object status change. | 133 | * @event_queue: Queue for processes waiting on buffer object status change. |
111 | * @lock: spinlock protecting mostly synchronization members. | 134 | * @lock: spinlock protecting mostly synchronization members. |
112 | * @proposed_placement: Proposed placement for the buffer. Changed only by the | ||
113 | * creator prior to validation as opposed to bo->mem.proposed_flags which is | ||
114 | * changed by the implementation prior to a buffer move if it wants to outsmart | ||
115 | * the buffer creator / user. This latter happens, for example, at eviction. | ||
116 | * @mem: structure describing current placement. | 135 | * @mem: structure describing current placement. |
117 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | 136 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers |
118 | * pinned in physical memory. If this behaviour is not desired, this member | 137 | * pinned in physical memory. If this behaviour is not desired, this member |
@@ -177,7 +196,6 @@ struct ttm_buffer_object { | |||
177 | * Members protected by the bo::reserved lock. | 196 | * Members protected by the bo::reserved lock. |
178 | */ | 197 | */ |
179 | 198 | ||
180 | uint32_t proposed_placement; | ||
181 | struct ttm_mem_reg mem; | 199 | struct ttm_mem_reg mem; |
182 | struct file *persistant_swap_storage; | 200 | struct file *persistant_swap_storage; |
183 | struct ttm_tt *ttm; | 201 | struct ttm_tt *ttm; |
@@ -285,29 +303,30 @@ ttm_bo_reference(struct ttm_buffer_object *bo) | |||
285 | * Note: It might be necessary to block validations before the | 303 | * Note: It might be necessary to block validations before the |
286 | * wait by reserving the buffer. | 304 | * wait by reserving the buffer. |
287 | * Returns -EBUSY if no_wait is true and the buffer is busy. | 305 | * Returns -EBUSY if no_wait is true and the buffer is busy. |
288 | * Returns -ERESTART if interrupted by a signal. | 306 | * Returns -ERESTARTSYS if interrupted by a signal. |
289 | */ | 307 | */ |
290 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | 308 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, |
291 | bool interruptible, bool no_wait); | 309 | bool interruptible, bool no_wait); |
292 | /** | 310 | /** |
293 | * ttm_buffer_object_validate | 311 | * ttm_bo_validate |
294 | * | 312 | * |
295 | * @bo: The buffer object. | 313 | * @bo: The buffer object. |
296 | * @proposed_placement: Proposed_placement for the buffer object. | 314 | * @placement: Proposed placement for the buffer object. |
297 | * @interruptible: Sleep interruptible if sleeping. | 315 | * @interruptible: Sleep interruptible if sleeping. |
298 | * @no_wait: Return immediately if the buffer is busy. | 316 | * @no_wait: Return immediately if the buffer is busy. |
299 | * | 317 | * |
300 | * Changes placement and caching policy of the buffer object | 318 | * Changes placement and caching policy of the buffer object |
301 | * according to bo::proposed_flags. | 319 | * according proposed placement. |
302 | * Returns | 320 | * Returns |
303 | * -EINVAL on invalid proposed_flags. | 321 | * -EINVAL on invalid proposed placement. |
304 | * -ENOMEM on out-of-memory condition. | 322 | * -ENOMEM on out-of-memory condition. |
305 | * -EBUSY if no_wait is true and buffer busy. | 323 | * -EBUSY if no_wait is true and buffer busy. |
306 | * -ERESTART if interrupted by a signal. | 324 | * -ERESTARTSYS if interrupted by a signal. |
307 | */ | 325 | */ |
308 | extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, | 326 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, |
309 | uint32_t proposed_placement, | 327 | struct ttm_placement *placement, |
310 | bool interruptible, bool no_wait); | 328 | bool interruptible, bool no_wait); |
329 | |||
311 | /** | 330 | /** |
312 | * ttm_bo_unref | 331 | * ttm_bo_unref |
313 | * | 332 | * |
@@ -328,7 +347,7 @@ extern void ttm_bo_unref(struct ttm_buffer_object **bo); | |||
328 | * waiting for buffer idle. This lock is recursive. | 347 | * waiting for buffer idle. This lock is recursive. |
329 | * Returns | 348 | * Returns |
330 | * -EBUSY if the buffer is busy and no_wait is true. | 349 | * -EBUSY if the buffer is busy and no_wait is true. |
331 | * -ERESTART if interrupted by a signal. | 350 | * -ERESTARTSYS if interrupted by a signal. |
332 | */ | 351 | */ |
333 | 352 | ||
334 | extern int | 353 | extern int |
@@ -343,7 +362,7 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); | |||
343 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | 362 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); |
344 | 363 | ||
345 | /** | 364 | /** |
346 | * ttm_buffer_object_init | 365 | * ttm_bo_init |
347 | * | 366 | * |
348 | * @bdev: Pointer to a ttm_bo_device struct. | 367 | * @bdev: Pointer to a ttm_bo_device struct. |
349 | * @bo: Pointer to a ttm_buffer_object to be initialized. | 368 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
@@ -371,20 +390,20 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | |||
371 | * Returns | 390 | * Returns |
372 | * -ENOMEM: Out of memory. | 391 | * -ENOMEM: Out of memory. |
373 | * -EINVAL: Invalid placement flags. | 392 | * -EINVAL: Invalid placement flags. |
374 | * -ERESTART: Interrupted by signal while sleeping waiting for resources. | 393 | * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources. |
375 | */ | 394 | */ |
376 | 395 | ||
377 | extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | 396 | extern int ttm_bo_init(struct ttm_bo_device *bdev, |
378 | struct ttm_buffer_object *bo, | 397 | struct ttm_buffer_object *bo, |
379 | unsigned long size, | 398 | unsigned long size, |
380 | enum ttm_bo_type type, | 399 | enum ttm_bo_type type, |
381 | uint32_t flags, | 400 | struct ttm_placement *placement, |
382 | uint32_t page_alignment, | 401 | uint32_t page_alignment, |
383 | unsigned long buffer_start, | 402 | unsigned long buffer_start, |
384 | bool interrubtible, | 403 | bool interrubtible, |
385 | struct file *persistant_swap_storage, | 404 | struct file *persistant_swap_storage, |
386 | size_t acc_size, | 405 | size_t acc_size, |
387 | void (*destroy) (struct ttm_buffer_object *)); | 406 | void (*destroy) (struct ttm_buffer_object *)); |
388 | /** | 407 | /** |
389 | * ttm_bo_synccpu_object_init | 408 | * ttm_bo_synccpu_object_init |
390 | * | 409 | * |
@@ -405,47 +424,43 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | |||
405 | * GEM user interface. | 424 | * GEM user interface. |
406 | * @p_bo: On successful completion *p_bo points to the created object. | 425 | * @p_bo: On successful completion *p_bo points to the created object. |
407 | * | 426 | * |
408 | * This function allocates a ttm_buffer_object, and then calls | 427 | * This function allocates a ttm_buffer_object, and then calls ttm_bo_init |
409 | * ttm_buffer_object_init on that object. | 428 | * on that object. The destroy function is set to kfree(). |
410 | * The destroy function is set to kfree(). | ||
411 | * Returns | 429 | * Returns |
412 | * -ENOMEM: Out of memory. | 430 | * -ENOMEM: Out of memory. |
413 | * -EINVAL: Invalid placement flags. | 431 | * -EINVAL: Invalid placement flags. |
414 | * -ERESTART: Interrupted by signal while waiting for resources. | 432 | * -ERESTARTSYS: Interrupted by signal while waiting for resources. |
415 | */ | 433 | */ |
416 | 434 | ||
417 | extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, | 435 | extern int ttm_bo_create(struct ttm_bo_device *bdev, |
418 | unsigned long size, | 436 | unsigned long size, |
419 | enum ttm_bo_type type, | 437 | enum ttm_bo_type type, |
420 | uint32_t flags, | 438 | struct ttm_placement *placement, |
421 | uint32_t page_alignment, | 439 | uint32_t page_alignment, |
422 | unsigned long buffer_start, | 440 | unsigned long buffer_start, |
423 | bool interruptible, | 441 | bool interruptible, |
424 | struct file *persistant_swap_storage, | 442 | struct file *persistant_swap_storage, |
425 | struct ttm_buffer_object **p_bo); | 443 | struct ttm_buffer_object **p_bo); |
426 | 444 | ||
427 | /** | 445 | /** |
428 | * ttm_bo_check_placement | 446 | * ttm_bo_check_placement |
429 | * | 447 | * |
430 | * @bo: the buffer object. | 448 | * @bo: the buffer object. |
431 | * @set_flags: placement flags to set. | 449 | * @placement: placements |
432 | * @clr_flags: placement flags to clear. | ||
433 | * | 450 | * |
434 | * Performs minimal validity checking on an intended change of | 451 | * Performs minimal validity checking on an intended change of |
435 | * placement flags. | 452 | * placement flags. |
436 | * Returns | 453 | * Returns |
437 | * -EINVAL: Intended change is invalid or not allowed. | 454 | * -EINVAL: Intended change is invalid or not allowed. |
438 | */ | 455 | */ |
439 | |||
440 | extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, | 456 | extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, |
441 | uint32_t set_flags, uint32_t clr_flags); | 457 | struct ttm_placement *placement); |
442 | 458 | ||
443 | /** | 459 | /** |
444 | * ttm_bo_init_mm | 460 | * ttm_bo_init_mm |
445 | * | 461 | * |
446 | * @bdev: Pointer to a ttm_bo_device struct. | 462 | * @bdev: Pointer to a ttm_bo_device struct. |
447 | * @mem_type: The memory type. | 463 | * @mem_type: The memory type. |
448 | * @p_offset: offset for managed area in pages. | ||
449 | * @p_size: size managed area in pages. | 464 | * @p_size: size managed area in pages. |
450 | * | 465 | * |
451 | * Initialize a manager for a given memory type. | 466 | * Initialize a manager for a given memory type. |
@@ -458,7 +473,7 @@ extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, | |||
458 | */ | 473 | */ |
459 | 474 | ||
460 | extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, | 475 | extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, |
461 | unsigned long p_offset, unsigned long p_size); | 476 | unsigned long p_size); |
462 | /** | 477 | /** |
463 | * ttm_bo_clean_mm | 478 | * ttm_bo_clean_mm |
464 | * | 479 | * |
@@ -503,7 +518,7 @@ extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type); | |||
503 | * | 518 | * |
504 | * Returns: | 519 | * Returns: |
505 | * -EINVAL: Invalid or uninitialized memory type. | 520 | * -EINVAL: Invalid or uninitialized memory type. |
506 | * -ERESTART: The call was interrupted by a signal while waiting to | 521 | * -ERESTARTSYS: The call was interrupted by a signal while waiting to |
507 | * evict a buffer. | 522 | * evict a buffer. |
508 | */ | 523 | */ |
509 | 524 | ||
@@ -606,7 +621,7 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, | |||
606 | * be called from the fops::read and fops::write method. | 621 | * be called from the fops::read and fops::write method. |
607 | * Returns: | 622 | * Returns: |
608 | * See man (2) write, man(2) read. In particular, | 623 | * See man (2) write, man(2) read. In particular, |
609 | * the function may return -EINTR if | 624 | * the function may return -ERESTARTSYS if |
610 | * interrupted by a signal. | 625 | * interrupted by a signal. |
611 | */ | 626 | */ |
612 | 627 | ||
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index e8cd6d20aed2..4c4e0f8375b3 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -242,12 +242,6 @@ struct ttm_mem_type_manager { | |||
242 | /** | 242 | /** |
243 | * struct ttm_bo_driver | 243 | * struct ttm_bo_driver |
244 | * | 244 | * |
245 | * @mem_type_prio: Priority array of memory types to place a buffer object in | ||
246 | * if it fits without evicting buffers from any of these memory types. | ||
247 | * @mem_busy_prio: Priority array of memory types to place a buffer object in | ||
248 | * if it needs to evict buffers to make room. | ||
249 | * @num_mem_type_prio: Number of elements in the @mem_type_prio array. | ||
250 | * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array. | ||
251 | * @create_ttm_backend_entry: Callback to create a struct ttm_backend. | 245 | * @create_ttm_backend_entry: Callback to create a struct ttm_backend. |
252 | * @invalidate_caches: Callback to invalidate read caches when a buffer object | 246 | * @invalidate_caches: Callback to invalidate read caches when a buffer object |
253 | * has been evicted. | 247 | * has been evicted. |
@@ -265,11 +259,6 @@ struct ttm_mem_type_manager { | |||
265 | */ | 259 | */ |
266 | 260 | ||
267 | struct ttm_bo_driver { | 261 | struct ttm_bo_driver { |
268 | const uint32_t *mem_type_prio; | ||
269 | const uint32_t *mem_busy_prio; | ||
270 | uint32_t num_mem_type_prio; | ||
271 | uint32_t num_mem_busy_prio; | ||
272 | |||
273 | /** | 262 | /** |
274 | * struct ttm_bo_driver member create_ttm_backend_entry | 263 | * struct ttm_bo_driver member create_ttm_backend_entry |
275 | * | 264 | * |
@@ -306,7 +295,8 @@ struct ttm_bo_driver { | |||
306 | * finished, they'll end up in bo->mem.flags | 295 | * finished, they'll end up in bo->mem.flags |
307 | */ | 296 | */ |
308 | 297 | ||
309 | uint32_t(*evict_flags) (struct ttm_buffer_object *bo); | 298 | void(*evict_flags) (struct ttm_buffer_object *bo, |
299 | struct ttm_placement *placement); | ||
310 | /** | 300 | /** |
311 | * struct ttm_bo_driver member move: | 301 | * struct ttm_bo_driver member move: |
312 | * | 302 | * |
@@ -363,6 +353,11 @@ struct ttm_bo_driver { | |||
363 | /* notify the driver we are taking a fault on this BO | 353 | /* notify the driver we are taking a fault on this BO |
364 | * and have reserved it */ | 354 | * and have reserved it */ |
365 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); | 355 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); |
356 | |||
357 | /** | ||
358 | * notify the driver that we're about to swap out this bo | ||
359 | */ | ||
360 | void (*swap_notify) (struct ttm_buffer_object *bo); | ||
366 | }; | 361 | }; |
367 | 362 | ||
368 | /** | 363 | /** |
@@ -545,6 +540,15 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm, | |||
545 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); | 540 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); |
546 | 541 | ||
547 | /** | 542 | /** |
543 | * ttm_tt_populate: | ||
544 | * | ||
545 | * @ttm: The struct ttm_tt to contain the backing pages. | ||
546 | * | ||
547 | * Add backing pages to all of @ttm | ||
548 | */ | ||
549 | extern int ttm_tt_populate(struct ttm_tt *ttm); | ||
550 | |||
551 | /** | ||
548 | * ttm_ttm_destroy: | 552 | * ttm_ttm_destroy: |
549 | * | 553 | * |
550 | * @ttm: The struct ttm_tt. | 554 | * @ttm: The struct ttm_tt. |
@@ -639,12 +643,12 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | |||
639 | * -EBUSY: No space available (only if no_wait == 1). | 643 | * -EBUSY: No space available (only if no_wait == 1). |
640 | * -ENOMEM: Could not allocate memory for the buffer object, either due to | 644 | * -ENOMEM: Could not allocate memory for the buffer object, either due to |
641 | * fragmentation or concurrent allocators. | 645 | * fragmentation or concurrent allocators. |
642 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 646 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
643 | */ | 647 | */ |
644 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | 648 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, |
645 | uint32_t proposed_placement, | 649 | struct ttm_placement *placement, |
646 | struct ttm_mem_reg *mem, | 650 | struct ttm_mem_reg *mem, |
647 | bool interruptible, bool no_wait); | 651 | bool interruptible, bool no_wait); |
648 | /** | 652 | /** |
649 | * ttm_bo_wait_for_cpu | 653 | * ttm_bo_wait_for_cpu |
650 | * | 654 | * |
@@ -654,7 +658,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
654 | * Wait until a buffer object is no longer sync'ed for CPU access. | 658 | * Wait until a buffer object is no longer sync'ed for CPU access. |
655 | * Returns: | 659 | * Returns: |
656 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). | 660 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). |
657 | * -ERESTART: An interruptible sleep was interrupted by a signal. | 661 | * -ERESTARTSYS: An interruptible sleep was interrupted by a signal. |
658 | */ | 662 | */ |
659 | 663 | ||
660 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); | 664 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); |
@@ -758,7 +762,7 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | |||
758 | * -EAGAIN: The reservation may cause a deadlock. | 762 | * -EAGAIN: The reservation may cause a deadlock. |
759 | * Release all buffer reservations, wait for @bo to become unreserved and | 763 | * Release all buffer reservations, wait for @bo to become unreserved and |
760 | * try again. (only if use_sequence == 1). | 764 | * try again. (only if use_sequence == 1). |
761 | * -ERESTART: A wait for the buffer to become unreserved was interrupted by | 765 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
762 | * a signal. Release all buffer reservations and return to user-space. | 766 | * a signal. Release all buffer reservations and return to user-space. |
763 | */ | 767 | */ |
764 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 768 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, |
@@ -799,7 +803,7 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | |||
799 | * | 803 | * |
800 | * Returns: | 804 | * Returns: |
801 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. | 805 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. |
802 | * -ERESTART: If interruptible == 1 and the process received a signal | 806 | * -ERESTARTSYS: If interruptible == 1 and the process received a signal |
803 | * while sleeping. | 807 | * while sleeping. |
804 | */ | 808 | */ |
805 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, | 809 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, |
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h new file mode 100644 index 000000000000..cd2c475da9ea --- /dev/null +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | **************************************************************************/ | ||
27 | /* | ||
28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
29 | */ | ||
30 | |||
31 | #ifndef _TTM_EXECBUF_UTIL_H_ | ||
32 | #define _TTM_EXECBUF_UTIL_H_ | ||
33 | |||
34 | #include "ttm/ttm_bo_api.h" | ||
35 | #include <linux/list.h> | ||
36 | |||
37 | /** | ||
38 | * struct ttm_validate_buffer | ||
39 | * | ||
40 | * @head: list head for thread-private list. | ||
41 | * @bo: refcounted buffer object pointer. | ||
42 | * @new_sync_obj_arg: New sync_obj_arg for @bo, to be used once | ||
43 | * adding a new sync object. | ||
44 | * @reservied: Indicates whether @bo has been reserved for validation. | ||
45 | */ | ||
46 | |||
47 | struct ttm_validate_buffer { | ||
48 | struct list_head head; | ||
49 | struct ttm_buffer_object *bo; | ||
50 | void *new_sync_obj_arg; | ||
51 | bool reserved; | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * function ttm_eu_backoff_reservation | ||
56 | * | ||
57 | * @list: thread private list of ttm_validate_buffer structs. | ||
58 | * | ||
59 | * Undoes all buffer validation reservations for bos pointed to by | ||
60 | * the list entries. | ||
61 | */ | ||
62 | |||
63 | extern void ttm_eu_backoff_reservation(struct list_head *list); | ||
64 | |||
65 | /** | ||
66 | * function ttm_eu_reserve_buffers | ||
67 | * | ||
68 | * @list: thread private list of ttm_validate_buffer structs. | ||
69 | * @val_seq: A unique sequence number. | ||
70 | * | ||
71 | * Tries to reserve bos pointed to by the list entries for validation. | ||
72 | * If the function returns 0, all buffers are marked as "unfenced", | ||
73 | * taken off the lru lists and are not synced for write CPU usage. | ||
74 | * | ||
75 | * If the function detects a deadlock due to multiple threads trying to | ||
76 | * reserve the same buffers in reverse order, all threads except one will | ||
77 | * back off and retry. This function may sleep while waiting for | ||
78 | * CPU write reservations to be cleared, and for other threads to | ||
79 | * unreserve their buffers. | ||
80 | * | ||
81 | * This function may return -ERESTART or -EAGAIN if the calling process | ||
82 | * receives a signal while waiting. In that case, no buffers on the list | ||
83 | * will be reserved upon return. | ||
84 | * | ||
85 | * Buffers reserved by this function should be unreserved by | ||
86 | * a call to either ttm_eu_backoff_reservation() or | ||
87 | * ttm_eu_fence_buffer_objects() when command submission is complete or | ||
88 | * has failed. | ||
89 | */ | ||
90 | |||
91 | extern int ttm_eu_reserve_buffers(struct list_head *list, uint32_t val_seq); | ||
92 | |||
93 | /** | ||
94 | * function ttm_eu_fence_buffer_objects. | ||
95 | * | ||
96 | * @list: thread private list of ttm_validate_buffer structs. | ||
97 | * @sync_obj: The new sync object for the buffers. | ||
98 | * | ||
99 | * This function should be called when command submission is complete, and | ||
100 | * it will add a new sync object to bos pointed to by entries on @list. | ||
101 | * It also unreserves all buffers, putting them on lru lists. | ||
102 | * | ||
103 | */ | ||
104 | |||
105 | extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj); | ||
106 | |||
107 | #endif | ||
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h new file mode 100644 index 000000000000..81ba0b0b891a --- /dev/null +++ b/include/drm/ttm/ttm_lock.h | |||
@@ -0,0 +1,247 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | **************************************************************************/ | ||
27 | /* | ||
28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
29 | */ | ||
30 | |||
31 | /** @file ttm_lock.h | ||
32 | * This file implements a simple replacement for the buffer manager use | ||
33 | * of the DRM heavyweight hardware lock. | ||
34 | * The lock is a read-write lock. Taking it in read mode and write mode | ||
35 | * is relatively fast, and intended for in-kernel use only. | ||
36 | * | ||
37 | * The vt mode is used only when there is a need to block all | ||
38 | * user-space processes from validating buffers. | ||
39 | * It's allowed to leave kernel space with the vt lock held. | ||
40 | * If a user-space process dies while having the vt-lock, | ||
41 | * it will be released during the file descriptor release. The vt lock | ||
42 | * excludes write lock and read lock. | ||
43 | * | ||
44 | * The suspend mode is used to lock out all TTM users when preparing for | ||
45 | * and executing suspend operations. | ||
46 | * | ||
47 | */ | ||
48 | |||
49 | #ifndef _TTM_LOCK_H_ | ||
50 | #define _TTM_LOCK_H_ | ||
51 | |||
52 | #include "ttm/ttm_object.h" | ||
53 | #include <linux/wait.h> | ||
54 | #include <asm/atomic.h> | ||
55 | |||
56 | /** | ||
57 | * struct ttm_lock | ||
58 | * | ||
59 | * @base: ttm base object used solely to release the lock if the client | ||
60 | * holding the lock dies. | ||
61 | * @queue: Queue for processes waiting for lock change-of-status. | ||
62 | * @lock: Spinlock protecting some lock members. | ||
63 | * @rw: Read-write lock counter. Protected by @lock. | ||
64 | * @flags: Lock state. Protected by @lock. | ||
65 | * @kill_takers: Boolean whether to kill takers of the lock. | ||
66 | * @signal: Signal to send when kill_takers is true. | ||
67 | */ | ||
68 | |||
69 | struct ttm_lock { | ||
70 | struct ttm_base_object base; | ||
71 | wait_queue_head_t queue; | ||
72 | spinlock_t lock; | ||
73 | int32_t rw; | ||
74 | uint32_t flags; | ||
75 | bool kill_takers; | ||
76 | int signal; | ||
77 | struct ttm_object_file *vt_holder; | ||
78 | }; | ||
79 | |||
80 | |||
81 | /** | ||
82 | * ttm_lock_init | ||
83 | * | ||
84 | * @lock: Pointer to a struct ttm_lock | ||
85 | * Initializes the lock. | ||
86 | */ | ||
87 | extern void ttm_lock_init(struct ttm_lock *lock); | ||
88 | |||
89 | /** | ||
90 | * ttm_read_unlock | ||
91 | * | ||
92 | * @lock: Pointer to a struct ttm_lock | ||
93 | * | ||
94 | * Releases a read lock. | ||
95 | */ | ||
96 | extern void ttm_read_unlock(struct ttm_lock *lock); | ||
97 | |||
98 | /** | ||
99 | * ttm_read_lock | ||
100 | * | ||
101 | * @lock: Pointer to a struct ttm_lock | ||
102 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
103 | * | ||
104 | * Takes the lock in read mode. | ||
105 | * Returns: | ||
106 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
107 | */ | ||
108 | extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible); | ||
109 | |||
110 | /** | ||
111 | * ttm_read_trylock | ||
112 | * | ||
113 | * @lock: Pointer to a struct ttm_lock | ||
114 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
115 | * | ||
116 | * Tries to take the lock in read mode. If the lock is already held | ||
117 | * in write mode, the function will return -EBUSY. If the lock is held | ||
118 | * in vt or suspend mode, the function will sleep until these modes | ||
119 | * are unlocked. | ||
120 | * | ||
121 | * Returns: | ||
122 | * -EBUSY The lock was already held in write mode. | ||
123 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
124 | */ | ||
125 | extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible); | ||
126 | |||
127 | /** | ||
128 | * ttm_write_unlock | ||
129 | * | ||
130 | * @lock: Pointer to a struct ttm_lock | ||
131 | * | ||
132 | * Releases a write lock. | ||
133 | */ | ||
134 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
135 | |||
136 | /** | ||
137 | * ttm_write_lock | ||
138 | * | ||
139 | * @lock: Pointer to a struct ttm_lock | ||
140 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
141 | * | ||
142 | * Takes the lock in write mode. | ||
143 | * Returns: | ||
144 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
145 | */ | ||
146 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
147 | |||
148 | /** | ||
149 | * ttm_lock_downgrade | ||
150 | * | ||
151 | * @lock: Pointer to a struct ttm_lock | ||
152 | * | ||
153 | * Downgrades a write lock to a read lock. | ||
154 | */ | ||
155 | extern void ttm_lock_downgrade(struct ttm_lock *lock); | ||
156 | |||
157 | /** | ||
158 | * ttm_suspend_lock | ||
159 | * | ||
160 | * @lock: Pointer to a struct ttm_lock | ||
161 | * | ||
162 | * Takes the lock in suspend mode. Excludes read and write mode. | ||
163 | */ | ||
164 | extern void ttm_suspend_lock(struct ttm_lock *lock); | ||
165 | |||
166 | /** | ||
167 | * ttm_suspend_unlock | ||
168 | * | ||
169 | * @lock: Pointer to a struct ttm_lock | ||
170 | * | ||
171 | * Releases a suspend lock | ||
172 | */ | ||
173 | extern void ttm_suspend_unlock(struct ttm_lock *lock); | ||
174 | |||
175 | /** | ||
176 | * ttm_vt_lock | ||
177 | * | ||
178 | * @lock: Pointer to a struct ttm_lock | ||
179 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
180 | * @tfile: Pointer to a struct ttm_object_file to register the lock with. | ||
181 | * | ||
182 | * Takes the lock in vt mode. | ||
183 | * Returns: | ||
184 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
185 | * -ENOMEM: Out of memory when locking. | ||
186 | */ | ||
187 | extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible, | ||
188 | struct ttm_object_file *tfile); | ||
189 | |||
190 | /** | ||
191 | * ttm_vt_unlock | ||
192 | * | ||
193 | * @lock: Pointer to a struct ttm_lock | ||
194 | * | ||
195 | * Releases a vt lock. | ||
196 | * Returns: | ||
197 | * -EINVAL If the lock was not held. | ||
198 | */ | ||
199 | extern int ttm_vt_unlock(struct ttm_lock *lock); | ||
200 | |||
201 | /** | ||
202 | * ttm_write_unlock | ||
203 | * | ||
204 | * @lock: Pointer to a struct ttm_lock | ||
205 | * | ||
206 | * Releases a write lock. | ||
207 | */ | ||
208 | extern void ttm_write_unlock(struct ttm_lock *lock); | ||
209 | |||
210 | /** | ||
211 | * ttm_write_lock | ||
212 | * | ||
213 | * @lock: Pointer to a struct ttm_lock | ||
214 | * @interruptible: Interruptible sleeping while waiting for a lock. | ||
215 | * | ||
216 | * Takes the lock in write mode. | ||
217 | * Returns: | ||
218 | * -ERESTARTSYS If interrupted by a signal and interruptible is true. | ||
219 | */ | ||
220 | extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); | ||
221 | |||
222 | /** | ||
223 | * ttm_lock_set_kill | ||
224 | * | ||
225 | * @lock: Pointer to a struct ttm_lock | ||
226 | * @val: Boolean whether to kill processes taking the lock. | ||
227 | * @signal: Signal to send to the process taking the lock. | ||
228 | * | ||
229 | * The kill-when-taking-lock functionality is used to kill processes that keep | ||
230 | * on using the TTM functionality when its resources has been taken down, for | ||
231 | * example when the X server exits. A typical sequence would look like this: | ||
232 | * - X server takes lock in write mode. | ||
233 | * - ttm_lock_set_kill() is called with @val set to true. | ||
234 | * - As part of X server exit, TTM resources are taken down. | ||
235 | * - X server releases the lock on file release. | ||
236 | * - Another dri client wants to render, takes the lock and is killed. | ||
237 | * | ||
238 | */ | ||
239 | static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val, | ||
240 | int signal) | ||
241 | { | ||
242 | lock->kill_takers = val; | ||
243 | if (val) | ||
244 | lock->signal = signal; | ||
245 | } | ||
246 | |||
247 | #endif | ||
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index 6983a7cf4da4..b199170b3c2c 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/kobject.h> | 35 | #include <linux/kobject.h> |
36 | #include <linux/mm.h> | ||
36 | 37 | ||
37 | /** | 38 | /** |
38 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. | 39 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. |
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h new file mode 100644 index 000000000000..0d9db099978b --- /dev/null +++ b/include/drm/ttm/ttm_object.h | |||
@@ -0,0 +1,271 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | **************************************************************************/ | ||
27 | /* | ||
28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
29 | */ | ||
30 | /** @file ttm_object.h | ||
31 | * | ||
32 | * Base- and reference object implementation for the various | ||
33 | * ttm objects. Implements reference counting, minimal security checks | ||
34 | * and release on file close. | ||
35 | */ | ||
36 | |||
37 | #ifndef _TTM_OBJECT_H_ | ||
38 | #define _TTM_OBJECT_H_ | ||
39 | |||
40 | #include <linux/list.h> | ||
41 | #include "drm_hashtab.h" | ||
42 | #include <linux/kref.h> | ||
43 | #include <ttm/ttm_memory.h> | ||
44 | |||
45 | /** | ||
46 | * enum ttm_ref_type | ||
47 | * | ||
48 | * Describes what type of reference a ref object holds. | ||
49 | * | ||
50 | * TTM_REF_USAGE is a simple refcount on a base object. | ||
51 | * | ||
52 | * TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a | ||
53 | * buffer object. | ||
54 | * | ||
55 | * TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a | ||
56 | * buffer object. | ||
57 | * | ||
58 | */ | ||
59 | |||
60 | enum ttm_ref_type { | ||
61 | TTM_REF_USAGE, | ||
62 | TTM_REF_SYNCCPU_READ, | ||
63 | TTM_REF_SYNCCPU_WRITE, | ||
64 | TTM_REF_NUM | ||
65 | }; | ||
66 | |||
67 | /** | ||
68 | * enum ttm_object_type | ||
69 | * | ||
70 | * One entry per ttm object type. | ||
71 | * Device-specific types should use the | ||
72 | * ttm_driver_typex types. | ||
73 | */ | ||
74 | |||
75 | enum ttm_object_type { | ||
76 | ttm_fence_type, | ||
77 | ttm_buffer_type, | ||
78 | ttm_lock_type, | ||
79 | ttm_driver_type0 = 256, | ||
80 | ttm_driver_type1, | ||
81 | ttm_driver_type2, | ||
82 | ttm_driver_type3, | ||
83 | ttm_driver_type4, | ||
84 | ttm_driver_type5 | ||
85 | }; | ||
86 | |||
87 | struct ttm_object_file; | ||
88 | struct ttm_object_device; | ||
89 | |||
90 | /** | ||
91 | * struct ttm_base_object | ||
92 | * | ||
93 | * @hash: hash entry for the per-device object hash. | ||
94 | * @type: derived type this object is base class for. | ||
95 | * @shareable: Other ttm_object_files can access this object. | ||
96 | * | ||
97 | * @tfile: Pointer to ttm_object_file of the creator. | ||
98 | * NULL if the object was not created by a user request. | ||
99 | * (kernel object). | ||
100 | * | ||
101 | * @refcount: Number of references to this object, not | ||
102 | * including the hash entry. A reference to a base object can | ||
103 | * only be held by a ref object. | ||
104 | * | ||
105 | * @refcount_release: A function to be called when there are | ||
106 | * no more references to this object. This function should | ||
107 | * destroy the object (or make sure destruction eventually happens), | ||
108 | * and when it is called, the object has | ||
109 | * already been taken out of the per-device hash. The parameter | ||
110 | * "base" should be set to NULL by the function. | ||
111 | * | ||
112 | * @ref_obj_release: A function to be called when a reference object | ||
113 | * with another ttm_ref_type than TTM_REF_USAGE is deleted. | ||
114 | * this function may, for example, release a lock held by a user-space | ||
115 | * process. | ||
116 | * | ||
117 | * This struct is intended to be used as a base struct for objects that | ||
118 | * are visible to user-space. It provides a global name, race-safe | ||
119 | * access and refcounting, minimal access contol and hooks for unref actions. | ||
120 | */ | ||
121 | |||
122 | struct ttm_base_object { | ||
123 | struct drm_hash_item hash; | ||
124 | enum ttm_object_type object_type; | ||
125 | bool shareable; | ||
126 | struct ttm_object_file *tfile; | ||
127 | struct kref refcount; | ||
128 | void (*refcount_release) (struct ttm_base_object **base); | ||
129 | void (*ref_obj_release) (struct ttm_base_object *base, | ||
130 | enum ttm_ref_type ref_type); | ||
131 | }; | ||
132 | |||
133 | /** | ||
134 | * ttm_base_object_init | ||
135 | * | ||
136 | * @tfile: Pointer to a struct ttm_object_file. | ||
137 | * @base: The struct ttm_base_object to initialize. | ||
138 | * @shareable: This object is shareable with other applcations. | ||
139 | * (different @tfile pointers.) | ||
140 | * @type: The object type. | ||
141 | * @refcount_release: See the struct ttm_base_object description. | ||
142 | * @ref_obj_release: See the struct ttm_base_object description. | ||
143 | * | ||
144 | * Initializes a struct ttm_base_object. | ||
145 | */ | ||
146 | |||
147 | extern int ttm_base_object_init(struct ttm_object_file *tfile, | ||
148 | struct ttm_base_object *base, | ||
149 | bool shareable, | ||
150 | enum ttm_object_type type, | ||
151 | void (*refcount_release) (struct ttm_base_object | ||
152 | **), | ||
153 | void (*ref_obj_release) (struct ttm_base_object | ||
154 | *, | ||
155 | enum ttm_ref_type | ||
156 | ref_type)); | ||
157 | |||
158 | /** | ||
159 | * ttm_base_object_lookup | ||
160 | * | ||
161 | * @tfile: Pointer to a struct ttm_object_file. | ||
162 | * @key: Hash key | ||
163 | * | ||
164 | * Looks up a struct ttm_base_object with the key @key. | ||
165 | * Also verifies that the object is visible to the application, by | ||
166 | * comparing the @tfile argument and checking the object shareable flag. | ||
167 | */ | ||
168 | |||
169 | extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file | ||
170 | *tfile, uint32_t key); | ||
171 | |||
172 | /** | ||
173 | * ttm_base_object_unref | ||
174 | * | ||
175 | * @p_base: Pointer to a pointer referncing a struct ttm_base_object. | ||
176 | * | ||
177 | * Decrements the base object refcount and clears the pointer pointed to by | ||
178 | * p_base. | ||
179 | */ | ||
180 | |||
181 | extern void ttm_base_object_unref(struct ttm_base_object **p_base); | ||
182 | |||
183 | /** | ||
184 | * ttm_ref_object_add. | ||
185 | * | ||
186 | * @tfile: A struct ttm_object_file representing the application owning the | ||
187 | * ref_object. | ||
188 | * @base: The base object to reference. | ||
189 | * @ref_type: The type of reference. | ||
190 | * @existed: Upon completion, indicates that an identical reference object | ||
191 | * already existed, and the refcount was upped on that object instead. | ||
192 | * | ||
193 | * Adding a ref object to a base object is basically like referencing the | ||
194 | * base object, but a user-space application holds the reference. When the | ||
195 | * file corresponding to @tfile is closed, all its reference objects are | ||
196 | * deleted. A reference object can have different types depending on what | ||
197 | * it's intended for. It can be refcounting to prevent object destruction, | ||
198 | * When user-space takes a lock, it can add a ref object to that lock to | ||
199 | * make sure the lock is released if the application dies. A ref object | ||
200 | * will hold a single reference on a base object. | ||
201 | */ | ||
202 | extern int ttm_ref_object_add(struct ttm_object_file *tfile, | ||
203 | struct ttm_base_object *base, | ||
204 | enum ttm_ref_type ref_type, bool *existed); | ||
205 | /** | ||
206 | * ttm_ref_object_base_unref | ||
207 | * | ||
208 | * @key: Key representing the base object. | ||
209 | * @ref_type: Ref type of the ref object to be dereferenced. | ||
210 | * | ||
211 | * Unreference a ref object with type @ref_type | ||
212 | * on the base object identified by @key. If there are no duplicate | ||
213 | * references, the ref object will be destroyed and the base object | ||
214 | * will be unreferenced. | ||
215 | */ | ||
216 | extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile, | ||
217 | unsigned long key, | ||
218 | enum ttm_ref_type ref_type); | ||
219 | |||
220 | /** | ||
221 | * ttm_object_file_init - initialize a struct ttm_object file | ||
222 | * | ||
223 | * @tdev: A struct ttm_object device this file is initialized on. | ||
224 | * @hash_order: Order of the hash table used to hold the reference objects. | ||
225 | * | ||
226 | * This is typically called by the file_ops::open function. | ||
227 | */ | ||
228 | |||
229 | extern struct ttm_object_file *ttm_object_file_init(struct ttm_object_device | ||
230 | *tdev, | ||
231 | unsigned int hash_order); | ||
232 | |||
233 | /** | ||
234 | * ttm_object_file_release - release data held by a ttm_object_file | ||
235 | * | ||
236 | * @p_tfile: Pointer to pointer to the ttm_object_file object to release. | ||
237 | * *p_tfile will be set to NULL by this function. | ||
238 | * | ||
239 | * Releases all data associated by a ttm_object_file. | ||
240 | * Typically called from file_ops::release. The caller must | ||
241 | * ensure that there are no concurrent users of tfile. | ||
242 | */ | ||
243 | |||
244 | extern void ttm_object_file_release(struct ttm_object_file **p_tfile); | ||
245 | |||
246 | /** | ||
247 | * ttm_object device init - initialize a struct ttm_object_device | ||
248 | * | ||
249 | * @hash_order: Order of hash table used to hash the base objects. | ||
250 | * | ||
251 | * This function is typically called on device initialization to prepare | ||
252 | * data structures needed for ttm base and ref objects. | ||
253 | */ | ||
254 | |||
255 | extern struct ttm_object_device *ttm_object_device_init | ||
256 | (struct ttm_mem_global *mem_glob, unsigned int hash_order); | ||
257 | |||
258 | /** | ||
259 | * ttm_object_device_release - release data held by a ttm_object_device | ||
260 | * | ||
261 | * @p_tdev: Pointer to pointer to the ttm_object_device object to release. | ||
262 | * *p_tdev will be set to NULL by this function. | ||
263 | * | ||
264 | * Releases all data associated by a ttm_object_device. | ||
265 | * Typically called from driver::unload before the destruction of the | ||
266 | * device private data structure. | ||
267 | */ | ||
268 | |||
269 | extern void ttm_object_device_release(struct ttm_object_device **p_tdev); | ||
270 | |||
271 | #endif | ||
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h index 170786e5c2ff..fd11a5bd892d 100644 --- a/include/drm/via_drm.h +++ b/include/drm/via_drm.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #ifndef _VIA_DRM_H_ | 24 | #ifndef _VIA_DRM_H_ |
25 | #define _VIA_DRM_H_ | 25 | #define _VIA_DRM_H_ |
26 | 26 | ||
27 | #include <linux/types.h> | 27 | #include "drm.h" |
28 | 28 | ||
29 | /* WARNING: These defines must be the same as what the Xserver uses. | 29 | /* WARNING: These defines must be the same as what the Xserver uses. |
30 | * if you change them, you must change the defines in the Xserver. | 30 | * if you change them, you must change the defines in the Xserver. |
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h new file mode 100644 index 000000000000..c7645f480d12 --- /dev/null +++ b/include/drm/vmwgfx_drm.h | |||
@@ -0,0 +1,588 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the | ||
8 | * "Software"), to deal in the Software without restriction, including | ||
9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
11 | * permit persons to whom the Software is furnished to do so, subject to | ||
12 | * the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice (including the | ||
15 | * next paragraph) shall be included in all copies or substantial portions | ||
16 | * of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | * | ||
26 | **************************************************************************/ | ||
27 | |||
28 | #ifndef __VMWGFX_DRM_H__ | ||
29 | #define __VMWGFX_DRM_H__ | ||
30 | |||
31 | #define DRM_VMW_MAX_SURFACE_FACES 6 | ||
32 | #define DRM_VMW_MAX_MIP_LEVELS 24 | ||
33 | |||
34 | #define DRM_VMW_EXT_NAME_LEN 128 | ||
35 | |||
36 | #define DRM_VMW_GET_PARAM 0 | ||
37 | #define DRM_VMW_ALLOC_DMABUF 1 | ||
38 | #define DRM_VMW_UNREF_DMABUF 2 | ||
39 | #define DRM_VMW_CURSOR_BYPASS 3 | ||
40 | /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ | ||
41 | #define DRM_VMW_CONTROL_STREAM 4 | ||
42 | #define DRM_VMW_CLAIM_STREAM 5 | ||
43 | #define DRM_VMW_UNREF_STREAM 6 | ||
44 | /* guarded by DRM_VMW_PARAM_3D == 1 */ | ||
45 | #define DRM_VMW_CREATE_CONTEXT 7 | ||
46 | #define DRM_VMW_UNREF_CONTEXT 8 | ||
47 | #define DRM_VMW_CREATE_SURFACE 9 | ||
48 | #define DRM_VMW_UNREF_SURFACE 10 | ||
49 | #define DRM_VMW_REF_SURFACE 11 | ||
50 | #define DRM_VMW_EXECBUF 12 | ||
51 | #define DRM_VMW_FIFO_DEBUG 13 | ||
52 | #define DRM_VMW_FENCE_WAIT 14 | ||
53 | |||
54 | |||
55 | /*************************************************************************/ | ||
56 | /** | ||
57 | * DRM_VMW_GET_PARAM - get device information. | ||
58 | * | ||
59 | * DRM_VMW_PARAM_FIFO_OFFSET: | ||
60 | * Offset to use to map the first page of the FIFO read-only. | ||
61 | * The fifo is mapped using the mmap() system call on the drm device. | ||
62 | * | ||
63 | * DRM_VMW_PARAM_OVERLAY_IOCTL: | ||
64 | * Does the driver support the overlay ioctl. | ||
65 | */ | ||
66 | |||
67 | #define DRM_VMW_PARAM_NUM_STREAMS 0 | ||
68 | #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 | ||
69 | #define DRM_VMW_PARAM_3D 2 | ||
70 | #define DRM_VMW_PARAM_FIFO_OFFSET 3 | ||
71 | #define DRM_VMW_PARAM_HW_CAPS 4 | ||
72 | #define DRM_VMW_PARAM_FIFO_CAPS 5 | ||
73 | |||
74 | /** | ||
75 | * struct drm_vmw_getparam_arg | ||
76 | * | ||
77 | * @value: Returned value. //Out | ||
78 | * @param: Parameter to query. //In. | ||
79 | * | ||
80 | * Argument to the DRM_VMW_GET_PARAM Ioctl. | ||
81 | */ | ||
82 | |||
83 | struct drm_vmw_getparam_arg { | ||
84 | uint64_t value; | ||
85 | uint32_t param; | ||
86 | uint32_t pad64; | ||
87 | }; | ||
88 | |||
89 | /*************************************************************************/ | ||
90 | /** | ||
91 | * DRM_VMW_EXTENSION - Query device extensions. | ||
92 | */ | ||
93 | |||
94 | /** | ||
95 | * struct drm_vmw_extension_rep | ||
96 | * | ||
97 | * @exists: The queried extension exists. | ||
98 | * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension. | ||
99 | * @driver_sarea_offset: Offset to any space in the DRI SAREA | ||
100 | * used by the extension. | ||
101 | * @major: Major version number of the extension. | ||
102 | * @minor: Minor version number of the extension. | ||
103 | * @pl: Patch level version number of the extension. | ||
104 | * | ||
105 | * Output argument to the DRM_VMW_EXTENSION Ioctl. | ||
106 | */ | ||
107 | |||
108 | struct drm_vmw_extension_rep { | ||
109 | int32_t exists; | ||
110 | uint32_t driver_ioctl_offset; | ||
111 | uint32_t driver_sarea_offset; | ||
112 | uint32_t major; | ||
113 | uint32_t minor; | ||
114 | uint32_t pl; | ||
115 | uint32_t pad64; | ||
116 | }; | ||
117 | |||
118 | /** | ||
119 | * union drm_vmw_extension_arg | ||
120 | * | ||
121 | * @extension - Ascii name of the extension to be queried. //In | ||
122 | * @rep - Reply as defined above. //Out | ||
123 | * | ||
124 | * Argument to the DRM_VMW_EXTENSION Ioctl. | ||
125 | */ | ||
126 | |||
127 | union drm_vmw_extension_arg { | ||
128 | char extension[DRM_VMW_EXT_NAME_LEN]; | ||
129 | struct drm_vmw_extension_rep rep; | ||
130 | }; | ||
131 | |||
132 | /*************************************************************************/ | ||
133 | /** | ||
134 | * DRM_VMW_CREATE_CONTEXT - Create a host context. | ||
135 | * | ||
136 | * Allocates a device unique context id, and queues a create context command | ||
137 | * for the host. Does not wait for host completion. | ||
138 | */ | ||
139 | |||
140 | /** | ||
141 | * struct drm_vmw_context_arg | ||
142 | * | ||
143 | * @cid: Device unique context ID. | ||
144 | * | ||
145 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
146 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
147 | */ | ||
148 | |||
149 | struct drm_vmw_context_arg { | ||
150 | int32_t cid; | ||
151 | uint32_t pad64; | ||
152 | }; | ||
153 | |||
154 | /*************************************************************************/ | ||
155 | /** | ||
156 | * DRM_VMW_UNREF_CONTEXT - Create a host context. | ||
157 | * | ||
158 | * Frees a global context id, and queues a destroy host command for the host. | ||
159 | * Does not wait for host completion. The context ID can be used directly | ||
160 | * in the command stream and shows up as the same context ID on the host. | ||
161 | */ | ||
162 | |||
163 | /*************************************************************************/ | ||
164 | /** | ||
165 | * DRM_VMW_CREATE_SURFACE - Create a host suface. | ||
166 | * | ||
167 | * Allocates a device unique surface id, and queues a create surface command | ||
168 | * for the host. Does not wait for host completion. The surface ID can be | ||
169 | * used directly in the command stream and shows up as the same surface | ||
170 | * ID on the host. | ||
171 | */ | ||
172 | |||
173 | /** | ||
174 | * struct drm_wmv_surface_create_req | ||
175 | * | ||
176 | * @flags: Surface flags as understood by the host. | ||
177 | * @format: Surface format as understood by the host. | ||
178 | * @mip_levels: Number of mip levels for each face. | ||
179 | * An unused face should have 0 encoded. | ||
180 | * @size_addr: Address of a user-space array of sruct drm_vmw_size | ||
181 | * cast to an uint64_t for 32-64 bit compatibility. | ||
182 | * The size of the array should equal the total number of mipmap levels. | ||
183 | * @shareable: Boolean whether other clients (as identified by file descriptors) | ||
184 | * may reference this surface. | ||
185 | * @scanout: Boolean whether the surface is intended to be used as a | ||
186 | * scanout. | ||
187 | * | ||
188 | * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
189 | * Output data from the DRM_VMW_REF_SURFACE Ioctl. | ||
190 | */ | ||
191 | |||
192 | struct drm_vmw_surface_create_req { | ||
193 | uint32_t flags; | ||
194 | uint32_t format; | ||
195 | uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; | ||
196 | uint64_t size_addr; | ||
197 | int32_t shareable; | ||
198 | int32_t scanout; | ||
199 | }; | ||
200 | |||
201 | /** | ||
202 | * struct drm_wmv_surface_arg | ||
203 | * | ||
204 | * @sid: Surface id of created surface or surface to destroy or reference. | ||
205 | * | ||
206 | * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. | ||
207 | * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. | ||
208 | * Input argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
209 | */ | ||
210 | |||
211 | struct drm_vmw_surface_arg { | ||
212 | int32_t sid; | ||
213 | uint32_t pad64; | ||
214 | }; | ||
215 | |||
216 | /** | ||
217 | * struct drm_vmw_size ioctl. | ||
218 | * | ||
219 | * @width - mip level width | ||
220 | * @height - mip level height | ||
221 | * @depth - mip level depth | ||
222 | * | ||
223 | * Description of a mip level. | ||
224 | * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. | ||
225 | */ | ||
226 | |||
227 | struct drm_vmw_size { | ||
228 | uint32_t width; | ||
229 | uint32_t height; | ||
230 | uint32_t depth; | ||
231 | uint32_t pad64; | ||
232 | }; | ||
233 | |||
234 | /** | ||
235 | * union drm_vmw_surface_create_arg | ||
236 | * | ||
237 | * @rep: Output data as described above. | ||
238 | * @req: Input data as described above. | ||
239 | * | ||
240 | * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. | ||
241 | */ | ||
242 | |||
243 | union drm_vmw_surface_create_arg { | ||
244 | struct drm_vmw_surface_arg rep; | ||
245 | struct drm_vmw_surface_create_req req; | ||
246 | }; | ||
247 | |||
248 | /*************************************************************************/ | ||
249 | /** | ||
250 | * DRM_VMW_REF_SURFACE - Reference a host surface. | ||
251 | * | ||
252 | * Puts a reference on a host surface with a give sid, as previously | ||
253 | * returned by the DRM_VMW_CREATE_SURFACE ioctl. | ||
254 | * A reference will make sure the surface isn't destroyed while we hold | ||
255 | * it and will allow the calling client to use the surface ID in the command | ||
256 | * stream. | ||
257 | * | ||
258 | * On successful return, the Ioctl returns the surface information given | ||
259 | * in the DRM_VMW_CREATE_SURFACE ioctl. | ||
260 | */ | ||
261 | |||
262 | /** | ||
263 | * union drm_vmw_surface_reference_arg | ||
264 | * | ||
265 | * @rep: Output data as described above. | ||
266 | * @req: Input data as described above. | ||
267 | * | ||
268 | * Argument to the DRM_VMW_REF_SURFACE Ioctl. | ||
269 | */ | ||
270 | |||
271 | union drm_vmw_surface_reference_arg { | ||
272 | struct drm_vmw_surface_create_req rep; | ||
273 | struct drm_vmw_surface_arg req; | ||
274 | }; | ||
275 | |||
276 | /*************************************************************************/ | ||
277 | /** | ||
278 | * DRM_VMW_UNREF_SURFACE - Unreference a host surface. | ||
279 | * | ||
280 | * Clear a reference previously put on a host surface. | ||
281 | * When all references are gone, including the one implicitly placed | ||
282 | * on creation, | ||
283 | * a destroy surface command will be queued for the host. | ||
284 | * Does not wait for completion. | ||
285 | */ | ||
286 | |||
287 | /*************************************************************************/ | ||
288 | /** | ||
289 | * DRM_VMW_EXECBUF | ||
290 | * | ||
291 | * Submit a command buffer for execution on the host, and return a | ||
292 | * fence sequence that when signaled, indicates that the command buffer has | ||
293 | * executed. | ||
294 | */ | ||
295 | |||
296 | /** | ||
297 | * struct drm_vmw_execbuf_arg | ||
298 | * | ||
299 | * @commands: User-space address of a command buffer cast to an uint64_t. | ||
300 | * @command-size: Size in bytes of the command buffer. | ||
301 | * @throttle-us: Sleep until software is less than @throttle_us | ||
302 | * microseconds ahead of hardware. The driver may round this value | ||
303 | * to the nearest kernel tick. | ||
304 | * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an | ||
305 | * uint64_t. | ||
306 | * @version: Allows expanding the execbuf ioctl parameters without breaking | ||
307 | * backwards compatibility, since user-space will always tell the kernel | ||
308 | * which version it uses. | ||
309 | * @flags: Execbuf flags. None currently. | ||
310 | * | ||
311 | * Argument to the DRM_VMW_EXECBUF Ioctl. | ||
312 | */ | ||
313 | |||
314 | #define DRM_VMW_EXECBUF_VERSION 0 | ||
315 | |||
316 | struct drm_vmw_execbuf_arg { | ||
317 | uint64_t commands; | ||
318 | uint32_t command_size; | ||
319 | uint32_t throttle_us; | ||
320 | uint64_t fence_rep; | ||
321 | uint32_t version; | ||
322 | uint32_t flags; | ||
323 | }; | ||
324 | |||
325 | /** | ||
326 | * struct drm_vmw_fence_rep | ||
327 | * | ||
328 | * @fence_seq: Fence sequence associated with a command submission. | ||
329 | * @error: This member should've been set to -EFAULT on submission. | ||
330 | * The following actions should be take on completion: | ||
331 | * error == -EFAULT: Fence communication failed. The host is synchronized. | ||
332 | * Use the last fence id read from the FIFO fence register. | ||
333 | * error != 0 && error != -EFAULT: | ||
334 | * Fence submission failed. The host is synchronized. Use the fence_seq member. | ||
335 | * error == 0: All is OK, The host may not be synchronized. | ||
336 | * Use the fence_seq member. | ||
337 | * | ||
338 | * Input / Output data to the DRM_VMW_EXECBUF Ioctl. | ||
339 | */ | ||
340 | |||
341 | struct drm_vmw_fence_rep { | ||
342 | uint64_t fence_seq; | ||
343 | int32_t error; | ||
344 | uint32_t pad64; | ||
345 | }; | ||
346 | |||
347 | /*************************************************************************/ | ||
348 | /** | ||
349 | * DRM_VMW_ALLOC_DMABUF | ||
350 | * | ||
351 | * Allocate a DMA buffer that is visible also to the host. | ||
352 | * NOTE: The buffer is | ||
353 | * identified by a handle and an offset, which are private to the guest, but | ||
354 | * useable in the command stream. The guest kernel may translate these | ||
355 | * and patch up the command stream accordingly. In the future, the offset may | ||
356 | * be zero at all times, or it may disappear from the interface before it is | ||
357 | * fixed. | ||
358 | * | ||
359 | * The DMA buffer may stay user-space mapped in the guest at all times, | ||
360 | * and is thus suitable for sub-allocation. | ||
361 | * | ||
362 | * DMA buffers are mapped using the mmap() syscall on the drm device. | ||
363 | */ | ||
364 | |||
365 | /** | ||
366 | * struct drm_vmw_alloc_dmabuf_req | ||
367 | * | ||
368 | * @size: Required minimum size of the buffer. | ||
369 | * | ||
370 | * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
371 | */ | ||
372 | |||
373 | struct drm_vmw_alloc_dmabuf_req { | ||
374 | uint32_t size; | ||
375 | uint32_t pad64; | ||
376 | }; | ||
377 | |||
378 | /** | ||
379 | * struct drm_vmw_dmabuf_rep | ||
380 | * | ||
381 | * @map_handle: Offset to use in the mmap() call used to map the buffer. | ||
382 | * @handle: Handle unique to this buffer. Used for unreferencing. | ||
383 | * @cur_gmr_id: GMR id to use in the command stream when this buffer is | ||
384 | * referenced. See not above. | ||
385 | * @cur_gmr_offset: Offset to use in the command stream when this buffer is | ||
386 | * referenced. See note above. | ||
387 | * | ||
388 | * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
389 | */ | ||
390 | |||
391 | struct drm_vmw_dmabuf_rep { | ||
392 | uint64_t map_handle; | ||
393 | uint32_t handle; | ||
394 | uint32_t cur_gmr_id; | ||
395 | uint32_t cur_gmr_offset; | ||
396 | uint32_t pad64; | ||
397 | }; | ||
398 | |||
399 | /** | ||
400 | * union drm_vmw_dmabuf_arg | ||
401 | * | ||
402 | * @req: Input data as described above. | ||
403 | * @rep: Output data as described above. | ||
404 | * | ||
405 | * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl. | ||
406 | */ | ||
407 | |||
408 | union drm_vmw_alloc_dmabuf_arg { | ||
409 | struct drm_vmw_alloc_dmabuf_req req; | ||
410 | struct drm_vmw_dmabuf_rep rep; | ||
411 | }; | ||
412 | |||
413 | /*************************************************************************/ | ||
414 | /** | ||
415 | * DRM_VMW_UNREF_DMABUF - Free a DMA buffer. | ||
416 | * | ||
417 | */ | ||
418 | |||
419 | /** | ||
420 | * struct drm_vmw_unref_dmabuf_arg | ||
421 | * | ||
422 | * @handle: Handle indicating what buffer to free. Obtained from the | ||
423 | * DRM_VMW_ALLOC_DMABUF Ioctl. | ||
424 | * | ||
425 | * Argument to the DRM_VMW_UNREF_DMABUF Ioctl. | ||
426 | */ | ||
427 | |||
428 | struct drm_vmw_unref_dmabuf_arg { | ||
429 | uint32_t handle; | ||
430 | uint32_t pad64; | ||
431 | }; | ||
432 | |||
433 | /*************************************************************************/ | ||
434 | /** | ||
435 | * DRM_VMW_FIFO_DEBUG - Get last FIFO submission. | ||
436 | * | ||
437 | * This IOCTL copies the last FIFO submission directly out of the FIFO buffer. | ||
438 | */ | ||
439 | |||
440 | /** | ||
441 | * struct drm_vmw_fifo_debug_arg | ||
442 | * | ||
443 | * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In | ||
444 | * @debug_buffer_size: Size in bytes of debug buffer //In | ||
445 | * @used_size: Number of bytes copied to the buffer // Out | ||
446 | * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out | ||
447 | * | ||
448 | * Argument to the DRM_VMW_FIFO_DEBUG Ioctl. | ||
449 | */ | ||
450 | |||
451 | struct drm_vmw_fifo_debug_arg { | ||
452 | uint64_t debug_buffer; | ||
453 | uint32_t debug_buffer_size; | ||
454 | uint32_t used_size; | ||
455 | int32_t did_not_fit; | ||
456 | uint32_t pad64; | ||
457 | }; | ||
458 | |||
459 | struct drm_vmw_fence_wait_arg { | ||
460 | uint64_t sequence; | ||
461 | uint64_t kernel_cookie; | ||
462 | int32_t cookie_valid; | ||
463 | int32_t pad64; | ||
464 | }; | ||
465 | |||
466 | /*************************************************************************/ | ||
467 | /** | ||
468 | * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. | ||
469 | * | ||
470 | * This IOCTL controls the overlay units of the svga device. | ||
471 | * The SVGA overlay units does not work like regular hardware units in | ||
472 | * that they do not automaticaly read back the contents of the given dma | ||
473 | * buffer. But instead only read back for each call to this ioctl, and | ||
474 | * at any point between this call being made and a following call that | ||
475 | * either changes the buffer or disables the stream. | ||
476 | */ | ||
477 | |||
478 | /** | ||
479 | * struct drm_vmw_rect | ||
480 | * | ||
481 | * Defines a rectangle. Used in the overlay ioctl to define | ||
482 | * source and destination rectangle. | ||
483 | */ | ||
484 | |||
485 | struct drm_vmw_rect { | ||
486 | int32_t x; | ||
487 | int32_t y; | ||
488 | uint32_t w; | ||
489 | uint32_t h; | ||
490 | }; | ||
491 | |||
492 | /** | ||
493 | * struct drm_vmw_control_stream_arg | ||
494 | * | ||
495 | * @stream_id: Stearm to control | ||
496 | * @enabled: If false all following arguments are ignored. | ||
497 | * @handle: Handle to buffer for getting data from. | ||
498 | * @format: Format of the overlay as understood by the host. | ||
499 | * @width: Width of the overlay. | ||
500 | * @height: Height of the overlay. | ||
501 | * @size: Size of the overlay in bytes. | ||
502 | * @pitch: Array of pitches, the two last are only used for YUV12 formats. | ||
503 | * @offset: Offset from start of dma buffer to overlay. | ||
504 | * @src: Source rect, must be within the defined area above. | ||
505 | * @dst: Destination rect, x and y may be negative. | ||
506 | * | ||
507 | * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. | ||
508 | */ | ||
509 | |||
510 | struct drm_vmw_control_stream_arg { | ||
511 | uint32_t stream_id; | ||
512 | uint32_t enabled; | ||
513 | |||
514 | uint32_t flags; | ||
515 | uint32_t color_key; | ||
516 | |||
517 | uint32_t handle; | ||
518 | uint32_t offset; | ||
519 | int32_t format; | ||
520 | uint32_t size; | ||
521 | uint32_t width; | ||
522 | uint32_t height; | ||
523 | uint32_t pitch[3]; | ||
524 | |||
525 | uint32_t pad64; | ||
526 | struct drm_vmw_rect src; | ||
527 | struct drm_vmw_rect dst; | ||
528 | }; | ||
529 | |||
530 | /*************************************************************************/ | ||
531 | /** | ||
532 | * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. | ||
533 | * | ||
534 | */ | ||
535 | |||
536 | #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) | ||
537 | #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) | ||
538 | |||
539 | /** | ||
540 | * struct drm_vmw_cursor_bypass_arg | ||
541 | * | ||
542 | * @flags: Flags. | ||
543 | * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. | ||
544 | * @xpos: X position of cursor. | ||
545 | * @ypos: Y position of cursor. | ||
546 | * @xhot: X hotspot. | ||
547 | * @yhot: Y hotspot. | ||
548 | * | ||
549 | * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. | ||
550 | */ | ||
551 | |||
552 | struct drm_vmw_cursor_bypass_arg { | ||
553 | uint32_t flags; | ||
554 | uint32_t crtc_id; | ||
555 | int32_t xpos; | ||
556 | int32_t ypos; | ||
557 | int32_t xhot; | ||
558 | int32_t yhot; | ||
559 | }; | ||
560 | |||
561 | /*************************************************************************/ | ||
562 | /** | ||
563 | * DRM_VMW_CLAIM_STREAM - Claim a single stream. | ||
564 | */ | ||
565 | |||
566 | /** | ||
567 | * struct drm_vmw_context_arg | ||
568 | * | ||
569 | * @stream_id: Device unique context ID. | ||
570 | * | ||
571 | * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. | ||
572 | * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. | ||
573 | */ | ||
574 | |||
575 | struct drm_vmw_stream_arg { | ||
576 | uint32_t stream_id; | ||
577 | uint32_t pad64; | ||
578 | }; | ||
579 | |||
580 | /*************************************************************************/ | ||
581 | /** | ||
582 | * DRM_VMW_UNREF_STREAM - Unclaim a stream. | ||
583 | * | ||
584 | * Return a single stream that was claimed by this process. Also makes | ||
585 | * sure that the stream has been stopped. | ||
586 | */ | ||
587 | |||
588 | #endif | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 5a5385749e16..d93080748a91 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -118,6 +118,7 @@ header-y += mtio.h | |||
118 | header-y += ncp_no.h | 118 | header-y += ncp_no.h |
119 | header-y += neighbour.h | 119 | header-y += neighbour.h |
120 | header-y += net_dropmon.h | 120 | header-y += net_dropmon.h |
121 | header-y += net_tstamp.h | ||
121 | header-y += netfilter_arp.h | 122 | header-y += netfilter_arp.h |
122 | header-y += netrom.h | 123 | header-y += netrom.h |
123 | header-y += nfs2.h | 124 | header-y += nfs2.h |
@@ -214,7 +215,6 @@ unifdef-y += futex.h | |||
214 | unifdef-y += fs.h | 215 | unifdef-y += fs.h |
215 | unifdef-y += gameport.h | 216 | unifdef-y += gameport.h |
216 | unifdef-y += generic_serial.h | 217 | unifdef-y += generic_serial.h |
217 | unifdef-y += hayesesp.h | ||
218 | unifdef-y += hdlcdrv.h | 218 | unifdef-y += hdlcdrv.h |
219 | unifdef-y += hdlc.h | 219 | unifdef-y += hdlc.h |
220 | unifdef-y += hdreg.h | 220 | unifdef-y += hdreg.h |
@@ -362,6 +362,7 @@ unifdef-y += uio.h | |||
362 | unifdef-y += unistd.h | 362 | unifdef-y += unistd.h |
363 | unifdef-y += usbdevice_fs.h | 363 | unifdef-y += usbdevice_fs.h |
364 | unifdef-y += utsname.h | 364 | unifdef-y += utsname.h |
365 | unifdef-y += vhost.h | ||
365 | unifdef-y += videodev2.h | 366 | unifdef-y += videodev2.h |
366 | unifdef-y += videodev.h | 367 | unifdef-y += videodev.h |
367 | unifdef-y += virtio_config.h | 368 | unifdef-y += virtio_config.h |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index dfcd920c3e54..b926afe8c03e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | |||
80 | void __acpi_unmap_table(char *map, unsigned long size); | 80 | void __acpi_unmap_table(char *map, unsigned long size); |
81 | int early_acpi_boot_init(void); | 81 | int early_acpi_boot_init(void); |
82 | int acpi_boot_init (void); | 82 | int acpi_boot_init (void); |
83 | int acpi_boot_table_init (void); | 83 | void acpi_boot_table_init (void); |
84 | int acpi_mps_check (void); | 84 | int acpi_mps_check (void); |
85 | int acpi_numa_init (void); | 85 | int acpi_numa_init (void); |
86 | 86 | ||
@@ -240,7 +240,7 @@ extern int pnpacpi_disabled; | |||
240 | #define PXM_INVAL (-1) | 240 | #define PXM_INVAL (-1) |
241 | #define NID_INVAL (-1) | 241 | #define NID_INVAL (-1) |
242 | 242 | ||
243 | int acpi_check_resource_conflict(struct resource *res); | 243 | int acpi_check_resource_conflict(const struct resource *res); |
244 | 244 | ||
245 | int acpi_check_region(resource_size_t start, resource_size_t n, | 245 | int acpi_check_region(resource_size_t start, resource_size_t n, |
246 | const char *name); | 246 | const char *name); |
@@ -251,12 +251,19 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n, | |||
251 | void __init acpi_no_s4_hw_signature(void); | 251 | void __init acpi_no_s4_hw_signature(void); |
252 | void __init acpi_old_suspend_ordering(void); | 252 | void __init acpi_old_suspend_ordering(void); |
253 | void __init acpi_s4_no_nvs(void); | 253 | void __init acpi_s4_no_nvs(void); |
254 | void __init acpi_set_sci_en_on_resume(void); | ||
254 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
255 | 256 | ||
257 | struct acpi_osc_context { | ||
258 | char *uuid_str; /* uuid string */ | ||
259 | int rev; | ||
260 | struct acpi_buffer cap; /* arg2/arg3 */ | ||
261 | struct acpi_buffer ret; /* free by caller if success */ | ||
262 | }; | ||
263 | |||
256 | #define OSC_QUERY_TYPE 0 | 264 | #define OSC_QUERY_TYPE 0 |
257 | #define OSC_SUPPORT_TYPE 1 | 265 | #define OSC_SUPPORT_TYPE 1 |
258 | #define OSC_CONTROL_TYPE 2 | 266 | #define OSC_CONTROL_TYPE 2 |
259 | #define OSC_SUPPORT_MASKS 0x1f | ||
260 | 267 | ||
261 | /* _OSC DW0 Definition */ | 268 | /* _OSC DW0 Definition */ |
262 | #define OSC_QUERY_ENABLE 1 | 269 | #define OSC_QUERY_ENABLE 1 |
@@ -265,12 +272,23 @@ void __init acpi_s4_no_nvs(void); | |||
265 | #define OSC_INVALID_REVISION_ERROR 8 | 272 | #define OSC_INVALID_REVISION_ERROR 8 |
266 | #define OSC_CAPABILITIES_MASK_ERROR 16 | 273 | #define OSC_CAPABILITIES_MASK_ERROR 16 |
267 | 274 | ||
275 | acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); | ||
276 | |||
277 | /* platform-wide _OSC bits */ | ||
278 | #define OSC_SB_PAD_SUPPORT 1 | ||
279 | #define OSC_SB_PPC_OST_SUPPORT 2 | ||
280 | #define OSC_SB_PR3_SUPPORT 4 | ||
281 | #define OSC_SB_CPUHP_OST_SUPPORT 8 | ||
282 | #define OSC_SB_APEI_SUPPORT 16 | ||
283 | |||
284 | /* PCI defined _OSC bits */ | ||
268 | /* _OSC DW1 Definition (OS Support Fields) */ | 285 | /* _OSC DW1 Definition (OS Support Fields) */ |
269 | #define OSC_EXT_PCI_CONFIG_SUPPORT 1 | 286 | #define OSC_EXT_PCI_CONFIG_SUPPORT 1 |
270 | #define OSC_ACTIVE_STATE_PWR_SUPPORT 2 | 287 | #define OSC_ACTIVE_STATE_PWR_SUPPORT 2 |
271 | #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 | 288 | #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4 |
272 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 | 289 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8 |
273 | #define OSC_MSI_SUPPORT 16 | 290 | #define OSC_MSI_SUPPORT 16 |
291 | #define OSC_PCI_SUPPORT_MASKS 0x1f | ||
274 | 292 | ||
275 | /* _OSC DW1 Definition (OS Control Fields) */ | 293 | /* _OSC DW1 Definition (OS Control Fields) */ |
276 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 | 294 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1 |
@@ -279,7 +297,7 @@ void __init acpi_s4_no_nvs(void); | |||
279 | #define OSC_PCI_EXPRESS_AER_CONTROL 8 | 297 | #define OSC_PCI_EXPRESS_AER_CONTROL 8 |
280 | #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 | 298 | #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16 |
281 | 299 | ||
282 | #define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ | 300 | #define OSC_PCI_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \ |
283 | OSC_SHPC_NATIVE_HP_CONTROL | \ | 301 | OSC_SHPC_NATIVE_HP_CONTROL | \ |
284 | OSC_PCI_EXPRESS_PME_CONTROL | \ | 302 | OSC_PCI_EXPRESS_PME_CONTROL | \ |
285 | OSC_PCI_EXPRESS_AER_CONTROL | \ | 303 | OSC_PCI_EXPRESS_AER_CONTROL | \ |
@@ -303,9 +321,9 @@ static inline int acpi_boot_init(void) | |||
303 | return 0; | 321 | return 0; |
304 | } | 322 | } |
305 | 323 | ||
306 | static inline int acpi_boot_table_init(void) | 324 | static inline void acpi_boot_table_init(void) |
307 | { | 325 | { |
308 | return 0; | 326 | return; |
309 | } | 327 | } |
310 | 328 | ||
311 | static inline int acpi_mps_check(void) | 329 | static inline int acpi_mps_check(void) |
diff --git a/include/linux/aio.h b/include/linux/aio.h index aea219d7d8d1..811dbb369379 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
@@ -102,7 +102,6 @@ struct kiocb { | |||
102 | } ki_obj; | 102 | } ki_obj; |
103 | 103 | ||
104 | __u64 ki_user_data; /* user's data for completion */ | 104 | __u64 ki_user_data; /* user's data for completion */ |
105 | wait_queue_t ki_wait; | ||
106 | loff_t ki_pos; | 105 | loff_t ki_pos; |
107 | 106 | ||
108 | void *private; | 107 | void *private; |
@@ -140,7 +139,6 @@ struct kiocb { | |||
140 | (x)->ki_dtor = NULL; \ | 139 | (x)->ki_dtor = NULL; \ |
141 | (x)->ki_obj.tsk = tsk; \ | 140 | (x)->ki_obj.tsk = tsk; \ |
142 | (x)->ki_user_data = 0; \ | 141 | (x)->ki_user_data = 0; \ |
143 | init_wait((&(x)->ki_wait)); \ | ||
144 | } while (0) | 142 | } while (0) |
145 | 143 | ||
146 | #define AIO_RING_MAGIC 0xa10a10a1 | 144 | #define AIO_RING_MAGIC 0xa10a10a1 |
@@ -223,8 +221,6 @@ struct mm_struct; | |||
223 | static inline void exit_aio(struct mm_struct *mm) { } | 221 | static inline void exit_aio(struct mm_struct *mm) { } |
224 | #endif /* CONFIG_AIO */ | 222 | #endif /* CONFIG_AIO */ |
225 | 223 | ||
226 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) | ||
227 | |||
228 | static inline struct kiocb *list_kiocb(struct list_head *h) | 224 | static inline struct kiocb *list_kiocb(struct list_head *h) |
229 | { | 225 | { |
230 | return list_entry(h, struct kiocb, ki_list); | 226 | return list_entry(h, struct kiocb, ki_list); |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 38a6948ce0c2..20f31567ccee 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -647,9 +647,9 @@ static inline int ata_id_has_large_logical_sectors(const u16 *id) | |||
647 | return id[ATA_ID_SECTOR_SIZE] & (1 << 13); | 647 | return id[ATA_ID_SECTOR_SIZE] & (1 << 13); |
648 | } | 648 | } |
649 | 649 | ||
650 | static inline u8 ata_id_logical_per_physical_sectors(const u16 *id) | 650 | static inline u16 ata_id_logical_per_physical_sectors(const u16 *id) |
651 | { | 651 | { |
652 | return id[ATA_ID_SECTOR_SIZE] & 0xf; | 652 | return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf); |
653 | } | 653 | } |
654 | 654 | ||
655 | static inline int ata_id_has_lba48(const u16 *id) | 655 | static inline int ata_id_has_lba48(const u16 *id) |
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h index 57b1846a3c87..3e09b345f4d6 100644 --- a/include/linux/atmel-mci.h +++ b/include/linux/atmel-mci.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #define ATMEL_MCI_MAX_NR_SLOTS 2 | 4 | #define ATMEL_MCI_MAX_NR_SLOTS 2 |
5 | 5 | ||
6 | #include <linux/dw_dmac.h> | ||
7 | |||
8 | /** | 6 | /** |
9 | * struct mci_slot_pdata - board-specific per-slot configuration | 7 | * struct mci_slot_pdata - board-specific per-slot configuration |
10 | * @bus_width: Number of data lines wired up the slot | 8 | * @bus_width: Number of data lines wired up the slot |
@@ -34,7 +32,7 @@ struct mci_slot_pdata { | |||
34 | * @slot: Per-slot configuration data. | 32 | * @slot: Per-slot configuration data. |
35 | */ | 33 | */ |
36 | struct mci_platform_data { | 34 | struct mci_platform_data { |
37 | struct dw_dma_slave dma_slave; | 35 | struct mci_dma_data *dma_slave; |
38 | struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; | 36 | struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; |
39 | }; | 37 | }; |
40 | 38 | ||
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 0f5f57858a23..8c4f884db6b4 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
@@ -36,18 +36,18 @@ struct backlight_device; | |||
36 | struct fb_info; | 36 | struct fb_info; |
37 | 37 | ||
38 | struct backlight_ops { | 38 | struct backlight_ops { |
39 | unsigned int options; | 39 | const unsigned int options; |
40 | 40 | ||
41 | #define BL_CORE_SUSPENDRESUME (1 << 0) | 41 | #define BL_CORE_SUSPENDRESUME (1 << 0) |
42 | 42 | ||
43 | /* Notify the backlight driver some property has changed */ | 43 | /* Notify the backlight driver some property has changed */ |
44 | int (*update_status)(struct backlight_device *); | 44 | int (* const update_status)(struct backlight_device *); |
45 | /* Return the current backlight brightness (accounting for power, | 45 | /* Return the current backlight brightness (accounting for power, |
46 | fb_blank etc.) */ | 46 | fb_blank etc.) */ |
47 | int (*get_brightness)(struct backlight_device *); | 47 | int (* const get_brightness)(struct backlight_device *); |
48 | /* Check if given framebuffer device is the one bound to this backlight; | 48 | /* Check if given framebuffer device is the one bound to this backlight; |
49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ | 49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ |
50 | int (*check_fb)(struct fb_info *); | 50 | int (* const check_fb)(struct fb_info *); |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /* This structure defines all the properties of a backlight */ | 53 | /* This structure defines all the properties of a backlight */ |
@@ -86,7 +86,7 @@ struct backlight_device { | |||
86 | registered this device has been unloaded, and if class_get_devdata() | 86 | registered this device has been unloaded, and if class_get_devdata() |
87 | points to something in the body of that driver, it is also invalid. */ | 87 | points to something in the body of that driver, it is also invalid. */ |
88 | struct mutex ops_lock; | 88 | struct mutex ops_lock; |
89 | struct backlight_ops *ops; | 89 | const struct backlight_ops *ops; |
90 | 90 | ||
91 | /* The framebuffer notifier block */ | 91 | /* The framebuffer notifier block */ |
92 | struct notifier_block fb_notif; | 92 | struct notifier_block fb_notif; |
@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | extern struct backlight_device *backlight_device_register(const char *name, | 105 | extern struct backlight_device *backlight_device_register(const char *name, |
106 | struct device *dev, void *devdata, struct backlight_ops *ops); | 106 | struct device *dev, void *devdata, const struct backlight_ops *ops); |
107 | extern void backlight_device_unregister(struct backlight_device *bd); | 107 | extern void backlight_device_unregister(struct backlight_device *bd); |
108 | extern void backlight_force_update(struct backlight_device *bd, | 108 | extern void backlight_force_update(struct backlight_device *bd, |
109 | enum backlight_update_reason reason); | 109 | enum backlight_update_reason reason); |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index aece486ac734..89c6249fc561 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -68,6 +68,14 @@ struct linux_binprm{ | |||
68 | 68 | ||
69 | #define BINPRM_MAX_RECURSION 4 | 69 | #define BINPRM_MAX_RECURSION 4 |
70 | 70 | ||
71 | /* Function parameter for binfmt->coredump */ | ||
72 | struct coredump_params { | ||
73 | long signr; | ||
74 | struct pt_regs *regs; | ||
75 | struct file *file; | ||
76 | unsigned long limit; | ||
77 | }; | ||
78 | |||
71 | /* | 79 | /* |
72 | * This structure defines the functions that are used to load the binary formats that | 80 | * This structure defines the functions that are used to load the binary formats that |
73 | * linux accepts. | 81 | * linux accepts. |
@@ -77,7 +85,7 @@ struct linux_binfmt { | |||
77 | struct module *module; | 85 | struct module *module; |
78 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); | 86 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); |
79 | int (*load_shlib)(struct file *); | 87 | int (*load_shlib)(struct file *); |
80 | int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); | 88 | int (*core_dump)(struct coredump_params *cprm); |
81 | unsigned long min_coredump; /* minimal dump size */ | 89 | unsigned long min_coredump; /* minimal dump size */ |
82 | int hasvdso; | 90 | int hasvdso; |
83 | }; | 91 | }; |
@@ -101,6 +109,7 @@ extern int prepare_binprm(struct linux_binprm *); | |||
101 | extern int __must_check remove_arg_zero(struct linux_binprm *); | 109 | extern int __must_check remove_arg_zero(struct linux_binprm *); |
102 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); | 110 | extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); |
103 | extern int flush_old_exec(struct linux_binprm * bprm); | 111 | extern int flush_old_exec(struct linux_binprm * bprm); |
112 | extern void setup_new_exec(struct linux_binprm * bprm); | ||
104 | 113 | ||
105 | extern int suid_dumpable; | 114 | extern int suid_dumpable; |
106 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | 115 | #define SUID_DUMP_DISABLE 0 /* No setuid dumping */ |
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 756d78b8c1c5..daf8c480c786 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -42,6 +42,9 @@ | |||
42 | * bitmap_empty(src, nbits) Are all bits zero in *src? | 42 | * bitmap_empty(src, nbits) Are all bits zero in *src? |
43 | * bitmap_full(src, nbits) Are all bits set in *src? | 43 | * bitmap_full(src, nbits) Are all bits set in *src? |
44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits | 44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits |
45 | * bitmap_set(dst, pos, nbits) Set specified bit area | ||
46 | * bitmap_clear(dst, pos, nbits) Clear specified bit area | ||
47 | * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area | ||
45 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n | 48 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
46 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n | 49 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
47 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) | 50 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
@@ -108,6 +111,14 @@ extern int __bitmap_subset(const unsigned long *bitmap1, | |||
108 | const unsigned long *bitmap2, int bits); | 111 | const unsigned long *bitmap2, int bits); |
109 | extern int __bitmap_weight(const unsigned long *bitmap, int bits); | 112 | extern int __bitmap_weight(const unsigned long *bitmap, int bits); |
110 | 113 | ||
114 | extern void bitmap_set(unsigned long *map, int i, int len); | ||
115 | extern void bitmap_clear(unsigned long *map, int start, int nr); | ||
116 | extern unsigned long bitmap_find_next_zero_area(unsigned long *map, | ||
117 | unsigned long size, | ||
118 | unsigned long start, | ||
119 | unsigned int nr, | ||
120 | unsigned long align_mask); | ||
121 | |||
111 | extern int bitmap_scnprintf(char *buf, unsigned int len, | 122 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
112 | const unsigned long *src, int nbits); | 123 | const unsigned long *src, int nbits); |
113 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, | 124 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 784a919aa0d0..5c8018977efa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -845,7 +845,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | |||
845 | * blk_rq_err_bytes() : bytes left till the next error boundary | 845 | * blk_rq_err_bytes() : bytes left till the next error boundary |
846 | * blk_rq_sectors() : sectors left in the entire request | 846 | * blk_rq_sectors() : sectors left in the entire request |
847 | * blk_rq_cur_sectors() : sectors left in the current segment | 847 | * blk_rq_cur_sectors() : sectors left in the current segment |
848 | * blk_rq_err_sectors() : sectors left till the next error boundary | ||
849 | */ | 848 | */ |
850 | static inline sector_t blk_rq_pos(const struct request *rq) | 849 | static inline sector_t blk_rq_pos(const struct request *rq) |
851 | { | 850 | { |
@@ -874,11 +873,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |||
874 | return blk_rq_cur_bytes(rq) >> 9; | 873 | return blk_rq_cur_bytes(rq) >> 9; |
875 | } | 874 | } |
876 | 875 | ||
877 | static inline unsigned int blk_rq_err_sectors(const struct request *rq) | ||
878 | { | ||
879 | return blk_rq_err_bytes(rq) >> 9; | ||
880 | } | ||
881 | |||
882 | /* | 876 | /* |
883 | * Request issue related functions. | 877 | * Request issue related functions. |
884 | */ | 878 | */ |
@@ -944,6 +938,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); | |||
944 | extern void blk_set_default_limits(struct queue_limits *lim); | 938 | extern void blk_set_default_limits(struct queue_limits *lim); |
945 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | 939 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
946 | sector_t offset); | 940 | sector_t offset); |
941 | extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, | ||
942 | sector_t offset); | ||
947 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | 943 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
948 | sector_t offset); | 944 | sector_t offset); |
949 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); | 945 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
@@ -1116,11 +1112,18 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
1116 | return q->limits.alignment_offset; | 1112 | return q->limits.alignment_offset; |
1117 | } | 1113 | } |
1118 | 1114 | ||
1115 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | ||
1116 | { | ||
1117 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | ||
1118 | |||
1119 | offset &= granularity - 1; | ||
1120 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | ||
1121 | } | ||
1122 | |||
1119 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1123 | static inline int queue_sector_alignment_offset(struct request_queue *q, |
1120 | sector_t sector) | 1124 | sector_t sector) |
1121 | { | 1125 | { |
1122 | return ((sector << 9) - q->limits.alignment_offset) | 1126 | return queue_limit_alignment_offset(&q->limits, sector << 9); |
1123 | & (q->limits.io_min - 1); | ||
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1129 | static inline int bdev_alignment_offset(struct block_device *bdev) |
@@ -1147,8 +1150,11 @@ static inline int queue_discard_alignment(struct request_queue *q) | |||
1147 | static inline int queue_sector_discard_alignment(struct request_queue *q, | 1150 | static inline int queue_sector_discard_alignment(struct request_queue *q, |
1148 | sector_t sector) | 1151 | sector_t sector) |
1149 | { | 1152 | { |
1150 | return ((sector << 9) - q->limits.discard_alignment) | 1153 | struct queue_limits *lim = &q->limits; |
1151 | & (q->limits.discard_granularity - 1); | 1154 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
1155 | |||
1156 | return (lim->discard_granularity + lim->discard_alignment - alignment) | ||
1157 | & (lim->discard_granularity - 1); | ||
1152 | } | 1158 | } |
1153 | 1159 | ||
1154 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) | 1160 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 2b31b91f5871..7f437ca1ed44 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h | |||
@@ -1,3 +1,14 @@ | |||
1 | #define PHY_ID_BCM50610 0x0143bd60 | ||
2 | #define PHY_ID_BCM50610M 0x0143bd70 | ||
3 | #define PHY_ID_BCMAC131 0x0143bc70 | ||
4 | #define PHY_ID_BCM57780 0x03625d90 | ||
5 | |||
6 | #define PHY_BCM_OUI_MASK 0xfffffc00 | ||
7 | #define PHY_BCM_OUI_1 0x00206000 | ||
8 | #define PHY_BCM_OUI_2 0x0143bc00 | ||
9 | #define PHY_BCM_OUI_3 0x03625c00 | ||
10 | |||
11 | |||
1 | #define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 | 12 | #define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 |
2 | #define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 | 13 | #define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 |
3 | #define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 | 14 | #define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 1ed2a5cc03f5..c8c660a79f90 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -38,6 +38,7 @@ struct can_priv { | |||
38 | 38 | ||
39 | enum can_state state; | 39 | enum can_state state; |
40 | u32 ctrlmode; | 40 | u32 ctrlmode; |
41 | u32 ctrlmode_supported; | ||
41 | 42 | ||
42 | int restart_ms; | 43 | int restart_ms; |
43 | struct timer_list restart_timer; | 44 | struct timer_list restart_timer; |
@@ -51,6 +52,30 @@ struct can_priv { | |||
51 | struct sk_buff **echo_skb; | 52 | struct sk_buff **echo_skb; |
52 | }; | 53 | }; |
53 | 54 | ||
55 | /* | ||
56 | * get_can_dlc(value) - helper macro to cast a given data length code (dlc) | ||
57 | * to __u8 and ensure the dlc value to be max. 8 bytes. | ||
58 | * | ||
59 | * To be used in the CAN netdriver receive path to ensure conformance with | ||
60 | * ISO 11898-1 Chapter 8.4.2.3 (DLC field) | ||
61 | */ | ||
62 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) | ||
63 | |||
64 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ | ||
65 | static inline int can_dropped_invalid_skb(struct net_device *dev, | ||
66 | struct sk_buff *skb) | ||
67 | { | ||
68 | const struct can_frame *cf = (struct can_frame *)skb->data; | ||
69 | |||
70 | if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) { | ||
71 | kfree_skb(skb); | ||
72 | dev->stats.tx_dropped++; | ||
73 | return 1; | ||
74 | } | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
54 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | 79 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); |
55 | void free_candev(struct net_device *dev); | 80 | void free_candev(struct net_device *dev); |
56 | 81 | ||
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h index 9ecbb7871c0e..c818335fbb13 100644 --- a/include/linux/can/netlink.h +++ b/include/linux/can/netlink.h | |||
@@ -80,6 +80,7 @@ struct can_ctrlmode { | |||
80 | #define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ | 80 | #define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ |
81 | #define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ | 81 | #define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ |
82 | #define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ | 82 | #define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ |
83 | #define CAN_CTRLMODE_ONE_SHOT 0x8 /* One-Shot mode */ | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * CAN device statistics | 86 | * CAN device statistics |
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h index cb57c30081a8..eb130b4d8e72 100644 --- a/include/linux/cciss_ioctl.h +++ b/include/linux/cciss_ioctl.h | |||
@@ -39,7 +39,7 @@ typedef __u32 DriverVer_type; | |||
39 | #ifndef CCISS_CMD_H | 39 | #ifndef CCISS_CMD_H |
40 | // This defines are duplicated in cciss_cmd.h in the driver directory | 40 | // This defines are duplicated in cciss_cmd.h in the driver directory |
41 | 41 | ||
42 | //general boundary defintions | 42 | //general boundary definitions |
43 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations | 43 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations |
44 | 44 | ||
45 | //Command Status value | 45 | //Command Status value |
diff --git a/include/linux/chio.h b/include/linux/chio.h index 519248d8b2b6..d9bac7f97282 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h | |||
@@ -21,7 +21,7 @@ | |||
21 | * query vendor-specific element types | 21 | * query vendor-specific element types |
22 | * | 22 | * |
23 | * accessing elements works by specifing type and unit of the element. | 23 | * accessing elements works by specifing type and unit of the element. |
24 | * for eample, storage elements are addressed with type = CHET_ST and | 24 | * for example, storage elements are addressed with type = CHET_ST and |
25 | * unit = 0 .. cp_nslots-1 | 25 | * unit = 0 .. cp_nslots-1 |
26 | * | 26 | * |
27 | */ | 27 | */ |
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 3a1dbba4d3ae..0cf725bdd2a1 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
@@ -77,10 +77,10 @@ enum clock_event_nofitiers { | |||
77 | struct clock_event_device { | 77 | struct clock_event_device { |
78 | const char *name; | 78 | const char *name; |
79 | unsigned int features; | 79 | unsigned int features; |
80 | unsigned long max_delta_ns; | 80 | u64 max_delta_ns; |
81 | unsigned long min_delta_ns; | 81 | u64 min_delta_ns; |
82 | unsigned long mult; | 82 | u32 mult; |
83 | int shift; | 83 | u32 shift; |
84 | int rating; | 84 | int rating; |
85 | int irq; | 85 | int irq; |
86 | const struct cpumask *cpumask; | 86 | const struct cpumask *cpumask; |
@@ -116,8 +116,8 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /* Clock event layer functions */ | 118 | /* Clock event layer functions */ |
119 | extern unsigned long clockevent_delta2ns(unsigned long latch, | 119 | extern u64 clockevent_delta2ns(unsigned long latch, |
120 | struct clock_event_device *evt); | 120 | struct clock_event_device *evt); |
121 | extern void clockevents_register_device(struct clock_event_device *dev); | 121 | extern void clockevents_register_device(struct clock_event_device *dev); |
122 | 122 | ||
123 | extern void clockevents_exchange_device(struct clock_event_device *old, | 123 | extern void clockevents_exchange_device(struct clock_event_device *old, |
@@ -130,6 +130,13 @@ extern int clockevents_program_event(struct clock_event_device *dev, | |||
130 | 130 | ||
131 | extern void clockevents_handle_noop(struct clock_event_device *dev); | 131 | extern void clockevents_handle_noop(struct clock_event_device *dev); |
132 | 132 | ||
133 | static inline void | ||
134 | clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) | ||
135 | { | ||
136 | return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, | ||
137 | freq, minsec); | ||
138 | } | ||
139 | |||
133 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 140 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
134 | extern void clockevents_notify(unsigned long reason, void *arg); | 141 | extern void clockevents_notify(unsigned long reason, void *arg); |
135 | #else | 142 | #else |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 83d2fbd81b93..8a4a130cc196 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -151,6 +151,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
151 | * subtraction of non 64 bit counters | 151 | * subtraction of non 64 bit counters |
152 | * @mult: cycle to nanosecond multiplier | 152 | * @mult: cycle to nanosecond multiplier |
153 | * @shift: cycle to nanosecond divisor (power of two) | 153 | * @shift: cycle to nanosecond divisor (power of two) |
154 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | ||
154 | * @flags: flags describing special properties | 155 | * @flags: flags describing special properties |
155 | * @vread: vsyscall based read | 156 | * @vread: vsyscall based read |
156 | * @resume: resume function for the clocksource, if necessary | 157 | * @resume: resume function for the clocksource, if necessary |
@@ -168,6 +169,7 @@ struct clocksource { | |||
168 | cycle_t mask; | 169 | cycle_t mask; |
169 | u32 mult; | 170 | u32 mult; |
170 | u32 shift; | 171 | u32 shift; |
172 | u64 max_idle_ns; | ||
171 | unsigned long flags; | 173 | unsigned long flags; |
172 | cycle_t (*vread)(void); | 174 | cycle_t (*vread)(void); |
173 | void (*resume)(void); | 175 | void (*resume)(void); |
@@ -279,11 +281,23 @@ extern void clocksource_resume(void); | |||
279 | extern struct clocksource * __init __weak clocksource_default_clock(void); | 281 | extern struct clocksource * __init __weak clocksource_default_clock(void); |
280 | extern void clocksource_mark_unstable(struct clocksource *cs); | 282 | extern void clocksource_mark_unstable(struct clocksource *cs); |
281 | 283 | ||
284 | extern void | ||
285 | clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); | ||
286 | |||
287 | static inline void | ||
288 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | ||
289 | { | ||
290 | return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | ||
291 | NSEC_PER_SEC, minsec); | ||
292 | } | ||
293 | |||
282 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 294 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
283 | extern void update_vsyscall(struct timespec *ts, struct clocksource *c); | 295 | extern void |
296 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); | ||
284 | extern void update_vsyscall_tz(void); | 297 | extern void update_vsyscall_tz(void); |
285 | #else | 298 | #else |
286 | static inline void update_vsyscall(struct timespec *ts, struct clocksource *c) | 299 | static inline void |
300 | update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) | ||
287 | { | 301 | { |
288 | } | 302 | } |
289 | 303 | ||
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 5be3dab4a695..188fcae10a99 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -15,6 +15,7 @@ | |||
15 | # define __acquire(x) __context__(x,1) | 15 | # define __acquire(x) __context__(x,1) |
16 | # define __release(x) __context__(x,-1) | 16 | # define __release(x) __context__(x,-1) |
17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) | 17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
18 | # define __percpu __attribute__((noderef, address_space(3))) | ||
18 | extern void __chk_user_ptr(const volatile void __user *); | 19 | extern void __chk_user_ptr(const volatile void __user *); |
19 | extern void __chk_io_ptr(const volatile void __iomem *); | 20 | extern void __chk_io_ptr(const volatile void __iomem *); |
20 | #else | 21 | #else |
@@ -32,6 +33,7 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
32 | # define __acquire(x) (void)0 | 33 | # define __acquire(x) (void)0 |
33 | # define __release(x) (void)0 | 34 | # define __release(x) (void)0 |
34 | # define __cond_lock(x,c) (c) | 35 | # define __cond_lock(x,c) (c) |
36 | # define __percpu | ||
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | #ifdef __KERNEL__ | 39 | #ifdef __KERNEL__ |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 72ba63eb83c5..3a779ffba60b 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -24,9 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | 26 | ||
27 | #define CN_IDX_CONNECTOR 0xffffffff | ||
28 | #define CN_VAL_CONNECTOR 0xffffffff | ||
29 | |||
30 | /* | 27 | /* |
31 | * Process Events connector unique ids -- used for message routing | 28 | * Process Events connector unique ids -- used for message routing |
32 | */ | 29 | */ |
@@ -75,30 +72,6 @@ struct cn_msg { | |||
75 | __u8 data[0]; | 72 | __u8 data[0]; |
76 | }; | 73 | }; |
77 | 74 | ||
78 | /* | ||
79 | * Notify structure - requests notification about | ||
80 | * registering/unregistering idx/val in range [first, first+range]. | ||
81 | */ | ||
82 | struct cn_notify_req { | ||
83 | __u32 first; | ||
84 | __u32 range; | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * Main notification control message | ||
89 | * *_notify_num - number of appropriate cn_notify_req structures after | ||
90 | * this struct. | ||
91 | * group - notification receiver's idx. | ||
92 | * len - total length of the attached data. | ||
93 | */ | ||
94 | struct cn_ctl_msg { | ||
95 | __u32 idx_notify_num; | ||
96 | __u32 val_notify_num; | ||
97 | __u32 group; | ||
98 | __u32 len; | ||
99 | __u8 data[0]; | ||
100 | }; | ||
101 | |||
102 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
103 | 76 | ||
104 | #include <asm/atomic.h> | 77 | #include <asm/atomic.h> |
@@ -151,11 +124,6 @@ struct cn_callback_entry { | |||
151 | u32 seq, group; | 124 | u32 seq, group; |
152 | }; | 125 | }; |
153 | 126 | ||
154 | struct cn_ctl_entry { | ||
155 | struct list_head notify_entry; | ||
156 | struct cn_ctl_msg *msg; | ||
157 | }; | ||
158 | |||
159 | struct cn_dev { | 127 | struct cn_dev { |
160 | struct cb_id id; | 128 | struct cb_id id; |
161 | 129 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 47536197ffdd..e287863ac053 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -43,6 +43,8 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | |||
43 | 43 | ||
44 | #ifdef CONFIG_HOTPLUG_CPU | 44 | #ifdef CONFIG_HOTPLUG_CPU |
45 | extern void unregister_cpu(struct cpu *cpu); | 45 | extern void unregister_cpu(struct cpu *cpu); |
46 | extern ssize_t arch_cpu_probe(const char *, size_t); | ||
47 | extern ssize_t arch_cpu_release(const char *, size_t); | ||
46 | #endif | 48 | #endif |
47 | struct notifier_block; | 49 | struct notifier_block; |
48 | 50 | ||
@@ -115,6 +117,19 @@ extern void put_online_cpus(void); | |||
115 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) | 117 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) |
116 | int cpu_down(unsigned int cpu); | 118 | int cpu_down(unsigned int cpu); |
117 | 119 | ||
120 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
121 | extern void cpu_hotplug_driver_lock(void); | ||
122 | extern void cpu_hotplug_driver_unlock(void); | ||
123 | #else | ||
124 | static inline void cpu_hotplug_driver_lock(void) | ||
125 | { | ||
126 | } | ||
127 | |||
128 | static inline void cpu_hotplug_driver_unlock(void) | ||
129 | { | ||
130 | } | ||
131 | #endif | ||
132 | |||
118 | #else /* CONFIG_HOTPLUG_CPU */ | 133 | #else /* CONFIG_HOTPLUG_CPU */ |
119 | 134 | ||
120 | #define get_online_cpus() do { } while (0) | 135 | #define get_online_cpus() do { } while (0) |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 79a2340d83cd..4de02b10007f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -232,6 +232,7 @@ struct cpufreq_driver { | |||
232 | /* optional */ | 232 | /* optional */ |
233 | unsigned int (*getavg) (struct cpufreq_policy *policy, | 233 | unsigned int (*getavg) (struct cpufreq_policy *policy, |
234 | unsigned int cpu); | 234 | unsigned int cpu); |
235 | int (*bios_limit) (int cpu, unsigned int *limit); | ||
235 | 236 | ||
236 | int (*exit) (struct cpufreq_policy *policy); | 237 | int (*exit) (struct cpufreq_policy *policy); |
237 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 238 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 789cf5f920ce..d77b54733c5b 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -84,6 +84,7 @@ extern const struct cpumask *const cpu_active_mask; | |||
84 | #define num_online_cpus() cpumask_weight(cpu_online_mask) | 84 | #define num_online_cpus() cpumask_weight(cpu_online_mask) |
85 | #define num_possible_cpus() cpumask_weight(cpu_possible_mask) | 85 | #define num_possible_cpus() cpumask_weight(cpu_possible_mask) |
86 | #define num_present_cpus() cpumask_weight(cpu_present_mask) | 86 | #define num_present_cpus() cpumask_weight(cpu_present_mask) |
87 | #define num_active_cpus() cpumask_weight(cpu_active_mask) | ||
87 | #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) | 88 | #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) |
88 | #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) | 89 | #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) |
89 | #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) | 90 | #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) |
@@ -92,6 +93,7 @@ extern const struct cpumask *const cpu_active_mask; | |||
92 | #define num_online_cpus() 1 | 93 | #define num_online_cpus() 1 |
93 | #define num_possible_cpus() 1 | 94 | #define num_possible_cpus() 1 |
94 | #define num_present_cpus() 1 | 95 | #define num_present_cpus() 1 |
96 | #define num_active_cpus() 1 | ||
95 | #define cpu_online(cpu) ((cpu) == 0) | 97 | #define cpu_online(cpu) ((cpu) == 0) |
96 | #define cpu_possible(cpu) ((cpu) == 0) | 98 | #define cpu_possible(cpu) ((cpu) == 0) |
97 | #define cpu_present(cpu) ((cpu) == 0) | 99 | #define cpu_present(cpu) ((cpu) == 0) |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index fd929889e8dc..24d2e30f1b46 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -250,29 +250,6 @@ struct cipher_alg { | |||
250 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 250 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
251 | }; | 251 | }; |
252 | 252 | ||
253 | struct digest_alg { | ||
254 | unsigned int dia_digestsize; | ||
255 | void (*dia_init)(struct crypto_tfm *tfm); | ||
256 | void (*dia_update)(struct crypto_tfm *tfm, const u8 *data, | ||
257 | unsigned int len); | ||
258 | void (*dia_final)(struct crypto_tfm *tfm, u8 *out); | ||
259 | int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key, | ||
260 | unsigned int keylen); | ||
261 | }; | ||
262 | |||
263 | struct hash_alg { | ||
264 | int (*init)(struct hash_desc *desc); | ||
265 | int (*update)(struct hash_desc *desc, struct scatterlist *sg, | ||
266 | unsigned int nbytes); | ||
267 | int (*final)(struct hash_desc *desc, u8 *out); | ||
268 | int (*digest)(struct hash_desc *desc, struct scatterlist *sg, | ||
269 | unsigned int nbytes, u8 *out); | ||
270 | int (*setkey)(struct crypto_hash *tfm, const u8 *key, | ||
271 | unsigned int keylen); | ||
272 | |||
273 | unsigned int digestsize; | ||
274 | }; | ||
275 | |||
276 | struct compress_alg { | 253 | struct compress_alg { |
277 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, | 254 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, |
278 | unsigned int slen, u8 *dst, unsigned int *dlen); | 255 | unsigned int slen, u8 *dst, unsigned int *dlen); |
@@ -293,8 +270,6 @@ struct rng_alg { | |||
293 | #define cra_aead cra_u.aead | 270 | #define cra_aead cra_u.aead |
294 | #define cra_blkcipher cra_u.blkcipher | 271 | #define cra_blkcipher cra_u.blkcipher |
295 | #define cra_cipher cra_u.cipher | 272 | #define cra_cipher cra_u.cipher |
296 | #define cra_digest cra_u.digest | ||
297 | #define cra_hash cra_u.hash | ||
298 | #define cra_compress cra_u.compress | 273 | #define cra_compress cra_u.compress |
299 | #define cra_rng cra_u.rng | 274 | #define cra_rng cra_u.rng |
300 | 275 | ||
@@ -320,8 +295,6 @@ struct crypto_alg { | |||
320 | struct aead_alg aead; | 295 | struct aead_alg aead; |
321 | struct blkcipher_alg blkcipher; | 296 | struct blkcipher_alg blkcipher; |
322 | struct cipher_alg cipher; | 297 | struct cipher_alg cipher; |
323 | struct digest_alg digest; | ||
324 | struct hash_alg hash; | ||
325 | struct compress_alg compress; | 298 | struct compress_alg compress; |
326 | struct rng_alg rng; | 299 | struct rng_alg rng; |
327 | } cra_u; | 300 | } cra_u; |
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h new file mode 100644 index 000000000000..d5a1d4810b80 --- /dev/null +++ b/include/linux/cs5535.h | |||
@@ -0,0 +1,172 @@ | |||
1 | /* | ||
2 | * AMD CS5535/CS5536 definitions | ||
3 | * Copyright (C) 2006 Advanced Micro Devices, Inc. | ||
4 | * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of version 2 of the GNU General Public License | ||
8 | * as published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef _CS5535_H | ||
12 | #define _CS5535_H | ||
13 | |||
14 | /* MSRs */ | ||
15 | #define MSR_GLIU_P2D_RO0 0x10000029 | ||
16 | |||
17 | #define MSR_LX_GLD_MSR_CONFIG 0x48002001 | ||
18 | #define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data | ||
19 | * sheet has the wrong value */ | ||
20 | #define MSR_GLCP_SYS_RSTPLL 0x4C000014 | ||
21 | #define MSR_GLCP_DOTPLL 0x4C000015 | ||
22 | |||
23 | #define MSR_LBAR_SMB 0x5140000B | ||
24 | #define MSR_LBAR_GPIO 0x5140000C | ||
25 | #define MSR_LBAR_MFGPT 0x5140000D | ||
26 | #define MSR_LBAR_ACPI 0x5140000E | ||
27 | #define MSR_LBAR_PMS 0x5140000F | ||
28 | |||
29 | #define MSR_DIVIL_SOFT_RESET 0x51400017 | ||
30 | |||
31 | #define MSR_PIC_YSEL_LOW 0x51400020 | ||
32 | #define MSR_PIC_YSEL_HIGH 0x51400021 | ||
33 | #define MSR_PIC_ZSEL_LOW 0x51400022 | ||
34 | #define MSR_PIC_ZSEL_HIGH 0x51400023 | ||
35 | #define MSR_PIC_IRQM_LPC 0x51400025 | ||
36 | |||
37 | #define MSR_MFGPT_IRQ 0x51400028 | ||
38 | #define MSR_MFGPT_NR 0x51400029 | ||
39 | #define MSR_MFGPT_SETUP 0x5140002B | ||
40 | |||
41 | #define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */ | ||
42 | |||
43 | #define MSR_GX_GLD_MSR_CONFIG 0xC0002001 | ||
44 | #define MSR_GX_MSR_PADSEL 0xC0002011 | ||
45 | |||
46 | /* resource sizes */ | ||
47 | #define LBAR_GPIO_SIZE 0xFF | ||
48 | #define LBAR_MFGPT_SIZE 0x40 | ||
49 | #define LBAR_ACPI_SIZE 0x40 | ||
50 | #define LBAR_PMS_SIZE 0x80 | ||
51 | |||
52 | /* VSA2 magic values */ | ||
53 | #define VSA_VRC_INDEX 0xAC1C | ||
54 | #define VSA_VRC_DATA 0xAC1E | ||
55 | #define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */ | ||
56 | #define VSA_VR_SIGNATURE 0x0003 | ||
57 | #define VSA_VR_MEM_SIZE 0x0200 | ||
58 | #define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */ | ||
59 | #define GSW_VSA_SIG 0x534d /* General Software signature */ | ||
60 | |||
61 | #include <linux/io.h> | ||
62 | |||
63 | static inline int cs5535_has_vsa2(void) | ||
64 | { | ||
65 | static int has_vsa2 = -1; | ||
66 | |||
67 | if (has_vsa2 == -1) { | ||
68 | uint16_t val; | ||
69 | |||
70 | /* | ||
71 | * The VSA has virtual registers that we can query for a | ||
72 | * signature. | ||
73 | */ | ||
74 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); | ||
75 | outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX); | ||
76 | |||
77 | val = inw(VSA_VRC_DATA); | ||
78 | has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG); | ||
79 | } | ||
80 | |||
81 | return has_vsa2; | ||
82 | } | ||
83 | |||
84 | /* GPIOs */ | ||
85 | #define GPIO_OUTPUT_VAL 0x00 | ||
86 | #define GPIO_OUTPUT_ENABLE 0x04 | ||
87 | #define GPIO_OUTPUT_OPEN_DRAIN 0x08 | ||
88 | #define GPIO_OUTPUT_INVERT 0x0C | ||
89 | #define GPIO_OUTPUT_AUX1 0x10 | ||
90 | #define GPIO_OUTPUT_AUX2 0x14 | ||
91 | #define GPIO_PULL_UP 0x18 | ||
92 | #define GPIO_PULL_DOWN 0x1C | ||
93 | #define GPIO_INPUT_ENABLE 0x20 | ||
94 | #define GPIO_INPUT_INVERT 0x24 | ||
95 | #define GPIO_INPUT_FILTER 0x28 | ||
96 | #define GPIO_INPUT_EVENT_COUNT 0x2C | ||
97 | #define GPIO_READ_BACK 0x30 | ||
98 | #define GPIO_INPUT_AUX1 0x34 | ||
99 | #define GPIO_EVENTS_ENABLE 0x38 | ||
100 | #define GPIO_LOCK_ENABLE 0x3C | ||
101 | #define GPIO_POSITIVE_EDGE_EN 0x40 | ||
102 | #define GPIO_NEGATIVE_EDGE_EN 0x44 | ||
103 | #define GPIO_POSITIVE_EDGE_STS 0x48 | ||
104 | #define GPIO_NEGATIVE_EDGE_STS 0x4C | ||
105 | |||
106 | #define GPIO_MAP_X 0xE0 | ||
107 | #define GPIO_MAP_Y 0xE4 | ||
108 | #define GPIO_MAP_Z 0xE8 | ||
109 | #define GPIO_MAP_W 0xEC | ||
110 | |||
111 | void cs5535_gpio_set(unsigned offset, unsigned int reg); | ||
112 | void cs5535_gpio_clear(unsigned offset, unsigned int reg); | ||
113 | int cs5535_gpio_isset(unsigned offset, unsigned int reg); | ||
114 | |||
115 | /* MFGPTs */ | ||
116 | |||
117 | #define MFGPT_MAX_TIMERS 8 | ||
118 | #define MFGPT_TIMER_ANY (-1) | ||
119 | |||
120 | #define MFGPT_DOMAIN_WORKING 1 | ||
121 | #define MFGPT_DOMAIN_STANDBY 2 | ||
122 | #define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY) | ||
123 | |||
124 | #define MFGPT_CMP1 0 | ||
125 | #define MFGPT_CMP2 1 | ||
126 | |||
127 | #define MFGPT_EVENT_IRQ 0 | ||
128 | #define MFGPT_EVENT_NMI 1 | ||
129 | #define MFGPT_EVENT_RESET 3 | ||
130 | |||
131 | #define MFGPT_REG_CMP1 0 | ||
132 | #define MFGPT_REG_CMP2 2 | ||
133 | #define MFGPT_REG_COUNTER 4 | ||
134 | #define MFGPT_REG_SETUP 6 | ||
135 | |||
136 | #define MFGPT_SETUP_CNTEN (1 << 15) | ||
137 | #define MFGPT_SETUP_CMP2 (1 << 14) | ||
138 | #define MFGPT_SETUP_CMP1 (1 << 13) | ||
139 | #define MFGPT_SETUP_SETUP (1 << 12) | ||
140 | #define MFGPT_SETUP_STOPEN (1 << 11) | ||
141 | #define MFGPT_SETUP_EXTEN (1 << 10) | ||
142 | #define MFGPT_SETUP_REVEN (1 << 5) | ||
143 | #define MFGPT_SETUP_CLKSEL (1 << 4) | ||
144 | |||
145 | struct cs5535_mfgpt_timer; | ||
146 | |||
147 | extern uint16_t cs5535_mfgpt_read(struct cs5535_mfgpt_timer *timer, | ||
148 | uint16_t reg); | ||
149 | extern void cs5535_mfgpt_write(struct cs5535_mfgpt_timer *timer, uint16_t reg, | ||
150 | uint16_t value); | ||
151 | |||
152 | extern int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp, | ||
153 | int event, int enable); | ||
154 | extern int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp, | ||
155 | int *irq, int enable); | ||
156 | extern struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer, | ||
157 | int domain); | ||
158 | extern void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer); | ||
159 | |||
160 | static inline int cs5535_mfgpt_setup_irq(struct cs5535_mfgpt_timer *timer, | ||
161 | int cmp, int *irq) | ||
162 | { | ||
163 | return cs5535_mfgpt_set_irq(timer, cmp, irq, 1); | ||
164 | } | ||
165 | |||
166 | static inline int cs5535_mfgpt_release_irq(struct cs5535_mfgpt_timer *timer, | ||
167 | int cmp, int *irq) | ||
168 | { | ||
169 | return cs5535_mfgpt_set_irq(timer, cmp, irq, 0); | ||
170 | } | ||
171 | |||
172 | #endif | ||
diff --git a/include/linux/ctype.h b/include/linux/ctype.h index afa36392297a..a3d6ee0044f9 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #define _X 0x40 /* hex digit */ | 15 | #define _X 0x40 /* hex digit */ |
16 | #define _SP 0x80 /* hard space (0x20) */ | 16 | #define _SP 0x80 /* hard space (0x20) */ |
17 | 17 | ||
18 | extern unsigned char _ctype[]; | 18 | extern const unsigned char _ctype[]; |
19 | 19 | ||
20 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) | 20 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) |
21 | 21 | ||
@@ -27,6 +27,7 @@ extern unsigned char _ctype[]; | |||
27 | #define islower(c) ((__ismask(c)&(_L)) != 0) | 27 | #define islower(c) ((__ismask(c)&(_L)) != 0) |
28 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) | 28 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) |
29 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) | 29 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) |
30 | /* Note: isspace() must return false for %NUL-terminator */ | ||
30 | #define isspace(c) ((__ismask(c)&(_S)) != 0) | 31 | #define isspace(c) ((__ismask(c)&(_S)) != 0) |
31 | #define isupper(c) ((__ismask(c)&(_U)) != 0) | 32 | #define isupper(c) ((__ismask(c)&(_U)) != 0) |
32 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) | 33 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) |
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index 12ff8c3f1d05..5032b9a31ae7 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h | |||
@@ -25,7 +25,7 @@ static void *malloc(int size) | |||
25 | void *p; | 25 | void *p; |
26 | 26 | ||
27 | if (size < 0) | 27 | if (size < 0) |
28 | error("Malloc error"); | 28 | return NULL; |
29 | if (!malloc_ptr) | 29 | if (!malloc_ptr) |
30 | malloc_ptr = free_mem_ptr; | 30 | malloc_ptr = free_mem_ptr; |
31 | 31 | ||
@@ -35,7 +35,7 @@ static void *malloc(int size) | |||
35 | malloc_ptr += size; | 35 | malloc_ptr += size; |
36 | 36 | ||
37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) |
38 | error("Out of memory"); | 38 | return NULL; |
39 | 39 | ||
40 | malloc_count++; | 40 | malloc_count++; |
41 | return p; | 41 | return p; |
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h new file mode 100644 index 000000000000..987229752519 --- /dev/null +++ b/include/linux/decompress/unlzo.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef DECOMPRESS_UNLZO_H | ||
2 | #define DECOMPRESS_UNLZO_H | ||
3 | |||
4 | int unlzo(unsigned char *inbuf, int len, | ||
5 | int(*fill)(void*, unsigned int), | ||
6 | int(*flush)(void*, unsigned int), | ||
7 | unsigned char *output, | ||
8 | int *pos, | ||
9 | void(*error)(char *x)); | ||
10 | #endif | ||
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index df7607e6dce8..d4c9c0b88adc 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -235,7 +235,7 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist); | |||
235 | const char *dm_device_name(struct mapped_device *md); | 235 | const char *dm_device_name(struct mapped_device *md); |
236 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | 236 | int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); |
237 | struct gendisk *dm_disk(struct mapped_device *md); | 237 | struct gendisk *dm_disk(struct mapped_device *md); |
238 | int dm_suspended(struct mapped_device *md); | 238 | int dm_suspended(struct dm_target *ti); |
239 | int dm_noflush_suspending(struct dm_target *ti); | 239 | int dm_noflush_suspending(struct dm_target *ti); |
240 | union map_info *dm_get_mapinfo(struct bio *bio); | 240 | union map_info *dm_get_mapinfo(struct bio *bio); |
241 | union map_info *dm_get_rq_mapinfo(struct request *rq); | 241 | union map_info *dm_get_rq_mapinfo(struct request *rq); |
@@ -276,7 +276,7 @@ void dm_table_unplug_all(struct dm_table *t); | |||
276 | /* | 276 | /* |
277 | * Table reference counting. | 277 | * Table reference counting. |
278 | */ | 278 | */ |
279 | struct dm_table *dm_get_table(struct mapped_device *md); | 279 | struct dm_table *dm_get_live_table(struct mapped_device *md); |
280 | void dm_table_get(struct dm_table *t); | 280 | void dm_table_get(struct dm_table *t); |
281 | void dm_table_put(struct dm_table *t); | 281 | void dm_table_put(struct dm_table *t); |
282 | 282 | ||
@@ -295,8 +295,10 @@ void dm_table_event(struct dm_table *t); | |||
295 | 295 | ||
296 | /* | 296 | /* |
297 | * The device must be suspended before calling this method. | 297 | * The device must be suspended before calling this method. |
298 | * Returns the previous table, which the caller must destroy. | ||
298 | */ | 299 | */ |
299 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); | 300 | struct dm_table *dm_swap_table(struct mapped_device *md, |
301 | struct dm_table *t); | ||
300 | 302 | ||
301 | /* | 303 | /* |
302 | * A wrapper around vmalloc. | 304 | * A wrapper around vmalloc. |
diff --git a/include/linux/device.h b/include/linux/device.h index 2ea3e4921812..a62799f2ab00 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \ | |||
166 | __ATTR(_name, _mode, _show, _store) | 166 | __ATTR(_name, _mode, _show, _store) |
167 | 167 | ||
168 | extern int __must_check driver_create_file(struct device_driver *driver, | 168 | extern int __must_check driver_create_file(struct device_driver *driver, |
169 | struct driver_attribute *attr); | 169 | const struct driver_attribute *attr); |
170 | extern void driver_remove_file(struct device_driver *driver, | 170 | extern void driver_remove_file(struct device_driver *driver, |
171 | struct driver_attribute *attr); | 171 | const struct driver_attribute *attr); |
172 | 172 | ||
173 | extern int __must_check driver_add_kobj(struct device_driver *drv, | 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, |
174 | struct kobject *kobj, | 174 | struct kobject *kobj, |
@@ -319,13 +319,13 @@ struct device_attribute { | |||
319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
320 | 320 | ||
321 | extern int __must_check device_create_file(struct device *device, | 321 | extern int __must_check device_create_file(struct device *device, |
322 | struct device_attribute *entry); | 322 | const struct device_attribute *entry); |
323 | extern void device_remove_file(struct device *dev, | 323 | extern void device_remove_file(struct device *dev, |
324 | struct device_attribute *attr); | 324 | const struct device_attribute *attr); |
325 | extern int __must_check device_create_bin_file(struct device *dev, | 325 | extern int __must_check device_create_bin_file(struct device *dev, |
326 | struct bin_attribute *attr); | 326 | const struct bin_attribute *attr); |
327 | extern void device_remove_bin_file(struct device *dev, | 327 | extern void device_remove_bin_file(struct device *dev, |
328 | struct bin_attribute *attr); | 328 | const struct bin_attribute *attr); |
329 | extern int device_schedule_callback_owner(struct device *dev, | 329 | extern int device_schedule_callback_owner(struct device *dev, |
330 | void (*func)(struct device *dev), struct module *owner); | 330 | void (*func)(struct device *dev), struct module *owner); |
331 | 331 | ||
@@ -558,7 +558,7 @@ extern void wait_for_device_probe(void); | |||
558 | #ifdef CONFIG_DEVTMPFS | 558 | #ifdef CONFIG_DEVTMPFS |
559 | extern int devtmpfs_create_node(struct device *dev); | 559 | extern int devtmpfs_create_node(struct device *dev); |
560 | extern int devtmpfs_delete_node(struct device *dev); | 560 | extern int devtmpfs_delete_node(struct device *dev); |
561 | extern int devtmpfs_mount(const char *mountpoint); | 561 | extern int devtmpfs_mount(const char *mntdir); |
562 | #else | 562 | #else |
563 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } | 563 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
564 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } | 564 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } |
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h index 5e8b11d88f6f..7084503c3405 100644 --- a/include/linux/dm-dirty-log.h +++ b/include/linux/dm-dirty-log.h | |||
@@ -21,6 +21,7 @@ struct dm_dirty_log_type; | |||
21 | 21 | ||
22 | struct dm_dirty_log { | 22 | struct dm_dirty_log { |
23 | struct dm_dirty_log_type *type; | 23 | struct dm_dirty_log_type *type; |
24 | int (*flush_callback_fn)(struct dm_target *ti); | ||
24 | void *context; | 25 | void *context; |
25 | }; | 26 | }; |
26 | 27 | ||
@@ -136,8 +137,9 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type); | |||
136 | * type->constructor/destructor() directly. | 137 | * type->constructor/destructor() directly. |
137 | */ | 138 | */ |
138 | struct dm_dirty_log *dm_dirty_log_create(const char *type_name, | 139 | struct dm_dirty_log *dm_dirty_log_create(const char *type_name, |
139 | struct dm_target *ti, | 140 | struct dm_target *ti, |
140 | unsigned argc, char **argv); | 141 | int (*flush_callback_fn)(struct dm_target *ti), |
142 | unsigned argc, char **argv); | ||
141 | void dm_dirty_log_destroy(struct dm_dirty_log *log); | 143 | void dm_dirty_log_destroy(struct dm_dirty_log *log); |
142 | 144 | ||
143 | #endif /* __KERNEL__ */ | 145 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h index 2ab84c83c31a..aa95508d2f95 100644 --- a/include/linux/dm-ioctl.h +++ b/include/linux/dm-ioctl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. | 2 | * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. |
3 | * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This file is released under the LGPL. | 5 | * This file is released under the LGPL. |
6 | */ | 6 | */ |
@@ -266,9 +266,9 @@ enum { | |||
266 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 266 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
267 | 267 | ||
268 | #define DM_VERSION_MAJOR 4 | 268 | #define DM_VERSION_MAJOR 4 |
269 | #define DM_VERSION_MINOR 15 | 269 | #define DM_VERSION_MINOR 16 |
270 | #define DM_VERSION_PATCHLEVEL 0 | 270 | #define DM_VERSION_PATCHLEVEL 0 |
271 | #define DM_VERSION_EXTRA "-ioctl (2009-04-01)" | 271 | #define DM_VERSION_EXTRA "-ioctl (2009-11-05)" |
272 | 272 | ||
273 | /* Status bits */ | 273 | /* Status bits */ |
274 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 274 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |
@@ -309,4 +309,11 @@ enum { | |||
309 | */ | 309 | */ |
310 | #define DM_NOFLUSH_FLAG (1 << 11) /* In */ | 310 | #define DM_NOFLUSH_FLAG (1 << 11) /* In */ |
311 | 311 | ||
312 | /* | ||
313 | * If set, any table information returned will relate to the inactive | ||
314 | * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG | ||
315 | * is set before using the data returned. | ||
316 | */ | ||
317 | #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ | ||
318 | |||
312 | #endif /* _LINUX_DM_IOCTL_H */ | 319 | #endif /* _LINUX_DM_IOCTL_H */ |
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h index 8a1f972c0fe9..0c3c3a2110c4 100644 --- a/include/linux/dm-log-userspace.h +++ b/include/linux/dm-log-userspace.h | |||
@@ -363,7 +363,7 @@ | |||
363 | * various request types above. The remaining 24-bits are currently | 363 | * various request types above. The remaining 24-bits are currently |
364 | * set to zero and are reserved for future use and compatibility concerns. | 364 | * set to zero and are reserved for future use and compatibility concerns. |
365 | * | 365 | * |
366 | * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the | 366 | * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the |
367 | * request type from the 'request_type' field to maintain forward compatibility. | 367 | * request type from the 'request_type' field to maintain forward compatibility. |
368 | */ | 368 | */ |
369 | #define DM_ULOG_REQUEST_MASK 0xFF | 369 | #define DM_ULOG_REQUEST_MASK 0xFF |
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h index a9e652a41373..9e2a7a401df5 100644 --- a/include/linux/dm-region-hash.h +++ b/include/linux/dm-region-hash.h | |||
@@ -78,8 +78,7 @@ void dm_rh_dec(struct dm_region_hash *rh, region_t region); | |||
78 | /* Delay bios on regions. */ | 78 | /* Delay bios on regions. */ |
79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); | 79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); |
80 | 80 | ||
81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, | 81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio); |
82 | struct bio *bio, unsigned done, int error); | ||
83 | 82 | ||
84 | /* | 83 | /* |
85 | * Region recovery control. | 84 | * Region recovery control. |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 2b9f2ac7ed60..78784982b33e 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -74,7 +74,7 @@ enum dma_transaction_type { | |||
74 | * control completion, and communicate status. | 74 | * control completion, and communicate status. |
75 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of | 75 | * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of |
76 | * this transaction | 76 | * this transaction |
77 | * @DMA_CTRL_ACK - the descriptor cannot be reused until the client | 77 | * @DMA_CTRL_ACK - if clear, the descriptor cannot be reused until the client |
78 | * acknowledges receipt, i.e. has has a chance to establish any dependency | 78 | * acknowledges receipt, i.e. has has a chance to establish any dependency |
79 | * chains | 79 | * chains |
80 | * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) | 80 | * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 5de4c9e5856d..d7cecc90ed34 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -126,7 +126,9 @@ extern int free_irte(int irq); | |||
126 | extern int irq_remapped(int irq); | 126 | extern int irq_remapped(int irq); |
127 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); | 127 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); |
128 | extern struct intel_iommu *map_ioapic_to_ir(int apic); | 128 | extern struct intel_iommu *map_ioapic_to_ir(int apic); |
129 | extern struct intel_iommu *map_hpet_to_ir(u8 id); | ||
129 | extern int set_ioapic_sid(struct irte *irte, int apic); | 130 | extern int set_ioapic_sid(struct irte *irte, int apic); |
131 | extern int set_hpet_sid(struct irte *irte, u8 id); | ||
130 | extern int set_msi_sid(struct irte *irte, struct pci_dev *dev); | 132 | extern int set_msi_sid(struct irte *irte, struct pci_dev *dev); |
131 | #else | 133 | #else |
132 | static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) | 134 | static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) |
@@ -158,10 +160,18 @@ static inline struct intel_iommu *map_ioapic_to_ir(int apic) | |||
158 | { | 160 | { |
159 | return NULL; | 161 | return NULL; |
160 | } | 162 | } |
163 | static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id) | ||
164 | { | ||
165 | return NULL; | ||
166 | } | ||
161 | static inline int set_ioapic_sid(struct irte *irte, int apic) | 167 | static inline int set_ioapic_sid(struct irte *irte, int apic) |
162 | { | 168 | { |
163 | return 0; | 169 | return 0; |
164 | } | 170 | } |
171 | static inline int set_hpet_sid(struct irte *irte, u8 id) | ||
172 | { | ||
173 | return -1; | ||
174 | } | ||
165 | static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) | 175 | static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) |
166 | { | 176 | { |
167 | return 0; | 177 | return 0; |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index e84f4733cb55..78962272338a 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | 54 | ||
55 | extern const char *drbd_buildtag(void); | 55 | extern const char *drbd_buildtag(void); |
56 | #define REL_VERSION "8.3.6" | 56 | #define REL_VERSION "8.3.7" |
57 | #define API_VERSION 88 | 57 | #define API_VERSION 88 |
58 | #define PRO_VERSION_MIN 86 | 58 | #define PRO_VERSION_MIN 86 |
59 | #define PRO_VERSION_MAX 91 | 59 | #define PRO_VERSION_MAX 91 |
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h index db5721ad50d1..a4d82f895994 100644 --- a/include/linux/drbd_nl.h +++ b/include/linux/drbd_nl.h | |||
@@ -69,6 +69,7 @@ NL_PACKET(disconnect, 6, ) | |||
69 | 69 | ||
70 | NL_PACKET(resize, 7, | 70 | NL_PACKET(resize, 7, |
71 | NL_INT64( 29, T_MAY_IGNORE, resize_size) | 71 | NL_INT64( 29, T_MAY_IGNORE, resize_size) |
72 | NL_BIT( 68, T_MAY_IGNORE, resize_force) | ||
72 | ) | 73 | ) |
73 | 74 | ||
74 | NL_PACKET(syncer_conf, 8, | 75 | NL_PACKET(syncer_conf, 8, |
diff --git a/include/linux/dst.h b/include/linux/dst.h deleted file mode 100644 index e26fed84b1aa..000000000000 --- a/include/linux/dst.h +++ /dev/null | |||
@@ -1,587 +0,0 @@ | |||
1 | /* | ||
2 | * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __DST_H | ||
17 | #define __DST_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/connector.h> | ||
21 | |||
22 | #define DST_NAMELEN 32 | ||
23 | #define DST_NAME "dst" | ||
24 | |||
25 | enum { | ||
26 | /* Remove node with given id from storage */ | ||
27 | DST_DEL_NODE = 0, | ||
28 | /* Add remote node with given id to the storage */ | ||
29 | DST_ADD_REMOTE, | ||
30 | /* Add local node with given id to the storage to be exported and used by remote peers */ | ||
31 | DST_ADD_EXPORT, | ||
32 | /* Crypto initialization command (hash/cipher used to protect the connection) */ | ||
33 | DST_CRYPTO, | ||
34 | /* Security attributes for given connection (permissions for example) */ | ||
35 | DST_SECURITY, | ||
36 | /* Register given node in the block layer subsystem */ | ||
37 | DST_START, | ||
38 | DST_CMD_MAX | ||
39 | }; | ||
40 | |||
41 | struct dst_ctl | ||
42 | { | ||
43 | /* Storage name */ | ||
44 | char name[DST_NAMELEN]; | ||
45 | /* Command flags */ | ||
46 | __u32 flags; | ||
47 | /* Command itself (see above) */ | ||
48 | __u32 cmd; | ||
49 | /* Maximum number of pages per single request in this device */ | ||
50 | __u32 max_pages; | ||
51 | /* Stale/error transaction scanning timeout in milliseconds */ | ||
52 | __u32 trans_scan_timeout; | ||
53 | /* Maximum number of retry sends before completing transaction as broken */ | ||
54 | __u32 trans_max_retries; | ||
55 | /* Storage size */ | ||
56 | __u64 size; | ||
57 | }; | ||
58 | |||
59 | /* Reply command carries completion status */ | ||
60 | struct dst_ctl_ack | ||
61 | { | ||
62 | struct cn_msg msg; | ||
63 | int error; | ||
64 | int unused[3]; | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | * Unfortunaltely socket address structure is not exported to userspace | ||
69 | * and is redefined there. | ||
70 | */ | ||
71 | #define SADDR_MAX_DATA 128 | ||
72 | |||
73 | struct saddr { | ||
74 | /* address family, AF_xxx */ | ||
75 | unsigned short sa_family; | ||
76 | /* 14 bytes of protocol address */ | ||
77 | char sa_data[SADDR_MAX_DATA]; | ||
78 | /* Number of bytes used in sa_data */ | ||
79 | unsigned short sa_data_len; | ||
80 | }; | ||
81 | |||
82 | /* Address structure */ | ||
83 | struct dst_network_ctl | ||
84 | { | ||
85 | /* Socket type: datagram, stream...*/ | ||
86 | unsigned int type; | ||
87 | /* Let me guess, is it a Jupiter diameter? */ | ||
88 | unsigned int proto; | ||
89 | /* Peer's address */ | ||
90 | struct saddr addr; | ||
91 | }; | ||
92 | |||
93 | struct dst_crypto_ctl | ||
94 | { | ||
95 | /* Cipher and hash names */ | ||
96 | char cipher_algo[DST_NAMELEN]; | ||
97 | char hash_algo[DST_NAMELEN]; | ||
98 | |||
99 | /* Key sizes. Can be zero for digest for example */ | ||
100 | unsigned int cipher_keysize, hash_keysize; | ||
101 | /* Alignment. Calculated by the DST itself. */ | ||
102 | unsigned int crypto_attached_size; | ||
103 | /* Number of threads to perform crypto operations */ | ||
104 | int thread_num; | ||
105 | }; | ||
106 | |||
107 | /* Export security attributes have this bits checked in when client connects */ | ||
108 | #define DST_PERM_READ (1<<0) | ||
109 | #define DST_PERM_WRITE (1<<1) | ||
110 | |||
111 | /* | ||
112 | * Right now it is simple model, where each remote address | ||
113 | * is assigned to set of permissions it is allowed to perform. | ||
114 | * In real world block device does not know anything but | ||
115 | * reading and writing, so it should be more than enough. | ||
116 | */ | ||
117 | struct dst_secure_user | ||
118 | { | ||
119 | unsigned int permissions; | ||
120 | struct saddr addr; | ||
121 | }; | ||
122 | |||
123 | /* | ||
124 | * Export control command: device to export and network address to accept | ||
125 | * clients to work with given device | ||
126 | */ | ||
127 | struct dst_export_ctl | ||
128 | { | ||
129 | char device[DST_NAMELEN]; | ||
130 | struct dst_network_ctl ctl; | ||
131 | }; | ||
132 | |||
133 | enum { | ||
134 | DST_CFG = 1, /* Request remote configuration */ | ||
135 | DST_IO, /* IO command */ | ||
136 | DST_IO_RESPONSE, /* IO response */ | ||
137 | DST_PING, /* Keepalive message */ | ||
138 | DST_NCMD_MAX, | ||
139 | }; | ||
140 | |||
141 | struct dst_cmd | ||
142 | { | ||
143 | /* Network command itself, see above */ | ||
144 | __u32 cmd; | ||
145 | /* | ||
146 | * Size of the attached data | ||
147 | * (in most cases, for READ command it means how many bytes were requested) | ||
148 | */ | ||
149 | __u32 size; | ||
150 | /* Crypto size: number of attached bytes with digest/hmac */ | ||
151 | __u32 csize; | ||
152 | /* Here we can carry secret data */ | ||
153 | __u32 reserved; | ||
154 | /* Read/write bits, see how they are encoded in bio structure */ | ||
155 | __u64 rw; | ||
156 | /* BIO flags */ | ||
157 | __u64 flags; | ||
158 | /* Unique command id (like transaction ID) */ | ||
159 | __u64 id; | ||
160 | /* Sector to start IO from */ | ||
161 | __u64 sector; | ||
162 | /* Hash data is placed after this header */ | ||
163 | __u8 hash[0]; | ||
164 | }; | ||
165 | |||
166 | /* | ||
167 | * Convert command to/from network byte order. | ||
168 | * We do not use hton*() functions, since there is | ||
169 | * no 64-bit implementation. | ||
170 | */ | ||
171 | static inline void dst_convert_cmd(struct dst_cmd *c) | ||
172 | { | ||
173 | c->cmd = __cpu_to_be32(c->cmd); | ||
174 | c->csize = __cpu_to_be32(c->csize); | ||
175 | c->size = __cpu_to_be32(c->size); | ||
176 | c->sector = __cpu_to_be64(c->sector); | ||
177 | c->id = __cpu_to_be64(c->id); | ||
178 | c->flags = __cpu_to_be64(c->flags); | ||
179 | c->rw = __cpu_to_be64(c->rw); | ||
180 | } | ||
181 | |||
182 | /* Transaction id */ | ||
183 | typedef __u64 dst_gen_t; | ||
184 | |||
185 | #ifdef __KERNEL__ | ||
186 | |||
187 | #include <linux/blkdev.h> | ||
188 | #include <linux/bio.h> | ||
189 | #include <linux/device.h> | ||
190 | #include <linux/mempool.h> | ||
191 | #include <linux/net.h> | ||
192 | #include <linux/poll.h> | ||
193 | #include <linux/rbtree.h> | ||
194 | |||
195 | #ifdef CONFIG_DST_DEBUG | ||
196 | #define dprintk(f, a...) printk(KERN_NOTICE f, ##a) | ||
197 | #else | ||
198 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
199 | dprintk(const char *fmt, ...) {} | ||
200 | #endif | ||
201 | |||
202 | struct dst_node; | ||
203 | |||
204 | struct dst_trans | ||
205 | { | ||
206 | /* DST node we are working with */ | ||
207 | struct dst_node *n; | ||
208 | |||
209 | /* Entry inside transaction tree */ | ||
210 | struct rb_node trans_entry; | ||
211 | |||
212 | /* Merlin kills this transaction when this memory cell equals zero */ | ||
213 | atomic_t refcnt; | ||
214 | |||
215 | /* How this transaction should be processed by crypto engine */ | ||
216 | short enc; | ||
217 | /* How many times this transaction was resent */ | ||
218 | short retries; | ||
219 | /* Completion status */ | ||
220 | int error; | ||
221 | |||
222 | /* When did we send it to the remote peer */ | ||
223 | long send_time; | ||
224 | |||
225 | /* My name is... | ||
226 | * Well, computers does not speak, they have unique id instead */ | ||
227 | dst_gen_t gen; | ||
228 | |||
229 | /* Block IO we are working with */ | ||
230 | struct bio *bio; | ||
231 | |||
232 | /* Network command for above block IO request */ | ||
233 | struct dst_cmd cmd; | ||
234 | }; | ||
235 | |||
236 | struct dst_crypto_engine | ||
237 | { | ||
238 | /* What should we do with all block requests */ | ||
239 | struct crypto_hash *hash; | ||
240 | struct crypto_ablkcipher *cipher; | ||
241 | |||
242 | /* Pool of pages used to encrypt data into before sending */ | ||
243 | int page_num; | ||
244 | struct page **pages; | ||
245 | |||
246 | /* What to do with current request */ | ||
247 | int enc; | ||
248 | /* Who we are and where do we go */ | ||
249 | struct scatterlist *src, *dst; | ||
250 | |||
251 | /* Maximum timeout waiting for encryption to be completed */ | ||
252 | long timeout; | ||
253 | /* IV is a 64-bit sequential counter */ | ||
254 | u64 iv; | ||
255 | |||
256 | /* Secret data */ | ||
257 | void *private; | ||
258 | |||
259 | /* Cached temporary data lives here */ | ||
260 | int size; | ||
261 | void *data; | ||
262 | }; | ||
263 | |||
264 | struct dst_state | ||
265 | { | ||
266 | /* The main state protection */ | ||
267 | struct mutex state_lock; | ||
268 | |||
269 | /* Polling machinery for sockets */ | ||
270 | wait_queue_t wait; | ||
271 | wait_queue_head_t *whead; | ||
272 | /* Most of events are being waited here */ | ||
273 | wait_queue_head_t thread_wait; | ||
274 | |||
275 | /* Who owns this? */ | ||
276 | struct dst_node *node; | ||
277 | |||
278 | /* Network address for this state */ | ||
279 | struct dst_network_ctl ctl; | ||
280 | |||
281 | /* Permissions to work with: read-only or rw connection */ | ||
282 | u32 permissions; | ||
283 | |||
284 | /* Called when we need to clean private data */ | ||
285 | void (* cleanup)(struct dst_state *st); | ||
286 | |||
287 | /* Used by the server: BIO completion queues BIOs here */ | ||
288 | struct list_head request_list; | ||
289 | spinlock_t request_lock; | ||
290 | |||
291 | /* Guess what? No, it is not number of planets */ | ||
292 | atomic_t refcnt; | ||
293 | |||
294 | /* This flags is set when connection should be dropped */ | ||
295 | int need_exit; | ||
296 | |||
297 | /* | ||
298 | * Socket to work with. Second pointer is used for | ||
299 | * lockless check if socket was changed before performing | ||
300 | * next action (like working with cached polling result) | ||
301 | */ | ||
302 | struct socket *socket, *read_socket; | ||
303 | |||
304 | /* Cached preallocated data */ | ||
305 | void *data; | ||
306 | unsigned int size; | ||
307 | |||
308 | /* Currently processed command */ | ||
309 | struct dst_cmd cmd; | ||
310 | }; | ||
311 | |||
312 | struct dst_info | ||
313 | { | ||
314 | /* Device size */ | ||
315 | u64 size; | ||
316 | |||
317 | /* Local device name for export devices */ | ||
318 | char local[DST_NAMELEN]; | ||
319 | |||
320 | /* Network setup */ | ||
321 | struct dst_network_ctl net; | ||
322 | |||
323 | /* Sysfs bits use this */ | ||
324 | struct device device; | ||
325 | }; | ||
326 | |||
327 | struct dst_node | ||
328 | { | ||
329 | struct list_head node_entry; | ||
330 | |||
331 | /* Hi, my name is stored here */ | ||
332 | char name[DST_NAMELEN]; | ||
333 | /* My cache name is stored here */ | ||
334 | char cache_name[DST_NAMELEN]; | ||
335 | |||
336 | /* Block device attached to given node. | ||
337 | * Only valid for exporting nodes */ | ||
338 | struct block_device *bdev; | ||
339 | /* Network state machine for given peer */ | ||
340 | struct dst_state *state; | ||
341 | |||
342 | /* Block IO machinery */ | ||
343 | struct request_queue *queue; | ||
344 | struct gendisk *disk; | ||
345 | |||
346 | /* Number of threads in processing pool */ | ||
347 | int thread_num; | ||
348 | /* Maximum number of pages in single IO */ | ||
349 | int max_pages; | ||
350 | |||
351 | /* I'm that big in bytes */ | ||
352 | loff_t size; | ||
353 | |||
354 | /* Exported to userspace node information */ | ||
355 | struct dst_info *info; | ||
356 | |||
357 | /* | ||
358 | * Security attribute list. | ||
359 | * Used only by exporting node currently. | ||
360 | */ | ||
361 | struct list_head security_list; | ||
362 | struct mutex security_lock; | ||
363 | |||
364 | /* | ||
365 | * When this unerflows below zero, university collapses. | ||
366 | * But this will not happen, since node will be freed, | ||
367 | * when reference counter reaches zero. | ||
368 | */ | ||
369 | atomic_t refcnt; | ||
370 | |||
371 | /* How precisely should I be started? */ | ||
372 | int (*start)(struct dst_node *); | ||
373 | |||
374 | /* Crypto capabilities */ | ||
375 | struct dst_crypto_ctl crypto; | ||
376 | u8 *hash_key; | ||
377 | u8 *cipher_key; | ||
378 | |||
379 | /* Pool of processing thread */ | ||
380 | struct thread_pool *pool; | ||
381 | |||
382 | /* Transaction IDs live here */ | ||
383 | atomic_long_t gen; | ||
384 | |||
385 | /* | ||
386 | * How frequently and how many times transaction | ||
387 | * tree should be scanned to drop stale objects. | ||
388 | */ | ||
389 | long trans_scan_timeout; | ||
390 | int trans_max_retries; | ||
391 | |||
392 | /* Small gnomes live here */ | ||
393 | struct rb_root trans_root; | ||
394 | struct mutex trans_lock; | ||
395 | |||
396 | /* | ||
397 | * Transaction cache/memory pool. | ||
398 | * It is big enough to contain not only transaction | ||
399 | * itself, but additional crypto data (digest/hmac). | ||
400 | */ | ||
401 | struct kmem_cache *trans_cache; | ||
402 | mempool_t *trans_pool; | ||
403 | |||
404 | /* This entity scans transaction tree */ | ||
405 | struct delayed_work trans_work; | ||
406 | |||
407 | wait_queue_head_t wait; | ||
408 | }; | ||
409 | |||
410 | /* Kernel representation of the security attribute */ | ||
411 | struct dst_secure | ||
412 | { | ||
413 | struct list_head sec_entry; | ||
414 | struct dst_secure_user sec; | ||
415 | }; | ||
416 | |||
417 | int dst_process_bio(struct dst_node *n, struct bio *bio); | ||
418 | |||
419 | int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r); | ||
420 | int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le); | ||
421 | |||
422 | static inline struct dst_state *dst_state_get(struct dst_state *st) | ||
423 | { | ||
424 | BUG_ON(atomic_read(&st->refcnt) == 0); | ||
425 | atomic_inc(&st->refcnt); | ||
426 | return st; | ||
427 | } | ||
428 | |||
429 | void dst_state_put(struct dst_state *st); | ||
430 | |||
431 | struct dst_state *dst_state_alloc(struct dst_node *n); | ||
432 | int dst_state_socket_create(struct dst_state *st); | ||
433 | void dst_state_socket_release(struct dst_state *st); | ||
434 | |||
435 | void dst_state_exit_connected(struct dst_state *st); | ||
436 | |||
437 | int dst_state_schedule_receiver(struct dst_state *st); | ||
438 | |||
439 | void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str); | ||
440 | |||
441 | static inline void dst_state_lock(struct dst_state *st) | ||
442 | { | ||
443 | mutex_lock(&st->state_lock); | ||
444 | } | ||
445 | |||
446 | static inline void dst_state_unlock(struct dst_state *st) | ||
447 | { | ||
448 | mutex_unlock(&st->state_lock); | ||
449 | } | ||
450 | |||
451 | void dst_poll_exit(struct dst_state *st); | ||
452 | int dst_poll_init(struct dst_state *st); | ||
453 | |||
454 | static inline unsigned int dst_state_poll(struct dst_state *st) | ||
455 | { | ||
456 | unsigned int revents = POLLHUP | POLLERR; | ||
457 | |||
458 | dst_state_lock(st); | ||
459 | if (st->socket) | ||
460 | revents = st->socket->ops->poll(NULL, st->socket, NULL); | ||
461 | dst_state_unlock(st); | ||
462 | |||
463 | return revents; | ||
464 | } | ||
465 | |||
466 | static inline int dst_thread_setup(void *private, void *data) | ||
467 | { | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | void dst_node_put(struct dst_node *n); | ||
472 | |||
473 | static inline struct dst_node *dst_node_get(struct dst_node *n) | ||
474 | { | ||
475 | atomic_inc(&n->refcnt); | ||
476 | return n; | ||
477 | } | ||
478 | |||
479 | int dst_data_recv(struct dst_state *st, void *data, unsigned int size); | ||
480 | int dst_recv_cdata(struct dst_state *st, void *cdata); | ||
481 | int dst_data_send_header(struct socket *sock, | ||
482 | void *data, unsigned int size, int more); | ||
483 | |||
484 | int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio); | ||
485 | |||
486 | int dst_process_io(struct dst_state *st); | ||
487 | int dst_export_crypto(struct dst_node *n, struct bio *bio); | ||
488 | int dst_export_send_bio(struct bio *bio); | ||
489 | int dst_start_export(struct dst_node *n); | ||
490 | |||
491 | int __init dst_export_init(void); | ||
492 | void dst_export_exit(void); | ||
493 | |||
494 | /* Private structure for export block IO requests */ | ||
495 | struct dst_export_priv | ||
496 | { | ||
497 | struct list_head request_entry; | ||
498 | struct dst_state *state; | ||
499 | struct bio *bio; | ||
500 | struct dst_cmd cmd; | ||
501 | }; | ||
502 | |||
503 | static inline void dst_trans_get(struct dst_trans *t) | ||
504 | { | ||
505 | atomic_inc(&t->refcnt); | ||
506 | } | ||
507 | |||
508 | struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen); | ||
509 | int dst_trans_remove(struct dst_trans *t); | ||
510 | int dst_trans_remove_nolock(struct dst_trans *t); | ||
511 | void dst_trans_put(struct dst_trans *t); | ||
512 | |||
513 | /* | ||
514 | * Convert bio into network command. | ||
515 | */ | ||
516 | static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd, | ||
517 | u32 command, u64 id) | ||
518 | { | ||
519 | cmd->cmd = command; | ||
520 | cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS; | ||
521 | cmd->rw = bio->bi_rw; | ||
522 | cmd->size = bio->bi_size; | ||
523 | cmd->csize = 0; | ||
524 | cmd->id = id; | ||
525 | cmd->sector = bio->bi_sector; | ||
526 | }; | ||
527 | |||
528 | int dst_trans_send(struct dst_trans *t); | ||
529 | int dst_trans_crypto(struct dst_trans *t); | ||
530 | |||
531 | int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl); | ||
532 | void dst_node_crypto_exit(struct dst_node *n); | ||
533 | |||
534 | static inline int dst_need_crypto(struct dst_node *n) | ||
535 | { | ||
536 | struct dst_crypto_ctl *c = &n->crypto; | ||
537 | /* | ||
538 | * Logical OR is appropriate here, but boolean one produces | ||
539 | * more optimal code, so it is used instead. | ||
540 | */ | ||
541 | return (c->hash_algo[0] | c->cipher_algo[0]); | ||
542 | } | ||
543 | |||
544 | int dst_node_trans_init(struct dst_node *n, unsigned int size); | ||
545 | void dst_node_trans_exit(struct dst_node *n); | ||
546 | |||
547 | /* | ||
548 | * Pool of threads. | ||
549 | * Ready list contains threads currently free to be used, | ||
550 | * active one contains threads with some work scheduled for them. | ||
551 | * Caller can wait in given queue when thread is ready. | ||
552 | */ | ||
553 | struct thread_pool | ||
554 | { | ||
555 | int thread_num; | ||
556 | struct mutex thread_lock; | ||
557 | struct list_head ready_list, active_list; | ||
558 | |||
559 | wait_queue_head_t wait; | ||
560 | }; | ||
561 | |||
562 | void thread_pool_del_worker(struct thread_pool *p); | ||
563 | void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id); | ||
564 | int thread_pool_add_worker(struct thread_pool *p, | ||
565 | char *name, | ||
566 | unsigned int id, | ||
567 | void *(* init)(void *data), | ||
568 | void (* cleanup)(void *data), | ||
569 | void *data); | ||
570 | |||
571 | void thread_pool_destroy(struct thread_pool *p); | ||
572 | struct thread_pool *thread_pool_create(int num, char *name, | ||
573 | void *(* init)(void *data), | ||
574 | void (* cleanup)(void *data), | ||
575 | void *data); | ||
576 | |||
577 | int thread_pool_schedule(struct thread_pool *p, | ||
578 | int (* setup)(void *stored_private, void *setup_data), | ||
579 | int (* action)(void *stored_private, void *setup_data), | ||
580 | void *setup_data, long timeout); | ||
581 | int thread_pool_schedule_private(struct thread_pool *p, | ||
582 | int (* setup)(void *private, void *data), | ||
583 | int (* action)(void *private, void *data), | ||
584 | void *data, long timeout, void *id); | ||
585 | |||
586 | #endif /* __KERNEL__ */ | ||
587 | #endif /* __DST_H */ | ||
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a0d9422a1569..f8c2e1767500 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name); | |||
57 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | 57 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ |
58 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | 58 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ |
59 | if (__dynamic_dbg_enabled(descriptor)) \ | 59 | if (__dynamic_dbg_enabled(descriptor)) \ |
60 | printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ | 60 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ |
61 | ##__VA_ARGS__); \ | ||
62 | } while (0) | 61 | } while (0) |
63 | 62 | ||
64 | 63 | ||
@@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name); | |||
69 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | 68 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ |
70 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | 69 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ |
71 | if (__dynamic_dbg_enabled(descriptor)) \ | 70 | if (__dynamic_dbg_enabled(descriptor)) \ |
72 | dev_printk(KERN_DEBUG, dev, \ | 71 | dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ |
73 | KBUILD_MODNAME ": " fmt, \ | ||
74 | ##__VA_ARGS__); \ | ||
75 | } while (0) | 72 | } while (0) |
76 | 73 | ||
77 | #else | 74 | #else |
@@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod) | |||
81 | return 0; | 78 | return 0; |
82 | } | 79 | } |
83 | 80 | ||
84 | #define dynamic_pr_debug(fmt, ...) do { } while (0) | 81 | #define dynamic_pr_debug(fmt, ...) \ |
85 | #define dynamic_dev_dbg(dev, format, ...) do { } while (0) | 82 | do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) |
83 | #define dynamic_dev_dbg(dev, format, ...) \ | ||
84 | do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) | ||
86 | #endif | 85 | #endif |
87 | 86 | ||
88 | #endif | 87 | #endif |
diff --git a/include/linux/efi.h b/include/linux/efi.h index ce4581fbc08b..fb737bc19a8c 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -280,11 +280,7 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right) | |||
280 | static inline char * | 280 | static inline char * |
281 | efi_guid_unparse(efi_guid_t *guid, char *out) | 281 | efi_guid_unparse(efi_guid_t *guid, char *out) |
282 | { | 282 | { |
283 | sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | 283 | sprintf(out, "%pUl", guid->b); |
284 | guid->b[3], guid->b[2], guid->b[1], guid->b[0], | ||
285 | guid->b[5], guid->b[4], guid->b[7], guid->b[6], | ||
286 | guid->b[8], guid->b[9], guid->b[10], guid->b[11], | ||
287 | guid->b[12], guid->b[13], guid->b[14], guid->b[15]); | ||
288 | return out; | 284 | return out; |
289 | } | 285 | } |
290 | 286 | ||
diff --git a/include/linux/elf.h b/include/linux/elf.h index 90a4ed0ea0e5..0cc4d55151b7 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -361,7 +361,7 @@ typedef struct elf64_shdr { | |||
361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ |
362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ |
364 | #define NT_PRXSTATUS 0x300 /* s390 upper register halves */ | 364 | #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ |
365 | 365 | ||
366 | 366 | ||
367 | /* Note header in a PT_NOTE section */ | 367 | /* Note header in a PT_NOTE section */ |
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 90d1c2184112..9a33c5f7e126 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h | |||
@@ -42,6 +42,8 @@ enum enclosure_status { | |||
42 | ENCLOSURE_STATUS_NOT_INSTALLED, | 42 | ENCLOSURE_STATUS_NOT_INSTALLED, |
43 | ENCLOSURE_STATUS_UNKNOWN, | 43 | ENCLOSURE_STATUS_UNKNOWN, |
44 | ENCLOSURE_STATUS_UNAVAILABLE, | 44 | ENCLOSURE_STATUS_UNAVAILABLE, |
45 | /* last element for counting purposes */ | ||
46 | ENCLOSURE_STATUS_MAX | ||
45 | }; | 47 | }; |
46 | 48 | ||
47 | /* SFF-8485 activity light settings */ | 49 | /* SFF-8485 activity light settings */ |
diff --git a/include/linux/err.h b/include/linux/err.h index ec87f3142bf3..1b12642636c7 100644 --- a/include/linux/err.h +++ b/include/linux/err.h | |||
@@ -34,6 +34,11 @@ static inline long IS_ERR(const void *ptr) | |||
34 | return IS_ERR_VALUE((unsigned long)ptr); | 34 | return IS_ERR_VALUE((unsigned long)ptr); |
35 | } | 35 | } |
36 | 36 | ||
37 | static inline long IS_ERR_OR_NULL(const void *ptr) | ||
38 | { | ||
39 | return !ptr || IS_ERR_VALUE((unsigned long)ptr); | ||
40 | } | ||
41 | |||
37 | /** | 42 | /** |
38 | * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type | 43 | * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type |
39 | * @ptr: The pointer to cast. | 44 | * @ptr: The pointer to cast. |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index ef4a2d84d922..cca1c3de140d 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -242,6 +242,7 @@ enum ethtool_stringset { | |||
242 | ETH_SS_TEST = 0, | 242 | ETH_SS_TEST = 0, |
243 | ETH_SS_STATS, | 243 | ETH_SS_STATS, |
244 | ETH_SS_PRIV_FLAGS, | 244 | ETH_SS_PRIV_FLAGS, |
245 | ETH_SS_NTUPLE_FILTERS, | ||
245 | }; | 246 | }; |
246 | 247 | ||
247 | /* for passing string sets for data tagging */ | 248 | /* for passing string sets for data tagging */ |
@@ -290,6 +291,7 @@ struct ethtool_perm_addr { | |||
290 | */ | 291 | */ |
291 | enum ethtool_flags { | 292 | enum ethtool_flags { |
292 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | 293 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ |
294 | ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ | ||
293 | }; | 295 | }; |
294 | 296 | ||
295 | /* The following structures are for supporting RX network flow | 297 | /* The following structures are for supporting RX network flow |
@@ -363,6 +365,35 @@ struct ethtool_rxnfc { | |||
363 | __u32 rule_locs[0]; | 365 | __u32 rule_locs[0]; |
364 | }; | 366 | }; |
365 | 367 | ||
368 | struct ethtool_rx_ntuple_flow_spec { | ||
369 | __u32 flow_type; | ||
370 | union { | ||
371 | struct ethtool_tcpip4_spec tcp_ip4_spec; | ||
372 | struct ethtool_tcpip4_spec udp_ip4_spec; | ||
373 | struct ethtool_tcpip4_spec sctp_ip4_spec; | ||
374 | struct ethtool_ah_espip4_spec ah_ip4_spec; | ||
375 | struct ethtool_ah_espip4_spec esp_ip4_spec; | ||
376 | struct ethtool_rawip4_spec raw_ip4_spec; | ||
377 | struct ethtool_ether_spec ether_spec; | ||
378 | struct ethtool_usrip4_spec usr_ip4_spec; | ||
379 | __u8 hdata[64]; | ||
380 | } h_u, m_u; /* entry, mask */ | ||
381 | |||
382 | __u16 vlan_tag; | ||
383 | __u16 vlan_tag_mask; | ||
384 | __u64 data; /* user-defined flow spec data */ | ||
385 | __u64 data_mask; /* user-defined flow spec mask */ | ||
386 | |||
387 | /* signed to distinguish between queue and actions (DROP) */ | ||
388 | __s32 action; | ||
389 | #define ETHTOOL_RXNTUPLE_ACTION_DROP -1 | ||
390 | }; | ||
391 | |||
392 | struct ethtool_rx_ntuple { | ||
393 | __u32 cmd; | ||
394 | struct ethtool_rx_ntuple_flow_spec fs; | ||
395 | }; | ||
396 | |||
366 | #define ETHTOOL_FLASH_MAX_FILENAME 128 | 397 | #define ETHTOOL_FLASH_MAX_FILENAME 128 |
367 | enum ethtool_flash_op_type { | 398 | enum ethtool_flash_op_type { |
368 | ETHTOOL_FLASH_ALL_REGIONS = 0, | 399 | ETHTOOL_FLASH_ALL_REGIONS = 0, |
@@ -377,6 +408,20 @@ struct ethtool_flash { | |||
377 | 408 | ||
378 | #ifdef __KERNEL__ | 409 | #ifdef __KERNEL__ |
379 | 410 | ||
411 | #include <linux/rculist.h> | ||
412 | |||
413 | struct ethtool_rx_ntuple_flow_spec_container { | ||
414 | struct ethtool_rx_ntuple_flow_spec fs; | ||
415 | struct list_head list; | ||
416 | }; | ||
417 | |||
418 | struct ethtool_rx_ntuple_list { | ||
419 | #define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024 | ||
420 | #define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14 | ||
421 | struct list_head list; | ||
422 | unsigned int count; | ||
423 | }; | ||
424 | |||
380 | struct net_device; | 425 | struct net_device; |
381 | 426 | ||
382 | /* Some generic methods drivers may use in their ethtool_ops */ | 427 | /* Some generic methods drivers may use in their ethtool_ops */ |
@@ -394,6 +439,7 @@ u32 ethtool_op_get_ufo(struct net_device *dev); | |||
394 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); | 439 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); |
395 | u32 ethtool_op_get_flags(struct net_device *dev); | 440 | u32 ethtool_op_get_flags(struct net_device *dev); |
396 | int ethtool_op_set_flags(struct net_device *dev, u32 data); | 441 | int ethtool_op_set_flags(struct net_device *dev, u32 data); |
442 | void ethtool_ntuple_flush(struct net_device *dev); | ||
397 | 443 | ||
398 | /** | 444 | /** |
399 | * ðtool_ops - Alter and report network device settings | 445 | * ðtool_ops - Alter and report network device settings |
@@ -500,6 +546,8 @@ struct ethtool_ops { | |||
500 | int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); | 546 | int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); |
501 | int (*flash_device)(struct net_device *, struct ethtool_flash *); | 547 | int (*flash_device)(struct net_device *, struct ethtool_flash *); |
502 | int (*reset)(struct net_device *, u32 *); | 548 | int (*reset)(struct net_device *, u32 *); |
549 | int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); | ||
550 | int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *); | ||
503 | }; | 551 | }; |
504 | #endif /* __KERNEL__ */ | 552 | #endif /* __KERNEL__ */ |
505 | 553 | ||
@@ -559,6 +607,9 @@ struct ethtool_ops { | |||
559 | #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ | 607 | #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ |
560 | #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ | 608 | #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ |
561 | 609 | ||
610 | #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ | ||
611 | #define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ | ||
612 | |||
562 | /* compatibility with older code */ | 613 | /* compatibility with older code */ |
563 | #define SPARC_ETH_GSET ETHTOOL_GSET | 614 | #define SPARC_ETH_GSET ETHTOOL_GSET |
564 | #define SPARC_ETH_SSET ETHTOOL_SSET | 615 | #define SPARC_ETH_SSET ETHTOOL_SSET |
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 94dd10366a78..91bb4f27238c 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/fcntl.h> | 11 | #include <linux/fcntl.h> |
12 | #include <linux/file.h> | 12 | #include <linux/file.h> |
13 | #include <linux/wait.h> | ||
13 | 14 | ||
14 | /* | 15 | /* |
15 | * CAREFUL: Check include/asm-generic/fcntl.h when defining | 16 | * CAREFUL: Check include/asm-generic/fcntl.h when defining |
@@ -34,6 +35,9 @@ struct file *eventfd_fget(int fd); | |||
34 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); | 35 | struct eventfd_ctx *eventfd_ctx_fdget(int fd); |
35 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); | 36 | struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); |
36 | int eventfd_signal(struct eventfd_ctx *ctx, int n); | 37 | int eventfd_signal(struct eventfd_ctx *ctx, int n); |
38 | ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt); | ||
39 | int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, | ||
40 | __u64 *cnt); | ||
37 | 41 | ||
38 | #else /* CONFIG_EVENTFD */ | 42 | #else /* CONFIG_EVENTFD */ |
39 | 43 | ||
@@ -61,6 +65,18 @@ static inline void eventfd_ctx_put(struct eventfd_ctx *ctx) | |||
61 | 65 | ||
62 | } | 66 | } |
63 | 67 | ||
68 | static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, | ||
69 | __u64 *cnt) | ||
70 | { | ||
71 | return -ENOSYS; | ||
72 | } | ||
73 | |||
74 | static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, | ||
75 | wait_queue_t *wait, __u64 *cnt) | ||
76 | { | ||
77 | return -ENOSYS; | ||
78 | } | ||
79 | |||
64 | #endif | 80 | #endif |
65 | 81 | ||
66 | #endif /* _LINUX_EVENTFD_H */ | 82 | #endif /* _LINUX_EVENTFD_H */ |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 27e772cefb6a..dc12f416a49f 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -97,7 +97,7 @@ struct fid { | |||
97 | * @get_name: find the name for a given inode in a given directory | 97 | * @get_name: find the name for a given inode in a given directory |
98 | * @get_parent: find the parent of a given directory | 98 | * @get_parent: find the parent of a given directory |
99 | * | 99 | * |
100 | * See Documentation/filesystems/Exporting for details on how to use | 100 | * See Documentation/filesystems/nfs/Exporting for details on how to use |
101 | * this interface correctly. | 101 | * this interface correctly. |
102 | * | 102 | * |
103 | * encode_fh: | 103 | * encode_fh: |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 121720d74e15..2dfa7076e8b6 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -565,14 +565,14 @@ struct ext2_dir_entry_2 { | |||
565 | * other bits are reserved for now. | 565 | * other bits are reserved for now. |
566 | */ | 566 | */ |
567 | enum { | 567 | enum { |
568 | EXT2_FT_UNKNOWN, | 568 | EXT2_FT_UNKNOWN = 0, |
569 | EXT2_FT_REG_FILE, | 569 | EXT2_FT_REG_FILE = 1, |
570 | EXT2_FT_DIR, | 570 | EXT2_FT_DIR = 2, |
571 | EXT2_FT_CHRDEV, | 571 | EXT2_FT_CHRDEV = 3, |
572 | EXT2_FT_BLKDEV, | 572 | EXT2_FT_BLKDEV = 4, |
573 | EXT2_FT_FIFO, | 573 | EXT2_FT_FIFO = 5, |
574 | EXT2_FT_SOCK, | 574 | EXT2_FT_SOCK = 6, |
575 | EXT2_FT_SYMLINK, | 575 | EXT2_FT_SYMLINK = 7, |
576 | EXT2_FT_MAX | 576 | EXT2_FT_MAX |
577 | }; | 577 | }; |
578 | 578 | ||
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 7499b3667798..6b049030fbe6 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -918,6 +918,8 @@ extern void ext3_abort (struct super_block *, const char *, const char *, ...) | |||
918 | __attribute__ ((format (printf, 3, 4))); | 918 | __attribute__ ((format (printf, 3, 4))); |
919 | extern void ext3_warning (struct super_block *, const char *, const char *, ...) | 919 | extern void ext3_warning (struct super_block *, const char *, const char *, ...) |
920 | __attribute__ ((format (printf, 3, 4))); | 920 | __attribute__ ((format (printf, 3, 4))); |
921 | extern void ext3_msg(struct super_block *, const char *, const char *, ...) | ||
922 | __attribute__ ((format (printf, 3, 4))); | ||
921 | extern void ext3_update_dynamic_rev (struct super_block *sb); | 923 | extern void ext3_update_dynamic_rev (struct super_block *sb); |
922 | 924 | ||
923 | #define ext3_std_error(sb, errno) \ | 925 | #define ext3_std_error(sb, errno) \ |
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h index f07f34de2f0e..258088ab3c6b 100644 --- a/include/linux/ext3_fs_sb.h +++ b/include/linux/ext3_fs_sb.h | |||
@@ -72,6 +72,8 @@ struct ext3_sb_info { | |||
72 | struct inode * s_journal_inode; | 72 | struct inode * s_journal_inode; |
73 | struct journal_s * s_journal; | 73 | struct journal_s * s_journal; |
74 | struct list_head s_orphan; | 74 | struct list_head s_orphan; |
75 | struct mutex s_orphan_lock; | ||
76 | struct mutex s_resize_lock; | ||
75 | unsigned long s_commit_interval; | 77 | unsigned long s_commit_interval; |
76 | struct block_device *journal_bdev; | 78 | struct block_device *journal_bdev; |
77 | #ifdef CONFIG_JBD_DEBUG | 79 | #ifdef CONFIG_JBD_DEBUG |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index cf82d519be40..d7b5ddca99c2 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
@@ -44,13 +44,13 @@ | |||
44 | 44 | ||
45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) | 47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) |
48 | 48 | ||
49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
52 | 52 | ||
53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) |
54 | 54 | ||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
@@ -86,6 +86,9 @@ | |||
86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 |
88 | #endif | 88 | #endif |
89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
89 | 92 | ||
90 | int | 93 | int |
91 | ext3_mark_iloc_dirty(handle_t *handle, | 94 | ext3_mark_iloc_dirty(handle_t *handle, |
diff --git a/include/linux/fb.h b/include/linux/fb.h index de9c722e7b90..369767bd873e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -763,6 +763,7 @@ struct fb_tile_ops { | |||
763 | * takes over; acceleration engine should be in a quiescent state */ | 763 | * takes over; acceleration engine should be in a quiescent state */ |
764 | 764 | ||
765 | /* hints */ | 765 | /* hints */ |
766 | #define FBINFO_VIRTFB 0x0004 /* FB is System RAM, not device. */ | ||
766 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ | 767 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ |
767 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ | 768 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ |
768 | 769 | ||
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h index 934e22d65801..d830747f5c0b 100644 --- a/include/linux/fiemap.h +++ b/include/linux/fiemap.h | |||
@@ -62,5 +62,7 @@ struct fiemap { | |||
62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | 62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively |
63 | * support extents. Result | 63 | * support extents. Result |
64 | * merged for efficiency. */ | 64 | * merged for efficiency. */ |
65 | #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other | ||
66 | * files. */ | ||
65 | 67 | ||
66 | #endif /* _LINUX_FIEMAP_H */ | 68 | #endif /* _LINUX_FIEMAP_H */ |
diff --git a/include/linux/file.h b/include/linux/file.h index 335a0a5c316e..5555508fd517 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -18,11 +18,9 @@ extern void drop_file_write_access(struct file *file); | |||
18 | struct file_operations; | 18 | struct file_operations; |
19 | struct vfsmount; | 19 | struct vfsmount; |
20 | struct dentry; | 20 | struct dentry; |
21 | extern int init_file(struct file *, struct vfsmount *mnt, | 21 | struct path; |
22 | struct dentry *dentry, fmode_t mode, | 22 | extern struct file *alloc_file(struct path *, fmode_t mode, |
23 | const struct file_operations *fop); | 23 | const struct file_operations *fop); |
24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, | ||
25 | fmode_t mode, const struct file_operations *fop); | ||
26 | 24 | ||
27 | static inline void fput_light(struct file *file, int fput_needed) | 25 | static inline void fput_light(struct file *file, int fput_needed) |
28 | { | 26 | { |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index c6b3ca3af6df..520ecf86cbb3 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -340,6 +340,9 @@ struct fw_cdev_send_response { | |||
340 | * The @closure field is passed back to userspace in the response event. | 340 | * The @closure field is passed back to userspace in the response event. |
341 | * The @handle field is an out parameter, returning a handle to the allocated | 341 | * The @handle field is an out parameter, returning a handle to the allocated |
342 | * range to be used for later deallocation of the range. | 342 | * range to be used for later deallocation of the range. |
343 | * | ||
344 | * The address range is allocated on all local nodes. The address allocation | ||
345 | * is exclusive except for the FCP command and response registers. | ||
343 | */ | 346 | */ |
344 | struct fw_cdev_allocate { | 347 | struct fw_cdev_allocate { |
345 | __u64 offset; | 348 | __u64 offset; |
@@ -377,7 +380,7 @@ struct fw_cdev_initiate_bus_reset { | |||
377 | * @immediate: If non-zero, immediate key to insert before pointer | 380 | * @immediate: If non-zero, immediate key to insert before pointer |
378 | * @key: Upper 8 bits of root directory pointer | 381 | * @key: Upper 8 bits of root directory pointer |
379 | * @data: Userspace pointer to contents of descriptor block | 382 | * @data: Userspace pointer to contents of descriptor block |
380 | * @length: Length of descriptor block data, in bytes | 383 | * @length: Length of descriptor block data, in quadlets |
381 | * @handle: Handle to the descriptor, written by the kernel | 384 | * @handle: Handle to the descriptor, written by the kernel |
382 | * | 385 | * |
383 | * Add a descriptor block and optionally a preceding immediate key to the local | 386 | * Add a descriptor block and optionally a preceding immediate key to the local |
@@ -391,6 +394,8 @@ struct fw_cdev_initiate_bus_reset { | |||
391 | * If not 0, the @immediate field specifies an immediate key which will be | 394 | * If not 0, the @immediate field specifies an immediate key which will be |
392 | * inserted before the root directory pointer. | 395 | * inserted before the root directory pointer. |
393 | * | 396 | * |
397 | * @immediate, @key, and @data array elements are CPU-endian quadlets. | ||
398 | * | ||
394 | * If successful, the kernel adds the descriptor and writes back a handle to the | 399 | * If successful, the kernel adds the descriptor and writes back a handle to the |
395 | * kernel-side object to be used for later removal of the descriptor block and | 400 | * kernel-side object to be used for later removal of the descriptor block and |
396 | * immediate key. | 401 | * immediate key. |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 9416a461b696..a0e67150a729 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -248,8 +248,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
248 | void *data, size_t length, | 248 | void *data, size_t length, |
249 | void *callback_data); | 249 | void *callback_data); |
250 | /* | 250 | /* |
251 | * Important note: The callback must guarantee that either fw_send_response() | 251 | * Important note: Except for the FCP registers, the callback must guarantee |
252 | * or kfree() is called on the @request. | 252 | * that either fw_send_response() or kfree() is called on the @request. |
253 | */ | 253 | */ |
254 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 254 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
255 | struct fw_request *request, | 255 | struct fw_request *request, |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index d31544628436..043811f0d277 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
7 | #include <linux/gfp.h> | ||
7 | 8 | ||
8 | #define FW_ACTION_NOHOTPLUG 0 | 9 | #define FW_ACTION_NOHOTPLUG 0 |
9 | #define FW_ACTION_HOTPLUG 1 | 10 | #define FW_ACTION_HOTPLUG 1 |
@@ -38,7 +39,7 @@ int request_firmware(const struct firmware **fw, const char *name, | |||
38 | struct device *device); | 39 | struct device *device); |
39 | int request_firmware_nowait( | 40 | int request_firmware_nowait( |
40 | struct module *module, int uevent, | 41 | struct module *module, int uevent, |
41 | const char *name, struct device *device, void *context, | 42 | const char *name, struct device *device, gfp_t gfp, void *context, |
42 | void (*cont)(const struct firmware *fw, void *context)); | 43 | void (*cont)(const struct firmware *fw, void *context)); |
43 | 44 | ||
44 | void release_firmware(const struct firmware *fw); | 45 | void release_firmware(const struct firmware *fw); |
@@ -51,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw, | |||
51 | } | 52 | } |
52 | static inline int request_firmware_nowait( | 53 | static inline int request_firmware_nowait( |
53 | struct module *module, int uevent, | 54 | struct module *module, int uevent, |
54 | const char *name, struct device *device, void *context, | 55 | const char *name, struct device *device, gfp_t gfp, void *context, |
55 | void (*cont)(const struct firmware *fw, void *context)) | 56 | void (*cont)(const struct firmware *fw, void *context)) |
56 | { | 57 | { |
57 | return -EINVAL; | 58 | return -EINVAL; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 891f7d642e5c..b1bcb275b596 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -152,6 +152,7 @@ struct inodes_stat_t { | |||
152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
154 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) | 154 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) |
155 | #define WRITE_META (WRITE | (1 << BIO_RW_META)) | ||
155 | #define SWRITE_SYNC_PLUG \ | 156 | #define SWRITE_SYNC_PLUG \ |
156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 157 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 158 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
@@ -1094,10 +1095,6 @@ struct file_lock { | |||
1094 | 1095 | ||
1095 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1096 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1096 | 1097 | ||
1097 | /* fs/sync.c */ | ||
1098 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1099 | loff_t endbyte, unsigned int flags); | ||
1100 | |||
1101 | #ifdef CONFIG_FILE_LOCKING | 1098 | #ifdef CONFIG_FILE_LOCKING |
1102 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1099 | extern int fcntl_getlk(struct file *, struct flock __user *); |
1103 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1100 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
@@ -1590,7 +1587,7 @@ struct super_operations { | |||
1590 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at | 1587 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at |
1591 | * various stages of removing an inode. | 1588 | * various stages of removing an inode. |
1592 | * | 1589 | * |
1593 | * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. | 1590 | * Two bits are used for locking and completion notification, I_NEW and I_SYNC. |
1594 | * | 1591 | * |
1595 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on | 1592 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on |
1596 | * fdatasync(). i_atime is the usual cause. | 1593 | * fdatasync(). i_atime is the usual cause. |
@@ -1599,8 +1596,14 @@ struct super_operations { | |||
1599 | * don't have to write inode on fdatasync() when only | 1596 | * don't have to write inode on fdatasync() when only |
1600 | * mtime has changed in it. | 1597 | * mtime has changed in it. |
1601 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. | 1598 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. |
1602 | * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both | 1599 | * I_NEW Serves as both a mutex and completion notification. |
1603 | * are cleared by unlock_new_inode(), called from iget(). | 1600 | * New inodes set I_NEW. If two processes both create |
1601 | * the same inode, one of them will release its inode and | ||
1602 | * wait for I_NEW to be released before returning. | ||
1603 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1604 | * also cause waiting on I_NEW, without I_NEW actually | ||
1605 | * being set. find_inode() uses this to prevent returning | ||
1606 | * nearly-dead inodes. | ||
1604 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count | 1607 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count |
1605 | * is zero. I_FREEING must be set when I_WILL_FREE is | 1608 | * is zero. I_FREEING must be set when I_WILL_FREE is |
1606 | * cleared. | 1609 | * cleared. |
@@ -1614,35 +1617,23 @@ struct super_operations { | |||
1614 | * prohibited for many purposes. iget() must wait for | 1617 | * prohibited for many purposes. iget() must wait for |
1615 | * the inode to be completely released, then create it | 1618 | * the inode to be completely released, then create it |
1616 | * anew. Other functions will just ignore such inodes, | 1619 | * anew. Other functions will just ignore such inodes, |
1617 | * if appropriate. I_LOCK is used for waiting. | 1620 | * if appropriate. I_NEW is used for waiting. |
1618 | * | 1621 | * |
1619 | * I_LOCK Serves as both a mutex and completion notification. | 1622 | * I_SYNC Synchonized write of dirty inode data. The bits is |
1620 | * New inodes set I_LOCK. If two processes both create | 1623 | * set during data writeback, and cleared with a wakeup |
1621 | * the same inode, one of them will release its inode and | 1624 | * on the bit address once it is done. |
1622 | * wait for I_LOCK to be released before returning. | ||
1623 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1624 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
1625 | * being set. find_inode() uses this to prevent returning | ||
1626 | * nearly-dead inodes. | ||
1627 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
1628 | * of inode dirty data. Having a separate lock for this | ||
1629 | * purpose reduces latency and prevents some filesystem- | ||
1630 | * specific deadlocks. | ||
1631 | * | 1625 | * |
1632 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1626 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1633 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
1634 | * I_CLEAR? If not, why? | ||
1635 | */ | 1627 | */ |
1636 | #define I_DIRTY_SYNC 1 | 1628 | #define I_DIRTY_SYNC 1 |
1637 | #define I_DIRTY_DATASYNC 2 | 1629 | #define I_DIRTY_DATASYNC 2 |
1638 | #define I_DIRTY_PAGES 4 | 1630 | #define I_DIRTY_PAGES 4 |
1639 | #define I_NEW 8 | 1631 | #define __I_NEW 3 |
1632 | #define I_NEW (1 << __I_NEW) | ||
1640 | #define I_WILL_FREE 16 | 1633 | #define I_WILL_FREE 16 |
1641 | #define I_FREEING 32 | 1634 | #define I_FREEING 32 |
1642 | #define I_CLEAR 64 | 1635 | #define I_CLEAR 64 |
1643 | #define __I_LOCK 7 | 1636 | #define __I_SYNC 7 |
1644 | #define I_LOCK (1 << __I_LOCK) | ||
1645 | #define __I_SYNC 8 | ||
1646 | #define I_SYNC (1 << __I_SYNC) | 1637 | #define I_SYNC (1 << __I_SYNC) |
1647 | 1638 | ||
1648 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1639 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
@@ -2091,8 +2082,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | |||
2091 | extern int filemap_write_and_wait(struct address_space *mapping); | 2082 | extern int filemap_write_and_wait(struct address_space *mapping); |
2092 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2083 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
2093 | loff_t lstart, loff_t lend); | 2084 | loff_t lstart, loff_t lend); |
2094 | extern int wait_on_page_writeback_range(struct address_space *mapping, | ||
2095 | pgoff_t start, pgoff_t end); | ||
2096 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 2085 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
2097 | loff_t start, loff_t end, int sync_mode); | 2086 | loff_t start, loff_t end, int sync_mode); |
2098 | extern int filemap_fdatawrite_range(struct address_space *mapping, | 2087 | extern int filemap_fdatawrite_range(struct address_space *mapping, |
@@ -2191,7 +2180,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
2191 | __insert_inode_hash(inode, inode->i_ino); | 2180 | __insert_inode_hash(inode, inode->i_ino); |
2192 | } | 2181 | } |
2193 | 2182 | ||
2194 | extern struct file * get_empty_filp(void); | ||
2195 | extern void file_move(struct file *f, struct list_head *list); | 2183 | extern void file_move(struct file *f, struct list_head *list); |
2196 | extern void file_kill(struct file *f); | 2184 | extern void file_kill(struct file *f); |
2197 | #ifdef CONFIG_BLOCK | 2185 | #ifdef CONFIG_BLOCK |
@@ -2266,9 +2254,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
2266 | int lock_type); | 2254 | int lock_type); |
2267 | 2255 | ||
2268 | enum { | 2256 | enum { |
2269 | DIO_LOCKING = 1, /* need locking between buffered and direct access */ | 2257 | /* need locking between buffered and direct access */ |
2270 | DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ | 2258 | DIO_LOCKING = 0x01, |
2271 | DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ | 2259 | |
2260 | /* filesystem does not support filling holes */ | ||
2261 | DIO_SKIP_HOLES = 0x02, | ||
2272 | }; | 2262 | }; |
2273 | 2263 | ||
2274 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2264 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
@@ -2277,7 +2267,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | |||
2277 | dio_iodone_t end_io) | 2267 | dio_iodone_t end_io) |
2278 | { | 2268 | { |
2279 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2269 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2280 | nr_segs, get_block, end_io, DIO_LOCKING); | 2270 | nr_segs, get_block, end_io, |
2271 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
2281 | } | 2272 | } |
2282 | 2273 | ||
2283 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | 2274 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, |
@@ -2286,16 +2277,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | |||
2286 | dio_iodone_t end_io) | 2277 | dio_iodone_t end_io) |
2287 | { | 2278 | { |
2288 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2279 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2289 | nr_segs, get_block, end_io, DIO_NO_LOCKING); | 2280 | nr_segs, get_block, end_io, 0); |
2290 | } | ||
2291 | |||
2292 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | ||
2293 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2294 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2295 | dio_iodone_t end_io) | ||
2296 | { | ||
2297 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | ||
2298 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); | ||
2299 | } | 2281 | } |
2300 | #endif | 2282 | #endif |
2301 | 2283 | ||
@@ -2315,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
2315 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
2316 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
2317 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2300 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
2318 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2319 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
2320 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |
@@ -2480,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
2480 | 2463 | ||
2481 | int __init get_filesystem_list(char *buf); | 2464 | int __init get_filesystem_list(char *buf); |
2482 | 2465 | ||
2466 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | ||
2467 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
2468 | |||
2483 | #endif /* __KERNEL__ */ | 2469 | #endif /* __KERNEL__ */ |
2484 | #endif /* _LINUX_FS_H */ | 2470 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index bb516ceeefc9..da317c7163ab 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h | |||
@@ -8,10 +8,8 @@ | |||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | 9 | ||
10 | /* externs for fs/stack.c */ | 10 | /* externs for fs/stack.c */ |
11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src); |
12 | int (*get_nlinks)(struct inode *)); | 12 | extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src); |
13 | |||
14 | extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src); | ||
15 | 13 | ||
16 | /* inlines */ | 14 | /* inlines */ |
17 | static inline void fsstack_copy_attr_atime(struct inode *dest, | 15 | static inline void fsstack_copy_attr_atime(struct inode *dest, |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 43fc95d822d5..28e33fea5107 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -74,7 +74,12 @@ struct spi_device; | |||
74 | struct fsl_spi_platform_data { | 74 | struct fsl_spi_platform_data { |
75 | u32 initial_spmode; /* initial SPMODE value */ | 75 | u32 initial_spmode; /* initial SPMODE value */ |
76 | s16 bus_num; | 76 | s16 bus_num; |
77 | bool qe_mode; | 77 | unsigned int flags; |
78 | #define SPI_QE_CPU_MODE (1 << 0) /* QE CPU ("PIO") mode */ | ||
79 | #define SPI_CPM_MODE (1 << 1) /* CPM/QE ("DMA") mode */ | ||
80 | #define SPI_CPM1 (1 << 2) /* SPI unit is in CPM1 block */ | ||
81 | #define SPI_CPM2 (1 << 3) /* SPI unit is in CPM2 block */ | ||
82 | #define SPI_QE (1 << 4) /* SPI unit is in QE block */ | ||
78 | /* board specific information */ | 83 | /* board specific information */ |
79 | u16 max_chipselect; | 84 | u16 max_chipselect; |
80 | void (*cs_control)(struct spi_device *spi, bool on); | 85 | void (*cs_control)(struct spi_device *spi, bool on); |
@@ -90,6 +95,10 @@ struct mpc8xx_pcmcia_ops { | |||
90 | * lead to a deep sleep (i.e. power removed from the core, | 95 | * lead to a deep sleep (i.e. power removed from the core, |
91 | * instead of just the clock). | 96 | * instead of just the clock). |
92 | */ | 97 | */ |
98 | #if defined(CONFIG_PPC_83xx) && defined(CONFIG_SUSPEND) | ||
93 | int fsl_deep_sleep(void); | 99 | int fsl_deep_sleep(void); |
100 | #else | ||
101 | static inline int fsl_deep_sleep(void) { return 0; } | ||
102 | #endif | ||
94 | 103 | ||
95 | #endif /* _FSL_DEVICE_H_ */ | 104 | #endif /* _FSL_DEVICE_H_ */ |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 47bbdf9c38d0..2233c98d80df 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -57,6 +57,7 @@ struct trace_iterator { | |||
57 | /* The below is zeroed out in pipe_read */ | 57 | /* The below is zeroed out in pipe_read */ |
58 | struct trace_seq seq; | 58 | struct trace_seq seq; |
59 | struct trace_entry *ent; | 59 | struct trace_entry *ent; |
60 | int leftover; | ||
60 | int cpu; | 61 | int cpu; |
61 | u64 ts; | 62 | u64 ts; |
62 | 63 | ||
@@ -130,7 +131,7 @@ struct ftrace_event_call { | |||
130 | void *mod; | 131 | void *mod; |
131 | void *data; | 132 | void *data; |
132 | 133 | ||
133 | atomic_t profile_count; | 134 | int profile_count; |
134 | int (*profile_enable)(struct ftrace_event_call *); | 135 | int (*profile_enable)(struct ftrace_event_call *); |
135 | void (*profile_disable)(struct ftrace_event_call *); | 136 | void (*profile_disable)(struct ftrace_event_call *); |
136 | }; | 137 | }; |
@@ -157,7 +158,7 @@ enum { | |||
157 | FILTER_PTR_STRING, | 158 | FILTER_PTR_STRING, |
158 | }; | 159 | }; |
159 | 160 | ||
160 | extern int trace_define_common_fields(struct ftrace_event_call *call); | 161 | extern int trace_event_raw_init(struct ftrace_event_call *call); |
161 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, | 162 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, |
162 | const char *name, int offset, int size, | 163 | const char *name, int offset, int size, |
163 | int is_signed, int filter_type); | 164 | int is_signed, int filter_type); |
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h index 886f5faa08cb..ca666d18ed67 100644 --- a/include/linux/generic_acl.h +++ b/include/linux/generic_acl.h | |||
@@ -1,36 +1,15 @@ | |||
1 | /* | 1 | #ifndef LINUX_GENERIC_ACL_H |
2 | * include/linux/generic_acl.h | 2 | #define LINUX_GENERIC_ACL_H |
3 | * | ||
4 | * (C) 2005 Andreas Gruenbacher <agruen@suse.de> | ||
5 | * | ||
6 | * This file is released under the GPL. | ||
7 | */ | ||
8 | 3 | ||
9 | #ifndef GENERIC_ACL_H | 4 | #include <linux/xattr.h> |
10 | #define GENERIC_ACL_H | ||
11 | 5 | ||
12 | #include <linux/posix_acl.h> | 6 | struct inode; |
13 | #include <linux/posix_acl_xattr.h> | ||
14 | 7 | ||
15 | /** | 8 | extern struct xattr_handler generic_acl_access_handler; |
16 | * struct generic_acl_operations - filesystem operations | 9 | extern struct xattr_handler generic_acl_default_handler; |
17 | * | ||
18 | * Filesystems must make these operations available to the generic | ||
19 | * operations. | ||
20 | */ | ||
21 | struct generic_acl_operations { | ||
22 | struct posix_acl *(*getacl)(struct inode *, int); | ||
23 | void (*setacl)(struct inode *, int, struct posix_acl *); | ||
24 | }; | ||
25 | 10 | ||
26 | size_t generic_acl_list(struct inode *, struct generic_acl_operations *, int, | 11 | int generic_acl_init(struct inode *, struct inode *); |
27 | char *, size_t); | 12 | int generic_acl_chmod(struct inode *); |
28 | int generic_acl_get(struct inode *, struct generic_acl_operations *, int, | 13 | int generic_check_acl(struct inode *inode, int mask); |
29 | void *, size_t); | ||
30 | int generic_acl_set(struct inode *, struct generic_acl_operations *, int, | ||
31 | const void *, size_t); | ||
32 | int generic_acl_init(struct inode *, struct inode *, | ||
33 | struct generic_acl_operations *); | ||
34 | int generic_acl_chmod(struct inode *, struct generic_acl_operations *); | ||
35 | 14 | ||
36 | #endif | 15 | #endif /* LINUX_GENERIC_ACL_H */ |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c6c0c41af35f..9717081c75ad 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | |||
256 | #define part_stat_read(part, field) \ | 256 | #define part_stat_read(part, field) \ |
257 | ({ \ | 257 | ({ \ |
258 | typeof((part)->dkstats->field) res = 0; \ | 258 | typeof((part)->dkstats->field) res = 0; \ |
259 | int i; \ | 259 | unsigned int _cpu; \ |
260 | for_each_possible_cpu(i) \ | 260 | for_each_possible_cpu(_cpu) \ |
261 | res += per_cpu_ptr((part)->dkstats, i)->field; \ | 261 | res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ |
262 | res; \ | 262 | res; \ |
263 | }) | 263 | }) |
264 | 264 | ||
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 059bd189d35d..4e949a5b5b85 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -99,6 +99,12 @@ static inline int gpio_export_link(struct device *dev, const char *name, | |||
99 | return -EINVAL; | 99 | return -EINVAL; |
100 | } | 100 | } |
101 | 101 | ||
102 | static inline int gpio_sysfs_set_active_low(unsigned gpio, int value) | ||
103 | { | ||
104 | /* GPIO can never have been requested */ | ||
105 | WARN_ON(1); | ||
106 | return -EINVAL; | ||
107 | } | ||
102 | 108 | ||
103 | static inline void gpio_unexport(unsigned gpio) | 109 | static inline void gpio_unexport(unsigned gpio) |
104 | { | 110 | { |
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h deleted file mode 100644 index 92b08cfe4a75..000000000000 --- a/include/linux/hayesesp.h +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | #ifndef HAYESESP_H | ||
2 | #define HAYESESP_H | ||
3 | |||
4 | struct hayes_esp_config { | ||
5 | short flow_on; | ||
6 | short flow_off; | ||
7 | short rx_trigger; | ||
8 | short tx_trigger; | ||
9 | short pio_threshold; | ||
10 | unsigned char rx_timeout; | ||
11 | char dma_channel; | ||
12 | }; | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #define ESP_DMA_CHANNEL 0 | ||
17 | #define ESP_RX_TRIGGER 768 | ||
18 | #define ESP_TX_TRIGGER 768 | ||
19 | #define ESP_FLOW_OFF 1016 | ||
20 | #define ESP_FLOW_ON 944 | ||
21 | #define ESP_RX_TMOUT 128 | ||
22 | #define ESP_PIO_THRESHOLD 32 | ||
23 | |||
24 | #define ESP_IN_MAJOR 57 /* major dev # for dial in */ | ||
25 | #define ESP_OUT_MAJOR 58 /* major dev # for dial out */ | ||
26 | #define ESPC_SCALE 3 | ||
27 | #define UART_ESI_BASE 0x00 | ||
28 | #define UART_ESI_SID 0x01 | ||
29 | #define UART_ESI_RX 0x02 | ||
30 | #define UART_ESI_TX 0x02 | ||
31 | #define UART_ESI_CMD1 0x04 | ||
32 | #define UART_ESI_CMD2 0x05 | ||
33 | #define UART_ESI_STAT1 0x04 | ||
34 | #define UART_ESI_STAT2 0x05 | ||
35 | #define UART_ESI_RWS 0x07 | ||
36 | |||
37 | #define UART_IER_DMA_TMOUT 0x80 | ||
38 | #define UART_IER_DMA_TC 0x08 | ||
39 | |||
40 | #define ESI_SET_IRQ 0x04 | ||
41 | #define ESI_SET_DMA_TMOUT 0x05 | ||
42 | #define ESI_SET_SRV_MASK 0x06 | ||
43 | #define ESI_SET_ERR_MASK 0x07 | ||
44 | #define ESI_SET_FLOW_CNTL 0x08 | ||
45 | #define ESI_SET_FLOW_CHARS 0x09 | ||
46 | #define ESI_SET_FLOW_LVL 0x0a | ||
47 | #define ESI_SET_TRIGGER 0x0b | ||
48 | #define ESI_SET_RX_TIMEOUT 0x0c | ||
49 | #define ESI_SET_FLOW_TMOUT 0x0d | ||
50 | #define ESI_WRITE_UART 0x0e | ||
51 | #define ESI_READ_UART 0x0f | ||
52 | #define ESI_SET_MODE 0x10 | ||
53 | #define ESI_GET_ERR_STAT 0x12 | ||
54 | #define ESI_GET_UART_STAT 0x13 | ||
55 | #define ESI_GET_RX_AVAIL 0x14 | ||
56 | #define ESI_GET_TX_AVAIL 0x15 | ||
57 | #define ESI_START_DMA_RX 0x16 | ||
58 | #define ESI_START_DMA_TX 0x17 | ||
59 | #define ESI_ISSUE_BREAK 0x1a | ||
60 | #define ESI_FLUSH_RX 0x1b | ||
61 | #define ESI_FLUSH_TX 0x1c | ||
62 | #define ESI_SET_BAUD 0x1d | ||
63 | #define ESI_SET_ENH_IRQ 0x1f | ||
64 | #define ESI_SET_REINTR 0x20 | ||
65 | #define ESI_SET_PRESCALAR 0x23 | ||
66 | #define ESI_NO_COMMAND 0xff | ||
67 | |||
68 | #define ESP_STAT_RX_TIMEOUT 0x01 | ||
69 | #define ESP_STAT_DMA_RX 0x02 | ||
70 | #define ESP_STAT_DMA_TX 0x04 | ||
71 | #define ESP_STAT_NEVER_DMA 0x08 | ||
72 | #define ESP_STAT_USE_PIO 0x10 | ||
73 | |||
74 | #define ESP_MAGIC 0x53ee | ||
75 | #define ESP_XMIT_SIZE 4096 | ||
76 | |||
77 | struct esp_struct { | ||
78 | int magic; | ||
79 | struct tty_port port; | ||
80 | spinlock_t lock; | ||
81 | int io_port; | ||
82 | int irq; | ||
83 | int read_status_mask; | ||
84 | int ignore_status_mask; | ||
85 | int timeout; | ||
86 | int stat_flags; | ||
87 | int custom_divisor; | ||
88 | int close_delay; | ||
89 | unsigned short closing_wait; | ||
90 | unsigned short closing_wait2; | ||
91 | int IER; /* Interrupt Enable Register */ | ||
92 | int MCR; /* Modem control register */ | ||
93 | unsigned long last_active; | ||
94 | int line; | ||
95 | unsigned char *xmit_buf; | ||
96 | int xmit_head; | ||
97 | int xmit_tail; | ||
98 | int xmit_cnt; | ||
99 | wait_queue_head_t break_wait; | ||
100 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ | ||
101 | struct hayes_esp_config config; /* port configuration */ | ||
102 | struct esp_struct *next_port; /* For the linked list */ | ||
103 | }; | ||
104 | |||
105 | struct esp_pio_buffer { | ||
106 | unsigned char data[1024]; | ||
107 | struct esp_pio_buffer *next; | ||
108 | }; | ||
109 | |||
110 | #endif /* __KERNEL__ */ | ||
111 | |||
112 | |||
113 | #endif /* ESP_H */ | ||
114 | |||
diff --git a/include/linux/hid.h b/include/linux/hid.h index 10f628416740..87093652dda8 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -312,6 +312,7 @@ struct hid_item { | |||
312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
315 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | ||
315 | 316 | ||
316 | /* | 317 | /* |
317 | * This is the global environment of the parser. This information is | 318 | * This is the global environment of the parser. This information is |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 211ff4497269..ab2cc20e21a5 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -46,7 +46,7 @@ void kmap_flush_unused(void); | |||
46 | 46 | ||
47 | static inline unsigned int nr_free_highpages(void) { return 0; } | 47 | static inline unsigned int nr_free_highpages(void) { return 0; } |
48 | 48 | ||
49 | #define totalhigh_pages 0 | 49 | #define totalhigh_pages 0UL |
50 | 50 | ||
51 | #ifndef ARCH_HAS_KMAP | 51 | #ifndef ARCH_HAS_KMAP |
52 | static inline void *kmap(struct page *page) | 52 | static inline void *kmap(struct page *page) |
diff --git a/include/linux/hpet.h b/include/linux/hpet.h index 79f63a27bcef..219ca4f6bea6 100644 --- a/include/linux/hpet.h +++ b/include/linux/hpet.h | |||
@@ -126,4 +126,6 @@ struct hpet_info { | |||
126 | #define HPET_DPI _IO('h', 0x05) /* disable periodic */ | 126 | #define HPET_DPI _IO('h', 0x05) /* disable periodic */ |
127 | #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ | 127 | #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ |
128 | 128 | ||
129 | #define MAX_HPET_TBS 8 /* maximum hpet timer blocks */ | ||
130 | |||
129 | #endif /* !__HPET__ */ | 131 | #endif /* !__HPET__ */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index ff037f0b1b4e..5d86fb2309d2 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -162,18 +162,23 @@ struct hrtimer_clock_base { | |||
162 | * @expires_next: absolute time of the next event which was scheduled | 162 | * @expires_next: absolute time of the next event which was scheduled |
163 | * via clock_set_next_event() | 163 | * via clock_set_next_event() |
164 | * @hres_active: State of high resolution mode | 164 | * @hres_active: State of high resolution mode |
165 | * @check_clocks: Indictator, when set evaluate time source and clock | 165 | * @hang_detected: The last hrtimer interrupt detected a hang |
166 | * event devices whether high resolution mode can be | 166 | * @nr_events: Total number of hrtimer interrupt events |
167 | * activated. | 167 | * @nr_retries: Total number of hrtimer interrupt retries |
168 | * @nr_events: Total number of timer interrupt events | 168 | * @nr_hangs: Total number of hrtimer interrupt hangs |
169 | * @max_hang_time: Maximum time spent in hrtimer_interrupt | ||
169 | */ | 170 | */ |
170 | struct hrtimer_cpu_base { | 171 | struct hrtimer_cpu_base { |
171 | spinlock_t lock; | 172 | raw_spinlock_t lock; |
172 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; | 173 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; |
173 | #ifdef CONFIG_HIGH_RES_TIMERS | 174 | #ifdef CONFIG_HIGH_RES_TIMERS |
174 | ktime_t expires_next; | 175 | ktime_t expires_next; |
175 | int hres_active; | 176 | int hres_active; |
177 | int hang_detected; | ||
176 | unsigned long nr_events; | 178 | unsigned long nr_events; |
179 | unsigned long nr_retries; | ||
180 | unsigned long nr_hangs; | ||
181 | ktime_t max_hang_time; | ||
177 | #endif | 182 | #endif |
178 | }; | 183 | }; |
179 | 184 | ||
@@ -435,49 +440,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div); | |||
435 | /* Show pending timers: */ | 440 | /* Show pending timers: */ |
436 | extern void sysrq_timer_list_show(void); | 441 | extern void sysrq_timer_list_show(void); |
437 | 442 | ||
438 | /* | ||
439 | * Timer-statistics info: | ||
440 | */ | ||
441 | #ifdef CONFIG_TIMER_STATS | ||
442 | |||
443 | extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, | ||
444 | void *timerf, char *comm, | ||
445 | unsigned int timer_flag); | ||
446 | |||
447 | static inline void timer_stats_account_hrtimer(struct hrtimer *timer) | ||
448 | { | ||
449 | if (likely(!timer->start_site)) | ||
450 | return; | ||
451 | timer_stats_update_stats(timer, timer->start_pid, timer->start_site, | ||
452 | timer->function, timer->start_comm, 0); | ||
453 | } | ||
454 | |||
455 | extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, | ||
456 | void *addr); | ||
457 | |||
458 | static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer) | ||
459 | { | ||
460 | if (likely(!timer_stats_active)) | ||
461 | return; | ||
462 | __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0)); | ||
463 | } | ||
464 | |||
465 | static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer) | ||
466 | { | ||
467 | timer->start_site = NULL; | ||
468 | } | ||
469 | #else | ||
470 | static inline void timer_stats_account_hrtimer(struct hrtimer *timer) | ||
471 | { | ||
472 | } | ||
473 | |||
474 | static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer) | ||
475 | { | ||
476 | } | ||
477 | |||
478 | static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer) | ||
479 | { | ||
480 | } | ||
481 | #endif | ||
482 | |||
483 | #endif | 443 | #endif |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 41a59afc70fa..78b4bc64c006 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -23,6 +23,12 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma); | |||
23 | int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 23 | int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
24 | int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 24 | int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
25 | int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); | 25 | int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); |
26 | |||
27 | #ifdef CONFIG_NUMA | ||
28 | int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, | ||
29 | void __user *, size_t *, loff_t *); | ||
30 | #endif | ||
31 | |||
26 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); | 32 | int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); |
27 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, | 33 | int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, |
28 | struct page **, struct vm_area_struct **, | 34 | struct page **, struct vm_area_struct **, |
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index a03daed08c59..5977b724f7c6 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h | |||
@@ -20,19 +20,18 @@ enum { | |||
20 | 20 | ||
21 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 21 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
22 | 22 | ||
23 | /* As it's for in-kernel or ptrace use, we want it to be pinned */ | ||
24 | #define DEFINE_BREAKPOINT_ATTR(name) \ | ||
25 | struct perf_event_attr name = { \ | ||
26 | .type = PERF_TYPE_BREAKPOINT, \ | ||
27 | .size = sizeof(name), \ | ||
28 | .pinned = 1, \ | ||
29 | }; | ||
30 | |||
31 | static inline void hw_breakpoint_init(struct perf_event_attr *attr) | 23 | static inline void hw_breakpoint_init(struct perf_event_attr *attr) |
32 | { | 24 | { |
25 | memset(attr, 0, sizeof(*attr)); | ||
26 | |||
33 | attr->type = PERF_TYPE_BREAKPOINT; | 27 | attr->type = PERF_TYPE_BREAKPOINT; |
34 | attr->size = sizeof(*attr); | 28 | attr->size = sizeof(*attr); |
29 | /* | ||
30 | * As it's for in-kernel or ptrace use, we want it to be pinned | ||
31 | * and to call its callback every hits. | ||
32 | */ | ||
35 | attr->pinned = 1; | 33 | attr->pinned = 1; |
34 | attr->sample_period = 1; | ||
36 | } | 35 | } |
37 | 36 | ||
38 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) | 37 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) |
@@ -45,40 +44,39 @@ static inline int hw_breakpoint_type(struct perf_event *bp) | |||
45 | return bp->attr.bp_type; | 44 | return bp->attr.bp_type; |
46 | } | 45 | } |
47 | 46 | ||
48 | static inline int hw_breakpoint_len(struct perf_event *bp) | 47 | static inline unsigned long hw_breakpoint_len(struct perf_event *bp) |
49 | { | 48 | { |
50 | return bp->attr.bp_len; | 49 | return bp->attr.bp_len; |
51 | } | 50 | } |
52 | 51 | ||
53 | extern struct perf_event * | 52 | extern struct perf_event * |
54 | register_user_hw_breakpoint(struct perf_event_attr *attr, | 53 | register_user_hw_breakpoint(struct perf_event_attr *attr, |
55 | perf_callback_t triggered, | 54 | perf_overflow_handler_t triggered, |
56 | struct task_struct *tsk); | 55 | struct task_struct *tsk); |
57 | 56 | ||
58 | /* FIXME: only change from the attr, and don't unregister */ | 57 | /* FIXME: only change from the attr, and don't unregister */ |
59 | extern struct perf_event * | 58 | extern int |
60 | modify_user_hw_breakpoint(struct perf_event *bp, | 59 | modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr); |
61 | struct perf_event_attr *attr, | ||
62 | perf_callback_t triggered, | ||
63 | struct task_struct *tsk); | ||
64 | 60 | ||
65 | /* | 61 | /* |
66 | * Kernel breakpoints are not associated with any particular thread. | 62 | * Kernel breakpoints are not associated with any particular thread. |
67 | */ | 63 | */ |
68 | extern struct perf_event * | 64 | extern struct perf_event * |
69 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | 65 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
70 | perf_callback_t triggered, | 66 | perf_overflow_handler_t triggered, |
71 | int cpu); | 67 | int cpu); |
72 | 68 | ||
73 | extern struct perf_event ** | 69 | extern struct perf_event ** |
74 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | 70 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
75 | perf_callback_t triggered); | 71 | perf_overflow_handler_t triggered); |
76 | 72 | ||
77 | extern int register_perf_hw_breakpoint(struct perf_event *bp); | 73 | extern int register_perf_hw_breakpoint(struct perf_event *bp); |
78 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); | 74 | extern int __register_perf_hw_breakpoint(struct perf_event *bp); |
79 | extern void unregister_hw_breakpoint(struct perf_event *bp); | 75 | extern void unregister_hw_breakpoint(struct perf_event *bp); |
80 | extern void unregister_wide_hw_breakpoint(struct perf_event **cpu_events); | 76 | extern void unregister_wide_hw_breakpoint(struct perf_event **cpu_events); |
81 | 77 | ||
78 | extern int dbg_reserve_bp_slot(struct perf_event *bp); | ||
79 | extern int dbg_release_bp_slot(struct perf_event *bp); | ||
82 | extern int reserve_bp_slot(struct perf_event *bp); | 80 | extern int reserve_bp_slot(struct perf_event *bp); |
83 | extern void release_bp_slot(struct perf_event *bp); | 81 | extern void release_bp_slot(struct perf_event *bp); |
84 | 82 | ||
@@ -93,20 +91,18 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp) | |||
93 | 91 | ||
94 | static inline struct perf_event * | 92 | static inline struct perf_event * |
95 | register_user_hw_breakpoint(struct perf_event_attr *attr, | 93 | register_user_hw_breakpoint(struct perf_event_attr *attr, |
96 | perf_callback_t triggered, | 94 | perf_overflow_handler_t triggered, |
97 | struct task_struct *tsk) { return NULL; } | 95 | struct task_struct *tsk) { return NULL; } |
98 | static inline struct perf_event * | 96 | static inline int |
99 | modify_user_hw_breakpoint(struct perf_event *bp, | 97 | modify_user_hw_breakpoint(struct perf_event *bp, |
100 | struct perf_event_attr *attr, | 98 | struct perf_event_attr *attr) { return -ENOSYS; } |
101 | perf_callback_t triggered, | ||
102 | struct task_struct *tsk) { return NULL; } | ||
103 | static inline struct perf_event * | 99 | static inline struct perf_event * |
104 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | 100 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, |
105 | perf_callback_t triggered, | 101 | perf_overflow_handler_t triggered, |
106 | int cpu) { return NULL; } | 102 | int cpu) { return NULL; } |
107 | static inline struct perf_event ** | 103 | static inline struct perf_event ** |
108 | register_wide_hw_breakpoint(struct perf_event_attr *attr, | 104 | register_wide_hw_breakpoint(struct perf_event_attr *attr, |
109 | perf_callback_t triggered) { return NULL; } | 105 | perf_overflow_handler_t triggered) { return NULL; } |
110 | static inline int | 106 | static inline int |
111 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } | 107 | register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } |
112 | static inline int | 108 | static inline int |
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 7244456e7e65..9bede7633f74 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
@@ -22,10 +22,12 @@ | |||
22 | * @cleanup: Cleanup callback (can be NULL). | 22 | * @cleanup: Cleanup callback (can be NULL). |
23 | * @data_present: Callback to determine if data is available | 23 | * @data_present: Callback to determine if data is available |
24 | * on the RNG. If NULL, it is assumed that | 24 | * on the RNG. If NULL, it is assumed that |
25 | * there is always data available. | 25 | * there is always data available. *OBSOLETE* |
26 | * @data_read: Read data from the RNG device. | 26 | * @data_read: Read data from the RNG device. |
27 | * Returns the number of lower random bytes in "data". | 27 | * Returns the number of lower random bytes in "data". |
28 | * Must not be NULL. | 28 | * Must not be NULL. *OSOLETE* |
29 | * @read: New API. drivers can fill up to max bytes of data | ||
30 | * into the buffer. The buffer is aligned for any type. | ||
29 | * @priv: Private data, for use by the RNG driver. | 31 | * @priv: Private data, for use by the RNG driver. |
30 | */ | 32 | */ |
31 | struct hwrng { | 33 | struct hwrng { |
@@ -34,6 +36,7 @@ struct hwrng { | |||
34 | void (*cleanup)(struct hwrng *rng); | 36 | void (*cleanup)(struct hwrng *rng); |
35 | int (*data_present)(struct hwrng *rng, int wait); | 37 | int (*data_present)(struct hwrng *rng, int wait); |
36 | int (*data_read)(struct hwrng *rng, u32 *data); | 38 | int (*data_read)(struct hwrng *rng, u32 *data); |
39 | int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); | ||
37 | unsigned long priv; | 40 | unsigned long priv; |
38 | 41 | ||
39 | /* internal. */ | 42 | /* internal. */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 419ab546b266..02fc617782ef 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -110,7 +110,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | |||
110 | * @driver: Device driver model driver | 110 | * @driver: Device driver model driver |
111 | * @id_table: List of I2C devices supported by this driver | 111 | * @id_table: List of I2C devices supported by this driver |
112 | * @detect: Callback for device detection | 112 | * @detect: Callback for device detection |
113 | * @address_data: The I2C addresses to probe (for detect) | 113 | * @address_list: The I2C addresses to probe (for detect) |
114 | * @clients: List of detected clients we created (for i2c-core use only) | 114 | * @clients: List of detected clients we created (for i2c-core use only) |
115 | * | 115 | * |
116 | * The driver.owner field should be set to the module owner of this driver. | 116 | * The driver.owner field should be set to the module owner of this driver. |
@@ -161,8 +161,8 @@ struct i2c_driver { | |||
161 | const struct i2c_device_id *id_table; | 161 | const struct i2c_device_id *id_table; |
162 | 162 | ||
163 | /* Device detection callback for automatic device creation */ | 163 | /* Device detection callback for automatic device creation */ |
164 | int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *); | 164 | int (*detect)(struct i2c_client *, struct i2c_board_info *); |
165 | const struct i2c_client_address_data *address_data; | 165 | const unsigned short *address_list; |
166 | struct list_head clients; | 166 | struct list_head clients; |
167 | }; | 167 | }; |
168 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) | 168 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) |
@@ -391,14 +391,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | |||
391 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 391 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
392 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | 392 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ |
393 | 393 | ||
394 | /* i2c_client_address_data is the struct for holding default client | ||
395 | * addresses for a driver and for the parameters supplied on the | ||
396 | * command line | ||
397 | */ | ||
398 | struct i2c_client_address_data { | ||
399 | const unsigned short *normal_i2c; | ||
400 | }; | ||
401 | |||
402 | /* Internal numbers to terminate lists */ | 394 | /* Internal numbers to terminate lists */ |
403 | #define I2C_CLIENT_END 0xfffeU | 395 | #define I2C_CLIENT_END 0xfffeU |
404 | 396 | ||
@@ -576,82 +568,4 @@ union i2c_smbus_data { | |||
576 | #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ | 568 | #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ |
577 | #define I2C_SMBUS_I2C_BLOCK_DATA 8 | 569 | #define I2C_SMBUS_I2C_BLOCK_DATA 8 |
578 | 570 | ||
579 | |||
580 | #ifdef __KERNEL__ | ||
581 | |||
582 | /* These defines are used for probing i2c client addresses */ | ||
583 | /* The length of the option lists */ | ||
584 | #define I2C_CLIENT_MAX_OPTS 48 | ||
585 | |||
586 | /* Default fill of many variables */ | ||
587 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
588 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
589 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
590 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
591 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
592 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
593 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
594 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
595 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
596 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
597 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
598 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
599 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
600 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
601 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | ||
602 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} | ||
603 | |||
604 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the | ||
605 | module header */ | ||
606 | |||
607 | #define I2C_CLIENT_MODULE_PARM(var,desc) \ | ||
608 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ | ||
609 | static unsigned int var##_num; \ | ||
610 | module_param_array(var, short, &var##_num, 0); \ | ||
611 | MODULE_PARM_DESC(var, desc) | ||
612 | |||
613 | #define I2C_CLIENT_INSMOD_COMMON \ | ||
614 | static const struct i2c_client_address_data addr_data = { \ | ||
615 | .normal_i2c = normal_i2c, \ | ||
616 | } | ||
617 | |||
618 | /* These are the ones you want to use in your own drivers. Pick the one | ||
619 | which matches the number of devices the driver differenciates between. */ | ||
620 | #define I2C_CLIENT_INSMOD \ | ||
621 | I2C_CLIENT_INSMOD_COMMON | ||
622 | |||
623 | #define I2C_CLIENT_INSMOD_1(chip1) \ | ||
624 | enum chips { any_chip, chip1 }; \ | ||
625 | I2C_CLIENT_INSMOD_COMMON | ||
626 | |||
627 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | ||
628 | enum chips { any_chip, chip1, chip2 }; \ | ||
629 | I2C_CLIENT_INSMOD_COMMON | ||
630 | |||
631 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | ||
632 | enum chips { any_chip, chip1, chip2, chip3 }; \ | ||
633 | I2C_CLIENT_INSMOD_COMMON | ||
634 | |||
635 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ | ||
636 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | ||
637 | I2C_CLIENT_INSMOD_COMMON | ||
638 | |||
639 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ | ||
640 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | ||
641 | I2C_CLIENT_INSMOD_COMMON | ||
642 | |||
643 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ | ||
644 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | ||
645 | I2C_CLIENT_INSMOD_COMMON | ||
646 | |||
647 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ | ||
648 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
649 | chip7 }; \ | ||
650 | I2C_CLIENT_INSMOD_COMMON | ||
651 | |||
652 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ | ||
653 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
654 | chip7, chip8 }; \ | ||
655 | I2C_CLIENT_INSMOD_COMMON | ||
656 | #endif /* __KERNEL__ */ | ||
657 | #endif /* _LINUX_I2C_H */ | 571 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h index fc5db826b48e..02c9af374741 100644 --- a/include/linux/i2c/adp5588.h +++ b/include/linux/i2c/adp5588.h | |||
@@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data { | |||
89 | unsigned short unlock_key2; /* Unlock Key 2 */ | 89 | unsigned short unlock_key2; /* Unlock Key 2 */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct adp5588_gpio_platform_data { | ||
93 | unsigned gpio_start; /* GPIO Chip base # */ | ||
94 | unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ | ||
95 | int (*setup)(struct i2c_client *client, | ||
96 | int gpio, unsigned ngpio, | ||
97 | void *context); | ||
98 | int (*teardown)(struct i2c_client *client, | ||
99 | int gpio, unsigned ngpio, | ||
100 | void *context); | ||
101 | void *context; | ||
102 | }; | ||
103 | |||
92 | #endif | 104 | #endif |
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h index 918c5354d9b8..08aa92278d71 100644 --- a/include/linux/i2c/tps65010.h +++ b/include/linux/i2c/tps65010.h | |||
@@ -72,6 +72,21 @@ | |||
72 | #define TPS_VDCDC1 0x0c | 72 | #define TPS_VDCDC1 0x0c |
73 | # define TPS_ENABLE_LP (1 << 3) | 73 | # define TPS_ENABLE_LP (1 << 3) |
74 | #define TPS_VDCDC2 0x0d | 74 | #define TPS_VDCDC2 0x0d |
75 | # define TPS_LP_COREOFF (1 << 7) | ||
76 | # define TPS_VCORE_1_8V (7<<4) | ||
77 | # define TPS_VCORE_1_5V (6 << 4) | ||
78 | # define TPS_VCORE_1_4V (5 << 4) | ||
79 | # define TPS_VCORE_1_3V (4 << 4) | ||
80 | # define TPS_VCORE_1_2V (3 << 4) | ||
81 | # define TPS_VCORE_1_1V (2 << 4) | ||
82 | # define TPS_VCORE_1_0V (1 << 4) | ||
83 | # define TPS_VCORE_0_85V (0 << 4) | ||
84 | # define TPS_VCORE_LP_1_2V (3 << 2) | ||
85 | # define TPS_VCORE_LP_1_1V (2 << 2) | ||
86 | # define TPS_VCORE_LP_1_0V (1 << 2) | ||
87 | # define TPS_VCORE_LP_0_85V (0 << 2) | ||
88 | # define TPS_VIB (1 << 1) | ||
89 | # define TPS_VCORE_DISCH (1 << 0) | ||
75 | #define TPS_VREGS1 0x0e | 90 | #define TPS_VREGS1 0x0e |
76 | # define TPS_LDO2_ENABLE (1 << 7) | 91 | # define TPS_LDO2_ENABLE (1 << 7) |
77 | # define TPS_LDO2_OFF (1 << 6) | 92 | # define TPS_LDO2_OFF (1 << 6) |
@@ -152,6 +167,10 @@ extern int tps65010_config_vregs1(unsigned value); | |||
152 | */ | 167 | */ |
153 | extern int tps65013_set_low_pwr(unsigned mode); | 168 | extern int tps65013_set_low_pwr(unsigned mode); |
154 | 169 | ||
170 | /* tps65010_set_vdcdc2 | ||
171 | * value to be written to VDCDC2 | ||
172 | */ | ||
173 | extern int tps65010_config_vdcdc2(unsigned value); | ||
155 | 174 | ||
156 | struct i2c_client; | 175 | struct i2c_client; |
157 | 176 | ||
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl.h index 5306a759cbde..bf1c5be1f5b6 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl.h | |||
@@ -22,8 +22,8 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef __TWL4030_H_ | 25 | #ifndef __TWL_H_ |
26 | #define __TWL4030_H_ | 26 | #define __TWL_H_ |
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/input/matrix_keypad.h> | 29 | #include <linux/input/matrix_keypad.h> |
@@ -61,28 +61,112 @@ | |||
61 | #define TWL4030_MODULE_PWMA 0x0E | 61 | #define TWL4030_MODULE_PWMA 0x0E |
62 | #define TWL4030_MODULE_PWMB 0x0F | 62 | #define TWL4030_MODULE_PWMB 0x0F |
63 | 63 | ||
64 | #define TWL5031_MODULE_ACCESSORY 0x10 | ||
65 | #define TWL5031_MODULE_INTERRUPTS 0x11 | ||
66 | |||
64 | /* Slave 3 (i2c address 0x4b) */ | 67 | /* Slave 3 (i2c address 0x4b) */ |
65 | #define TWL4030_MODULE_BACKUP 0x10 | 68 | #define TWL4030_MODULE_BACKUP 0x12 |
66 | #define TWL4030_MODULE_INT 0x11 | 69 | #define TWL4030_MODULE_INT 0x13 |
67 | #define TWL4030_MODULE_PM_MASTER 0x12 | 70 | #define TWL4030_MODULE_PM_MASTER 0x14 |
68 | #define TWL4030_MODULE_PM_RECEIVER 0x13 | 71 | #define TWL4030_MODULE_PM_RECEIVER 0x15 |
69 | #define TWL4030_MODULE_RTC 0x14 | 72 | #define TWL4030_MODULE_RTC 0x16 |
70 | #define TWL4030_MODULE_SECURED_REG 0x15 | 73 | #define TWL4030_MODULE_SECURED_REG 0x17 |
74 | |||
75 | #define TWL_MODULE_USB TWL4030_MODULE_USB | ||
76 | #define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE | ||
77 | #define TWL_MODULE_PIH TWL4030_MODULE_PIH | ||
78 | #define TWL_MODULE_MADC TWL4030_MODULE_MADC | ||
79 | #define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE | ||
80 | #define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER | ||
81 | #define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER | ||
82 | #define TWL_MODULE_RTC TWL4030_MODULE_RTC | ||
83 | |||
84 | #define GPIO_INTR_OFFSET 0 | ||
85 | #define KEYPAD_INTR_OFFSET 1 | ||
86 | #define BCI_INTR_OFFSET 2 | ||
87 | #define MADC_INTR_OFFSET 3 | ||
88 | #define USB_INTR_OFFSET 4 | ||
89 | #define BCI_PRES_INTR_OFFSET 9 | ||
90 | #define USB_PRES_INTR_OFFSET 10 | ||
91 | #define RTC_INTR_OFFSET 11 | ||
92 | |||
93 | /* | ||
94 | * Offset from TWL6030_IRQ_BASE / pdata->irq_base | ||
95 | */ | ||
96 | #define PWR_INTR_OFFSET 0 | ||
97 | #define HOTDIE_INTR_OFFSET 12 | ||
98 | #define SMPSLDO_INTR_OFFSET 13 | ||
99 | #define BATDETECT_INTR_OFFSET 14 | ||
100 | #define SIMDETECT_INTR_OFFSET 15 | ||
101 | #define MMCDETECT_INTR_OFFSET 16 | ||
102 | #define GASGAUGE_INTR_OFFSET 17 | ||
103 | #define USBOTG_INTR_OFFSET 4 | ||
104 | #define CHARGER_INTR_OFFSET 2 | ||
105 | #define RSV_INTR_OFFSET 0 | ||
106 | |||
107 | /* INT register offsets */ | ||
108 | #define REG_INT_STS_A 0x00 | ||
109 | #define REG_INT_STS_B 0x01 | ||
110 | #define REG_INT_STS_C 0x02 | ||
111 | |||
112 | #define REG_INT_MSK_LINE_A 0x03 | ||
113 | #define REG_INT_MSK_LINE_B 0x04 | ||
114 | #define REG_INT_MSK_LINE_C 0x05 | ||
115 | |||
116 | #define REG_INT_MSK_STS_A 0x06 | ||
117 | #define REG_INT_MSK_STS_B 0x07 | ||
118 | #define REG_INT_MSK_STS_C 0x08 | ||
119 | |||
120 | /* MASK INT REG GROUP A */ | ||
121 | #define TWL6030_PWR_INT_MASK 0x07 | ||
122 | #define TWL6030_RTC_INT_MASK 0x18 | ||
123 | #define TWL6030_HOTDIE_INT_MASK 0x20 | ||
124 | #define TWL6030_SMPSLDOA_INT_MASK 0xC0 | ||
125 | |||
126 | /* MASK INT REG GROUP B */ | ||
127 | #define TWL6030_SMPSLDOB_INT_MASK 0x01 | ||
128 | #define TWL6030_BATDETECT_INT_MASK 0x02 | ||
129 | #define TWL6030_SIMDETECT_INT_MASK 0x04 | ||
130 | #define TWL6030_MMCDETECT_INT_MASK 0x08 | ||
131 | #define TWL6030_GPADC_INT_MASK 0x60 | ||
132 | #define TWL6030_GASGAUGE_INT_MASK 0x80 | ||
133 | |||
134 | /* MASK INT REG GROUP C */ | ||
135 | #define TWL6030_USBOTG_INT_MASK 0x0F | ||
136 | #define TWL6030_CHARGER_CTRL_INT_MASK 0x10 | ||
137 | #define TWL6030_CHARGER_FAULT_INT_MASK 0x60 | ||
138 | |||
139 | |||
140 | #define TWL4030_CLASS_ID 0x4030 | ||
141 | #define TWL6030_CLASS_ID 0x6030 | ||
142 | unsigned int twl_rev(void); | ||
143 | #define GET_TWL_REV (twl_rev()) | ||
144 | #define TWL_CLASS_IS(class, id) \ | ||
145 | static inline int twl_class_is_ ##class(void) \ | ||
146 | { \ | ||
147 | return ((id) == (GET_TWL_REV)) ? 1 : 0; \ | ||
148 | } | ||
149 | |||
150 | TWL_CLASS_IS(4030, TWL4030_CLASS_ID) | ||
151 | TWL_CLASS_IS(6030, TWL6030_CLASS_ID) | ||
71 | 152 | ||
72 | /* | 153 | /* |
73 | * Read and write single 8-bit registers | 154 | * Read and write single 8-bit registers |
74 | */ | 155 | */ |
75 | int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg); | 156 | int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); |
76 | int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | 157 | int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); |
77 | 158 | ||
78 | /* | 159 | /* |
79 | * Read and write several 8-bit registers at once. | 160 | * Read and write several 8-bit registers at once. |
80 | * | 161 | * |
81 | * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 | 162 | * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1 |
82 | * for the value, and populate your data starting at offset 1. | 163 | * for the value, and populate your data starting at offset 1. |
83 | */ | 164 | */ |
84 | int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | 165 | int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
85 | int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | 166 | int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
167 | |||
168 | int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); | ||
169 | int twl6030_interrupt_mask(u8 bit_mask, u8 offset); | ||
86 | 170 | ||
87 | /*----------------------------------------------------------------------*/ | 171 | /*----------------------------------------------------------------------*/ |
88 | 172 | ||
@@ -221,6 +305,38 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
221 | 305 | ||
222 | /*----------------------------------------------------------------------*/ | 306 | /*----------------------------------------------------------------------*/ |
223 | 307 | ||
308 | /* | ||
309 | * Accessory Interrupts | ||
310 | */ | ||
311 | #define TWL5031_ACIIMR_LSB 0x05 | ||
312 | #define TWL5031_ACIIMR_MSB 0x06 | ||
313 | #define TWL5031_ACIIDR_LSB 0x07 | ||
314 | #define TWL5031_ACIIDR_MSB 0x08 | ||
315 | #define TWL5031_ACCISR1 0x0F | ||
316 | #define TWL5031_ACCIMR1 0x10 | ||
317 | #define TWL5031_ACCISR2 0x11 | ||
318 | #define TWL5031_ACCIMR2 0x12 | ||
319 | #define TWL5031_ACCSIR 0x13 | ||
320 | #define TWL5031_ACCEDR1 0x14 | ||
321 | #define TWL5031_ACCSIHCTRL 0x15 | ||
322 | |||
323 | /*----------------------------------------------------------------------*/ | ||
324 | |||
325 | /* | ||
326 | * Battery Charger Controller | ||
327 | */ | ||
328 | |||
329 | #define TWL5031_INTERRUPTS_BCIISR1 0x0 | ||
330 | #define TWL5031_INTERRUPTS_BCIIMR1 0x1 | ||
331 | #define TWL5031_INTERRUPTS_BCIISR2 0x2 | ||
332 | #define TWL5031_INTERRUPTS_BCIIMR2 0x3 | ||
333 | #define TWL5031_INTERRUPTS_BCISIR 0x4 | ||
334 | #define TWL5031_INTERRUPTS_BCIEDR1 0x5 | ||
335 | #define TWL5031_INTERRUPTS_BCIEDR2 0x6 | ||
336 | #define TWL5031_INTERRUPTS_BCISIHCTRL 0x7 | ||
337 | |||
338 | /*----------------------------------------------------------------------*/ | ||
339 | |||
224 | /* Power bus message definitions */ | 340 | /* Power bus message definitions */ |
225 | 341 | ||
226 | /* The TWL4030/5030 splits its power-management resources (the various | 342 | /* The TWL4030/5030 splits its power-management resources (the various |
@@ -250,6 +366,7 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
250 | 366 | ||
251 | #define RES_TYPE_ALL 0x7 | 367 | #define RES_TYPE_ALL 0x7 |
252 | 368 | ||
369 | /* Resource states */ | ||
253 | #define RES_STATE_WRST 0xF | 370 | #define RES_STATE_WRST 0xF |
254 | #define RES_STATE_ACTIVE 0xE | 371 | #define RES_STATE_ACTIVE 0xE |
255 | #define RES_STATE_SLEEP 0x8 | 372 | #define RES_STATE_SLEEP 0x8 |
@@ -310,8 +427,18 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
310 | #define MSG_SINGULAR(devgrp, id, state) \ | 427 | #define MSG_SINGULAR(devgrp, id, state) \ |
311 | ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) | 428 | ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) |
312 | 429 | ||
430 | #define MSG_BROADCAST_ALL(devgrp, state) \ | ||
431 | ((devgrp) << 5 | (state)) | ||
432 | |||
433 | #define MSG_BROADCAST_REF MSG_BROADCAST_ALL | ||
434 | #define MSG_BROADCAST_PROV MSG_BROADCAST_ALL | ||
435 | #define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL | ||
313 | /*----------------------------------------------------------------------*/ | 436 | /*----------------------------------------------------------------------*/ |
314 | 437 | ||
438 | struct twl4030_clock_init_data { | ||
439 | bool ck32k_lowpwr_enable; | ||
440 | }; | ||
441 | |||
315 | struct twl4030_bci_platform_data { | 442 | struct twl4030_bci_platform_data { |
316 | int *battery_tmp_tbl; | 443 | int *battery_tmp_tbl; |
317 | unsigned int tblsize; | 444 | unsigned int tblsize; |
@@ -391,12 +518,15 @@ struct twl4030_resconfig { | |||
391 | u8 devgroup; /* Processor group that Power resource belongs to */ | 518 | u8 devgroup; /* Processor group that Power resource belongs to */ |
392 | u8 type; /* Power resource addressed, 6 / broadcast message */ | 519 | u8 type; /* Power resource addressed, 6 / broadcast message */ |
393 | u8 type2; /* Power resource addressed, 3 / broadcast message */ | 520 | u8 type2; /* Power resource addressed, 3 / broadcast message */ |
521 | u8 remap_off; /* off state remapping */ | ||
522 | u8 remap_sleep; /* sleep state remapping */ | ||
394 | }; | 523 | }; |
395 | 524 | ||
396 | struct twl4030_power_data { | 525 | struct twl4030_power_data { |
397 | struct twl4030_script **scripts; | 526 | struct twl4030_script **scripts; |
398 | unsigned num; | 527 | unsigned num; |
399 | struct twl4030_resconfig *resource_config; | 528 | struct twl4030_resconfig *resource_config; |
529 | #define TWL4030_RESCONFIG_UNDEF ((u8)-1) | ||
400 | }; | 530 | }; |
401 | 531 | ||
402 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); | 532 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); |
@@ -421,6 +551,7 @@ struct twl4030_codec_data { | |||
421 | 551 | ||
422 | struct twl4030_platform_data { | 552 | struct twl4030_platform_data { |
423 | unsigned irq_base, irq_end; | 553 | unsigned irq_base, irq_end; |
554 | struct twl4030_clock_init_data *clock; | ||
424 | struct twl4030_bci_platform_data *bci; | 555 | struct twl4030_bci_platform_data *bci; |
425 | struct twl4030_gpio_platform_data *gpio; | 556 | struct twl4030_gpio_platform_data *gpio; |
426 | struct twl4030_madc_platform_data *madc; | 557 | struct twl4030_madc_platform_data *madc; |
@@ -429,19 +560,31 @@ struct twl4030_platform_data { | |||
429 | struct twl4030_power_data *power; | 560 | struct twl4030_power_data *power; |
430 | struct twl4030_codec_data *codec; | 561 | struct twl4030_codec_data *codec; |
431 | 562 | ||
432 | /* LDO regulators */ | 563 | /* Common LDO regulators for TWL4030/TWL6030 */ |
433 | struct regulator_init_data *vdac; | 564 | struct regulator_init_data *vdac; |
565 | struct regulator_init_data *vaux1; | ||
566 | struct regulator_init_data *vaux2; | ||
567 | struct regulator_init_data *vaux3; | ||
568 | /* TWL4030 LDO regulators */ | ||
434 | struct regulator_init_data *vpll1; | 569 | struct regulator_init_data *vpll1; |
435 | struct regulator_init_data *vpll2; | 570 | struct regulator_init_data *vpll2; |
436 | struct regulator_init_data *vmmc1; | 571 | struct regulator_init_data *vmmc1; |
437 | struct regulator_init_data *vmmc2; | 572 | struct regulator_init_data *vmmc2; |
438 | struct regulator_init_data *vsim; | 573 | struct regulator_init_data *vsim; |
439 | struct regulator_init_data *vaux1; | ||
440 | struct regulator_init_data *vaux2; | ||
441 | struct regulator_init_data *vaux3; | ||
442 | struct regulator_init_data *vaux4; | 574 | struct regulator_init_data *vaux4; |
443 | 575 | struct regulator_init_data *vio; | |
444 | /* REVISIT more to come ... _nothing_ should be hard-wired */ | 576 | struct regulator_init_data *vdd1; |
577 | struct regulator_init_data *vdd2; | ||
578 | struct regulator_init_data *vintana1; | ||
579 | struct regulator_init_data *vintana2; | ||
580 | struct regulator_init_data *vintdig; | ||
581 | /* TWL6030 LDO regulators */ | ||
582 | struct regulator_init_data *vmmc; | ||
583 | struct regulator_init_data *vpp; | ||
584 | struct regulator_init_data *vusim; | ||
585 | struct regulator_init_data *vana; | ||
586 | struct regulator_init_data *vcxio; | ||
587 | struct regulator_init_data *vusb; | ||
445 | }; | 588 | }; |
446 | 589 | ||
447 | /*----------------------------------------------------------------------*/ | 590 | /*----------------------------------------------------------------------*/ |
@@ -473,6 +616,7 @@ int twl4030_sih_setup(int module); | |||
473 | * VIO is generally fixed. | 616 | * VIO is generally fixed. |
474 | */ | 617 | */ |
475 | 618 | ||
619 | /* TWL4030 SMPS/LDO's */ | ||
476 | /* EXTERNAL dc-to-dc buck converters */ | 620 | /* EXTERNAL dc-to-dc buck converters */ |
477 | #define TWL4030_REG_VDD1 0 | 621 | #define TWL4030_REG_VDD1 0 |
478 | #define TWL4030_REG_VDD2 1 | 622 | #define TWL4030_REG_VDD2 1 |
@@ -499,4 +643,31 @@ int twl4030_sih_setup(int module); | |||
499 | #define TWL4030_REG_VUSB1V8 18 | 643 | #define TWL4030_REG_VUSB1V8 18 |
500 | #define TWL4030_REG_VUSB3V1 19 | 644 | #define TWL4030_REG_VUSB3V1 19 |
501 | 645 | ||
646 | /* TWL6030 SMPS/LDO's */ | ||
647 | /* EXTERNAL dc-to-dc buck convertor contollable via SR */ | ||
648 | #define TWL6030_REG_VDD1 30 | ||
649 | #define TWL6030_REG_VDD2 31 | ||
650 | #define TWL6030_REG_VDD3 32 | ||
651 | |||
652 | /* Non SR compliant dc-to-dc buck convertors */ | ||
653 | #define TWL6030_REG_VMEM 33 | ||
654 | #define TWL6030_REG_V2V1 34 | ||
655 | #define TWL6030_REG_V1V29 35 | ||
656 | #define TWL6030_REG_V1V8 36 | ||
657 | |||
658 | /* EXTERNAL LDOs */ | ||
659 | #define TWL6030_REG_VAUX1_6030 37 | ||
660 | #define TWL6030_REG_VAUX2_6030 38 | ||
661 | #define TWL6030_REG_VAUX3_6030 39 | ||
662 | #define TWL6030_REG_VMMC 40 | ||
663 | #define TWL6030_REG_VPP 41 | ||
664 | #define TWL6030_REG_VUSIM 42 | ||
665 | #define TWL6030_REG_VANA 43 | ||
666 | #define TWL6030_REG_VCXIO 44 | ||
667 | #define TWL6030_REG_VDAC 45 | ||
668 | #define TWL6030_REG_VUSB 46 | ||
669 | |||
670 | /* INTERNAL LDOs */ | ||
671 | #define TWL6030_REG_VRTC 47 | ||
672 | |||
502 | #endif /* End of __TWL4030_H */ | 673 | #endif /* End of __TWL4030_H */ |
diff --git a/include/linux/i8042.h b/include/linux/i8042.h index 60c3360ef6ad..9bf6870ee5f4 100644 --- a/include/linux/i8042.h +++ b/include/linux/i8042.h | |||
@@ -39,6 +39,10 @@ void i8042_lock_chip(void); | |||
39 | void i8042_unlock_chip(void); | 39 | void i8042_unlock_chip(void); |
40 | int i8042_command(unsigned char *param, int command); | 40 | int i8042_command(unsigned char *param, int command); |
41 | bool i8042_check_port_owner(const struct serio *); | 41 | bool i8042_check_port_owner(const struct serio *); |
42 | int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
43 | struct serio *serio)); | ||
44 | int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
45 | struct serio *serio)); | ||
42 | 46 | ||
43 | #else | 47 | #else |
44 | 48 | ||
@@ -52,7 +56,7 @@ void i8042_unlock_chip(void) | |||
52 | 56 | ||
53 | int i8042_command(unsigned char *param, int command) | 57 | int i8042_command(unsigned char *param, int command) |
54 | { | 58 | { |
55 | return -ENOSYS; | 59 | return -ENODEV; |
56 | } | 60 | } |
57 | 61 | ||
58 | bool i8042_check_port_owner(const struct serio *serio) | 62 | bool i8042_check_port_owner(const struct serio *serio) |
@@ -60,6 +64,18 @@ bool i8042_check_port_owner(const struct serio *serio) | |||
60 | return false; | 64 | return false; |
61 | } | 65 | } |
62 | 66 | ||
67 | int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
68 | struct serio *serio)) | ||
69 | { | ||
70 | return -ENODEV; | ||
71 | } | ||
72 | |||
73 | int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, | ||
74 | struct serio *serio)) | ||
75 | { | ||
76 | return -ENODEV; | ||
77 | } | ||
78 | |||
63 | #endif | 79 | #endif |
64 | 80 | ||
65 | #endif | 81 | #endif |
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index c0d8357917e2..4c4c74ec5987 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
@@ -174,8 +174,7 @@ struct icmp6_filter { | |||
174 | 174 | ||
175 | extern void icmpv6_send(struct sk_buff *skb, | 175 | extern void icmpv6_send(struct sk_buff *skb, |
176 | u8 type, u8 code, | 176 | u8 type, u8 code, |
177 | __u32 info, | 177 | __u32 info); |
178 | struct net_device *dev); | ||
179 | 178 | ||
180 | extern int icmpv6_init(void); | 179 | extern int icmpv6_init(void); |
181 | extern int icmpv6_err_convert(u8 type, u8 code, | 180 | extern int icmpv6_err_convert(u8 type, u8 code, |
diff --git a/include/linux/ide.h b/include/linux/ide.h index e4135d6e0556..0ec612959042 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -125,8 +125,8 @@ struct ide_io_ports { | |||
125 | * Timeouts for various operations: | 125 | * Timeouts for various operations: |
126 | */ | 126 | */ |
127 | enum { | 127 | enum { |
128 | /* spec allows up to 20ms */ | 128 | /* spec allows up to 20ms, but CF cards and SSD drives need more */ |
129 | WAIT_DRQ = HZ / 10, /* 100ms */ | 129 | WAIT_DRQ = 1 * HZ, /* 1s */ |
130 | /* some laptops are very slow */ | 130 | /* some laptops are very slow */ |
131 | WAIT_READY = 5 * HZ, /* 5s */ | 131 | WAIT_READY = 5 * HZ, /* 5s */ |
132 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 132 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 6674791622ca..c9bf92cd7653 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
@@ -78,6 +78,11 @@ enum { | |||
78 | #define IFLA_LINKINFO IFLA_LINKINFO | 78 | #define IFLA_LINKINFO IFLA_LINKINFO |
79 | IFLA_NET_NS_PID, | 79 | IFLA_NET_NS_PID, |
80 | IFLA_IFALIAS, | 80 | IFLA_IFALIAS, |
81 | IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ | ||
82 | IFLA_VF_MAC, /* Hardware queue specific attributes */ | ||
83 | IFLA_VF_VLAN, | ||
84 | IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ | ||
85 | IFLA_VFINFO, | ||
81 | __IFLA_MAX | 86 | __IFLA_MAX |
82 | }; | 87 | }; |
83 | 88 | ||
@@ -196,4 +201,29 @@ enum macvlan_mode { | |||
196 | MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ | 201 | MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ |
197 | }; | 202 | }; |
198 | 203 | ||
204 | /* SR-IOV virtual function managment section */ | ||
205 | |||
206 | struct ifla_vf_mac { | ||
207 | __u32 vf; | ||
208 | __u8 mac[32]; /* MAX_ADDR_LEN */ | ||
209 | }; | ||
210 | |||
211 | struct ifla_vf_vlan { | ||
212 | __u32 vf; | ||
213 | __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ | ||
214 | __u32 qos; | ||
215 | }; | ||
216 | |||
217 | struct ifla_vf_tx_rate { | ||
218 | __u32 vf; | ||
219 | __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ | ||
220 | }; | ||
221 | |||
222 | struct ifla_vf_info { | ||
223 | __u32 vf; | ||
224 | __u8 mac[32]; | ||
225 | __u32 vlan; | ||
226 | __u32 qos; | ||
227 | __u32 tx_rate; | ||
228 | }; | ||
199 | #endif /* _LINUX_IF_LINK_H */ | 229 | #endif /* _LINUX_IF_LINK_H */ |
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 5f200bac3749..b78a712247da 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h | |||
@@ -1,6 +1,90 @@ | |||
1 | #ifndef _LINUX_IF_MACVLAN_H | 1 | #ifndef _LINUX_IF_MACVLAN_H |
2 | #define _LINUX_IF_MACVLAN_H | 2 | #define _LINUX_IF_MACVLAN_H |
3 | 3 | ||
4 | #include <linux/if_link.h> | ||
5 | #include <linux/list.h> | ||
6 | #include <linux/netdevice.h> | ||
7 | #include <linux/netlink.h> | ||
8 | #include <net/netlink.h> | ||
9 | |||
10 | #if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) | ||
11 | struct socket *macvtap_get_socket(struct file *); | ||
12 | #else | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/errno.h> | ||
15 | struct file; | ||
16 | struct socket; | ||
17 | static inline struct socket *macvtap_get_socket(struct file *f) | ||
18 | { | ||
19 | return ERR_PTR(-EINVAL); | ||
20 | } | ||
21 | #endif /* CONFIG_MACVTAP */ | ||
22 | |||
23 | struct macvlan_port; | ||
24 | struct macvtap_queue; | ||
25 | |||
26 | /** | ||
27 | * struct macvlan_rx_stats - MACVLAN percpu rx stats | ||
28 | * @rx_packets: number of received packets | ||
29 | * @rx_bytes: number of received bytes | ||
30 | * @multicast: number of received multicast packets | ||
31 | * @rx_errors: number of errors | ||
32 | */ | ||
33 | struct macvlan_rx_stats { | ||
34 | unsigned long rx_packets; | ||
35 | unsigned long rx_bytes; | ||
36 | unsigned long multicast; | ||
37 | unsigned long rx_errors; | ||
38 | }; | ||
39 | |||
40 | struct macvlan_dev { | ||
41 | struct net_device *dev; | ||
42 | struct list_head list; | ||
43 | struct hlist_node hlist; | ||
44 | struct macvlan_port *port; | ||
45 | struct net_device *lowerdev; | ||
46 | struct macvlan_rx_stats __percpu *rx_stats; | ||
47 | enum macvlan_mode mode; | ||
48 | int (*receive)(struct sk_buff *skb); | ||
49 | int (*forward)(struct net_device *dev, struct sk_buff *skb); | ||
50 | struct macvtap_queue *tap; | ||
51 | }; | ||
52 | |||
53 | static inline void macvlan_count_rx(const struct macvlan_dev *vlan, | ||
54 | unsigned int len, bool success, | ||
55 | bool multicast) | ||
56 | { | ||
57 | struct macvlan_rx_stats *rx_stats; | ||
58 | |||
59 | rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id()); | ||
60 | if (likely(success)) { | ||
61 | rx_stats->rx_packets++;; | ||
62 | rx_stats->rx_bytes += len; | ||
63 | if (multicast) | ||
64 | rx_stats->multicast++; | ||
65 | } else { | ||
66 | rx_stats->rx_errors++; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | ||
71 | struct nlattr *tb[], struct nlattr *data[], | ||
72 | int (*receive)(struct sk_buff *skb), | ||
73 | int (*forward)(struct net_device *dev, | ||
74 | struct sk_buff *skb)); | ||
75 | |||
76 | extern void macvlan_count_rx(const struct macvlan_dev *vlan, | ||
77 | unsigned int len, bool success, | ||
78 | bool multicast); | ||
79 | |||
80 | extern void macvlan_dellink(struct net_device *dev, struct list_head *head); | ||
81 | |||
82 | extern int macvlan_link_register(struct rtnl_link_ops *ops); | ||
83 | |||
84 | extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, | ||
85 | struct net_device *dev); | ||
86 | |||
87 | |||
4 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); | 88 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); |
5 | 89 | ||
6 | #endif /* _LINUX_IF_MACVLAN_H */ | 90 | #endif /* _LINUX_IF_MACVLAN_H */ |
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index 4021d47cc437..aa57a5f993fc 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
@@ -46,6 +46,7 @@ struct sockaddr_ll { | |||
46 | #define PACKET_RESERVE 12 | 46 | #define PACKET_RESERVE 12 |
47 | #define PACKET_TX_RING 13 | 47 | #define PACKET_TX_RING 13 |
48 | #define PACKET_LOSS 14 | 48 | #define PACKET_LOSS 14 |
49 | #define PACKET_VNET_HDR 15 | ||
49 | 50 | ||
50 | struct tpacket_stats { | 51 | struct tpacket_stats { |
51 | unsigned int tp_packets; | 52 | unsigned int tp_packets; |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 3f5fd523b49d..1350a246893a 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/if_ether.h> | 20 | #include <linux/if_ether.h> |
21 | #include <linux/filter.h> | ||
21 | 22 | ||
22 | /* Read queue size */ | 23 | /* Read queue size */ |
23 | #define TUN_READQ_SIZE 500 | 24 | #define TUN_READQ_SIZE 500 |
@@ -48,6 +49,8 @@ | |||
48 | #define TUNGETIFF _IOR('T', 210, unsigned int) | 49 | #define TUNGETIFF _IOR('T', 210, unsigned int) |
49 | #define TUNGETSNDBUF _IOR('T', 211, int) | 50 | #define TUNGETSNDBUF _IOR('T', 211, int) |
50 | #define TUNSETSNDBUF _IOW('T', 212, int) | 51 | #define TUNSETSNDBUF _IOW('T', 212, int) |
52 | #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) | ||
53 | #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) | ||
51 | 54 | ||
52 | /* TUNSETIFF ifr flags */ | 55 | /* TUNSETIFF ifr flags */ |
53 | #define IFF_TUN 0x0001 | 56 | #define IFF_TUN 0x0001 |
@@ -86,4 +89,18 @@ struct tun_filter { | |||
86 | __u8 addr[0][ETH_ALEN]; | 89 | __u8 addr[0][ETH_ALEN]; |
87 | }; | 90 | }; |
88 | 91 | ||
92 | #ifdef __KERNEL__ | ||
93 | #if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) | ||
94 | struct socket *tun_get_socket(struct file *); | ||
95 | #else | ||
96 | #include <linux/err.h> | ||
97 | #include <linux/errno.h> | ||
98 | struct file; | ||
99 | struct socket; | ||
100 | static inline struct socket *tun_get_socket(struct file *f) | ||
101 | { | ||
102 | return ERR_PTR(-EINVAL); | ||
103 | } | ||
104 | #endif /* CONFIG_TUN */ | ||
105 | #endif /* __KERNEL__ */ | ||
89 | #endif /* __IF_TUN_H */ | 106 | #endif /* __IF_TUN_H */ |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 724c27e5d173..93fc2449af10 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -153,6 +153,7 @@ extern int sysctl_igmp_max_msf; | |||
153 | struct ip_sf_socklist { | 153 | struct ip_sf_socklist { |
154 | unsigned int sl_max; | 154 | unsigned int sl_max; |
155 | unsigned int sl_count; | 155 | unsigned int sl_count; |
156 | struct rcu_head rcu; | ||
156 | __be32 sl_addr[0]; | 157 | __be32 sl_addr[0]; |
157 | }; | 158 | }; |
158 | 159 | ||
@@ -170,6 +171,7 @@ struct ip_mc_socklist { | |||
170 | struct ip_mreqn multi; | 171 | struct ip_mreqn multi; |
171 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ | 172 | unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ |
172 | struct ip_sf_socklist *sflist; | 173 | struct ip_sf_socklist *sflist; |
174 | struct rcu_head rcu; | ||
173 | }; | 175 | }; |
174 | 176 | ||
175 | struct ip_sf_list { | 177 | struct ip_sf_list { |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 0e3f2a4c25f6..975837e7d6c0 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
@@ -13,18 +13,14 @@ | |||
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | struct linux_binprm; | 14 | struct linux_binprm; |
15 | 15 | ||
16 | #define IMA_COUNT_UPDATE 1 | ||
17 | #define IMA_COUNT_LEAVE 0 | ||
18 | |||
19 | #ifdef CONFIG_IMA | 16 | #ifdef CONFIG_IMA |
20 | extern int ima_bprm_check(struct linux_binprm *bprm); | 17 | extern int ima_bprm_check(struct linux_binprm *bprm); |
21 | extern int ima_inode_alloc(struct inode *inode); | 18 | extern int ima_inode_alloc(struct inode *inode); |
22 | extern void ima_inode_free(struct inode *inode); | 19 | extern void ima_inode_free(struct inode *inode); |
23 | extern int ima_path_check(struct path *path, int mask, int update_counts); | 20 | extern int ima_file_check(struct file *file, int mask); |
24 | extern void ima_file_free(struct file *file); | 21 | extern void ima_file_free(struct file *file); |
25 | extern int ima_file_mmap(struct file *file, unsigned long prot); | 22 | extern int ima_file_mmap(struct file *file, unsigned long prot); |
26 | extern void ima_counts_get(struct file *file); | 23 | extern void ima_counts_get(struct file *file); |
27 | extern void ima_counts_put(struct path *path, int mask); | ||
28 | 24 | ||
29 | #else | 25 | #else |
30 | static inline int ima_bprm_check(struct linux_binprm *bprm) | 26 | static inline int ima_bprm_check(struct linux_binprm *bprm) |
@@ -42,7 +38,7 @@ static inline void ima_inode_free(struct inode *inode) | |||
42 | return; | 38 | return; |
43 | } | 39 | } |
44 | 40 | ||
45 | static inline int ima_path_check(struct path *path, int mask, int update_counts) | 41 | static inline int ima_file_check(struct file *file, int mask) |
46 | { | 42 | { |
47 | return 0; | 43 | return 0; |
48 | } | 44 | } |
@@ -62,9 +58,5 @@ static inline void ima_counts_get(struct file *file) | |||
62 | return; | 58 | return; |
63 | } | 59 | } |
64 | 60 | ||
65 | static inline void ima_counts_put(struct path *path, int mask) | ||
66 | { | ||
67 | return; | ||
68 | } | ||
69 | #endif /* CONFIG_IMA_H */ | 61 | #endif /* CONFIG_IMA_H */ |
70 | #endif /* _LINUX_IMA_H */ | 62 | #endif /* _LINUX_IMA_H */ |
diff --git a/include/linux/in.h b/include/linux/in.h index b615649db129..583c76f9c30f 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -84,6 +84,8 @@ struct in_addr { | |||
84 | #define IP_ORIGDSTADDR 20 | 84 | #define IP_ORIGDSTADDR 20 |
85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR | 85 | #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR |
86 | 86 | ||
87 | #define IP_MINTTL 21 | ||
88 | |||
87 | /* IP_MTU_DISCOVER values */ | 89 | /* IP_MTU_DISCOVER values */ |
88 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ | 90 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ |
89 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ | 91 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ |
diff --git a/include/linux/in6.h b/include/linux/in6.h index dfa29168e6ab..bd55c6e46b2e 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -110,7 +110,7 @@ struct in6_flowlabel_req { | |||
110 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff | 110 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff |
111 | #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 | 111 | #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 |
112 | 112 | ||
113 | /* These defintions are obsolete */ | 113 | /* These definitions are obsolete */ |
114 | #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 | 114 | #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 |
115 | #define IPV6_PRIORITY_FILLER 0x0100 | 115 | #define IPV6_PRIORITY_FILLER 0x0100 |
116 | #define IPV6_PRIORITY_UNATTENDED 0x0200 | 116 | #define IPV6_PRIORITY_UNATTENDED 0x0200 |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 699e85c01a4d..2be1a1a2beb9 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -10,10 +10,40 @@ | |||
10 | #include <linux/timer.h> | 10 | #include <linux/timer.h> |
11 | #include <linux/sysctl.h> | 11 | #include <linux/sysctl.h> |
12 | 12 | ||
13 | enum | ||
14 | { | ||
15 | IPV4_DEVCONF_FORWARDING=1, | ||
16 | IPV4_DEVCONF_MC_FORWARDING, | ||
17 | IPV4_DEVCONF_PROXY_ARP, | ||
18 | IPV4_DEVCONF_ACCEPT_REDIRECTS, | ||
19 | IPV4_DEVCONF_SECURE_REDIRECTS, | ||
20 | IPV4_DEVCONF_SEND_REDIRECTS, | ||
21 | IPV4_DEVCONF_SHARED_MEDIA, | ||
22 | IPV4_DEVCONF_RP_FILTER, | ||
23 | IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
24 | IPV4_DEVCONF_BOOTP_RELAY, | ||
25 | IPV4_DEVCONF_LOG_MARTIANS, | ||
26 | IPV4_DEVCONF_TAG, | ||
27 | IPV4_DEVCONF_ARPFILTER, | ||
28 | IPV4_DEVCONF_MEDIUM_ID, | ||
29 | IPV4_DEVCONF_NOXFRM, | ||
30 | IPV4_DEVCONF_NOPOLICY, | ||
31 | IPV4_DEVCONF_FORCE_IGMP_VERSION, | ||
32 | IPV4_DEVCONF_ARP_ANNOUNCE, | ||
33 | IPV4_DEVCONF_ARP_IGNORE, | ||
34 | IPV4_DEVCONF_PROMOTE_SECONDARIES, | ||
35 | IPV4_DEVCONF_ARP_ACCEPT, | ||
36 | IPV4_DEVCONF_ARP_NOTIFY, | ||
37 | IPV4_DEVCONF_ACCEPT_LOCAL, | ||
38 | IPV4_DEVCONF_SRC_VMARK, | ||
39 | IPV4_DEVCONF_PROXY_ARP_PVLAN, | ||
40 | __IPV4_DEVCONF_MAX | ||
41 | }; | ||
42 | |||
13 | struct ipv4_devconf { | 43 | struct ipv4_devconf { |
14 | void *sysctl; | 44 | void *sysctl; |
15 | int data[__NET_IPV4_CONF_MAX - 1]; | 45 | int data[__IPV4_DEVCONF_MAX - 1]; |
16 | DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); | 46 | DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1); |
17 | }; | 47 | }; |
18 | 48 | ||
19 | struct in_device { | 49 | struct in_device { |
@@ -40,7 +70,7 @@ struct in_device { | |||
40 | struct rcu_head rcu_head; | 70 | struct rcu_head rcu_head; |
41 | }; | 71 | }; |
42 | 72 | ||
43 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) | 73 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[IPV4_DEVCONF_ ## attr - 1]) |
44 | #define IPV4_DEVCONF_ALL(net, attr) \ | 74 | #define IPV4_DEVCONF_ALL(net, attr) \ |
45 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) | 75 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) |
46 | 76 | ||
@@ -60,13 +90,13 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index, | |||
60 | 90 | ||
61 | static inline void ipv4_devconf_setall(struct in_device *in_dev) | 91 | static inline void ipv4_devconf_setall(struct in_device *in_dev) |
62 | { | 92 | { |
63 | bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1); | 93 | bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1); |
64 | } | 94 | } |
65 | 95 | ||
66 | #define IN_DEV_CONF_GET(in_dev, attr) \ | 96 | #define IN_DEV_CONF_GET(in_dev, attr) \ |
67 | ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr) | 97 | ipv4_devconf_get((in_dev), IPV4_DEVCONF_ ## attr) |
68 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ | 98 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ |
69 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 99 | ipv4_devconf_set((in_dev), IPV4_DEVCONF_ ## attr, (val)) |
70 | 100 | ||
71 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 101 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
72 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ | 102 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ |
@@ -81,6 +111,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
81 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 111 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
82 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 112 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
83 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) | 113 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) |
114 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) | ||
84 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 115 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
85 | ACCEPT_SOURCE_ROUTE) | 116 | ACCEPT_SOURCE_ROUTE) |
86 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) | 117 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) |
@@ -88,6 +119,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
88 | 119 | ||
89 | #define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS) | 120 | #define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS) |
90 | #define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) | 121 | #define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) |
122 | #define IN_DEV_PROXY_ARP_PVLAN(in_dev) IN_DEV_CONF_GET(in_dev, PROXY_ARP_PVLAN) | ||
91 | #define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA) | 123 | #define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA) |
92 | #define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS) | 124 | #define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS) |
93 | #define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \ | 125 | #define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \ |
diff --git a/include/linux/init.h b/include/linux/init.h index ff8bde520d03..ab1d31f9352b 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -149,6 +149,8 @@ void prepare_namespace(void); | |||
149 | 149 | ||
150 | extern void (*late_time_init)(void); | 150 | extern void (*late_time_init)(void); |
151 | 151 | ||
152 | extern int initcall_debug; | ||
153 | |||
152 | #endif | 154 | #endif |
153 | 155 | ||
154 | #ifndef MODULE | 156 | #ifndef MODULE |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 8d10aa7fd4c9..abec69b63d7e 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -165,7 +165,7 @@ extern struct cred init_cred; | |||
165 | .journal_info = NULL, \ | 165 | .journal_info = NULL, \ |
166 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 166 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
167 | .fs_excl = ATOMIC_INIT(0), \ | 167 | .fs_excl = ATOMIC_INIT(0), \ |
168 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ | 168 | .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ |
169 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ | 169 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ |
170 | .pids = { \ | 170 | .pids = { \ |
171 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ | 171 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ |
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h index 597a0077b3c5..5e3dddf8f562 100644 --- a/include/linux/input-polldev.h +++ b/include/linux/input-polldev.h | |||
@@ -14,12 +14,19 @@ | |||
14 | 14 | ||
15 | /** | 15 | /** |
16 | * struct input_polled_dev - simple polled input device | 16 | * struct input_polled_dev - simple polled input device |
17 | * @private: private driver data | 17 | * @private: private driver data. |
18 | * @flush: driver-supplied method that flushes device's state upon | 18 | * @open: driver-supplied method that prepares device for polling |
19 | * opening (optional) | 19 | * (enabled the device and maybe flushes device state). |
20 | * @close: driver-supplied method that is called when device is no | ||
21 | * longer being polled. Used to put device into low power mode. | ||
20 | * @poll: driver-supplied method that polls the device and posts | 22 | * @poll: driver-supplied method that polls the device and posts |
21 | * input events (mandatory). | 23 | * input events (mandatory). |
22 | * @poll_interval: specifies how often the poll() method shoudl be called. | 24 | * @poll_interval: specifies how often the poll() method should be called. |
25 | * Defaults to 500 msec unless overriden when registering the device. | ||
26 | * @poll_interval_max: specifies upper bound for the poll interval. | ||
27 | * Defaults to the initial value of @poll_interval. | ||
28 | * @poll_interval_min: specifies lower bound for the poll interval. | ||
29 | * Defaults to 0. | ||
23 | * @input: input device structire associated with the polled device. | 30 | * @input: input device structire associated with the polled device. |
24 | * Must be properly initialized by the driver (id, name, phys, bits). | 31 | * Must be properly initialized by the driver (id, name, phys, bits). |
25 | * | 32 | * |
@@ -30,11 +37,16 @@ | |||
30 | struct input_polled_dev { | 37 | struct input_polled_dev { |
31 | void *private; | 38 | void *private; |
32 | 39 | ||
33 | void (*flush)(struct input_polled_dev *dev); | 40 | void (*open)(struct input_polled_dev *dev); |
41 | void (*close)(struct input_polled_dev *dev); | ||
34 | void (*poll)(struct input_polled_dev *dev); | 42 | void (*poll)(struct input_polled_dev *dev); |
35 | unsigned int poll_interval; /* msec */ | 43 | unsigned int poll_interval; /* msec */ |
44 | unsigned int poll_interval_max; /* msec */ | ||
45 | unsigned int poll_interval_min; /* msec */ | ||
36 | 46 | ||
37 | struct input_dev *input; | 47 | struct input_dev *input; |
48 | |||
49 | /* private: */ | ||
38 | struct delayed_work work; | 50 | struct delayed_work work; |
39 | }; | 51 | }; |
40 | 52 | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 84b501ab0d8f..735ceaf1bc2d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -660,6 +660,7 @@ struct input_absinfo { | |||
660 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | 660 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
661 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | 661 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ |
662 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 662 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
663 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | ||
663 | 664 | ||
664 | #define ABS_MAX 0x3f | 665 | #define ABS_MAX 0x3f |
665 | #define ABS_CNT (ABS_MAX+1) | 666 | #define ABS_CNT (ABS_MAX+1) |
@@ -895,7 +896,7 @@ struct ff_periodic_effect { | |||
895 | struct ff_envelope envelope; | 896 | struct ff_envelope envelope; |
896 | 897 | ||
897 | __u32 custom_len; | 898 | __u32 custom_len; |
898 | __s16 *custom_data; | 899 | __s16 __user *custom_data; |
899 | }; | 900 | }; |
900 | 901 | ||
901 | /** | 902 | /** |
@@ -1021,9 +1022,12 @@ struct ff_effect { | |||
1021 | * @keycodesize: size of elements in keycode table | 1022 | * @keycodesize: size of elements in keycode table |
1022 | * @keycode: map of scancodes to keycodes for this device | 1023 | * @keycode: map of scancodes to keycodes for this device |
1023 | * @setkeycode: optional method to alter current keymap, used to implement | 1024 | * @setkeycode: optional method to alter current keymap, used to implement |
1024 | * sparse keymaps. If not supplied default mechanism will be used | 1025 | * sparse keymaps. If not supplied default mechanism will be used. |
1026 | * The method is being called while holding event_lock and thus must | ||
1027 | * not sleep | ||
1025 | * @getkeycode: optional method to retrieve current keymap. If not supplied | 1028 | * @getkeycode: optional method to retrieve current keymap. If not supplied |
1026 | * default mechanism will be used | 1029 | * default mechanism will be used. The method is being called while |
1030 | * holding event_lock and thus must not sleep | ||
1027 | * @ff: force feedback structure associated with the device if device | 1031 | * @ff: force feedback structure associated with the device if device |
1028 | * supports force feedback effects | 1032 | * supports force feedback effects |
1029 | * @repeat_key: stores key code of the last key pressed; used to implement | 1033 | * @repeat_key: stores key code of the last key pressed; used to implement |
@@ -1040,6 +1044,7 @@ struct ff_effect { | |||
1040 | * @absmin: minimum values for events coming from absolute axes | 1044 | * @absmin: minimum values for events coming from absolute axes |
1041 | * @absfuzz: describes noisiness for axes | 1045 | * @absfuzz: describes noisiness for axes |
1042 | * @absflat: size of the center flat position (used by joydev) | 1046 | * @absflat: size of the center flat position (used by joydev) |
1047 | * @absres: resolution used for events coming form absolute axes | ||
1043 | * @open: this method is called when the very first user calls | 1048 | * @open: this method is called when the very first user calls |
1044 | * input_open_device(). The driver must prepare the device | 1049 | * input_open_device(). The driver must prepare the device |
1045 | * to start generating events (start polling thread, | 1050 | * to start generating events (start polling thread, |
@@ -1294,6 +1299,9 @@ void input_unregister_device(struct input_dev *); | |||
1294 | int __must_check input_register_handler(struct input_handler *); | 1299 | int __must_check input_register_handler(struct input_handler *); |
1295 | void input_unregister_handler(struct input_handler *); | 1300 | void input_unregister_handler(struct input_handler *); |
1296 | 1301 | ||
1302 | int input_handler_for_each_handle(struct input_handler *, void *data, | ||
1303 | int (*fn)(struct input_handle *, void *)); | ||
1304 | |||
1297 | int input_register_handle(struct input_handle *); | 1305 | int input_register_handle(struct input_handle *); |
1298 | void input_unregister_handle(struct input_handle *); | 1306 | void input_unregister_handle(struct input_handle *); |
1299 | 1307 | ||
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index b3cd42d50e16..3bd018baae20 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
@@ -41,6 +41,9 @@ struct matrix_keymap_data { | |||
41 | * @col_scan_delay_us: delay, measured in microseconds, that is | 41 | * @col_scan_delay_us: delay, measured in microseconds, that is |
42 | * needed before we can keypad after activating column gpio | 42 | * needed before we can keypad after activating column gpio |
43 | * @debounce_ms: debounce interval in milliseconds | 43 | * @debounce_ms: debounce interval in milliseconds |
44 | * @active_low: gpio polarity | ||
45 | * @wakeup: controls whether the device should be set up as wakeup | ||
46 | * source | ||
44 | * | 47 | * |
45 | * This structure represents platform-specific data that use used by | 48 | * This structure represents platform-specific data that use used by |
46 | * matrix_keypad driver to perform proper initialization. | 49 | * matrix_keypad driver to perform proper initialization. |
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h new file mode 100644 index 000000000000..c211b5cf08e6 --- /dev/null +++ b/include/linux/input/sh_keysc.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef __SH_KEYSC_H__ | ||
2 | #define __SH_KEYSC_H__ | ||
3 | |||
4 | #define SH_KEYSC_MAXKEYS 30 | ||
5 | |||
6 | struct sh_keysc_info { | ||
7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode; | ||
8 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ | ||
9 | int delay; | ||
10 | int kycr2_delay; | ||
11 | int keycodes[SH_KEYSC_MAXKEYS]; | ||
12 | }; | ||
13 | |||
14 | #endif /* __SH_KEYSC_H__ */ | ||
diff --git a/include/linux/input/sparse-keymap.h b/include/linux/input/sparse-keymap.h new file mode 100644 index 000000000000..52db62064c6e --- /dev/null +++ b/include/linux/input/sparse-keymap.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #ifndef _SPARSE_KEYMAP_H | ||
2 | #define _SPARSE_KEYMAP_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (c) 2009 Dmitry Torokhov | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #define KE_END 0 /* Indicates end of keymap */ | ||
13 | #define KE_KEY 1 /* Ordinary key/button */ | ||
14 | #define KE_SW 2 /* Switch (predetermined value) */ | ||
15 | #define KE_VSW 3 /* Switch (value supplied at runtime) */ | ||
16 | #define KE_IGNORE 4 /* Known entry that should be ignored */ | ||
17 | #define KE_LAST KE_IGNORE | ||
18 | |||
19 | /** | ||
20 | * struct key_entry - keymap entry for use in sparse keymap | ||
21 | * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END); | ||
22 | * drivers are allowed to extend the list with their own | ||
23 | * private definitions. | ||
24 | * @code: Device-specific data identifying the button/switch | ||
25 | * @keycode: KEY_* code assigned to a key/button | ||
26 | * @sw.code: SW_* code assigned to a switch | ||
27 | * @sw.value: Value that should be sent in an input even when KE_SW | ||
28 | * switch is toggled. KE_VSW switches ignore this field and | ||
29 | * expect driver to supply value for the event. | ||
30 | * | ||
31 | * This structure defines an entry in a sparse keymap used by some | ||
32 | * input devices for which traditional table-based approach is not | ||
33 | * suitable. | ||
34 | */ | ||
35 | struct key_entry { | ||
36 | int type; /* See KE_* above */ | ||
37 | u32 code; | ||
38 | union { | ||
39 | u16 keycode; /* For KE_KEY */ | ||
40 | struct { /* For KE_SW, KE_VSW */ | ||
41 | u8 code; | ||
42 | u8 value; /* For KE_SW, ignored by KE_VSW */ | ||
43 | } sw; | ||
44 | }; | ||
45 | }; | ||
46 | |||
47 | struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev, | ||
48 | unsigned int code); | ||
49 | struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, | ||
50 | unsigned int code); | ||
51 | int sparse_keymap_setup(struct input_dev *dev, | ||
52 | const struct key_entry *keymap, | ||
53 | int (*setup)(struct input_dev *, struct key_entry *)); | ||
54 | void sparse_keymap_free(struct input_dev *dev); | ||
55 | |||
56 | void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, | ||
57 | unsigned int value, bool autorelease); | ||
58 | |||
59 | bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, | ||
60 | unsigned int value, bool autorelease); | ||
61 | |||
62 | #endif /* _SPARSE_KEYMAP_H */ | ||
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 4f0a72a9740c..9310c699a37d 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -332,6 +332,7 @@ struct intel_iommu { | |||
332 | #ifdef CONFIG_INTR_REMAP | 332 | #ifdef CONFIG_INTR_REMAP |
333 | struct ir_table *ir_table; /* Interrupt remapping info */ | 333 | struct ir_table *ir_table; /* Interrupt remapping info */ |
334 | #endif | 334 | #endif |
335 | int node; | ||
335 | }; | 336 | }; |
336 | 337 | ||
337 | static inline void __iommu_flush_cache( | 338 | static inline void __iommu_flush_cache( |
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index a63235996309..78ef023227d4 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -4,32 +4,6 @@ | |||
4 | #include <linux/radix-tree.h> | 4 | #include <linux/radix-tree.h> |
5 | #include <linux/rcupdate.h> | 5 | #include <linux/rcupdate.h> |
6 | 6 | ||
7 | /* | ||
8 | * This is the per-process anticipatory I/O scheduler state. | ||
9 | */ | ||
10 | struct as_io_context { | ||
11 | spinlock_t lock; | ||
12 | |||
13 | void (*dtor)(struct as_io_context *aic); /* destructor */ | ||
14 | void (*exit)(struct as_io_context *aic); /* called on task exit */ | ||
15 | |||
16 | unsigned long state; | ||
17 | atomic_t nr_queued; /* queued reads & sync writes */ | ||
18 | atomic_t nr_dispatched; /* number of requests gone to the drivers */ | ||
19 | |||
20 | /* IO History tracking */ | ||
21 | /* Thinktime */ | ||
22 | unsigned long last_end_request; | ||
23 | unsigned long ttime_total; | ||
24 | unsigned long ttime_samples; | ||
25 | unsigned long ttime_mean; | ||
26 | /* Layout pattern */ | ||
27 | unsigned int seek_samples; | ||
28 | sector_t last_request_pos; | ||
29 | u64 seek_total; | ||
30 | sector_t seek_mean; | ||
31 | }; | ||
32 | |||
33 | struct cfq_queue; | 7 | struct cfq_queue; |
34 | struct cfq_io_context { | 8 | struct cfq_io_context { |
35 | void *key; | 9 | void *key; |
@@ -78,7 +52,6 @@ struct io_context { | |||
78 | unsigned long last_waited; /* Time last woken after wait for request */ | 52 | unsigned long last_waited; /* Time last woken after wait for request */ |
79 | int nr_batch_requests; /* Number of requests left in the batch */ | 53 | int nr_batch_requests; /* Number of requests left in the batch */ |
80 | 54 | ||
81 | struct as_io_context *aic; | ||
82 | struct radix_tree_root radix_root; | 55 | struct radix_tree_root radix_root; |
83 | struct hlist_head cic_list; | 56 | struct hlist_head cic_list; |
84 | void *ioc_data; | 57 | void *ioc_data; |
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index 3b068e5b5671..64d1b638745d 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -14,14 +14,11 @@ static inline unsigned long iommu_device_max_index(unsigned long size, | |||
14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, | 14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
15 | unsigned long shift, | 15 | unsigned long shift, |
16 | unsigned long boundary_size); | 16 | unsigned long boundary_size); |
17 | extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len); | ||
18 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 17 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
19 | unsigned long start, unsigned int nr, | 18 | unsigned long start, unsigned int nr, |
20 | unsigned long shift, | 19 | unsigned long shift, |
21 | unsigned long boundary_size, | 20 | unsigned long boundary_size, |
22 | unsigned long align_mask); | 21 | unsigned long align_mask); |
23 | extern void iommu_area_free(unsigned long *map, unsigned long start, | ||
24 | unsigned int nr); | ||
25 | 22 | ||
26 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, | 23 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, |
27 | unsigned long io_page_size); | 24 | unsigned long io_page_size); |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 83aa81297ea3..7129504e053d 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -126,11 +126,11 @@ extern int allocate_resource(struct resource *root, struct resource *new, | |||
126 | int adjust_resource(struct resource *res, resource_size_t start, | 126 | int adjust_resource(struct resource *res, resource_size_t start, |
127 | resource_size_t size); | 127 | resource_size_t size); |
128 | resource_size_t resource_alignment(struct resource *res); | 128 | resource_size_t resource_alignment(struct resource *res); |
129 | static inline resource_size_t resource_size(struct resource *res) | 129 | static inline resource_size_t resource_size(const struct resource *res) |
130 | { | 130 | { |
131 | return res->end - res->start + 1; | 131 | return res->end - res->start + 1; |
132 | } | 132 | } |
133 | static inline unsigned long resource_type(struct resource *res) | 133 | static inline unsigned long resource_type(const struct resource *res) |
134 | { | 134 | { |
135 | return res->flags & IORESOURCE_TYPE_BITS; | 135 | return res->flags & IORESOURCE_TYPE_BITS; |
136 | } | 136 | } |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index e408722a84c7..07baa38bce37 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -87,7 +87,7 @@ extern int mq_init_ns(struct ipc_namespace *ns); | |||
87 | /* default values */ | 87 | /* default values */ |
88 | #define DFLT_QUEUESMAX 256 /* max number of message queues */ | 88 | #define DFLT_QUEUESMAX 256 /* max number of message queues */ |
89 | #define DFLT_MSGMAX 10 /* max number of messages in each queue */ | 89 | #define DFLT_MSGMAX 10 /* max number of messages in each queue */ |
90 | #define HARD_MSGMAX (131072/sizeof(void *)) | 90 | #define HARD_MSGMAX (32768*sizeof(void *)/4) |
91 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ | 91 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ |
92 | #else | 92 | #else |
93 | static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } | 93 | static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; } |
diff --git a/include/linux/irq.h b/include/linux/irq.h index ae9653dbcd78..451481c082b5 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -192,7 +192,7 @@ struct irq_desc { | |||
192 | unsigned int irq_count; /* For detecting broken IRQs */ | 192 | unsigned int irq_count; /* For detecting broken IRQs */ |
193 | unsigned long last_unhandled; /* Aging timer for unhandled count */ | 193 | unsigned long last_unhandled; /* Aging timer for unhandled count */ |
194 | unsigned int irqs_unhandled; | 194 | unsigned int irqs_unhandled; |
195 | spinlock_t lock; | 195 | raw_spinlock_t lock; |
196 | #ifdef CONFIG_SMP | 196 | #ifdef CONFIG_SMP |
197 | cpumask_var_t affinity; | 197 | cpumask_var_t affinity; |
198 | unsigned int node; | 198 | unsigned int node; |
@@ -282,7 +282,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action); | |||
282 | 282 | ||
283 | /* | 283 | /* |
284 | * Built-in IRQ handlers for various IRQ types, | 284 | * Built-in IRQ handlers for various IRQ types, |
285 | * callable via desc->chip->handle_irq() | 285 | * callable via desc->handle_irq() |
286 | */ | 286 | */ |
287 | extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); | 287 | extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); |
288 | extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); | 288 | extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); |
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h index 7acb87a44872..11b57c485854 100644 --- a/include/linux/isdn/capilli.h +++ b/include/linux/isdn/capilli.h | |||
@@ -50,8 +50,7 @@ struct capi_ctr { | |||
50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); | 50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); |
51 | 51 | ||
52 | char *(*procinfo)(struct capi_ctr *); | 52 | char *(*procinfo)(struct capi_ctr *); |
53 | int (*ctr_read_proc)(char *page, char **start, off_t off, | 53 | const struct file_operations *proc_fops; |
54 | int count, int *eof, struct capi_ctr *card); | ||
55 | 54 | ||
56 | /* filled in before calling ready callback */ | 55 | /* filled in before calling ready callback */ |
57 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ | 56 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ |
@@ -67,9 +66,10 @@ struct capi_ctr { | |||
67 | unsigned long nsentdatapkt; | 66 | unsigned long nsentdatapkt; |
68 | 67 | ||
69 | int cnr; /* controller number */ | 68 | int cnr; /* controller number */ |
70 | volatile unsigned short cardstate; /* controller state */ | 69 | unsigned short state; /* controller state */ |
71 | volatile int blocked; /* output blocked */ | 70 | int blocked; /* output blocked */ |
72 | int traceflag; /* capi trace */ | 71 | int traceflag; /* capi trace */ |
72 | wait_queue_head_t state_wait_queue; | ||
73 | 73 | ||
74 | struct proc_dir_entry *procent; | 74 | struct proc_dir_entry *procent; |
75 | char procfn[128]; | 75 | char procfn[128]; |
diff --git a/include/linux/isicom.h b/include/linux/isicom.h index bbd42197298f..b92e05650639 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h | |||
@@ -67,6 +67,7 @@ | |||
67 | 67 | ||
68 | #define FIRMWARE_LOADED 0x0001 | 68 | #define FIRMWARE_LOADED 0x0001 |
69 | #define BOARD_ACTIVE 0x0002 | 69 | #define BOARD_ACTIVE 0x0002 |
70 | #define BOARD_INIT 0x0004 | ||
70 | 71 | ||
71 | /* isi_port status bitmap */ | 72 | /* isi_port status bitmap */ |
72 | 73 | ||
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f1011f7f3d41..638ce4554c76 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -653,6 +653,7 @@ struct transaction_s | |||
653 | * waiting for it to finish. | 653 | * waiting for it to finish. |
654 | */ | 654 | */ |
655 | unsigned int t_synchronous_commit:1; | 655 | unsigned int t_synchronous_commit:1; |
656 | unsigned int t_flushed_data_blocks:1; | ||
656 | 657 | ||
657 | /* | 658 | /* |
658 | * For use by the filesystem to store fs-specific data | 659 | * For use by the filesystem to store fs-specific data |
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 792274269f2b..d8e9b3d1c23c 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -107,18 +107,6 @@ static inline void print_symbol(const char *fmt, unsigned long addr) | |||
107 | __builtin_extract_return_addr((void *)addr)); | 107 | __builtin_extract_return_addr((void *)addr)); |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | ||
111 | * Pretty-print a function pointer. This function is deprecated. | ||
112 | * Please use the "%pF" vsprintf format instead. | ||
113 | */ | ||
114 | static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr) | ||
115 | { | ||
116 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
117 | addr = *(void **)addr; | ||
118 | #endif | ||
119 | print_symbol(fmt, (unsigned long)addr); | ||
120 | } | ||
121 | |||
122 | static inline void print_ip_sym(unsigned long ip) | 110 | static inline void print_ip_sym(unsigned long ip) |
123 | { | 111 | { |
124 | printk("[<%p>] %pS\n", (void *) ip, (void *) ip); | 112 | printk("[<%p>] %pS\n", (void *) ip, (void *) ip); |
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h new file mode 100644 index 000000000000..bd92a89f4b0a --- /dev/null +++ b/include/linux/kernel-page-flags.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef LINUX_KERNEL_PAGE_FLAGS_H | ||
2 | #define LINUX_KERNEL_PAGE_FLAGS_H | ||
3 | |||
4 | /* | ||
5 | * Stable page flag bits exported to user space | ||
6 | */ | ||
7 | |||
8 | #define KPF_LOCKED 0 | ||
9 | #define KPF_ERROR 1 | ||
10 | #define KPF_REFERENCED 2 | ||
11 | #define KPF_UPTODATE 3 | ||
12 | #define KPF_DIRTY 4 | ||
13 | #define KPF_LRU 5 | ||
14 | #define KPF_ACTIVE 6 | ||
15 | #define KPF_SLAB 7 | ||
16 | #define KPF_WRITEBACK 8 | ||
17 | #define KPF_RECLAIM 9 | ||
18 | #define KPF_BUDDY 10 | ||
19 | |||
20 | /* 11-20: new additions in 2.6.31 */ | ||
21 | #define KPF_MMAP 11 | ||
22 | #define KPF_ANON 12 | ||
23 | #define KPF_SWAPCACHE 13 | ||
24 | #define KPF_SWAPBACKED 14 | ||
25 | #define KPF_COMPOUND_HEAD 15 | ||
26 | #define KPF_COMPOUND_TAIL 16 | ||
27 | #define KPF_HUGE 17 | ||
28 | #define KPF_UNEVICTABLE 18 | ||
29 | #define KPF_HWPOISON 19 | ||
30 | #define KPF_NOPAGE 20 | ||
31 | |||
32 | #define KPF_KSM 21 | ||
33 | |||
34 | /* kernel hacking assistances | ||
35 | * WARNING: subject to change, never rely on them! | ||
36 | */ | ||
37 | #define KPF_RESERVED 32 | ||
38 | #define KPF_MLOCKED 33 | ||
39 | #define KPF_MAPPEDTODISK 34 | ||
40 | #define KPF_PRIVATE 35 | ||
41 | #define KPF_PRIVATE_2 36 | ||
42 | #define KPF_OWNER_PRIVATE 37 | ||
43 | #define KPF_ARCH 38 | ||
44 | #define KPF_UNCACHED 39 | ||
45 | |||
46 | #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 3fa4c590cf12..328bca609b9b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -251,10 +251,10 @@ extern int printk_delay_msec; | |||
251 | * Print a one-time message (analogous to WARN_ONCE() et al): | 251 | * Print a one-time message (analogous to WARN_ONCE() et al): |
252 | */ | 252 | */ |
253 | #define printk_once(x...) ({ \ | 253 | #define printk_once(x...) ({ \ |
254 | static bool __print_once = true; \ | 254 | static bool __print_once; \ |
255 | \ | 255 | \ |
256 | if (__print_once) { \ | 256 | if (!__print_once) { \ |
257 | __print_once = false; \ | 257 | __print_once = true; \ |
258 | printk(x); \ | 258 | printk(x); \ |
259 | } \ | 259 | } \ |
260 | }) | 260 | }) |
@@ -397,15 +397,58 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
397 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 397 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
398 | #elif defined(CONFIG_DYNAMIC_DEBUG) | 398 | #elif defined(CONFIG_DYNAMIC_DEBUG) |
399 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | 399 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
400 | #define pr_debug(fmt, ...) do { \ | 400 | #define pr_debug(fmt, ...) \ |
401 | dynamic_pr_debug(fmt, ##__VA_ARGS__); \ | 401 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
402 | } while (0) | ||
403 | #else | 402 | #else |
404 | #define pr_debug(fmt, ...) \ | 403 | #define pr_debug(fmt, ...) \ |
405 | ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) | 404 | ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) |
406 | #endif | 405 | #endif |
407 | 406 | ||
408 | /* | 407 | /* |
408 | * ratelimited messages with local ratelimit_state, | ||
409 | * no local ratelimit_state used in the !PRINTK case | ||
410 | */ | ||
411 | #ifdef CONFIG_PRINTK | ||
412 | #define printk_ratelimited(fmt, ...) ({ \ | ||
413 | static struct ratelimit_state _rs = { \ | ||
414 | .interval = DEFAULT_RATELIMIT_INTERVAL, \ | ||
415 | .burst = DEFAULT_RATELIMIT_BURST, \ | ||
416 | }; \ | ||
417 | \ | ||
418 | if (!__ratelimit(&_rs)) \ | ||
419 | printk(fmt, ##__VA_ARGS__); \ | ||
420 | }) | ||
421 | #else | ||
422 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
423 | #define printk_ratelimited printk | ||
424 | #endif | ||
425 | |||
426 | #define pr_emerg_ratelimited(fmt, ...) \ | ||
427 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) | ||
428 | #define pr_alert_ratelimited(fmt, ...) \ | ||
429 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) | ||
430 | #define pr_crit_ratelimited(fmt, ...) \ | ||
431 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | ||
432 | #define pr_err_ratelimited(fmt, ...) \ | ||
433 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ||
434 | #define pr_warning_ratelimited(fmt, ...) \ | ||
435 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | ||
436 | #define pr_notice_ratelimited(fmt, ...) \ | ||
437 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | ||
438 | #define pr_info_ratelimited(fmt, ...) \ | ||
439 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ||
440 | /* no pr_cont_ratelimited, don't do that... */ | ||
441 | /* If you are writing a driver, please use dev_dbg instead */ | ||
442 | #if defined(DEBUG) | ||
443 | #define pr_debug_ratelimited(fmt, ...) \ | ||
444 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
445 | #else | ||
446 | #define pr_debug_ratelimited(fmt, ...) \ | ||
447 | ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \ | ||
448 | ##__VA_ARGS__); 0; }) | ||
449 | #endif | ||
450 | |||
451 | /* | ||
409 | * General tracing related utility functions - trace_printk(), | 452 | * General tracing related utility functions - trace_printk(), |
410 | * tracing_on/tracing_off and tracing_start()/tracing_stop | 453 | * tracing_on/tracing_off and tracing_start()/tracing_stop |
411 | * | 454 | * |
@@ -492,6 +535,8 @@ extern int | |||
492 | __trace_printk(unsigned long ip, const char *fmt, ...) | 535 | __trace_printk(unsigned long ip, const char *fmt, ...) |
493 | __attribute__ ((format (printf, 2, 3))); | 536 | __attribute__ ((format (printf, 2, 3))); |
494 | 537 | ||
538 | extern void trace_dump_stack(void); | ||
539 | |||
495 | /* | 540 | /* |
496 | * The double __builtin_constant_p is because gcc will give us an error | 541 | * The double __builtin_constant_p is because gcc will give us an error |
497 | * if we try to allocate the static variable to fmt if it is not a | 542 | * if we try to allocate the static variable to fmt if it is not a |
@@ -525,6 +570,7 @@ trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | |||
525 | static inline void tracing_start(void) { } | 570 | static inline void tracing_start(void) { } |
526 | static inline void tracing_stop(void) { } | 571 | static inline void tracing_stop(void) { } |
527 | static inline void ftrace_off_permanent(void) { } | 572 | static inline void ftrace_off_permanent(void) { } |
573 | static inline void trace_dump_stack(void) { } | ||
528 | static inline int | 574 | static inline int |
529 | trace_printk(const char *fmt, ...) | 575 | trace_printk(const char *fmt, ...) |
530 | { | 576 | { |
@@ -688,6 +734,10 @@ struct sysinfo { | |||
688 | /* Force a compilation error if condition is constant and true */ | 734 | /* Force a compilation error if condition is constant and true */ |
689 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) | 735 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) |
690 | 736 | ||
737 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
738 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
739 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
740 | |||
691 | /* Force a compilation error if condition is true, but also produce a | 741 | /* Force a compilation error if condition is true, but also produce a |
692 | result (of value 0 and type size_t), so the expression can be used | 742 | result (of value 0 and type size_t), so the expression can be used |
693 | e.g. in a structure initializer (or where-ever else comma expressions | 743 | e.g. in a structure initializer (or where-ever else comma expressions |
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h index a53e932f80fb..9c2683929fd3 100644 --- a/include/linux/kernelcapi.h +++ b/include/linux/kernelcapi.h | |||
@@ -48,9 +48,7 @@ typedef struct kcapi_carddef { | |||
48 | #include <linux/list.h> | 48 | #include <linux/list.h> |
49 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
50 | #include <linux/workqueue.h> | 50 | #include <linux/workqueue.h> |
51 | 51 | #include <linux/notifier.h> | |
52 | #define KCI_CONTRUP 0 /* arg: struct capi_profile */ | ||
53 | #define KCI_CONTRDOWN 1 /* arg: NULL */ | ||
54 | 52 | ||
55 | struct capi20_appl { | 53 | struct capi20_appl { |
56 | u16 applid; | 54 | u16 applid; |
@@ -67,11 +65,6 @@ struct capi20_appl { | |||
67 | struct sk_buff_head recv_queue; | 65 | struct sk_buff_head recv_queue; |
68 | struct work_struct recv_work; | 66 | struct work_struct recv_work; |
69 | int release_in_progress; | 67 | int release_in_progress; |
70 | |||
71 | /* ugly hack to allow for notification of added/removed | ||
72 | * controllers. The Right Way (tm) is known. XXX | ||
73 | */ | ||
74 | void (*callback) (unsigned int cmd, __u32 contr, void *data); | ||
75 | }; | 68 | }; |
76 | 69 | ||
77 | u16 capi20_isinstalled(void); | 70 | u16 capi20_isinstalled(void); |
@@ -84,11 +77,11 @@ u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); | |||
84 | u16 capi20_get_profile(u32 contr, struct capi_profile *profp); | 77 | u16 capi20_get_profile(u32 contr, struct capi_profile *profp); |
85 | int capi20_manufacturer(unsigned int cmd, void __user *data); | 78 | int capi20_manufacturer(unsigned int cmd, void __user *data); |
86 | 79 | ||
87 | /* temporary hack XXX */ | 80 | #define CAPICTR_UP 0 |
88 | void capi20_set_callback(struct capi20_appl *ap, | 81 | #define CAPICTR_DOWN 1 |
89 | void (*callback) (unsigned int cmd, __u32 contr, void *data)); | ||
90 | |||
91 | 82 | ||
83 | int register_capictr_notifier(struct notifier_block *nb); | ||
84 | int unregister_capictr_notifier(struct notifier_block *nb); | ||
92 | 85 | ||
93 | #define CAPI_NOERROR 0x0000 | 86 | #define CAPI_NOERROR 0x0000 |
94 | 87 | ||
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index adc34f2c6eff..c356b6914ffd 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -206,6 +206,8 @@ extern size_t vmcoreinfo_max_size; | |||
206 | 206 | ||
207 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, | 207 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, |
208 | unsigned long long *crash_size, unsigned long long *crash_base); | 208 | unsigned long long *crash_size, unsigned long long *crash_base); |
209 | int crash_shrink_memory(unsigned long new_size); | ||
210 | size_t crash_get_memory_size(void); | ||
209 | 211 | ||
210 | #else /* !CONFIG_KEXEC */ | 212 | #else /* !CONFIG_KEXEC */ |
211 | struct pt_regs; | 213 | struct pt_regs; |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index ad6bdf5a5970..bc0fc795bd35 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * A simple kernel FIFO implementation. | 2 | * A generic kernel FIFO implementation. |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> | ||
4 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> | 5 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -18,6 +19,25 @@ | |||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | * | 20 | * |
20 | */ | 21 | */ |
22 | |||
23 | /* | ||
24 | * Howto porting drivers to the new generic fifo API: | ||
25 | * | ||
26 | * - Modify the declaration of the "struct kfifo *" object into a | ||
27 | * in-place "struct kfifo" object | ||
28 | * - Init the in-place object with kfifo_alloc() or kfifo_init() | ||
29 | * Note: The address of the in-place "struct kfifo" object must be | ||
30 | * passed as the first argument to this functions | ||
31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | ||
32 | * into kfifo_out | ||
33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | ||
34 | * into kfifo_out_locked | ||
35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | ||
36 | * must be passed now to the kfifo_in_locked and kfifo_out_locked | ||
37 | * as the last parameter. | ||
38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | ||
39 | */ | ||
40 | |||
21 | #ifndef _LINUX_KFIFO_H | 41 | #ifndef _LINUX_KFIFO_H |
22 | #define _LINUX_KFIFO_H | 42 | #define _LINUX_KFIFO_H |
23 | 43 | ||
@@ -29,26 +49,82 @@ struct kfifo { | |||
29 | unsigned int size; /* the size of the allocated buffer */ | 49 | unsigned int size; /* the size of the allocated buffer */ |
30 | unsigned int in; /* data is added at offset (in % size) */ | 50 | unsigned int in; /* data is added at offset (in % size) */ |
31 | unsigned int out; /* data is extracted from off. (out % size) */ | 51 | unsigned int out; /* data is extracted from off. (out % size) */ |
32 | spinlock_t *lock; /* protects concurrent modifications */ | ||
33 | }; | 52 | }; |
34 | 53 | ||
35 | extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, | 54 | /* |
36 | gfp_t gfp_mask, spinlock_t *lock); | 55 | * Macros for declaration and initialization of the kfifo datatype |
37 | extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, | 56 | */ |
38 | spinlock_t *lock); | 57 | |
58 | /* helper macro */ | ||
59 | #define __kfifo_initializer(s, b) \ | ||
60 | (struct kfifo) { \ | ||
61 | .size = s, \ | ||
62 | .in = 0, \ | ||
63 | .out = 0, \ | ||
64 | .buffer = b \ | ||
65 | } | ||
66 | |||
67 | /** | ||
68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer | ||
69 | * @name: name of the declared kfifo datatype | ||
70 | * @size: size of the fifo buffer. Must be a power of two. | ||
71 | * | ||
72 | * Note1: the macro can be used inside struct or union declaration | ||
73 | * Note2: the macro creates two objects: | ||
74 | * A kfifo object with the given name and a buffer for the kfifo | ||
75 | * object named name##kfifo_buffer | ||
76 | */ | ||
77 | #define DECLARE_KFIFO(name, size) \ | ||
78 | union { \ | ||
79 | struct kfifo name; \ | ||
80 | unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \ | ||
81 | } | ||
82 | |||
83 | /** | ||
84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO | ||
85 | * @name: name of the declared kfifo datatype | ||
86 | */ | ||
87 | #define INIT_KFIFO(name) \ | ||
88 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | ||
89 | sizeof(struct kfifo), name##kfifo_buffer) | ||
90 | |||
91 | /** | ||
92 | * DEFINE_KFIFO - macro to define and initialize a kfifo | ||
93 | * @name: name of the declared kfifo datatype | ||
94 | * @size: size of the fifo buffer. Must be a power of two. | ||
95 | * | ||
96 | * Note1: the macro can be used for global and local kfifo data type variables | ||
97 | * Note2: the macro creates two objects: | ||
98 | * A kfifo object with the given name and a buffer for the kfifo | ||
99 | * object named name##kfifo_buffer | ||
100 | */ | ||
101 | #define DEFINE_KFIFO(name, size) \ | ||
102 | unsigned char name##kfifo_buffer[size]; \ | ||
103 | struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) | ||
104 | |||
105 | #undef __kfifo_initializer | ||
106 | |||
107 | extern void kfifo_init(struct kfifo *fifo, void *buffer, | ||
108 | unsigned int size); | ||
109 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | ||
110 | gfp_t gfp_mask); | ||
39 | extern void kfifo_free(struct kfifo *fifo); | 111 | extern void kfifo_free(struct kfifo *fifo); |
40 | extern unsigned int __kfifo_put(struct kfifo *fifo, | 112 | extern unsigned int kfifo_in(struct kfifo *fifo, |
41 | const unsigned char *buffer, unsigned int len); | 113 | const void *from, unsigned int len); |
42 | extern unsigned int __kfifo_get(struct kfifo *fifo, | 114 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
43 | unsigned char *buffer, unsigned int len); | 115 | void *to, unsigned int len); |
116 | extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo, | ||
117 | void *to, unsigned int len, unsigned offset); | ||
44 | 118 | ||
45 | /** | 119 | /** |
46 | * __kfifo_reset - removes the entire FIFO contents, no locking version | 120 | * kfifo_initialized - Check if kfifo is initialized. |
47 | * @fifo: the fifo to be emptied. | 121 | * @fifo: fifo to check |
122 | * Return %true if FIFO is initialized, otherwise %false. | ||
123 | * Assumes the fifo was 0 before. | ||
48 | */ | 124 | */ |
49 | static inline void __kfifo_reset(struct kfifo *fifo) | 125 | static inline bool kfifo_initialized(struct kfifo *fifo) |
50 | { | 126 | { |
51 | fifo->in = fifo->out = 0; | 127 | return fifo->buffer != NULL; |
52 | } | 128 | } |
53 | 129 | ||
54 | /** | 130 | /** |
@@ -57,96 +133,484 @@ static inline void __kfifo_reset(struct kfifo *fifo) | |||
57 | */ | 133 | */ |
58 | static inline void kfifo_reset(struct kfifo *fifo) | 134 | static inline void kfifo_reset(struct kfifo *fifo) |
59 | { | 135 | { |
60 | unsigned long flags; | 136 | fifo->in = fifo->out = 0; |
137 | } | ||
61 | 138 | ||
62 | spin_lock_irqsave(fifo->lock, flags); | 139 | /** |
140 | * kfifo_reset_out - skip FIFO contents | ||
141 | * @fifo: the fifo to be emptied. | ||
142 | */ | ||
143 | static inline void kfifo_reset_out(struct kfifo *fifo) | ||
144 | { | ||
145 | smp_mb(); | ||
146 | fifo->out = fifo->in; | ||
147 | } | ||
63 | 148 | ||
64 | __kfifo_reset(fifo); | 149 | /** |
150 | * kfifo_size - returns the size of the fifo in bytes | ||
151 | * @fifo: the fifo to be used. | ||
152 | */ | ||
153 | static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) | ||
154 | { | ||
155 | return fifo->size; | ||
156 | } | ||
65 | 157 | ||
66 | spin_unlock_irqrestore(fifo->lock, flags); | 158 | /** |
159 | * kfifo_len - returns the number of used bytes in the FIFO | ||
160 | * @fifo: the fifo to be used. | ||
161 | */ | ||
162 | static inline unsigned int kfifo_len(struct kfifo *fifo) | ||
163 | { | ||
164 | register unsigned int out; | ||
165 | |||
166 | out = fifo->out; | ||
167 | smp_rmb(); | ||
168 | return fifo->in - out; | ||
67 | } | 169 | } |
68 | 170 | ||
69 | /** | 171 | /** |
70 | * kfifo_put - puts some data into the FIFO | 172 | * kfifo_is_empty - returns true if the fifo is empty |
71 | * @fifo: the fifo to be used. | 173 | * @fifo: the fifo to be used. |
72 | * @buffer: the data to be added. | 174 | */ |
73 | * @len: the length of the data to be added. | 175 | static inline __must_check int kfifo_is_empty(struct kfifo *fifo) |
176 | { | ||
177 | return fifo->in == fifo->out; | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * kfifo_is_full - returns true if the fifo is full | ||
182 | * @fifo: the fifo to be used. | ||
183 | */ | ||
184 | static inline __must_check int kfifo_is_full(struct kfifo *fifo) | ||
185 | { | ||
186 | return kfifo_len(fifo) == kfifo_size(fifo); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * kfifo_avail - returns the number of bytes available in the FIFO | ||
191 | * @fifo: the fifo to be used. | ||
192 | */ | ||
193 | static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) | ||
194 | { | ||
195 | return kfifo_size(fifo) - kfifo_len(fifo); | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking | ||
200 | * @fifo: the fifo to be used. | ||
201 | * @from: the data to be added. | ||
202 | * @n: the length of the data to be added. | ||
203 | * @lock: pointer to the spinlock to use for locking. | ||
74 | * | 204 | * |
75 | * This function copies at most @len bytes from the @buffer into | 205 | * This function copies at most @len bytes from the @from buffer into |
76 | * the FIFO depending on the free space, and returns the number of | 206 | * the FIFO depending on the free space, and returns the number of |
77 | * bytes copied. | 207 | * bytes copied. |
78 | */ | 208 | */ |
79 | static inline unsigned int kfifo_put(struct kfifo *fifo, | 209 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, |
80 | const unsigned char *buffer, unsigned int len) | 210 | const void *from, unsigned int n, spinlock_t *lock) |
81 | { | 211 | { |
82 | unsigned long flags; | 212 | unsigned long flags; |
83 | unsigned int ret; | 213 | unsigned int ret; |
84 | 214 | ||
85 | spin_lock_irqsave(fifo->lock, flags); | 215 | spin_lock_irqsave(lock, flags); |
86 | 216 | ||
87 | ret = __kfifo_put(fifo, buffer, len); | 217 | ret = kfifo_in(fifo, from, n); |
88 | 218 | ||
89 | spin_unlock_irqrestore(fifo->lock, flags); | 219 | spin_unlock_irqrestore(lock, flags); |
90 | 220 | ||
91 | return ret; | 221 | return ret; |
92 | } | 222 | } |
93 | 223 | ||
94 | /** | 224 | /** |
95 | * kfifo_get - gets some data from the FIFO | 225 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
96 | * @fifo: the fifo to be used. | 226 | * @fifo: the fifo to be used. |
97 | * @buffer: where the data must be copied. | 227 | * @to: where the data must be copied. |
98 | * @len: the size of the destination buffer. | 228 | * @n: the size of the destination buffer. |
229 | * @lock: pointer to the spinlock to use for locking. | ||
99 | * | 230 | * |
100 | * This function copies at most @len bytes from the FIFO into the | 231 | * This function copies at most @len bytes from the FIFO into the |
101 | * @buffer and returns the number of copied bytes. | 232 | * @to buffer and returns the number of copied bytes. |
102 | */ | 233 | */ |
103 | static inline unsigned int kfifo_get(struct kfifo *fifo, | 234 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
104 | unsigned char *buffer, unsigned int len) | 235 | void *to, unsigned int n, spinlock_t *lock) |
105 | { | 236 | { |
106 | unsigned long flags; | 237 | unsigned long flags; |
107 | unsigned int ret; | 238 | unsigned int ret; |
108 | 239 | ||
109 | spin_lock_irqsave(fifo->lock, flags); | 240 | spin_lock_irqsave(lock, flags); |
241 | |||
242 | ret = kfifo_out(fifo, to, n); | ||
243 | |||
244 | spin_unlock_irqrestore(lock, flags); | ||
245 | |||
246 | return ret; | ||
247 | } | ||
248 | |||
249 | extern void kfifo_skip(struct kfifo *fifo, unsigned int len); | ||
250 | |||
251 | extern __must_check int kfifo_from_user(struct kfifo *fifo, | ||
252 | const void __user *from, unsigned int n, unsigned *lenout); | ||
253 | |||
254 | extern __must_check int kfifo_to_user(struct kfifo *fifo, | ||
255 | void __user *to, unsigned int n, unsigned *lenout); | ||
256 | |||
257 | /* | ||
258 | * __kfifo_add_out internal helper function for updating the out offset | ||
259 | */ | ||
260 | static inline void __kfifo_add_out(struct kfifo *fifo, | ||
261 | unsigned int off) | ||
262 | { | ||
263 | smp_mb(); | ||
264 | fifo->out += off; | ||
265 | } | ||
266 | |||
267 | /* | ||
268 | * __kfifo_add_in internal helper function for updating the in offset | ||
269 | */ | ||
270 | static inline void __kfifo_add_in(struct kfifo *fifo, | ||
271 | unsigned int off) | ||
272 | { | ||
273 | smp_wmb(); | ||
274 | fifo->in += off; | ||
275 | } | ||
276 | |||
277 | /* | ||
278 | * __kfifo_off internal helper function for calculating the index of a | ||
279 | * given offeset | ||
280 | */ | ||
281 | static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | ||
282 | { | ||
283 | return off & (fifo->size - 1); | ||
284 | } | ||
285 | |||
286 | /* | ||
287 | * __kfifo_peek_n internal helper function for determinate the length of | ||
288 | * the next record in the fifo | ||
289 | */ | ||
290 | static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, | ||
291 | unsigned int recsize) | ||
292 | { | ||
293 | #define __KFIFO_GET(fifo, off, shift) \ | ||
294 | ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) | ||
295 | |||
296 | unsigned int l; | ||
297 | |||
298 | l = __KFIFO_GET(fifo, 0, 0); | ||
299 | |||
300 | if (--recsize) | ||
301 | l |= __KFIFO_GET(fifo, 1, 8); | ||
302 | |||
303 | return l; | ||
304 | #undef __KFIFO_GET | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * __kfifo_poke_n internal helper function for storing the length of | ||
309 | * the next record into the fifo | ||
310 | */ | ||
311 | static inline void __kfifo_poke_n(struct kfifo *fifo, | ||
312 | unsigned int recsize, unsigned int n) | ||
313 | { | ||
314 | #define __KFIFO_PUT(fifo, off, val, shift) \ | ||
315 | ( \ | ||
316 | (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ | ||
317 | (unsigned char)((val) >> (shift)) \ | ||
318 | ) | ||
319 | |||
320 | __KFIFO_PUT(fifo, 0, n, 0); | ||
321 | |||
322 | if (--recsize) | ||
323 | __KFIFO_PUT(fifo, 1, n, 8); | ||
324 | #undef __KFIFO_PUT | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * __kfifo_in_... internal functions for put date into the fifo | ||
329 | * do not call it directly, use kfifo_in_rec() instead | ||
330 | */ | ||
331 | extern unsigned int __kfifo_in_n(struct kfifo *fifo, | ||
332 | const void *from, unsigned int n, unsigned int recsize); | ||
110 | 333 | ||
111 | ret = __kfifo_get(fifo, buffer, len); | 334 | extern unsigned int __kfifo_in_generic(struct kfifo *fifo, |
335 | const void *from, unsigned int n, unsigned int recsize); | ||
112 | 336 | ||
113 | /* | 337 | static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, |
114 | * optimization: if the FIFO is empty, set the indices to 0 | 338 | const void *from, unsigned int n, unsigned int recsize) |
115 | * so we don't wrap the next time | 339 | { |
116 | */ | 340 | unsigned int ret; |
117 | if (fifo->in == fifo->out) | ||
118 | fifo->in = fifo->out = 0; | ||
119 | 341 | ||
120 | spin_unlock_irqrestore(fifo->lock, flags); | 342 | ret = __kfifo_in_n(fifo, from, n, recsize); |
121 | 343 | ||
344 | if (likely(ret == 0)) { | ||
345 | if (recsize) | ||
346 | __kfifo_poke_n(fifo, recsize, n); | ||
347 | __kfifo_add_in(fifo, n + recsize); | ||
348 | } | ||
122 | return ret; | 349 | return ret; |
123 | } | 350 | } |
124 | 351 | ||
125 | /** | 352 | /** |
126 | * __kfifo_len - returns the number of bytes available in the FIFO, no locking version | 353 | * kfifo_in_rec - puts some record data into the FIFO |
127 | * @fifo: the fifo to be used. | 354 | * @fifo: the fifo to be used. |
355 | * @from: the data to be added. | ||
356 | * @n: the length of the data to be added. | ||
357 | * @recsize: size of record field | ||
358 | * | ||
359 | * This function copies @n bytes from the @from into the FIFO and returns | ||
360 | * the number of bytes which cannot be copied. | ||
361 | * A returned value greater than the @n value means that the record doesn't | ||
362 | * fit into the buffer. | ||
363 | * | ||
364 | * Note that with only one concurrent reader and one concurrent | ||
365 | * writer, you don't need extra locking to use these functions. | ||
366 | */ | ||
367 | static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, | ||
368 | void *from, unsigned int n, unsigned int recsize) | ||
369 | { | ||
370 | if (!__builtin_constant_p(recsize)) | ||
371 | return __kfifo_in_generic(fifo, from, n, recsize); | ||
372 | return __kfifo_in_rec(fifo, from, n, recsize); | ||
373 | } | ||
374 | |||
375 | /* | ||
376 | * __kfifo_out_... internal functions for get date from the fifo | ||
377 | * do not call it directly, use kfifo_out_rec() instead | ||
128 | */ | 378 | */ |
129 | static inline unsigned int __kfifo_len(struct kfifo *fifo) | 379 | extern unsigned int __kfifo_out_n(struct kfifo *fifo, |
380 | void *to, unsigned int reclen, unsigned int recsize); | ||
381 | |||
382 | extern unsigned int __kfifo_out_generic(struct kfifo *fifo, | ||
383 | void *to, unsigned int n, | ||
384 | unsigned int recsize, unsigned int *total); | ||
385 | |||
386 | static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, | ||
387 | void *to, unsigned int n, unsigned int recsize, | ||
388 | unsigned int *total) | ||
130 | { | 389 | { |
131 | return fifo->in - fifo->out; | 390 | unsigned int l; |
391 | |||
392 | if (!recsize) { | ||
393 | l = n; | ||
394 | if (total) | ||
395 | *total = l; | ||
396 | } else { | ||
397 | l = __kfifo_peek_n(fifo, recsize); | ||
398 | if (total) | ||
399 | *total = l; | ||
400 | if (n < l) | ||
401 | return l; | ||
402 | } | ||
403 | |||
404 | return __kfifo_out_n(fifo, to, l, recsize); | ||
132 | } | 405 | } |
133 | 406 | ||
134 | /** | 407 | /** |
135 | * kfifo_len - returns the number of bytes available in the FIFO | 408 | * kfifo_out_rec - gets some record data from the FIFO |
136 | * @fifo: the fifo to be used. | 409 | * @fifo: the fifo to be used. |
410 | * @to: where the data must be copied. | ||
411 | * @n: the size of the destination buffer. | ||
412 | * @recsize: size of record field | ||
413 | * @total: pointer where the total number of to copied bytes should stored | ||
414 | * | ||
415 | * This function copies at most @n bytes from the FIFO to @to and returns the | ||
416 | * number of bytes which cannot be copied. | ||
417 | * A returned value greater than the @n value means that the record doesn't | ||
418 | * fit into the @to buffer. | ||
419 | * | ||
420 | * Note that with only one concurrent reader and one concurrent | ||
421 | * writer, you don't need extra locking to use these functions. | ||
137 | */ | 422 | */ |
138 | static inline unsigned int kfifo_len(struct kfifo *fifo) | 423 | static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, |
424 | void *to, unsigned int n, unsigned int recsize, | ||
425 | unsigned int *total) | ||
426 | |||
139 | { | 427 | { |
140 | unsigned long flags; | 428 | if (!__builtin_constant_p(recsize)) |
141 | unsigned int ret; | 429 | return __kfifo_out_generic(fifo, to, n, recsize, total); |
430 | return __kfifo_out_rec(fifo, to, n, recsize, total); | ||
431 | } | ||
142 | 432 | ||
143 | spin_lock_irqsave(fifo->lock, flags); | 433 | /* |
434 | * __kfifo_from_user_... internal functions for transfer from user space into | ||
435 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | ||
436 | */ | ||
437 | extern unsigned int __kfifo_from_user_n(struct kfifo *fifo, | ||
438 | const void __user *from, unsigned int n, unsigned int recsize); | ||
439 | |||
440 | extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, | ||
441 | const void __user *from, unsigned int n, unsigned int recsize); | ||
144 | 442 | ||
145 | ret = __kfifo_len(fifo); | 443 | static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, |
444 | const void __user *from, unsigned int n, unsigned int recsize) | ||
445 | { | ||
446 | unsigned int ret; | ||
146 | 447 | ||
147 | spin_unlock_irqrestore(fifo->lock, flags); | 448 | ret = __kfifo_from_user_n(fifo, from, n, recsize); |
148 | 449 | ||
450 | if (likely(ret == 0)) { | ||
451 | if (recsize) | ||
452 | __kfifo_poke_n(fifo, recsize, n); | ||
453 | __kfifo_add_in(fifo, n + recsize); | ||
454 | } | ||
149 | return ret; | 455 | return ret; |
150 | } | 456 | } |
151 | 457 | ||
458 | /** | ||
459 | * kfifo_from_user_rec - puts some data from user space into the FIFO | ||
460 | * @fifo: the fifo to be used. | ||
461 | * @from: pointer to the data to be added. | ||
462 | * @n: the length of the data to be added. | ||
463 | * @recsize: size of record field | ||
464 | * | ||
465 | * This function copies @n bytes from the @from into the | ||
466 | * FIFO and returns the number of bytes which cannot be copied. | ||
467 | * | ||
468 | * If the returned value is equal or less the @n value, the copy_from_user() | ||
469 | * functions has failed. Otherwise the record doesn't fit into the buffer. | ||
470 | * | ||
471 | * Note that with only one concurrent reader and one concurrent | ||
472 | * writer, you don't need extra locking to use these functions. | ||
473 | */ | ||
474 | static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | ||
475 | const void __user *from, unsigned int n, unsigned int recsize) | ||
476 | { | ||
477 | if (!__builtin_constant_p(recsize)) | ||
478 | return __kfifo_from_user_generic(fifo, from, n, recsize); | ||
479 | return __kfifo_from_user_rec(fifo, from, n, recsize); | ||
480 | } | ||
481 | |||
482 | /* | ||
483 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | ||
484 | * do not call it directly, use kfifo_to_user_rec() instead | ||
485 | */ | ||
486 | extern unsigned int __kfifo_to_user_n(struct kfifo *fifo, | ||
487 | void __user *to, unsigned int n, unsigned int reclen, | ||
488 | unsigned int recsize); | ||
489 | |||
490 | extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, | ||
491 | void __user *to, unsigned int n, unsigned int recsize, | ||
492 | unsigned int *total); | ||
493 | |||
494 | static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, | ||
495 | void __user *to, unsigned int n, | ||
496 | unsigned int recsize, unsigned int *total) | ||
497 | { | ||
498 | unsigned int l; | ||
499 | |||
500 | if (!recsize) { | ||
501 | l = n; | ||
502 | if (total) | ||
503 | *total = l; | ||
504 | } else { | ||
505 | l = __kfifo_peek_n(fifo, recsize); | ||
506 | if (total) | ||
507 | *total = l; | ||
508 | if (n < l) | ||
509 | return l; | ||
510 | } | ||
511 | |||
512 | return __kfifo_to_user_n(fifo, to, n, l, recsize); | ||
513 | } | ||
514 | |||
515 | /** | ||
516 | * kfifo_to_user_rec - gets data from the FIFO and write it to user space | ||
517 | * @fifo: the fifo to be used. | ||
518 | * @to: where the data must be copied. | ||
519 | * @n: the size of the destination buffer. | ||
520 | * @recsize: size of record field | ||
521 | * @total: pointer where the total number of to copied bytes should stored | ||
522 | * | ||
523 | * This function copies at most @n bytes from the FIFO to the @to. | ||
524 | * In case of an error, the function returns the number of bytes which cannot | ||
525 | * be copied. | ||
526 | * If the returned value is equal or less the @n value, the copy_to_user() | ||
527 | * functions has failed. Otherwise the record doesn't fit into the @to buffer. | ||
528 | * | ||
529 | * Note that with only one concurrent reader and one concurrent | ||
530 | * writer, you don't need extra locking to use these functions. | ||
531 | */ | ||
532 | static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | ||
533 | void __user *to, unsigned int n, unsigned int recsize, | ||
534 | unsigned int *total) | ||
535 | { | ||
536 | if (!__builtin_constant_p(recsize)) | ||
537 | return __kfifo_to_user_generic(fifo, to, n, recsize, total); | ||
538 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | ||
539 | } | ||
540 | |||
541 | /* | ||
542 | * __kfifo_peek_... internal functions for peek into the next fifo record | ||
543 | * do not call it directly, use kfifo_peek_rec() instead | ||
544 | */ | ||
545 | extern unsigned int __kfifo_peek_generic(struct kfifo *fifo, | ||
546 | unsigned int recsize); | ||
547 | |||
548 | /** | ||
549 | * kfifo_peek_rec - gets the size of the next FIFO record data | ||
550 | * @fifo: the fifo to be used. | ||
551 | * @recsize: size of record field | ||
552 | * | ||
553 | * This function returns the size of the next FIFO record in number of bytes | ||
554 | */ | ||
555 | static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | ||
556 | unsigned int recsize) | ||
557 | { | ||
558 | if (!__builtin_constant_p(recsize)) | ||
559 | return __kfifo_peek_generic(fifo, recsize); | ||
560 | if (!recsize) | ||
561 | return kfifo_len(fifo); | ||
562 | return __kfifo_peek_n(fifo, recsize); | ||
563 | } | ||
564 | |||
565 | /* | ||
566 | * __kfifo_skip_... internal functions for skip the next fifo record | ||
567 | * do not call it directly, use kfifo_skip_rec() instead | ||
568 | */ | ||
569 | extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize); | ||
570 | |||
571 | static inline void __kfifo_skip_rec(struct kfifo *fifo, | ||
572 | unsigned int recsize) | ||
573 | { | ||
574 | unsigned int l; | ||
575 | |||
576 | if (recsize) { | ||
577 | l = __kfifo_peek_n(fifo, recsize); | ||
578 | |||
579 | if (l + recsize <= kfifo_len(fifo)) { | ||
580 | __kfifo_add_out(fifo, l + recsize); | ||
581 | return; | ||
582 | } | ||
583 | } | ||
584 | kfifo_reset_out(fifo); | ||
585 | } | ||
586 | |||
587 | /** | ||
588 | * kfifo_skip_rec - skip the next fifo out record | ||
589 | * @fifo: the fifo to be used. | ||
590 | * @recsize: size of record field | ||
591 | * | ||
592 | * This function skips the next FIFO record | ||
593 | */ | ||
594 | static inline void kfifo_skip_rec(struct kfifo *fifo, | ||
595 | unsigned int recsize) | ||
596 | { | ||
597 | if (!__builtin_constant_p(recsize)) | ||
598 | __kfifo_skip_generic(fifo, recsize); | ||
599 | else | ||
600 | __kfifo_skip_rec(fifo, recsize); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * kfifo_avail_rec - returns the number of bytes available in a record FIFO | ||
605 | * @fifo: the fifo to be used. | ||
606 | * @recsize: size of record field | ||
607 | */ | ||
608 | static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo, | ||
609 | unsigned int recsize) | ||
610 | { | ||
611 | unsigned int l = kfifo_size(fifo) - kfifo_len(fifo); | ||
612 | |||
613 | return (l > recsize) ? l - recsize : 0; | ||
614 | } | ||
615 | |||
152 | #endif | 616 | #endif |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 6adcc297e354..19ec41a183f5 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
@@ -29,8 +29,7 @@ struct pt_regs; | |||
29 | * | 29 | * |
30 | * On some architectures it is required to skip a breakpoint | 30 | * On some architectures it is required to skip a breakpoint |
31 | * exception when it occurs after a breakpoint has been removed. | 31 | * exception when it occurs after a breakpoint has been removed. |
32 | * This can be implemented in the architecture specific portion of | 32 | * This can be implemented in the architecture specific portion of kgdb. |
33 | * for kgdb. | ||
34 | */ | 33 | */ |
35 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | 34 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); |
36 | 35 | ||
@@ -65,7 +64,7 @@ struct uart_port; | |||
65 | /** | 64 | /** |
66 | * kgdb_breakpoint - compiled in breakpoint | 65 | * kgdb_breakpoint - compiled in breakpoint |
67 | * | 66 | * |
68 | * This will be impelmented a static inline per architecture. This | 67 | * This will be implemented as a static inline per architecture. This |
69 | * function is called by the kgdb core to execute an architecture | 68 | * function is called by the kgdb core to execute an architecture |
70 | * specific trap to cause kgdb to enter the exception processing. | 69 | * specific trap to cause kgdb to enter the exception processing. |
71 | * | 70 | * |
@@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
190 | * @flags: Current IRQ state | 189 | * @flags: Current IRQ state |
191 | * | 190 | * |
192 | * On SMP systems, we need to get the attention of the other CPUs | 191 | * On SMP systems, we need to get the attention of the other CPUs |
193 | * and get them be in a known state. This should do what is needed | 192 | * and get them into a known state. This should do what is needed |
194 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, | 193 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
195 | * the NMI approach is not used for rounding up all the CPUs. For example, | 194 | * the NMI approach is not used for rounding up all the CPUs. For example, |
196 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In | 195 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index e880d4cf9e22..08d7dc4ddf40 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h | |||
@@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address); | |||
36 | 36 | ||
37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); | 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); |
38 | 38 | ||
39 | /* | ||
40 | * Bitfield annotations | ||
41 | * | ||
42 | * How to use: If you have a struct using bitfields, for example | ||
43 | * | ||
44 | * struct a { | ||
45 | * int x:8, y:8; | ||
46 | * }; | ||
47 | * | ||
48 | * then this should be rewritten as | ||
49 | * | ||
50 | * struct a { | ||
51 | * kmemcheck_bitfield_begin(flags); | ||
52 | * int x:8, y:8; | ||
53 | * kmemcheck_bitfield_end(flags); | ||
54 | * }; | ||
55 | * | ||
56 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
57 | * beginning and end, respectively, of the bitfield (and things like | ||
58 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
59 | * fields should be annotated: | ||
60 | * | ||
61 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
62 | * kmemcheck_annotate_bitfield(a, flags); | ||
63 | */ | ||
64 | #define kmemcheck_bitfield_begin(name) \ | ||
65 | int name##_begin[0]; | ||
66 | |||
67 | #define kmemcheck_bitfield_end(name) \ | ||
68 | int name##_end[0]; | ||
69 | |||
70 | #define kmemcheck_annotate_bitfield(ptr, name) \ | ||
71 | do { \ | ||
72 | int _n; \ | ||
73 | \ | ||
74 | if (!ptr) \ | ||
75 | break; \ | ||
76 | \ | ||
77 | _n = (long) &((ptr)->name##_end) \ | ||
78 | - (long) &((ptr)->name##_begin); \ | ||
79 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
80 | \ | ||
81 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
82 | } while (0) | ||
83 | |||
84 | #define kmemcheck_annotate_variable(var) \ | ||
85 | do { \ | ||
86 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
87 | } while (0) \ | ||
88 | |||
39 | #else | 89 | #else |
40 | #define kmemcheck_enabled 0 | 90 | #define kmemcheck_enabled 0 |
41 | 91 | ||
@@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) | |||
106 | return true; | 156 | return true; |
107 | } | 157 | } |
108 | 158 | ||
109 | #endif /* CONFIG_KMEMCHECK */ | 159 | #define kmemcheck_bitfield_begin(name) |
110 | 160 | #define kmemcheck_bitfield_end(name) | |
111 | /* | 161 | #define kmemcheck_annotate_bitfield(ptr, name) \ |
112 | * Bitfield annotations | 162 | do { \ |
113 | * | 163 | } while (0) |
114 | * How to use: If you have a struct using bitfields, for example | ||
115 | * | ||
116 | * struct a { | ||
117 | * int x:8, y:8; | ||
118 | * }; | ||
119 | * | ||
120 | * then this should be rewritten as | ||
121 | * | ||
122 | * struct a { | ||
123 | * kmemcheck_bitfield_begin(flags); | ||
124 | * int x:8, y:8; | ||
125 | * kmemcheck_bitfield_end(flags); | ||
126 | * }; | ||
127 | * | ||
128 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
129 | * beginning and end, respectively, of the bitfield (and things like | ||
130 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
131 | * fields should be annotated: | ||
132 | * | ||
133 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
134 | * kmemcheck_annotate_bitfield(a, flags); | ||
135 | * | ||
136 | * Note: We provide the same definitions for both kmemcheck and non- | ||
137 | * kmemcheck kernels. This makes it harder to introduce accidental errors. It | ||
138 | * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield(). | ||
139 | */ | ||
140 | #define kmemcheck_bitfield_begin(name) \ | ||
141 | int name##_begin[0]; | ||
142 | |||
143 | #define kmemcheck_bitfield_end(name) \ | ||
144 | int name##_end[0]; | ||
145 | 164 | ||
146 | #define kmemcheck_annotate_bitfield(ptr, name) \ | 165 | #define kmemcheck_annotate_variable(var) \ |
147 | do { \ | 166 | do { \ |
148 | int _n; \ | ||
149 | \ | ||
150 | if (!ptr) \ | ||
151 | break; \ | ||
152 | \ | ||
153 | _n = (long) &((ptr)->name##_end) \ | ||
154 | - (long) &((ptr)->name##_begin); \ | ||
155 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
156 | \ | ||
157 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
158 | } while (0) | 167 | } while (0) |
159 | 168 | ||
160 | #define kmemcheck_annotate_variable(var) \ | 169 | #endif /* CONFIG_KMEMCHECK */ |
161 | do { \ | ||
162 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
163 | } while (0) \ | ||
164 | 170 | ||
165 | #endif /* LINUX_KMEMCHECK_H */ | 171 | #endif /* LINUX_KMEMCHECK_H */ |
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 3c7497d46ee9..99d9a6766f7e 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h | |||
@@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset, | |||
32 | size_t size) __ref; | 32 | size_t size) __ref; |
33 | extern void kmemleak_not_leak(const void *ptr) __ref; | 33 | extern void kmemleak_not_leak(const void *ptr) __ref; |
34 | extern void kmemleak_ignore(const void *ptr) __ref; | 34 | extern void kmemleak_ignore(const void *ptr) __ref; |
35 | extern void kmemleak_scan_area(const void *ptr, unsigned long offset, | 35 | extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; |
36 | size_t length, gfp_t gfp) __ref; | ||
37 | extern void kmemleak_no_scan(const void *ptr) __ref; | 36 | extern void kmemleak_no_scan(const void *ptr) __ref; |
38 | 37 | ||
39 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, | 38 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, |
@@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr) | |||
84 | static inline void kmemleak_ignore(const void *ptr) | 83 | static inline void kmemleak_ignore(const void *ptr) |
85 | { | 84 | { |
86 | } | 85 | } |
87 | static inline void kmemleak_scan_area(const void *ptr, unsigned long offset, | 86 | static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) |
88 | size_t length, gfp_t gfp) | ||
89 | { | 87 | { |
90 | } | 88 | } |
91 | static inline void kmemleak_erase(void **ptr) | 89 | static inline void kmemleak_erase(void **ptr) |
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h new file mode 100644 index 000000000000..24b44145a886 --- /dev/null +++ b/include/linux/kmsg_dump.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * linux/include/kmsg_dump.h | ||
3 | * | ||
4 | * Copyright (C) 2009 Net Insight AB | ||
5 | * | ||
6 | * Author: Simon Kagstrom <simon.kagstrom@netinsight.net> | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file COPYING in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #ifndef _LINUX_KMSG_DUMP_H | ||
13 | #define _LINUX_KMSG_DUMP_H | ||
14 | |||
15 | #include <linux/list.h> | ||
16 | |||
17 | enum kmsg_dump_reason { | ||
18 | KMSG_DUMP_OOPS, | ||
19 | KMSG_DUMP_PANIC, | ||
20 | KMSG_DUMP_KEXEC, | ||
21 | }; | ||
22 | |||
23 | /** | ||
24 | * struct kmsg_dumper - kernel crash message dumper structure | ||
25 | * @dump: The callback which gets called on crashes. The buffer is passed | ||
26 | * as two sections, where s1 (length l1) contains the older | ||
27 | * messages and s2 (length l2) contains the newer. | ||
28 | * @list: Entry in the dumper list (private) | ||
29 | * @registered: Flag that specifies if this is already registered | ||
30 | */ | ||
31 | struct kmsg_dumper { | ||
32 | void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason, | ||
33 | const char *s1, unsigned long l1, | ||
34 | const char *s2, unsigned long l2); | ||
35 | struct list_head list; | ||
36 | int registered; | ||
37 | }; | ||
38 | |||
39 | #ifdef CONFIG_PRINTK | ||
40 | void kmsg_dump(enum kmsg_dump_reason reason); | ||
41 | |||
42 | int kmsg_dump_register(struct kmsg_dumper *dumper); | ||
43 | |||
44 | int kmsg_dump_unregister(struct kmsg_dumper *dumper); | ||
45 | #else | ||
46 | static inline void kmsg_dump(enum kmsg_dump_reason reason) | ||
47 | { | ||
48 | } | ||
49 | |||
50 | static inline int kmsg_dump_register(struct kmsg_dumper *dumper) | ||
51 | { | ||
52 | return -EINVAL; | ||
53 | } | ||
54 | |||
55 | static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper) | ||
56 | { | ||
57 | return -EINVAL; | ||
58 | } | ||
59 | #endif | ||
60 | |||
61 | #endif /* _LINUX_KMSG_DUMP_H */ | ||
diff --git a/include/linux/ksm.h b/include/linux/ksm.h index a485c14ecd5d..43bdab769fc3 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h | |||
@@ -9,8 +9,12 @@ | |||
9 | 9 | ||
10 | #include <linux/bitops.h> | 10 | #include <linux/bitops.h> |
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/pagemap.h> | ||
13 | #include <linux/rmap.h> | ||
12 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
13 | #include <linux/vmstat.h> | 15 | |
16 | struct stable_node; | ||
17 | struct mem_cgroup; | ||
14 | 18 | ||
15 | #ifdef CONFIG_KSM | 19 | #ifdef CONFIG_KSM |
16 | int ksm_madvise(struct vm_area_struct *vma, unsigned long start, | 20 | int ksm_madvise(struct vm_area_struct *vma, unsigned long start, |
@@ -34,46 +38,110 @@ static inline void ksm_exit(struct mm_struct *mm) | |||
34 | /* | 38 | /* |
35 | * A KSM page is one of those write-protected "shared pages" or "merged pages" | 39 | * A KSM page is one of those write-protected "shared pages" or "merged pages" |
36 | * which KSM maps into multiple mms, wherever identical anonymous page content | 40 | * which KSM maps into multiple mms, wherever identical anonymous page content |
37 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma. | 41 | * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any |
42 | * anon_vma, but to that page's node of the stable tree. | ||
38 | */ | 43 | */ |
39 | static inline int PageKsm(struct page *page) | 44 | static inline int PageKsm(struct page *page) |
40 | { | 45 | { |
41 | return ((unsigned long)page->mapping == PAGE_MAPPING_ANON); | 46 | return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == |
47 | (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); | ||
48 | } | ||
49 | |||
50 | static inline struct stable_node *page_stable_node(struct page *page) | ||
51 | { | ||
52 | return PageKsm(page) ? page_rmapping(page) : NULL; | ||
53 | } | ||
54 | |||
55 | static inline void set_page_stable_node(struct page *page, | ||
56 | struct stable_node *stable_node) | ||
57 | { | ||
58 | page->mapping = (void *)stable_node + | ||
59 | (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); | ||
42 | } | 60 | } |
43 | 61 | ||
44 | /* | 62 | /* |
45 | * But we have to avoid the checking which page_add_anon_rmap() performs. | 63 | * When do_swap_page() first faults in from swap what used to be a KSM page, |
64 | * no problem, it will be assigned to this vma's anon_vma; but thereafter, | ||
65 | * it might be faulted into a different anon_vma (or perhaps to a different | ||
66 | * offset in the same anon_vma). do_swap_page() cannot do all the locking | ||
67 | * needed to reconstitute a cross-anon_vma KSM page: for now it has to make | ||
68 | * a copy, and leave remerging the pages to a later pass of ksmd. | ||
69 | * | ||
70 | * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, | ||
71 | * but what if the vma was unmerged while the page was swapped out? | ||
46 | */ | 72 | */ |
47 | static inline void page_add_ksm_rmap(struct page *page) | 73 | struct page *ksm_does_need_to_copy(struct page *page, |
74 | struct vm_area_struct *vma, unsigned long address); | ||
75 | static inline struct page *ksm_might_need_to_copy(struct page *page, | ||
76 | struct vm_area_struct *vma, unsigned long address) | ||
48 | { | 77 | { |
49 | if (atomic_inc_and_test(&page->_mapcount)) { | 78 | struct anon_vma *anon_vma = page_anon_vma(page); |
50 | page->mapping = (void *) PAGE_MAPPING_ANON; | 79 | |
51 | __inc_zone_page_state(page, NR_ANON_PAGES); | 80 | if (!anon_vma || |
52 | } | 81 | (anon_vma == vma->anon_vma && |
82 | page->index == linear_page_index(vma, address))) | ||
83 | return page; | ||
84 | |||
85 | return ksm_does_need_to_copy(page, vma, address); | ||
53 | } | 86 | } |
87 | |||
88 | int page_referenced_ksm(struct page *page, | ||
89 | struct mem_cgroup *memcg, unsigned long *vm_flags); | ||
90 | int try_to_unmap_ksm(struct page *page, enum ttu_flags flags); | ||
91 | int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *, | ||
92 | struct vm_area_struct *, unsigned long, void *), void *arg); | ||
93 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); | ||
94 | |||
54 | #else /* !CONFIG_KSM */ | 95 | #else /* !CONFIG_KSM */ |
55 | 96 | ||
97 | static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) | ||
98 | { | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static inline void ksm_exit(struct mm_struct *mm) | ||
103 | { | ||
104 | } | ||
105 | |||
106 | static inline int PageKsm(struct page *page) | ||
107 | { | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | #ifdef CONFIG_MMU | ||
56 | static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, | 112 | static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, |
57 | unsigned long end, int advice, unsigned long *vm_flags) | 113 | unsigned long end, int advice, unsigned long *vm_flags) |
58 | { | 114 | { |
59 | return 0; | 115 | return 0; |
60 | } | 116 | } |
61 | 117 | ||
62 | static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) | 118 | static inline struct page *ksm_might_need_to_copy(struct page *page, |
119 | struct vm_area_struct *vma, unsigned long address) | ||
120 | { | ||
121 | return page; | ||
122 | } | ||
123 | |||
124 | static inline int page_referenced_ksm(struct page *page, | ||
125 | struct mem_cgroup *memcg, unsigned long *vm_flags) | ||
63 | { | 126 | { |
64 | return 0; | 127 | return 0; |
65 | } | 128 | } |
66 | 129 | ||
67 | static inline void ksm_exit(struct mm_struct *mm) | 130 | static inline int try_to_unmap_ksm(struct page *page, enum ttu_flags flags) |
68 | { | 131 | { |
132 | return 0; | ||
69 | } | 133 | } |
70 | 134 | ||
71 | static inline int PageKsm(struct page *page) | 135 | static inline int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page*, |
136 | struct vm_area_struct *, unsigned long, void *), void *arg) | ||
72 | { | 137 | { |
73 | return 0; | 138 | return 0; |
74 | } | 139 | } |
75 | 140 | ||
76 | /* No stub required for page_add_ksm_rmap(page) */ | 141 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
142 | { | ||
143 | } | ||
144 | #endif /* CONFIG_MMU */ | ||
77 | #endif /* !CONFIG_KSM */ | 145 | #endif /* !CONFIG_KSM */ |
78 | 146 | ||
79 | #endif | 147 | #endif /* __LINUX_KSM_H */ |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 2d241da07236..a24de0b1858e 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -496,6 +496,7 @@ struct kvm_ioeventfd { | |||
496 | #define KVM_CAP_VCPU_EVENTS 41 | 496 | #define KVM_CAP_VCPU_EVENTS 41 |
497 | #endif | 497 | #endif |
498 | #define KVM_CAP_S390_PSW 42 | 498 | #define KVM_CAP_S390_PSW 42 |
499 | #define KVM_CAP_PPC_SEGSTATE 43 | ||
499 | 500 | ||
500 | #ifdef KVM_CAP_IRQ_ROUTING | 501 | #ifdef KVM_CAP_IRQ_ROUTING |
501 | 502 | ||
diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h index afc9f9fd70f5..2618aa9063bc 100644 --- a/include/linux/leds-lp3944.h +++ b/include/linux/leds-lp3944.h | |||
@@ -12,9 +12,6 @@ | |||
12 | #ifndef __LINUX_LEDS_LP3944_H | 12 | #ifndef __LINUX_LEDS_LP3944_H |
13 | #define __LINUX_LEDS_LP3944_H | 13 | #define __LINUX_LEDS_LP3944_H |
14 | 14 | ||
15 | #include <linux/leds.h> | ||
16 | #include <linux/workqueue.h> | ||
17 | |||
18 | #define LP3944_LED0 0 | 15 | #define LP3944_LED0 0 |
19 | #define LP3944_LED1 1 | 16 | #define LP3944_LED1 1 |
20 | #define LP3944_LED2 2 | 17 | #define LP3944_LED2 2 |
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h index 96eea90f01a8..f158eb1149aa 100644 --- a/include/linux/leds-pca9532.h +++ b/include/linux/leds-pca9532.h | |||
@@ -32,7 +32,7 @@ struct pca9532_led { | |||
32 | struct i2c_client *client; | 32 | struct i2c_client *client; |
33 | char *name; | 33 | char *name; |
34 | struct led_classdev ldev; | 34 | struct led_classdev ldev; |
35 | struct work_struct work; | 35 | struct work_struct work; |
36 | enum pca9532_type type; | 36 | enum pca9532_type type; |
37 | enum pca9532_state state; | 37 | enum pca9532_state state; |
38 | }; | 38 | }; |
diff --git a/include/linux/leds-regulator.h b/include/linux/leds-regulator.h new file mode 100644 index 000000000000..5a8eb389aab8 --- /dev/null +++ b/include/linux/leds-regulator.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * leds-regulator.h - platform data structure for regulator driven LEDs. | ||
3 | * | ||
4 | * Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_LEDS_REGULATOR_H | ||
13 | #define __LINUX_LEDS_REGULATOR_H | ||
14 | |||
15 | /* | ||
16 | * Use "vled" as supply id when declaring the regulator consumer: | ||
17 | * | ||
18 | * static struct regulator_consumer_supply pcap_regulator_VVIB_consumers [] = { | ||
19 | * { .dev_name = "leds-regulator.0", supply = "vled" }, | ||
20 | * }; | ||
21 | * | ||
22 | * If you have several regulator driven LEDs, you can append a numerical id to | ||
23 | * .dev_name as done above, and use the same id when declaring the platform | ||
24 | * device: | ||
25 | * | ||
26 | * static struct led_regulator_platform_data a780_vibrator_data = { | ||
27 | * .name = "a780::vibrator", | ||
28 | * }; | ||
29 | * | ||
30 | * static struct platform_device a780_vibrator = { | ||
31 | * .name = "leds-regulator", | ||
32 | * .id = 0, | ||
33 | * .dev = { | ||
34 | * .platform_data = &a780_vibrator_data, | ||
35 | * }, | ||
36 | * }; | ||
37 | */ | ||
38 | |||
39 | #include <linux/leds.h> | ||
40 | |||
41 | struct led_regulator_platform_data { | ||
42 | char *name; /* LED name as expected by LED class */ | ||
43 | enum led_brightness brightness; /* initial brightness value */ | ||
44 | }; | ||
45 | |||
46 | #endif /* __LINUX_LEDS_REGULATOR_H */ | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index a5b3dc71e819..73112250862c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -354,6 +354,9 @@ enum { | |||
354 | /* max tries if error condition is still set after ->error_handler */ | 354 | /* max tries if error condition is still set after ->error_handler */ |
355 | ATA_EH_MAX_TRIES = 5, | 355 | ATA_EH_MAX_TRIES = 5, |
356 | 356 | ||
357 | /* sometimes resuming a link requires several retries */ | ||
358 | ATA_LINK_RESUME_TRIES = 5, | ||
359 | |||
357 | /* how hard are we gonna try to probe/recover devices */ | 360 | /* how hard are we gonna try to probe/recover devices */ |
358 | ATA_PROBE_MAX_TRIES = 3, | 361 | ATA_PROBE_MAX_TRIES = 3, |
359 | ATA_EH_DEV_TRIES = 3, | 362 | ATA_EH_DEV_TRIES = 3, |
@@ -1024,7 +1027,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev, | |||
1024 | extern int ata_scsi_slave_config(struct scsi_device *sdev); | 1027 | extern int ata_scsi_slave_config(struct scsi_device *sdev); |
1025 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); | 1028 | extern void ata_scsi_slave_destroy(struct scsi_device *sdev); |
1026 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | 1029 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, |
1027 | int queue_depth); | 1030 | int queue_depth, int reason); |
1028 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 1031 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
1029 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); | 1032 | extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); |
1030 | 1033 | ||
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h index 3cc2f2c53e4c..f1ca0dcc1628 100644 --- a/include/linux/lis3lv02d.h +++ b/include/linux/lis3lv02d.h | |||
@@ -43,6 +43,21 @@ struct lis3lv02d_platform_data { | |||
43 | #define LIS3_WAKEUP_Z_HI (1 << 5) | 43 | #define LIS3_WAKEUP_Z_HI (1 << 5) |
44 | unsigned char wakeup_flags; | 44 | unsigned char wakeup_flags; |
45 | unsigned char wakeup_thresh; | 45 | unsigned char wakeup_thresh; |
46 | #define LIS3_NO_MAP 0 | ||
47 | #define LIS3_DEV_X 1 | ||
48 | #define LIS3_DEV_Y 2 | ||
49 | #define LIS3_DEV_Z 3 | ||
50 | #define LIS3_INV_DEV_X -1 | ||
51 | #define LIS3_INV_DEV_Y -2 | ||
52 | #define LIS3_INV_DEV_Z -3 | ||
53 | s8 axis_x; | ||
54 | s8 axis_y; | ||
55 | s8 axis_z; | ||
56 | int (*setup_resources)(void); | ||
57 | int (*release_resources)(void); | ||
58 | /* Limits for selftest are specified in chip data sheet */ | ||
59 | s16 st_min_limits[3]; /* min pass limit x, y, z */ | ||
60 | s16 st_max_limits[3]; /* max pass limit x, y, z */ | ||
46 | }; | 61 | }; |
47 | 62 | ||
48 | #endif /* __LIS3LV02D_H_ */ | 63 | #endif /* __LIS3LV02D_H_ */ |
diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h new file mode 100644 index 000000000000..1a2df2efb771 --- /dev/null +++ b/include/linux/list_sort.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _LINUX_LIST_SORT_H | ||
2 | #define _LINUX_LIST_SORT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct list_head; | ||
7 | |||
8 | void list_sort(void *priv, struct list_head *head, | ||
9 | int (*cmp)(void *priv, struct list_head *a, | ||
10 | struct list_head *b)); | ||
11 | #endif | ||
diff --git a/include/linux/llc.h b/include/linux/llc.h index 7733585603f1..ad7074ba81af 100644 --- a/include/linux/llc.h +++ b/include/linux/llc.h | |||
@@ -36,6 +36,7 @@ enum llc_sockopts { | |||
36 | LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ | 36 | LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ |
37 | LLC_OPT_TX_WIN, /* tx window size. */ | 37 | LLC_OPT_TX_WIN, /* tx window size. */ |
38 | LLC_OPT_RX_WIN, /* rx window size. */ | 38 | LLC_OPT_RX_WIN, /* rx window size. */ |
39 | LLC_OPT_PKTINFO, /* ancillary packet information. */ | ||
39 | LLC_OPT_MAX | 40 | LLC_OPT_MAX |
40 | }; | 41 | }; |
41 | 42 | ||
@@ -70,6 +71,12 @@ enum llc_sockopts { | |||
70 | #define LLC_SAP_RM 0xD4 /* Resource Management */ | 71 | #define LLC_SAP_RM 0xD4 /* Resource Management */ |
71 | #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ | 72 | #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ |
72 | 73 | ||
74 | struct llc_pktinfo { | ||
75 | int lpi_ifindex; | ||
76 | unsigned char lpi_sap; | ||
77 | unsigned char lpi_mac[IFHWADDRLEN]; | ||
78 | }; | ||
79 | |||
73 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
74 | #define LLC_SAP_DYN_START 0xC0 | 81 | #define LLC_SAP_DYN_START 0xC0 |
75 | #define LLC_SAP_DYN_STOP 0xDE | 82 | #define LLC_SAP_DYN_STOP 0xDE |
diff --git a/include/linux/lmb.h b/include/linux/lmb.h index 2442e3f3d033..ef82b8fcbddb 100644 --- a/include/linux/lmb.h +++ b/include/linux/lmb.h | |||
@@ -54,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void); | |||
54 | extern u64 lmb_end_of_DRAM(void); | 54 | extern u64 lmb_end_of_DRAM(void); |
55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); | 55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); |
56 | extern int __init lmb_is_reserved(u64 addr); | 56 | extern int __init lmb_is_reserved(u64 addr); |
57 | extern int lmb_is_region_reserved(u64 base, u64 size); | ||
57 | extern int lmb_find(struct lmb_property *res); | 58 | extern int lmb_find(struct lmb_property *res); |
58 | 59 | ||
59 | extern void lmb_dump_all(void); | 60 | extern void lmb_dump_all(void); |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index bf9213b2db8f..1f9b119f4ace 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -54,6 +54,11 @@ extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); | |||
54 | extern void mem_cgroup_del_lru(struct page *page); | 54 | extern void mem_cgroup_del_lru(struct page *page); |
55 | extern void mem_cgroup_move_lists(struct page *page, | 55 | extern void mem_cgroup_move_lists(struct page *page, |
56 | enum lru_list from, enum lru_list to); | 56 | enum lru_list from, enum lru_list to); |
57 | |||
58 | /* For coalescing uncharge for reducing memcg' overhead*/ | ||
59 | extern void mem_cgroup_uncharge_start(void); | ||
60 | extern void mem_cgroup_uncharge_end(void); | ||
61 | |||
57 | extern void mem_cgroup_uncharge_page(struct page *page); | 62 | extern void mem_cgroup_uncharge_page(struct page *page); |
58 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 63 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
59 | extern int mem_cgroup_shmem_charge_fallback(struct page *page, | 64 | extern int mem_cgroup_shmem_charge_fallback(struct page *page, |
@@ -68,6 +73,7 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
68 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); | 73 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); |
69 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 74 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
70 | 75 | ||
76 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | ||
71 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | 77 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); |
72 | 78 | ||
73 | static inline | 79 | static inline |
@@ -80,6 +86,8 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) | |||
80 | return cgroup == mem; | 86 | return cgroup == mem; |
81 | } | 87 | } |
82 | 88 | ||
89 | extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem); | ||
90 | |||
83 | extern int | 91 | extern int |
84 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); | 92 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); |
85 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, | 93 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, |
@@ -117,7 +125,7 @@ static inline bool mem_cgroup_disabled(void) | |||
117 | } | 125 | } |
118 | 126 | ||
119 | extern bool mem_cgroup_oom_called(struct task_struct *task); | 127 | extern bool mem_cgroup_oom_called(struct task_struct *task); |
120 | void mem_cgroup_update_mapped_file_stat(struct page *page, int val); | 128 | void mem_cgroup_update_file_mapped(struct page *page, int val); |
121 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 129 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
122 | gfp_t gfp_mask, int nid, | 130 | gfp_t gfp_mask, int nid, |
123 | int zid); | 131 | int zid); |
@@ -151,6 +159,14 @@ static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) | |||
151 | { | 159 | { |
152 | } | 160 | } |
153 | 161 | ||
162 | static inline void mem_cgroup_uncharge_start(void) | ||
163 | { | ||
164 | } | ||
165 | |||
166 | static inline void mem_cgroup_uncharge_end(void) | ||
167 | { | ||
168 | } | ||
169 | |||
154 | static inline void mem_cgroup_uncharge_page(struct page *page) | 170 | static inline void mem_cgroup_uncharge_page(struct page *page) |
155 | { | 171 | { |
156 | } | 172 | } |
@@ -189,6 +205,11 @@ mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to) | |||
189 | { | 205 | { |
190 | } | 206 | } |
191 | 207 | ||
208 | static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) | ||
209 | { | ||
210 | return NULL; | ||
211 | } | ||
212 | |||
192 | static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) | 213 | static inline int mm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) |
193 | { | 214 | { |
194 | return 1; | 215 | return 1; |
@@ -200,6 +221,11 @@ static inline int task_in_mem_cgroup(struct task_struct *task, | |||
200 | return 1; | 221 | return 1; |
201 | } | 222 | } |
202 | 223 | ||
224 | static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem) | ||
225 | { | ||
226 | return NULL; | ||
227 | } | ||
228 | |||
203 | static inline int | 229 | static inline int |
204 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) | 230 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) |
205 | { | 231 | { |
@@ -274,7 +300,7 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
274 | { | 300 | { |
275 | } | 301 | } |
276 | 302 | ||
277 | static inline void mem_cgroup_update_mapped_file_stat(struct page *page, | 303 | static inline void mem_cgroup_update_file_mapped(struct page *page, |
278 | int val) | 304 | int val) |
279 | { | 305 | { |
280 | } | 306 | } |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 37fa19b34ef5..1adfe779eb99 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -50,6 +50,19 @@ struct memory_notify { | |||
50 | int status_change_nid; | 50 | int status_change_nid; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /* | ||
54 | * During pageblock isolation, count the number of pages within the | ||
55 | * range [start_pfn, start_pfn + nr_pages) which are owned by code | ||
56 | * in the notifier chain. | ||
57 | */ | ||
58 | #define MEM_ISOLATE_COUNT (1<<0) | ||
59 | |||
60 | struct memory_isolate_notify { | ||
61 | unsigned long start_pfn; /* Start of range to check */ | ||
62 | unsigned int nr_pages; /* # pages in range to check */ | ||
63 | unsigned int pages_found; /* # pages owned found by callbacks */ | ||
64 | }; | ||
65 | |||
53 | struct notifier_block; | 66 | struct notifier_block; |
54 | struct mem_section; | 67 | struct mem_section; |
55 | 68 | ||
@@ -76,14 +89,28 @@ static inline int memory_notify(unsigned long val, void *v) | |||
76 | { | 89 | { |
77 | return 0; | 90 | return 0; |
78 | } | 91 | } |
92 | static inline int register_memory_isolate_notifier(struct notifier_block *nb) | ||
93 | { | ||
94 | return 0; | ||
95 | } | ||
96 | static inline void unregister_memory_isolate_notifier(struct notifier_block *nb) | ||
97 | { | ||
98 | } | ||
99 | static inline int memory_isolate_notify(unsigned long val, void *v) | ||
100 | { | ||
101 | return 0; | ||
102 | } | ||
79 | #else | 103 | #else |
80 | extern int register_memory_notifier(struct notifier_block *nb); | 104 | extern int register_memory_notifier(struct notifier_block *nb); |
81 | extern void unregister_memory_notifier(struct notifier_block *nb); | 105 | extern void unregister_memory_notifier(struct notifier_block *nb); |
106 | extern int register_memory_isolate_notifier(struct notifier_block *nb); | ||
107 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | ||
82 | extern int register_new_memory(int, struct mem_section *); | 108 | extern int register_new_memory(int, struct mem_section *); |
83 | extern int unregister_memory_section(struct mem_section *); | 109 | extern int unregister_memory_section(struct mem_section *); |
84 | extern int memory_dev_init(void); | 110 | extern int memory_dev_init(void); |
85 | extern int remove_memory_block(unsigned long, struct mem_section *, int); | 111 | extern int remove_memory_block(unsigned long, struct mem_section *, int); |
86 | extern int memory_notify(unsigned long val, void *v); | 112 | extern int memory_notify(unsigned long val, void *v); |
113 | extern int memory_isolate_notify(unsigned long val, void *v); | ||
87 | extern struct memory_block *find_memory_block(struct mem_section *); | 114 | extern struct memory_block *find_memory_block(struct mem_section *); |
88 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 115 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
89 | enum mem_add_context { BOOT, HOTPLUG }; | 116 | enum mem_add_context { BOOT, HOTPLUG }; |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index fed969281a41..35b07b773e6c 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -69,7 +69,6 @@ extern void online_page(struct page *page); | |||
69 | /* VM interface that may be used by firmware interface */ | 69 | /* VM interface that may be used by firmware interface */ |
70 | extern int online_pages(unsigned long, unsigned long); | 70 | extern int online_pages(unsigned long, unsigned long); |
71 | extern void __offline_isolated_pages(unsigned long, unsigned long); | 71 | extern void __offline_isolated_pages(unsigned long, unsigned long); |
72 | extern int offline_pages(unsigned long, unsigned long, unsigned long); | ||
73 | 72 | ||
74 | /* reasonably generic interface to expand the physical pages in a zone */ | 73 | /* reasonably generic interface to expand the physical pages in a zone */ |
75 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, | 74 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 085c903fe0f1..1cc966cd3e5f 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -201,6 +201,7 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p); | |||
201 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 201 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
202 | unsigned long addr, gfp_t gfp_flags, | 202 | unsigned long addr, gfp_t gfp_flags, |
203 | struct mempolicy **mpol, nodemask_t **nodemask); | 203 | struct mempolicy **mpol, nodemask_t **nodemask); |
204 | extern bool init_nodemask_of_mempolicy(nodemask_t *mask); | ||
204 | extern unsigned slab_node(struct mempolicy *policy); | 205 | extern unsigned slab_node(struct mempolicy *policy); |
205 | 206 | ||
206 | extern enum zone_type policy_zone; | 207 | extern enum zone_type policy_zone; |
@@ -328,6 +329,8 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, | |||
328 | return node_zonelist(0, gfp_flags); | 329 | return node_zonelist(0, gfp_flags); |
329 | } | 330 | } |
330 | 331 | ||
332 | static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; } | ||
333 | |||
331 | static inline int do_migrate_pages(struct mm_struct *mm, | 334 | static inline int do_migrate_pages(struct mm_struct *mm, |
332 | const nodemask_t *from_nodes, | 335 | const nodemask_t *from_nodes, |
333 | const nodemask_t *to_nodes, int flags) | 336 | const nodemask_t *to_nodes, int flags) |
diff --git a/include/linux/mfd/88pm8607.h b/include/linux/mfd/88pm8607.h new file mode 100644 index 000000000000..f41b428d2cec --- /dev/null +++ b/include/linux/mfd/88pm8607.h | |||
@@ -0,0 +1,217 @@ | |||
1 | /* | ||
2 | * Marvell 88PM8607 Interface | ||
3 | * | ||
4 | * Copyright (C) 2009 Marvell International Ltd. | ||
5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
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 | #ifndef __LINUX_MFD_88PM8607_H | ||
13 | #define __LINUX_MFD_88PM8607_H | ||
14 | |||
15 | enum { | ||
16 | PM8607_ID_BUCK1 = 0, | ||
17 | PM8607_ID_BUCK2, | ||
18 | PM8607_ID_BUCK3, | ||
19 | |||
20 | PM8607_ID_LDO1, | ||
21 | PM8607_ID_LDO2, | ||
22 | PM8607_ID_LDO3, | ||
23 | PM8607_ID_LDO4, | ||
24 | PM8607_ID_LDO5, | ||
25 | PM8607_ID_LDO6, | ||
26 | PM8607_ID_LDO7, | ||
27 | PM8607_ID_LDO8, | ||
28 | PM8607_ID_LDO9, | ||
29 | PM8607_ID_LDO10, | ||
30 | PM8607_ID_LDO12, | ||
31 | PM8607_ID_LDO14, | ||
32 | |||
33 | PM8607_ID_RG_MAX, | ||
34 | }; | ||
35 | |||
36 | #define CHIP_ID (0x40) | ||
37 | #define CHIP_ID_MASK (0xF8) | ||
38 | |||
39 | /* Interrupt Registers */ | ||
40 | #define PM8607_STATUS_1 (0x01) | ||
41 | #define PM8607_STATUS_2 (0x02) | ||
42 | #define PM8607_INT_STATUS1 (0x03) | ||
43 | #define PM8607_INT_STATUS2 (0x04) | ||
44 | #define PM8607_INT_STATUS3 (0x05) | ||
45 | #define PM8607_INT_MASK_1 (0x06) | ||
46 | #define PM8607_INT_MASK_2 (0x07) | ||
47 | #define PM8607_INT_MASK_3 (0x08) | ||
48 | |||
49 | /* Regulator Control Registers */ | ||
50 | #define PM8607_LDO1 (0x10) | ||
51 | #define PM8607_LDO2 (0x11) | ||
52 | #define PM8607_LDO3 (0x12) | ||
53 | #define PM8607_LDO4 (0x13) | ||
54 | #define PM8607_LDO5 (0x14) | ||
55 | #define PM8607_LDO6 (0x15) | ||
56 | #define PM8607_LDO7 (0x16) | ||
57 | #define PM8607_LDO8 (0x17) | ||
58 | #define PM8607_LDO9 (0x18) | ||
59 | #define PM8607_LDO10 (0x19) | ||
60 | #define PM8607_LDO12 (0x1A) | ||
61 | #define PM8607_LDO14 (0x1B) | ||
62 | #define PM8607_SLEEP_MODE1 (0x1C) | ||
63 | #define PM8607_SLEEP_MODE2 (0x1D) | ||
64 | #define PM8607_SLEEP_MODE3 (0x1E) | ||
65 | #define PM8607_SLEEP_MODE4 (0x1F) | ||
66 | #define PM8607_GO (0x20) | ||
67 | #define PM8607_SLEEP_BUCK1 (0x21) | ||
68 | #define PM8607_SLEEP_BUCK2 (0x22) | ||
69 | #define PM8607_SLEEP_BUCK3 (0x23) | ||
70 | #define PM8607_BUCK1 (0x24) | ||
71 | #define PM8607_BUCK2 (0x25) | ||
72 | #define PM8607_BUCK3 (0x26) | ||
73 | #define PM8607_BUCK_CONTROLS (0x27) | ||
74 | #define PM8607_SUPPLIES_EN11 (0x2B) | ||
75 | #define PM8607_SUPPLIES_EN12 (0x2C) | ||
76 | #define PM8607_GROUP1 (0x2D) | ||
77 | #define PM8607_GROUP2 (0x2E) | ||
78 | #define PM8607_GROUP3 (0x2F) | ||
79 | #define PM8607_GROUP4 (0x30) | ||
80 | #define PM8607_GROUP5 (0x31) | ||
81 | #define PM8607_GROUP6 (0x32) | ||
82 | #define PM8607_SUPPLIES_EN21 (0x33) | ||
83 | #define PM8607_SUPPLIES_EN22 (0x34) | ||
84 | |||
85 | /* RTC Control Registers */ | ||
86 | #define PM8607_RTC1 (0xA0) | ||
87 | #define PM8607_RTC_COUNTER1 (0xA1) | ||
88 | #define PM8607_RTC_COUNTER2 (0xA2) | ||
89 | #define PM8607_RTC_COUNTER3 (0xA3) | ||
90 | #define PM8607_RTC_COUNTER4 (0xA4) | ||
91 | #define PM8607_RTC_EXPIRE1 (0xA5) | ||
92 | #define PM8607_RTC_EXPIRE2 (0xA6) | ||
93 | #define PM8607_RTC_EXPIRE3 (0xA7) | ||
94 | #define PM8607_RTC_EXPIRE4 (0xA8) | ||
95 | #define PM8607_RTC_TRIM1 (0xA9) | ||
96 | #define PM8607_RTC_TRIM2 (0xAA) | ||
97 | #define PM8607_RTC_TRIM3 (0xAB) | ||
98 | #define PM8607_RTC_TRIM4 (0xAC) | ||
99 | #define PM8607_RTC_MISC1 (0xAD) | ||
100 | #define PM8607_RTC_MISC2 (0xAE) | ||
101 | #define PM8607_RTC_MISC3 (0xAF) | ||
102 | |||
103 | /* Misc Registers */ | ||
104 | #define PM8607_CHIP_ID (0x00) | ||
105 | #define PM8607_LDO1 (0x10) | ||
106 | #define PM8607_DVC3 (0x26) | ||
107 | #define PM8607_MISC1 (0x40) | ||
108 | |||
109 | /* bit definitions for PM8607 events */ | ||
110 | #define PM8607_EVENT_ONKEY (1 << 0) | ||
111 | #define PM8607_EVENT_EXTON (1 << 1) | ||
112 | #define PM8607_EVENT_CHG (1 << 2) | ||
113 | #define PM8607_EVENT_BAT (1 << 3) | ||
114 | #define PM8607_EVENT_RTC (1 << 4) | ||
115 | #define PM8607_EVENT_CC (1 << 5) | ||
116 | #define PM8607_EVENT_VBAT (1 << 8) | ||
117 | #define PM8607_EVENT_VCHG (1 << 9) | ||
118 | #define PM8607_EVENT_VSYS (1 << 10) | ||
119 | #define PM8607_EVENT_TINT (1 << 11) | ||
120 | #define PM8607_EVENT_GPADC0 (1 << 12) | ||
121 | #define PM8607_EVENT_GPADC1 (1 << 13) | ||
122 | #define PM8607_EVENT_GPADC2 (1 << 14) | ||
123 | #define PM8607_EVENT_GPADC3 (1 << 15) | ||
124 | #define PM8607_EVENT_AUDIO_SHORT (1 << 16) | ||
125 | #define PM8607_EVENT_PEN (1 << 17) | ||
126 | #define PM8607_EVENT_HEADSET (1 << 18) | ||
127 | #define PM8607_EVENT_HOOK (1 << 19) | ||
128 | #define PM8607_EVENT_MICIN (1 << 20) | ||
129 | #define PM8607_EVENT_CHG_TIMEOUT (1 << 21) | ||
130 | #define PM8607_EVENT_CHG_DONE (1 << 22) | ||
131 | #define PM8607_EVENT_CHG_FAULT (1 << 23) | ||
132 | |||
133 | /* bit definitions of Status Query Interface */ | ||
134 | #define PM8607_STATUS_CC (1 << 3) | ||
135 | #define PM8607_STATUS_PEN (1 << 4) | ||
136 | #define PM8607_STATUS_HEADSET (1 << 5) | ||
137 | #define PM8607_STATUS_HOOK (1 << 6) | ||
138 | #define PM8607_STATUS_MICIN (1 << 7) | ||
139 | #define PM8607_STATUS_ONKEY (1 << 8) | ||
140 | #define PM8607_STATUS_EXTON (1 << 9) | ||
141 | #define PM8607_STATUS_CHG (1 << 10) | ||
142 | #define PM8607_STATUS_BAT (1 << 11) | ||
143 | #define PM8607_STATUS_VBUS (1 << 12) | ||
144 | #define PM8607_STATUS_OV (1 << 13) | ||
145 | |||
146 | /* bit definitions of BUCK3 */ | ||
147 | #define PM8607_BUCK3_DOUBLE (1 << 6) | ||
148 | |||
149 | /* bit definitions of Misc1 */ | ||
150 | #define PM8607_MISC1_PI2C (1 << 0) | ||
151 | |||
152 | /* Interrupt Number in 88PM8607 */ | ||
153 | enum { | ||
154 | PM8607_IRQ_ONKEY = 0, | ||
155 | PM8607_IRQ_EXTON, | ||
156 | PM8607_IRQ_CHG, | ||
157 | PM8607_IRQ_BAT, | ||
158 | PM8607_IRQ_RTC, | ||
159 | PM8607_IRQ_VBAT = 8, | ||
160 | PM8607_IRQ_VCHG, | ||
161 | PM8607_IRQ_VSYS, | ||
162 | PM8607_IRQ_TINT, | ||
163 | PM8607_IRQ_GPADC0, | ||
164 | PM8607_IRQ_GPADC1, | ||
165 | PM8607_IRQ_GPADC2, | ||
166 | PM8607_IRQ_GPADC3, | ||
167 | PM8607_IRQ_AUDIO_SHORT = 16, | ||
168 | PM8607_IRQ_PEN, | ||
169 | PM8607_IRQ_HEADSET, | ||
170 | PM8607_IRQ_HOOK, | ||
171 | PM8607_IRQ_MICIN, | ||
172 | PM8607_IRQ_CHG_FAIL, | ||
173 | PM8607_IRQ_CHG_DONE, | ||
174 | PM8607_IRQ_CHG_FAULT, | ||
175 | }; | ||
176 | |||
177 | enum { | ||
178 | PM8607_CHIP_A0 = 0x40, | ||
179 | PM8607_CHIP_A1 = 0x41, | ||
180 | PM8607_CHIP_B0 = 0x48, | ||
181 | }; | ||
182 | |||
183 | |||
184 | struct pm8607_chip { | ||
185 | struct device *dev; | ||
186 | struct mutex io_lock; | ||
187 | struct i2c_client *client; | ||
188 | |||
189 | int (*read)(struct pm8607_chip *chip, int reg, int bytes, void *dest); | ||
190 | int (*write)(struct pm8607_chip *chip, int reg, int bytes, void *src); | ||
191 | |||
192 | int buck3_double; /* DVC ramp slope double */ | ||
193 | unsigned char chip_id; | ||
194 | |||
195 | }; | ||
196 | |||
197 | #define PM8607_MAX_REGULATOR 15 /* 3 Bucks, 12 LDOs */ | ||
198 | |||
199 | enum { | ||
200 | GI2C_PORT = 0, | ||
201 | PI2C_PORT, | ||
202 | }; | ||
203 | |||
204 | struct pm8607_platform_data { | ||
205 | int i2c_port; /* Controlled by GI2C or PI2C */ | ||
206 | struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; | ||
207 | }; | ||
208 | |||
209 | extern int pm8607_reg_read(struct pm8607_chip *, int); | ||
210 | extern int pm8607_reg_write(struct pm8607_chip *, int, unsigned char); | ||
211 | extern int pm8607_bulk_read(struct pm8607_chip *, int, int, | ||
212 | unsigned char *); | ||
213 | extern int pm8607_bulk_write(struct pm8607_chip *, int, int, | ||
214 | unsigned char *); | ||
215 | extern int pm8607_set_bits(struct pm8607_chip *, int, unsigned char, | ||
216 | unsigned char); | ||
217 | #endif /* __LINUX_MFD_88PM8607_H */ | ||
diff --git a/include/linux/mfd/ab4500.h b/include/linux/mfd/ab4500.h new file mode 100644 index 000000000000..a42a7033ae53 --- /dev/null +++ b/include/linux/mfd/ab4500.h | |||
@@ -0,0 +1,262 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 ST-Ericsson | ||
3 | * | ||
4 | * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2, as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * AB4500 device core funtions, for client access | ||
11 | */ | ||
12 | #ifndef MFD_AB4500_H | ||
13 | #define MFD_AB4500_H | ||
14 | |||
15 | #include <linux/device.h> | ||
16 | |||
17 | /* | ||
18 | * AB4500 bank addresses | ||
19 | */ | ||
20 | #define AB4500_SYS_CTRL1_BLOCK 0x1 | ||
21 | #define AB4500_SYS_CTRL2_BLOCK 0x2 | ||
22 | #define AB4500_REGU_CTRL1 0x3 | ||
23 | #define AB4500_REGU_CTRL2 0x4 | ||
24 | #define AB4500_USB 0x5 | ||
25 | #define AB4500_TVOUT 0x6 | ||
26 | #define AB4500_DBI 0x7 | ||
27 | #define AB4500_ECI_AV_ACC 0x8 | ||
28 | #define AB4500_RESERVED 0x9 | ||
29 | #define AB4500_GPADC 0xA | ||
30 | #define AB4500_CHARGER 0xB | ||
31 | #define AB4500_GAS_GAUGE 0xC | ||
32 | #define AB4500_AUDIO 0xD | ||
33 | #define AB4500_INTERRUPT 0xE | ||
34 | #define AB4500_RTC 0xF | ||
35 | #define AB4500_MISC 0x10 | ||
36 | #define AB4500_DEBUG 0x12 | ||
37 | #define AB4500_PROD_TEST 0x13 | ||
38 | #define AB4500_OTP_EMUL 0x15 | ||
39 | |||
40 | /* | ||
41 | * System control 1 register offsets. | ||
42 | * Bank = 0x01 | ||
43 | */ | ||
44 | #define AB4500_TURNON_STAT_REG 0x0100 | ||
45 | #define AB4500_RESET_STAT_REG 0x0101 | ||
46 | #define AB4500_PONKEY1_PRESS_STAT_REG 0x0102 | ||
47 | |||
48 | #define AB4500_FSM_STAT1_REG 0x0140 | ||
49 | #define AB4500_FSM_STAT2_REG 0x0141 | ||
50 | #define AB4500_SYSCLK_REQ_STAT_REG 0x0142 | ||
51 | #define AB4500_USB_STAT1_REG 0x0143 | ||
52 | #define AB4500_USB_STAT2_REG 0x0144 | ||
53 | #define AB4500_STATUS_SPARE1_REG 0x0145 | ||
54 | #define AB4500_STATUS_SPARE2_REG 0x0146 | ||
55 | |||
56 | #define AB4500_CTRL1_REG 0x0180 | ||
57 | #define AB4500_CTRL2_REG 0x0181 | ||
58 | |||
59 | /* | ||
60 | * System control 2 register offsets. | ||
61 | * bank = 0x02 | ||
62 | */ | ||
63 | #define AB4500_CTRL3_REG 0x0200 | ||
64 | #define AB4500_MAIN_WDOG_CTRL_REG 0x0201 | ||
65 | #define AB4500_MAIN_WDOG_TIMER_REG 0x0202 | ||
66 | #define AB4500_LOW_BAT_REG 0x0203 | ||
67 | #define AB4500_BATT_OK_REG 0x0204 | ||
68 | #define AB4500_SYSCLK_TIMER_REG 0x0205 | ||
69 | #define AB4500_SMPSCLK_CTRL_REG 0x0206 | ||
70 | #define AB4500_SMPSCLK_SEL1_REG 0x0207 | ||
71 | #define AB4500_SMPSCLK_SEL2_REG 0x0208 | ||
72 | #define AB4500_SMPSCLK_SEL3_REG 0x0209 | ||
73 | #define AB4500_SYSULPCLK_CONF_REG 0x020A | ||
74 | #define AB4500_SYSULPCLK_CTRL1_REG 0x020B | ||
75 | #define AB4500_SYSCLK_CTRL_REG 0x020C | ||
76 | #define AB4500_SYSCLK_REQ1_VALID_REG 0x020D | ||
77 | #define AB4500_SYSCLK_REQ_VALID_REG 0x020E | ||
78 | #define AB4500_SYSCTRL_SPARE_REG 0x020F | ||
79 | #define AB4500_PAD_CONF_REG 0x0210 | ||
80 | |||
81 | /* | ||
82 | * Regu control1 register offsets | ||
83 | * Bank = 0x03 | ||
84 | */ | ||
85 | #define AB4500_REGU_SERIAL_CTRL1_REG 0x0300 | ||
86 | #define AB4500_REGU_SERIAL_CTRL2_REG 0x0301 | ||
87 | #define AB4500_REGU_SERIAL_CTRL3_REG 0x0302 | ||
88 | #define AB4500_REGU_REQ_CTRL1_REG 0x0303 | ||
89 | #define AB4500_REGU_REQ_CTRL2_REG 0x0304 | ||
90 | #define AB4500_REGU_REQ_CTRL3_REG 0x0305 | ||
91 | #define AB4500_REGU_REQ_CTRL4_REG 0x0306 | ||
92 | #define AB4500_REGU_MISC1_REG 0x0380 | ||
93 | #define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381 | ||
94 | #define AB4500_REGU_VUSB_CTRL_REG 0x0382 | ||
95 | #define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383 | ||
96 | #define AB4500_REGU_CTRL1_SPARE_REG 0x0384 | ||
97 | |||
98 | /* | ||
99 | * Regu control2 Vmod register offsets | ||
100 | */ | ||
101 | #define AB4500_REGU_VMOD_REGU_REG 0x0440 | ||
102 | #define AB4500_REGU_VMOD_SEL1_REG 0x0441 | ||
103 | #define AB4500_REGU_VMOD_SEL2_REG 0x0442 | ||
104 | #define AB4500_REGU_CTRL_DISCH_REG 0x0443 | ||
105 | #define AB4500_REGU_CTRL_DISCH2_REG 0x0444 | ||
106 | |||
107 | /* | ||
108 | * USB/ULPI register offsets | ||
109 | * Bank : 0x5 | ||
110 | */ | ||
111 | #define AB4500_USB_LINE_STAT_REG 0x0580 | ||
112 | #define AB4500_USB_LINE_CTRL1_REG 0x0581 | ||
113 | #define AB4500_USB_LINE_CTRL2_REG 0x0582 | ||
114 | #define AB4500_USB_LINE_CTRL3_REG 0x0583 | ||
115 | #define AB4500_USB_LINE_CTRL4_REG 0x0584 | ||
116 | #define AB4500_USB_LINE_CTRL5_REG 0x0585 | ||
117 | #define AB4500_USB_OTG_CTRL_REG 0x0587 | ||
118 | #define AB4500_USB_OTG_STAT_REG 0x0588 | ||
119 | #define AB4500_USB_OTG_STAT_REG 0x0588 | ||
120 | #define AB4500_USB_CTRL_SPARE_REG 0x0589 | ||
121 | #define AB4500_USB_PHY_CTRL_REG 0x058A | ||
122 | |||
123 | /* | ||
124 | * TVOUT / CTRL register offsets | ||
125 | * Bank : 0x06 | ||
126 | */ | ||
127 | #define AB4500_TVOUT_CTRL_REG 0x0680 | ||
128 | |||
129 | /* | ||
130 | * DBI register offsets | ||
131 | * Bank : 0x07 | ||
132 | */ | ||
133 | #define AB4500_DBI_REG1_REG 0x0700 | ||
134 | #define AB4500_DBI_REG2_REG 0x0701 | ||
135 | |||
136 | /* | ||
137 | * ECI regsiter offsets | ||
138 | * Bank : 0x08 | ||
139 | */ | ||
140 | #define AB4500_ECI_CTRL_REG 0x0800 | ||
141 | #define AB4500_ECI_HOOKLEVEL_REG 0x0801 | ||
142 | #define AB4500_ECI_DATAOUT_REG 0x0802 | ||
143 | #define AB4500_ECI_DATAIN_REG 0x0803 | ||
144 | |||
145 | /* | ||
146 | * AV Connector register offsets | ||
147 | * Bank : 0x08 | ||
148 | */ | ||
149 | #define AB4500_AV_CONN_REG 0x0840 | ||
150 | |||
151 | /* | ||
152 | * Accessory detection register offsets | ||
153 | * Bank : 0x08 | ||
154 | */ | ||
155 | #define AB4500_ACC_DET_DB1_REG 0x0880 | ||
156 | #define AB4500_ACC_DET_DB2_REG 0x0881 | ||
157 | |||
158 | /* | ||
159 | * GPADC register offsets | ||
160 | * Bank : 0x0A | ||
161 | */ | ||
162 | #define AB4500_GPADC_CTRL1_REG 0x0A00 | ||
163 | #define AB4500_GPADC_CTRL2_REG 0x0A01 | ||
164 | #define AB4500_GPADC_CTRL3_REG 0x0A02 | ||
165 | #define AB4500_GPADC_AUTO_TIMER_REG 0x0A03 | ||
166 | #define AB4500_GPADC_STAT_REG 0x0A04 | ||
167 | #define AB4500_GPADC_MANDATAL_REG 0x0A05 | ||
168 | #define AB4500_GPADC_MANDATAH_REG 0x0A06 | ||
169 | #define AB4500_GPADC_AUTODATAL_REG 0x0A07 | ||
170 | #define AB4500_GPADC_AUTODATAH_REG 0x0A08 | ||
171 | #define AB4500_GPADC_MUX_CTRL_REG 0x0A09 | ||
172 | |||
173 | /* | ||
174 | * Charger / status register offfsets | ||
175 | * Bank : 0x0B | ||
176 | */ | ||
177 | #define AB4500_CH_STATUS1_REG 0x0B00 | ||
178 | #define AB4500_CH_STATUS2_REG 0x0B01 | ||
179 | #define AB4500_CH_USBCH_STAT1_REG 0x0B02 | ||
180 | #define AB4500_CH_USBCH_STAT2_REG 0x0B03 | ||
181 | #define AB4500_CH_FSM_STAT_REG 0x0B04 | ||
182 | #define AB4500_CH_STAT_REG 0x0B05 | ||
183 | |||
184 | /* | ||
185 | * Charger / control register offfsets | ||
186 | * Bank : 0x0B | ||
187 | */ | ||
188 | #define AB4500_CH_VOLT_LVL_REG 0x0B40 | ||
189 | |||
190 | /* | ||
191 | * Charger / main control register offfsets | ||
192 | * Bank : 0x0B | ||
193 | */ | ||
194 | #define AB4500_MCH_CTRL1 0x0B80 | ||
195 | #define AB4500_MCH_CTRL2 0x0B81 | ||
196 | #define AB4500_MCH_IPT_CURLVL_REG 0x0B82 | ||
197 | #define AB4500_CH_WD_REG 0x0B83 | ||
198 | |||
199 | /* | ||
200 | * Charger / USB control register offsets | ||
201 | * Bank : 0x0B | ||
202 | */ | ||
203 | #define AB4500_USBCH_CTRL1_REG 0x0BC0 | ||
204 | #define AB4500_USBCH_CTRL2_REG 0x0BC1 | ||
205 | #define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2 | ||
206 | |||
207 | /* | ||
208 | * RTC bank register offsets | ||
209 | * Bank : 0xF | ||
210 | */ | ||
211 | #define AB4500_RTC_SOFF_STAT_REG 0x0F00 | ||
212 | #define AB4500_RTC_CC_CONF_REG 0x0F01 | ||
213 | #define AB4500_RTC_READ_REQ_REG 0x0F02 | ||
214 | #define AB4500_RTC_WATCH_TSECMID_REG 0x0F03 | ||
215 | #define AB4500_RTC_WATCH_TSECHI_REG 0x0F04 | ||
216 | #define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05 | ||
217 | #define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06 | ||
218 | #define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07 | ||
219 | #define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08 | ||
220 | #define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09 | ||
221 | #define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A | ||
222 | #define AB4500_RTC_STAT_REG 0x0F0B | ||
223 | #define AB4500_RTC_BKUP_CHG_REG 0x0F0C | ||
224 | #define AB4500_RTC_FORCE_BKUP_REG 0x0F0D | ||
225 | #define AB4500_RTC_CALIB_REG 0x0F0E | ||
226 | #define AB4500_RTC_SWITCH_STAT_REG 0x0F0F | ||
227 | |||
228 | /* | ||
229 | * PWM Out generators | ||
230 | * Bank: 0x10 | ||
231 | */ | ||
232 | #define AB4500_PWM_OUT_CTRL1_REG 0x1060 | ||
233 | #define AB4500_PWM_OUT_CTRL2_REG 0x1061 | ||
234 | #define AB4500_PWM_OUT_CTRL3_REG 0x1062 | ||
235 | #define AB4500_PWM_OUT_CTRL4_REG 0x1063 | ||
236 | #define AB4500_PWM_OUT_CTRL5_REG 0x1064 | ||
237 | #define AB4500_PWM_OUT_CTRL6_REG 0x1065 | ||
238 | #define AB4500_PWM_OUT_CTRL7_REG 0x1066 | ||
239 | |||
240 | #define AB4500_I2C_PAD_CTRL_REG 0x1067 | ||
241 | #define AB4500_REV_REG 0x1080 | ||
242 | |||
243 | /** | ||
244 | * struct ab4500 | ||
245 | * @spi: spi device structure | ||
246 | * @tx_buf: transmit buffer | ||
247 | * @rx_buf: receive buffer | ||
248 | * @lock: sync primitive | ||
249 | */ | ||
250 | struct ab4500 { | ||
251 | struct spi_device *spi; | ||
252 | unsigned long tx_buf[4]; | ||
253 | unsigned long rx_buf[4]; | ||
254 | struct mutex lock; | ||
255 | }; | ||
256 | |||
257 | int ab4500_write(struct ab4500 *ab4500, unsigned char block, | ||
258 | unsigned long addr, unsigned char data); | ||
259 | int ab4500_read(struct ab4500 *ab4500, unsigned char block, | ||
260 | unsigned long addr); | ||
261 | |||
262 | #endif /* MFD_AB4500_H */ | ||
diff --git a/include/linux/mfd/adp5520.h b/include/linux/mfd/adp5520.h new file mode 100644 index 000000000000..ac37558a4673 --- /dev/null +++ b/include/linux/mfd/adp5520.h | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * Definitions and platform data for Analog Devices | ||
3 | * ADP5520/ADP5501 MFD PMICs (Backlight, LED, GPIO and Keys) | ||
4 | * | ||
5 | * Copyright 2009 Analog Devices Inc. | ||
6 | * | ||
7 | * Licensed under the GPL-2 or later. | ||
8 | */ | ||
9 | |||
10 | |||
11 | #ifndef __LINUX_MFD_ADP5520_H | ||
12 | #define __LINUX_MFD_ADP5520_H | ||
13 | |||
14 | #define ID_ADP5520 5520 | ||
15 | #define ID_ADP5501 5501 | ||
16 | |||
17 | /* | ||
18 | * ADP5520/ADP5501 Register Map | ||
19 | */ | ||
20 | |||
21 | #define ADP5520_MODE_STATUS 0x00 | ||
22 | #define ADP5520_INTERRUPT_ENABLE 0x01 | ||
23 | #define ADP5520_BL_CONTROL 0x02 | ||
24 | #define ADP5520_BL_TIME 0x03 | ||
25 | #define ADP5520_BL_FADE 0x04 | ||
26 | #define ADP5520_DAYLIGHT_MAX 0x05 | ||
27 | #define ADP5520_DAYLIGHT_DIM 0x06 | ||
28 | #define ADP5520_OFFICE_MAX 0x07 | ||
29 | #define ADP5520_OFFICE_DIM 0x08 | ||
30 | #define ADP5520_DARK_MAX 0x09 | ||
31 | #define ADP5520_DARK_DIM 0x0A | ||
32 | #define ADP5520_BL_VALUE 0x0B | ||
33 | #define ADP5520_ALS_CMPR_CFG 0x0C | ||
34 | #define ADP5520_L2_TRIP 0x0D | ||
35 | #define ADP5520_L2_HYS 0x0E | ||
36 | #define ADP5520_L3_TRIP 0x0F | ||
37 | #define ADP5520_L3_HYS 0x10 | ||
38 | #define ADP5520_LED_CONTROL 0x11 | ||
39 | #define ADP5520_LED_TIME 0x12 | ||
40 | #define ADP5520_LED_FADE 0x13 | ||
41 | #define ADP5520_LED1_CURRENT 0x14 | ||
42 | #define ADP5520_LED2_CURRENT 0x15 | ||
43 | #define ADP5520_LED3_CURRENT 0x16 | ||
44 | |||
45 | /* | ||
46 | * ADP5520 Register Map | ||
47 | */ | ||
48 | |||
49 | #define ADP5520_GPIO_CFG_1 0x17 | ||
50 | #define ADP5520_GPIO_CFG_2 0x18 | ||
51 | #define ADP5520_GPIO_IN 0x19 | ||
52 | #define ADP5520_GPIO_OUT 0x1A | ||
53 | #define ADP5520_GPIO_INT_EN 0x1B | ||
54 | #define ADP5520_GPIO_INT_STAT 0x1C | ||
55 | #define ADP5520_GPIO_INT_LVL 0x1D | ||
56 | #define ADP5520_GPIO_DEBOUNCE 0x1E | ||
57 | #define ADP5520_GPIO_PULLUP 0x1F | ||
58 | #define ADP5520_KP_INT_STAT_1 0x20 | ||
59 | #define ADP5520_KP_INT_STAT_2 0x21 | ||
60 | #define ADP5520_KR_INT_STAT_1 0x22 | ||
61 | #define ADP5520_KR_INT_STAT_2 0x23 | ||
62 | #define ADP5520_KEY_STAT_1 0x24 | ||
63 | #define ADP5520_KEY_STAT_2 0x25 | ||
64 | |||
65 | /* | ||
66 | * MODE_STATUS bits | ||
67 | */ | ||
68 | |||
69 | #define ADP5520_nSTNBY (1 << 7) | ||
70 | #define ADP5520_BL_EN (1 << 6) | ||
71 | #define ADP5520_DIM_EN (1 << 5) | ||
72 | #define ADP5520_OVP_INT (1 << 4) | ||
73 | #define ADP5520_CMPR_INT (1 << 3) | ||
74 | #define ADP5520_GPI_INT (1 << 2) | ||
75 | #define ADP5520_KR_INT (1 << 1) | ||
76 | #define ADP5520_KP_INT (1 << 0) | ||
77 | |||
78 | /* | ||
79 | * INTERRUPT_ENABLE bits | ||
80 | */ | ||
81 | |||
82 | #define ADP5520_AUTO_LD_EN (1 << 4) | ||
83 | #define ADP5520_CMPR_IEN (1 << 3) | ||
84 | #define ADP5520_OVP_IEN (1 << 2) | ||
85 | #define ADP5520_KR_IEN (1 << 1) | ||
86 | #define ADP5520_KP_IEN (1 << 0) | ||
87 | |||
88 | /* | ||
89 | * BL_CONTROL bits | ||
90 | */ | ||
91 | |||
92 | #define ADP5520_BL_LVL ((x) << 5) | ||
93 | #define ADP5520_BL_LAW ((x) << 4) | ||
94 | #define ADP5520_BL_AUTO_ADJ (1 << 3) | ||
95 | #define ADP5520_OVP_EN (1 << 2) | ||
96 | #define ADP5520_FOVR (1 << 1) | ||
97 | #define ADP5520_KP_BL_EN (1 << 0) | ||
98 | |||
99 | /* | ||
100 | * ALS_CMPR_CFG bits | ||
101 | */ | ||
102 | |||
103 | #define ADP5520_L3_OUT (1 << 3) | ||
104 | #define ADP5520_L2_OUT (1 << 2) | ||
105 | #define ADP5520_L3_EN (1 << 1) | ||
106 | |||
107 | #define ADP5020_MAX_BRIGHTNESS 0x7F | ||
108 | |||
109 | #define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4)) | ||
110 | #define BL_CTRL_VAL(law, auto) (((1 & (auto)) << 3) | ((0x3 & (law)) << 4)) | ||
111 | #define ALS_CMPR_CFG_VAL(filt, l3_en) (((0x7 & filt) << 5) | l3_en) | ||
112 | |||
113 | /* | ||
114 | * LEDs subdevice bits and masks | ||
115 | */ | ||
116 | |||
117 | #define ADP5520_01_MAXLEDS 3 | ||
118 | |||
119 | #define ADP5520_FLAG_LED_MASK 0x3 | ||
120 | #define ADP5520_FLAG_OFFT_SHIFT 8 | ||
121 | #define ADP5520_FLAG_OFFT_MASK 0x3 | ||
122 | |||
123 | #define ADP5520_R3_MODE (1 << 5) | ||
124 | #define ADP5520_C3_MODE (1 << 4) | ||
125 | #define ADP5520_LED_LAW (1 << 3) | ||
126 | #define ADP5520_LED3_EN (1 << 2) | ||
127 | #define ADP5520_LED2_EN (1 << 1) | ||
128 | #define ADP5520_LED1_EN (1 << 0) | ||
129 | |||
130 | /* | ||
131 | * GPIO subdevice bits and masks | ||
132 | */ | ||
133 | |||
134 | #define ADP5520_MAXGPIOS 8 | ||
135 | |||
136 | #define ADP5520_GPIO_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */ | ||
137 | #define ADP5520_GPIO_C2 (1 << 6) | ||
138 | #define ADP5520_GPIO_C1 (1 << 5) | ||
139 | #define ADP5520_GPIO_C0 (1 << 4) | ||
140 | #define ADP5520_GPIO_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */ | ||
141 | #define ADP5520_GPIO_R2 (1 << 2) | ||
142 | #define ADP5520_GPIO_R1 (1 << 1) | ||
143 | #define ADP5520_GPIO_R0 (1 << 0) | ||
144 | |||
145 | struct adp5520_gpio_platform_data { | ||
146 | unsigned gpio_start; | ||
147 | u8 gpio_en_mask; | ||
148 | u8 gpio_pullup_mask; | ||
149 | }; | ||
150 | |||
151 | /* | ||
152 | * Keypad subdevice bits and masks | ||
153 | */ | ||
154 | |||
155 | #define ADP5520_MAXKEYS 16 | ||
156 | |||
157 | #define ADP5520_COL_C3 (1 << 7) /* LED2 or GPIO7 aka C3 */ | ||
158 | #define ADP5520_COL_C2 (1 << 6) | ||
159 | #define ADP5520_COL_C1 (1 << 5) | ||
160 | #define ADP5520_COL_C0 (1 << 4) | ||
161 | #define ADP5520_ROW_R3 (1 << 3) /* LED3 or GPIO3 aka R3 */ | ||
162 | #define ADP5520_ROW_R2 (1 << 2) | ||
163 | #define ADP5520_ROW_R1 (1 << 1) | ||
164 | #define ADP5520_ROW_R0 (1 << 0) | ||
165 | |||
166 | #define ADP5520_KEY(row, col) (col + row * 4) | ||
167 | #define ADP5520_KEYMAPSIZE ADP5520_MAXKEYS | ||
168 | |||
169 | struct adp5520_keys_platform_data { | ||
170 | int rows_en_mask; /* Number of rows */ | ||
171 | int cols_en_mask; /* Number of columns */ | ||
172 | const unsigned short *keymap; /* Pointer to keymap */ | ||
173 | unsigned short keymapsize; /* Keymap size */ | ||
174 | unsigned repeat:1; /* Enable key repeat */ | ||
175 | }; | ||
176 | |||
177 | |||
178 | /* | ||
179 | * LEDs subdevice platform data | ||
180 | */ | ||
181 | |||
182 | #define FLAG_ID_ADP5520_LED1_ADP5501_LED0 1 /* ADP5520 PIN ILED */ | ||
183 | #define FLAG_ID_ADP5520_LED2_ADP5501_LED1 2 /* ADP5520 PIN C3 */ | ||
184 | #define FLAG_ID_ADP5520_LED3_ADP5501_LED2 3 /* ADP5520 PIN R3 */ | ||
185 | |||
186 | #define ADP5520_LED_DIS_BLINK (0 << ADP5520_FLAG_OFFT_SHIFT) | ||
187 | #define ADP5520_LED_OFFT_600ms (1 << ADP5520_FLAG_OFFT_SHIFT) | ||
188 | #define ADP5520_LED_OFFT_800ms (2 << ADP5520_FLAG_OFFT_SHIFT) | ||
189 | #define ADP5520_LED_OFFT_1200ms (3 << ADP5520_FLAG_OFFT_SHIFT) | ||
190 | |||
191 | #define ADP5520_LED_ONT_200ms 0 | ||
192 | #define ADP5520_LED_ONT_600ms 1 | ||
193 | #define ADP5520_LED_ONT_800ms 2 | ||
194 | #define ADP5520_LED_ONT_1200ms 3 | ||
195 | |||
196 | struct adp5520_leds_platform_data { | ||
197 | int num_leds; | ||
198 | struct led_info *leds; | ||
199 | u8 fade_in; /* Backlight Fade-In Timer */ | ||
200 | u8 fade_out; /* Backlight Fade-Out Timer */ | ||
201 | u8 led_on_time; | ||
202 | }; | ||
203 | |||
204 | /* | ||
205 | * Backlight subdevice platform data | ||
206 | */ | ||
207 | |||
208 | #define ADP5520_FADE_T_DIS 0 /* Fade Timer Disabled */ | ||
209 | #define ADP5520_FADE_T_300ms 1 /* 0.3 Sec */ | ||
210 | #define ADP5520_FADE_T_600ms 2 | ||
211 | #define ADP5520_FADE_T_900ms 3 | ||
212 | #define ADP5520_FADE_T_1200ms 4 | ||
213 | #define ADP5520_FADE_T_1500ms 5 | ||
214 | #define ADP5520_FADE_T_1800ms 6 | ||
215 | #define ADP5520_FADE_T_2100ms 7 | ||
216 | #define ADP5520_FADE_T_2400ms 8 | ||
217 | #define ADP5520_FADE_T_2700ms 9 | ||
218 | #define ADP5520_FADE_T_3000ms 10 | ||
219 | #define ADP5520_FADE_T_3500ms 11 | ||
220 | #define ADP5520_FADE_T_4000ms 12 | ||
221 | #define ADP5520_FADE_T_4500ms 13 | ||
222 | #define ADP5520_FADE_T_5000ms 14 | ||
223 | #define ADP5520_FADE_T_5500ms 15 /* 5.5 Sec */ | ||
224 | |||
225 | #define ADP5520_BL_LAW_LINEAR 0 | ||
226 | #define ADP5520_BL_LAW_SQUARE 1 | ||
227 | #define ADP5520_BL_LAW_CUBIC1 2 | ||
228 | #define ADP5520_BL_LAW_CUBIC2 3 | ||
229 | |||
230 | #define ADP5520_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */ | ||
231 | #define ADP5520_BL_AMBL_FILT_160ms 1 | ||
232 | #define ADP5520_BL_AMBL_FILT_320ms 2 | ||
233 | #define ADP5520_BL_AMBL_FILT_640ms 3 | ||
234 | #define ADP5520_BL_AMBL_FILT_1280ms 4 | ||
235 | #define ADP5520_BL_AMBL_FILT_2560ms 5 | ||
236 | #define ADP5520_BL_AMBL_FILT_5120ms 6 | ||
237 | #define ADP5520_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */ | ||
238 | |||
239 | /* | ||
240 | * Blacklight current 0..30mA | ||
241 | */ | ||
242 | #define ADP5520_BL_CUR_mA(I) ((I * 127) / 30) | ||
243 | |||
244 | /* | ||
245 | * L2 comparator current 0..1000uA | ||
246 | */ | ||
247 | #define ADP5520_L2_COMP_CURR_uA(I) ((I * 255) / 1000) | ||
248 | |||
249 | /* | ||
250 | * L3 comparator current 0..127uA | ||
251 | */ | ||
252 | #define ADP5520_L3_COMP_CURR_uA(I) ((I * 255) / 127) | ||
253 | |||
254 | struct adp5520_backlight_platform_data { | ||
255 | u8 fade_in; /* Backlight Fade-In Timer */ | ||
256 | u8 fade_out; /* Backlight Fade-Out Timer */ | ||
257 | u8 fade_led_law; /* fade-on/fade-off transfer characteristic */ | ||
258 | |||
259 | u8 en_ambl_sens; /* 1 = enable ambient light sensor */ | ||
260 | u8 abml_filt; /* Light sensor filter time */ | ||
261 | u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
262 | u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
263 | u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
264 | u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
265 | u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
266 | u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ | ||
267 | u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */ | ||
268 | u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1000 uA */ | ||
269 | u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */ | ||
270 | u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 127 uA */ | ||
271 | }; | ||
272 | |||
273 | /* | ||
274 | * MFD chip platform data | ||
275 | */ | ||
276 | |||
277 | struct adp5520_platform_data { | ||
278 | struct adp5520_keys_platform_data *keys; | ||
279 | struct adp5520_gpio_platform_data *gpio; | ||
280 | struct adp5520_leds_platform_data *leds; | ||
281 | struct adp5520_backlight_platform_data *backlight; | ||
282 | }; | ||
283 | |||
284 | /* | ||
285 | * MFD chip functions | ||
286 | */ | ||
287 | |||
288 | extern int adp5520_read(struct device *dev, int reg, uint8_t *val); | ||
289 | extern int adp5520_write(struct device *dev, int reg, u8 val); | ||
290 | extern int adp5520_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
291 | extern int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
292 | |||
293 | extern int adp5520_register_notifier(struct device *dev, | ||
294 | struct notifier_block *nb, unsigned int events); | ||
295 | |||
296 | extern int adp5520_unregister_notifier(struct device *dev, | ||
297 | struct notifier_block *nb, unsigned int events); | ||
298 | |||
299 | #endif /* __LINUX_MFD_ADP5520_H */ | ||
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h index e5124ceea769..40c372165f3e 100644 --- a/include/linux/mfd/ezx-pcap.h +++ b/include/linux/mfd/ezx-pcap.h | |||
@@ -45,7 +45,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
45 | #define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff | 45 | #define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff |
46 | #define PCAP_MASK_ALL_INTERRUPT 0x01ffffff | 46 | #define PCAP_MASK_ALL_INTERRUPT 0x01ffffff |
47 | 47 | ||
48 | /* registers acessible by both pcap ports */ | 48 | /* registers accessible by both pcap ports */ |
49 | #define PCAP_REG_ISR 0x0 /* Interrupt Status */ | 49 | #define PCAP_REG_ISR 0x0 /* Interrupt Status */ |
50 | #define PCAP_REG_MSR 0x1 /* Interrupt Mask */ | 50 | #define PCAP_REG_MSR 0x1 /* Interrupt Mask */ |
51 | #define PCAP_REG_PSTAT 0x2 /* Processor Status */ | 51 | #define PCAP_REG_PSTAT 0x2 /* Processor Status */ |
@@ -67,7 +67,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
67 | #define PCAP_REG_VENDOR_TEST1 0x1e | 67 | #define PCAP_REG_VENDOR_TEST1 0x1e |
68 | #define PCAP_REG_VENDOR_TEST2 0x1f | 68 | #define PCAP_REG_VENDOR_TEST2 0x1f |
69 | 69 | ||
70 | /* registers acessible by pcap port 1 only (a1200, e2 & e6) */ | 70 | /* registers accessible by pcap port 1 only (a1200, e2 & e6) */ |
71 | #define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */ | 71 | #define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */ |
72 | #define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */ | 72 | #define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */ |
73 | #define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */ | 73 | #define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */ |
@@ -231,9 +231,6 @@ void pcap_set_ts_bits(struct pcap_chip *, u32); | |||
231 | #define PCAP_LED_4MA 1 | 231 | #define PCAP_LED_4MA 1 |
232 | #define PCAP_LED_5MA 2 | 232 | #define PCAP_LED_5MA 2 |
233 | #define PCAP_LED_9MA 3 | 233 | #define PCAP_LED_9MA 3 |
234 | #define PCAP_LED_GPIO_VAL_MASK 0x00ffffff | ||
235 | #define PCAP_LED_GPIO_EN 0x01000000 | ||
236 | #define PCAP_LED_GPIO_INVERT 0x02000000 | ||
237 | #define PCAP_LED_T_MASK 0xf | 234 | #define PCAP_LED_T_MASK 0xf |
238 | #define PCAP_LED_C_MASK 0x3 | 235 | #define PCAP_LED_C_MASK 0x3 |
239 | #define PCAP_BL_MASK 0x1f | 236 | #define PCAP_BL_MASK 0x1f |
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h index 47e698cb0f16..95cf9360553f 100644 --- a/include/linux/mfd/mc13783-private.h +++ b/include/linux/mfd/mc13783-private.h | |||
@@ -24,52 +24,23 @@ | |||
24 | 24 | ||
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/mfd/mc13783.h> | 26 | #include <linux/mfd/mc13783.h> |
27 | #include <linux/workqueue.h> | ||
28 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
29 | 28 | #include <linux/interrupt.h> | |
30 | struct mc13783_irq { | ||
31 | void (*handler)(int, void *); | ||
32 | void *data; | ||
33 | }; | ||
34 | |||
35 | #define MC13783_NUM_IRQ 2 | ||
36 | #define MC13783_IRQ_TS 0 | ||
37 | #define MC13783_IRQ_REGULATOR 1 | ||
38 | |||
39 | #define MC13783_ADC_MODE_TS 1 | ||
40 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | ||
41 | #define MC13783_ADC_MODE_MULT_CHAN 3 | ||
42 | 29 | ||
43 | struct mc13783 { | 30 | struct mc13783 { |
44 | int revision; | 31 | struct spi_device *spidev; |
45 | struct device *dev; | 32 | struct mutex lock; |
46 | struct spi_device *spi_device; | ||
47 | |||
48 | int (*read_dev)(void *data, char reg, int count, u32 *dst); | ||
49 | int (*write_dev)(void *data, char reg, int count, const u32 *src); | ||
50 | |||
51 | struct mutex io_lock; | ||
52 | void *io_data; | ||
53 | int irq; | 33 | int irq; |
54 | unsigned int flags; | 34 | int flags; |
55 | 35 | ||
56 | struct mc13783_irq irq_handler[MC13783_NUM_IRQ]; | 36 | irq_handler_t irqhandler[MC13783_NUM_IRQ]; |
57 | struct work_struct work; | 37 | void *irqdata[MC13783_NUM_IRQ]; |
58 | struct completion adc_done; | ||
59 | unsigned int ts_active; | ||
60 | struct mutex adc_conv_lock; | ||
61 | 38 | ||
39 | /* XXX these should go as platformdata to the regulator subdevice */ | ||
62 | struct mc13783_regulator_init_data *regulators; | 40 | struct mc13783_regulator_init_data *regulators; |
63 | int num_regulators; | 41 | int num_regulators; |
64 | }; | 42 | }; |
65 | 43 | ||
66 | int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *); | ||
67 | int mc13783_reg_write(struct mc13783 *, int, u32); | ||
68 | int mc13783_set_bits(struct mc13783 *, int, u32, u32); | ||
69 | int mc13783_free_irq(struct mc13783 *mc13783, int irq); | ||
70 | int mc13783_register_irq(struct mc13783 *mc13783, int irq, | ||
71 | void (*handler) (int, void *), void *data); | ||
72 | |||
73 | #define MC13783_REG_INTERRUPT_STATUS_0 0 | 44 | #define MC13783_REG_INTERRUPT_STATUS_0 0 |
74 | #define MC13783_REG_INTERRUPT_MASK_0 1 | 45 | #define MC13783_REG_INTERRUPT_MASK_0 1 |
75 | #define MC13783_REG_INTERRUPT_SENSE_0 2 | 46 | #define MC13783_REG_INTERRUPT_SENSE_0 2 |
@@ -136,55 +107,6 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq, | |||
136 | #define MC13783_REG_TEST_3 63 | 107 | #define MC13783_REG_TEST_3 63 |
137 | #define MC13783_REG_NB 64 | 108 | #define MC13783_REG_NB 64 |
138 | 109 | ||
139 | |||
140 | /* | ||
141 | * Interrupt Status | ||
142 | */ | ||
143 | #define MC13783_INT_STAT_ADCDONEI (1 << 0) | ||
144 | #define MC13783_INT_STAT_ADCBISDONEI (1 << 1) | ||
145 | #define MC13783_INT_STAT_TSI (1 << 2) | ||
146 | #define MC13783_INT_STAT_WHIGHI (1 << 3) | ||
147 | #define MC13783_INT_STAT_WLOWI (1 << 4) | ||
148 | #define MC13783_INT_STAT_CHGDETI (1 << 6) | ||
149 | #define MC13783_INT_STAT_CHGOVI (1 << 7) | ||
150 | #define MC13783_INT_STAT_CHGREVI (1 << 8) | ||
151 | #define MC13783_INT_STAT_CHGSHORTI (1 << 9) | ||
152 | #define MC13783_INT_STAT_CCCVI (1 << 10) | ||
153 | #define MC13783_INT_STAT_CHGCURRI (1 << 11) | ||
154 | #define MC13783_INT_STAT_BPONI (1 << 12) | ||
155 | #define MC13783_INT_STAT_LOBATLI (1 << 13) | ||
156 | #define MC13783_INT_STAT_LOBATHI (1 << 14) | ||
157 | #define MC13783_INT_STAT_UDPI (1 << 15) | ||
158 | #define MC13783_INT_STAT_USBI (1 << 16) | ||
159 | #define MC13783_INT_STAT_IDI (1 << 19) | ||
160 | #define MC13783_INT_STAT_Unused (1 << 20) | ||
161 | #define MC13783_INT_STAT_SE1I (1 << 21) | ||
162 | #define MC13783_INT_STAT_CKDETI (1 << 22) | ||
163 | #define MC13783_INT_STAT_UDMI (1 << 23) | ||
164 | |||
165 | /* | ||
166 | * Interrupt Mask | ||
167 | */ | ||
168 | #define MC13783_INT_MASK_ADCDONEM (1 << 0) | ||
169 | #define MC13783_INT_MASK_ADCBISDONEM (1 << 1) | ||
170 | #define MC13783_INT_MASK_TSM (1 << 2) | ||
171 | #define MC13783_INT_MASK_WHIGHM (1 << 3) | ||
172 | #define MC13783_INT_MASK_WLOWM (1 << 4) | ||
173 | #define MC13783_INT_MASK_CHGDETM (1 << 6) | ||
174 | #define MC13783_INT_MASK_CHGOVM (1 << 7) | ||
175 | #define MC13783_INT_MASK_CHGREVM (1 << 8) | ||
176 | #define MC13783_INT_MASK_CHGSHORTM (1 << 9) | ||
177 | #define MC13783_INT_MASK_CCCVM (1 << 10) | ||
178 | #define MC13783_INT_MASK_CHGCURRM (1 << 11) | ||
179 | #define MC13783_INT_MASK_BPONM (1 << 12) | ||
180 | #define MC13783_INT_MASK_LOBATLM (1 << 13) | ||
181 | #define MC13783_INT_MASK_LOBATHM (1 << 14) | ||
182 | #define MC13783_INT_MASK_UDPM (1 << 15) | ||
183 | #define MC13783_INT_MASK_USBM (1 << 16) | ||
184 | #define MC13783_INT_MASK_IDM (1 << 19) | ||
185 | #define MC13783_INT_MASK_SE1M (1 << 21) | ||
186 | #define MC13783_INT_MASK_CKDETM (1 << 22) | ||
187 | |||
188 | /* | 110 | /* |
189 | * Reg Regulator Mode 0 | 111 | * Reg Regulator Mode 0 |
190 | */ | 112 | */ |
@@ -284,113 +206,15 @@ int mc13783_register_irq(struct mc13783 *mc13783, int irq, | |||
284 | #define MC13783_SWCTRL_SW3_STBY (1 << 21) | 206 | #define MC13783_SWCTRL_SW3_STBY (1 << 21) |
285 | #define MC13783_SWCTRL_SW3_MODE (1 << 22) | 207 | #define MC13783_SWCTRL_SW3_MODE (1 << 22) |
286 | 208 | ||
287 | /* | 209 | static inline int mc13783_set_bits(struct mc13783 *mc13783, unsigned int offset, |
288 | * ADC/Touch | 210 | u32 mask, u32 val) |
289 | */ | 211 | { |
290 | #define MC13783_ADC0_LICELLCON (1 << 0) | 212 | int ret; |
291 | #define MC13783_ADC0_CHRGICON (1 << 1) | 213 | mc13783_lock(mc13783); |
292 | #define MC13783_ADC0_BATICON (1 << 2) | 214 | ret = mc13783_reg_rmw(mc13783, offset, mask, val); |
293 | #define MC13783_ADC0_RTHEN (1 << 3) | 215 | mc13783_unlock(mc13783); |
294 | #define MC13783_ADC0_DTHEN (1 << 4) | ||
295 | #define MC13783_ADC0_UIDEN (1 << 5) | ||
296 | #define MC13783_ADC0_ADOUTEN (1 << 6) | ||
297 | #define MC13783_ADC0_ADOUTPER (1 << 7) | ||
298 | #define MC13783_ADC0_ADREFEN (1 << 10) | ||
299 | #define MC13783_ADC0_ADREFMODE (1 << 11) | ||
300 | #define MC13783_ADC0_TSMOD0 (1 << 12) | ||
301 | #define MC13783_ADC0_TSMOD1 (1 << 13) | ||
302 | #define MC13783_ADC0_TSMOD2 (1 << 14) | ||
303 | #define MC13783_ADC0_CHRGRAWDIV (1 << 15) | ||
304 | #define MC13783_ADC0_ADINC1 (1 << 16) | ||
305 | #define MC13783_ADC0_ADINC2 (1 << 17) | ||
306 | #define MC13783_ADC0_WCOMP (1 << 18) | ||
307 | #define MC13783_ADC0_ADCBIS0 (1 << 23) | ||
308 | |||
309 | #define MC13783_ADC1_ADEN (1 << 0) | ||
310 | #define MC13783_ADC1_RAND (1 << 1) | ||
311 | #define MC13783_ADC1_ADSEL (1 << 3) | ||
312 | #define MC13783_ADC1_TRIGMASK (1 << 4) | ||
313 | #define MC13783_ADC1_ADA10 (1 << 5) | ||
314 | #define MC13783_ADC1_ADA11 (1 << 6) | ||
315 | #define MC13783_ADC1_ADA12 (1 << 7) | ||
316 | #define MC13783_ADC1_ADA20 (1 << 8) | ||
317 | #define MC13783_ADC1_ADA21 (1 << 9) | ||
318 | #define MC13783_ADC1_ADA22 (1 << 10) | ||
319 | #define MC13783_ADC1_ATO0 (1 << 11) | ||
320 | #define MC13783_ADC1_ATO1 (1 << 12) | ||
321 | #define MC13783_ADC1_ATO2 (1 << 13) | ||
322 | #define MC13783_ADC1_ATO3 (1 << 14) | ||
323 | #define MC13783_ADC1_ATO4 (1 << 15) | ||
324 | #define MC13783_ADC1_ATO5 (1 << 16) | ||
325 | #define MC13783_ADC1_ATO6 (1 << 17) | ||
326 | #define MC13783_ADC1_ATO7 (1 << 18) | ||
327 | #define MC13783_ADC1_ATOX (1 << 19) | ||
328 | #define MC13783_ADC1_ASC (1 << 20) | ||
329 | #define MC13783_ADC1_ADTRIGIGN (1 << 21) | ||
330 | #define MC13783_ADC1_ADONESHOT (1 << 22) | ||
331 | #define MC13783_ADC1_ADCBIS1 (1 << 23) | ||
332 | |||
333 | #define MC13783_ADC1_CHAN0_SHIFT 5 | ||
334 | #define MC13783_ADC1_CHAN1_SHIFT 8 | ||
335 | |||
336 | #define MC13783_ADC2_ADD10 (1 << 2) | ||
337 | #define MC13783_ADC2_ADD11 (1 << 3) | ||
338 | #define MC13783_ADC2_ADD12 (1 << 4) | ||
339 | #define MC13783_ADC2_ADD13 (1 << 5) | ||
340 | #define MC13783_ADC2_ADD14 (1 << 6) | ||
341 | #define MC13783_ADC2_ADD15 (1 << 7) | ||
342 | #define MC13783_ADC2_ADD16 (1 << 8) | ||
343 | #define MC13783_ADC2_ADD17 (1 << 9) | ||
344 | #define MC13783_ADC2_ADD18 (1 << 10) | ||
345 | #define MC13783_ADC2_ADD19 (1 << 11) | ||
346 | #define MC13783_ADC2_ADD20 (1 << 14) | ||
347 | #define MC13783_ADC2_ADD21 (1 << 15) | ||
348 | #define MC13783_ADC2_ADD22 (1 << 16) | ||
349 | #define MC13783_ADC2_ADD23 (1 << 17) | ||
350 | #define MC13783_ADC2_ADD24 (1 << 18) | ||
351 | #define MC13783_ADC2_ADD25 (1 << 19) | ||
352 | #define MC13783_ADC2_ADD26 (1 << 20) | ||
353 | #define MC13783_ADC2_ADD27 (1 << 21) | ||
354 | #define MC13783_ADC2_ADD28 (1 << 22) | ||
355 | #define MC13783_ADC2_ADD29 (1 << 23) | ||
356 | 216 | ||
357 | #define MC13783_ADC3_WHIGH0 (1 << 0) | 217 | return ret; |
358 | #define MC13783_ADC3_WHIGH1 (1 << 1) | 218 | } |
359 | #define MC13783_ADC3_WHIGH2 (1 << 2) | ||
360 | #define MC13783_ADC3_WHIGH3 (1 << 3) | ||
361 | #define MC13783_ADC3_WHIGH4 (1 << 4) | ||
362 | #define MC13783_ADC3_WHIGH5 (1 << 5) | ||
363 | #define MC13783_ADC3_ICID0 (1 << 6) | ||
364 | #define MC13783_ADC3_ICID1 (1 << 7) | ||
365 | #define MC13783_ADC3_ICID2 (1 << 8) | ||
366 | #define MC13783_ADC3_WLOW0 (1 << 9) | ||
367 | #define MC13783_ADC3_WLOW1 (1 << 10) | ||
368 | #define MC13783_ADC3_WLOW2 (1 << 11) | ||
369 | #define MC13783_ADC3_WLOW3 (1 << 12) | ||
370 | #define MC13783_ADC3_WLOW4 (1 << 13) | ||
371 | #define MC13783_ADC3_WLOW5 (1 << 14) | ||
372 | #define MC13783_ADC3_ADCBIS2 (1 << 23) | ||
373 | |||
374 | #define MC13783_ADC4_ADDBIS10 (1 << 2) | ||
375 | #define MC13783_ADC4_ADDBIS11 (1 << 3) | ||
376 | #define MC13783_ADC4_ADDBIS12 (1 << 4) | ||
377 | #define MC13783_ADC4_ADDBIS13 (1 << 5) | ||
378 | #define MC13783_ADC4_ADDBIS14 (1 << 6) | ||
379 | #define MC13783_ADC4_ADDBIS15 (1 << 7) | ||
380 | #define MC13783_ADC4_ADDBIS16 (1 << 8) | ||
381 | #define MC13783_ADC4_ADDBIS17 (1 << 9) | ||
382 | #define MC13783_ADC4_ADDBIS18 (1 << 10) | ||
383 | #define MC13783_ADC4_ADDBIS19 (1 << 11) | ||
384 | #define MC13783_ADC4_ADDBIS20 (1 << 14) | ||
385 | #define MC13783_ADC4_ADDBIS21 (1 << 15) | ||
386 | #define MC13783_ADC4_ADDBIS22 (1 << 16) | ||
387 | #define MC13783_ADC4_ADDBIS23 (1 << 17) | ||
388 | #define MC13783_ADC4_ADDBIS24 (1 << 18) | ||
389 | #define MC13783_ADC4_ADDBIS25 (1 << 19) | ||
390 | #define MC13783_ADC4_ADDBIS26 (1 << 20) | ||
391 | #define MC13783_ADC4_ADDBIS27 (1 << 21) | ||
392 | #define MC13783_ADC4_ADDBIS28 (1 << 22) | ||
393 | #define MC13783_ADC4_ADDBIS29 (1 << 23) | ||
394 | 219 | ||
395 | #endif /* __LINUX_MFD_MC13783_PRIV_H */ | 220 | #endif /* __LINUX_MFD_MC13783_PRIV_H */ |
396 | |||
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h index b3a2a7243573..35680409b8cf 100644 --- a/include/linux/mfd/mc13783.h +++ b/include/linux/mfd/mc13783.h | |||
@@ -1,28 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> | 2 | * Copyright 2009 Pengutronix |
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
3 | * | 4 | * |
4 | * Initial development of this code was funded by | 5 | * This program is free software; you can redistribute it and/or modify it under |
5 | * Phytec Messtechnik GmbH, http://www.phytec.de | 6 | * the terms of the GNU General Public License version 2 as published by the |
6 | * | 7 | * Free Software Foundation. |
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | 8 | */ |
9 | #ifndef __LINUX_MFD_MC13783_H | ||
10 | #define __LINUX_MFD_MC13783_H | ||
21 | 11 | ||
22 | #ifndef __INCLUDE_LINUX_MFD_MC13783_H | 12 | #include <linux/interrupt.h> |
23 | #define __INCLUDE_LINUX_MFD_MC13783_H | ||
24 | 13 | ||
25 | struct mc13783; | 14 | struct mc13783; |
15 | |||
16 | void mc13783_lock(struct mc13783 *mc13783); | ||
17 | void mc13783_unlock(struct mc13783 *mc13783); | ||
18 | |||
19 | int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); | ||
20 | int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); | ||
21 | int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, | ||
22 | u32 mask, u32 val); | ||
23 | |||
24 | int mc13783_irq_request(struct mc13783 *mc13783, int irq, | ||
25 | irq_handler_t handler, const char *name, void *dev); | ||
26 | int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, | ||
27 | irq_handler_t handler, const char *name, void *dev); | ||
28 | int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); | ||
29 | int mc13783_ackirq(struct mc13783 *mc13783, int irq); | ||
30 | |||
31 | int mc13783_mask(struct mc13783 *mc13783, int irq); | ||
32 | int mc13783_unmask(struct mc13783 *mc13783, int irq); | ||
33 | |||
34 | #define MC13783_ADC0 43 | ||
35 | #define MC13783_ADC0_ADREFEN (1 << 10) | ||
36 | #define MC13783_ADC0_ADREFMODE (1 << 11) | ||
37 | #define MC13783_ADC0_TSMOD0 (1 << 12) | ||
38 | #define MC13783_ADC0_TSMOD1 (1 << 13) | ||
39 | #define MC13783_ADC0_TSMOD2 (1 << 14) | ||
40 | #define MC13783_ADC0_ADINC1 (1 << 16) | ||
41 | #define MC13783_ADC0_ADINC2 (1 << 17) | ||
42 | |||
43 | #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \ | ||
44 | MC13783_ADC0_TSMOD1 | \ | ||
45 | MC13783_ADC0_TSMOD2) | ||
46 | |||
47 | /* to be cleaned up */ | ||
26 | struct regulator_init_data; | 48 | struct regulator_init_data; |
27 | 49 | ||
28 | struct mc13783_regulator_init_data { | 50 | struct mc13783_regulator_init_data { |
@@ -30,23 +52,30 @@ struct mc13783_regulator_init_data { | |||
30 | struct regulator_init_data *init_data; | 52 | struct regulator_init_data *init_data; |
31 | }; | 53 | }; |
32 | 54 | ||
33 | struct mc13783_platform_data { | 55 | struct mc13783_regulator_platform_data { |
34 | struct mc13783_regulator_init_data *regulators; | ||
35 | int num_regulators; | 56 | int num_regulators; |
36 | unsigned int flags; | 57 | struct mc13783_regulator_init_data *regulators; |
37 | }; | 58 | }; |
38 | 59 | ||
39 | /* mc13783_platform_data flags */ | 60 | struct mc13783_platform_data { |
61 | int num_regulators; | ||
62 | struct mc13783_regulator_init_data *regulators; | ||
63 | |||
40 | #define MC13783_USE_TOUCHSCREEN (1 << 0) | 64 | #define MC13783_USE_TOUCHSCREEN (1 << 0) |
41 | #define MC13783_USE_CODEC (1 << 1) | 65 | #define MC13783_USE_CODEC (1 << 1) |
42 | #define MC13783_USE_ADC (1 << 2) | 66 | #define MC13783_USE_ADC (1 << 2) |
43 | #define MC13783_USE_RTC (1 << 3) | 67 | #define MC13783_USE_RTC (1 << 3) |
44 | #define MC13783_USE_REGULATOR (1 << 4) | 68 | #define MC13783_USE_REGULATOR (1 << 4) |
69 | unsigned int flags; | ||
70 | }; | ||
71 | |||
72 | #define MC13783_ADC_MODE_TS 1 | ||
73 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | ||
74 | #define MC13783_ADC_MODE_MULT_CHAN 3 | ||
45 | 75 | ||
46 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, | 76 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, |
47 | unsigned int channel, unsigned int *sample); | 77 | unsigned int channel, unsigned int *sample); |
48 | 78 | ||
49 | void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | ||
50 | 79 | ||
51 | #define MC13783_SW_SW1A 0 | 80 | #define MC13783_SW_SW1A 0 |
52 | #define MC13783_SW_SW1B 1 | 81 | #define MC13783_SW_SW1B 1 |
@@ -80,5 +109,46 @@ void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | |||
80 | #define MC13783_REGU_V3 29 | 109 | #define MC13783_REGU_V3 29 |
81 | #define MC13783_REGU_V4 30 | 110 | #define MC13783_REGU_V4 30 |
82 | 111 | ||
83 | #endif /* __INCLUDE_LINUX_MFD_MC13783_H */ | 112 | #define MC13783_IRQ_ADCDONE 0 |
113 | #define MC13783_IRQ_ADCBISDONE 1 | ||
114 | #define MC13783_IRQ_TS 2 | ||
115 | #define MC13783_IRQ_WHIGH 3 | ||
116 | #define MC13783_IRQ_WLOW 4 | ||
117 | #define MC13783_IRQ_CHGDET 6 | ||
118 | #define MC13783_IRQ_CHGOV 7 | ||
119 | #define MC13783_IRQ_CHGREV 8 | ||
120 | #define MC13783_IRQ_CHGSHORT 9 | ||
121 | #define MC13783_IRQ_CCCV 10 | ||
122 | #define MC13783_IRQ_CHGCURR 11 | ||
123 | #define MC13783_IRQ_BPON 12 | ||
124 | #define MC13783_IRQ_LOBATL 13 | ||
125 | #define MC13783_IRQ_LOBATH 14 | ||
126 | #define MC13783_IRQ_UDP 15 | ||
127 | #define MC13783_IRQ_USB 16 | ||
128 | #define MC13783_IRQ_ID 19 | ||
129 | #define MC13783_IRQ_SE1 21 | ||
130 | #define MC13783_IRQ_CKDET 22 | ||
131 | #define MC13783_IRQ_UDM 23 | ||
132 | #define MC13783_IRQ_1HZ 24 | ||
133 | #define MC13783_IRQ_TODA 25 | ||
134 | #define MC13783_IRQ_ONOFD1 27 | ||
135 | #define MC13783_IRQ_ONOFD2 28 | ||
136 | #define MC13783_IRQ_ONOFD3 29 | ||
137 | #define MC13783_IRQ_SYSRST 30 | ||
138 | #define MC13783_IRQ_RTCRST 31 | ||
139 | #define MC13783_IRQ_PC 32 | ||
140 | #define MC13783_IRQ_WARM 33 | ||
141 | #define MC13783_IRQ_MEMHLD 34 | ||
142 | #define MC13783_IRQ_PWRRDY 35 | ||
143 | #define MC13783_IRQ_THWARNL 36 | ||
144 | #define MC13783_IRQ_THWARNH 37 | ||
145 | #define MC13783_IRQ_CLK 38 | ||
146 | #define MC13783_IRQ_SEMAF 39 | ||
147 | #define MC13783_IRQ_MC2B 41 | ||
148 | #define MC13783_IRQ_HSDET 42 | ||
149 | #define MC13783_IRQ_HSL 43 | ||
150 | #define MC13783_IRQ_ALSPTH 44 | ||
151 | #define MC13783_IRQ_AHSSHORT 45 | ||
152 | #define MC13783_NUM_IRQ 46 | ||
84 | 153 | ||
154 | #endif /* __LINUX_MFD_MC13783_H */ | ||
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h index 9aba7b779fbc..3398bd9aab11 100644 --- a/include/linux/mfd/pcf50633/core.h +++ b/include/linux/mfd/pcf50633/core.h | |||
@@ -29,7 +29,12 @@ struct pcf50633_platform_data { | |||
29 | char **batteries; | 29 | char **batteries; |
30 | int num_batteries; | 30 | int num_batteries; |
31 | 31 | ||
32 | int charging_restart_interval; | 32 | /* |
33 | * Should be set accordingly to the reference resistor used, see | ||
34 | * I_{ch(ref)} charger reference current in the pcf50633 User | ||
35 | * Manual. | ||
36 | */ | ||
37 | int charger_reference_current_ma; | ||
33 | 38 | ||
34 | /* Callbacks */ | 39 | /* Callbacks */ |
35 | void (*probe_done)(struct pcf50633 *); | 40 | void (*probe_done)(struct pcf50633 *); |
@@ -40,10 +45,6 @@ struct pcf50633_platform_data { | |||
40 | u8 resumers[5]; | 45 | u8 resumers[5]; |
41 | }; | 46 | }; |
42 | 47 | ||
43 | struct pcf50633_subdev_pdata { | ||
44 | struct pcf50633 *pcf; | ||
45 | }; | ||
46 | |||
47 | struct pcf50633_irq { | 48 | struct pcf50633_irq { |
48 | void (*handler) (int, void *); | 49 | void (*handler) (int, void *); |
49 | void *data; | 50 | void *data; |
@@ -217,5 +218,9 @@ enum pcf50633_reg_int5 { | |||
217 | #define PCF50633_REG_LEDCTL 0x2a | 218 | #define PCF50633_REG_LEDCTL 0x2a |
218 | #define PCF50633_REG_LEDDIM 0x2b | 219 | #define PCF50633_REG_LEDDIM 0x2b |
219 | 220 | ||
220 | #endif | 221 | static inline struct pcf50633 *dev_to_pcf50633(struct device *dev) |
222 | { | ||
223 | return dev_get_drvdata(dev); | ||
224 | } | ||
221 | 225 | ||
226 | #endif | ||
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h index 4119579acf2c..df4f5fa88de3 100644 --- a/include/linux/mfd/pcf50633/mbc.h +++ b/include/linux/mfd/pcf50633/mbc.h | |||
@@ -128,6 +128,7 @@ enum pcf50633_reg_mbcs3 { | |||
128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); | 128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); |
129 | 129 | ||
130 | int pcf50633_mbc_get_status(struct pcf50633 *); | 130 | int pcf50633_mbc_get_status(struct pcf50633 *); |
131 | int pcf50633_mbc_get_usb_online_status(struct pcf50633 *); | ||
131 | 132 | ||
132 | #endif | 133 | #endif |
133 | 134 | ||
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h new file mode 100644 index 000000000000..3bcd7163485c --- /dev/null +++ b/include/linux/mfd/sh_mobile_sdhi.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __SH_MOBILE_SDHI_H__ | ||
2 | #define __SH_MOBILE_SDHI_H__ | ||
3 | |||
4 | struct sh_mobile_sdhi_info { | ||
5 | void (*set_pwr)(struct platform_device *pdev, int state); | ||
6 | }; | ||
7 | |||
8 | #endif /* __SH_MOBILE_SDHI_H__ */ | ||
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 6b9c5d06690c..9cb1834deffa 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define MFD_TMIO_H | 2 | #define MFD_TMIO_H |
3 | 3 | ||
4 | #include <linux/fb.h> | 4 | #include <linux/fb.h> |
5 | #include <linux/io.h> | ||
6 | #include <linux/platform_device.h> | ||
5 | 7 | ||
6 | #define tmio_ioread8(addr) readb(addr) | 8 | #define tmio_ioread8(addr) readb(addr) |
7 | #define tmio_ioread16(addr) readw(addr) | 9 | #define tmio_ioread16(addr) readw(addr) |
@@ -18,11 +20,48 @@ | |||
18 | writew((val) >> 16, (addr) + 2); \ | 20 | writew((val) >> 16, (addr) + 2); \ |
19 | } while (0) | 21 | } while (0) |
20 | 22 | ||
23 | #define CNF_CMD 0x04 | ||
24 | #define CNF_CTL_BASE 0x10 | ||
25 | #define CNF_INT_PIN 0x3d | ||
26 | #define CNF_STOP_CLK_CTL 0x40 | ||
27 | #define CNF_GCLK_CTL 0x41 | ||
28 | #define CNF_SD_CLK_MODE 0x42 | ||
29 | #define CNF_PIN_STATUS 0x44 | ||
30 | #define CNF_PWR_CTL_1 0x48 | ||
31 | #define CNF_PWR_CTL_2 0x49 | ||
32 | #define CNF_PWR_CTL_3 0x4a | ||
33 | #define CNF_CARD_DETECT_MODE 0x4c | ||
34 | #define CNF_SD_SLOT 0x50 | ||
35 | #define CNF_EXT_GCLK_CTL_1 0xf0 | ||
36 | #define CNF_EXT_GCLK_CTL_2 0xf1 | ||
37 | #define CNF_EXT_GCLK_CTL_3 0xf9 | ||
38 | #define CNF_SD_LED_EN_1 0xfa | ||
39 | #define CNF_SD_LED_EN_2 0xfe | ||
40 | |||
41 | #define SDCREN 0x2 /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/ | ||
42 | |||
43 | #define sd_config_write8(base, shift, reg, val) \ | ||
44 | tmio_iowrite8((val), (base) + ((reg) << (shift))) | ||
45 | #define sd_config_write16(base, shift, reg, val) \ | ||
46 | tmio_iowrite16((val), (base) + ((reg) << (shift))) | ||
47 | #define sd_config_write32(base, shift, reg, val) \ | ||
48 | do { \ | ||
49 | tmio_iowrite16((val), (base) + ((reg) << (shift))); \ | ||
50 | tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \ | ||
51 | } while (0) | ||
52 | |||
53 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); | ||
54 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); | ||
55 | void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); | ||
56 | void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); | ||
57 | |||
21 | /* | 58 | /* |
22 | * data for the MMC controller | 59 | * data for the MMC controller |
23 | */ | 60 | */ |
24 | struct tmio_mmc_data { | 61 | struct tmio_mmc_data { |
25 | const unsigned int hclk; | 62 | const unsigned int hclk; |
63 | void (*set_pwr)(struct platform_device *host, int state); | ||
64 | void (*set_clk_div)(struct platform_device *host, int state); | ||
26 | }; | 65 | }; |
27 | 66 | ||
28 | /* | 67 | /* |
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index 91eb493bf14c..5184b79c700b 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #define __MFD_WM831X_CORE_H__ | 16 | #define __MFD_WM831X_CORE_H__ |
17 | 17 | ||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/workqueue.h> | ||
20 | 19 | ||
21 | /* | 20 | /* |
22 | * Register values. | 21 | * Register values. |
@@ -117,6 +116,7 @@ | |||
117 | #define WM831X_DC3_SLEEP_CONTROL 0x4063 | 116 | #define WM831X_DC3_SLEEP_CONTROL 0x4063 |
118 | #define WM831X_DC4_CONTROL 0x4064 | 117 | #define WM831X_DC4_CONTROL 0x4064 |
119 | #define WM831X_DC4_SLEEP_CONTROL 0x4065 | 118 | #define WM831X_DC4_SLEEP_CONTROL 0x4065 |
119 | #define WM832X_DC4_SLEEP_CONTROL 0x4067 | ||
120 | #define WM831X_EPE1_CONTROL 0x4066 | 120 | #define WM831X_EPE1_CONTROL 0x4066 |
121 | #define WM831X_EPE2_CONTROL 0x4067 | 121 | #define WM831X_EPE2_CONTROL 0x4067 |
122 | #define WM831X_LDO1_CONTROL 0x4068 | 122 | #define WM831X_LDO1_CONTROL 0x4068 |
@@ -235,6 +235,8 @@ | |||
235 | 235 | ||
236 | struct regulator_dev; | 236 | struct regulator_dev; |
237 | 237 | ||
238 | #define WM831X_NUM_IRQ_REGS 5 | ||
239 | |||
238 | struct wm831x { | 240 | struct wm831x { |
239 | struct mutex io_lock; | 241 | struct mutex io_lock; |
240 | 242 | ||
@@ -248,10 +250,11 @@ struct wm831x { | |||
248 | 250 | ||
249 | int irq; /* Our chip IRQ */ | 251 | int irq; /* Our chip IRQ */ |
250 | struct mutex irq_lock; | 252 | struct mutex irq_lock; |
251 | struct workqueue_struct *irq_wq; | ||
252 | struct work_struct irq_work; | ||
253 | unsigned int irq_base; | 253 | unsigned int irq_base; |
254 | int irq_masks[5]; | 254 | int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ |
255 | int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ | ||
256 | |||
257 | int num_gpio; | ||
255 | 258 | ||
256 | struct mutex auxadc_lock; | 259 | struct mutex auxadc_lock; |
257 | 260 | ||
@@ -278,12 +281,30 @@ int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg, | |||
278 | int wm831x_irq_init(struct wm831x *wm831x, int irq); | 281 | int wm831x_irq_init(struct wm831x *wm831x, int irq); |
279 | void wm831x_irq_exit(struct wm831x *wm831x); | 282 | void wm831x_irq_exit(struct wm831x *wm831x); |
280 | 283 | ||
281 | int __must_check wm831x_request_irq(struct wm831x *wm831x, | 284 | static inline int __must_check wm831x_request_irq(struct wm831x *wm831x, |
282 | unsigned int irq, irq_handler_t handler, | 285 | unsigned int irq, |
283 | unsigned long flags, const char *name, | 286 | irq_handler_t handler, |
284 | void *dev); | 287 | unsigned long flags, |
285 | void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *); | 288 | const char *name, |
286 | void wm831x_disable_irq(struct wm831x *wm831x, int irq); | 289 | void *dev) |
287 | void wm831x_enable_irq(struct wm831x *wm831x, int irq); | 290 | { |
291 | return request_threaded_irq(irq, NULL, handler, flags, name, dev); | ||
292 | } | ||
293 | |||
294 | static inline void wm831x_free_irq(struct wm831x *wm831x, | ||
295 | unsigned int irq, void *dev) | ||
296 | { | ||
297 | free_irq(irq, dev); | ||
298 | } | ||
299 | |||
300 | static inline void wm831x_disable_irq(struct wm831x *wm831x, int irq) | ||
301 | { | ||
302 | disable_irq(irq); | ||
303 | } | ||
304 | |||
305 | static inline void wm831x_enable_irq(struct wm831x *wm831x, int irq) | ||
306 | { | ||
307 | enable_irq(irq); | ||
308 | } | ||
288 | 309 | ||
289 | #endif | 310 | #endif |
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h index 90d820260aad..fd322aca33ba 100644 --- a/include/linux/mfd/wm831x/pdata.h +++ b/include/linux/mfd/wm831x/pdata.h | |||
@@ -41,6 +41,23 @@ struct wm831x_battery_pdata { | |||
41 | int timeout; /** Charge cycle timeout, in minutes */ | 41 | int timeout; /** Charge cycle timeout, in minutes */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /** | ||
45 | * Configuration for the WM831x DC-DC BuckWise convertors. This | ||
46 | * should be passed as driver_data in the regulator_init_data. | ||
47 | * | ||
48 | * Currently all the configuration is for the fast DVS switching | ||
49 | * support of the devices. This allows MFPs on the device to be | ||
50 | * configured as an input to switch between two output voltages, | ||
51 | * allowing voltage transitions without the expense of an access over | ||
52 | * I2C or SPI buses. | ||
53 | */ | ||
54 | struct wm831x_buckv_pdata { | ||
55 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ | ||
56 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ | ||
57 | int dvs_init_state; /** DVS state to expect on startup */ | ||
58 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ | ||
59 | }; | ||
60 | |||
44 | /* Sources for status LED configuration. Values are register values | 61 | /* Sources for status LED configuration. Values are register values |
45 | * plus 1 to allow for a zero default for preserve. | 62 | * plus 1 to allow for a zero default for preserve. |
46 | */ | 63 | */ |
@@ -91,6 +108,7 @@ struct wm831x_pdata { | |||
91 | /** Called after subdevices are set up */ | 108 | /** Called after subdevices are set up */ |
92 | int (*post_init)(struct wm831x *wm831x); | 109 | int (*post_init)(struct wm831x *wm831x); |
93 | 110 | ||
111 | int irq_base; | ||
94 | int gpio_base; | 112 | int gpio_base; |
95 | struct wm831x_backlight_pdata *backlight; | 113 | struct wm831x_backlight_pdata *backlight; |
96 | struct wm831x_backup_pdata *backup; | 114 | struct wm831x_backup_pdata *backup; |
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 1d595de6a055..43868899bf49 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/workqueue.h> | 18 | #include <linux/interrupt.h> |
19 | 19 | ||
20 | #include <linux/mfd/wm8350/audio.h> | 20 | #include <linux/mfd/wm8350/audio.h> |
21 | #include <linux/mfd/wm8350/gpio.h> | 21 | #include <linux/mfd/wm8350/gpio.h> |
@@ -601,7 +601,7 @@ extern const u16 wm8352_mode3_defaults[]; | |||
601 | struct wm8350; | 601 | struct wm8350; |
602 | 602 | ||
603 | struct wm8350_irq { | 603 | struct wm8350_irq { |
604 | void (*handler) (struct wm8350 *, int, void *); | 604 | irq_handler_t handler; |
605 | void *data; | 605 | void *data; |
606 | }; | 606 | }; |
607 | 607 | ||
@@ -646,10 +646,12 @@ struct wm8350 { | |||
646 | * @init: Function called during driver initialisation. Should be | 646 | * @init: Function called during driver initialisation. Should be |
647 | * used by the platform to configure GPIO functions and similar. | 647 | * used by the platform to configure GPIO functions and similar. |
648 | * @irq_high: Set if WM8350 IRQ is active high. | 648 | * @irq_high: Set if WM8350 IRQ is active high. |
649 | * @irq_base: Base IRQ for genirq (not currently used). | ||
649 | */ | 650 | */ |
650 | struct wm8350_platform_data { | 651 | struct wm8350_platform_data { |
651 | int (*init)(struct wm8350 *wm8350); | 652 | int (*init)(struct wm8350 *wm8350); |
652 | int irq_high; | 653 | int irq_high; |
654 | int irq_base; | ||
653 | }; | 655 | }; |
654 | 656 | ||
655 | 657 | ||
@@ -676,11 +678,13 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); | |||
676 | * WM8350 internal interrupts | 678 | * WM8350 internal interrupts |
677 | */ | 679 | */ |
678 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | 680 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, |
679 | void (*handler) (struct wm8350 *, int, void *), | 681 | irq_handler_t handler, unsigned long flags, |
680 | void *data); | 682 | const char *name, void *data); |
681 | int wm8350_free_irq(struct wm8350 *wm8350, int irq); | 683 | int wm8350_free_irq(struct wm8350 *wm8350, int irq); |
682 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); | 684 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); |
683 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); | 685 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); |
684 | 686 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, | |
687 | struct wm8350_platform_data *pdata); | ||
688 | int wm8350_irq_exit(struct wm8350 *wm8350); | ||
685 | 689 | ||
686 | #endif | 690 | #endif |
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h index ed91e8f5d298..71af3d6ebe9d 100644 --- a/include/linux/mfd/wm8350/gpio.h +++ b/include/linux/mfd/wm8350/gpio.h | |||
@@ -173,6 +173,24 @@ | |||
173 | #define WM8350_GPIO_DEBOUNCE_ON 1 | 173 | #define WM8350_GPIO_DEBOUNCE_ON 1 |
174 | 174 | ||
175 | /* | 175 | /* |
176 | * R30 (0x1E) - GPIO Interrupt Status | ||
177 | */ | ||
178 | #define WM8350_GP12_EINT 0x1000 | ||
179 | #define WM8350_GP11_EINT 0x0800 | ||
180 | #define WM8350_GP10_EINT 0x0400 | ||
181 | #define WM8350_GP9_EINT 0x0200 | ||
182 | #define WM8350_GP8_EINT 0x0100 | ||
183 | #define WM8350_GP7_EINT 0x0080 | ||
184 | #define WM8350_GP6_EINT 0x0040 | ||
185 | #define WM8350_GP5_EINT 0x0020 | ||
186 | #define WM8350_GP4_EINT 0x0010 | ||
187 | #define WM8350_GP3_EINT 0x0008 | ||
188 | #define WM8350_GP2_EINT 0x0004 | ||
189 | #define WM8350_GP1_EINT 0x0002 | ||
190 | #define WM8350_GP0_EINT 0x0001 | ||
191 | |||
192 | |||
193 | /* | ||
176 | * R128 (0x80) - GPIO Debounce | 194 | * R128 (0x80) - GPIO Debounce |
177 | */ | 195 | */ |
178 | #define WM8350_GP12_DB 0x1000 | 196 | #define WM8350_GP12_DB 0x1000 |
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index be3264e286e0..e786fe9841ef 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
@@ -666,20 +666,20 @@ | |||
666 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) | 666 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) |
667 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) | 667 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) |
668 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) | 668 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) |
669 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4) | 669 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 0) |
670 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 4) | 670 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 0) |
671 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 4) | 671 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 0) |
672 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 4) | 672 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 0) |
673 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 4) | 673 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 0) |
674 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 4) | 674 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 0) |
675 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 4) | 675 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 0) |
676 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0) | 676 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 4) |
677 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0) | 677 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 4) |
678 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0) | 678 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 4) |
679 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0) | 679 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 4) |
680 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0) | 680 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 4) |
681 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0) | 681 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 4) |
682 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0) | 682 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 4) |
683 | 683 | ||
684 | /* | 684 | /* |
685 | * Regulator Interrupts. | 685 | * Regulator Interrupts. |
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 527602cdea1c..7f085c97c799 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
@@ -12,7 +12,8 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **); | |||
12 | extern int putback_lru_pages(struct list_head *l); | 12 | extern int putback_lru_pages(struct list_head *l); |
13 | extern int migrate_page(struct address_space *, | 13 | extern int migrate_page(struct address_space *, |
14 | struct page *, struct page *); | 14 | struct page *, struct page *); |
15 | extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long); | 15 | extern int migrate_pages(struct list_head *l, new_page_t x, |
16 | unsigned long private, int offlining); | ||
16 | 17 | ||
17 | extern int fail_migrate_page(struct address_space *, | 18 | extern int fail_migrate_page(struct address_space *, |
18 | struct page *, struct page *); | 19 | struct page *, struct page *); |
@@ -26,10 +27,7 @@ extern int migrate_vmas(struct mm_struct *mm, | |||
26 | 27 | ||
27 | static inline int putback_lru_pages(struct list_head *l) { return 0; } | 28 | static inline int putback_lru_pages(struct list_head *l) { return 0; } |
28 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 29 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
29 | unsigned long private) { return -ENOSYS; } | 30 | unsigned long private, int offlining) { return -ENOSYS; } |
30 | |||
31 | static inline int migrate_pages_to(struct list_head *pagelist, | ||
32 | struct vm_area_struct *vma, int dest) { return 0; } | ||
33 | 31 | ||
34 | static inline int migrate_prep(void) { return -ENOSYS; } | 32 | static inline int migrate_prep(void) { return -ENOSYS; } |
35 | 33 | ||
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index adaf3c15e449..8b5f7cc0fba6 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define HPET_MINOR 228 | 30 | #define HPET_MINOR 228 |
31 | #define FUSE_MINOR 229 | 31 | #define FUSE_MINOR 229 |
32 | #define KVM_MINOR 232 | 32 | #define KVM_MINOR 232 |
33 | #define VHOST_NET_MINOR 233 | ||
33 | #define MISC_DYNAMIC_MINOR 255 | 34 | #define MISC_DYNAMIC_MINOR 255 |
34 | 35 | ||
35 | struct device; | 36 | struct device; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index ce7cc6c7bcbb..e92d1bfdb330 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -61,6 +61,7 @@ enum { | |||
61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, | 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, |
62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, | 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, |
63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, | 63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, |
64 | MLX4_DEV_CAP_FLAG_BLH = 1 << 15, | ||
64 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, | 65 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, |
65 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, | 66 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, |
66 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, | 67 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 24c395694f4d..60c467bfbabd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -620,13 +620,22 @@ void page_address_init(void); | |||
620 | /* | 620 | /* |
621 | * On an anonymous page mapped into a user virtual memory area, | 621 | * On an anonymous page mapped into a user virtual memory area, |
622 | * page->mapping points to its anon_vma, not to a struct address_space; | 622 | * page->mapping points to its anon_vma, not to a struct address_space; |
623 | * with the PAGE_MAPPING_ANON bit set to distinguish it. | 623 | * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h. |
624 | * | ||
625 | * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled, | ||
626 | * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit; | ||
627 | * and then page->mapping points, not to an anon_vma, but to a private | ||
628 | * structure which KSM associates with that merged page. See ksm.h. | ||
629 | * | ||
630 | * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used. | ||
624 | * | 631 | * |
625 | * Please note that, confusingly, "page_mapping" refers to the inode | 632 | * Please note that, confusingly, "page_mapping" refers to the inode |
626 | * address_space which maps the page from disk; whereas "page_mapped" | 633 | * address_space which maps the page from disk; whereas "page_mapped" |
627 | * refers to user virtual address space into which the page is mapped. | 634 | * refers to user virtual address space into which the page is mapped. |
628 | */ | 635 | */ |
629 | #define PAGE_MAPPING_ANON 1 | 636 | #define PAGE_MAPPING_ANON 1 |
637 | #define PAGE_MAPPING_KSM 2 | ||
638 | #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) | ||
630 | 639 | ||
631 | extern struct address_space swapper_space; | 640 | extern struct address_space swapper_space; |
632 | static inline struct address_space *page_mapping(struct page *page) | 641 | static inline struct address_space *page_mapping(struct page *page) |
@@ -634,16 +643,19 @@ static inline struct address_space *page_mapping(struct page *page) | |||
634 | struct address_space *mapping = page->mapping; | 643 | struct address_space *mapping = page->mapping; |
635 | 644 | ||
636 | VM_BUG_ON(PageSlab(page)); | 645 | VM_BUG_ON(PageSlab(page)); |
637 | #ifdef CONFIG_SWAP | ||
638 | if (unlikely(PageSwapCache(page))) | 646 | if (unlikely(PageSwapCache(page))) |
639 | mapping = &swapper_space; | 647 | mapping = &swapper_space; |
640 | else | 648 | else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) |
641 | #endif | ||
642 | if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) | ||
643 | mapping = NULL; | 649 | mapping = NULL; |
644 | return mapping; | 650 | return mapping; |
645 | } | 651 | } |
646 | 652 | ||
653 | /* Neutral page->mapping pointer to address_space or anon_vma or other */ | ||
654 | static inline void *page_rmapping(struct page *page) | ||
655 | { | ||
656 | return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS); | ||
657 | } | ||
658 | |||
647 | static inline int PageAnon(struct page *page) | 659 | static inline int PageAnon(struct page *page) |
648 | { | 660 | { |
649 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; | 661 | return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; |
@@ -758,6 +770,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlb, | |||
758 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry | 770 | * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry |
759 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry | 771 | * @pte_entry: if set, called for each non-empty PTE (4th-level) entry |
760 | * @pte_hole: if set, called for each hole at all levels | 772 | * @pte_hole: if set, called for each hole at all levels |
773 | * @hugetlb_entry: if set, called for each hugetlb entry | ||
761 | * | 774 | * |
762 | * (see walk_page_range for more details) | 775 | * (see walk_page_range for more details) |
763 | */ | 776 | */ |
@@ -767,6 +780,8 @@ struct mm_walk { | |||
767 | int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); | 780 | int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); |
768 | int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); | 781 | int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); |
769 | int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); | 782 | int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); |
783 | int (*hugetlb_entry)(pte_t *, unsigned long, unsigned long, | ||
784 | struct mm_walk *); | ||
770 | struct mm_struct *mm; | 785 | struct mm_struct *mm; |
771 | void *private; | 786 | void *private; |
772 | }; | 787 | }; |
@@ -1022,6 +1037,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn, | |||
1022 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, | 1037 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, |
1023 | unsigned long end_pfn); | 1038 | unsigned long end_pfn); |
1024 | extern void remove_all_active_ranges(void); | 1039 | extern void remove_all_active_ranges(void); |
1040 | void sort_node_map(void); | ||
1041 | unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, | ||
1042 | unsigned long end_pfn); | ||
1025 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | 1043 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, |
1026 | unsigned long end_pfn); | 1044 | unsigned long end_pfn); |
1027 | extern void get_pfn_range_for_nid(unsigned int nid, | 1045 | extern void get_pfn_range_for_nid(unsigned int nid, |
@@ -1071,6 +1089,7 @@ extern void zone_pcp_update(struct zone *zone); | |||
1071 | 1089 | ||
1072 | /* nommu.c */ | 1090 | /* nommu.c */ |
1073 | extern atomic_long_t mmap_pages_allocated; | 1091 | extern atomic_long_t mmap_pages_allocated; |
1092 | extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); | ||
1074 | 1093 | ||
1075 | /* prio_tree.c */ | 1094 | /* prio_tree.c */ |
1076 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); | 1095 | void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); |
@@ -1316,11 +1335,17 @@ extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | |||
1316 | size_t size); | 1335 | size_t size); |
1317 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); | 1336 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); |
1318 | 1337 | ||
1338 | enum mf_flags { | ||
1339 | MF_COUNT_INCREASED = 1 << 0, | ||
1340 | }; | ||
1319 | extern void memory_failure(unsigned long pfn, int trapno); | 1341 | extern void memory_failure(unsigned long pfn, int trapno); |
1320 | extern int __memory_failure(unsigned long pfn, int trapno, int ref); | 1342 | extern int __memory_failure(unsigned long pfn, int trapno, int flags); |
1343 | extern int unpoison_memory(unsigned long pfn); | ||
1321 | extern int sysctl_memory_failure_early_kill; | 1344 | extern int sysctl_memory_failure_early_kill; |
1322 | extern int sysctl_memory_failure_recovery; | 1345 | extern int sysctl_memory_failure_recovery; |
1346 | extern void shake_page(struct page *p, int access); | ||
1323 | extern atomic_long_t mce_bad_pages; | 1347 | extern atomic_long_t mce_bad_pages; |
1348 | extern int soft_offline_page(struct page *page, int flags); | ||
1324 | 1349 | ||
1325 | #endif /* __KERNEL__ */ | 1350 | #endif /* __KERNEL__ */ |
1326 | #endif /* _LINUX_MM_H */ | 1351 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 84a524afb3dc..36f96271306c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -122,7 +122,9 @@ struct vm_region { | |||
122 | unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ | 122 | unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ |
123 | struct file *vm_file; /* the backing file or NULL */ | 123 | struct file *vm_file; /* the backing file or NULL */ |
124 | 124 | ||
125 | atomic_t vm_usage; /* region usage count */ | 125 | int vm_usage; /* region usage count (access under nommu_region_sem) */ |
126 | bool vm_icache_flushed : 1; /* true if the icache has been flushed for | ||
127 | * this region */ | ||
126 | }; | 128 | }; |
127 | 129 | ||
128 | /* | 130 | /* |
@@ -203,10 +205,12 @@ struct mm_struct { | |||
203 | struct vm_area_struct * mmap; /* list of VMAs */ | 205 | struct vm_area_struct * mmap; /* list of VMAs */ |
204 | struct rb_root mm_rb; | 206 | struct rb_root mm_rb; |
205 | struct vm_area_struct * mmap_cache; /* last find_vma result */ | 207 | struct vm_area_struct * mmap_cache; /* last find_vma result */ |
208 | #ifdef CONFIG_MMU | ||
206 | unsigned long (*get_unmapped_area) (struct file *filp, | 209 | unsigned long (*get_unmapped_area) (struct file *filp, |
207 | unsigned long addr, unsigned long len, | 210 | unsigned long addr, unsigned long len, |
208 | unsigned long pgoff, unsigned long flags); | 211 | unsigned long pgoff, unsigned long flags); |
209 | void (*unmap_area) (struct mm_struct *mm, unsigned long addr); | 212 | void (*unmap_area) (struct mm_struct *mm, unsigned long addr); |
213 | #endif | ||
210 | unsigned long mmap_base; /* base of mmap area */ | 214 | unsigned long mmap_base; /* base of mmap area */ |
211 | unsigned long task_size; /* size of task vm space */ | 215 | unsigned long task_size; /* size of task vm space */ |
212 | unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ | 216 | unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ |
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 8a5509877192..ee24ef8ab616 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef LINUX_MM_DEBUG_H | 1 | #ifndef LINUX_MM_DEBUG_H |
2 | #define LINUX_MM_DEBUG_H 1 | 2 | #define LINUX_MM_DEBUG_H 1 |
3 | 3 | ||
4 | #include <linux/autoconf.h> | ||
5 | |||
6 | #ifdef CONFIG_DEBUG_VM | 4 | #ifdef CONFIG_DEBUG_VM |
7 | #define VM_BUG_ON(cond) BUG_ON(cond) | 5 | #define VM_BUG_ON(cond) BUG_ON(cond) |
8 | #else | 6 | #else |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6f7561730d88..30fe668c2542 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/seqlock.h> | 15 | #include <linux/seqlock.h> |
16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
17 | #include <linux/pageblock-flags.h> | 17 | #include <linux/pageblock-flags.h> |
18 | #include <linux/bounds.h> | 18 | #include <generated/bounds.h> |
19 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
21 | 21 | ||
diff --git a/include/linux/module.h b/include/linux/module.h index 482efc865acf..6cb1a3cab5d3 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -25,8 +25,10 @@ | |||
25 | /* Not Yet Implemented */ | 25 | /* Not Yet Implemented */ |
26 | #define MODULE_SUPPORTED_DEVICE(name) | 26 | #define MODULE_SUPPORTED_DEVICE(name) |
27 | 27 | ||
28 | /* some toolchains uses a `_' prefix for all user symbols */ | 28 | /* Some toolchains use a `_' prefix for all user symbols. */ |
29 | #ifndef MODULE_SYMBOL_PREFIX | 29 | #ifdef CONFIG_SYMBOL_PREFIX |
30 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
31 | #else | ||
30 | #define MODULE_SYMBOL_PREFIX "" | 32 | #define MODULE_SYMBOL_PREFIX "" |
31 | #endif | 33 | #endif |
32 | 34 | ||
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index fff8c53e5434..9c3757c5759d 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
@@ -19,22 +19,21 @@ | |||
19 | 19 | ||
20 | /** | 20 | /** |
21 | * struct nand_bbt_descr - bad block table descriptor | 21 | * struct nand_bbt_descr - bad block table descriptor |
22 | * @options: options for this descriptor | 22 | * @options: options for this descriptor |
23 | * @pages: the page(s) where we find the bbt, used with | 23 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE |
24 | * option BBT_ABSPAGE when bbt is searched, | 24 | * when bbt is searched, then we store the found bbts pages here. |
25 | * then we store the found bbts pages here. | 25 | * Its an array and supports up to 8 chips now |
26 | * Its an array and supports up to 8 chips now | 26 | * @offs: offset of the pattern in the oob area of the page |
27 | * @offs: offset of the pattern in the oob area of the page | 27 | * @veroffs: offset of the bbt version counter in the oob are of the page |
28 | * @veroffs: offset of the bbt version counter in the oob area of the page | 28 | * @version: version read from the bbt page during scan |
29 | * @version: version read from the bbt page during scan | 29 | * @len: length of the pattern, if 0 no pattern check is performed |
30 | * @len: length of the pattern, if 0 no pattern check is performed | 30 | * @maxblocks: maximum number of blocks to search for a bbt. This number of |
31 | * @maxblocks: maximum number of blocks to search for a bbt. This | 31 | * blocks is reserved at the end of the device where the tables are |
32 | * number of blocks is reserved at the end of the device | 32 | * written. |
33 | * where the tables are written. | 33 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than |
34 | * @reserved_block_code: if non-0, this pattern denotes a reserved | 34 | * bad) block in the stored bbt |
35 | * (rather than bad) block in the stored bbt | 35 | * @pattern: pattern to identify bad block table or factory marked good / |
36 | * @pattern: pattern to identify bad block table or factory marked | 36 | * bad blocks, can be NULL, if len = 0 |
37 | * good / bad blocks, can be NULL, if len = 0 | ||
38 | * | 37 | * |
39 | * Descriptor for the bad block table marker and the descriptor for the | 38 | * Descriptor for the bad block table marker and the descriptor for the |
40 | * pattern which identifies good and bad blocks. The assumption is made | 39 | * pattern which identifies good and bad blocks. The assumption is made |
@@ -90,7 +89,9 @@ struct nand_bbt_descr { | |||
90 | /* | 89 | /* |
91 | * Constants for oob configuration | 90 | * Constants for oob configuration |
92 | */ | 91 | */ |
93 | #define ONENAND_BADBLOCK_POS 0 | 92 | #define NAND_SMALL_BADBLOCK_POS 5 |
93 | #define NAND_LARGE_BADBLOCK_POS 0 | ||
94 | #define ONENAND_BADBLOCK_POS 0 | ||
94 | 95 | ||
95 | /* | 96 | /* |
96 | * Bad block scanning errors | 97 | * Bad block scanning errors |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 88d3d8fbf9f2..df89f4275232 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -518,10 +518,11 @@ struct cfi_fixup { | |||
518 | #define CFI_MFR_ANY 0xffff | 518 | #define CFI_MFR_ANY 0xffff |
519 | #define CFI_ID_ANY 0xffff | 519 | #define CFI_ID_ANY 0xffff |
520 | 520 | ||
521 | #define CFI_MFR_AMD 0x0001 | 521 | #define CFI_MFR_AMD 0x0001 |
522 | #define CFI_MFR_ATMEL 0x001F | 522 | #define CFI_MFR_INTEL 0x0089 |
523 | #define CFI_MFR_SAMSUNG 0x00EC | 523 | #define CFI_MFR_ATMEL 0x001F |
524 | #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ | 524 | #define CFI_MFR_SAMSUNG 0x00EC |
525 | #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ | ||
525 | 526 | ||
526 | void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); | 527 | void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); |
527 | 528 | ||
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index d4f38c5fd44e..d0bf422ae374 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
@@ -38,6 +38,15 @@ typedef enum { | |||
38 | FL_XIP_WHILE_ERASING, | 38 | FL_XIP_WHILE_ERASING, |
39 | FL_XIP_WHILE_WRITING, | 39 | FL_XIP_WHILE_WRITING, |
40 | FL_SHUTDOWN, | 40 | FL_SHUTDOWN, |
41 | /* These 2 come from nand_state_t, which has been unified here */ | ||
42 | FL_READING, | ||
43 | FL_CACHEDPRG, | ||
44 | /* These 4 come from onenand_state_t, which has been unified here */ | ||
45 | FL_RESETING, | ||
46 | FL_OTPING, | ||
47 | FL_PREPARING_ERASE, | ||
48 | FL_VERIFYING_ERASE, | ||
49 | |||
41 | FL_UNKNOWN | 50 | FL_UNKNOWN |
42 | } flstate_t; | 51 | } flstate_t; |
43 | 52 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 7a232a9bdd62..ccab9dfc5217 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/flashchip.h> | ||
25 | #include <linux/mtd/bbm.h> | ||
24 | 26 | ||
25 | struct mtd_info; | 27 | struct mtd_info; |
26 | /* Scan and identify a NAND device */ | 28 | /* Scan and identify a NAND device */ |
@@ -168,7 +170,6 @@ typedef enum { | |||
168 | /* Chip does not allow subpage writes */ | 170 | /* Chip does not allow subpage writes */ |
169 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 171 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
170 | 172 | ||
171 | |||
172 | /* Options valid for Samsung large page devices */ | 173 | /* Options valid for Samsung large page devices */ |
173 | #define NAND_SAMSUNG_LP_OPTIONS \ | 174 | #define NAND_SAMSUNG_LP_OPTIONS \ |
174 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) | 175 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
@@ -194,6 +195,9 @@ typedef enum { | |||
194 | /* This option is defined if the board driver allocates its own buffers | 195 | /* This option is defined if the board driver allocates its own buffers |
195 | (e.g. because it needs them DMA-coherent */ | 196 | (e.g. because it needs them DMA-coherent */ |
196 | #define NAND_OWN_BUFFERS 0x00040000 | 197 | #define NAND_OWN_BUFFERS 0x00040000 |
198 | /* Chip may not exist, so silence any errors in scan */ | ||
199 | #define NAND_SCAN_SILENT_NODEV 0x00080000 | ||
200 | |||
197 | /* Options set by nand scan */ | 201 | /* Options set by nand scan */ |
198 | /* Nand scan has allocated controller struct */ | 202 | /* Nand scan has allocated controller struct */ |
199 | #define NAND_CONTROLLER_ALLOC 0x80000000 | 203 | #define NAND_CONTROLLER_ALLOC 0x80000000 |
@@ -202,20 +206,6 @@ typedef enum { | |||
202 | #define NAND_CI_CHIPNR_MSK 0x03 | 206 | #define NAND_CI_CHIPNR_MSK 0x03 |
203 | #define NAND_CI_CELLTYPE_MSK 0x0C | 207 | #define NAND_CI_CELLTYPE_MSK 0x0C |
204 | 208 | ||
205 | /* | ||
206 | * nand_state_t - chip states | ||
207 | * Enumeration for NAND flash chip state | ||
208 | */ | ||
209 | typedef enum { | ||
210 | FL_READY, | ||
211 | FL_READING, | ||
212 | FL_WRITING, | ||
213 | FL_ERASING, | ||
214 | FL_SYNCING, | ||
215 | FL_CACHEDPRG, | ||
216 | FL_PM_SUSPENDED, | ||
217 | } nand_state_t; | ||
218 | |||
219 | /* Keep gcc happy */ | 209 | /* Keep gcc happy */ |
220 | struct nand_chip; | 210 | struct nand_chip; |
221 | 211 | ||
@@ -402,7 +392,7 @@ struct nand_chip { | |||
402 | uint8_t cellinfo; | 392 | uint8_t cellinfo; |
403 | int badblockpos; | 393 | int badblockpos; |
404 | 394 | ||
405 | nand_state_t state; | 395 | flstate_t state; |
406 | 396 | ||
407 | uint8_t *oob_poi; | 397 | uint8_t *oob_poi; |
408 | struct nand_hw_control *controller; | 398 | struct nand_hw_control *controller; |
@@ -470,75 +460,6 @@ struct nand_manufacturers { | |||
470 | extern struct nand_flash_dev nand_flash_ids[]; | 460 | extern struct nand_flash_dev nand_flash_ids[]; |
471 | extern struct nand_manufacturers nand_manuf_ids[]; | 461 | extern struct nand_manufacturers nand_manuf_ids[]; |
472 | 462 | ||
473 | /** | ||
474 | * struct nand_bbt_descr - bad block table descriptor | ||
475 | * @options: options for this descriptor | ||
476 | * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE | ||
477 | * when bbt is searched, then we store the found bbts pages here. | ||
478 | * Its an array and supports up to 8 chips now | ||
479 | * @offs: offset of the pattern in the oob area of the page | ||
480 | * @veroffs: offset of the bbt version counter in the oob are of the page | ||
481 | * @version: version read from the bbt page during scan | ||
482 | * @len: length of the pattern, if 0 no pattern check is performed | ||
483 | * @maxblocks: maximum number of blocks to search for a bbt. This number of | ||
484 | * blocks is reserved at the end of the device where the tables are | ||
485 | * written. | ||
486 | * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than | ||
487 | * bad) block in the stored bbt | ||
488 | * @pattern: pattern to identify bad block table or factory marked good / | ||
489 | * bad blocks, can be NULL, if len = 0 | ||
490 | * | ||
491 | * Descriptor for the bad block table marker and the descriptor for the | ||
492 | * pattern which identifies good and bad blocks. The assumption is made | ||
493 | * that the pattern and the version count are always located in the oob area | ||
494 | * of the first block. | ||
495 | */ | ||
496 | struct nand_bbt_descr { | ||
497 | int options; | ||
498 | int pages[NAND_MAX_CHIPS]; | ||
499 | int offs; | ||
500 | int veroffs; | ||
501 | uint8_t version[NAND_MAX_CHIPS]; | ||
502 | int len; | ||
503 | int maxblocks; | ||
504 | int reserved_block_code; | ||
505 | uint8_t *pattern; | ||
506 | }; | ||
507 | |||
508 | /* Options for the bad block table descriptors */ | ||
509 | |||
510 | /* The number of bits used per block in the bbt on the device */ | ||
511 | #define NAND_BBT_NRBITS_MSK 0x0000000F | ||
512 | #define NAND_BBT_1BIT 0x00000001 | ||
513 | #define NAND_BBT_2BIT 0x00000002 | ||
514 | #define NAND_BBT_4BIT 0x00000004 | ||
515 | #define NAND_BBT_8BIT 0x00000008 | ||
516 | /* The bad block table is in the last good block of the device */ | ||
517 | #define NAND_BBT_LASTBLOCK 0x00000010 | ||
518 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
519 | #define NAND_BBT_ABSPAGE 0x00000020 | ||
520 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
521 | #define NAND_BBT_SEARCH 0x00000040 | ||
522 | /* bbt is stored per chip on multichip devices */ | ||
523 | #define NAND_BBT_PERCHIP 0x00000080 | ||
524 | /* bbt has a version counter at offset veroffs */ | ||
525 | #define NAND_BBT_VERSION 0x00000100 | ||
526 | /* Create a bbt if none axists */ | ||
527 | #define NAND_BBT_CREATE 0x00000200 | ||
528 | /* Search good / bad pattern through all pages of a block */ | ||
529 | #define NAND_BBT_SCANALLPAGES 0x00000400 | ||
530 | /* Scan block empty during good / bad block scan */ | ||
531 | #define NAND_BBT_SCANEMPTY 0x00000800 | ||
532 | /* Write bbt if neccecary */ | ||
533 | #define NAND_BBT_WRITE 0x00001000 | ||
534 | /* Read and write back block contents when writing bbt */ | ||
535 | #define NAND_BBT_SAVECONTENT 0x00002000 | ||
536 | /* Search good / bad pattern on the first and the second page */ | ||
537 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | ||
538 | |||
539 | /* The maximum number of blocks to scan for a bbt */ | ||
540 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | ||
541 | |||
542 | extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); | 463 | extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); |
543 | extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); | 464 | extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); |
544 | extern int nand_default_bbt(struct mtd_info *mtd); | 465 | extern int nand_default_bbt(struct mtd_info *mtd); |
@@ -548,12 +469,6 @@ extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
548 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | 469 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, |
549 | size_t * retlen, uint8_t * buf); | 470 | size_t * retlen, uint8_t * buf); |
550 | 471 | ||
551 | /* | ||
552 | * Constants for oob configuration | ||
553 | */ | ||
554 | #define NAND_SMALL_BADBLOCK_POS 5 | ||
555 | #define NAND_LARGE_BADBLOCK_POS 0 | ||
556 | |||
557 | /** | 472 | /** |
558 | * struct platform_nand_chip - chip level device structure | 473 | * struct platform_nand_chip - chip level device structure |
559 | * @nr_chips: max. number of chips to scan for | 474 | * @nr_chips: max. number of chips to scan for |
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h index 052ea8ca2434..41bc013571d0 100644 --- a/include/linux/mtd/nand_ecc.h +++ b/include/linux/mtd/nand_ecc.h | |||
@@ -16,7 +16,13 @@ | |||
16 | struct mtd_info; | 16 | struct mtd_info; |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * Calculate 3 byte ECC code for 256 byte block | 19 | * Calculate 3 byte ECC code for eccsize byte block |
20 | */ | ||
21 | void __nand_calculate_ecc(const u_char *dat, unsigned int eccsize, | ||
22 | u_char *ecc_code); | ||
23 | |||
24 | /* | ||
25 | * Calculate 3 byte ECC code for 256/512 byte block | ||
20 | */ | 26 | */ |
21 | int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); | 27 | int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); |
22 | 28 | ||
@@ -27,7 +33,7 @@ int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc, | |||
27 | unsigned int eccsize); | 33 | unsigned int eccsize); |
28 | 34 | ||
29 | /* | 35 | /* |
30 | * Detect and correct a 1 bit error for 256 byte block | 36 | * Detect and correct a 1 bit error for 256/512 byte block |
31 | */ | 37 | */ |
32 | int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); | 38 | int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); |
33 | 39 | ||
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 4e49f3350678..5509eb06b326 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/mtd/onenand.h | 2 | * linux/include/linux/mtd/onenand.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2007 Samsung Electronics | 4 | * Copyright © 2005-2009 Samsung Electronics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | #include <linux/completion.h> | 16 | #include <linux/completion.h> |
17 | #include <linux/mtd/flashchip.h> | ||
17 | #include <linux/mtd/onenand_regs.h> | 18 | #include <linux/mtd/onenand_regs.h> |
18 | #include <linux/mtd/bbm.h> | 19 | #include <linux/mtd/bbm.h> |
19 | 20 | ||
@@ -25,22 +26,6 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips); | |||
25 | /* Free resources held by the OneNAND device */ | 26 | /* Free resources held by the OneNAND device */ |
26 | extern void onenand_release(struct mtd_info *mtd); | 27 | extern void onenand_release(struct mtd_info *mtd); |
27 | 28 | ||
28 | /* | ||
29 | * onenand_state_t - chip states | ||
30 | * Enumeration for OneNAND flash chip state | ||
31 | */ | ||
32 | typedef enum { | ||
33 | FL_READY, | ||
34 | FL_READING, | ||
35 | FL_WRITING, | ||
36 | FL_ERASING, | ||
37 | FL_SYNCING, | ||
38 | FL_LOCKING, | ||
39 | FL_RESETING, | ||
40 | FL_OTPING, | ||
41 | FL_PM_SUSPENDED, | ||
42 | } onenand_state_t; | ||
43 | |||
44 | /** | 29 | /** |
45 | * struct onenand_bufferram - OneNAND BufferRAM Data | 30 | * struct onenand_bufferram - OneNAND BufferRAM Data |
46 | * @blockpage: block & page address in BufferRAM | 31 | * @blockpage: block & page address in BufferRAM |
@@ -137,7 +122,7 @@ struct onenand_chip { | |||
137 | 122 | ||
138 | spinlock_t chip_lock; | 123 | spinlock_t chip_lock; |
139 | wait_queue_head_t wq; | 124 | wait_queue_head_t wq; |
140 | onenand_state_t state; | 125 | flstate_t state; |
141 | unsigned char *page_buf; | 126 | unsigned char *page_buf; |
142 | unsigned char *oob_buf; | 127 | unsigned char *oob_buf; |
143 | 128 | ||
@@ -152,6 +137,8 @@ struct onenand_chip { | |||
152 | /* | 137 | /* |
153 | * Helper macros | 138 | * Helper macros |
154 | */ | 139 | */ |
140 | #define ONENAND_PAGES_PER_BLOCK (1<<6) | ||
141 | |||
155 | #define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) | 142 | #define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) |
156 | #define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) | 143 | #define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) |
157 | #define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) | 144 | #define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index acadbf53a69f..cd6f3b431195 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
@@ -131,6 +131,8 @@ | |||
131 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) | 131 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) |
132 | #define ONENAND_CMD_UNLOCK_ALL (0x27) | 132 | #define ONENAND_CMD_UNLOCK_ALL (0x27) |
133 | #define ONENAND_CMD_ERASE (0x94) | 133 | #define ONENAND_CMD_ERASE (0x94) |
134 | #define ONENAND_CMD_MULTIBLOCK_ERASE (0x95) | ||
135 | #define ONENAND_CMD_ERASE_VERIFY (0x71) | ||
134 | #define ONENAND_CMD_RESET (0xF0) | 136 | #define ONENAND_CMD_RESET (0xF0) |
135 | #define ONENAND_CMD_OTP_ACCESS (0x65) | 137 | #define ONENAND_CMD_OTP_ACCESS (0x65) |
136 | #define ONENAND_CMD_READID (0x90) | 138 | #define ONENAND_CMD_READID (0x90) |
diff --git a/include/linux/mtd/pismo.h b/include/linux/mtd/pismo.h new file mode 100644 index 000000000000..8dfb7e1421c5 --- /dev/null +++ b/include/linux/mtd/pismo.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * PISMO memory driver - http://www.pismoworld.org/ | ||
3 | * | ||
4 | * 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 | ||
6 | * the Free Software Foundation; either version 2 of the License. | ||
7 | */ | ||
8 | #ifndef __LINUX_MTD_PISMO_H | ||
9 | #define __LINUX_MTD_PISMO_H | ||
10 | |||
11 | struct pismo_pdata { | ||
12 | void (*set_vpp)(void *, int); | ||
13 | void *vpp_data; | ||
14 | phys_addr_t cs_addrs[5]; | ||
15 | }; | ||
16 | |||
17 | #endif | ||
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 6913b71d9ab2..b31bd9e9bca3 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -174,6 +174,8 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc, | |||
174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); | 174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); |
175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | 175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, |
176 | int mode); | 176 | int mode); |
177 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode); | ||
178 | |||
177 | int ubi_register_volume_notifier(struct notifier_block *nb, | 179 | int ubi_register_volume_notifier(struct notifier_block *nb, |
178 | int ignore_existing); | 180 | int ignore_existing); |
179 | int ubi_unregister_volume_notifier(struct notifier_block *nb); | 181 | int ubi_unregister_volume_notifier(struct notifier_block *nb); |
diff --git a/include/linux/namei.h b/include/linux/namei.h index ec0f607b364a..05b441d93642 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -72,11 +72,8 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | |||
72 | 72 | ||
73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, | 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, |
74 | int (*open)(struct inode *, struct file *)); | 74 | int (*open)(struct inode *, struct file *)); |
75 | extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | ||
76 | extern void release_open_intent(struct nameidata *); | ||
77 | 75 | ||
78 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); | 76 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
79 | extern struct dentry *lookup_one_noperm(const char *, struct dentry *); | ||
80 | 77 | ||
81 | extern int follow_down(struct path *); | 78 | extern int follow_down(struct path *); |
82 | extern int follow_up(struct path *); | 79 | extern int follow_up(struct path *); |
diff --git a/include/linux/net.h b/include/linux/net.h index 5e8083cacc8b..4157b5d42bd6 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -174,18 +174,22 @@ struct proto_ops { | |||
174 | struct poll_table_struct *wait); | 174 | struct poll_table_struct *wait); |
175 | int (*ioctl) (struct socket *sock, unsigned int cmd, | 175 | int (*ioctl) (struct socket *sock, unsigned int cmd, |
176 | unsigned long arg); | 176 | unsigned long arg); |
177 | #ifdef CONFIG_COMPAT | ||
177 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, | 178 | int (*compat_ioctl) (struct socket *sock, unsigned int cmd, |
178 | unsigned long arg); | 179 | unsigned long arg); |
180 | #endif | ||
179 | int (*listen) (struct socket *sock, int len); | 181 | int (*listen) (struct socket *sock, int len); |
180 | int (*shutdown) (struct socket *sock, int flags); | 182 | int (*shutdown) (struct socket *sock, int flags); |
181 | int (*setsockopt)(struct socket *sock, int level, | 183 | int (*setsockopt)(struct socket *sock, int level, |
182 | int optname, char __user *optval, unsigned int optlen); | 184 | int optname, char __user *optval, unsigned int optlen); |
183 | int (*getsockopt)(struct socket *sock, int level, | 185 | int (*getsockopt)(struct socket *sock, int level, |
184 | int optname, char __user *optval, int __user *optlen); | 186 | int optname, char __user *optval, int __user *optlen); |
187 | #ifdef CONFIG_COMPAT | ||
185 | int (*compat_setsockopt)(struct socket *sock, int level, | 188 | int (*compat_setsockopt)(struct socket *sock, int level, |
186 | int optname, char __user *optval, unsigned int optlen); | 189 | int optname, char __user *optval, unsigned int optlen); |
187 | int (*compat_getsockopt)(struct socket *sock, int level, | 190 | int (*compat_getsockopt)(struct socket *sock, int level, |
188 | int optname, char __user *optval, int __user *optlen); | 191 | int optname, char __user *optval, int __user *optlen); |
192 | #endif | ||
189 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, | 193 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, |
190 | struct msghdr *m, size_t total_len); | 194 | struct msghdr *m, size_t total_len); |
191 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, | 195 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a3fccc85b1a0..682d02521bbc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/if.h> | 28 | #include <linux/if.h> |
29 | #include <linux/if_ether.h> | 29 | #include <linux/if_ether.h> |
30 | #include <linux/if_packet.h> | 30 | #include <linux/if_packet.h> |
31 | #include <linux/if_link.h> | ||
31 | 32 | ||
32 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
33 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
@@ -263,6 +264,17 @@ struct netdev_hw_addr_list { | |||
263 | int count; | 264 | int count; |
264 | }; | 265 | }; |
265 | 266 | ||
267 | #define netdev_uc_count(dev) ((dev)->uc.count) | ||
268 | #define netdev_uc_empty(dev) ((dev)->uc.count == 0) | ||
269 | #define netdev_for_each_uc_addr(ha, dev) \ | ||
270 | list_for_each_entry(ha, &dev->uc.list, list) | ||
271 | |||
272 | #define netdev_mc_count(dev) ((dev)->mc_count) | ||
273 | #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) | ||
274 | |||
275 | #define netdev_for_each_mc_addr(mclist, dev) \ | ||
276 | for (mclist = dev->mc_list; mclist; mclist = mclist->next) | ||
277 | |||
266 | struct hh_cache { | 278 | struct hh_cache { |
267 | struct hh_cache *hh_next; /* Next entry */ | 279 | struct hh_cache *hh_next; /* Next entry */ |
268 | atomic_t hh_refcnt; /* number of users */ | 280 | atomic_t hh_refcnt; /* number of users */ |
@@ -610,6 +622,13 @@ struct netdev_queue { | |||
610 | * this function is called when a VLAN id is unregistered. | 622 | * this function is called when a VLAN id is unregistered. |
611 | * | 623 | * |
612 | * void (*ndo_poll_controller)(struct net_device *dev); | 624 | * void (*ndo_poll_controller)(struct net_device *dev); |
625 | * | ||
626 | * SR-IOV management functions. | ||
627 | * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); | ||
628 | * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); | ||
629 | * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); | ||
630 | * int (*ndo_get_vf_config)(struct net_device *dev, | ||
631 | * int vf, struct ifla_vf_info *ivf); | ||
613 | */ | 632 | */ |
614 | #define HAVE_NET_DEVICE_OPS | 633 | #define HAVE_NET_DEVICE_OPS |
615 | struct net_device_ops { | 634 | struct net_device_ops { |
@@ -621,30 +640,21 @@ struct net_device_ops { | |||
621 | struct net_device *dev); | 640 | struct net_device *dev); |
622 | u16 (*ndo_select_queue)(struct net_device *dev, | 641 | u16 (*ndo_select_queue)(struct net_device *dev, |
623 | struct sk_buff *skb); | 642 | struct sk_buff *skb); |
624 | #define HAVE_CHANGE_RX_FLAGS | ||
625 | void (*ndo_change_rx_flags)(struct net_device *dev, | 643 | void (*ndo_change_rx_flags)(struct net_device *dev, |
626 | int flags); | 644 | int flags); |
627 | #define HAVE_SET_RX_MODE | ||
628 | void (*ndo_set_rx_mode)(struct net_device *dev); | 645 | void (*ndo_set_rx_mode)(struct net_device *dev); |
629 | #define HAVE_MULTICAST | ||
630 | void (*ndo_set_multicast_list)(struct net_device *dev); | 646 | void (*ndo_set_multicast_list)(struct net_device *dev); |
631 | #define HAVE_SET_MAC_ADDR | ||
632 | int (*ndo_set_mac_address)(struct net_device *dev, | 647 | int (*ndo_set_mac_address)(struct net_device *dev, |
633 | void *addr); | 648 | void *addr); |
634 | #define HAVE_VALIDATE_ADDR | ||
635 | int (*ndo_validate_addr)(struct net_device *dev); | 649 | int (*ndo_validate_addr)(struct net_device *dev); |
636 | #define HAVE_PRIVATE_IOCTL | ||
637 | int (*ndo_do_ioctl)(struct net_device *dev, | 650 | int (*ndo_do_ioctl)(struct net_device *dev, |
638 | struct ifreq *ifr, int cmd); | 651 | struct ifreq *ifr, int cmd); |
639 | #define HAVE_SET_CONFIG | ||
640 | int (*ndo_set_config)(struct net_device *dev, | 652 | int (*ndo_set_config)(struct net_device *dev, |
641 | struct ifmap *map); | 653 | struct ifmap *map); |
642 | #define HAVE_CHANGE_MTU | ||
643 | int (*ndo_change_mtu)(struct net_device *dev, | 654 | int (*ndo_change_mtu)(struct net_device *dev, |
644 | int new_mtu); | 655 | int new_mtu); |
645 | int (*ndo_neigh_setup)(struct net_device *dev, | 656 | int (*ndo_neigh_setup)(struct net_device *dev, |
646 | struct neigh_parms *); | 657 | struct neigh_parms *); |
647 | #define HAVE_TX_TIMEOUT | ||
648 | void (*ndo_tx_timeout) (struct net_device *dev); | 658 | void (*ndo_tx_timeout) (struct net_device *dev); |
649 | 659 | ||
650 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 660 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
@@ -656,9 +666,17 @@ struct net_device_ops { | |||
656 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 666 | void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
657 | unsigned short vid); | 667 | unsigned short vid); |
658 | #ifdef CONFIG_NET_POLL_CONTROLLER | 668 | #ifdef CONFIG_NET_POLL_CONTROLLER |
659 | #define HAVE_NETDEV_POLL | ||
660 | void (*ndo_poll_controller)(struct net_device *dev); | 669 | void (*ndo_poll_controller)(struct net_device *dev); |
661 | #endif | 670 | #endif |
671 | int (*ndo_set_vf_mac)(struct net_device *dev, | ||
672 | int queue, u8 *mac); | ||
673 | int (*ndo_set_vf_vlan)(struct net_device *dev, | ||
674 | int queue, u16 vlan, u8 qos); | ||
675 | int (*ndo_set_vf_tx_rate)(struct net_device *dev, | ||
676 | int vf, int rate); | ||
677 | int (*ndo_get_vf_config)(struct net_device *dev, | ||
678 | int vf, | ||
679 | struct ifla_vf_info *ivf); | ||
662 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 680 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) |
663 | int (*ndo_fcoe_enable)(struct net_device *dev); | 681 | int (*ndo_fcoe_enable)(struct net_device *dev); |
664 | int (*ndo_fcoe_disable)(struct net_device *dev); | 682 | int (*ndo_fcoe_disable)(struct net_device *dev); |
@@ -745,6 +763,7 @@ struct net_device { | |||
745 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ | 763 | #define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ |
746 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ | 764 | #define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ |
747 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ | 765 | #define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ |
766 | #define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ | ||
748 | 767 | ||
749 | /* Segmentation offload features */ | 768 | /* Segmentation offload features */ |
750 | #define NETIF_F_GSO_SHIFT 16 | 769 | #define NETIF_F_GSO_SHIFT 16 |
@@ -953,6 +972,8 @@ struct net_device { | |||
953 | /* max exchange id for FCoE LRO by ddp */ | 972 | /* max exchange id for FCoE LRO by ddp */ |
954 | unsigned int fcoe_ddp_xid; | 973 | unsigned int fcoe_ddp_xid; |
955 | #endif | 974 | #endif |
975 | /* n-tuple filter list attached to this device */ | ||
976 | struct ethtool_rx_ntuple_list ethtool_ntuple_list; | ||
956 | }; | 977 | }; |
957 | #define to_net_dev(d) container_of(d, struct net_device, dev) | 978 | #define to_net_dev(d) container_of(d, struct net_device, dev) |
958 | 979 | ||
@@ -1009,6 +1030,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev) | |||
1009 | return 0; | 1030 | return 0; |
1010 | } | 1031 | } |
1011 | 1032 | ||
1033 | #ifndef CONFIG_NET_NS | ||
1034 | static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
1035 | { | ||
1036 | skb->dev = dev; | ||
1037 | } | ||
1038 | #else /* CONFIG_NET_NS */ | ||
1039 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev); | ||
1040 | #endif | ||
1041 | |||
1012 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | 1042 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) |
1013 | { | 1043 | { |
1014 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 1044 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
@@ -1527,7 +1557,6 @@ extern int netif_rx(struct sk_buff *skb); | |||
1527 | extern int netif_rx_ni(struct sk_buff *skb); | 1557 | extern int netif_rx_ni(struct sk_buff *skb); |
1528 | #define HAVE_NETIF_RECEIVE_SKB 1 | 1558 | #define HAVE_NETIF_RECEIVE_SKB 1 |
1529 | extern int netif_receive_skb(struct sk_buff *skb); | 1559 | extern int netif_receive_skb(struct sk_buff *skb); |
1530 | extern void napi_gro_flush(struct napi_struct *napi); | ||
1531 | extern gro_result_t dev_gro_receive(struct napi_struct *napi, | 1560 | extern gro_result_t dev_gro_receive(struct napi_struct *napi, |
1532 | struct sk_buff *skb); | 1561 | struct sk_buff *skb); |
1533 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); | 1562 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); |
@@ -2083,6 +2112,130 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev) | |||
2083 | return 0; | 2112 | return 0; |
2084 | return dev->ethtool_ops->get_flags(dev); | 2113 | return dev->ethtool_ops->get_flags(dev); |
2085 | } | 2114 | } |
2115 | |||
2116 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
2117 | |||
2118 | /* netdev_printk helpers, similar to dev_printk */ | ||
2119 | |||
2120 | static inline const char *netdev_name(const struct net_device *dev) | ||
2121 | { | ||
2122 | if (dev->reg_state != NETREG_REGISTERED) | ||
2123 | return "(unregistered net_device)"; | ||
2124 | return dev->name; | ||
2125 | } | ||
2126 | |||
2127 | #define netdev_printk(level, netdev, format, args...) \ | ||
2128 | dev_printk(level, (netdev)->dev.parent, \ | ||
2129 | "%s: " format, \ | ||
2130 | netdev_name(netdev), ##args) | ||
2131 | |||
2132 | #define netdev_emerg(dev, format, args...) \ | ||
2133 | netdev_printk(KERN_EMERG, dev, format, ##args) | ||
2134 | #define netdev_alert(dev, format, args...) \ | ||
2135 | netdev_printk(KERN_ALERT, dev, format, ##args) | ||
2136 | #define netdev_crit(dev, format, args...) \ | ||
2137 | netdev_printk(KERN_CRIT, dev, format, ##args) | ||
2138 | #define netdev_err(dev, format, args...) \ | ||
2139 | netdev_printk(KERN_ERR, dev, format, ##args) | ||
2140 | #define netdev_warn(dev, format, args...) \ | ||
2141 | netdev_printk(KERN_WARNING, dev, format, ##args) | ||
2142 | #define netdev_notice(dev, format, args...) \ | ||
2143 | netdev_printk(KERN_NOTICE, dev, format, ##args) | ||
2144 | #define netdev_info(dev, format, args...) \ | ||
2145 | netdev_printk(KERN_INFO, dev, format, ##args) | ||
2146 | |||
2147 | #if defined(DEBUG) | ||
2148 | #define netdev_dbg(__dev, format, args...) \ | ||
2149 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
2150 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2151 | #define netdev_dbg(__dev, format, args...) \ | ||
2152 | do { \ | ||
2153 | dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ | ||
2154 | netdev_name(__dev), ##args); \ | ||
2155 | } while (0) | ||
2156 | #else | ||
2157 | #define netdev_dbg(__dev, format, args...) \ | ||
2158 | ({ \ | ||
2159 | if (0) \ | ||
2160 | netdev_printk(KERN_DEBUG, __dev, format, ##args); \ | ||
2161 | 0; \ | ||
2162 | }) | ||
2163 | #endif | ||
2164 | |||
2165 | #if defined(VERBOSE_DEBUG) | ||
2166 | #define netdev_vdbg netdev_dbg | ||
2167 | #else | ||
2168 | |||
2169 | #define netdev_vdbg(dev, format, args...) \ | ||
2170 | ({ \ | ||
2171 | if (0) \ | ||
2172 | netdev_printk(KERN_DEBUG, dev, format, ##args); \ | ||
2173 | 0; \ | ||
2174 | }) | ||
2175 | #endif | ||
2176 | |||
2177 | /* | ||
2178 | * netdev_WARN() acts like dev_printk(), but with the key difference | ||
2179 | * of using a WARN/WARN_ON to get the message out, including the | ||
2180 | * file/line information and a backtrace. | ||
2181 | */ | ||
2182 | #define netdev_WARN(dev, format, args...) \ | ||
2183 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); | ||
2184 | |||
2185 | /* netif printk helpers, similar to netdev_printk */ | ||
2186 | |||
2187 | #define netif_printk(priv, type, level, dev, fmt, args...) \ | ||
2188 | do { \ | ||
2189 | if (netif_msg_##type(priv)) \ | ||
2190 | netdev_printk(level, (dev), fmt, ##args); \ | ||
2191 | } while (0) | ||
2192 | |||
2193 | #define netif_emerg(priv, type, dev, fmt, args...) \ | ||
2194 | netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) | ||
2195 | #define netif_alert(priv, type, dev, fmt, args...) \ | ||
2196 | netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) | ||
2197 | #define netif_crit(priv, type, dev, fmt, args...) \ | ||
2198 | netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) | ||
2199 | #define netif_err(priv, type, dev, fmt, args...) \ | ||
2200 | netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) | ||
2201 | #define netif_warn(priv, type, dev, fmt, args...) \ | ||
2202 | netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) | ||
2203 | #define netif_notice(priv, type, dev, fmt, args...) \ | ||
2204 | netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) | ||
2205 | #define netif_info(priv, type, dev, fmt, args...) \ | ||
2206 | netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) | ||
2207 | |||
2208 | #if defined(DEBUG) | ||
2209 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
2210 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) | ||
2211 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2212 | #define netif_dbg(priv, type, netdev, format, args...) \ | ||
2213 | do { \ | ||
2214 | if (netif_msg_##type(priv)) \ | ||
2215 | dynamic_dev_dbg((netdev)->dev.parent, \ | ||
2216 | "%s: " format, \ | ||
2217 | netdev_name(netdev), ##args); \ | ||
2218 | } while (0) | ||
2219 | #else | ||
2220 | #define netif_dbg(priv, type, dev, format, args...) \ | ||
2221 | ({ \ | ||
2222 | if (0) \ | ||
2223 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ | ||
2224 | 0; \ | ||
2225 | }) | ||
2226 | #endif | ||
2227 | |||
2228 | #if defined(VERBOSE_DEBUG) | ||
2229 | #define netif_vdbg netdev_dbg | ||
2230 | #else | ||
2231 | #define netif_vdbg(priv, type, dev, format, args...) \ | ||
2232 | ({ \ | ||
2233 | if (0) \ | ||
2234 | netif_printk(KERN_DEBUG, dev, format, ##args); \ | ||
2235 | 0; \ | ||
2236 | }) | ||
2237 | #endif | ||
2238 | |||
2086 | #endif /* __KERNEL__ */ | 2239 | #endif /* __KERNEL__ */ |
2087 | 2240 | ||
2088 | #endif /* _LINUX_NETDEVICE_H */ | 2241 | #endif /* _LINUX_NETDEVICE_H */ |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 48c54960773c..89341c32631a 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -114,15 +114,17 @@ struct nf_sockopt_ops { | |||
114 | int set_optmin; | 114 | int set_optmin; |
115 | int set_optmax; | 115 | int set_optmax; |
116 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); | 116 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); |
117 | #ifdef CONFIG_COMPAT | ||
117 | int (*compat_set)(struct sock *sk, int optval, | 118 | int (*compat_set)(struct sock *sk, int optval, |
118 | void __user *user, unsigned int len); | 119 | void __user *user, unsigned int len); |
119 | 120 | #endif | |
120 | int get_optmin; | 121 | int get_optmin; |
121 | int get_optmax; | 122 | int get_optmax; |
122 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); | 123 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); |
124 | #ifdef CONFIG_COMPAT | ||
123 | int (*compat_get)(struct sock *sk, int optval, | 125 | int (*compat_get)(struct sock *sk, int optval, |
124 | void __user *user, int *len); | 126 | void __user *user, int *len); |
125 | 127 | #endif | |
126 | /* Use the module struct to lock set/get code in place */ | 128 | /* Use the module struct to lock set/get code in place */ |
127 | struct module *owner; | 129 | struct module *owner; |
128 | }; | 130 | }; |
@@ -161,11 +163,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
161 | struct sk_buff *skb, | 163 | struct sk_buff *skb, |
162 | struct net_device *indev, | 164 | struct net_device *indev, |
163 | struct net_device *outdev, | 165 | struct net_device *outdev, |
164 | int (*okfn)(struct sk_buff *), int thresh, | 166 | int (*okfn)(struct sk_buff *), int thresh) |
165 | int cond) | ||
166 | { | 167 | { |
167 | if (!cond) | ||
168 | return 1; | ||
169 | #ifndef CONFIG_NETFILTER_DEBUG | 168 | #ifndef CONFIG_NETFILTER_DEBUG |
170 | if (list_empty(&nf_hooks[pf][hook])) | 169 | if (list_empty(&nf_hooks[pf][hook])) |
171 | return 1; | 170 | return 1; |
@@ -177,7 +176,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
177 | struct net_device *indev, struct net_device *outdev, | 176 | struct net_device *indev, struct net_device *outdev, |
178 | int (*okfn)(struct sk_buff *)) | 177 | int (*okfn)(struct sk_buff *)) |
179 | { | 178 | { |
180 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN, 1); | 179 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); |
181 | } | 180 | } |
182 | 181 | ||
183 | /* Activate hook; either okfn or kfree_skb called, unless a hook | 182 | /* Activate hook; either okfn or kfree_skb called, unless a hook |
@@ -197,36 +196,49 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
197 | coders :) | 196 | coders :) |
198 | */ | 197 | */ |
199 | 198 | ||
200 | /* This is gross, but inline doesn't cut it for avoiding the function | 199 | static inline int |
201 | call in fast path: gcc doesn't inline (needs value tracking?). --RR */ | 200 | NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
202 | 201 | struct net_device *in, struct net_device *out, | |
203 | /* HX: It's slightly less gross now. */ | 202 | int (*okfn)(struct sk_buff *), int thresh) |
203 | { | ||
204 | int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); | ||
205 | if (ret == 1) | ||
206 | ret = okfn(skb); | ||
207 | return ret; | ||
208 | } | ||
204 | 209 | ||
205 | #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ | 210 | static inline int |
206 | ({int __ret; \ | 211 | NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
207 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh, 1)) == 1)\ | 212 | struct net_device *in, struct net_device *out, |
208 | __ret = (okfn)(skb); \ | 213 | int (*okfn)(struct sk_buff *), bool cond) |
209 | __ret;}) | 214 | { |
215 | int ret; | ||
210 | 216 | ||
211 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ | 217 | if (!cond || |
212 | ({int __ret; \ | 218 | (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) |
213 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ | 219 | ret = okfn(skb); |
214 | __ret = (okfn)(skb); \ | 220 | return ret; |
215 | __ret;}) | 221 | } |
216 | 222 | ||
217 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ | 223 | static inline int |
218 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 224 | NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
225 | struct net_device *in, struct net_device *out, | ||
226 | int (*okfn)(struct sk_buff *)) | ||
227 | { | ||
228 | return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); | ||
229 | } | ||
219 | 230 | ||
220 | /* Call setsockopt() */ | 231 | /* Call setsockopt() */ |
221 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 232 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
222 | unsigned int len); | 233 | unsigned int len); |
223 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 234 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
224 | int *len); | 235 | int *len); |
225 | 236 | #ifdef CONFIG_COMPAT | |
226 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, | 237 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
227 | char __user *opt, unsigned int len); | 238 | char __user *opt, unsigned int len); |
228 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, | 239 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, |
229 | char __user *opt, int *len); | 240 | char __user *opt, int *len); |
241 | #endif | ||
230 | 242 | ||
231 | /* Call this before modifying an existing packet: ensures it is | 243 | /* Call this before modifying an existing packet: ensures it is |
232 | modifiable and linear to the point you care about (writable_len). | 244 | modifiable and linear to the point you care about (writable_len). |
@@ -325,8 +337,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
325 | struct sk_buff *skb, | 337 | struct sk_buff *skb, |
326 | struct net_device *indev, | 338 | struct net_device *indev, |
327 | struct net_device *outdev, | 339 | struct net_device *outdev, |
328 | int (*okfn)(struct sk_buff *), int thresh, | 340 | int (*okfn)(struct sk_buff *), int thresh) |
329 | int cond) | ||
330 | { | 341 | { |
331 | return okfn(skb); | 342 | return okfn(skb); |
332 | } | 343 | } |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 2aea50399c0b..a5a63e41b8af 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -6,6 +6,7 @@ header-y += nfnetlink_queue.h | |||
6 | header-y += xt_CLASSIFY.h | 6 | header-y += xt_CLASSIFY.h |
7 | header-y += xt_CONNMARK.h | 7 | header-y += xt_CONNMARK.h |
8 | header-y += xt_CONNSECMARK.h | 8 | header-y += xt_CONNSECMARK.h |
9 | header-y += xt_CT.h | ||
9 | header-y += xt_DSCP.h | 10 | header-y += xt_DSCP.h |
10 | header-y += xt_LED.h | 11 | header-y += xt_LED.h |
11 | header-y += xt_MARK.h | 12 | header-y += xt_MARK.h |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index a374787ed9b0..c608677dda60 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
@@ -72,6 +72,28 @@ enum ip_conntrack_status { | |||
72 | /* Connection has fixed timeout. */ | 72 | /* Connection has fixed timeout. */ |
73 | IPS_FIXED_TIMEOUT_BIT = 10, | 73 | IPS_FIXED_TIMEOUT_BIT = 10, |
74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), | 74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), |
75 | |||
76 | /* Conntrack is a template */ | ||
77 | IPS_TEMPLATE_BIT = 11, | ||
78 | IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), | ||
79 | }; | ||
80 | |||
81 | /* Connection tracking event types */ | ||
82 | enum ip_conntrack_events { | ||
83 | IPCT_NEW, /* new conntrack */ | ||
84 | IPCT_RELATED, /* related conntrack */ | ||
85 | IPCT_DESTROY, /* destroyed conntrack */ | ||
86 | IPCT_REPLY, /* connection has seen two-way traffic */ | ||
87 | IPCT_ASSURED, /* connection status has changed to assured */ | ||
88 | IPCT_PROTOINFO, /* protocol information has changed */ | ||
89 | IPCT_HELPER, /* new helper has been set */ | ||
90 | IPCT_MARK, /* new mark has been set */ | ||
91 | IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */ | ||
92 | IPCT_SECMARK, /* new security mark has been set */ | ||
93 | }; | ||
94 | |||
95 | enum ip_conntrack_expect_events { | ||
96 | IPEXP_NEW, /* new expectation */ | ||
75 | }; | 97 | }; |
76 | 98 | ||
77 | #ifdef __KERNEL__ | 99 | #ifdef __KERNEL__ |
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 23aa2ec6b7b7..ff8cfbcf3b81 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
@@ -14,6 +14,7 @@ enum sip_expectation_classes { | |||
14 | SIP_EXPECT_SIGNALLING, | 14 | SIP_EXPECT_SIGNALLING, |
15 | SIP_EXPECT_AUDIO, | 15 | SIP_EXPECT_AUDIO, |
16 | SIP_EXPECT_VIDEO, | 16 | SIP_EXPECT_VIDEO, |
17 | SIP_EXPECT_IMAGE, | ||
17 | __SIP_EXPECT_MAX | 18 | __SIP_EXPECT_MAX |
18 | }; | 19 | }; |
19 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) | 20 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) |
@@ -34,10 +35,10 @@ struct sdp_media_type { | |||
34 | struct sip_handler { | 35 | struct sip_handler { |
35 | const char *method; | 36 | const char *method; |
36 | unsigned int len; | 37 | unsigned int len; |
37 | int (*request)(struct sk_buff *skb, | 38 | int (*request)(struct sk_buff *skb, unsigned int dataoff, |
38 | const char **dptr, unsigned int *datalen, | 39 | const char **dptr, unsigned int *datalen, |
39 | unsigned int cseq); | 40 | unsigned int cseq); |
40 | int (*response)(struct sk_buff *skb, | 41 | int (*response)(struct sk_buff *skb, unsigned int dataoff, |
41 | const char **dptr, unsigned int *datalen, | 42 | const char **dptr, unsigned int *datalen, |
42 | unsigned int cseq, unsigned int code); | 43 | unsigned int cseq, unsigned int code); |
43 | }; | 44 | }; |
@@ -84,7 +85,8 @@ enum sip_header_types { | |||
84 | SIP_HDR_FROM, | 85 | SIP_HDR_FROM, |
85 | SIP_HDR_TO, | 86 | SIP_HDR_TO, |
86 | SIP_HDR_CONTACT, | 87 | SIP_HDR_CONTACT, |
87 | SIP_HDR_VIA, | 88 | SIP_HDR_VIA_UDP, |
89 | SIP_HDR_VIA_TCP, | ||
88 | SIP_HDR_EXPIRES, | 90 | SIP_HDR_EXPIRES, |
89 | SIP_HDR_CONTENT_LENGTH, | 91 | SIP_HDR_CONTENT_LENGTH, |
90 | }; | 92 | }; |
@@ -100,33 +102,40 @@ enum sdp_header_types { | |||
100 | }; | 102 | }; |
101 | 103 | ||
102 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, | 104 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, |
105 | unsigned int dataoff, | ||
103 | const char **dptr, | 106 | const char **dptr, |
104 | unsigned int *datalen); | 107 | unsigned int *datalen); |
108 | extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off); | ||
105 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, | 109 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, |
110 | unsigned int dataoff, | ||
106 | const char **dptr, | 111 | const char **dptr, |
107 | unsigned int *datalen, | 112 | unsigned int *datalen, |
108 | struct nf_conntrack_expect *exp, | 113 | struct nf_conntrack_expect *exp, |
109 | unsigned int matchoff, | 114 | unsigned int matchoff, |
110 | unsigned int matchlen); | 115 | unsigned int matchlen); |
111 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, | 116 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, |
112 | const char **dptr, | ||
113 | unsigned int dataoff, | 117 | unsigned int dataoff, |
118 | const char **dptr, | ||
114 | unsigned int *datalen, | 119 | unsigned int *datalen, |
120 | unsigned int sdpoff, | ||
115 | enum sdp_header_types type, | 121 | enum sdp_header_types type, |
116 | enum sdp_header_types term, | 122 | enum sdp_header_types term, |
117 | const union nf_inet_addr *addr); | 123 | const union nf_inet_addr *addr); |
118 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, | 124 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, |
125 | unsigned int dataoff, | ||
119 | const char **dptr, | 126 | const char **dptr, |
120 | unsigned int *datalen, | 127 | unsigned int *datalen, |
121 | unsigned int matchoff, | 128 | unsigned int matchoff, |
122 | unsigned int matchlen, | 129 | unsigned int matchlen, |
123 | u_int16_t port); | 130 | u_int16_t port); |
124 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, | 131 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, |
125 | const char **dptr, | ||
126 | unsigned int dataoff, | 132 | unsigned int dataoff, |
133 | const char **dptr, | ||
127 | unsigned int *datalen, | 134 | unsigned int *datalen, |
135 | unsigned int sdpoff, | ||
128 | const union nf_inet_addr *addr); | 136 | const union nf_inet_addr *addr); |
129 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, | 137 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, |
138 | unsigned int dataoff, | ||
130 | const char **dptr, | 139 | const char **dptr, |
131 | unsigned int *datalen, | 140 | unsigned int *datalen, |
132 | struct nf_conntrack_expect *rtp_exp, | 141 | struct nf_conntrack_expect *rtp_exp, |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 49d321f3ccd2..53923868c9bd 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -73,11 +73,11 @@ struct nfnetlink_subsystem { | |||
73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); | 73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | 74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
75 | 75 | ||
76 | extern int nfnetlink_has_listeners(unsigned int group); | 76 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
77 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | 77 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, |
78 | int echo, gfp_t flags); | 78 | int echo, gfp_t flags); |
79 | extern void nfnetlink_set_err(u32 pid, u32 group, int error); | 79 | extern void nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); |
80 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | 80 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); |
81 | 81 | ||
82 | extern void nfnl_lock(void); | 82 | extern void nfnl_lock(void); |
83 | extern void nfnl_unlock(void); | 83 | extern void nfnl_unlock(void); |
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index ed4ef8d0b11b..9ed534c991b9 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -40,6 +40,7 @@ enum ctattr_type { | |||
40 | CTA_NAT_SEQ_ADJ_ORIG, | 40 | CTA_NAT_SEQ_ADJ_ORIG, |
41 | CTA_NAT_SEQ_ADJ_REPLY, | 41 | CTA_NAT_SEQ_ADJ_REPLY, |
42 | CTA_SECMARK, | 42 | CTA_SECMARK, |
43 | CTA_ZONE, | ||
43 | __CTA_MAX | 44 | __CTA_MAX |
44 | }; | 45 | }; |
45 | #define CTA_MAX (__CTA_MAX - 1) | 46 | #define CTA_MAX (__CTA_MAX - 1) |
@@ -159,6 +160,7 @@ enum ctattr_expect { | |||
159 | CTA_EXPECT_TIMEOUT, | 160 | CTA_EXPECT_TIMEOUT, |
160 | CTA_EXPECT_ID, | 161 | CTA_EXPECT_ID, |
161 | CTA_EXPECT_HELP_NAME, | 162 | CTA_EXPECT_HELP_NAME, |
163 | CTA_EXPECT_ZONE, | ||
162 | __CTA_EXPECT_MAX | 164 | __CTA_EXPECT_MAX |
163 | }; | 165 | }; |
164 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | 166 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 378f27ae7772..84c7c928e9eb 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -93,8 +93,7 @@ struct _xt_align { | |||
93 | __u64 u64; | 93 | __u64 u64; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | #define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ | 96 | #define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) |
97 | & ~(__alignof__(struct _xt_align)-1)) | ||
98 | 97 | ||
99 | /* Standard return verdict, or do jump. */ | 98 | /* Standard return verdict, or do jump. */ |
100 | #define XT_STANDARD_TARGET "" | 99 | #define XT_STANDARD_TARGET "" |
@@ -121,6 +120,7 @@ struct xt_counters_info { | |||
121 | 120 | ||
122 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ | 121 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ |
123 | 122 | ||
123 | #ifndef __KERNEL__ | ||
124 | /* fn returns 0 to continue iteration */ | 124 | /* fn returns 0 to continue iteration */ |
125 | #define XT_MATCH_ITERATE(type, e, fn, args...) \ | 125 | #define XT_MATCH_ITERATE(type, e, fn, args...) \ |
126 | ({ \ | 126 | ({ \ |
@@ -164,6 +164,22 @@ struct xt_counters_info { | |||
164 | #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ | 164 | #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ |
165 | XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) | 165 | XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) |
166 | 166 | ||
167 | #endif /* !__KERNEL__ */ | ||
168 | |||
169 | /* pos is normally a struct ipt_entry/ip6t_entry/etc. */ | ||
170 | #define xt_entry_foreach(pos, ehead, esize) \ | ||
171 | for ((pos) = (typeof(pos))(ehead); \ | ||
172 | (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ | ||
173 | (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) | ||
174 | |||
175 | /* can only be xt_entry_match, so no use of typeof here */ | ||
176 | #define xt_ematch_foreach(pos, entry) \ | ||
177 | for ((pos) = (struct xt_entry_match *)entry->elems; \ | ||
178 | (pos) < (struct xt_entry_match *)((char *)(entry) + \ | ||
179 | (entry)->target_offset); \ | ||
180 | (pos) = (struct xt_entry_match *)((char *)(pos) + \ | ||
181 | (pos)->u.match_size)) | ||
182 | |||
167 | #ifdef __KERNEL__ | 183 | #ifdef __KERNEL__ |
168 | 184 | ||
169 | #include <linux/netdevice.h> | 185 | #include <linux/netdevice.h> |
@@ -205,6 +221,7 @@ struct xt_match_param { | |||
205 | * @hook_mask: via which hooks the new rule is reachable | 221 | * @hook_mask: via which hooks the new rule is reachable |
206 | */ | 222 | */ |
207 | struct xt_mtchk_param { | 223 | struct xt_mtchk_param { |
224 | struct net *net; | ||
208 | const char *table; | 225 | const char *table; |
209 | const void *entryinfo; | 226 | const void *entryinfo; |
210 | const struct xt_match *match; | 227 | const struct xt_match *match; |
@@ -215,6 +232,7 @@ struct xt_mtchk_param { | |||
215 | 232 | ||
216 | /* Match destructor parameters */ | 233 | /* Match destructor parameters */ |
217 | struct xt_mtdtor_param { | 234 | struct xt_mtdtor_param { |
235 | struct net *net; | ||
218 | const struct xt_match *match; | 236 | const struct xt_match *match; |
219 | void *matchinfo; | 237 | void *matchinfo; |
220 | u_int8_t family; | 238 | u_int8_t family; |
@@ -247,6 +265,7 @@ struct xt_target_param { | |||
247 | * Other fields see above. | 265 | * Other fields see above. |
248 | */ | 266 | */ |
249 | struct xt_tgchk_param { | 267 | struct xt_tgchk_param { |
268 | struct net *net; | ||
250 | const char *table; | 269 | const char *table; |
251 | const void *entryinfo; | 270 | const void *entryinfo; |
252 | const struct xt_target *target; | 271 | const struct xt_target *target; |
@@ -257,6 +276,7 @@ struct xt_tgchk_param { | |||
257 | 276 | ||
258 | /* Target destructor parameters */ | 277 | /* Target destructor parameters */ |
259 | struct xt_tgdtor_param { | 278 | struct xt_tgdtor_param { |
279 | struct net *net; | ||
260 | const struct xt_target *target; | 280 | const struct xt_target *target; |
261 | void *targinfo; | 281 | void *targinfo; |
262 | u_int8_t family; | 282 | u_int8_t family; |
@@ -281,11 +301,11 @@ struct xt_match { | |||
281 | 301 | ||
282 | /* Called when entry of this type deleted. */ | 302 | /* Called when entry of this type deleted. */ |
283 | void (*destroy)(const struct xt_mtdtor_param *); | 303 | void (*destroy)(const struct xt_mtdtor_param *); |
284 | 304 | #ifdef CONFIG_COMPAT | |
285 | /* Called when userspace align differs from kernel space one */ | 305 | /* Called when userspace align differs from kernel space one */ |
286 | void (*compat_from_user)(void *dst, void *src); | 306 | void (*compat_from_user)(void *dst, const void *src); |
287 | int (*compat_to_user)(void __user *dst, void *src); | 307 | int (*compat_to_user)(void __user *dst, const void *src); |
288 | 308 | #endif | |
289 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 309 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
290 | struct module *me; | 310 | struct module *me; |
291 | 311 | ||
@@ -294,7 +314,9 @@ struct xt_match { | |||
294 | 314 | ||
295 | const char *table; | 315 | const char *table; |
296 | unsigned int matchsize; | 316 | unsigned int matchsize; |
317 | #ifdef CONFIG_COMPAT | ||
297 | unsigned int compatsize; | 318 | unsigned int compatsize; |
319 | #endif | ||
298 | unsigned int hooks; | 320 | unsigned int hooks; |
299 | unsigned short proto; | 321 | unsigned short proto; |
300 | 322 | ||
@@ -321,17 +343,19 @@ struct xt_target { | |||
321 | 343 | ||
322 | /* Called when entry of this type deleted. */ | 344 | /* Called when entry of this type deleted. */ |
323 | void (*destroy)(const struct xt_tgdtor_param *); | 345 | void (*destroy)(const struct xt_tgdtor_param *); |
324 | 346 | #ifdef CONFIG_COMPAT | |
325 | /* Called when userspace align differs from kernel space one */ | 347 | /* Called when userspace align differs from kernel space one */ |
326 | void (*compat_from_user)(void *dst, void *src); | 348 | void (*compat_from_user)(void *dst, const void *src); |
327 | int (*compat_to_user)(void __user *dst, void *src); | 349 | int (*compat_to_user)(void __user *dst, const void *src); |
328 | 350 | #endif | |
329 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 351 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
330 | struct module *me; | 352 | struct module *me; |
331 | 353 | ||
332 | const char *table; | 354 | const char *table; |
333 | unsigned int targetsize; | 355 | unsigned int targetsize; |
356 | #ifdef CONFIG_COMPAT | ||
334 | unsigned int compatsize; | 357 | unsigned int compatsize; |
358 | #endif | ||
335 | unsigned int hooks; | 359 | unsigned int hooks; |
336 | unsigned short proto; | 360 | unsigned short proto; |
337 | 361 | ||
@@ -353,6 +377,7 @@ struct xt_table { | |||
353 | struct module *me; | 377 | struct module *me; |
354 | 378 | ||
355 | u_int8_t af; /* address/protocol family */ | 379 | u_int8_t af; /* address/protocol family */ |
380 | int priority; /* hook order */ | ||
356 | 381 | ||
357 | /* A unique name... */ | 382 | /* A unique name... */ |
358 | const char name[XT_TABLE_MAXNAMELEN]; | 383 | const char name[XT_TABLE_MAXNAMELEN]; |
@@ -514,6 +539,9 @@ static inline unsigned long ifname_compare_aligned(const char *_a, | |||
514 | return ret; | 539 | return ret; |
515 | } | 540 | } |
516 | 541 | ||
542 | extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); | ||
543 | extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *); | ||
544 | |||
517 | #ifdef CONFIG_COMPAT | 545 | #ifdef CONFIG_COMPAT |
518 | #include <net/compat.h> | 546 | #include <net/compat.h> |
519 | 547 | ||
@@ -554,11 +582,7 @@ struct compat_xt_entry_target { | |||
554 | * current task alignment */ | 582 | * current task alignment */ |
555 | 583 | ||
556 | struct compat_xt_counters { | 584 | struct compat_xt_counters { |
557 | #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) | 585 | compat_u64 pcnt, bcnt; /* Packet and byte counters */ |
558 | u_int32_t cnt[4]; | ||
559 | #else | ||
560 | u_int64_t cnt[2]; | ||
561 | #endif | ||
562 | }; | 586 | }; |
563 | 587 | ||
564 | struct compat_xt_counters_info { | 588 | struct compat_xt_counters_info { |
@@ -567,26 +591,32 @@ struct compat_xt_counters_info { | |||
567 | struct compat_xt_counters counters[0]; | 591 | struct compat_xt_counters counters[0]; |
568 | }; | 592 | }; |
569 | 593 | ||
570 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ | 594 | struct _compat_xt_align { |
571 | & ~(__alignof__(struct compat_xt_counters)-1)) | 595 | __u8 u8; |
596 | __u16 u16; | ||
597 | __u32 u32; | ||
598 | compat_u64 u64; | ||
599 | }; | ||
600 | |||
601 | #define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) | ||
572 | 602 | ||
573 | extern void xt_compat_lock(u_int8_t af); | 603 | extern void xt_compat_lock(u_int8_t af); |
574 | extern void xt_compat_unlock(u_int8_t af); | 604 | extern void xt_compat_unlock(u_int8_t af); |
575 | 605 | ||
576 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); | 606 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
577 | extern void xt_compat_flush_offsets(u_int8_t af); | 607 | extern void xt_compat_flush_offsets(u_int8_t af); |
578 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); | 608 | extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
579 | 609 | ||
580 | extern int xt_compat_match_offset(const struct xt_match *match); | 610 | extern int xt_compat_match_offset(const struct xt_match *match); |
581 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 611 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
582 | void **dstptr, unsigned int *size); | 612 | void **dstptr, unsigned int *size); |
583 | extern int xt_compat_match_to_user(struct xt_entry_match *m, | 613 | extern int xt_compat_match_to_user(const struct xt_entry_match *m, |
584 | void __user **dstptr, unsigned int *size); | 614 | void __user **dstptr, unsigned int *size); |
585 | 615 | ||
586 | extern int xt_compat_target_offset(const struct xt_target *target); | 616 | extern int xt_compat_target_offset(const struct xt_target *target); |
587 | extern void xt_compat_target_from_user(struct xt_entry_target *t, | 617 | extern void xt_compat_target_from_user(struct xt_entry_target *t, |
588 | void **dstptr, unsigned int *size); | 618 | void **dstptr, unsigned int *size); |
589 | extern int xt_compat_target_to_user(struct xt_entry_target *t, | 619 | extern int xt_compat_target_to_user(const struct xt_entry_target *t, |
590 | void __user **dstptr, unsigned int *size); | 620 | void __user **dstptr, unsigned int *size); |
591 | 621 | ||
592 | #endif /* CONFIG_COMPAT */ | 622 | #endif /* CONFIG_COMPAT */ |
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h new file mode 100644 index 000000000000..1b564106891d --- /dev/null +++ b/include/linux/netfilter/xt_CT.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _XT_CT_H | ||
2 | #define _XT_CT_H | ||
3 | |||
4 | #define XT_CT_NOTRACK 0x1 | ||
5 | |||
6 | struct xt_ct_target_info { | ||
7 | u_int16_t flags; | ||
8 | u_int16_t zone; | ||
9 | u_int32_t ct_events; | ||
10 | u_int32_t exp_events; | ||
11 | char helper[16]; | ||
12 | |||
13 | /* Used internally by the kernel */ | ||
14 | struct nf_conn *ct __attribute__((aligned(8))); | ||
15 | }; | ||
16 | |||
17 | #endif /* _XT_CT_H */ | ||
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index f2336523a9df..e9948c0560f6 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
@@ -211,9 +211,11 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e | |||
211 | return (void *)e + e->target_offset; | 211 | return (void *)e + e->target_offset; |
212 | } | 212 | } |
213 | 213 | ||
214 | #ifndef __KERNEL__ | ||
214 | /* fn returns 0 to continue iteration */ | 215 | /* fn returns 0 to continue iteration */ |
215 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 216 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
216 | XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) | 217 | XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) |
218 | #endif | ||
217 | 219 | ||
218 | /* | 220 | /* |
219 | * Main firewall chains definitions and global var's definitions. | 221 | * Main firewall chains definitions and global var's definitions. |
@@ -258,6 +260,7 @@ struct arpt_error { | |||
258 | .target.errorname = "ERROR", \ | 260 | .target.errorname = "ERROR", \ |
259 | } | 261 | } |
260 | 262 | ||
263 | extern void *arpt_alloc_initial_table(const struct xt_table *); | ||
261 | extern struct xt_table *arpt_register_table(struct net *net, | 264 | extern struct xt_table *arpt_register_table(struct net *net, |
262 | const struct xt_table *table, | 265 | const struct xt_table *table, |
263 | const struct arpt_replace *repl); | 266 | const struct arpt_replace *repl); |
@@ -290,14 +293,6 @@ compat_arpt_get_target(struct compat_arpt_entry *e) | |||
290 | 293 | ||
291 | #define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) | 294 | #define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) |
292 | 295 | ||
293 | /* fn returns 0 to continue iteration */ | ||
294 | #define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
295 | XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args) | ||
296 | |||
297 | #define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
298 | XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \ | ||
299 | fn, ## args) | ||
300 | |||
301 | #endif /* CONFIG_COMPAT */ | 296 | #endif /* CONFIG_COMPAT */ |
302 | #endif /*__KERNEL__*/ | 297 | #endif /*__KERNEL__*/ |
303 | #endif /* _ARPTABLES_H */ | 298 | #endif /* _ARPTABLES_H */ |
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 3cc40c131cc3..1c6f0c5f530e 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
@@ -289,7 +289,7 @@ struct ebt_table { | |||
289 | ~(__alignof__(struct ebt_replace)-1)) | 289 | ~(__alignof__(struct ebt_replace)-1)) |
290 | extern struct ebt_table *ebt_register_table(struct net *net, | 290 | extern struct ebt_table *ebt_register_table(struct net *net, |
291 | const struct ebt_table *table); | 291 | const struct ebt_table *table); |
292 | extern void ebt_unregister_table(struct ebt_table *table); | 292 | extern void ebt_unregister_table(struct net *net, struct ebt_table *table); |
293 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | 293 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, |
294 | const struct net_device *in, const struct net_device *out, | 294 | const struct net_device *in, const struct net_device *out, |
295 | struct ebt_table *table); | 295 | struct ebt_table *table); |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index 27b3f5807305..704a7b6e8169 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
@@ -223,6 +223,7 @@ ipt_get_target(struct ipt_entry *e) | |||
223 | return (void *)e + e->target_offset; | 223 | return (void *)e + e->target_offset; |
224 | } | 224 | } |
225 | 225 | ||
226 | #ifndef __KERNEL__ | ||
226 | /* fn returns 0 to continue iteration */ | 227 | /* fn returns 0 to continue iteration */ |
227 | #define IPT_MATCH_ITERATE(e, fn, args...) \ | 228 | #define IPT_MATCH_ITERATE(e, fn, args...) \ |
228 | XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) | 229 | XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) |
@@ -230,6 +231,7 @@ ipt_get_target(struct ipt_entry *e) | |||
230 | /* fn returns 0 to continue iteration */ | 231 | /* fn returns 0 to continue iteration */ |
231 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 232 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
232 | XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) | 233 | XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) |
234 | #endif | ||
233 | 235 | ||
234 | /* | 236 | /* |
235 | * Main firewall chains definitions and global var's definitions. | 237 | * Main firewall chains definitions and global var's definitions. |
@@ -242,7 +244,7 @@ extern void ipt_init(void) __init; | |||
242 | extern struct xt_table *ipt_register_table(struct net *net, | 244 | extern struct xt_table *ipt_register_table(struct net *net, |
243 | const struct xt_table *table, | 245 | const struct xt_table *table, |
244 | const struct ipt_replace *repl); | 246 | const struct ipt_replace *repl); |
245 | extern void ipt_unregister_table(struct xt_table *table); | 247 | extern void ipt_unregister_table(struct net *net, struct xt_table *table); |
246 | 248 | ||
247 | /* Standard entry. */ | 249 | /* Standard entry. */ |
248 | struct ipt_standard { | 250 | struct ipt_standard { |
@@ -282,6 +284,7 @@ struct ipt_error { | |||
282 | .target.errorname = "ERROR", \ | 284 | .target.errorname = "ERROR", \ |
283 | } | 285 | } |
284 | 286 | ||
287 | extern void *ipt_alloc_initial_table(const struct xt_table *); | ||
285 | extern unsigned int ipt_do_table(struct sk_buff *skb, | 288 | extern unsigned int ipt_do_table(struct sk_buff *skb, |
286 | unsigned int hook, | 289 | unsigned int hook, |
287 | const struct net_device *in, | 290 | const struct net_device *in, |
@@ -312,19 +315,6 @@ compat_ipt_get_target(struct compat_ipt_entry *e) | |||
312 | 315 | ||
313 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) | 316 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) |
314 | 317 | ||
315 | /* fn returns 0 to continue iteration */ | ||
316 | #define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \ | ||
317 | XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args) | ||
318 | |||
319 | /* fn returns 0 to continue iteration */ | ||
320 | #define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
321 | XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args) | ||
322 | |||
323 | /* fn returns 0 to continue iteration */ | ||
324 | #define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
325 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \ | ||
326 | fn, ## args) | ||
327 | |||
328 | #endif /* CONFIG_COMPAT */ | 318 | #endif /* CONFIG_COMPAT */ |
329 | #endif /*__KERNEL__*/ | 319 | #endif /*__KERNEL__*/ |
330 | #endif /* _IPTABLES_H */ | 320 | #endif /* _IPTABLES_H */ |
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index b31050d20ae4..e5ba03d783c6 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -280,6 +280,7 @@ ip6t_get_target(struct ip6t_entry *e) | |||
280 | return (void *)e + e->target_offset; | 280 | return (void *)e + e->target_offset; |
281 | } | 281 | } |
282 | 282 | ||
283 | #ifndef __KERNEL__ | ||
283 | /* fn returns 0 to continue iteration */ | 284 | /* fn returns 0 to continue iteration */ |
284 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ | 285 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ |
285 | XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) | 286 | XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) |
@@ -287,6 +288,7 @@ ip6t_get_target(struct ip6t_entry *e) | |||
287 | /* fn returns 0 to continue iteration */ | 288 | /* fn returns 0 to continue iteration */ |
288 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | 289 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ |
289 | XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) | 290 | XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) |
291 | #endif | ||
290 | 292 | ||
291 | /* | 293 | /* |
292 | * Main firewall chains definitions and global var's definitions. | 294 | * Main firewall chains definitions and global var's definitions. |
@@ -297,10 +299,11 @@ ip6t_get_target(struct ip6t_entry *e) | |||
297 | #include <linux/init.h> | 299 | #include <linux/init.h> |
298 | extern void ip6t_init(void) __init; | 300 | extern void ip6t_init(void) __init; |
299 | 301 | ||
302 | extern void *ip6t_alloc_initial_table(const struct xt_table *); | ||
300 | extern struct xt_table *ip6t_register_table(struct net *net, | 303 | extern struct xt_table *ip6t_register_table(struct net *net, |
301 | const struct xt_table *table, | 304 | const struct xt_table *table, |
302 | const struct ip6t_replace *repl); | 305 | const struct ip6t_replace *repl); |
303 | extern void ip6t_unregister_table(struct xt_table *table); | 306 | extern void ip6t_unregister_table(struct net *net, struct xt_table *table); |
304 | extern unsigned int ip6t_do_table(struct sk_buff *skb, | 307 | extern unsigned int ip6t_do_table(struct sk_buff *skb, |
305 | unsigned int hook, | 308 | unsigned int hook, |
306 | const struct net_device *in, | 309 | const struct net_device *in, |
@@ -340,18 +343,6 @@ compat_ip6t_get_target(struct compat_ip6t_entry *e) | |||
340 | 343 | ||
341 | #define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) | 344 | #define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) |
342 | 345 | ||
343 | /* fn returns 0 to continue iteration */ | ||
344 | #define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \ | ||
345 | XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args) | ||
346 | |||
347 | /* fn returns 0 to continue iteration */ | ||
348 | #define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
349 | XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args) | ||
350 | |||
351 | #define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
352 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \ | ||
353 | fn, ## args) | ||
354 | |||
355 | #endif /* CONFIG_COMPAT */ | 346 | #endif /* CONFIG_COMPAT */ |
356 | #endif /*__KERNEL__*/ | 347 | #endif /*__KERNEL__*/ |
357 | #endif /* _IP6_TABLES_H */ | 348 | #endif /* _IP6_TABLES_H */ |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 2524267210d3..a765ea898549 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -21,15 +21,20 @@ struct netpoll { | |||
21 | __be32 local_ip, remote_ip; | 21 | __be32 local_ip, remote_ip; |
22 | u16 local_port, remote_port; | 22 | u16 local_port, remote_port; |
23 | u8 remote_mac[ETH_ALEN]; | 23 | u8 remote_mac[ETH_ALEN]; |
24 | |||
25 | struct list_head rx; /* rx_np list element */ | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | struct netpoll_info { | 28 | struct netpoll_info { |
27 | atomic_t refcnt; | 29 | atomic_t refcnt; |
30 | |||
28 | int rx_flags; | 31 | int rx_flags; |
29 | spinlock_t rx_lock; | 32 | spinlock_t rx_lock; |
30 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 33 | struct list_head rx_np; /* netpolls that registered an rx_hook */ |
34 | |||
31 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ | 35 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ |
32 | struct sk_buff_head txq; | 36 | struct sk_buff_head txq; |
37 | |||
33 | struct delayed_work tx_work; | 38 | struct delayed_work tx_work; |
34 | }; | 39 | }; |
35 | 40 | ||
@@ -51,7 +56,7 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
51 | unsigned long flags; | 56 | unsigned long flags; |
52 | int ret = 0; | 57 | int ret = 0; |
53 | 58 | ||
54 | if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) | 59 | if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) |
55 | return 0; | 60 | return 0; |
56 | 61 | ||
57 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 62 | spin_lock_irqsave(&npinfo->rx_lock, flags); |
@@ -67,7 +72,7 @@ static inline int netpoll_rx_on(struct sk_buff *skb) | |||
67 | { | 72 | { |
68 | struct netpoll_info *npinfo = skb->dev->npinfo; | 73 | struct netpoll_info *npinfo = skb->dev->npinfo; |
69 | 74 | ||
70 | return npinfo && (npinfo->rx_np || npinfo->rx_flags); | 75 | return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); |
71 | } | 76 | } |
72 | 77 | ||
73 | static inline int netpoll_receive_skb(struct sk_buff *skb) | 78 | static inline int netpoll_receive_skb(struct sk_buff *skb) |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index c4c060208109..9b8299af3741 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -128,6 +128,8 @@ | |||
128 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 | 128 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 |
129 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 | 129 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 |
130 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 | 130 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 |
131 | #define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 | ||
132 | #define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 | ||
131 | 133 | ||
132 | #define NFS4_MAX_UINT64 (~(u64)0) | 134 | #define NFS4_MAX_UINT64 (~(u64)0) |
133 | 135 | ||
@@ -528,6 +530,7 @@ enum { | |||
528 | NFSPROC4_CLNT_DESTROY_SESSION, | 530 | NFSPROC4_CLNT_DESTROY_SESSION, |
529 | NFSPROC4_CLNT_SEQUENCE, | 531 | NFSPROC4_CLNT_SEQUENCE, |
530 | NFSPROC4_CLNT_GET_LEASE_TIME, | 532 | NFSPROC4_CLNT_GET_LEASE_TIME, |
533 | NFSPROC4_CLNT_RECLAIM_COMPLETE, | ||
531 | }; | 534 | }; |
532 | 535 | ||
533 | /* nfs41 types */ | 536 | /* nfs41 types */ |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 320569eabe3b..34fc6be5bfcf 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -209,6 +209,7 @@ struct nfs4_session { | |||
209 | unsigned long session_state; | 209 | unsigned long session_state; |
210 | u32 hash_alg; | 210 | u32 hash_alg; |
211 | u32 ssv_len; | 211 | u32 ssv_len; |
212 | struct completion complete; | ||
212 | 213 | ||
213 | /* The fore and back channel */ | 214 | /* The fore and back channel */ |
214 | struct nfs4_channel_attrs fc_attrs; | 215 | struct nfs4_channel_attrs fc_attrs; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 62f63fb0c4c8..89b28812ec24 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
3 | 3 | ||
4 | #include <linux/nfsacl.h> | 4 | #include <linux/nfsacl.h> |
5 | #include <linux/nfs3.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * To change the maximum rsize and wsize supported by the NFS client, adjust | 8 | * To change the maximum rsize and wsize supported by the NFS client, adjust |
@@ -170,8 +171,9 @@ struct nfs4_sequence_args { | |||
170 | struct nfs4_sequence_res { | 171 | struct nfs4_sequence_res { |
171 | struct nfs4_session *sr_session; | 172 | struct nfs4_session *sr_session; |
172 | u8 sr_slotid; /* slot used to send request */ | 173 | u8 sr_slotid; /* slot used to send request */ |
173 | unsigned long sr_renewal_time; | ||
174 | int sr_status; /* sequence operation status */ | 174 | int sr_status; /* sequence operation status */ |
175 | unsigned long sr_renewal_time; | ||
176 | u32 sr_status_flags; | ||
175 | }; | 177 | }; |
176 | 178 | ||
177 | struct nfs4_get_lease_time_args { | 179 | struct nfs4_get_lease_time_args { |
@@ -938,6 +940,16 @@ struct nfs41_create_session_args { | |||
938 | struct nfs41_create_session_res { | 940 | struct nfs41_create_session_res { |
939 | struct nfs_client *client; | 941 | struct nfs_client *client; |
940 | }; | 942 | }; |
943 | |||
944 | struct nfs41_reclaim_complete_args { | ||
945 | /* In the future extend to include curr_fh for use with migration */ | ||
946 | unsigned char one_fs:1; | ||
947 | struct nfs4_sequence_args seq_args; | ||
948 | }; | ||
949 | |||
950 | struct nfs41_reclaim_complete_res { | ||
951 | struct nfs4_sequence_res seq_res; | ||
952 | }; | ||
941 | #endif /* CONFIG_NFS_V4_1 */ | 953 | #endif /* CONFIG_NFS_V4_1 */ |
942 | 954 | ||
943 | struct nfs_page; | 955 | struct nfs_page; |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index 43011b69297c..f321b578edeb 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
30 | 30 | ||
31 | #include <linux/posix_acl.h> | 31 | #include <linux/posix_acl.h> |
32 | #include <linux/sunrpc/xdr.h> | ||
32 | 33 | ||
33 | /* Maximum number of ACL entries over NFS */ | 34 | /* Maximum number of ACL entries over NFS */ |
34 | #define NFS_ACL_MAX_ENTRIES 1024 | 35 | #define NFS_ACL_MAX_ENTRIES 1024 |
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h deleted file mode 100644 index 3a3f58934f5e..000000000000 --- a/include/linux/nfsd/cache.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * include/linux/nfsd/cache.h | ||
3 | * | ||
4 | * Request reply cache. This was heavily inspired by the | ||
5 | * implementation in 4.3BSD/4.4BSD. | ||
6 | * | ||
7 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | ||
8 | */ | ||
9 | |||
10 | #ifndef NFSCACHE_H | ||
11 | #define NFSCACHE_H | ||
12 | |||
13 | #include <linux/in.h> | ||
14 | #include <linux/uio.h> | ||
15 | |||
16 | /* | ||
17 | * Representation of a reply cache entry. | ||
18 | */ | ||
19 | struct svc_cacherep { | ||
20 | struct hlist_node c_hash; | ||
21 | struct list_head c_lru; | ||
22 | |||
23 | unsigned char c_state, /* unused, inprog, done */ | ||
24 | c_type, /* status, buffer */ | ||
25 | c_secure : 1; /* req came from port < 1024 */ | ||
26 | struct sockaddr_in c_addr; | ||
27 | __be32 c_xid; | ||
28 | u32 c_prot; | ||
29 | u32 c_proc; | ||
30 | u32 c_vers; | ||
31 | unsigned long c_timestamp; | ||
32 | union { | ||
33 | struct kvec u_vec; | ||
34 | __be32 u_status; | ||
35 | } c_u; | ||
36 | }; | ||
37 | |||
38 | #define c_replvec c_u.u_vec | ||
39 | #define c_replstat c_u.u_status | ||
40 | |||
41 | /* cache entry states */ | ||
42 | enum { | ||
43 | RC_UNUSED, | ||
44 | RC_INPROG, | ||
45 | RC_DONE | ||
46 | }; | ||
47 | |||
48 | /* return values */ | ||
49 | enum { | ||
50 | RC_DROPIT, | ||
51 | RC_REPLY, | ||
52 | RC_DOIT, | ||
53 | RC_INTR | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * Cache types. | ||
58 | * We may want to add more types one day, e.g. for diropres and | ||
59 | * attrstat replies. Using cache entries with fixed length instead | ||
60 | * of buffer pointers may be more efficient. | ||
61 | */ | ||
62 | enum { | ||
63 | RC_NOCACHE, | ||
64 | RC_REPLSTAT, | ||
65 | RC_REPLBUFF, | ||
66 | }; | ||
67 | |||
68 | /* | ||
69 | * If requests are retransmitted within this interval, they're dropped. | ||
70 | */ | ||
71 | #define RC_DELAY (HZ/5) | ||
72 | |||
73 | int nfsd_reply_cache_init(void); | ||
74 | void nfsd_reply_cache_shutdown(void); | ||
75 | int nfsd_cache_lookup(struct svc_rqst *, int); | ||
76 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); | ||
77 | |||
78 | #ifdef CONFIG_NFSD_V4 | ||
79 | void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp); | ||
80 | #else /* CONFIG_NFSD_V4 */ | ||
81 | static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp) | ||
82 | { | ||
83 | } | ||
84 | #endif /* CONFIG_NFSD_V4 */ | ||
85 | |||
86 | #endif /* NFSCACHE_H */ | ||
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index a6d9ef2bb34a..8ae78a61eea4 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | # include <linux/types.h> | 13 | # include <linux/types.h> |
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | # include <linux/in.h> | 15 | # include <linux/nfsd/nfsfh.h> |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -39,11 +39,23 @@ | |||
39 | #define NFSEXP_FSID 0x2000 | 39 | #define NFSEXP_FSID 0x2000 |
40 | #define NFSEXP_CROSSMOUNT 0x4000 | 40 | #define NFSEXP_CROSSMOUNT 0x4000 |
41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ | 41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ |
42 | #define NFSEXP_ALLFLAGS 0xFE3F | 42 | /* |
43 | * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 | ||
44 | * clients, and only to the single directory that is the root of the | ||
45 | * export; further lookup and readdir operations are treated as if every | ||
46 | * subdirectory was a mountpoint, and ignored if they are not themselves | ||
47 | * exported. This is used by nfsd and mountd to construct the NFSv4 | ||
48 | * pseudofilesystem, which provides access only to paths leading to each | ||
49 | * exported filesystem. | ||
50 | */ | ||
51 | #define NFSEXP_V4ROOT 0x10000 | ||
52 | /* All flags that we claim to support. (Note we don't support NOACL.) */ | ||
53 | #define NFSEXP_ALLFLAGS 0x17E3F | ||
43 | 54 | ||
44 | /* The flags that may vary depending on security flavor: */ | 55 | /* The flags that may vary depending on security flavor: */ |
45 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | 56 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ |
46 | | NFSEXP_ALLSQUASH) | 57 | | NFSEXP_ALLSQUASH \ |
58 | | NFSEXP_INSECURE_PORT) | ||
47 | 59 | ||
48 | #ifdef __KERNEL__ | 60 | #ifdef __KERNEL__ |
49 | 61 | ||
@@ -108,7 +120,6 @@ struct svc_expkey { | |||
108 | struct path ek_path; | 120 | struct path ek_path; |
109 | }; | 121 | }; |
110 | 122 | ||
111 | #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) | ||
112 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) | 123 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) |
113 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) | 124 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) |
114 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) | 125 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h deleted file mode 100644 index 510ffdd5020e..000000000000 --- a/include/linux/nfsd/nfsd.h +++ /dev/null | |||
@@ -1,424 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/nfsd/nfsd.h | ||
3 | * | ||
4 | * Hodge-podge collection of knfsd-related stuff. | ||
5 | * I will sort this out later. | ||
6 | * | ||
7 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | ||
8 | */ | ||
9 | |||
10 | #ifndef LINUX_NFSD_NFSD_H | ||
11 | #define LINUX_NFSD_NFSD_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/unistd.h> | ||
15 | #include <linux/fs.h> | ||
16 | #include <linux/posix_acl.h> | ||
17 | #include <linux/mount.h> | ||
18 | |||
19 | #include <linux/nfsd/debug.h> | ||
20 | #include <linux/nfsd/nfsfh.h> | ||
21 | #include <linux/nfsd/export.h> | ||
22 | #include <linux/nfsd/stats.h> | ||
23 | /* | ||
24 | * nfsd version | ||
25 | */ | ||
26 | #define NFSD_SUPPORTED_MINOR_VERSION 1 | ||
27 | |||
28 | /* | ||
29 | * Flags for nfsd_permission | ||
30 | */ | ||
31 | #define NFSD_MAY_NOP 0 | ||
32 | #define NFSD_MAY_EXEC 1 /* == MAY_EXEC */ | ||
33 | #define NFSD_MAY_WRITE 2 /* == MAY_WRITE */ | ||
34 | #define NFSD_MAY_READ 4 /* == MAY_READ */ | ||
35 | #define NFSD_MAY_SATTR 8 | ||
36 | #define NFSD_MAY_TRUNC 16 | ||
37 | #define NFSD_MAY_LOCK 32 | ||
38 | #define NFSD_MAY_OWNER_OVERRIDE 64 | ||
39 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | ||
40 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
41 | |||
42 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | ||
43 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | ||
44 | |||
45 | /* | ||
46 | * Callback function for readdir | ||
47 | */ | ||
48 | struct readdir_cd { | ||
49 | __be32 err; /* 0, nfserr, or nfserr_eof */ | ||
50 | }; | ||
51 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | ||
52 | |||
53 | extern struct svc_program nfsd_program; | ||
54 | extern struct svc_version nfsd_version2, nfsd_version3, | ||
55 | nfsd_version4; | ||
56 | extern u32 nfsd_supported_minorversion; | ||
57 | extern struct mutex nfsd_mutex; | ||
58 | extern struct svc_serv *nfsd_serv; | ||
59 | extern spinlock_t nfsd_drc_lock; | ||
60 | extern unsigned int nfsd_drc_max_mem; | ||
61 | extern unsigned int nfsd_drc_mem_used; | ||
62 | |||
63 | extern const struct seq_operations nfs_exports_op; | ||
64 | |||
65 | /* | ||
66 | * Function prototypes. | ||
67 | */ | ||
68 | int nfsd_svc(unsigned short port, int nrservs); | ||
69 | int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); | ||
70 | |||
71 | int nfsd_nrthreads(void); | ||
72 | int nfsd_nrpools(void); | ||
73 | int nfsd_get_nrthreads(int n, int *); | ||
74 | int nfsd_set_nrthreads(int n, int *); | ||
75 | |||
76 | /* nfsd/vfs.c */ | ||
77 | int fh_lock_parent(struct svc_fh *, struct dentry *); | ||
78 | int nfsd_racache_init(int); | ||
79 | void nfsd_racache_shutdown(void); | ||
80 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | ||
81 | struct svc_export **expp); | ||
82 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, | ||
83 | const char *, unsigned int, struct svc_fh *); | ||
84 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, | ||
85 | const char *, unsigned int, | ||
86 | struct svc_export **, struct dentry **); | ||
87 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, | ||
88 | struct iattr *, int, time_t); | ||
89 | #ifdef CONFIG_NFSD_V4 | ||
90 | __be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, | ||
91 | struct nfs4_acl *); | ||
92 | int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); | ||
93 | #endif /* CONFIG_NFSD_V4 */ | ||
94 | __be32 nfsd_create(struct svc_rqst *, struct svc_fh *, | ||
95 | char *name, int len, struct iattr *attrs, | ||
96 | int type, dev_t rdev, struct svc_fh *res); | ||
97 | #ifdef CONFIG_NFSD_V3 | ||
98 | __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); | ||
99 | __be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, | ||
100 | char *name, int len, struct iattr *attrs, | ||
101 | struct svc_fh *res, int createmode, | ||
102 | u32 *verifier, int *truncp, int *created); | ||
103 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, | ||
104 | loff_t, unsigned long); | ||
105 | #endif /* CONFIG_NFSD_V3 */ | ||
106 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, | ||
107 | int, struct file **); | ||
108 | void nfsd_close(struct file *); | ||
109 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | ||
110 | loff_t, struct kvec *, int, unsigned long *); | ||
111 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | ||
112 | loff_t, struct kvec *,int, unsigned long *, int *); | ||
113 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | ||
114 | char *, int *); | ||
115 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | ||
116 | char *name, int len, char *path, int plen, | ||
117 | struct svc_fh *res, struct iattr *); | ||
118 | __be32 nfsd_link(struct svc_rqst *, struct svc_fh *, | ||
119 | char *, int, struct svc_fh *); | ||
120 | __be32 nfsd_rename(struct svc_rqst *, | ||
121 | struct svc_fh *, char *, int, | ||
122 | struct svc_fh *, char *, int); | ||
123 | __be32 nfsd_remove(struct svc_rqst *, | ||
124 | struct svc_fh *, char *, int); | ||
125 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, | ||
126 | char *name, int len); | ||
127 | int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | ||
128 | unsigned long size); | ||
129 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | ||
130 | loff_t *, struct readdir_cd *, filldir_t); | ||
131 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | ||
132 | struct kstatfs *, int access); | ||
133 | |||
134 | int nfsd_notify_change(struct inode *, struct iattr *); | ||
135 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | ||
136 | struct dentry *, int); | ||
137 | int nfsd_sync_dir(struct dentry *dp); | ||
138 | |||
139 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
140 | #ifdef CONFIG_NFSD_V2_ACL | ||
141 | extern struct svc_version nfsd_acl_version2; | ||
142 | #else | ||
143 | #define nfsd_acl_version2 NULL | ||
144 | #endif | ||
145 | #ifdef CONFIG_NFSD_V3_ACL | ||
146 | extern struct svc_version nfsd_acl_version3; | ||
147 | #else | ||
148 | #define nfsd_acl_version3 NULL | ||
149 | #endif | ||
150 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
151 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
152 | #endif | ||
153 | |||
154 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; | ||
155 | int nfsd_vers(int vers, enum vers_op change); | ||
156 | int nfsd_minorversion(u32 minorversion, enum vers_op change); | ||
157 | void nfsd_reset_versions(void); | ||
158 | int nfsd_create_serv(void); | ||
159 | |||
160 | extern int nfsd_max_blksize; | ||
161 | |||
162 | /* | ||
163 | * NFSv4 State | ||
164 | */ | ||
165 | #ifdef CONFIG_NFSD_V4 | ||
166 | extern unsigned int max_delegations; | ||
167 | int nfs4_state_init(void); | ||
168 | void nfsd4_free_slabs(void); | ||
169 | int nfs4_state_start(void); | ||
170 | void nfs4_state_shutdown(void); | ||
171 | time_t nfs4_lease_time(void); | ||
172 | void nfs4_reset_lease(time_t leasetime); | ||
173 | int nfs4_reset_recoverydir(char *recdir); | ||
174 | #else | ||
175 | static inline int nfs4_state_init(void) { return 0; } | ||
176 | static inline void nfsd4_free_slabs(void) { } | ||
177 | static inline int nfs4_state_start(void) { return 0; } | ||
178 | static inline void nfs4_state_shutdown(void) { } | ||
179 | static inline time_t nfs4_lease_time(void) { return 0; } | ||
180 | static inline void nfs4_reset_lease(time_t leasetime) { } | ||
181 | static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } | ||
182 | #endif | ||
183 | |||
184 | /* | ||
185 | * lockd binding | ||
186 | */ | ||
187 | void nfsd_lockd_init(void); | ||
188 | void nfsd_lockd_shutdown(void); | ||
189 | |||
190 | |||
191 | /* | ||
192 | * These macros provide pre-xdr'ed values for faster operation. | ||
193 | */ | ||
194 | #define nfs_ok cpu_to_be32(NFS_OK) | ||
195 | #define nfserr_perm cpu_to_be32(NFSERR_PERM) | ||
196 | #define nfserr_noent cpu_to_be32(NFSERR_NOENT) | ||
197 | #define nfserr_io cpu_to_be32(NFSERR_IO) | ||
198 | #define nfserr_nxio cpu_to_be32(NFSERR_NXIO) | ||
199 | #define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN) | ||
200 | #define nfserr_acces cpu_to_be32(NFSERR_ACCES) | ||
201 | #define nfserr_exist cpu_to_be32(NFSERR_EXIST) | ||
202 | #define nfserr_xdev cpu_to_be32(NFSERR_XDEV) | ||
203 | #define nfserr_nodev cpu_to_be32(NFSERR_NODEV) | ||
204 | #define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR) | ||
205 | #define nfserr_isdir cpu_to_be32(NFSERR_ISDIR) | ||
206 | #define nfserr_inval cpu_to_be32(NFSERR_INVAL) | ||
207 | #define nfserr_fbig cpu_to_be32(NFSERR_FBIG) | ||
208 | #define nfserr_nospc cpu_to_be32(NFSERR_NOSPC) | ||
209 | #define nfserr_rofs cpu_to_be32(NFSERR_ROFS) | ||
210 | #define nfserr_mlink cpu_to_be32(NFSERR_MLINK) | ||
211 | #define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP) | ||
212 | #define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG) | ||
213 | #define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY) | ||
214 | #define nfserr_dquot cpu_to_be32(NFSERR_DQUOT) | ||
215 | #define nfserr_stale cpu_to_be32(NFSERR_STALE) | ||
216 | #define nfserr_remote cpu_to_be32(NFSERR_REMOTE) | ||
217 | #define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH) | ||
218 | #define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE) | ||
219 | #define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC) | ||
220 | #define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE) | ||
221 | #define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP) | ||
222 | #define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL) | ||
223 | #define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT) | ||
224 | #define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE) | ||
225 | #define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX) | ||
226 | #define nfserr_denied cpu_to_be32(NFSERR_DENIED) | ||
227 | #define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK) | ||
228 | #define nfserr_expired cpu_to_be32(NFSERR_EXPIRED) | ||
229 | #define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE) | ||
230 | #define nfserr_same cpu_to_be32(NFSERR_SAME) | ||
231 | #define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE) | ||
232 | #define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID) | ||
233 | #define nfserr_resource cpu_to_be32(NFSERR_RESOURCE) | ||
234 | #define nfserr_moved cpu_to_be32(NFSERR_MOVED) | ||
235 | #define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE) | ||
236 | #define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH) | ||
237 | #define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED) | ||
238 | #define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID) | ||
239 | #define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID) | ||
240 | #define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID) | ||
241 | #define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID) | ||
242 | #define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK) | ||
243 | #define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME) | ||
244 | #define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH) | ||
245 | #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) | ||
246 | #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) | ||
247 | #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) | ||
248 | #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) | ||
249 | #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) | ||
250 | #define nfserr_grace cpu_to_be32(NFSERR_GRACE) | ||
251 | #define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE) | ||
252 | #define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD) | ||
253 | #define nfserr_badname cpu_to_be32(NFSERR_BADNAME) | ||
254 | #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) | ||
255 | #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) | ||
256 | #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) | ||
257 | #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) | ||
258 | #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) | ||
259 | #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) | ||
260 | #define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION) | ||
261 | #define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT) | ||
262 | #define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY) | ||
263 | #define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION) | ||
264 | #define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED) | ||
265 | #define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY) | ||
266 | #define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER) | ||
267 | #define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE) | ||
268 | #define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT) | ||
269 | #define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT) | ||
270 | #define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE) | ||
271 | #define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED) | ||
272 | #define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS) | ||
273 | #define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG) | ||
274 | #define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG) | ||
275 | #define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE) | ||
276 | #define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP) | ||
277 | #define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND) | ||
278 | #define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS) | ||
279 | #define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION) | ||
280 | #define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP) | ||
281 | #define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY) | ||
282 | #define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE) | ||
283 | #define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY) | ||
284 | #define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT) | ||
285 | #define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION) | ||
286 | #define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP) | ||
287 | #define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT) | ||
288 | #define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP) | ||
289 | #define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED) | ||
290 | #define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE) | ||
291 | #define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL) | ||
292 | #define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG) | ||
293 | #define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT) | ||
294 | #define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED) | ||
295 | |||
296 | /* error codes for internal use */ | ||
297 | /* if a request fails due to kmalloc failure, it gets dropped. | ||
298 | * Client should resend eventually | ||
299 | */ | ||
300 | #define nfserr_dropit cpu_to_be32(30000) | ||
301 | /* end-of-file indicator in readdir */ | ||
302 | #define nfserr_eof cpu_to_be32(30001) | ||
303 | /* replay detected */ | ||
304 | #define nfserr_replay_me cpu_to_be32(11001) | ||
305 | /* nfs41 replay detected */ | ||
306 | #define nfserr_replay_cache cpu_to_be32(11002) | ||
307 | |||
308 | /* Check for dir entries '.' and '..' */ | ||
309 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) | ||
310 | |||
311 | /* | ||
312 | * Time of server startup | ||
313 | */ | ||
314 | extern struct timeval nfssvc_boot; | ||
315 | |||
316 | #ifdef CONFIG_NFSD_V4 | ||
317 | |||
318 | /* before processing a COMPOUND operation, we have to check that there | ||
319 | * is enough space in the buffer for XDR encode to succeed. otherwise, | ||
320 | * we might process an operation with side effects, and be unable to | ||
321 | * tell the client that the operation succeeded. | ||
322 | * | ||
323 | * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space | ||
324 | * needed to encode an "ordinary" _successful_ operation. (GETATTR, | ||
325 | * READ, READDIR, and READLINK have their own buffer checks.) if we | ||
326 | * fall below this level, we fail the next operation with NFS4ERR_RESOURCE. | ||
327 | * | ||
328 | * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space | ||
329 | * needed to encode an operation which has failed with NFS4ERR_RESOURCE. | ||
330 | * care is taken to ensure that we never fall below this level for any | ||
331 | * reason. | ||
332 | */ | ||
333 | #define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */ | ||
334 | #define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */ | ||
335 | |||
336 | #define NFSD_LEASE_TIME (nfs4_lease_time()) | ||
337 | #define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */ | ||
338 | |||
339 | /* | ||
340 | * The following attributes are currently not supported by the NFSv4 server: | ||
341 | * ARCHIVE (deprecated anyway) | ||
342 | * HIDDEN (unlikely to be supported any time soon) | ||
343 | * MIMETYPE (unlikely to be supported any time soon) | ||
344 | * QUOTA_* (will be supported in a forthcoming patch) | ||
345 | * SYSTEM (unlikely to be supported any time soon) | ||
346 | * TIME_BACKUP (unlikely to be supported any time soon) | ||
347 | * TIME_CREATE (unlikely to be supported any time soon) | ||
348 | */ | ||
349 | #define NFSD4_SUPPORTED_ATTRS_WORD0 \ | ||
350 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ | ||
351 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ | ||
352 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ | ||
353 | | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \ | ||
354 | | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \ | ||
355 | | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \ | ||
356 | | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \ | ||
357 | | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \ | ||
358 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ | ||
359 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) | ||
360 | |||
361 | #define NFSD4_SUPPORTED_ATTRS_WORD1 \ | ||
362 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ | ||
363 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ | ||
364 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | ||
365 | | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \ | ||
366 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ | ||
367 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) | ||
368 | |||
369 | #define NFSD4_SUPPORTED_ATTRS_WORD2 0 | ||
370 | |||
371 | #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ | ||
372 | NFSD4_SUPPORTED_ATTRS_WORD0 | ||
373 | |||
374 | #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ | ||
375 | NFSD4_SUPPORTED_ATTRS_WORD1 | ||
376 | |||
377 | #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ | ||
378 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) | ||
379 | |||
380 | static inline u32 nfsd_suppattrs0(u32 minorversion) | ||
381 | { | ||
382 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 | ||
383 | : NFSD4_SUPPORTED_ATTRS_WORD0; | ||
384 | } | ||
385 | |||
386 | static inline u32 nfsd_suppattrs1(u32 minorversion) | ||
387 | { | ||
388 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1 | ||
389 | : NFSD4_SUPPORTED_ATTRS_WORD1; | ||
390 | } | ||
391 | |||
392 | static inline u32 nfsd_suppattrs2(u32 minorversion) | ||
393 | { | ||
394 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 | ||
395 | : NFSD4_SUPPORTED_ATTRS_WORD2; | ||
396 | } | ||
397 | |||
398 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ | ||
399 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ | ||
400 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | ||
401 | |||
402 | /* These are the only attrs allowed in CREATE/OPEN/SETATTR. */ | ||
403 | #define NFSD_WRITEABLE_ATTRS_WORD0 \ | ||
404 | (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL ) | ||
405 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ | ||
406 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ | ||
407 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | ||
408 | #define NFSD_WRITEABLE_ATTRS_WORD2 0 | ||
409 | |||
410 | #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \ | ||
411 | NFSD_WRITEABLE_ATTRS_WORD0 | ||
412 | /* | ||
413 | * we currently store the exclusive create verifier in the v_{a,m}time | ||
414 | * attributes so the client can't set these at create time using EXCLUSIVE4_1 | ||
415 | */ | ||
416 | #define NFSD_SUPPATTR_EXCLCREAT_WORD1 \ | ||
417 | (NFSD_WRITEABLE_ATTRS_WORD1 & \ | ||
418 | ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)) | ||
419 | #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ | ||
420 | NFSD_WRITEABLE_ATTRS_WORD2 | ||
421 | |||
422 | #endif /* CONFIG_NFSD_V4 */ | ||
423 | |||
424 | #endif /* LINUX_NFSD_NFSD_H */ | ||
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index 8f641c908450..65e333afaee4 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -16,11 +16,9 @@ | |||
16 | 16 | ||
17 | # include <linux/types.h> | 17 | # include <linux/types.h> |
18 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
19 | # include <linux/string.h> | 19 | # include <linux/sunrpc/svc.h> |
20 | # include <linux/fs.h> | ||
21 | #endif | 20 | #endif |
22 | #include <linux/nfsd/const.h> | 21 | #include <linux/nfsd/const.h> |
23 | #include <linux/nfsd/debug.h> | ||
24 | 22 | ||
25 | /* | 23 | /* |
26 | * This is the old "dentry style" Linux NFSv2 file handle. | 24 | * This is the old "dentry style" Linux NFSv2 file handle. |
@@ -164,208 +162,6 @@ typedef struct svc_fh { | |||
164 | 162 | ||
165 | } svc_fh; | 163 | } svc_fh; |
166 | 164 | ||
167 | enum nfsd_fsid { | ||
168 | FSID_DEV = 0, | ||
169 | FSID_NUM, | ||
170 | FSID_MAJOR_MINOR, | ||
171 | FSID_ENCODE_DEV, | ||
172 | FSID_UUID4_INUM, | ||
173 | FSID_UUID8, | ||
174 | FSID_UUID16, | ||
175 | FSID_UUID16_INUM, | ||
176 | }; | ||
177 | |||
178 | enum fsid_source { | ||
179 | FSIDSOURCE_DEV, | ||
180 | FSIDSOURCE_FSID, | ||
181 | FSIDSOURCE_UUID, | ||
182 | }; | ||
183 | extern enum fsid_source fsid_source(struct svc_fh *fhp); | ||
184 | |||
185 | |||
186 | /* This might look a little large to "inline" but in all calls except | ||
187 | * one, 'vers' is constant so moste of the function disappears. | ||
188 | */ | ||
189 | static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino, | ||
190 | u32 fsid, unsigned char *uuid) | ||
191 | { | ||
192 | u32 *up; | ||
193 | switch(vers) { | ||
194 | case FSID_DEV: | ||
195 | fsidv[0] = htonl((MAJOR(dev)<<16) | | ||
196 | MINOR(dev)); | ||
197 | fsidv[1] = ino_t_to_u32(ino); | ||
198 | break; | ||
199 | case FSID_NUM: | ||
200 | fsidv[0] = fsid; | ||
201 | break; | ||
202 | case FSID_MAJOR_MINOR: | ||
203 | fsidv[0] = htonl(MAJOR(dev)); | ||
204 | fsidv[1] = htonl(MINOR(dev)); | ||
205 | fsidv[2] = ino_t_to_u32(ino); | ||
206 | break; | ||
207 | |||
208 | case FSID_ENCODE_DEV: | ||
209 | fsidv[0] = new_encode_dev(dev); | ||
210 | fsidv[1] = ino_t_to_u32(ino); | ||
211 | break; | ||
212 | |||
213 | case FSID_UUID4_INUM: | ||
214 | /* 4 byte fsid and inode number */ | ||
215 | up = (u32*)uuid; | ||
216 | fsidv[0] = ino_t_to_u32(ino); | ||
217 | fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3]; | ||
218 | break; | ||
219 | |||
220 | case FSID_UUID8: | ||
221 | /* 8 byte fsid */ | ||
222 | up = (u32*)uuid; | ||
223 | fsidv[0] = up[0] ^ up[2]; | ||
224 | fsidv[1] = up[1] ^ up[3]; | ||
225 | break; | ||
226 | |||
227 | case FSID_UUID16: | ||
228 | /* 16 byte fsid - NFSv3+ only */ | ||
229 | memcpy(fsidv, uuid, 16); | ||
230 | break; | ||
231 | |||
232 | case FSID_UUID16_INUM: | ||
233 | /* 8 byte inode and 16 byte fsid */ | ||
234 | *(u64*)fsidv = (u64)ino; | ||
235 | memcpy(fsidv+2, uuid, 16); | ||
236 | break; | ||
237 | default: BUG(); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | static inline int key_len(int type) | ||
242 | { | ||
243 | switch(type) { | ||
244 | case FSID_DEV: return 8; | ||
245 | case FSID_NUM: return 4; | ||
246 | case FSID_MAJOR_MINOR: return 12; | ||
247 | case FSID_ENCODE_DEV: return 8; | ||
248 | case FSID_UUID4_INUM: return 8; | ||
249 | case FSID_UUID8: return 8; | ||
250 | case FSID_UUID16: return 16; | ||
251 | case FSID_UUID16_INUM: return 24; | ||
252 | default: return 0; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | /* | ||
257 | * Shorthand for dprintk()'s | ||
258 | */ | ||
259 | extern char * SVCFH_fmt(struct svc_fh *fhp); | ||
260 | |||
261 | /* | ||
262 | * Function prototypes | ||
263 | */ | ||
264 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); | ||
265 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); | ||
266 | __be32 fh_update(struct svc_fh *); | ||
267 | void fh_put(struct svc_fh *); | ||
268 | |||
269 | static __inline__ struct svc_fh * | ||
270 | fh_copy(struct svc_fh *dst, struct svc_fh *src) | ||
271 | { | ||
272 | WARN_ON(src->fh_dentry || src->fh_locked); | ||
273 | |||
274 | *dst = *src; | ||
275 | return dst; | ||
276 | } | ||
277 | |||
278 | static inline void | ||
279 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
280 | { | ||
281 | dst->fh_size = src->fh_size; | ||
282 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
283 | } | ||
284 | |||
285 | static __inline__ struct svc_fh * | ||
286 | fh_init(struct svc_fh *fhp, int maxsize) | ||
287 | { | ||
288 | memset(fhp, 0, sizeof(*fhp)); | ||
289 | fhp->fh_maxsize = maxsize; | ||
290 | return fhp; | ||
291 | } | ||
292 | |||
293 | #ifdef CONFIG_NFSD_V3 | ||
294 | /* | ||
295 | * Fill in the pre_op attr for the wcc data | ||
296 | */ | ||
297 | static inline void | ||
298 | fill_pre_wcc(struct svc_fh *fhp) | ||
299 | { | ||
300 | struct inode *inode; | ||
301 | |||
302 | inode = fhp->fh_dentry->d_inode; | ||
303 | if (!fhp->fh_pre_saved) { | ||
304 | fhp->fh_pre_mtime = inode->i_mtime; | ||
305 | fhp->fh_pre_ctime = inode->i_ctime; | ||
306 | fhp->fh_pre_size = inode->i_size; | ||
307 | fhp->fh_pre_change = inode->i_version; | ||
308 | fhp->fh_pre_saved = 1; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | extern void fill_post_wcc(struct svc_fh *); | ||
313 | #else | ||
314 | #define fill_pre_wcc(ignored) | ||
315 | #define fill_post_wcc(notused) | ||
316 | #endif /* CONFIG_NFSD_V3 */ | ||
317 | |||
318 | |||
319 | /* | ||
320 | * Lock a file handle/inode | ||
321 | * NOTE: both fh_lock and fh_unlock are done "by hand" in | ||
322 | * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once | ||
323 | * so, any changes here should be reflected there. | ||
324 | */ | ||
325 | |||
326 | static inline void | ||
327 | fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | ||
328 | { | ||
329 | struct dentry *dentry = fhp->fh_dentry; | ||
330 | struct inode *inode; | ||
331 | |||
332 | dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n", | ||
333 | SVCFH_fmt(fhp), fhp->fh_locked); | ||
334 | |||
335 | BUG_ON(!dentry); | ||
336 | |||
337 | if (fhp->fh_locked) { | ||
338 | printk(KERN_WARNING "fh_lock: %s/%s already locked!\n", | ||
339 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
340 | return; | ||
341 | } | ||
342 | |||
343 | inode = dentry->d_inode; | ||
344 | mutex_lock_nested(&inode->i_mutex, subclass); | ||
345 | fill_pre_wcc(fhp); | ||
346 | fhp->fh_locked = 1; | ||
347 | } | ||
348 | |||
349 | static inline void | ||
350 | fh_lock(struct svc_fh *fhp) | ||
351 | { | ||
352 | fh_lock_nested(fhp, I_MUTEX_NORMAL); | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | * Unlock a file handle/inode | ||
357 | */ | ||
358 | static inline void | ||
359 | fh_unlock(struct svc_fh *fhp) | ||
360 | { | ||
361 | BUG_ON(!fhp->fh_dentry); | ||
362 | |||
363 | if (fhp->fh_locked) { | ||
364 | fill_post_wcc(fhp); | ||
365 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); | ||
366 | fhp->fh_locked = 0; | ||
367 | } | ||
368 | } | ||
369 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
370 | 166 | ||
371 | 167 | ||
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h deleted file mode 100644 index b38d11324189..000000000000 --- a/include/linux/nfsd/state.h +++ /dev/null | |||
@@ -1,404 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/nfsd/state.h | ||
3 | * | ||
4 | * Copyright (c) 2001 The Regents of the University of Michigan. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Kendrick Smith <kmsmith@umich.edu> | ||
8 | * Andy Adamson <andros@umich.edu> | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or without | ||
11 | * modification, are permitted provided that the following conditions | ||
12 | * are met: | ||
13 | * | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions and the following disclaimer. | ||
16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
17 | * notice, this list of conditions and the following disclaimer in the | ||
18 | * documentation and/or other materials provided with the distribution. | ||
19 | * 3. Neither the name of the University nor the names of its | ||
20 | * contributors may be used to endorse or promote products derived | ||
21 | * from this software without specific prior written permission. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
34 | * | ||
35 | */ | ||
36 | |||
37 | #ifndef _NFSD4_STATE_H | ||
38 | #define _NFSD4_STATE_H | ||
39 | |||
40 | #include <linux/list.h> | ||
41 | #include <linux/kref.h> | ||
42 | #include <linux/sunrpc/clnt.h> | ||
43 | |||
44 | typedef struct { | ||
45 | u32 cl_boot; | ||
46 | u32 cl_id; | ||
47 | } clientid_t; | ||
48 | |||
49 | typedef struct { | ||
50 | u32 so_boot; | ||
51 | u32 so_stateownerid; | ||
52 | u32 so_fileid; | ||
53 | } stateid_opaque_t; | ||
54 | |||
55 | typedef struct { | ||
56 | u32 si_generation; | ||
57 | stateid_opaque_t si_opaque; | ||
58 | } stateid_t; | ||
59 | #define si_boot si_opaque.so_boot | ||
60 | #define si_stateownerid si_opaque.so_stateownerid | ||
61 | #define si_fileid si_opaque.so_fileid | ||
62 | |||
63 | struct nfsd4_cb_sequence { | ||
64 | /* args/res */ | ||
65 | u32 cbs_minorversion; | ||
66 | struct nfs4_client *cbs_clp; | ||
67 | }; | ||
68 | |||
69 | struct nfs4_delegation { | ||
70 | struct list_head dl_perfile; | ||
71 | struct list_head dl_perclnt; | ||
72 | struct list_head dl_recall_lru; /* delegation recalled */ | ||
73 | atomic_t dl_count; /* ref count */ | ||
74 | struct nfs4_client *dl_client; | ||
75 | struct nfs4_file *dl_file; | ||
76 | struct file_lock *dl_flock; | ||
77 | struct file *dl_vfs_file; | ||
78 | u32 dl_type; | ||
79 | time_t dl_time; | ||
80 | /* For recall: */ | ||
81 | u32 dl_ident; | ||
82 | stateid_t dl_stateid; | ||
83 | struct knfsd_fh dl_fh; | ||
84 | int dl_retries; | ||
85 | }; | ||
86 | |||
87 | /* client delegation callback info */ | ||
88 | struct nfs4_cb_conn { | ||
89 | /* SETCLIENTID info */ | ||
90 | struct sockaddr_storage cb_addr; | ||
91 | size_t cb_addrlen; | ||
92 | u32 cb_prog; | ||
93 | u32 cb_minorversion; | ||
94 | u32 cb_ident; /* minorversion 0 only */ | ||
95 | /* RPC client info */ | ||
96 | atomic_t cb_set; /* successful CB_NULL call */ | ||
97 | struct rpc_clnt * cb_client; | ||
98 | }; | ||
99 | |||
100 | /* Maximum number of slots per session. 160 is useful for long haul TCP */ | ||
101 | #define NFSD_MAX_SLOTS_PER_SESSION 160 | ||
102 | /* Maximum number of operations per session compound */ | ||
103 | #define NFSD_MAX_OPS_PER_COMPOUND 16 | ||
104 | /* Maximum session per slot cache size */ | ||
105 | #define NFSD_SLOT_CACHE_SIZE 1024 | ||
106 | /* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */ | ||
107 | #define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32 | ||
108 | #define NFSD_MAX_MEM_PER_SESSION \ | ||
109 | (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE) | ||
110 | |||
111 | struct nfsd4_slot { | ||
112 | bool sl_inuse; | ||
113 | bool sl_cachethis; | ||
114 | u16 sl_opcnt; | ||
115 | u32 sl_seqid; | ||
116 | __be32 sl_status; | ||
117 | u32 sl_datalen; | ||
118 | char sl_data[]; | ||
119 | }; | ||
120 | |||
121 | struct nfsd4_channel_attrs { | ||
122 | u32 headerpadsz; | ||
123 | u32 maxreq_sz; | ||
124 | u32 maxresp_sz; | ||
125 | u32 maxresp_cached; | ||
126 | u32 maxops; | ||
127 | u32 maxreqs; | ||
128 | u32 nr_rdma_attrs; | ||
129 | u32 rdma_attrs; | ||
130 | }; | ||
131 | |||
132 | struct nfsd4_create_session { | ||
133 | clientid_t clientid; | ||
134 | struct nfs4_sessionid sessionid; | ||
135 | u32 seqid; | ||
136 | u32 flags; | ||
137 | struct nfsd4_channel_attrs fore_channel; | ||
138 | struct nfsd4_channel_attrs back_channel; | ||
139 | u32 callback_prog; | ||
140 | u32 uid; | ||
141 | u32 gid; | ||
142 | }; | ||
143 | |||
144 | /* The single slot clientid cache structure */ | ||
145 | struct nfsd4_clid_slot { | ||
146 | u32 sl_seqid; | ||
147 | __be32 sl_status; | ||
148 | struct nfsd4_create_session sl_cr_ses; | ||
149 | }; | ||
150 | |||
151 | struct nfsd4_session { | ||
152 | struct kref se_ref; | ||
153 | struct list_head se_hash; /* hash by sessionid */ | ||
154 | struct list_head se_perclnt; | ||
155 | u32 se_flags; | ||
156 | struct nfs4_client *se_client; /* for expire_client */ | ||
157 | struct nfs4_sessionid se_sessionid; | ||
158 | struct nfsd4_channel_attrs se_fchannel; | ||
159 | struct nfsd4_channel_attrs se_bchannel; | ||
160 | struct nfsd4_slot *se_slots[]; /* forward channel slots */ | ||
161 | }; | ||
162 | |||
163 | static inline void | ||
164 | nfsd4_put_session(struct nfsd4_session *ses) | ||
165 | { | ||
166 | extern void free_session(struct kref *kref); | ||
167 | kref_put(&ses->se_ref, free_session); | ||
168 | } | ||
169 | |||
170 | static inline void | ||
171 | nfsd4_get_session(struct nfsd4_session *ses) | ||
172 | { | ||
173 | kref_get(&ses->se_ref); | ||
174 | } | ||
175 | |||
176 | /* formatted contents of nfs4_sessionid */ | ||
177 | struct nfsd4_sessionid { | ||
178 | clientid_t clientid; | ||
179 | u32 sequence; | ||
180 | u32 reserved; | ||
181 | }; | ||
182 | |||
183 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | ||
184 | |||
185 | /* | ||
186 | * struct nfs4_client - one per client. Clientids live here. | ||
187 | * o Each nfs4_client is hashed by clientid. | ||
188 | * | ||
189 | * o Each nfs4_clients is also hashed by name | ||
190 | * (the opaque quantity initially sent by the client to identify itself). | ||
191 | * | ||
192 | * o cl_perclient list is used to ensure no dangling stateowner references | ||
193 | * when we expire the nfs4_client | ||
194 | */ | ||
195 | struct nfs4_client { | ||
196 | struct list_head cl_idhash; /* hash by cl_clientid.id */ | ||
197 | struct list_head cl_strhash; /* hash by cl_name */ | ||
198 | struct list_head cl_openowners; | ||
199 | struct list_head cl_delegations; | ||
200 | struct list_head cl_lru; /* tail queue */ | ||
201 | struct xdr_netobj cl_name; /* id generated by client */ | ||
202 | char cl_recdir[HEXDIR_LEN]; /* recovery dir */ | ||
203 | nfs4_verifier cl_verifier; /* generated by client */ | ||
204 | time_t cl_time; /* time of last lease renewal */ | ||
205 | struct sockaddr_storage cl_addr; /* client ipaddress */ | ||
206 | u32 cl_flavor; /* setclientid pseudoflavor */ | ||
207 | char *cl_principal; /* setclientid principal name */ | ||
208 | struct svc_cred cl_cred; /* setclientid principal */ | ||
209 | clientid_t cl_clientid; /* generated by server */ | ||
210 | nfs4_verifier cl_confirm; /* generated by server */ | ||
211 | struct nfs4_cb_conn cl_cb_conn; /* callback info */ | ||
212 | atomic_t cl_count; /* ref count */ | ||
213 | u32 cl_firststate; /* recovery dir creation */ | ||
214 | |||
215 | /* for nfs41 */ | ||
216 | struct list_head cl_sessions; | ||
217 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ | ||
218 | u32 cl_exchange_flags; | ||
219 | struct nfs4_sessionid cl_sessionid; | ||
220 | |||
221 | /* for nfs41 callbacks */ | ||
222 | /* We currently support a single back channel with a single slot */ | ||
223 | unsigned long cl_cb_slot_busy; | ||
224 | u32 cl_cb_seq_nr; | ||
225 | struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */ | ||
226 | struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ | ||
227 | /* wait here for slots */ | ||
228 | }; | ||
229 | |||
230 | /* struct nfs4_client_reset | ||
231 | * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl | ||
232 | * upon lease reset, or from upcall to state_daemon (to read in state | ||
233 | * from non-volitile storage) upon reboot. | ||
234 | */ | ||
235 | struct nfs4_client_reclaim { | ||
236 | struct list_head cr_strhash; /* hash by cr_name */ | ||
237 | char cr_recdir[HEXDIR_LEN]; /* recover dir */ | ||
238 | }; | ||
239 | |||
240 | static inline void | ||
241 | update_stateid(stateid_t *stateid) | ||
242 | { | ||
243 | stateid->si_generation++; | ||
244 | } | ||
245 | |||
246 | /* A reasonable value for REPLAY_ISIZE was estimated as follows: | ||
247 | * The OPEN response, typically the largest, requires | ||
248 | * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) + | ||
249 | * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) + | ||
250 | * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes | ||
251 | */ | ||
252 | |||
253 | #define NFSD4_REPLAY_ISIZE 112 | ||
254 | |||
255 | /* | ||
256 | * Replay buffer, where the result of the last seqid-mutating operation | ||
257 | * is cached. | ||
258 | */ | ||
259 | struct nfs4_replay { | ||
260 | __be32 rp_status; | ||
261 | unsigned int rp_buflen; | ||
262 | char *rp_buf; | ||
263 | unsigned intrp_allocated; | ||
264 | struct knfsd_fh rp_openfh; | ||
265 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; | ||
266 | }; | ||
267 | |||
268 | /* | ||
269 | * nfs4_stateowner can either be an open_owner, or a lock_owner | ||
270 | * | ||
271 | * so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[] | ||
272 | * for lock_owner | ||
273 | * so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[] | ||
274 | * for lock_owner | ||
275 | * so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client | ||
276 | * struct is reaped. | ||
277 | * so_perfilestate: heads the list of nfs4_stateid (either open or lock) | ||
278 | * and is used to ensure no dangling nfs4_stateid references when we | ||
279 | * release a stateowner. | ||
280 | * so_perlockowner: (open) nfs4_stateid->st_perlockowner entry - used when | ||
281 | * close is called to reap associated byte-range locks | ||
282 | * so_close_lru: (open) stateowner is placed on this list instead of being | ||
283 | * reaped (when so_perfilestate is empty) to hold the last close replay. | ||
284 | * reaped by laundramat thread after lease period. | ||
285 | */ | ||
286 | struct nfs4_stateowner { | ||
287 | struct kref so_ref; | ||
288 | struct list_head so_idhash; /* hash by so_id */ | ||
289 | struct list_head so_strhash; /* hash by op_name */ | ||
290 | struct list_head so_perclient; | ||
291 | struct list_head so_stateids; | ||
292 | struct list_head so_perstateid; /* for lockowners only */ | ||
293 | struct list_head so_close_lru; /* tail queue */ | ||
294 | time_t so_time; /* time of placement on so_close_lru */ | ||
295 | int so_is_open_owner; /* 1=openowner,0=lockowner */ | ||
296 | u32 so_id; | ||
297 | struct nfs4_client * so_client; | ||
298 | /* after increment in ENCODE_SEQID_OP_TAIL, represents the next | ||
299 | * sequence id expected from the client: */ | ||
300 | u32 so_seqid; | ||
301 | struct xdr_netobj so_owner; /* open owner name */ | ||
302 | int so_confirmed; /* successful OPEN_CONFIRM? */ | ||
303 | struct nfs4_replay so_replay; | ||
304 | }; | ||
305 | |||
306 | /* | ||
307 | * nfs4_file: a file opened by some number of (open) nfs4_stateowners. | ||
308 | * o fi_perfile list is used to search for conflicting | ||
309 | * share_acces, share_deny on the file. | ||
310 | */ | ||
311 | struct nfs4_file { | ||
312 | atomic_t fi_ref; | ||
313 | struct list_head fi_hash; /* hash by "struct inode *" */ | ||
314 | struct list_head fi_stateids; | ||
315 | struct list_head fi_delegations; | ||
316 | struct inode *fi_inode; | ||
317 | u32 fi_id; /* used with stateowner->so_id | ||
318 | * for stateid_hashtbl hash */ | ||
319 | bool fi_had_conflict; | ||
320 | }; | ||
321 | |||
322 | /* | ||
323 | * nfs4_stateid can either be an open stateid or (eventually) a lock stateid | ||
324 | * | ||
325 | * (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file | ||
326 | * | ||
327 | * st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry | ||
328 | * st_perfile: file_hashtbl[] entry. | ||
329 | * st_perfile_state: nfs4_stateowner->so_perfilestate | ||
330 | * st_perlockowner: (open stateid) list of lock nfs4_stateowners | ||
331 | * st_access_bmap: used only for open stateid | ||
332 | * st_deny_bmap: used only for open stateid | ||
333 | * st_openstp: open stateid lock stateid was derived from | ||
334 | * | ||
335 | * XXX: open stateids and lock stateids have diverged sufficiently that | ||
336 | * we should consider defining separate structs for the two cases. | ||
337 | */ | ||
338 | |||
339 | struct nfs4_stateid { | ||
340 | struct list_head st_hash; | ||
341 | struct list_head st_perfile; | ||
342 | struct list_head st_perstateowner; | ||
343 | struct list_head st_lockowners; | ||
344 | struct nfs4_stateowner * st_stateowner; | ||
345 | struct nfs4_file * st_file; | ||
346 | stateid_t st_stateid; | ||
347 | struct file * st_vfs_file; | ||
348 | unsigned long st_access_bmap; | ||
349 | unsigned long st_deny_bmap; | ||
350 | struct nfs4_stateid * st_openstp; | ||
351 | }; | ||
352 | |||
353 | /* flags for preprocess_seqid_op() */ | ||
354 | #define HAS_SESSION 0x00000001 | ||
355 | #define CONFIRM 0x00000002 | ||
356 | #define OPEN_STATE 0x00000004 | ||
357 | #define LOCK_STATE 0x00000008 | ||
358 | #define RD_STATE 0x00000010 | ||
359 | #define WR_STATE 0x00000020 | ||
360 | #define CLOSE_STATE 0x00000040 | ||
361 | |||
362 | #define seqid_mutating_err(err) \ | ||
363 | (((err) != nfserr_stale_clientid) && \ | ||
364 | ((err) != nfserr_bad_seqid) && \ | ||
365 | ((err) != nfserr_stale_stateid) && \ | ||
366 | ((err) != nfserr_bad_stateid)) | ||
367 | |||
368 | struct nfsd4_compound_state; | ||
369 | |||
370 | extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | ||
371 | stateid_t *stateid, int flags, struct file **filp); | ||
372 | extern void nfs4_lock_state(void); | ||
373 | extern void nfs4_unlock_state(void); | ||
374 | extern int nfs4_in_grace(void); | ||
375 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid); | ||
376 | extern void put_nfs4_client(struct nfs4_client *clp); | ||
377 | extern void nfs4_free_stateowner(struct kref *kref); | ||
378 | extern int set_callback_cred(void); | ||
379 | extern void nfsd4_probe_callback(struct nfs4_client *clp); | ||
380 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | ||
381 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | ||
382 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | ||
383 | extern void nfsd4_init_recdir(char *recdir_name); | ||
384 | extern int nfsd4_recdir_load(void); | ||
385 | extern void nfsd4_shutdown_recdir(void); | ||
386 | extern int nfs4_client_to_reclaim(const char *name); | ||
387 | extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id); | ||
388 | extern void nfsd4_recdir_purge_old(void); | ||
389 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | ||
390 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | ||
391 | |||
392 | static inline void | ||
393 | nfs4_put_stateowner(struct nfs4_stateowner *so) | ||
394 | { | ||
395 | kref_put(&so->so_ref, nfs4_free_stateowner); | ||
396 | } | ||
397 | |||
398 | static inline void | ||
399 | nfs4_get_stateowner(struct nfs4_stateowner *so) | ||
400 | { | ||
401 | kref_get(&so->so_ref); | ||
402 | } | ||
403 | |||
404 | #endif /* NFSD4_STATE_H */ | ||
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 7a3b565b898f..812bc1e160dc 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h | |||
@@ -9,14 +9,8 @@ | |||
9 | #ifndef NFSD_SYSCALL_H | 9 | #ifndef NFSD_SYSCALL_H |
10 | #define NFSD_SYSCALL_H | 10 | #define NFSD_SYSCALL_H |
11 | 11 | ||
12 | # include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #ifdef __KERNEL__ | ||
14 | # include <linux/in.h> | ||
15 | #endif | ||
16 | #include <linux/posix_types.h> | ||
17 | #include <linux/nfsd/const.h> | ||
18 | #include <linux/nfsd/export.h> | 13 | #include <linux/nfsd/export.h> |
19 | #include <linux/nfsd/nfsfh.h> | ||
20 | 14 | ||
21 | /* | 15 | /* |
22 | * Version of the syscall interface | 16 | * Version of the syscall interface |
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h deleted file mode 100644 index a0132ef58f21..000000000000 --- a/include/linux/nfsd/xdr.h +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/nfsd/xdr.h | ||
3 | * | ||
4 | * XDR types for nfsd. This is mainly a typing exercise. | ||
5 | */ | ||
6 | |||
7 | #ifndef LINUX_NFSD_H | ||
8 | #define LINUX_NFSD_H | ||
9 | |||
10 | #include <linux/fs.h> | ||
11 | #include <linux/vfs.h> | ||
12 | #include <linux/nfs.h> | ||
13 | |||
14 | struct nfsd_fhandle { | ||
15 | struct svc_fh fh; | ||
16 | }; | ||
17 | |||
18 | struct nfsd_sattrargs { | ||
19 | struct svc_fh fh; | ||
20 | struct iattr attrs; | ||
21 | }; | ||
22 | |||
23 | struct nfsd_diropargs { | ||
24 | struct svc_fh fh; | ||
25 | char * name; | ||
26 | unsigned int len; | ||
27 | }; | ||
28 | |||
29 | struct nfsd_readargs { | ||
30 | struct svc_fh fh; | ||
31 | __u32 offset; | ||
32 | __u32 count; | ||
33 | int vlen; | ||
34 | }; | ||
35 | |||
36 | struct nfsd_writeargs { | ||
37 | svc_fh fh; | ||
38 | __u32 offset; | ||
39 | int len; | ||
40 | int vlen; | ||
41 | }; | ||
42 | |||
43 | struct nfsd_createargs { | ||
44 | struct svc_fh fh; | ||
45 | char * name; | ||
46 | unsigned int len; | ||
47 | struct iattr attrs; | ||
48 | }; | ||
49 | |||
50 | struct nfsd_renameargs { | ||
51 | struct svc_fh ffh; | ||
52 | char * fname; | ||
53 | unsigned int flen; | ||
54 | struct svc_fh tfh; | ||
55 | char * tname; | ||
56 | unsigned int tlen; | ||
57 | }; | ||
58 | |||
59 | struct nfsd_readlinkargs { | ||
60 | struct svc_fh fh; | ||
61 | char * buffer; | ||
62 | }; | ||
63 | |||
64 | struct nfsd_linkargs { | ||
65 | struct svc_fh ffh; | ||
66 | struct svc_fh tfh; | ||
67 | char * tname; | ||
68 | unsigned int tlen; | ||
69 | }; | ||
70 | |||
71 | struct nfsd_symlinkargs { | ||
72 | struct svc_fh ffh; | ||
73 | char * fname; | ||
74 | unsigned int flen; | ||
75 | char * tname; | ||
76 | unsigned int tlen; | ||
77 | struct iattr attrs; | ||
78 | }; | ||
79 | |||
80 | struct nfsd_readdirargs { | ||
81 | struct svc_fh fh; | ||
82 | __u32 cookie; | ||
83 | __u32 count; | ||
84 | __be32 * buffer; | ||
85 | }; | ||
86 | |||
87 | struct nfsd_attrstat { | ||
88 | struct svc_fh fh; | ||
89 | struct kstat stat; | ||
90 | }; | ||
91 | |||
92 | struct nfsd_diropres { | ||
93 | struct svc_fh fh; | ||
94 | struct kstat stat; | ||
95 | }; | ||
96 | |||
97 | struct nfsd_readlinkres { | ||
98 | int len; | ||
99 | }; | ||
100 | |||
101 | struct nfsd_readres { | ||
102 | struct svc_fh fh; | ||
103 | unsigned long count; | ||
104 | struct kstat stat; | ||
105 | }; | ||
106 | |||
107 | struct nfsd_readdirres { | ||
108 | int count; | ||
109 | |||
110 | struct readdir_cd common; | ||
111 | __be32 * buffer; | ||
112 | int buflen; | ||
113 | __be32 * offset; | ||
114 | }; | ||
115 | |||
116 | struct nfsd_statfsres { | ||
117 | struct kstatfs stats; | ||
118 | }; | ||
119 | |||
120 | /* | ||
121 | * Storage requirements for XDR arguments and results. | ||
122 | */ | ||
123 | union nfsd_xdrstore { | ||
124 | struct nfsd_sattrargs sattr; | ||
125 | struct nfsd_diropargs dirop; | ||
126 | struct nfsd_readargs read; | ||
127 | struct nfsd_writeargs write; | ||
128 | struct nfsd_createargs create; | ||
129 | struct nfsd_renameargs rename; | ||
130 | struct nfsd_linkargs link; | ||
131 | struct nfsd_symlinkargs symlink; | ||
132 | struct nfsd_readdirargs readdir; | ||
133 | }; | ||
134 | |||
135 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) | ||
136 | |||
137 | |||
138 | int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *); | ||
139 | int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
140 | int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *, | ||
141 | struct nfsd_sattrargs *); | ||
142 | int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *, | ||
143 | struct nfsd_diropargs *); | ||
144 | int nfssvc_decode_readargs(struct svc_rqst *, __be32 *, | ||
145 | struct nfsd_readargs *); | ||
146 | int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *, | ||
147 | struct nfsd_writeargs *); | ||
148 | int nfssvc_decode_createargs(struct svc_rqst *, __be32 *, | ||
149 | struct nfsd_createargs *); | ||
150 | int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *, | ||
151 | struct nfsd_renameargs *); | ||
152 | int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *, | ||
153 | struct nfsd_readlinkargs *); | ||
154 | int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *, | ||
155 | struct nfsd_linkargs *); | ||
156 | int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *, | ||
157 | struct nfsd_symlinkargs *); | ||
158 | int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *, | ||
159 | struct nfsd_readdirargs *); | ||
160 | int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *); | ||
161 | int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *); | ||
162 | int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *); | ||
163 | int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *); | ||
164 | int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *); | ||
165 | int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *); | ||
166 | int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *); | ||
167 | |||
168 | int nfssvc_encode_entry(void *, const char *name, | ||
169 | int namlen, loff_t offset, u64 ino, unsigned int); | ||
170 | |||
171 | int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
172 | |||
173 | /* Helper functions for NFSv2 ACL code */ | ||
174 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp); | ||
175 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); | ||
176 | |||
177 | #endif /* LINUX_NFSD_H */ | ||
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h deleted file mode 100644 index 421eddd65a25..000000000000 --- a/include/linux/nfsd/xdr3.h +++ /dev/null | |||
@@ -1,346 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/nfsd/xdr3.h | ||
3 | * | ||
4 | * XDR types for NFSv3 in nfsd. | ||
5 | * | ||
6 | * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_NFSD_XDR3_H | ||
10 | #define _LINUX_NFSD_XDR3_H | ||
11 | |||
12 | #include <linux/nfsd/xdr.h> | ||
13 | |||
14 | struct nfsd3_sattrargs { | ||
15 | struct svc_fh fh; | ||
16 | struct iattr attrs; | ||
17 | int check_guard; | ||
18 | time_t guardtime; | ||
19 | }; | ||
20 | |||
21 | struct nfsd3_diropargs { | ||
22 | struct svc_fh fh; | ||
23 | char * name; | ||
24 | unsigned int len; | ||
25 | }; | ||
26 | |||
27 | struct nfsd3_accessargs { | ||
28 | struct svc_fh fh; | ||
29 | unsigned int access; | ||
30 | }; | ||
31 | |||
32 | struct nfsd3_readargs { | ||
33 | struct svc_fh fh; | ||
34 | __u64 offset; | ||
35 | __u32 count; | ||
36 | int vlen; | ||
37 | }; | ||
38 | |||
39 | struct nfsd3_writeargs { | ||
40 | svc_fh fh; | ||
41 | __u64 offset; | ||
42 | __u32 count; | ||
43 | int stable; | ||
44 | __u32 len; | ||
45 | int vlen; | ||
46 | }; | ||
47 | |||
48 | struct nfsd3_createargs { | ||
49 | struct svc_fh fh; | ||
50 | char * name; | ||
51 | unsigned int len; | ||
52 | int createmode; | ||
53 | struct iattr attrs; | ||
54 | __be32 * verf; | ||
55 | }; | ||
56 | |||
57 | struct nfsd3_mknodargs { | ||
58 | struct svc_fh fh; | ||
59 | char * name; | ||
60 | unsigned int len; | ||
61 | __u32 ftype; | ||
62 | __u32 major, minor; | ||
63 | struct iattr attrs; | ||
64 | }; | ||
65 | |||
66 | struct nfsd3_renameargs { | ||
67 | struct svc_fh ffh; | ||
68 | char * fname; | ||
69 | unsigned int flen; | ||
70 | struct svc_fh tfh; | ||
71 | char * tname; | ||
72 | unsigned int tlen; | ||
73 | }; | ||
74 | |||
75 | struct nfsd3_readlinkargs { | ||
76 | struct svc_fh fh; | ||
77 | char * buffer; | ||
78 | }; | ||
79 | |||
80 | struct nfsd3_linkargs { | ||
81 | struct svc_fh ffh; | ||
82 | struct svc_fh tfh; | ||
83 | char * tname; | ||
84 | unsigned int tlen; | ||
85 | }; | ||
86 | |||
87 | struct nfsd3_symlinkargs { | ||
88 | struct svc_fh ffh; | ||
89 | char * fname; | ||
90 | unsigned int flen; | ||
91 | char * tname; | ||
92 | unsigned int tlen; | ||
93 | struct iattr attrs; | ||
94 | }; | ||
95 | |||
96 | struct nfsd3_readdirargs { | ||
97 | struct svc_fh fh; | ||
98 | __u64 cookie; | ||
99 | __u32 dircount; | ||
100 | __u32 count; | ||
101 | __be32 * verf; | ||
102 | __be32 * buffer; | ||
103 | }; | ||
104 | |||
105 | struct nfsd3_commitargs { | ||
106 | struct svc_fh fh; | ||
107 | __u64 offset; | ||
108 | __u32 count; | ||
109 | }; | ||
110 | |||
111 | struct nfsd3_getaclargs { | ||
112 | struct svc_fh fh; | ||
113 | int mask; | ||
114 | }; | ||
115 | |||
116 | struct posix_acl; | ||
117 | struct nfsd3_setaclargs { | ||
118 | struct svc_fh fh; | ||
119 | int mask; | ||
120 | struct posix_acl *acl_access; | ||
121 | struct posix_acl *acl_default; | ||
122 | }; | ||
123 | |||
124 | struct nfsd3_attrstat { | ||
125 | __be32 status; | ||
126 | struct svc_fh fh; | ||
127 | struct kstat stat; | ||
128 | }; | ||
129 | |||
130 | /* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ | ||
131 | struct nfsd3_diropres { | ||
132 | __be32 status; | ||
133 | struct svc_fh dirfh; | ||
134 | struct svc_fh fh; | ||
135 | }; | ||
136 | |||
137 | struct nfsd3_accessres { | ||
138 | __be32 status; | ||
139 | struct svc_fh fh; | ||
140 | __u32 access; | ||
141 | }; | ||
142 | |||
143 | struct nfsd3_readlinkres { | ||
144 | __be32 status; | ||
145 | struct svc_fh fh; | ||
146 | __u32 len; | ||
147 | }; | ||
148 | |||
149 | struct nfsd3_readres { | ||
150 | __be32 status; | ||
151 | struct svc_fh fh; | ||
152 | unsigned long count; | ||
153 | int eof; | ||
154 | }; | ||
155 | |||
156 | struct nfsd3_writeres { | ||
157 | __be32 status; | ||
158 | struct svc_fh fh; | ||
159 | unsigned long count; | ||
160 | int committed; | ||
161 | }; | ||
162 | |||
163 | struct nfsd3_renameres { | ||
164 | __be32 status; | ||
165 | struct svc_fh ffh; | ||
166 | struct svc_fh tfh; | ||
167 | }; | ||
168 | |||
169 | struct nfsd3_linkres { | ||
170 | __be32 status; | ||
171 | struct svc_fh tfh; | ||
172 | struct svc_fh fh; | ||
173 | }; | ||
174 | |||
175 | struct nfsd3_readdirres { | ||
176 | __be32 status; | ||
177 | struct svc_fh fh; | ||
178 | int count; | ||
179 | __be32 verf[2]; | ||
180 | |||
181 | struct readdir_cd common; | ||
182 | __be32 * buffer; | ||
183 | int buflen; | ||
184 | __be32 * offset; | ||
185 | __be32 * offset1; | ||
186 | struct svc_rqst * rqstp; | ||
187 | |||
188 | }; | ||
189 | |||
190 | struct nfsd3_fsstatres { | ||
191 | __be32 status; | ||
192 | struct kstatfs stats; | ||
193 | __u32 invarsec; | ||
194 | }; | ||
195 | |||
196 | struct nfsd3_fsinfores { | ||
197 | __be32 status; | ||
198 | __u32 f_rtmax; | ||
199 | __u32 f_rtpref; | ||
200 | __u32 f_rtmult; | ||
201 | __u32 f_wtmax; | ||
202 | __u32 f_wtpref; | ||
203 | __u32 f_wtmult; | ||
204 | __u32 f_dtpref; | ||
205 | __u64 f_maxfilesize; | ||
206 | __u32 f_properties; | ||
207 | }; | ||
208 | |||
209 | struct nfsd3_pathconfres { | ||
210 | __be32 status; | ||
211 | __u32 p_link_max; | ||
212 | __u32 p_name_max; | ||
213 | __u32 p_no_trunc; | ||
214 | __u32 p_chown_restricted; | ||
215 | __u32 p_case_insensitive; | ||
216 | __u32 p_case_preserving; | ||
217 | }; | ||
218 | |||
219 | struct nfsd3_commitres { | ||
220 | __be32 status; | ||
221 | struct svc_fh fh; | ||
222 | }; | ||
223 | |||
224 | struct nfsd3_getaclres { | ||
225 | __be32 status; | ||
226 | struct svc_fh fh; | ||
227 | int mask; | ||
228 | struct posix_acl *acl_access; | ||
229 | struct posix_acl *acl_default; | ||
230 | }; | ||
231 | |||
232 | /* dummy type for release */ | ||
233 | struct nfsd3_fhandle_pair { | ||
234 | __u32 dummy; | ||
235 | struct svc_fh fh1; | ||
236 | struct svc_fh fh2; | ||
237 | }; | ||
238 | |||
239 | /* | ||
240 | * Storage requirements for XDR arguments and results. | ||
241 | */ | ||
242 | union nfsd3_xdrstore { | ||
243 | struct nfsd3_sattrargs sattrargs; | ||
244 | struct nfsd3_diropargs diropargs; | ||
245 | struct nfsd3_readargs readargs; | ||
246 | struct nfsd3_writeargs writeargs; | ||
247 | struct nfsd3_createargs createargs; | ||
248 | struct nfsd3_renameargs renameargs; | ||
249 | struct nfsd3_linkargs linkargs; | ||
250 | struct nfsd3_symlinkargs symlinkargs; | ||
251 | struct nfsd3_readdirargs readdirargs; | ||
252 | struct nfsd3_diropres diropres; | ||
253 | struct nfsd3_accessres accessres; | ||
254 | struct nfsd3_readlinkres readlinkres; | ||
255 | struct nfsd3_readres readres; | ||
256 | struct nfsd3_writeres writeres; | ||
257 | struct nfsd3_renameres renameres; | ||
258 | struct nfsd3_linkres linkres; | ||
259 | struct nfsd3_readdirres readdirres; | ||
260 | struct nfsd3_fsstatres fsstatres; | ||
261 | struct nfsd3_fsinfores fsinfores; | ||
262 | struct nfsd3_pathconfres pathconfres; | ||
263 | struct nfsd3_commitres commitres; | ||
264 | struct nfsd3_getaclres getaclres; | ||
265 | }; | ||
266 | |||
267 | #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) | ||
268 | |||
269 | int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | ||
270 | int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *, | ||
271 | struct nfsd3_sattrargs *); | ||
272 | int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *, | ||
273 | struct nfsd3_diropargs *); | ||
274 | int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *, | ||
275 | struct nfsd3_accessargs *); | ||
276 | int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *, | ||
277 | struct nfsd3_readargs *); | ||
278 | int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *, | ||
279 | struct nfsd3_writeargs *); | ||
280 | int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *, | ||
281 | struct nfsd3_createargs *); | ||
282 | int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *, | ||
283 | struct nfsd3_createargs *); | ||
284 | int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *, | ||
285 | struct nfsd3_mknodargs *); | ||
286 | int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *, | ||
287 | struct nfsd3_renameargs *); | ||
288 | int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *, | ||
289 | struct nfsd3_readlinkargs *); | ||
290 | int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *, | ||
291 | struct nfsd3_linkargs *); | ||
292 | int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *, | ||
293 | struct nfsd3_symlinkargs *); | ||
294 | int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *, | ||
295 | struct nfsd3_readdirargs *); | ||
296 | int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *, | ||
297 | struct nfsd3_readdirargs *); | ||
298 | int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *, | ||
299 | struct nfsd3_commitargs *); | ||
300 | int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | ||
301 | int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *, | ||
302 | struct nfsd3_attrstat *); | ||
303 | int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *, | ||
304 | struct nfsd3_attrstat *); | ||
305 | int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *, | ||
306 | struct nfsd3_diropres *); | ||
307 | int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *, | ||
308 | struct nfsd3_accessres *); | ||
309 | int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *, | ||
310 | struct nfsd3_readlinkres *); | ||
311 | int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *); | ||
312 | int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *); | ||
313 | int nfs3svc_encode_createres(struct svc_rqst *, __be32 *, | ||
314 | struct nfsd3_diropres *); | ||
315 | int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *, | ||
316 | struct nfsd3_renameres *); | ||
317 | int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *, | ||
318 | struct nfsd3_linkres *); | ||
319 | int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *, | ||
320 | struct nfsd3_readdirres *); | ||
321 | int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *, | ||
322 | struct nfsd3_fsstatres *); | ||
323 | int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *, | ||
324 | struct nfsd3_fsinfores *); | ||
325 | int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *, | ||
326 | struct nfsd3_pathconfres *); | ||
327 | int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *, | ||
328 | struct nfsd3_commitres *); | ||
329 | |||
330 | int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *, | ||
331 | struct nfsd3_attrstat *); | ||
332 | int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *, | ||
333 | struct nfsd3_fhandle_pair *); | ||
334 | int nfs3svc_encode_entry(void *, const char *name, | ||
335 | int namlen, loff_t offset, u64 ino, | ||
336 | unsigned int); | ||
337 | int nfs3svc_encode_entry_plus(void *, const char *name, | ||
338 | int namlen, loff_t offset, u64 ino, | ||
339 | unsigned int); | ||
340 | /* Helper functions for NFSv3 ACL code */ | ||
341 | __be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, | ||
342 | struct svc_fh *fhp); | ||
343 | __be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp); | ||
344 | |||
345 | |||
346 | #endif /* _LINUX_NFSD_XDR3_H */ | ||
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h deleted file mode 100644 index 73164c2b3d29..000000000000 --- a/include/linux/nfsd/xdr4.h +++ /dev/null | |||
@@ -1,563 +0,0 @@ | |||
1 | /* | ||
2 | * include/linux/nfsd/xdr4.h | ||
3 | * | ||
4 | * Server-side types for NFSv4. | ||
5 | * | ||
6 | * Copyright (c) 2002 The Regents of the University of Michigan. | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * Kendrick Smith <kmsmith@umich.edu> | ||
10 | * Andy Adamson <andros@umich.edu> | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * | ||
16 | * 1. Redistributions of source code must retain the above copyright | ||
17 | * notice, this list of conditions and the following disclaimer. | ||
18 | * 2. Redistributions in binary form must reproduce the above copyright | ||
19 | * notice, this list of conditions and the following disclaimer in the | ||
20 | * documentation and/or other materials provided with the distribution. | ||
21 | * 3. Neither the name of the University nor the names of its | ||
22 | * contributors may be used to endorse or promote products derived | ||
23 | * from this software without specific prior written permission. | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
26 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
27 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
28 | * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
32 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
36 | * | ||
37 | */ | ||
38 | |||
39 | #ifndef _LINUX_NFSD_XDR4_H | ||
40 | #define _LINUX_NFSD_XDR4_H | ||
41 | |||
42 | #include <linux/nfs4.h> | ||
43 | |||
44 | #define NFSD4_MAX_TAGLEN 128 | ||
45 | #define XDR_LEN(n) (((n) + 3) & ~3) | ||
46 | |||
47 | struct nfsd4_compound_state { | ||
48 | struct svc_fh current_fh; | ||
49 | struct svc_fh save_fh; | ||
50 | struct nfs4_stateowner *replay_owner; | ||
51 | /* For sessions DRC */ | ||
52 | struct nfsd4_session *session; | ||
53 | struct nfsd4_slot *slot; | ||
54 | __be32 *datap; | ||
55 | size_t iovlen; | ||
56 | u32 minorversion; | ||
57 | u32 status; | ||
58 | }; | ||
59 | |||
60 | static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) | ||
61 | { | ||
62 | return cs->slot != NULL; | ||
63 | } | ||
64 | |||
65 | struct nfsd4_change_info { | ||
66 | u32 atomic; | ||
67 | bool change_supported; | ||
68 | u32 before_ctime_sec; | ||
69 | u32 before_ctime_nsec; | ||
70 | u64 before_change; | ||
71 | u32 after_ctime_sec; | ||
72 | u32 after_ctime_nsec; | ||
73 | u64 after_change; | ||
74 | }; | ||
75 | |||
76 | struct nfsd4_access { | ||
77 | u32 ac_req_access; /* request */ | ||
78 | u32 ac_supported; /* response */ | ||
79 | u32 ac_resp_access; /* response */ | ||
80 | }; | ||
81 | |||
82 | struct nfsd4_close { | ||
83 | u32 cl_seqid; /* request */ | ||
84 | stateid_t cl_stateid; /* request+response */ | ||
85 | struct nfs4_stateowner * cl_stateowner; /* response */ | ||
86 | }; | ||
87 | |||
88 | struct nfsd4_commit { | ||
89 | u64 co_offset; /* request */ | ||
90 | u32 co_count; /* request */ | ||
91 | nfs4_verifier co_verf; /* response */ | ||
92 | }; | ||
93 | |||
94 | struct nfsd4_create { | ||
95 | u32 cr_namelen; /* request */ | ||
96 | char * cr_name; /* request */ | ||
97 | u32 cr_type; /* request */ | ||
98 | union { /* request */ | ||
99 | struct { | ||
100 | u32 namelen; | ||
101 | char *name; | ||
102 | } link; /* NF4LNK */ | ||
103 | struct { | ||
104 | u32 specdata1; | ||
105 | u32 specdata2; | ||
106 | } dev; /* NF4BLK, NF4CHR */ | ||
107 | } u; | ||
108 | u32 cr_bmval[3]; /* request */ | ||
109 | struct iattr cr_iattr; /* request */ | ||
110 | struct nfsd4_change_info cr_cinfo; /* response */ | ||
111 | struct nfs4_acl *cr_acl; | ||
112 | }; | ||
113 | #define cr_linklen u.link.namelen | ||
114 | #define cr_linkname u.link.name | ||
115 | #define cr_specdata1 u.dev.specdata1 | ||
116 | #define cr_specdata2 u.dev.specdata2 | ||
117 | |||
118 | struct nfsd4_delegreturn { | ||
119 | stateid_t dr_stateid; | ||
120 | }; | ||
121 | |||
122 | struct nfsd4_getattr { | ||
123 | u32 ga_bmval[3]; /* request */ | ||
124 | struct svc_fh *ga_fhp; /* response */ | ||
125 | }; | ||
126 | |||
127 | struct nfsd4_link { | ||
128 | u32 li_namelen; /* request */ | ||
129 | char * li_name; /* request */ | ||
130 | struct nfsd4_change_info li_cinfo; /* response */ | ||
131 | }; | ||
132 | |||
133 | struct nfsd4_lock_denied { | ||
134 | clientid_t ld_clientid; | ||
135 | struct nfs4_stateowner *ld_sop; | ||
136 | u64 ld_start; | ||
137 | u64 ld_length; | ||
138 | u32 ld_type; | ||
139 | }; | ||
140 | |||
141 | struct nfsd4_lock { | ||
142 | /* request */ | ||
143 | u32 lk_type; | ||
144 | u32 lk_reclaim; /* boolean */ | ||
145 | u64 lk_offset; | ||
146 | u64 lk_length; | ||
147 | u32 lk_is_new; | ||
148 | union { | ||
149 | struct { | ||
150 | u32 open_seqid; | ||
151 | stateid_t open_stateid; | ||
152 | u32 lock_seqid; | ||
153 | clientid_t clientid; | ||
154 | struct xdr_netobj owner; | ||
155 | } new; | ||
156 | struct { | ||
157 | stateid_t lock_stateid; | ||
158 | u32 lock_seqid; | ||
159 | } old; | ||
160 | } v; | ||
161 | |||
162 | /* response */ | ||
163 | union { | ||
164 | struct { | ||
165 | stateid_t stateid; | ||
166 | } ok; | ||
167 | struct nfsd4_lock_denied denied; | ||
168 | } u; | ||
169 | /* The lk_replay_owner is the open owner in the open_to_lock_owner | ||
170 | * case and the lock owner otherwise: */ | ||
171 | struct nfs4_stateowner *lk_replay_owner; | ||
172 | }; | ||
173 | #define lk_new_open_seqid v.new.open_seqid | ||
174 | #define lk_new_open_stateid v.new.open_stateid | ||
175 | #define lk_new_lock_seqid v.new.lock_seqid | ||
176 | #define lk_new_clientid v.new.clientid | ||
177 | #define lk_new_owner v.new.owner | ||
178 | #define lk_old_lock_stateid v.old.lock_stateid | ||
179 | #define lk_old_lock_seqid v.old.lock_seqid | ||
180 | |||
181 | #define lk_rflags u.ok.rflags | ||
182 | #define lk_resp_stateid u.ok.stateid | ||
183 | #define lk_denied u.denied | ||
184 | |||
185 | |||
186 | struct nfsd4_lockt { | ||
187 | u32 lt_type; | ||
188 | clientid_t lt_clientid; | ||
189 | struct xdr_netobj lt_owner; | ||
190 | u64 lt_offset; | ||
191 | u64 lt_length; | ||
192 | struct nfs4_stateowner * lt_stateowner; | ||
193 | struct nfsd4_lock_denied lt_denied; | ||
194 | }; | ||
195 | |||
196 | |||
197 | struct nfsd4_locku { | ||
198 | u32 lu_type; | ||
199 | u32 lu_seqid; | ||
200 | stateid_t lu_stateid; | ||
201 | u64 lu_offset; | ||
202 | u64 lu_length; | ||
203 | struct nfs4_stateowner *lu_stateowner; | ||
204 | }; | ||
205 | |||
206 | |||
207 | struct nfsd4_lookup { | ||
208 | u32 lo_len; /* request */ | ||
209 | char * lo_name; /* request */ | ||
210 | }; | ||
211 | |||
212 | struct nfsd4_putfh { | ||
213 | u32 pf_fhlen; /* request */ | ||
214 | char *pf_fhval; /* request */ | ||
215 | }; | ||
216 | |||
217 | struct nfsd4_open { | ||
218 | u32 op_claim_type; /* request */ | ||
219 | struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */ | ||
220 | u32 op_delegate_type; /* request - CLAIM_PREV only */ | ||
221 | stateid_t op_delegate_stateid; /* request - response */ | ||
222 | u32 op_create; /* request */ | ||
223 | u32 op_createmode; /* request */ | ||
224 | u32 op_bmval[3]; /* request */ | ||
225 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ | ||
226 | nfs4_verifier verf; /* EXCLUSIVE4 */ | ||
227 | clientid_t op_clientid; /* request */ | ||
228 | struct xdr_netobj op_owner; /* request */ | ||
229 | u32 op_seqid; /* request */ | ||
230 | u32 op_share_access; /* request */ | ||
231 | u32 op_share_deny; /* request */ | ||
232 | stateid_t op_stateid; /* response */ | ||
233 | u32 op_recall; /* recall */ | ||
234 | struct nfsd4_change_info op_cinfo; /* response */ | ||
235 | u32 op_rflags; /* response */ | ||
236 | int op_truncate; /* used during processing */ | ||
237 | struct nfs4_stateowner *op_stateowner; /* used during processing */ | ||
238 | struct nfs4_acl *op_acl; | ||
239 | }; | ||
240 | #define op_iattr iattr | ||
241 | #define op_verf verf | ||
242 | |||
243 | struct nfsd4_open_confirm { | ||
244 | stateid_t oc_req_stateid /* request */; | ||
245 | u32 oc_seqid /* request */; | ||
246 | stateid_t oc_resp_stateid /* response */; | ||
247 | struct nfs4_stateowner * oc_stateowner; /* response */ | ||
248 | }; | ||
249 | |||
250 | struct nfsd4_open_downgrade { | ||
251 | stateid_t od_stateid; | ||
252 | u32 od_seqid; | ||
253 | u32 od_share_access; | ||
254 | u32 od_share_deny; | ||
255 | struct nfs4_stateowner *od_stateowner; | ||
256 | }; | ||
257 | |||
258 | |||
259 | struct nfsd4_read { | ||
260 | stateid_t rd_stateid; /* request */ | ||
261 | u64 rd_offset; /* request */ | ||
262 | u32 rd_length; /* request */ | ||
263 | int rd_vlen; | ||
264 | struct file *rd_filp; | ||
265 | |||
266 | struct svc_rqst *rd_rqstp; /* response */ | ||
267 | struct svc_fh * rd_fhp; /* response */ | ||
268 | }; | ||
269 | |||
270 | struct nfsd4_readdir { | ||
271 | u64 rd_cookie; /* request */ | ||
272 | nfs4_verifier rd_verf; /* request */ | ||
273 | u32 rd_dircount; /* request */ | ||
274 | u32 rd_maxcount; /* request */ | ||
275 | u32 rd_bmval[3]; /* request */ | ||
276 | struct svc_rqst *rd_rqstp; /* response */ | ||
277 | struct svc_fh * rd_fhp; /* response */ | ||
278 | |||
279 | struct readdir_cd common; | ||
280 | __be32 * buffer; | ||
281 | int buflen; | ||
282 | __be32 * offset; | ||
283 | }; | ||
284 | |||
285 | struct nfsd4_release_lockowner { | ||
286 | clientid_t rl_clientid; | ||
287 | struct xdr_netobj rl_owner; | ||
288 | }; | ||
289 | struct nfsd4_readlink { | ||
290 | struct svc_rqst *rl_rqstp; /* request */ | ||
291 | struct svc_fh * rl_fhp; /* request */ | ||
292 | }; | ||
293 | |||
294 | struct nfsd4_remove { | ||
295 | u32 rm_namelen; /* request */ | ||
296 | char * rm_name; /* request */ | ||
297 | struct nfsd4_change_info rm_cinfo; /* response */ | ||
298 | }; | ||
299 | |||
300 | struct nfsd4_rename { | ||
301 | u32 rn_snamelen; /* request */ | ||
302 | char * rn_sname; /* request */ | ||
303 | u32 rn_tnamelen; /* request */ | ||
304 | char * rn_tname; /* request */ | ||
305 | struct nfsd4_change_info rn_sinfo; /* response */ | ||
306 | struct nfsd4_change_info rn_tinfo; /* response */ | ||
307 | }; | ||
308 | |||
309 | struct nfsd4_secinfo { | ||
310 | u32 si_namelen; /* request */ | ||
311 | char *si_name; /* request */ | ||
312 | struct svc_export *si_exp; /* response */ | ||
313 | }; | ||
314 | |||
315 | struct nfsd4_setattr { | ||
316 | stateid_t sa_stateid; /* request */ | ||
317 | u32 sa_bmval[3]; /* request */ | ||
318 | struct iattr sa_iattr; /* request */ | ||
319 | struct nfs4_acl *sa_acl; | ||
320 | }; | ||
321 | |||
322 | struct nfsd4_setclientid { | ||
323 | nfs4_verifier se_verf; /* request */ | ||
324 | u32 se_namelen; /* request */ | ||
325 | char * se_name; /* request */ | ||
326 | u32 se_callback_prog; /* request */ | ||
327 | u32 se_callback_netid_len; /* request */ | ||
328 | char * se_callback_netid_val; /* request */ | ||
329 | u32 se_callback_addr_len; /* request */ | ||
330 | char * se_callback_addr_val; /* request */ | ||
331 | u32 se_callback_ident; /* request */ | ||
332 | clientid_t se_clientid; /* response */ | ||
333 | nfs4_verifier se_confirm; /* response */ | ||
334 | }; | ||
335 | |||
336 | struct nfsd4_setclientid_confirm { | ||
337 | clientid_t sc_clientid; | ||
338 | nfs4_verifier sc_confirm; | ||
339 | }; | ||
340 | |||
341 | /* also used for NVERIFY */ | ||
342 | struct nfsd4_verify { | ||
343 | u32 ve_bmval[3]; /* request */ | ||
344 | u32 ve_attrlen; /* request */ | ||
345 | char * ve_attrval; /* request */ | ||
346 | }; | ||
347 | |||
348 | struct nfsd4_write { | ||
349 | stateid_t wr_stateid; /* request */ | ||
350 | u64 wr_offset; /* request */ | ||
351 | u32 wr_stable_how; /* request */ | ||
352 | u32 wr_buflen; /* request */ | ||
353 | int wr_vlen; | ||
354 | |||
355 | u32 wr_bytes_written; /* response */ | ||
356 | u32 wr_how_written; /* response */ | ||
357 | nfs4_verifier wr_verifier; /* response */ | ||
358 | }; | ||
359 | |||
360 | struct nfsd4_exchange_id { | ||
361 | nfs4_verifier verifier; | ||
362 | struct xdr_netobj clname; | ||
363 | u32 flags; | ||
364 | clientid_t clientid; | ||
365 | u32 seqid; | ||
366 | int spa_how; | ||
367 | }; | ||
368 | |||
369 | struct nfsd4_sequence { | ||
370 | struct nfs4_sessionid sessionid; /* request/response */ | ||
371 | u32 seqid; /* request/response */ | ||
372 | u32 slotid; /* request/response */ | ||
373 | u32 maxslots; /* request/response */ | ||
374 | u32 cachethis; /* request */ | ||
375 | #if 0 | ||
376 | u32 target_maxslots; /* response */ | ||
377 | u32 status_flags; /* response */ | ||
378 | #endif /* not yet */ | ||
379 | }; | ||
380 | |||
381 | struct nfsd4_destroy_session { | ||
382 | struct nfs4_sessionid sessionid; | ||
383 | }; | ||
384 | |||
385 | struct nfsd4_op { | ||
386 | int opnum; | ||
387 | __be32 status; | ||
388 | union { | ||
389 | struct nfsd4_access access; | ||
390 | struct nfsd4_close close; | ||
391 | struct nfsd4_commit commit; | ||
392 | struct nfsd4_create create; | ||
393 | struct nfsd4_delegreturn delegreturn; | ||
394 | struct nfsd4_getattr getattr; | ||
395 | struct svc_fh * getfh; | ||
396 | struct nfsd4_link link; | ||
397 | struct nfsd4_lock lock; | ||
398 | struct nfsd4_lockt lockt; | ||
399 | struct nfsd4_locku locku; | ||
400 | struct nfsd4_lookup lookup; | ||
401 | struct nfsd4_verify nverify; | ||
402 | struct nfsd4_open open; | ||
403 | struct nfsd4_open_confirm open_confirm; | ||
404 | struct nfsd4_open_downgrade open_downgrade; | ||
405 | struct nfsd4_putfh putfh; | ||
406 | struct nfsd4_read read; | ||
407 | struct nfsd4_readdir readdir; | ||
408 | struct nfsd4_readlink readlink; | ||
409 | struct nfsd4_remove remove; | ||
410 | struct nfsd4_rename rename; | ||
411 | clientid_t renew; | ||
412 | struct nfsd4_secinfo secinfo; | ||
413 | struct nfsd4_setattr setattr; | ||
414 | struct nfsd4_setclientid setclientid; | ||
415 | struct nfsd4_setclientid_confirm setclientid_confirm; | ||
416 | struct nfsd4_verify verify; | ||
417 | struct nfsd4_write write; | ||
418 | struct nfsd4_release_lockowner release_lockowner; | ||
419 | |||
420 | /* NFSv4.1 */ | ||
421 | struct nfsd4_exchange_id exchange_id; | ||
422 | struct nfsd4_create_session create_session; | ||
423 | struct nfsd4_destroy_session destroy_session; | ||
424 | struct nfsd4_sequence sequence; | ||
425 | } u; | ||
426 | struct nfs4_replay * replay; | ||
427 | }; | ||
428 | |||
429 | struct nfsd4_compoundargs { | ||
430 | /* scratch variables for XDR decode */ | ||
431 | __be32 * p; | ||
432 | __be32 * end; | ||
433 | struct page ** pagelist; | ||
434 | int pagelen; | ||
435 | __be32 tmp[8]; | ||
436 | __be32 * tmpp; | ||
437 | struct tmpbuf { | ||
438 | struct tmpbuf *next; | ||
439 | void (*release)(const void *); | ||
440 | void *buf; | ||
441 | } *to_free; | ||
442 | |||
443 | struct svc_rqst *rqstp; | ||
444 | |||
445 | u32 taglen; | ||
446 | char * tag; | ||
447 | u32 minorversion; | ||
448 | u32 opcnt; | ||
449 | struct nfsd4_op *ops; | ||
450 | struct nfsd4_op iops[8]; | ||
451 | }; | ||
452 | |||
453 | struct nfsd4_compoundres { | ||
454 | /* scratch variables for XDR encode */ | ||
455 | __be32 * p; | ||
456 | __be32 * end; | ||
457 | struct xdr_buf * xbuf; | ||
458 | struct svc_rqst * rqstp; | ||
459 | |||
460 | u32 taglen; | ||
461 | char * tag; | ||
462 | u32 opcnt; | ||
463 | __be32 * tagp; /* tag, opcount encode location */ | ||
464 | struct nfsd4_compound_state cstate; | ||
465 | }; | ||
466 | |||
467 | static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) | ||
468 | { | ||
469 | struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; | ||
470 | return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE; | ||
471 | } | ||
472 | |||
473 | static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | ||
474 | { | ||
475 | return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp); | ||
476 | } | ||
477 | |||
478 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) | ||
479 | |||
480 | static inline void | ||
481 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) | ||
482 | { | ||
483 | BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); | ||
484 | cinfo->atomic = 1; | ||
485 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); | ||
486 | if (cinfo->change_supported) { | ||
487 | cinfo->before_change = fhp->fh_pre_change; | ||
488 | cinfo->after_change = fhp->fh_post_change; | ||
489 | } else { | ||
490 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; | ||
491 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; | ||
492 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; | ||
493 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; | ||
494 | } | ||
495 | } | ||
496 | |||
497 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | ||
498 | int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *, | ||
499 | struct nfsd4_compoundargs *); | ||
500 | int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *, | ||
501 | struct nfsd4_compoundres *); | ||
502 | void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); | ||
503 | void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); | ||
504 | __be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | ||
505 | struct dentry *dentry, __be32 *buffer, int *countp, | ||
506 | u32 *bmval, struct svc_rqst *, int ignore_crossmnt); | ||
507 | extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, | ||
508 | struct nfsd4_compound_state *, | ||
509 | struct nfsd4_setclientid *setclid); | ||
510 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | ||
511 | struct nfsd4_compound_state *, | ||
512 | struct nfsd4_setclientid_confirm *setclientid_confirm); | ||
513 | extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp); | ||
514 | extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp, | ||
515 | struct nfsd4_sequence *seq); | ||
516 | extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp, | ||
517 | struct nfsd4_compound_state *, | ||
518 | struct nfsd4_exchange_id *); | ||
519 | extern __be32 nfsd4_create_session(struct svc_rqst *, | ||
520 | struct nfsd4_compound_state *, | ||
521 | struct nfsd4_create_session *); | ||
522 | extern __be32 nfsd4_sequence(struct svc_rqst *, | ||
523 | struct nfsd4_compound_state *, | ||
524 | struct nfsd4_sequence *); | ||
525 | extern __be32 nfsd4_destroy_session(struct svc_rqst *, | ||
526 | struct nfsd4_compound_state *, | ||
527 | struct nfsd4_destroy_session *); | ||
528 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, | ||
529 | struct nfsd4_open *open); | ||
530 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, | ||
531 | struct svc_fh *current_fh, struct nfsd4_open *open); | ||
532 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, | ||
533 | struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc); | ||
534 | extern __be32 nfsd4_close(struct svc_rqst *rqstp, | ||
535 | struct nfsd4_compound_state *, | ||
536 | struct nfsd4_close *close); | ||
537 | extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp, | ||
538 | struct nfsd4_compound_state *, | ||
539 | struct nfsd4_open_downgrade *od); | ||
540 | extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *, | ||
541 | struct nfsd4_lock *lock); | ||
542 | extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, | ||
543 | struct nfsd4_compound_state *, | ||
544 | struct nfsd4_lockt *lockt); | ||
545 | extern __be32 nfsd4_locku(struct svc_rqst *rqstp, | ||
546 | struct nfsd4_compound_state *, | ||
547 | struct nfsd4_locku *locku); | ||
548 | extern __be32 | ||
549 | nfsd4_release_lockowner(struct svc_rqst *rqstp, | ||
550 | struct nfsd4_compound_state *, | ||
551 | struct nfsd4_release_lockowner *rlockowner); | ||
552 | extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *); | ||
553 | extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp, | ||
554 | struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr); | ||
555 | extern __be32 nfsd4_renew(struct svc_rqst *rqstp, | ||
556 | struct nfsd4_compound_state *, clientid_t *clid); | ||
557 | #endif | ||
558 | |||
559 | /* | ||
560 | * Local variables: | ||
561 | * c-basic-offset: 8 | ||
562 | * End: | ||
563 | */ | ||
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index ce520402e840..3fe02cf8b65a 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
@@ -151,6 +151,8 @@ struct nilfs_super_root { | |||
151 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ | 151 | #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ |
152 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order | 152 | #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order |
153 | semantics also for data */ | 153 | semantics also for data */ |
154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during | ||
155 | mount-time recovery */ | ||
154 | 156 | ||
155 | 157 | ||
156 | /** | 158 | /** |
@@ -403,6 +405,28 @@ struct nilfs_segment_summary { | |||
403 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ | 405 | #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ |
404 | 406 | ||
405 | /** | 407 | /** |
408 | * struct nilfs_btree_node - B-tree node | ||
409 | * @bn_flags: flags | ||
410 | * @bn_level: level | ||
411 | * @bn_nchildren: number of children | ||
412 | * @bn_pad: padding | ||
413 | */ | ||
414 | struct nilfs_btree_node { | ||
415 | __u8 bn_flags; | ||
416 | __u8 bn_level; | ||
417 | __le16 bn_nchildren; | ||
418 | __le32 bn_pad; | ||
419 | }; | ||
420 | |||
421 | /* flags */ | ||
422 | #define NILFS_BTREE_NODE_ROOT 0x01 | ||
423 | |||
424 | /* level */ | ||
425 | #define NILFS_BTREE_LEVEL_DATA 0 | ||
426 | #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) | ||
427 | #define NILFS_BTREE_LEVEL_MAX 14 | ||
428 | |||
429 | /** | ||
406 | * struct nilfs_palloc_group_desc - block group descriptor | 430 | * struct nilfs_palloc_group_desc - block group descriptor |
407 | * @pg_nfrees: number of free entries in block group | 431 | * @pg_nfrees: number of free entries in block group |
408 | */ | 432 | */ |
diff --git a/include/linux/node.h b/include/linux/node.h index 681a697b9a86..06292dac3eab 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
@@ -21,13 +21,19 @@ | |||
21 | 21 | ||
22 | #include <linux/sysdev.h> | 22 | #include <linux/sysdev.h> |
23 | #include <linux/cpumask.h> | 23 | #include <linux/cpumask.h> |
24 | #include <linux/workqueue.h> | ||
24 | 25 | ||
25 | struct node { | 26 | struct node { |
26 | struct sys_device sysdev; | 27 | struct sys_device sysdev; |
28 | |||
29 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) | ||
30 | struct work_struct node_work; | ||
31 | #endif | ||
27 | }; | 32 | }; |
28 | 33 | ||
29 | struct memory_block; | 34 | struct memory_block; |
30 | extern struct node node_devices[]; | 35 | extern struct node node_devices[]; |
36 | typedef void (*node_registration_func_t)(struct node *); | ||
31 | 37 | ||
32 | extern int register_node(struct node *, int, struct node *); | 38 | extern int register_node(struct node *, int, struct node *); |
33 | extern void unregister_node(struct node *node); | 39 | extern void unregister_node(struct node *node); |
@@ -39,6 +45,11 @@ extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); | |||
39 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, | 45 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, |
40 | int nid); | 46 | int nid); |
41 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); | 47 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); |
48 | |||
49 | #ifdef CONFIG_HUGETLBFS | ||
50 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, | ||
51 | node_registration_func_t unregister); | ||
52 | #endif | ||
42 | #else | 53 | #else |
43 | static inline int register_one_node(int nid) | 54 | static inline int register_one_node(int nid) |
44 | { | 55 | { |
@@ -65,6 +76,11 @@ static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) | |||
65 | { | 76 | { |
66 | return 0; | 77 | return 0; |
67 | } | 78 | } |
79 | |||
80 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, | ||
81 | node_registration_func_t unreg) | ||
82 | { | ||
83 | } | ||
68 | #endif | 84 | #endif |
69 | 85 | ||
70 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 86 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) |
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index b359c4a9ec9e..454997cccbd8 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
@@ -245,14 +245,19 @@ static inline int __next_node(int n, const nodemask_t *srcp) | |||
245 | return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); | 245 | return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); |
246 | } | 246 | } |
247 | 247 | ||
248 | static inline void init_nodemask_of_node(nodemask_t *mask, int node) | ||
249 | { | ||
250 | nodes_clear(*mask); | ||
251 | node_set(node, *mask); | ||
252 | } | ||
253 | |||
248 | #define nodemask_of_node(node) \ | 254 | #define nodemask_of_node(node) \ |
249 | ({ \ | 255 | ({ \ |
250 | typeof(_unused_nodemask_arg_) m; \ | 256 | typeof(_unused_nodemask_arg_) m; \ |
251 | if (sizeof(m) == sizeof(unsigned long)) { \ | 257 | if (sizeof(m) == sizeof(unsigned long)) { \ |
252 | m.bits[0] = 1UL<<(node); \ | 258 | m.bits[0] = 1UL << (node); \ |
253 | } else { \ | 259 | } else { \ |
254 | nodes_clear(m); \ | 260 | init_nodemask_of_node(&m, (node)); \ |
255 | node_set((node), m); \ | ||
256 | } \ | 261 | } \ |
257 | m; \ | 262 | m; \ |
258 | }) | 263 | }) |
@@ -480,15 +485,17 @@ static inline int num_node_state(enum node_states state) | |||
480 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) | 485 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) |
481 | 486 | ||
482 | /* | 487 | /* |
483 | * For nodemask scrach area.(See CPUMASK_ALLOC() in cpumask.h) | 488 | * For nodemask scrach area. |
489 | * NODEMASK_ALLOC(type, name) allocates an object with a specified type and | ||
490 | * name. | ||
484 | */ | 491 | */ |
485 | 492 | #if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */ | |
486 | #if NODES_SHIFT > 8 /* nodemask_t > 64 bytes */ | 493 | #define NODEMASK_ALLOC(type, name, gfp_flags) \ |
487 | #define NODEMASK_ALLOC(x, m) struct x *m = kmalloc(sizeof(*m), GFP_KERNEL) | 494 | type *name = kmalloc(sizeof(*name), gfp_flags) |
488 | #define NODEMASK_FREE(m) kfree(m) | 495 | #define NODEMASK_FREE(m) kfree(m) |
489 | #else | 496 | #else |
490 | #define NODEMASK_ALLOC(x, m) struct x _m, *m = &_m | 497 | #define NODEMASK_ALLOC(type, name, gfp_flags) type _name, *name = &_name |
491 | #define NODEMASK_FREE(m) | 498 | #define NODEMASK_FREE(m) do {} while (0) |
492 | #endif | 499 | #endif |
493 | 500 | ||
494 | /* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ | 501 | /* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ |
@@ -497,8 +504,10 @@ struct nodemask_scratch { | |||
497 | nodemask_t mask2; | 504 | nodemask_t mask2; |
498 | }; | 505 | }; |
499 | 506 | ||
500 | #define NODEMASK_SCRATCH(x) NODEMASK_ALLOC(nodemask_scratch, x) | 507 | #define NODEMASK_SCRATCH(x) \ |
501 | #define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) | 508 | NODEMASK_ALLOC(struct nodemask_scratch, x, \ |
509 | GFP_KERNEL | __GFP_NORETRY) | ||
510 | #define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) | ||
502 | 511 | ||
503 | 512 | ||
504 | #endif /* __LINUX_NODEMASK_H */ | 513 | #endif /* __LINUX_NODEMASK_H */ |
diff --git a/include/linux/numa.h b/include/linux/numa.h index a31a7301b159..3aaa31603a86 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h | |||
@@ -10,4 +10,6 @@ | |||
10 | 10 | ||
11 | #define MAX_NUMNODES (1 << NODES_SHIFT) | 11 | #define MAX_NUMNODES (1 << NODES_SHIFT) |
12 | 12 | ||
13 | #define NUMA_NO_NODE (-1) | ||
14 | |||
13 | #endif /* _LINUX_NUMA_H */ | 15 | #endif /* _LINUX_NUMA_H */ |
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h new file mode 100644 index 000000000000..f46c40ac6d45 --- /dev/null +++ b/include/linux/omapfb.h | |||
@@ -0,0 +1,251 @@ | |||
1 | /* | ||
2 | * File: include/linux/omapfb.h | ||
3 | * | ||
4 | * Framebuffer driver for TI OMAP boards | ||
5 | * | ||
6 | * Copyright (C) 2004 Nokia Corporation | ||
7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __LINUX_OMAPFB_H__ | ||
25 | #define __LINUX_OMAPFB_H__ | ||
26 | |||
27 | #include <linux/fb.h> | ||
28 | #include <linux/ioctl.h> | ||
29 | #include <linux/types.h> | ||
30 | |||
31 | /* IOCTL commands. */ | ||
32 | |||
33 | #define OMAP_IOW(num, dtype) _IOW('O', num, dtype) | ||
34 | #define OMAP_IOR(num, dtype) _IOR('O', num, dtype) | ||
35 | #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) | ||
36 | #define OMAP_IO(num) _IO('O', num) | ||
37 | |||
38 | #define OMAPFB_MIRROR OMAP_IOW(31, int) | ||
39 | #define OMAPFB_SYNC_GFX OMAP_IO(37) | ||
40 | #define OMAPFB_VSYNC OMAP_IO(38) | ||
41 | #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) | ||
42 | #define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) | ||
43 | #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) | ||
44 | #define OMAPFB_LCD_TEST OMAP_IOW(45, int) | ||
45 | #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) | ||
46 | #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) | ||
47 | #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) | ||
48 | #define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) | ||
49 | #define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) | ||
50 | #define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) | ||
51 | #define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) | ||
52 | #define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) | ||
53 | #define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) | ||
54 | #define OMAPFB_WAITFORVSYNC OMAP_IO(57) | ||
55 | #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) | ||
56 | #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) | ||
57 | #define OMAPFB_WAITFORGO OMAP_IO(60) | ||
58 | #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) | ||
59 | #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) | ||
60 | |||
61 | #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff | ||
62 | #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 | ||
63 | #define OMAPFB_CAPS_PANEL_MASK 0xff000000 | ||
64 | |||
65 | #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 | ||
66 | #define OMAPFB_CAPS_TEARSYNC 0x00002000 | ||
67 | #define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 | ||
68 | #define OMAPFB_CAPS_PLANE_SCALE 0x00008000 | ||
69 | #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 | ||
70 | #define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 | ||
71 | #define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 | ||
72 | #define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 | ||
73 | #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 | ||
74 | |||
75 | /* Values from DSP must map to lower 16-bits */ | ||
76 | #define OMAPFB_FORMAT_MASK 0x00ff | ||
77 | #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 | ||
78 | #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 | ||
79 | #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 | ||
80 | #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 | ||
81 | #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 | ||
82 | |||
83 | #define OMAPFB_MEMTYPE_SDRAM 0 | ||
84 | #define OMAPFB_MEMTYPE_SRAM 1 | ||
85 | #define OMAPFB_MEMTYPE_MAX 1 | ||
86 | |||
87 | enum omapfb_color_format { | ||
88 | OMAPFB_COLOR_RGB565 = 0, | ||
89 | OMAPFB_COLOR_YUV422, | ||
90 | OMAPFB_COLOR_YUV420, | ||
91 | OMAPFB_COLOR_CLUT_8BPP, | ||
92 | OMAPFB_COLOR_CLUT_4BPP, | ||
93 | OMAPFB_COLOR_CLUT_2BPP, | ||
94 | OMAPFB_COLOR_CLUT_1BPP, | ||
95 | OMAPFB_COLOR_RGB444, | ||
96 | OMAPFB_COLOR_YUY422, | ||
97 | |||
98 | OMAPFB_COLOR_ARGB16, | ||
99 | OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */ | ||
100 | OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */ | ||
101 | OMAPFB_COLOR_ARGB32, | ||
102 | OMAPFB_COLOR_RGBA32, | ||
103 | OMAPFB_COLOR_RGBX32, | ||
104 | }; | ||
105 | |||
106 | struct omapfb_update_window { | ||
107 | __u32 x, y; | ||
108 | __u32 width, height; | ||
109 | __u32 format; | ||
110 | __u32 out_x, out_y; | ||
111 | __u32 out_width, out_height; | ||
112 | __u32 reserved[8]; | ||
113 | }; | ||
114 | |||
115 | struct omapfb_update_window_old { | ||
116 | __u32 x, y; | ||
117 | __u32 width, height; | ||
118 | __u32 format; | ||
119 | }; | ||
120 | |||
121 | enum omapfb_plane { | ||
122 | OMAPFB_PLANE_GFX = 0, | ||
123 | OMAPFB_PLANE_VID1, | ||
124 | OMAPFB_PLANE_VID2, | ||
125 | }; | ||
126 | |||
127 | enum omapfb_channel_out { | ||
128 | OMAPFB_CHANNEL_OUT_LCD = 0, | ||
129 | OMAPFB_CHANNEL_OUT_DIGIT, | ||
130 | }; | ||
131 | |||
132 | struct omapfb_plane_info { | ||
133 | __u32 pos_x; | ||
134 | __u32 pos_y; | ||
135 | __u8 enabled; | ||
136 | __u8 channel_out; | ||
137 | __u8 mirror; | ||
138 | __u8 reserved1; | ||
139 | __u32 out_width; | ||
140 | __u32 out_height; | ||
141 | __u32 reserved2[12]; | ||
142 | }; | ||
143 | |||
144 | struct omapfb_mem_info { | ||
145 | __u32 size; | ||
146 | __u8 type; | ||
147 | __u8 reserved[3]; | ||
148 | }; | ||
149 | |||
150 | struct omapfb_caps { | ||
151 | __u32 ctrl; | ||
152 | __u32 plane_color; | ||
153 | __u32 wnd_color; | ||
154 | }; | ||
155 | |||
156 | enum omapfb_color_key_type { | ||
157 | OMAPFB_COLOR_KEY_DISABLED = 0, | ||
158 | OMAPFB_COLOR_KEY_GFX_DST, | ||
159 | OMAPFB_COLOR_KEY_VID_SRC, | ||
160 | }; | ||
161 | |||
162 | struct omapfb_color_key { | ||
163 | __u8 channel_out; | ||
164 | __u32 background; | ||
165 | __u32 trans_key; | ||
166 | __u8 key_type; | ||
167 | }; | ||
168 | |||
169 | enum omapfb_update_mode { | ||
170 | OMAPFB_UPDATE_DISABLED = 0, | ||
171 | OMAPFB_AUTO_UPDATE, | ||
172 | OMAPFB_MANUAL_UPDATE | ||
173 | }; | ||
174 | |||
175 | struct omapfb_memory_read { | ||
176 | __u16 x; | ||
177 | __u16 y; | ||
178 | __u16 w; | ||
179 | __u16 h; | ||
180 | size_t buffer_size; | ||
181 | void __user *buffer; | ||
182 | }; | ||
183 | |||
184 | struct omapfb_ovl_colormode { | ||
185 | __u8 overlay_idx; | ||
186 | __u8 mode_idx; | ||
187 | __u32 bits_per_pixel; | ||
188 | __u32 nonstd; | ||
189 | struct fb_bitfield red; | ||
190 | struct fb_bitfield green; | ||
191 | struct fb_bitfield blue; | ||
192 | struct fb_bitfield transp; | ||
193 | }; | ||
194 | |||
195 | struct omapfb_vram_info { | ||
196 | __u32 total; | ||
197 | __u32 free; | ||
198 | __u32 largest_free_block; | ||
199 | __u32 reserved[5]; | ||
200 | }; | ||
201 | |||
202 | struct omapfb_tearsync_info { | ||
203 | __u8 enabled; | ||
204 | __u8 reserved1[3]; | ||
205 | __u16 line; | ||
206 | __u16 reserved2; | ||
207 | }; | ||
208 | |||
209 | #ifdef __KERNEL__ | ||
210 | |||
211 | #include <plat/board.h> | ||
212 | |||
213 | #ifdef CONFIG_ARCH_OMAP1 | ||
214 | #define OMAPFB_PLANE_NUM 1 | ||
215 | #else | ||
216 | #define OMAPFB_PLANE_NUM 3 | ||
217 | #endif | ||
218 | |||
219 | struct omapfb_mem_region { | ||
220 | u32 paddr; | ||
221 | void __iomem *vaddr; | ||
222 | unsigned long size; | ||
223 | u8 type; /* OMAPFB_PLANE_MEM_* */ | ||
224 | enum omapfb_color_format format;/* OMAPFB_COLOR_* */ | ||
225 | unsigned format_used:1; /* Must be set when format is set. | ||
226 | * Needed b/c of the badly chosen 0 | ||
227 | * base for OMAPFB_COLOR_* values | ||
228 | */ | ||
229 | unsigned alloc:1; /* allocated by the driver */ | ||
230 | unsigned map:1; /* kernel mapped by the driver */ | ||
231 | }; | ||
232 | |||
233 | struct omapfb_mem_desc { | ||
234 | int region_cnt; | ||
235 | struct omapfb_mem_region region[OMAPFB_PLANE_NUM]; | ||
236 | }; | ||
237 | |||
238 | struct omapfb_platform_data { | ||
239 | struct omap_lcd_config lcd; | ||
240 | struct omapfb_mem_desc mem_desc; | ||
241 | void *ctrl_platform_data; | ||
242 | }; | ||
243 | |||
244 | /* in arch/arm/plat-omap/fb.c */ | ||
245 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); | ||
246 | extern void omapfb_set_ctrl_platform_data(void *pdata); | ||
247 | extern void omapfb_reserve_sdram(void); | ||
248 | |||
249 | #endif | ||
250 | |||
251 | #endif /* __OMAPFB_H */ | ||
diff --git a/include/linux/oom.h b/include/linux/oom.h index 6aac5fe4f6f1..537662315627 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/nodemask.h> | ||
13 | 14 | ||
14 | struct zonelist; | 15 | struct zonelist; |
15 | struct notifier_block; | 16 | struct notifier_block; |
@@ -26,7 +27,8 @@ enum oom_constraint { | |||
26 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 27 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
27 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 28 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
28 | 29 | ||
29 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); | 30 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
31 | int order, nodemask_t *mask); | ||
30 | extern int register_oom_notifier(struct notifier_block *nb); | 32 | extern int register_oom_notifier(struct notifier_block *nb); |
31 | extern int unregister_oom_notifier(struct notifier_block *nb); | 33 | extern int unregister_oom_notifier(struct notifier_block *nb); |
32 | 34 | ||
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6b202b173955..5b59f35dcb8f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #ifndef __GENERATING_BOUNDS_H | 9 | #ifndef __GENERATING_BOUNDS_H |
10 | #include <linux/mm_types.h> | 10 | #include <linux/mm_types.h> |
11 | #include <linux/bounds.h> | 11 | #include <generated/bounds.h> |
12 | #endif /* !__GENERATING_BOUNDS_H */ | 12 | #endif /* !__GENERATING_BOUNDS_H */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -99,7 +99,7 @@ enum pageflags { | |||
99 | PG_buddy, /* Page is free, on buddy lists */ | 99 | PG_buddy, /* Page is free, on buddy lists */ |
100 | PG_swapbacked, /* Page is backed by RAM/swap */ | 100 | PG_swapbacked, /* Page is backed by RAM/swap */ |
101 | PG_unevictable, /* Page is "unevictable" */ | 101 | PG_unevictable, /* Page is "unevictable" */ |
102 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 102 | #ifdef CONFIG_MMU |
103 | PG_mlocked, /* Page is vma mlocked */ | 103 | PG_mlocked, /* Page is vma mlocked */ |
104 | #endif | 104 | #endif |
105 | #ifdef CONFIG_ARCH_USES_PG_UNCACHED | 105 | #ifdef CONFIG_ARCH_USES_PG_UNCACHED |
@@ -259,12 +259,10 @@ PAGEFLAG_FALSE(SwapCache) | |||
259 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) | 259 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) |
260 | TESTCLEARFLAG(Unevictable, unevictable) | 260 | TESTCLEARFLAG(Unevictable, unevictable) |
261 | 261 | ||
262 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 262 | #ifdef CONFIG_MMU |
263 | #define MLOCK_PAGES 1 | ||
264 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) | 263 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) |
265 | TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) | 264 | TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) |
266 | #else | 265 | #else |
267 | #define MLOCK_PAGES 0 | ||
268 | PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) | 266 | PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) |
269 | TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) | 267 | TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) |
270 | #endif | 268 | #endif |
@@ -277,13 +275,15 @@ PAGEFLAG_FALSE(Uncached) | |||
277 | 275 | ||
278 | #ifdef CONFIG_MEMORY_FAILURE | 276 | #ifdef CONFIG_MEMORY_FAILURE |
279 | PAGEFLAG(HWPoison, hwpoison) | 277 | PAGEFLAG(HWPoison, hwpoison) |
280 | TESTSETFLAG(HWPoison, hwpoison) | 278 | TESTSCFLAG(HWPoison, hwpoison) |
281 | #define __PG_HWPOISON (1UL << PG_hwpoison) | 279 | #define __PG_HWPOISON (1UL << PG_hwpoison) |
282 | #else | 280 | #else |
283 | PAGEFLAG_FALSE(HWPoison) | 281 | PAGEFLAG_FALSE(HWPoison) |
284 | #define __PG_HWPOISON 0 | 282 | #define __PG_HWPOISON 0 |
285 | #endif | 283 | #endif |
286 | 284 | ||
285 | u64 stable_page_flags(struct page *page); | ||
286 | |||
287 | static inline int PageUptodate(struct page *page) | 287 | static inline int PageUptodate(struct page *page) |
288 | { | 288 | { |
289 | int ret = test_bit(PG_uptodate, &(page)->flags); | 289 | int ret = test_bit(PG_uptodate, &(page)->flags); |
@@ -393,7 +393,7 @@ static inline void __ClearPageTail(struct page *page) | |||
393 | 393 | ||
394 | #endif /* !PAGEFLAGS_EXTENDED */ | 394 | #endif /* !PAGEFLAGS_EXTENDED */ |
395 | 395 | ||
396 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 396 | #ifdef CONFIG_MMU |
397 | #define __PG_MLOCKED (1 << PG_mlocked) | 397 | #define __PG_MLOCKED (1 << PG_mlocked) |
398 | #else | 398 | #else |
399 | #define __PG_MLOCKED 0 | 399 | #define __PG_MLOCKED 0 |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 4b938d4f3ac2..b0e4eb126236 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
@@ -57,6 +57,8 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
57 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 57 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
58 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 58 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
59 | 59 | ||
60 | TESTPCGFLAG(Locked, LOCK) | ||
61 | |||
60 | /* Cache flag is set only once (at allocation) */ | 62 | /* Cache flag is set only once (at allocation) */ |
61 | TESTPCGFLAG(Cache, CACHE) | 63 | TESTPCGFLAG(Cache, CACHE) |
62 | CLEARPCGFLAG(Cache, CACHE) | 64 | CLEARPCGFLAG(Cache, CACHE) |
@@ -86,11 +88,6 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
86 | bit_spin_lock(PCG_LOCK, &pc->flags); | 88 | bit_spin_lock(PCG_LOCK, &pc->flags); |
87 | } | 89 | } |
88 | 90 | ||
89 | static inline int trylock_page_cgroup(struct page_cgroup *pc) | ||
90 | { | ||
91 | return bit_spin_trylock(PCG_LOCK, &pc->flags); | ||
92 | } | ||
93 | |||
94 | static inline void unlock_page_cgroup(struct page_cgroup *pc) | 91 | static inline void unlock_page_cgroup(struct page_cgroup *pc) |
95 | { | 92 | { |
96 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 93 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index ed5d7501e181..3c62ed408492 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -253,6 +253,8 @@ extern struct page * read_cache_page_async(struct address_space *mapping, | |||
253 | extern struct page * read_cache_page(struct address_space *mapping, | 253 | extern struct page * read_cache_page(struct address_space *mapping, |
254 | pgoff_t index, filler_t *filler, | 254 | pgoff_t index, filler_t *filler, |
255 | void *data); | 255 | void *data); |
256 | extern struct page * read_cache_page_gfp(struct address_space *mapping, | ||
257 | pgoff_t index, gfp_t gfp_mask); | ||
256 | extern int read_cache_pages(struct address_space *mapping, | 258 | extern int read_cache_pages(struct address_space *mapping, |
257 | struct list_head *pages, filler_t *filler, void *data); | 259 | struct list_head *pages, filler_t *filler, void *data); |
258 | 260 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index f5c7cd343e56..e2575f86133a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -218,6 +218,7 @@ struct pci_dev { | |||
218 | unsigned int class; /* 3 bytes: (base,sub,prog-if) */ | 218 | unsigned int class; /* 3 bytes: (base,sub,prog-if) */ |
219 | u8 revision; /* PCI revision, low byte of class word */ | 219 | u8 revision; /* PCI revision, low byte of class word */ |
220 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 220 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
221 | u8 pcie_cap; /* PCI-E capability offset */ | ||
221 | u8 pcie_type; /* PCI-E device/port type */ | 222 | u8 pcie_type; /* PCI-E device/port type */ |
222 | u8 rom_base_reg; /* which config register controls the ROM */ | 223 | u8 rom_base_reg; /* which config register controls the ROM */ |
223 | u8 pin; /* which interrupt pin this device uses */ | 224 | u8 pin; /* which interrupt pin this device uses */ |
@@ -242,6 +243,7 @@ struct pci_dev { | |||
242 | unsigned int d2_support:1; /* Low power state D2 is supported */ | 243 | unsigned int d2_support:1; /* Low power state D2 is supported */ |
243 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | 244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ |
244 | unsigned int wakeup_prepared:1; | 245 | unsigned int wakeup_prepared:1; |
246 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | ||
245 | 247 | ||
246 | #ifdef CONFIG_PCIEASPM | 248 | #ifdef CONFIG_PCIEASPM |
247 | struct pcie_link_state *link_state; /* ASPM link state. */ | 249 | struct pcie_link_state *link_state; /* ASPM link state. */ |
@@ -280,6 +282,7 @@ struct pci_dev { | |||
280 | unsigned int is_virtfn:1; | 282 | unsigned int is_virtfn:1; |
281 | unsigned int reset_fn:1; | 283 | unsigned int reset_fn:1; |
282 | unsigned int is_hotplug_bridge:1; | 284 | unsigned int is_hotplug_bridge:1; |
285 | unsigned int aer_firmware_first:1; | ||
283 | pci_dev_flags_t dev_flags; | 286 | pci_dev_flags_t dev_flags; |
284 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 287 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
285 | 288 | ||
@@ -564,6 +567,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t, | |||
564 | resource_size_t); | 567 | resource_size_t); |
565 | void pcibios_update_irq(struct pci_dev *, int irq); | 568 | void pcibios_update_irq(struct pci_dev *, int irq); |
566 | 569 | ||
570 | /* Weak but can be overriden by arch */ | ||
571 | void pci_fixup_cardbus(struct pci_bus *); | ||
572 | |||
567 | /* Generic PCI functions used internally */ | 573 | /* Generic PCI functions used internally */ |
568 | 574 | ||
569 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 575 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
@@ -606,6 +612,9 @@ extern void pci_remove_bus_device(struct pci_dev *dev); | |||
606 | extern void pci_stop_bus_device(struct pci_dev *dev); | 612 | extern void pci_stop_bus_device(struct pci_dev *dev); |
607 | void pci_setup_cardbus(struct pci_bus *bus); | 613 | void pci_setup_cardbus(struct pci_bus *bus); |
608 | extern void pci_sort_breadthfirst(void); | 614 | extern void pci_sort_breadthfirst(void); |
615 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | ||
616 | #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) | ||
617 | #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) | ||
609 | 618 | ||
610 | /* Generic PCI functions exported to card drivers */ | 619 | /* Generic PCI functions exported to card drivers */ |
611 | 620 | ||
@@ -635,7 +644,13 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | |||
635 | unsigned int ss_vendor, unsigned int ss_device, | 644 | unsigned int ss_vendor, unsigned int ss_device, |
636 | struct pci_dev *from); | 645 | struct pci_dev *from); |
637 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 646 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
638 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 647 | struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, |
648 | unsigned int devfn); | ||
649 | static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | ||
650 | unsigned int devfn) | ||
651 | { | ||
652 | return pci_get_domain_bus_and_slot(0, bus, devfn); | ||
653 | } | ||
639 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 654 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
640 | int pci_dev_present(const struct pci_device_id *ids); | 655 | int pci_dev_present(const struct pci_device_id *ids); |
641 | 656 | ||
@@ -701,6 +716,7 @@ void pci_disable_device(struct pci_dev *dev); | |||
701 | void pci_set_master(struct pci_dev *dev); | 716 | void pci_set_master(struct pci_dev *dev); |
702 | void pci_clear_master(struct pci_dev *dev); | 717 | void pci_clear_master(struct pci_dev *dev); |
703 | int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); | 718 | int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); |
719 | int pci_set_cacheline_size(struct pci_dev *dev); | ||
704 | #define HAVE_PCI_SET_MWI | 720 | #define HAVE_PCI_SET_MWI |
705 | int __must_check pci_set_mwi(struct pci_dev *dev); | 721 | int __must_check pci_set_mwi(struct pci_dev *dev); |
706 | int pci_try_set_mwi(struct pci_dev *dev); | 722 | int pci_try_set_mwi(struct pci_dev *dev); |
@@ -743,6 +759,10 @@ pci_power_t pci_target_state(struct pci_dev *dev); | |||
743 | int pci_prepare_to_sleep(struct pci_dev *dev); | 759 | int pci_prepare_to_sleep(struct pci_dev *dev); |
744 | int pci_back_from_sleep(struct pci_dev *dev); | 760 | int pci_back_from_sleep(struct pci_dev *dev); |
745 | 761 | ||
762 | /* For use by arch with custom probe code */ | ||
763 | void set_pcie_port_type(struct pci_dev *pdev); | ||
764 | void set_pcie_hotplug_bridge(struct pci_dev *pdev); | ||
765 | |||
746 | /* Functions for PCI Hotplug drivers to use */ | 766 | /* Functions for PCI Hotplug drivers to use */ |
747 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 767 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
748 | #ifdef CONFIG_HOTPLUG | 768 | #ifdef CONFIG_HOTPLUG |
@@ -1116,6 +1136,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1116 | unsigned int devfn) | 1136 | unsigned int devfn) |
1117 | { return NULL; } | 1137 | { return NULL; } |
1118 | 1138 | ||
1139 | #define dev_is_pci(d) (false) | ||
1140 | #define dev_is_pf(d) (false) | ||
1141 | #define dev_num_vf(d) (0) | ||
1119 | #endif /* CONFIG_PCI */ | 1142 | #endif /* CONFIG_PCI */ |
1120 | 1143 | ||
1121 | /* Include architecture-dependent settings and functions */ | 1144 | /* Include architecture-dependent settings and functions */ |
@@ -1246,6 +1269,8 @@ extern int pci_pci_problems; | |||
1246 | 1269 | ||
1247 | extern unsigned long pci_cardbus_io_size; | 1270 | extern unsigned long pci_cardbus_io_size; |
1248 | extern unsigned long pci_cardbus_mem_size; | 1271 | extern unsigned long pci_cardbus_mem_size; |
1272 | extern u8 __devinitdata pci_dfl_cache_line_size; | ||
1273 | extern u8 pci_cache_line_size; | ||
1249 | 1274 | ||
1250 | extern unsigned long pci_hotplug_io_size; | 1275 | extern unsigned long pci_hotplug_io_size; |
1251 | extern unsigned long pci_hotplug_mem_size; | 1276 | extern unsigned long pci_hotplug_mem_size; |
@@ -1271,6 +1296,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | |||
1271 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | 1296 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
1272 | extern void pci_disable_sriov(struct pci_dev *dev); | 1297 | extern void pci_disable_sriov(struct pci_dev *dev); |
1273 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1298 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
1299 | extern int pci_num_vf(struct pci_dev *dev); | ||
1274 | #else | 1300 | #else |
1275 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1301 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
1276 | { | 1302 | { |
@@ -1283,6 +1309,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) | |||
1283 | { | 1309 | { |
1284 | return IRQ_NONE; | 1310 | return IRQ_NONE; |
1285 | } | 1311 | } |
1312 | static inline int pci_num_vf(struct pci_dev *dev) | ||
1313 | { | ||
1314 | return 0; | ||
1315 | } | ||
1286 | #endif | 1316 | #endif |
1287 | 1317 | ||
1288 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1318 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |
@@ -1290,5 +1320,34 @@ extern void pci_hp_create_module_link(struct pci_slot *pci_slot); | |||
1290 | extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); | 1320 | extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); |
1291 | #endif | 1321 | #endif |
1292 | 1322 | ||
1323 | /** | ||
1324 | * pci_pcie_cap - get the saved PCIe capability offset | ||
1325 | * @dev: PCI device | ||
1326 | * | ||
1327 | * PCIe capability offset is calculated at PCI device initialization | ||
1328 | * time and saved in the data structure. This function returns saved | ||
1329 | * PCIe capability offset. Using this instead of pci_find_capability() | ||
1330 | * reduces unnecessary search in the PCI configuration space. If you | ||
1331 | * need to calculate PCIe capability offset from raw device for some | ||
1332 | * reasons, please use pci_find_capability() instead. | ||
1333 | */ | ||
1334 | static inline int pci_pcie_cap(struct pci_dev *dev) | ||
1335 | { | ||
1336 | return dev->pcie_cap; | ||
1337 | } | ||
1338 | |||
1339 | /** | ||
1340 | * pci_is_pcie - check if the PCI device is PCI Express capable | ||
1341 | * @dev: PCI device | ||
1342 | * | ||
1343 | * Retrun true if the PCI device is PCI Express capable, false otherwise. | ||
1344 | */ | ||
1345 | static inline bool pci_is_pcie(struct pci_dev *dev) | ||
1346 | { | ||
1347 | return !!pci_pcie_cap(dev); | ||
1348 | } | ||
1349 | |||
1350 | void pci_request_acs(void); | ||
1351 | |||
1293 | #endif /* __KERNEL__ */ | 1352 | #endif /* __KERNEL__ */ |
1294 | #endif /* LINUX_PCI_H */ | 1353 | #endif /* LINUX_PCI_H */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index cabf074b4324..cca8a044e2b6 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1587,6 +1587,8 @@ | |||
1587 | #define PCI_VENDOR_ID_COMPEX 0x11f6 | 1587 | #define PCI_VENDOR_ID_COMPEX 0x11f6 |
1588 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 | 1588 | #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 |
1589 | 1589 | ||
1590 | #define PCI_VENDOR_ID_PMC_Sierra 0x11f8 | ||
1591 | |||
1590 | #define PCI_VENDOR_ID_RP 0x11fe | 1592 | #define PCI_VENDOR_ID_RP 0x11fe |
1591 | #define PCI_DEVICE_ID_RP32INTF 0x0001 | 1593 | #define PCI_DEVICE_ID_RP32INTF 0x0001 |
1592 | #define PCI_DEVICE_ID_RP8INTF 0x0002 | 1594 | #define PCI_DEVICE_ID_RP8INTF 0x0002 |
@@ -2293,6 +2295,20 @@ | |||
2293 | #define PCI_DEVICE_ID_MPC8536 0x0051 | 2295 | #define PCI_DEVICE_ID_MPC8536 0x0051 |
2294 | #define PCI_DEVICE_ID_P2020E 0x0070 | 2296 | #define PCI_DEVICE_ID_P2020E 0x0070 |
2295 | #define PCI_DEVICE_ID_P2020 0x0071 | 2297 | #define PCI_DEVICE_ID_P2020 0x0071 |
2298 | #define PCI_DEVICE_ID_P2010E 0x0078 | ||
2299 | #define PCI_DEVICE_ID_P2010 0x0079 | ||
2300 | #define PCI_DEVICE_ID_P1020E 0x0100 | ||
2301 | #define PCI_DEVICE_ID_P1020 0x0101 | ||
2302 | #define PCI_DEVICE_ID_P1011E 0x0108 | ||
2303 | #define PCI_DEVICE_ID_P1011 0x0109 | ||
2304 | #define PCI_DEVICE_ID_P1022E 0x0110 | ||
2305 | #define PCI_DEVICE_ID_P1022 0x0111 | ||
2306 | #define PCI_DEVICE_ID_P1013E 0x0118 | ||
2307 | #define PCI_DEVICE_ID_P1013 0x0119 | ||
2308 | #define PCI_DEVICE_ID_P4080E 0x0400 | ||
2309 | #define PCI_DEVICE_ID_P4080 0x0401 | ||
2310 | #define PCI_DEVICE_ID_P4040E 0x0408 | ||
2311 | #define PCI_DEVICE_ID_P4040 0x0409 | ||
2296 | #define PCI_DEVICE_ID_MPC8641 0x7010 | 2312 | #define PCI_DEVICE_ID_MPC8641 0x7010 |
2297 | #define PCI_DEVICE_ID_MPC8641D 0x7011 | 2313 | #define PCI_DEVICE_ID_MPC8641D 0x7011 |
2298 | #define PCI_DEVICE_ID_MPC8610 0x7018 | 2314 | #define PCI_DEVICE_ID_MPC8610 0x7018 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index dd0bed4f1cf0..9f2ad0aa3c39 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -365,6 +365,11 @@ | |||
365 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | 365 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ |
366 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | 366 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ |
367 | 367 | ||
368 | /* PCI Bridge Subsystem ID registers */ | ||
369 | |||
370 | #define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ | ||
371 | #define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */ | ||
372 | |||
368 | /* PCI Express capability registers */ | 373 | /* PCI Express capability registers */ |
369 | 374 | ||
370 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ | 375 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ |
@@ -502,6 +507,7 @@ | |||
502 | #define PCI_EXT_CAP_ID_VC 2 | 507 | #define PCI_EXT_CAP_ID_VC 2 |
503 | #define PCI_EXT_CAP_ID_DSN 3 | 508 | #define PCI_EXT_CAP_ID_DSN 3 |
504 | #define PCI_EXT_CAP_ID_PWR 4 | 509 | #define PCI_EXT_CAP_ID_PWR 4 |
510 | #define PCI_EXT_CAP_ID_ACS 13 | ||
505 | #define PCI_EXT_CAP_ID_ARI 14 | 511 | #define PCI_EXT_CAP_ID_ARI 14 |
506 | #define PCI_EXT_CAP_ID_ATS 15 | 512 | #define PCI_EXT_CAP_ID_ATS 15 |
507 | #define PCI_EXT_CAP_ID_SRIOV 16 | 513 | #define PCI_EXT_CAP_ID_SRIOV 16 |
@@ -662,4 +668,16 @@ | |||
662 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ | 668 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ |
663 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ | 669 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ |
664 | 670 | ||
671 | /* Access Control Service */ | ||
672 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ | ||
673 | #define PCI_ACS_SV 0x01 /* Source Validation */ | ||
674 | #define PCI_ACS_TB 0x02 /* Translation Blocking */ | ||
675 | #define PCI_ACS_RR 0x04 /* P2P Request Redirect */ | ||
676 | #define PCI_ACS_CR 0x08 /* P2P Completion Redirect */ | ||
677 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ | ||
678 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ | ||
679 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ | ||
680 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ | ||
681 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ | ||
682 | |||
665 | #endif /* LINUX_PCI_REGS_H */ | 683 | #endif /* LINUX_PCI_REGS_H */ |
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index b4c79545330b..6775532b92a9 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h | |||
@@ -10,10 +10,7 @@ | |||
10 | #define _PCIEPORT_IF_H_ | 10 | #define _PCIEPORT_IF_H_ |
11 | 11 | ||
12 | /* Port Type */ | 12 | /* Port Type */ |
13 | #define PCIE_RC_PORT 4 /* Root port of RC */ | 13 | #define PCIE_ANY_PORT (~0) |
14 | #define PCIE_SW_UPSTREAM_PORT 5 /* Upstream port of Switch */ | ||
15 | #define PCIE_SW_DOWNSTREAM_PORT 6 /* Downstream port of Switch */ | ||
16 | #define PCIE_ANY_PORT 7 | ||
17 | 14 | ||
18 | /* Service Type */ | 15 | /* Service Type */ |
19 | #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ | 16 | #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ |
@@ -25,17 +22,6 @@ | |||
25 | #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */ | 22 | #define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */ |
26 | #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) | 23 | #define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) |
27 | 24 | ||
28 | /* Root/Upstream/Downstream Port's Interrupt Mode */ | ||
29 | #define PCIE_PORT_NO_IRQ (-1) | ||
30 | #define PCIE_PORT_INTx_MODE 0 | ||
31 | #define PCIE_PORT_MSI_MODE 1 | ||
32 | #define PCIE_PORT_MSIX_MODE 2 | ||
33 | |||
34 | struct pcie_port_data { | ||
35 | int port_type; /* Type of the port */ | ||
36 | int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ | ||
37 | }; | ||
38 | |||
39 | struct pcie_device { | 25 | struct pcie_device { |
40 | int irq; /* Service IRQ/MSI/MSI-X Vector */ | 26 | int irq; /* Service IRQ/MSI/MSI-X Vector */ |
41 | struct pci_dev *port; /* Root/Upstream/Downstream Port */ | 27 | struct pci_dev *port; /* Root/Upstream/Downstream Port */ |
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 9bd03193ecd4..5a5d6ce4bd55 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -60,6 +60,7 @@ | |||
60 | 60 | ||
61 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 61 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
62 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 62 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
63 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | ||
63 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 64 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
64 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ | 65 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ |
65 | __typeof__(type) per_cpu__##name | 66 | __typeof__(type) per_cpu__##name |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 878836ca999c..cf5efbcf716c 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -34,8 +34,6 @@ | |||
34 | 34 | ||
35 | #ifdef CONFIG_SMP | 35 | #ifdef CONFIG_SMP |
36 | 36 | ||
37 | #ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA | ||
38 | |||
39 | /* minimum unit size, also is the maximum supported allocation size */ | 37 | /* minimum unit size, also is the maximum supported allocation size */ |
40 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) | 38 | #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) |
41 | 39 | ||
@@ -130,30 +128,9 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size, | |||
130 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | 128 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) |
131 | 129 | ||
132 | extern void *__alloc_reserved_percpu(size_t size, size_t align); | 130 | extern void *__alloc_reserved_percpu(size_t size, size_t align); |
133 | |||
134 | #else /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ | ||
135 | |||
136 | struct percpu_data { | ||
137 | void *ptrs[1]; | ||
138 | }; | ||
139 | |||
140 | /* pointer disguising messes up the kmemleak objects tracking */ | ||
141 | #ifndef CONFIG_DEBUG_KMEMLEAK | ||
142 | #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) | ||
143 | #else | ||
144 | #define __percpu_disguise(pdata) (struct percpu_data *)(pdata) | ||
145 | #endif | ||
146 | |||
147 | #define per_cpu_ptr(ptr, cpu) \ | ||
148 | ({ \ | ||
149 | struct percpu_data *__p = __percpu_disguise(ptr); \ | ||
150 | (__typeof__(ptr))__p->ptrs[(cpu)]; \ | ||
151 | }) | ||
152 | |||
153 | #endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ | ||
154 | |||
155 | extern void *__alloc_percpu(size_t size, size_t align); | 131 | extern void *__alloc_percpu(size_t size, size_t align); |
156 | extern void free_percpu(void *__pdata); | 132 | extern void free_percpu(void *__pdata); |
133 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); | ||
157 | 134 | ||
158 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA | 135 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA |
159 | extern void __init setup_per_cpu_areas(void); | 136 | extern void __init setup_per_cpu_areas(void); |
@@ -179,6 +156,11 @@ static inline void free_percpu(void *p) | |||
179 | kfree(p); | 156 | kfree(p); |
180 | } | 157 | } |
181 | 158 | ||
159 | static inline phys_addr_t per_cpu_ptr_to_phys(void *addr) | ||
160 | { | ||
161 | return __pa(addr); | ||
162 | } | ||
163 | |||
182 | static inline void __init setup_per_cpu_areas(void) { } | 164 | static inline void __init setup_per_cpu_areas(void) { } |
183 | 165 | ||
184 | static inline void *pcpu_lpage_remapped(void *kaddr) | 166 | static inline void *pcpu_lpage_remapped(void *kaddr) |
@@ -188,8 +170,8 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
188 | 170 | ||
189 | #endif /* CONFIG_SMP */ | 171 | #endif /* CONFIG_SMP */ |
190 | 172 | ||
191 | #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ | 173 | #define alloc_percpu(type) \ |
192 | __alignof__(type)) | 174 | (typeof(type) *)__alloc_percpu(sizeof(type), __alignof__(type)) |
193 | 175 | ||
194 | /* | 176 | /* |
195 | * Optional methods for optimized non-lvalue per-cpu variable access. | 177 | * Optional methods for optimized non-lvalue per-cpu variable access. |
@@ -243,4 +225,404 @@ do { \ | |||
243 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) | 225 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) |
244 | #endif | 226 | #endif |
245 | 227 | ||
228 | /* | ||
229 | * Branching function to split up a function into a set of functions that | ||
230 | * are called for different scalar sizes of the objects handled. | ||
231 | */ | ||
232 | |||
233 | extern void __bad_size_call_parameter(void); | ||
234 | |||
235 | #define __pcpu_size_call_return(stem, variable) \ | ||
236 | ({ typeof(variable) pscr_ret__; \ | ||
237 | switch(sizeof(variable)) { \ | ||
238 | case 1: pscr_ret__ = stem##1(variable);break; \ | ||
239 | case 2: pscr_ret__ = stem##2(variable);break; \ | ||
240 | case 4: pscr_ret__ = stem##4(variable);break; \ | ||
241 | case 8: pscr_ret__ = stem##8(variable);break; \ | ||
242 | default: \ | ||
243 | __bad_size_call_parameter();break; \ | ||
244 | } \ | ||
245 | pscr_ret__; \ | ||
246 | }) | ||
247 | |||
248 | #define __pcpu_size_call(stem, variable, ...) \ | ||
249 | do { \ | ||
250 | switch(sizeof(variable)) { \ | ||
251 | case 1: stem##1(variable, __VA_ARGS__);break; \ | ||
252 | case 2: stem##2(variable, __VA_ARGS__);break; \ | ||
253 | case 4: stem##4(variable, __VA_ARGS__);break; \ | ||
254 | case 8: stem##8(variable, __VA_ARGS__);break; \ | ||
255 | default: \ | ||
256 | __bad_size_call_parameter();break; \ | ||
257 | } \ | ||
258 | } while (0) | ||
259 | |||
260 | /* | ||
261 | * Optimized manipulation for memory allocated through the per cpu | ||
262 | * allocator or for addresses of per cpu variables (can be determined | ||
263 | * using per_cpu_var(xx). | ||
264 | * | ||
265 | * These operation guarantee exclusivity of access for other operations | ||
266 | * on the *same* processor. The assumption is that per cpu data is only | ||
267 | * accessed by a single processor instance (the current one). | ||
268 | * | ||
269 | * The first group is used for accesses that must be done in a | ||
270 | * preemption safe way since we know that the context is not preempt | ||
271 | * safe. Interrupts may occur. If the interrupt modifies the variable | ||
272 | * too then RMW actions will not be reliable. | ||
273 | * | ||
274 | * The arch code can provide optimized functions in two ways: | ||
275 | * | ||
276 | * 1. Override the function completely. F.e. define this_cpu_add(). | ||
277 | * The arch must then ensure that the various scalar format passed | ||
278 | * are handled correctly. | ||
279 | * | ||
280 | * 2. Provide functions for certain scalar sizes. F.e. provide | ||
281 | * this_cpu_add_2() to provide per cpu atomic operations for 2 byte | ||
282 | * sized RMW actions. If arch code does not provide operations for | ||
283 | * a scalar size then the fallback in the generic code will be | ||
284 | * used. | ||
285 | */ | ||
286 | |||
287 | #define _this_cpu_generic_read(pcp) \ | ||
288 | ({ typeof(pcp) ret__; \ | ||
289 | preempt_disable(); \ | ||
290 | ret__ = *this_cpu_ptr(&(pcp)); \ | ||
291 | preempt_enable(); \ | ||
292 | ret__; \ | ||
293 | }) | ||
294 | |||
295 | #ifndef this_cpu_read | ||
296 | # ifndef this_cpu_read_1 | ||
297 | # define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp) | ||
298 | # endif | ||
299 | # ifndef this_cpu_read_2 | ||
300 | # define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp) | ||
301 | # endif | ||
302 | # ifndef this_cpu_read_4 | ||
303 | # define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp) | ||
304 | # endif | ||
305 | # ifndef this_cpu_read_8 | ||
306 | # define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp) | ||
307 | # endif | ||
308 | # define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp)) | ||
309 | #endif | ||
310 | |||
311 | #define _this_cpu_generic_to_op(pcp, val, op) \ | ||
312 | do { \ | ||
313 | preempt_disable(); \ | ||
314 | *__this_cpu_ptr(&pcp) op val; \ | ||
315 | preempt_enable(); \ | ||
316 | } while (0) | ||
317 | |||
318 | #ifndef this_cpu_write | ||
319 | # ifndef this_cpu_write_1 | ||
320 | # define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
321 | # endif | ||
322 | # ifndef this_cpu_write_2 | ||
323 | # define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
324 | # endif | ||
325 | # ifndef this_cpu_write_4 | ||
326 | # define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
327 | # endif | ||
328 | # ifndef this_cpu_write_8 | ||
329 | # define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =) | ||
330 | # endif | ||
331 | # define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val)) | ||
332 | #endif | ||
333 | |||
334 | #ifndef this_cpu_add | ||
335 | # ifndef this_cpu_add_1 | ||
336 | # define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
337 | # endif | ||
338 | # ifndef this_cpu_add_2 | ||
339 | # define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
340 | # endif | ||
341 | # ifndef this_cpu_add_4 | ||
342 | # define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
343 | # endif | ||
344 | # ifndef this_cpu_add_8 | ||
345 | # define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=) | ||
346 | # endif | ||
347 | # define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val)) | ||
348 | #endif | ||
349 | |||
350 | #ifndef this_cpu_sub | ||
351 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) | ||
352 | #endif | ||
353 | |||
354 | #ifndef this_cpu_inc | ||
355 | # define this_cpu_inc(pcp) this_cpu_add((pcp), 1) | ||
356 | #endif | ||
357 | |||
358 | #ifndef this_cpu_dec | ||
359 | # define this_cpu_dec(pcp) this_cpu_sub((pcp), 1) | ||
360 | #endif | ||
361 | |||
362 | #ifndef this_cpu_and | ||
363 | # ifndef this_cpu_and_1 | ||
364 | # define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
365 | # endif | ||
366 | # ifndef this_cpu_and_2 | ||
367 | # define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
368 | # endif | ||
369 | # ifndef this_cpu_and_4 | ||
370 | # define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
371 | # endif | ||
372 | # ifndef this_cpu_and_8 | ||
373 | # define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=) | ||
374 | # endif | ||
375 | # define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val)) | ||
376 | #endif | ||
377 | |||
378 | #ifndef this_cpu_or | ||
379 | # ifndef this_cpu_or_1 | ||
380 | # define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
381 | # endif | ||
382 | # ifndef this_cpu_or_2 | ||
383 | # define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
384 | # endif | ||
385 | # ifndef this_cpu_or_4 | ||
386 | # define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
387 | # endif | ||
388 | # ifndef this_cpu_or_8 | ||
389 | # define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=) | ||
390 | # endif | ||
391 | # define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) | ||
392 | #endif | ||
393 | |||
394 | #ifndef this_cpu_xor | ||
395 | # ifndef this_cpu_xor_1 | ||
396 | # define this_cpu_xor_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
397 | # endif | ||
398 | # ifndef this_cpu_xor_2 | ||
399 | # define this_cpu_xor_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
400 | # endif | ||
401 | # ifndef this_cpu_xor_4 | ||
402 | # define this_cpu_xor_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
403 | # endif | ||
404 | # ifndef this_cpu_xor_8 | ||
405 | # define this_cpu_xor_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), ^=) | ||
406 | # endif | ||
407 | # define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) | ||
408 | #endif | ||
409 | |||
410 | /* | ||
411 | * Generic percpu operations that do not require preemption handling. | ||
412 | * Either we do not care about races or the caller has the | ||
413 | * responsibility of handling preemptions issues. Arch code can still | ||
414 | * override these instructions since the arch per cpu code may be more | ||
415 | * efficient and may actually get race freeness for free (that is the | ||
416 | * case for x86 for example). | ||
417 | * | ||
418 | * If there is no other protection through preempt disable and/or | ||
419 | * disabling interupts then one of these RMW operations can show unexpected | ||
420 | * behavior because the execution thread was rescheduled on another processor | ||
421 | * or an interrupt occurred and the same percpu variable was modified from | ||
422 | * the interrupt context. | ||
423 | */ | ||
424 | #ifndef __this_cpu_read | ||
425 | # ifndef __this_cpu_read_1 | ||
426 | # define __this_cpu_read_1(pcp) (*__this_cpu_ptr(&(pcp))) | ||
427 | # endif | ||
428 | # ifndef __this_cpu_read_2 | ||
429 | # define __this_cpu_read_2(pcp) (*__this_cpu_ptr(&(pcp))) | ||
430 | # endif | ||
431 | # ifndef __this_cpu_read_4 | ||
432 | # define __this_cpu_read_4(pcp) (*__this_cpu_ptr(&(pcp))) | ||
433 | # endif | ||
434 | # ifndef __this_cpu_read_8 | ||
435 | # define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) | ||
436 | # endif | ||
437 | # define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp)) | ||
438 | #endif | ||
439 | |||
440 | #define __this_cpu_generic_to_op(pcp, val, op) \ | ||
441 | do { \ | ||
442 | *__this_cpu_ptr(&(pcp)) op val; \ | ||
443 | } while (0) | ||
444 | |||
445 | #ifndef __this_cpu_write | ||
446 | # ifndef __this_cpu_write_1 | ||
447 | # define __this_cpu_write_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
448 | # endif | ||
449 | # ifndef __this_cpu_write_2 | ||
450 | # define __this_cpu_write_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
451 | # endif | ||
452 | # ifndef __this_cpu_write_4 | ||
453 | # define __this_cpu_write_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
454 | # endif | ||
455 | # ifndef __this_cpu_write_8 | ||
456 | # define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) | ||
457 | # endif | ||
458 | # define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val)) | ||
459 | #endif | ||
460 | |||
461 | #ifndef __this_cpu_add | ||
462 | # ifndef __this_cpu_add_1 | ||
463 | # define __this_cpu_add_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
464 | # endif | ||
465 | # ifndef __this_cpu_add_2 | ||
466 | # define __this_cpu_add_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
467 | # endif | ||
468 | # ifndef __this_cpu_add_4 | ||
469 | # define __this_cpu_add_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
470 | # endif | ||
471 | # ifndef __this_cpu_add_8 | ||
472 | # define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) | ||
473 | # endif | ||
474 | # define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val)) | ||
475 | #endif | ||
476 | |||
477 | #ifndef __this_cpu_sub | ||
478 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) | ||
479 | #endif | ||
480 | |||
481 | #ifndef __this_cpu_inc | ||
482 | # define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) | ||
483 | #endif | ||
484 | |||
485 | #ifndef __this_cpu_dec | ||
486 | # define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) | ||
487 | #endif | ||
488 | |||
489 | #ifndef __this_cpu_and | ||
490 | # ifndef __this_cpu_and_1 | ||
491 | # define __this_cpu_and_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
492 | # endif | ||
493 | # ifndef __this_cpu_and_2 | ||
494 | # define __this_cpu_and_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
495 | # endif | ||
496 | # ifndef __this_cpu_and_4 | ||
497 | # define __this_cpu_and_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
498 | # endif | ||
499 | # ifndef __this_cpu_and_8 | ||
500 | # define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) | ||
501 | # endif | ||
502 | # define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val)) | ||
503 | #endif | ||
504 | |||
505 | #ifndef __this_cpu_or | ||
506 | # ifndef __this_cpu_or_1 | ||
507 | # define __this_cpu_or_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
508 | # endif | ||
509 | # ifndef __this_cpu_or_2 | ||
510 | # define __this_cpu_or_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
511 | # endif | ||
512 | # ifndef __this_cpu_or_4 | ||
513 | # define __this_cpu_or_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
514 | # endif | ||
515 | # ifndef __this_cpu_or_8 | ||
516 | # define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) | ||
517 | # endif | ||
518 | # define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) | ||
519 | #endif | ||
520 | |||
521 | #ifndef __this_cpu_xor | ||
522 | # ifndef __this_cpu_xor_1 | ||
523 | # define __this_cpu_xor_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
524 | # endif | ||
525 | # ifndef __this_cpu_xor_2 | ||
526 | # define __this_cpu_xor_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
527 | # endif | ||
528 | # ifndef __this_cpu_xor_4 | ||
529 | # define __this_cpu_xor_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
530 | # endif | ||
531 | # ifndef __this_cpu_xor_8 | ||
532 | # define __this_cpu_xor_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), ^=) | ||
533 | # endif | ||
534 | # define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val)) | ||
535 | #endif | ||
536 | |||
537 | /* | ||
538 | * IRQ safe versions of the per cpu RMW operations. Note that these operations | ||
539 | * are *not* safe against modification of the same variable from another | ||
540 | * processors (which one gets when using regular atomic operations) | ||
541 | . They are guaranteed to be atomic vs. local interrupts and | ||
542 | * preemption only. | ||
543 | */ | ||
544 | #define irqsafe_cpu_generic_to_op(pcp, val, op) \ | ||
545 | do { \ | ||
546 | unsigned long flags; \ | ||
547 | local_irq_save(flags); \ | ||
548 | *__this_cpu_ptr(&(pcp)) op val; \ | ||
549 | local_irq_restore(flags); \ | ||
550 | } while (0) | ||
551 | |||
552 | #ifndef irqsafe_cpu_add | ||
553 | # ifndef irqsafe_cpu_add_1 | ||
554 | # define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
555 | # endif | ||
556 | # ifndef irqsafe_cpu_add_2 | ||
557 | # define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
558 | # endif | ||
559 | # ifndef irqsafe_cpu_add_4 | ||
560 | # define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
561 | # endif | ||
562 | # ifndef irqsafe_cpu_add_8 | ||
563 | # define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=) | ||
564 | # endif | ||
565 | # define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val)) | ||
566 | #endif | ||
567 | |||
568 | #ifndef irqsafe_cpu_sub | ||
569 | # define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val)) | ||
570 | #endif | ||
571 | |||
572 | #ifndef irqsafe_cpu_inc | ||
573 | # define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1) | ||
574 | #endif | ||
575 | |||
576 | #ifndef irqsafe_cpu_dec | ||
577 | # define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1) | ||
578 | #endif | ||
579 | |||
580 | #ifndef irqsafe_cpu_and | ||
581 | # ifndef irqsafe_cpu_and_1 | ||
582 | # define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
583 | # endif | ||
584 | # ifndef irqsafe_cpu_and_2 | ||
585 | # define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
586 | # endif | ||
587 | # ifndef irqsafe_cpu_and_4 | ||
588 | # define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
589 | # endif | ||
590 | # ifndef irqsafe_cpu_and_8 | ||
591 | # define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=) | ||
592 | # endif | ||
593 | # define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val)) | ||
594 | #endif | ||
595 | |||
596 | #ifndef irqsafe_cpu_or | ||
597 | # ifndef irqsafe_cpu_or_1 | ||
598 | # define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
599 | # endif | ||
600 | # ifndef irqsafe_cpu_or_2 | ||
601 | # define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
602 | # endif | ||
603 | # ifndef irqsafe_cpu_or_4 | ||
604 | # define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
605 | # endif | ||
606 | # ifndef irqsafe_cpu_or_8 | ||
607 | # define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=) | ||
608 | # endif | ||
609 | # define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val)) | ||
610 | #endif | ||
611 | |||
612 | #ifndef irqsafe_cpu_xor | ||
613 | # ifndef irqsafe_cpu_xor_1 | ||
614 | # define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
615 | # endif | ||
616 | # ifndef irqsafe_cpu_xor_2 | ||
617 | # define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
618 | # endif | ||
619 | # ifndef irqsafe_cpu_xor_4 | ||
620 | # define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
621 | # endif | ||
622 | # ifndef irqsafe_cpu_xor_8 | ||
623 | # define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=) | ||
624 | # endif | ||
625 | # define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val)) | ||
626 | #endif | ||
627 | |||
246 | #endif /* __LINUX_PERCPU_H */ | 628 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h deleted file mode 100644 index e3fb25606706..000000000000 --- a/include/linux/perf_counter.h +++ /dev/null | |||
@@ -1,444 +0,0 @@ | |||
1 | /* | ||
2 | * NOTE: this file will be removed in a future kernel release, it is | ||
3 | * provided as a courtesy copy of user-space code that relies on the | ||
4 | * old (pre-rename) symbols and constants. | ||
5 | * | ||
6 | * Performance events: | ||
7 | * | ||
8 | * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> | ||
9 | * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar | ||
10 | * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra | ||
11 | * | ||
12 | * Data type definitions, declarations, prototypes. | ||
13 | * | ||
14 | * Started by: Thomas Gleixner and Ingo Molnar | ||
15 | * | ||
16 | * For licencing details see kernel-base/COPYING | ||
17 | */ | ||
18 | #ifndef _LINUX_PERF_COUNTER_H | ||
19 | #define _LINUX_PERF_COUNTER_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/ioctl.h> | ||
23 | #include <asm/byteorder.h> | ||
24 | |||
25 | /* | ||
26 | * User-space ABI bits: | ||
27 | */ | ||
28 | |||
29 | /* | ||
30 | * attr.type | ||
31 | */ | ||
32 | enum perf_type_id { | ||
33 | PERF_TYPE_HARDWARE = 0, | ||
34 | PERF_TYPE_SOFTWARE = 1, | ||
35 | PERF_TYPE_TRACEPOINT = 2, | ||
36 | PERF_TYPE_HW_CACHE = 3, | ||
37 | PERF_TYPE_RAW = 4, | ||
38 | |||
39 | PERF_TYPE_MAX, /* non-ABI */ | ||
40 | }; | ||
41 | |||
42 | /* | ||
43 | * Generalized performance counter event types, used by the | ||
44 | * attr.event_id parameter of the sys_perf_counter_open() | ||
45 | * syscall: | ||
46 | */ | ||
47 | enum perf_hw_id { | ||
48 | /* | ||
49 | * Common hardware events, generalized by the kernel: | ||
50 | */ | ||
51 | PERF_COUNT_HW_CPU_CYCLES = 0, | ||
52 | PERF_COUNT_HW_INSTRUCTIONS = 1, | ||
53 | PERF_COUNT_HW_CACHE_REFERENCES = 2, | ||
54 | PERF_COUNT_HW_CACHE_MISSES = 3, | ||
55 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, | ||
56 | PERF_COUNT_HW_BRANCH_MISSES = 5, | ||
57 | PERF_COUNT_HW_BUS_CYCLES = 6, | ||
58 | |||
59 | PERF_COUNT_HW_MAX, /* non-ABI */ | ||
60 | }; | ||
61 | |||
62 | /* | ||
63 | * Generalized hardware cache counters: | ||
64 | * | ||
65 | * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x | ||
66 | * { read, write, prefetch } x | ||
67 | * { accesses, misses } | ||
68 | */ | ||
69 | enum perf_hw_cache_id { | ||
70 | PERF_COUNT_HW_CACHE_L1D = 0, | ||
71 | PERF_COUNT_HW_CACHE_L1I = 1, | ||
72 | PERF_COUNT_HW_CACHE_LL = 2, | ||
73 | PERF_COUNT_HW_CACHE_DTLB = 3, | ||
74 | PERF_COUNT_HW_CACHE_ITLB = 4, | ||
75 | PERF_COUNT_HW_CACHE_BPU = 5, | ||
76 | |||
77 | PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ | ||
78 | }; | ||
79 | |||
80 | enum perf_hw_cache_op_id { | ||
81 | PERF_COUNT_HW_CACHE_OP_READ = 0, | ||
82 | PERF_COUNT_HW_CACHE_OP_WRITE = 1, | ||
83 | PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, | ||
84 | |||
85 | PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ | ||
86 | }; | ||
87 | |||
88 | enum perf_hw_cache_op_result_id { | ||
89 | PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, | ||
90 | PERF_COUNT_HW_CACHE_RESULT_MISS = 1, | ||
91 | |||
92 | PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ | ||
93 | }; | ||
94 | |||
95 | /* | ||
96 | * Special "software" counters provided by the kernel, even if the hardware | ||
97 | * does not support performance counters. These counters measure various | ||
98 | * physical and sw events of the kernel (and allow the profiling of them as | ||
99 | * well): | ||
100 | */ | ||
101 | enum perf_sw_ids { | ||
102 | PERF_COUNT_SW_CPU_CLOCK = 0, | ||
103 | PERF_COUNT_SW_TASK_CLOCK = 1, | ||
104 | PERF_COUNT_SW_PAGE_FAULTS = 2, | ||
105 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, | ||
106 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | ||
107 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | ||
108 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | ||
109 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
110 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
111 | |||
112 | PERF_COUNT_SW_MAX, /* non-ABI */ | ||
113 | }; | ||
114 | |||
115 | /* | ||
116 | * Bits that can be set in attr.sample_type to request information | ||
117 | * in the overflow packets. | ||
118 | */ | ||
119 | enum perf_counter_sample_format { | ||
120 | PERF_SAMPLE_IP = 1U << 0, | ||
121 | PERF_SAMPLE_TID = 1U << 1, | ||
122 | PERF_SAMPLE_TIME = 1U << 2, | ||
123 | PERF_SAMPLE_ADDR = 1U << 3, | ||
124 | PERF_SAMPLE_READ = 1U << 4, | ||
125 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | ||
126 | PERF_SAMPLE_ID = 1U << 6, | ||
127 | PERF_SAMPLE_CPU = 1U << 7, | ||
128 | PERF_SAMPLE_PERIOD = 1U << 8, | ||
129 | PERF_SAMPLE_STREAM_ID = 1U << 9, | ||
130 | PERF_SAMPLE_RAW = 1U << 10, | ||
131 | |||
132 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | ||
133 | }; | ||
134 | |||
135 | /* | ||
136 | * The format of the data returned by read() on a perf counter fd, | ||
137 | * as specified by attr.read_format: | ||
138 | * | ||
139 | * struct read_format { | ||
140 | * { u64 value; | ||
141 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
142 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
143 | * { u64 id; } && PERF_FORMAT_ID | ||
144 | * } && !PERF_FORMAT_GROUP | ||
145 | * | ||
146 | * { u64 nr; | ||
147 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
148 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
149 | * { u64 value; | ||
150 | * { u64 id; } && PERF_FORMAT_ID | ||
151 | * } cntr[nr]; | ||
152 | * } && PERF_FORMAT_GROUP | ||
153 | * }; | ||
154 | */ | ||
155 | enum perf_counter_read_format { | ||
156 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | ||
157 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | ||
158 | PERF_FORMAT_ID = 1U << 2, | ||
159 | PERF_FORMAT_GROUP = 1U << 3, | ||
160 | |||
161 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ | ||
162 | }; | ||
163 | |||
164 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | ||
165 | |||
166 | /* | ||
167 | * Hardware event to monitor via a performance monitoring counter: | ||
168 | */ | ||
169 | struct perf_counter_attr { | ||
170 | |||
171 | /* | ||
172 | * Major type: hardware/software/tracepoint/etc. | ||
173 | */ | ||
174 | __u32 type; | ||
175 | |||
176 | /* | ||
177 | * Size of the attr structure, for fwd/bwd compat. | ||
178 | */ | ||
179 | __u32 size; | ||
180 | |||
181 | /* | ||
182 | * Type specific configuration information. | ||
183 | */ | ||
184 | __u64 config; | ||
185 | |||
186 | union { | ||
187 | __u64 sample_period; | ||
188 | __u64 sample_freq; | ||
189 | }; | ||
190 | |||
191 | __u64 sample_type; | ||
192 | __u64 read_format; | ||
193 | |||
194 | __u64 disabled : 1, /* off by default */ | ||
195 | inherit : 1, /* children inherit it */ | ||
196 | pinned : 1, /* must always be on PMU */ | ||
197 | exclusive : 1, /* only group on PMU */ | ||
198 | exclude_user : 1, /* don't count user */ | ||
199 | exclude_kernel : 1, /* ditto kernel */ | ||
200 | exclude_hv : 1, /* ditto hypervisor */ | ||
201 | exclude_idle : 1, /* don't count when idle */ | ||
202 | mmap : 1, /* include mmap data */ | ||
203 | comm : 1, /* include comm data */ | ||
204 | freq : 1, /* use freq, not period */ | ||
205 | inherit_stat : 1, /* per task counts */ | ||
206 | enable_on_exec : 1, /* next exec enables */ | ||
207 | task : 1, /* trace fork/exit */ | ||
208 | watermark : 1, /* wakeup_watermark */ | ||
209 | |||
210 | __reserved_1 : 49; | ||
211 | |||
212 | union { | ||
213 | __u32 wakeup_events; /* wakeup every n events */ | ||
214 | __u32 wakeup_watermark; /* bytes before wakeup */ | ||
215 | }; | ||
216 | __u32 __reserved_2; | ||
217 | |||
218 | __u64 __reserved_3; | ||
219 | }; | ||
220 | |||
221 | /* | ||
222 | * Ioctls that can be done on a perf counter fd: | ||
223 | */ | ||
224 | #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0) | ||
225 | #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1) | ||
226 | #define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) | ||
227 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) | ||
228 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) | ||
229 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) | ||
230 | #define PERF_COUNTER_IOC_SET_FILTER _IOW('$', 6, char *) | ||
231 | |||
232 | enum perf_counter_ioc_flags { | ||
233 | PERF_IOC_FLAG_GROUP = 1U << 0, | ||
234 | }; | ||
235 | |||
236 | /* | ||
237 | * Structure of the page that can be mapped via mmap | ||
238 | */ | ||
239 | struct perf_counter_mmap_page { | ||
240 | __u32 version; /* version number of this structure */ | ||
241 | __u32 compat_version; /* lowest version this is compat with */ | ||
242 | |||
243 | /* | ||
244 | * Bits needed to read the hw counters in user-space. | ||
245 | * | ||
246 | * u32 seq; | ||
247 | * s64 count; | ||
248 | * | ||
249 | * do { | ||
250 | * seq = pc->lock; | ||
251 | * | ||
252 | * barrier() | ||
253 | * if (pc->index) { | ||
254 | * count = pmc_read(pc->index - 1); | ||
255 | * count += pc->offset; | ||
256 | * } else | ||
257 | * goto regular_read; | ||
258 | * | ||
259 | * barrier(); | ||
260 | * } while (pc->lock != seq); | ||
261 | * | ||
262 | * NOTE: for obvious reason this only works on self-monitoring | ||
263 | * processes. | ||
264 | */ | ||
265 | __u32 lock; /* seqlock for synchronization */ | ||
266 | __u32 index; /* hardware counter identifier */ | ||
267 | __s64 offset; /* add to hardware counter value */ | ||
268 | __u64 time_enabled; /* time counter active */ | ||
269 | __u64 time_running; /* time counter on cpu */ | ||
270 | |||
271 | /* | ||
272 | * Hole for extension of the self monitor capabilities | ||
273 | */ | ||
274 | |||
275 | __u64 __reserved[123]; /* align to 1k */ | ||
276 | |||
277 | /* | ||
278 | * Control data for the mmap() data buffer. | ||
279 | * | ||
280 | * User-space reading the @data_head value should issue an rmb(), on | ||
281 | * SMP capable platforms, after reading this value -- see | ||
282 | * perf_counter_wakeup(). | ||
283 | * | ||
284 | * When the mapping is PROT_WRITE the @data_tail value should be | ||
285 | * written by userspace to reflect the last read data. In this case | ||
286 | * the kernel will not over-write unread data. | ||
287 | */ | ||
288 | __u64 data_head; /* head in the data section */ | ||
289 | __u64 data_tail; /* user-space written tail */ | ||
290 | }; | ||
291 | |||
292 | #define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0) | ||
293 | #define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0) | ||
294 | #define PERF_EVENT_MISC_KERNEL (1 << 0) | ||
295 | #define PERF_EVENT_MISC_USER (2 << 0) | ||
296 | #define PERF_EVENT_MISC_HYPERVISOR (3 << 0) | ||
297 | |||
298 | struct perf_event_header { | ||
299 | __u32 type; | ||
300 | __u16 misc; | ||
301 | __u16 size; | ||
302 | }; | ||
303 | |||
304 | enum perf_event_type { | ||
305 | |||
306 | /* | ||
307 | * The MMAP events record the PROT_EXEC mappings so that we can | ||
308 | * correlate userspace IPs to code. They have the following structure: | ||
309 | * | ||
310 | * struct { | ||
311 | * struct perf_event_header header; | ||
312 | * | ||
313 | * u32 pid, tid; | ||
314 | * u64 addr; | ||
315 | * u64 len; | ||
316 | * u64 pgoff; | ||
317 | * char filename[]; | ||
318 | * }; | ||
319 | */ | ||
320 | PERF_EVENT_MMAP = 1, | ||
321 | |||
322 | /* | ||
323 | * struct { | ||
324 | * struct perf_event_header header; | ||
325 | * u64 id; | ||
326 | * u64 lost; | ||
327 | * }; | ||
328 | */ | ||
329 | PERF_EVENT_LOST = 2, | ||
330 | |||
331 | /* | ||
332 | * struct { | ||
333 | * struct perf_event_header header; | ||
334 | * | ||
335 | * u32 pid, tid; | ||
336 | * char comm[]; | ||
337 | * }; | ||
338 | */ | ||
339 | PERF_EVENT_COMM = 3, | ||
340 | |||
341 | /* | ||
342 | * struct { | ||
343 | * struct perf_event_header header; | ||
344 | * u32 pid, ppid; | ||
345 | * u32 tid, ptid; | ||
346 | * u64 time; | ||
347 | * }; | ||
348 | */ | ||
349 | PERF_EVENT_EXIT = 4, | ||
350 | |||
351 | /* | ||
352 | * struct { | ||
353 | * struct perf_event_header header; | ||
354 | * u64 time; | ||
355 | * u64 id; | ||
356 | * u64 stream_id; | ||
357 | * }; | ||
358 | */ | ||
359 | PERF_EVENT_THROTTLE = 5, | ||
360 | PERF_EVENT_UNTHROTTLE = 6, | ||
361 | |||
362 | /* | ||
363 | * struct { | ||
364 | * struct perf_event_header header; | ||
365 | * u32 pid, ppid; | ||
366 | * u32 tid, ptid; | ||
367 | * u64 time; | ||
368 | * }; | ||
369 | */ | ||
370 | PERF_EVENT_FORK = 7, | ||
371 | |||
372 | /* | ||
373 | * struct { | ||
374 | * struct perf_event_header header; | ||
375 | * u32 pid, tid; | ||
376 | * | ||
377 | * struct read_format values; | ||
378 | * }; | ||
379 | */ | ||
380 | PERF_EVENT_READ = 8, | ||
381 | |||
382 | /* | ||
383 | * struct { | ||
384 | * struct perf_event_header header; | ||
385 | * | ||
386 | * { u64 ip; } && PERF_SAMPLE_IP | ||
387 | * { u32 pid, tid; } && PERF_SAMPLE_TID | ||
388 | * { u64 time; } && PERF_SAMPLE_TIME | ||
389 | * { u64 addr; } && PERF_SAMPLE_ADDR | ||
390 | * { u64 id; } && PERF_SAMPLE_ID | ||
391 | * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID | ||
392 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | ||
393 | * { u64 period; } && PERF_SAMPLE_PERIOD | ||
394 | * | ||
395 | * { struct read_format values; } && PERF_SAMPLE_READ | ||
396 | * | ||
397 | * { u64 nr, | ||
398 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | ||
399 | * | ||
400 | * # | ||
401 | * # The RAW record below is opaque data wrt the ABI | ||
402 | * # | ||
403 | * # That is, the ABI doesn't make any promises wrt to | ||
404 | * # the stability of its content, it may vary depending | ||
405 | * # on event, hardware, kernel version and phase of | ||
406 | * # the moon. | ||
407 | * # | ||
408 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
409 | * # | ||
410 | * | ||
411 | * { u32 size; | ||
412 | * char data[size];}&& PERF_SAMPLE_RAW | ||
413 | * }; | ||
414 | */ | ||
415 | PERF_EVENT_SAMPLE = 9, | ||
416 | |||
417 | PERF_EVENT_MAX, /* non-ABI */ | ||
418 | }; | ||
419 | |||
420 | enum perf_callchain_context { | ||
421 | PERF_CONTEXT_HV = (__u64)-32, | ||
422 | PERF_CONTEXT_KERNEL = (__u64)-128, | ||
423 | PERF_CONTEXT_USER = (__u64)-512, | ||
424 | |||
425 | PERF_CONTEXT_GUEST = (__u64)-2048, | ||
426 | PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, | ||
427 | PERF_CONTEXT_GUEST_USER = (__u64)-2560, | ||
428 | |||
429 | PERF_CONTEXT_MAX = (__u64)-4095, | ||
430 | }; | ||
431 | |||
432 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | ||
433 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | ||
434 | |||
435 | /* | ||
436 | * In case some app still references the old symbols: | ||
437 | */ | ||
438 | |||
439 | #define __NR_perf_counter_open __NR_perf_event_open | ||
440 | |||
441 | #define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE | ||
442 | #define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE | ||
443 | |||
444 | #endif /* _LINUX_PERF_COUNTER_H */ | ||
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 43adbd7f0010..a177698d95e2 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -18,10 +18,6 @@ | |||
18 | #include <linux/ioctl.h> | 18 | #include <linux/ioctl.h> |
19 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
20 | 20 | ||
21 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
22 | #include <asm/hw_breakpoint.h> | ||
23 | #endif | ||
24 | |||
25 | /* | 21 | /* |
26 | * User-space ABI bits: | 22 | * User-space ABI bits: |
27 | */ | 23 | */ |
@@ -215,17 +211,9 @@ struct perf_event_attr { | |||
215 | __u32 wakeup_watermark; /* bytes before wakeup */ | 211 | __u32 wakeup_watermark; /* bytes before wakeup */ |
216 | }; | 212 | }; |
217 | 213 | ||
218 | union { | 214 | __u32 bp_type; |
219 | struct { /* Hardware breakpoint info */ | 215 | __u64 bp_addr; |
220 | __u64 bp_addr; | 216 | __u64 bp_len; |
221 | __u32 bp_type; | ||
222 | __u32 bp_len; | ||
223 | }; | ||
224 | }; | ||
225 | |||
226 | __u32 __reserved_2; | ||
227 | |||
228 | __u64 __reserved_3; | ||
229 | }; | 217 | }; |
230 | 218 | ||
231 | /* | 219 | /* |
@@ -451,6 +439,10 @@ enum perf_callchain_context { | |||
451 | # include <asm/perf_event.h> | 439 | # include <asm/perf_event.h> |
452 | #endif | 440 | #endif |
453 | 441 | ||
442 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
443 | #include <asm/hw_breakpoint.h> | ||
444 | #endif | ||
445 | |||
454 | #include <linux/list.h> | 446 | #include <linux/list.h> |
455 | #include <linux/mutex.h> | 447 | #include <linux/mutex.h> |
456 | #include <linux/rculist.h> | 448 | #include <linux/rculist.h> |
@@ -565,10 +557,12 @@ struct perf_pending_entry { | |||
565 | void (*func)(struct perf_pending_entry *); | 557 | void (*func)(struct perf_pending_entry *); |
566 | }; | 558 | }; |
567 | 559 | ||
568 | typedef void (*perf_callback_t)(struct perf_event *, void *); | ||
569 | |||
570 | struct perf_sample_data; | 560 | struct perf_sample_data; |
571 | 561 | ||
562 | typedef void (*perf_overflow_handler_t)(struct perf_event *, int, | ||
563 | struct perf_sample_data *, | ||
564 | struct pt_regs *regs); | ||
565 | |||
572 | /** | 566 | /** |
573 | * struct perf_event - performance event kernel representation: | 567 | * struct perf_event - performance event kernel representation: |
574 | */ | 568 | */ |
@@ -660,18 +654,12 @@ struct perf_event { | |||
660 | struct pid_namespace *ns; | 654 | struct pid_namespace *ns; |
661 | u64 id; | 655 | u64 id; |
662 | 656 | ||
663 | void (*overflow_handler)(struct perf_event *event, | 657 | perf_overflow_handler_t overflow_handler; |
664 | int nmi, struct perf_sample_data *data, | ||
665 | struct pt_regs *regs); | ||
666 | 658 | ||
667 | #ifdef CONFIG_EVENT_PROFILE | 659 | #ifdef CONFIG_EVENT_PROFILE |
668 | struct event_filter *filter; | 660 | struct event_filter *filter; |
669 | #endif | 661 | #endif |
670 | 662 | ||
671 | perf_callback_t callback; | ||
672 | |||
673 | perf_callback_t event_callback; | ||
674 | |||
675 | #endif /* CONFIG_PERF_EVENTS */ | 663 | #endif /* CONFIG_PERF_EVENTS */ |
676 | }; | 664 | }; |
677 | 665 | ||
@@ -685,7 +673,7 @@ struct perf_event_context { | |||
685 | * Protect the states of the events in the list, | 673 | * Protect the states of the events in the list, |
686 | * nr_active, and the list: | 674 | * nr_active, and the list: |
687 | */ | 675 | */ |
688 | spinlock_t lock; | 676 | raw_spinlock_t lock; |
689 | /* | 677 | /* |
690 | * Protect the list of events. Locking either mutex or lock | 678 | * Protect the list of events. Locking either mutex or lock |
691 | * is sufficient to ensure the list doesn't change; to change | 679 | * is sufficient to ensure the list doesn't change; to change |
@@ -781,7 +769,7 @@ extern struct perf_event * | |||
781 | perf_event_create_kernel_counter(struct perf_event_attr *attr, | 769 | perf_event_create_kernel_counter(struct perf_event_attr *attr, |
782 | int cpu, | 770 | int cpu, |
783 | pid_t pid, | 771 | pid_t pid, |
784 | perf_callback_t callback); | 772 | perf_overflow_handler_t callback); |
785 | extern u64 perf_event_read_value(struct perf_event *event, | 773 | extern u64 perf_event_read_value(struct perf_event *event, |
786 | u64 *enabled, u64 *running); | 774 | u64 *enabled, u64 *running); |
787 | 775 | ||
@@ -824,9 +812,14 @@ extern int perf_event_overflow(struct perf_event *event, int nmi, | |||
824 | */ | 812 | */ |
825 | static inline int is_software_event(struct perf_event *event) | 813 | static inline int is_software_event(struct perf_event *event) |
826 | { | 814 | { |
827 | return (event->attr.type != PERF_TYPE_RAW) && | 815 | switch (event->attr.type) { |
828 | (event->attr.type != PERF_TYPE_HARDWARE) && | 816 | case PERF_TYPE_SOFTWARE: |
829 | (event->attr.type != PERF_TYPE_HW_CACHE); | 817 | case PERF_TYPE_TRACEPOINT: |
818 | /* for now the breakpoint stuff also works as software event */ | ||
819 | case PERF_TYPE_BREAKPOINT: | ||
820 | return 1; | ||
821 | } | ||
822 | return 0; | ||
830 | } | 823 | } |
831 | 824 | ||
832 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; | 825 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; |
@@ -876,6 +869,8 @@ extern void perf_output_copy(struct perf_output_handle *handle, | |||
876 | const void *buf, unsigned int len); | 869 | const void *buf, unsigned int len); |
877 | extern int perf_swevent_get_recursion_context(void); | 870 | extern int perf_swevent_get_recursion_context(void); |
878 | extern void perf_swevent_put_recursion_context(int rctx); | 871 | extern void perf_swevent_put_recursion_context(int rctx); |
872 | extern void perf_event_enable(struct perf_event *event); | ||
873 | extern void perf_event_disable(struct perf_event *event); | ||
879 | #else | 874 | #else |
880 | static inline void | 875 | static inline void |
881 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } | 876 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } |
@@ -906,7 +901,8 @@ static inline void perf_event_fork(struct task_struct *tsk) { } | |||
906 | static inline void perf_event_init(void) { } | 901 | static inline void perf_event_init(void) { } |
907 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | 902 | static inline int perf_swevent_get_recursion_context(void) { return -1; } |
908 | static inline void perf_swevent_put_recursion_context(int rctx) { } | 903 | static inline void perf_swevent_put_recursion_context(int rctx) { } |
909 | 904 | static inline void perf_event_enable(struct perf_event *event) { } | |
905 | static inline void perf_event_disable(struct perf_event *event) { } | ||
910 | #endif | 906 | #endif |
911 | 907 | ||
912 | #define perf_output_put(handle, x) \ | 908 | #define perf_output_put(handle, x) \ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index b1368b8f6572..14d7fdf6a90a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -447,10 +447,12 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | |||
447 | int phy_device_register(struct phy_device *phy); | 447 | int phy_device_register(struct phy_device *phy); |
448 | int phy_clear_interrupt(struct phy_device *phydev); | 448 | int phy_clear_interrupt(struct phy_device *phydev); |
449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); | 449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); |
450 | int phy_init_hw(struct phy_device *phydev); | ||
450 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | 451 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
451 | u32 flags, phy_interface_t interface); | 452 | u32 flags, phy_interface_t interface); |
452 | struct phy_device * phy_attach(struct net_device *dev, | 453 | struct phy_device * phy_attach(struct net_device *dev, |
453 | const char *bus_id, u32 flags, phy_interface_t interface); | 454 | const char *bus_id, u32 flags, phy_interface_t interface); |
455 | struct phy_device *phy_find_first(struct mii_bus *bus); | ||
454 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, | 456 | int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, |
455 | void (*handler)(struct net_device *), u32 flags, | 457 | void (*handler)(struct net_device *), u32 flags, |
456 | phy_interface_t interface); | 458 | phy_interface_t interface); |
@@ -484,6 +486,7 @@ void phy_driver_unregister(struct phy_driver *drv); | |||
484 | int phy_driver_register(struct phy_driver *new_driver); | 486 | int phy_driver_register(struct phy_driver *new_driver); |
485 | void phy_prepare_link(struct phy_device *phydev, | 487 | void phy_prepare_link(struct phy_device *phydev, |
486 | void (*adjust_link)(struct net_device *)); | 488 | void (*adjust_link)(struct net_device *)); |
489 | void phy_state_machine(struct work_struct *work); | ||
487 | void phy_start_machine(struct phy_device *phydev, | 490 | void phy_start_machine(struct phy_device *phydev, |
488 | void (*handler)(struct net_device *)); | 491 | void (*handler)(struct net_device *)); |
489 | void phy_stop_machine(struct phy_device *phydev); | 492 | void phy_stop_machine(struct phy_device *phydev); |
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index d745f5b6c7b0..76e5053e1fac 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * use drive write caching -- we need deferred error handling to be | 32 | * use drive write caching -- we need deferred error handling to be |
33 | * able to sucessfully recover with this option (drive will return good | 33 | * able to successfully recover with this option (drive will return good |
34 | * status as soon as the cdb is validated). | 34 | * status as soon as the cdb is validated). |
35 | */ | 35 | */ |
36 | #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) | 36 | #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 3c6675c2444b..71ff887ca44e 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -83,6 +83,8 @@ struct early_platform_driver { | |||
83 | struct platform_driver *pdrv; | 83 | struct platform_driver *pdrv; |
84 | struct list_head list; | 84 | struct list_head list; |
85 | int requested_id; | 85 | int requested_id; |
86 | char *buffer; | ||
87 | int bufsize; | ||
86 | }; | 88 | }; |
87 | 89 | ||
88 | #define EARLY_PLATFORM_ID_UNSET -2 | 90 | #define EARLY_PLATFORM_ID_UNSET -2 |
@@ -102,21 +104,29 @@ extern int early_platform_driver_probe(char *class_str, | |||
102 | int nr_probe, int user_only); | 104 | int nr_probe, int user_only); |
103 | extern void early_platform_cleanup(void); | 105 | extern void early_platform_cleanup(void); |
104 | 106 | ||
107 | #define early_platform_init(class_string, platdrv) \ | ||
108 | early_platform_init_buffer(class_string, platdrv, NULL, 0) | ||
105 | 109 | ||
106 | #ifndef MODULE | 110 | #ifndef MODULE |
107 | #define early_platform_init(class_string, platform_driver) \ | 111 | #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ |
108 | static __initdata struct early_platform_driver early_driver = { \ | 112 | static __initdata struct early_platform_driver early_driver = { \ |
109 | .class_str = class_string, \ | 113 | .class_str = class_string, \ |
110 | .pdrv = platform_driver, \ | 114 | .buffer = buf, \ |
115 | .bufsize = bufsiz, \ | ||
116 | .pdrv = platdrv, \ | ||
111 | .requested_id = EARLY_PLATFORM_ID_UNSET, \ | 117 | .requested_id = EARLY_PLATFORM_ID_UNSET, \ |
112 | }; \ | 118 | }; \ |
113 | static int __init early_platform_driver_setup_func(char *buf) \ | 119 | static int __init early_platform_driver_setup_func(char *buffer) \ |
114 | { \ | 120 | { \ |
115 | return early_platform_driver_register(&early_driver, buf); \ | 121 | return early_platform_driver_register(&early_driver, buffer); \ |
116 | } \ | 122 | } \ |
117 | early_param(class_string, early_platform_driver_setup_func) | 123 | early_param(class_string, early_platform_driver_setup_func) |
118 | #else /* MODULE */ | 124 | #else /* MODULE */ |
119 | #define early_platform_init(class_string, platform_driver) | 125 | #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ |
126 | static inline char *early_platform_driver_setup_func(void) \ | ||
127 | { \ | ||
128 | return bufsiz ? buf : NULL; \ | ||
129 | } | ||
120 | #endif /* MODULE */ | 130 | #endif /* MODULE */ |
121 | 131 | ||
122 | #endif /* _PLATFORM_DEVICE_H_ */ | 132 | #endif /* _PLATFORM_DEVICE_H_ */ |
diff --git a/include/linux/plist.h b/include/linux/plist.h index 45926d77d6ac..8227f717c70f 100644 --- a/include/linux/plist.h +++ b/include/linux/plist.h | |||
@@ -81,7 +81,8 @@ struct plist_head { | |||
81 | struct list_head prio_list; | 81 | struct list_head prio_list; |
82 | struct list_head node_list; | 82 | struct list_head node_list; |
83 | #ifdef CONFIG_DEBUG_PI_LIST | 83 | #ifdef CONFIG_DEBUG_PI_LIST |
84 | spinlock_t *lock; | 84 | raw_spinlock_t *rawlock; |
85 | spinlock_t *spinlock; | ||
85 | #endif | 86 | #endif |
86 | }; | 87 | }; |
87 | 88 | ||
@@ -91,9 +92,11 @@ struct plist_node { | |||
91 | }; | 92 | }; |
92 | 93 | ||
93 | #ifdef CONFIG_DEBUG_PI_LIST | 94 | #ifdef CONFIG_DEBUG_PI_LIST |
94 | # define PLIST_HEAD_LOCK_INIT(_lock) .lock = _lock | 95 | # define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock |
96 | # define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock | ||
95 | #else | 97 | #else |
96 | # define PLIST_HEAD_LOCK_INIT(_lock) | 98 | # define PLIST_HEAD_LOCK_INIT(_lock) |
99 | # define PLIST_HEAD_LOCK_INIT_RAW(_lock) | ||
97 | #endif | 100 | #endif |
98 | 101 | ||
99 | #define _PLIST_HEAD_INIT(head) \ | 102 | #define _PLIST_HEAD_INIT(head) \ |
@@ -107,11 +110,22 @@ struct plist_node { | |||
107 | */ | 110 | */ |
108 | #define PLIST_HEAD_INIT(head, _lock) \ | 111 | #define PLIST_HEAD_INIT(head, _lock) \ |
109 | { \ | 112 | { \ |
110 | _PLIST_HEAD_INIT(head), \ | 113 | _PLIST_HEAD_INIT(head), \ |
111 | PLIST_HEAD_LOCK_INIT(&(_lock)) \ | 114 | PLIST_HEAD_LOCK_INIT(&(_lock)) \ |
112 | } | 115 | } |
113 | 116 | ||
114 | /** | 117 | /** |
118 | * PLIST_HEAD_INIT_RAW - static struct plist_head initializer | ||
119 | * @head: struct plist_head variable name | ||
120 | * @_lock: lock to initialize for this list | ||
121 | */ | ||
122 | #define PLIST_HEAD_INIT_RAW(head, _lock) \ | ||
123 | { \ | ||
124 | _PLIST_HEAD_INIT(head), \ | ||
125 | PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \ | ||
126 | } | ||
127 | |||
128 | /** | ||
115 | * PLIST_NODE_INIT - static struct plist_node initializer | 129 | * PLIST_NODE_INIT - static struct plist_node initializer |
116 | * @node: struct plist_node variable name | 130 | * @node: struct plist_node variable name |
117 | * @__prio: initial node priority | 131 | * @__prio: initial node priority |
@@ -119,13 +133,13 @@ struct plist_node { | |||
119 | #define PLIST_NODE_INIT(node, __prio) \ | 133 | #define PLIST_NODE_INIT(node, __prio) \ |
120 | { \ | 134 | { \ |
121 | .prio = (__prio), \ | 135 | .prio = (__prio), \ |
122 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ | 136 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ |
123 | } | 137 | } |
124 | 138 | ||
125 | /** | 139 | /** |
126 | * plist_head_init - dynamic struct plist_head initializer | 140 | * plist_head_init - dynamic struct plist_head initializer |
127 | * @head: &struct plist_head pointer | 141 | * @head: &struct plist_head pointer |
128 | * @lock: list spinlock, remembered for debugging | 142 | * @lock: spinlock protecting the list (debugging) |
129 | */ | 143 | */ |
130 | static inline void | 144 | static inline void |
131 | plist_head_init(struct plist_head *head, spinlock_t *lock) | 145 | plist_head_init(struct plist_head *head, spinlock_t *lock) |
@@ -133,7 +147,24 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) | |||
133 | INIT_LIST_HEAD(&head->prio_list); | 147 | INIT_LIST_HEAD(&head->prio_list); |
134 | INIT_LIST_HEAD(&head->node_list); | 148 | INIT_LIST_HEAD(&head->node_list); |
135 | #ifdef CONFIG_DEBUG_PI_LIST | 149 | #ifdef CONFIG_DEBUG_PI_LIST |
136 | head->lock = lock; | 150 | head->spinlock = lock; |
151 | head->rawlock = NULL; | ||
152 | #endif | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * plist_head_init_raw - dynamic struct plist_head initializer | ||
157 | * @head: &struct plist_head pointer | ||
158 | * @lock: raw_spinlock protecting the list (debugging) | ||
159 | */ | ||
160 | static inline void | ||
161 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | ||
162 | { | ||
163 | INIT_LIST_HEAD(&head->prio_list); | ||
164 | INIT_LIST_HEAD(&head->node_list); | ||
165 | #ifdef CONFIG_DEBUG_PI_LIST | ||
166 | head->rawlock = lock; | ||
167 | head->spinlock = NULL; | ||
137 | #endif | 168 | #endif |
138 | } | 169 | } |
139 | 170 | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index 0d65934246af..198b8f9fe05e 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -219,7 +219,7 @@ struct dev_pm_ops { | |||
219 | * to RAM and hibernation. | 219 | * to RAM and hibernation. |
220 | */ | 220 | */ |
221 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ | 221 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ |
222 | struct dev_pm_ops name = { \ | 222 | const struct dev_pm_ops name = { \ |
223 | .suspend = suspend_fn, \ | 223 | .suspend = suspend_fn, \ |
224 | .resume = resume_fn, \ | 224 | .resume = resume_fn, \ |
225 | .freeze = suspend_fn, \ | 225 | .freeze = suspend_fn, \ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index fddfafaed024..7c4193eb0072 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -334,6 +334,19 @@ extern struct pnp_protocol pnpbios_protocol; | |||
334 | #define pnp_device_is_pnpbios(dev) 0 | 334 | #define pnp_device_is_pnpbios(dev) 0 |
335 | #endif | 335 | #endif |
336 | 336 | ||
337 | #ifdef CONFIG_PNPACPI | ||
338 | extern struct pnp_protocol pnpacpi_protocol; | ||
339 | |||
340 | static inline struct acpi_device *pnp_acpi_device(struct pnp_dev *dev) | ||
341 | { | ||
342 | if (dev->protocol == &pnpacpi_protocol) | ||
343 | return dev->data; | ||
344 | return NULL; | ||
345 | } | ||
346 | #else | ||
347 | #define pnp_acpi_device(dev) 0 | ||
348 | #endif | ||
349 | |||
337 | /* status */ | 350 | /* status */ |
338 | #define PNP_READY 0x0000 | 351 | #define PNP_READY 0x0000 |
339 | #define PNP_ATTACHED 0x0001 | 352 | #define PNP_ATTACHED 0x0001 |
diff --git a/include/linux/poison.h b/include/linux/poison.h index 7fc194aef8c2..2110a81c5e2a 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
@@ -2,13 +2,25 @@ | |||
2 | #define _LINUX_POISON_H | 2 | #define _LINUX_POISON_H |
3 | 3 | ||
4 | /********** include/linux/list.h **********/ | 4 | /********** include/linux/list.h **********/ |
5 | |||
6 | /* | ||
7 | * Architectures might want to move the poison pointer offset | ||
8 | * into some well-recognized area such as 0xdead000000000000, | ||
9 | * that is also not mappable by user-space exploits: | ||
10 | */ | ||
11 | #ifdef CONFIG_ILLEGAL_POINTER_VALUE | ||
12 | # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) | ||
13 | #else | ||
14 | # define POISON_POINTER_DELTA 0 | ||
15 | #endif | ||
16 | |||
5 | /* | 17 | /* |
6 | * These are non-NULL pointers that will result in page faults | 18 | * These are non-NULL pointers that will result in page faults |
7 | * under normal circumstances, used to verify that nobody uses | 19 | * under normal circumstances, used to verify that nobody uses |
8 | * non-initialized list entries. | 20 | * non-initialized list entries. |
9 | */ | 21 | */ |
10 | #define LIST_POISON1 ((void *) 0x00100100) | 22 | #define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) |
11 | #define LIST_POISON2 ((void *) 0x00200200) | 23 | #define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) |
12 | 24 | ||
13 | /********** include/linux/timer.h **********/ | 25 | /********** include/linux/timer.h **********/ |
14 | /* | 26 | /* |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 7456d7d87a19..56f2d63a5cbb 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -105,12 +105,7 @@ static inline int ptrace_reparented(struct task_struct *child) | |||
105 | { | 105 | { |
106 | return child->real_parent != child->parent; | 106 | return child->real_parent != child->parent; |
107 | } | 107 | } |
108 | static inline void ptrace_link(struct task_struct *child, | 108 | |
109 | struct task_struct *new_parent) | ||
110 | { | ||
111 | if (unlikely(child->ptrace)) | ||
112 | __ptrace_link(child, new_parent); | ||
113 | } | ||
114 | static inline void ptrace_unlink(struct task_struct *child) | 109 | static inline void ptrace_unlink(struct task_struct *child) |
115 | { | 110 | { |
116 | if (unlikely(child->ptrace)) | 111 | if (unlikely(child->ptrace)) |
@@ -169,9 +164,9 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace) | |||
169 | INIT_LIST_HEAD(&child->ptraced); | 164 | INIT_LIST_HEAD(&child->ptraced); |
170 | child->parent = child->real_parent; | 165 | child->parent = child->real_parent; |
171 | child->ptrace = 0; | 166 | child->ptrace = 0; |
172 | if (unlikely(ptrace)) { | 167 | if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) { |
173 | child->ptrace = current->ptrace; | 168 | child->ptrace = current->ptrace; |
174 | ptrace_link(child, current->parent); | 169 | __ptrace_link(child, current->parent); |
175 | } | 170 | } |
176 | } | 171 | } |
177 | 172 | ||
@@ -278,6 +273,18 @@ static inline void user_enable_block_step(struct task_struct *task) | |||
278 | } | 273 | } |
279 | #endif /* arch_has_block_step */ | 274 | #endif /* arch_has_block_step */ |
280 | 275 | ||
276 | #ifdef ARCH_HAS_USER_SINGLE_STEP_INFO | ||
277 | extern void user_single_step_siginfo(struct task_struct *tsk, | ||
278 | struct pt_regs *regs, siginfo_t *info); | ||
279 | #else | ||
280 | static inline void user_single_step_siginfo(struct task_struct *tsk, | ||
281 | struct pt_regs *regs, siginfo_t *info) | ||
282 | { | ||
283 | memset(info, 0, sizeof(*info)); | ||
284 | info->si_signo = SIGTRAP; | ||
285 | } | ||
286 | #endif | ||
287 | |||
281 | #ifndef arch_ptrace_stop_needed | 288 | #ifndef arch_ptrace_stop_needed |
282 | /** | 289 | /** |
283 | * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called | 290 | * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called |
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 7a9754c96775..01b3d759f1fc 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h | |||
@@ -10,7 +10,7 @@ struct platform_pwm_backlight_data { | |||
10 | unsigned int dft_brightness; | 10 | unsigned int dft_brightness; |
11 | unsigned int pwm_period_ns; | 11 | unsigned int pwm_period_ns; |
12 | int (*init)(struct device *dev); | 12 | int (*init)(struct device *dev); |
13 | int (*notify)(int brightness); | 13 | int (*notify)(struct device *dev, int brightness); |
14 | void (*exit)(struct device *dev); | 14 | void (*exit)(struct device *dev); |
15 | }; | 15 | }; |
16 | 16 | ||
diff --git a/include/linux/quota.h b/include/linux/quota.h index ce9a9b2e5cd4..a6861f117480 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -73,6 +73,8 @@ | |||
73 | /* Quota format type IDs */ | 73 | /* Quota format type IDs */ |
74 | #define QFMT_VFS_OLD 1 | 74 | #define QFMT_VFS_OLD 1 |
75 | #define QFMT_VFS_V0 2 | 75 | #define QFMT_VFS_V0 2 |
76 | #define QFMT_OCFS2 3 | ||
77 | #define QFMT_VFS_V1 4 | ||
76 | 78 | ||
77 | /* Size of block in which space limits are passed through the quota | 79 | /* Size of block in which space limits are passed through the quota |
78 | * interface */ | 80 | * interface */ |
@@ -313,8 +315,9 @@ struct dquot_operations { | |||
313 | int (*claim_space) (struct inode *, qsize_t); | 315 | int (*claim_space) (struct inode *, qsize_t); |
314 | /* release rsved quota for delayed alloc */ | 316 | /* release rsved quota for delayed alloc */ |
315 | void (*release_rsv) (struct inode *, qsize_t); | 317 | void (*release_rsv) (struct inode *, qsize_t); |
316 | /* get reserved quota for delayed alloc */ | 318 | /* get reserved quota for delayed alloc, value returned is managed by |
317 | qsize_t (*get_reserved_space) (struct inode *); | 319 | * quota code only */ |
320 | qsize_t *(*get_reserved_space) (struct inode *); | ||
318 | }; | 321 | }; |
319 | 322 | ||
320 | /* Operations handling requests from userspace */ | 323 | /* Operations handling requests from userspace */ |
@@ -334,7 +337,7 @@ struct quotactl_ops { | |||
334 | 337 | ||
335 | struct quota_format_type { | 338 | struct quota_format_type { |
336 | int qf_fmt_id; /* Quota format id */ | 339 | int qf_fmt_id; /* Quota format id */ |
337 | struct quota_format_ops *qf_ops; /* Operations of format */ | 340 | const struct quota_format_ops *qf_ops; /* Operations of format */ |
338 | struct module *qf_owner; /* Module implementing quota format */ | 341 | struct module *qf_owner; /* Module implementing quota format */ |
339 | struct quota_format_type *qf_next; | 342 | struct quota_format_type *qf_next; |
340 | }; | 343 | }; |
@@ -394,7 +397,7 @@ struct quota_info { | |||
394 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ | 397 | struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ |
395 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ | 398 | struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ |
396 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ | 399 | struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ |
397 | struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ | 400 | const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ |
398 | }; | 401 | }; |
399 | 402 | ||
400 | int register_quota_format(struct quota_format_type *fmt); | 403 | int register_quota_format(struct quota_format_type *fmt); |
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h index d92480f8285c..1cbbd2c11aa9 100644 --- a/include/linux/raid/pq.h +++ b/include/linux/raid/pq.h | |||
@@ -78,6 +78,25 @@ struct raid6_calls { | |||
78 | /* Selected algorithm */ | 78 | /* Selected algorithm */ |
79 | extern struct raid6_calls raid6_call; | 79 | extern struct raid6_calls raid6_call; |
80 | 80 | ||
81 | /* Various routine sets */ | ||
82 | extern const struct raid6_calls raid6_intx1; | ||
83 | extern const struct raid6_calls raid6_intx2; | ||
84 | extern const struct raid6_calls raid6_intx4; | ||
85 | extern const struct raid6_calls raid6_intx8; | ||
86 | extern const struct raid6_calls raid6_intx16; | ||
87 | extern const struct raid6_calls raid6_intx32; | ||
88 | extern const struct raid6_calls raid6_mmxx1; | ||
89 | extern const struct raid6_calls raid6_mmxx2; | ||
90 | extern const struct raid6_calls raid6_sse1x1; | ||
91 | extern const struct raid6_calls raid6_sse1x2; | ||
92 | extern const struct raid6_calls raid6_sse2x1; | ||
93 | extern const struct raid6_calls raid6_sse2x2; | ||
94 | extern const struct raid6_calls raid6_sse2x4; | ||
95 | extern const struct raid6_calls raid6_altivec1; | ||
96 | extern const struct raid6_calls raid6_altivec2; | ||
97 | extern const struct raid6_calls raid6_altivec4; | ||
98 | extern const struct raid6_calls raid6_altivec8; | ||
99 | |||
81 | /* Algorithm list */ | 100 | /* Algorithm list */ |
82 | extern const struct raid6_calls * const raid6_algos[]; | 101 | extern const struct raid6_calls * const raid6_algos[]; |
83 | int raid6_select_algo(void); | 102 | int raid6_select_algo(void); |
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 1bf0f708c4fc..701fe9cb552a 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
@@ -406,6 +406,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
406 | n->next->pprev = &n->next; | 406 | n->next->pprev = &n->next; |
407 | } | 407 | } |
408 | 408 | ||
409 | #define __hlist_for_each_rcu(pos, head) \ | ||
410 | for (pos = rcu_dereference((head)->first); \ | ||
411 | pos && ({ prefetch(pos->next); 1; }); \ | ||
412 | pos = rcu_dereference(pos->next)) | ||
413 | |||
409 | /** | 414 | /** |
410 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | 415 | * hlist_for_each_entry_rcu - iterate over rcu list of given type |
411 | * @tpos: the type * to use as a loop cursor. | 416 | * @tpos: the type * to use as a loop cursor. |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index c4ba9a78721e..96cc307ed9f4 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
@@ -101,4 +101,9 @@ static inline void exit_rcu(void) | |||
101 | { | 101 | { |
102 | } | 102 | } |
103 | 103 | ||
104 | static inline int rcu_preempt_depth(void) | ||
105 | { | ||
106 | return 0; | ||
107 | } | ||
108 | |||
104 | #endif /* __LINUX_RCUTINY_H */ | 109 | #endif /* __LINUX_RCUTINY_H */ |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index c93eee5911b0..8044b1b94333 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -45,6 +45,12 @@ extern void __rcu_read_unlock(void); | |||
45 | extern void synchronize_rcu(void); | 45 | extern void synchronize_rcu(void); |
46 | extern void exit_rcu(void); | 46 | extern void exit_rcu(void); |
47 | 47 | ||
48 | /* | ||
49 | * Defined as macro as it is a very low level header | ||
50 | * included from areas that don't even know about current | ||
51 | */ | ||
52 | #define rcu_preempt_depth() (current->rcu_read_lock_nesting) | ||
53 | |||
48 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 54 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
49 | 55 | ||
50 | static inline void __rcu_read_lock(void) | 56 | static inline void __rcu_read_lock(void) |
@@ -63,6 +69,11 @@ static inline void exit_rcu(void) | |||
63 | { | 69 | { |
64 | } | 70 | } |
65 | 71 | ||
72 | static inline int rcu_preempt_depth(void) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
66 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | 77 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ |
67 | 78 | ||
68 | static inline void __rcu_read_lock_bh(void) | 79 | static inline void __rcu_read_lock_bh(void) |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 490c5b37b6d7..030d92255c7a 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
37 | 37 | ||
38 | #include <linux/device.h> | ||
39 | |||
38 | /* | 40 | /* |
39 | * Regulator operating modes. | 41 | * Regulator operating modes. |
40 | * | 42 | * |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 87f5f176d4ef..234a8476cba8 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -43,16 +43,20 @@ struct regulator; | |||
43 | /** | 43 | /** |
44 | * struct regulator_state - regulator state during low power system states | 44 | * struct regulator_state - regulator state during low power system states |
45 | * | 45 | * |
46 | * This describes a regulators state during a system wide low power state. | 46 | * This describes a regulators state during a system wide low power |
47 | * state. One of enabled or disabled must be set for the | ||
48 | * configuration to be applied. | ||
47 | * | 49 | * |
48 | * @uV: Operating voltage during suspend. | 50 | * @uV: Operating voltage during suspend. |
49 | * @mode: Operating mode during suspend. | 51 | * @mode: Operating mode during suspend. |
50 | * @enabled: Enabled during suspend. | 52 | * @enabled: Enabled during suspend. |
53 | * @disabled: Disabled during suspend. | ||
51 | */ | 54 | */ |
52 | struct regulator_state { | 55 | struct regulator_state { |
53 | int uV; /* suspend voltage */ | 56 | int uV; /* suspend voltage */ |
54 | unsigned int mode; /* suspend regulator operating mode */ | 57 | unsigned int mode; /* suspend regulator operating mode */ |
55 | int enabled; /* is regulator enabled in this suspend state */ | 58 | int enabled; /* is regulator enabled in this suspend state */ |
59 | int disabled; /* is the regulator disbled in this suspend state */ | ||
56 | }; | 60 | }; |
57 | 61 | ||
58 | /** | 62 | /** |
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h new file mode 100644 index 000000000000..9936763621c7 --- /dev/null +++ b/include/linux/regulator/max8660.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * max8660.h -- Voltage regulation for the Maxim 8660/8661 | ||
3 | * | ||
4 | * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __LINUX_REGULATOR_MAX8660_H | ||
21 | #define __LINUX_REGULATOR_MAX8660_H | ||
22 | |||
23 | #include <linux/regulator/machine.h> | ||
24 | |||
25 | enum { | ||
26 | MAX8660_V3, | ||
27 | MAX8660_V4, | ||
28 | MAX8660_V5, | ||
29 | MAX8660_V6, | ||
30 | MAX8660_V7, | ||
31 | MAX8660_V_END, | ||
32 | }; | ||
33 | |||
34 | /** | ||
35 | * max8660_subdev_data - regulator subdev data | ||
36 | * @id: regulator id | ||
37 | * @name: regulator name | ||
38 | * @platform_data: regulator init data | ||
39 | */ | ||
40 | struct max8660_subdev_data { | ||
41 | int id; | ||
42 | char *name; | ||
43 | struct regulator_init_data *platform_data; | ||
44 | }; | ||
45 | |||
46 | /** | ||
47 | * max8660_platform_data - platform data for max8660 | ||
48 | * @num_subdevs: number of regulators used | ||
49 | * @subdevs: pointer to regulators used | ||
50 | * @en34_is_high: if EN34 is driven high, regulators cannot be en-/disabled. | ||
51 | */ | ||
52 | struct max8660_platform_data { | ||
53 | int num_subdevs; | ||
54 | struct max8660_subdev_data *subdevs; | ||
55 | unsigned en34_is_high:1; | ||
56 | }; | ||
57 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index dd31e7bae35c..1ba3cf6edfbb 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -52,11 +52,89 @@ | |||
52 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | 52 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION |
53 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | 53 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION |
54 | 54 | ||
55 | /* Locking primitives */ | 55 | /* |
56 | /* Right now we are still falling back to (un)lock_kernel, but eventually that | 56 | * Locking primitives. The write lock is a per superblock |
57 | would evolve into real per-fs locks */ | 57 | * special mutex that has properties close to the Big Kernel Lock |
58 | #define reiserfs_write_lock( sb ) lock_kernel() | 58 | * which was used in the previous locking scheme. |
59 | #define reiserfs_write_unlock( sb ) unlock_kernel() | 59 | */ |
60 | void reiserfs_write_lock(struct super_block *s); | ||
61 | void reiserfs_write_unlock(struct super_block *s); | ||
62 | int reiserfs_write_lock_once(struct super_block *s); | ||
63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | ||
64 | |||
65 | #ifdef CONFIG_REISERFS_CHECK | ||
66 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
67 | #else | ||
68 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
69 | #endif | ||
70 | |||
71 | /* | ||
72 | * Several mutexes depend on the write lock. | ||
73 | * However sometimes we want to relax the write lock while we hold | ||
74 | * these mutexes, according to the release/reacquire on schedule() | ||
75 | * properties of the Bkl that were used. | ||
76 | * Reiserfs performances and locking were based on this scheme. | ||
77 | * Now that the write lock is a mutex and not the bkl anymore, doing so | ||
78 | * may result in a deadlock: | ||
79 | * | ||
80 | * A acquire write_lock | ||
81 | * A acquire j_commit_mutex | ||
82 | * A release write_lock and wait for something | ||
83 | * B acquire write_lock | ||
84 | * B can't acquire j_commit_mutex and sleep | ||
85 | * A can't acquire write lock anymore | ||
86 | * deadlock | ||
87 | * | ||
88 | * What we do here is avoiding such deadlock by playing the same game | ||
89 | * than the Bkl: if we can't acquire a mutex that depends on the write lock, | ||
90 | * we release the write lock, wait a bit and then retry. | ||
91 | * | ||
92 | * The mutexes concerned by this hack are: | ||
93 | * - The commit mutex of a journal list | ||
94 | * - The flush mutex | ||
95 | * - The journal lock | ||
96 | * - The inode mutex | ||
97 | */ | ||
98 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | ||
99 | struct super_block *s) | ||
100 | { | ||
101 | reiserfs_lock_check_recursive(s); | ||
102 | reiserfs_write_unlock(s); | ||
103 | mutex_lock(m); | ||
104 | reiserfs_write_lock(s); | ||
105 | } | ||
106 | |||
107 | static inline void | ||
108 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
109 | struct super_block *s) | ||
110 | { | ||
111 | reiserfs_lock_check_recursive(s); | ||
112 | reiserfs_write_unlock(s); | ||
113 | mutex_lock_nested(m, subclass); | ||
114 | reiserfs_write_lock(s); | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
119 | { | ||
120 | reiserfs_lock_check_recursive(s); | ||
121 | reiserfs_write_unlock(s); | ||
122 | down_read(sem); | ||
123 | reiserfs_write_lock(s); | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * When we schedule, we usually want to also release the write lock, | ||
128 | * according to the previous bkl based locking scheme of reiserfs. | ||
129 | */ | ||
130 | static inline void reiserfs_cond_resched(struct super_block *s) | ||
131 | { | ||
132 | if (need_resched()) { | ||
133 | reiserfs_write_unlock(s); | ||
134 | schedule(); | ||
135 | reiserfs_write_lock(s); | ||
136 | } | ||
137 | } | ||
60 | 138 | ||
61 | struct fid; | 139 | struct fid; |
62 | 140 | ||
@@ -1329,7 +1407,11 @@ static inline loff_t max_reiserfs_offset(struct inode *inode) | |||
1329 | #define get_generation(s) atomic_read (&fs_generation(s)) | 1407 | #define get_generation(s) atomic_read (&fs_generation(s)) |
1330 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) | 1408 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) |
1331 | #define __fs_changed(gen,s) (gen != get_generation (s)) | 1409 | #define __fs_changed(gen,s) (gen != get_generation (s)) |
1332 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) | 1410 | #define fs_changed(gen,s) \ |
1411 | ({ \ | ||
1412 | reiserfs_cond_resched(s); \ | ||
1413 | __fs_changed(gen, s); \ | ||
1414 | }) | ||
1333 | 1415 | ||
1334 | /***************************************************************************/ | 1416 | /***************************************************************************/ |
1335 | /* FIXATE NODES */ | 1417 | /* FIXATE NODES */ |
@@ -1995,25 +2077,12 @@ void set_de_name_and_namelen(struct reiserfs_dir_entry *de); | |||
1995 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, | 2077 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, |
1996 | struct treepath *path, struct reiserfs_dir_entry *de); | 2078 | struct treepath *path, struct reiserfs_dir_entry *de); |
1997 | struct dentry *reiserfs_get_parent(struct dentry *); | 2079 | struct dentry *reiserfs_get_parent(struct dentry *); |
1998 | /* procfs.c */ | ||
1999 | |||
2000 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | ||
2001 | #define REISERFS_PROC_INFO | ||
2002 | #else | ||
2003 | #undef REISERFS_PROC_INFO | ||
2004 | #endif | ||
2005 | 2080 | ||
2081 | #ifdef CONFIG_REISERFS_PROC_INFO | ||
2006 | int reiserfs_proc_info_init(struct super_block *sb); | 2082 | int reiserfs_proc_info_init(struct super_block *sb); |
2007 | int reiserfs_proc_info_done(struct super_block *sb); | 2083 | int reiserfs_proc_info_done(struct super_block *sb); |
2008 | struct proc_dir_entry *reiserfs_proc_register_global(char *name, | ||
2009 | read_proc_t * func); | ||
2010 | void reiserfs_proc_unregister_global(const char *name); | ||
2011 | int reiserfs_proc_info_global_init(void); | 2084 | int reiserfs_proc_info_global_init(void); |
2012 | int reiserfs_proc_info_global_done(void); | 2085 | int reiserfs_proc_info_global_done(void); |
2013 | int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, | ||
2014 | int count, int *eof, void *data); | ||
2015 | |||
2016 | #if defined( REISERFS_PROC_INFO ) | ||
2017 | 2086 | ||
2018 | #define PROC_EXP( e ) e | 2087 | #define PROC_EXP( e ) e |
2019 | 2088 | ||
@@ -2028,6 +2097,26 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, | |||
2028 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ | 2097 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ |
2029 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) | 2098 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) |
2030 | #else | 2099 | #else |
2100 | static inline int reiserfs_proc_info_init(struct super_block *sb) | ||
2101 | { | ||
2102 | return 0; | ||
2103 | } | ||
2104 | |||
2105 | static inline int reiserfs_proc_info_done(struct super_block *sb) | ||
2106 | { | ||
2107 | return 0; | ||
2108 | } | ||
2109 | |||
2110 | static inline int reiserfs_proc_info_global_init(void) | ||
2111 | { | ||
2112 | return 0; | ||
2113 | } | ||
2114 | |||
2115 | static inline int reiserfs_proc_info_global_done(void) | ||
2116 | { | ||
2117 | return 0; | ||
2118 | } | ||
2119 | |||
2031 | #define PROC_EXP( e ) | 2120 | #define PROC_EXP( e ) |
2032 | #define VOID_V ( ( void ) 0 ) | 2121 | #define VOID_V ( ( void ) 0 ) |
2033 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | 2122 | #define PROC_INFO_MAX( sb, field, value ) VOID_V |
@@ -2258,8 +2347,7 @@ __u32 r5_hash(const signed char *msg, int len); | |||
2258 | #define SPARE_SPACE 500 | 2347 | #define SPARE_SPACE 500 |
2259 | 2348 | ||
2260 | /* prototypes from ioctl.c */ | 2349 | /* prototypes from ioctl.c */ |
2261 | int reiserfs_ioctl(struct inode *inode, struct file *filp, | 2350 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
2262 | unsigned int cmd, unsigned long arg); | ||
2263 | long reiserfs_compat_ioctl(struct file *filp, | 2351 | long reiserfs_compat_ioctl(struct file *filp, |
2264 | unsigned int cmd, unsigned long arg); | 2352 | unsigned int cmd, unsigned long arg); |
2265 | int reiserfs_unpack(struct inode *inode, struct file *filp); | 2353 | int reiserfs_unpack(struct inode *inode, struct file *filp); |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index dab68bbed675..52c83b6a758a 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
9 | #include <linux/rwsem.h> | 9 | #include <linux/rwsem.h> |
10 | #include <linux/mutex.h> | ||
11 | #include <linux/sched.h> | ||
10 | #endif | 12 | #endif |
11 | 13 | ||
12 | typedef enum { | 14 | typedef enum { |
@@ -355,6 +357,13 @@ struct reiserfs_sb_info { | |||
355 | struct reiserfs_journal *s_journal; /* pointer to journal information */ | 357 | struct reiserfs_journal *s_journal; /* pointer to journal information */ |
356 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | 358 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ |
357 | 359 | ||
360 | /* Serialize writers access, replace the old bkl */ | ||
361 | struct mutex lock; | ||
362 | /* Owner of the lock (can be recursive) */ | ||
363 | struct task_struct *lock_owner; | ||
364 | /* Depth of the lock, start from -1 like the bkl */ | ||
365 | int lock_depth; | ||
366 | |||
358 | /* Comment? -Hans */ | 367 | /* Comment? -Hans */ |
359 | void (*end_io_handler) (struct buffer_head *, int); | 368 | void (*end_io_handler) (struct buffer_head *, int); |
360 | hashf_t s_hash_function; /* pointer to function which is used | 369 | hashf_t s_hash_function; /* pointer to function which is used |
@@ -408,6 +417,17 @@ struct reiserfs_sb_info { | |||
408 | char *s_qf_names[MAXQUOTAS]; | 417 | char *s_qf_names[MAXQUOTAS]; |
409 | int s_jquota_fmt; | 418 | int s_jquota_fmt; |
410 | #endif | 419 | #endif |
420 | #ifdef CONFIG_REISERFS_CHECK | ||
421 | |||
422 | struct tree_balance *cur_tb; /* | ||
423 | * Detects whether more than one | ||
424 | * copy of tb exists per superblock | ||
425 | * as a means of checking whether | ||
426 | * do_balance is executing concurrently | ||
427 | * against another tree reader/writer | ||
428 | * on a same mount point. | ||
429 | */ | ||
430 | #endif | ||
411 | }; | 431 | }; |
412 | 432 | ||
413 | /* Definitions of reiserfs on-disk properties: */ | 433 | /* Definitions of reiserfs on-disk properties: */ |
diff --git a/include/linux/resource.h b/include/linux/resource.h index 40fc7e626082..f1e914eefeab 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
5 | 5 | ||
6 | struct task_struct; | ||
7 | |||
8 | /* | 6 | /* |
9 | * Resource control/accounting header file for linux | 7 | * Resource control/accounting header file for linux |
10 | */ | 8 | */ |
@@ -70,6 +68,12 @@ struct rlimit { | |||
70 | */ | 68 | */ |
71 | #include <asm/resource.h> | 69 | #include <asm/resource.h> |
72 | 70 | ||
71 | #ifdef __KERNEL__ | ||
72 | |||
73 | struct task_struct; | ||
74 | |||
73 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); | 75 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); |
74 | 76 | ||
77 | #endif /* __KERNEL__ */ | ||
78 | |||
75 | #endif | 79 | #endif |
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index cb0ba7032609..b019ae64e2ab 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -26,6 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | struct anon_vma { | 27 | struct anon_vma { |
28 | spinlock_t lock; /* Serialize access to vma list */ | 28 | spinlock_t lock; /* Serialize access to vma list */ |
29 | #ifdef CONFIG_KSM | ||
30 | atomic_t ksm_refcount; | ||
31 | #endif | ||
29 | /* | 32 | /* |
30 | * NOTE: the LSB of the head.next is set by | 33 | * NOTE: the LSB of the head.next is set by |
31 | * mm_take_all_locks() _after_ taking the above lock. So the | 34 | * mm_take_all_locks() _after_ taking the above lock. So the |
@@ -38,6 +41,34 @@ struct anon_vma { | |||
38 | }; | 41 | }; |
39 | 42 | ||
40 | #ifdef CONFIG_MMU | 43 | #ifdef CONFIG_MMU |
44 | #ifdef CONFIG_KSM | ||
45 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
46 | { | ||
47 | atomic_set(&anon_vma->ksm_refcount, 0); | ||
48 | } | ||
49 | |||
50 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
51 | { | ||
52 | return atomic_read(&anon_vma->ksm_refcount); | ||
53 | } | ||
54 | #else | ||
55 | static inline void ksm_refcount_init(struct anon_vma *anon_vma) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | static inline int ksm_refcount(struct anon_vma *anon_vma) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
63 | #endif /* CONFIG_KSM */ | ||
64 | |||
65 | static inline struct anon_vma *page_anon_vma(struct page *page) | ||
66 | { | ||
67 | if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != | ||
68 | PAGE_MAPPING_ANON) | ||
69 | return NULL; | ||
70 | return page_rmapping(page); | ||
71 | } | ||
41 | 72 | ||
42 | static inline void anon_vma_lock(struct vm_area_struct *vma) | 73 | static inline void anon_vma_lock(struct vm_area_struct *vma) |
43 | { | 74 | { |
@@ -62,6 +93,7 @@ void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *); | |||
62 | void anon_vma_unlink(struct vm_area_struct *); | 93 | void anon_vma_unlink(struct vm_area_struct *); |
63 | void anon_vma_link(struct vm_area_struct *); | 94 | void anon_vma_link(struct vm_area_struct *); |
64 | void __anon_vma_link(struct vm_area_struct *); | 95 | void __anon_vma_link(struct vm_area_struct *); |
96 | void anon_vma_free(struct anon_vma *); | ||
65 | 97 | ||
66 | /* | 98 | /* |
67 | * rmap interfaces called when adding or removing pte of page | 99 | * rmap interfaces called when adding or removing pte of page |
@@ -81,6 +113,9 @@ static inline void page_dup_rmap(struct page *page) | |||
81 | */ | 113 | */ |
82 | int page_referenced(struct page *, int is_locked, | 114 | int page_referenced(struct page *, int is_locked, |
83 | struct mem_cgroup *cnt, unsigned long *vm_flags); | 115 | struct mem_cgroup *cnt, unsigned long *vm_flags); |
116 | int page_referenced_one(struct page *, struct vm_area_struct *, | ||
117 | unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); | ||
118 | |||
84 | enum ttu_flags { | 119 | enum ttu_flags { |
85 | TTU_UNMAP = 0, /* unmap mode */ | 120 | TTU_UNMAP = 0, /* unmap mode */ |
86 | TTU_MIGRATION = 1, /* migration mode */ | 121 | TTU_MIGRATION = 1, /* migration mode */ |
@@ -94,6 +129,8 @@ enum ttu_flags { | |||
94 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) | 129 | #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) |
95 | 130 | ||
96 | int try_to_unmap(struct page *, enum ttu_flags flags); | 131 | int try_to_unmap(struct page *, enum ttu_flags flags); |
132 | int try_to_unmap_one(struct page *, struct vm_area_struct *, | ||
133 | unsigned long address, enum ttu_flags flags); | ||
97 | 134 | ||
98 | /* | 135 | /* |
99 | * Called from mm/filemap_xip.c to unmap empty zero page | 136 | * Called from mm/filemap_xip.c to unmap empty zero page |
@@ -127,6 +164,12 @@ struct anon_vma *page_lock_anon_vma(struct page *page); | |||
127 | void page_unlock_anon_vma(struct anon_vma *anon_vma); | 164 | void page_unlock_anon_vma(struct anon_vma *anon_vma); |
128 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); | 165 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); |
129 | 166 | ||
167 | /* | ||
168 | * Called by migrate.c to remove migration ptes, but might be used more later. | ||
169 | */ | ||
170 | int rmap_walk(struct page *page, int (*rmap_one)(struct page *, | ||
171 | struct vm_area_struct *, unsigned long, void *), void *arg); | ||
172 | |||
130 | #else /* !CONFIG_MMU */ | 173 | #else /* !CONFIG_MMU */ |
131 | 174 | ||
132 | #define anon_vma_init() do {} while (0) | 175 | #define anon_vma_init() do {} while (0) |
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index f19b00b7d530..281d8fd775e8 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h | |||
@@ -24,7 +24,7 @@ | |||
24 | * @owner: the mutex owner | 24 | * @owner: the mutex owner |
25 | */ | 25 | */ |
26 | struct rt_mutex { | 26 | struct rt_mutex { |
27 | spinlock_t wait_lock; | 27 | raw_spinlock_t wait_lock; |
28 | struct plist_head wait_list; | 28 | struct plist_head wait_list; |
29 | struct task_struct *owner; | 29 | struct task_struct *owner; |
30 | #ifdef CONFIG_DEBUG_RT_MUTEXES | 30 | #ifdef CONFIG_DEBUG_RT_MUTEXES |
@@ -63,8 +63,8 @@ struct hrtimer_sleeper; | |||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #define __RT_MUTEX_INITIALIZER(mutexname) \ | 65 | #define __RT_MUTEX_INITIALIZER(mutexname) \ |
66 | { .wait_lock = __SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ | 66 | { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
67 | , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \ | 67 | , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ |
68 | , .owner = NULL \ | 68 | , .owner = NULL \ |
69 | __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} | 69 | __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} |
70 | 70 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 14fc906ed602..9590364fe8b5 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -362,17 +362,17 @@ enum { | |||
362 | #define RTAX_FEATURES RTAX_FEATURES | 362 | #define RTAX_FEATURES RTAX_FEATURES |
363 | RTAX_RTO_MIN, | 363 | RTAX_RTO_MIN, |
364 | #define RTAX_RTO_MIN RTAX_RTO_MIN | 364 | #define RTAX_RTO_MIN RTAX_RTO_MIN |
365 | RTAX_INITRWND, | ||
366 | #define RTAX_INITRWND RTAX_INITRWND | ||
365 | __RTAX_MAX | 367 | __RTAX_MAX |
366 | }; | 368 | }; |
367 | 369 | ||
368 | #define RTAX_MAX (__RTAX_MAX - 1) | 370 | #define RTAX_MAX (__RTAX_MAX - 1) |
369 | 371 | ||
370 | #define RTAX_FEATURE_ECN 0x00000001 | 372 | #define RTAX_FEATURE_ECN 0x00000001 |
371 | #define RTAX_FEATURE_NO_SACK 0x00000002 | 373 | #define RTAX_FEATURE_SACK 0x00000002 |
372 | #define RTAX_FEATURE_NO_TSTAMP 0x00000004 | 374 | #define RTAX_FEATURE_TIMESTAMP 0x00000004 |
373 | #define RTAX_FEATURE_ALLFRAG 0x00000008 | 375 | #define RTAX_FEATURE_ALLFRAG 0x00000008 |
374 | #define RTAX_FEATURE_NO_WSCALE 0x00000010 | ||
375 | #define RTAX_FEATURE_NO_DSACK 0x00000020 | ||
376 | 376 | ||
377 | struct rta_session { | 377 | struct rta_session { |
378 | __u8 proto; | 378 | __u8 proto; |
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h new file mode 100644 index 000000000000..71e0b00b6f2c --- /dev/null +++ b/include/linux/rwlock.h | |||
@@ -0,0 +1,125 @@ | |||
1 | #ifndef __LINUX_RWLOCK_H | ||
2 | #define __LINUX_RWLOCK_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * rwlock related methods | ||
10 | * | ||
11 | * split out from spinlock.h | ||
12 | * | ||
13 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
14 | * Released under the General Public License (GPL). | ||
15 | */ | ||
16 | |||
17 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
18 | extern void __rwlock_init(rwlock_t *lock, const char *name, | ||
19 | struct lock_class_key *key); | ||
20 | # define rwlock_init(lock) \ | ||
21 | do { \ | ||
22 | static struct lock_class_key __key; \ | ||
23 | \ | ||
24 | __rwlock_init((lock), #lock, &__key); \ | ||
25 | } while (0) | ||
26 | #else | ||
27 | # define rwlock_init(lock) \ | ||
28 | do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0) | ||
29 | #endif | ||
30 | |||
31 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
32 | extern void do_raw_read_lock(rwlock_t *lock); | ||
33 | #define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock) | ||
34 | extern int do_raw_read_trylock(rwlock_t *lock); | ||
35 | extern void do_raw_read_unlock(rwlock_t *lock); | ||
36 | extern void do_raw_write_lock(rwlock_t *lock); | ||
37 | #define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock) | ||
38 | extern int do_raw_write_trylock(rwlock_t *lock); | ||
39 | extern void do_raw_write_unlock(rwlock_t *lock); | ||
40 | #else | ||
41 | # define do_raw_read_lock(rwlock) arch_read_lock(&(rwlock)->raw_lock) | ||
42 | # define do_raw_read_lock_flags(lock, flags) \ | ||
43 | arch_read_lock_flags(&(lock)->raw_lock, *(flags)) | ||
44 | # define do_raw_read_trylock(rwlock) arch_read_trylock(&(rwlock)->raw_lock) | ||
45 | # define do_raw_read_unlock(rwlock) arch_read_unlock(&(rwlock)->raw_lock) | ||
46 | # define do_raw_write_lock(rwlock) arch_write_lock(&(rwlock)->raw_lock) | ||
47 | # define do_raw_write_lock_flags(lock, flags) \ | ||
48 | arch_write_lock_flags(&(lock)->raw_lock, *(flags)) | ||
49 | # define do_raw_write_trylock(rwlock) arch_write_trylock(&(rwlock)->raw_lock) | ||
50 | # define do_raw_write_unlock(rwlock) arch_write_unlock(&(rwlock)->raw_lock) | ||
51 | #endif | ||
52 | |||
53 | #define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock) | ||
54 | #define write_can_lock(rwlock) arch_write_can_lock(&(rwlock)->raw_lock) | ||
55 | |||
56 | /* | ||
57 | * Define the various rw_lock methods. Note we define these | ||
58 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | ||
59 | * methods are defined as nops in the case they are not required. | ||
60 | */ | ||
61 | #define read_trylock(lock) __cond_lock(lock, _raw_read_trylock(lock)) | ||
62 | #define write_trylock(lock) __cond_lock(lock, _raw_write_trylock(lock)) | ||
63 | |||
64 | #define write_lock(lock) _raw_write_lock(lock) | ||
65 | #define read_lock(lock) _raw_read_lock(lock) | ||
66 | |||
67 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
68 | |||
69 | #define read_lock_irqsave(lock, flags) \ | ||
70 | do { \ | ||
71 | typecheck(unsigned long, flags); \ | ||
72 | flags = _raw_read_lock_irqsave(lock); \ | ||
73 | } while (0) | ||
74 | #define write_lock_irqsave(lock, flags) \ | ||
75 | do { \ | ||
76 | typecheck(unsigned long, flags); \ | ||
77 | flags = _raw_write_lock_irqsave(lock); \ | ||
78 | } while (0) | ||
79 | |||
80 | #else | ||
81 | |||
82 | #define read_lock_irqsave(lock, flags) \ | ||
83 | do { \ | ||
84 | typecheck(unsigned long, flags); \ | ||
85 | _raw_read_lock_irqsave(lock, flags); \ | ||
86 | } while (0) | ||
87 | #define write_lock_irqsave(lock, flags) \ | ||
88 | do { \ | ||
89 | typecheck(unsigned long, flags); \ | ||
90 | _raw_write_lock_irqsave(lock, flags); \ | ||
91 | } while (0) | ||
92 | |||
93 | #endif | ||
94 | |||
95 | #define read_lock_irq(lock) _raw_read_lock_irq(lock) | ||
96 | #define read_lock_bh(lock) _raw_read_lock_bh(lock) | ||
97 | #define write_lock_irq(lock) _raw_write_lock_irq(lock) | ||
98 | #define write_lock_bh(lock) _raw_write_lock_bh(lock) | ||
99 | #define read_unlock(lock) _raw_read_unlock(lock) | ||
100 | #define write_unlock(lock) _raw_write_unlock(lock) | ||
101 | #define read_unlock_irq(lock) _raw_read_unlock_irq(lock) | ||
102 | #define write_unlock_irq(lock) _raw_write_unlock_irq(lock) | ||
103 | |||
104 | #define read_unlock_irqrestore(lock, flags) \ | ||
105 | do { \ | ||
106 | typecheck(unsigned long, flags); \ | ||
107 | _raw_read_unlock_irqrestore(lock, flags); \ | ||
108 | } while (0) | ||
109 | #define read_unlock_bh(lock) _raw_read_unlock_bh(lock) | ||
110 | |||
111 | #define write_unlock_irqrestore(lock, flags) \ | ||
112 | do { \ | ||
113 | typecheck(unsigned long, flags); \ | ||
114 | _raw_write_unlock_irqrestore(lock, flags); \ | ||
115 | } while (0) | ||
116 | #define write_unlock_bh(lock) _raw_write_unlock_bh(lock) | ||
117 | |||
118 | #define write_trylock_irqsave(lock, flags) \ | ||
119 | ({ \ | ||
120 | local_irq_save(flags); \ | ||
121 | write_trylock(lock) ? \ | ||
122 | 1 : ({ local_irq_restore(flags); 0; }); \ | ||
123 | }) | ||
124 | |||
125 | #endif /* __LINUX_RWLOCK_H */ | ||
diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h new file mode 100644 index 000000000000..9c9f0495d37c --- /dev/null +++ b/include/linux/rwlock_api_smp.h | |||
@@ -0,0 +1,282 @@ | |||
1 | #ifndef __LINUX_RWLOCK_API_SMP_H | ||
2 | #define __LINUX_RWLOCK_API_SMP_H | ||
3 | |||
4 | #ifndef __LINUX_SPINLOCK_API_SMP_H | ||
5 | # error "please don't include this file directly" | ||
6 | #endif | ||
7 | |||
8 | /* | ||
9 | * include/linux/rwlock_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 | void __lockfunc _raw_read_lock(rwlock_t *lock) __acquires(lock); | ||
19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ||
20 | void __lockfunc _raw_read_lock_bh(rwlock_t *lock) __acquires(lock); | ||
21 | void __lockfunc _raw_write_lock_bh(rwlock_t *lock) __acquires(lock); | ||
22 | void __lockfunc _raw_read_lock_irq(rwlock_t *lock) __acquires(lock); | ||
23 | void __lockfunc _raw_write_lock_irq(rwlock_t *lock) __acquires(lock); | ||
24 | unsigned long __lockfunc _raw_read_lock_irqsave(rwlock_t *lock) | ||
25 | __acquires(lock); | ||
26 | unsigned long __lockfunc _raw_write_lock_irqsave(rwlock_t *lock) | ||
27 | __acquires(lock); | ||
28 | int __lockfunc _raw_read_trylock(rwlock_t *lock); | ||
29 | int __lockfunc _raw_write_trylock(rwlock_t *lock); | ||
30 | void __lockfunc _raw_read_unlock(rwlock_t *lock) __releases(lock); | ||
31 | void __lockfunc _raw_write_unlock(rwlock_t *lock) __releases(lock); | ||
32 | void __lockfunc _raw_read_unlock_bh(rwlock_t *lock) __releases(lock); | ||
33 | void __lockfunc _raw_write_unlock_bh(rwlock_t *lock) __releases(lock); | ||
34 | void __lockfunc _raw_read_unlock_irq(rwlock_t *lock) __releases(lock); | ||
35 | void __lockfunc _raw_write_unlock_irq(rwlock_t *lock) __releases(lock); | ||
36 | void __lockfunc | ||
37 | _raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
38 | __releases(lock); | ||
39 | void __lockfunc | ||
40 | _raw_write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
41 | __releases(lock); | ||
42 | |||
43 | #ifdef CONFIG_INLINE_READ_LOCK | ||
44 | #define _raw_read_lock(lock) __raw_read_lock(lock) | ||
45 | #endif | ||
46 | |||
47 | #ifdef CONFIG_INLINE_WRITE_LOCK | ||
48 | #define _raw_write_lock(lock) __raw_write_lock(lock) | ||
49 | #endif | ||
50 | |||
51 | #ifdef CONFIG_INLINE_READ_LOCK_BH | ||
52 | #define _raw_read_lock_bh(lock) __raw_read_lock_bh(lock) | ||
53 | #endif | ||
54 | |||
55 | #ifdef CONFIG_INLINE_WRITE_LOCK_BH | ||
56 | #define _raw_write_lock_bh(lock) __raw_write_lock_bh(lock) | ||
57 | #endif | ||
58 | |||
59 | #ifdef CONFIG_INLINE_READ_LOCK_IRQ | ||
60 | #define _raw_read_lock_irq(lock) __raw_read_lock_irq(lock) | ||
61 | #endif | ||
62 | |||
63 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQ | ||
64 | #define _raw_write_lock_irq(lock) __raw_write_lock_irq(lock) | ||
65 | #endif | ||
66 | |||
67 | #ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE | ||
68 | #define _raw_read_lock_irqsave(lock) __raw_read_lock_irqsave(lock) | ||
69 | #endif | ||
70 | |||
71 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE | ||
72 | #define _raw_write_lock_irqsave(lock) __raw_write_lock_irqsave(lock) | ||
73 | #endif | ||
74 | |||
75 | #ifdef CONFIG_INLINE_READ_TRYLOCK | ||
76 | #define _raw_read_trylock(lock) __raw_read_trylock(lock) | ||
77 | #endif | ||
78 | |||
79 | #ifdef CONFIG_INLINE_WRITE_TRYLOCK | ||
80 | #define _raw_write_trylock(lock) __raw_write_trylock(lock) | ||
81 | #endif | ||
82 | |||
83 | #ifdef CONFIG_INLINE_READ_UNLOCK | ||
84 | #define _raw_read_unlock(lock) __raw_read_unlock(lock) | ||
85 | #endif | ||
86 | |||
87 | #ifdef CONFIG_INLINE_WRITE_UNLOCK | ||
88 | #define _raw_write_unlock(lock) __raw_write_unlock(lock) | ||
89 | #endif | ||
90 | |||
91 | #ifdef CONFIG_INLINE_READ_UNLOCK_BH | ||
92 | #define _raw_read_unlock_bh(lock) __raw_read_unlock_bh(lock) | ||
93 | #endif | ||
94 | |||
95 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_BH | ||
96 | #define _raw_write_unlock_bh(lock) __raw_write_unlock_bh(lock) | ||
97 | #endif | ||
98 | |||
99 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQ | ||
100 | #define _raw_read_unlock_irq(lock) __raw_read_unlock_irq(lock) | ||
101 | #endif | ||
102 | |||
103 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ | ||
104 | #define _raw_write_unlock_irq(lock) __raw_write_unlock_irq(lock) | ||
105 | #endif | ||
106 | |||
107 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE | ||
108 | #define _raw_read_unlock_irqrestore(lock, flags) \ | ||
109 | __raw_read_unlock_irqrestore(lock, flags) | ||
110 | #endif | ||
111 | |||
112 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE | ||
113 | #define _raw_write_unlock_irqrestore(lock, flags) \ | ||
114 | __raw_write_unlock_irqrestore(lock, flags) | ||
115 | #endif | ||
116 | |||
117 | static inline int __raw_read_trylock(rwlock_t *lock) | ||
118 | { | ||
119 | preempt_disable(); | ||
120 | if (do_raw_read_trylock(lock)) { | ||
121 | rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_); | ||
122 | return 1; | ||
123 | } | ||
124 | preempt_enable(); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static inline int __raw_write_trylock(rwlock_t *lock) | ||
129 | { | ||
130 | preempt_disable(); | ||
131 | if (do_raw_write_trylock(lock)) { | ||
132 | rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_); | ||
133 | return 1; | ||
134 | } | ||
135 | preempt_enable(); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * If lockdep is enabled then we use the non-preemption spin-ops | ||
141 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are | ||
142 | * not re-enabled during lock-acquire (which the preempt-spin-ops do): | ||
143 | */ | ||
144 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) | ||
145 | |||
146 | static inline void __raw_read_lock(rwlock_t *lock) | ||
147 | { | ||
148 | preempt_disable(); | ||
149 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
150 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
151 | } | ||
152 | |||
153 | static inline unsigned long __raw_read_lock_irqsave(rwlock_t *lock) | ||
154 | { | ||
155 | unsigned long flags; | ||
156 | |||
157 | local_irq_save(flags); | ||
158 | preempt_disable(); | ||
159 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
160 | LOCK_CONTENDED_FLAGS(lock, do_raw_read_trylock, do_raw_read_lock, | ||
161 | do_raw_read_lock_flags, &flags); | ||
162 | return flags; | ||
163 | } | ||
164 | |||
165 | static inline void __raw_read_lock_irq(rwlock_t *lock) | ||
166 | { | ||
167 | local_irq_disable(); | ||
168 | preempt_disable(); | ||
169 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
170 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
171 | } | ||
172 | |||
173 | static inline void __raw_read_lock_bh(rwlock_t *lock) | ||
174 | { | ||
175 | local_bh_disable(); | ||
176 | preempt_disable(); | ||
177 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
178 | LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); | ||
179 | } | ||
180 | |||
181 | static inline unsigned long __raw_write_lock_irqsave(rwlock_t *lock) | ||
182 | { | ||
183 | unsigned long flags; | ||
184 | |||
185 | local_irq_save(flags); | ||
186 | preempt_disable(); | ||
187 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
188 | LOCK_CONTENDED_FLAGS(lock, do_raw_write_trylock, do_raw_write_lock, | ||
189 | do_raw_write_lock_flags, &flags); | ||
190 | return flags; | ||
191 | } | ||
192 | |||
193 | static inline void __raw_write_lock_irq(rwlock_t *lock) | ||
194 | { | ||
195 | local_irq_disable(); | ||
196 | preempt_disable(); | ||
197 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
198 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
199 | } | ||
200 | |||
201 | static inline void __raw_write_lock_bh(rwlock_t *lock) | ||
202 | { | ||
203 | local_bh_disable(); | ||
204 | preempt_disable(); | ||
205 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
206 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
207 | } | ||
208 | |||
209 | static inline void __raw_write_lock(rwlock_t *lock) | ||
210 | { | ||
211 | preempt_disable(); | ||
212 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
213 | LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); | ||
214 | } | ||
215 | |||
216 | #endif /* CONFIG_PREEMPT */ | ||
217 | |||
218 | static inline void __raw_write_unlock(rwlock_t *lock) | ||
219 | { | ||
220 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
221 | do_raw_write_unlock(lock); | ||
222 | preempt_enable(); | ||
223 | } | ||
224 | |||
225 | static inline void __raw_read_unlock(rwlock_t *lock) | ||
226 | { | ||
227 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
228 | do_raw_read_unlock(lock); | ||
229 | preempt_enable(); | ||
230 | } | ||
231 | |||
232 | static inline void | ||
233 | __raw_read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
234 | { | ||
235 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
236 | do_raw_read_unlock(lock); | ||
237 | local_irq_restore(flags); | ||
238 | preempt_enable(); | ||
239 | } | ||
240 | |||
241 | static inline void __raw_read_unlock_irq(rwlock_t *lock) | ||
242 | { | ||
243 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
244 | do_raw_read_unlock(lock); | ||
245 | local_irq_enable(); | ||
246 | preempt_enable(); | ||
247 | } | ||
248 | |||
249 | static inline void __raw_read_unlock_bh(rwlock_t *lock) | ||
250 | { | ||
251 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
252 | do_raw_read_unlock(lock); | ||
253 | preempt_enable_no_resched(); | ||
254 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
255 | } | ||
256 | |||
257 | static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, | ||
258 | unsigned long flags) | ||
259 | { | ||
260 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
261 | do_raw_write_unlock(lock); | ||
262 | local_irq_restore(flags); | ||
263 | preempt_enable(); | ||
264 | } | ||
265 | |||
266 | static inline void __raw_write_unlock_irq(rwlock_t *lock) | ||
267 | { | ||
268 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
269 | do_raw_write_unlock(lock); | ||
270 | local_irq_enable(); | ||
271 | preempt_enable(); | ||
272 | } | ||
273 | |||
274 | static inline void __raw_write_unlock_bh(rwlock_t *lock) | ||
275 | { | ||
276 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
277 | do_raw_write_unlock(lock); | ||
278 | preempt_enable_no_resched(); | ||
279 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
280 | } | ||
281 | |||
282 | #endif /* __LINUX_RWLOCK_API_SMP_H */ | ||
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h new file mode 100644 index 000000000000..bd31808c7d8e --- /dev/null +++ b/include/linux/rwlock_types.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef __LINUX_RWLOCK_TYPES_H | ||
2 | #define __LINUX_RWLOCK_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * include/linux/rwlock_types.h - generic rwlock 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 | typedef struct { | ||
12 | arch_rwlock_t raw_lock; | ||
13 | #ifdef CONFIG_GENERIC_LOCKBREAK | ||
14 | unsigned int break_lock; | ||
15 | #endif | ||
16 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
17 | unsigned int magic, owner_cpu; | ||
18 | void *owner; | ||
19 | #endif | ||
20 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
21 | struct lockdep_map dep_map; | ||
22 | #endif | ||
23 | } rwlock_t; | ||
24 | |||
25 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
26 | |||
27 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
28 | # define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | ||
29 | #else | ||
30 | # define RW_DEP_MAP_INIT(lockname) | ||
31 | #endif | ||
32 | |||
33 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
34 | #define __RW_LOCK_UNLOCKED(lockname) \ | ||
35 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ | ||
36 | .magic = RWLOCK_MAGIC, \ | ||
37 | .owner = SPINLOCK_OWNER_INIT, \ | ||
38 | .owner_cpu = -1, \ | ||
39 | RW_DEP_MAP_INIT(lockname) } | ||
40 | #else | ||
41 | #define __RW_LOCK_UNLOCKED(lockname) \ | ||
42 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ | ||
43 | RW_DEP_MAP_INIT(lockname) } | ||
44 | #endif | ||
45 | |||
46 | /* | ||
47 | * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence | ||
48 | * deprecated. | ||
49 | * | ||
50 | * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate. | ||
51 | */ | ||
52 | #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) | ||
53 | |||
54 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) | ||
55 | |||
56 | #endif /* __LINUX_RWLOCK_TYPES_H */ | ||
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index 6c3c0f6c261f..bdfcc2527970 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h | |||
@@ -68,11 +68,7 @@ extern int __down_write_trylock(struct rw_semaphore *sem); | |||
68 | extern void __up_read(struct rw_semaphore *sem); | 68 | extern void __up_read(struct rw_semaphore *sem); |
69 | extern void __up_write(struct rw_semaphore *sem); | 69 | extern void __up_write(struct rw_semaphore *sem); |
70 | extern void __downgrade_write(struct rw_semaphore *sem); | 70 | extern void __downgrade_write(struct rw_semaphore *sem); |
71 | 71 | extern int rwsem_is_locked(struct rw_semaphore *sem); | |
72 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
73 | { | ||
74 | return (sem->activity != 0); | ||
75 | } | ||
76 | 72 | ||
77 | #endif /* __KERNEL__ */ | 73 | #endif /* __KERNEL__ */ |
78 | #endif /* _LINUX_RWSEM_SPINLOCK_H */ | 74 | #endif /* _LINUX_RWSEM_SPINLOCK_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 89115ec7d43f..78efe7c485ac 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -192,6 +192,12 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
192 | #define TASK_DEAD 64 | 192 | #define TASK_DEAD 64 |
193 | #define TASK_WAKEKILL 128 | 193 | #define TASK_WAKEKILL 128 |
194 | #define TASK_WAKING 256 | 194 | #define TASK_WAKING 256 |
195 | #define TASK_STATE_MAX 512 | ||
196 | |||
197 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | ||
198 | |||
199 | extern char ___assert_task_state[1 - 2*!!( | ||
200 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
195 | 201 | ||
196 | /* Convenience macros for the sake of set_task_state */ | 202 | /* Convenience macros for the sake of set_task_state */ |
197 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 203 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
@@ -304,6 +310,7 @@ extern void sched_show_task(struct task_struct *p); | |||
304 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 310 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
305 | extern void softlockup_tick(void); | 311 | extern void softlockup_tick(void); |
306 | extern void touch_softlockup_watchdog(void); | 312 | extern void touch_softlockup_watchdog(void); |
313 | extern void touch_softlockup_watchdog_sync(void); | ||
307 | extern void touch_all_softlockup_watchdogs(void); | 314 | extern void touch_all_softlockup_watchdogs(void); |
308 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | 315 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, |
309 | void __user *buffer, | 316 | void __user *buffer, |
@@ -317,6 +324,9 @@ static inline void softlockup_tick(void) | |||
317 | static inline void touch_softlockup_watchdog(void) | 324 | static inline void touch_softlockup_watchdog(void) |
318 | { | 325 | { |
319 | } | 326 | } |
327 | static inline void touch_softlockup_watchdog_sync(void) | ||
328 | { | ||
329 | } | ||
320 | static inline void touch_all_softlockup_watchdogs(void) | 330 | static inline void touch_all_softlockup_watchdogs(void) |
321 | { | 331 | { |
322 | } | 332 | } |
@@ -371,6 +381,8 @@ extern int sysctl_max_map_count; | |||
371 | 381 | ||
372 | #include <linux/aio.h> | 382 | #include <linux/aio.h> |
373 | 383 | ||
384 | #ifdef CONFIG_MMU | ||
385 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | ||
374 | extern unsigned long | 386 | extern unsigned long |
375 | arch_get_unmapped_area(struct file *, unsigned long, unsigned long, | 387 | arch_get_unmapped_area(struct file *, unsigned long, unsigned long, |
376 | unsigned long, unsigned long); | 388 | unsigned long, unsigned long); |
@@ -380,6 +392,9 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
380 | unsigned long flags); | 392 | unsigned long flags); |
381 | extern void arch_unmap_area(struct mm_struct *, unsigned long); | 393 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
382 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | 394 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
395 | #else | ||
396 | static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | ||
397 | #endif | ||
383 | 398 | ||
384 | #if USE_SPLIT_PTLOCKS | 399 | #if USE_SPLIT_PTLOCKS |
385 | /* | 400 | /* |
@@ -1091,7 +1106,8 @@ struct sched_class { | |||
1091 | enum cpu_idle_type idle); | 1106 | enum cpu_idle_type idle); |
1092 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1107 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
1093 | void (*post_schedule) (struct rq *this_rq); | 1108 | void (*post_schedule) (struct rq *this_rq); |
1094 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1109 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); |
1110 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
1095 | 1111 | ||
1096 | void (*set_cpus_allowed)(struct task_struct *p, | 1112 | void (*set_cpus_allowed)(struct task_struct *p, |
1097 | const struct cpumask *newmask); | 1113 | const struct cpumask *newmask); |
@@ -1102,7 +1118,7 @@ struct sched_class { | |||
1102 | 1118 | ||
1103 | void (*set_curr_task) (struct rq *rq); | 1119 | void (*set_curr_task) (struct rq *rq); |
1104 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | 1120 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); |
1105 | void (*task_new) (struct rq *rq, struct task_struct *p); | 1121 | void (*task_fork) (struct task_struct *p); |
1106 | 1122 | ||
1107 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, | 1123 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, |
1108 | int running); | 1124 | int running); |
@@ -1111,10 +1127,11 @@ struct sched_class { | |||
1111 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, | 1127 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, |
1112 | int oldprio, int running); | 1128 | int oldprio, int running); |
1113 | 1129 | ||
1114 | unsigned int (*get_rr_interval) (struct task_struct *task); | 1130 | unsigned int (*get_rr_interval) (struct rq *rq, |
1131 | struct task_struct *task); | ||
1115 | 1132 | ||
1116 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1133 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1117 | void (*moved_group) (struct task_struct *p); | 1134 | void (*moved_group) (struct task_struct *p, int on_rq); |
1118 | #endif | 1135 | #endif |
1119 | }; | 1136 | }; |
1120 | 1137 | ||
@@ -1151,8 +1168,6 @@ struct sched_entity { | |||
1151 | u64 start_runtime; | 1168 | u64 start_runtime; |
1152 | u64 avg_wakeup; | 1169 | u64 avg_wakeup; |
1153 | 1170 | ||
1154 | u64 avg_running; | ||
1155 | |||
1156 | #ifdef CONFIG_SCHEDSTATS | 1171 | #ifdef CONFIG_SCHEDSTATS |
1157 | u64 wait_start; | 1172 | u64 wait_start; |
1158 | u64 wait_max; | 1173 | u64 wait_max; |
@@ -1175,7 +1190,6 @@ struct sched_entity { | |||
1175 | u64 nr_failed_migrations_running; | 1190 | u64 nr_failed_migrations_running; |
1176 | u64 nr_failed_migrations_hot; | 1191 | u64 nr_failed_migrations_hot; |
1177 | u64 nr_forced_migrations; | 1192 | u64 nr_forced_migrations; |
1178 | u64 nr_forced2_migrations; | ||
1179 | 1193 | ||
1180 | u64 nr_wakeups; | 1194 | u64 nr_wakeups; |
1181 | u64 nr_wakeups_sync; | 1195 | u64 nr_wakeups_sync; |
@@ -1359,7 +1373,7 @@ struct task_struct { | |||
1359 | char comm[TASK_COMM_LEN]; /* executable name excluding path | 1373 | char comm[TASK_COMM_LEN]; /* executable name excluding path |
1360 | - access with [gs]et_task_comm (which lock | 1374 | - access with [gs]et_task_comm (which lock |
1361 | it with task_lock()) | 1375 | it with task_lock()) |
1362 | - initialized normally by flush_old_exec */ | 1376 | - initialized normally by setup_new_exec */ |
1363 | /* file system info */ | 1377 | /* file system info */ |
1364 | int link_count, total_link_count; | 1378 | int link_count, total_link_count; |
1365 | #ifdef CONFIG_SYSVIPC | 1379 | #ifdef CONFIG_SYSVIPC |
@@ -1411,7 +1425,7 @@ struct task_struct { | |||
1411 | #endif | 1425 | #endif |
1412 | 1426 | ||
1413 | /* Protection of the PI data structures: */ | 1427 | /* Protection of the PI data structures: */ |
1414 | spinlock_t pi_lock; | 1428 | raw_spinlock_t pi_lock; |
1415 | 1429 | ||
1416 | #ifdef CONFIG_RT_MUTEXES | 1430 | #ifdef CONFIG_RT_MUTEXES |
1417 | /* PI waiters blocked on a rt_mutex held by this task */ | 1431 | /* PI waiters blocked on a rt_mutex held by this task */ |
@@ -1544,10 +1558,18 @@ struct task_struct { | |||
1544 | unsigned long trace_recursion; | 1558 | unsigned long trace_recursion; |
1545 | #endif /* CONFIG_TRACING */ | 1559 | #endif /* CONFIG_TRACING */ |
1546 | unsigned long stack_start; | 1560 | unsigned long stack_start; |
1561 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ | ||
1562 | struct memcg_batch_info { | ||
1563 | int do_batch; /* incremented when batch uncharge started */ | ||
1564 | struct mem_cgroup *memcg; /* target memcg of uncharge */ | ||
1565 | unsigned long bytes; /* uncharged usage */ | ||
1566 | unsigned long memsw_bytes; /* uncharged mem+swap usage */ | ||
1567 | } memcg_batch; | ||
1568 | #endif | ||
1547 | }; | 1569 | }; |
1548 | 1570 | ||
1549 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1571 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
1550 | #define tsk_cpumask(tsk) (&(tsk)->cpus_allowed) | 1572 | #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) |
1551 | 1573 | ||
1552 | /* | 1574 | /* |
1553 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT | 1575 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT |
@@ -1840,7 +1862,8 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1840 | extern int sched_clock_stable; | 1862 | extern int sched_clock_stable; |
1841 | #endif | 1863 | #endif |
1842 | 1864 | ||
1843 | extern unsigned long long sched_clock(void); | 1865 | /* ftrace calls sched_clock() directly */ |
1866 | extern unsigned long long notrace sched_clock(void); | ||
1844 | 1867 | ||
1845 | extern void sched_clock_init(void); | 1868 | extern void sched_clock_init(void); |
1846 | extern u64 sched_clock_cpu(int cpu); | 1869 | extern u64 sched_clock_cpu(int cpu); |
@@ -1903,14 +1926,22 @@ extern unsigned int sysctl_sched_wakeup_granularity; | |||
1903 | extern unsigned int sysctl_sched_shares_ratelimit; | 1926 | extern unsigned int sysctl_sched_shares_ratelimit; |
1904 | extern unsigned int sysctl_sched_shares_thresh; | 1927 | extern unsigned int sysctl_sched_shares_thresh; |
1905 | extern unsigned int sysctl_sched_child_runs_first; | 1928 | extern unsigned int sysctl_sched_child_runs_first; |
1929 | |||
1930 | enum sched_tunable_scaling { | ||
1931 | SCHED_TUNABLESCALING_NONE, | ||
1932 | SCHED_TUNABLESCALING_LOG, | ||
1933 | SCHED_TUNABLESCALING_LINEAR, | ||
1934 | SCHED_TUNABLESCALING_END, | ||
1935 | }; | ||
1936 | extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; | ||
1937 | |||
1906 | #ifdef CONFIG_SCHED_DEBUG | 1938 | #ifdef CONFIG_SCHED_DEBUG |
1907 | extern unsigned int sysctl_sched_features; | ||
1908 | extern unsigned int sysctl_sched_migration_cost; | 1939 | extern unsigned int sysctl_sched_migration_cost; |
1909 | extern unsigned int sysctl_sched_nr_migrate; | 1940 | extern unsigned int sysctl_sched_nr_migrate; |
1910 | extern unsigned int sysctl_sched_time_avg; | 1941 | extern unsigned int sysctl_sched_time_avg; |
1911 | extern unsigned int sysctl_timer_migration; | 1942 | extern unsigned int sysctl_timer_migration; |
1912 | 1943 | ||
1913 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1944 | int sched_proc_update_handler(struct ctl_table *table, int write, |
1914 | void __user *buffer, size_t *length, | 1945 | void __user *buffer, size_t *length, |
1915 | loff_t *ppos); | 1946 | loff_t *ppos); |
1916 | #endif | 1947 | #endif |
@@ -2066,7 +2097,6 @@ extern int kill_proc_info(int, struct siginfo *, pid_t); | |||
2066 | extern int do_notify_parent(struct task_struct *, int); | 2097 | extern int do_notify_parent(struct task_struct *, int); |
2067 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); | 2098 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); |
2068 | extern void force_sig(int, struct task_struct *); | 2099 | extern void force_sig(int, struct task_struct *); |
2069 | extern void force_sig_specific(int, struct task_struct *); | ||
2070 | extern int send_sig(int, struct task_struct *, int); | 2100 | extern int send_sig(int, struct task_struct *, int); |
2071 | extern void zap_other_threads(struct task_struct *p); | 2101 | extern void zap_other_threads(struct task_struct *p); |
2072 | extern struct sigqueue *sigqueue_alloc(void); | 2102 | extern struct sigqueue *sigqueue_alloc(void); |
@@ -2085,11 +2115,6 @@ static inline int kill_cad_pid(int sig, int priv) | |||
2085 | #define SEND_SIG_PRIV ((struct siginfo *) 1) | 2115 | #define SEND_SIG_PRIV ((struct siginfo *) 1) |
2086 | #define SEND_SIG_FORCED ((struct siginfo *) 2) | 2116 | #define SEND_SIG_FORCED ((struct siginfo *) 2) |
2087 | 2117 | ||
2088 | static inline int is_si_special(const struct siginfo *info) | ||
2089 | { | ||
2090 | return info <= SEND_SIG_FORCED; | ||
2091 | } | ||
2092 | |||
2093 | /* | 2118 | /* |
2094 | * True if we are on the alternate signal stack. | 2119 | * True if we are on the alternate signal stack. |
2095 | */ | 2120 | */ |
@@ -2475,8 +2500,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) | |||
2475 | 2500 | ||
2476 | #endif /* CONFIG_SMP */ | 2501 | #endif /* CONFIG_SMP */ |
2477 | 2502 | ||
2478 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | ||
2479 | |||
2480 | #ifdef CONFIG_TRACING | 2503 | #ifdef CONFIG_TRACING |
2481 | extern void | 2504 | extern void |
2482 | __trace_special(void *__tr, void *__data, | 2505 | __trace_special(void *__tr, void *__data, |
@@ -2585,7 +2608,27 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
2585 | } | 2608 | } |
2586 | #endif /* CONFIG_MM_OWNER */ | 2609 | #endif /* CONFIG_MM_OWNER */ |
2587 | 2610 | ||
2588 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | 2611 | static inline unsigned long task_rlimit(const struct task_struct *tsk, |
2612 | unsigned int limit) | ||
2613 | { | ||
2614 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); | ||
2615 | } | ||
2616 | |||
2617 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | ||
2618 | unsigned int limit) | ||
2619 | { | ||
2620 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); | ||
2621 | } | ||
2622 | |||
2623 | static inline unsigned long rlimit(unsigned int limit) | ||
2624 | { | ||
2625 | return task_rlimit(current, limit); | ||
2626 | } | ||
2627 | |||
2628 | static inline unsigned long rlimit_max(unsigned int limit) | ||
2629 | { | ||
2630 | return task_rlimit_max(current, limit); | ||
2631 | } | ||
2589 | 2632 | ||
2590 | #endif /* __KERNEL__ */ | 2633 | #endif /* __KERNEL__ */ |
2591 | 2634 | ||
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h index 1ee2c05142f6..899fbb487c94 100644 --- a/include/linux/screen_info.h +++ b/include/linux/screen_info.h | |||
@@ -14,7 +14,8 @@ struct screen_info { | |||
14 | __u16 orig_video_page; /* 0x04 */ | 14 | __u16 orig_video_page; /* 0x04 */ |
15 | __u8 orig_video_mode; /* 0x06 */ | 15 | __u8 orig_video_mode; /* 0x06 */ |
16 | __u8 orig_video_cols; /* 0x07 */ | 16 | __u8 orig_video_cols; /* 0x07 */ |
17 | __u16 unused2; /* 0x08 */ | 17 | __u8 flags; /* 0x08 */ |
18 | __u8 unused2; /* 0x09 */ | ||
18 | __u16 orig_video_ega_bx;/* 0x0a */ | 19 | __u16 orig_video_ega_bx;/* 0x0a */ |
19 | __u16 unused3; /* 0x0c */ | 20 | __u16 unused3; /* 0x0c */ |
20 | __u8 orig_video_lines; /* 0x0e */ | 21 | __u8 orig_video_lines; /* 0x0e */ |
@@ -65,6 +66,8 @@ struct screen_info { | |||
65 | 66 | ||
66 | #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ | 67 | #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ |
67 | 68 | ||
69 | #define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ | ||
70 | |||
68 | #ifdef __KERNEL__ | 71 | #ifdef __KERNEL__ |
69 | extern struct screen_info screen_info; | 72 | extern struct screen_info screen_info; |
70 | 73 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 466cbadbd1ef..2c627d361c02 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -95,8 +95,13 @@ struct seq_file; | |||
95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
97 | 97 | ||
98 | #ifdef CONFIG_MMU | ||
98 | extern unsigned long mmap_min_addr; | 99 | extern unsigned long mmap_min_addr; |
99 | extern unsigned long dac_mmap_min_addr; | 100 | extern unsigned long dac_mmap_min_addr; |
101 | #else | ||
102 | #define dac_mmap_min_addr 0UL | ||
103 | #endif | ||
104 | |||
100 | /* | 105 | /* |
101 | * Values used in the task_security_ops calls | 106 | * Values used in the task_security_ops calls |
102 | */ | 107 | */ |
@@ -121,6 +126,7 @@ struct request_sock; | |||
121 | #define LSM_UNSAFE_PTRACE 2 | 126 | #define LSM_UNSAFE_PTRACE 2 |
122 | #define LSM_UNSAFE_PTRACE_CAP 4 | 127 | #define LSM_UNSAFE_PTRACE_CAP 4 |
123 | 128 | ||
129 | #ifdef CONFIG_MMU | ||
124 | /* | 130 | /* |
125 | * If a hint addr is less than mmap_min_addr change hint to be as | 131 | * If a hint addr is less than mmap_min_addr change hint to be as |
126 | * low as possible but still greater than mmap_min_addr | 132 | * low as possible but still greater than mmap_min_addr |
@@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
135 | } | 141 | } |
136 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 142 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
137 | void __user *buffer, size_t *lenp, loff_t *ppos); | 143 | void __user *buffer, size_t *lenp, loff_t *ppos); |
144 | #endif | ||
138 | 145 | ||
139 | #ifdef CONFIG_SECURITY | 146 | #ifdef CONFIG_SECURITY |
140 | 147 | ||
diff --git a/include/linux/sem.h b/include/linux/sem.h index 1b191c176bcd..8a4adbef8a0f 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h | |||
@@ -86,6 +86,7 @@ struct task_struct; | |||
86 | struct sem { | 86 | struct sem { |
87 | int semval; /* current value */ | 87 | int semval; /* current value */ |
88 | int sempid; /* pid of last operation */ | 88 | int sempid; /* pid of last operation */ |
89 | struct list_head sem_pending; /* pending single-sop operations */ | ||
89 | }; | 90 | }; |
90 | 91 | ||
91 | /* One sem_array data structure for each set of semaphores in the system. */ | 92 | /* One sem_array data structure for each set of semaphores in the system. */ |
@@ -96,11 +97,13 @@ struct sem_array { | |||
96 | struct sem *sem_base; /* ptr to first semaphore in array */ | 97 | struct sem *sem_base; /* ptr to first semaphore in array */ |
97 | struct list_head sem_pending; /* pending operations to be processed */ | 98 | struct list_head sem_pending; /* pending operations to be processed */ |
98 | struct list_head list_id; /* undo requests on this array */ | 99 | struct list_head list_id; /* undo requests on this array */ |
99 | unsigned long sem_nsems; /* no. of semaphores in array */ | 100 | int sem_nsems; /* no. of semaphores in array */ |
101 | int complex_count; /* pending complex operations */ | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | /* One queue for each sleeping process in the system. */ | 104 | /* One queue for each sleeping process in the system. */ |
103 | struct sem_queue { | 105 | struct sem_queue { |
106 | struct list_head simple_list; /* queue of pending operations */ | ||
104 | struct list_head list; /* queue of pending operations */ | 107 | struct list_head list; /* queue of pending operations */ |
105 | struct task_struct *sleeper; /* this process */ | 108 | struct task_struct *sleeper; /* this process */ |
106 | struct sem_undo *undo; /* undo structure */ | 109 | struct sem_undo *undo; /* undo structure */ |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 8366d8f12e53..03c0232b4169 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -135,4 +135,22 @@ extern struct list_head *seq_list_start_head(struct list_head *head, | |||
135 | extern struct list_head *seq_list_next(void *v, struct list_head *head, | 135 | extern struct list_head *seq_list_next(void *v, struct list_head *head, |
136 | loff_t *ppos); | 136 | loff_t *ppos); |
137 | 137 | ||
138 | /* | ||
139 | * Helpers for iteration over hlist_head-s in seq_files | ||
140 | */ | ||
141 | |||
142 | extern struct hlist_node *seq_hlist_start(struct hlist_head *head, | ||
143 | loff_t pos); | ||
144 | extern struct hlist_node *seq_hlist_start_head(struct hlist_head *head, | ||
145 | loff_t pos); | ||
146 | extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head, | ||
147 | loff_t *ppos); | ||
148 | |||
149 | extern struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head, | ||
150 | loff_t pos); | ||
151 | extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head, | ||
152 | loff_t pos); | ||
153 | extern struct hlist_node *seq_hlist_next_rcu(void *v, | ||
154 | struct hlist_head *head, | ||
155 | loff_t *ppos); | ||
138 | #endif | 156 | #endif |
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index 850db2e80510..cf9327c051ad 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h | |||
@@ -216,10 +216,10 @@ | |||
216 | 216 | ||
217 | #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ | 217 | #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ |
218 | 218 | ||
219 | #define UART_FCR_PXAR1 0x00 /* receive FIFO treshold = 1 */ | 219 | #define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */ |
220 | #define UART_FCR_PXAR8 0x40 /* receive FIFO treshold = 8 */ | 220 | #define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */ |
221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO treshold = 16 */ | 221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ |
222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO treshold = 32 */ | 222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ |
223 | 223 | ||
224 | 224 | ||
225 | 225 | ||
diff --git a/include/linux/serio.h b/include/linux/serio.h index a640bc2afe76..813d26c247ec 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
@@ -136,25 +136,6 @@ static inline void serio_continue_rx(struct serio *serio) | |||
136 | spin_unlock_irq(&serio->lock); | 136 | spin_unlock_irq(&serio->lock); |
137 | } | 137 | } |
138 | 138 | ||
139 | /* | ||
140 | * Use the following functions to pin serio's driver in process context | ||
141 | */ | ||
142 | static inline int serio_pin_driver(struct serio *serio) | ||
143 | { | ||
144 | return mutex_lock_interruptible(&serio->drv_mutex); | ||
145 | } | ||
146 | |||
147 | static inline void serio_pin_driver_uninterruptible(struct serio *serio) | ||
148 | { | ||
149 | mutex_lock(&serio->drv_mutex); | ||
150 | } | ||
151 | |||
152 | static inline void serio_unpin_driver(struct serio *serio) | ||
153 | { | ||
154 | mutex_unlock(&serio->drv_mutex); | ||
155 | } | ||
156 | |||
157 | |||
158 | #endif | 139 | #endif |
159 | 140 | ||
160 | /* | 141 | /* |
@@ -215,5 +196,6 @@ static inline void serio_unpin_driver(struct serio *serio) | |||
215 | #define SERIO_INEXIO 0x37 | 196 | #define SERIO_INEXIO 0x37 |
216 | #define SERIO_TOUCHIT213 0x38 | 197 | #define SERIO_TOUCHIT213 0x38 |
217 | #define SERIO_W8001 0x39 | 198 | #define SERIO_W8001 0x39 |
199 | #define SERIO_DYNAPRO 0x3a | ||
218 | 200 | ||
219 | #endif | 201 | #endif |
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h index 68e212ff9dde..4ef246f14654 100644 --- a/include/linux/sh_intc.h +++ b/include/linux/sh_intc.h | |||
@@ -57,10 +57,8 @@ struct intc_desc { | |||
57 | struct intc_sense_reg *sense_regs; | 57 | struct intc_sense_reg *sense_regs; |
58 | unsigned int nr_sense_regs; | 58 | unsigned int nr_sense_regs; |
59 | char *name; | 59 | char *name; |
60 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
61 | struct intc_mask_reg *ack_regs; | 60 | struct intc_mask_reg *ack_regs; |
62 | unsigned int nr_ack_regs; | 61 | unsigned int nr_ack_regs; |
63 | #endif | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) | 64 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) |
@@ -73,7 +71,6 @@ struct intc_desc symbol __initdata = { \ | |||
73 | chipname, \ | 71 | chipname, \ |
74 | } | 72 | } |
75 | 73 | ||
76 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
77 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ | 74 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ |
78 | mask_regs, prio_regs, sense_regs, ack_regs) \ | 75 | mask_regs, prio_regs, sense_regs, ack_regs) \ |
79 | struct intc_desc symbol __initdata = { \ | 76 | struct intc_desc symbol __initdata = { \ |
@@ -83,9 +80,11 @@ struct intc_desc symbol __initdata = { \ | |||
83 | chipname, \ | 80 | chipname, \ |
84 | _INTC_ARRAY(ack_regs), \ | 81 | _INTC_ARRAY(ack_regs), \ |
85 | } | 82 | } |
86 | #endif | ||
87 | 83 | ||
88 | void __init register_intc_controller(struct intc_desc *desc); | 84 | void __init register_intc_controller(struct intc_desc *desc); |
89 | int intc_set_priority(unsigned int irq, unsigned int prio); | 85 | int intc_set_priority(unsigned int irq, unsigned int prio); |
90 | 86 | ||
87 | int reserve_irq_vector(unsigned int irq); | ||
88 | void reserve_irq_legacy(void); | ||
89 | |||
91 | #endif /* __SH_INTC_H */ | 90 | #endif /* __SH_INTC_H */ |
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h new file mode 100644 index 000000000000..07c08af9f8f6 --- /dev/null +++ b/include/linux/sh_pfc.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * SuperH Pin Function Controller Support | ||
3 | * | ||
4 | * Copyright (c) 2008 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef __SH_PFC_H | ||
12 | #define __SH_PFC_H | ||
13 | |||
14 | #include <asm-generic/gpio.h> | ||
15 | |||
16 | typedef unsigned short pinmux_enum_t; | ||
17 | typedef unsigned short pinmux_flag_t; | ||
18 | |||
19 | #define PINMUX_TYPE_NONE 0 | ||
20 | #define PINMUX_TYPE_FUNCTION 1 | ||
21 | #define PINMUX_TYPE_GPIO 2 | ||
22 | #define PINMUX_TYPE_OUTPUT 3 | ||
23 | #define PINMUX_TYPE_INPUT 4 | ||
24 | #define PINMUX_TYPE_INPUT_PULLUP 5 | ||
25 | #define PINMUX_TYPE_INPUT_PULLDOWN 6 | ||
26 | |||
27 | #define PINMUX_FLAG_TYPE (0x7) | ||
28 | #define PINMUX_FLAG_WANT_PULLUP (1 << 3) | ||
29 | #define PINMUX_FLAG_WANT_PULLDOWN (1 << 4) | ||
30 | |||
31 | #define PINMUX_FLAG_DBIT_SHIFT 5 | ||
32 | #define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT) | ||
33 | #define PINMUX_FLAG_DREG_SHIFT 10 | ||
34 | #define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) | ||
35 | |||
36 | struct pinmux_gpio { | ||
37 | pinmux_enum_t enum_id; | ||
38 | pinmux_flag_t flags; | ||
39 | }; | ||
40 | |||
41 | #define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark } | ||
42 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 | ||
43 | |||
44 | struct pinmux_cfg_reg { | ||
45 | unsigned long reg, reg_width, field_width; | ||
46 | unsigned long *cnt; | ||
47 | pinmux_enum_t *enum_ids; | ||
48 | }; | ||
49 | |||
50 | #define PINMUX_CFG_REG(name, r, r_width, f_width) \ | ||
51 | .reg = r, .reg_width = r_width, .field_width = f_width, \ | ||
52 | .cnt = (unsigned long [r_width / f_width]) {}, \ | ||
53 | .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ | ||
54 | |||
55 | struct pinmux_data_reg { | ||
56 | unsigned long reg, reg_width, reg_shadow; | ||
57 | pinmux_enum_t *enum_ids; | ||
58 | }; | ||
59 | |||
60 | #define PINMUX_DATA_REG(name, r, r_width) \ | ||
61 | .reg = r, .reg_width = r_width, \ | ||
62 | .enum_ids = (pinmux_enum_t [r_width]) \ | ||
63 | |||
64 | struct pinmux_range { | ||
65 | pinmux_enum_t begin; | ||
66 | pinmux_enum_t end; | ||
67 | pinmux_enum_t force; | ||
68 | }; | ||
69 | |||
70 | struct pinmux_info { | ||
71 | char *name; | ||
72 | pinmux_enum_t reserved_id; | ||
73 | struct pinmux_range data; | ||
74 | struct pinmux_range input; | ||
75 | struct pinmux_range input_pd; | ||
76 | struct pinmux_range input_pu; | ||
77 | struct pinmux_range output; | ||
78 | struct pinmux_range mark; | ||
79 | struct pinmux_range function; | ||
80 | |||
81 | unsigned first_gpio, last_gpio; | ||
82 | |||
83 | struct pinmux_gpio *gpios; | ||
84 | struct pinmux_cfg_reg *cfg_regs; | ||
85 | struct pinmux_data_reg *data_regs; | ||
86 | |||
87 | pinmux_enum_t *gpio_data; | ||
88 | unsigned int gpio_data_size; | ||
89 | |||
90 | unsigned long *gpio_in_use; | ||
91 | struct gpio_chip chip; | ||
92 | }; | ||
93 | |||
94 | int register_pinmux(struct pinmux_info *pip); | ||
95 | |||
96 | #endif /* __SH_PFC_H */ | ||
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index deee7afd8d66..e164291fb3e7 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -41,20 +41,4 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | |||
41 | extern int init_tmpfs(void); | 41 | extern int init_tmpfs(void); |
42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); | 42 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); |
43 | 43 | ||
44 | #ifdef CONFIG_TMPFS_POSIX_ACL | ||
45 | int shmem_check_acl(struct inode *, int); | ||
46 | int shmem_acl_init(struct inode *, struct inode *); | ||
47 | |||
48 | extern struct xattr_handler shmem_xattr_acl_access_handler; | ||
49 | extern struct xattr_handler shmem_xattr_acl_default_handler; | ||
50 | |||
51 | extern struct generic_acl_operations shmem_acl_ops; | ||
52 | |||
53 | #else | ||
54 | static inline int shmem_acl_init(struct inode *inode, struct inode *dir) | ||
55 | { | ||
56 | return 0; | ||
57 | } | ||
58 | #endif /* CONFIG_TMPFS_POSIX_ACL */ | ||
59 | |||
60 | #endif | 44 | #endif |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ae836fded530..ba0f8e3a9cda 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -738,7 +738,7 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb, | |||
738 | } | 738 | } |
739 | 739 | ||
740 | /** | 740 | /** |
741 | * skb_peek | 741 | * skb_peek - peek at the head of an &sk_buff_head |
742 | * @list_: list to peek at | 742 | * @list_: list to peek at |
743 | * | 743 | * |
744 | * Peek an &sk_buff. Unlike most other operations you _MUST_ | 744 | * Peek an &sk_buff. Unlike most other operations you _MUST_ |
@@ -759,7 +759,7 @@ static inline struct sk_buff *skb_peek(struct sk_buff_head *list_) | |||
759 | } | 759 | } |
760 | 760 | ||
761 | /** | 761 | /** |
762 | * skb_peek_tail | 762 | * skb_peek_tail - peek at the tail of an &sk_buff_head |
763 | * @list_: list to peek at | 763 | * @list_: list to peek at |
764 | * | 764 | * |
765 | * Peek an &sk_buff. Unlike most other operations you _MUST_ | 765 | * Peek an &sk_buff. Unlike most other operations you _MUST_ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 850d057500de..ca6b2b317991 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -110,7 +110,7 @@ extern struct cache_sizes malloc_sizes[]; | |||
110 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 110 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
111 | void *__kmalloc(size_t size, gfp_t flags); | 111 | void *__kmalloc(size_t size, gfp_t flags); |
112 | 112 | ||
113 | #ifdef CONFIG_KMEMTRACE | 113 | #ifdef CONFIG_TRACING |
114 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); | 114 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); |
115 | extern size_t slab_buffer_size(struct kmem_cache *cachep); | 115 | extern size_t slab_buffer_size(struct kmem_cache *cachep); |
116 | #else | 116 | #else |
@@ -166,7 +166,7 @@ found: | |||
166 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | 166 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
167 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 167 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
168 | 168 | ||
169 | #ifdef CONFIG_KMEMTRACE | 169 | #ifdef CONFIG_TRACING |
170 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, | 170 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, |
171 | gfp_t flags, | 171 | gfp_t flags, |
172 | int nodeid); | 172 | int nodeid); |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 5ad70a60fd74..1e14beb23f9b 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -217,7 +217,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size) | |||
217 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 217 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
218 | void *__kmalloc(size_t size, gfp_t flags); | 218 | void *__kmalloc(size_t size, gfp_t flags); |
219 | 219 | ||
220 | #ifdef CONFIG_KMEMTRACE | 220 | #ifdef CONFIG_TRACING |
221 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); | 221 | extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); |
222 | #else | 222 | #else |
223 | static __always_inline void * | 223 | static __always_inline void * |
@@ -266,7 +266,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
266 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 266 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
267 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 267 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
268 | 268 | ||
269 | #ifdef CONFIG_KMEMTRACE | 269 | #ifdef CONFIG_TRACING |
270 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, | 270 | extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, |
271 | gfp_t gfpflags, | 271 | gfp_t gfpflags, |
272 | int node); | 272 | int node); |
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h index d53642d2d899..67ed2c542831 100644 --- a/include/linux/sm501-regs.h +++ b/include/linux/sm501-regs.h | |||
@@ -31,6 +31,8 @@ | |||
31 | #define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) | 31 | #define SM501_SYSCTRL_PCI_SUBSYS_LOCK (1<<11) |
32 | #define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) | 32 | #define SM501_SYSCTRL_PCI_BURST_READ_EN (1<<15) |
33 | 33 | ||
34 | #define SM501_SYSCTRL_2D_ENGINE_STATUS (1<<19) | ||
35 | |||
34 | /* miscellaneous control */ | 36 | /* miscellaneous control */ |
35 | 37 | ||
36 | #define SM501_MISC_CONTROL (0x000004) | 38 | #define SM501_MISC_CONTROL (0x000004) |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 0f953fe40413..e28f5a0182e8 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -257,6 +257,7 @@ enum | |||
257 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ | 257 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ |
258 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ | 258 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ |
259 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ | 259 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ |
260 | LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ | ||
260 | __LINUX_MIB_XFRMMAX | 261 | __LINUX_MIB_XFRMMAX |
261 | }; | 262 | }; |
262 | 263 | ||
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h index 34c4475ac4a2..4f95c1aac2fd 100644 --- a/include/linux/sonypi.h +++ b/include/linux/sonypi.h | |||
@@ -111,6 +111,7 @@ | |||
111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 | 111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 |
112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 | 112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 |
113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 | 113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 |
114 | #define SONYPI_EVENT_MEDIA_PRESSED 72 | ||
114 | 115 | ||
115 | /* get/set brightness */ | 116 | /* get/set brightness */ |
116 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) | 117 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) |
diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h index 4231104c9afa..6334cee1a3be 100644 --- a/include/linux/spi/ad7879.h +++ b/include/linux/spi/ad7879.h | |||
@@ -28,8 +28,12 @@ struct ad7879_platform_data { | |||
28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) | 28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) |
29 | */ | 29 | */ |
30 | u8 median; | 30 | u8 median; |
31 | /* 1 = AUX/VBAT/GPIO set to GPIO Output */ | 31 | /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib |
32 | u8 gpio_output; | 32 | * requires CONFIG_GPIOLIB |
33 | /* Initial GPIO pin state (valid if gpio_output = 1) */ | 33 | */ |
34 | u8 gpio_default; | 34 | bool gpio_export; |
35 | /* identifies the first GPIO number handled by this chip; | ||
36 | * or, if negative, requests dynamic ID allocation. | ||
37 | */ | ||
38 | s32 gpio_base; | ||
35 | }; | 39 | }; |
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h new file mode 100644 index 000000000000..51b3e771a9a3 --- /dev/null +++ b/include/linux/spi/dw_spi.h | |||
@@ -0,0 +1,212 @@ | |||
1 | #ifndef DW_SPI_HEADER_H | ||
2 | #define DW_SPI_HEADER_H | ||
3 | #include <linux/io.h> | ||
4 | |||
5 | /* Bit fields in CTRLR0 */ | ||
6 | #define SPI_DFS_OFFSET 0 | ||
7 | |||
8 | #define SPI_FRF_OFFSET 4 | ||
9 | #define SPI_FRF_SPI 0x0 | ||
10 | #define SPI_FRF_SSP 0x1 | ||
11 | #define SPI_FRF_MICROWIRE 0x2 | ||
12 | #define SPI_FRF_RESV 0x3 | ||
13 | |||
14 | #define SPI_MODE_OFFSET 6 | ||
15 | #define SPI_SCPH_OFFSET 6 | ||
16 | #define SPI_SCOL_OFFSET 7 | ||
17 | #define SPI_TMOD_OFFSET 8 | ||
18 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ | ||
19 | #define SPI_TMOD_TO 0x1 /* xmit only */ | ||
20 | #define SPI_TMOD_RO 0x2 /* recv only */ | ||
21 | #define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */ | ||
22 | |||
23 | #define SPI_SLVOE_OFFSET 10 | ||
24 | #define SPI_SRL_OFFSET 11 | ||
25 | #define SPI_CFS_OFFSET 12 | ||
26 | |||
27 | /* Bit fields in SR, 7 bits */ | ||
28 | #define SR_MASK 0x7f /* cover 7 bits */ | ||
29 | #define SR_BUSY (1 << 0) | ||
30 | #define SR_TF_NOT_FULL (1 << 1) | ||
31 | #define SR_TF_EMPT (1 << 2) | ||
32 | #define SR_RF_NOT_EMPT (1 << 3) | ||
33 | #define SR_RF_FULL (1 << 4) | ||
34 | #define SR_TX_ERR (1 << 5) | ||
35 | #define SR_DCOL (1 << 6) | ||
36 | |||
37 | /* Bit fields in ISR, IMR, RISR, 7 bits */ | ||
38 | #define SPI_INT_TXEI (1 << 0) | ||
39 | #define SPI_INT_TXOI (1 << 1) | ||
40 | #define SPI_INT_RXUI (1 << 2) | ||
41 | #define SPI_INT_RXOI (1 << 3) | ||
42 | #define SPI_INT_RXFI (1 << 4) | ||
43 | #define SPI_INT_MSTI (1 << 5) | ||
44 | |||
45 | /* TX RX interrupt level threshhold, max can be 256 */ | ||
46 | #define SPI_INT_THRESHOLD 32 | ||
47 | |||
48 | enum dw_ssi_type { | ||
49 | SSI_MOTO_SPI = 0, | ||
50 | SSI_TI_SSP, | ||
51 | SSI_NS_MICROWIRE, | ||
52 | }; | ||
53 | |||
54 | struct dw_spi_reg { | ||
55 | u32 ctrl0; | ||
56 | u32 ctrl1; | ||
57 | u32 ssienr; | ||
58 | u32 mwcr; | ||
59 | u32 ser; | ||
60 | u32 baudr; | ||
61 | u32 txfltr; | ||
62 | u32 rxfltr; | ||
63 | u32 txflr; | ||
64 | u32 rxflr; | ||
65 | u32 sr; | ||
66 | u32 imr; | ||
67 | u32 isr; | ||
68 | u32 risr; | ||
69 | u32 txoicr; | ||
70 | u32 rxoicr; | ||
71 | u32 rxuicr; | ||
72 | u32 msticr; | ||
73 | u32 icr; | ||
74 | u32 dmacr; | ||
75 | u32 dmatdlr; | ||
76 | u32 dmardlr; | ||
77 | u32 idr; | ||
78 | u32 version; | ||
79 | u32 dr; /* Currently oper as 32 bits, | ||
80 | though only low 16 bits matters */ | ||
81 | } __packed; | ||
82 | |||
83 | struct dw_spi { | ||
84 | struct spi_master *master; | ||
85 | struct spi_device *cur_dev; | ||
86 | struct device *parent_dev; | ||
87 | enum dw_ssi_type type; | ||
88 | |||
89 | void __iomem *regs; | ||
90 | unsigned long paddr; | ||
91 | u32 iolen; | ||
92 | int irq; | ||
93 | u32 max_freq; /* max bus freq supported */ | ||
94 | |||
95 | u16 bus_num; | ||
96 | u16 num_cs; /* supported slave numbers */ | ||
97 | |||
98 | /* Driver message queue */ | ||
99 | struct workqueue_struct *workqueue; | ||
100 | struct work_struct pump_messages; | ||
101 | spinlock_t lock; | ||
102 | struct list_head queue; | ||
103 | int busy; | ||
104 | int run; | ||
105 | |||
106 | /* Message Transfer pump */ | ||
107 | struct tasklet_struct pump_transfers; | ||
108 | |||
109 | /* Current message transfer state info */ | ||
110 | struct spi_message *cur_msg; | ||
111 | struct spi_transfer *cur_transfer; | ||
112 | struct chip_data *cur_chip; | ||
113 | struct chip_data *prev_chip; | ||
114 | size_t len; | ||
115 | void *tx; | ||
116 | void *tx_end; | ||
117 | void *rx; | ||
118 | void *rx_end; | ||
119 | int dma_mapped; | ||
120 | dma_addr_t rx_dma; | ||
121 | dma_addr_t tx_dma; | ||
122 | size_t rx_map_len; | ||
123 | size_t tx_map_len; | ||
124 | u8 n_bytes; /* current is a 1/2 bytes op */ | ||
125 | u8 max_bits_per_word; /* maxim is 16b */ | ||
126 | u32 dma_width; | ||
127 | int cs_change; | ||
128 | int (*write)(struct dw_spi *dws); | ||
129 | int (*read)(struct dw_spi *dws); | ||
130 | irqreturn_t (*transfer_handler)(struct dw_spi *dws); | ||
131 | void (*cs_control)(u32 command); | ||
132 | |||
133 | /* Dma info */ | ||
134 | int dma_inited; | ||
135 | struct dma_chan *txchan; | ||
136 | struct dma_chan *rxchan; | ||
137 | int txdma_done; | ||
138 | int rxdma_done; | ||
139 | u64 tx_param; | ||
140 | u64 rx_param; | ||
141 | struct device *dma_dev; | ||
142 | dma_addr_t dma_addr; | ||
143 | |||
144 | /* Bus interface info */ | ||
145 | void *priv; | ||
146 | #ifdef CONFIG_DEBUG_FS | ||
147 | struct dentry *debugfs; | ||
148 | #endif | ||
149 | }; | ||
150 | |||
151 | #define dw_readl(dw, name) \ | ||
152 | __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
153 | #define dw_writel(dw, name, val) \ | ||
154 | __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
155 | #define dw_readw(dw, name) \ | ||
156 | __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
157 | #define dw_writew(dw, name, val) \ | ||
158 | __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
159 | |||
160 | static inline void spi_enable_chip(struct dw_spi *dws, int enable) | ||
161 | { | ||
162 | dw_writel(dws, ssienr, (enable ? 1 : 0)); | ||
163 | } | ||
164 | |||
165 | static inline void spi_set_clk(struct dw_spi *dws, u16 div) | ||
166 | { | ||
167 | dw_writel(dws, baudr, div); | ||
168 | } | ||
169 | |||
170 | static inline void spi_chip_sel(struct dw_spi *dws, u16 cs) | ||
171 | { | ||
172 | if (cs > dws->num_cs) | ||
173 | return; | ||
174 | dw_writel(dws, ser, 1 << cs); | ||
175 | } | ||
176 | |||
177 | /* Disable IRQ bits */ | ||
178 | static inline void spi_mask_intr(struct dw_spi *dws, u32 mask) | ||
179 | { | ||
180 | u32 new_mask; | ||
181 | |||
182 | new_mask = dw_readl(dws, imr) & ~mask; | ||
183 | dw_writel(dws, imr, new_mask); | ||
184 | } | ||
185 | |||
186 | /* Enable IRQ bits */ | ||
187 | static inline void spi_umask_intr(struct dw_spi *dws, u32 mask) | ||
188 | { | ||
189 | u32 new_mask; | ||
190 | |||
191 | new_mask = dw_readl(dws, imr) | mask; | ||
192 | dw_writel(dws, imr, new_mask); | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * Each SPI slave device to work with dw_api controller should | ||
197 | * has such a structure claiming its working mode (PIO/DMA etc), | ||
198 | * which can be save in the "controller_data" member of the | ||
199 | * struct spi_device | ||
200 | */ | ||
201 | struct dw_spi_chip { | ||
202 | u8 poll_mode; /* 0 for contoller polling mode */ | ||
203 | u8 type; /* SPI/SSP/Micrwire */ | ||
204 | u8 enable_dma; | ||
205 | void (*cs_control)(u32 command); | ||
206 | }; | ||
207 | |||
208 | extern int dw_spi_add_host(struct dw_spi *dws); | ||
209 | extern void dw_spi_remove_host(struct dw_spi *dws); | ||
210 | extern int dw_spi_suspend_host(struct dw_spi *dws); | ||
211 | extern int dw_spi_resume_host(struct dw_spi *dws); | ||
212 | #endif /* DW_SPI_HEADER_H */ | ||
diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h new file mode 100644 index 000000000000..2e8db3d2d2e5 --- /dev/null +++ b/include/linux/spi/sh_msiof.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __SPI_SH_MSIOF_H__ | ||
2 | #define __SPI_SH_MSIOF_H__ | ||
3 | |||
4 | struct sh_msiof_spi_info { | ||
5 | int tx_fifo_override; | ||
6 | int rx_fifo_override; | ||
7 | u16 num_chipselect; | ||
8 | }; | ||
9 | |||
10 | #endif /* __SPI_SH_MSIOF_H__ */ | ||
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index eed4254bd503..3274c507b8a9 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -15,7 +15,7 @@ | |||
15 | * Some hardware works well with requests at spi_transfer scope: | 15 | * Some hardware works well with requests at spi_transfer scope: |
16 | * | 16 | * |
17 | * - Drivers leveraging smarter hardware, with fifos or DMA; or for half | 17 | * - Drivers leveraging smarter hardware, with fifos or DMA; or for half |
18 | * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), | 18 | * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(), |
19 | * and custom setup()/cleanup() methods. | 19 | * and custom setup()/cleanup() methods. |
20 | */ | 20 | */ |
21 | 21 | ||
diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h new file mode 100644 index 000000000000..6f17278810b0 --- /dev/null +++ b/include/linux/spi/xilinx_spi.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __LINUX_SPI_XILINX_SPI_H | ||
2 | #define __LINUX_SPI_XILINX_SPI_H | ||
3 | |||
4 | /** | ||
5 | * struct xspi_platform_data - Platform data of the Xilinx SPI driver | ||
6 | * @num_chipselect: Number of chip select by the IP. | ||
7 | * @little_endian: If registers should be accessed little endian or not. | ||
8 | * @bits_per_word: Number of bits per word. | ||
9 | * @devices: Devices to add when the driver is probed. | ||
10 | * @num_devices: Number of devices in the devices array. | ||
11 | */ | ||
12 | struct xspi_platform_data { | ||
13 | u16 num_chipselect; | ||
14 | bool little_endian; | ||
15 | u8 bits_per_word; | ||
16 | struct spi_board_info *devices; | ||
17 | u8 num_devices; | ||
18 | }; | ||
19 | |||
20 | #endif /* __LINUX_SPI_XILINX_SPI_H */ | ||
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 71dccfeb0d88..86088213334a 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -8,13 +8,13 @@ | |||
8 | * | 8 | * |
9 | * on SMP builds: | 9 | * on SMP builds: |
10 | * | 10 | * |
11 | * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the | 11 | * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the |
12 | * initializers | 12 | * initializers |
13 | * | 13 | * |
14 | * linux/spinlock_types.h: | 14 | * linux/spinlock_types.h: |
15 | * defines the generic type and initializers | 15 | * defines the generic type and initializers |
16 | * | 16 | * |
17 | * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel | 17 | * asm/spinlock.h: contains the arch_spin_*()/etc. lowlevel |
18 | * implementations, mostly inline assembly code | 18 | * implementations, mostly inline assembly code |
19 | * | 19 | * |
20 | * (also included on UP-debug builds:) | 20 | * (also included on UP-debug builds:) |
@@ -34,7 +34,7 @@ | |||
34 | * defines the generic type and initializers | 34 | * defines the generic type and initializers |
35 | * | 35 | * |
36 | * linux/spinlock_up.h: | 36 | * linux/spinlock_up.h: |
37 | * contains the __raw_spin_*()/etc. version of UP | 37 | * contains the arch_spin_*()/etc. version of UP |
38 | * builds. (which are NOPs on non-debug, non-preempt | 38 | * builds. (which are NOPs on non-debug, non-preempt |
39 | * builds) | 39 | * builds) |
40 | * | 40 | * |
@@ -75,12 +75,12 @@ | |||
75 | #define __lockfunc __attribute__((section(".spinlock.text"))) | 75 | #define __lockfunc __attribute__((section(".spinlock.text"))) |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Pull the raw_spinlock_t and raw_rwlock_t definitions: | 78 | * Pull the arch_spinlock_t and arch_rwlock_t definitions: |
79 | */ | 79 | */ |
80 | #include <linux/spinlock_types.h> | 80 | #include <linux/spinlock_types.h> |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): | 83 | * Pull the arch_spin*() functions/declarations (UP-nondebug doesnt need them): |
84 | */ | 84 | */ |
85 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_SMP |
86 | # include <asm/spinlock.h> | 86 | # include <asm/spinlock.h> |
@@ -89,45 +89,31 @@ | |||
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #ifdef CONFIG_DEBUG_SPINLOCK | 91 | #ifdef CONFIG_DEBUG_SPINLOCK |
92 | extern void __spin_lock_init(spinlock_t *lock, const char *name, | 92 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, |
93 | struct lock_class_key *key); | 93 | struct lock_class_key *key); |
94 | # define spin_lock_init(lock) \ | 94 | # define raw_spin_lock_init(lock) \ |
95 | do { \ | 95 | do { \ |
96 | static struct lock_class_key __key; \ | 96 | static struct lock_class_key __key; \ |
97 | \ | 97 | \ |
98 | __spin_lock_init((lock), #lock, &__key); \ | 98 | __raw_spin_lock_init((lock), #lock, &__key); \ |
99 | } while (0) | 99 | } while (0) |
100 | 100 | ||
101 | #else | 101 | #else |
102 | # define spin_lock_init(lock) \ | 102 | # define raw_spin_lock_init(lock) \ |
103 | do { *(lock) = __SPIN_LOCK_UNLOCKED(lock); } while (0) | 103 | do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0) |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | #ifdef CONFIG_DEBUG_SPINLOCK | 106 | #define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock) |
107 | extern void __rwlock_init(rwlock_t *lock, const char *name, | ||
108 | struct lock_class_key *key); | ||
109 | # define rwlock_init(lock) \ | ||
110 | do { \ | ||
111 | static struct lock_class_key __key; \ | ||
112 | \ | ||
113 | __rwlock_init((lock), #lock, &__key); \ | ||
114 | } while (0) | ||
115 | #else | ||
116 | # define rwlock_init(lock) \ | ||
117 | do { *(lock) = __RW_LOCK_UNLOCKED(lock); } while (0) | ||
118 | #endif | ||
119 | |||
120 | #define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) | ||
121 | 107 | ||
122 | #ifdef CONFIG_GENERIC_LOCKBREAK | 108 | #ifdef CONFIG_GENERIC_LOCKBREAK |
123 | #define spin_is_contended(lock) ((lock)->break_lock) | 109 | #define raw_spin_is_contended(lock) ((lock)->break_lock) |
124 | #else | 110 | #else |
125 | 111 | ||
126 | #ifdef __raw_spin_is_contended | 112 | #ifdef arch_spin_is_contended |
127 | #define spin_is_contended(lock) __raw_spin_is_contended(&(lock)->raw_lock) | 113 | #define raw_spin_is_contended(lock) arch_spin_is_contended(&(lock)->raw_lock) |
128 | #else | 114 | #else |
129 | #define spin_is_contended(lock) (((void)(lock), 0)) | 115 | #define raw_spin_is_contended(lock) (((void)(lock), 0)) |
130 | #endif /*__raw_spin_is_contended*/ | 116 | #endif /*arch_spin_is_contended*/ |
131 | #endif | 117 | #endif |
132 | 118 | ||
133 | /* The lock does not imply full memory barrier. */ | 119 | /* The lock does not imply full memory barrier. */ |
@@ -136,182 +122,260 @@ static inline void smp_mb__after_lock(void) { smp_mb(); } | |||
136 | #endif | 122 | #endif |
137 | 123 | ||
138 | /** | 124 | /** |
139 | * spin_unlock_wait - wait until the spinlock gets unlocked | 125 | * raw_spin_unlock_wait - wait until the spinlock gets unlocked |
140 | * @lock: the spinlock in question. | 126 | * @lock: the spinlock in question. |
141 | */ | 127 | */ |
142 | #define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) | 128 | #define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock) |
143 | 129 | ||
144 | #ifdef CONFIG_DEBUG_SPINLOCK | 130 | #ifdef CONFIG_DEBUG_SPINLOCK |
145 | extern void _raw_spin_lock(spinlock_t *lock); | 131 | extern void do_raw_spin_lock(raw_spinlock_t *lock); |
146 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) | 132 | #define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock) |
147 | extern int _raw_spin_trylock(spinlock_t *lock); | 133 | extern int do_raw_spin_trylock(raw_spinlock_t *lock); |
148 | extern void _raw_spin_unlock(spinlock_t *lock); | 134 | extern void do_raw_spin_unlock(raw_spinlock_t *lock); |
149 | extern void _raw_read_lock(rwlock_t *lock); | ||
150 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) | ||
151 | extern int _raw_read_trylock(rwlock_t *lock); | ||
152 | extern void _raw_read_unlock(rwlock_t *lock); | ||
153 | extern void _raw_write_lock(rwlock_t *lock); | ||
154 | #define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock) | ||
155 | extern int _raw_write_trylock(rwlock_t *lock); | ||
156 | extern void _raw_write_unlock(rwlock_t *lock); | ||
157 | #else | 135 | #else |
158 | # define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) | 136 | static inline void do_raw_spin_lock(raw_spinlock_t *lock) |
159 | # define _raw_spin_lock_flags(lock, flags) \ | 137 | { |
160 | __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) | 138 | arch_spin_lock(&lock->raw_lock); |
161 | # define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) | 139 | } |
162 | # define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) | 140 | |
163 | # define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) | 141 | static inline void |
164 | # define _raw_read_lock_flags(lock, flags) \ | 142 | do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) |
165 | __raw_read_lock_flags(&(lock)->raw_lock, *(flags)) | 143 | { |
166 | # define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) | 144 | arch_spin_lock_flags(&lock->raw_lock, *flags); |
167 | # define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) | 145 | } |
168 | # define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) | 146 | |
169 | # define _raw_write_lock_flags(lock, flags) \ | 147 | static inline int do_raw_spin_trylock(raw_spinlock_t *lock) |
170 | __raw_write_lock_flags(&(lock)->raw_lock, *(flags)) | 148 | { |
171 | # define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) | 149 | return arch_spin_trylock(&(lock)->raw_lock); |
172 | # define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) | 150 | } |
151 | |||
152 | static inline void do_raw_spin_unlock(raw_spinlock_t *lock) | ||
153 | { | ||
154 | arch_spin_unlock(&lock->raw_lock); | ||
155 | } | ||
173 | #endif | 156 | #endif |
174 | 157 | ||
175 | #define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) | ||
176 | #define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) | ||
177 | |||
178 | /* | 158 | /* |
179 | * Define the various spin_lock and rw_lock methods. Note we define these | 159 | * Define the various spin_lock methods. Note we define these |
180 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | 160 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The |
181 | * methods are defined as nops in the case they are not required. | 161 | * various methods are defined as nops in the case they are not |
162 | * required. | ||
182 | */ | 163 | */ |
183 | #define spin_trylock(lock) __cond_lock(lock, _spin_trylock(lock)) | 164 | #define raw_spin_trylock(lock) __cond_lock(lock, _raw_spin_trylock(lock)) |
184 | #define read_trylock(lock) __cond_lock(lock, _read_trylock(lock)) | ||
185 | #define write_trylock(lock) __cond_lock(lock, _write_trylock(lock)) | ||
186 | 165 | ||
187 | #define spin_lock(lock) _spin_lock(lock) | 166 | #define raw_spin_lock(lock) _raw_spin_lock(lock) |
188 | 167 | ||
189 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 168 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
190 | # define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) | 169 | # define raw_spin_lock_nested(lock, subclass) \ |
191 | # define spin_lock_nest_lock(lock, nest_lock) \ | 170 | _raw_spin_lock_nested(lock, subclass) |
171 | |||
172 | # define raw_spin_lock_nest_lock(lock, nest_lock) \ | ||
192 | do { \ | 173 | do { \ |
193 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ | 174 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\ |
194 | _spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ | 175 | _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ |
195 | } while (0) | 176 | } while (0) |
196 | #else | 177 | #else |
197 | # define spin_lock_nested(lock, subclass) _spin_lock(lock) | 178 | # define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) |
198 | # define spin_lock_nest_lock(lock, nest_lock) _spin_lock(lock) | 179 | # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) |
199 | #endif | 180 | #endif |
200 | 181 | ||
201 | #define write_lock(lock) _write_lock(lock) | ||
202 | #define read_lock(lock) _read_lock(lock) | ||
203 | |||
204 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 182 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
205 | 183 | ||
206 | #define spin_lock_irqsave(lock, flags) \ | 184 | #define raw_spin_lock_irqsave(lock, flags) \ |
207 | do { \ | 185 | do { \ |
208 | typecheck(unsigned long, flags); \ | 186 | typecheck(unsigned long, flags); \ |
209 | flags = _spin_lock_irqsave(lock); \ | 187 | flags = _raw_spin_lock_irqsave(lock); \ |
210 | } while (0) | ||
211 | #define read_lock_irqsave(lock, flags) \ | ||
212 | do { \ | ||
213 | typecheck(unsigned long, flags); \ | ||
214 | flags = _read_lock_irqsave(lock); \ | ||
215 | } while (0) | ||
216 | #define write_lock_irqsave(lock, flags) \ | ||
217 | do { \ | ||
218 | typecheck(unsigned long, flags); \ | ||
219 | flags = _write_lock_irqsave(lock); \ | ||
220 | } while (0) | 188 | } while (0) |
221 | 189 | ||
222 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 190 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
223 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 191 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
224 | do { \ | 192 | do { \ |
225 | typecheck(unsigned long, flags); \ | 193 | typecheck(unsigned long, flags); \ |
226 | flags = _spin_lock_irqsave_nested(lock, subclass); \ | 194 | flags = _raw_spin_lock_irqsave_nested(lock, subclass); \ |
227 | } while (0) | 195 | } while (0) |
228 | #else | 196 | #else |
229 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 197 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
230 | do { \ | 198 | do { \ |
231 | typecheck(unsigned long, flags); \ | 199 | typecheck(unsigned long, flags); \ |
232 | flags = _spin_lock_irqsave(lock); \ | 200 | flags = _raw_spin_lock_irqsave(lock); \ |
233 | } while (0) | 201 | } while (0) |
234 | #endif | 202 | #endif |
235 | 203 | ||
236 | #else | 204 | #else |
237 | 205 | ||
238 | #define spin_lock_irqsave(lock, flags) \ | 206 | #define raw_spin_lock_irqsave(lock, flags) \ |
239 | do { \ | ||
240 | typecheck(unsigned long, flags); \ | ||
241 | _spin_lock_irqsave(lock, flags); \ | ||
242 | } while (0) | ||
243 | #define read_lock_irqsave(lock, flags) \ | ||
244 | do { \ | ||
245 | typecheck(unsigned long, flags); \ | ||
246 | _read_lock_irqsave(lock, flags); \ | ||
247 | } while (0) | ||
248 | #define write_lock_irqsave(lock, flags) \ | ||
249 | do { \ | 207 | do { \ |
250 | typecheck(unsigned long, flags); \ | 208 | typecheck(unsigned long, flags); \ |
251 | _write_lock_irqsave(lock, flags); \ | 209 | _raw_spin_lock_irqsave(lock, flags); \ |
252 | } while (0) | 210 | } while (0) |
253 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
254 | spin_lock_irqsave(lock, flags) | ||
255 | 211 | ||
256 | #endif | 212 | #define raw_spin_lock_irqsave_nested(lock, flags, subclass) \ |
213 | raw_spin_lock_irqsave(lock, flags) | ||
257 | 214 | ||
258 | #define spin_lock_irq(lock) _spin_lock_irq(lock) | 215 | #endif |
259 | #define spin_lock_bh(lock) _spin_lock_bh(lock) | ||
260 | #define read_lock_irq(lock) _read_lock_irq(lock) | ||
261 | #define read_lock_bh(lock) _read_lock_bh(lock) | ||
262 | #define write_lock_irq(lock) _write_lock_irq(lock) | ||
263 | #define write_lock_bh(lock) _write_lock_bh(lock) | ||
264 | #define spin_unlock(lock) _spin_unlock(lock) | ||
265 | #define read_unlock(lock) _read_unlock(lock) | ||
266 | #define write_unlock(lock) _write_unlock(lock) | ||
267 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) | ||
268 | #define read_unlock_irq(lock) _read_unlock_irq(lock) | ||
269 | #define write_unlock_irq(lock) _write_unlock_irq(lock) | ||
270 | |||
271 | #define spin_unlock_irqrestore(lock, flags) \ | ||
272 | do { \ | ||
273 | typecheck(unsigned long, flags); \ | ||
274 | _spin_unlock_irqrestore(lock, flags); \ | ||
275 | } while (0) | ||
276 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | ||
277 | 216 | ||
278 | #define read_unlock_irqrestore(lock, flags) \ | 217 | #define raw_spin_lock_irq(lock) _raw_spin_lock_irq(lock) |
279 | do { \ | 218 | #define raw_spin_lock_bh(lock) _raw_spin_lock_bh(lock) |
280 | typecheck(unsigned long, flags); \ | 219 | #define raw_spin_unlock(lock) _raw_spin_unlock(lock) |
281 | _read_unlock_irqrestore(lock, flags); \ | 220 | #define raw_spin_unlock_irq(lock) _raw_spin_unlock_irq(lock) |
282 | } while (0) | ||
283 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | ||
284 | 221 | ||
285 | #define write_unlock_irqrestore(lock, flags) \ | 222 | #define raw_spin_unlock_irqrestore(lock, flags) \ |
286 | do { \ | 223 | do { \ |
287 | typecheck(unsigned long, flags); \ | 224 | typecheck(unsigned long, flags); \ |
288 | _write_unlock_irqrestore(lock, flags); \ | 225 | _raw_spin_unlock_irqrestore(lock, flags); \ |
289 | } while (0) | 226 | } while (0) |
290 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | 227 | #define raw_spin_unlock_bh(lock) _raw_spin_unlock_bh(lock) |
291 | 228 | ||
292 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) | 229 | #define raw_spin_trylock_bh(lock) \ |
230 | __cond_lock(lock, _raw_spin_trylock_bh(lock)) | ||
293 | 231 | ||
294 | #define spin_trylock_irq(lock) \ | 232 | #define raw_spin_trylock_irq(lock) \ |
295 | ({ \ | 233 | ({ \ |
296 | local_irq_disable(); \ | 234 | local_irq_disable(); \ |
297 | spin_trylock(lock) ? \ | 235 | raw_spin_trylock(lock) ? \ |
298 | 1 : ({ local_irq_enable(); 0; }); \ | 236 | 1 : ({ local_irq_enable(); 0; }); \ |
299 | }) | 237 | }) |
300 | 238 | ||
301 | #define spin_trylock_irqsave(lock, flags) \ | 239 | #define raw_spin_trylock_irqsave(lock, flags) \ |
302 | ({ \ | 240 | ({ \ |
303 | local_irq_save(flags); \ | 241 | local_irq_save(flags); \ |
304 | spin_trylock(lock) ? \ | 242 | raw_spin_trylock(lock) ? \ |
305 | 1 : ({ local_irq_restore(flags); 0; }); \ | 243 | 1 : ({ local_irq_restore(flags); 0; }); \ |
306 | }) | 244 | }) |
307 | 245 | ||
308 | #define write_trylock_irqsave(lock, flags) \ | 246 | /** |
309 | ({ \ | 247 | * raw_spin_can_lock - would raw_spin_trylock() succeed? |
310 | local_irq_save(flags); \ | 248 | * @lock: the spinlock in question. |
311 | write_trylock(lock) ? \ | 249 | */ |
312 | 1 : ({ local_irq_restore(flags); 0; }); \ | 250 | #define raw_spin_can_lock(lock) (!raw_spin_is_locked(lock)) |
251 | |||
252 | /* Include rwlock functions */ | ||
253 | #include <linux/rwlock.h> | ||
254 | |||
255 | /* | ||
256 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: | ||
257 | */ | ||
258 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
259 | # include <linux/spinlock_api_smp.h> | ||
260 | #else | ||
261 | # include <linux/spinlock_api_up.h> | ||
262 | #endif | ||
263 | |||
264 | /* | ||
265 | * Map the spin_lock functions to the raw variants for PREEMPT_RT=n | ||
266 | */ | ||
267 | |||
268 | static inline raw_spinlock_t *spinlock_check(spinlock_t *lock) | ||
269 | { | ||
270 | return &lock->rlock; | ||
271 | } | ||
272 | |||
273 | #define spin_lock_init(_lock) \ | ||
274 | do { \ | ||
275 | spinlock_check(_lock); \ | ||
276 | raw_spin_lock_init(&(_lock)->rlock); \ | ||
277 | } while (0) | ||
278 | |||
279 | static inline void spin_lock(spinlock_t *lock) | ||
280 | { | ||
281 | raw_spin_lock(&lock->rlock); | ||
282 | } | ||
283 | |||
284 | static inline void spin_lock_bh(spinlock_t *lock) | ||
285 | { | ||
286 | raw_spin_lock_bh(&lock->rlock); | ||
287 | } | ||
288 | |||
289 | static inline int spin_trylock(spinlock_t *lock) | ||
290 | { | ||
291 | return raw_spin_trylock(&lock->rlock); | ||
292 | } | ||
293 | |||
294 | #define spin_lock_nested(lock, subclass) \ | ||
295 | do { \ | ||
296 | raw_spin_lock_nested(spinlock_check(lock), subclass); \ | ||
297 | } while (0) | ||
298 | |||
299 | #define spin_lock_nest_lock(lock, nest_lock) \ | ||
300 | do { \ | ||
301 | raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \ | ||
302 | } while (0) | ||
303 | |||
304 | static inline void spin_lock_irq(spinlock_t *lock) | ||
305 | { | ||
306 | raw_spin_lock_irq(&lock->rlock); | ||
307 | } | ||
308 | |||
309 | #define spin_lock_irqsave(lock, flags) \ | ||
310 | do { \ | ||
311 | raw_spin_lock_irqsave(spinlock_check(lock), flags); \ | ||
312 | } while (0) | ||
313 | |||
314 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
315 | do { \ | ||
316 | raw_spin_lock_irqsave_nested(spinlock_check(lock), flags, subclass); \ | ||
317 | } while (0) | ||
318 | |||
319 | static inline void spin_unlock(spinlock_t *lock) | ||
320 | { | ||
321 | raw_spin_unlock(&lock->rlock); | ||
322 | } | ||
323 | |||
324 | static inline void spin_unlock_bh(spinlock_t *lock) | ||
325 | { | ||
326 | raw_spin_unlock_bh(&lock->rlock); | ||
327 | } | ||
328 | |||
329 | static inline void spin_unlock_irq(spinlock_t *lock) | ||
330 | { | ||
331 | raw_spin_unlock_irq(&lock->rlock); | ||
332 | } | ||
333 | |||
334 | static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
335 | { | ||
336 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | ||
337 | } | ||
338 | |||
339 | static inline int spin_trylock_bh(spinlock_t *lock) | ||
340 | { | ||
341 | return raw_spin_trylock_bh(&lock->rlock); | ||
342 | } | ||
343 | |||
344 | static inline int spin_trylock_irq(spinlock_t *lock) | ||
345 | { | ||
346 | return raw_spin_trylock_irq(&lock->rlock); | ||
347 | } | ||
348 | |||
349 | #define spin_trylock_irqsave(lock, flags) \ | ||
350 | ({ \ | ||
351 | raw_spin_trylock_irqsave(spinlock_check(lock), flags); \ | ||
313 | }) | 352 | }) |
314 | 353 | ||
354 | static inline void spin_unlock_wait(spinlock_t *lock) | ||
355 | { | ||
356 | raw_spin_unlock_wait(&lock->rlock); | ||
357 | } | ||
358 | |||
359 | static inline int spin_is_locked(spinlock_t *lock) | ||
360 | { | ||
361 | return raw_spin_is_locked(&lock->rlock); | ||
362 | } | ||
363 | |||
364 | static inline int spin_is_contended(spinlock_t *lock) | ||
365 | { | ||
366 | return raw_spin_is_contended(&lock->rlock); | ||
367 | } | ||
368 | |||
369 | static inline int spin_can_lock(spinlock_t *lock) | ||
370 | { | ||
371 | return raw_spin_can_lock(&lock->rlock); | ||
372 | } | ||
373 | |||
374 | static inline void assert_spin_locked(spinlock_t *lock) | ||
375 | { | ||
376 | assert_raw_spin_locked(&lock->rlock); | ||
377 | } | ||
378 | |||
315 | /* | 379 | /* |
316 | * Pull the atomic_t declaration: | 380 | * Pull the atomic_t declaration: |
317 | * (asm-mips/atomic.h needs above definitions) | 381 | * (asm-mips/atomic.h needs above definitions) |
@@ -329,19 +393,4 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); | |||
329 | #define atomic_dec_and_lock(atomic, lock) \ | 393 | #define atomic_dec_and_lock(atomic, lock) \ |
330 | __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) | 394 | __cond_lock(lock, _atomic_dec_and_lock(atomic, lock)) |
331 | 395 | ||
332 | /** | ||
333 | * spin_can_lock - would spin_trylock() succeed? | ||
334 | * @lock: the spinlock in question. | ||
335 | */ | ||
336 | #define spin_can_lock(lock) (!spin_is_locked(lock)) | ||
337 | |||
338 | /* | ||
339 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: | ||
340 | */ | ||
341 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
342 | # include <linux/spinlock_api_smp.h> | ||
343 | #else | ||
344 | # include <linux/spinlock_api_up.h> | ||
345 | #endif | ||
346 | |||
347 | #endif /* __LINUX_SPINLOCK_H */ | 396 | #endif /* __LINUX_SPINLOCK_H */ |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 8264a7f459bc..e253ccd7a604 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
@@ -17,165 +17,76 @@ | |||
17 | 17 | ||
18 | int in_lock_functions(unsigned long addr); | 18 | int in_lock_functions(unsigned long addr); |
19 | 19 | ||
20 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | 20 | #define assert_raw_spin_locked(x) BUG_ON(!raw_spin_is_locked(x)) |
21 | 21 | ||
22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); | 22 | void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); |
23 | void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) | 23 | void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) |
24 | __acquires(lock); | 24 | __acquires(lock); |
25 | void __lockfunc _spin_lock_nest_lock(spinlock_t *lock, struct lockdep_map *map) | 25 | void __lockfunc |
26 | __acquires(lock); | 26 | _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) |
27 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); | 27 | __acquires(lock); |
28 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); | 28 | void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) __acquires(lock); |
29 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); | 29 | void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock) |
30 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(lock); | 30 | __acquires(lock); |
31 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(lock); | 31 | |
32 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(lock); | 32 | unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock) |
33 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock); | 33 | __acquires(lock); |
34 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); | 34 | unsigned long __lockfunc |
35 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | 35 | _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, int subclass) |
36 | __acquires(lock); | 36 | __acquires(lock); |
37 | unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass) | 37 | int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock); |
38 | __acquires(lock); | 38 | int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock); |
39 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | 39 | void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) __releases(lock); |
40 | __acquires(lock); | 40 | void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) __releases(lock); |
41 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | 41 | void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) __releases(lock); |
42 | __acquires(lock); | 42 | void __lockfunc |
43 | int __lockfunc _spin_trylock(spinlock_t *lock); | 43 | _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) |
44 | int __lockfunc _read_trylock(rwlock_t *lock); | 44 | __releases(lock); |
45 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
46 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
47 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(lock); | ||
48 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(lock); | ||
49 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(lock); | ||
50 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(lock); | ||
51 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(lock); | ||
52 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(lock); | ||
53 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(lock); | ||
54 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(lock); | ||
55 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(lock); | ||
56 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
57 | __releases(lock); | ||
58 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
59 | __releases(lock); | ||
60 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
61 | __releases(lock); | ||
62 | 45 | ||
63 | #ifdef CONFIG_INLINE_SPIN_LOCK | 46 | #ifdef CONFIG_INLINE_SPIN_LOCK |
64 | #define _spin_lock(lock) __spin_lock(lock) | 47 | #define _raw_spin_lock(lock) __raw_spin_lock(lock) |
65 | #endif | ||
66 | |||
67 | #ifdef CONFIG_INLINE_READ_LOCK | ||
68 | #define _read_lock(lock) __read_lock(lock) | ||
69 | #endif | ||
70 | |||
71 | #ifdef CONFIG_INLINE_WRITE_LOCK | ||
72 | #define _write_lock(lock) __write_lock(lock) | ||
73 | #endif | 48 | #endif |
74 | 49 | ||
75 | #ifdef CONFIG_INLINE_SPIN_LOCK_BH | 50 | #ifdef CONFIG_INLINE_SPIN_LOCK_BH |
76 | #define _spin_lock_bh(lock) __spin_lock_bh(lock) | 51 | #define _raw_spin_lock_bh(lock) __raw_spin_lock_bh(lock) |
77 | #endif | ||
78 | |||
79 | #ifdef CONFIG_INLINE_READ_LOCK_BH | ||
80 | #define _read_lock_bh(lock) __read_lock_bh(lock) | ||
81 | #endif | ||
82 | |||
83 | #ifdef CONFIG_INLINE_WRITE_LOCK_BH | ||
84 | #define _write_lock_bh(lock) __write_lock_bh(lock) | ||
85 | #endif | 52 | #endif |
86 | 53 | ||
87 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQ | 54 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQ |
88 | #define _spin_lock_irq(lock) __spin_lock_irq(lock) | 55 | #define _raw_spin_lock_irq(lock) __raw_spin_lock_irq(lock) |
89 | #endif | ||
90 | |||
91 | #ifdef CONFIG_INLINE_READ_LOCK_IRQ | ||
92 | #define _read_lock_irq(lock) __read_lock_irq(lock) | ||
93 | #endif | ||
94 | |||
95 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQ | ||
96 | #define _write_lock_irq(lock) __write_lock_irq(lock) | ||
97 | #endif | 56 | #endif |
98 | 57 | ||
99 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE | 58 | #ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE |
100 | #define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) | 59 | #define _raw_spin_lock_irqsave(lock) __raw_spin_lock_irqsave(lock) |
101 | #endif | ||
102 | |||
103 | #ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE | ||
104 | #define _read_lock_irqsave(lock) __read_lock_irqsave(lock) | ||
105 | #endif | ||
106 | |||
107 | #ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE | ||
108 | #define _write_lock_irqsave(lock) __write_lock_irqsave(lock) | ||
109 | #endif | 60 | #endif |
110 | 61 | ||
111 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK | 62 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK |
112 | #define _spin_trylock(lock) __spin_trylock(lock) | 63 | #define _raw_spin_trylock(lock) __raw_spin_trylock(lock) |
113 | #endif | ||
114 | |||
115 | #ifdef CONFIG_INLINE_READ_TRYLOCK | ||
116 | #define _read_trylock(lock) __read_trylock(lock) | ||
117 | #endif | ||
118 | |||
119 | #ifdef CONFIG_INLINE_WRITE_TRYLOCK | ||
120 | #define _write_trylock(lock) __write_trylock(lock) | ||
121 | #endif | 64 | #endif |
122 | 65 | ||
123 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH | 66 | #ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH |
124 | #define _spin_trylock_bh(lock) __spin_trylock_bh(lock) | 67 | #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) |
125 | #endif | 68 | #endif |
126 | 69 | ||
127 | #ifdef CONFIG_INLINE_SPIN_UNLOCK | 70 | #ifdef CONFIG_INLINE_SPIN_UNLOCK |
128 | #define _spin_unlock(lock) __spin_unlock(lock) | 71 | #define _raw_spin_unlock(lock) __raw_spin_unlock(lock) |
129 | #endif | ||
130 | |||
131 | #ifdef CONFIG_INLINE_READ_UNLOCK | ||
132 | #define _read_unlock(lock) __read_unlock(lock) | ||
133 | #endif | ||
134 | |||
135 | #ifdef CONFIG_INLINE_WRITE_UNLOCK | ||
136 | #define _write_unlock(lock) __write_unlock(lock) | ||
137 | #endif | 72 | #endif |
138 | 73 | ||
139 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_BH | 74 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_BH |
140 | #define _spin_unlock_bh(lock) __spin_unlock_bh(lock) | 75 | #define _raw_spin_unlock_bh(lock) __raw_spin_unlock_bh(lock) |
141 | #endif | ||
142 | |||
143 | #ifdef CONFIG_INLINE_READ_UNLOCK_BH | ||
144 | #define _read_unlock_bh(lock) __read_unlock_bh(lock) | ||
145 | #endif | ||
146 | |||
147 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_BH | ||
148 | #define _write_unlock_bh(lock) __write_unlock_bh(lock) | ||
149 | #endif | 76 | #endif |
150 | 77 | ||
151 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ | 78 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ |
152 | #define _spin_unlock_irq(lock) __spin_unlock_irq(lock) | 79 | #define _raw_spin_unlock_irq(lock) __raw_spin_unlock_irq(lock) |
153 | #endif | ||
154 | |||
155 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQ | ||
156 | #define _read_unlock_irq(lock) __read_unlock_irq(lock) | ||
157 | #endif | ||
158 | |||
159 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ | ||
160 | #define _write_unlock_irq(lock) __write_unlock_irq(lock) | ||
161 | #endif | 80 | #endif |
162 | 81 | ||
163 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE | 82 | #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE |
164 | #define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) | 83 | #define _raw_spin_unlock_irqrestore(lock, flags) __raw_spin_unlock_irqrestore(lock, flags) |
165 | #endif | ||
166 | |||
167 | #ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE | ||
168 | #define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags) | ||
169 | #endif | ||
170 | |||
171 | #ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE | ||
172 | #define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags) | ||
173 | #endif | 84 | #endif |
174 | 85 | ||
175 | static inline int __spin_trylock(spinlock_t *lock) | 86 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) |
176 | { | 87 | { |
177 | preempt_disable(); | 88 | preempt_disable(); |
178 | if (_raw_spin_trylock(lock)) { | 89 | if (do_raw_spin_trylock(lock)) { |
179 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); | 90 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); |
180 | return 1; | 91 | return 1; |
181 | } | 92 | } |
@@ -183,28 +94,6 @@ static inline int __spin_trylock(spinlock_t *lock) | |||
183 | return 0; | 94 | return 0; |
184 | } | 95 | } |
185 | 96 | ||
186 | static inline int __read_trylock(rwlock_t *lock) | ||
187 | { | ||
188 | preempt_disable(); | ||
189 | if (_raw_read_trylock(lock)) { | ||
190 | rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_); | ||
191 | return 1; | ||
192 | } | ||
193 | preempt_enable(); | ||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static inline int __write_trylock(rwlock_t *lock) | ||
198 | { | ||
199 | preempt_disable(); | ||
200 | if (_raw_write_trylock(lock)) { | ||
201 | rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_); | ||
202 | return 1; | ||
203 | } | ||
204 | preempt_enable(); | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | /* | 97 | /* |
209 | * If lockdep is enabled then we use the non-preemption spin-ops | 98 | * If lockdep is enabled then we use the non-preemption spin-ops |
210 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are | 99 | * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are |
@@ -212,14 +101,7 @@ static inline int __write_trylock(rwlock_t *lock) | |||
212 | */ | 101 | */ |
213 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) | 102 | #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) |
214 | 103 | ||
215 | static inline void __read_lock(rwlock_t *lock) | 104 | static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock) |
216 | { | ||
217 | preempt_disable(); | ||
218 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
219 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
220 | } | ||
221 | |||
222 | static inline unsigned long __spin_lock_irqsave(spinlock_t *lock) | ||
223 | { | 105 | { |
224 | unsigned long flags; | 106 | unsigned long flags; |
225 | 107 | ||
@@ -228,205 +110,79 @@ static inline unsigned long __spin_lock_irqsave(spinlock_t *lock) | |||
228 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 110 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
229 | /* | 111 | /* |
230 | * On lockdep we dont want the hand-coded irq-enable of | 112 | * On lockdep we dont want the hand-coded irq-enable of |
231 | * _raw_spin_lock_flags() code, because lockdep assumes | 113 | * do_raw_spin_lock_flags() code, because lockdep assumes |
232 | * that interrupts are not re-enabled during lock-acquire: | 114 | * that interrupts are not re-enabled during lock-acquire: |
233 | */ | 115 | */ |
234 | #ifdef CONFIG_LOCKDEP | 116 | #ifdef CONFIG_LOCKDEP |
235 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 117 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
236 | #else | 118 | #else |
237 | _raw_spin_lock_flags(lock, &flags); | 119 | do_raw_spin_lock_flags(lock, &flags); |
238 | #endif | 120 | #endif |
239 | return flags; | 121 | return flags; |
240 | } | 122 | } |
241 | 123 | ||
242 | static inline void __spin_lock_irq(spinlock_t *lock) | 124 | static inline void __raw_spin_lock_irq(raw_spinlock_t *lock) |
243 | { | 125 | { |
244 | local_irq_disable(); | 126 | local_irq_disable(); |
245 | preempt_disable(); | 127 | preempt_disable(); |
246 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 128 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
247 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 129 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
248 | } | 130 | } |
249 | 131 | ||
250 | static inline void __spin_lock_bh(spinlock_t *lock) | 132 | static inline void __raw_spin_lock_bh(raw_spinlock_t *lock) |
251 | { | 133 | { |
252 | local_bh_disable(); | 134 | local_bh_disable(); |
253 | preempt_disable(); | 135 | preempt_disable(); |
254 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 136 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
255 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 137 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
256 | } | ||
257 | |||
258 | static inline unsigned long __read_lock_irqsave(rwlock_t *lock) | ||
259 | { | ||
260 | unsigned long flags; | ||
261 | |||
262 | local_irq_save(flags); | ||
263 | preempt_disable(); | ||
264 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
265 | LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock, | ||
266 | _raw_read_lock_flags, &flags); | ||
267 | return flags; | ||
268 | } | ||
269 | |||
270 | static inline void __read_lock_irq(rwlock_t *lock) | ||
271 | { | ||
272 | local_irq_disable(); | ||
273 | preempt_disable(); | ||
274 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
275 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
276 | } | ||
277 | |||
278 | static inline void __read_lock_bh(rwlock_t *lock) | ||
279 | { | ||
280 | local_bh_disable(); | ||
281 | preempt_disable(); | ||
282 | rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); | ||
283 | LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock); | ||
284 | } | ||
285 | |||
286 | static inline unsigned long __write_lock_irqsave(rwlock_t *lock) | ||
287 | { | ||
288 | unsigned long flags; | ||
289 | |||
290 | local_irq_save(flags); | ||
291 | preempt_disable(); | ||
292 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
293 | LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock, | ||
294 | _raw_write_lock_flags, &flags); | ||
295 | return flags; | ||
296 | } | ||
297 | |||
298 | static inline void __write_lock_irq(rwlock_t *lock) | ||
299 | { | ||
300 | local_irq_disable(); | ||
301 | preempt_disable(); | ||
302 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
303 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
304 | } | 138 | } |
305 | 139 | ||
306 | static inline void __write_lock_bh(rwlock_t *lock) | 140 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
307 | { | ||
308 | local_bh_disable(); | ||
309 | preempt_disable(); | ||
310 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
311 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
312 | } | ||
313 | |||
314 | static inline void __spin_lock(spinlock_t *lock) | ||
315 | { | 141 | { |
316 | preempt_disable(); | 142 | preempt_disable(); |
317 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); | 143 | spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); |
318 | LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock); | 144 | LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); |
319 | } | ||
320 | |||
321 | static inline void __write_lock(rwlock_t *lock) | ||
322 | { | ||
323 | preempt_disable(); | ||
324 | rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); | ||
325 | LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock); | ||
326 | } | 145 | } |
327 | 146 | ||
328 | #endif /* CONFIG_PREEMPT */ | 147 | #endif /* CONFIG_PREEMPT */ |
329 | 148 | ||
330 | static inline void __spin_unlock(spinlock_t *lock) | 149 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
331 | { | 150 | { |
332 | spin_release(&lock->dep_map, 1, _RET_IP_); | 151 | spin_release(&lock->dep_map, 1, _RET_IP_); |
333 | _raw_spin_unlock(lock); | 152 | do_raw_spin_unlock(lock); |
334 | preempt_enable(); | ||
335 | } | ||
336 | |||
337 | static inline void __write_unlock(rwlock_t *lock) | ||
338 | { | ||
339 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
340 | _raw_write_unlock(lock); | ||
341 | preempt_enable(); | ||
342 | } | ||
343 | |||
344 | static inline void __read_unlock(rwlock_t *lock) | ||
345 | { | ||
346 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
347 | _raw_read_unlock(lock); | ||
348 | preempt_enable(); | 153 | preempt_enable(); |
349 | } | 154 | } |
350 | 155 | ||
351 | static inline void __spin_unlock_irqrestore(spinlock_t *lock, | 156 | static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, |
352 | unsigned long flags) | 157 | unsigned long flags) |
353 | { | 158 | { |
354 | spin_release(&lock->dep_map, 1, _RET_IP_); | 159 | spin_release(&lock->dep_map, 1, _RET_IP_); |
355 | _raw_spin_unlock(lock); | 160 | do_raw_spin_unlock(lock); |
356 | local_irq_restore(flags); | 161 | local_irq_restore(flags); |
357 | preempt_enable(); | 162 | preempt_enable(); |
358 | } | 163 | } |
359 | 164 | ||
360 | static inline void __spin_unlock_irq(spinlock_t *lock) | 165 | static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) |
361 | { | 166 | { |
362 | spin_release(&lock->dep_map, 1, _RET_IP_); | 167 | spin_release(&lock->dep_map, 1, _RET_IP_); |
363 | _raw_spin_unlock(lock); | 168 | do_raw_spin_unlock(lock); |
364 | local_irq_enable(); | 169 | local_irq_enable(); |
365 | preempt_enable(); | 170 | preempt_enable(); |
366 | } | 171 | } |
367 | 172 | ||
368 | static inline void __spin_unlock_bh(spinlock_t *lock) | 173 | static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock) |
369 | { | 174 | { |
370 | spin_release(&lock->dep_map, 1, _RET_IP_); | 175 | spin_release(&lock->dep_map, 1, _RET_IP_); |
371 | _raw_spin_unlock(lock); | 176 | do_raw_spin_unlock(lock); |
372 | preempt_enable_no_resched(); | ||
373 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
374 | } | ||
375 | |||
376 | static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
377 | { | ||
378 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
379 | _raw_read_unlock(lock); | ||
380 | local_irq_restore(flags); | ||
381 | preempt_enable(); | ||
382 | } | ||
383 | |||
384 | static inline void __read_unlock_irq(rwlock_t *lock) | ||
385 | { | ||
386 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
387 | _raw_read_unlock(lock); | ||
388 | local_irq_enable(); | ||
389 | preempt_enable(); | ||
390 | } | ||
391 | |||
392 | static inline void __read_unlock_bh(rwlock_t *lock) | ||
393 | { | ||
394 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
395 | _raw_read_unlock(lock); | ||
396 | preempt_enable_no_resched(); | 177 | preempt_enable_no_resched(); |
397 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | 178 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); |
398 | } | 179 | } |
399 | 180 | ||
400 | static inline void __write_unlock_irqrestore(rwlock_t *lock, | 181 | static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock) |
401 | unsigned long flags) | ||
402 | { | ||
403 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
404 | _raw_write_unlock(lock); | ||
405 | local_irq_restore(flags); | ||
406 | preempt_enable(); | ||
407 | } | ||
408 | |||
409 | static inline void __write_unlock_irq(rwlock_t *lock) | ||
410 | { | ||
411 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
412 | _raw_write_unlock(lock); | ||
413 | local_irq_enable(); | ||
414 | preempt_enable(); | ||
415 | } | ||
416 | |||
417 | static inline void __write_unlock_bh(rwlock_t *lock) | ||
418 | { | ||
419 | rwlock_release(&lock->dep_map, 1, _RET_IP_); | ||
420 | _raw_write_unlock(lock); | ||
421 | preempt_enable_no_resched(); | ||
422 | local_bh_enable_ip((unsigned long)__builtin_return_address(0)); | ||
423 | } | ||
424 | |||
425 | static inline int __spin_trylock_bh(spinlock_t *lock) | ||
426 | { | 182 | { |
427 | local_bh_disable(); | 183 | local_bh_disable(); |
428 | preempt_disable(); | 184 | preempt_disable(); |
429 | if (_raw_spin_trylock(lock)) { | 185 | if (do_raw_spin_trylock(lock)) { |
430 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); | 186 | spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); |
431 | return 1; | 187 | return 1; |
432 | } | 188 | } |
@@ -435,4 +191,6 @@ static inline int __spin_trylock_bh(spinlock_t *lock) | |||
435 | return 0; | 191 | return 0; |
436 | } | 192 | } |
437 | 193 | ||
194 | #include <linux/rwlock_api_smp.h> | ||
195 | |||
438 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ | 196 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ |
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h index 04e1d3164576..af1f47229e70 100644 --- a/include/linux/spinlock_api_up.h +++ b/include/linux/spinlock_api_up.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #define in_lock_functions(ADDR) 0 | 17 | #define in_lock_functions(ADDR) 0 |
18 | 18 | ||
19 | #define assert_spin_locked(lock) do { (void)(lock); } while (0) | 19 | #define assert_raw_spin_locked(lock) do { (void)(lock); } while (0) |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * In the UP-nondebug case there's no real locking going on, so the | 22 | * In the UP-nondebug case there's no real locking going on, so the |
@@ -40,7 +40,8 @@ | |||
40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) | 40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) |
41 | 41 | ||
42 | #define __UNLOCK_BH(lock) \ | 42 | #define __UNLOCK_BH(lock) \ |
43 | do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) | 43 | do { preempt_enable_no_resched(); local_bh_enable(); \ |
44 | __release(lock); (void)(lock); } while (0) | ||
44 | 45 | ||
45 | #define __UNLOCK_IRQ(lock) \ | 46 | #define __UNLOCK_IRQ(lock) \ |
46 | do { local_irq_enable(); __UNLOCK(lock); } while (0) | 47 | do { local_irq_enable(); __UNLOCK(lock); } while (0) |
@@ -48,34 +49,37 @@ | |||
48 | #define __UNLOCK_IRQRESTORE(lock, flags) \ | 49 | #define __UNLOCK_IRQRESTORE(lock, flags) \ |
49 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) | 50 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) |
50 | 51 | ||
51 | #define _spin_lock(lock) __LOCK(lock) | 52 | #define _raw_spin_lock(lock) __LOCK(lock) |
52 | #define _spin_lock_nested(lock, subclass) __LOCK(lock) | 53 | #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) |
53 | #define _read_lock(lock) __LOCK(lock) | 54 | #define _raw_read_lock(lock) __LOCK(lock) |
54 | #define _write_lock(lock) __LOCK(lock) | 55 | #define _raw_write_lock(lock) __LOCK(lock) |
55 | #define _spin_lock_bh(lock) __LOCK_BH(lock) | 56 | #define _raw_spin_lock_bh(lock) __LOCK_BH(lock) |
56 | #define _read_lock_bh(lock) __LOCK_BH(lock) | 57 | #define _raw_read_lock_bh(lock) __LOCK_BH(lock) |
57 | #define _write_lock_bh(lock) __LOCK_BH(lock) | 58 | #define _raw_write_lock_bh(lock) __LOCK_BH(lock) |
58 | #define _spin_lock_irq(lock) __LOCK_IRQ(lock) | 59 | #define _raw_spin_lock_irq(lock) __LOCK_IRQ(lock) |
59 | #define _read_lock_irq(lock) __LOCK_IRQ(lock) | 60 | #define _raw_read_lock_irq(lock) __LOCK_IRQ(lock) |
60 | #define _write_lock_irq(lock) __LOCK_IRQ(lock) | 61 | #define _raw_write_lock_irq(lock) __LOCK_IRQ(lock) |
61 | #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 62 | #define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
62 | #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 63 | #define _raw_read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
63 | #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | 64 | #define _raw_write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) |
64 | #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) | 65 | #define _raw_spin_trylock(lock) ({ __LOCK(lock); 1; }) |
65 | #define _read_trylock(lock) ({ __LOCK(lock); 1; }) | 66 | #define _raw_read_trylock(lock) ({ __LOCK(lock); 1; }) |
66 | #define _write_trylock(lock) ({ __LOCK(lock); 1; }) | 67 | #define _raw_write_trylock(lock) ({ __LOCK(lock); 1; }) |
67 | #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) | 68 | #define _raw_spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) |
68 | #define _spin_unlock(lock) __UNLOCK(lock) | 69 | #define _raw_spin_unlock(lock) __UNLOCK(lock) |
69 | #define _read_unlock(lock) __UNLOCK(lock) | 70 | #define _raw_read_unlock(lock) __UNLOCK(lock) |
70 | #define _write_unlock(lock) __UNLOCK(lock) | 71 | #define _raw_write_unlock(lock) __UNLOCK(lock) |
71 | #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) | 72 | #define _raw_spin_unlock_bh(lock) __UNLOCK_BH(lock) |
72 | #define _write_unlock_bh(lock) __UNLOCK_BH(lock) | 73 | #define _raw_write_unlock_bh(lock) __UNLOCK_BH(lock) |
73 | #define _read_unlock_bh(lock) __UNLOCK_BH(lock) | 74 | #define _raw_read_unlock_bh(lock) __UNLOCK_BH(lock) |
74 | #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) | 75 | #define _raw_spin_unlock_irq(lock) __UNLOCK_IRQ(lock) |
75 | #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) | 76 | #define _raw_read_unlock_irq(lock) __UNLOCK_IRQ(lock) |
76 | #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) | 77 | #define _raw_write_unlock_irq(lock) __UNLOCK_IRQ(lock) |
77 | #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 78 | #define _raw_spin_unlock_irqrestore(lock, flags) \ |
78 | #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 79 | __UNLOCK_IRQRESTORE(lock, flags) |
79 | #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | 80 | #define _raw_read_unlock_irqrestore(lock, flags) \ |
81 | __UNLOCK_IRQRESTORE(lock, flags) | ||
82 | #define _raw_write_unlock_irqrestore(lock, flags) \ | ||
83 | __UNLOCK_IRQRESTORE(lock, flags) | ||
80 | 84 | ||
81 | #endif /* __LINUX_SPINLOCK_API_UP_H */ | 85 | #endif /* __LINUX_SPINLOCK_API_UP_H */ |
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h index 68d88f71f1a2..851b7783720d 100644 --- a/include/linux/spinlock_types.h +++ b/include/linux/spinlock_types.h | |||
@@ -17,8 +17,8 @@ | |||
17 | 17 | ||
18 | #include <linux/lockdep.h> | 18 | #include <linux/lockdep.h> |
19 | 19 | ||
20 | typedef struct { | 20 | typedef struct raw_spinlock { |
21 | raw_spinlock_t raw_lock; | 21 | arch_spinlock_t raw_lock; |
22 | #ifdef CONFIG_GENERIC_LOCKBREAK | 22 | #ifdef CONFIG_GENERIC_LOCKBREAK |
23 | unsigned int break_lock; | 23 | unsigned int break_lock; |
24 | #endif | 24 | #endif |
@@ -29,26 +29,10 @@ typedef struct { | |||
29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
30 | struct lockdep_map dep_map; | 30 | struct lockdep_map dep_map; |
31 | #endif | 31 | #endif |
32 | } spinlock_t; | 32 | } raw_spinlock_t; |
33 | 33 | ||
34 | #define SPINLOCK_MAGIC 0xdead4ead | 34 | #define SPINLOCK_MAGIC 0xdead4ead |
35 | 35 | ||
36 | typedef struct { | ||
37 | raw_rwlock_t raw_lock; | ||
38 | #ifdef CONFIG_GENERIC_LOCKBREAK | ||
39 | unsigned int break_lock; | ||
40 | #endif | ||
41 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
42 | unsigned int magic, owner_cpu; | ||
43 | void *owner; | ||
44 | #endif | ||
45 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
46 | struct lockdep_map dep_map; | ||
47 | #endif | ||
48 | } rwlock_t; | ||
49 | |||
50 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
51 | |||
52 | #define SPINLOCK_OWNER_INIT ((void *)-1L) | 36 | #define SPINLOCK_OWNER_INIT ((void *)-1L) |
53 | 37 | ||
54 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
@@ -57,44 +41,56 @@ typedef struct { | |||
57 | # define SPIN_DEP_MAP_INIT(lockname) | 41 | # define SPIN_DEP_MAP_INIT(lockname) |
58 | #endif | 42 | #endif |
59 | 43 | ||
60 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 44 | #ifdef CONFIG_DEBUG_SPINLOCK |
61 | # define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } | 45 | # define SPIN_DEBUG_INIT(lockname) \ |
46 | .magic = SPINLOCK_MAGIC, \ | ||
47 | .owner_cpu = -1, \ | ||
48 | .owner = SPINLOCK_OWNER_INIT, | ||
62 | #else | 49 | #else |
63 | # define RW_DEP_MAP_INIT(lockname) | 50 | # define SPIN_DEBUG_INIT(lockname) |
64 | #endif | 51 | #endif |
65 | 52 | ||
66 | #ifdef CONFIG_DEBUG_SPINLOCK | 53 | #define __RAW_SPIN_LOCK_INITIALIZER(lockname) \ |
67 | # define __SPIN_LOCK_UNLOCKED(lockname) \ | 54 | { \ |
68 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | 55 | .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ |
69 | .magic = SPINLOCK_MAGIC, \ | 56 | SPIN_DEBUG_INIT(lockname) \ |
70 | .owner = SPINLOCK_OWNER_INIT, \ | 57 | SPIN_DEP_MAP_INIT(lockname) } |
71 | .owner_cpu = -1, \ | 58 | |
72 | SPIN_DEP_MAP_INIT(lockname) } | 59 | #define __RAW_SPIN_LOCK_UNLOCKED(lockname) \ |
73 | #define __RW_LOCK_UNLOCKED(lockname) \ | 60 | (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) |
74 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 61 | |
75 | .magic = RWLOCK_MAGIC, \ | 62 | #define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x) |
76 | .owner = SPINLOCK_OWNER_INIT, \ | 63 | |
77 | .owner_cpu = -1, \ | 64 | typedef struct spinlock { |
78 | RW_DEP_MAP_INIT(lockname) } | 65 | union { |
79 | #else | 66 | struct raw_spinlock rlock; |
80 | # define __SPIN_LOCK_UNLOCKED(lockname) \ | 67 | |
81 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | 68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
82 | SPIN_DEP_MAP_INIT(lockname) } | 69 | # define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map)) |
83 | #define __RW_LOCK_UNLOCKED(lockname) \ | 70 | struct { |
84 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 71 | u8 __padding[LOCK_PADSIZE]; |
85 | RW_DEP_MAP_INIT(lockname) } | 72 | struct lockdep_map dep_map; |
73 | }; | ||
86 | #endif | 74 | #endif |
75 | }; | ||
76 | } spinlock_t; | ||
77 | |||
78 | #define __SPIN_LOCK_INITIALIZER(lockname) \ | ||
79 | { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } } | ||
80 | |||
81 | #define __SPIN_LOCK_UNLOCKED(lockname) \ | ||
82 | (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) | ||
87 | 83 | ||
88 | /* | 84 | /* |
89 | * SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and | 85 | * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence |
90 | * are hence deprecated. | 86 | * deprecated. |
91 | * Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or | 87 | * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as |
92 | * __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate. | 88 | * appropriate. |
93 | */ | 89 | */ |
94 | #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) | 90 | #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) |
95 | #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) | ||
96 | 91 | ||
97 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) | 92 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) |
98 | #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) | 93 | |
94 | #include <linux/rwlock_types.h> | ||
99 | 95 | ||
100 | #endif /* __LINUX_SPINLOCK_TYPES_H */ | 96 | #endif /* __LINUX_SPINLOCK_TYPES_H */ |
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h index 04135b0e198e..c09b6407ae1b 100644 --- a/include/linux/spinlock_types_up.h +++ b/include/linux/spinlock_types_up.h | |||
@@ -16,22 +16,22 @@ | |||
16 | 16 | ||
17 | typedef struct { | 17 | typedef struct { |
18 | volatile unsigned int slock; | 18 | volatile unsigned int slock; |
19 | } raw_spinlock_t; | 19 | } arch_spinlock_t; |
20 | 20 | ||
21 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | 21 | #define __ARCH_SPIN_LOCK_UNLOCKED { 1 } |
22 | 22 | ||
23 | #else | 23 | #else |
24 | 24 | ||
25 | typedef struct { } raw_spinlock_t; | 25 | typedef struct { } arch_spinlock_t; |
26 | 26 | ||
27 | #define __RAW_SPIN_LOCK_UNLOCKED { } | 27 | #define __ARCH_SPIN_LOCK_UNLOCKED { } |
28 | 28 | ||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | typedef struct { | 31 | typedef struct { |
32 | /* no debug version on UP */ | 32 | /* no debug version on UP */ |
33 | } raw_rwlock_t; | 33 | } arch_rwlock_t; |
34 | 34 | ||
35 | #define __RAW_RW_LOCK_UNLOCKED { } | 35 | #define __ARCH_RW_LOCK_UNLOCKED { } |
36 | 36 | ||
37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ | 37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ |
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h index d4841ed8215b..b14f6a91e19f 100644 --- a/include/linux/spinlock_up.h +++ b/include/linux/spinlock_up.h | |||
@@ -18,21 +18,21 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifdef CONFIG_DEBUG_SPINLOCK | 20 | #ifdef CONFIG_DEBUG_SPINLOCK |
21 | #define __raw_spin_is_locked(x) ((x)->slock == 0) | 21 | #define arch_spin_is_locked(x) ((x)->slock == 0) |
22 | 22 | ||
23 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 23 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
24 | { | 24 | { |
25 | lock->slock = 0; | 25 | lock->slock = 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | static inline void | 28 | static inline void |
29 | __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | 29 | arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) |
30 | { | 30 | { |
31 | local_irq_save(flags); | 31 | local_irq_save(flags); |
32 | lock->slock = 0; | 32 | lock->slock = 0; |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 35 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
36 | { | 36 | { |
37 | char oldval = lock->slock; | 37 | char oldval = lock->slock; |
38 | 38 | ||
@@ -41,7 +41,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
41 | return oldval > 0; | 41 | return oldval > 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 44 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
45 | { | 45 | { |
46 | lock->slock = 1; | 46 | lock->slock = 1; |
47 | } | 47 | } |
@@ -49,28 +49,28 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
49 | /* | 49 | /* |
50 | * Read-write spinlocks. No debug version. | 50 | * Read-write spinlocks. No debug version. |
51 | */ | 51 | */ |
52 | #define __raw_read_lock(lock) do { (void)(lock); } while (0) | 52 | #define arch_read_lock(lock) do { (void)(lock); } while (0) |
53 | #define __raw_write_lock(lock) do { (void)(lock); } while (0) | 53 | #define arch_write_lock(lock) do { (void)(lock); } while (0) |
54 | #define __raw_read_trylock(lock) ({ (void)(lock); 1; }) | 54 | #define arch_read_trylock(lock) ({ (void)(lock); 1; }) |
55 | #define __raw_write_trylock(lock) ({ (void)(lock); 1; }) | 55 | #define arch_write_trylock(lock) ({ (void)(lock); 1; }) |
56 | #define __raw_read_unlock(lock) do { (void)(lock); } while (0) | 56 | #define arch_read_unlock(lock) do { (void)(lock); } while (0) |
57 | #define __raw_write_unlock(lock) do { (void)(lock); } while (0) | 57 | #define arch_write_unlock(lock) do { (void)(lock); } while (0) |
58 | 58 | ||
59 | #else /* DEBUG_SPINLOCK */ | 59 | #else /* DEBUG_SPINLOCK */ |
60 | #define __raw_spin_is_locked(lock) ((void)(lock), 0) | 60 | #define arch_spin_is_locked(lock) ((void)(lock), 0) |
61 | /* for sched.c and kernel_lock.c: */ | 61 | /* for sched.c and kernel_lock.c: */ |
62 | # define __raw_spin_lock(lock) do { (void)(lock); } while (0) | 62 | # define arch_spin_lock(lock) do { (void)(lock); } while (0) |
63 | # define __raw_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) | 63 | # define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0) |
64 | # define __raw_spin_unlock(lock) do { (void)(lock); } while (0) | 64 | # define arch_spin_unlock(lock) do { (void)(lock); } while (0) |
65 | # define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) | 65 | # define arch_spin_trylock(lock) ({ (void)(lock); 1; }) |
66 | #endif /* DEBUG_SPINLOCK */ | 66 | #endif /* DEBUG_SPINLOCK */ |
67 | 67 | ||
68 | #define __raw_spin_is_contended(lock) (((void)(lock), 0)) | 68 | #define arch_spin_is_contended(lock) (((void)(lock), 0)) |
69 | 69 | ||
70 | #define __raw_read_can_lock(lock) (((void)(lock), 1)) | 70 | #define arch_read_can_lock(lock) (((void)(lock), 1)) |
71 | #define __raw_write_can_lock(lock) (((void)(lock), 1)) | 71 | #define arch_write_can_lock(lock) (((void)(lock), 1)) |
72 | 72 | ||
73 | #define __raw_spin_unlock_wait(lock) \ | 73 | #define arch_spin_unlock_wait(lock) \ |
74 | do { cpu_relax(); } while (__raw_spin_is_locked(lock)) | 74 | do { cpu_relax(); } while (arch_spin_is_locked(lock)) |
75 | 75 | ||
76 | #endif /* __LINUX_SPINLOCK_UP_H */ | 76 | #endif /* __LINUX_SPINLOCK_UP_H */ |
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h new file mode 100644 index 000000000000..32bfd1a8a48d --- /dev/null +++ b/include/linux/stmmac.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /******************************************************************************* | ||
2 | |||
3 | Header file for stmmac platform data | ||
4 | |||
5 | Copyright (C) 2009 STMicroelectronics Ltd | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify it | ||
8 | under the terms and conditions of the GNU General Public License, | ||
9 | version 2, as published by the Free Software Foundation. | ||
10 | |||
11 | This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License along with | ||
17 | this program; if not, write to the Free Software Foundation, Inc., | ||
18 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | |||
20 | The full GNU General Public License is included in this distribution in | ||
21 | the file called "COPYING". | ||
22 | |||
23 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
24 | *******************************************************************************/ | ||
25 | |||
26 | #ifndef __STMMAC_PLATFORM_DATA | ||
27 | #define __STMMAC_PLATFORM_DATA | ||
28 | |||
29 | /* platfrom data for platfrom device structure's platfrom_data field */ | ||
30 | |||
31 | /* Private data for the STM on-board ethernet driver */ | ||
32 | struct plat_stmmacenet_data { | ||
33 | int bus_id; | ||
34 | int pbl; | ||
35 | int has_gmac; | ||
36 | void (*fix_mac_speed)(void *priv, unsigned int speed); | ||
37 | void (*bus_setup)(unsigned long ioaddr); | ||
38 | #ifdef CONFIG_STM_DRIVERS | ||
39 | struct stm_pad_config *pad_config; | ||
40 | #endif | ||
41 | void *bsp_priv; | ||
42 | }; | ||
43 | |||
44 | struct plat_stmmacphy_data { | ||
45 | int bus_id; | ||
46 | int phy_addr; | ||
47 | unsigned int phy_mask; | ||
48 | int interface; | ||
49 | int (*phy_reset)(void *priv); | ||
50 | void *priv; | ||
51 | }; | ||
52 | #endif | ||
53 | |||
diff --git a/include/linux/string.h b/include/linux/string.h index b8508868d5ad..a716ee2a8adb 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -62,9 +62,20 @@ extern char * strnchr(const char *, size_t, int); | |||
62 | #ifndef __HAVE_ARCH_STRRCHR | 62 | #ifndef __HAVE_ARCH_STRRCHR |
63 | extern char * strrchr(const char *,int); | 63 | extern char * strrchr(const char *,int); |
64 | #endif | 64 | #endif |
65 | extern char * __must_check strstrip(char *); | 65 | extern char * __must_check skip_spaces(const char *); |
66 | |||
67 | extern char *strim(char *); | ||
68 | |||
69 | static inline __must_check char *strstrip(char *str) | ||
70 | { | ||
71 | return strim(str); | ||
72 | } | ||
73 | |||
66 | #ifndef __HAVE_ARCH_STRSTR | 74 | #ifndef __HAVE_ARCH_STRSTR |
67 | extern char * strstr(const char *,const char *); | 75 | extern char * strstr(const char *, const char *); |
76 | #endif | ||
77 | #ifndef __HAVE_ARCH_STRNSTR | ||
78 | extern char * strnstr(const char *, const char *, size_t); | ||
68 | #endif | 79 | #endif |
69 | #ifndef __HAVE_ARCH_STRLEN | 80 | #ifndef __HAVE_ARCH_STRLEN |
70 | extern __kernel_size_t strlen(const char *); | 81 | extern __kernel_size_t strlen(const char *); |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index 10709cbe96fd..c2786f20016f 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
@@ -28,9 +28,6 @@ | |||
28 | 28 | ||
29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
30 | 30 | ||
31 | #include <linux/timer.h> | ||
32 | #include <linux/workqueue.h> | ||
33 | |||
34 | /* | 31 | /* |
35 | * Enable RPC debugging/profiling. | 32 | * Enable RPC debugging/profiling. |
36 | */ | 33 | */ |
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h index 87b895d5c786..b78f16b1dea3 100644 --- a/include/linux/sunrpc/rpc_rdma.h +++ b/include/linux/sunrpc/rpc_rdma.h | |||
@@ -40,6 +40,8 @@ | |||
40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H | 40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H |
41 | #define _LINUX_SUNRPC_RPC_RDMA_H | 41 | #define _LINUX_SUNRPC_RPC_RDMA_H |
42 | 42 | ||
43 | #include <linux/types.h> | ||
44 | |||
43 | struct rpcrdma_segment { | 45 | struct rpcrdma_segment { |
44 | __be32 rs_handle; /* Registered memory handle */ | 46 | __be32 rs_handle; /* Registered memory handle */ |
45 | __be32 rs_length; /* Length of the chunk in bytes */ | 47 | __be32 rs_length; /* Length of the chunk in bytes */ |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 401097781fc0..7bc7fd5291ce 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -130,12 +130,14 @@ struct rpc_task_setup { | |||
130 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ | 130 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ |
131 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ | 131 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ |
132 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ | 132 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ |
133 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ | ||
133 | 134 | ||
134 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 135 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
135 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 136 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
136 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) | 137 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) |
137 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | 138 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) |
138 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) | 139 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) |
140 | #define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) | ||
139 | 141 | ||
140 | #define RPC_TASK_RUNNING 0 | 142 | #define RPC_TASK_RUNNING 0 |
141 | #define RPC_TASK_QUEUED 1 | 143 | #define RPC_TASK_QUEUED 1 |
@@ -171,7 +173,8 @@ struct rpc_task_setup { | |||
171 | #define RPC_PRIORITY_LOW (-1) | 173 | #define RPC_PRIORITY_LOW (-1) |
172 | #define RPC_PRIORITY_NORMAL (0) | 174 | #define RPC_PRIORITY_NORMAL (0) |
173 | #define RPC_PRIORITY_HIGH (1) | 175 | #define RPC_PRIORITY_HIGH (1) |
174 | #define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW) | 176 | #define RPC_PRIORITY_PRIVILEGED (2) |
177 | #define RPC_NR_PRIORITY (1 + RPC_PRIORITY_PRIVILEGED - RPC_PRIORITY_LOW) | ||
175 | 178 | ||
176 | struct rpc_timer { | 179 | struct rpc_timer { |
177 | struct timer_list timer; | 180 | struct timer_list timer; |
@@ -227,6 +230,7 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *, | |||
227 | void rpc_wake_up(struct rpc_wait_queue *); | 230 | void rpc_wake_up(struct rpc_wait_queue *); |
228 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); | 231 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); |
229 | void rpc_wake_up_status(struct rpc_wait_queue *, int); | 232 | void rpc_wake_up_status(struct rpc_wait_queue *, int); |
233 | int rpc_queue_empty(struct rpc_wait_queue *); | ||
230 | void rpc_delay(struct rpc_task *, unsigned long); | 234 | void rpc_delay(struct rpc_task *, unsigned long); |
231 | void * rpc_malloc(struct rpc_task *, size_t); | 235 | void * rpc_malloc(struct rpc_task *, size_t); |
232 | void rpc_free(void *); | 236 | void rpc_free(void *); |
@@ -252,6 +256,16 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task) | |||
252 | return __rpc_wait_for_completion_task(task, NULL); | 256 | return __rpc_wait_for_completion_task(task, NULL); |
253 | } | 257 | } |
254 | 258 | ||
259 | static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio) | ||
260 | { | ||
261 | task->tk_priority = prio - RPC_PRIORITY_LOW; | ||
262 | } | ||
263 | |||
264 | static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio) | ||
265 | { | ||
266 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); | ||
267 | } | ||
268 | |||
255 | #ifdef RPC_DEBUG | 269 | #ifdef RPC_DEBUG |
256 | static inline const char * rpc_qname(struct rpc_wait_queue *q) | 270 | static inline const char * rpc_qname(struct rpc_wait_queue *q) |
257 | { | 271 | { |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 52e8cb0a7569..5a3085b9b394 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -29,7 +29,6 @@ struct svc_pool_stats { | |||
29 | unsigned long packets; | 29 | unsigned long packets; |
30 | unsigned long sockets_queued; | 30 | unsigned long sockets_queued; |
31 | unsigned long threads_woken; | 31 | unsigned long threads_woken; |
32 | unsigned long overloads_avoided; | ||
33 | unsigned long threads_timedout; | 32 | unsigned long threads_timedout; |
34 | }; | 33 | }; |
35 | 34 | ||
@@ -50,7 +49,6 @@ struct svc_pool { | |||
50 | struct list_head sp_sockets; /* pending sockets */ | 49 | struct list_head sp_sockets; /* pending sockets */ |
51 | unsigned int sp_nrthreads; /* # of threads in pool */ | 50 | unsigned int sp_nrthreads; /* # of threads in pool */ |
52 | struct list_head sp_all_threads; /* all server threads */ | 51 | struct list_head sp_all_threads; /* all server threads */ |
53 | int sp_nwaking; /* number of threads woken but not yet active */ | ||
54 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ | 52 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ |
55 | } ____cacheline_aligned_in_smp; | 53 | } ____cacheline_aligned_in_smp; |
56 | 54 | ||
@@ -275,16 +273,11 @@ struct svc_rqst { | |||
275 | struct auth_domain * rq_client; /* RPC peer info */ | 273 | struct auth_domain * rq_client; /* RPC peer info */ |
276 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ | 274 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ |
277 | struct svc_cacherep * rq_cacherep; /* cache info */ | 275 | struct svc_cacherep * rq_cacherep; /* cache info */ |
278 | struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to | ||
279 | * determine what device number | ||
280 | * to report (real or virtual) | ||
281 | */ | ||
282 | int rq_splice_ok; /* turned off in gss privacy | 276 | int rq_splice_ok; /* turned off in gss privacy |
283 | * to prevent encrypting page | 277 | * to prevent encrypting page |
284 | * cache pages */ | 278 | * cache pages */ |
285 | wait_queue_head_t rq_wait; /* synchronization */ | 279 | wait_queue_head_t rq_wait; /* synchronization */ |
286 | struct task_struct *rq_task; /* service thread */ | 280 | struct task_struct *rq_task; /* service thread */ |
287 | int rq_waking; /* 1 if thread is being woken */ | ||
288 | }; | 281 | }; |
289 | 282 | ||
290 | /* | 283 | /* |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 4ec90019c1a4..a2602a8207a6 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -145,38 +145,43 @@ enum { | |||
145 | SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ | 145 | SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */ |
146 | SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ | 146 | SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ |
147 | SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ | 147 | SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ |
148 | SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ | ||
148 | /* add others here before... */ | 149 | /* add others here before... */ |
149 | SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ | 150 | SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ |
150 | }; | 151 | }; |
151 | 152 | ||
152 | #define SWAP_CLUSTER_MAX 32 | 153 | #define SWAP_CLUSTER_MAX 32 |
153 | 154 | ||
154 | #define SWAP_MAP_MAX 0x7ffe | 155 | #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ |
155 | #define SWAP_MAP_BAD 0x7fff | 156 | #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ |
156 | #define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */ | 157 | #define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ |
157 | #define SWAP_COUNT_MASK (~SWAP_HAS_CACHE) | 158 | #define SWAP_CONT_MAX 0x7f /* Max count, in each swap_map continuation */ |
159 | #define COUNT_CONTINUED 0x80 /* See swap_map continuation for full count */ | ||
160 | #define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ | ||
161 | |||
158 | /* | 162 | /* |
159 | * The in-memory structure used to track swap areas. | 163 | * The in-memory structure used to track swap areas. |
160 | */ | 164 | */ |
161 | struct swap_info_struct { | 165 | struct swap_info_struct { |
162 | unsigned long flags; | 166 | unsigned long flags; /* SWP_USED etc: see above */ |
163 | int prio; /* swap priority */ | 167 | signed short prio; /* swap priority of this type */ |
164 | int next; /* next entry on swap list */ | 168 | signed char type; /* strange name for an index */ |
165 | struct file *swap_file; | 169 | signed char next; /* next type on the swap list */ |
166 | struct block_device *bdev; | 170 | unsigned int max; /* extent of the swap_map */ |
167 | struct list_head extent_list; | 171 | unsigned char *swap_map; /* vmalloc'ed array of usage counts */ |
168 | struct swap_extent *curr_swap_extent; | 172 | unsigned int lowest_bit; /* index of first free in swap_map */ |
169 | unsigned short *swap_map; | 173 | unsigned int highest_bit; /* index of last free in swap_map */ |
170 | unsigned int lowest_bit; | 174 | unsigned int pages; /* total of usable pages of swap */ |
171 | unsigned int highest_bit; | 175 | unsigned int inuse_pages; /* number of those currently in use */ |
176 | unsigned int cluster_next; /* likely index for next allocation */ | ||
177 | unsigned int cluster_nr; /* countdown to next cluster search */ | ||
172 | unsigned int lowest_alloc; /* while preparing discard cluster */ | 178 | unsigned int lowest_alloc; /* while preparing discard cluster */ |
173 | unsigned int highest_alloc; /* while preparing discard cluster */ | 179 | unsigned int highest_alloc; /* while preparing discard cluster */ |
174 | unsigned int cluster_next; | 180 | struct swap_extent *curr_swap_extent; |
175 | unsigned int cluster_nr; | 181 | struct swap_extent first_swap_extent; |
176 | unsigned int pages; | 182 | struct block_device *bdev; /* swap device or bdev of swap file */ |
177 | unsigned int max; | 183 | struct file *swap_file; /* seldom referenced */ |
178 | unsigned int inuse_pages; | 184 | unsigned int old_block_size; /* seldom referenced */ |
179 | unsigned int old_block_size; | ||
180 | }; | 185 | }; |
181 | 186 | ||
182 | struct swap_list_t { | 187 | struct swap_list_t { |
@@ -273,6 +278,7 @@ extern int scan_unevictable_register_node(struct node *node); | |||
273 | extern void scan_unevictable_unregister_node(struct node *node); | 278 | extern void scan_unevictable_unregister_node(struct node *node); |
274 | 279 | ||
275 | extern int kswapd_run(int nid); | 280 | extern int kswapd_run(int nid); |
281 | extern void kswapd_stop(int nid); | ||
276 | 282 | ||
277 | #ifdef CONFIG_MMU | 283 | #ifdef CONFIG_MMU |
278 | /* linux/mm/shmem.c */ | 284 | /* linux/mm/shmem.c */ |
@@ -309,17 +315,18 @@ extern long total_swap_pages; | |||
309 | extern void si_swapinfo(struct sysinfo *); | 315 | extern void si_swapinfo(struct sysinfo *); |
310 | extern swp_entry_t get_swap_page(void); | 316 | extern swp_entry_t get_swap_page(void); |
311 | extern swp_entry_t get_swap_page_of_type(int); | 317 | extern swp_entry_t get_swap_page_of_type(int); |
312 | extern void swap_duplicate(swp_entry_t); | ||
313 | extern int swapcache_prepare(swp_entry_t); | ||
314 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | 318 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
319 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); | ||
320 | extern void swap_shmem_alloc(swp_entry_t); | ||
321 | extern int swap_duplicate(swp_entry_t); | ||
322 | extern int swapcache_prepare(swp_entry_t); | ||
315 | extern void swap_free(swp_entry_t); | 323 | extern void swap_free(swp_entry_t); |
316 | extern void swapcache_free(swp_entry_t, struct page *page); | 324 | extern void swapcache_free(swp_entry_t, struct page *page); |
317 | extern int free_swap_and_cache(swp_entry_t); | 325 | extern int free_swap_and_cache(swp_entry_t); |
318 | extern int swap_type_of(dev_t, sector_t, struct block_device **); | 326 | extern int swap_type_of(dev_t, sector_t, struct block_device **); |
319 | extern unsigned int count_swap_pages(int, int); | 327 | extern unsigned int count_swap_pages(int, int); |
320 | extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); | 328 | extern sector_t map_swap_page(struct page *, struct block_device **); |
321 | extern sector_t swapdev_block(int, pgoff_t); | 329 | extern sector_t swapdev_block(int, pgoff_t); |
322 | extern struct swap_info_struct *get_swap_info_struct(unsigned); | ||
323 | extern int reuse_swap_page(struct page *); | 330 | extern int reuse_swap_page(struct page *); |
324 | extern int try_to_free_swap(struct page *); | 331 | extern int try_to_free_swap(struct page *); |
325 | struct backing_dev_info; | 332 | struct backing_dev_info; |
@@ -384,8 +391,18 @@ static inline void show_swap_cache_info(void) | |||
384 | #define free_swap_and_cache(swp) is_migration_entry(swp) | 391 | #define free_swap_and_cache(swp) is_migration_entry(swp) |
385 | #define swapcache_prepare(swp) is_migration_entry(swp) | 392 | #define swapcache_prepare(swp) is_migration_entry(swp) |
386 | 393 | ||
387 | static inline void swap_duplicate(swp_entry_t swp) | 394 | static inline int add_swap_count_continuation(swp_entry_t swp, gfp_t gfp_mask) |
388 | { | 395 | { |
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static inline void swap_shmem_alloc(swp_entry_t swp) | ||
400 | { | ||
401 | } | ||
402 | |||
403 | static inline int swap_duplicate(swp_entry_t swp) | ||
404 | { | ||
405 | return 0; | ||
389 | } | 406 | } |
390 | 407 | ||
391 | static inline void swap_free(swp_entry_t swp) | 408 | static inline void swap_free(swp_entry_t swp) |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index bc70c5810fec..207466a49f3d 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -102,12 +102,10 @@ struct perf_event_attr; | |||
102 | #ifdef CONFIG_EVENT_PROFILE | 102 | #ifdef CONFIG_EVENT_PROFILE |
103 | 103 | ||
104 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | 104 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ |
105 | .profile_count = ATOMIC_INIT(-1), \ | ||
106 | .profile_enable = prof_sysenter_enable, \ | 105 | .profile_enable = prof_sysenter_enable, \ |
107 | .profile_disable = prof_sysenter_disable, | 106 | .profile_disable = prof_sysenter_disable, |
108 | 107 | ||
109 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | 108 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ |
110 | .profile_count = ATOMIC_INIT(-1), \ | ||
111 | .profile_enable = prof_sysexit_enable, \ | 109 | .profile_enable = prof_sysexit_enable, \ |
112 | .profile_disable = prof_sysexit_disable, | 110 | .profile_disable = prof_sysexit_disable, |
113 | #else | 111 | #else |
@@ -145,7 +143,7 @@ struct perf_event_attr; | |||
145 | .name = "sys_enter"#sname, \ | 143 | .name = "sys_enter"#sname, \ |
146 | .system = "syscalls", \ | 144 | .system = "syscalls", \ |
147 | .event = &enter_syscall_print_##sname, \ | 145 | .event = &enter_syscall_print_##sname, \ |
148 | .raw_init = init_syscall_trace, \ | 146 | .raw_init = trace_event_raw_init, \ |
149 | .show_format = syscall_enter_format, \ | 147 | .show_format = syscall_enter_format, \ |
150 | .define_fields = syscall_enter_define_fields, \ | 148 | .define_fields = syscall_enter_define_fields, \ |
151 | .regfunc = reg_event_syscall_enter, \ | 149 | .regfunc = reg_event_syscall_enter, \ |
@@ -167,7 +165,7 @@ struct perf_event_attr; | |||
167 | .name = "sys_exit"#sname, \ | 165 | .name = "sys_exit"#sname, \ |
168 | .system = "syscalls", \ | 166 | .system = "syscalls", \ |
169 | .event = &exit_syscall_print_##sname, \ | 167 | .event = &exit_syscall_print_##sname, \ |
170 | .raw_init = init_syscall_trace, \ | 168 | .raw_init = trace_event_raw_init, \ |
171 | .show_format = syscall_exit_format, \ | 169 | .show_format = syscall_exit_format, \ |
172 | .define_fields = syscall_exit_define_fields, \ | 170 | .define_fields = syscall_exit_define_fields, \ |
173 | .regfunc = reg_event_syscall_exit, \ | 171 | .regfunc = reg_event_syscall_exit, \ |
@@ -197,7 +195,7 @@ struct perf_event_attr; | |||
197 | static const struct syscall_metadata __used \ | 195 | static const struct syscall_metadata __used \ |
198 | __attribute__((__aligned__(4))) \ | 196 | __attribute__((__aligned__(4))) \ |
199 | __attribute__((section("__syscalls_metadata"))) \ | 197 | __attribute__((section("__syscalls_metadata"))) \ |
200 | __syscall_meta_##sname = { \ | 198 | __syscall_meta__##sname = { \ |
201 | .name = "sys_"#sname, \ | 199 | .name = "sys_"#sname, \ |
202 | .nb_args = 0, \ | 200 | .nb_args = 0, \ |
203 | .enter_event = &event_enter__##sname, \ | 201 | .enter_event = &event_enter__##sname, \ |
@@ -834,4 +832,8 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | |||
834 | asmlinkage long sys_perf_event_open( | 832 | asmlinkage long sys_perf_event_open( |
835 | struct perf_event_attr __user *attr_uptr, | 833 | struct perf_event_attr __user *attr_uptr, |
836 | pid_t pid, int cpu, int group_fd, unsigned long flags); | 834 | pid_t pid, int cpu, int group_fd, unsigned long flags); |
835 | |||
836 | asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, | ||
837 | unsigned long prot, unsigned long flags, | ||
838 | unsigned long fd, unsigned long pgoff); | ||
837 | #endif | 839 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 56af3ca75e24..f66014c90c9f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -89,8 +89,8 @@ enum | |||
89 | KERN_VERSION=4, /* string: compile time info */ | 89 | KERN_VERSION=4, /* string: compile time info */ |
90 | KERN_SECUREMASK=5, /* struct: maximum rights mask */ | 90 | KERN_SECUREMASK=5, /* struct: maximum rights mask */ |
91 | KERN_PROF=6, /* table: profiling information */ | 91 | KERN_PROF=6, /* table: profiling information */ |
92 | KERN_NODENAME=7, | 92 | KERN_NODENAME=7, /* string: hostname */ |
93 | KERN_DOMAINNAME=8, | 93 | KERN_DOMAINNAME=8, /* string: domainname */ |
94 | 94 | ||
95 | KERN_PANIC=15, /* int: panic timeout */ | 95 | KERN_PANIC=15, /* int: panic timeout */ |
96 | KERN_REALROOTDEV=16, /* real root device to mount after initrd */ | 96 | KERN_REALROOTDEV=16, /* real root device to mount after initrd */ |
@@ -102,8 +102,8 @@ enum | |||
102 | KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ | 102 | KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ |
103 | KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ | 103 | KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ |
104 | KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ | 104 | KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ |
105 | KERN_MODPROBE=28, | 105 | KERN_MODPROBE=28, /* string: modprobe path */ |
106 | KERN_SG_BIG_BUFF=29, | 106 | KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */ |
107 | KERN_ACCT=30, /* BSD process accounting parameters */ | 107 | KERN_ACCT=30, /* BSD process accounting parameters */ |
108 | KERN_PPC_L2CR=31, /* l2cr register on PPC */ | 108 | KERN_PPC_L2CR=31, /* l2cr register on PPC */ |
109 | 109 | ||
@@ -150,7 +150,7 @@ enum | |||
150 | KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ | 150 | KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ |
151 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ | 151 | KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ |
152 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ | 152 | KERN_COMPAT_LOG=73, /* int: print compat layer messages */ |
153 | KERN_MAX_LOCK_DEPTH=74, | 153 | KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */ |
154 | KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ | 154 | KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ |
155 | KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ | 155 | KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ |
156 | }; | 156 | }; |
@@ -481,8 +481,6 @@ enum | |||
481 | NET_IPV4_CONF_PROMOTE_SECONDARIES=20, | 481 | NET_IPV4_CONF_PROMOTE_SECONDARIES=20, |
482 | NET_IPV4_CONF_ARP_ACCEPT=21, | 482 | NET_IPV4_CONF_ARP_ACCEPT=21, |
483 | NET_IPV4_CONF_ARP_NOTIFY=22, | 483 | NET_IPV4_CONF_ARP_NOTIFY=22, |
484 | NET_IPV4_CONF_ACCEPT_LOCAL=23, | ||
485 | __NET_IPV4_CONF_MAX | ||
486 | }; | 484 | }; |
487 | 485 | ||
488 | /* /proc/sys/net/ipv4/netfilter */ | 486 | /* /proc/sys/net/ipv4/netfilter */ |
@@ -598,7 +596,6 @@ enum { | |||
598 | NET_NEIGH_GC_THRESH3=16, | 596 | NET_NEIGH_GC_THRESH3=16, |
599 | NET_NEIGH_RETRANS_TIME_MS=17, | 597 | NET_NEIGH_RETRANS_TIME_MS=17, |
600 | NET_NEIGH_REACHABLE_TIME_MS=18, | 598 | NET_NEIGH_REACHABLE_TIME_MS=18, |
601 | __NET_NEIGH_MAX | ||
602 | }; | 599 | }; |
603 | 600 | ||
604 | /* /proc/sys/net/dccp */ | 601 | /* /proc/sys/net/dccp */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9d68fed50f11..cfa83083a2d4 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | |||
99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
100 | 100 | ||
101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
102 | struct bin_attribute *attr); | 102 | const struct bin_attribute *attr); |
103 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 103 | void sysfs_remove_bin_file(struct kobject *kobj, |
104 | const struct bin_attribute *attr); | ||
104 | 105 | ||
105 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 106 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
106 | const char *name); | 107 | const char *name); |
@@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
175 | } | 176 | } |
176 | 177 | ||
177 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 178 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
178 | struct bin_attribute *attr) | 179 | const struct bin_attribute *attr) |
179 | { | 180 | { |
180 | return 0; | 181 | return 0; |
181 | } | 182 | } |
182 | 183 | ||
183 | static inline void sysfs_remove_bin_file(struct kobject *kobj, | 184 | static inline void sysfs_remove_bin_file(struct kobject *kobj, |
184 | struct bin_attribute *attr) | 185 | const struct bin_attribute *attr) |
185 | { | 186 | { |
186 | } | 187 | } |
187 | 188 | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 7fee8a4df931..a778ee024590 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -103,6 +103,8 @@ enum { | |||
103 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | 103 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ |
104 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ | 104 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ |
105 | #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ | 105 | #define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ |
106 | #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ | ||
107 | #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ | ||
106 | 108 | ||
107 | /* for TCP_INFO socket option */ | 109 | /* for TCP_INFO socket option */ |
108 | #define TCPI_OPT_TIMESTAMPS 1 | 110 | #define TCPI_OPT_TIMESTAMPS 1 |
@@ -340,7 +342,10 @@ struct tcp_sock { | |||
340 | u32 frto_highmark; /* snd_nxt when RTO occurred */ | 342 | u32 frto_highmark; /* snd_nxt when RTO occurred */ |
341 | u16 advmss; /* Advertised MSS */ | 343 | u16 advmss; /* Advertised MSS */ |
342 | u8 frto_counter; /* Number of new acks after RTO */ | 344 | u8 frto_counter; /* Number of new acks after RTO */ |
343 | u8 nonagle; /* Disable Nagle algorithm? */ | 345 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
346 | thin_lto : 1,/* Use linear timeouts for thin streams */ | ||
347 | thin_dupack : 1,/* Fast retransmit on first dupack */ | ||
348 | unused : 2; | ||
344 | 349 | ||
345 | /* RTT measurement */ | 350 | /* RTT measurement */ |
346 | u32 srtt; /* smoothed round trip time << 3 */ | 351 | u32 srtt; /* smoothed round trip time << 3 */ |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 0482229c07db..d2ae79e21be3 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -43,6 +43,7 @@ enum tick_nohz_mode { | |||
43 | * @idle_exittime: Time when the idle state was left | 43 | * @idle_exittime: Time when the idle state was left |
44 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped | 44 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped |
45 | * @sleep_length: Duration of the current idle sleep | 45 | * @sleep_length: Duration of the current idle sleep |
46 | * @do_timer_lst: CPU was the last one doing do_timer before going idle | ||
46 | */ | 47 | */ |
47 | struct tick_sched { | 48 | struct tick_sched { |
48 | struct hrtimer sched_timer; | 49 | struct hrtimer sched_timer; |
@@ -64,6 +65,7 @@ struct tick_sched { | |||
64 | unsigned long last_jiffies; | 65 | unsigned long last_jiffies; |
65 | unsigned long next_jiffies; | 66 | unsigned long next_jiffies; |
66 | ktime_t idle_expires; | 67 | ktime_t idle_expires; |
68 | int do_timer_last; | ||
67 | }; | 69 | }; |
68 | 70 | ||
69 | extern void __init tick_init(void); | 71 | extern void __init tick_init(void); |
@@ -98,6 +100,9 @@ extern int tick_check_oneshot_change(int allow_nohz); | |||
98 | extern struct tick_sched *tick_get_tick_sched(int cpu); | 100 | extern struct tick_sched *tick_get_tick_sched(int cpu); |
99 | extern void tick_check_idle(int cpu); | 101 | extern void tick_check_idle(int cpu); |
100 | extern int tick_oneshot_mode_active(void); | 102 | extern int tick_oneshot_mode_active(void); |
103 | # ifndef arch_needs_cpu | ||
104 | # define arch_needs_cpu(cpu) (0) | ||
105 | # endif | ||
101 | # else | 106 | # else |
102 | static inline void tick_clock_notify(void) { } | 107 | static inline void tick_clock_notify(void) { } |
103 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 108 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
diff --git a/include/linux/timb_gpio.h b/include/linux/timb_gpio.h new file mode 100644 index 000000000000..ce456eaae861 --- /dev/null +++ b/include/linux/timb_gpio.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * timb_gpio.h timberdale FPGA GPIO driver, platform data definition | ||
3 | * Copyright (c) 2009 Intel Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef _LINUX_TIMB_GPIO_H | ||
20 | #define _LINUX_TIMB_GPIO_H | ||
21 | |||
22 | /** | ||
23 | * struct timbgpio_platform_data - Platform data of the Timberdale GPIO driver | ||
24 | * @gpio_base The number of the first GPIO pin, set to -1 for | ||
25 | * dynamic number allocation. | ||
26 | * @nr_pins Number of pins that is supported by the hardware (1-32) | ||
27 | * @irq_base If IRQ is supported by the hardware, this is the base | ||
28 | * number of IRQ:s. One IRQ per pin will be used. Set to | ||
29 | * -1 if IRQ:s is not supported. | ||
30 | */ | ||
31 | struct timbgpio_platform_data { | ||
32 | int gpio_base; | ||
33 | int nr_pins; | ||
34 | int irq_base; | ||
35 | }; | ||
36 | |||
37 | #endif | ||
diff --git a/include/linux/time.h b/include/linux/time.h index fe04e5ef6a59..6e026e45a179 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts); | |||
148 | 148 | ||
149 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 149 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
150 | extern int timekeeping_valid_for_hres(void); | 150 | extern int timekeeping_valid_for_hres(void); |
151 | extern u64 timekeeping_max_deferment(void); | ||
151 | extern void update_wall_time(void); | 152 | extern void update_wall_time(void); |
152 | extern void update_xtime_cache(u64 nsec); | 153 | extern void update_xtime_cache(u64 nsec); |
153 | extern void timekeeping_leap_insert(int leapsecond); | 154 | extern void timekeeping_leap_insert(int leapsecond); |
diff --git a/include/linux/timex.h b/include/linux/timex.h index e6967d10d9e5..94f8faecdcbc 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -115,13 +115,16 @@ struct timex { | |||
115 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ | 115 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | /* xntp 3.4 compatibility names */ | 118 | /* NTP userland likes the MOD_ prefix better */ |
119 | #define MOD_OFFSET ADJ_OFFSET | 119 | #define MOD_OFFSET ADJ_OFFSET |
120 | #define MOD_FREQUENCY ADJ_FREQUENCY | 120 | #define MOD_FREQUENCY ADJ_FREQUENCY |
121 | #define MOD_MAXERROR ADJ_MAXERROR | 121 | #define MOD_MAXERROR ADJ_MAXERROR |
122 | #define MOD_ESTERROR ADJ_ESTERROR | 122 | #define MOD_ESTERROR ADJ_ESTERROR |
123 | #define MOD_STATUS ADJ_STATUS | 123 | #define MOD_STATUS ADJ_STATUS |
124 | #define MOD_TIMECONST ADJ_TIMECONST | 124 | #define MOD_TIMECONST ADJ_TIMECONST |
125 | #define MOD_TAI ADJ_TAI | ||
126 | #define MOD_MICRO ADJ_MICRO | ||
127 | #define MOD_NANO ADJ_NANO | ||
125 | 128 | ||
126 | 129 | ||
127 | /* | 130 | /* |
@@ -261,11 +264,7 @@ static inline int ntp_synced(void) | |||
261 | 264 | ||
262 | #define NTP_SCALE_SHIFT 32 | 265 | #define NTP_SCALE_SHIFT 32 |
263 | 266 | ||
264 | #ifdef CONFIG_NO_HZ | ||
265 | #define NTP_INTERVAL_FREQ (2) | ||
266 | #else | ||
267 | #define NTP_INTERVAL_FREQ (HZ) | 267 | #define NTP_INTERVAL_FREQ (HZ) |
268 | #endif | ||
269 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 268 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
270 | 269 | ||
271 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | 270 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
diff --git a/include/linux/topology.h b/include/linux/topology.h index 57e63579bfdd..5b81156780b1 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -99,7 +99,7 @@ int arch_update_cpu_topology(void); | |||
99 | | 1*SD_WAKE_AFFINE \ | 99 | | 1*SD_WAKE_AFFINE \ |
100 | | 1*SD_SHARE_CPUPOWER \ | 100 | | 1*SD_SHARE_CPUPOWER \ |
101 | | 0*SD_POWERSAVINGS_BALANCE \ | 101 | | 0*SD_POWERSAVINGS_BALANCE \ |
102 | | 0*SD_SHARE_PKG_RESOURCES \ | 102 | | 1*SD_SHARE_PKG_RESOURCES \ |
103 | | 0*SD_SERIALIZE \ | 103 | | 0*SD_SERIALIZE \ |
104 | | 0*SD_PREFER_SIBLING \ | 104 | | 0*SD_PREFER_SIBLING \ |
105 | , \ | 105 | , \ |
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 09077f6ed128..5cf397ceb726 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
@@ -14,6 +14,7 @@ struct trace_seq { | |||
14 | unsigned char buffer[PAGE_SIZE]; | 14 | unsigned char buffer[PAGE_SIZE]; |
15 | unsigned int len; | 15 | unsigned int len; |
16 | unsigned int readpos; | 16 | unsigned int readpos; |
17 | int full; | ||
17 | }; | 18 | }; |
18 | 19 | ||
19 | static inline void | 20 | static inline void |
@@ -21,6 +22,7 @@ trace_seq_init(struct trace_seq *s) | |||
21 | { | 22 | { |
22 | s->len = 0; | 23 | s->len = 0; |
23 | s->readpos = 0; | 24 | s->readpos = 0; |
25 | s->full = 0; | ||
24 | } | 26 | } |
25 | 27 | ||
26 | /* | 28 | /* |
@@ -33,7 +35,7 @@ extern int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args) | |||
33 | __attribute__ ((format (printf, 2, 0))); | 35 | __attribute__ ((format (printf, 2, 0))); |
34 | extern int | 36 | extern int |
35 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); | 37 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); |
36 | extern void trace_print_seq(struct seq_file *m, struct trace_seq *s); | 38 | extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); |
37 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 39 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
38 | size_t cnt); | 40 | size_t cnt); |
39 | extern int trace_seq_puts(struct trace_seq *s, const char *str); | 41 | extern int trace_seq_puts(struct trace_seq *s, const char *str); |
@@ -55,8 +57,9 @@ trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary) | |||
55 | return 0; | 57 | return 0; |
56 | } | 58 | } |
57 | 59 | ||
58 | static inline void trace_print_seq(struct seq_file *m, struct trace_seq *s) | 60 | static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) |
59 | { | 61 | { |
62 | return 0; | ||
60 | } | 63 | } |
61 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | 64 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
62 | size_t cnt) | 65 | size_t cnt) |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 1eb44a924e56..10db0102a890 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -134,6 +134,13 @@ static inline __must_check int tracehook_report_syscall_entry( | |||
134 | */ | 134 | */ |
135 | static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) | 135 | static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) |
136 | { | 136 | { |
137 | if (step) { | ||
138 | siginfo_t info; | ||
139 | user_single_step_siginfo(current, regs, &info); | ||
140 | force_sig_info(SIGTRAP, &info, current); | ||
141 | return; | ||
142 | } | ||
143 | |||
137 | ptrace_report_syscall(regs); | 144 | ptrace_report_syscall(regs); |
138 | } | 145 | } |
139 | 146 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index f0f43d08d8b8..6abfcf5b5887 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -190,9 +190,17 @@ struct tty_port_operations { | |||
190 | /* Control the DTR line */ | 190 | /* Control the DTR line */ |
191 | void (*dtr_rts)(struct tty_port *port, int raise); | 191 | void (*dtr_rts)(struct tty_port *port, int raise); |
192 | /* Called when the last close completes or a hangup finishes | 192 | /* Called when the last close completes or a hangup finishes |
193 | IFF the port was initialized. Do not use to free resources */ | 193 | IFF the port was initialized. Do not use to free resources. Called |
194 | under the port mutex to serialize against activate/shutdowns */ | ||
194 | void (*shutdown)(struct tty_port *port); | 195 | void (*shutdown)(struct tty_port *port); |
195 | void (*drop)(struct tty_port *port); | 196 | void (*drop)(struct tty_port *port); |
197 | /* Called under the port mutex from tty_port_open, serialized using | ||
198 | the port mutex */ | ||
199 | /* FIXME: long term getting the tty argument *out* of this would be | ||
200 | good for consoles */ | ||
201 | int (*activate)(struct tty_port *port, struct tty_struct *tty); | ||
202 | /* Called on the final put of a port */ | ||
203 | void (*destruct)(struct tty_port *port); | ||
196 | }; | 204 | }; |
197 | 205 | ||
198 | struct tty_port { | 206 | struct tty_port { |
@@ -206,12 +214,14 @@ struct tty_port { | |||
206 | wait_queue_head_t delta_msr_wait; /* Modem status change */ | 214 | wait_queue_head_t delta_msr_wait; /* Modem status change */ |
207 | unsigned long flags; /* TTY flags ASY_*/ | 215 | unsigned long flags; /* TTY flags ASY_*/ |
208 | struct mutex mutex; /* Locking */ | 216 | struct mutex mutex; /* Locking */ |
217 | struct mutex buf_mutex; /* Buffer alloc lock */ | ||
209 | unsigned char *xmit_buf; /* Optional buffer */ | 218 | unsigned char *xmit_buf; /* Optional buffer */ |
210 | unsigned int close_delay; /* Close port delay */ | 219 | unsigned int close_delay; /* Close port delay */ |
211 | unsigned int closing_wait; /* Delay for output */ | 220 | unsigned int closing_wait; /* Delay for output */ |
212 | int drain_delay; /* Set to zero if no pure time | 221 | int drain_delay; /* Set to zero if no pure time |
213 | based drain is needed else | 222 | based drain is needed else |
214 | set to size of fifo */ | 223 | set to size of fifo */ |
224 | struct kref kref; /* Ref counter */ | ||
215 | }; | 225 | }; |
216 | 226 | ||
217 | /* | 227 | /* |
@@ -340,8 +350,6 @@ extern void tty_write_flush(struct tty_struct *); | |||
340 | 350 | ||
341 | extern struct ktermios tty_std_termios; | 351 | extern struct ktermios tty_std_termios; |
342 | 352 | ||
343 | extern int kmsg_redirect; | ||
344 | |||
345 | extern void console_init(void); | 353 | extern void console_init(void); |
346 | extern int vcs_init(void); | 354 | extern int vcs_init(void); |
347 | 355 | ||
@@ -439,7 +447,7 @@ extern void initialize_tty_struct(struct tty_struct *tty, | |||
439 | struct tty_driver *driver, int idx); | 447 | struct tty_driver *driver, int idx); |
440 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | 448 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, |
441 | int first_ok); | 449 | int first_ok); |
442 | extern void tty_release_dev(struct file *filp); | 450 | extern int tty_release(struct inode *inode, struct file *filp); |
443 | extern int tty_init_termios(struct tty_struct *tty); | 451 | extern int tty_init_termios(struct tty_struct *tty); |
444 | 452 | ||
445 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); | 453 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); |
@@ -454,6 +462,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay); | |||
454 | extern void tty_port_init(struct tty_port *port); | 462 | extern void tty_port_init(struct tty_port *port); |
455 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); | 463 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); |
456 | extern void tty_port_free_xmit_buf(struct tty_port *port); | 464 | extern void tty_port_free_xmit_buf(struct tty_port *port); |
465 | extern void tty_port_put(struct tty_port *port); | ||
466 | |||
467 | static inline struct tty_port *tty_port_get(struct tty_port *port) | ||
468 | { | ||
469 | if (port) | ||
470 | kref_get(&port->kref); | ||
471 | return port; | ||
472 | } | ||
473 | |||
457 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); | 474 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); |
458 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); | 475 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); |
459 | extern int tty_port_carrier_raised(struct tty_port *port); | 476 | extern int tty_port_carrier_raised(struct tty_port *port); |
@@ -467,7 +484,9 @@ extern int tty_port_close_start(struct tty_port *port, | |||
467 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); | 484 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); |
468 | extern void tty_port_close(struct tty_port *port, | 485 | extern void tty_port_close(struct tty_port *port, |
469 | struct tty_struct *tty, struct file *filp); | 486 | struct tty_struct *tty, struct file *filp); |
470 | extern inline int tty_port_users(struct tty_port *port) | 487 | extern int tty_port_open(struct tty_port *port, |
488 | struct tty_struct *tty, struct file *filp); | ||
489 | static inline int tty_port_users(struct tty_port *port) | ||
471 | { | 490 | { |
472 | return port->count + port->blocked_open; | 491 | return port->count + port->blocked_open; |
473 | } | 492 | } |
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 6b58367d145e..d512d98dfb7d 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -94,6 +94,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
94 | * happens, handle that and return -EFAULT. | 94 | * happens, handle that and return -EFAULT. |
95 | */ | 95 | */ |
96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); |
97 | extern long __probe_kernel_read(void *dst, void *src, size_t size); | ||
97 | 98 | ||
98 | /* | 99 | /* |
99 | * probe_kernel_write(): safely attempt to write to a location | 100 | * probe_kernel_write(): safely attempt to write to a location |
@@ -104,6 +105,7 @@ extern long probe_kernel_read(void *dst, void *src, size_t size); | |||
104 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
105 | * happens, handle that and return -EFAULT. | 106 | * happens, handle that and return -EFAULT. |
106 | */ | 107 | */ |
107 | extern long probe_kernel_write(void *dst, void *src, size_t size); | 108 | extern long notrace probe_kernel_write(void *dst, void *src, size_t size); |
109 | extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); | ||
108 | 110 | ||
109 | #endif /* __LINUX_UACCESS_H__ */ | 111 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index adb44066680c..1b4790911052 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
@@ -110,6 +110,10 @@ struct ucb1400 { | |||
110 | struct platform_device *ucb1400_gpio; | 110 | struct platform_device *ucb1400_gpio; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct ucb1400_pdata { | ||
114 | int irq; | ||
115 | }; | ||
116 | |||
113 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) | 117 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) |
114 | { | 118 | { |
115 | return ac97->bus->ops->read(ac97, reg); | 119 | return ac97->bus->ops->read(ac97, reg); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index a34fa89f1474..d7ace1b80f09 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -192,6 +192,7 @@ struct usb_interface { | |||
192 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ | 192 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ |
193 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ | 193 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ |
194 | unsigned reset_running:1; | 194 | unsigned reset_running:1; |
195 | unsigned resetting_device:1; /* true: bandwidth alloc after reset */ | ||
195 | 196 | ||
196 | struct device dev; /* interface specific device info */ | 197 | struct device dev; /* interface specific device info */ |
197 | struct device *usb_dev; | 198 | struct device *usb_dev; |
@@ -331,6 +332,7 @@ struct usb_bus { | |||
331 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 332 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
332 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 333 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
333 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 334 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
335 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ | ||
334 | 336 | ||
335 | int devnum_next; /* Next open device number in | 337 | int devnum_next; /* Next open device number in |
336 | * round-robin allocation */ | 338 | * round-robin allocation */ |
@@ -428,11 +430,9 @@ struct usb_tt; | |||
428 | * @last_busy: time of last use | 430 | * @last_busy: time of last use |
429 | * @autosuspend_delay: in jiffies | 431 | * @autosuspend_delay: in jiffies |
430 | * @connect_time: time device was first connected | 432 | * @connect_time: time device was first connected |
431 | * @auto_pm: autosuspend/resume in progress | ||
432 | * @do_remote_wakeup: remote wakeup should be enabled | 433 | * @do_remote_wakeup: remote wakeup should be enabled |
433 | * @reset_resume: needs reset instead of resume | 434 | * @reset_resume: needs reset instead of resume |
434 | * @autosuspend_disabled: autosuspend disabled by the user | 435 | * @autosuspend_disabled: autosuspend disabled by the user |
435 | * @autoresume_disabled: autoresume disabled by the user | ||
436 | * @skip_sys_resume: skip the next system resume | 436 | * @skip_sys_resume: skip the next system resume |
437 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 437 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
438 | * specific data for the device. | 438 | * specific data for the device. |
@@ -513,11 +513,9 @@ struct usb_device { | |||
513 | int autosuspend_delay; | 513 | int autosuspend_delay; |
514 | unsigned long connect_time; | 514 | unsigned long connect_time; |
515 | 515 | ||
516 | unsigned auto_pm:1; | ||
517 | unsigned do_remote_wakeup:1; | 516 | unsigned do_remote_wakeup:1; |
518 | unsigned reset_resume:1; | 517 | unsigned reset_resume:1; |
519 | unsigned autosuspend_disabled:1; | 518 | unsigned autosuspend_disabled:1; |
520 | unsigned autoresume_disabled:1; | ||
521 | unsigned skip_sys_resume:1; | 519 | unsigned skip_sys_resume:1; |
522 | #endif | 520 | #endif |
523 | struct wusb_dev *wusb_dev; | 521 | struct wusb_dev *wusb_dev; |
@@ -543,22 +541,20 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | |||
543 | 541 | ||
544 | /* USB autosuspend and autoresume */ | 542 | /* USB autosuspend and autoresume */ |
545 | #ifdef CONFIG_USB_SUSPEND | 543 | #ifdef CONFIG_USB_SUSPEND |
546 | extern int usb_autopm_set_interface(struct usb_interface *intf); | ||
547 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 544 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
548 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 545 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
549 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); | 546 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); |
550 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); | 547 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); |
551 | 548 | ||
552 | static inline void usb_autopm_enable(struct usb_interface *intf) | 549 | static inline void usb_autopm_get_interface_no_resume( |
550 | struct usb_interface *intf) | ||
553 | { | 551 | { |
554 | atomic_set(&intf->pm_usage_cnt, 0); | 552 | atomic_inc(&intf->pm_usage_cnt); |
555 | usb_autopm_set_interface(intf); | ||
556 | } | 553 | } |
557 | 554 | static inline void usb_autopm_put_interface_no_suspend( | |
558 | static inline void usb_autopm_disable(struct usb_interface *intf) | 555 | struct usb_interface *intf) |
559 | { | 556 | { |
560 | atomic_set(&intf->pm_usage_cnt, 1); | 557 | atomic_dec(&intf->pm_usage_cnt); |
561 | usb_autopm_set_interface(intf); | ||
562 | } | 558 | } |
563 | 559 | ||
564 | static inline void usb_mark_last_busy(struct usb_device *udev) | 560 | static inline void usb_mark_last_busy(struct usb_device *udev) |
@@ -568,12 +564,8 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
568 | 564 | ||
569 | #else | 565 | #else |
570 | 566 | ||
571 | static inline int usb_autopm_set_interface(struct usb_interface *intf) | ||
572 | { return 0; } | ||
573 | |||
574 | static inline int usb_autopm_get_interface(struct usb_interface *intf) | 567 | static inline int usb_autopm_get_interface(struct usb_interface *intf) |
575 | { return 0; } | 568 | { return 0; } |
576 | |||
577 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) | 569 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) |
578 | { return 0; } | 570 | { return 0; } |
579 | 571 | ||
@@ -581,9 +573,11 @@ static inline void usb_autopm_put_interface(struct usb_interface *intf) | |||
581 | { } | 573 | { } |
582 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) | 574 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) |
583 | { } | 575 | { } |
584 | static inline void usb_autopm_enable(struct usb_interface *intf) | 576 | static inline void usb_autopm_get_interface_no_resume( |
577 | struct usb_interface *intf) | ||
585 | { } | 578 | { } |
586 | static inline void usb_autopm_disable(struct usb_interface *intf) | 579 | static inline void usb_autopm_put_interface_no_suspend( |
580 | struct usb_interface *intf) | ||
587 | { } | 581 | { } |
588 | static inline void usb_mark_last_busy(struct usb_device *udev) | 582 | static inline void usb_mark_last_busy(struct usb_device *udev) |
589 | { } | 583 | { } |
@@ -626,6 +620,10 @@ extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, | |||
626 | unsigned ifnum); | 620 | unsigned ifnum); |
627 | extern struct usb_host_interface *usb_altnum_to_altsetting( | 621 | extern struct usb_host_interface *usb_altnum_to_altsetting( |
628 | const struct usb_interface *intf, unsigned int altnum); | 622 | const struct usb_interface *intf, unsigned int altnum); |
623 | extern struct usb_host_interface *usb_find_alt_setting( | ||
624 | struct usb_host_config *config, | ||
625 | unsigned int iface_num, | ||
626 | unsigned int alt_num); | ||
629 | 627 | ||
630 | 628 | ||
631 | /** | 629 | /** |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 4f6bb3d2160e..738ea1a691cb 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -127,6 +127,7 @@ struct usb_function { | |||
127 | /* private: */ | 127 | /* private: */ |
128 | /* internals */ | 128 | /* internals */ |
129 | struct list_head list; | 129 | struct list_head list; |
130 | DECLARE_BITMAP(endpoints, 32); | ||
130 | }; | 131 | }; |
131 | 132 | ||
132 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 133 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 2443c0e7a80c..52bb917641f0 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -33,6 +33,23 @@ enum usb_otg_state { | |||
33 | OTG_STATE_A_VBUS_ERR, | 33 | OTG_STATE_A_VBUS_ERR, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #define USB_OTG_PULLUP_ID (1 << 0) | ||
37 | #define USB_OTG_PULLDOWN_DP (1 << 1) | ||
38 | #define USB_OTG_PULLDOWN_DM (1 << 2) | ||
39 | #define USB_OTG_EXT_VBUS_INDICATOR (1 << 3) | ||
40 | #define USB_OTG_DRV_VBUS (1 << 4) | ||
41 | #define USB_OTG_DRV_VBUS_EXT (1 << 5) | ||
42 | |||
43 | struct otg_transceiver; | ||
44 | |||
45 | /* for transceivers connected thru an ULPI interface, the user must | ||
46 | * provide access ops | ||
47 | */ | ||
48 | struct otg_io_access_ops { | ||
49 | int (*read)(struct otg_transceiver *otg, u32 reg); | ||
50 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | ||
51 | }; | ||
52 | |||
36 | /* | 53 | /* |
37 | * the otg driver needs to interact with both device side and host side | 54 | * the otg driver needs to interact with both device side and host side |
38 | * usb controllers. it decides which controller is active at a given | 55 | * usb controllers. it decides which controller is active at a given |
@@ -42,6 +59,7 @@ enum usb_otg_state { | |||
42 | struct otg_transceiver { | 59 | struct otg_transceiver { |
43 | struct device *dev; | 60 | struct device *dev; |
44 | const char *label; | 61 | const char *label; |
62 | unsigned int flags; | ||
45 | 63 | ||
46 | u8 default_a; | 64 | u8 default_a; |
47 | enum usb_otg_state state; | 65 | enum usb_otg_state state; |
@@ -49,10 +67,17 @@ struct otg_transceiver { | |||
49 | struct usb_bus *host; | 67 | struct usb_bus *host; |
50 | struct usb_gadget *gadget; | 68 | struct usb_gadget *gadget; |
51 | 69 | ||
70 | struct otg_io_access_ops *io_ops; | ||
71 | void __iomem *io_priv; | ||
72 | |||
52 | /* to pass extra port status to the root hub */ | 73 | /* to pass extra port status to the root hub */ |
53 | u16 port_status; | 74 | u16 port_status; |
54 | u16 port_change; | 75 | u16 port_change; |
55 | 76 | ||
77 | /* initialize/shutdown the OTG controller */ | ||
78 | int (*init)(struct otg_transceiver *otg); | ||
79 | void (*shutdown)(struct otg_transceiver *otg); | ||
80 | |||
56 | /* bind/unbind the host controller */ | 81 | /* bind/unbind the host controller */ |
57 | int (*set_host)(struct otg_transceiver *otg, | 82 | int (*set_host)(struct otg_transceiver *otg, |
58 | struct usb_bus *host); | 83 | struct usb_bus *host); |
@@ -65,6 +90,10 @@ struct otg_transceiver { | |||
65 | int (*set_power)(struct otg_transceiver *otg, | 90 | int (*set_power)(struct otg_transceiver *otg, |
66 | unsigned mA); | 91 | unsigned mA); |
67 | 92 | ||
93 | /* effective for A-peripheral, ignored for B devices */ | ||
94 | int (*set_vbus)(struct otg_transceiver *otg, | ||
95 | bool enabled); | ||
96 | |||
68 | /* for non-OTG B devices: set transceiver into suspend mode */ | 97 | /* for non-OTG B devices: set transceiver into suspend mode */ |
69 | int (*set_suspend)(struct otg_transceiver *otg, | 98 | int (*set_suspend)(struct otg_transceiver *otg, |
70 | int suspend); | 99 | int suspend); |
@@ -85,6 +114,38 @@ extern int otg_set_transceiver(struct otg_transceiver *); | |||
85 | extern void usb_nop_xceiv_register(void); | 114 | extern void usb_nop_xceiv_register(void); |
86 | extern void usb_nop_xceiv_unregister(void); | 115 | extern void usb_nop_xceiv_unregister(void); |
87 | 116 | ||
117 | /* helpers for direct access thru low-level io interface */ | ||
118 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | ||
119 | { | ||
120 | if (otg->io_ops && otg->io_ops->read) | ||
121 | return otg->io_ops->read(otg, reg); | ||
122 | |||
123 | return -EINVAL; | ||
124 | } | ||
125 | |||
126 | static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) | ||
127 | { | ||
128 | if (otg->io_ops && otg->io_ops->write) | ||
129 | return otg->io_ops->write(otg, reg, val); | ||
130 | |||
131 | return -EINVAL; | ||
132 | } | ||
133 | |||
134 | static inline int | ||
135 | otg_init(struct otg_transceiver *otg) | ||
136 | { | ||
137 | if (otg->init) | ||
138 | return otg->init(otg); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static inline void | ||
144 | otg_shutdown(struct otg_transceiver *otg) | ||
145 | { | ||
146 | if (otg->shutdown) | ||
147 | otg->shutdown(otg); | ||
148 | } | ||
88 | 149 | ||
89 | /* for usb host and peripheral controller drivers */ | 150 | /* for usb host and peripheral controller drivers */ |
90 | extern struct otg_transceiver *otg_get_transceiver(void); | 151 | extern struct otg_transceiver *otg_get_transceiver(void); |
@@ -97,6 +158,12 @@ otg_start_hnp(struct otg_transceiver *otg) | |||
97 | return otg->start_hnp(otg); | 158 | return otg->start_hnp(otg); |
98 | } | 159 | } |
99 | 160 | ||
161 | /* Context: can sleep */ | ||
162 | static inline int | ||
163 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | ||
164 | { | ||
165 | return otg->set_vbus(otg, enabled); | ||
166 | } | ||
100 | 167 | ||
101 | /* for HCDs */ | 168 | /* for HCDs */ |
102 | static inline int | 169 | static inline int |
@@ -105,7 +172,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
105 | return otg->set_host(otg, host); | 172 | return otg->set_host(otg, host); |
106 | } | 173 | } |
107 | 174 | ||
108 | |||
109 | /* for usb peripheral controller drivers */ | 175 | /* for usb peripheral controller drivers */ |
110 | 176 | ||
111 | /* Context: can sleep */ | 177 | /* Context: can sleep */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ce911ebf91e8..1819396ed501 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/sysrq.h> | 18 | #include <linux/sysrq.h> |
19 | #include <linux/kfifo.h> | ||
19 | 20 | ||
20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 22 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
@@ -39,8 +40,6 @@ enum port_dev_state { | |||
39 | * @serial: pointer back to the struct usb_serial owner of this port. | 40 | * @serial: pointer back to the struct usb_serial owner of this port. |
40 | * @port: pointer to the corresponding tty_port for this port. | 41 | * @port: pointer to the corresponding tty_port for this port. |
41 | * @lock: spinlock to grab when updating portions of this structure. | 42 | * @lock: spinlock to grab when updating portions of this structure. |
42 | * @mutex: mutex used to synchronize serial_open() and serial_close() | ||
43 | * access for this port. | ||
44 | * @number: the number of the port (the minor number). | 43 | * @number: the number of the port (the minor number). |
45 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 44 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
46 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | 45 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. |
@@ -77,7 +76,6 @@ struct usb_serial_port { | |||
77 | struct usb_serial *serial; | 76 | struct usb_serial *serial; |
78 | struct tty_port port; | 77 | struct tty_port port; |
79 | spinlock_t lock; | 78 | spinlock_t lock; |
80 | struct mutex mutex; | ||
81 | unsigned char number; | 79 | unsigned char number; |
82 | 80 | ||
83 | unsigned char *interrupt_in_buffer; | 81 | unsigned char *interrupt_in_buffer; |
@@ -97,7 +95,7 @@ struct usb_serial_port { | |||
97 | unsigned char *bulk_out_buffer; | 95 | unsigned char *bulk_out_buffer; |
98 | int bulk_out_size; | 96 | int bulk_out_size; |
99 | struct urb *write_urb; | 97 | struct urb *write_urb; |
100 | struct kfifo *write_fifo; | 98 | struct kfifo write_fifo; |
101 | int write_urb_busy; | 99 | int write_urb_busy; |
102 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
103 | 101 | ||
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h new file mode 100644 index 000000000000..20675c6ebc4d --- /dev/null +++ b/include/linux/usb/ulpi.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __LINUX_USB_ULPI_H | ||
2 | #define __LINUX_USB_ULPI_H | ||
3 | |||
4 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | ||
5 | unsigned int flags); | ||
6 | |||
7 | #endif /* __LINUX_USB_ULPI_H */ | ||
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 8ce61359bf73..df1e83dd9a54 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -214,25 +214,4 @@ extern void usbnet_set_msglevel (struct net_device *, u32); | |||
214 | extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); | 214 | extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); |
215 | extern int usbnet_nway_reset(struct net_device *net); | 215 | extern int usbnet_nway_reset(struct net_device *net); |
216 | 216 | ||
217 | /* messaging support includes the interface name, so it must not be | ||
218 | * used before it has one ... notably, in minidriver bind() calls. | ||
219 | */ | ||
220 | #ifdef DEBUG | ||
221 | #define devdbg(usbnet, fmt, arg...) \ | ||
222 | printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
223 | #else | ||
224 | #define devdbg(usbnet, fmt, arg...) \ | ||
225 | ({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \ | ||
226 | ## arg); 0; }) | ||
227 | #endif | ||
228 | |||
229 | #define deverr(usbnet, fmt, arg...) \ | ||
230 | printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
231 | #define devwarn(usbnet, fmt, arg...) \ | ||
232 | printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg) | ||
233 | |||
234 | #define devinfo(usbnet, fmt, arg...) \ | ||
235 | printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \ | ||
236 | |||
237 | |||
238 | #endif /* __LINUX_USB_USBNET_H */ | 217 | #endif /* __LINUX_USB_USBNET_H */ |
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 429c631d2aad..63ebdcc5dda6 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h | |||
@@ -74,7 +74,7 @@ enum { | |||
74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of | 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of |
75 | * data. In order to avoid confusion and enforce types, we wrap it. | 75 | * data. In order to avoid confusion and enforce types, we wrap it. |
76 | * | 76 | * |
77 | * Make it packed, as we use it in some hw defintions. | 77 | * Make it packed, as we use it in some hw definitions. |
78 | */ | 78 | */ |
79 | struct wusb_ckhdid { | 79 | struct wusb_ckhdid { |
80 | u8 data[16]; | 80 | u8 data[16]; |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 3d15fb9bc116..a4b947e470a5 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -56,7 +56,9 @@ | |||
56 | US_FLAG(SANE_SENSE, 0x00008000) \ | 56 | US_FLAG(SANE_SENSE, 0x00008000) \ |
57 | /* Sane Sense (> 18 bytes) */ \ | 57 | /* Sane Sense (> 18 bytes) */ \ |
58 | US_FLAG(CAPACITY_OK, 0x00010000) \ | 58 | US_FLAG(CAPACITY_OK, 0x00010000) \ |
59 | /* READ CAPACITY response is correct */ | 59 | /* READ CAPACITY response is correct */ \ |
60 | US_FLAG(BAD_SENSE, 0x00020000) \ | ||
61 | /* Bad Sense (never more than 18 bytes) */ | ||
60 | 62 | ||
61 | #define US_FLAG(name, value) US_FL_##name = value , | 63 | #define US_FLAG(name, value) US_FL_##name = value , |
62 | enum { US_DO_ALL_FLAGS }; | 64 | enum { US_DO_ALL_FLAGS }; |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index b2a7d8ba6ee3..15591d2ea400 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
@@ -128,6 +128,29 @@ struct usbdevfs_hub_portinfo { | |||
128 | #ifdef __KERNEL__ | 128 | #ifdef __KERNEL__ |
129 | #ifdef CONFIG_COMPAT | 129 | #ifdef CONFIG_COMPAT |
130 | #include <linux/compat.h> | 130 | #include <linux/compat.h> |
131 | |||
132 | struct usbdevfs_ctrltransfer32 { | ||
133 | u8 bRequestType; | ||
134 | u8 bRequest; | ||
135 | u16 wValue; | ||
136 | u16 wIndex; | ||
137 | u16 wLength; | ||
138 | u32 timeout; /* in milliseconds */ | ||
139 | compat_caddr_t data; | ||
140 | }; | ||
141 | |||
142 | struct usbdevfs_bulktransfer32 { | ||
143 | compat_uint_t ep; | ||
144 | compat_uint_t len; | ||
145 | compat_uint_t timeout; /* in milliseconds */ | ||
146 | compat_caddr_t data; | ||
147 | }; | ||
148 | |||
149 | struct usbdevfs_disconnectsignal32 { | ||
150 | compat_int_t signr; | ||
151 | compat_caddr_t context; | ||
152 | }; | ||
153 | |||
131 | struct usbdevfs_urb32 { | 154 | struct usbdevfs_urb32 { |
132 | unsigned char type; | 155 | unsigned char type; |
133 | unsigned char endpoint; | 156 | unsigned char endpoint; |
@@ -153,7 +176,9 @@ struct usbdevfs_ioctl32 { | |||
153 | #endif /* __KERNEL__ */ | 176 | #endif /* __KERNEL__ */ |
154 | 177 | ||
155 | #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) | 178 | #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) |
179 | #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) | ||
156 | #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) | 180 | #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) |
181 | #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) | ||
157 | #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) | 182 | #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) |
158 | #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) | 183 | #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) |
159 | #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) | 184 | #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) |
@@ -166,6 +191,7 @@ struct usbdevfs_ioctl32 { | |||
166 | #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) | 191 | #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) |
167 | #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) | 192 | #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) |
168 | #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) | 193 | #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) |
194 | #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) | ||
169 | #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) | 195 | #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) |
170 | #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) | 196 | #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) |
171 | #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) | 197 | #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) |
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 79b9837d9ca0..cf97b5b9d1fe 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #include <linux/utsrelease.h> | 1 | #include <generated/utsrelease.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | 3 | ||
4 | /* Simply sanity version stamp for modules. */ | 4 | /* Simply sanity version stamp for modules. */ |
diff --git a/include/linux/vhost.h b/include/linux/vhost.h new file mode 100644 index 000000000000..e847f1e30756 --- /dev/null +++ b/include/linux/vhost.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef _LINUX_VHOST_H | ||
2 | #define _LINUX_VHOST_H | ||
3 | /* Userspace interface for in-kernel virtio accelerators. */ | ||
4 | |||
5 | /* vhost is used to reduce the number of system calls involved in virtio. | ||
6 | * | ||
7 | * Existing virtio net code is used in the guest without modification. | ||
8 | * | ||
9 | * This header includes interface used by userspace hypervisor for | ||
10 | * device configuration. | ||
11 | */ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/compiler.h> | ||
15 | #include <linux/ioctl.h> | ||
16 | #include <linux/virtio_config.h> | ||
17 | #include <linux/virtio_ring.h> | ||
18 | |||
19 | struct vhost_vring_state { | ||
20 | unsigned int index; | ||
21 | unsigned int num; | ||
22 | }; | ||
23 | |||
24 | struct vhost_vring_file { | ||
25 | unsigned int index; | ||
26 | int fd; /* Pass -1 to unbind from file. */ | ||
27 | |||
28 | }; | ||
29 | |||
30 | struct vhost_vring_addr { | ||
31 | unsigned int index; | ||
32 | /* Option flags. */ | ||
33 | unsigned int flags; | ||
34 | /* Flag values: */ | ||
35 | /* Whether log address is valid. If set enables logging. */ | ||
36 | #define VHOST_VRING_F_LOG 0 | ||
37 | |||
38 | /* Start of array of descriptors (virtually contiguous) */ | ||
39 | __u64 desc_user_addr; | ||
40 | /* Used structure address. Must be 32 bit aligned */ | ||
41 | __u64 used_user_addr; | ||
42 | /* Available structure address. Must be 16 bit aligned */ | ||
43 | __u64 avail_user_addr; | ||
44 | /* Logging support. */ | ||
45 | /* Log writes to used structure, at offset calculated from specified | ||
46 | * address. Address must be 32 bit aligned. */ | ||
47 | __u64 log_guest_addr; | ||
48 | }; | ||
49 | |||
50 | struct vhost_memory_region { | ||
51 | __u64 guest_phys_addr; | ||
52 | __u64 memory_size; /* bytes */ | ||
53 | __u64 userspace_addr; | ||
54 | __u64 flags_padding; /* No flags are currently specified. */ | ||
55 | }; | ||
56 | |||
57 | /* All region addresses and sizes must be 4K aligned. */ | ||
58 | #define VHOST_PAGE_SIZE 0x1000 | ||
59 | |||
60 | struct vhost_memory { | ||
61 | __u32 nregions; | ||
62 | __u32 padding; | ||
63 | struct vhost_memory_region regions[0]; | ||
64 | }; | ||
65 | |||
66 | /* ioctls */ | ||
67 | |||
68 | #define VHOST_VIRTIO 0xAF | ||
69 | |||
70 | /* Features bitmask for forward compatibility. Transport bits are used for | ||
71 | * vhost specific features. */ | ||
72 | #define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64) | ||
73 | #define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64) | ||
74 | |||
75 | /* Set current process as the (exclusive) owner of this file descriptor. This | ||
76 | * must be called before any other vhost command. Further calls to | ||
77 | * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ | ||
78 | #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) | ||
79 | /* Give up ownership, and reset the device to default values. | ||
80 | * Allows subsequent call to VHOST_OWNER_SET to succeed. */ | ||
81 | #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) | ||
82 | |||
83 | /* Set up/modify memory layout */ | ||
84 | #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory) | ||
85 | |||
86 | /* Write logging setup. */ | ||
87 | /* Memory writes can optionally be logged by setting bit at an offset | ||
88 | * (calculated from the physical address) from specified log base. | ||
89 | * The bit is set using an atomic 32 bit operation. */ | ||
90 | /* Set base address for logging. */ | ||
91 | #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64) | ||
92 | /* Specify an eventfd file descriptor to signal on log write. */ | ||
93 | #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int) | ||
94 | |||
95 | /* Ring setup. */ | ||
96 | /* Set number of descriptors in ring. This parameter can not | ||
97 | * be modified while ring is running (bound to a device). */ | ||
98 | #define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state) | ||
99 | /* Set addresses for the ring. */ | ||
100 | #define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr) | ||
101 | /* Base value where queue looks for available descriptors */ | ||
102 | #define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
103 | /* Get accessor: reads index, writes value in num */ | ||
104 | #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) | ||
105 | |||
106 | /* The following ioctls use eventfd file descriptors to signal and poll | ||
107 | * for events. */ | ||
108 | |||
109 | /* Set eventfd to poll for added buffers */ | ||
110 | #define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file) | ||
111 | /* Set eventfd to signal when buffers have beed used */ | ||
112 | #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) | ||
113 | /* Set eventfd to signal an error */ | ||
114 | #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) | ||
115 | |||
116 | /* VHOST_NET specific defines */ | ||
117 | |||
118 | /* Attach virtio net ring to a raw socket, or tap device. | ||
119 | * The socket must be already bound to an ethernet device, this device will be | ||
120 | * used for transmit. Pass fd -1 to unbind from the socket and the transmit | ||
121 | * device. This can be used to stop the ring (e.g. for migration). */ | ||
122 | #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) | ||
123 | |||
124 | /* Feature bits */ | ||
125 | /* Log all write descriptors. Can be changed while device is active. */ | ||
126 | #define VHOST_F_LOG_ALL 26 | ||
127 | /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ | ||
128 | #define VHOST_NET_F_VIRTIO_NET_HDR 27 | ||
129 | |||
130 | #endif | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index b59e78c57161..d4962a782b8a 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -294,6 +294,7 @@ struct v4l2_pix_format { | |||
294 | 294 | ||
295 | /* Grey formats */ | 295 | /* Grey formats */ |
296 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ | 296 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ |
297 | #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ | ||
297 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ | 298 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ |
298 | 299 | ||
299 | /* Palette formats */ | 300 | /* Palette formats */ |
@@ -329,7 +330,11 @@ struct v4l2_pix_format { | |||
329 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ | 330 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
330 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ | 331 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
331 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ | 332 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ |
332 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10bit raw bayer */ | 333 | #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ |
334 | #define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ | ||
335 | #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ | ||
336 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ | ||
337 | #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ | ||
333 | /* 10bit raw bayer DPCM compressed to 8 bits */ | 338 | /* 10bit raw bayer DPCM compressed to 8 bits */ |
334 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') | 339 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') |
335 | /* | 340 | /* |
@@ -361,6 +366,7 @@ struct v4l2_pix_format { | |||
361 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ | 366 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ |
362 | #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ | 367 | #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ |
363 | #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ | 368 | #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ |
369 | #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ | ||
364 | 370 | ||
365 | /* | 371 | /* |
366 | * F O R M A T E N U M E R A T I O N | 372 | * F O R M A T E N U M E R A T I O N |
@@ -490,7 +496,7 @@ struct v4l2_jpegcompression { | |||
490 | * you do, leave them untouched. | 496 | * you do, leave them untouched. |
491 | * Inluding less markers will make the | 497 | * Inluding less markers will make the |
492 | * resulting code smaller, but there will | 498 | * resulting code smaller, but there will |
493 | * be fewer aplications which can read it. | 499 | * be fewer applications which can read it. |
494 | * The presence of the APP and COM marker | 500 | * The presence of the APP and COM marker |
495 | * is influenced by APP_len and COM_len | 501 | * is influenced by APP_len and COM_len |
496 | * ONLY, not by this property! */ | 502 | * ONLY, not by this property! */ |
@@ -563,6 +569,7 @@ struct v4l2_framebuffer { | |||
563 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 | 569 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 |
564 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 | 570 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 |
565 | #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 | 571 | #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 |
572 | #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 | ||
566 | /* Flags for the 'flags' field. */ | 573 | /* Flags for the 'flags' field. */ |
567 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 | 574 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
568 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 | 575 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
@@ -570,6 +577,7 @@ struct v4l2_framebuffer { | |||
570 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 | 577 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 |
571 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 | 578 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 |
572 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 | 579 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 |
580 | #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 | ||
573 | 581 | ||
574 | struct v4l2_clip { | 582 | struct v4l2_clip { |
575 | struct v4l2_rect c; | 583 | struct v4l2_rect c; |
@@ -729,6 +737,99 @@ struct v4l2_standard { | |||
729 | }; | 737 | }; |
730 | 738 | ||
731 | /* | 739 | /* |
740 | * V I D E O T I M I N G S D V P R E S E T | ||
741 | */ | ||
742 | struct v4l2_dv_preset { | ||
743 | __u32 preset; | ||
744 | __u32 reserved[4]; | ||
745 | }; | ||
746 | |||
747 | /* | ||
748 | * D V P R E S E T S E N U M E R A T I O N | ||
749 | */ | ||
750 | struct v4l2_dv_enum_preset { | ||
751 | __u32 index; | ||
752 | __u32 preset; | ||
753 | __u8 name[32]; /* Name of the preset timing */ | ||
754 | __u32 width; | ||
755 | __u32 height; | ||
756 | __u32 reserved[4]; | ||
757 | }; | ||
758 | |||
759 | /* | ||
760 | * D V P R E S E T V A L U E S | ||
761 | */ | ||
762 | #define V4L2_DV_INVALID 0 | ||
763 | #define V4L2_DV_480P59_94 1 /* BT.1362 */ | ||
764 | #define V4L2_DV_576P50 2 /* BT.1362 */ | ||
765 | #define V4L2_DV_720P24 3 /* SMPTE 296M */ | ||
766 | #define V4L2_DV_720P25 4 /* SMPTE 296M */ | ||
767 | #define V4L2_DV_720P30 5 /* SMPTE 296M */ | ||
768 | #define V4L2_DV_720P50 6 /* SMPTE 296M */ | ||
769 | #define V4L2_DV_720P59_94 7 /* SMPTE 274M */ | ||
770 | #define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ | ||
771 | #define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ | ||
772 | #define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ | ||
773 | #define V4L2_DV_1080I25 11 /* BT.1120 */ | ||
774 | #define V4L2_DV_1080I50 12 /* SMPTE 296M */ | ||
775 | #define V4L2_DV_1080I60 13 /* SMPTE 296M */ | ||
776 | #define V4L2_DV_1080P24 14 /* SMPTE 296M */ | ||
777 | #define V4L2_DV_1080P25 15 /* SMPTE 296M */ | ||
778 | #define V4L2_DV_1080P30 16 /* SMPTE 296M */ | ||
779 | #define V4L2_DV_1080P50 17 /* BT.1120 */ | ||
780 | #define V4L2_DV_1080P60 18 /* BT.1120 */ | ||
781 | |||
782 | /* | ||
783 | * D V B T T I M I N G S | ||
784 | */ | ||
785 | |||
786 | /* BT.656/BT.1120 timing data */ | ||
787 | struct v4l2_bt_timings { | ||
788 | __u32 width; /* width in pixels */ | ||
789 | __u32 height; /* height in lines */ | ||
790 | __u32 interlaced; /* Interlaced or progressive */ | ||
791 | __u32 polarities; /* Positive or negative polarity */ | ||
792 | __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ | ||
793 | __u32 hfrontporch; /* Horizpontal front porch in pixels */ | ||
794 | __u32 hsync; /* Horizontal Sync length in pixels */ | ||
795 | __u32 hbackporch; /* Horizontal back porch in pixels */ | ||
796 | __u32 vfrontporch; /* Vertical front porch in pixels */ | ||
797 | __u32 vsync; /* Vertical Sync length in lines */ | ||
798 | __u32 vbackporch; /* Vertical back porch in lines */ | ||
799 | __u32 il_vfrontporch; /* Vertical front porch for bottom field of | ||
800 | * interlaced field formats | ||
801 | */ | ||
802 | __u32 il_vsync; /* Vertical sync length for bottom field of | ||
803 | * interlaced field formats | ||
804 | */ | ||
805 | __u32 il_vbackporch; /* Vertical back porch for bottom field of | ||
806 | * interlaced field formats | ||
807 | */ | ||
808 | __u32 reserved[16]; | ||
809 | } __attribute__ ((packed)); | ||
810 | |||
811 | /* Interlaced or progressive format */ | ||
812 | #define V4L2_DV_PROGRESSIVE 0 | ||
813 | #define V4L2_DV_INTERLACED 1 | ||
814 | |||
815 | /* Polarities. If bit is not set, it is assumed to be negative polarity */ | ||
816 | #define V4L2_DV_VSYNC_POS_POL 0x00000001 | ||
817 | #define V4L2_DV_HSYNC_POS_POL 0x00000002 | ||
818 | |||
819 | |||
820 | /* DV timings */ | ||
821 | struct v4l2_dv_timings { | ||
822 | __u32 type; | ||
823 | union { | ||
824 | struct v4l2_bt_timings bt; | ||
825 | __u32 reserved[32]; | ||
826 | }; | ||
827 | } __attribute__ ((packed)); | ||
828 | |||
829 | /* Values for the type field */ | ||
830 | #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ | ||
831 | |||
832 | /* | ||
732 | * V I D E O I N P U T S | 833 | * V I D E O I N P U T S |
733 | */ | 834 | */ |
734 | struct v4l2_input { | 835 | struct v4l2_input { |
@@ -739,7 +840,8 @@ struct v4l2_input { | |||
739 | __u32 tuner; /* Associated tuner */ | 840 | __u32 tuner; /* Associated tuner */ |
740 | v4l2_std_id std; | 841 | v4l2_std_id std; |
741 | __u32 status; | 842 | __u32 status; |
742 | __u32 reserved[4]; | 843 | __u32 capabilities; |
844 | __u32 reserved[3]; | ||
743 | }; | 845 | }; |
744 | 846 | ||
745 | /* Values for the 'type' field */ | 847 | /* Values for the 'type' field */ |
@@ -770,6 +872,11 @@ struct v4l2_input { | |||
770 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ | 872 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ |
771 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ | 873 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ |
772 | 874 | ||
875 | /* capabilities flags */ | ||
876 | #define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
877 | #define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
878 | #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ | ||
879 | |||
773 | /* | 880 | /* |
774 | * V I D E O O U T P U T S | 881 | * V I D E O O U T P U T S |
775 | */ | 882 | */ |
@@ -780,13 +887,19 @@ struct v4l2_output { | |||
780 | __u32 audioset; /* Associated audios (bitfield) */ | 887 | __u32 audioset; /* Associated audios (bitfield) */ |
781 | __u32 modulator; /* Associated modulator */ | 888 | __u32 modulator; /* Associated modulator */ |
782 | v4l2_std_id std; | 889 | v4l2_std_id std; |
783 | __u32 reserved[4]; | 890 | __u32 capabilities; |
891 | __u32 reserved[3]; | ||
784 | }; | 892 | }; |
785 | /* Values for the 'type' field */ | 893 | /* Values for the 'type' field */ |
786 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 | 894 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 |
787 | #define V4L2_OUTPUT_TYPE_ANALOG 2 | 895 | #define V4L2_OUTPUT_TYPE_ANALOG 2 |
788 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 | 896 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 |
789 | 897 | ||
898 | /* capabilities flags */ | ||
899 | #define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
900 | #define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
901 | #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ | ||
902 | |||
790 | /* | 903 | /* |
791 | * C O N T R O L S | 904 | * C O N T R O L S |
792 | */ | 905 | */ |
@@ -912,8 +1025,10 @@ enum v4l2_colorfx { | |||
912 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) | 1025 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) |
913 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) | 1026 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) |
914 | 1027 | ||
1028 | #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) | ||
1029 | #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) | ||
915 | /* last CID + 1 */ | 1030 | /* last CID + 1 */ |
916 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE+34) | 1031 | #define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) |
917 | 1032 | ||
918 | /* MPEG-class control IDs defined by V4L2 */ | 1033 | /* MPEG-class control IDs defined by V4L2 */ |
919 | #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) | 1034 | #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) |
@@ -1619,6 +1734,13 @@ struct v4l2_dbg_chip_ident { | |||
1619 | #endif | 1734 | #endif |
1620 | 1735 | ||
1621 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) | 1736 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) |
1737 | #define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) | ||
1738 | #define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) | ||
1739 | #define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) | ||
1740 | #define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) | ||
1741 | #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) | ||
1742 | #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) | ||
1743 | |||
1622 | /* Reminder: when adding new ioctls please add support for them to | 1744 | /* Reminder: when adding new ioctls please add support for them to |
1623 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 1745 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
1624 | 1746 | ||
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 057a2e010758..f508c651e53d 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -51,6 +51,9 @@ struct virtqueue { | |||
51 | * This re-enables callbacks; it returns "false" if there are pending | 51 | * This re-enables callbacks; it returns "false" if there are pending |
52 | * buffers in the queue, to detect a possible race between the driver | 52 | * buffers in the queue, to detect a possible race between the driver |
53 | * checking for more work, and enabling callbacks. | 53 | * checking for more work, and enabling callbacks. |
54 | * @detach_unused_buf: detach first unused buffer | ||
55 | * vq: the struct virtqueue we're talking about. | ||
56 | * Returns NULL or the "data" token handed to add_buf | ||
54 | * | 57 | * |
55 | * Locking rules are straightforward: the driver is responsible for | 58 | * Locking rules are straightforward: the driver is responsible for |
56 | * locking. No two operations may be invoked simultaneously, with the exception | 59 | * locking. No two operations may be invoked simultaneously, with the exception |
@@ -71,6 +74,7 @@ struct virtqueue_ops { | |||
71 | 74 | ||
72 | void (*disable_cb)(struct virtqueue *vq); | 75 | void (*disable_cb)(struct virtqueue *vq); |
73 | bool (*enable_cb)(struct virtqueue *vq); | 76 | bool (*enable_cb)(struct virtqueue *vq); |
77 | void *(*detach_unused_buf)(struct virtqueue *vq); | ||
74 | }; | 78 | }; |
75 | 79 | ||
76 | /** | 80 | /** |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 2d0f222388a8..ee03bba9c5df 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -40,6 +40,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
40 | PGSCAN_ZONE_RECLAIM_FAILED, | 40 | PGSCAN_ZONE_RECLAIM_FAILED, |
41 | #endif | 41 | #endif |
42 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, | 42 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, |
43 | KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, | ||
44 | KSWAPD_SKIP_CONGESTION_WAIT, | ||
43 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, | 45 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, |
44 | #ifdef CONFIG_HUGETLB_PAGE | 46 | #ifdef CONFIG_HUGETLB_PAGE |
45 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, | 47 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, |
@@ -76,24 +78,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
76 | 78 | ||
77 | static inline void __count_vm_event(enum vm_event_item item) | 79 | static inline void __count_vm_event(enum vm_event_item item) |
78 | { | 80 | { |
79 | __get_cpu_var(vm_event_states).event[item]++; | 81 | __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); |
80 | } | 82 | } |
81 | 83 | ||
82 | static inline void count_vm_event(enum vm_event_item item) | 84 | static inline void count_vm_event(enum vm_event_item item) |
83 | { | 85 | { |
84 | get_cpu_var(vm_event_states).event[item]++; | 86 | this_cpu_inc(per_cpu_var(vm_event_states).event[item]); |
85 | put_cpu(); | ||
86 | } | 87 | } |
87 | 88 | ||
88 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 89 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
89 | { | 90 | { |
90 | __get_cpu_var(vm_event_states).event[item] += delta; | 91 | __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); |
91 | } | 92 | } |
92 | 93 | ||
93 | static inline void count_vm_events(enum vm_event_item item, long delta) | 94 | static inline void count_vm_events(enum vm_event_item item, long delta) |
94 | { | 95 | { |
95 | get_cpu_var(vm_event_states).event[item] += delta; | 96 | this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); |
96 | put_cpu(); | ||
97 | } | 97 | } |
98 | 98 | ||
99 | extern void all_vm_events(unsigned long *); | 99 | extern void all_vm_events(unsigned long *); |
diff --git a/include/linux/vt.h b/include/linux/vt.h index 7ffa11f06232..d5dd0bc408fd 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h | |||
@@ -84,4 +84,23 @@ struct vt_setactivate { | |||
84 | 84 | ||
85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ | 85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ |
86 | 86 | ||
87 | #ifdef __KERNEL__ | ||
88 | |||
89 | #ifdef CONFIG_VT_CONSOLE | ||
90 | |||
91 | extern int vt_kmsg_redirect(int new); | ||
92 | |||
93 | #else | ||
94 | |||
95 | static inline int vt_kmsg_redirect(int new) | ||
96 | { | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | #endif | ||
101 | |||
102 | #endif /* __KERNEL__ */ | ||
103 | |||
104 | #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1) | ||
105 | |||
87 | #endif /* _LINUX_VT_H */ | 106 | #endif /* _LINUX_VT_H */ |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index c0c4e1103a73..7f56db4a79f0 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE]; | |||
110 | extern struct mutex con_buf_mtx; | 110 | extern struct mutex con_buf_mtx; |
111 | extern char vt_dont_switch; | 111 | extern char vt_dont_switch; |
112 | extern int default_utf8; | 112 | extern int default_utf8; |
113 | extern int global_cursor_default; | ||
113 | 114 | ||
114 | struct vt_spawn_console { | 115 | struct vt_spawn_console { |
115 | spinlock_t lock; | 116 | spinlock_t lock; |
@@ -130,4 +131,6 @@ struct vt_notifier_param { | |||
130 | extern int register_vt_notifier(struct notifier_block *nb); | 131 | extern int register_vt_notifier(struct notifier_block *nb); |
131 | extern int unregister_vt_notifier(struct notifier_block *nb); | 132 | extern int unregister_vt_notifier(struct notifier_block *nb); |
132 | 133 | ||
134 | extern void hide_boot_cursor(bool hide); | ||
135 | |||
133 | #endif /* _VT_KERN_H */ | 136 | #endif /* _VT_KERN_H */ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index cf24c20de9e4..9466e860d8c2 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -25,6 +25,7 @@ typedef void (*work_func_t)(struct work_struct *work); | |||
25 | struct work_struct { | 25 | struct work_struct { |
26 | atomic_long_t data; | 26 | atomic_long_t data; |
27 | #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ | 27 | #define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ |
28 | #define WORK_STRUCT_STATIC 1 /* static initializer (debugobjects) */ | ||
28 | #define WORK_STRUCT_FLAG_MASK (3UL) | 29 | #define WORK_STRUCT_FLAG_MASK (3UL) |
29 | #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) | 30 | #define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) |
30 | struct list_head entry; | 31 | struct list_head entry; |
@@ -35,6 +36,7 @@ struct work_struct { | |||
35 | }; | 36 | }; |
36 | 37 | ||
37 | #define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) | 38 | #define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) |
39 | #define WORK_DATA_STATIC_INIT() ATOMIC_LONG_INIT(2) | ||
38 | 40 | ||
39 | struct delayed_work { | 41 | struct delayed_work { |
40 | struct work_struct work; | 42 | struct work_struct work; |
@@ -63,7 +65,7 @@ struct execute_work { | |||
63 | #endif | 65 | #endif |
64 | 66 | ||
65 | #define __WORK_INITIALIZER(n, f) { \ | 67 | #define __WORK_INITIALIZER(n, f) { \ |
66 | .data = WORK_DATA_INIT(), \ | 68 | .data = WORK_DATA_STATIC_INIT(), \ |
67 | .entry = { &(n).entry, &(n).entry }, \ | 69 | .entry = { &(n).entry, &(n).entry }, \ |
68 | .func = (f), \ | 70 | .func = (f), \ |
69 | __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ | 71 | __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ |
@@ -91,6 +93,14 @@ struct execute_work { | |||
91 | #define PREPARE_DELAYED_WORK(_work, _func) \ | 93 | #define PREPARE_DELAYED_WORK(_work, _func) \ |
92 | PREPARE_WORK(&(_work)->work, (_func)) | 94 | PREPARE_WORK(&(_work)->work, (_func)) |
93 | 95 | ||
96 | #ifdef CONFIG_DEBUG_OBJECTS_WORK | ||
97 | extern void __init_work(struct work_struct *work, int onstack); | ||
98 | extern void destroy_work_on_stack(struct work_struct *work); | ||
99 | #else | ||
100 | static inline void __init_work(struct work_struct *work, int onstack) { } | ||
101 | static inline void destroy_work_on_stack(struct work_struct *work) { } | ||
102 | #endif | ||
103 | |||
94 | /* | 104 | /* |
95 | * initialize all of a work item in one go | 105 | * initialize all of a work item in one go |
96 | * | 106 | * |
@@ -99,24 +109,36 @@ struct execute_work { | |||
99 | * to generate better code. | 109 | * to generate better code. |
100 | */ | 110 | */ |
101 | #ifdef CONFIG_LOCKDEP | 111 | #ifdef CONFIG_LOCKDEP |
102 | #define INIT_WORK(_work, _func) \ | 112 | #define __INIT_WORK(_work, _func, _onstack) \ |
103 | do { \ | 113 | do { \ |
104 | static struct lock_class_key __key; \ | 114 | static struct lock_class_key __key; \ |
105 | \ | 115 | \ |
116 | __init_work((_work), _onstack); \ | ||
106 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ | 117 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ |
107 | lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ | 118 | lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ |
108 | INIT_LIST_HEAD(&(_work)->entry); \ | 119 | INIT_LIST_HEAD(&(_work)->entry); \ |
109 | PREPARE_WORK((_work), (_func)); \ | 120 | PREPARE_WORK((_work), (_func)); \ |
110 | } while (0) | 121 | } while (0) |
111 | #else | 122 | #else |
112 | #define INIT_WORK(_work, _func) \ | 123 | #define __INIT_WORK(_work, _func, _onstack) \ |
113 | do { \ | 124 | do { \ |
125 | __init_work((_work), _onstack); \ | ||
114 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ | 126 | (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ |
115 | INIT_LIST_HEAD(&(_work)->entry); \ | 127 | INIT_LIST_HEAD(&(_work)->entry); \ |
116 | PREPARE_WORK((_work), (_func)); \ | 128 | PREPARE_WORK((_work), (_func)); \ |
117 | } while (0) | 129 | } while (0) |
118 | #endif | 130 | #endif |
119 | 131 | ||
132 | #define INIT_WORK(_work, _func) \ | ||
133 | do { \ | ||
134 | __INIT_WORK((_work), (_func), 0); \ | ||
135 | } while (0) | ||
136 | |||
137 | #define INIT_WORK_ON_STACK(_work, _func) \ | ||
138 | do { \ | ||
139 | __INIT_WORK((_work), (_func), 1); \ | ||
140 | } while (0) | ||
141 | |||
120 | #define INIT_DELAYED_WORK(_work, _func) \ | 142 | #define INIT_DELAYED_WORK(_work, _func) \ |
121 | do { \ | 143 | do { \ |
122 | INIT_WORK(&(_work)->work, (_func)); \ | 144 | INIT_WORK(&(_work)->work, (_func)); \ |
@@ -125,22 +147,16 @@ struct execute_work { | |||
125 | 147 | ||
126 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | 148 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ |
127 | do { \ | 149 | do { \ |
128 | INIT_WORK(&(_work)->work, (_func)); \ | 150 | INIT_WORK_ON_STACK(&(_work)->work, (_func)); \ |
129 | init_timer_on_stack(&(_work)->timer); \ | 151 | init_timer_on_stack(&(_work)->timer); \ |
130 | } while (0) | 152 | } while (0) |
131 | 153 | ||
132 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ | 154 | #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ |
133 | do { \ | 155 | do { \ |
134 | INIT_WORK(&(_work)->work, (_func)); \ | 156 | INIT_WORK(&(_work)->work, (_func)); \ |
135 | init_timer_deferrable(&(_work)->timer); \ | 157 | init_timer_deferrable(&(_work)->timer); \ |
136 | } while (0) | 158 | } while (0) |
137 | 159 | ||
138 | #define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ | ||
139 | do { \ | ||
140 | INIT_WORK(&(_work)->work, (_func)); \ | ||
141 | init_timer_on_stack(&(_work)->timer); \ | ||
142 | } while (0) | ||
143 | |||
144 | /** | 160 | /** |
145 | * work_pending - Find out whether a work item is currently pending | 161 | * work_pending - Find out whether a work item is currently pending |
146 | * @work: The work item in question | 162 | * @work: The work item in question |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 705f01fe413a..76e8903cd204 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -70,6 +70,7 @@ struct writeback_control { | |||
70 | struct bdi_writeback; | 70 | struct bdi_writeback; |
71 | int inode_wait(void *); | 71 | int inode_wait(void *); |
72 | void writeback_inodes_sb(struct super_block *); | 72 | void writeback_inodes_sb(struct super_block *); |
73 | int writeback_inodes_sb_if_idle(struct super_block *); | ||
73 | void sync_inodes_sb(struct super_block *); | 74 | void sync_inodes_sb(struct super_block *); |
74 | void writeback_inodes_wbc(struct writeback_control *wbc); | 75 | void writeback_inodes_wbc(struct writeback_control *wbc); |
75 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | 76 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); |
@@ -79,8 +80,7 @@ void wakeup_flusher_threads(long nr_pages); | |||
79 | static inline void wait_on_inode(struct inode *inode) | 80 | static inline void wait_on_inode(struct inode *inode) |
80 | { | 81 | { |
81 | might_sleep(); | 82 | might_sleep(); |
82 | wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, | 83 | wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); |
83 | TASK_UNINTERRUPTIBLE); | ||
84 | } | 84 | } |
85 | static inline void inode_sync_wait(struct inode *inode) | 85 | static inline void inode_sync_wait(struct inode *inode) |
86 | { | 86 | { |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 5c84af8c5f6f..fb9b7e6e1e2d 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
@@ -38,12 +38,13 @@ struct dentry; | |||
38 | 38 | ||
39 | struct xattr_handler { | 39 | struct xattr_handler { |
40 | char *prefix; | 40 | char *prefix; |
41 | size_t (*list)(struct inode *inode, char *list, size_t list_size, | 41 | int flags; /* fs private flags passed back to the handlers */ |
42 | const char *name, size_t name_len); | 42 | size_t (*list)(struct dentry *dentry, char *list, size_t list_size, |
43 | int (*get)(struct inode *inode, const char *name, void *buffer, | 43 | const char *name, size_t name_len, int handler_flags); |
44 | size_t size); | 44 | int (*get)(struct dentry *dentry, const char *name, void *buffer, |
45 | int (*set)(struct inode *inode, const char *name, const void *buffer, | 45 | size_t size, int handler_flags); |
46 | size_t size, int flags); | 46 | int (*set)(struct dentry *dentry, const char *name, const void *buffer, |
47 | size_t size, int flags, int handler_flags); | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); | 50 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 29e04beb1fc9..b971e3848493 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -267,8 +267,8 @@ enum xfrm_attr_type_t { | |||
267 | XFRMA_ALG_COMP, /* struct xfrm_algo */ | 267 | XFRMA_ALG_COMP, /* struct xfrm_algo */ |
268 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ | 268 | XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ |
269 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | 269 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ |
270 | XFRMA_SA, | 270 | XFRMA_SA, /* struct xfrm_usersa_info */ |
271 | XFRMA_POLICY, | 271 | XFRMA_POLICY, /*struct xfrm_userpolicy_info */ |
272 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ | 272 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ |
273 | XFRMA_LTIME_VAL, | 273 | XFRMA_LTIME_VAL, |
274 | XFRMA_REPLAY_VAL, | 274 | XFRMA_REPLAY_VAL, |
@@ -276,17 +276,23 @@ enum xfrm_attr_type_t { | |||
276 | XFRMA_ETIMER_THRESH, | 276 | XFRMA_ETIMER_THRESH, |
277 | XFRMA_SRCADDR, /* xfrm_address_t */ | 277 | XFRMA_SRCADDR, /* xfrm_address_t */ |
278 | XFRMA_COADDR, /* xfrm_address_t */ | 278 | XFRMA_COADDR, /* xfrm_address_t */ |
279 | XFRMA_LASTUSED, | 279 | XFRMA_LASTUSED, /* unsigned long */ |
280 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | 280 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ |
281 | XFRMA_MIGRATE, | 281 | XFRMA_MIGRATE, |
282 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ | 282 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ |
283 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ | 283 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ |
284 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ | 284 | XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ |
285 | XFRMA_MARK, /* struct xfrm_mark */ | ||
285 | __XFRMA_MAX | 286 | __XFRMA_MAX |
286 | 287 | ||
287 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 288 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
288 | }; | 289 | }; |
289 | 290 | ||
291 | struct xfrm_mark { | ||
292 | __u32 v; /* value */ | ||
293 | __u32 m; /* mask */ | ||
294 | }; | ||
295 | |||
290 | enum xfrm_sadattr_type_t { | 296 | enum xfrm_sadattr_type_t { |
291 | XFRMA_SAD_UNSPEC, | 297 | XFRMA_SAD_UNSPEC, |
292 | XFRMA_SAD_CNT, | 298 | XFRMA_SAD_CNT, |
diff --git a/include/media/cx25840.h b/include/media/cx25840.h index 2c3fbaa33f74..0b0cb1776796 100644 --- a/include/media/cx25840.h +++ b/include/media/cx25840.h | |||
@@ -84,6 +84,7 @@ enum cx25840_video_input { | |||
84 | CX25840_NONE0_CH3 = 0x80000080, | 84 | CX25840_NONE0_CH3 = 0x80000080, |
85 | CX25840_NONE1_CH3 = 0x800000c0, | 85 | CX25840_NONE1_CH3 = 0x800000c0, |
86 | CX25840_SVIDEO_ON = 0x80000100, | 86 | CX25840_SVIDEO_ON = 0x80000100, |
87 | CX25840_COMPONENT_ON = 0x80000200, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | enum cx25840_audio_input { | 90 | enum cx25840_audio_input { |
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 71d8982e13ff..d863e5e8426d 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h | |||
@@ -83,6 +83,8 @@ struct vpfe_subdev_info { | |||
83 | struct vpfe_config { | 83 | struct vpfe_config { |
84 | /* Number of sub devices connected to vpfe */ | 84 | /* Number of sub devices connected to vpfe */ |
85 | int num_subdevs; | 85 | int num_subdevs; |
86 | /* i2c bus adapter no */ | ||
87 | int i2c_adapter_id; | ||
86 | /* information about each subdev */ | 88 | /* information about each subdev */ |
87 | struct vpfe_subdev_info *sub_devs; | 89 | struct vpfe_subdev_info *sub_devs; |
88 | /* evm card info */ | 90 | /* evm card info */ |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 29f0e53cff94..2c6af24b905e 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -26,26 +26,7 @@ | |||
26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | 29 | #include <media/ir-core.h> | |
30 | #define IR_TYPE_RC5 1 | ||
31 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ | ||
32 | #define IR_TYPE_OTHER 99 | ||
33 | |||
34 | #define IR_KEYTAB_TYPE u32 | ||
35 | #define IR_KEYTAB_SIZE 128 /* enougth for rc5, probably need more some day */ | ||
36 | |||
37 | struct ir_scancode { | ||
38 | u16 scancode; | ||
39 | u32 keycode; | ||
40 | }; | ||
41 | |||
42 | struct ir_scancode_table { | ||
43 | struct ir_scancode *scan; | ||
44 | int size; | ||
45 | }; | ||
46 | |||
47 | #define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ | ||
48 | ? tab[code] : KEY_RESERVED) | ||
49 | 30 | ||
50 | #define RC5_START(x) (((x)>>12)&3) | 31 | #define RC5_START(x) (((x)>>12)&3) |
51 | #define RC5_TOGGLE(x) (((x)>>11)&1) | 32 | #define RC5_TOGGLE(x) (((x)>>11)&1) |
@@ -55,11 +36,9 @@ struct ir_scancode_table { | |||
55 | struct ir_input_state { | 36 | struct ir_input_state { |
56 | /* configuration */ | 37 | /* configuration */ |
57 | int ir_type; | 38 | int ir_type; |
58 | IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; | ||
59 | 39 | ||
60 | /* key info */ | 40 | /* key info */ |
61 | u32 ir_raw; /* raw data */ | 41 | u32 ir_key; /* ir scancode */ |
62 | u32 ir_key; /* ir key code */ | ||
63 | u32 keycode; /* linux key code */ | 42 | u32 keycode; /* linux key code */ |
64 | int keypressed; /* current state */ | 43 | int keypressed; /* current state */ |
65 | }; | 44 | }; |
@@ -102,20 +81,23 @@ struct card_ir { | |||
102 | struct tasklet_struct tlet; | 81 | struct tasklet_struct tlet; |
103 | }; | 82 | }; |
104 | 83 | ||
105 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 84 | /* Routines from ir-functions.c */ |
106 | int ir_type, struct ir_scancode_table *ir_codes); | 85 | |
86 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | ||
87 | int ir_type); | ||
107 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); | 88 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); |
108 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | 89 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, |
109 | u32 ir_key, u32 ir_raw); | 90 | u32 ir_key); |
110 | u32 ir_extract_bits(u32 data, u32 mask); | 91 | u32 ir_extract_bits(u32 data, u32 mask); |
111 | int ir_dump_samples(u32 *samples, int count); | 92 | int ir_dump_samples(u32 *samples, int count); |
112 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | 93 | int ir_decode_biphase(u32 *samples, int count, int low, int high); |
113 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); | 94 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); |
95 | u32 ir_rc5_decode(unsigned int code); | ||
114 | 96 | ||
115 | void ir_rc5_timer_end(unsigned long data); | 97 | void ir_rc5_timer_end(unsigned long data); |
116 | void ir_rc5_timer_keyup(unsigned long data); | 98 | void ir_rc5_timer_keyup(unsigned long data); |
117 | 99 | ||
118 | /* Keymaps to be used by other modules */ | 100 | /* scancode->keycode map tables from ir-keymaps.c */ |
119 | 101 | ||
120 | extern struct ir_scancode_table ir_codes_empty_table; | 102 | extern struct ir_scancode_table ir_codes_empty_table; |
121 | extern struct ir_scancode_table ir_codes_avermedia_table; | 103 | extern struct ir_scancode_table ir_codes_avermedia_table; |
@@ -150,6 +132,7 @@ extern struct ir_scancode_table ir_codes_rc5_tv_table; | |||
150 | extern struct ir_scancode_table ir_codes_winfast_table; | 132 | extern struct ir_scancode_table ir_codes_winfast_table; |
151 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; | 133 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; |
152 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; | 134 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; |
135 | extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table; | ||
153 | extern struct ir_scancode_table ir_codes_npgtech_table; | 136 | extern struct ir_scancode_table ir_codes_npgtech_table; |
154 | extern struct ir_scancode_table ir_codes_norwood_table; | 137 | extern struct ir_scancode_table ir_codes_norwood_table; |
155 | extern struct ir_scancode_table ir_codes_proteus_2309_table; | 138 | extern struct ir_scancode_table ir_codes_proteus_2309_table; |
@@ -172,8 +155,11 @@ extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table; | |||
172 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; | 155 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; |
173 | extern struct ir_scancode_table ir_codes_kaiomy_table; | 156 | extern struct ir_scancode_table ir_codes_kaiomy_table; |
174 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; | 157 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; |
158 | extern struct ir_scancode_table ir_codes_tevii_nec_table; | ||
159 | extern struct ir_scancode_table ir_codes_tbs_nec_table; | ||
175 | extern struct ir_scancode_table ir_codes_evga_indtube_table; | 160 | extern struct ir_scancode_table ir_codes_evga_indtube_table; |
176 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; | 161 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; |
177 | extern struct ir_scancode_table ir_codes_videomate_s350_table; | 162 | extern struct ir_scancode_table ir_codes_videomate_s350_table; |
178 | extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; | 163 | extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; |
164 | extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table; | ||
179 | #endif | 165 | #endif |
diff --git a/include/media/ir-core.h b/include/media/ir-core.h new file mode 100644 index 000000000000..299d201e1339 --- /dev/null +++ b/include/media/ir-core.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Remote Controller core header | ||
3 | * | ||
4 | * 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 | ||
6 | * the Free Software Foundation version 2 of the License. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #ifndef _IR_CORE | ||
15 | #define _IR_CORE | ||
16 | |||
17 | #include <linux/input.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | |||
20 | extern int ir_core_debug; | ||
21 | #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ | ||
22 | printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) | ||
23 | |||
24 | enum ir_type { | ||
25 | IR_TYPE_UNKNOWN = 0, | ||
26 | IR_TYPE_RC5 = 1, | ||
27 | IR_TYPE_PD = 2, /* Pulse distance encoded IR */ | ||
28 | IR_TYPE_NEC = 3, | ||
29 | IR_TYPE_OTHER = 99, | ||
30 | }; | ||
31 | |||
32 | struct ir_scancode { | ||
33 | u16 scancode; | ||
34 | u32 keycode; | ||
35 | }; | ||
36 | |||
37 | struct ir_scancode_table { | ||
38 | struct ir_scancode *scan; | ||
39 | int size; | ||
40 | enum ir_type ir_type; | ||
41 | spinlock_t lock; | ||
42 | }; | ||
43 | |||
44 | struct ir_input_dev { | ||
45 | struct input_dev *dev; | ||
46 | struct ir_scancode_table rc_tab; | ||
47 | }; | ||
48 | |||
49 | /* Routines from ir-keytable.c */ | ||
50 | |||
51 | u32 ir_g_keycode_from_table(struct input_dev *input_dev, | ||
52 | u32 scancode); | ||
53 | |||
54 | int ir_set_keycode_table(struct input_dev *input_dev, | ||
55 | struct ir_scancode_table *rc_tab); | ||
56 | |||
57 | int ir_roundup_tablesize(int n_elems); | ||
58 | int ir_input_register(struct input_dev *dev, | ||
59 | struct ir_scancode_table *ir_codes); | ||
60 | void ir_input_unregister(struct input_dev *input_dev); | ||
61 | |||
62 | #endif | ||
diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h new file mode 100644 index 000000000000..a43c74ab05ec --- /dev/null +++ b/include/media/mt9t112.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* mt9t112 Camera | ||
2 | * | ||
3 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __MT9T112_H__ | ||
12 | #define __MT9T112_H__ | ||
13 | |||
14 | #define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0) | ||
15 | #define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */ | ||
16 | |||
17 | struct mt9t112_pll_divider { | ||
18 | u8 m, n; | ||
19 | u8 p1, p2, p3, p4, p5, p6, p7; | ||
20 | }; | ||
21 | |||
22 | /* | ||
23 | * mt9t112 camera info | ||
24 | */ | ||
25 | struct mt9t112_camera_info { | ||
26 | u32 flags; | ||
27 | struct mt9t112_pll_divider divider; | ||
28 | }; | ||
29 | |||
30 | #endif /* __MT9T112_H__ */ | ||
diff --git a/include/media/ov772x.h b/include/media/ov772x.h index 30d9629198ef..14c77efd6a85 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h | |||
@@ -1,4 +1,5 @@ | |||
1 | /* ov772x Camera | 1 | /* |
2 | * ov772x Camera | ||
2 | * | 3 | * |
3 | * Copyright (C) 2008 Renesas Solutions Corp. | 4 | * Copyright (C) 2008 Renesas Solutions Corp. |
4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | 5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
@@ -54,7 +55,6 @@ struct ov772x_edge_ctrl { | |||
54 | struct ov772x_camera_info { | 55 | struct ov772x_camera_info { |
55 | unsigned long buswidth; | 56 | unsigned long buswidth; |
56 | unsigned long flags; | 57 | unsigned long flags; |
57 | struct soc_camera_link link; | ||
58 | struct ov772x_edge_ctrl edgectrl; | 58 | struct ov772x_edge_ctrl edgectrl; |
59 | }; | 59 | }; |
60 | 60 | ||
diff --git a/include/media/rj54n1cb0c.h b/include/media/rj54n1cb0c.h new file mode 100644 index 000000000000..8ae3288ae925 --- /dev/null +++ b/include/media/rj54n1cb0c.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * RJ54N1CB0C Private data | ||
3 | * | ||
4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __RJ54N1CB0C_H__ | ||
12 | #define __RJ54N1CB0C_H__ | ||
13 | |||
14 | struct rj54n1_pdata { | ||
15 | unsigned int mclk_freq; | ||
16 | bool ioctl_high; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index eed5fccc83f3..4aeff96ff7d8 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
@@ -108,8 +108,6 @@ struct saa7146_fh { | |||
108 | 108 | ||
109 | struct saa7146_vv | 109 | struct saa7146_vv |
110 | { | 110 | { |
111 | int vbi_minor; | ||
112 | |||
113 | /* vbi capture */ | 111 | /* vbi capture */ |
114 | struct saa7146_dmaqueue vbi_q; | 112 | struct saa7146_dmaqueue vbi_q; |
115 | /* vbi workaround interrupt queue */ | 113 | /* vbi workaround interrupt queue */ |
@@ -117,8 +115,6 @@ struct saa7146_vv | |||
117 | int vbi_fieldcount; | 115 | int vbi_fieldcount; |
118 | struct saa7146_fh *vbi_streaming; | 116 | struct saa7146_fh *vbi_streaming; |
119 | 117 | ||
120 | int video_minor; | ||
121 | |||
122 | int video_status; | 118 | int video_status; |
123 | struct saa7146_fh *video_fh; | 119 | struct saa7146_fh *video_fh; |
124 | 120 | ||
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 0f3524cff435..b67747836878 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ | 4 | #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ |
5 | #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ | 5 | #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ |
6 | #define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ | ||
7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ | ||
6 | 8 | ||
7 | struct sh_mobile_ceu_info { | 9 | struct sh_mobile_ceu_info { |
8 | unsigned long flags; | 10 | unsigned long flags; |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 3d74e60032dd..dcc5b86bcb6c 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -24,18 +24,13 @@ struct soc_camera_device { | |||
24 | struct device *pdev; /* Platform device */ | 24 | struct device *pdev; /* Platform device */ |
25 | s32 user_width; | 25 | s32 user_width; |
26 | s32 user_height; | 26 | s32 user_height; |
27 | unsigned short width_min; | 27 | enum v4l2_colorspace colorspace; |
28 | unsigned short height_min; | ||
29 | unsigned short y_skip_top; /* Lines to skip at the top */ | ||
30 | unsigned char iface; /* Host number */ | 28 | unsigned char iface; /* Host number */ |
31 | unsigned char devnum; /* Device number per host */ | 29 | unsigned char devnum; /* Device number per host */ |
32 | unsigned char buswidth; /* See comment in .c */ | ||
33 | struct soc_camera_sense *sense; /* See comment in struct definition */ | 30 | struct soc_camera_sense *sense; /* See comment in struct definition */ |
34 | struct soc_camera_ops *ops; | 31 | struct soc_camera_ops *ops; |
35 | struct video_device *vdev; | 32 | struct video_device *vdev; |
36 | const struct soc_camera_data_format *current_fmt; | 33 | const struct soc_camera_format_xlate *current_fmt; |
37 | const struct soc_camera_data_format *formats; | ||
38 | int num_formats; | ||
39 | struct soc_camera_format_xlate *user_formats; | 34 | struct soc_camera_format_xlate *user_formats; |
40 | int num_user_formats; | 35 | int num_user_formats; |
41 | enum v4l2_field field; /* Preserve field over close() */ | 36 | enum v4l2_field field; /* Preserve field over close() */ |
@@ -107,6 +102,8 @@ struct soc_camera_link { | |||
107 | int i2c_adapter_id; | 102 | int i2c_adapter_id; |
108 | struct i2c_board_info *board_info; | 103 | struct i2c_board_info *board_info; |
109 | const char *module_name; | 104 | const char *module_name; |
105 | void *priv; | ||
106 | |||
110 | /* | 107 | /* |
111 | * For non-I2C devices platform platform has to provide methods to | 108 | * For non-I2C devices platform platform has to provide methods to |
112 | * add a device to the system and to remove | 109 | * add a device to the system and to remove |
@@ -162,23 +159,13 @@ static inline struct v4l2_subdev *soc_camera_to_subdev( | |||
162 | int soc_camera_host_register(struct soc_camera_host *ici); | 159 | int soc_camera_host_register(struct soc_camera_host *ici); |
163 | void soc_camera_host_unregister(struct soc_camera_host *ici); | 160 | void soc_camera_host_unregister(struct soc_camera_host *ici); |
164 | 161 | ||
165 | const struct soc_camera_data_format *soc_camera_format_by_fourcc( | ||
166 | struct soc_camera_device *icd, unsigned int fourcc); | ||
167 | const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( | 162 | const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( |
168 | struct soc_camera_device *icd, unsigned int fourcc); | 163 | struct soc_camera_device *icd, unsigned int fourcc); |
169 | 164 | ||
170 | struct soc_camera_data_format { | ||
171 | const char *name; | ||
172 | unsigned int depth; | ||
173 | __u32 fourcc; | ||
174 | enum v4l2_colorspace colorspace; | ||
175 | }; | ||
176 | |||
177 | /** | 165 | /** |
178 | * struct soc_camera_format_xlate - match between host and sensor formats | 166 | * struct soc_camera_format_xlate - match between host and sensor formats |
179 | * @cam_fmt: sensor format provided by the sensor | 167 | * @code: code of a sensor provided format |
180 | * @host_fmt: host format after host translation from cam_fmt | 168 | * @host_fmt: host format after host translation from code |
181 | * @buswidth: bus width for this format | ||
182 | * | 169 | * |
183 | * Host and sensor translation structure. Used in table of host and sensor | 170 | * Host and sensor translation structure. Used in table of host and sensor |
184 | * formats matchings in soc_camera_device. A host can override the generic list | 171 | * formats matchings in soc_camera_device. A host can override the generic list |
@@ -186,9 +173,8 @@ struct soc_camera_data_format { | |||
186 | * format setup. | 173 | * format setup. |
187 | */ | 174 | */ |
188 | struct soc_camera_format_xlate { | 175 | struct soc_camera_format_xlate { |
189 | const struct soc_camera_data_format *cam_fmt; | 176 | enum v4l2_mbus_pixelcode code; |
190 | const struct soc_camera_data_format *host_fmt; | 177 | const struct soc_mbus_pixelfmt *host_fmt; |
191 | unsigned char buswidth; | ||
192 | }; | 178 | }; |
193 | 179 | ||
194 | struct soc_camera_ops { | 180 | struct soc_camera_ops { |
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h index bb70401b8141..0ecefe227b76 100644 --- a/include/media/soc_camera_platform.h +++ b/include/media/soc_camera_platform.h | |||
@@ -19,11 +19,10 @@ struct device; | |||
19 | struct soc_camera_platform_info { | 19 | struct soc_camera_platform_info { |
20 | const char *format_name; | 20 | const char *format_name; |
21 | unsigned long format_depth; | 21 | unsigned long format_depth; |
22 | struct v4l2_pix_format format; | 22 | struct v4l2_mbus_framefmt format; |
23 | unsigned long bus_param; | 23 | unsigned long bus_param; |
24 | struct device *dev; | 24 | struct device *dev; |
25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); | 25 | int (*set_capture)(struct soc_camera_platform_info *info, int enable); |
26 | struct soc_camera_link link; | ||
27 | }; | 26 | }; |
28 | 27 | ||
29 | #endif /* __SOC_CAMERA_H__ */ | 28 | #endif /* __SOC_CAMERA_H__ */ |
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h new file mode 100644 index 000000000000..037cd7be001e --- /dev/null +++ b/include/media/soc_mediabus.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * SoC-camera Media Bus API extensions | ||
3 | * | ||
4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef SOC_MEDIABUS_H | ||
12 | #define SOC_MEDIABUS_H | ||
13 | |||
14 | #include <linux/videodev2.h> | ||
15 | |||
16 | #include <media/v4l2-mediabus.h> | ||
17 | |||
18 | /** | ||
19 | * enum soc_mbus_packing - data packing types on the media-bus | ||
20 | * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM | ||
21 | * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the | ||
22 | * possibly incomplete byte high bits are padding | ||
23 | * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding | ||
24 | * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended | ||
25 | * to 16 bits | ||
26 | */ | ||
27 | enum soc_mbus_packing { | ||
28 | SOC_MBUS_PACKING_NONE, | ||
29 | SOC_MBUS_PACKING_2X8_PADHI, | ||
30 | SOC_MBUS_PACKING_2X8_PADLO, | ||
31 | SOC_MBUS_PACKING_EXTEND16, | ||
32 | }; | ||
33 | |||
34 | /** | ||
35 | * enum soc_mbus_order - sample order on the media bus | ||
36 | * @SOC_MBUS_ORDER_LE: least significant sample first | ||
37 | * @SOC_MBUS_ORDER_BE: most significant sample first | ||
38 | */ | ||
39 | enum soc_mbus_order { | ||
40 | SOC_MBUS_ORDER_LE, | ||
41 | SOC_MBUS_ORDER_BE, | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * struct soc_mbus_pixelfmt - Data format on the media bus | ||
46 | * @name: Name of the format | ||
47 | * @fourcc: Fourcc code, that will be obtained if the data is | ||
48 | * stored in memory in the following way: | ||
49 | * @packing: Type of sample-packing, that has to be used | ||
50 | * @order: Sample order when storing in memory | ||
51 | * @bits_per_sample: How many bits the bridge has to sample | ||
52 | */ | ||
53 | struct soc_mbus_pixelfmt { | ||
54 | const char *name; | ||
55 | u32 fourcc; | ||
56 | enum soc_mbus_packing packing; | ||
57 | enum soc_mbus_order order; | ||
58 | u8 bits_per_sample; | ||
59 | }; | ||
60 | |||
61 | const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( | ||
62 | enum v4l2_mbus_pixelcode code); | ||
63 | s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); | ||
64 | |||
65 | #endif | ||
diff --git a/include/media/tw9910.h b/include/media/tw9910.h index 73231e7880d8..5e2895a05e6b 100644 --- a/include/media/tw9910.h +++ b/include/media/tw9910.h | |||
@@ -32,7 +32,6 @@ enum tw9910_mpout_pin { | |||
32 | struct tw9910_video_info { | 32 | struct tw9910_video_info { |
33 | unsigned long buswidth; | 33 | unsigned long buswidth; |
34 | enum tw9910_mpout_pin mpout; | 34 | enum tw9910_mpout_pin mpout; |
35 | struct soc_camera_link link; | ||
36 | }; | 35 | }; |
37 | 36 | ||
38 | 37 | ||
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index cf16689adba7..6cc107d198a0 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -64,6 +64,7 @@ enum { | |||
64 | V4L2_IDENT_OV9650 = 254, | 64 | V4L2_IDENT_OV9650 = 254, |
65 | V4L2_IDENT_OV9655 = 255, | 65 | V4L2_IDENT_OV9655 = 255, |
66 | V4L2_IDENT_SOI968 = 256, | 66 | V4L2_IDENT_SOI968 = 256, |
67 | V4L2_IDENT_OV9640 = 257, | ||
67 | 68 | ||
68 | /* module saa7146: reserved range 300-309 */ | 69 | /* module saa7146: reserved range 300-309 */ |
69 | V4L2_IDENT_SAA7146 = 300, | 70 | V4L2_IDENT_SAA7146 = 300, |
@@ -72,6 +73,7 @@ enum { | |||
72 | V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ | 73 | V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ |
73 | V4L2_IDENT_CX23415 = 415, | 74 | V4L2_IDENT_CX23415 = 415, |
74 | V4L2_IDENT_CX23416 = 416, | 75 | V4L2_IDENT_CX23416 = 416, |
76 | V4L2_IDENT_CX23417 = 417, | ||
75 | V4L2_IDENT_CX23418 = 418, | 77 | V4L2_IDENT_CX23418 = 418, |
76 | 78 | ||
77 | /* module au0828 */ | 79 | /* module au0828 */ |
@@ -129,6 +131,9 @@ enum { | |||
129 | V4L2_IDENT_SAA6752HS = 6752, | 131 | V4L2_IDENT_SAA6752HS = 6752, |
130 | V4L2_IDENT_SAA6752HS_AC3 = 6753, | 132 | V4L2_IDENT_SAA6752HS_AC3 = 6753, |
131 | 133 | ||
134 | /* modules tef6862: just ident 6862 */ | ||
135 | V4L2_IDENT_TEF6862 = 6862, | ||
136 | |||
132 | /* module adv7170: just ident 7170 */ | 137 | /* module adv7170: just ident 7170 */ |
133 | V4L2_IDENT_ADV7170 = 7170, | 138 | V4L2_IDENT_ADV7170 = 7170, |
134 | 139 | ||
@@ -165,12 +170,27 @@ enum { | |||
165 | /* module mt9v011, just ident 8243 */ | 170 | /* module mt9v011, just ident 8243 */ |
166 | V4L2_IDENT_MT9V011 = 8243, | 171 | V4L2_IDENT_MT9V011 = 8243, |
167 | 172 | ||
173 | /* module cx23885 and cx25840 */ | ||
174 | V4L2_IDENT_CX23885 = 8850, | ||
175 | V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */ | ||
176 | V4L2_IDENT_CX23887 = 8870, | ||
177 | V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */ | ||
178 | V4L2_IDENT_CX23888 = 8880, | ||
179 | V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ | ||
180 | V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ | ||
181 | |||
168 | /* module tw9910: just ident 9910 */ | 182 | /* module tw9910: just ident 9910 */ |
169 | V4L2_IDENT_TW9910 = 9910, | 183 | V4L2_IDENT_TW9910 = 9910, |
170 | 184 | ||
171 | /* module sn9c20x: just ident 10000 */ | 185 | /* module sn9c20x: just ident 10000 */ |
172 | V4L2_IDENT_SN9C20X = 10000, | 186 | V4L2_IDENT_SN9C20X = 10000, |
173 | 187 | ||
188 | /* module cx231xx and cx25840 */ | ||
189 | V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */ | ||
190 | V4L2_IDENT_CX23100 = 23100, | ||
191 | V4L2_IDENT_CX23101 = 23101, | ||
192 | V4L2_IDENT_CX23102 = 23102, | ||
193 | |||
174 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ | 194 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ |
175 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only | 195 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only |
176 | use internally (tveeprom.c). */ | 196 | use internally (tveeprom.c). */ |
@@ -247,6 +267,8 @@ enum { | |||
247 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ | 267 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ |
248 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ | 268 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ |
249 | V4L2_IDENT_MT9T031 = 45020, | 269 | V4L2_IDENT_MT9T031 = 45020, |
270 | V4L2_IDENT_MT9T111 = 45021, | ||
271 | V4L2_IDENT_MT9T112 = 45022, | ||
250 | V4L2_IDENT_MT9V111 = 45031, | 272 | V4L2_IDENT_MT9V111 = 45031, |
251 | V4L2_IDENT_MT9V112 = 45032, | 273 | V4L2_IDENT_MT9V112 = 45032, |
252 | 274 | ||
@@ -264,6 +286,9 @@ enum { | |||
264 | 286 | ||
265 | /* module m52790: just ident 52790 */ | 287 | /* module m52790: just ident 52790 */ |
266 | V4L2_IDENT_M52790 = 52790, | 288 | V4L2_IDENT_M52790 = 52790, |
289 | |||
290 | /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ | ||
291 | V4L2_IDENT_RJ54N1CB0C = 51980, | ||
267 | }; | 292 | }; |
268 | 293 | ||
269 | #endif | 294 | #endif |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1c25b10da34b..1c7b259f341c 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -212,5 +212,5 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin, | |||
212 | unsigned int *h, unsigned int hmin, | 212 | unsigned int *h, unsigned int hmin, |
213 | unsigned int hmax, unsigned int halign, | 213 | unsigned int hmax, unsigned int halign, |
214 | unsigned int salign); | 214 | unsigned int salign); |
215 | 215 | int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info); | |
216 | #endif /* V4L2_COMMON_H_ */ | 216 | #endif /* V4L2_COMMON_H_ */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 73c9867d744c..2dee93892ea2 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -28,10 +28,10 @@ struct v4l2_ioctl_callbacks; | |||
28 | struct video_device; | 28 | struct video_device; |
29 | struct v4l2_device; | 29 | struct v4l2_device; |
30 | 30 | ||
31 | /* Flag to mark the video_device struct as unregistered. | 31 | /* Flag to mark the video_device struct as registered. |
32 | Drivers can set this flag if they want to block all future | 32 | Drivers can clear this flag if they want to block all future |
33 | device access. It is set by video_unregister_device. */ | 33 | device access. It is cleared by video_unregister_device. */ |
34 | #define V4L2_FL_UNREGISTERED (0) | 34 | #define V4L2_FL_REGISTERED (0) |
35 | 35 | ||
36 | struct v4l2_file_operations { | 36 | struct v4l2_file_operations { |
37 | struct module *owner; | 37 | struct module *owner; |
@@ -96,9 +96,7 @@ struct video_device | |||
96 | /* Register video devices. Note that if video_register_device fails, | 96 | /* Register video devices. Note that if video_register_device fails, |
97 | the release() callback of the video_device structure is *not* called, so | 97 | the release() callback of the video_device structure is *not* called, so |
98 | the caller is responsible for freeing any data. Usually that means that | 98 | the caller is responsible for freeing any data. Usually that means that |
99 | you call video_device_release() on failure. | 99 | you call video_device_release() on failure. */ |
100 | |||
101 | Also note that vdev->minor is set to -1 if the registration failed. */ | ||
102 | int __must_check video_register_device(struct video_device *vdev, int type, int nr); | 100 | int __must_check video_register_device(struct video_device *vdev, int type, int nr); |
103 | 101 | ||
104 | /* Same as video_register_device, but no warning is issued if the desired | 102 | /* Same as video_register_device, but no warning is issued if the desired |
@@ -106,7 +104,7 @@ int __must_check video_register_device(struct video_device *vdev, int type, int | |||
106 | int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); | 104 | int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); |
107 | 105 | ||
108 | /* Unregister video devices. Will do nothing if vdev == NULL or | 106 | /* Unregister video devices. Will do nothing if vdev == NULL or |
109 | vdev->minor < 0. */ | 107 | video_is_registered() returns false. */ |
110 | void video_unregister_device(struct video_device *vdev); | 108 | void video_unregister_device(struct video_device *vdev); |
111 | 109 | ||
112 | /* helper functions to alloc/release struct video_device, the | 110 | /* helper functions to alloc/release struct video_device, the |
@@ -141,9 +139,14 @@ static inline void *video_drvdata(struct file *file) | |||
141 | return video_get_drvdata(video_devdata(file)); | 139 | return video_get_drvdata(video_devdata(file)); |
142 | } | 140 | } |
143 | 141 | ||
144 | static inline int video_is_unregistered(struct video_device *vdev) | 142 | static inline const char *video_device_node_name(struct video_device *vdev) |
143 | { | ||
144 | return dev_name(&vdev->dev); | ||
145 | } | ||
146 | |||
147 | static inline int video_is_registered(struct video_device *vdev) | ||
145 | { | 148 | { |
146 | return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags); | 149 | return test_bit(V4L2_FL_REGISTERED, &vdev->flags); |
147 | } | 150 | } |
148 | 151 | ||
149 | #endif /* _V4L2_DEV_H */ | 152 | #endif /* _V4L2_DEV_H */ |
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 7a4529defa88..e8ba0f2efbae 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
@@ -239,6 +239,21 @@ struct v4l2_ioctl_ops { | |||
239 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, | 239 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, |
240 | struct v4l2_frmivalenum *fival); | 240 | struct v4l2_frmivalenum *fival); |
241 | 241 | ||
242 | /* DV Timings IOCTLs */ | ||
243 | int (*vidioc_enum_dv_presets) (struct file *file, void *fh, | ||
244 | struct v4l2_dv_enum_preset *preset); | ||
245 | |||
246 | int (*vidioc_s_dv_preset) (struct file *file, void *fh, | ||
247 | struct v4l2_dv_preset *preset); | ||
248 | int (*vidioc_g_dv_preset) (struct file *file, void *fh, | ||
249 | struct v4l2_dv_preset *preset); | ||
250 | int (*vidioc_query_dv_preset) (struct file *file, void *fh, | ||
251 | struct v4l2_dv_preset *qpreset); | ||
252 | int (*vidioc_s_dv_timings) (struct file *file, void *fh, | ||
253 | struct v4l2_dv_timings *timings); | ||
254 | int (*vidioc_g_dv_timings) (struct file *file, void *fh, | ||
255 | struct v4l2_dv_timings *timings); | ||
256 | |||
242 | /* For other private ioctls */ | 257 | /* For other private ioctls */ |
243 | long (*vidioc_default) (struct file *file, void *fh, | 258 | long (*vidioc_default) (struct file *file, void *fh, |
244 | int cmd, void *arg); | 259 | int cmd, void *arg); |
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h new file mode 100644 index 000000000000..0dbe02ada259 --- /dev/null +++ b/include/media/v4l2-mediabus.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Media Bus API header | ||
3 | * | ||
4 | * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef V4L2_MEDIABUS_H | ||
12 | #define V4L2_MEDIABUS_H | ||
13 | |||
14 | /* | ||
15 | * These pixel codes uniquely identify data formats on the media bus. Mostly | ||
16 | * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is | ||
17 | * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the | ||
18 | * data format is fixed. Additionally, "2X8" means that one pixel is transferred | ||
19 | * in two 8-bit samples, "BE" or "LE" specify in which order those samples are | ||
20 | * transferred over the bus: "LE" means that the least significant bits are | ||
21 | * transferred first, "BE" means that the most significant bits are transferred | ||
22 | * first, and "PADHI" and "PADLO" define which bits - low or high, in the | ||
23 | * incomplete high byte, are filled with padding bits. | ||
24 | */ | ||
25 | enum v4l2_mbus_pixelcode { | ||
26 | V4L2_MBUS_FMT_FIXED = 1, | ||
27 | V4L2_MBUS_FMT_YUYV8_2X8_LE, | ||
28 | V4L2_MBUS_FMT_YVYU8_2X8_LE, | ||
29 | V4L2_MBUS_FMT_YUYV8_2X8_BE, | ||
30 | V4L2_MBUS_FMT_YVYU8_2X8_BE, | ||
31 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, | ||
32 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, | ||
33 | V4L2_MBUS_FMT_RGB565_2X8_LE, | ||
34 | V4L2_MBUS_FMT_RGB565_2X8_BE, | ||
35 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
36 | V4L2_MBUS_FMT_SBGGR10_1X10, | ||
37 | V4L2_MBUS_FMT_GREY8_1X8, | ||
38 | V4L2_MBUS_FMT_Y10_1X10, | ||
39 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE, | ||
40 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE, | ||
41 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, | ||
42 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, | ||
43 | }; | ||
44 | |||
45 | /** | ||
46 | * struct v4l2_mbus_framefmt - frame format on the media bus | ||
47 | * @width: frame width | ||
48 | * @height: frame height | ||
49 | * @code: data format code | ||
50 | * @field: used interlacing type | ||
51 | * @colorspace: colorspace of the data | ||
52 | */ | ||
53 | struct v4l2_mbus_framefmt { | ||
54 | __u32 width; | ||
55 | __u32 height; | ||
56 | enum v4l2_mbus_pixelcode code; | ||
57 | enum v4l2_field field; | ||
58 | enum v4l2_colorspace colorspace; | ||
59 | }; | ||
60 | |||
61 | #endif | ||
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index d411345f244b..9ba99cd39ee7 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -22,6 +22,17 @@ | |||
22 | #define _V4L2_SUBDEV_H | 22 | #define _V4L2_SUBDEV_H |
23 | 23 | ||
24 | #include <media/v4l2-common.h> | 24 | #include <media/v4l2-common.h> |
25 | #include <media/v4l2-mediabus.h> | ||
26 | |||
27 | /* generic v4l2_device notify callback notification values */ | ||
28 | #define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32) | ||
29 | #define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ 0x00000001 | ||
30 | #define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED 0x00000002 | ||
31 | #define V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN 0x00000004 | ||
32 | #define V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN 0x00000008 | ||
33 | |||
34 | #define V4L2_SUBDEV_IR_TX_NOTIFY _IOW('v', 1, u32) | ||
35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | ||
25 | 36 | ||
26 | struct v4l2_device; | 37 | struct v4l2_device; |
27 | struct v4l2_subdev; | 38 | struct v4l2_subdev; |
@@ -96,6 +107,9 @@ struct v4l2_decode_vbi_line { | |||
96 | 107 | ||
97 | s_gpio: set GPIO pins. Very simple right now, might need to be extended with | 108 | s_gpio: set GPIO pins. Very simple right now, might need to be extended with |
98 | a direction argument if needed. | 109 | a direction argument if needed. |
110 | |||
111 | s_power: puts subdevice in power saving mode (on == 0) or normal operation | ||
112 | mode (on == 1). | ||
99 | */ | 113 | */ |
100 | struct v4l2_subdev_core_ops { | 114 | struct v4l2_subdev_core_ops { |
101 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); | 115 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); |
@@ -118,6 +132,7 @@ struct v4l2_subdev_core_ops { | |||
118 | int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 132 | int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
119 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 133 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
120 | #endif | 134 | #endif |
135 | int (*s_power)(struct v4l2_subdev *sd, int on); | ||
121 | }; | 136 | }; |
122 | 137 | ||
123 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 138 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. |
@@ -127,8 +142,6 @@ struct v4l2_subdev_core_ops { | |||
127 | s_type_addr: sets tuner type and its I2C addr. | 142 | s_type_addr: sets tuner type and its I2C addr. |
128 | 143 | ||
129 | s_config: sets tda9887 specific stuff, like port1, port2 and qss | 144 | s_config: sets tda9887 specific stuff, like port1, port2 and qss |
130 | |||
131 | s_standby: puts tuner on powersaving state, disabling it, except for i2c. | ||
132 | */ | 145 | */ |
133 | struct v4l2_subdev_tuner_ops { | 146 | struct v4l2_subdev_tuner_ops { |
134 | int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); | 147 | int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); |
@@ -141,7 +154,6 @@ struct v4l2_subdev_tuner_ops { | |||
141 | int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); | 154 | int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); |
142 | int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); | 155 | int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); |
143 | int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); | 156 | int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); |
144 | int (*s_standby)(struct v4l2_subdev *sd); | ||
145 | }; | 157 | }; |
146 | 158 | ||
147 | /* s_clock_freq: set the frequency (in Hz) of the audio clock output. | 159 | /* s_clock_freq: set the frequency (in Hz) of the audio clock output. |
@@ -196,7 +208,7 @@ struct v4l2_subdev_audio_ops { | |||
196 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by | 208 | s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by |
197 | video input devices. | 209 | video input devices. |
198 | 210 | ||
199 | s_crystal_freq: sets the frequency of the crystal used to generate the | 211 | s_crystal_freq: sets the frequency of the crystal used to generate the |
200 | clocks in Hz. An extra flags field allows device specific configuration | 212 | clocks in Hz. An extra flags field allows device specific configuration |
201 | regarding clock frequency dividers, etc. If not used, then set flags | 213 | regarding clock frequency dividers, etc. If not used, then set flags |
202 | to 0. If the frequency is not supported, then -EINVAL is returned. | 214 | to 0. If the frequency is not supported, then -EINVAL is returned. |
@@ -206,6 +218,26 @@ struct v4l2_subdev_audio_ops { | |||
206 | 218 | ||
207 | s_routing: see s_routing in audio_ops, except this version is for video | 219 | s_routing: see s_routing in audio_ops, except this version is for video |
208 | devices. | 220 | devices. |
221 | |||
222 | s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to | ||
223 | s_std() | ||
224 | |||
225 | query_dv_preset: query dv preset in the sub device. This is similar to | ||
226 | querystd() | ||
227 | |||
228 | s_dv_timings(): Set custom dv timings in the sub device. This is used | ||
229 | when sub device is capable of setting detailed timing information | ||
230 | in the hardware to generate/detect the video signal. | ||
231 | |||
232 | g_dv_timings(): Get custom dv timings in the sub device. | ||
233 | |||
234 | enum_mbus_fmt: enumerate pixel formats, provided by a video data source | ||
235 | |||
236 | g_mbus_fmt: get the current pixel format, provided by a video data source | ||
237 | |||
238 | try_mbus_fmt: try to set a pixel format on a video data source | ||
239 | |||
240 | s_mbus_fmt: set a pixel format on a video data source | ||
209 | */ | 241 | */ |
210 | struct v4l2_subdev_video_ops { | 242 | struct v4l2_subdev_video_ops { |
211 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); | 243 | int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); |
@@ -229,13 +261,125 @@ struct v4l2_subdev_video_ops { | |||
229 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); | 261 | int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); |
230 | int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); | 262 | int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); |
231 | int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); | 263 | int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); |
264 | int (*s_dv_preset)(struct v4l2_subdev *sd, | ||
265 | struct v4l2_dv_preset *preset); | ||
266 | int (*query_dv_preset)(struct v4l2_subdev *sd, | ||
267 | struct v4l2_dv_preset *preset); | ||
268 | int (*s_dv_timings)(struct v4l2_subdev *sd, | ||
269 | struct v4l2_dv_timings *timings); | ||
270 | int (*g_dv_timings)(struct v4l2_subdev *sd, | ||
271 | struct v4l2_dv_timings *timings); | ||
272 | int (*enum_mbus_fmt)(struct v4l2_subdev *sd, int index, | ||
273 | enum v4l2_mbus_pixelcode *code); | ||
274 | int (*g_mbus_fmt)(struct v4l2_subdev *sd, | ||
275 | struct v4l2_mbus_framefmt *fmt); | ||
276 | int (*try_mbus_fmt)(struct v4l2_subdev *sd, | ||
277 | struct v4l2_mbus_framefmt *fmt); | ||
278 | int (*s_mbus_fmt)(struct v4l2_subdev *sd, | ||
279 | struct v4l2_mbus_framefmt *fmt); | ||
280 | }; | ||
281 | |||
282 | /** | ||
283 | * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations | ||
284 | * @g_skip_top_lines: number of lines at the top of the image to be skipped. | ||
285 | * This is needed for some sensors, which always corrupt | ||
286 | * several top lines of the output image, or which send their | ||
287 | * metadata in them. | ||
288 | */ | ||
289 | struct v4l2_subdev_sensor_ops { | ||
290 | int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines); | ||
291 | }; | ||
292 | |||
293 | /* | ||
294 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
295 | handler, when an IR interrupt status has be raised due to this subdev, | ||
296 | so that this subdev can handle the details. It may schedule work to be | ||
297 | performed later. It must not sleep. *Called from an IRQ context*. | ||
298 | |||
299 | [rt]x_g_parameters: Get the current operating parameters and state of the | ||
300 | the IR receiver or transmitter. | ||
301 | |||
302 | [rt]x_s_parameters: Set the current operating parameters and state of the | ||
303 | the IR receiver or transmitter. It is recommended to call | ||
304 | [rt]x_g_parameters first to fill out the current state, and only change | ||
305 | the fields that need to be changed. Upon return, the actual device | ||
306 | operating parameters and state will be returned. Note that hardware | ||
307 | limitations may prevent the actual settings from matching the requested | ||
308 | settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz | ||
309 | was requested. An exception is when the shutdown parameter is true. | ||
310 | The last used operational parameters will be returned, but the actual | ||
311 | state of the hardware be different to minimize power consumption and | ||
312 | processing when shutdown is true. | ||
313 | |||
314 | rx_read: Reads received codes or pulse width data. | ||
315 | The semantics are similar to a non-blocking read() call. | ||
316 | |||
317 | tx_write: Writes codes or pulse width data for transmission. | ||
318 | The semantics are similar to a non-blocking write() call. | ||
319 | */ | ||
320 | |||
321 | enum v4l2_subdev_ir_mode { | ||
322 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ | ||
323 | }; | ||
324 | |||
325 | /* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */ | ||
326 | #define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff | ||
327 | #define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000 | ||
328 | #define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff | ||
329 | |||
330 | struct v4l2_subdev_ir_parameters { | ||
331 | /* Either Rx or Tx */ | ||
332 | unsigned int bytes_per_data_element; /* of data in read or write call */ | ||
333 | enum v4l2_subdev_ir_mode mode; | ||
334 | |||
335 | bool enable; | ||
336 | bool interrupt_enable; | ||
337 | bool shutdown; /* true: set hardware to low/no power, false: normal */ | ||
338 | |||
339 | bool modulation; /* true: uses carrier, false: baseband */ | ||
340 | u32 max_pulse_width; /* ns, valid only for baseband signal */ | ||
341 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ | ||
342 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ | ||
343 | bool invert; /* logically invert sense of mark/space */ | ||
344 | |||
345 | /* Rx only */ | ||
346 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ | ||
347 | unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */ | ||
348 | unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */ | ||
349 | u32 resolution; /* ns */ | ||
350 | }; | ||
351 | |||
352 | struct v4l2_subdev_ir_ops { | ||
353 | /* Common to receiver and transmitter */ | ||
354 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
355 | u32 status, bool *handled); | ||
356 | |||
357 | /* Receiver */ | ||
358 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, | ||
359 | ssize_t *num); | ||
360 | |||
361 | int (*rx_g_parameters)(struct v4l2_subdev *sd, | ||
362 | struct v4l2_subdev_ir_parameters *params); | ||
363 | int (*rx_s_parameters)(struct v4l2_subdev *sd, | ||
364 | struct v4l2_subdev_ir_parameters *params); | ||
365 | |||
366 | /* Transmitter */ | ||
367 | int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count, | ||
368 | ssize_t *num); | ||
369 | |||
370 | int (*tx_g_parameters)(struct v4l2_subdev *sd, | ||
371 | struct v4l2_subdev_ir_parameters *params); | ||
372 | int (*tx_s_parameters)(struct v4l2_subdev *sd, | ||
373 | struct v4l2_subdev_ir_parameters *params); | ||
232 | }; | 374 | }; |
233 | 375 | ||
234 | struct v4l2_subdev_ops { | 376 | struct v4l2_subdev_ops { |
235 | const struct v4l2_subdev_core_ops *core; | 377 | const struct v4l2_subdev_core_ops *core; |
236 | const struct v4l2_subdev_tuner_ops *tuner; | 378 | const struct v4l2_subdev_tuner_ops *tuner; |
237 | const struct v4l2_subdev_audio_ops *audio; | 379 | const struct v4l2_subdev_audio_ops *audio; |
238 | const struct v4l2_subdev_video_ops *video; | 380 | const struct v4l2_subdev_video_ops *video; |
381 | const struct v4l2_subdev_ir_ops *ir; | ||
382 | const struct v4l2_subdev_sensor_ops *sensor; | ||
239 | }; | 383 | }; |
240 | 384 | ||
241 | #define V4L2_SUBDEV_NAME_SIZE 32 | 385 | #define V4L2_SUBDEV_NAME_SIZE 32 |
@@ -290,7 +434,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
290 | Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); | 434 | Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); |
291 | */ | 435 | */ |
292 | #define v4l2_subdev_call(sd, o, f, args...) \ | 436 | #define v4l2_subdev_call(sd, o, f, args...) \ |
293 | (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ | 437 | (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ |
294 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) | 438 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) |
295 | 439 | ||
296 | /* Send a notification to v4l2_device. */ | 440 | /* Send a notification to v4l2_device. */ |
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 1c5946c44758..316fdccdcaa0 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
@@ -166,7 +166,7 @@ struct videobuf_queue { | |||
166 | enum v4l2_field field; | 166 | enum v4l2_field field; |
167 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ | 167 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ |
168 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; | 168 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; |
169 | struct videobuf_queue_ops *ops; | 169 | const struct videobuf_queue_ops *ops; |
170 | struct videobuf_qtype_ops *int_ops; | 170 | struct videobuf_qtype_ops *int_ops; |
171 | 171 | ||
172 | unsigned int streaming:1; | 172 | unsigned int streaming:1; |
@@ -195,7 +195,7 @@ void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, | |||
195 | struct videobuf_buffer *buf); | 195 | struct videobuf_buffer *buf); |
196 | 196 | ||
197 | void videobuf_queue_core_init(struct videobuf_queue *q, | 197 | void videobuf_queue_core_init(struct videobuf_queue *q, |
198 | struct videobuf_queue_ops *ops, | 198 | const struct videobuf_queue_ops *ops, |
199 | struct device *dev, | 199 | struct device *dev, |
200 | spinlock_t *irqlock, | 200 | spinlock_t *irqlock, |
201 | enum v4l2_buf_type type, | 201 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h index 549386681aab..ebaa9bc1ee8d 100644 --- a/include/media/videobuf-dma-contig.h +++ b/include/media/videobuf-dma-contig.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <media/videobuf-core.h> | 17 | #include <media/videobuf-core.h> |
18 | 18 | ||
19 | void videobuf_queue_dma_contig_init(struct videobuf_queue *q, | 19 | void videobuf_queue_dma_contig_init(struct videobuf_queue *q, |
20 | struct videobuf_queue_ops *ops, | 20 | const struct videobuf_queue_ops *ops, |
21 | struct device *dev, | 21 | struct device *dev, |
22 | spinlock_t *irqlock, | 22 | spinlock_t *irqlock, |
23 | enum v4l2_buf_type type, | 23 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index dda47f0082e9..53e72f787175 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h | |||
@@ -103,7 +103,7 @@ struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf); | |||
103 | void *videobuf_sg_alloc(size_t size); | 103 | void *videobuf_sg_alloc(size_t size); |
104 | 104 | ||
105 | void videobuf_queue_sg_init(struct videobuf_queue* q, | 105 | void videobuf_queue_sg_init(struct videobuf_queue* q, |
106 | struct videobuf_queue_ops *ops, | 106 | const struct videobuf_queue_ops *ops, |
107 | struct device *dev, | 107 | struct device *dev, |
108 | spinlock_t *irqlock, | 108 | spinlock_t *irqlock, |
109 | enum v4l2_buf_type type, | 109 | enum v4l2_buf_type type, |
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index 6ba4f1271d23..07cf4b9d0a65 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h | |||
@@ -42,7 +42,9 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | |||
42 | void *adapter_priv, | 42 | void *adapter_priv, |
43 | struct device *device, | 43 | struct device *device, |
44 | short *adapter_nr, | 44 | short *adapter_nr, |
45 | int mfe_shared); | 45 | int mfe_shared, |
46 | int (*fe_ioctl_override)(struct dvb_frontend *, | ||
47 | unsigned int, void *, unsigned int)); | ||
46 | 48 | ||
47 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); | 49 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); |
48 | 50 | ||
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index e87222c6a125..4b419a257a7d 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h | |||
@@ -30,8 +30,8 @@ struct videobuf_vmalloc_memory | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | void videobuf_queue_vmalloc_init(struct videobuf_queue* q, | 32 | void videobuf_queue_vmalloc_init(struct videobuf_queue* q, |
33 | struct videobuf_queue_ops *ops, | 33 | const struct videobuf_queue_ops *ops, |
34 | void *dev, | 34 | struct device *dev, |
35 | spinlock_t *irqlock, | 35 | spinlock_t *irqlock, |
36 | enum v4l2_buf_type type, | 36 | enum v4l2_buf_type type, |
37 | enum v4l2_field field, | 37 | enum v4l2_field field, |
diff --git a/include/net/compat.h b/include/net/compat.h index 3c7d4e38fa1d..28d5428ec6a2 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -46,7 +46,7 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi | |||
46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); | 46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); |
47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, | 47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, |
48 | unsigned, unsigned, | 48 | unsigned, unsigned, |
49 | struct timespec __user *); | 49 | struct compat_timespec __user *); |
50 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); | 50 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); |
51 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); | 51 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); |
52 | 52 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 387cb3cfde7e..ce078cda6b74 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -83,8 +83,6 @@ struct dst_entry { | |||
83 | * (L1_CACHE_SIZE would be too much) | 83 | * (L1_CACHE_SIZE would be too much) |
84 | */ | 84 | */ |
85 | #ifdef CONFIG_64BIT | 85 | #ifdef CONFIG_64BIT |
86 | long __pad_to_align_refcnt[2]; | ||
87 | #else | ||
88 | long __pad_to_align_refcnt[1]; | 86 | long __pad_to_align_refcnt[1]; |
89 | #endif | 87 | #endif |
90 | /* | 88 | /* |
@@ -113,7 +111,7 @@ dst_metric(const struct dst_entry *dst, int metric) | |||
113 | static inline u32 | 111 | static inline u32 |
114 | dst_feature(const struct dst_entry *dst, u32 feature) | 112 | dst_feature(const struct dst_entry *dst, u32 feature) |
115 | { | 113 | { |
116 | return (dst ? dst_metric(dst, RTAX_FEATURES) & feature : 0); | 114 | return dst_metric(dst, RTAX_FEATURES) & feature; |
117 | } | 115 | } |
118 | 116 | ||
119 | static inline u32 dst_mtu(const struct dst_entry *dst) | 117 | static inline u32 dst_mtu(const struct dst_entry *dst) |
diff --git a/include/net/icmp.h b/include/net/icmp.h index dfa72d4e8907..15b3dfe9fce8 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -28,7 +28,7 @@ struct icmp_err { | |||
28 | unsigned fatal:1; | 28 | unsigned fatal:1; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern struct icmp_err icmp_err_convert[]; | 31 | extern const struct icmp_err icmp_err_convert[]; |
32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) | 32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) |
33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) | 33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) |
34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) | 34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index e9d69d198495..545d8b059bef 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -157,7 +157,7 @@ struct inet6_dev { | |||
157 | 157 | ||
158 | struct ifmcaddr6 *mc_list; | 158 | struct ifmcaddr6 *mc_list; |
159 | struct ifmcaddr6 *mc_tomb; | 159 | struct ifmcaddr6 *mc_tomb; |
160 | rwlock_t mc_lock; | 160 | spinlock_t mc_lock; |
161 | unsigned char mc_qrv; | 161 | unsigned char mc_qrv; |
162 | unsigned char mc_gq_running; | 162 | unsigned char mc_gq_running; |
163 | unsigned char mc_ifc_count; | 163 | unsigned char mc_ifc_count; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index bd4c53f75ac0..83fd34437cf1 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -122,10 +122,12 @@ struct inet_sock { | |||
122 | __be32 inet_saddr; | 122 | __be32 inet_saddr; |
123 | __s16 uc_ttl; | 123 | __s16 uc_ttl; |
124 | __u16 cmsg_flags; | 124 | __u16 cmsg_flags; |
125 | struct ip_options *opt; | ||
126 | __be16 inet_sport; | 125 | __be16 inet_sport; |
127 | __u16 inet_id; | 126 | __u16 inet_id; |
127 | |||
128 | struct ip_options *opt; | ||
128 | __u8 tos; | 129 | __u8 tos; |
130 | __u8 min_ttl; | ||
129 | __u8 mc_ttl; | 131 | __u8 mc_ttl; |
130 | __u8 pmtudisc; | 132 | __u8 pmtudisc; |
131 | __u8 recverr:1, | 133 | __u8 recverr:1, |
diff --git a/include/net/ip.h b/include/net/ip.h index e6b9d12d5f62..503994a38ed1 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -174,9 +174,9 @@ extern struct ipv4_config ipv4_config; | |||
174 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) | 174 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) |
175 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 175 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
176 | 176 | ||
177 | extern unsigned long snmp_fold_field(void *mib[], int offt); | 177 | extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); |
178 | extern int snmp_mib_init(void *ptr[2], size_t mibsize); | 178 | extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize); |
179 | extern void snmp_mib_free(void *ptr[2]); | 179 | extern void snmp_mib_free(void __percpu *ptr[2]); |
180 | 180 | ||
181 | extern struct local_ports { | 181 | extern struct local_ports { |
182 | seqlock_t lock; | 182 | seqlock_t lock; |
@@ -326,6 +326,22 @@ static __inline__ void inet_reset_saddr(struct sock *sk) | |||
326 | 326 | ||
327 | #endif | 327 | #endif |
328 | 328 | ||
329 | static inline int sk_mc_loop(struct sock *sk) | ||
330 | { | ||
331 | if (!sk) | ||
332 | return 1; | ||
333 | switch (sk->sk_family) { | ||
334 | case AF_INET: | ||
335 | return inet_sk(sk)->mc_loop; | ||
336 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
337 | case AF_INET6: | ||
338 | return inet6_sk(sk)->mc_loop; | ||
339 | #endif | ||
340 | } | ||
341 | WARN_ON(1); | ||
342 | return 1; | ||
343 | } | ||
344 | |||
329 | extern int ip_call_ra_chain(struct sk_buff *skb); | 345 | extern int ip_call_ra_chain(struct sk_buff *skb); |
330 | 346 | ||
331 | /* | 347 | /* |
@@ -336,7 +352,11 @@ enum ip_defrag_users { | |||
336 | IP_DEFRAG_LOCAL_DELIVER, | 352 | IP_DEFRAG_LOCAL_DELIVER, |
337 | IP_DEFRAG_CALL_RA_CHAIN, | 353 | IP_DEFRAG_CALL_RA_CHAIN, |
338 | IP_DEFRAG_CONNTRACK_IN, | 354 | IP_DEFRAG_CONNTRACK_IN, |
355 | __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX, | ||
339 | IP_DEFRAG_CONNTRACK_OUT, | 356 | IP_DEFRAG_CONNTRACK_OUT, |
357 | __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | ||
358 | IP_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
359 | __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | ||
340 | IP_DEFRAG_VS_IN, | 360 | IP_DEFRAG_VS_IN, |
341 | IP_DEFRAG_VS_OUT, | 361 | IP_DEFRAG_VS_OUT, |
342 | IP_DEFRAG_VS_FWD | 362 | IP_DEFRAG_VS_FWD |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 257808188add..86f46c49e318 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -124,11 +124,13 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | struct fib6_walker_t { | 126 | struct fib6_walker_t { |
127 | struct fib6_walker_t *prev, *next; | 127 | struct list_head lh; |
128 | struct fib6_node *root, *node; | 128 | struct fib6_node *root, *node; |
129 | struct rt6_info *leaf; | 129 | struct rt6_info *leaf; |
130 | unsigned char state; | 130 | unsigned char state; |
131 | unsigned char prune; | 131 | unsigned char prune; |
132 | unsigned int skip; | ||
133 | unsigned int count; | ||
132 | int (*func)(struct fib6_walker_t *); | 134 | int (*func)(struct fib6_walker_t *); |
133 | void *args; | 135 | void *args; |
134 | }; | 136 | }; |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 8dc3296b7bea..fe82b1e10a29 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ | 26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ |
27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ | 27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ |
28 | 28 | ||
29 | |||
30 | /* Connections' size value needed by ip_vs_ctl.c */ | ||
31 | extern int ip_vs_conn_tab_size; | ||
32 | |||
33 | |||
29 | struct ip_vs_iphdr { | 34 | struct ip_vs_iphdr { |
30 | int len; | 35 | int len; |
31 | __u8 protocol; | 36 | __u8 protocol; |
@@ -220,6 +225,26 @@ enum { | |||
220 | }; | 225 | }; |
221 | 226 | ||
222 | /* | 227 | /* |
228 | * SCTP State Values | ||
229 | */ | ||
230 | enum ip_vs_sctp_states { | ||
231 | IP_VS_SCTP_S_NONE, | ||
232 | IP_VS_SCTP_S_INIT_CLI, | ||
233 | IP_VS_SCTP_S_INIT_SER, | ||
234 | IP_VS_SCTP_S_INIT_ACK_CLI, | ||
235 | IP_VS_SCTP_S_INIT_ACK_SER, | ||
236 | IP_VS_SCTP_S_ECHO_CLI, | ||
237 | IP_VS_SCTP_S_ECHO_SER, | ||
238 | IP_VS_SCTP_S_ESTABLISHED, | ||
239 | IP_VS_SCTP_S_SHUT_CLI, | ||
240 | IP_VS_SCTP_S_SHUT_SER, | ||
241 | IP_VS_SCTP_S_SHUT_ACK_CLI, | ||
242 | IP_VS_SCTP_S_SHUT_ACK_SER, | ||
243 | IP_VS_SCTP_S_CLOSED, | ||
244 | IP_VS_SCTP_S_LAST | ||
245 | }; | ||
246 | |||
247 | /* | ||
223 | * Delta sequence info structure | 248 | * Delta sequence info structure |
224 | * Each ip_vs_conn has 2 (output AND input seq. changes). | 249 | * Each ip_vs_conn has 2 (output AND input seq. changes). |
225 | * Only used in the VS/NAT. | 250 | * Only used in the VS/NAT. |
@@ -592,17 +617,6 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows); | |||
592 | * (from ip_vs_conn.c) | 617 | * (from ip_vs_conn.c) |
593 | */ | 618 | */ |
594 | 619 | ||
595 | /* | ||
596 | * IPVS connection entry hash table | ||
597 | */ | ||
598 | #ifndef CONFIG_IP_VS_TAB_BITS | ||
599 | #define CONFIG_IP_VS_TAB_BITS 12 | ||
600 | #endif | ||
601 | |||
602 | #define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS | ||
603 | #define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS) | ||
604 | #define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1) | ||
605 | |||
606 | enum { | 620 | enum { |
607 | IP_VS_DIR_INPUT = 0, | 621 | IP_VS_DIR_INPUT = 0, |
608 | IP_VS_DIR_OUTPUT, | 622 | IP_VS_DIR_OUTPUT, |
@@ -747,7 +761,7 @@ extern struct ip_vs_protocol ip_vs_protocol_udp; | |||
747 | extern struct ip_vs_protocol ip_vs_protocol_icmp; | 761 | extern struct ip_vs_protocol ip_vs_protocol_icmp; |
748 | extern struct ip_vs_protocol ip_vs_protocol_esp; | 762 | extern struct ip_vs_protocol ip_vs_protocol_esp; |
749 | extern struct ip_vs_protocol ip_vs_protocol_ah; | 763 | extern struct ip_vs_protocol ip_vs_protocol_ah; |
750 | 764 | extern struct ip_vs_protocol ip_vs_protocol_sctp; | |
751 | 765 | ||
752 | /* | 766 | /* |
753 | * Registering/unregistering scheduler functions | 767 | * Registering/unregistering scheduler functions |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index 2a1092abaa07..cc4f30cd7315 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
@@ -9,7 +9,7 @@ struct crypto_comp; | |||
9 | 9 | ||
10 | struct ipcomp_data { | 10 | struct ipcomp_data { |
11 | u16 threshold; | 11 | u16 threshold; |
12 | struct crypto_comp **tfms; | 12 | struct crypto_comp * __percpu *tfms; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | struct ip_comp_hdr; | 15 | struct ip_comp_hdr; |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 92db8617d188..d067db1f88c7 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -246,7 +246,9 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | |||
246 | int ip6_frag_nqueues(struct net *net); | 246 | int ip6_frag_nqueues(struct net *net); |
247 | int ip6_frag_mem(struct net *net); | 247 | int ip6_frag_mem(struct net *net); |
248 | 248 | ||
249 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ | 249 | #define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ |
250 | #define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ | ||
251 | #define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ | ||
250 | 252 | ||
251 | extern int __ipv6_addr_type(const struct in6_addr *addr); | 253 | extern int __ipv6_addr_type(const struct in6_addr *addr); |
252 | static inline int ipv6_addr_type(const struct in6_addr *addr) | 254 | static inline int ipv6_addr_type(const struct in6_addr *addr) |
@@ -350,8 +352,19 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1, | |||
350 | 352 | ||
351 | struct inet_frag_queue; | 353 | struct inet_frag_queue; |
352 | 354 | ||
355 | enum ip6_defrag_users { | ||
356 | IP6_DEFRAG_LOCAL_DELIVER, | ||
357 | IP6_DEFRAG_CONNTRACK_IN, | ||
358 | __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX, | ||
359 | IP6_DEFRAG_CONNTRACK_OUT, | ||
360 | __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX, | ||
361 | IP6_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
362 | __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX, | ||
363 | }; | ||
364 | |||
353 | struct ip6_create_arg { | 365 | struct ip6_create_arg { |
354 | __be32 id; | 366 | __be32 id; |
367 | u32 user; | ||
355 | struct in6_addr *src; | 368 | struct in6_addr *src; |
356 | struct in6_addr *dst; | 369 | struct in6_addr *dst; |
357 | }; | 370 | }; |
diff --git a/include/net/llc.h b/include/net/llc.h index 7940da1606e7..5503b74ab170 100644 --- a/include/net/llc.h +++ b/include/net/llc.h | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <linux/if_ether.h> | 16 | #include <linux/if_ether.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/rculist_nulls.h> | ||
20 | #include <linux/hash.h> | ||
21 | #include <linux/jhash.h> | ||
19 | 22 | ||
20 | #include <asm/atomic.h> | 23 | #include <asm/atomic.h> |
21 | 24 | ||
@@ -31,6 +34,12 @@ struct llc_addr { | |||
31 | #define LLC_SAP_STATE_INACTIVE 1 | 34 | #define LLC_SAP_STATE_INACTIVE 1 |
32 | #define LLC_SAP_STATE_ACTIVE 2 | 35 | #define LLC_SAP_STATE_ACTIVE 2 |
33 | 36 | ||
37 | #define LLC_SK_DEV_HASH_BITS 6 | ||
38 | #define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS) | ||
39 | |||
40 | #define LLC_SK_LADDR_HASH_BITS 6 | ||
41 | #define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS) | ||
42 | |||
34 | /** | 43 | /** |
35 | * struct llc_sap - Defines the SAP component | 44 | * struct llc_sap - Defines the SAP component |
36 | * | 45 | * |
@@ -53,18 +62,38 @@ struct llc_sap { | |||
53 | struct net_device *orig_dev); | 62 | struct net_device *orig_dev); |
54 | struct llc_addr laddr; | 63 | struct llc_addr laddr; |
55 | struct list_head node; | 64 | struct list_head node; |
56 | struct { | 65 | spinlock_t sk_lock; |
57 | rwlock_t lock; | 66 | int sk_count; |
58 | struct hlist_head list; | 67 | struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES]; |
59 | } sk_list; | 68 | struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES]; |
60 | }; | 69 | }; |
61 | 70 | ||
71 | static inline | ||
72 | struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex) | ||
73 | { | ||
74 | return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES]; | ||
75 | } | ||
76 | |||
77 | static inline | ||
78 | u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr) | ||
79 | { | ||
80 | return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0), | ||
81 | LLC_SK_LADDR_HASH_BITS); | ||
82 | } | ||
83 | |||
84 | static inline | ||
85 | struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap, | ||
86 | const struct llc_addr *laddr) | ||
87 | { | ||
88 | return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)]; | ||
89 | } | ||
90 | |||
62 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ | 91 | #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ |
63 | #define LLC_DEST_SAP 1 /* Type 1 goes here */ | 92 | #define LLC_DEST_SAP 1 /* Type 1 goes here */ |
64 | #define LLC_DEST_CONN 2 /* Type 2 goes here */ | 93 | #define LLC_DEST_CONN 2 /* Type 2 goes here */ |
65 | 94 | ||
66 | extern struct list_head llc_sap_list; | 95 | extern struct list_head llc_sap_list; |
67 | extern rwlock_t llc_sap_list_lock; | 96 | extern spinlock_t llc_sap_list_lock; |
68 | 97 | ||
69 | extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, | 98 | extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, |
70 | struct packet_type *pt, struct net_device *orig_dev); | 99 | struct packet_type *pt, struct net_device *orig_dev); |
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index e2374e34989f..2f97d8ddce92 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h | |||
@@ -76,6 +76,8 @@ struct llc_sock { | |||
76 | u32 rx_pdu_hdr; /* used for saving header of last pdu | 76 | u32 rx_pdu_hdr; /* used for saving header of last pdu |
77 | received and caused sending FRMR. | 77 | received and caused sending FRMR. |
78 | Used for resending FRMR */ | 78 | Used for resending FRMR */ |
79 | u32 cmsg_flags; | ||
80 | struct hlist_node dev_hash_node; | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | static inline struct llc_sock *llc_sk(const struct sock *sk) | 83 | static inline struct llc_sock *llc_sk(const struct sock *sk) |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 0302f31a2fb7..da1d58be31b7 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -88,12 +88,7 @@ struct neigh_statistics { | |||
88 | unsigned long unres_discards; /* number of unresolved drops */ | 88 | unsigned long unres_discards; /* number of unresolved drops */ |
89 | }; | 89 | }; |
90 | 90 | ||
91 | #define NEIGH_CACHE_STAT_INC(tbl, field) \ | 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) |
92 | do { \ | ||
93 | preempt_disable(); \ | ||
94 | (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \ | ||
95 | preempt_enable(); \ | ||
96 | } while (0) | ||
97 | 92 | ||
98 | struct neighbour { | 93 | struct neighbour { |
99 | struct neighbour *next; | 94 | struct neighbour *next; |
@@ -169,7 +164,7 @@ struct neigh_table { | |||
169 | rwlock_t lock; | 164 | rwlock_t lock; |
170 | unsigned long last_rand; | 165 | unsigned long last_rand; |
171 | struct kmem_cache *kmem_cachep; | 166 | struct kmem_cache *kmem_cachep; |
172 | struct neigh_statistics *stats; | 167 | struct neigh_statistics __percpu *stats; |
173 | struct neighbour **hash_buckets; | 168 | struct neighbour **hash_buckets; |
174 | unsigned int hash_mask; | 169 | unsigned int hash_mask; |
175 | __u32 hash_rnd; | 170 | __u32 hash_rnd; |
@@ -256,7 +251,6 @@ extern void neigh_seq_stop(struct seq_file *, void *); | |||
256 | 251 | ||
257 | extern int neigh_sysctl_register(struct net_device *dev, | 252 | extern int neigh_sysctl_register(struct net_device *dev, |
258 | struct neigh_parms *p, | 253 | struct neigh_parms *p, |
259 | int p_id, int pdev_id, | ||
260 | char *p_name, | 254 | char *p_name, |
261 | proc_handler *proc_handler); | 255 | proc_handler *proc_handler); |
262 | extern void neigh_sysctl_unregister(struct neigh_parms *p); | 256 | extern void neigh_sysctl_unregister(struct neigh_parms *p); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index f307e133d14c..82b7be4db89a 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -81,6 +81,8 @@ struct net { | |||
81 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 81 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
82 | struct netns_ct ct; | 82 | struct netns_ct ct; |
83 | #endif | 83 | #endif |
84 | struct sock *nfnl; | ||
85 | struct sock *nfnl_stash; | ||
84 | #endif | 86 | #endif |
85 | #ifdef CONFIG_XFRM | 87 | #ifdef CONFIG_XFRM |
86 | struct netns_xfrm xfrm; | 88 | struct netns_xfrm xfrm; |
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h index abc55ad75c2b..1ee717eb5b09 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h | |||
@@ -9,7 +9,7 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6; | |||
9 | 9 | ||
10 | extern int nf_ct_frag6_init(void); | 10 | extern int nf_ct_frag6_init(void); |
11 | extern void nf_ct_frag6_cleanup(void); | 11 | extern void nf_ct_frag6_cleanup(void); |
12 | extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb); | 12 | extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user); |
13 | extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, | 13 | extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, |
14 | struct net_device *in, | 14 | struct net_device *in, |
15 | struct net_device *out, | 15 | struct net_device *out, |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 5cf7270e3ffc..bde095f7e845 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -70,7 +70,7 @@ union nf_conntrack_help { | |||
70 | struct nf_conntrack_helper; | 70 | struct nf_conntrack_helper; |
71 | 71 | ||
72 | /* Must be kept in sync with the classes defined by helpers */ | 72 | /* Must be kept in sync with the classes defined by helpers */ |
73 | #define NF_CT_MAX_EXPECT_CLASSES 3 | 73 | #define NF_CT_MAX_EXPECT_CLASSES 4 |
74 | 74 | ||
75 | /* nf_conn feature for connections that have a helper */ | 75 | /* nf_conn feature for connections that have a helper */ |
76 | struct nf_conn_help { | 76 | struct nf_conn_help { |
@@ -198,7 +198,8 @@ extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int null | |||
198 | extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); | 198 | extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); |
199 | 199 | ||
200 | extern struct nf_conntrack_tuple_hash * | 200 | extern struct nf_conntrack_tuple_hash * |
201 | __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); | 201 | __nf_conntrack_find(struct net *net, u16 zone, |
202 | const struct nf_conntrack_tuple *tuple); | ||
202 | 203 | ||
203 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 204 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
204 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); | 205 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); |
@@ -267,11 +268,16 @@ extern void | |||
267 | nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); | 268 | nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); |
268 | extern void nf_conntrack_free(struct nf_conn *ct); | 269 | extern void nf_conntrack_free(struct nf_conn *ct); |
269 | extern struct nf_conn * | 270 | extern struct nf_conn * |
270 | nf_conntrack_alloc(struct net *net, | 271 | nf_conntrack_alloc(struct net *net, u16 zone, |
271 | const struct nf_conntrack_tuple *orig, | 272 | const struct nf_conntrack_tuple *orig, |
272 | const struct nf_conntrack_tuple *repl, | 273 | const struct nf_conntrack_tuple *repl, |
273 | gfp_t gfp); | 274 | gfp_t gfp); |
274 | 275 | ||
276 | static inline int nf_ct_is_template(const struct nf_conn *ct) | ||
277 | { | ||
278 | return test_bit(IPS_TEMPLATE_BIT, &ct->status); | ||
279 | } | ||
280 | |||
275 | /* It's confirmed if it is, or has been in the hash table. */ | 281 | /* It's confirmed if it is, or has been in the hash table. */ |
276 | static inline int nf_ct_is_confirmed(struct nf_conn *ct) | 282 | static inline int nf_ct_is_confirmed(struct nf_conn *ct) |
277 | { | 283 | { |
@@ -293,11 +299,11 @@ extern unsigned int nf_conntrack_htable_size; | |||
293 | extern unsigned int nf_conntrack_max; | 299 | extern unsigned int nf_conntrack_max; |
294 | 300 | ||
295 | #define NF_CT_STAT_INC(net, count) \ | 301 | #define NF_CT_STAT_INC(net, count) \ |
296 | (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) | 302 | __this_cpu_inc((net)->ct.stat->count) |
297 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ | 303 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ |
298 | do { \ | 304 | do { \ |
299 | local_bh_disable(); \ | 305 | local_bh_disable(); \ |
300 | per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ | 306 | __this_cpu_inc((net)->ct.stat->count); \ |
301 | local_bh_enable(); \ | 307 | local_bh_enable(); \ |
302 | } while (0) | 308 | } while (0) |
303 | 309 | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 5a449b44ba33..dffde8e6920e 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -49,7 +49,8 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | |||
49 | 49 | ||
50 | /* Find a connection corresponding to a tuple. */ | 50 | /* Find a connection corresponding to a tuple. */ |
51 | extern struct nf_conntrack_tuple_hash * | 51 | extern struct nf_conntrack_tuple_hash * |
52 | nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); | 52 | nf_conntrack_find_get(struct net *net, u16 zone, |
53 | const struct nf_conntrack_tuple *tuple); | ||
53 | 54 | ||
54 | extern int __nf_conntrack_confirm(struct sk_buff *skb); | 55 | extern int __nf_conntrack_confirm(struct sk_buff *skb); |
55 | 56 | ||
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 475facc3051a..96ba5f7dcab6 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -12,27 +12,12 @@ | |||
12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
13 | #include <net/netfilter/nf_conntrack_extend.h> | 13 | #include <net/netfilter/nf_conntrack_extend.h> |
14 | 14 | ||
15 | /* Connection tracking event types */ | ||
16 | enum ip_conntrack_events { | ||
17 | IPCT_NEW = 0, /* new conntrack */ | ||
18 | IPCT_RELATED = 1, /* related conntrack */ | ||
19 | IPCT_DESTROY = 2, /* destroyed conntrack */ | ||
20 | IPCT_STATUS = 3, /* status has changed */ | ||
21 | IPCT_PROTOINFO = 4, /* protocol information has changed */ | ||
22 | IPCT_HELPER = 5, /* new helper has been set */ | ||
23 | IPCT_MARK = 6, /* new mark has been set */ | ||
24 | IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */ | ||
25 | IPCT_SECMARK = 8, /* new security mark has been set */ | ||
26 | }; | ||
27 | |||
28 | enum ip_conntrack_expect_events { | ||
29 | IPEXP_NEW = 0, /* new expectation */ | ||
30 | }; | ||
31 | |||
32 | struct nf_conntrack_ecache { | 15 | struct nf_conntrack_ecache { |
33 | unsigned long cache; /* bitops want long */ | 16 | unsigned long cache; /* bitops want long */ |
34 | unsigned long missed; /* missed events */ | 17 | unsigned long missed; /* missed events */ |
35 | u32 pid; /* netlink pid of destroyer */ | 18 | u16 ctmask; /* bitmask of ct events to be delivered */ |
19 | u16 expmask; /* bitmask of expect events to be delivered */ | ||
20 | u32 pid; /* netlink pid of destroyer */ | ||
36 | }; | 21 | }; |
37 | 22 | ||
38 | static inline struct nf_conntrack_ecache * | 23 | static inline struct nf_conntrack_ecache * |
@@ -42,14 +27,24 @@ nf_ct_ecache_find(const struct nf_conn *ct) | |||
42 | } | 27 | } |
43 | 28 | ||
44 | static inline struct nf_conntrack_ecache * | 29 | static inline struct nf_conntrack_ecache * |
45 | nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) | 30 | nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) |
46 | { | 31 | { |
47 | struct net *net = nf_ct_net(ct); | 32 | struct net *net = nf_ct_net(ct); |
33 | struct nf_conntrack_ecache *e; | ||
48 | 34 | ||
49 | if (!net->ct.sysctl_events) | 35 | if (!ctmask && !expmask && net->ct.sysctl_events) { |
36 | ctmask = ~0; | ||
37 | expmask = ~0; | ||
38 | } | ||
39 | if (!ctmask && !expmask) | ||
50 | return NULL; | 40 | return NULL; |
51 | 41 | ||
52 | return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); | 42 | e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); |
43 | if (e) { | ||
44 | e->ctmask = ctmask; | ||
45 | e->expmask = expmask; | ||
46 | } | ||
47 | return e; | ||
53 | }; | 48 | }; |
54 | 49 | ||
55 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 50 | #ifdef CONFIG_NF_CONNTRACK_EVENTS |
@@ -82,6 +77,9 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | |||
82 | if (e == NULL) | 77 | if (e == NULL) |
83 | return; | 78 | return; |
84 | 79 | ||
80 | if (!(e->ctmask & (1 << event))) | ||
81 | return; | ||
82 | |||
85 | set_bit(event, &e->cache); | 83 | set_bit(event, &e->cache); |
86 | } | 84 | } |
87 | 85 | ||
@@ -92,7 +90,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
92 | int report) | 90 | int report) |
93 | { | 91 | { |
94 | int ret = 0; | 92 | int ret = 0; |
95 | struct net *net = nf_ct_net(ct); | ||
96 | struct nf_ct_event_notifier *notify; | 93 | struct nf_ct_event_notifier *notify; |
97 | struct nf_conntrack_ecache *e; | 94 | struct nf_conntrack_ecache *e; |
98 | 95 | ||
@@ -101,9 +98,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
101 | if (notify == NULL) | 98 | if (notify == NULL) |
102 | goto out_unlock; | 99 | goto out_unlock; |
103 | 100 | ||
104 | if (!net->ct.sysctl_events) | ||
105 | goto out_unlock; | ||
106 | |||
107 | e = nf_ct_ecache_find(ct); | 101 | e = nf_ct_ecache_find(ct); |
108 | if (e == NULL) | 102 | if (e == NULL) |
109 | goto out_unlock; | 103 | goto out_unlock; |
@@ -117,6 +111,9 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
117 | /* This is a resent of a destroy event? If so, skip missed */ | 111 | /* This is a resent of a destroy event? If so, skip missed */ |
118 | unsigned long missed = e->pid ? 0 : e->missed; | 112 | unsigned long missed = e->pid ? 0 : e->missed; |
119 | 113 | ||
114 | if (!((eventmask | missed) & e->ctmask)) | ||
115 | goto out_unlock; | ||
116 | |||
120 | ret = notify->fcn(eventmask | missed, &item); | 117 | ret = notify->fcn(eventmask | missed, &item); |
121 | if (unlikely(ret < 0 || missed)) { | 118 | if (unlikely(ret < 0 || missed)) { |
122 | spin_lock_bh(&ct->lock); | 119 | spin_lock_bh(&ct->lock); |
@@ -172,18 +169,19 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | |||
172 | u32 pid, | 169 | u32 pid, |
173 | int report) | 170 | int report) |
174 | { | 171 | { |
175 | struct net *net = nf_ct_exp_net(exp); | ||
176 | struct nf_exp_event_notifier *notify; | 172 | struct nf_exp_event_notifier *notify; |
173 | struct nf_conntrack_ecache *e; | ||
177 | 174 | ||
178 | rcu_read_lock(); | 175 | rcu_read_lock(); |
179 | notify = rcu_dereference(nf_expect_event_cb); | 176 | notify = rcu_dereference(nf_expect_event_cb); |
180 | if (notify == NULL) | 177 | if (notify == NULL) |
181 | goto out_unlock; | 178 | goto out_unlock; |
182 | 179 | ||
183 | if (!net->ct.sysctl_events) | 180 | e = nf_ct_ecache_find(exp->master); |
181 | if (e == NULL) | ||
184 | goto out_unlock; | 182 | goto out_unlock; |
185 | 183 | ||
186 | { | 184 | if (e->expmask & (1 << event)) { |
187 | struct nf_exp_event item = { | 185 | struct nf_exp_event item = { |
188 | .exp = exp, | 186 | .exp = exp, |
189 | .pid = pid, | 187 | .pid = pid, |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index 9a2b9cb52271..11e815084fcf 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -56,16 +56,13 @@ struct nf_conntrack_expect { | |||
56 | 56 | ||
57 | static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) | 57 | static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) |
58 | { | 58 | { |
59 | #ifdef CONFIG_NET_NS | 59 | return nf_ct_net(exp->master); |
60 | return exp->master->ct_net; /* by definition */ | ||
61 | #else | ||
62 | return &init_net; | ||
63 | #endif | ||
64 | } | 60 | } |
65 | 61 | ||
66 | struct nf_conntrack_expect_policy { | 62 | struct nf_conntrack_expect_policy { |
67 | unsigned int max_expected; | 63 | unsigned int max_expected; |
68 | unsigned int timeout; | 64 | unsigned int timeout; |
65 | const char *name; | ||
69 | }; | 66 | }; |
70 | 67 | ||
71 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 | 68 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 |
@@ -77,13 +74,16 @@ int nf_conntrack_expect_init(struct net *net); | |||
77 | void nf_conntrack_expect_fini(struct net *net); | 74 | void nf_conntrack_expect_fini(struct net *net); |
78 | 75 | ||
79 | struct nf_conntrack_expect * | 76 | struct nf_conntrack_expect * |
80 | __nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); | 77 | __nf_ct_expect_find(struct net *net, u16 zone, |
78 | const struct nf_conntrack_tuple *tuple); | ||
81 | 79 | ||
82 | struct nf_conntrack_expect * | 80 | struct nf_conntrack_expect * |
83 | nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); | 81 | nf_ct_expect_find_get(struct net *net, u16 zone, |
82 | const struct nf_conntrack_tuple *tuple); | ||
84 | 83 | ||
85 | struct nf_conntrack_expect * | 84 | struct nf_conntrack_expect * |
86 | nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); | 85 | nf_ct_find_expectation(struct net *net, u16 zone, |
86 | const struct nf_conntrack_tuple *tuple); | ||
87 | 87 | ||
88 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); | 88 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); |
89 | void nf_ct_remove_expectations(struct nf_conn *ct); | 89 | void nf_ct_remove_expectations(struct nf_conn *ct); |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index e192dc17c583..2d2a1f9a61d8 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -8,6 +8,7 @@ enum nf_ct_ext_id { | |||
8 | NF_CT_EXT_NAT, | 8 | NF_CT_EXT_NAT, |
9 | NF_CT_EXT_ACCT, | 9 | NF_CT_EXT_ACCT, |
10 | NF_CT_EXT_ECACHE, | 10 | NF_CT_EXT_ECACHE, |
11 | NF_CT_EXT_ZONE, | ||
11 | NF_CT_EXT_NUM, | 12 | NF_CT_EXT_NUM, |
12 | }; | 13 | }; |
13 | 14 | ||
@@ -15,6 +16,7 @@ enum nf_ct_ext_id { | |||
15 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat | 16 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat |
16 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter | 17 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter |
17 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | 18 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache |
19 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone | ||
18 | 20 | ||
19 | /* Extensions: optional stuff which isn't permanently in struct. */ | 21 | /* Extensions: optional stuff which isn't permanently in struct. */ |
20 | struct nf_ct_ext { | 22 | struct nf_ct_ext { |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index d015de92e03f..32c305dbdab6 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -40,14 +40,18 @@ struct nf_conntrack_helper { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | extern struct nf_conntrack_helper * | 42 | extern struct nf_conntrack_helper * |
43 | __nf_conntrack_helper_find_byname(const char *name); | 43 | __nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum); |
44 | |||
45 | extern struct nf_conntrack_helper * | ||
46 | nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum); | ||
44 | 47 | ||
45 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | 48 | extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); |
46 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); | 49 | extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); |
47 | 50 | ||
48 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); | 51 | extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); |
49 | 52 | ||
50 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); | 53 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, |
54 | gfp_t flags); | ||
51 | 55 | ||
52 | extern void nf_ct_helper_destroy(struct nf_conn *ct); | 56 | extern void nf_ct_helper_destroy(struct nf_conn *ct); |
53 | 57 | ||
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index ca6dcf3445ab..e3d3ee3c06a2 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -49,8 +49,8 @@ struct nf_conntrack_l4proto { | |||
49 | /* Called when a conntrack entry is destroyed */ | 49 | /* Called when a conntrack entry is destroyed */ |
50 | void (*destroy)(struct nf_conn *ct); | 50 | void (*destroy)(struct nf_conn *ct); |
51 | 51 | ||
52 | int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, | 52 | int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, |
53 | enum ip_conntrack_info *ctinfo, | 53 | unsigned int dataoff, enum ip_conntrack_info *ctinfo, |
54 | u_int8_t pf, unsigned int hooknum); | 54 | u_int8_t pf, unsigned int hooknum); |
55 | 55 | ||
56 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | 56 | /* Print out the per-protocol part of the tuple. Return like seq_* */ |
diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h new file mode 100644 index 000000000000..034efe8d45a5 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_zones.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _NF_CONNTRACK_ZONES_H | ||
2 | #define _NF_CONNTRACK_ZONES_H | ||
3 | |||
4 | #define NF_CT_DEFAULT_ZONE 0 | ||
5 | |||
6 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
7 | #include <net/netfilter/nf_conntrack_extend.h> | ||
8 | |||
9 | struct nf_conntrack_zone { | ||
10 | u16 id; | ||
11 | }; | ||
12 | |||
13 | static inline u16 nf_ct_zone(const struct nf_conn *ct) | ||
14 | { | ||
15 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
16 | struct nf_conntrack_zone *nf_ct_zone; | ||
17 | nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE); | ||
18 | if (nf_ct_zone) | ||
19 | return nf_ct_zone->id; | ||
20 | #endif | ||
21 | return NF_CT_DEFAULT_ZONE; | ||
22 | } | ||
23 | |||
24 | #endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */ | ||
25 | #endif /* _NF_CONNTRACK_ZONES_H */ | ||
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h index 4222220920a5..02bb6c29dc3d 100644 --- a/include/net/netfilter/nf_nat_helper.h +++ b/include/net/netfilter/nf_nat_helper.h | |||
@@ -7,13 +7,27 @@ | |||
7 | struct sk_buff; | 7 | struct sk_buff; |
8 | 8 | ||
9 | /* These return true or false. */ | 9 | /* These return true or false. */ |
10 | extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb, | 10 | extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, |
11 | struct nf_conn *ct, | 11 | struct nf_conn *ct, |
12 | enum ip_conntrack_info ctinfo, | 12 | enum ip_conntrack_info ctinfo, |
13 | unsigned int match_offset, | 13 | unsigned int match_offset, |
14 | unsigned int match_len, | 14 | unsigned int match_len, |
15 | const char *rep_buffer, | 15 | const char *rep_buffer, |
16 | unsigned int rep_len); | 16 | unsigned int rep_len, bool adjust); |
17 | |||
18 | static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, | ||
19 | struct nf_conn *ct, | ||
20 | enum ip_conntrack_info ctinfo, | ||
21 | unsigned int match_offset, | ||
22 | unsigned int match_len, | ||
23 | const char *rep_buffer, | ||
24 | unsigned int rep_len) | ||
25 | { | ||
26 | return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, | ||
27 | match_offset, match_len, | ||
28 | rep_buffer, rep_len, true); | ||
29 | } | ||
30 | |||
17 | extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, | 31 | extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, |
18 | struct nf_conn *ct, | 32 | struct nf_conn *ct, |
19 | enum ip_conntrack_info ctinfo, | 33 | enum ip_conntrack_info ctinfo, |
@@ -21,6 +35,10 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, | |||
21 | unsigned int match_len, | 35 | unsigned int match_len, |
22 | const char *rep_buffer, | 36 | const char *rep_buffer, |
23 | unsigned int rep_len); | 37 | unsigned int rep_len); |
38 | |||
39 | extern void nf_nat_set_seq_adjust(struct nf_conn *ct, | ||
40 | enum ip_conntrack_info ctinfo, | ||
41 | __be32 seq, s16 off); | ||
24 | extern int nf_nat_seq_adjust(struct sk_buff *skb, | 42 | extern int nf_nat_seq_adjust(struct sk_buff *skb, |
25 | struct nf_conn *ct, | 43 | struct nf_conn *ct, |
26 | enum ip_conntrack_info ctinfo); | 44 | enum ip_conntrack_info ctinfo); |
diff --git a/include/net/netlink.h b/include/net/netlink.h index a63b2192ac1c..f82e463c875a 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -196,7 +196,7 @@ enum { | |||
196 | * All other Exact length of attribute payload | 196 | * All other Exact length of attribute payload |
197 | * | 197 | * |
198 | * Example: | 198 | * Example: |
199 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 199 | * static const struct nla_policy my_policy[ATTR_MAX+1] = { |
200 | * [ATTR_FOO] = { .type = NLA_U16 }, | 200 | * [ATTR_FOO] = { .type = NLA_U16 }, |
201 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, | 201 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, |
202 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, | 202 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index ba1ba0c5efd1..d4958d4c6574 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
@@ -11,11 +11,13 @@ struct nf_conntrack_ecache; | |||
11 | struct netns_ct { | 11 | struct netns_ct { |
12 | atomic_t count; | 12 | atomic_t count; |
13 | unsigned int expect_count; | 13 | unsigned int expect_count; |
14 | unsigned int htable_size; | ||
15 | struct kmem_cache *nf_conntrack_cachep; | ||
14 | struct hlist_nulls_head *hash; | 16 | struct hlist_nulls_head *hash; |
15 | struct hlist_head *expect_hash; | 17 | struct hlist_head *expect_hash; |
16 | struct hlist_nulls_head unconfirmed; | 18 | struct hlist_nulls_head unconfirmed; |
17 | struct hlist_nulls_head dying; | 19 | struct hlist_nulls_head dying; |
18 | struct ip_conntrack_stat *stat; | 20 | struct ip_conntrack_stat __percpu *stat; |
19 | int sysctl_events; | 21 | int sysctl_events; |
20 | unsigned int sysctl_events_retry_timeout; | 22 | unsigned int sysctl_events_retry_timeout; |
21 | int sysctl_acct; | 23 | int sysctl_acct; |
@@ -28,5 +30,6 @@ struct netns_ct { | |||
28 | #endif | 30 | #endif |
29 | int hash_vmalloc; | 31 | int hash_vmalloc; |
30 | int expect_vmalloc; | 32 | int expect_vmalloc; |
33 | char *slabname; | ||
31 | }; | 34 | }; |
32 | #endif | 35 | #endif |
diff --git a/include/net/netns/core.h b/include/net/netns/core.h index 24d4be76bbd1..78eb1ff75475 100644 --- a/include/net/netns/core.h +++ b/include/net/netns/core.h | |||
@@ -10,7 +10,7 @@ struct netns_core { | |||
10 | 10 | ||
11 | int sysctl_somaxconn; | 11 | int sysctl_somaxconn; |
12 | 12 | ||
13 | struct prot_inuse *inuse; | 13 | struct prot_inuse __percpu *inuse; |
14 | }; | 14 | }; |
15 | 15 | ||
16 | #endif | 16 | #endif |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2eb3814d6258..2764994c9136 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -37,9 +37,12 @@ struct netns_ipv4 { | |||
37 | struct xt_table *iptable_mangle; | 37 | struct xt_table *iptable_mangle; |
38 | struct xt_table *iptable_raw; | 38 | struct xt_table *iptable_raw; |
39 | struct xt_table *arptable_filter; | 39 | struct xt_table *arptable_filter; |
40 | #ifdef CONFIG_SECURITY | ||
40 | struct xt_table *iptable_security; | 41 | struct xt_table *iptable_security; |
42 | #endif | ||
41 | struct xt_table *nat_table; | 43 | struct xt_table *nat_table; |
42 | struct hlist_head *nat_bysource; | 44 | struct hlist_head *nat_bysource; |
45 | unsigned int nat_htable_size; | ||
43 | int nat_vmalloced; | 46 | int nat_vmalloced; |
44 | #endif | 47 | #endif |
45 | 48 | ||
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index dfeb2d7c425b..1f11ebc22151 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
@@ -36,8 +36,10 @@ struct netns_ipv6 { | |||
36 | struct xt_table *ip6table_filter; | 36 | struct xt_table *ip6table_filter; |
37 | struct xt_table *ip6table_mangle; | 37 | struct xt_table *ip6table_mangle; |
38 | struct xt_table *ip6table_raw; | 38 | struct xt_table *ip6table_raw; |
39 | #ifdef CONFIG_SECURITY | ||
39 | struct xt_table *ip6table_security; | 40 | struct xt_table *ip6table_security; |
40 | #endif | 41 | #endif |
42 | #endif | ||
41 | struct rt6_info *ip6_null_entry; | 43 | struct rt6_info *ip6_null_entry; |
42 | struct rt6_statistics *rt6_stats; | 44 | struct rt6_statistics *rt6_stats; |
43 | struct timer_list ip6_fib_timer; | 45 | struct timer_list ip6_fib_timer; |
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h index 637daf698884..cb4e894c0f8d 100644 --- a/include/net/netns/packet.h +++ b/include/net/netns/packet.h | |||
@@ -4,11 +4,11 @@ | |||
4 | #ifndef __NETNS_PACKET_H__ | 4 | #ifndef __NETNS_PACKET_H__ |
5 | #define __NETNS_PACKET_H__ | 5 | #define __NETNS_PACKET_H__ |
6 | 6 | ||
7 | #include <linux/list.h> | 7 | #include <linux/rculist.h> |
8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
9 | 9 | ||
10 | struct netns_packet { | 10 | struct netns_packet { |
11 | rwlock_t sklist_lock; | 11 | spinlock_t sklist_lock; |
12 | struct hlist_head sklist; | 12 | struct hlist_head sklist; |
13 | }; | 13 | }; |
14 | 14 | ||
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 56f8e5585df7..74f119a2829a 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/wait.h> | 5 | #include <linux/wait.h> |
6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
7 | #include <linux/xfrm.h> | 7 | #include <linux/xfrm.h> |
8 | #include <net/dst_ops.h> | ||
8 | 9 | ||
9 | struct ctl_table_header; | 10 | struct ctl_table_header; |
10 | 11 | ||
@@ -42,6 +43,11 @@ struct netns_xfrm { | |||
42 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; | 43 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; |
43 | struct work_struct policy_hash_work; | 44 | struct work_struct policy_hash_work; |
44 | 45 | ||
46 | struct dst_ops xfrm4_dst_ops; | ||
47 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
48 | struct dst_ops xfrm6_dst_ops; | ||
49 | #endif | ||
50 | |||
45 | struct sock *nlsk; | 51 | struct sock *nlsk; |
46 | struct sock *nlsk_stash; | 52 | struct sock *nlsk_stash; |
47 | 53 | ||
diff --git a/include/net/netrom.h b/include/net/netrom.h index 15696b1fd30f..ab170a60e7d3 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h | |||
@@ -132,6 +132,8 @@ static __inline__ void nr_node_put(struct nr_node *nr_node) | |||
132 | static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) | 132 | static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) |
133 | { | 133 | { |
134 | if (atomic_dec_and_test(&nr_neigh->refcount)) { | 134 | if (atomic_dec_and_test(&nr_neigh->refcount)) { |
135 | if (nr_neigh->ax25) | ||
136 | ax25_cb_put(nr_neigh->ax25); | ||
135 | kfree(nr_neigh->digipeat); | 137 | kfree(nr_neigh->digipeat); |
136 | kfree(nr_neigh); | 138 | kfree(nr_neigh); |
137 | } | 139 | } |
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h index 4c61cdce4e5f..35672b1cf44a 100644 --- a/include/net/phonet/pep.h +++ b/include/net/phonet/pep.h | |||
@@ -44,6 +44,7 @@ struct pep_sock { | |||
44 | u8 rx_fc; /* RX flow control */ | 44 | u8 rx_fc; /* RX flow control */ |
45 | u8 tx_fc; /* TX flow control */ | 45 | u8 tx_fc; /* TX flow control */ |
46 | u8 init_enable; /* auto-enable at creation */ | 46 | u8 init_enable; /* auto-enable at creation */ |
47 | u8 aligned; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | static inline struct pep_sock *pep_sk(struct sock *sk) | 50 | static inline struct pep_sock *pep_sk(struct sock *sk) |
@@ -77,6 +78,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb) | |||
77 | 78 | ||
78 | enum { | 79 | enum { |
79 | PNS_PIPE_DATA = 0x20, | 80 | PNS_PIPE_DATA = 0x20, |
81 | PNS_PIPE_ALIGNED_DATA, | ||
80 | 82 | ||
81 | PNS_PEP_CONNECT_REQ = 0x40, | 83 | PNS_PEP_CONNECT_REQ = 0x40, |
82 | PNS_PEP_CONNECT_RESP, | 84 | PNS_PEP_CONNECT_RESP, |
@@ -138,6 +140,7 @@ enum { | |||
138 | PN_PIPE_SB_NEGOTIATED_FC, | 140 | PN_PIPE_SB_NEGOTIATED_FC, |
139 | PN_PIPE_SB_REQUIRED_FC_TX, | 141 | PN_PIPE_SB_REQUIRED_FC_TX, |
140 | PN_PIPE_SB_PREFERRED_FC_RX, | 142 | PN_PIPE_SB_PREFERRED_FC_RX, |
143 | PN_PIPE_SB_ALIGNED_DATA, | ||
141 | }; | 144 | }; |
142 | 145 | ||
143 | /* Phonet pipe flow control models */ | 146 | /* Phonet pipe flow control models */ |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 2d567265363e..b6cdc33b39c1 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -71,6 +71,7 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); | |||
71 | 71 | ||
72 | extern struct Qdisc_ops pfifo_qdisc_ops; | 72 | extern struct Qdisc_ops pfifo_qdisc_ops; |
73 | extern struct Qdisc_ops bfifo_qdisc_ops; | 73 | extern struct Qdisc_ops bfifo_qdisc_ops; |
74 | extern struct Qdisc_ops pfifo_head_drop_qdisc_ops; | ||
74 | 75 | ||
75 | extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); | 76 | extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); |
76 | extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, | 77 | extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index c9b50ebd9ce9..99e6e19b57c2 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -45,6 +45,8 @@ struct request_sock_ops { | |||
45 | void (*send_reset)(struct sock *sk, | 45 | void (*send_reset)(struct sock *sk, |
46 | struct sk_buff *skb); | 46 | struct sk_buff *skb); |
47 | void (*destructor)(struct request_sock *req); | 47 | void (*destructor)(struct request_sock *req); |
48 | void (*syn_ack_timeout)(struct sock *sk, | ||
49 | struct request_sock *req); | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | /* struct request_sock - mini sock to represent a connection request | 52 | /* struct request_sock - mini sock to represent a connection request |
diff --git a/include/net/route.h b/include/net/route.h index bce6dd68d27b..2c9fba7f7731 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -101,7 +101,7 @@ struct rt_cache_stat { | |||
101 | unsigned int out_hlist_search; | 101 | unsigned int out_hlist_search; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | extern struct ip_rt_acct *ip_rt_acct; | 104 | extern struct ip_rt_acct __percpu *ip_rt_acct; |
105 | 105 | ||
106 | struct in_device; | 106 | struct in_device; |
107 | extern int ip_rt_init(void); | 107 | extern int ip_rt_init(void); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index dad558bc06fa..67dc08eaaa45 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -427,6 +427,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch) | |||
427 | return __qdisc_dequeue_head(sch, &sch->q); | 427 | return __qdisc_dequeue_head(sch, &sch->q); |
428 | } | 428 | } |
429 | 429 | ||
430 | static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, | ||
431 | struct sk_buff_head *list) | ||
432 | { | ||
433 | struct sk_buff *skb = __qdisc_dequeue_head(sch, list); | ||
434 | |||
435 | if (likely(skb != NULL)) { | ||
436 | unsigned int len = qdisc_pkt_len(skb); | ||
437 | kfree_skb(skb); | ||
438 | return len; | ||
439 | } | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch) | ||
445 | { | ||
446 | return __qdisc_queue_drop_head(sch, &sch->q); | ||
447 | } | ||
448 | |||
430 | static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, | 449 | static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, |
431 | struct sk_buff_head *list) | 450 | struct sk_buff_head *list) |
432 | { | 451 | { |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 7571e32723bf..ff3017744711 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -989,7 +989,7 @@ struct sctp_transport { | |||
989 | int init_sent_count; | 989 | int init_sent_count; |
990 | 990 | ||
991 | /* state : The current state of this destination, | 991 | /* state : The current state of this destination, |
992 | * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. | 992 | * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKNOWN. |
993 | */ | 993 | */ |
994 | int state; | 994 | int state; |
995 | 995 | ||
diff --git a/include/net/snmp.h b/include/net/snmp.h index 8c842e06bec8..692ee0061dc4 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -32,7 +32,7 @@ | |||
32 | * - name of entries. | 32 | * - name of entries. |
33 | */ | 33 | */ |
34 | struct snmp_mib { | 34 | struct snmp_mib { |
35 | char *name; | 35 | const char *name; |
36 | int entry; | 36 | int entry; |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -129,52 +129,42 @@ struct linux_xfrm_mib { | |||
129 | * nonlocked_atomic_inc() primitives -AK | 129 | * nonlocked_atomic_inc() primitives -AK |
130 | */ | 130 | */ |
131 | #define DEFINE_SNMP_STAT(type, name) \ | 131 | #define DEFINE_SNMP_STAT(type, name) \ |
132 | __typeof__(type) *name[2] | 132 | __typeof__(type) __percpu *name[2] |
133 | #define DECLARE_SNMP_STAT(type, name) \ | 133 | #define DECLARE_SNMP_STAT(type, name) \ |
134 | extern __typeof__(type) *name[2] | 134 | extern __typeof__(type) __percpu *name[2] |
135 | 135 | ||
136 | #define SNMP_STAT_BHPTR(name) (name[0]) | 136 | #define SNMP_STAT_BHPTR(name) (name[0]) |
137 | #define SNMP_STAT_USRPTR(name) (name[1]) | 137 | #define SNMP_STAT_USRPTR(name) (name[1]) |
138 | 138 | ||
139 | #define SNMP_INC_STATS_BH(mib, field) \ | 139 | #define SNMP_INC_STATS_BH(mib, field) \ |
140 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 140 | __this_cpu_inc(mib[0]->mibs[field]) |
141 | #define SNMP_INC_STATS_USER(mib, field) \ | 141 | #define SNMP_INC_STATS_USER(mib, field) \ |
142 | do { \ | 142 | this_cpu_inc(mib[1]->mibs[field]) |
143 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | 143 | #define SNMP_INC_STATS(mib, field) \ |
144 | put_cpu(); \ | 144 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) |
145 | } while (0) | 145 | #define SNMP_DEC_STATS(mib, field) \ |
146 | #define SNMP_INC_STATS(mib, field) \ | 146 | this_cpu_dec(mib[!in_softirq()]->mibs[field]) |
147 | do { \ | 147 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
148 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | 148 | __this_cpu_add(mib[0]->mibs[field], addend) |
149 | put_cpu(); \ | 149 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
150 | } while (0) | 150 | this_cpu_add(mib[1]->mibs[field], addend) |
151 | #define SNMP_DEC_STATS(mib, field) \ | 151 | /* |
152 | do { \ | 152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" |
153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | 153 | * to make @ptr a non-percpu pointer. |
154 | put_cpu(); \ | 154 | */ |
155 | } while (0) | ||
156 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
157 | do { \ | ||
158 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ | ||
159 | put_cpu(); \ | ||
160 | } while (0) | ||
161 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | ||
162 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | ||
163 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | ||
164 | do { \ | ||
165 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
166 | put_cpu(); \ | ||
167 | } while (0) | ||
168 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | 155 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ |
169 | do { \ | 156 | do { \ |
170 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ | 157 | __typeof__(*mib[0]) *ptr; \ |
158 | preempt_disable(); \ | ||
159 | ptr = this_cpu_ptr((mib)[!in_softirq()]); \ | ||
171 | ptr->mibs[basefield##PKTS]++; \ | 160 | ptr->mibs[basefield##PKTS]++; \ |
172 | ptr->mibs[basefield##OCTETS] += addend;\ | 161 | ptr->mibs[basefield##OCTETS] += addend;\ |
173 | put_cpu(); \ | 162 | preempt_enable(); \ |
174 | } while (0) | 163 | } while (0) |
175 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | 164 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ |
176 | do { \ | 165 | do { \ |
177 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ | 166 | __typeof__(*mib[0]) *ptr = \ |
167 | __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
178 | ptr->mibs[basefield##PKTS]++; \ | 168 | ptr->mibs[basefield##PKTS]++; \ |
179 | ptr->mibs[basefield##OCTETS] += addend;\ | 169 | ptr->mibs[basefield##OCTETS] += addend;\ |
180 | } while (0) | 170 | } while (0) |
diff --git a/include/net/sock.h b/include/net/sock.h index 3f1a4804bb3f..6cb1676e409a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -317,6 +317,11 @@ struct sock { | |||
317 | /* | 317 | /* |
318 | * Hashed lists helper routines | 318 | * Hashed lists helper routines |
319 | */ | 319 | */ |
320 | static inline struct sock *sk_entry(const struct hlist_node *node) | ||
321 | { | ||
322 | return hlist_entry(node, struct sock, sk_node); | ||
323 | } | ||
324 | |||
320 | static inline struct sock *__sk_head(const struct hlist_head *head) | 325 | static inline struct sock *__sk_head(const struct hlist_head *head) |
321 | { | 326 | { |
322 | return hlist_entry(head->first, struct sock, sk_node); | 327 | return hlist_entry(head->first, struct sock, sk_node); |
@@ -376,6 +381,7 @@ static __inline__ void __sk_del_node(struct sock *sk) | |||
376 | __hlist_del(&sk->sk_node); | 381 | __hlist_del(&sk->sk_node); |
377 | } | 382 | } |
378 | 383 | ||
384 | /* NB: equivalent to hlist_del_init_rcu */ | ||
379 | static __inline__ int __sk_del_node_init(struct sock *sk) | 385 | static __inline__ int __sk_del_node_init(struct sock *sk) |
380 | { | 386 | { |
381 | if (sk_hashed(sk)) { | 387 | if (sk_hashed(sk)) { |
@@ -416,6 +422,7 @@ static __inline__ int sk_del_node_init(struct sock *sk) | |||
416 | } | 422 | } |
417 | return rc; | 423 | return rc; |
418 | } | 424 | } |
425 | #define sk_del_node_init_rcu(sk) sk_del_node_init(sk) | ||
419 | 426 | ||
420 | static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) | 427 | static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) |
421 | { | 428 | { |
@@ -449,6 +456,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list) | |||
449 | __sk_add_node(sk, list); | 456 | __sk_add_node(sk, list); |
450 | } | 457 | } |
451 | 458 | ||
459 | static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list) | ||
460 | { | ||
461 | sock_hold(sk); | ||
462 | hlist_add_head_rcu(&sk->sk_node, list); | ||
463 | } | ||
464 | |||
452 | static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) | 465 | static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) |
453 | { | 466 | { |
454 | hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); | 467 | hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); |
@@ -473,6 +486,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk, | |||
473 | 486 | ||
474 | #define sk_for_each(__sk, node, list) \ | 487 | #define sk_for_each(__sk, node, list) \ |
475 | hlist_for_each_entry(__sk, node, list, sk_node) | 488 | hlist_for_each_entry(__sk, node, list, sk_node) |
489 | #define sk_for_each_rcu(__sk, node, list) \ | ||
490 | hlist_for_each_entry_rcu(__sk, node, list, sk_node) | ||
476 | #define sk_nulls_for_each(__sk, node, list) \ | 491 | #define sk_nulls_for_each(__sk, node, list) \ |
477 | hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) | 492 | hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) |
478 | #define sk_nulls_for_each_rcu(__sk, node, list) \ | 493 | #define sk_nulls_for_each_rcu(__sk, node, list) \ |
@@ -1044,7 +1059,7 @@ extern void sk_common_release(struct sock *sk); | |||
1044 | extern void sock_init_data(struct socket *sock, struct sock *sk); | 1059 | extern void sock_init_data(struct socket *sock, struct sock *sk); |
1045 | 1060 | ||
1046 | /** | 1061 | /** |
1047 | * sk_filter_release: Release a socket filter | 1062 | * sk_filter_release - release a socket filter |
1048 | * @fp: filter to remove | 1063 | * @fp: filter to remove |
1049 | * | 1064 | * |
1050 | * Remove a filter from a socket and release its resources. | 1065 | * Remove a filter from a socket and release its resources. |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 0248c181a92c..56f0aec40ed6 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
196 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ | 196 | #define TCP_NAGLE_CORK 2 /* Socket is corked */ |
197 | #define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ | 197 | #define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ |
198 | 198 | ||
199 | /* TCP thin-stream limits */ | ||
200 | #define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ | ||
201 | |||
199 | extern struct inet_timewait_death_row tcp_death_row; | 202 | extern struct inet_timewait_death_row tcp_death_row; |
200 | 203 | ||
201 | /* sysctl variables for tcp */ | 204 | /* sysctl variables for tcp */ |
@@ -241,6 +244,8 @@ extern int sysctl_tcp_workaround_signed_windows; | |||
241 | extern int sysctl_tcp_slow_start_after_idle; | 244 | extern int sysctl_tcp_slow_start_after_idle; |
242 | extern int sysctl_tcp_max_ssthresh; | 245 | extern int sysctl_tcp_max_ssthresh; |
243 | extern int sysctl_tcp_cookie_size; | 246 | extern int sysctl_tcp_cookie_size; |
247 | extern int sysctl_tcp_thin_linear_timeouts; | ||
248 | extern int sysctl_tcp_thin_dupack; | ||
244 | 249 | ||
245 | extern atomic_t tcp_memory_allocated; | 250 | extern atomic_t tcp_memory_allocated; |
246 | extern struct percpu_counter tcp_sockets_allocated; | 251 | extern struct percpu_counter tcp_sockets_allocated; |
@@ -400,6 +405,8 @@ extern int compat_tcp_setsockopt(struct sock *sk, | |||
400 | int level, int optname, | 405 | int level, int optname, |
401 | char __user *optval, unsigned int optlen); | 406 | char __user *optval, unsigned int optlen); |
402 | extern void tcp_set_keepalive(struct sock *sk, int val); | 407 | extern void tcp_set_keepalive(struct sock *sk, int val); |
408 | extern void tcp_syn_ack_timeout(struct sock *sk, | ||
409 | struct request_sock *req); | ||
403 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | 410 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, |
404 | struct msghdr *msg, | 411 | struct msghdr *msg, |
405 | size_t len, int nonblock, | 412 | size_t len, int nonblock, |
@@ -408,8 +415,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
408 | extern void tcp_parse_options(struct sk_buff *skb, | 415 | extern void tcp_parse_options(struct sk_buff *skb, |
409 | struct tcp_options_received *opt_rx, | 416 | struct tcp_options_received *opt_rx, |
410 | u8 **hvpp, | 417 | u8 **hvpp, |
411 | int estab, | 418 | int estab); |
412 | struct dst_entry *dst); | ||
413 | 419 | ||
414 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); | 420 | extern u8 *tcp_parse_md5sig_option(struct tcphdr *th); |
415 | 421 | ||
@@ -857,13 +863,6 @@ static inline void tcp_check_probe_timer(struct sock *sk) | |||
857 | icsk->icsk_rto, TCP_RTO_MAX); | 863 | icsk->icsk_rto, TCP_RTO_MAX); |
858 | } | 864 | } |
859 | 865 | ||
860 | static inline void tcp_push_pending_frames(struct sock *sk) | ||
861 | { | ||
862 | struct tcp_sock *tp = tcp_sk(sk); | ||
863 | |||
864 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); | ||
865 | } | ||
866 | |||
867 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) | 866 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) |
868 | { | 867 | { |
869 | tp->snd_wl1 = seq; | 868 | tp->snd_wl1 = seq; |
@@ -973,7 +972,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | |||
973 | /* Determine a window scaling and initial window to offer. */ | 972 | /* Determine a window scaling and initial window to offer. */ |
974 | extern void tcp_select_initial_window(int __space, __u32 mss, | 973 | extern void tcp_select_initial_window(int __space, __u32 mss, |
975 | __u32 *rcv_wnd, __u32 *window_clamp, | 974 | __u32 *rcv_wnd, __u32 *window_clamp, |
976 | int wscale_ok, __u8 *rcv_wscale); | 975 | int wscale_ok, __u8 *rcv_wscale, |
976 | __u32 init_rcv_wnd); | ||
977 | 977 | ||
978 | static inline int tcp_win_from_space(int space) | 978 | static inline int tcp_win_from_space(int space) |
979 | { | 979 | { |
@@ -1194,7 +1194,7 @@ extern int tcp_v4_md5_do_del(struct sock *sk, | |||
1194 | #define tcp_twsk_md5_key(twsk) NULL | 1194 | #define tcp_twsk_md5_key(twsk) NULL |
1195 | #endif | 1195 | #endif |
1196 | 1196 | ||
1197 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); | 1197 | extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); |
1198 | extern void tcp_free_md5sig_pool(void); | 1198 | extern void tcp_free_md5sig_pool(void); |
1199 | 1199 | ||
1200 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); | 1200 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); |
@@ -1261,7 +1261,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu | |||
1261 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | 1261 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ |
1262 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) | 1262 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) |
1263 | 1263 | ||
1264 | |||
1265 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1264 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1266 | { | 1265 | { |
1267 | return sk->sk_send_head; | 1266 | return sk->sk_send_head; |
@@ -1344,6 +1343,15 @@ static inline int tcp_write_queue_empty(struct sock *sk) | |||
1344 | return skb_queue_empty(&sk->sk_write_queue); | 1343 | return skb_queue_empty(&sk->sk_write_queue); |
1345 | } | 1344 | } |
1346 | 1345 | ||
1346 | static inline void tcp_push_pending_frames(struct sock *sk) | ||
1347 | { | ||
1348 | if (tcp_send_head(sk)) { | ||
1349 | struct tcp_sock *tp = tcp_sk(sk); | ||
1350 | |||
1351 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); | ||
1352 | } | ||
1353 | } | ||
1354 | |||
1347 | /* Start sequence of the highest skb with SACKed bit, valid only if | 1355 | /* Start sequence of the highest skb with SACKed bit, valid only if |
1348 | * sacked > 0 or when the caller has ensured validity by itself. | 1356 | * sacked > 0 or when the caller has ensured validity by itself. |
1349 | */ | 1357 | */ |
@@ -1383,6 +1391,14 @@ static inline void tcp_highest_sack_combine(struct sock *sk, | |||
1383 | tcp_sk(sk)->highest_sack = new; | 1391 | tcp_sk(sk)->highest_sack = new; |
1384 | } | 1392 | } |
1385 | 1393 | ||
1394 | /* Determines whether this is a thin stream (which may suffer from | ||
1395 | * increased latency). Used to trigger latency-reducing mechanisms. | ||
1396 | */ | ||
1397 | static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp) | ||
1398 | { | ||
1399 | return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp); | ||
1400 | } | ||
1401 | |||
1386 | /* /proc */ | 1402 | /* /proc */ |
1387 | enum tcp_seq_states { | 1403 | enum tcp_seq_states { |
1388 | TCP_SEQ_STATE_LISTENING, | 1404 | TCP_SEQ_STATE_LISTENING, |
diff --git a/include/net/wimax.h b/include/net/wimax.h index d69c4a7a1267..3461aa1df1e0 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
@@ -79,7 +79,7 @@ | |||
79 | * drivers have to only report state changes due to external | 79 | * drivers have to only report state changes due to external |
80 | * conditions. | 80 | * conditions. |
81 | * | 81 | * |
82 | * All API operations are 'atomic', serialized thorough a mutex in the | 82 | * All API operations are 'atomic', serialized through a mutex in the |
83 | * `struct wimax_dev`. | 83 | * `struct wimax_dev`. |
84 | * | 84 | * |
85 | * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK | 85 | * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 6d85861ab990..a7df3275b860 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -140,6 +140,7 @@ struct xfrm_state { | |||
140 | 140 | ||
141 | struct xfrm_id id; | 141 | struct xfrm_id id; |
142 | struct xfrm_selector sel; | 142 | struct xfrm_selector sel; |
143 | struct xfrm_mark mark; | ||
143 | 144 | ||
144 | u32 genid; | 145 | u32 genid; |
145 | 146 | ||
@@ -317,8 +318,8 @@ extern void xfrm_state_delete_tunnel(struct xfrm_state *x); | |||
317 | struct xfrm_type { | 318 | struct xfrm_type { |
318 | char *description; | 319 | char *description; |
319 | struct module *owner; | 320 | struct module *owner; |
320 | __u8 proto; | 321 | u8 proto; |
321 | __u8 flags; | 322 | u8 flags; |
322 | #define XFRM_TYPE_NON_FRAGMENT 1 | 323 | #define XFRM_TYPE_NON_FRAGMENT 1 |
323 | #define XFRM_TYPE_REPLAY_PROT 2 | 324 | #define XFRM_TYPE_REPLAY_PROT 2 |
324 | #define XFRM_TYPE_LOCAL_COADDR 4 | 325 | #define XFRM_TYPE_LOCAL_COADDR 4 |
@@ -434,24 +435,24 @@ struct xfrm_tmpl { | |||
434 | 435 | ||
435 | unsigned short encap_family; | 436 | unsigned short encap_family; |
436 | 437 | ||
437 | __u32 reqid; | 438 | u32 reqid; |
438 | 439 | ||
439 | /* Mode: transport, tunnel etc. */ | 440 | /* Mode: transport, tunnel etc. */ |
440 | __u8 mode; | 441 | u8 mode; |
441 | 442 | ||
442 | /* Sharing mode: unique, this session only, this user only etc. */ | 443 | /* Sharing mode: unique, this session only, this user only etc. */ |
443 | __u8 share; | 444 | u8 share; |
444 | 445 | ||
445 | /* May skip this transfomration if no SA is found */ | 446 | /* May skip this transfomration if no SA is found */ |
446 | __u8 optional; | 447 | u8 optional; |
447 | 448 | ||
448 | /* Skip aalgos/ealgos/calgos checks. */ | 449 | /* Skip aalgos/ealgos/calgos checks. */ |
449 | __u8 allalgs; | 450 | u8 allalgs; |
450 | 451 | ||
451 | /* Bit mask of algos allowed for acquisition */ | 452 | /* Bit mask of algos allowed for acquisition */ |
452 | __u32 aalgos; | 453 | u32 aalgos; |
453 | __u32 ealgos; | 454 | u32 ealgos; |
454 | __u32 calgos; | 455 | u32 calgos; |
455 | }; | 456 | }; |
456 | 457 | ||
457 | #define XFRM_MAX_DEPTH 6 | 458 | #define XFRM_MAX_DEPTH 6 |
@@ -481,6 +482,7 @@ struct xfrm_policy { | |||
481 | 482 | ||
482 | u32 priority; | 483 | u32 priority; |
483 | u32 index; | 484 | u32 index; |
485 | struct xfrm_mark mark; | ||
484 | struct xfrm_selector selector; | 486 | struct xfrm_selector selector; |
485 | struct xfrm_lifetime_cfg lft; | 487 | struct xfrm_lifetime_cfg lft; |
486 | struct xfrm_lifetime_cur curlft; | 488 | struct xfrm_lifetime_cur curlft; |
@@ -770,7 +772,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
770 | int pdw; | 772 | int pdw; |
771 | int pbi; | 773 | int pbi; |
772 | 774 | ||
773 | pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ | 775 | pdw = prefixlen >> 5; /* num of whole u32 in prefix */ |
774 | pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ | 776 | pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ |
775 | 777 | ||
776 | if (pdw) | 778 | if (pdw) |
@@ -1259,7 +1261,7 @@ struct xfrm_algo_desc { | |||
1259 | /* XFRM tunnel handlers. */ | 1261 | /* XFRM tunnel handlers. */ |
1260 | struct xfrm_tunnel { | 1262 | struct xfrm_tunnel { |
1261 | int (*handler)(struct sk_buff *skb); | 1263 | int (*handler)(struct sk_buff *skb); |
1262 | int (*err_handler)(struct sk_buff *skb, __u32 info); | 1264 | int (*err_handler)(struct sk_buff *skb, u32 info); |
1263 | 1265 | ||
1264 | struct xfrm_tunnel *next; | 1266 | struct xfrm_tunnel *next; |
1265 | int priority; | 1267 | int priority; |
@@ -1317,7 +1319,7 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t | |||
1317 | struct flowi *fl, struct xfrm_tmpl *tmpl, | 1319 | struct flowi *fl, struct xfrm_tmpl *tmpl, |
1318 | struct xfrm_policy *pol, int *err, | 1320 | struct xfrm_policy *pol, int *err, |
1319 | unsigned short family); | 1321 | unsigned short family); |
1320 | extern struct xfrm_state * xfrm_stateonly_find(struct net *net, | 1322 | extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, |
1321 | xfrm_address_t *daddr, | 1323 | xfrm_address_t *daddr, |
1322 | xfrm_address_t *saddr, | 1324 | xfrm_address_t *saddr, |
1323 | unsigned short family, | 1325 | unsigned short family, |
@@ -1326,8 +1328,14 @@ extern int xfrm_state_check_expire(struct xfrm_state *x); | |||
1326 | extern void xfrm_state_insert(struct xfrm_state *x); | 1328 | extern void xfrm_state_insert(struct xfrm_state *x); |
1327 | extern int xfrm_state_add(struct xfrm_state *x); | 1329 | extern int xfrm_state_add(struct xfrm_state *x); |
1328 | extern int xfrm_state_update(struct xfrm_state *x); | 1330 | extern int xfrm_state_update(struct xfrm_state *x); |
1329 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); | 1331 | extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, |
1330 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | 1332 | xfrm_address_t *daddr, __be32 spi, |
1333 | u8 proto, unsigned short family); | ||
1334 | extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, | ||
1335 | xfrm_address_t *daddr, | ||
1336 | xfrm_address_t *saddr, | ||
1337 | u8 proto, | ||
1338 | unsigned short family); | ||
1331 | #ifdef CONFIG_XFRM_SUB_POLICY | 1339 | #ifdef CONFIG_XFRM_SUB_POLICY |
1332 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | 1340 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, |
1333 | int n, unsigned short family); | 1341 | int n, unsigned short family); |
@@ -1364,11 +1372,12 @@ struct xfrmk_spdinfo { | |||
1364 | u32 spdhmcnt; | 1372 | u32 spdhmcnt; |
1365 | }; | 1373 | }; |
1366 | 1374 | ||
1367 | extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); | 1375 | extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, |
1376 | u32 seq); | ||
1368 | extern int xfrm_state_delete(struct xfrm_state *x); | 1377 | extern int xfrm_state_delete(struct xfrm_state *x); |
1369 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); | 1378 | extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); |
1370 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); | 1379 | extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
1371 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | 1380 | extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
1372 | extern int xfrm_replay_check(struct xfrm_state *x, | 1381 | extern int xfrm_replay_check(struct xfrm_state *x, |
1373 | struct sk_buff *skb, __be32 seq); | 1382 | struct sk_buff *skb, __be32 seq); |
1374 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 1383 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
@@ -1408,9 +1417,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | |||
1408 | xfrm_address_t *saddr, u8 proto); | 1417 | xfrm_address_t *saddr, u8 proto); |
1409 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); | 1418 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
1410 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); | 1419 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
1411 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 1420 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); |
1412 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 1421 | extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr); |
1413 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 1422 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); |
1414 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1423 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1415 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1424 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1416 | extern int xfrm6_output(struct sk_buff *skb); | 1425 | extern int xfrm6_output(struct sk_buff *skb); |
@@ -1441,17 +1450,20 @@ extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, | |||
1441 | int (*func)(struct xfrm_policy *, int, int, void*), void *); | 1450 | int (*func)(struct xfrm_policy *, int, int, void*), void *); |
1442 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); | 1451 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); |
1443 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 1452 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
1444 | struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, | 1453 | struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, |
1454 | u8 type, int dir, | ||
1445 | struct xfrm_selector *sel, | 1455 | struct xfrm_selector *sel, |
1446 | struct xfrm_sec_ctx *ctx, int delete, | 1456 | struct xfrm_sec_ctx *ctx, int delete, |
1447 | int *err); | 1457 | int *err); |
1448 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); | 1458 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err); |
1449 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); | 1459 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); |
1450 | u32 xfrm_get_acqseq(void); | 1460 | u32 xfrm_get_acqseq(void); |
1451 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 1461 | extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
1452 | struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto, | 1462 | struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, |
1453 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1463 | u8 mode, u32 reqid, u8 proto, |
1454 | int create, unsigned short family); | 1464 | xfrm_address_t *daddr, |
1465 | xfrm_address_t *saddr, int create, | ||
1466 | unsigned short family); | ||
1455 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1467 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
1456 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, | 1468 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, |
1457 | struct flowi *fl, int family, int strict); | 1469 | struct flowi *fl, int family, int strict); |
@@ -1500,7 +1512,7 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | |||
1500 | switch (family) { | 1512 | switch (family) { |
1501 | default: | 1513 | default: |
1502 | case AF_INET: | 1514 | case AF_INET: |
1503 | return (__force __u32)a->a4 - (__force __u32)b->a4; | 1515 | return (__force u32)a->a4 - (__force u32)b->a4; |
1504 | case AF_INET6: | 1516 | case AF_INET6: |
1505 | return ipv6_addr_cmp((struct in6_addr *)a, | 1517 | return ipv6_addr_cmp((struct in6_addr *)a, |
1506 | (struct in6_addr *)b); | 1518 | (struct in6_addr *)b); |
@@ -1570,4 +1582,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | |||
1570 | } | 1582 | } |
1571 | #endif | 1583 | #endif |
1572 | 1584 | ||
1585 | static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m) | ||
1586 | { | ||
1587 | if (attrs[XFRMA_MARK]) | ||
1588 | memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m)); | ||
1589 | else | ||
1590 | m->v = m->m = 0; | ||
1591 | |||
1592 | return m->v & m->m; | ||
1593 | } | ||
1594 | |||
1595 | static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m) | ||
1596 | { | ||
1597 | if (m->m | m->v) | ||
1598 | NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); | ||
1599 | return 0; | ||
1600 | |||
1601 | nla_put_failure: | ||
1602 | return -1; | ||
1603 | } | ||
1604 | |||
1573 | #endif /* _NET_XFRM_H */ | 1605 | #endif /* _NET_XFRM_H */ |
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index afc2bfb9e917..75fa3530345b 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h | |||
@@ -126,8 +126,8 @@ typedef struct irq_req_t { | |||
126 | #define IRQ_TYPE_TIME 0x01 | 126 | #define IRQ_TYPE_TIME 0x01 |
127 | #define IRQ_TYPE_DYNAMIC_SHARING 0x02 | 127 | #define IRQ_TYPE_DYNAMIC_SHARING 0x02 |
128 | #define IRQ_FORCED_PULSE 0x04 | 128 | #define IRQ_FORCED_PULSE 0x04 |
129 | #define IRQ_FIRST_SHARED 0x08 | 129 | #define IRQ_FIRST_SHARED 0x08 /* unused */ |
130 | //#define IRQ_HANDLE_PRESENT 0x10 | 130 | #define IRQ_HANDLE_PRESENT 0x10 /* unused */ |
131 | #define IRQ_PULSE_ALLOCATED 0x100 | 131 | #define IRQ_PULSE_ALLOCATED 0x100 |
132 | 132 | ||
133 | /* Bits in IRQInfo1 field */ | 133 | /* Bits in IRQInfo1 field */ |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index d403c12f7978..ee148573c114 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -82,7 +82,7 @@ struct pcmcia_device { | |||
82 | /* the hardware "function" device; certain subdevices can | 82 | /* the hardware "function" device; certain subdevices can |
83 | * share one hardware "function" device. */ | 83 | * share one hardware "function" device. */ |
84 | u8 func; | 84 | u8 func; |
85 | struct config_t* function_config; | 85 | struct config_t *function_config; |
86 | 86 | ||
87 | struct list_head socket_device_list; | 87 | struct list_head socket_device_list; |
88 | 88 | ||
@@ -121,14 +121,14 @@ struct pcmcia_device { | |||
121 | u16 manf_id; | 121 | u16 manf_id; |
122 | u16 card_id; | 122 | u16 card_id; |
123 | 123 | ||
124 | char * prod_id[4]; | 124 | char *prod_id[4]; |
125 | 125 | ||
126 | u64 dma_mask; | 126 | u64 dma_mask; |
127 | struct device dev; | 127 | struct device dev; |
128 | 128 | ||
129 | #ifdef CONFIG_PCMCIA_IOCTL | 129 | #ifdef CONFIG_PCMCIA_IOCTL |
130 | /* device driver wanted by cardmgr */ | 130 | /* device driver wanted by cardmgr */ |
131 | struct pcmcia_driver * cardmgr; | 131 | struct pcmcia_driver *cardmgr; |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | /* data private to drivers */ | 134 | /* data private to drivers */ |
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h index 8d19b9401a5b..0fa06e5d5376 100644 --- a/include/pcmcia/mem_op.h +++ b/include/pcmcia/mem_op.h | |||
@@ -15,8 +15,8 @@ | |||
15 | #ifndef _LINUX_MEM_OP_H | 15 | #ifndef _LINUX_MEM_OP_H |
16 | #define _LINUX_MEM_OP_H | 16 | #define _LINUX_MEM_OP_H |
17 | 17 | ||
18 | #include <linux/io.h> | ||
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include <asm/io.h> | ||
20 | 20 | ||
21 | /* | 21 | /* |
22 | If UNSAFE_MEMCPY is defined, we use the (optimized) system routines | 22 | If UNSAFE_MEMCPY is defined, we use the (optimized) system routines |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 7c23be706f12..cbfba885eb85 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
@@ -154,7 +154,7 @@ struct pcmcia_socket { | |||
154 | struct list_head socket_list; | 154 | struct list_head socket_list; |
155 | struct completion socket_released; | 155 | struct completion socket_released; |
156 | 156 | ||
157 | /* deprecated */ | 157 | /* deprecated */ |
158 | unsigned int sock; /* socket number */ | 158 | unsigned int sock; /* socket number */ |
159 | 159 | ||
160 | 160 | ||
@@ -164,7 +164,7 @@ struct pcmcia_socket { | |||
164 | u_int map_size; | 164 | u_int map_size; |
165 | u_int io_offset; | 165 | u_int io_offset; |
166 | u_int pci_irq; | 166 | u_int pci_irq; |
167 | struct pci_dev * cb_dev; | 167 | struct pci_dev *cb_dev; |
168 | 168 | ||
169 | 169 | ||
170 | /* socket setup is done so resources should be able to be allocated. | 170 | /* socket setup is done so resources should be able to be allocated. |
@@ -179,9 +179,9 @@ struct pcmcia_socket { | |||
179 | u8 reserved:5; | 179 | u8 reserved:5; |
180 | 180 | ||
181 | /* socket operations */ | 181 | /* socket operations */ |
182 | struct pccard_operations * ops; | 182 | struct pccard_operations *ops; |
183 | struct pccard_resource_ops * resource_ops; | 183 | struct pccard_resource_ops *resource_ops; |
184 | void * resource_data; | 184 | void *resource_data; |
185 | 185 | ||
186 | /* Zoom video behaviour is so chip specific its not worth adding | 186 | /* Zoom video behaviour is so chip specific its not worth adding |
187 | this to _ops */ | 187 | this to _ops */ |
@@ -245,7 +245,7 @@ struct pcmcia_socket { | |||
245 | 245 | ||
246 | /* cardbus (32-bit) */ | 246 | /* cardbus (32-bit) */ |
247 | #ifdef CONFIG_CARDBUS | 247 | #ifdef CONFIG_CARDBUS |
248 | struct resource * cb_cis_res; | 248 | struct resource *cb_cis_res; |
249 | void __iomem *cb_cis_virt; | 249 | void __iomem *cb_cis_virt; |
250 | #endif /* CONFIG_CARDBUS */ | 250 | #endif /* CONFIG_CARDBUS */ |
251 | 251 | ||
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 483057b2f4b4..fa0d52b8e622 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/in.h> | 37 | #include <linux/in.h> |
38 | #include <linux/in6.h> | 38 | #include <linux/in6.h> |
39 | #include <linux/if_arp.h> | ||
39 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
40 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
41 | #include <rdma/ib_verbs.h> | 42 | #include <rdma/ib_verbs.h> |
@@ -60,8 +61,8 @@ struct rdma_dev_addr { | |||
60 | unsigned char src_dev_addr[MAX_ADDR_LEN]; | 61 | unsigned char src_dev_addr[MAX_ADDR_LEN]; |
61 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; | 62 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; |
62 | unsigned char broadcast[MAX_ADDR_LEN]; | 63 | unsigned char broadcast[MAX_ADDR_LEN]; |
63 | enum rdma_node_type dev_type; | 64 | unsigned short dev_type; |
64 | struct net_device *src_dev; | 65 | int bound_dev_if; |
65 | }; | 66 | }; |
66 | 67 | ||
67 | /** | 68 | /** |
@@ -121,40 +122,29 @@ static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr, | |||
121 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); | 122 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); |
122 | } | 123 | } |
123 | 124 | ||
124 | static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 125 | static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr) |
125 | union ib_gid *gid) | ||
126 | { | 126 | { |
127 | memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid); | 127 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, | 130 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
131 | union ib_gid *gid) | ||
132 | { | 131 | { |
133 | memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); | 132 | memcpy(gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
134 | } | 133 | } |
135 | 134 | ||
136 | static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr, | 135 | static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
137 | union ib_gid *gid) | ||
138 | { | 136 | { |
139 | memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid); | 137 | memcpy(dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
140 | } | 138 | } |
141 | 139 | ||
142 | static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | 140 | static inline void rdma_addr_get_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
143 | union ib_gid *gid) | ||
144 | { | 141 | { |
145 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 142 | memcpy(gid, dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
146 | } | 143 | } |
147 | 144 | ||
148 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 145 | static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
149 | union ib_gid *gid) | ||
150 | { | ||
151 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
152 | } | ||
153 | |||
154 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
155 | union ib_gid *gid) | ||
156 | { | 146 | { |
157 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | 147 | memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
158 | } | 148 | } |
159 | 149 | ||
160 | #endif /* IB_ADDR_H */ | 150 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index 3841c1aff692..1082afaed158 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
@@ -379,4 +379,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, | |||
379 | struct ib_sa_path_rec *rec, | 379 | struct ib_sa_path_rec *rec, |
380 | struct ib_ah_attr *ah_attr); | 380 | struct ib_ah_attr *ah_attr); |
381 | 381 | ||
382 | /** | ||
383 | * ib_sa_unpack_path - Convert a path record from MAD format to struct | ||
384 | * ib_sa_path_rec. | ||
385 | */ | ||
386 | void ib_sa_unpack_path(void *attribute, struct ib_sa_path_rec *rec); | ||
387 | |||
382 | #endif /* IB_SA_H */ | 388 | #endif /* IB_SA_H */ |
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h index 659120157e14..cfc7c9ba781e 100644 --- a/include/rdma/ib_user_sa.h +++ b/include/rdma/ib_user_sa.h | |||
@@ -35,6 +35,22 @@ | |||
35 | 35 | ||
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | 37 | ||
38 | enum { | ||
39 | IB_PATH_GMP = 1, | ||
40 | IB_PATH_PRIMARY = (1<<1), | ||
41 | IB_PATH_ALTERNATE = (1<<2), | ||
42 | IB_PATH_OUTBOUND = (1<<3), | ||
43 | IB_PATH_INBOUND = (1<<4), | ||
44 | IB_PATH_INBOUND_REVERSE = (1<<5), | ||
45 | IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE | ||
46 | }; | ||
47 | |||
48 | struct ib_path_rec_data { | ||
49 | __u32 flags; | ||
50 | __u32 reserved; | ||
51 | __u32 path_rec[16]; | ||
52 | }; | ||
53 | |||
38 | struct ib_user_path_rec { | 54 | struct ib_user_path_rec { |
39 | __u8 dgid[16]; | 55 | __u8 dgid[16]; |
40 | __u8 sgid[16]; | 56 | __u8 sgid[16]; |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c179318edd92..09509edb1c5f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -1425,6 +1425,11 @@ int ib_destroy_qp(struct ib_qp *qp); | |||
1425 | * @send_wr: A list of work requests to post on the send queue. | 1425 | * @send_wr: A list of work requests to post on the send queue. |
1426 | * @bad_send_wr: On an immediate failure, this parameter will reference | 1426 | * @bad_send_wr: On an immediate failure, this parameter will reference |
1427 | * the work request that failed to be posted on the QP. | 1427 | * the work request that failed to be posted on the QP. |
1428 | * | ||
1429 | * While IBA Vol. 1 section 11.4.1.1 specifies that if an immediate | ||
1430 | * error is returned, the QP state shall not be affected, | ||
1431 | * ib_post_send() will return an immediate error after queueing any | ||
1432 | * earlier work requests in the list. | ||
1428 | */ | 1433 | */ |
1429 | static inline int ib_post_send(struct ib_qp *qp, | 1434 | static inline int ib_post_send(struct ib_qp *qp, |
1430 | struct ib_send_wr *send_wr, | 1435 | struct ib_send_wr *send_wr, |
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h index c55705460b87..1d165022c02d 100644 --- a/include/rdma/rdma_user_cm.h +++ b/include/rdma/rdma_user_cm.h | |||
@@ -215,12 +215,14 @@ struct rdma_ucm_event_resp { | |||
215 | 215 | ||
216 | /* Option levels */ | 216 | /* Option levels */ |
217 | enum { | 217 | enum { |
218 | RDMA_OPTION_ID = 0 | 218 | RDMA_OPTION_ID = 0, |
219 | RDMA_OPTION_IB = 1 | ||
219 | }; | 220 | }; |
220 | 221 | ||
221 | /* Option details */ | 222 | /* Option details */ |
222 | enum { | 223 | enum { |
223 | RDMA_OPTION_ID_TOS = 0 | 224 | RDMA_OPTION_ID_TOS = 0, |
225 | RDMA_OPTION_IB_PATH = 1 | ||
224 | }; | 226 | }; |
225 | 227 | ||
226 | struct rdma_ucm_set_option { | 228 | struct rdma_ucm_set_option { |
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild index 33b2750e9283..b3a0ee6b2f1c 100644 --- a/include/scsi/Kbuild +++ b/include/scsi/Kbuild | |||
@@ -2,3 +2,4 @@ header-y += scsi.h | |||
2 | header-y += scsi_netlink.h | 2 | header-y += scsi_netlink.h |
3 | header-y += scsi_netlink_fc.h | 3 | header-y += scsi_netlink_fc.h |
4 | header-y += scsi_bsg_fc.h | 4 | header-y += scsi_bsg_fc.h |
5 | header-y += fc/ | ||
diff --git a/include/scsi/fc/Kbuild b/include/scsi/fc/Kbuild new file mode 100644 index 000000000000..56603813c6cd --- /dev/null +++ b/include/scsi/fc/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | header-y += fc_els.h | ||
2 | header-y += fc_fs.h | ||
3 | header-y += fc_gs.h | ||
4 | header-y += fc_ns.h | ||
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h index 195ca014d3ce..f94328132a26 100644 --- a/include/scsi/fc/fc_els.h +++ b/include/scsi/fc/fc_els.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FC_ELS_H_ | 20 | #ifndef _FC_ELS_H_ |
21 | #define _FC_ELS_H_ | 21 | #define _FC_ELS_H_ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * Fibre Channel Switch - Enhanced Link Services definitions. | 26 | * Fibre Channel Switch - Enhanced Link Services definitions. |
25 | * From T11 FC-LS Rev 1.2 June 7, 2005. | 27 | * From T11 FC-LS Rev 1.2 June 7, 2005. |
@@ -248,10 +250,12 @@ struct fc_els_csp { | |||
248 | /* | 250 | /* |
249 | * sp_features | 251 | * sp_features |
250 | */ | 252 | */ |
251 | #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel. off. */ | 253 | #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ |
254 | #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ | ||
252 | #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ | 255 | #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ |
253 | #define FC_SP_FT_RAND 0x4000 /* random relative offset */ | 256 | #define FC_SP_FT_RAND 0x4000 /* random relative offset */ |
254 | #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ | 257 | #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ |
258 | #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ | ||
255 | #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ | 259 | #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ |
256 | #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ | 260 | #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ |
257 | #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ | 261 | #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ |
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h index ccb3dbe90463..e6ad3d2ae475 100644 --- a/include/scsi/fc/fc_fcoe.h +++ b/include/scsi/fc/fc_fcoe.h | |||
@@ -86,6 +86,18 @@ struct fcoe_crc_eof { | |||
86 | #define FCOE_MIN_FRAME 46 | 86 | #define FCOE_MIN_FRAME 46 |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * FCoE Link Error Status Block: T11 FC-BB-5 Rev2.0, Clause 7.10. | ||
90 | */ | ||
91 | struct fcoe_fc_els_lesb { | ||
92 | __be32 lesb_link_fail; /* link failure count */ | ||
93 | __be32 lesb_vlink_fail; /* virtual link failure count */ | ||
94 | __be32 lesb_miss_fka; /* missing FIP keep-alive count */ | ||
95 | __be32 lesb_symb_err; /* symbol error during carrier count */ | ||
96 | __be32 lesb_err_block; /* errored block count */ | ||
97 | __be32 lesb_fcs_error; /* frame check sequence error count */ | ||
98 | }; | ||
99 | |||
100 | /* | ||
89 | * fc_fcoe_set_mac - Store OUI + DID into MAC address field. | 101 | * fc_fcoe_set_mac - Store OUI + DID into MAC address field. |
90 | * @mac: mac address to be set | 102 | * @mac: mac address to be set |
91 | * @did: fc dest id to use | 103 | * @did: fc dest id to use |
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h index 5d38f1989f37..747e2c7d88d6 100644 --- a/include/scsi/fc/fc_fcp.h +++ b/include/scsi/fc/fc_fcp.h | |||
@@ -83,6 +83,8 @@ struct fcp_cmnd32 { | |||
83 | * fc_tm_flags - task management flags field. | 83 | * fc_tm_flags - task management flags field. |
84 | */ | 84 | */ |
85 | #define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ | 85 | #define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ |
86 | #define FCP_TMF_TGT_RESET 0x20 /* target reset task management, | ||
87 | deprecated as of FCP-3 */ | ||
86 | #define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ | 88 | #define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ |
87 | #define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ | 89 | #define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ |
88 | #define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ | 90 | #define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ |
@@ -196,4 +198,10 @@ struct fcp_srr { | |||
196 | __u8 srr_resvd2[3]; /* reserved */ | 198 | __u8 srr_resvd2[3]; /* reserved */ |
197 | }; | 199 | }; |
198 | 200 | ||
201 | /* | ||
202 | * Feature bits in name server FC-4 Features object. | ||
203 | */ | ||
204 | #define FCP_FEAT_TARG (1 << 0) /* target function supported */ | ||
205 | #define FCP_FEAT_INIT (1 << 1) /* initiator function supported */ | ||
206 | |||
199 | #endif /* _FC_FCP_H_ */ | 207 | #endif /* _FC_FCP_H_ */ |
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h index 3d138c1fcf8a..17baa19380f0 100644 --- a/include/scsi/fc/fc_fip.h +++ b/include/scsi/fc/fc_fip.h | |||
@@ -214,11 +214,21 @@ struct fip_vn_desc { | |||
214 | */ | 214 | */ |
215 | struct fip_fka_desc { | 215 | struct fip_fka_desc { |
216 | struct fip_desc fd_desc; | 216 | struct fip_desc fd_desc; |
217 | __u8 fd_resvd[2]; | 217 | __u8 fd_resvd; |
218 | __u8 fd_flags; /* bit0 is fka disable flag */ | ||
218 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ | 219 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ |
219 | } __attribute__((packed)); | 220 | } __attribute__((packed)); |
220 | 221 | ||
221 | /* | 222 | /* |
223 | * flags for fip_fka_desc.fd_flags | ||
224 | */ | ||
225 | enum fip_fka_flags { | ||
226 | FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */ | ||
227 | }; | ||
228 | |||
229 | /* FIP_DT_FKA flags */ | ||
230 | |||
231 | /* | ||
222 | * FIP_DT_VENDOR descriptor. | 232 | * FIP_DT_VENDOR descriptor. |
223 | */ | 233 | */ |
224 | struct fip_vendor_desc { | 234 | struct fip_vendor_desc { |
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h index ac4cd38c860e..50f28b143451 100644 --- a/include/scsi/fc/fc_fs.h +++ b/include/scsi/fc/fc_fs.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FC_FS_H_ | 20 | #ifndef _FC_FS_H_ |
21 | #define _FC_FS_H_ | 21 | #define _FC_FS_H_ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * Fibre Channel Framing and Signalling definitions. | 26 | * Fibre Channel Framing and Signalling definitions. |
25 | * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. | 27 | * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. |
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h index 324dd0e3c622..a37346d47eb1 100644 --- a/include/scsi/fc/fc_gs.h +++ b/include/scsi/fc/fc_gs.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FC_GS_H_ | 20 | #ifndef _FC_GS_H_ |
21 | #define _FC_GS_H_ | 21 | #define _FC_GS_H_ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * Fibre Channel Services - Common Transport. | 26 | * Fibre Channel Services - Common Transport. |
25 | * From T11.org FC-GS-2 Rev 5.3 November 1998. | 27 | * From T11.org FC-GS-2 Rev 5.3 November 1998. |
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h index 790d7b97d4bc..e7d3ac497d7d 100644 --- a/include/scsi/fc/fc_ns.h +++ b/include/scsi/fc/fc_ns.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FC_NS_H_ | 20 | #ifndef _FC_NS_H_ |
21 | #define _FC_NS_H_ | 21 | #define _FC_NS_H_ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * Fibre Channel Services - Name Service (dNS) | 26 | * Fibre Channel Services - Name Service (dNS) |
25 | * From T11.org FC-GS-2 Rev 5.3 November 1998. | 27 | * From T11.org FC-GS-2 Rev 5.3 November 1998. |
@@ -44,9 +46,12 @@ enum fc_ns_req { | |||
44 | FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ | 46 | FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ |
45 | FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ | 47 | FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ |
46 | FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ | 48 | FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ |
47 | FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ | ||
48 | FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ | 49 | FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ |
49 | FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ | 50 | FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ |
51 | FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ | ||
52 | FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */ | ||
53 | FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */ | ||
54 | FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */ | ||
50 | }; | 55 | }; |
51 | 56 | ||
52 | /* | 57 | /* |
@@ -156,4 +161,32 @@ struct fc_ns_rn_id { | |||
156 | __be64 fr_wwn; /* node name or port name */ | 161 | __be64 fr_wwn; /* node name or port name */ |
157 | } __attribute__((__packed__)); | 162 | } __attribute__((__packed__)); |
158 | 163 | ||
164 | /* | ||
165 | * RSNN_NN request - register symbolic node name | ||
166 | */ | ||
167 | struct fc_ns_rsnn { | ||
168 | __be64 fr_wwn; /* node name */ | ||
169 | __u8 fr_name_len; | ||
170 | char fr_name[]; | ||
171 | } __attribute__((__packed__)); | ||
172 | |||
173 | /* | ||
174 | * RSPN_ID request - register symbolic port name | ||
175 | */ | ||
176 | struct fc_ns_rspn { | ||
177 | struct fc_ns_fid fr_fid; /* port ID object */ | ||
178 | __u8 fr_name_len; | ||
179 | char fr_name[]; | ||
180 | } __attribute__((__packed__)); | ||
181 | |||
182 | /* | ||
183 | * RFF_ID request - register FC-4 Features for ID. | ||
184 | */ | ||
185 | struct fc_ns_rff_id { | ||
186 | struct fc_ns_fid fr_fid; /* port ID object */ | ||
187 | __u8 fr_resvd[2]; | ||
188 | __u8 fr_feat; /* FC-4 Feature bits */ | ||
189 | __u8 fr_type; /* FC-4 type */ | ||
190 | } __attribute__((__packed__)); | ||
191 | |||
159 | #endif /* _FC_NS_H_ */ | 192 | #endif /* _FC_NS_H_ */ |
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index 27dad703824f..8eb0a0fc0a71 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h | |||
@@ -32,7 +32,10 @@ struct fc_ct_req { | |||
32 | struct fc_ns_gid_ft gid; | 32 | struct fc_ns_gid_ft gid; |
33 | struct fc_ns_rn_id rn; | 33 | struct fc_ns_rn_id rn; |
34 | struct fc_ns_rft rft; | 34 | struct fc_ns_rft rft; |
35 | struct fc_ns_rff_id rff; | ||
35 | struct fc_ns_fid fid; | 36 | struct fc_ns_fid fid; |
37 | struct fc_ns_rsnn snn; | ||
38 | struct fc_ns_rspn spn; | ||
36 | } payload; | 39 | } payload; |
37 | }; | 40 | }; |
38 | 41 | ||
@@ -109,6 +112,7 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
109 | enum fc_fh_type *fh_type) | 112 | enum fc_fh_type *fh_type) |
110 | { | 113 | { |
111 | struct fc_ct_req *ct; | 114 | struct fc_ct_req *ct; |
115 | size_t len; | ||
112 | 116 | ||
113 | switch (op) { | 117 | switch (op) { |
114 | case FC_NS_GPN_FT: | 118 | case FC_NS_GPN_FT: |
@@ -128,12 +132,41 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
128 | ct->payload.rft.fts = lport->fcts; | 132 | ct->payload.rft.fts = lport->fcts; |
129 | break; | 133 | break; |
130 | 134 | ||
131 | case FC_NS_RPN_ID: | 135 | case FC_NS_RFF_ID: |
136 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); | ||
137 | hton24(ct->payload.rff.fr_fid.fp_fid, | ||
138 | fc_host_port_id(lport->host)); | ||
139 | ct->payload.rff.fr_type = FC_TYPE_FCP; | ||
140 | if (lport->service_params & FCP_SPPF_INIT_FCN) | ||
141 | ct->payload.rff.fr_feat = FCP_FEAT_INIT; | ||
142 | if (lport->service_params & FCP_SPPF_TARG_FCN) | ||
143 | ct->payload.rff.fr_feat |= FCP_FEAT_TARG; | ||
144 | break; | ||
145 | |||
146 | case FC_NS_RNN_ID: | ||
132 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); | 147 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); |
133 | hton24(ct->payload.rn.fr_fid.fp_fid, | 148 | hton24(ct->payload.rn.fr_fid.fp_fid, |
134 | fc_host_port_id(lport->host)); | 149 | fc_host_port_id(lport->host)); |
135 | ct->payload.rft.fts = lport->fcts; | 150 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); |
136 | put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn); | 151 | break; |
152 | |||
153 | case FC_NS_RSPN_ID: | ||
154 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | ||
155 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); | ||
156 | hton24(ct->payload.spn.fr_fid.fp_fid, | ||
157 | fc_host_port_id(lport->host)); | ||
158 | strncpy(ct->payload.spn.fr_name, | ||
159 | fc_host_symbolic_name(lport->host), len); | ||
160 | ct->payload.spn.fr_name_len = len; | ||
161 | break; | ||
162 | |||
163 | case FC_NS_RSNN_NN: | ||
164 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | ||
165 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len); | ||
166 | put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); | ||
167 | strncpy(ct->payload.snn.fr_name, | ||
168 | fc_host_symbolic_name(lport->host), len); | ||
169 | ct->payload.snn.fr_name_len = len; | ||
137 | break; | 170 | break; |
138 | 171 | ||
139 | default: | 172 | default: |
@@ -198,6 +231,31 @@ static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
198 | sp->sp_bb_data = htons((u16) lport->mfs); | 231 | sp->sp_bb_data = htons((u16) lport->mfs); |
199 | cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */ | 232 | cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */ |
200 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | 233 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); |
234 | if (lport->does_npiv) | ||
235 | sp->sp_features = htons(FC_SP_FT_NPIV); | ||
236 | } | ||
237 | |||
238 | /** | ||
239 | * fc_fdisc_fill - Fill in a fdisc request frame. | ||
240 | */ | ||
241 | static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp) | ||
242 | { | ||
243 | struct fc_els_csp *sp; | ||
244 | struct fc_els_cssp *cp; | ||
245 | struct fc_els_flogi *fdisc; | ||
246 | |||
247 | fdisc = fc_frame_payload_get(fp, sizeof(*fdisc)); | ||
248 | memset(fdisc, 0, sizeof(*fdisc)); | ||
249 | fdisc->fl_cmd = (u8) ELS_FDISC; | ||
250 | put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn); | ||
251 | put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn); | ||
252 | sp = &fdisc->fl_csp; | ||
253 | sp->sp_hi_ver = 0x20; | ||
254 | sp->sp_lo_ver = 0x20; | ||
255 | sp->sp_bb_cred = htons(10); /* this gets set by gateway */ | ||
256 | sp->sp_bb_data = htons((u16) lport->mfs); | ||
257 | cp = &fdisc->fl_cssp[3 - 1]; /* class 3 parameters */ | ||
258 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | ||
201 | } | 259 | } |
202 | 260 | ||
203 | /** | 261 | /** |
@@ -296,6 +354,10 @@ static inline int fc_els_fill(struct fc_lport *lport, | |||
296 | fc_flogi_fill(lport, fp); | 354 | fc_flogi_fill(lport, fp); |
297 | break; | 355 | break; |
298 | 356 | ||
357 | case ELS_FDISC: | ||
358 | fc_fdisc_fill(lport, fp); | ||
359 | break; | ||
360 | |||
299 | case ELS_LOGO: | 361 | case ELS_LOGO: |
300 | fc_logo_fill(lport, fp); | 362 | fc_logo_fill(lport, fp); |
301 | break; | 363 | break; |
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h index c35d2383cc26..4d3e9c7b7c57 100644 --- a/include/scsi/fc_frame.h +++ b/include/scsi/fc_frame.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <scsi/fc/fc_fcp.h> | 28 | #include <scsi/fc/fc_fcp.h> |
29 | #include <scsi/fc/fc_encaps.h> | 29 | #include <scsi/fc/fc_encaps.h> |
30 | 30 | ||
31 | #include <linux/if_ether.h> | ||
32 | |||
31 | /* | 33 | /* |
32 | * The fc_frame interface is used to pass frame data between functions. | 34 | * The fc_frame interface is used to pass frame data between functions. |
33 | * The frame includes the data buffer, length, and SOF / EOF delimiter types. | 35 | * The frame includes the data buffer, length, and SOF / EOF delimiter types. |
@@ -37,6 +39,9 @@ | |||
37 | #define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ | 39 | #define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ |
38 | #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ | 40 | #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ |
39 | 41 | ||
42 | /* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */ | ||
43 | #define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1) | ||
44 | |||
40 | #define fp_skb(fp) (&((fp)->skb)) | 45 | #define fp_skb(fp) (&((fp)->skb)) |
41 | #define fr_hdr(fp) ((fp)->skb.data) | 46 | #define fr_hdr(fp) ((fp)->skb.data) |
42 | #define fr_len(fp) ((fp)->skb.len) | 47 | #define fr_len(fp) ((fp)->skb.len) |
@@ -64,6 +69,7 @@ struct fcoe_rcv_info { | |||
64 | enum fc_sof fr_sof; /* start of frame delimiter */ | 69 | enum fc_sof fr_sof; /* start of frame delimiter */ |
65 | enum fc_eof fr_eof; /* end of frame delimiter */ | 70 | enum fc_eof fr_eof; /* end of frame delimiter */ |
66 | u8 fr_flags; /* flags - see below */ | 71 | u8 fr_flags; /* flags - see below */ |
72 | u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ | ||
67 | }; | 73 | }; |
68 | 74 | ||
69 | 75 | ||
@@ -94,17 +100,7 @@ static inline void fc_frame_init(struct fc_frame *fp) | |||
94 | } | 100 | } |
95 | 101 | ||
96 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); | 102 | struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); |
97 | 103 | struct fc_frame *_fc_frame_alloc(size_t payload_len); | |
98 | struct fc_frame *__fc_frame_alloc(size_t payload_len); | ||
99 | |||
100 | /* | ||
101 | * Get frame for sending via port. | ||
102 | */ | ||
103 | static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev, | ||
104 | size_t payload_len) | ||
105 | { | ||
106 | return __fc_frame_alloc(payload_len); | ||
107 | } | ||
108 | 104 | ||
109 | /* | 105 | /* |
110 | * Allocate fc_frame structure and buffer. Set the initial length to | 106 | * Allocate fc_frame structure and buffer. Set the initial length to |
@@ -118,10 +114,10 @@ static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len) | |||
118 | * Note: Since len will often be a constant multiple of 4, | 114 | * Note: Since len will often be a constant multiple of 4, |
119 | * this check will usually be evaluated and eliminated at compile time. | 115 | * this check will usually be evaluated and eliminated at compile time. |
120 | */ | 116 | */ |
121 | if ((len % 4) != 0) | 117 | if (len && len % 4) |
122 | fp = fc_frame_alloc_fill(dev, len); | 118 | fp = fc_frame_alloc_fill(dev, len); |
123 | else | 119 | else |
124 | fp = _fc_frame_alloc(dev, len); | 120 | fp = _fc_frame_alloc(len); |
125 | return fp; | 121 | return fp; |
126 | } | 122 | } |
127 | 123 | ||
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index d67dda2b6aa0..66d377b9c72b 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -311,6 +311,8 @@ enum iscsi_param { | |||
311 | ISCSI_PARAM_IFACE_NAME, | 311 | ISCSI_PARAM_IFACE_NAME, |
312 | ISCSI_PARAM_ISID, | 312 | ISCSI_PARAM_ISID, |
313 | ISCSI_PARAM_INITIATOR_NAME, | 313 | ISCSI_PARAM_INITIATOR_NAME, |
314 | |||
315 | ISCSI_PARAM_TGT_RESET_TMO, | ||
314 | /* must always be last */ | 316 | /* must always be last */ |
315 | ISCSI_PARAM_MAX, | 317 | ISCSI_PARAM_MAX, |
316 | }; | 318 | }; |
@@ -350,6 +352,7 @@ enum iscsi_param { | |||
350 | #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) | 352 | #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) |
351 | #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) | 353 | #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) |
352 | #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) | 354 | #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) |
355 | #define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO) | ||
353 | 356 | ||
354 | /* iSCSI HBA params */ | 357 | /* iSCSI HBA params */ |
355 | enum iscsi_host_param { | 358 | enum iscsi_host_param { |
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index f2a2c1169486..dd0a52cea95a 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
@@ -279,6 +279,8 @@ struct iscsi_tm { | |||
279 | #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 | 279 | #define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 |
280 | #define ISCSI_TM_FUNC_TASK_REASSIGN 8 | 280 | #define ISCSI_TM_FUNC_TASK_REASSIGN 8 |
281 | 281 | ||
282 | #define ISCSI_TM_FUNC_VALUE(hdr) ((hdr)->flags & ISCSI_FLAG_TM_FUNC_MASK) | ||
283 | |||
282 | /* SCSI Task Management Response Header */ | 284 | /* SCSI Task Management Response Header */ |
283 | struct iscsi_tm_rsp { | 285 | struct iscsi_tm_rsp { |
284 | uint8_t opcode; | 286 | uint8_t opcode; |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 65dc9aacbf70..4b912eee33e5 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <scsi/scsi_transport.h> | 27 | #include <scsi/scsi_transport.h> |
28 | #include <scsi/scsi_transport_fc.h> | 28 | #include <scsi/scsi_transport_fc.h> |
29 | #include <scsi/scsi_bsg_fc.h> | ||
29 | 30 | ||
30 | #include <scsi/fc/fc_fcp.h> | 31 | #include <scsi/fc/fc_fcp.h> |
31 | #include <scsi/fc/fc_ns.h> | 32 | #include <scsi/fc/fc_ns.h> |
@@ -34,67 +35,6 @@ | |||
34 | 35 | ||
35 | #include <scsi/fc_frame.h> | 36 | #include <scsi/fc_frame.h> |
36 | 37 | ||
37 | #define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */ | ||
38 | #define FC_LPORT_LOGGING 0x02 /* lport layer logging */ | ||
39 | #define FC_DISC_LOGGING 0x04 /* discovery layer logging */ | ||
40 | #define FC_RPORT_LOGGING 0x08 /* rport layer logging */ | ||
41 | #define FC_FCP_LOGGING 0x10 /* I/O path logging */ | ||
42 | #define FC_EM_LOGGING 0x20 /* Exchange Manager logging */ | ||
43 | #define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */ | ||
44 | #define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */ | ||
45 | |||
46 | extern unsigned int fc_debug_logging; | ||
47 | |||
48 | #define FC_CHECK_LOGGING(LEVEL, CMD) \ | ||
49 | do { \ | ||
50 | if (unlikely(fc_debug_logging & LEVEL)) \ | ||
51 | do { \ | ||
52 | CMD; \ | ||
53 | } while (0); \ | ||
54 | } while (0) | ||
55 | |||
56 | #define FC_LIBFC_DBG(fmt, args...) \ | ||
57 | FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ | ||
58 | printk(KERN_INFO "libfc: " fmt, ##args)) | ||
59 | |||
60 | #define FC_LPORT_DBG(lport, fmt, args...) \ | ||
61 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ | ||
62 | printk(KERN_INFO "host%u: lport %6x: " fmt, \ | ||
63 | (lport)->host->host_no, \ | ||
64 | fc_host_port_id((lport)->host), ##args)) | ||
65 | |||
66 | #define FC_DISC_DBG(disc, fmt, args...) \ | ||
67 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ | ||
68 | printk(KERN_INFO "host%u: disc: " fmt, \ | ||
69 | (disc)->lport->host->host_no, \ | ||
70 | ##args)) | ||
71 | |||
72 | #define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \ | ||
73 | FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ | ||
74 | printk(KERN_INFO "host%u: rport %6x: " fmt, \ | ||
75 | (lport)->host->host_no, \ | ||
76 | (port_id), ##args)) | ||
77 | |||
78 | #define FC_RPORT_DBG(rdata, fmt, args...) \ | ||
79 | FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args) | ||
80 | |||
81 | #define FC_FCP_DBG(pkt, fmt, args...) \ | ||
82 | FC_CHECK_LOGGING(FC_FCP_LOGGING, \ | ||
83 | printk(KERN_INFO "host%u: fcp: %6x: " fmt, \ | ||
84 | (pkt)->lp->host->host_no, \ | ||
85 | pkt->rport->port_id, ##args)) | ||
86 | |||
87 | #define FC_EXCH_DBG(exch, fmt, args...) \ | ||
88 | FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ | ||
89 | printk(KERN_INFO "host%u: xid %4x: " fmt, \ | ||
90 | (exch)->lp->host->host_no, \ | ||
91 | exch->xid, ##args)) | ||
92 | |||
93 | #define FC_SCSI_DBG(lport, fmt, args...) \ | ||
94 | FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ | ||
95 | printk(KERN_INFO "host%u: scsi: " fmt, \ | ||
96 | (lport)->host->host_no, ##args)) | ||
97 | |||
98 | /* | 38 | /* |
99 | * libfc error codes | 39 | * libfc error codes |
100 | */ | 40 | */ |
@@ -115,15 +55,28 @@ do { \ | |||
115 | p[2] = ((v) & 0xFF); \ | 55 | p[2] = ((v) & 0xFF); \ |
116 | } while (0) | 56 | } while (0) |
117 | 57 | ||
118 | /* | 58 | /** |
119 | * FC HBA status | 59 | * enum fc_lport_state - Local port states |
60 | * @LPORT_ST_DISABLED: Disabled | ||
61 | * @LPORT_ST_FLOGI: Fabric login (FLOGI) sent | ||
62 | * @LPORT_ST_DNS: Waiting for name server remote port to become ready | ||
63 | * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent | ||
64 | * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent | ||
65 | * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent | ||
66 | * @LPORT_ST_SCR: State Change Register (SCR) sent | ||
67 | * @LPORT_ST_READY: Ready for use | ||
68 | * @LPORT_ST_LOGO: Local port logout (LOGO) sent | ||
69 | * @LPORT_ST_RESET: Local port reset | ||
120 | */ | 70 | */ |
121 | enum fc_lport_state { | 71 | enum fc_lport_state { |
122 | LPORT_ST_DISABLED = 0, | 72 | LPORT_ST_DISABLED = 0, |
123 | LPORT_ST_FLOGI, | 73 | LPORT_ST_FLOGI, |
124 | LPORT_ST_DNS, | 74 | LPORT_ST_DNS, |
125 | LPORT_ST_RPN_ID, | 75 | LPORT_ST_RNN_ID, |
76 | LPORT_ST_RSNN_NN, | ||
77 | LPORT_ST_RSPN_ID, | ||
126 | LPORT_ST_RFT_ID, | 78 | LPORT_ST_RFT_ID, |
79 | LPORT_ST_RFF_ID, | ||
127 | LPORT_ST_SCR, | 80 | LPORT_ST_SCR, |
128 | LPORT_ST_READY, | 81 | LPORT_ST_READY, |
129 | LPORT_ST_LOGO, | 82 | LPORT_ST_LOGO, |
@@ -136,15 +89,28 @@ enum fc_disc_event { | |||
136 | DISC_EV_FAILED | 89 | DISC_EV_FAILED |
137 | }; | 90 | }; |
138 | 91 | ||
92 | /** | ||
93 | * enum fc_rport_state - Remote port states | ||
94 | * @RPORT_ST_INIT: Initialized | ||
95 | * @RPORT_ST_PLOGI: Waiting for PLOGI completion | ||
96 | * @RPORT_ST_PRLI: Waiting for PRLI completion | ||
97 | * @RPORT_ST_RTV: Waiting for RTV completion | ||
98 | * @RPORT_ST_READY: Ready for use | ||
99 | * @RPORT_ST_LOGO: Remote port logout (LOGO) sent | ||
100 | * @RPORT_ST_ADISC: Discover Address sent | ||
101 | * @RPORT_ST_DELETE: Remote port being deleted | ||
102 | * @RPORT_ST_RESTART: Remote port being deleted and will restart | ||
103 | */ | ||
139 | enum fc_rport_state { | 104 | enum fc_rport_state { |
140 | RPORT_ST_INIT, /* initialized */ | 105 | RPORT_ST_INIT, |
141 | RPORT_ST_PLOGI, /* waiting for PLOGI completion */ | 106 | RPORT_ST_PLOGI, |
142 | RPORT_ST_PRLI, /* waiting for PRLI completion */ | 107 | RPORT_ST_PRLI, |
143 | RPORT_ST_RTV, /* waiting for RTV completion */ | 108 | RPORT_ST_RTV, |
144 | RPORT_ST_READY, /* ready for use */ | 109 | RPORT_ST_READY, |
145 | RPORT_ST_LOGO, /* port logout sent */ | 110 | RPORT_ST_LOGO, |
146 | RPORT_ST_ADISC, /* Discover Address sent */ | 111 | RPORT_ST_ADISC, |
147 | RPORT_ST_DELETE, /* port being deleted */ | 112 | RPORT_ST_DELETE, |
113 | RPORT_ST_RESTART, | ||
148 | }; | 114 | }; |
149 | 115 | ||
150 | /** | 116 | /** |
@@ -155,12 +121,20 @@ enum fc_rport_state { | |||
155 | * @port_id: Port ID of the discovered port | 121 | * @port_id: Port ID of the discovered port |
156 | */ | 122 | */ |
157 | struct fc_disc_port { | 123 | struct fc_disc_port { |
158 | struct fc_lport *lp; | 124 | struct fc_lport *lp; |
159 | struct list_head peers; | 125 | struct list_head peers; |
160 | struct work_struct rport_work; | 126 | struct work_struct rport_work; |
161 | u32 port_id; | 127 | u32 port_id; |
162 | }; | 128 | }; |
163 | 129 | ||
130 | /** | ||
131 | * enum fc_rport_event - Remote port events | ||
132 | * @RPORT_EV_NONE: No event | ||
133 | * @RPORT_EV_READY: Remote port is ready for use | ||
134 | * @RPORT_EV_FAILED: State machine failed, remote port is not ready | ||
135 | * @RPORT_EV_STOP: Remote port has been stopped | ||
136 | * @RPORT_EV_LOGO: Remote port logout (LOGO) sent | ||
137 | */ | ||
164 | enum fc_rport_event { | 138 | enum fc_rport_event { |
165 | RPORT_EV_NONE = 0, | 139 | RPORT_EV_NONE = 0, |
166 | RPORT_EV_READY, | 140 | RPORT_EV_READY, |
@@ -171,6 +145,10 @@ enum fc_rport_event { | |||
171 | 145 | ||
172 | struct fc_rport_priv; | 146 | struct fc_rport_priv; |
173 | 147 | ||
148 | /** | ||
149 | * struct fc_rport_operations - Operations for a remote port | ||
150 | * @event_callback: Function to be called for remote port events | ||
151 | */ | ||
174 | struct fc_rport_operations { | 152 | struct fc_rport_operations { |
175 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, | 153 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, |
176 | enum fc_rport_event); | 154 | enum fc_rport_event); |
@@ -178,11 +156,11 @@ struct fc_rport_operations { | |||
178 | 156 | ||
179 | /** | 157 | /** |
180 | * struct fc_rport_libfc_priv - libfc internal information about a remote port | 158 | * struct fc_rport_libfc_priv - libfc internal information about a remote port |
181 | * @local_port: Fibre Channel host port instance | 159 | * @local_port: The associated local port |
182 | * @rp_state: indicates READY for I/O or DELETE when blocked. | 160 | * @rp_state: Indicates READY for I/O or DELETE when blocked |
183 | * @flags: REC and RETRY supported flags | 161 | * @flags: REC and RETRY supported flags |
184 | * @e_d_tov: error detect timeout value (in msec) | 162 | * @e_d_tov: Error detect timeout value (in msec) |
185 | * @r_a_tov: resource allocation timeout value (in msec) | 163 | * @r_a_tov: Resource allocation timeout value (in msec) |
186 | */ | 164 | */ |
187 | struct fc_rport_libfc_priv { | 165 | struct fc_rport_libfc_priv { |
188 | struct fc_lport *local_port; | 166 | struct fc_lport *local_port; |
@@ -195,47 +173,66 @@ struct fc_rport_libfc_priv { | |||
195 | }; | 173 | }; |
196 | 174 | ||
197 | /** | 175 | /** |
198 | * struct fc_rport_priv - libfc rport and discovery info about a remote port | 176 | * struct fc_rport_priv - libfc remote port and discovery info |
199 | * @local_port: Fibre Channel host port instance | 177 | * @local_port: The associated local port |
200 | * @rport: transport remote port | 178 | * @rport: The FC transport remote port |
201 | * @kref: reference counter | 179 | * @kref: Reference counter |
202 | * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges | 180 | * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, |
203 | * @ids: remote port identifiers and roles | 181 | * and RTV exchanges |
204 | * @flags: REC and RETRY supported flags | 182 | * @ids: The remote port identifiers and roles |
205 | * @max_seq: maximum number of concurrent sequences | 183 | * @flags: REC and RETRY supported flags |
206 | * @disc_id: discovery identifier | 184 | * @max_seq: Maximum number of concurrent sequences |
207 | * @maxframe_size: maximum frame size | 185 | * @disc_id: The discovery identifier |
208 | * @retries: retry count in current state | 186 | * @maxframe_size: The maximum frame size |
209 | * @e_d_tov: error detect timeout value (in msec) | 187 | * @retries: The retry count for the current state |
210 | * @r_a_tov: resource allocation timeout value (in msec) | 188 | * @e_d_tov: Error detect timeout value (in msec) |
211 | * @rp_mutex: mutex protects rport | 189 | * @r_a_tov: Resource allocation timeout value (in msec) |
212 | * @retry_work: | 190 | * @rp_mutex: The mutex that protects the remote port |
213 | * @event_callback: Callback for rport READY, FAILED or LOGO | 191 | * @retry_work: Handle for retries |
192 | * @event_callback: Callback when READY, FAILED or LOGO states complete | ||
214 | */ | 193 | */ |
215 | struct fc_rport_priv { | 194 | struct fc_rport_priv { |
216 | struct fc_lport *local_port; | 195 | struct fc_lport *local_port; |
217 | struct fc_rport *rport; | 196 | struct fc_rport *rport; |
218 | struct kref kref; | 197 | struct kref kref; |
219 | enum fc_rport_state rp_state; | 198 | enum fc_rport_state rp_state; |
220 | struct fc_rport_identifiers ids; | 199 | struct fc_rport_identifiers ids; |
221 | u16 flags; | 200 | u16 flags; |
222 | u16 max_seq; | 201 | u16 max_seq; |
223 | u16 disc_id; | 202 | u16 disc_id; |
224 | u16 maxframe_size; | 203 | u16 maxframe_size; |
225 | unsigned int retries; | 204 | unsigned int retries; |
226 | unsigned int e_d_tov; | 205 | unsigned int e_d_tov; |
227 | unsigned int r_a_tov; | 206 | unsigned int r_a_tov; |
228 | struct mutex rp_mutex; | 207 | struct mutex rp_mutex; |
229 | struct delayed_work retry_work; | 208 | struct delayed_work retry_work; |
230 | enum fc_rport_event event; | 209 | enum fc_rport_event event; |
231 | struct fc_rport_operations *ops; | 210 | struct fc_rport_operations *ops; |
232 | struct list_head peers; | 211 | struct list_head peers; |
233 | struct work_struct event_work; | 212 | struct work_struct event_work; |
234 | u32 supported_classes; | 213 | u32 supported_classes; |
235 | }; | 214 | }; |
236 | 215 | ||
237 | /* | 216 | /** |
238 | * fcoe stats structure | 217 | * struct fcoe_dev_stats - fcoe stats structure |
218 | * @SecondsSinceLastReset: Seconds since the last reset | ||
219 | * @TxFrames: Number of transmitted frames | ||
220 | * @TxWords: Number of transmitted words | ||
221 | * @RxFrames: Number of received frames | ||
222 | * @RxWords: Number of received words | ||
223 | * @ErrorFrames: Number of received error frames | ||
224 | * @DumpedFrames: Number of dumped frames | ||
225 | * @LinkFailureCount: Number of link failures | ||
226 | * @LossOfSignalCount: Number for signal losses | ||
227 | * @InvalidTxWordCount: Number of invalid transmitted words | ||
228 | * @InvalidCRCCount: Number of invalid CRCs | ||
229 | * @InputRequests: Number of input requests | ||
230 | * @OutputRequests: Number of output requests | ||
231 | * @ControlRequests: Number of control requests | ||
232 | * @InputMegabytes: Number of received megabytes | ||
233 | * @OutputMegabytes: Number of transmitted megabytes | ||
234 | * @VLinkFailureCount: Number of virtual link failures | ||
235 | * @MissDiscAdvCount: Number of missing FIP discovery advertisement | ||
239 | */ | 236 | */ |
240 | struct fcoe_dev_stats { | 237 | struct fcoe_dev_stats { |
241 | u64 SecondsSinceLastReset; | 238 | u64 SecondsSinceLastReset; |
@@ -254,12 +251,17 @@ struct fcoe_dev_stats { | |||
254 | u64 ControlRequests; | 251 | u64 ControlRequests; |
255 | u64 InputMegabytes; | 252 | u64 InputMegabytes; |
256 | u64 OutputMegabytes; | 253 | u64 OutputMegabytes; |
254 | u64 VLinkFailureCount; | ||
255 | u64 MissDiscAdvCount; | ||
257 | }; | 256 | }; |
258 | 257 | ||
259 | /* | 258 | /** |
260 | * els data is used for passing ELS respone specific | 259 | * struct fc_seq_els_data - ELS data used for passing ELS specific responses |
261 | * data to send ELS response mainly using infomation | 260 | * @fp: The ELS frame |
262 | * in exchange and sequence in EM layer. | 261 | * @reason: The reason for rejection |
262 | * @explan: The explaination of the rejection | ||
263 | * | ||
264 | * Mainly used by the exchange manager layer. | ||
263 | */ | 265 | */ |
264 | struct fc_seq_els_data { | 266 | struct fc_seq_els_data { |
265 | struct fc_frame *fp; | 267 | struct fc_frame *fp; |
@@ -267,77 +269,87 @@ struct fc_seq_els_data { | |||
267 | enum fc_els_rjt_explan explan; | 269 | enum fc_els_rjt_explan explan; |
268 | }; | 270 | }; |
269 | 271 | ||
270 | /* | 272 | /** |
271 | * FCP request structure, one for each scsi cmd request | 273 | * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) |
274 | * @lp: The associated local port | ||
275 | * @state: The state of the I/O | ||
276 | * @tgt_flags: Target's flags | ||
277 | * @ref_cnt: Reference count | ||
278 | * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the | ||
279 | * host_lock if both are to be held at the same time) | ||
280 | * @cmd: The SCSI command (set and clear with the host_lock held) | ||
281 | * @list: Tracks queued commands (accessed with the host_lock held) | ||
282 | * @timer: The command timer | ||
283 | * @tm_done: Completion indicator | ||
284 | * @wait_for_comp: Indicator to wait for completion of the I/O (in jiffies) | ||
285 | * @start_time: Timestamp indicating the start of the I/O (in jiffies) | ||
286 | * @end_time: Timestamp indicating the end of the I/O (in jiffies) | ||
287 | * @last_pkt_time: Timestamp of the last frame received (in jiffies) | ||
288 | * @data_len: The length of the data | ||
289 | * @cdb_cmd: The CDB command | ||
290 | * @xfer_len: The transfer length | ||
291 | * @xfer_ddp: Indicates if this transfer used DDP (XID of the exchange | ||
292 | * will be set here if DDP was setup) | ||
293 | * @xfer_contig_end: The offset into the buffer if the buffer is contiguous | ||
294 | * (Tx and Rx) | ||
295 | * @max_payload: The maximum payload size (in bytes) | ||
296 | * @io_status: SCSI result (upper 24 bits) | ||
297 | * @cdb_status: CDB status | ||
298 | * @status_code: FCP I/O status | ||
299 | * @scsi_comp_flags: Completion flags (bit 3 Underrun bit 2: overrun) | ||
300 | * @req_flags: Request flags (bit 0: read bit:1 write) | ||
301 | * @scsi_resid: SCSI residule length | ||
302 | * @rport: The remote port that the SCSI command is targeted at | ||
303 | * @seq_ptr: The sequence that will carry the SCSI command | ||
304 | * @recov_retry: Number of recovery retries | ||
305 | * @recov_seq: The sequence for REC or SRR | ||
272 | */ | 306 | */ |
273 | struct fc_fcp_pkt { | 307 | struct fc_fcp_pkt { |
274 | /* | 308 | /* Housekeeping information */ |
275 | * housekeeping stuff | 309 | struct fc_lport *lp; |
276 | */ | 310 | u16 state; |
277 | struct fc_lport *lp; /* handle to hba struct */ | 311 | u16 tgt_flags; |
278 | u16 state; /* scsi_pkt state state */ | 312 | atomic_t ref_cnt; |
279 | u16 tgt_flags; /* target flags */ | 313 | spinlock_t scsi_pkt_lock; |
280 | atomic_t ref_cnt; /* fcp pkt ref count */ | 314 | |
281 | spinlock_t scsi_pkt_lock; /* Must be taken before the host lock | 315 | /* SCSI I/O related information */ |
282 | * if both are held at the same time */ | 316 | struct scsi_cmnd *cmd; |
283 | /* | 317 | struct list_head list; |
284 | * SCSI I/O related stuff | 318 | |
285 | */ | 319 | /* Timeout related information */ |
286 | struct scsi_cmnd *cmd; /* scsi command pointer. set/clear | 320 | struct timer_list timer; |
287 | * under host lock */ | ||
288 | struct list_head list; /* tracks queued commands. access under | ||
289 | * host lock */ | ||
290 | /* | ||
291 | * timeout related stuff | ||
292 | */ | ||
293 | struct timer_list timer; /* command timer */ | ||
294 | struct completion tm_done; | 321 | struct completion tm_done; |
295 | int wait_for_comp; | 322 | int wait_for_comp; |
296 | unsigned long start_time; /* start jiffie */ | 323 | unsigned long start_time; |
297 | unsigned long end_time; /* end jiffie */ | 324 | unsigned long end_time; |
298 | unsigned long last_pkt_time; /* jiffies of last frame received */ | 325 | unsigned long last_pkt_time; |
299 | 326 | ||
300 | /* | 327 | /* SCSI command and data transfer information */ |
301 | * scsi cmd and data transfer information | 328 | u32 data_len; |
302 | */ | 329 | |
303 | u32 data_len; | 330 | /* Transport related veriables */ |
304 | /* | 331 | struct fcp_cmnd cdb_cmd; |
305 | * transport related veriables | 332 | size_t xfer_len; |
306 | */ | 333 | u16 xfer_ddp; |
307 | struct fcp_cmnd cdb_cmd; | 334 | u32 xfer_contig_end; |
308 | size_t xfer_len; | 335 | u16 max_payload; |
309 | u16 xfer_ddp; /* this xfer is ddped */ | 336 | |
310 | u32 xfer_contig_end; /* offset of end of contiguous xfer */ | 337 | /* SCSI/FCP return status */ |
311 | u16 max_payload; /* max payload size in bytes */ | 338 | u32 io_status; |
312 | 339 | u8 cdb_status; | |
313 | /* | 340 | u8 status_code; |
314 | * scsi/fcp return status | 341 | u8 scsi_comp_flags; |
315 | */ | 342 | u32 req_flags; |
316 | u32 io_status; /* SCSI result upper 24 bits */ | 343 | u32 scsi_resid; |
317 | u8 cdb_status; | 344 | |
318 | u8 status_code; /* FCP I/O status */ | 345 | /* Associated structures */ |
319 | /* bit 3 Underrun bit 2: overrun */ | 346 | struct fc_rport *rport; |
320 | u8 scsi_comp_flags; | 347 | struct fc_seq *seq_ptr; |
321 | u32 req_flags; /* bit 0: read bit:1 write */ | 348 | |
322 | u32 scsi_resid; /* residule length */ | 349 | /* Error Processing information */ |
323 | 350 | u8 recov_retry; | |
324 | struct fc_rport *rport; /* remote port pointer */ | 351 | struct fc_seq *recov_seq; |
325 | struct fc_seq *seq_ptr; /* current sequence pointer */ | ||
326 | /* | ||
327 | * Error Processing | ||
328 | */ | ||
329 | u8 recov_retry; /* count of recovery retries */ | ||
330 | struct fc_seq *recov_seq; /* sequence for REC or SRR */ | ||
331 | }; | 352 | }; |
332 | /* | ||
333 | * FC_FCP HELPER FUNCTIONS | ||
334 | *****************************/ | ||
335 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | ||
336 | { | ||
337 | if (fsp && fsp->cmd) | ||
338 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; | ||
339 | return false; | ||
340 | } | ||
341 | 353 | ||
342 | /* | 354 | /* |
343 | * Structure and function definitions for managing Fibre Channel Exchanges | 355 | * Structure and function definitions for managing Fibre Channel Exchanges |
@@ -350,23 +362,51 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | |||
350 | 362 | ||
351 | struct fc_exch_mgr; | 363 | struct fc_exch_mgr; |
352 | struct fc_exch_mgr_anchor; | 364 | struct fc_exch_mgr_anchor; |
353 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ | 365 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ |
354 | 366 | ||
355 | /* | 367 | /** |
356 | * Sequence. | 368 | * struct fc_seq - FC sequence |
369 | * @id: The sequence ID | ||
370 | * @ssb_stat: Status flags for the sequence status block (SSB) | ||
371 | * @cnt: Number of frames sent so far | ||
372 | * @rec_data: FC-4 value for REC | ||
357 | */ | 373 | */ |
358 | struct fc_seq { | 374 | struct fc_seq { |
359 | u8 id; /* seq ID */ | 375 | u8 id; |
360 | u16 ssb_stat; /* status flags for sequence status block */ | 376 | u16 ssb_stat; |
361 | u16 cnt; /* frames sent so far on sequence */ | 377 | u16 cnt; |
362 | u32 rec_data; /* FC-4 value for REC */ | 378 | u32 rec_data; |
363 | }; | 379 | }; |
364 | 380 | ||
365 | #define FC_EX_DONE (1 << 0) /* ep is completed */ | 381 | #define FC_EX_DONE (1 << 0) /* ep is completed */ |
366 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ | 382 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ |
367 | 383 | ||
368 | /* | 384 | /** |
369 | * Exchange. | 385 | * struct fc_exch - Fibre Channel Exchange |
386 | * @em: Exchange manager | ||
387 | * @pool: Exchange pool | ||
388 | * @state: The exchange's state | ||
389 | * @xid: The exchange ID | ||
390 | * @ex_list: Handle used by the EM to track free exchanges | ||
391 | * @ex_lock: Lock that protects the exchange | ||
392 | * @ex_refcnt: Reference count | ||
393 | * @timeout_work: Handle for timeout handler | ||
394 | * @lp: The local port that this exchange is on | ||
395 | * @oxid: Originator's exchange ID | ||
396 | * @rxid: Responder's exchange ID | ||
397 | * @oid: Originator's FCID | ||
398 | * @sid: Source FCID | ||
399 | * @did: Destination FCID | ||
400 | * @esb_stat: ESB exchange status | ||
401 | * @r_a_tov: Resouce allocation time out value (in msecs) | ||
402 | * @seq_id: The next sequence ID to use | ||
403 | * @f_ctl: F_CTL flags for the sequence | ||
404 | * @fh_type: The frame type | ||
405 | * @class: The class of service | ||
406 | * @seq: The sequence in use on this exchange | ||
407 | * @resp: Callback for responses on this exchange | ||
408 | * @destructor: Called when destroying the exchange | ||
409 | * @arg: Passed as a void pointer to the resp() callback | ||
370 | * | 410 | * |
371 | * Locking notes: The ex_lock protects following items: | 411 | * Locking notes: The ex_lock protects following items: |
372 | * state, esb_stat, f_ctl, seq.ssb_stat | 412 | * state, esb_stat, f_ctl, seq.ssb_stat |
@@ -374,76 +414,59 @@ struct fc_seq { | |||
374 | * sequence allocation | 414 | * sequence allocation |
375 | */ | 415 | */ |
376 | struct fc_exch { | 416 | struct fc_exch { |
377 | struct fc_exch_mgr *em; /* exchange manager */ | 417 | struct fc_exch_mgr *em; |
378 | struct fc_exch_pool *pool; /* per cpu exches pool */ | 418 | struct fc_exch_pool *pool; |
379 | u32 state; /* internal driver state */ | 419 | u32 state; |
380 | u16 xid; /* our exchange ID */ | 420 | u16 xid; |
381 | struct list_head ex_list; /* free or busy list linkage */ | 421 | struct list_head ex_list; |
382 | spinlock_t ex_lock; /* lock covering exchange state */ | 422 | spinlock_t ex_lock; |
383 | atomic_t ex_refcnt; /* reference counter */ | 423 | atomic_t ex_refcnt; |
384 | struct delayed_work timeout_work; /* timer for upper level protocols */ | 424 | struct delayed_work timeout_work; |
385 | struct fc_lport *lp; /* fc device instance */ | 425 | struct fc_lport *lp; |
386 | u16 oxid; /* originator's exchange ID */ | 426 | u16 oxid; |
387 | u16 rxid; /* responder's exchange ID */ | 427 | u16 rxid; |
388 | u32 oid; /* originator's FCID */ | 428 | u32 oid; |
389 | u32 sid; /* source FCID */ | 429 | u32 sid; |
390 | u32 did; /* destination FCID */ | 430 | u32 did; |
391 | u32 esb_stat; /* exchange status for ESB */ | 431 | u32 esb_stat; |
392 | u32 r_a_tov; /* r_a_tov from rport (msec) */ | 432 | u32 r_a_tov; |
393 | u8 seq_id; /* next sequence ID to use */ | 433 | u8 seq_id; |
394 | u32 f_ctl; /* F_CTL flags for sequences */ | 434 | u32 f_ctl; |
395 | u8 fh_type; /* frame type */ | 435 | u8 fh_type; |
396 | enum fc_class class; /* class of service */ | 436 | enum fc_class class; |
397 | struct fc_seq seq; /* single sequence */ | 437 | struct fc_seq seq; |
398 | /* | 438 | |
399 | * Handler for responses to this current exchange. | 439 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); |
400 | */ | 440 | void *arg; |
401 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); | 441 | |
402 | void (*destructor)(struct fc_seq *, void *); | 442 | void (*destructor)(struct fc_seq *, void *); |
403 | /* | 443 | |
404 | * arg is passed as void pointer to exchange | ||
405 | * resp and destructor handlers | ||
406 | */ | ||
407 | void *arg; | ||
408 | }; | 444 | }; |
409 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) | 445 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) |
410 | 446 | ||
411 | struct libfc_function_template { | ||
412 | 447 | ||
448 | struct libfc_function_template { | ||
413 | /* | 449 | /* |
414 | * Interface to send a FC frame | 450 | * Interface to send a FC frame |
415 | * | 451 | * |
416 | * STATUS: REQUIRED | 452 | * STATUS: REQUIRED |
417 | */ | 453 | */ |
418 | int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp); | 454 | int (*frame_send)(struct fc_lport *, struct fc_frame *); |
419 | 455 | ||
420 | /* | 456 | /* |
421 | * Interface to send ELS/CT frames | 457 | * Interface to send ELS/CT frames |
422 | * | 458 | * |
423 | * STATUS: OPTIONAL | 459 | * STATUS: OPTIONAL |
424 | */ | 460 | */ |
425 | struct fc_seq *(*elsct_send)(struct fc_lport *lport, | 461 | struct fc_seq *(*elsct_send)(struct fc_lport *, u32 did, |
426 | u32 did, | 462 | struct fc_frame *, unsigned int op, |
427 | struct fc_frame *fp, | ||
428 | unsigned int op, | ||
429 | void (*resp)(struct fc_seq *, | 463 | void (*resp)(struct fc_seq *, |
430 | struct fc_frame *fp, | 464 | struct fc_frame *, void *arg), |
431 | void *arg), | ||
432 | void *arg, u32 timer_msec); | 465 | void *arg, u32 timer_msec); |
433 | 466 | ||
434 | /* | 467 | /* |
435 | * Send the FC frame payload using a new exchange and sequence. | 468 | * Send the FC frame payload using a new exchange and sequence. |
436 | * | 469 | * |
437 | * The frame pointer with some of the header's fields must be | ||
438 | * filled before calling exch_seq_send(), those fields are, | ||
439 | * | ||
440 | * - routing control | ||
441 | * - FC port did | ||
442 | * - FC port sid | ||
443 | * - FC header type | ||
444 | * - frame control | ||
445 | * - parameter or relative offset | ||
446 | * | ||
447 | * The exchange response handler is set in this routine to resp() | 470 | * The exchange response handler is set in this routine to resp() |
448 | * function pointer. It can be called in two scenarios: if a timeout | 471 | * function pointer. It can be called in two scenarios: if a timeout |
449 | * occurs or if a response frame is received for the exchange. The | 472 | * occurs or if a response frame is received for the exchange. The |
@@ -464,14 +487,13 @@ struct libfc_function_template { | |||
464 | * | 487 | * |
465 | * STATUS: OPTIONAL | 488 | * STATUS: OPTIONAL |
466 | */ | 489 | */ |
467 | struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, | 490 | struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *, |
468 | struct fc_frame *fp, | 491 | void (*resp)(struct fc_seq *, |
469 | void (*resp)(struct fc_seq *sp, | 492 | struct fc_frame *, |
470 | struct fc_frame *fp, | 493 | void *), |
471 | void *arg), | 494 | void (*destructor)(struct fc_seq *, |
472 | void (*destructor)(struct fc_seq *sp, | 495 | void *), |
473 | void *arg), | 496 | void *, unsigned int timer_msec); |
474 | void *arg, unsigned int timer_msec); | ||
475 | 497 | ||
476 | /* | 498 | /* |
477 | * Sets up the DDP context for a given exchange id on the given | 499 | * Sets up the DDP context for a given exchange id on the given |
@@ -479,22 +501,28 @@ struct libfc_function_template { | |||
479 | * | 501 | * |
480 | * STATUS: OPTIONAL | 502 | * STATUS: OPTIONAL |
481 | */ | 503 | */ |
482 | int (*ddp_setup)(struct fc_lport *lp, u16 xid, | 504 | int (*ddp_setup)(struct fc_lport *, u16, struct scatterlist *, |
483 | struct scatterlist *sgl, unsigned int sgc); | 505 | unsigned int); |
484 | /* | 506 | /* |
485 | * Completes the DDP transfer and returns the length of data DDPed | 507 | * Completes the DDP transfer and returns the length of data DDPed |
486 | * for the given exchange id. | 508 | * for the given exchange id. |
487 | * | 509 | * |
488 | * STATUS: OPTIONAL | 510 | * STATUS: OPTIONAL |
489 | */ | 511 | */ |
490 | int (*ddp_done)(struct fc_lport *lp, u16 xid); | 512 | int (*ddp_done)(struct fc_lport *, u16); |
513 | /* | ||
514 | * Allow LLD to fill its own Link Error Status Block | ||
515 | * | ||
516 | * STATUS: OPTIONAL | ||
517 | */ | ||
518 | void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb); | ||
491 | /* | 519 | /* |
492 | * Send a frame using an existing sequence and exchange. | 520 | * Send a frame using an existing sequence and exchange. |
493 | * | 521 | * |
494 | * STATUS: OPTIONAL | 522 | * STATUS: OPTIONAL |
495 | */ | 523 | */ |
496 | int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, | 524 | int (*seq_send)(struct fc_lport *, struct fc_seq *, |
497 | struct fc_frame *fp); | 525 | struct fc_frame *); |
498 | 526 | ||
499 | /* | 527 | /* |
500 | * Send an ELS response using infomation from a previous | 528 | * Send an ELS response using infomation from a previous |
@@ -502,8 +530,8 @@ struct libfc_function_template { | |||
502 | * | 530 | * |
503 | * STATUS: OPTIONAL | 531 | * STATUS: OPTIONAL |
504 | */ | 532 | */ |
505 | void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, | 533 | void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, |
506 | struct fc_seq_els_data *els_data); | 534 | struct fc_seq_els_data *); |
507 | 535 | ||
508 | /* | 536 | /* |
509 | * Abort an exchange and sequence. Generally called because of a | 537 | * Abort an exchange and sequence. Generally called because of a |
@@ -515,7 +543,7 @@ struct libfc_function_template { | |||
515 | * | 543 | * |
516 | * STATUS: OPTIONAL | 544 | * STATUS: OPTIONAL |
517 | */ | 545 | */ |
518 | int (*seq_exch_abort)(const struct fc_seq *req_sp, | 546 | int (*seq_exch_abort)(const struct fc_seq *, |
519 | unsigned int timer_msec); | 547 | unsigned int timer_msec); |
520 | 548 | ||
521 | /* | 549 | /* |
@@ -524,14 +552,14 @@ struct libfc_function_template { | |||
524 | * | 552 | * |
525 | * STATUS: OPTIONAL | 553 | * STATUS: OPTIONAL |
526 | */ | 554 | */ |
527 | void (*exch_done)(struct fc_seq *sp); | 555 | void (*exch_done)(struct fc_seq *); |
528 | 556 | ||
529 | /* | 557 | /* |
530 | * Start a new sequence on the same exchange/sequence tuple. | 558 | * Start a new sequence on the same exchange/sequence tuple. |
531 | * | 559 | * |
532 | * STATUS: OPTIONAL | 560 | * STATUS: OPTIONAL |
533 | */ | 561 | */ |
534 | struct fc_seq *(*seq_start_next)(struct fc_seq *sp); | 562 | struct fc_seq *(*seq_start_next)(struct fc_seq *); |
535 | 563 | ||
536 | /* | 564 | /* |
537 | * Reset an exchange manager, completing all sequences and exchanges. | 565 | * Reset an exchange manager, completing all sequences and exchanges. |
@@ -540,8 +568,7 @@ struct libfc_function_template { | |||
540 | * | 568 | * |
541 | * STATUS: OPTIONAL | 569 | * STATUS: OPTIONAL |
542 | */ | 570 | */ |
543 | void (*exch_mgr_reset)(struct fc_lport *, | 571 | void (*exch_mgr_reset)(struct fc_lport *, u32 s_id, u32 d_id); |
544 | u32 s_id, u32 d_id); | ||
545 | 572 | ||
546 | /* | 573 | /* |
547 | * Flush the rport work queue. Generally used before shutdown. | 574 | * Flush the rport work queue. Generally used before shutdown. |
@@ -555,8 +582,8 @@ struct libfc_function_template { | |||
555 | * | 582 | * |
556 | * STATUS: OPTIONAL | 583 | * STATUS: OPTIONAL |
557 | */ | 584 | */ |
558 | void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, | 585 | void (*lport_recv)(struct fc_lport *, struct fc_seq *, |
559 | struct fc_frame *fp); | 586 | struct fc_frame *); |
560 | 587 | ||
561 | /* | 588 | /* |
562 | * Reset the local port. | 589 | * Reset the local port. |
@@ -566,6 +593,26 @@ struct libfc_function_template { | |||
566 | int (*lport_reset)(struct fc_lport *); | 593 | int (*lport_reset)(struct fc_lport *); |
567 | 594 | ||
568 | /* | 595 | /* |
596 | * Set the local port FC_ID. | ||
597 | * | ||
598 | * This may be provided by the LLD to allow it to be | ||
599 | * notified when the local port is assigned a FC-ID. | ||
600 | * | ||
601 | * The frame, if non-NULL, is the incoming frame with the | ||
602 | * FLOGI LS_ACC or FLOGI, and may contain the granted MAC | ||
603 | * address for the LLD. The frame pointer may be NULL if | ||
604 | * no MAC is associated with this assignment (LOGO or PLOGI). | ||
605 | * | ||
606 | * If FC_ID is non-zero, r_a_tov and e_d_tov must be valid. | ||
607 | * | ||
608 | * Note: this is called with the local port mutex held. | ||
609 | * | ||
610 | * STATUS: OPTIONAL | ||
611 | */ | ||
612 | void (*lport_set_port_id)(struct fc_lport *, u32 port_id, | ||
613 | struct fc_frame *); | ||
614 | |||
615 | /* | ||
569 | * Create a remote port with a given port ID | 616 | * Create a remote port with a given port ID |
570 | * | 617 | * |
571 | * STATUS: OPTIONAL | 618 | * STATUS: OPTIONAL |
@@ -622,31 +669,31 @@ struct libfc_function_template { | |||
622 | * | 669 | * |
623 | * STATUS: OPTIONAL | 670 | * STATUS: OPTIONAL |
624 | */ | 671 | */ |
625 | int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, | 672 | int (*fcp_cmd_send)(struct fc_lport *, struct fc_fcp_pkt *, |
626 | void (*resp)(struct fc_seq *, struct fc_frame *fp, | 673 | void (*resp)(struct fc_seq *, struct fc_frame *, |
627 | void *arg)); | 674 | void *)); |
628 | 675 | ||
629 | /* | 676 | /* |
630 | * Cleanup the FCP layer, used durring link down and reset | 677 | * Cleanup the FCP layer, used durring link down and reset |
631 | * | 678 | * |
632 | * STATUS: OPTIONAL | 679 | * STATUS: OPTIONAL |
633 | */ | 680 | */ |
634 | void (*fcp_cleanup)(struct fc_lport *lp); | 681 | void (*fcp_cleanup)(struct fc_lport *); |
635 | 682 | ||
636 | /* | 683 | /* |
637 | * Abort all I/O on a local port | 684 | * Abort all I/O on a local port |
638 | * | 685 | * |
639 | * STATUS: OPTIONAL | 686 | * STATUS: OPTIONAL |
640 | */ | 687 | */ |
641 | void (*fcp_abort_io)(struct fc_lport *lp); | 688 | void (*fcp_abort_io)(struct fc_lport *); |
642 | 689 | ||
643 | /* | 690 | /* |
644 | * Receive a request for the discovery layer. | 691 | * Receive a request for the discovery layer. |
645 | * | 692 | * |
646 | * STATUS: OPTIONAL | 693 | * STATUS: OPTIONAL |
647 | */ | 694 | */ |
648 | void (*disc_recv_req)(struct fc_seq *, | 695 | void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, |
649 | struct fc_frame *, struct fc_lport *); | 696 | struct fc_lport *); |
650 | 697 | ||
651 | /* | 698 | /* |
652 | * Start discovery for a local port. | 699 | * Start discovery for a local port. |
@@ -675,419 +722,340 @@ struct libfc_function_template { | |||
675 | void (*disc_stop_final) (struct fc_lport *); | 722 | void (*disc_stop_final) (struct fc_lport *); |
676 | }; | 723 | }; |
677 | 724 | ||
678 | /* information used by the discovery layer */ | 725 | /** |
726 | * struct fc_disc - Discovery context | ||
727 | * @retry_count: Number of retries | ||
728 | * @pending: 1 if discovery is pending, 0 if not | ||
729 | * @requesting: 1 if discovery has been requested, 0 if not | ||
730 | * @seq_count: Number of sequences used for discovery | ||
731 | * @buf_len: Length of the discovery buffer | ||
732 | * @disc_id: Discovery ID | ||
733 | * @rports: List of discovered remote ports | ||
734 | * @lport: The local port that discovery is for | ||
735 | * @disc_mutex: Mutex that protects the discovery context | ||
736 | * @partial_buf: Partial name buffer (if names are returned | ||
737 | * in multiple frames) | ||
738 | * @disc_work: handle for delayed work context | ||
739 | * @disc_callback: Callback routine called when discovery completes | ||
740 | */ | ||
679 | struct fc_disc { | 741 | struct fc_disc { |
680 | unsigned char retry_count; | 742 | unsigned char retry_count; |
681 | unsigned char pending; | 743 | unsigned char pending; |
682 | unsigned char requested; | 744 | unsigned char requested; |
683 | unsigned short seq_count; | 745 | unsigned short seq_count; |
684 | unsigned char buf_len; | 746 | unsigned char buf_len; |
685 | u16 disc_id; | 747 | u16 disc_id; |
748 | |||
749 | struct list_head rports; | ||
750 | struct fc_lport *lport; | ||
751 | struct mutex disc_mutex; | ||
752 | struct fc_gpn_ft_resp partial_buf; | ||
753 | struct delayed_work disc_work; | ||
686 | 754 | ||
687 | void (*disc_callback)(struct fc_lport *, | 755 | void (*disc_callback)(struct fc_lport *, |
688 | enum fc_disc_event); | 756 | enum fc_disc_event); |
689 | |||
690 | struct list_head rports; | ||
691 | struct fc_lport *lport; | ||
692 | struct mutex disc_mutex; | ||
693 | struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ | ||
694 | struct delayed_work disc_work; | ||
695 | }; | 757 | }; |
696 | 758 | ||
759 | /** | ||
760 | * struct fc_lport - Local port | ||
761 | * @host: The SCSI host associated with a local port | ||
762 | * @ema_list: Exchange manager anchor list | ||
763 | * @dns_rdata: The directory server remote port | ||
764 | * @ptp_rdata: Point to point remote port | ||
765 | * @scsi_priv: FCP layer internal data | ||
766 | * @disc: Discovery context | ||
767 | * @vports: Child vports if N_Port | ||
768 | * @vport: Parent vport if VN_Port | ||
769 | * @tt: Libfc function template | ||
770 | * @link_up: Link state (1 = link up, 0 = link down) | ||
771 | * @qfull: Queue state (1 queue is full, 0 queue is not full) | ||
772 | * @state: Identifies the state | ||
773 | * @boot_time: Timestamp indicating when the local port came online | ||
774 | * @host_stats: SCSI host statistics | ||
775 | * @dev_stats: FCoE device stats (TODO: libfc should not be | ||
776 | * FCoE aware) | ||
777 | * @retry_count: Number of retries in the current state | ||
778 | * @wwpn: World Wide Port Name | ||
779 | * @wwnn: World Wide Node Name | ||
780 | * @service_params: Common service parameters | ||
781 | * @e_d_tov: Error detection timeout value | ||
782 | * @r_a_tov: Resouce allocation timeout value | ||
783 | * @rnid_gen: RNID information | ||
784 | * @sg_supp: Indicates if scatter gather is supported | ||
785 | * @seq_offload: Indicates if sequence offload is supported | ||
786 | * @crc_offload: Indicates if CRC offload is supported | ||
787 | * @lro_enabled: Indicates if large receive offload is supported | ||
788 | * @does_npiv: Supports multiple vports | ||
789 | * @npiv_enabled: Switch/fabric allows NPIV | ||
790 | * @mfs: The maximum Fibre Channel payload size | ||
791 | * @max_retry_count: The maximum retry attempts | ||
792 | * @max_rport_retry_count: The maximum remote port retry attempts | ||
793 | * @lro_xid: The maximum XID for LRO | ||
794 | * @lso_max: The maximum large offload send size | ||
795 | * @fcts: FC-4 type mask | ||
796 | * @lp_mutex: Mutex to protect the local port | ||
797 | * @list: Handle for list of local ports | ||
798 | * @retry_work: Handle to local port for delayed retry context | ||
799 | */ | ||
697 | struct fc_lport { | 800 | struct fc_lport { |
698 | struct list_head list; | ||
699 | |||
700 | /* Associations */ | 801 | /* Associations */ |
701 | struct Scsi_Host *host; | 802 | struct Scsi_Host *host; |
702 | struct list_head ema_list; | 803 | struct list_head ema_list; |
703 | struct fc_rport_priv *dns_rp; | 804 | struct fc_rport_priv *dns_rdata; |
704 | struct fc_rport_priv *ptp_rp; | 805 | struct fc_rport_priv *ptp_rdata; |
705 | void *scsi_priv; | 806 | void *scsi_priv; |
706 | struct fc_disc disc; | 807 | struct fc_disc disc; |
808 | |||
809 | /* Virtual port information */ | ||
810 | struct list_head vports; | ||
811 | struct fc_vport *vport; | ||
707 | 812 | ||
708 | /* Operational Information */ | 813 | /* Operational Information */ |
709 | struct libfc_function_template tt; | 814 | struct libfc_function_template tt; |
710 | u8 link_up; | 815 | u8 link_up; |
711 | u8 qfull; | 816 | u8 qfull; |
712 | enum fc_lport_state state; | 817 | enum fc_lport_state state; |
713 | unsigned long boot_time; | 818 | unsigned long boot_time; |
714 | 819 | struct fc_host_statistics host_stats; | |
715 | struct fc_host_statistics host_stats; | 820 | struct fcoe_dev_stats *dev_stats; |
716 | struct fcoe_dev_stats *dev_stats; | 821 | u8 retry_count; |
717 | 822 | ||
718 | u64 wwpn; | 823 | /* Fabric information */ |
719 | u64 wwnn; | 824 | u64 wwpn; |
720 | u8 retry_count; | 825 | u64 wwnn; |
826 | unsigned int service_params; | ||
827 | unsigned int e_d_tov; | ||
828 | unsigned int r_a_tov; | ||
829 | struct fc_els_rnid_gen rnid_gen; | ||
721 | 830 | ||
722 | /* Capabilities */ | 831 | /* Capabilities */ |
723 | u32 sg_supp:1; /* scatter gather supported */ | 832 | u32 sg_supp:1; |
724 | u32 seq_offload:1; /* seq offload supported */ | 833 | u32 seq_offload:1; |
725 | u32 crc_offload:1; /* crc offload supported */ | 834 | u32 crc_offload:1; |
726 | u32 lro_enabled:1; /* large receive offload */ | 835 | u32 lro_enabled:1; |
727 | u32 mfs; /* max FC payload size */ | 836 | u32 does_npiv:1; |
728 | unsigned int service_params; | 837 | u32 npiv_enabled:1; |
729 | unsigned int e_d_tov; | 838 | u32 mfs; |
730 | unsigned int r_a_tov; | 839 | u8 max_retry_count; |
731 | u8 max_retry_count; | 840 | u8 max_rport_retry_count; |
732 | u8 max_rport_retry_count; | 841 | u16 link_speed; |
733 | u16 link_speed; | 842 | u16 link_supported_speeds; |
734 | u16 link_supported_speeds; | 843 | u16 lro_xid; |
735 | u16 lro_xid; /* max xid for fcoe lro */ | 844 | unsigned int lso_max; |
736 | unsigned int lso_max; /* max large send size */ | 845 | struct fc_ns_fts fcts; |
737 | struct fc_ns_fts fcts; /* FC-4 type masks */ | ||
738 | struct fc_els_rnid_gen rnid_gen; /* RNID information */ | ||
739 | |||
740 | /* Semaphores */ | ||
741 | struct mutex lp_mutex; | ||
742 | 846 | ||
743 | /* Miscellaneous */ | 847 | /* Miscellaneous */ |
744 | struct delayed_work retry_work; | 848 | struct mutex lp_mutex; |
745 | struct delayed_work disc_work; | 849 | struct list_head list; |
850 | struct delayed_work retry_work; | ||
746 | }; | 851 | }; |
747 | 852 | ||
748 | /* | 853 | /* |
749 | * FC_LPORT HELPER FUNCTIONS | 854 | * FC_LPORT HELPER FUNCTIONS |
750 | *****************************/ | 855 | *****************************/ |
751 | static inline int fc_lport_test_ready(struct fc_lport *lp) | 856 | |
857 | /** | ||
858 | * fc_lport_test_ready() - Determine if a local port is in the READY state | ||
859 | * @lport: The local port to test | ||
860 | */ | ||
861 | static inline int fc_lport_test_ready(struct fc_lport *lport) | ||
752 | { | 862 | { |
753 | return lp->state == LPORT_ST_READY; | 863 | return lport->state == LPORT_ST_READY; |
754 | } | 864 | } |
755 | 865 | ||
756 | static inline void fc_set_wwnn(struct fc_lport *lp, u64 wwnn) | 866 | /** |
867 | * fc_set_wwnn() - Set the World Wide Node Name of a local port | ||
868 | * @lport: The local port whose WWNN is to be set | ||
869 | * @wwnn: The new WWNN | ||
870 | */ | ||
871 | static inline void fc_set_wwnn(struct fc_lport *lport, u64 wwnn) | ||
757 | { | 872 | { |
758 | lp->wwnn = wwnn; | 873 | lport->wwnn = wwnn; |
759 | } | 874 | } |
760 | 875 | ||
761 | static inline void fc_set_wwpn(struct fc_lport *lp, u64 wwnn) | 876 | /** |
877 | * fc_set_wwpn() - Set the World Wide Port Name of a local port | ||
878 | * @lport: The local port whose WWPN is to be set | ||
879 | * @wwnn: The new WWPN | ||
880 | */ | ||
881 | static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn) | ||
762 | { | 882 | { |
763 | lp->wwpn = wwnn; | 883 | lport->wwpn = wwnn; |
764 | } | 884 | } |
765 | 885 | ||
766 | static inline void fc_lport_state_enter(struct fc_lport *lp, | 886 | /** |
887 | * fc_lport_state_enter() - Change a local port's state | ||
888 | * @lport: The local port whose state is to change | ||
889 | * @state: The new state | ||
890 | */ | ||
891 | static inline void fc_lport_state_enter(struct fc_lport *lport, | ||
767 | enum fc_lport_state state) | 892 | enum fc_lport_state state) |
768 | { | 893 | { |
769 | if (state != lp->state) | 894 | if (state != lport->state) |
770 | lp->retry_count = 0; | 895 | lport->retry_count = 0; |
771 | lp->state = state; | 896 | lport->state = state; |
772 | } | 897 | } |
773 | 898 | ||
774 | static inline int fc_lport_init_stats(struct fc_lport *lp) | 899 | /** |
900 | * fc_lport_init_stats() - Allocate per-CPU statistics for a local port | ||
901 | * @lport: The local port whose statistics are to be initialized | ||
902 | */ | ||
903 | static inline int fc_lport_init_stats(struct fc_lport *lport) | ||
775 | { | 904 | { |
776 | /* allocate per cpu stats block */ | 905 | lport->dev_stats = alloc_percpu(struct fcoe_dev_stats); |
777 | lp->dev_stats = alloc_percpu(struct fcoe_dev_stats); | 906 | if (!lport->dev_stats) |
778 | if (!lp->dev_stats) | ||
779 | return -ENOMEM; | 907 | return -ENOMEM; |
780 | return 0; | 908 | return 0; |
781 | } | 909 | } |
782 | 910 | ||
783 | static inline void fc_lport_free_stats(struct fc_lport *lp) | 911 | /** |
912 | * fc_lport_free_stats() - Free memory for a local port's statistics | ||
913 | * @lport: The local port whose statistics are to be freed | ||
914 | */ | ||
915 | static inline void fc_lport_free_stats(struct fc_lport *lport) | ||
784 | { | 916 | { |
785 | free_percpu(lp->dev_stats); | 917 | free_percpu(lport->dev_stats); |
786 | } | 918 | } |
787 | 919 | ||
788 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp) | 920 | /** |
921 | * fc_lport_get_stats() - Get a local port's statistics | ||
922 | * @lport: The local port whose statistics are to be retreived | ||
923 | */ | ||
924 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport) | ||
789 | { | 925 | { |
790 | return per_cpu_ptr(lp->dev_stats, smp_processor_id()); | 926 | return per_cpu_ptr(lport->dev_stats, smp_processor_id()); |
791 | } | 927 | } |
792 | 928 | ||
793 | static inline void *lport_priv(const struct fc_lport *lp) | 929 | /** |
930 | * lport_priv() - Return the private data from a local port | ||
931 | * @lport: The local port whose private data is to be retreived | ||
932 | */ | ||
933 | static inline void *lport_priv(const struct fc_lport *lport) | ||
794 | { | 934 | { |
795 | return (void *)(lp + 1); | 935 | return (void *)(lport + 1); |
796 | } | 936 | } |
797 | 937 | ||
798 | /** | 938 | /** |
799 | * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport | 939 | * libfc_host_alloc() - Allocate a Scsi_Host with room for a local port and |
800 | * @sht: ptr to the scsi host templ | 940 | * LLD private data |
801 | * @priv_size: size of private data after fc_lport | 941 | * @sht: The SCSI host template |
942 | * @priv_size: Size of private data | ||
802 | * | 943 | * |
803 | * Returns: ptr to Scsi_Host | 944 | * Returns: libfc lport |
804 | */ | 945 | */ |
805 | static inline struct Scsi_Host * | 946 | static inline struct fc_lport * |
806 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | 947 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) |
807 | { | 948 | { |
808 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | 949 | struct fc_lport *lport; |
950 | struct Scsi_Host *shost; | ||
951 | |||
952 | shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size); | ||
953 | if (!shost) | ||
954 | return NULL; | ||
955 | lport = shost_priv(shost); | ||
956 | lport->host = shost; | ||
957 | INIT_LIST_HEAD(&lport->ema_list); | ||
958 | INIT_LIST_HEAD(&lport->vports); | ||
959 | return lport; | ||
809 | } | 960 | } |
810 | 961 | ||
811 | /* | 962 | /* |
812 | * LOCAL PORT LAYER | 963 | * FC_FCP HELPER FUNCTIONS |
813 | *****************************/ | 964 | *****************************/ |
814 | int fc_lport_init(struct fc_lport *lp); | 965 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) |
815 | 966 | { | |
816 | /* | 967 | if (fsp && fsp->cmd) |
817 | * Destroy the specified local port by finding and freeing all | 968 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; |
818 | * fc_rports associated with it and then by freeing the fc_lport | 969 | return false; |
819 | * itself. | 970 | } |
820 | */ | ||
821 | int fc_lport_destroy(struct fc_lport *lp); | ||
822 | |||
823 | /* | ||
824 | * Logout the specified local port from the fabric | ||
825 | */ | ||
826 | int fc_fabric_logoff(struct fc_lport *lp); | ||
827 | |||
828 | /* | ||
829 | * Initiate the LP state machine. This handler will use fc_host_attr | ||
830 | * to store the FLOGI service parameters, so fc_host_attr must be | ||
831 | * initialized before calling this handler. | ||
832 | */ | ||
833 | int fc_fabric_login(struct fc_lport *lp); | ||
834 | 971 | ||
835 | /* | 972 | /* |
836 | * The link is up for the given local port. | 973 | * LOCAL PORT LAYER |
837 | */ | 974 | *****************************/ |
975 | int fc_lport_init(struct fc_lport *); | ||
976 | int fc_lport_destroy(struct fc_lport *); | ||
977 | int fc_fabric_logoff(struct fc_lport *); | ||
978 | int fc_fabric_login(struct fc_lport *); | ||
979 | void __fc_linkup(struct fc_lport *); | ||
838 | void fc_linkup(struct fc_lport *); | 980 | void fc_linkup(struct fc_lport *); |
839 | 981 | void __fc_linkdown(struct fc_lport *); | |
840 | /* | ||
841 | * Link is down for the given local port. | ||
842 | */ | ||
843 | void fc_linkdown(struct fc_lport *); | 982 | void fc_linkdown(struct fc_lport *); |
844 | 983 | void fc_vport_setlink(struct fc_lport *); | |
845 | /* | 984 | void fc_vports_linkchange(struct fc_lport *); |
846 | * Configure the local port. | ||
847 | */ | ||
848 | int fc_lport_config(struct fc_lport *); | 985 | int fc_lport_config(struct fc_lport *); |
849 | |||
850 | /* | ||
851 | * Reset the local port. | ||
852 | */ | ||
853 | int fc_lport_reset(struct fc_lport *); | 986 | int fc_lport_reset(struct fc_lport *); |
854 | 987 | int fc_set_mfs(struct fc_lport *, u32 mfs); | |
855 | /* | 988 | struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); |
856 | * Set the mfs or reset | 989 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); |
857 | */ | 990 | int fc_lport_bsg_request(struct fc_bsg_job *); |
858 | int fc_set_mfs(struct fc_lport *lp, u32 mfs); | ||
859 | |||
860 | 991 | ||
861 | /* | 992 | /* |
862 | * REMOTE PORT LAYER | 993 | * REMOTE PORT LAYER |
863 | *****************************/ | 994 | *****************************/ |
864 | int fc_rport_init(struct fc_lport *lp); | 995 | int fc_rport_init(struct fc_lport *); |
865 | void fc_rport_terminate_io(struct fc_rport *rp); | 996 | void fc_rport_terminate_io(struct fc_rport *); |
866 | 997 | ||
867 | /* | 998 | /* |
868 | * DISCOVERY LAYER | 999 | * DISCOVERY LAYER |
869 | *****************************/ | 1000 | *****************************/ |
870 | int fc_disc_init(struct fc_lport *lp); | 1001 | int fc_disc_init(struct fc_lport *); |
871 | |||
872 | 1002 | ||
873 | /* | 1003 | /* |
874 | * SCSI LAYER | 1004 | * FCP LAYER |
875 | *****************************/ | 1005 | *****************************/ |
876 | /* | ||
877 | * Initialize the SCSI block of libfc | ||
878 | */ | ||
879 | int fc_fcp_init(struct fc_lport *); | 1006 | int fc_fcp_init(struct fc_lport *); |
880 | |||
881 | /* | ||
882 | * This section provides an API which allows direct interaction | ||
883 | * with the SCSI-ml. Each of these functions satisfies a function | ||
884 | * pointer defined in Scsi_Host and therefore is always called | ||
885 | * directly from the SCSI-ml. | ||
886 | */ | ||
887 | int fc_queuecommand(struct scsi_cmnd *sc_cmd, | ||
888 | void (*done)(struct scsi_cmnd *)); | ||
889 | |||
890 | /* | ||
891 | * complete processing of a fcp packet | ||
892 | * | ||
893 | * This function may sleep if a fsp timer is pending. | ||
894 | * The host lock must not be held by caller. | ||
895 | */ | ||
896 | void fc_fcp_complete(struct fc_fcp_pkt *fsp); | ||
897 | |||
898 | /* | ||
899 | * Send an ABTS frame to the target device. The sc_cmd argument | ||
900 | * is a pointer to the SCSI command to be aborted. | ||
901 | */ | ||
902 | int fc_eh_abort(struct scsi_cmnd *sc_cmd); | ||
903 | |||
904 | /* | ||
905 | * Reset a LUN by sending send the tm cmd to the target. | ||
906 | */ | ||
907 | int fc_eh_device_reset(struct scsi_cmnd *sc_cmd); | ||
908 | |||
909 | /* | ||
910 | * Reset the host adapter. | ||
911 | */ | ||
912 | int fc_eh_host_reset(struct scsi_cmnd *sc_cmd); | ||
913 | |||
914 | /* | ||
915 | * Check rport status. | ||
916 | */ | ||
917 | int fc_slave_alloc(struct scsi_device *sdev); | ||
918 | |||
919 | /* | ||
920 | * Adjust the queue depth. | ||
921 | */ | ||
922 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth); | ||
923 | |||
924 | /* | ||
925 | * Change the tag type. | ||
926 | */ | ||
927 | int fc_change_queue_type(struct scsi_device *sdev, int tag_type); | ||
928 | |||
929 | /* | ||
930 | * Free memory pools used by the FCP layer. | ||
931 | */ | ||
932 | void fc_fcp_destroy(struct fc_lport *); | 1007 | void fc_fcp_destroy(struct fc_lport *); |
933 | 1008 | ||
934 | /* | 1009 | /* |
935 | * Set up direct-data placement for this I/O request | 1010 | * SCSI INTERACTION LAYER |
936 | */ | 1011 | *****************************/ |
937 | void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); | 1012 | int fc_queuecommand(struct scsi_cmnd *, |
1013 | void (*done)(struct scsi_cmnd *)); | ||
1014 | int fc_eh_abort(struct scsi_cmnd *); | ||
1015 | int fc_eh_device_reset(struct scsi_cmnd *); | ||
1016 | int fc_eh_host_reset(struct scsi_cmnd *); | ||
1017 | int fc_slave_alloc(struct scsi_device *); | ||
1018 | int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason); | ||
1019 | int fc_change_queue_type(struct scsi_device *, int tag_type); | ||
938 | 1020 | ||
939 | /* | 1021 | /* |
940 | * ELS/CT interface | 1022 | * ELS/CT interface |
941 | *****************************/ | 1023 | *****************************/ |
942 | /* | 1024 | int fc_elsct_init(struct fc_lport *); |
943 | * Initializes ELS/CT interface | 1025 | struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did, |
944 | */ | 1026 | struct fc_frame *, |
945 | int fc_elsct_init(struct fc_lport *lp); | 1027 | unsigned int op, |
1028 | void (*resp)(struct fc_seq *, | ||
1029 | struct fc_frame *, | ||
1030 | void *arg), | ||
1031 | void *arg, u32 timer_msec); | ||
1032 | void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); | ||
1033 | void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); | ||
946 | 1034 | ||
947 | 1035 | ||
948 | /* | 1036 | /* |
949 | * EXCHANGE MANAGER LAYER | 1037 | * EXCHANGE MANAGER LAYER |
950 | *****************************/ | 1038 | *****************************/ |
951 | /* | 1039 | int fc_exch_init(struct fc_lport *); |
952 | * Initializes Exchange Manager related | 1040 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *, |
953 | * function pointers in struct libfc_function_template. | 1041 | struct fc_exch_mgr *, |
954 | */ | ||
955 | int fc_exch_init(struct fc_lport *lp); | ||
956 | |||
957 | /* | ||
958 | * Adds Exchange Manager (EM) mp to lport. | ||
959 | * | ||
960 | * Adds specified mp to lport using struct fc_exch_mgr_anchor, | ||
961 | * the struct fc_exch_mgr_anchor allows same EM sharing by | ||
962 | * more than one lport with their specified match function, | ||
963 | * the match function is used in allocating exchange from | ||
964 | * added mp. | ||
965 | */ | ||
966 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport, | ||
967 | struct fc_exch_mgr *mp, | ||
968 | bool (*match)(struct fc_frame *)); | 1042 | bool (*match)(struct fc_frame *)); |
969 | 1043 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *); | |
970 | /* | 1044 | int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst); |
971 | * Deletes Exchange Manager (EM) from lport by removing | 1045 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class, |
972 | * its anchor ema from lport. | 1046 | u16 min_xid, u16 max_xid, |
973 | * | ||
974 | * If removed anchor ema was the last user of its associated EM | ||
975 | * then also destroys associated EM. | ||
976 | */ | ||
977 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); | ||
978 | |||
979 | /* | ||
980 | * Allocates an Exchange Manager (EM). | ||
981 | * | ||
982 | * The EM manages exchanges for their allocation and | ||
983 | * free, also allows exchange lookup for received | ||
984 | * frame. | ||
985 | * | ||
986 | * The class is used for initializing FC class of | ||
987 | * allocated exchange from EM. | ||
988 | * | ||
989 | * The min_xid and max_xid will limit new | ||
990 | * exchange ID (XID) within this range for | ||
991 | * a new exchange. | ||
992 | * The LLD may choose to have multiple EMs, | ||
993 | * e.g. one EM instance per CPU receive thread in LLD. | ||
994 | * | ||
995 | * Specified match function is used in allocating exchanges | ||
996 | * from newly allocated EM. | ||
997 | */ | ||
998 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, | ||
999 | enum fc_class class, | ||
1000 | u16 min_xid, | ||
1001 | u16 max_xid, | ||
1002 | bool (*match)(struct fc_frame *)); | 1047 | bool (*match)(struct fc_frame *)); |
1003 | 1048 | void fc_exch_mgr_free(struct fc_lport *); | |
1004 | /* | 1049 | void fc_exch_recv(struct fc_lport *, struct fc_frame *); |
1005 | * Free all exchange managers of a lport. | ||
1006 | */ | ||
1007 | void fc_exch_mgr_free(struct fc_lport *lport); | ||
1008 | |||
1009 | /* | ||
1010 | * Receive a frame on specified local port and exchange manager. | ||
1011 | */ | ||
1012 | void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp); | ||
1013 | |||
1014 | /* | ||
1015 | * This function is for exch_seq_send function pointer in | ||
1016 | * struct libfc_function_template, see comment block on | ||
1017 | * exch_seq_send for description of this function. | ||
1018 | */ | ||
1019 | struct fc_seq *fc_exch_seq_send(struct fc_lport *lp, | ||
1020 | struct fc_frame *fp, | ||
1021 | void (*resp)(struct fc_seq *sp, | ||
1022 | struct fc_frame *fp, | ||
1023 | void *arg), | ||
1024 | void (*destructor)(struct fc_seq *sp, | ||
1025 | void *arg), | ||
1026 | void *arg, u32 timer_msec); | ||
1027 | |||
1028 | /* | ||
1029 | * send a frame using existing sequence and exchange. | ||
1030 | */ | ||
1031 | int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp, struct fc_frame *fp); | ||
1032 | |||
1033 | /* | ||
1034 | * Send ELS response using mainly infomation | ||
1035 | * in exchange and sequence in EM layer. | ||
1036 | */ | ||
1037 | void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd, | ||
1038 | struct fc_seq_els_data *els_data); | ||
1039 | |||
1040 | /* | ||
1041 | * This function is for seq_exch_abort function pointer in | ||
1042 | * struct libfc_function_template, see comment block on | ||
1043 | * seq_exch_abort for description of this function. | ||
1044 | */ | ||
1045 | int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec); | ||
1046 | |||
1047 | /* | ||
1048 | * Indicate that an exchange/sequence tuple is complete and the memory | ||
1049 | * allocated for the related objects may be freed. | ||
1050 | */ | ||
1051 | void fc_exch_done(struct fc_seq *sp); | ||
1052 | |||
1053 | /* | ||
1054 | * Allocate a new exchange and sequence pair. | ||
1055 | */ | ||
1056 | struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp); | ||
1057 | /* | ||
1058 | * Start a new sequence on the same exchange as the supplied sequence. | ||
1059 | */ | ||
1060 | struct fc_seq *fc_seq_start_next(struct fc_seq *sp); | ||
1061 | |||
1062 | |||
1063 | /* | ||
1064 | * Reset all EMs of a lport, releasing its all sequences and | ||
1065 | * exchanges. If sid is non-zero, then reset only exchanges | ||
1066 | * we sourced from that FID. If did is non-zero, reset only | ||
1067 | * exchanges destined to that FID. | ||
1068 | */ | ||
1069 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); | 1050 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); |
1070 | 1051 | ||
1071 | /* | 1052 | /* |
1072 | * Functions for fc_functions_template | 1053 | * Functions for fc_functions_template |
1073 | */ | 1054 | */ |
1074 | void fc_get_host_speed(struct Scsi_Host *shost); | 1055 | void fc_get_host_speed(struct Scsi_Host *); |
1075 | void fc_get_host_port_type(struct Scsi_Host *shost); | 1056 | void fc_get_host_port_type(struct Scsi_Host *); |
1076 | void fc_get_host_port_state(struct Scsi_Host *shost); | 1057 | void fc_get_host_port_state(struct Scsi_Host *); |
1077 | void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout); | 1058 | void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); |
1078 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); | 1059 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); |
1079 | 1060 | ||
1080 | /* | ||
1081 | * module setup functions. | ||
1082 | */ | ||
1083 | int fc_setup_exch_mgr(void); | ||
1084 | void fc_destroy_exch_mgr(void); | ||
1085 | int fc_setup_rport(void); | ||
1086 | void fc_destroy_rport(void); | ||
1087 | |||
1088 | /* | ||
1089 | * Internal libfc functions. | ||
1090 | */ | ||
1091 | const char *fc_els_resp_type(struct fc_frame *); | ||
1092 | |||
1093 | #endif /* _LIBFC_H_ */ | 1061 | #endif /* _LIBFC_H_ */ |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index b2410605b740..c603f4a7e7fc 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -53,33 +53,36 @@ enum fip_state { | |||
53 | }; | 53 | }; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * struct fcoe_ctlr - FCoE Controller and FIP state. | 56 | * struct fcoe_ctlr - FCoE Controller and FIP state |
57 | * @state: internal FIP state for network link and FIP or non-FIP mode. | 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. |
58 | * @lp: &fc_lport: libfc local port. | 58 | * @mode: LLD-selected mode. |
59 | * @sel_fcf: currently selected FCF, or NULL. | 59 | * @lp: &fc_lport: libfc local port. |
60 | * @fcfs: list of discovered FCFs. | 60 | * @sel_fcf: currently selected FCF, or NULL. |
61 | * @fcf_count: number of discovered FCF entries. | 61 | * @fcfs: list of discovered FCFs. |
62 | * @sol_time: time when a multicast solicitation was last sent. | 62 | * @fcf_count: number of discovered FCF entries. |
63 | * @sel_time: time after which to select an FCF. | 63 | * @sol_time: time when a multicast solicitation was last sent. |
64 | * @port_ka_time: time of next port keep-alive. | 64 | * @sel_time: time after which to select an FCF. |
65 | * @ctlr_ka_time: time of next controller keep-alive. | 65 | * @port_ka_time: time of next port keep-alive. |
66 | * @timer: timer struct used for all delayed events. | 66 | * @ctlr_ka_time: time of next controller keep-alive. |
67 | * @link_work: &work_struct for doing FCF selection. | 67 | * @timer: timer struct used for all delayed events. |
68 | * @recv_work: &work_struct for receiving FIP frames. | 68 | * @link_work: &work_struct for doing FCF selection. |
69 | * @recv_work: &work_struct for receiving FIP frames. | ||
69 | * @fip_recv_list: list of received FIP frames. | 70 | * @fip_recv_list: list of received FIP frames. |
70 | * @user_mfs: configured maximum FC frame size, including FC header. | 71 | * @user_mfs: configured maximum FC frame size, including FC header. |
71 | * @flogi_oxid: exchange ID of most recent fabric login. | 72 | * @flogi_oxid: exchange ID of most recent fabric login. |
72 | * @flogi_count: number of FLOGI attempts in AUTO mode. | 73 | * @flogi_count: number of FLOGI attempts in AUTO mode. |
73 | * @link: current link status for libfc. | 74 | * @link: current link status for libfc. |
74 | * @last_link: last link state reported to libfc. | 75 | * @last_link: last link state reported to libfc. |
75 | * @map_dest: use the FC_MAP mode for destination MAC addresses. | 76 | * @map_dest: use the FC_MAP mode for destination MAC addresses. |
76 | * @spma: supports SPMA server-provided MACs mode | 77 | * @spma: supports SPMA server-provided MACs mode |
77 | * @dest_addr: MAC address of the selected FC forwarder. | 78 | * @send_ctlr_ka: need to send controller keep alive |
78 | * @ctl_src_addr: the native MAC address of our local port. | 79 | * @send_port_ka: need to send port keep alives |
79 | * @data_src_addr: the assigned MAC address for the local port after FLOGI. | 80 | * @dest_addr: MAC address of the selected FC forwarder. |
80 | * @send: LLD-supplied function to handle sending of FIP Ethernet frames. | 81 | * @ctl_src_addr: the native MAC address of our local port. |
81 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. | 82 | * @send: LLD-supplied function to handle sending FIP Ethernet frames |
82 | * @lock: lock protecting this structure. | 83 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. |
84 | * @get_src_addr: LLD-supplied function to supply a source MAC address. | ||
85 | * @lock: lock protecting this structure. | ||
83 | * | 86 | * |
84 | * This structure is used by all FCoE drivers. It contains information | 87 | * This structure is used by all FCoE drivers. It contains information |
85 | * needed by all FCoE low-level drivers (LLDs) as well as internal state | 88 | * needed by all FCoE low-level drivers (LLDs) as well as internal state |
@@ -87,6 +90,7 @@ enum fip_state { | |||
87 | */ | 90 | */ |
88 | struct fcoe_ctlr { | 91 | struct fcoe_ctlr { |
89 | enum fip_state state; | 92 | enum fip_state state; |
93 | enum fip_state mode; | ||
90 | struct fc_lport *lp; | 94 | struct fc_lport *lp; |
91 | struct fcoe_fcf *sel_fcf; | 95 | struct fcoe_fcf *sel_fcf; |
92 | struct list_head fcfs; | 96 | struct list_head fcfs; |
@@ -104,29 +108,32 @@ struct fcoe_ctlr { | |||
104 | u8 flogi_count; | 108 | u8 flogi_count; |
105 | u8 link; | 109 | u8 link; |
106 | u8 last_link; | 110 | u8 last_link; |
111 | u8 reset_req; | ||
107 | u8 map_dest; | 112 | u8 map_dest; |
108 | u8 spma; | 113 | u8 spma; |
114 | u8 send_ctlr_ka; | ||
115 | u8 send_port_ka; | ||
109 | u8 dest_addr[ETH_ALEN]; | 116 | u8 dest_addr[ETH_ALEN]; |
110 | u8 ctl_src_addr[ETH_ALEN]; | 117 | u8 ctl_src_addr[ETH_ALEN]; |
111 | u8 data_src_addr[ETH_ALEN]; | ||
112 | 118 | ||
113 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); | 119 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); |
114 | void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new); | 120 | void (*update_mac)(struct fc_lport *, u8 *addr); |
121 | u8 * (*get_src_addr)(struct fc_lport *); | ||
115 | spinlock_t lock; | 122 | spinlock_t lock; |
116 | }; | 123 | }; |
117 | 124 | ||
118 | /* | 125 | /** |
119 | * struct fcoe_fcf - Fibre-Channel Forwarder. | 126 | * struct fcoe_fcf - Fibre-Channel Forwarder |
120 | * @list: list linkage. | 127 | * @list: list linkage |
121 | * @time: system time (jiffies) when an advertisement was last received. | 128 | * @time: system time (jiffies) when an advertisement was last received |
122 | * @switch_name: WWN of switch from advertisement. | 129 | * @switch_name: WWN of switch from advertisement |
123 | * @fabric_name: WWN of fabric from advertisement. | 130 | * @fabric_name: WWN of fabric from advertisement |
124 | * @fc_map: FC_MAP value from advertisement. | 131 | * @fc_map: FC_MAP value from advertisement |
125 | * @fcf_mac: Ethernet address of the FCF. | 132 | * @fcf_mac: Ethernet address of the FCF |
126 | * @vfid: virtual fabric ID. | 133 | * @vfid: virtual fabric ID |
127 | * @pri: seletion priority, smaller values are better. | 134 | * @pri: selection priority, smaller values are better |
128 | * @flags: flags received from advertisement. | 135 | * @flags: flags received from advertisement |
129 | * @fka_period: keep-alive period, in jiffies. | 136 | * @fka_period: keep-alive period, in jiffies |
130 | * | 137 | * |
131 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that | 138 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that |
132 | * passes FCoE frames on to an FC fabric. This structure represents | 139 | * passes FCoE frames on to an FC fabric. This structure represents |
@@ -148,6 +155,7 @@ struct fcoe_fcf { | |||
148 | u8 pri; | 155 | u8 pri; |
149 | u16 flags; | 156 | u16 flags; |
150 | u32 fka_period; | 157 | u32 fka_period; |
158 | u8 fd_flags:1; | ||
151 | }; | 159 | }; |
152 | 160 | ||
153 | /* FIP API functions */ | 161 | /* FIP API functions */ |
@@ -155,9 +163,10 @@ void fcoe_ctlr_init(struct fcoe_ctlr *); | |||
155 | void fcoe_ctlr_destroy(struct fcoe_ctlr *); | 163 | void fcoe_ctlr_destroy(struct fcoe_ctlr *); |
156 | void fcoe_ctlr_link_up(struct fcoe_ctlr *); | 164 | void fcoe_ctlr_link_up(struct fcoe_ctlr *); |
157 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); | 165 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); |
158 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *); | 166 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); |
159 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); | 167 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); |
160 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa); | 168 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, |
169 | struct fc_frame *); | ||
161 | 170 | ||
162 | /* libfcoe funcs */ | 171 | /* libfcoe funcs */ |
163 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); | 172 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index a72edd4eceec..ff92b46f5153 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/kfifo.h> | ||
31 | #include <scsi/iscsi_proto.h> | 32 | #include <scsi/iscsi_proto.h> |
32 | #include <scsi/iscsi_if.h> | 33 | #include <scsi/iscsi_if.h> |
33 | #include <scsi/scsi_transport_iscsi.h> | 34 | #include <scsi/scsi_transport_iscsi.h> |
@@ -231,7 +232,7 @@ struct iscsi_conn { | |||
231 | }; | 232 | }; |
232 | 233 | ||
233 | struct iscsi_pool { | 234 | struct iscsi_pool { |
234 | struct kfifo *queue; /* FIFO Queue */ | 235 | struct kfifo queue; /* FIFO Queue */ |
235 | void **pool; /* Pool of elements */ | 236 | void **pool; /* Pool of elements */ |
236 | int max; /* Max number of elements */ | 237 | int max; /* Max number of elements */ |
237 | }; | 238 | }; |
@@ -267,6 +268,7 @@ struct iscsi_session { | |||
267 | /* configuration */ | 268 | /* configuration */ |
268 | int abort_timeout; | 269 | int abort_timeout; |
269 | int lu_reset_timeout; | 270 | int lu_reset_timeout; |
271 | int tgt_reset_timeout; | ||
270 | int initial_r2t_en; | 272 | int initial_r2t_en; |
271 | unsigned max_r2t; | 273 | unsigned max_r2t; |
272 | int imm_data_en; | 274 | int imm_data_en; |
@@ -333,7 +335,8 @@ struct iscsi_host { | |||
333 | /* | 335 | /* |
334 | * scsi host template | 336 | * scsi host template |
335 | */ | 337 | */ |
336 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); | 338 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, |
339 | int reason); | ||
337 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); | 340 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); |
338 | extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); | 341 | extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); |
339 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); | 342 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); |
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index 9e3182e659db..741ae7ed4394 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h | |||
@@ -80,7 +80,7 @@ struct iscsi_tcp_task { | |||
80 | int data_offset; | 80 | int data_offset; |
81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ | 81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ |
82 | struct iscsi_pool r2tpool; | 82 | struct iscsi_pool r2tpool; |
83 | struct kfifo *r2tqueue; | 83 | struct kfifo r2tqueue; |
84 | void *dd_data; | 84 | void *dd_data; |
85 | }; | 85 | }; |
86 | 86 | ||
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index e78d3b62d8ec..9eaa3f05f954 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *); | |||
634 | extern int sas_slave_alloc(struct scsi_device *); | 634 | extern int sas_slave_alloc(struct scsi_device *); |
635 | extern int sas_slave_configure(struct scsi_device *); | 635 | extern int sas_slave_configure(struct scsi_device *); |
636 | extern void sas_slave_destroy(struct scsi_device *); | 636 | extern void sas_slave_destroy(struct scsi_device *); |
637 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth); | 637 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth, |
638 | int reason); | ||
638 | extern int sas_change_queue_type(struct scsi_device *, int qt); | 639 | extern int sas_change_queue_type(struct scsi_device *, int qt); |
639 | extern int sas_bios_param(struct scsi_device *, | 640 | extern int sas_bios_param(struct scsi_device *, |
640 | struct block_device *, | 641 | struct block_device *, |
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h index ba615e4c1d7c..f4105c91af53 100644 --- a/include/scsi/libsrp.h +++ b/include/scsi/libsrp.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __LIBSRP_H__ | 2 | #define __LIBSRP_H__ |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/kfifo.h> | ||
5 | #include <scsi/scsi_cmnd.h> | 6 | #include <scsi/scsi_cmnd.h> |
6 | #include <scsi/scsi_host.h> | 7 | #include <scsi/scsi_host.h> |
7 | #include <scsi/srp.h> | 8 | #include <scsi/srp.h> |
@@ -21,7 +22,7 @@ struct srp_buf { | |||
21 | struct srp_queue { | 22 | struct srp_queue { |
22 | void *pool; | 23 | void *pool; |
23 | void *items; | 24 | void *items; |
24 | struct kfifo *queue; | 25 | struct kfifo queue; |
25 | spinlock_t lock; | 26 | spinlock_t lock; |
26 | }; | 27 | }; |
27 | 28 | ||
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h index 02bd9f716357..a8f370126632 100644 --- a/include/scsi/osd_initiator.h +++ b/include/scsi/osd_initiator.h | |||
@@ -48,7 +48,6 @@ enum osd_std_version { | |||
48 | */ | 48 | */ |
49 | struct osd_dev { | 49 | struct osd_dev { |
50 | struct scsi_device *scsi_device; | 50 | struct scsi_device *scsi_device; |
51 | struct file *file; | ||
52 | unsigned def_timeout; | 51 | unsigned def_timeout; |
53 | 52 | ||
54 | #ifdef OSD_VER1_SUPPORT | 53 | #ifdef OSD_VER1_SUPPORT |
@@ -56,10 +55,24 @@ struct osd_dev { | |||
56 | #endif | 55 | #endif |
57 | }; | 56 | }; |
58 | 57 | ||
59 | /* Retrieve/return osd_dev(s) for use by Kernel clients */ | 58 | /* Unique Identification of an OSD device */ |
60 | struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/ | 59 | struct osd_dev_info { |
60 | unsigned systemid_len; | ||
61 | u8 systemid[OSD_SYSTEMID_LEN]; | ||
62 | unsigned osdname_len; | ||
63 | u8 *osdname; | ||
64 | }; | ||
65 | |||
66 | /* Retrieve/return osd_dev(s) for use by Kernel clients | ||
67 | * Use IS_ERR/ERR_PTR on returned "osd_dev *". | ||
68 | */ | ||
69 | struct osd_dev *osduld_path_lookup(const char *dev_name); | ||
70 | struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi); | ||
61 | void osduld_put_device(struct osd_dev *od); | 71 | void osduld_put_device(struct osd_dev *od); |
62 | 72 | ||
73 | const struct osd_dev_info *osduld_device_info(struct osd_dev *od); | ||
74 | bool osduld_device_same(struct osd_dev *od, const struct osd_dev_info *odi); | ||
75 | |||
63 | /* Add/remove test ioctls from external modules */ | 76 | /* Add/remove test ioctls from external modules */ |
64 | typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); | 77 | typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); |
65 | int osduld_register_test(unsigned ioctl, do_test_fn *do_test); | 78 | int osduld_register_test(unsigned ioctl, do_test_fn *do_test); |
@@ -69,8 +82,24 @@ void osduld_unregister_test(unsigned ioctl); | |||
69 | void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); | 82 | void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); |
70 | void osd_dev_fini(struct osd_dev *od); | 83 | void osd_dev_fini(struct osd_dev *od); |
71 | 84 | ||
72 | /* some hi level device operations */ | 85 | /** |
73 | int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ | 86 | * osd_auto_detect_ver - Detect the OSD version, return Unique Identification |
87 | * | ||
88 | * @od: OSD target lun handle | ||
89 | * @caps: Capabilities authorizing OSD root read attributes access | ||
90 | * @odi: Retrieved information uniquely identifying the osd target lun | ||
91 | * Note: odi->osdname must be kfreed by caller. | ||
92 | * | ||
93 | * Auto detects the OSD version of the OSD target and sets the @od | ||
94 | * accordingly. Meanwhile also returns the "system id" and "osd name" root | ||
95 | * attributes which uniquely identify the OSD target. This member is usually | ||
96 | * called by the ULD. ULD users should call osduld_device_info(). | ||
97 | * This rutine allocates osd requests and memory at GFP_KERNEL level and might | ||
98 | * sleep. | ||
99 | */ | ||
100 | int osd_auto_detect_ver(struct osd_dev *od, | ||
101 | void *caps, struct osd_dev_info *odi); | ||
102 | |||
74 | static inline struct request_queue *osd_request_queue(struct osd_dev *od) | 103 | static inline struct request_queue *osd_request_queue(struct osd_dev *od) |
75 | { | 104 | { |
76 | return od->scsi_device->request_queue; | 105 | return od->scsi_device->request_queue; |
@@ -84,6 +113,15 @@ static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v) | |||
84 | #endif | 113 | #endif |
85 | } | 114 | } |
86 | 115 | ||
116 | static inline bool osd_dev_is_ver1(struct osd_dev *od) | ||
117 | { | ||
118 | #ifdef OSD_VER1_SUPPORT | ||
119 | return od->version == OSD_VER1; | ||
120 | #else | ||
121 | return false; | ||
122 | #endif | ||
123 | } | ||
124 | |||
87 | struct osd_request; | 125 | struct osd_request; |
88 | typedef void (osd_req_done_fn)(struct osd_request *or, void *private); | 126 | typedef void (osd_req_done_fn)(struct osd_request *or, void *private); |
89 | 127 | ||
@@ -104,6 +142,7 @@ struct osd_request { | |||
104 | struct _osd_io_info { | 142 | struct _osd_io_info { |
105 | struct bio *bio; | 143 | struct bio *bio; |
106 | u64 total_bytes; | 144 | u64 total_bytes; |
145 | u64 residual; | ||
107 | struct request *req; | 146 | struct request *req; |
108 | struct _osd_req_data_segment *last_seg; | 147 | struct _osd_req_data_segment *last_seg; |
109 | u8 *pad_buff; | 148 | u8 *pad_buff; |
@@ -112,22 +151,19 @@ struct osd_request { | |||
112 | gfp_t alloc_flags; | 151 | gfp_t alloc_flags; |
113 | unsigned timeout; | 152 | unsigned timeout; |
114 | unsigned retries; | 153 | unsigned retries; |
154 | unsigned sense_len; | ||
115 | u8 sense[OSD_MAX_SENSE_LEN]; | 155 | u8 sense[OSD_MAX_SENSE_LEN]; |
116 | enum osd_attributes_mode attributes_mode; | 156 | enum osd_attributes_mode attributes_mode; |
117 | 157 | ||
118 | osd_req_done_fn *async_done; | 158 | osd_req_done_fn *async_done; |
119 | void *async_private; | 159 | void *async_private; |
120 | int async_error; | 160 | int async_error; |
161 | int req_errors; | ||
121 | }; | 162 | }; |
122 | 163 | ||
123 | /* OSD Version control */ | ||
124 | static inline bool osd_req_is_ver1(struct osd_request *or) | 164 | static inline bool osd_req_is_ver1(struct osd_request *or) |
125 | { | 165 | { |
126 | #ifdef OSD_VER1_SUPPORT | 166 | return osd_dev_is_ver1(or->osd_dev); |
127 | return or->osd_dev->version == OSD_VER1; | ||
128 | #else | ||
129 | return false; | ||
130 | #endif | ||
131 | } | 167 | } |
132 | 168 | ||
133 | /* | 169 | /* |
@@ -234,7 +270,7 @@ int osd_execute_request_async(struct osd_request *or, | |||
234 | * @bad_attr_list - List of failing attributes (optional) | 270 | * @bad_attr_list - List of failing attributes (optional) |
235 | * @max_attr - Size of @bad_attr_list. | 271 | * @max_attr - Size of @bad_attr_list. |
236 | * | 272 | * |
237 | * After execution, sense + return code can be analyzed using this function. The | 273 | * After execution, osd_request results are analyzed using this function. The |
238 | * return code is the final disposition on the error. So it is possible that a | 274 | * return code is the final disposition on the error. So it is possible that a |
239 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for | 275 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for |
240 | * example on recovered errors. All parameters are optional if caller does | 276 | * example on recovered errors. All parameters are optional if caller does |
@@ -243,7 +279,29 @@ int osd_execute_request_async(struct osd_request *or, | |||
243 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the | 279 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the |
244 | * command would routinely fail, to not spam the dmsg file. | 280 | * command would routinely fail, to not spam the dmsg file. |
245 | */ | 281 | */ |
282 | |||
283 | /** | ||
284 | * osd_err_priority - osd categorized return codes in ascending severity. | ||
285 | * | ||
286 | * The categories are borrowed from the pnfs_osd_errno enum. | ||
287 | * See comments for translated Linux codes returned by osd_req_decode_sense. | ||
288 | */ | ||
289 | enum osd_err_priority { | ||
290 | OSD_ERR_PRI_NO_ERROR = 0, | ||
291 | /* Recoverable, caller should clear_highpage() all pages */ | ||
292 | OSD_ERR_PRI_CLEAR_PAGES = 1, /* -EFAULT */ | ||
293 | OSD_ERR_PRI_RESOURCE = 2, /* -ENOMEM */ | ||
294 | OSD_ERR_PRI_BAD_CRED = 3, /* -EINVAL */ | ||
295 | OSD_ERR_PRI_NO_ACCESS = 4, /* -EACCES */ | ||
296 | OSD_ERR_PRI_UNREACHABLE = 5, /* any other */ | ||
297 | OSD_ERR_PRI_NOT_FOUND = 6, /* -ENOENT */ | ||
298 | OSD_ERR_PRI_NO_SPACE = 7, /* -ENOSPC */ | ||
299 | OSD_ERR_PRI_EIO = 8, /* -EIO */ | ||
300 | }; | ||
301 | |||
246 | struct osd_sense_info { | 302 | struct osd_sense_info { |
303 | enum osd_err_priority osd_err_pri; | ||
304 | |||
247 | int key; /* one of enum scsi_sense_keys */ | 305 | int key; /* one of enum scsi_sense_keys */ |
248 | int additional_code ; /* enum osd_additional_sense_codes */ | 306 | int additional_code ; /* enum osd_additional_sense_codes */ |
249 | union { /* Sense specific information */ | 307 | union { /* Sense specific information */ |
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h index 2cc8e8b1cc19..685661283540 100644 --- a/include/scsi/osd_protocol.h +++ b/include/scsi/osd_protocol.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define __OSD_PROTOCOL_H__ | 17 | #define __OSD_PROTOCOL_H__ |
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/kernel.h> | ||
20 | #include <asm/unaligned.h> | 21 | #include <asm/unaligned.h> |
21 | #include <scsi/scsi.h> | 22 | #include <scsi/scsi.h> |
22 | 23 | ||
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h index ff9b33c773c7..91db543a5502 100644 --- a/include/scsi/osd_sense.h +++ b/include/scsi/osd_sense.h | |||
@@ -255,6 +255,9 @@ enum osdv2_cdb_field_offset { | |||
255 | OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), | 255 | OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), |
256 | OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), | 256 | OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), |
257 | OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), | 257 | OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), |
258 | OSD_CFO_PERMISSIONS = sizeof(struct osd_cdb_head) + | ||
259 | offsetof(struct osd_capability_head, | ||
260 | permissions_bit_mask), | ||
258 | }; | 261 | }; |
259 | 262 | ||
260 | #endif /* ndef __OSD_SENSE_H__ */ | 263 | #endif /* ndef __OSD_SENSE_H__ */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 34c46ab5c31b..8b4deca996ad 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -94,6 +94,7 @@ struct scsi_cmnd; | |||
94 | #define WRITE_LONG 0x3f | 94 | #define WRITE_LONG 0x3f |
95 | #define CHANGE_DEFINITION 0x40 | 95 | #define CHANGE_DEFINITION 0x40 |
96 | #define WRITE_SAME 0x41 | 96 | #define WRITE_SAME 0x41 |
97 | #define UNMAP 0x42 | ||
97 | #define READ_TOC 0x43 | 98 | #define READ_TOC 0x43 |
98 | #define LOG_SELECT 0x4c | 99 | #define LOG_SELECT 0x4c |
99 | #define LOG_SENSE 0x4d | 100 | #define LOG_SENSE 0x4d |
@@ -122,9 +123,11 @@ struct scsi_cmnd; | |||
122 | #define READ_16 0x88 | 123 | #define READ_16 0x88 |
123 | #define WRITE_16 0x8a | 124 | #define WRITE_16 0x8a |
124 | #define VERIFY_16 0x8f | 125 | #define VERIFY_16 0x8f |
126 | #define WRITE_SAME_16 0x93 | ||
125 | #define SERVICE_ACTION_IN 0x9e | 127 | #define SERVICE_ACTION_IN 0x9e |
126 | /* values for service action in */ | 128 | /* values for service action in */ |
127 | #define SAI_READ_CAPACITY_16 0x10 | 129 | #define SAI_READ_CAPACITY_16 0x10 |
130 | #define SAI_GET_LBA_STATUS 0x12 | ||
128 | /* values for maintenance in */ | 131 | /* values for maintenance in */ |
129 | #define MI_REPORT_TARGET_PGS 0x0a | 132 | #define MI_REPORT_TARGET_PGS 0x0a |
130 | /* values for maintenance out */ | 133 | /* values for maintenance out */ |
@@ -132,6 +135,7 @@ struct scsi_cmnd; | |||
132 | /* values for variable length command */ | 135 | /* values for variable length command */ |
133 | #define READ_32 0x09 | 136 | #define READ_32 0x09 |
134 | #define WRITE_32 0x0b | 137 | #define WRITE_32 0x0b |
138 | #define WRITE_SAME_32 0x0d | ||
135 | 139 | ||
136 | /* Values for T10/04-262r7 */ | 140 | /* Values for T10/04-262r7 */ |
137 | #define ATA_16 0x85 /* 16-byte pass-thru */ | 141 | #define ATA_16 0x85 /* 16-byte pass-thru */ |
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h index a4b233318179..91a4e4ff9a9b 100644 --- a/include/scsi/scsi_bsg_fc.h +++ b/include/scsi/scsi_bsg_fc.h | |||
@@ -292,7 +292,7 @@ struct fc_bsg_request { | |||
292 | struct fc_bsg_rport_els r_els; | 292 | struct fc_bsg_rport_els r_els; |
293 | struct fc_bsg_rport_ct r_ct; | 293 | struct fc_bsg_rport_ct r_ct; |
294 | } rqst_data; | 294 | } rqst_data; |
295 | }; | 295 | } __attribute__((packed)); |
296 | 296 | ||
297 | 297 | ||
298 | /* response (request sense data) structure of the sg_io_v4 */ | 298 | /* response (request sense data) structure of the sg_io_v4 */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index f097ae340bc1..7c4449900c24 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -81,11 +81,14 @@ struct scsi_device { | |||
81 | struct list_head starved_entry; | 81 | struct list_head starved_entry; |
82 | struct scsi_cmnd *current_cmnd; /* currently active command */ | 82 | struct scsi_cmnd *current_cmnd; /* currently active command */ |
83 | unsigned short queue_depth; /* How deep of a queue we want */ | 83 | unsigned short queue_depth; /* How deep of a queue we want */ |
84 | unsigned short max_queue_depth; /* max queue depth */ | ||
84 | unsigned short last_queue_full_depth; /* These two are used by */ | 85 | unsigned short last_queue_full_depth; /* These two are used by */ |
85 | unsigned short last_queue_full_count; /* scsi_track_queue_full() */ | 86 | unsigned short last_queue_full_count; /* scsi_track_queue_full() */ |
86 | unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same | 87 | unsigned long last_queue_full_time; /* last queue full time */ |
87 | jiffie count on our counter, they | 88 | unsigned long queue_ramp_up_period; /* ramp up period in jiffies */ |
88 | could all be from the same event. */ | 89 | #define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ) |
90 | |||
91 | unsigned long last_queue_ramp_up; /* last queue ramp up time */ | ||
89 | 92 | ||
90 | unsigned int id, lun, channel; | 93 | unsigned int id, lun, channel; |
91 | 94 | ||
@@ -175,6 +178,7 @@ struct scsi_dh_devlist { | |||
175 | char *model; | 178 | char *model; |
176 | }; | 179 | }; |
177 | 180 | ||
181 | typedef void (*activate_complete)(void *, int); | ||
178 | struct scsi_device_handler { | 182 | struct scsi_device_handler { |
179 | /* Used by the infrastructure */ | 183 | /* Used by the infrastructure */ |
180 | struct list_head list; /* list of scsi_device_handlers */ | 184 | struct list_head list; /* list of scsi_device_handlers */ |
@@ -186,7 +190,7 @@ struct scsi_device_handler { | |||
186 | int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); | 190 | int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); |
187 | int (*attach)(struct scsi_device *); | 191 | int (*attach)(struct scsi_device *); |
188 | void (*detach)(struct scsi_device *); | 192 | void (*detach)(struct scsi_device *); |
189 | int (*activate)(struct scsi_device *); | 193 | int (*activate)(struct scsi_device *, activate_complete, void *); |
190 | int (*prep_fn)(struct scsi_device *, struct request *); | 194 | int (*prep_fn)(struct scsi_device *, struct request *); |
191 | int (*set_params)(struct scsi_device *, const char *); | 195 | int (*set_params)(struct scsi_device *, const char *); |
192 | }; | 196 | }; |
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h index ff2407405b42..e3f2db212ddc 100644 --- a/include/scsi/scsi_dh.h +++ b/include/scsi/scsi_dh.h | |||
@@ -56,14 +56,16 @@ enum { | |||
56 | SCSI_DH_DRIVER_MAX, | 56 | SCSI_DH_DRIVER_MAX, |
57 | }; | 57 | }; |
58 | #if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE) | 58 | #if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE) |
59 | extern int scsi_dh_activate(struct request_queue *); | 59 | extern int scsi_dh_activate(struct request_queue *, activate_complete, void *); |
60 | extern int scsi_dh_handler_exist(const char *); | 60 | extern int scsi_dh_handler_exist(const char *); |
61 | extern int scsi_dh_attach(struct request_queue *, const char *); | 61 | extern int scsi_dh_attach(struct request_queue *, const char *); |
62 | extern void scsi_dh_detach(struct request_queue *); | 62 | extern void scsi_dh_detach(struct request_queue *); |
63 | extern int scsi_dh_set_params(struct request_queue *, const char *); | 63 | extern int scsi_dh_set_params(struct request_queue *, const char *); |
64 | #else | 64 | #else |
65 | static inline int scsi_dh_activate(struct request_queue *req) | 65 | static inline int scsi_dh_activate(struct request_queue *req, |
66 | activate_complete fn, void *data) | ||
66 | { | 67 | { |
68 | fn(data, 0); | ||
67 | return 0; | 69 | return 0; |
68 | } | 70 | } |
69 | static inline int scsi_dh_handler_exist(const char *name) | 71 | static inline int scsi_dh_handler_exist(const char *name) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 47941fc5aba7..c50a97fc76f9 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -43,6 +43,12 @@ struct blk_queue_tags; | |||
43 | #define DISABLE_CLUSTERING 0 | 43 | #define DISABLE_CLUSTERING 0 |
44 | #define ENABLE_CLUSTERING 1 | 44 | #define ENABLE_CLUSTERING 1 |
45 | 45 | ||
46 | enum { | ||
47 | SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */ | ||
48 | SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */ | ||
49 | SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */ | ||
50 | }; | ||
51 | |||
46 | struct scsi_host_template { | 52 | struct scsi_host_template { |
47 | struct module *module; | 53 | struct module *module; |
48 | const char *name; | 54 | const char *name; |
@@ -294,7 +300,7 @@ struct scsi_host_template { | |||
294 | * | 300 | * |
295 | * Status: OPTIONAL | 301 | * Status: OPTIONAL |
296 | */ | 302 | */ |
297 | int (* change_queue_depth)(struct scsi_device *, int); | 303 | int (* change_queue_depth)(struct scsi_device *, int, int); |
298 | 304 | ||
299 | /* | 305 | /* |
300 | * Fill in this function to allow the changing of tag types | 306 | * Fill in this function to allow the changing of tag types |
@@ -677,6 +683,12 @@ struct Scsi_Host { | |||
677 | void *shost_data; | 683 | void *shost_data; |
678 | 684 | ||
679 | /* | 685 | /* |
686 | * Points to the physical bus device we'd use to do DMA | ||
687 | * Needed just in case we have virtual hosts. | ||
688 | */ | ||
689 | struct device *dma_dev; | ||
690 | |||
691 | /* | ||
680 | * We should ensure that this is aligned, both for better performance | 692 | * We should ensure that this is aligned, both for better performance |
681 | * and also because some compilers (m68k) don't automatically force | 693 | * and also because some compilers (m68k) don't automatically force |
682 | * alignment to a long boundary. | 694 | * alignment to a long boundary. |
@@ -720,7 +732,9 @@ extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *); | |||
720 | extern void scsi_flush_work(struct Scsi_Host *); | 732 | extern void scsi_flush_work(struct Scsi_Host *); |
721 | 733 | ||
722 | extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); | 734 | extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); |
723 | extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *); | 735 | extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *, |
736 | struct device *, | ||
737 | struct device *); | ||
724 | extern void scsi_scan_host(struct Scsi_Host *); | 738 | extern void scsi_scan_host(struct Scsi_Host *); |
725 | extern void scsi_rescan_device(struct device *); | 739 | extern void scsi_rescan_device(struct device *); |
726 | extern void scsi_remove_host(struct Scsi_Host *); | 740 | extern void scsi_remove_host(struct Scsi_Host *); |
@@ -731,6 +745,12 @@ extern const char *scsi_host_state_name(enum scsi_host_state); | |||
731 | 745 | ||
732 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); | 746 | extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); |
733 | 747 | ||
748 | static inline int __must_check scsi_add_host(struct Scsi_Host *host, | ||
749 | struct device *dev) | ||
750 | { | ||
751 | return scsi_add_host_with_dma(host, dev, dev); | ||
752 | } | ||
753 | |||
734 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) | 754 | static inline struct device *scsi_get_device(struct Scsi_Host *shost) |
735 | { | 755 | { |
736 | return shost->shost_gendev.parent; | 756 | return shost->shost_gendev.parent; |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index fc50bd64aa4e..8e86a94faf06 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
@@ -807,5 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
807 | struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, | 807 | struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, |
808 | struct fc_vport_identifiers *); | 808 | struct fc_vport_identifiers *); |
809 | int fc_vport_terminate(struct fc_vport *vport); | 809 | int fc_vport_terminate(struct fc_vport *vport); |
810 | void fc_block_scsi_eh(struct scsi_cmnd *cmnd); | ||
810 | 811 | ||
811 | #endif /* SCSI_TRANSPORT_FC_H */ | 812 | #endif /* SCSI_TRANSPORT_FC_H */ |
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 3dae3f799b9b..49400459b477 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -593,7 +593,7 @@ enum { | |||
593 | 593 | ||
594 | struct ac97_quirk { | 594 | struct ac97_quirk { |
595 | unsigned short subvendor; /* PCI subsystem vendor id */ | 595 | unsigned short subvendor; /* PCI subsystem vendor id */ |
596 | unsigned short subdevice; /* PCI sybsystem device id */ | 596 | unsigned short subdevice; /* PCI subsystem device id */ |
597 | unsigned short mask; /* device id bit mask, 0 = accept all */ | 597 | unsigned short mask; /* device id bit mask, 0 = accept all */ |
598 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ | 598 | unsigned int codec_id; /* codec id (if any), 0 = accept all */ |
599 | const char *name; /* name shown as info */ | 599 | const char *name; /* name shown as info */ |
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h index 9c661f2f8cda..eee19f63c0d8 100644 --- a/include/sound/wm8993.h +++ b/include/sound/wm8993.h | |||
@@ -36,7 +36,7 @@ struct wm8993_platform_data { | |||
36 | unsigned int micbias1_lvl:1; | 36 | unsigned int micbias1_lvl:1; |
37 | unsigned int micbias2_lvl:1; | 37 | unsigned int micbias2_lvl:1; |
38 | 38 | ||
39 | /* Jack detect threashold levels, see datasheet for values */ | 39 | /* Jack detect threshold levels, see datasheet for values */ |
40 | unsigned int jd_scthr:2; | 40 | unsigned int jd_scthr:2; |
41 | unsigned int jd_thr:2; | 41 | unsigned int jd_thr:2; |
42 | }; | 42 | }; |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 318f76535bd4..d0b6cd3afb2f 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -38,7 +38,7 @@ TRACE_EVENT(ext4_free_inode, | |||
38 | __entry->blocks = inode->i_blocks; | 38 | __entry->blocks = inode->i_blocks; |
39 | ), | 39 | ), |
40 | 40 | ||
41 | TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", | 41 | TP_printk("dev %s ino %lu mode 0%o uid %u gid %u blocks %llu", |
42 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 42 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
43 | __entry->mode, __entry->uid, __entry->gid, | 43 | __entry->mode, __entry->uid, __entry->gid, |
44 | (unsigned long long) __entry->blocks) | 44 | (unsigned long long) __entry->blocks) |
@@ -61,7 +61,7 @@ TRACE_EVENT(ext4_request_inode, | |||
61 | __entry->mode = mode; | 61 | __entry->mode = mode; |
62 | ), | 62 | ), |
63 | 63 | ||
64 | TP_printk("dev %s dir %lu mode %d", | 64 | TP_printk("dev %s dir %lu mode 0%o", |
65 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, | 65 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, |
66 | __entry->mode) | 66 | __entry->mode) |
67 | ); | 67 | ); |
@@ -85,7 +85,7 @@ TRACE_EVENT(ext4_allocate_inode, | |||
85 | __entry->mode = mode; | 85 | __entry->mode = mode; |
86 | ), | 86 | ), |
87 | 87 | ||
88 | TP_printk("dev %s ino %lu dir %lu mode %d", | 88 | TP_printk("dev %s ino %lu dir %lu mode 0%o", |
89 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 89 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
90 | (unsigned long) __entry->dir, __entry->mode) | 90 | (unsigned long) __entry->dir, __entry->mode) |
91 | ); | 91 | ); |
@@ -305,7 +305,6 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
305 | __field( int, ret ) | 305 | __field( int, ret ) |
306 | __field( int, pages_written ) | 306 | __field( int, pages_written ) |
307 | __field( long, pages_skipped ) | 307 | __field( long, pages_skipped ) |
308 | __field( char, encountered_congestion ) | ||
309 | __field( char, more_io ) | 308 | __field( char, more_io ) |
310 | __field( char, no_nrwrite_index_update ) | 309 | __field( char, no_nrwrite_index_update ) |
311 | __field( pgoff_t, writeback_index ) | 310 | __field( pgoff_t, writeback_index ) |
@@ -317,17 +316,16 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
317 | __entry->ret = ret; | 316 | __entry->ret = ret; |
318 | __entry->pages_written = pages_written; | 317 | __entry->pages_written = pages_written; |
319 | __entry->pages_skipped = wbc->pages_skipped; | 318 | __entry->pages_skipped = wbc->pages_skipped; |
320 | __entry->encountered_congestion = wbc->encountered_congestion; | ||
321 | __entry->more_io = wbc->more_io; | 319 | __entry->more_io = wbc->more_io; |
322 | __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; | 320 | __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; |
323 | __entry->writeback_index = inode->i_mapping->writeback_index; | 321 | __entry->writeback_index = inode->i_mapping->writeback_index; |
324 | ), | 322 | ), |
325 | 323 | ||
326 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d writeback_index %lu", | 324 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu", |
327 | jbd2_dev_to_name(__entry->dev), | 325 | jbd2_dev_to_name(__entry->dev), |
328 | (unsigned long) __entry->ino, __entry->ret, | 326 | (unsigned long) __entry->ino, __entry->ret, |
329 | __entry->pages_written, __entry->pages_skipped, | 327 | __entry->pages_written, __entry->pages_skipped, |
330 | __entry->encountered_congestion, __entry->more_io, | 328 | __entry->more_io, |
331 | __entry->no_nrwrite_index_update, | 329 | __entry->no_nrwrite_index_update, |
332 | (unsigned long) __entry->writeback_index) | 330 | (unsigned long) __entry->writeback_index) |
333 | ); | 331 | ); |
@@ -591,30 +589,32 @@ TRACE_EVENT(ext4_allocate_blocks, | |||
591 | 589 | ||
592 | TRACE_EVENT(ext4_free_blocks, | 590 | TRACE_EVENT(ext4_free_blocks, |
593 | TP_PROTO(struct inode *inode, __u64 block, unsigned long count, | 591 | TP_PROTO(struct inode *inode, __u64 block, unsigned long count, |
594 | int metadata), | 592 | int flags), |
595 | 593 | ||
596 | TP_ARGS(inode, block, count, metadata), | 594 | TP_ARGS(inode, block, count, flags), |
597 | 595 | ||
598 | TP_STRUCT__entry( | 596 | TP_STRUCT__entry( |
599 | __field( dev_t, dev ) | 597 | __field( dev_t, dev ) |
600 | __field( ino_t, ino ) | 598 | __field( ino_t, ino ) |
599 | __field( umode_t, mode ) | ||
601 | __field( __u64, block ) | 600 | __field( __u64, block ) |
602 | __field( unsigned long, count ) | 601 | __field( unsigned long, count ) |
603 | __field( int, metadata ) | 602 | __field( int, flags ) |
604 | |||
605 | ), | 603 | ), |
606 | 604 | ||
607 | TP_fast_assign( | 605 | TP_fast_assign( |
608 | __entry->dev = inode->i_sb->s_dev; | 606 | __entry->dev = inode->i_sb->s_dev; |
609 | __entry->ino = inode->i_ino; | 607 | __entry->ino = inode->i_ino; |
608 | __entry->mode = inode->i_mode; | ||
610 | __entry->block = block; | 609 | __entry->block = block; |
611 | __entry->count = count; | 610 | __entry->count = count; |
612 | __entry->metadata = metadata; | 611 | __entry->flags = flags; |
613 | ), | 612 | ), |
614 | 613 | ||
615 | TP_printk("dev %s ino %lu block %llu count %lu metadata %d", | 614 | TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d", |
616 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | 615 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
617 | __entry->block, __entry->count, __entry->metadata) | 616 | __entry->mode, __entry->block, __entry->count, |
617 | __entry->flags) | ||
618 | ); | 618 | ); |
619 | 619 | ||
620 | TRACE_EVENT(ext4_sync_file, | 620 | TRACE_EVENT(ext4_sync_file, |
@@ -848,6 +848,32 @@ TRACE_EVENT(ext4_mballoc_free, | |||
848 | __entry->result_len, __entry->result_logical) | 848 | __entry->result_len, __entry->result_logical) |
849 | ); | 849 | ); |
850 | 850 | ||
851 | TRACE_EVENT(ext4_forget, | ||
852 | TP_PROTO(struct inode *inode, int is_metadata, __u64 block), | ||
853 | |||
854 | TP_ARGS(inode, is_metadata, block), | ||
855 | |||
856 | TP_STRUCT__entry( | ||
857 | __field( dev_t, dev ) | ||
858 | __field( ino_t, ino ) | ||
859 | __field( umode_t, mode ) | ||
860 | __field( int, is_metadata ) | ||
861 | __field( __u64, block ) | ||
862 | ), | ||
863 | |||
864 | TP_fast_assign( | ||
865 | __entry->dev = inode->i_sb->s_dev; | ||
866 | __entry->ino = inode->i_ino; | ||
867 | __entry->mode = inode->i_mode; | ||
868 | __entry->is_metadata = is_metadata; | ||
869 | __entry->block = block; | ||
870 | ), | ||
871 | |||
872 | TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu", | ||
873 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
874 | __entry->mode, __entry->is_metadata, __entry->block) | ||
875 | ); | ||
876 | |||
851 | #endif /* _TRACE_EXT4_H */ | 877 | #endif /* _TRACE_EXT4_H */ |
852 | 878 | ||
853 | /* This part must be outside protection */ | 879 | /* This part must be outside protection */ |
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index e5ce87a0498d..9496b965d62a 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h | |||
@@ -301,8 +301,8 @@ TRACE_EVENT(itimer_state, | |||
301 | __entry->interval_usec = value->it_interval.tv_usec; | 301 | __entry->interval_usec = value->it_interval.tv_usec; |
302 | ), | 302 | ), |
303 | 303 | ||
304 | TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu", | 304 | TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", |
305 | __entry->which, __entry->expires, | 305 | __entry->which, (unsigned long long)__entry->expires, |
306 | __entry->value_sec, __entry->value_usec, | 306 | __entry->value_sec, __entry->value_usec, |
307 | __entry->interval_sec, __entry->interval_usec) | 307 | __entry->interval_sec, __entry->interval_usec) |
308 | ); | 308 | ); |
@@ -331,8 +331,8 @@ TRACE_EVENT(itimer_expire, | |||
331 | __entry->pid = pid_nr(pid); | 331 | __entry->pid = pid_nr(pid); |
332 | ), | 332 | ), |
333 | 333 | ||
334 | TP_printk("which=%d pid=%d now=%lu", __entry->which, | 334 | TP_printk("which=%d pid=%d now=%llu", __entry->which, |
335 | (int) __entry->pid, __entry->now) | 335 | (int) __entry->pid, (unsigned long long)__entry->now) |
336 | ); | 336 | ); |
337 | 337 | ||
338 | #endif /* _TRACE_TIMER_H */ | 338 | #endif /* _TRACE_TIMER_H */ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index d1b3de9c1a71..c6fe03e902ca 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -414,7 +414,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
416 | offsetof(typeof(field), item), \ | 416 | offsetof(typeof(field), item), \ |
417 | sizeof(field.item), 0, FILTER_OTHER); \ | 417 | sizeof(field.item), \ |
418 | is_signed_type(type), FILTER_OTHER); \ | ||
418 | if (ret) \ | 419 | if (ret) \ |
419 | return ret; | 420 | return ret; |
420 | 421 | ||
@@ -422,8 +423,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
422 | #define __dynamic_array(type, item, len) \ | 423 | #define __dynamic_array(type, item, len) \ |
423 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ | 424 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
424 | offsetof(typeof(field), __data_loc_##item), \ | 425 | offsetof(typeof(field), __data_loc_##item), \ |
425 | sizeof(field.__data_loc_##item), 0, \ | 426 | sizeof(field.__data_loc_##item), \ |
426 | FILTER_OTHER); | 427 | is_signed_type(type), FILTER_OTHER); |
427 | 428 | ||
428 | #undef __string | 429 | #undef __string |
429 | #define __string(item, src) __dynamic_array(char, item, -1) | 430 | #define __string(item, src) __dynamic_array(char, item, -1) |
@@ -436,10 +437,6 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
436 | struct ftrace_raw_##call field; \ | 437 | struct ftrace_raw_##call field; \ |
437 | int ret; \ | 438 | int ret; \ |
438 | \ | 439 | \ |
439 | ret = trace_define_common_fields(event_call); \ | ||
440 | if (ret) \ | ||
441 | return ret; \ | ||
442 | \ | ||
443 | tstruct; \ | 440 | tstruct; \ |
444 | \ | 441 | \ |
445 | return ret; \ | 442 | return ret; \ |
@@ -559,13 +556,7 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
559 | * | 556 | * |
560 | * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused) | 557 | * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused) |
561 | * { | 558 | * { |
562 | * int ret; | 559 | * return register_trace_<call>(ftrace_event_<call>); |
563 | * | ||
564 | * ret = register_trace_<call>(ftrace_event_<call>); | ||
565 | * if (!ret) | ||
566 | * pr_info("event trace: Could not activate trace point " | ||
567 | * "probe to <call>"); | ||
568 | * return ret; | ||
569 | * } | 560 | * } |
570 | * | 561 | * |
571 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) | 562 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) |
@@ -623,23 +614,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
623 | * .trace = ftrace_raw_output_<call>, <-- stage 2 | 614 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
624 | * }; | 615 | * }; |
625 | * | 616 | * |
626 | * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused) | ||
627 | * { | ||
628 | * int id; | ||
629 | * | ||
630 | * id = register_ftrace_event(&ftrace_event_type_<call>); | ||
631 | * if (!id) | ||
632 | * return -ENODEV; | ||
633 | * event_<call>.id = id; | ||
634 | * return 0; | ||
635 | * } | ||
636 | * | ||
637 | * static struct ftrace_event_call __used | 617 | * static struct ftrace_event_call __used |
638 | * __attribute__((__aligned__(4))) | 618 | * __attribute__((__aligned__(4))) |
639 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 619 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
640 | * .name = "<call>", | 620 | * .name = "<call>", |
641 | * .system = "<system>", | 621 | * .system = "<system>", |
642 | * .raw_init = ftrace_raw_init_event_<call>, | 622 | * .raw_init = trace_event_raw_init, |
643 | * .regfunc = ftrace_reg_event_<call>, | 623 | * .regfunc = ftrace_reg_event_<call>, |
644 | * .unregfunc = ftrace_unreg_event_<call>, | 624 | * .unregfunc = ftrace_unreg_event_<call>, |
645 | * .show_format = ftrace_format_<call>, | 625 | * .show_format = ftrace_format_<call>, |
@@ -647,13 +627,9 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
647 | * | 627 | * |
648 | */ | 628 | */ |
649 | 629 | ||
650 | #undef TP_FMT | ||
651 | #define TP_FMT(fmt, args...) fmt "\n", ##args | ||
652 | |||
653 | #ifdef CONFIG_EVENT_PROFILE | 630 | #ifdef CONFIG_EVENT_PROFILE |
654 | 631 | ||
655 | #define _TRACE_PROFILE_INIT(call) \ | 632 | #define _TRACE_PROFILE_INIT(call) \ |
656 | .profile_count = ATOMIC_INIT(-1), \ | ||
657 | .profile_enable = ftrace_profile_enable_##call, \ | 633 | .profile_enable = ftrace_profile_enable_##call, \ |
658 | .profile_disable = ftrace_profile_disable_##call, | 634 | .profile_disable = ftrace_profile_disable_##call, |
659 | 635 | ||
@@ -728,13 +704,7 @@ static void ftrace_raw_event_##call(proto) \ | |||
728 | \ | 704 | \ |
729 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ | 705 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ |
730 | { \ | 706 | { \ |
731 | int ret; \ | 707 | return register_trace_##call(ftrace_raw_event_##call); \ |
732 | \ | ||
733 | ret = register_trace_##call(ftrace_raw_event_##call); \ | ||
734 | if (ret) \ | ||
735 | pr_info("event trace: Could not activate trace point " \ | ||
736 | "probe to " #call "\n"); \ | ||
737 | return ret; \ | ||
738 | } \ | 708 | } \ |
739 | \ | 709 | \ |
740 | static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ | 710 | static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ |
@@ -744,19 +714,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ | |||
744 | \ | 714 | \ |
745 | static struct trace_event ftrace_event_type_##call = { \ | 715 | static struct trace_event ftrace_event_type_##call = { \ |
746 | .trace = ftrace_raw_output_##call, \ | 716 | .trace = ftrace_raw_output_##call, \ |
747 | }; \ | 717 | }; |
748 | \ | ||
749 | static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\ | ||
750 | { \ | ||
751 | int id; \ | ||
752 | \ | ||
753 | id = register_ftrace_event(&ftrace_event_type_##call); \ | ||
754 | if (!id) \ | ||
755 | return -ENODEV; \ | ||
756 | event_##call.id = id; \ | ||
757 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
758 | return 0; \ | ||
759 | } | ||
760 | 718 | ||
761 | #undef DEFINE_EVENT_PRINT | 719 | #undef DEFINE_EVENT_PRINT |
762 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 720 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
@@ -776,7 +734,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
776 | .name = #call, \ | 734 | .name = #call, \ |
777 | .system = __stringify(TRACE_SYSTEM), \ | 735 | .system = __stringify(TRACE_SYSTEM), \ |
778 | .event = &ftrace_event_type_##call, \ | 736 | .event = &ftrace_event_type_##call, \ |
779 | .raw_init = ftrace_raw_init_event_##call, \ | 737 | .raw_init = trace_event_raw_init, \ |
780 | .regfunc = ftrace_raw_reg_event_##call, \ | 738 | .regfunc = ftrace_raw_reg_event_##call, \ |
781 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 739 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
782 | .show_format = ftrace_format_##template, \ | 740 | .show_format = ftrace_format_##template, \ |
@@ -793,7 +751,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
793 | .name = #call, \ | 751 | .name = #call, \ |
794 | .system = __stringify(TRACE_SYSTEM), \ | 752 | .system = __stringify(TRACE_SYSTEM), \ |
795 | .event = &ftrace_event_type_##call, \ | 753 | .event = &ftrace_event_type_##call, \ |
796 | .raw_init = ftrace_raw_init_event_##call, \ | 754 | .raw_init = trace_event_raw_init, \ |
797 | .regfunc = ftrace_raw_reg_event_##call, \ | 755 | .regfunc = ftrace_raw_reg_event_##call, \ |
798 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 756 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
799 | .show_format = ftrace_format_##call, \ | 757 | .show_format = ftrace_format_##call, \ |
@@ -953,7 +911,6 @@ end: \ | |||
953 | perf_swevent_put_recursion_context(rctx); \ | 911 | perf_swevent_put_recursion_context(rctx); \ |
954 | end_recursion: \ | 912 | end_recursion: \ |
955 | local_irq_restore(irq_flags); \ | 913 | local_irq_restore(irq_flags); \ |
956 | \ | ||
957 | } | 914 | } |
958 | 915 | ||
959 | #undef DEFINE_EVENT | 916 | #undef DEFINE_EVENT |
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h index c051a50ed528..89d43b3d4cb9 100644 --- a/include/video/da8xx-fb.h +++ b/include/video/da8xx-fb.h | |||
@@ -38,6 +38,7 @@ struct da8xx_lcdc_platform_data { | |||
38 | const char manu_name[10]; | 38 | const char manu_name[10]; |
39 | void *controller_data; | 39 | void *controller_data; |
40 | const char type[25]; | 40 | const char type[25]; |
41 | void (*panel_power_ctrl)(int); | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | struct lcd_ctrl_config { | 44 | struct lcd_ctrl_config { |
diff --git a/include/video/sgivw.h b/include/video/sgivw.h index 55f2a7c024af..f6aa5692e74b 100644 --- a/include/video/sgivw.h +++ b/include/video/sgivw.h | |||
@@ -351,7 +351,7 @@ typedef enum { | |||
351 | struct dbe_timing_info | 351 | struct dbe_timing_info |
352 | { | 352 | { |
353 | dbe_timing_t type; | 353 | dbe_timing_t type; |
354 | int flags; | 354 | int flags; |
355 | short width; /* Monitor resolution */ | 355 | short width; /* Monitor resolution */ |
356 | short height; | 356 | short height; |
357 | int fields_sec; /* fields/sec (Hz -3 dec. places */ | 357 | int fields_sec; /* fields/sec (Hz -3 dec. places */ |
@@ -389,11 +389,11 @@ struct dbe_timing_info dbeVTimings[] = { | |||
389 | { | 389 | { |
390 | DBE_VT_640_480_60, | 390 | DBE_VT_640_480_60, |
391 | /* flags, width, height, fields_sec, cfreq */ | 391 | /* flags, width, height, fields_sec, cfreq */ |
392 | 0, 640, 480, 59940, 25175, | 392 | 0, 640, 480, 59940, 25175, |
393 | /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */ | 393 | /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */ |
394 | 800, 640, 800, 656, 752, | 394 | 800, 640, 800, 656, 752, |
395 | /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */ | 395 | /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */ |
396 | 525, 480, 525, 490, 492, | 396 | 525, 480, 525, 490, 492, |
397 | /* pll_m, pll_n, pll_p */ | 397 | /* pll_m, pll_n, pll_p */ |
398 | 15, 2, 3 | 398 | 15, 2, 3 |
399 | }, | 399 | }, |
@@ -650,7 +650,7 @@ struct dbe_timing_info dbeVTimings[] = { | |||
650 | /* pll_m, pll_n, pll_p */ | 650 | /* pll_m, pll_n, pll_p */ |
651 | 6, 1, 0 | 651 | 6, 1, 0 |
652 | }, | 652 | }, |
653 | 653 | ||
654 | { | 654 | { |
655 | DBE_VT_1920_1200_60, | 655 | DBE_VT_1920_1200_60, |
656 | /* flags, width, height, fields_sec, cfreq */ | 656 | /* flags, width, height, fields_sec, cfreq */ |
@@ -676,7 +676,6 @@ struct dbe_timing_info dbeVTimings[] = { | |||
676 | } | 676 | } |
677 | }; | 677 | }; |
678 | 678 | ||
679 | #define DBE_VT_SIZE (sizeof(dbeVTimings)/sizeof(dbeVTimings[0])) | ||
680 | #endif // INCLUDE_TIMING_TABLE_DATA | 679 | #endif // INCLUDE_TIMING_TABLE_DATA |
681 | 680 | ||
682 | #endif // ! __SGIVWFB_H__ | 681 | #endif // ! __SGIVWFB_H__ |
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index 25144ab22b95..288205457713 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h | |||
@@ -50,6 +50,8 @@ struct sh_mobile_lcdc_board_cfg { | |||
50 | void *board_data; | 50 | void *board_data; |
51 | int (*setup_sys)(void *board_data, void *sys_ops_handle, | 51 | int (*setup_sys)(void *board_data, void *sys_ops_handle, |
52 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 52 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
53 | void (*start_transfer)(void *board_data, void *sys_ops_handle, | ||
54 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | ||
53 | void (*display_on)(void *board_data); | 55 | void (*display_on)(void *board_data); |
54 | void (*display_off)(void *board_data); | 56 | void (*display_off)(void *board_data); |
55 | }; | 57 | }; |
diff --git a/include/xen/xen.h b/include/xen/xen.h new file mode 100644 index 000000000000..a16402418d31 --- /dev/null +++ b/include/xen/xen.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _XEN_XEN_H | ||
2 | #define _XEN_XEN_H | ||
3 | |||
4 | enum xen_domain_type { | ||
5 | XEN_NATIVE, /* running on bare hardware */ | ||
6 | XEN_PV_DOMAIN, /* running in a PV domain */ | ||
7 | XEN_HVM_DOMAIN, /* running in a Xen hvm domain */ | ||
8 | }; | ||
9 | |||
10 | #ifdef CONFIG_XEN | ||
11 | extern enum xen_domain_type xen_domain_type; | ||
12 | #else | ||
13 | #define xen_domain_type XEN_NATIVE | ||
14 | #endif | ||
15 | |||
16 | #define xen_domain() (xen_domain_type != XEN_NATIVE) | ||
17 | #define xen_pv_domain() (xen_domain() && \ | ||
18 | xen_domain_type == XEN_PV_DOMAIN) | ||
19 | #define xen_hvm_domain() (xen_domain() && \ | ||
20 | xen_domain_type == XEN_HVM_DOMAIN) | ||
21 | |||
22 | #ifdef CONFIG_XEN_DOM0 | ||
23 | #include <xen/interface/xen.h> | ||
24 | #include <asm/xen/hypervisor.h> | ||
25 | |||
26 | #define xen_initial_domain() (xen_pv_domain() && \ | ||
27 | xen_start_info->flags & SIF_INITDOMAIN) | ||
28 | #else /* !CONFIG_XEN_DOM0 */ | ||
29 | #define xen_initial_domain() (0) | ||
30 | #endif /* CONFIG_XEN_DOM0 */ | ||
31 | |||
32 | #endif /* _XEN_XEN_H */ | ||