aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild1
-rw-r--r--include/acpi/acpixf.h9
-rw-r--r--include/acpi/actypes.h20
-rw-r--r--include/acpi/platform/acgcc.h4
-rw-r--r--include/acpi/platform/aclinux.h63
-rw-r--r--include/asm-generic/atomic64.h42
-rw-r--r--include/asm-generic/dma-mapping-common.h190
-rw-r--r--include/asm-generic/kmap_types.h2
-rw-r--r--include/asm-generic/pci.h13
-rw-r--r--include/asm-generic/sections.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h9
-rw-r--r--include/drm/drm_pciids.h8
-rw-r--r--include/drm/radeon_drm.h130
-rw-r--r--include/drm/ttm/ttm_bo_api.h618
-rw-r--r--include/drm/ttm/ttm_bo_driver.h867
-rw-r--r--include/drm/ttm/ttm_memory.h153
-rw-r--r--include/drm/ttm/ttm_module.h58
-rw-r--r--include/drm/ttm/ttm_placement.h92
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/adfs_fs.h13
-rw-r--r--include/linux/adfs_fs_i.h24
-rw-r--r--include/linux/adfs_fs_sb.h38
-rw-r--r--include/linux/bio.h5
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/bug.h12
-rw-r--r--include/linux/c2port.h3
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/compiler-gcc3.h6
-rw-r--r--include/linux/cpuset.h13
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/efi.h2
-rw-r--r--include/linux/eisa.h4
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/firewire.h358
-rw-r--r--include/linux/firmware-map.h12
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/fs.h10
-rw-r--r--include/linux/fsl_devices.h4
-rw-r--r--include/linux/gcd.h8
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h173
-rw-r--r--include/linux/highmem.h4
-rw-r--r--include/linux/hrtimer.h7
-rw-r--r--include/linux/hugetlb.h7
-rw-r--r--include/linux/i2c/pca953x.h1
-rw-r--r--include/linux/init.h5
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/interrupt.h14
-rw-r--r--include/linux/ipc_namespace.h5
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kernel_stat.h12
-rw-r--r--include/linux/kmemcheck.h153
-rw-r--r--include/linux/linux_logo.h16
-rw-r--r--include/linux/lis3lv02d.h39
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/memcontrol.h14
-rw-r--r--include/linux/mfd/ab3100.h103
-rw-r--r--include/linux/mfd/asic3.h236
-rw-r--r--include/linux/mfd/ezx-pcap.h256
-rw-r--r--include/linux/mfd/tmio.h2
-rw-r--r--include/linux/mg_disk.h45
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mm.h33
-rw-r--r--include/linux/mm_types.h10
-rw-r--r--include/linux/mmc/sdio_ids.h8
-rw-r--r--include/linux/mmzone.h36
-rw-r--r--include/linux/module.h23
-rw-r--r--include/linux/mtd/ubi.h37
-rw-r--r--include/linux/nls.h35
-rw-r--r--include/linux/nodemask.h19
-rw-r--r--include/linux/page-flags.h18
-rw-r--r--include/linux/pagemap.h12
-rw-r--r--include/linux/pci.h8
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/platform_device.h4
-rw-r--r--include/linux/poll.h3
-rw-r--r--include/linux/pps.h122
-rw-r--r--include/linux/pps_kernel.h89
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/regulator/lp3971.h51
-rw-r--r--include/linux/regulator/max1586.h63
-rw-r--r--include/linux/regulator/userspace-consumer.h25
-rw-r--r--include/linux/reiserfs_fs.h47
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/ring_buffer.h4
-rw-r--r--include/linux/rmap.h12
-rw-r--r--include/linux/sched.h31
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/slab.h7
-rw-r--r--include/linux/slab_def.h81
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/spi/spi.h28
-rw-r--r--include/linux/stacktrace.h3
-rw-r--r--include/linux/swap.h53
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/tick.h3
-rw-r--r--include/linux/timer.h3
-rw-r--r--include/linux/timex.h45
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/linux/tracepoint.h4
-rw-r--r--include/linux/usb.h37
-rw-r--r--include/linux/usb/audio.h265
-rw-r--r--include/linux/usb/ch9.h17
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/langwell_otg.h177
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/otg.h4
-rw-r--r--include/linux/usb/r8a66597.h44
-rw-r--r--include/linux/usb/serial.h32
-rw-r--r--include/linux/utsname.h12
-rw-r--r--include/linux/videodev2.h3
-rw-r--r--include/linux/vlynq.h161
-rw-r--r--include/linux/vmstat.h5
-rw-r--r--include/linux/w1-gpio.h1
-rw-r--r--include/media/adv7343.h23
-rw-r--r--include/media/ir-kbd-i2c.h10
-rw-r--r--include/media/soc_camera.h10
-rw-r--r--include/media/tuner.h2
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-device.h23
-rw-r--r--include/media/v4l2-subdev.h5
-rw-r--r--include/net/inet_sock.h14
-rw-r--r--include/net/inet_timewait_sock.h5
-rw-r--r--include/net/sock.h2
-rw-r--r--include/scsi/Kbuild4
-rw-r--r--include/scsi/scsi_bsg_fc.h322
-rw-r--r--include/scsi/scsi_host.h9
-rw-r--r--include/scsi/scsi_transport_fc.h52
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/video/s1d13xxxfb.h9
133 files changed, 5782 insertions, 671 deletions
diff --git a/include/Kbuild b/include/Kbuild
index fe36accd4328..8d226bfa2696 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -9,3 +9,4 @@ header-y += rdma/
9header-y += video/ 9header-y += video/
10header-y += drm/ 10header-y += drm/
11header-y += xen/ 11header-y += xen/
12header-y += scsi/
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 4db89e98535d..82ec6a3c0500 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 0x20090320 50#define ACPI_CA_VERSION 0x20090521
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -201,6 +201,8 @@ acpi_evaluate_object_typed(acpi_handle object,
201acpi_status 201acpi_status
202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
203 203
204acpi_status acpi_install_method(u8 *buffer);
205
204acpi_status 206acpi_status
205acpi_get_next_object(acpi_object_type type, 207acpi_get_next_object(acpi_object_type type,
206 acpi_handle parent, 208 acpi_handle parent,
@@ -375,7 +377,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
375acpi_status acpi_leave_sleep_state(u8 sleep_state); 377acpi_status acpi_leave_sleep_state(u8 sleep_state);
376 378
377/* 379/*
378 * Debug output 380 * Error/Warning output
379 */ 381 */
380void ACPI_INTERNAL_VAR_XFACE 382void ACPI_INTERNAL_VAR_XFACE
381acpi_error(const char *module_name, 383acpi_error(const char *module_name,
@@ -394,6 +396,9 @@ void ACPI_INTERNAL_VAR_XFACE
394acpi_info(const char *module_name, 396acpi_info(const char *module_name,
395 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 397 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
396 398
399/*
400 * Debug output
401 */
397#ifdef ACPI_DEBUG_OUTPUT 402#ifdef ACPI_DEBUG_OUTPUT
398 403
399void ACPI_INTERNAL_VAR_XFACE 404void ACPI_INTERNAL_VAR_XFACE
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index f555d927f7c0..37ba576d06e8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -429,20 +429,12 @@ typedef unsigned long long acpi_integer;
429 429
430/* Data manipulation */ 430/* Data manipulation */
431 431
432#define ACPI_LOWORD(l) ((u16)(u32)(l)) 432#define ACPI_LOBYTE(integer) ((u8) (u16)(integer))
433#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) 433#define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8))
434#define ACPI_LOBYTE(l) ((u8)(u16)(l)) 434#define ACPI_LOWORD(integer) ((u16) (u32)(integer))
435#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) 435#define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16))
436 436#define ACPI_LODWORD(integer64) ((u32) (u64)(integer64))
437/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ 437#define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32))
438
439struct acpi_integer_overlay {
440 u32 lo_dword;
441 u32 hi_dword;
442};
443
444#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
445#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
446 438
447#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 439#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
448#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 440#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 8e2cdc57b197..935c5d7fc86e 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -62,4 +62,8 @@
62 */ 62 */
63#define ACPI_UNUSED_VAR __attribute__ ((unused)) 63#define ACPI_UNUSED_VAR __attribute__ ((unused))
64 64
65#ifdef _ANSI
66#define inline
67#endif
68
65#endif /* __ACGCC_H__ */ 69#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 6d49b2a498c4..fcb8e4b159b1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: aclinux.h - OS specific defines, etc. 3 * Name: aclinux.h - OS specific defines, etc. for Linux
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,10 +44,13 @@
44#ifndef __ACLINUX_H__ 44#ifndef __ACLINUX_H__
45#define __ACLINUX_H__ 45#define __ACLINUX_H__
46 46
47/* Common (in-kernel/user-space) ACPICA configuration */
48
47#define ACPI_USE_SYSTEM_CLIBRARY 49#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
50 52
53
51#ifdef __KERNEL__ 54#ifdef __KERNEL__
52 55
53#include <linux/string.h> 56#include <linux/string.h>
@@ -63,15 +66,18 @@
63#include <linux/spinlock_types.h> 66#include <linux/spinlock_types.h>
64#include <asm/current.h> 67#include <asm/current.h>
65 68
66/* Host-dependent types and defines */ 69/* Host-dependent types and defines for in-kernel ACPICA */
67 70
68#define ACPI_MACHINE_WIDTH BITS_PER_LONG 71#define ACPI_MACHINE_WIDTH BITS_PER_LONG
69#define acpi_cache_t struct kmem_cache
70#define acpi_spinlock spinlock_t *
71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 72#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
72#define strtoul simple_strtoul 73#define strtoul simple_strtoul
73 74
74#else /* !__KERNEL__ */ 75#define acpi_cache_t struct kmem_cache
76#define acpi_spinlock spinlock_t *
77#define acpi_cpu_flags unsigned long
78#define acpi_thread_id struct task_struct *
79
80#else /* !__KERNEL__ */
75 81
76#include <stdarg.h> 82#include <stdarg.h>
77#include <string.h> 83#include <string.h>
@@ -79,6 +85,11 @@
79#include <ctype.h> 85#include <ctype.h>
80#include <unistd.h> 86#include <unistd.h>
81 87
88/* Host-dependent types and defines for user-space ACPICA */
89
90#define ACPI_FLUSH_CPU_CACHE()
91#define acpi_thread_id pthread_t
92
82#if defined(__ia64__) || defined(__x86_64__) 93#if defined(__ia64__) || defined(__x86_64__)
83#define ACPI_MACHINE_WIDTH 64 94#define ACPI_MACHINE_WIDTH 64
84#define COMPILER_DEPENDENT_INT64 long 95#define COMPILER_DEPENDENT_INT64 long
@@ -94,17 +105,17 @@
94#define __cdecl 105#define __cdecl
95#endif 106#endif
96 107
97#define ACPI_FLUSH_CPU_CACHE() 108#endif /* __KERNEL__ */
98#endif /* __KERNEL__ */
99 109
100/* Linux uses GCC */ 110/* Linux uses GCC */
101 111
102#include "acgcc.h" 112#include "acgcc.h"
103 113
104#define acpi_cpu_flags unsigned long
105
106#define acpi_thread_id struct task_struct *
107 114
115#ifdef __KERNEL__
116/*
117 * Overrides for in-kernel ACPICA
118 */
108static inline acpi_thread_id acpi_os_get_thread_id(void) 119static inline acpi_thread_id acpi_os_get_thread_id(void)
109{ 120{
110 return current; 121 return current;
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
119#include <acpi/actypes.h> 130#include <acpi/actypes.h>
120static inline void *acpi_os_allocate(acpi_size size) 131static inline void *acpi_os_allocate(acpi_size size)
121{ 132{
122 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 133 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
123} 134}
135
124static inline void *acpi_os_allocate_zeroed(acpi_size size) 136static inline void *acpi_os_allocate_zeroed(acpi_size size)
125{ 137{
126 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 138 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
127} 139}
128 140
129static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 141static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
130{ 142{
131 return kmem_cache_zalloc(cache, 143 return kmem_cache_zalloc(cache,
132 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 144 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
133} 145}
134 146
135#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 147#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
136#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
137#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
138 150
139/* 151/* Used within ACPICA to show where it is safe to preempt execution */
140 * We need to show where it is safe to preempt execution of ACPICA 152
141 */ 153#define ACPI_PREEMPTION_POINT() \
142#define ACPI_PREEMPTION_POINT() \ 154 do { \
143 do { \ 155 if (!irqs_disabled()) \
144 if (!irqs_disabled()) \ 156 cond_resched(); \
145 cond_resched(); \
146 } while (0) 157 } while (0)
147 158
148#endif /* __ACLINUX_H__ */ 159#endif /* __KERNEL__ */
160
161#endif /* __ACLINUX_H__ */
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h
new file mode 100644
index 000000000000..b18ce4f9ee3d
--- /dev/null
+++ b/include/asm-generic/atomic64.h
@@ -0,0 +1,42 @@
1/*
2 * Generic implementation of 64-bit atomics using spinlocks,
3 * useful on processors that don't have 64-bit atomic instructions.
4 *
5 * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef _ASM_GENERIC_ATOMIC64_H
13#define _ASM_GENERIC_ATOMIC64_H
14
15typedef struct {
16 long long counter;
17} atomic64_t;
18
19#define ATOMIC64_INIT(i) { (i) }
20
21extern long long atomic64_read(const atomic64_t *v);
22extern void atomic64_set(atomic64_t *v, long long i);
23extern void atomic64_add(long long a, atomic64_t *v);
24extern long long atomic64_add_return(long long a, atomic64_t *v);
25extern void atomic64_sub(long long a, atomic64_t *v);
26extern long long atomic64_sub_return(long long a, atomic64_t *v);
27extern long long atomic64_dec_if_positive(atomic64_t *v);
28extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n);
29extern long long atomic64_xchg(atomic64_t *v, long long new);
30extern int atomic64_add_unless(atomic64_t *v, long long a, long long u);
31
32#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
33#define atomic64_inc(v) atomic64_add(1LL, (v))
34#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
35#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
36#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
37#define atomic64_dec(v) atomic64_sub(1LL, (v))
38#define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
39#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
40#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
41
42#endif /* _ASM_GENERIC_ATOMIC64_H */
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
new file mode 100644
index 000000000000..5406a601185c
--- /dev/null
+++ b/include/asm-generic/dma-mapping-common.h
@@ -0,0 +1,190 @@
1#ifndef _ASM_GENERIC_DMA_MAPPING_H
2#define _ASM_GENERIC_DMA_MAPPING_H
3
4#include <linux/kmemcheck.h>
5#include <linux/scatterlist.h>
6#include <linux/dma-debug.h>
7#include <linux/dma-attrs.h>
8
9static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
10 size_t size,
11 enum dma_data_direction dir,
12 struct dma_attrs *attrs)
13{
14 struct dma_map_ops *ops = get_dma_ops(dev);
15 dma_addr_t addr;
16
17 kmemcheck_mark_initialized(ptr, size);
18 BUG_ON(!valid_dma_direction(dir));
19 addr = ops->map_page(dev, virt_to_page(ptr),
20 (unsigned long)ptr & ~PAGE_MASK, size,
21 dir, attrs);
22 debug_dma_map_page(dev, virt_to_page(ptr),
23 (unsigned long)ptr & ~PAGE_MASK, size,
24 dir, addr, true);
25 return addr;
26}
27
28static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,
29 size_t size,
30 enum dma_data_direction dir,
31 struct dma_attrs *attrs)
32{
33 struct dma_map_ops *ops = get_dma_ops(dev);
34
35 BUG_ON(!valid_dma_direction(dir));
36 if (ops->unmap_page)
37 ops->unmap_page(dev, addr, size, dir, attrs);
38 debug_dma_unmap_page(dev, addr, size, dir, true);
39}
40
41static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
42 int nents, enum dma_data_direction dir,
43 struct dma_attrs *attrs)
44{
45 struct dma_map_ops *ops = get_dma_ops(dev);
46 int i, ents;
47 struct scatterlist *s;
48
49 for_each_sg(sg, s, nents, i)
50 kmemcheck_mark_initialized(sg_virt(s), s->length);
51 BUG_ON(!valid_dma_direction(dir));
52 ents = ops->map_sg(dev, sg, nents, dir, attrs);
53 debug_dma_map_sg(dev, sg, nents, ents, dir);
54
55 return ents;
56}
57
58static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
59 int nents, enum dma_data_direction dir,
60 struct dma_attrs *attrs)
61{
62 struct dma_map_ops *ops = get_dma_ops(dev);
63
64 BUG_ON(!valid_dma_direction(dir));
65 debug_dma_unmap_sg(dev, sg, nents, dir);
66 if (ops->unmap_sg)
67 ops->unmap_sg(dev, sg, nents, dir, attrs);
68}
69
70static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
71 size_t offset, size_t size,
72 enum dma_data_direction dir)
73{
74 struct dma_map_ops *ops = get_dma_ops(dev);
75 dma_addr_t addr;
76
77 kmemcheck_mark_initialized(page_address(page) + offset, size);
78 BUG_ON(!valid_dma_direction(dir));
79 addr = ops->map_page(dev, page, offset, size, dir, NULL);
80 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
81
82 return addr;
83}
84
85static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
86 size_t size, enum dma_data_direction dir)
87{
88 struct dma_map_ops *ops = get_dma_ops(dev);
89
90 BUG_ON(!valid_dma_direction(dir));
91 if (ops->unmap_page)
92 ops->unmap_page(dev, addr, size, dir, NULL);
93 debug_dma_unmap_page(dev, addr, size, dir, false);
94}
95
96static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
97 size_t size,
98 enum dma_data_direction dir)
99{
100 struct dma_map_ops *ops = get_dma_ops(dev);
101
102 BUG_ON(!valid_dma_direction(dir));
103 if (ops->sync_single_for_cpu)
104 ops->sync_single_for_cpu(dev, addr, size, dir);
105 debug_dma_sync_single_for_cpu(dev, addr, size, dir);
106 flush_write_buffers();
107}
108
109static inline void dma_sync_single_for_device(struct device *dev,
110 dma_addr_t addr, size_t size,
111 enum dma_data_direction dir)
112{
113 struct dma_map_ops *ops = get_dma_ops(dev);
114
115 BUG_ON(!valid_dma_direction(dir));
116 if (ops->sync_single_for_device)
117 ops->sync_single_for_device(dev, addr, size, dir);
118 debug_dma_sync_single_for_device(dev, addr, size, dir);
119 flush_write_buffers();
120}
121
122static inline void dma_sync_single_range_for_cpu(struct device *dev,
123 dma_addr_t addr,
124 unsigned long offset,
125 size_t size,
126 enum dma_data_direction dir)
127{
128 struct dma_map_ops *ops = get_dma_ops(dev);
129
130 BUG_ON(!valid_dma_direction(dir));
131 if (ops->sync_single_range_for_cpu) {
132 ops->sync_single_range_for_cpu(dev, addr, offset, size, dir);
133 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
134
135 flush_write_buffers();
136 } else
137 dma_sync_single_for_cpu(dev, addr, size, dir);
138}
139
140static inline void dma_sync_single_range_for_device(struct device *dev,
141 dma_addr_t addr,
142 unsigned long offset,
143 size_t size,
144 enum dma_data_direction dir)
145{
146 struct dma_map_ops *ops = get_dma_ops(dev);
147
148 BUG_ON(!valid_dma_direction(dir));
149 if (ops->sync_single_range_for_device) {
150 ops->sync_single_range_for_device(dev, addr, offset, size, dir);
151 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
152
153 flush_write_buffers();
154 } else
155 dma_sync_single_for_device(dev, addr, size, dir);
156}
157
158static inline void
159dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
160 int nelems, enum dma_data_direction dir)
161{
162 struct dma_map_ops *ops = get_dma_ops(dev);
163
164 BUG_ON(!valid_dma_direction(dir));
165 if (ops->sync_sg_for_cpu)
166 ops->sync_sg_for_cpu(dev, sg, nelems, dir);
167 debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
168 flush_write_buffers();
169}
170
171static inline void
172dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
173 int nelems, enum dma_data_direction dir)
174{
175 struct dma_map_ops *ops = get_dma_ops(dev);
176
177 BUG_ON(!valid_dma_direction(dir));
178 if (ops->sync_sg_for_device)
179 ops->sync_sg_for_device(dev, sg, nelems, dir);
180 debug_dma_sync_sg_for_device(dev, sg, nelems, dir);
181
182 flush_write_buffers();
183}
184
185#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
186#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
187#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
188#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
189
190#endif
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index 58c33055c304..54e8b3d956b7 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_GENERIC_KMAP_TYPES_H 1#ifndef _ASM_GENERIC_KMAP_TYPES_H
2#define _ASM_GENERIC_KMAP_TYPES_H 2#define _ASM_GENERIC_KMAP_TYPES_H
3 3
4#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef __WITH_KM_FENCE
5# define D(n) __KM_FENCE_##n , 5# define D(n) __KM_FENCE_##n ,
6#else 6#else
7# define D(n) 7# define D(n)
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index 515c6e2e3218..b4326b5466eb 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -30,19 +30,6 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
30 res->end = region->end; 30 res->end = region->end;
31} 31}
32 32
33static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{
36 struct resource *root = NULL;
37
38 if (res->flags & IORESOURCE_IO)
39 root = &ioport_resource;
40 if (res->flags & IORESOURCE_MEM)
41 root = &iomem_resource;
42
43 return root;
44}
45
46#define pcibios_scan_all_fns(a, b) 0 33#define pcibios_scan_all_fns(a, b) 0
47 34
48#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 4ce48e878530..d083561337f2 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -14,6 +14,9 @@ extern char __kprobes_text_start[], __kprobes_text_end[];
14extern char __initdata_begin[], __initdata_end[]; 14extern char __initdata_begin[], __initdata_end[];
15extern char __start_rodata[], __end_rodata[]; 15extern char __start_rodata[], __end_rodata[];
16 16
17/* Start and end of .ctors section - used for constructor calls. */
18extern char __ctors_start[], __ctors_end[];
19
17/* function descriptor handling (if any). Override 20/* function descriptor handling (if any). Override
18 * in asm/sections.h */ 21 * in asm/sections.h */
19#ifndef dereference_function_descriptor 22#ifndef dereference_function_descriptor
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6bdba10fef4a..55413e568f07 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -440,12 +440,21 @@
440 INIT_TASK \ 440 INIT_TASK \
441 } 441 }
442 442
443#ifdef CONFIG_CONSTRUCTORS
444#define KERNEL_CTORS() VMLINUX_SYMBOL(__ctors_start) = .; \
445 *(.ctors) \
446 VMLINUX_SYMBOL(__ctors_end) = .;
447#else
448#define KERNEL_CTORS()
449#endif
450
443/* init and exit section handling */ 451/* init and exit section handling */
444#define INIT_DATA \ 452#define INIT_DATA \
445 *(.init.data) \ 453 *(.init.data) \
446 DEV_DISCARD(init.data) \ 454 DEV_DISCARD(init.data) \
447 CPU_DISCARD(init.data) \ 455 CPU_DISCARD(init.data) \
448 MEM_DISCARD(init.data) \ 456 MEM_DISCARD(init.data) \
457 KERNEL_CTORS() \
449 *(.init.rodata) \ 458 *(.init.rodata) \
450 DEV_DISCARD(init.rodata) \ 459 DEV_DISCARD(init.rodata) \
451 CPU_DISCARD(init.rodata) \ 460 CPU_DISCARD(init.rodata) \
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index f8634ab53b8f..45c18672b093 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -254,8 +254,8 @@
254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ 256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 257 {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 258 {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 259 {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 260 {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ 261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
@@ -273,8 +273,8 @@
273 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 273 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 274 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 275 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 276 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
278 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 278 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
279 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 279 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
280 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 280 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index fe3e3a4b4aed..41862e9a4c20 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -496,6 +496,16 @@ typedef struct {
496#define DRM_RADEON_SETPARAM 0x19 496#define DRM_RADEON_SETPARAM 0x19
497#define DRM_RADEON_SURF_ALLOC 0x1a 497#define DRM_RADEON_SURF_ALLOC 0x1a
498#define DRM_RADEON_SURF_FREE 0x1b 498#define DRM_RADEON_SURF_FREE 0x1b
499/* KMS ioctl */
500#define DRM_RADEON_GEM_INFO 0x1c
501#define DRM_RADEON_GEM_CREATE 0x1d
502#define DRM_RADEON_GEM_MMAP 0x1e
503#define DRM_RADEON_GEM_PREAD 0x21
504#define DRM_RADEON_GEM_PWRITE 0x22
505#define DRM_RADEON_GEM_SET_DOMAIN 0x23
506#define DRM_RADEON_GEM_WAIT_IDLE 0x24
507#define DRM_RADEON_CS 0x26
508#define DRM_RADEON_INFO 0x27
499 509
500#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 510#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
501#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 511#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -524,6 +534,17 @@ typedef struct {
524#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) 534#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
525#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) 535#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
526#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) 536#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
537/* KMS */
538#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
539#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
540#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
541#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
542#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
543#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
544#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
545#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
546#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
547
527 548
528typedef struct drm_radeon_init { 549typedef struct drm_radeon_init {
529 enum { 550 enum {
@@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect {
682#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 703#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
683#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 704#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
684#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 705#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
706#define RADEON_PARAM_DEVICE_ID 16
685 707
686typedef struct drm_radeon_getparam { 708typedef struct drm_radeon_getparam {
687 int param; 709 int param;
@@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free {
751#define DRM_RADEON_VBLANK_CRTC1 1 773#define DRM_RADEON_VBLANK_CRTC1 1
752#define DRM_RADEON_VBLANK_CRTC2 2 774#define DRM_RADEON_VBLANK_CRTC2 2
753 775
776/*
777 * Kernel modesetting world below.
778 */
779#define RADEON_GEM_DOMAIN_CPU 0x1
780#define RADEON_GEM_DOMAIN_GTT 0x2
781#define RADEON_GEM_DOMAIN_VRAM 0x4
782
783struct drm_radeon_gem_info {
784 uint64_t gart_size;
785 uint64_t vram_size;
786 uint64_t vram_visible;
787};
788
789#define RADEON_GEM_NO_BACKING_STORE 1
790
791struct drm_radeon_gem_create {
792 uint64_t size;
793 uint64_t alignment;
794 uint32_t handle;
795 uint32_t initial_domain;
796 uint32_t flags;
797};
798
799struct drm_radeon_gem_mmap {
800 uint32_t handle;
801 uint32_t pad;
802 uint64_t offset;
803 uint64_t size;
804 uint64_t addr_ptr;
805};
806
807struct drm_radeon_gem_set_domain {
808 uint32_t handle;
809 uint32_t read_domains;
810 uint32_t write_domain;
811};
812
813struct drm_radeon_gem_wait_idle {
814 uint32_t handle;
815 uint32_t pad;
816};
817
818struct drm_radeon_gem_busy {
819 uint32_t handle;
820 uint32_t busy;
821};
822
823struct drm_radeon_gem_pread {
824 /** Handle for the object being read. */
825 uint32_t handle;
826 uint32_t pad;
827 /** Offset into the object to read from */
828 uint64_t offset;
829 /** Length of data to read */
830 uint64_t size;
831 /** Pointer to write the data into. */
832 /* void *, but pointers are not 32/64 compatible */
833 uint64_t data_ptr;
834};
835
836struct drm_radeon_gem_pwrite {
837 /** Handle for the object being written to. */
838 uint32_t handle;
839 uint32_t pad;
840 /** Offset into the object to write to */
841 uint64_t offset;
842 /** Length of data to write */
843 uint64_t size;
844 /** Pointer to read the data from. */
845 /* void *, but pointers are not 32/64 compatible */
846 uint64_t data_ptr;
847};
848
849#define RADEON_CHUNK_ID_RELOCS 0x01
850#define RADEON_CHUNK_ID_IB 0x02
851
852struct drm_radeon_cs_chunk {
853 uint32_t chunk_id;
854 uint32_t length_dw;
855 uint64_t chunk_data;
856};
857
858struct drm_radeon_cs_reloc {
859 uint32_t handle;
860 uint32_t read_domains;
861 uint32_t write_domain;
862 uint32_t flags;
863};
864
865struct drm_radeon_cs {
866 uint32_t num_chunks;
867 uint32_t cs_id;
868 /* this points to uint64_t * which point to cs chunks */
869 uint64_t chunks;
870 /* updates to the limits after this CS ioctl */
871 uint64_t gart_limit;
872 uint64_t vram_limit;
873};
874
875#define RADEON_INFO_DEVICE_ID 0x00
876#define RADEON_INFO_NUM_GB_PIPES 0x01
877
878struct drm_radeon_info {
879 uint32_t request;
880 uint32_t pad;
881 uint64_t value;
882};
883
754#endif 884#endif
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
new file mode 100644
index 000000000000..cd22ab4b495c
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -0,0 +1,618 @@
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_BO_API_H_
32#define _TTM_BO_API_H_
33
34#include "drm_hashtab.h"
35#include <linux/kref.h>
36#include <linux/list.h>
37#include <linux/wait.h>
38#include <linux/mutex.h>
39#include <linux/mm.h>
40#include <linux/rbtree.h>
41#include <linux/bitmap.h>
42
43struct ttm_bo_device;
44
45struct drm_mm_node;
46
47/**
48 * struct ttm_mem_reg
49 *
50 * @mm_node: Memory manager node.
51 * @size: Requested size of memory region.
52 * @num_pages: Actual size of memory region in pages.
53 * @page_alignment: Page alignment.
54 * @placement: Placement flags.
55 *
56 * Structure indicating the placement and space resources used by a
57 * buffer object.
58 */
59
60struct ttm_mem_reg {
61 struct drm_mm_node *mm_node;
62 unsigned long size;
63 unsigned long num_pages;
64 uint32_t page_alignment;
65 uint32_t mem_type;
66 uint32_t placement;
67};
68
69/**
70 * enum ttm_bo_type
71 *
72 * @ttm_bo_type_device: These are 'normal' buffers that can
73 * be mmapped by user space. Each of these bos occupy a slot in the
74 * device address space, that can be used for normal vm operations.
75 *
76 * @ttm_bo_type_user: These are user-space memory areas that are made
77 * available to the GPU by mapping the buffer pages into the GPU aperture
78 * space. These buffers cannot be mmaped from the device address space.
79 *
80 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
81 * but they cannot be accessed from user-space. For kernel-only use.
82 */
83
84enum ttm_bo_type {
85 ttm_bo_type_device,
86 ttm_bo_type_user,
87 ttm_bo_type_kernel
88};
89
90struct ttm_tt;
91
92/**
93 * struct ttm_buffer_object
94 *
95 * @bdev: Pointer to the buffer object device structure.
96 * @buffer_start: The virtual user-space start address of ttm_bo_type_user
97 * buffers.
98 * @type: The bo type.
99 * @destroy: Destruction function. If NULL, kfree is used.
100 * @num_pages: Actual number of pages.
101 * @addr_space_offset: Address space offset.
102 * @acc_size: Accounted size for this object.
103 * @kref: Reference count of this buffer object. When this refcount reaches
104 * zero, the object is put on the delayed delete list.
105 * @list_kref: List reference count of this buffer object. This member is
106 * used to avoid destruction while the buffer object is still on a list.
107 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
108 * keeps one refcount. When this refcount reaches zero,
109 * the object is destroyed.
110 * @event_queue: Queue for processes waiting on buffer object status change.
111 * @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.
117 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
118 * pinned in physical memory. If this behaviour is not desired, this member
119 * holds a pointer to a persistant shmem object.
120 * @ttm: TTM structure holding system pages.
121 * @evicted: Whether the object was evicted without user-space knowing.
122 * @cpu_writes: For synchronization. Number of cpu writers.
123 * @lru: List head for the lru list.
124 * @ddestroy: List head for the delayed destroy list.
125 * @swap: List head for swap LRU list.
126 * @val_seq: Sequence of the validation holding the @reserved lock.
127 * Used to avoid starvation when many processes compete to validate the
128 * buffer. This member is protected by the bo_device::lru_lock.
129 * @seq_valid: The value of @val_seq is valid. This value is protected by
130 * the bo_device::lru_lock.
131 * @reserved: Deadlock-free lock used for synchronization state transitions.
132 * @sync_obj_arg: Opaque argument to synchronization object function.
133 * @sync_obj: Pointer to a synchronization object.
134 * @priv_flags: Flags describing buffer object internal state.
135 * @vm_rb: Rb node for the vm rb tree.
136 * @vm_node: Address space manager node.
137 * @offset: The current GPU offset, which can have different meanings
138 * depending on the memory type. For SYSTEM type memory, it should be 0.
139 * @cur_placement: Hint of current placement.
140 *
141 * Base class for TTM buffer object, that deals with data placement and CPU
142 * mappings. GPU mappings are really up to the driver, but for simpler GPUs
143 * the driver can usually use the placement offset @offset directly as the
144 * GPU virtual address. For drivers implementing multiple
145 * GPU memory manager contexts, the driver should manage the address space
146 * in these contexts separately and use these objects to get the correct
147 * placement and caching for these GPU maps. This makes it possible to use
148 * these objects for even quite elaborate memory management schemes.
149 * The destroy member, the API visibility of this object makes it possible
150 * to derive driver specific types.
151 */
152
153struct ttm_buffer_object {
154 /**
155 * Members constant at init.
156 */
157
158 struct ttm_bo_device *bdev;
159 unsigned long buffer_start;
160 enum ttm_bo_type type;
161 void (*destroy) (struct ttm_buffer_object *);
162 unsigned long num_pages;
163 uint64_t addr_space_offset;
164 size_t acc_size;
165
166 /**
167 * Members not needing protection.
168 */
169
170 struct kref kref;
171 struct kref list_kref;
172 wait_queue_head_t event_queue;
173 spinlock_t lock;
174
175 /**
176 * Members protected by the bo::reserved lock.
177 */
178
179 uint32_t proposed_placement;
180 struct ttm_mem_reg mem;
181 struct file *persistant_swap_storage;
182 struct ttm_tt *ttm;
183 bool evicted;
184
185 /**
186 * Members protected by the bo::reserved lock only when written to.
187 */
188
189 atomic_t cpu_writers;
190
191 /**
192 * Members protected by the bdev::lru_lock.
193 */
194
195 struct list_head lru;
196 struct list_head ddestroy;
197 struct list_head swap;
198 uint32_t val_seq;
199 bool seq_valid;
200
201 /**
202 * Members protected by the bdev::lru_lock
203 * only when written to.
204 */
205
206 atomic_t reserved;
207
208
209 /**
210 * Members protected by the bo::lock
211 */
212
213 void *sync_obj_arg;
214 void *sync_obj;
215 unsigned long priv_flags;
216
217 /**
218 * Members protected by the bdev::vm_lock
219 */
220
221 struct rb_node vm_rb;
222 struct drm_mm_node *vm_node;
223
224
225 /**
226 * Special members that are protected by the reserve lock
227 * and the bo::lock when written to. Can be read with
228 * either of these locks held.
229 */
230
231 unsigned long offset;
232 uint32_t cur_placement;
233};
234
235/**
236 * struct ttm_bo_kmap_obj
237 *
238 * @virtual: The current kernel virtual address.
239 * @page: The page when kmap'ing a single page.
240 * @bo_kmap_type: Type of bo_kmap.
241 *
242 * Object describing a kernel mapping. Since a TTM bo may be located
243 * in various memory types with various caching policies, the
244 * mapping can either be an ioremap, a vmap, a kmap or part of a
245 * premapped region.
246 */
247
248struct ttm_bo_kmap_obj {
249 void *virtual;
250 struct page *page;
251 enum {
252 ttm_bo_map_iomap,
253 ttm_bo_map_vmap,
254 ttm_bo_map_kmap,
255 ttm_bo_map_premapped,
256 } bo_kmap_type;
257};
258
259/**
260 * ttm_bo_reference - reference a struct ttm_buffer_object
261 *
262 * @bo: The buffer object.
263 *
264 * Returns a refcounted pointer to a buffer object.
265 */
266
267static inline struct ttm_buffer_object *
268ttm_bo_reference(struct ttm_buffer_object *bo)
269{
270 kref_get(&bo->kref);
271 return bo;
272}
273
274/**
275 * ttm_bo_wait - wait for buffer idle.
276 *
277 * @bo: The buffer object.
278 * @interruptible: Use interruptible wait.
279 * @no_wait: Return immediately if buffer is busy.
280 *
281 * This function must be called with the bo::mutex held, and makes
282 * sure any previous rendering to the buffer is completed.
283 * Note: It might be necessary to block validations before the
284 * wait by reserving the buffer.
285 * Returns -EBUSY if no_wait is true and the buffer is busy.
286 * Returns -ERESTART if interrupted by a signal.
287 */
288extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
289 bool interruptible, bool no_wait);
290/**
291 * ttm_buffer_object_validate
292 *
293 * @bo: The buffer object.
294 * @proposed_placement: Proposed_placement for the buffer object.
295 * @interruptible: Sleep interruptible if sleeping.
296 * @no_wait: Return immediately if the buffer is busy.
297 *
298 * Changes placement and caching policy of the buffer object
299 * according to bo::proposed_flags.
300 * Returns
301 * -EINVAL on invalid proposed_flags.
302 * -ENOMEM on out-of-memory condition.
303 * -EBUSY if no_wait is true and buffer busy.
304 * -ERESTART if interrupted by a signal.
305 */
306extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
307 uint32_t proposed_placement,
308 bool interruptible, bool no_wait);
309/**
310 * ttm_bo_unref
311 *
312 * @bo: The buffer object.
313 *
314 * Unreference and clear a pointer to a buffer object.
315 */
316extern void ttm_bo_unref(struct ttm_buffer_object **bo);
317
318/**
319 * ttm_bo_synccpu_write_grab
320 *
321 * @bo: The buffer object:
322 * @no_wait: Return immediately if buffer is busy.
323 *
324 * Synchronizes a buffer object for CPU RW access. This means
325 * blocking command submission that affects the buffer and
326 * waiting for buffer idle. This lock is recursive.
327 * Returns
328 * -EBUSY if the buffer is busy and no_wait is true.
329 * -ERESTART if interrupted by a signal.
330 */
331
332extern int
333ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
334/**
335 * ttm_bo_synccpu_write_release:
336 *
337 * @bo : The buffer object.
338 *
339 * Releases a synccpu lock.
340 */
341extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
342
343/**
344 * ttm_buffer_object_init
345 *
346 * @bdev: Pointer to a ttm_bo_device struct.
347 * @bo: Pointer to a ttm_buffer_object to be initialized.
348 * @size: Requested size of buffer object.
349 * @type: Requested type of buffer object.
350 * @flags: Initial placement flags.
351 * @page_alignment: Data alignment in pages.
352 * @buffer_start: Virtual address of user space data backing a
353 * user buffer object.
354 * @interruptible: If needing to sleep to wait for GPU resources,
355 * sleep interruptible.
356 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
357 * pinned in physical memory. If this behaviour is not desired, this member
358 * holds a pointer to a persistant shmem object. Typically, this would
359 * point to the shmem object backing a GEM object if TTM is used to back a
360 * GEM user interface.
361 * @acc_size: Accounted size for this object.
362 * @destroy: Destroy function. Use NULL for kfree().
363 *
364 * This function initializes a pre-allocated struct ttm_buffer_object.
365 * As this object may be part of a larger structure, this function,
366 * together with the @destroy function,
367 * enables driver-specific objects derived from a ttm_buffer_object.
368 * On successful return, the object kref and list_kref are set to 1.
369 * Returns
370 * -ENOMEM: Out of memory.
371 * -EINVAL: Invalid placement flags.
372 * -ERESTART: Interrupted by signal while sleeping waiting for resources.
373 */
374
375extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
376 struct ttm_buffer_object *bo,
377 unsigned long size,
378 enum ttm_bo_type type,
379 uint32_t flags,
380 uint32_t page_alignment,
381 unsigned long buffer_start,
382 bool interrubtible,
383 struct file *persistant_swap_storage,
384 size_t acc_size,
385 void (*destroy) (struct ttm_buffer_object *));
386/**
387 * ttm_bo_synccpu_object_init
388 *
389 * @bdev: Pointer to a ttm_bo_device struct.
390 * @bo: Pointer to a ttm_buffer_object to be initialized.
391 * @size: Requested size of buffer object.
392 * @type: Requested type of buffer object.
393 * @flags: Initial placement flags.
394 * @page_alignment: Data alignment in pages.
395 * @buffer_start: Virtual address of user space data backing a
396 * user buffer object.
397 * @interruptible: If needing to sleep while waiting for GPU resources,
398 * sleep interruptible.
399 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
400 * pinned in physical memory. If this behaviour is not desired, this member
401 * holds a pointer to a persistant shmem object. Typically, this would
402 * point to the shmem object backing a GEM object if TTM is used to back a
403 * GEM user interface.
404 * @p_bo: On successful completion *p_bo points to the created object.
405 *
406 * This function allocates a ttm_buffer_object, and then calls
407 * ttm_buffer_object_init on that object.
408 * The destroy function is set to kfree().
409 * Returns
410 * -ENOMEM: Out of memory.
411 * -EINVAL: Invalid placement flags.
412 * -ERESTART: Interrupted by signal while waiting for resources.
413 */
414
415extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
416 unsigned long size,
417 enum ttm_bo_type type,
418 uint32_t flags,
419 uint32_t page_alignment,
420 unsigned long buffer_start,
421 bool interruptible,
422 struct file *persistant_swap_storage,
423 struct ttm_buffer_object **p_bo);
424
425/**
426 * ttm_bo_check_placement
427 *
428 * @bo: the buffer object.
429 * @set_flags: placement flags to set.
430 * @clr_flags: placement flags to clear.
431 *
432 * Performs minimal validity checking on an intended change of
433 * placement flags.
434 * Returns
435 * -EINVAL: Intended change is invalid or not allowed.
436 */
437
438extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
439 uint32_t set_flags, uint32_t clr_flags);
440
441/**
442 * ttm_bo_init_mm
443 *
444 * @bdev: Pointer to a ttm_bo_device struct.
445 * @mem_type: The memory type.
446 * @p_offset: offset for managed area in pages.
447 * @p_size: size managed area in pages.
448 *
449 * Initialize a manager for a given memory type.
450 * Note: if part of driver firstopen, it must be protected from a
451 * potentially racing lastclose.
452 * Returns:
453 * -EINVAL: invalid size or memory type.
454 * -ENOMEM: Not enough memory.
455 * May also return driver-specified errors.
456 */
457
458extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
459 unsigned long p_offset, unsigned long p_size);
460/**
461 * ttm_bo_clean_mm
462 *
463 * @bdev: Pointer to a ttm_bo_device struct.
464 * @mem_type: The memory type.
465 *
466 * Take down a manager for a given memory type after first walking
467 * the LRU list to evict any buffers left alive.
468 *
469 * Normally, this function is part of lastclose() or unload(), and at that
470 * point there shouldn't be any buffers left created by user-space, since
471 * there should've been removed by the file descriptor release() method.
472 * However, before this function is run, make sure to signal all sync objects,
473 * and verify that the delayed delete queue is empty. The driver must also
474 * make sure that there are no NO_EVICT buffers present in this memory type
475 * when the call is made.
476 *
477 * If this function is part of a VT switch, the caller must make sure that
478 * there are no appications currently validating buffers before this
479 * function is called. The caller can do that by first taking the
480 * struct ttm_bo_device::ttm_lock in write mode.
481 *
482 * Returns:
483 * -EINVAL: invalid or uninitialized memory type.
484 * -EBUSY: There are still buffers left in this memory type.
485 */
486
487extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
488
489/**
490 * ttm_bo_evict_mm
491 *
492 * @bdev: Pointer to a ttm_bo_device struct.
493 * @mem_type: The memory type.
494 *
495 * Evicts all buffers on the lru list of the memory type.
496 * This is normally part of a VT switch or an
497 * out-of-memory-space-due-to-fragmentation handler.
498 * The caller must make sure that there are no other processes
499 * currently validating buffers, and can do that by taking the
500 * struct ttm_bo_device::ttm_lock in write mode.
501 *
502 * Returns:
503 * -EINVAL: Invalid or uninitialized memory type.
504 * -ERESTART: The call was interrupted by a signal while waiting to
505 * evict a buffer.
506 */
507
508extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
509
510/**
511 * ttm_kmap_obj_virtual
512 *
513 * @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
514 * @is_iomem: Pointer to an integer that on return indicates 1 if the
515 * virtual map is io memory, 0 if normal memory.
516 *
517 * Returns the virtual address of a buffer object area mapped by ttm_bo_kmap.
518 * If *is_iomem is 1 on return, the virtual address points to an io memory area,
519 * that should strictly be accessed by the iowriteXX() and similar functions.
520 */
521
522static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
523 bool *is_iomem)
524{
525 *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap ||
526 map->bo_kmap_type == ttm_bo_map_premapped);
527 return map->virtual;
528}
529
530/**
531 * ttm_bo_kmap
532 *
533 * @bo: The buffer object.
534 * @start_page: The first page to map.
535 * @num_pages: Number of pages to map.
536 * @map: pointer to a struct ttm_bo_kmap_obj representing the map.
537 *
538 * Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the
539 * data in the buffer object. The ttm_kmap_obj_virtual function can then be
540 * used to obtain a virtual address to the data.
541 *
542 * Returns
543 * -ENOMEM: Out of memory.
544 * -EINVAL: Invalid range.
545 */
546
547extern int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
548 unsigned long num_pages, struct ttm_bo_kmap_obj *map);
549
550/**
551 * ttm_bo_kunmap
552 *
553 * @map: Object describing the map to unmap.
554 *
555 * Unmaps a kernel map set up by ttm_bo_kmap.
556 */
557
558extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
559
560#if 0
561#endif
562
563/**
564 * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object.
565 *
566 * @vma: vma as input from the fbdev mmap method.
567 * @bo: The bo backing the address space. The address space will
568 * have the same size as the bo, and start at offset 0.
569 *
570 * This function is intended to be called by the fbdev mmap method
571 * if the fbdev address space is to be backed by a bo.
572 */
573
574extern int ttm_fbdev_mmap(struct vm_area_struct *vma,
575 struct ttm_buffer_object *bo);
576
577/**
578 * ttm_bo_mmap - mmap out of the ttm device address space.
579 *
580 * @filp: filp as input from the mmap method.
581 * @vma: vma as input from the mmap method.
582 * @bdev: Pointer to the ttm_bo_device with the address space manager.
583 *
584 * This function is intended to be called by the device mmap method.
585 * if the device address space is to be backed by the bo manager.
586 */
587
588extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
589 struct ttm_bo_device *bdev);
590
591/**
592 * ttm_bo_io
593 *
594 * @bdev: Pointer to the struct ttm_bo_device.
595 * @filp: Pointer to the struct file attempting to read / write.
596 * @wbuf: User-space pointer to address of buffer to write. NULL on read.
597 * @rbuf: User-space pointer to address of buffer to read into.
598 * Null on write.
599 * @count: Number of bytes to read / write.
600 * @f_pos: Pointer to current file position.
601 * @write: 1 for read, 0 for write.
602 *
603 * This function implements read / write into ttm buffer objects, and is
604 * intended to
605 * be called from the fops::read and fops::write method.
606 * Returns:
607 * See man (2) write, man(2) read. In particular,
608 * the function may return -EINTR if
609 * interrupted by a signal.
610 */
611
612extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
613 const char __user *wbuf, char __user *rbuf,
614 size_t count, loff_t *f_pos, bool write);
615
616extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
617
618#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
new file mode 100644
index 000000000000..62ed733c52a2
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -0,0 +1,867 @@
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#ifndef _TTM_BO_DRIVER_H_
31#define _TTM_BO_DRIVER_H_
32
33#include "ttm/ttm_bo_api.h"
34#include "ttm/ttm_memory.h"
35#include "drm_mm.h"
36#include "linux/workqueue.h"
37#include "linux/fs.h"
38#include "linux/spinlock.h"
39
40struct ttm_backend;
41
42struct ttm_backend_func {
43 /**
44 * struct ttm_backend_func member populate
45 *
46 * @backend: Pointer to a struct ttm_backend.
47 * @num_pages: Number of pages to populate.
48 * @pages: Array of pointers to ttm pages.
49 * @dummy_read_page: Page to be used instead of NULL pages in the
50 * array @pages.
51 *
52 * Populate the backend with ttm pages. Depending on the backend,
53 * it may or may not copy the @pages array.
54 */
55 int (*populate) (struct ttm_backend *backend,
56 unsigned long num_pages, struct page **pages,
57 struct page *dummy_read_page);
58 /**
59 * struct ttm_backend_func member clear
60 *
61 * @backend: Pointer to a struct ttm_backend.
62 *
63 * This is an "unpopulate" function. Release all resources
64 * allocated with populate.
65 */
66 void (*clear) (struct ttm_backend *backend);
67
68 /**
69 * struct ttm_backend_func member bind
70 *
71 * @backend: Pointer to a struct ttm_backend.
72 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
73 * memory type and location for binding.
74 *
75 * Bind the backend pages into the aperture in the location
76 * indicated by @bo_mem. This function should be able to handle
77 * differences between aperture- and system page sizes.
78 */
79 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem);
80
81 /**
82 * struct ttm_backend_func member unbind
83 *
84 * @backend: Pointer to a struct ttm_backend.
85 *
86 * Unbind previously bound backend pages. This function should be
87 * able to handle differences between aperture- and system page sizes.
88 */
89 int (*unbind) (struct ttm_backend *backend);
90
91 /**
92 * struct ttm_backend_func member destroy
93 *
94 * @backend: Pointer to a struct ttm_backend.
95 *
96 * Destroy the backend.
97 */
98 void (*destroy) (struct ttm_backend *backend);
99};
100
101/**
102 * struct ttm_backend
103 *
104 * @bdev: Pointer to a struct ttm_bo_device.
105 * @flags: For driver use.
106 * @func: Pointer to a struct ttm_backend_func that describes
107 * the backend methods.
108 *
109 */
110
111struct ttm_backend {
112 struct ttm_bo_device *bdev;
113 uint32_t flags;
114 struct ttm_backend_func *func;
115};
116
117#define TTM_PAGE_FLAG_VMALLOC (1 << 0)
118#define TTM_PAGE_FLAG_USER (1 << 1)
119#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
120#define TTM_PAGE_FLAG_WRITE (1 << 3)
121#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
122#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
123#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
124
125enum ttm_caching_state {
126 tt_uncached,
127 tt_wc,
128 tt_cached
129};
130
131/**
132 * struct ttm_tt
133 *
134 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
135 * pointer.
136 * @pages: Array of pages backing the data.
137 * @first_himem_page: Himem pages are put last in the page array, which
138 * enables us to run caching attribute changes on only the first part
139 * of the page array containing lomem pages. This is the index of the
140 * first himem page.
141 * @last_lomem_page: Index of the last lomem page in the page array.
142 * @num_pages: Number of pages in the page array.
143 * @bdev: Pointer to the current struct ttm_bo_device.
144 * @be: Pointer to the ttm backend.
145 * @tsk: The task for user ttm.
146 * @start: virtual address for user ttm.
147 * @swap_storage: Pointer to shmem struct file for swap storage.
148 * @caching_state: The current caching state of the pages.
149 * @state: The current binding state of the pages.
150 *
151 * This is a structure holding the pages, caching- and aperture binding
152 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
153 * memory.
154 */
155
156struct ttm_tt {
157 struct page *dummy_read_page;
158 struct page **pages;
159 long first_himem_page;
160 long last_lomem_page;
161 uint32_t page_flags;
162 unsigned long num_pages;
163 struct ttm_bo_device *bdev;
164 struct ttm_backend *be;
165 struct task_struct *tsk;
166 unsigned long start;
167 struct file *swap_storage;
168 enum ttm_caching_state caching_state;
169 enum {
170 tt_bound,
171 tt_unbound,
172 tt_unpopulated,
173 } state;
174};
175
176#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
177#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
178#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
179 before kernel access. */
180#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
181
182/**
183 * struct ttm_mem_type_manager
184 *
185 * @has_type: The memory type has been initialized.
186 * @use_type: The memory type is enabled.
187 * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
188 * managed by this memory type.
189 * @gpu_offset: If used, the GPU offset of the first managed page of
190 * fixed memory or the first managed location in an aperture.
191 * @io_offset: The io_offset of the first managed page of IO memory or
192 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
193 * memory, this should be set to NULL.
194 * @io_size: The size of a managed IO region (fixed memory or aperture).
195 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
196 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
197 * @io_addr should be set to NULL.
198 * @size: Size of the managed region.
199 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
200 * as defined in ttm_placement_common.h
201 * @default_caching: The default caching policy used for a buffer object
202 * placed in this memory type if the user doesn't provide one.
203 * @manager: The range manager used for this memory type. FIXME: If the aperture
204 * has a page size different from the underlying system, the granularity
205 * of this manager should take care of this. But the range allocating code
206 * in ttm_bo.c needs to be modified for this.
207 * @lru: The lru list for this memory type.
208 *
209 * This structure is used to identify and manage memory types for a device.
210 * It's set up by the ttm_bo_driver::init_mem_type method.
211 */
212
213struct ttm_mem_type_manager {
214
215 /*
216 * No protection. Constant from start.
217 */
218
219 bool has_type;
220 bool use_type;
221 uint32_t flags;
222 unsigned long gpu_offset;
223 unsigned long io_offset;
224 unsigned long io_size;
225 void *io_addr;
226 uint64_t size;
227 uint32_t available_caching;
228 uint32_t default_caching;
229
230 /*
231 * Protected by the bdev->lru_lock.
232 * TODO: Consider one lru_lock per ttm_mem_type_manager.
233 * Plays ill with list removal, though.
234 */
235
236 struct drm_mm manager;
237 struct list_head lru;
238};
239
240/**
241 * struct ttm_bo_driver
242 *
243 * @mem_type_prio: Priority array of memory types to place a buffer object in
244 * if it fits without evicting buffers from any of these memory types.
245 * @mem_busy_prio: Priority array of memory types to place a buffer object in
246 * if it needs to evict buffers to make room.
247 * @num_mem_type_prio: Number of elements in the @mem_type_prio array.
248 * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array.
249 * @create_ttm_backend_entry: Callback to create a struct ttm_backend.
250 * @invalidate_caches: Callback to invalidate read caches when a buffer object
251 * has been evicted.
252 * @init_mem_type: Callback to initialize a struct ttm_mem_type_manager
253 * structure.
254 * @evict_flags: Callback to obtain placement flags when a buffer is evicted.
255 * @move: Callback for a driver to hook in accelerated functions to
256 * move a buffer.
257 * If set to NULL, a potentially slow memcpy() move is used.
258 * @sync_obj_signaled: See ttm_fence_api.h
259 * @sync_obj_wait: See ttm_fence_api.h
260 * @sync_obj_flush: See ttm_fence_api.h
261 * @sync_obj_unref: See ttm_fence_api.h
262 * @sync_obj_ref: See ttm_fence_api.h
263 */
264
265struct ttm_bo_driver {
266 const uint32_t *mem_type_prio;
267 const uint32_t *mem_busy_prio;
268 uint32_t num_mem_type_prio;
269 uint32_t num_mem_busy_prio;
270
271 /**
272 * struct ttm_bo_driver member create_ttm_backend_entry
273 *
274 * @bdev: The buffer object device.
275 *
276 * Create a driver specific struct ttm_backend.
277 */
278
279 struct ttm_backend *(*create_ttm_backend_entry)
280 (struct ttm_bo_device *bdev);
281
282 /**
283 * struct ttm_bo_driver member invalidate_caches
284 *
285 * @bdev: the buffer object device.
286 * @flags: new placement of the rebound buffer object.
287 *
288 * A previosly evicted buffer has been rebound in a
289 * potentially new location. Tell the driver that it might
290 * consider invalidating read (texture) caches on the next command
291 * submission as a consequence.
292 */
293
294 int (*invalidate_caches) (struct ttm_bo_device *bdev, uint32_t flags);
295 int (*init_mem_type) (struct ttm_bo_device *bdev, uint32_t type,
296 struct ttm_mem_type_manager *man);
297 /**
298 * struct ttm_bo_driver member evict_flags:
299 *
300 * @bo: the buffer object to be evicted
301 *
302 * Return the bo flags for a buffer which is not mapped to the hardware.
303 * These will be placed in proposed_flags so that when the move is
304 * finished, they'll end up in bo->mem.flags
305 */
306
307 uint32_t(*evict_flags) (struct ttm_buffer_object *bo);
308 /**
309 * struct ttm_bo_driver member move:
310 *
311 * @bo: the buffer to move
312 * @evict: whether this motion is evicting the buffer from
313 * the graphics address space
314 * @interruptible: Use interruptible sleeps if possible when sleeping.
315 * @no_wait: whether this should give up and return -EBUSY
316 * if this move would require sleeping
317 * @new_mem: the new memory region receiving the buffer
318 *
319 * Move a buffer between two memory regions.
320 */
321 int (*move) (struct ttm_buffer_object *bo,
322 bool evict, bool interruptible,
323 bool no_wait, struct ttm_mem_reg *new_mem);
324
325 /**
326 * struct ttm_bo_driver_member verify_access
327 *
328 * @bo: Pointer to a buffer object.
329 * @filp: Pointer to a struct file trying to access the object.
330 *
331 * Called from the map / write / read methods to verify that the
332 * caller is permitted to access the buffer object.
333 * This member may be set to NULL, which will refuse this kind of
334 * access for all buffer objects.
335 * This function should return 0 if access is granted, -EPERM otherwise.
336 */
337 int (*verify_access) (struct ttm_buffer_object *bo,
338 struct file *filp);
339
340 /**
341 * In case a driver writer dislikes the TTM fence objects,
342 * the driver writer can replace those with sync objects of
343 * his / her own. If it turns out that no driver writer is
344 * using these. I suggest we remove these hooks and plug in
345 * fences directly. The bo driver needs the following functionality:
346 * See the corresponding functions in the fence object API
347 * documentation.
348 */
349
350 bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg);
351 int (*sync_obj_wait) (void *sync_obj, void *sync_arg,
352 bool lazy, bool interruptible);
353 int (*sync_obj_flush) (void *sync_obj, void *sync_arg);
354 void (*sync_obj_unref) (void **sync_obj);
355 void *(*sync_obj_ref) (void *sync_obj);
356};
357
358#define TTM_NUM_MEM_TYPES 8
359
360#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
361 idling before CPU mapping */
362#define TTM_BO_PRIV_FLAG_MAX 1
363/**
364 * struct ttm_bo_device - Buffer object driver device-specific data.
365 *
366 * @mem_glob: Pointer to a struct ttm_mem_global object for accounting.
367 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
368 * @count: Current number of buffer object.
369 * @pages: Current number of pinned pages.
370 * @dummy_read_page: Pointer to a dummy page used for mapping requests
371 * of unpopulated pages.
372 * @shrink: A shrink callback object used for buffre object swap.
373 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
374 * used by a buffer object. This is excluding page arrays and backing pages.
375 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
376 * @man: An array of mem_type_managers.
377 * @addr_space_mm: Range manager for the device address space.
378 * lru_lock: Spinlock that protects the buffer+device lru lists and
379 * ddestroy lists.
380 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
381 * If a GPU lockup has been detected, this is forced to 0.
382 * @dev_mapping: A pointer to the struct address_space representing the
383 * device address space.
384 * @wq: Work queue structure for the delayed delete workqueue.
385 *
386 */
387
388struct ttm_bo_device {
389
390 /*
391 * Constant after bo device init / atomic.
392 */
393
394 struct ttm_mem_global *mem_glob;
395 struct ttm_bo_driver *driver;
396 struct page *dummy_read_page;
397 struct ttm_mem_shrink shrink;
398
399 size_t ttm_bo_extra_size;
400 size_t ttm_bo_size;
401
402 rwlock_t vm_lock;
403 /*
404 * Protected by the vm lock.
405 */
406 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
407 struct rb_root addr_space_rb;
408 struct drm_mm addr_space_mm;
409
410 /*
411 * Might want to change this to one lock per manager.
412 */
413 spinlock_t lru_lock;
414 /*
415 * Protected by the lru lock.
416 */
417 struct list_head ddestroy;
418 struct list_head swap_lru;
419
420 /*
421 * Protected by load / firstopen / lastclose /unload sync.
422 */
423
424 bool nice_mode;
425 struct address_space *dev_mapping;
426
427 /*
428 * Internal protection.
429 */
430
431 struct delayed_work wq;
432};
433
434/**
435 * ttm_flag_masked
436 *
437 * @old: Pointer to the result and original value.
438 * @new: New value of bits.
439 * @mask: Mask of bits to change.
440 *
441 * Convenience function to change a number of bits identified by a mask.
442 */
443
444static inline uint32_t
445ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
446{
447 *old ^= (*old ^ new) & mask;
448 return *old;
449}
450
451/**
452 * ttm_tt_create
453 *
454 * @bdev: pointer to a struct ttm_bo_device:
455 * @size: Size of the data needed backing.
456 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
457 * @dummy_read_page: See struct ttm_bo_device.
458 *
459 * Create a struct ttm_tt to back data with system memory pages.
460 * No pages are actually allocated.
461 * Returns:
462 * NULL: Out of memory.
463 */
464extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev,
465 unsigned long size,
466 uint32_t page_flags,
467 struct page *dummy_read_page);
468
469/**
470 * ttm_tt_set_user:
471 *
472 * @ttm: The struct ttm_tt to populate.
473 * @tsk: A struct task_struct for which @start is a valid user-space address.
474 * @start: A valid user-space address.
475 * @num_pages: Size in pages of the user memory area.
476 *
477 * Populate a struct ttm_tt with a user-space memory area after first pinning
478 * the pages backing it.
479 * Returns:
480 * !0: Error.
481 */
482
483extern int ttm_tt_set_user(struct ttm_tt *ttm,
484 struct task_struct *tsk,
485 unsigned long start, unsigned long num_pages);
486
487/**
488 * ttm_ttm_bind:
489 *
490 * @ttm: The struct ttm_tt containing backing pages.
491 * @bo_mem: The struct ttm_mem_reg identifying the binding location.
492 *
493 * Bind the pages of @ttm to an aperture location identified by @bo_mem
494 */
495extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
496
497/**
498 * ttm_ttm_destroy:
499 *
500 * @ttm: The struct ttm_tt.
501 *
502 * Unbind, unpopulate and destroy a struct ttm_tt.
503 */
504extern void ttm_tt_destroy(struct ttm_tt *ttm);
505
506/**
507 * ttm_ttm_unbind:
508 *
509 * @ttm: The struct ttm_tt.
510 *
511 * Unbind a struct ttm_tt.
512 */
513extern void ttm_tt_unbind(struct ttm_tt *ttm);
514
515/**
516 * ttm_ttm_destroy:
517 *
518 * @ttm: The struct ttm_tt.
519 * @index: Index of the desired page.
520 *
521 * Return a pointer to the struct page backing @ttm at page
522 * index @index. If the page is unpopulated, one will be allocated to
523 * populate that index.
524 *
525 * Returns:
526 * NULL on OOM.
527 */
528extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index);
529
530/**
531 * ttm_tt_cache_flush:
532 *
533 * @pages: An array of pointers to struct page:s to flush.
534 * @num_pages: Number of pages to flush.
535 *
536 * Flush the data of the indicated pages from the cpu caches.
537 * This is used when changing caching attributes of the pages from
538 * cache-coherent.
539 */
540extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
541
542/**
543 * ttm_tt_set_placement_caching:
544 *
545 * @ttm A struct ttm_tt the backing pages of which will change caching policy.
546 * @placement: Flag indicating the desired caching policy.
547 *
548 * This function will change caching policy of any default kernel mappings of
549 * the pages backing @ttm. If changing from cached to uncached or
550 * write-combined,
551 * all CPU caches will first be flushed to make sure the data of the pages
552 * hit RAM. This function may be very costly as it involves global TLB
553 * and cache flushes and potential page splitting / combining.
554 */
555extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
556extern int ttm_tt_swapout(struct ttm_tt *ttm,
557 struct file *persistant_swap_storage);
558
559/*
560 * ttm_bo.c
561 */
562
563/**
564 * ttm_mem_reg_is_pci
565 *
566 * @bdev: Pointer to a struct ttm_bo_device.
567 * @mem: A valid struct ttm_mem_reg.
568 *
569 * Returns true if the memory described by @mem is PCI memory,
570 * false otherwise.
571 */
572extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
573 struct ttm_mem_reg *mem);
574
575/**
576 * ttm_bo_mem_space
577 *
578 * @bo: Pointer to a struct ttm_buffer_object. the data of which
579 * we want to allocate space for.
580 * @proposed_placement: Proposed new placement for the buffer object.
581 * @mem: A struct ttm_mem_reg.
582 * @interruptible: Sleep interruptible when sliping.
583 * @no_wait: Don't sleep waiting for space to become available.
584 *
585 * Allocate memory space for the buffer object pointed to by @bo, using
586 * the placement flags in @mem, potentially evicting other idle buffer objects.
587 * This function may sleep while waiting for space to become available.
588 * Returns:
589 * -EBUSY: No space available (only if no_wait == 1).
590 * -ENOMEM: Could not allocate memory for the buffer object, either due to
591 * fragmentation or concurrent allocators.
592 * -ERESTART: An interruptible sleep was interrupted by a signal.
593 */
594extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
595 uint32_t proposed_placement,
596 struct ttm_mem_reg *mem,
597 bool interruptible, bool no_wait);
598/**
599 * ttm_bo_wait_for_cpu
600 *
601 * @bo: Pointer to a struct ttm_buffer_object.
602 * @no_wait: Don't sleep while waiting.
603 *
604 * Wait until a buffer object is no longer sync'ed for CPU access.
605 * Returns:
606 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
607 * -ERESTART: An interruptible sleep was interrupted by a signal.
608 */
609
610extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
611
612/**
613 * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory.
614 *
615 * @bo Pointer to a struct ttm_buffer_object.
616 * @bus_base On return the base of the PCI region
617 * @bus_offset On return the byte offset into the PCI region
618 * @bus_size On return the byte size of the buffer object or zero if
619 * the buffer object memory is not accessible through a PCI region.
620 *
621 * Returns:
622 * -EINVAL if the buffer object is currently not mappable.
623 * 0 otherwise.
624 */
625
626extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
627 struct ttm_mem_reg *mem,
628 unsigned long *bus_base,
629 unsigned long *bus_offset,
630 unsigned long *bus_size);
631
632extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
633
634/**
635 * ttm_bo_device_init
636 *
637 * @bdev: A pointer to a struct ttm_bo_device to initialize.
638 * @mem_global: A pointer to an initialized struct ttm_mem_global.
639 * @driver: A pointer to a struct ttm_bo_driver set up by the caller.
640 * @file_page_offset: Offset into the device address space that is available
641 * for buffer data. This ensures compatibility with other users of the
642 * address space.
643 *
644 * Initializes a struct ttm_bo_device:
645 * Returns:
646 * !0: Failure.
647 */
648extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
649 struct ttm_mem_global *mem_glob,
650 struct ttm_bo_driver *driver,
651 uint64_t file_page_offset);
652
653/**
654 * ttm_bo_reserve:
655 *
656 * @bo: A pointer to a struct ttm_buffer_object.
657 * @interruptible: Sleep interruptible if waiting.
658 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
659 * @use_sequence: If @bo is already reserved, Only sleep waiting for
660 * it to become unreserved if @sequence < (@bo)->sequence.
661 *
662 * Locks a buffer object for validation. (Or prevents other processes from
663 * locking it for validation) and removes it from lru lists, while taking
664 * a number of measures to prevent deadlocks.
665 *
666 * Deadlocks may occur when two processes try to reserve multiple buffers in
667 * different order, either by will or as a result of a buffer being evicted
668 * to make room for a buffer already reserved. (Buffers are reserved before
669 * they are evicted). The following algorithm prevents such deadlocks from
670 * occuring:
671 * 1) Buffers are reserved with the lru spinlock held. Upon successful
672 * reservation they are removed from the lru list. This stops a reserved buffer
673 * from being evicted. However the lru spinlock is released between the time
674 * a buffer is selected for eviction and the time it is reserved.
675 * Therefore a check is made when a buffer is reserved for eviction, that it
676 * is still the first buffer in the lru list, before it is removed from the
677 * list. @check_lru == 1 forces this check. If it fails, the function returns
678 * -EINVAL, and the caller should then choose a new buffer to evict and repeat
679 * the procedure.
680 * 2) Processes attempting to reserve multiple buffers other than for eviction,
681 * (typically execbuf), should first obtain a unique 32-bit
682 * validation sequence number,
683 * and call this function with @use_sequence == 1 and @sequence == the unique
684 * sequence number. If upon call of this function, the buffer object is already
685 * reserved, the validation sequence is checked against the validation
686 * sequence of the process currently reserving the buffer,
687 * and if the current validation sequence is greater than that of the process
688 * holding the reservation, the function returns -EAGAIN. Otherwise it sleeps
689 * waiting for the buffer to become unreserved, after which it retries
690 * reserving.
691 * The caller should, when receiving an -EAGAIN error
692 * release all its buffer reservations, wait for @bo to become unreserved, and
693 * then rerun the validation with the same validation sequence. This procedure
694 * will always guarantee that the process with the lowest validation sequence
695 * will eventually succeed, preventing both deadlocks and starvation.
696 *
697 * Returns:
698 * -EAGAIN: The reservation may cause a deadlock.
699 * Release all buffer reservations, wait for @bo to become unreserved and
700 * try again. (only if use_sequence == 1).
701 * -ERESTART: A wait for the buffer to become unreserved was interrupted by
702 * a signal. Release all buffer reservations and return to user-space.
703 */
704extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
705 bool interruptible,
706 bool no_wait, bool use_sequence, uint32_t sequence);
707
708/**
709 * ttm_bo_unreserve
710 *
711 * @bo: A pointer to a struct ttm_buffer_object.
712 *
713 * Unreserve a previous reservation of @bo.
714 */
715extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
716
717/**
718 * ttm_bo_wait_unreserved
719 *
720 * @bo: A pointer to a struct ttm_buffer_object.
721 *
722 * Wait for a struct ttm_buffer_object to become unreserved.
723 * This is typically used in the execbuf code to relax cpu-usage when
724 * a potential deadlock condition backoff.
725 */
726extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
727 bool interruptible);
728
729/**
730 * ttm_bo_block_reservation
731 *
732 * @bo: A pointer to a struct ttm_buffer_object.
733 * @interruptible: Use interruptible sleep when waiting.
734 * @no_wait: Don't sleep, but rather return -EBUSY.
735 *
736 * Block reservation for validation by simply reserving the buffer.
737 * This is intended for single buffer use only without eviction,
738 * and thus needs no deadlock protection.
739 *
740 * Returns:
741 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
742 * -ERESTART: If interruptible == 1 and the process received a signal
743 * while sleeping.
744 */
745extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
746 bool interruptible, bool no_wait);
747
748/**
749 * ttm_bo_unblock_reservation
750 *
751 * @bo: A pointer to a struct ttm_buffer_object.
752 *
753 * Unblocks reservation leaving lru lists untouched.
754 */
755extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
756
757/*
758 * ttm_bo_util.c
759 */
760
761/**
762 * ttm_bo_move_ttm
763 *
764 * @bo: A pointer to a struct ttm_buffer_object.
765 * @evict: 1: This is an eviction. Don't try to pipeline.
766 * @no_wait: Never sleep, but rather return with -EBUSY.
767 * @new_mem: struct ttm_mem_reg indicating where to move.
768 *
769 * Optimized move function for a buffer object with both old and
770 * new placement backed by a TTM. The function will, if successful,
771 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
772 * and update the (@bo)->mem placement flags. If unsuccessful, the old
773 * data remains untouched, and it's up to the caller to free the
774 * memory space indicated by @new_mem.
775 * Returns:
776 * !0: Failure.
777 */
778
779extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
780 bool evict, bool no_wait,
781 struct ttm_mem_reg *new_mem);
782
783/**
784 * ttm_bo_move_memcpy
785 *
786 * @bo: A pointer to a struct ttm_buffer_object.
787 * @evict: 1: This is an eviction. Don't try to pipeline.
788 * @no_wait: Never sleep, but rather return with -EBUSY.
789 * @new_mem: struct ttm_mem_reg indicating where to move.
790 *
791 * Fallback move function for a mappable buffer object in mappable memory.
792 * The function will, if successful,
793 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
794 * and update the (@bo)->mem placement flags. If unsuccessful, the old
795 * data remains untouched, and it's up to the caller to free the
796 * memory space indicated by @new_mem.
797 * Returns:
798 * !0: Failure.
799 */
800
801extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
802 bool evict,
803 bool no_wait, struct ttm_mem_reg *new_mem);
804
805/**
806 * ttm_bo_free_old_node
807 *
808 * @bo: A pointer to a struct ttm_buffer_object.
809 *
810 * Utility function to free an old placement after a successful move.
811 */
812extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
813
814/**
815 * ttm_bo_move_accel_cleanup.
816 *
817 * @bo: A pointer to a struct ttm_buffer_object.
818 * @sync_obj: A sync object that signals when moving is complete.
819 * @sync_obj_arg: An argument to pass to the sync object idle / wait
820 * functions.
821 * @evict: This is an evict move. Don't return until the buffer is idle.
822 * @no_wait: Never sleep, but rather return with -EBUSY.
823 * @new_mem: struct ttm_mem_reg indicating where to move.
824 *
825 * Accelerated move function to be called when an accelerated move
826 * has been scheduled. The function will create a new temporary buffer object
827 * representing the old placement, and put the sync object on both buffer
828 * objects. After that the newly created buffer object is unref'd to be
829 * destroyed when the move is complete. This will help pipeline
830 * buffer moves.
831 */
832
833extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
834 void *sync_obj,
835 void *sync_obj_arg,
836 bool evict, bool no_wait,
837 struct ttm_mem_reg *new_mem);
838/**
839 * ttm_io_prot
840 *
841 * @c_state: Caching state.
842 * @tmp: Page protection flag for a normal, cached mapping.
843 *
844 * Utility function that returns the pgprot_t that should be used for
845 * setting up a PTE with the caching model indicated by @c_state.
846 */
847extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp);
848
849#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
850#define TTM_HAS_AGP
851#include <linux/agp_backend.h>
852
853/**
854 * ttm_agp_backend_init
855 *
856 * @bdev: Pointer to a struct ttm_bo_device.
857 * @bridge: The agp bridge this device is sitting on.
858 *
859 * Create a TTM backend that uses the indicated AGP bridge as an aperture
860 * for TT memory. This function uses the linux agpgart interface to
861 * bind and unbind memory backing a ttm_tt.
862 */
863extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev,
864 struct agp_bridge_data *bridge);
865#endif
866
867#endif
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
new file mode 100644
index 000000000000..d8b8f042c4f1
--- /dev/null
+++ b/include/drm/ttm/ttm_memory.h
@@ -0,0 +1,153 @@
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#ifndef TTM_MEMORY_H
29#define TTM_MEMORY_H
30
31#include <linux/workqueue.h>
32#include <linux/spinlock.h>
33#include <linux/wait.h>
34#include <linux/errno.h>
35
36/**
37 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
38 *
39 * @do_shrink: The callback function.
40 *
41 * Arguments to the do_shrink functions are intended to be passed using
42 * inheritance. That is, the argument class derives from struct ttm_mem_srink,
43 * and can be accessed using container_of().
44 */
45
46struct ttm_mem_shrink {
47 int (*do_shrink) (struct ttm_mem_shrink *);
48};
49
50/**
51 * struct ttm_mem_global - Global memory accounting structure.
52 *
53 * @shrink: A single callback to shrink TTM memory usage. Extend this
54 * to a linked list to be able to handle multiple callbacks when needed.
55 * @swap_queue: A workqueue to handle shrinking in low memory situations. We
56 * need a separate workqueue since it will spend a lot of time waiting
57 * for the GPU, and this will otherwise block other workqueue tasks(?)
58 * At this point we use only a single-threaded workqueue.
59 * @work: The workqueue callback for the shrink queue.
60 * @queue: Wait queue for processes suspended waiting for memory.
61 * @lock: Lock to protect the @shrink - and the memory accounting members,
62 * that is, essentially the whole structure with some exceptions.
63 * @emer_memory: Lowmem memory limit available for root.
64 * @max_memory: Lowmem memory limit available for non-root.
65 * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in.
66 * @used_memory: Currently used lowmem memory.
67 * @used_total_memory: Currently used total (lowmem + highmem) memory.
68 * @total_memory_swap_limit: Total memory limit where the shrink workqueue
69 * kicks in.
70 * @max_total_memory: Total memory available to non-root processes.
71 * @emer_total_memory: Total memory available to root processes.
72 *
73 * Note that this structure is not per device. It should be global for all
74 * graphics devices.
75 */
76
77struct ttm_mem_global {
78 struct ttm_mem_shrink *shrink;
79 struct workqueue_struct *swap_queue;
80 struct work_struct work;
81 wait_queue_head_t queue;
82 spinlock_t lock;
83 uint64_t emer_memory;
84 uint64_t max_memory;
85 uint64_t swap_limit;
86 uint64_t used_memory;
87 uint64_t used_total_memory;
88 uint64_t total_memory_swap_limit;
89 uint64_t max_total_memory;
90 uint64_t emer_total_memory;
91};
92
93/**
94 * ttm_mem_init_shrink - initialize a struct ttm_mem_shrink object
95 *
96 * @shrink: The object to initialize.
97 * @func: The callback function.
98 */
99
100static inline void ttm_mem_init_shrink(struct ttm_mem_shrink *shrink,
101 int (*func) (struct ttm_mem_shrink *))
102{
103 shrink->do_shrink = func;
104}
105
106/**
107 * ttm_mem_register_shrink - register a struct ttm_mem_shrink object.
108 *
109 * @glob: The struct ttm_mem_global object to register with.
110 * @shrink: An initialized struct ttm_mem_shrink object to register.
111 *
112 * Returns:
113 * -EBUSY: There's already a callback registered. (May change).
114 */
115
116static inline int ttm_mem_register_shrink(struct ttm_mem_global *glob,
117 struct ttm_mem_shrink *shrink)
118{
119 spin_lock(&glob->lock);
120 if (glob->shrink != NULL) {
121 spin_unlock(&glob->lock);
122 return -EBUSY;
123 }
124 glob->shrink = shrink;
125 spin_unlock(&glob->lock);
126 return 0;
127}
128
129/**
130 * ttm_mem_unregister_shrink - unregister a struct ttm_mem_shrink object.
131 *
132 * @glob: The struct ttm_mem_global object to unregister from.
133 * @shrink: A previously registert struct ttm_mem_shrink object.
134 *
135 */
136
137static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
138 struct ttm_mem_shrink *shrink)
139{
140 spin_lock(&glob->lock);
141 BUG_ON(glob->shrink != shrink);
142 glob->shrink = NULL;
143 spin_unlock(&glob->lock);
144}
145
146extern int ttm_mem_global_init(struct ttm_mem_global *glob);
147extern void ttm_mem_global_release(struct ttm_mem_global *glob);
148extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
149 bool no_wait, bool interruptible, bool himem);
150extern void ttm_mem_global_free(struct ttm_mem_global *glob,
151 uint64_t amount, bool himem);
152extern size_t ttm_round_pot(size_t size);
153#endif
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
new file mode 100644
index 000000000000..889a4c7958ae
--- /dev/null
+++ b/include/drm/ttm/ttm_module.h
@@ -0,0 +1,58 @@
1/**************************************************************************
2 *
3 * Copyright 2008-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_MODULE_H_
32#define _TTM_MODULE_H_
33
34#include <linux/kernel.h>
35
36#define TTM_PFX "[TTM]"
37
38enum ttm_global_types {
39 TTM_GLOBAL_TTM_MEM = 0,
40 TTM_GLOBAL_TTM_BO,
41 TTM_GLOBAL_TTM_OBJECT,
42 TTM_GLOBAL_NUM
43};
44
45struct ttm_global_reference {
46 enum ttm_global_types global_type;
47 size_t size;
48 void *object;
49 int (*init) (struct ttm_global_reference *);
50 void (*release) (struct ttm_global_reference *);
51};
52
53extern void ttm_global_init(void);
54extern void ttm_global_release(void);
55extern int ttm_global_item_ref(struct ttm_global_reference *ref);
56extern void ttm_global_item_unref(struct ttm_global_reference *ref);
57
58#endif /* _TTM_MODULE_H_ */
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
new file mode 100644
index 000000000000..c84ff153a564
--- /dev/null
+++ b/include/drm/ttm/ttm_placement.h
@@ -0,0 +1,92 @@
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_PLACEMENT_H_
32#define _TTM_PLACEMENT_H_
33/*
34 * Memory regions for data placement.
35 */
36
37#define TTM_PL_SYSTEM 0
38#define TTM_PL_TT 1
39#define TTM_PL_VRAM 2
40#define TTM_PL_PRIV0 3
41#define TTM_PL_PRIV1 4
42#define TTM_PL_PRIV2 5
43#define TTM_PL_PRIV3 6
44#define TTM_PL_PRIV4 7
45#define TTM_PL_PRIV5 8
46#define TTM_PL_SWAPPED 15
47
48#define TTM_PL_FLAG_SYSTEM (1 << TTM_PL_SYSTEM)
49#define TTM_PL_FLAG_TT (1 << TTM_PL_TT)
50#define TTM_PL_FLAG_VRAM (1 << TTM_PL_VRAM)
51#define TTM_PL_FLAG_PRIV0 (1 << TTM_PL_PRIV0)
52#define TTM_PL_FLAG_PRIV1 (1 << TTM_PL_PRIV1)
53#define TTM_PL_FLAG_PRIV2 (1 << TTM_PL_PRIV2)
54#define TTM_PL_FLAG_PRIV3 (1 << TTM_PL_PRIV3)
55#define TTM_PL_FLAG_PRIV4 (1 << TTM_PL_PRIV4)
56#define TTM_PL_FLAG_PRIV5 (1 << TTM_PL_PRIV5)
57#define TTM_PL_FLAG_SWAPPED (1 << TTM_PL_SWAPPED)
58#define TTM_PL_MASK_MEM 0x0000FFFF
59
60/*
61 * Other flags that affects data placement.
62 * TTM_PL_FLAG_CACHED indicates cache-coherent mappings
63 * if available.
64 * TTM_PL_FLAG_SHARED means that another application may
65 * reference the buffer.
66 * TTM_PL_FLAG_NO_EVICT means that the buffer may never
67 * be evicted to make room for other buffers.
68 */
69
70#define TTM_PL_FLAG_CACHED (1 << 16)
71#define TTM_PL_FLAG_UNCACHED (1 << 17)
72#define TTM_PL_FLAG_WC (1 << 18)
73#define TTM_PL_FLAG_SHARED (1 << 20)
74#define TTM_PL_FLAG_NO_EVICT (1 << 21)
75
76#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \
77 TTM_PL_FLAG_UNCACHED | \
78 TTM_PL_FLAG_WC)
79
80#define TTM_PL_MASK_MEMTYPE (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
81
82/*
83 * Access flags to be used for CPU- and GPU- mappings.
84 * The idea is that the TTM synchronization mechanism will
85 * allow concurrent READ access and exclusive write access.
86 * Currently GPU- and CPU accesses are exclusive.
87 */
88
89#define TTM_ACCESS_READ (1 << 0)
90#define TTM_ACCESS_WRITE (1 << 1)
91
92#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a2df7030d49d..03f22076381f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -308,6 +308,7 @@ unifdef-y += pmu.h
308unifdef-y += poll.h 308unifdef-y += poll.h
309unifdef-y += ppp_defs.h 309unifdef-y += ppp_defs.h
310unifdef-y += ppp-comp.h 310unifdef-y += ppp-comp.h
311unifdef-y += pps.h
311unifdef-y += ptrace.h 312unifdef-y += ptrace.h
312unifdef-y += quota.h 313unifdef-y += quota.h
313unifdef-y += random.h 314unifdef-y += random.h
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index ef788c2085a1..b19801f73890 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -41,8 +41,6 @@ struct adfs_discrecord {
41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) 41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
42 42
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44#include <linux/adfs_fs_i.h>
45#include <linux/adfs_fs_sb.h>
46/* 44/*
47 * Calculate the boot block checksum on an ADFS drive. Note that this will 45 * Calculate the boot block checksum on an ADFS drive. Note that this will
48 * appear to be correct if the sector contains all zeros, so also check that 46 * appear to be correct if the sector contains all zeros, so also check that
@@ -60,17 +58,6 @@ static inline int adfs_checkbblk(unsigned char *ptr)
60 58
61 return (result & 0xff) != ptr[511]; 59 return (result & 0xff) != ptr[511];
62} 60}
63
64static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
65{
66 return sb->s_fs_info;
67}
68
69static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
70{
71 return container_of(inode, struct adfs_inode_info, vfs_inode);
72}
73
74#endif 61#endif
75 62
76#endif 63#endif
diff --git a/include/linux/adfs_fs_i.h b/include/linux/adfs_fs_i.h
deleted file mode 100644
index cb543034e54f..000000000000
--- a/include/linux/adfs_fs_i.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * linux/include/linux/adfs_fs_i.h
3 *
4 * Copyright (C) 1997 Russell King
5 */
6
7#ifndef _ADFS_FS_I
8#define _ADFS_FS_I
9
10/*
11 * adfs file system inode data in memory
12 */
13struct adfs_inode_info {
14 loff_t mmu_private;
15 unsigned long parent_id; /* object id of parent */
16 __u32 loadaddr; /* RISC OS load address */
17 __u32 execaddr; /* RISC OS exec address */
18 unsigned int filetype; /* RISC OS file type */
19 unsigned int attr; /* RISC OS permissions */
20 unsigned int stamped:1; /* RISC OS file has date/time */
21 struct inode vfs_inode;
22};
23
24#endif
diff --git a/include/linux/adfs_fs_sb.h b/include/linux/adfs_fs_sb.h
deleted file mode 100644
index d9bf05c02ccc..000000000000
--- a/include/linux/adfs_fs_sb.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * linux/include/linux/adfs_fs_sb.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 */
6
7#ifndef _ADFS_FS_SB
8#define _ADFS_FS_SB
9
10/*
11 * Forward-declare this
12 */
13struct adfs_discmap;
14struct adfs_dir_ops;
15
16/*
17 * ADFS file system superblock data in memory
18 */
19struct adfs_sb_info {
20 struct adfs_discmap *s_map; /* bh list containing map */
21 struct adfs_dir_ops *s_dir; /* directory operations */
22
23 uid_t s_uid; /* owner uid */
24 gid_t s_gid; /* owner gid */
25 umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
26 umode_t s_other_mask; /* ADFS other perm -> unix perm */
27
28 __u32 s_ids_per_zone; /* max. no ids in one zone */
29 __u32 s_idlen; /* length of ID in map */
30 __u32 s_map_size; /* sector size of a map */
31 unsigned long s_size; /* total size (in blocks) of this fs */
32 signed int s_map2blk; /* shift left by this for map->sector */
33 unsigned int s_log2sharesize;/* log2 share size */
34 __le32 s_version; /* disc format version */
35 unsigned int s_namelen; /* maximum number of characters in name */
36};
37
38#endif
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 12737be58601..2a04eb54c0dd 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
590 bl->head = bl2->head; 590 bl->head = bl2->head;
591} 591}
592 592
593static inline struct bio *bio_list_peek(struct bio_list *bl)
594{
595 return bl->head;
596}
597
593static inline struct bio *bio_list_pop(struct bio_list *bl) 598static inline struct bio *bio_list_pop(struct bio_list *bl)
594{ 599{
595 struct bio *bio = bl->head; 600 struct bio *bio = bl->head;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0b1a6cae9de1..8963d9149b5f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -926,6 +926,7 @@ extern void blk_queue_alignment_offset(struct request_queue *q,
926 unsigned int alignment); 926 unsigned int alignment);
927extern void blk_queue_io_min(struct request_queue *q, unsigned int min); 927extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
928extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 928extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
929extern void blk_set_default_limits(struct queue_limits *lim);
929extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 930extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
930 sector_t offset); 931 sector_t offset);
931extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, 932extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 54398d2c6d8d..d276b5510c83 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_BUG_H 1#ifndef _LINUX_BUG_H
2#define _LINUX_BUG_H 2#define _LINUX_BUG_H
3 3
4#include <linux/module.h>
5#include <asm/bug.h> 4#include <asm/bug.h>
6 5
7enum bug_trap_type { 6enum bug_trap_type {
@@ -24,10 +23,6 @@ const struct bug_entry *find_bug(unsigned long bugaddr);
24 23
25enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); 24enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
26 25
27int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
28 struct module *);
29void module_bug_cleanup(struct module *);
30
31/* These are defined by the architecture */ 26/* These are defined by the architecture */
32int is_valid_bugaddr(unsigned long addr); 27int is_valid_bugaddr(unsigned long addr);
33 28
@@ -38,13 +33,6 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
38{ 33{
39 return BUG_TRAP_TYPE_BUG; 34 return BUG_TRAP_TYPE_BUG;
40} 35}
41static inline int module_bug_finalize(const Elf_Ehdr *hdr,
42 const Elf_Shdr *sechdrs,
43 struct module *mod)
44{
45 return 0;
46}
47static inline void module_bug_cleanup(struct module *mod) {}
48 36
49#endif /* CONFIG_GENERIC_BUG */ 37#endif /* CONFIG_GENERIC_BUG */
50#endif /* _LINUX_BUG_H */ 38#endif /* _LINUX_BUG_H */
diff --git a/include/linux/c2port.h b/include/linux/c2port.h
index 7b5a2388ba67..2a5cd867c365 100644
--- a/include/linux/c2port.h
+++ b/include/linux/c2port.h
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/kmemcheck.h>
13 14
14#define C2PORT_NAME_LEN 32 15#define C2PORT_NAME_LEN 32
15 16
@@ -20,8 +21,10 @@
20/* Main struct */ 21/* Main struct */
21struct c2port_ops; 22struct c2port_ops;
22struct c2port_device { 23struct c2port_device {
24 kmemcheck_bitfield_begin(flags);
23 unsigned int access:1; 25 unsigned int access:1;
24 unsigned int flash_access:1; 26 unsigned int flash_access:1;
27 kmemcheck_bitfield_end(flags);
25 28
26 int id; 29 int id;
27 char name[C2PORT_NAME_LEN]; 30 char name[C2PORT_NAME_LEN];
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 3a1dbba4d3ae..20a100fe2b4f 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -143,3 +143,12 @@ extern void clockevents_notify(unsigned long reason, void *arg);
143#endif 143#endif
144 144
145#endif 145#endif
146
147#ifdef CONFIG_GENERIC_CLOCKEVENTS
148extern ktime_t clockevents_get_next_event(int cpu);
149#else
150static inline ktime_t clockevents_get_next_event(int cpu)
151{
152 return (ktime_t) { .tv64 = KTIME_MAX };
153}
154#endif
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 8005effc04f1..b721129e0469 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -16,6 +16,12 @@
16#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
17#endif 17#endif
18 18
19#ifdef CONFIG_GCOV_KERNEL
20# if __GNUC_MINOR__ < 4
21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */
24
19/* 25/*
20 * A trick to suppress uninitialized variable warning without generating any 26 * A trick to suppress uninitialized variable warning without generating any
21 * code 27 * code
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 05ea1dd7d681..a5740fc4d04b 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -18,7 +18,6 @@
18 18
19extern int number_of_cpusets; /* How many cpusets are defined in system? */ 19extern int number_of_cpusets; /* How many cpusets are defined in system? */
20 20
21extern int cpuset_init_early(void);
22extern int cpuset_init(void); 21extern int cpuset_init(void);
23extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
@@ -27,7 +26,6 @@ extern void cpuset_cpus_allowed_locked(struct task_struct *p,
27extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
28#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
29void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
30void cpuset_update_task_memory_state(void);
31int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
32 30
33extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); 31extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
@@ -92,9 +90,13 @@ extern void rebuild_sched_domains(void);
92 90
93extern void cpuset_print_task_mems_allowed(struct task_struct *p); 91extern void cpuset_print_task_mems_allowed(struct task_struct *p);
94 92
93static inline void set_mems_allowed(nodemask_t nodemask)
94{
95 current->mems_allowed = nodemask;
96}
97
95#else /* !CONFIG_CPUSETS */ 98#else /* !CONFIG_CPUSETS */
96 99
97static inline int cpuset_init_early(void) { return 0; }
98static inline int cpuset_init(void) { return 0; } 100static inline int cpuset_init(void) { return 0; }
99static inline void cpuset_init_smp(void) {} 101static inline void cpuset_init_smp(void) {}
100 102
@@ -116,7 +118,6 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
116 118
117#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) 119#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
118static inline void cpuset_init_current_mems_allowed(void) {} 120static inline void cpuset_init_current_mems_allowed(void) {}
119static inline void cpuset_update_task_memory_state(void) {}
120 121
121static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) 122static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
122{ 123{
@@ -188,6 +189,10 @@ static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
188{ 189{
189} 190}
190 191
192static inline void set_mems_allowed(nodemask_t nodemask)
193{
194}
195
191#endif /* !CONFIG_CPUSETS */ 196#endif /* !CONFIG_CPUSETS */
192 197
193#endif /* _LINUX_CPUSET_H */ 198#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index a4a7b10aaa48..ed4e39f2c423 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
114#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 114#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
116 unbound */ 116 unbound */
117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound
118 from the device */
117 119
118extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
119extern struct klist *bus_get_device_klist(struct bus_type *bus); 121extern struct klist *bus_get_device_klist(struct bus_type *bus);
@@ -192,6 +194,7 @@ struct class {
192 struct kobject *dev_kobj; 194 struct kobject *dev_kobj;
193 195
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 196 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
197 char *(*nodename)(struct device *dev);
195 198
196 void (*class_release)(struct class *class); 199 void (*class_release)(struct class *class);
197 void (*dev_release)(struct device *dev); 200 void (*dev_release)(struct device *dev);
@@ -287,6 +290,7 @@ struct device_type {
287 const char *name; 290 const char *name;
288 struct attribute_group **groups; 291 struct attribute_group **groups;
289 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 292 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
293 char *(*nodename)(struct device *dev);
290 void (*release)(struct device *dev); 294 void (*release)(struct device *dev);
291 295
292 struct dev_pm_ops *pm; 296 struct dev_pm_ops *pm;
@@ -486,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data,
486extern int device_rename(struct device *dev, char *new_name); 490extern int device_rename(struct device *dev, char *new_name);
487extern int device_move(struct device *dev, struct device *new_parent, 491extern int device_move(struct device *dev, struct device *new_parent,
488 enum dpm_order dpm_order); 492 enum dpm_order dpm_order);
493extern const char *device_get_nodename(struct device *dev, const char **tmp);
489 494
490/* 495/*
491 * Root device objects for grouping under /sys/devices 496 * Root device objects for grouping under /sys/devices
diff --git a/include/linux/efi.h b/include/linux/efi.h
index bb66feb164bd..ce4581fbc08b 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -101,7 +101,7 @@ typedef struct {
101 u64 attribute; 101 u64 attribute;
102} efi_memory_desc_t; 102} efi_memory_desc_t;
103 103
104typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg); 104typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
105 105
106/* 106/*
107 * Types and defines for Time Services 107 * Types and defines for Time Services
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index e61c0be2a459..6925249a5ac6 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
78/* Mimics pci.h... */ 78/* Mimics pci.h... */
79static inline void *eisa_get_drvdata (struct eisa_device *edev) 79static inline void *eisa_get_drvdata (struct eisa_device *edev)
80{ 80{
81 return edev->dev.driver_data; 81 return dev_get_drvdata(&edev->dev);
82} 82}
83 83
84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) 84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
85{ 85{
86 edev->dev.driver_data = data; 86 dev_set_drvdata(&edev->dev, data);
87} 87}
88 88
89/* The EISA root device. There's rumours about machines with multiple 89/* The EISA root device. There's rumours about machines with multiple
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 330c4b1bfcaa..dd68358996b7 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -677,6 +677,9 @@ struct fb_ops {
677 /* get capability given var */ 677 /* get capability given var */
678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, 678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
679 struct fb_var_screeninfo *var); 679 struct fb_var_screeninfo *var);
680
681 /* teardown any resources to do with this framebuffer */
682 void (*fb_destroy)(struct fb_info *info);
680}; 683};
681 684
682#ifdef CONFIG_FB_TILEBLITTING 685#ifdef CONFIG_FB_TILEBLITTING
@@ -786,6 +789,8 @@ struct fb_tile_ops {
786#define FBINFO_MISC_USEREVENT 0x10000 /* event request 789#define FBINFO_MISC_USEREVENT 0x10000 /* event request
787 from userspace */ 790 from userspace */
788#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 791#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
792#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
793 inited framebuffer */
789 794
790/* A driver may set this flag to indicate that it does want a set_par to be 795/* A driver may set this flag to indicate that it does want a set_par to be
791 * called every time when fbcon_switch is executed. The advantage is that with 796 * called every time when fbcon_switch is executed. The advantage is that with
@@ -854,7 +859,12 @@ struct fb_info {
854 u32 state; /* Hardware state i.e suspend */ 859 u32 state; /* Hardware state i.e suspend */
855 void *fbcon_par; /* fbcon use-only private area */ 860 void *fbcon_par; /* fbcon use-only private area */
856 /* From here on everything is device dependent */ 861 /* From here on everything is device dependent */
857 void *par; 862 void *par;
863 /* we need the PCI or similiar aperture base/size not
864 smem_start/size as smem_start may just be an object
865 allocated inside the aperture so may not actually overlap */
866 resource_size_t aperture_base;
867 resource_size_t aperture_size;
858}; 868};
859 869
860#ifdef MODULE 870#ifdef MODULE
@@ -893,7 +903,7 @@ struct fb_info {
893#define fb_writeq sbus_writeq 903#define fb_writeq sbus_writeq
894#define fb_memset sbus_memset_io 904#define fb_memset sbus_memset_io
895 905
896#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) 906#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
897 907
898#define fb_readb __raw_readb 908#define fb_readb __raw_readb
899#define fb_readw __raw_readw 909#define fb_readw __raw_readw
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
new file mode 100644
index 000000000000..e584b7215e8b
--- /dev/null
+++ b/include/linux/firewire.h
@@ -0,0 +1,358 @@
1#ifndef _LINUX_FIREWIRE_H
2#define _LINUX_FIREWIRE_H
3
4#include <linux/completion.h>
5#include <linux/device.h>
6#include <linux/kernel.h>
7#include <linux/kref.h>
8#include <linux/list.h>
9#include <linux/mutex.h>
10#include <linux/spinlock.h>
11#include <linux/sysfs.h>
12#include <linux/timer.h>
13#include <linux/types.h>
14#include <linux/workqueue.h>
15
16#include <asm/atomic.h>
17#include <asm/byteorder.h>
18
19#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
20#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
21
22static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
23{
24 u32 *dst = _dst;
25 __be32 *src = _src;
26 int i;
27
28 for (i = 0; i < size / 4; i++)
29 dst[i] = be32_to_cpu(src[i]);
30}
31
32static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
33{
34 fw_memcpy_from_be32(_dst, _src, size);
35}
36#define CSR_REGISTER_BASE 0xfffff0000000ULL
37
38/* register offsets are relative to CSR_REGISTER_BASE */
39#define CSR_STATE_CLEAR 0x0
40#define CSR_STATE_SET 0x4
41#define CSR_NODE_IDS 0x8
42#define CSR_RESET_START 0xc
43#define CSR_SPLIT_TIMEOUT_HI 0x18
44#define CSR_SPLIT_TIMEOUT_LO 0x1c
45#define CSR_CYCLE_TIME 0x200
46#define CSR_BUS_TIME 0x204
47#define CSR_BUSY_TIMEOUT 0x210
48#define CSR_BUS_MANAGER_ID 0x21c
49#define CSR_BANDWIDTH_AVAILABLE 0x220
50#define CSR_CHANNELS_AVAILABLE 0x224
51#define CSR_CHANNELS_AVAILABLE_HI 0x224
52#define CSR_CHANNELS_AVAILABLE_LO 0x228
53#define CSR_BROADCAST_CHANNEL 0x234
54#define CSR_CONFIG_ROM 0x400
55#define CSR_CONFIG_ROM_END 0x800
56#define CSR_FCP_COMMAND 0xB00
57#define CSR_FCP_RESPONSE 0xD00
58#define CSR_FCP_END 0xF00
59#define CSR_TOPOLOGY_MAP 0x1000
60#define CSR_TOPOLOGY_MAP_END 0x1400
61#define CSR_SPEED_MAP 0x2000
62#define CSR_SPEED_MAP_END 0x3000
63
64#define CSR_OFFSET 0x40
65#define CSR_LEAF 0x80
66#define CSR_DIRECTORY 0xc0
67
68#define CSR_DESCRIPTOR 0x01
69#define CSR_VENDOR 0x03
70#define CSR_HARDWARE_VERSION 0x04
71#define CSR_NODE_CAPABILITIES 0x0c
72#define CSR_UNIT 0x11
73#define CSR_SPECIFIER_ID 0x12
74#define CSR_VERSION 0x13
75#define CSR_DEPENDENT_INFO 0x14
76#define CSR_MODEL 0x17
77#define CSR_INSTANCE 0x18
78#define CSR_DIRECTORY_ID 0x20
79
80struct fw_csr_iterator {
81 u32 *p;
82 u32 *end;
83};
84
85void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p);
86int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
87
88extern struct bus_type fw_bus_type;
89
90struct fw_card_driver;
91struct fw_node;
92
93struct fw_card {
94 const struct fw_card_driver *driver;
95 struct device *device;
96 struct kref kref;
97 struct completion done;
98
99 int node_id;
100 int generation;
101 int current_tlabel;
102 u64 tlabel_mask;
103 struct list_head transaction_list;
104 struct timer_list flush_timer;
105 unsigned long reset_jiffies;
106
107 unsigned long long guid;
108 unsigned max_receive;
109 int link_speed;
110 int config_rom_generation;
111
112 spinlock_t lock; /* Take this lock when handling the lists in
113 * this struct. */
114 struct fw_node *local_node;
115 struct fw_node *root_node;
116 struct fw_node *irm_node;
117 u8 color; /* must be u8 to match the definition in struct fw_node */
118 int gap_count;
119 bool beta_repeaters_present;
120
121 int index;
122
123 struct list_head link;
124
125 /* Work struct for BM duties. */
126 struct delayed_work work;
127 int bm_retries;
128 int bm_generation;
129
130 bool broadcast_channel_allocated;
131 u32 broadcast_channel;
132 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
133};
134
135static inline struct fw_card *fw_card_get(struct fw_card *card)
136{
137 kref_get(&card->kref);
138
139 return card;
140}
141
142void fw_card_release(struct kref *kref);
143
144static inline void fw_card_put(struct fw_card *card)
145{
146 kref_put(&card->kref, fw_card_release);
147}
148
149struct fw_attribute_group {
150 struct attribute_group *groups[2];
151 struct attribute_group group;
152 struct attribute *attrs[12];
153};
154
155enum fw_device_state {
156 FW_DEVICE_INITIALIZING,
157 FW_DEVICE_RUNNING,
158 FW_DEVICE_GONE,
159 FW_DEVICE_SHUTDOWN,
160};
161
162/*
163 * Note, fw_device.generation always has to be read before fw_device.node_id.
164 * Use SMP memory barriers to ensure this. Otherwise requests will be sent
165 * to an outdated node_id if the generation was updated in the meantime due
166 * to a bus reset.
167 *
168 * Likewise, fw-core will take care to update .node_id before .generation so
169 * that whenever fw_device.generation is current WRT the actual bus generation,
170 * fw_device.node_id is guaranteed to be current too.
171 *
172 * The same applies to fw_device.card->node_id vs. fw_device.generation.
173 *
174 * fw_device.config_rom and fw_device.config_rom_length may be accessed during
175 * the lifetime of any fw_unit belonging to the fw_device, before device_del()
176 * was called on the last fw_unit. Alternatively, they may be accessed while
177 * holding fw_device_rwsem.
178 */
179struct fw_device {
180 atomic_t state;
181 struct fw_node *node;
182 int node_id;
183 int generation;
184 unsigned max_speed;
185 struct fw_card *card;
186 struct device device;
187
188 struct mutex client_list_mutex;
189 struct list_head client_list;
190
191 u32 *config_rom;
192 size_t config_rom_length;
193 int config_rom_retries;
194 unsigned is_local:1;
195 unsigned max_rec:4;
196 unsigned cmc:1;
197 unsigned irmc:1;
198 unsigned bc_implemented:2;
199
200 struct delayed_work work;
201 struct fw_attribute_group attribute_group;
202};
203
204static inline struct fw_device *fw_device(struct device *dev)
205{
206 return container_of(dev, struct fw_device, device);
207}
208
209static inline int fw_device_is_shutdown(struct fw_device *device)
210{
211 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
212}
213
214static inline struct fw_device *fw_device_get(struct fw_device *device)
215{
216 get_device(&device->device);
217
218 return device;
219}
220
221static inline void fw_device_put(struct fw_device *device)
222{
223 put_device(&device->device);
224}
225
226int fw_device_enable_phys_dma(struct fw_device *device);
227
228/*
229 * fw_unit.directory must not be accessed after device_del(&fw_unit.device).
230 */
231struct fw_unit {
232 struct device device;
233 u32 *directory;
234 struct fw_attribute_group attribute_group;
235};
236
237static inline struct fw_unit *fw_unit(struct device *dev)
238{
239 return container_of(dev, struct fw_unit, device);
240}
241
242static inline struct fw_unit *fw_unit_get(struct fw_unit *unit)
243{
244 get_device(&unit->device);
245
246 return unit;
247}
248
249static inline void fw_unit_put(struct fw_unit *unit)
250{
251 put_device(&unit->device);
252}
253
254static inline struct fw_device *fw_parent_device(struct fw_unit *unit)
255{
256 return fw_device(unit->device.parent);
257}
258
259struct ieee1394_device_id;
260
261struct fw_driver {
262 struct device_driver driver;
263 /* Called when the parent device sits through a bus reset. */
264 void (*update)(struct fw_unit *unit);
265 const struct ieee1394_device_id *id_table;
266};
267
268struct fw_packet;
269struct fw_request;
270
271typedef void (*fw_packet_callback_t)(struct fw_packet *packet,
272 struct fw_card *card, int status);
273typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
274 void *data, size_t length,
275 void *callback_data);
276/*
277 * Important note: The callback must guarantee that either fw_send_response()
278 * or kfree() is called on the @request.
279 */
280typedef void (*fw_address_callback_t)(struct fw_card *card,
281 struct fw_request *request,
282 int tcode, int destination, int source,
283 int generation, int speed,
284 unsigned long long offset,
285 void *data, size_t length,
286 void *callback_data);
287
288struct fw_packet {
289 int speed;
290 int generation;
291 u32 header[4];
292 size_t header_length;
293 void *payload;
294 size_t payload_length;
295 dma_addr_t payload_bus;
296 u32 timestamp;
297
298 /*
299 * This callback is called when the packet transmission has
300 * completed; for successful transmission, the status code is
301 * the ack received from the destination, otherwise it's a
302 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
303 * The callback can be called from tasklet context and thus
304 * must never block.
305 */
306 fw_packet_callback_t callback;
307 int ack;
308 struct list_head link;
309 void *driver_data;
310};
311
312struct fw_transaction {
313 int node_id; /* The generation is implied; it is always the current. */
314 int tlabel;
315 int timestamp;
316 struct list_head link;
317
318 struct fw_packet packet;
319
320 /*
321 * The data passed to the callback is valid only during the
322 * callback.
323 */
324 fw_transaction_callback_t callback;
325 void *callback_data;
326};
327
328struct fw_address_handler {
329 u64 offset;
330 size_t length;
331 fw_address_callback_t address_callback;
332 void *callback_data;
333 struct list_head link;
334};
335
336struct fw_address_region {
337 u64 start;
338 u64 end;
339};
340
341extern const struct fw_address_region fw_high_memory_region;
342
343int fw_core_add_address_handler(struct fw_address_handler *handler,
344 const struct fw_address_region *region);
345void fw_core_remove_address_handler(struct fw_address_handler *handler);
346void fw_send_response(struct fw_card *card,
347 struct fw_request *request, int rcode);
348void fw_send_request(struct fw_card *card, struct fw_transaction *t,
349 int tcode, int destination_id, int generation, int speed,
350 unsigned long long offset, void *payload, size_t length,
351 fw_transaction_callback_t callback, void *callback_data);
352int fw_cancel_transaction(struct fw_card *card,
353 struct fw_transaction *transaction);
354int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
355 int generation, int speed, unsigned long long offset,
356 void *payload, size_t length);
357
358#endif /* _LINUX_FIREWIRE_H */
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index cca686b39123..875451f1373a 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -24,21 +24,17 @@
24 */ 24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP 25#ifdef CONFIG_FIRMWARE_MEMMAP
26 26
27int firmware_map_add(resource_size_t start, resource_size_t end, 27int firmware_map_add(u64 start, u64 end, const char *type);
28 const char *type); 28int firmware_map_add_early(u64 start, u64 end, const char *type);
29int firmware_map_add_early(resource_size_t start, resource_size_t end,
30 const char *type);
31 29
32#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
33 31
34static inline int firmware_map_add(resource_size_t start, resource_size_t end, 32static inline int firmware_map_add(u64 start, u64 end, const char *type)
35 const char *type)
36{ 33{
37 return 0; 34 return 0;
38} 35}
39 36
40static inline int firmware_map_add_early(resource_size_t start, 37static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
41 resource_size_t end, const char *type)
42{ 38{
43 return 0; 39 return 0;
44} 40}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index c8ecf5b2a207..d31544628436 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -5,7 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7 7
8#define FIRMWARE_NAME_MAX 30
9#define FW_ACTION_NOHOTPLUG 0 8#define FW_ACTION_NOHOTPLUG 0
10#define FW_ACTION_HOTPLUG 1 9#define FW_ACTION_HOTPLUG 1
11 10
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ede84fa7da5d..74a57938c880 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -879,7 +879,7 @@ struct file_ra_state {
879 there are only # of pages ahead */ 879 there are only # of pages ahead */
880 880
881 unsigned int ra_pages; /* Maximum readahead window */ 881 unsigned int ra_pages; /* Maximum readahead window */
882 int mmap_miss; /* Cache miss stat for mmap accesses */ 882 unsigned int mmap_miss; /* Cache miss stat for mmap accesses */
883 loff_t prev_pos; /* Cache last read() position */ 883 loff_t prev_pos; /* Cache last read() position */
884}; 884};
885 885
@@ -1919,8 +1919,9 @@ extern void __init vfs_caches_init(unsigned long);
1919 1919
1920extern struct kmem_cache *names_cachep; 1920extern struct kmem_cache *names_cachep;
1921 1921
1922#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) 1922#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp))
1923#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 1923#define __getname() __getname_gfp(GFP_KERNEL)
1924#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
1924#ifndef CONFIG_AUDITSYSCALL 1925#ifndef CONFIG_AUDITSYSCALL
1925#define putname(name) __putname(name) 1926#define putname(name) __putname(name)
1926#else 1927#else
@@ -2036,9 +2037,6 @@ extern int __invalidate_device(struct block_device *);
2036extern int invalidate_partition(struct gendisk *, int); 2037extern int invalidate_partition(struct gendisk *, int);
2037#endif 2038#endif
2038extern int invalidate_inodes(struct super_block *); 2039extern int invalidate_inodes(struct super_block *);
2039unsigned long __invalidate_mapping_pages(struct address_space *mapping,
2040 pgoff_t start, pgoff_t end,
2041 bool be_atomic);
2042unsigned long invalidate_mapping_pages(struct address_space *mapping, 2040unsigned long invalidate_mapping_pages(struct address_space *mapping,
2043 pgoff_t start, pgoff_t end); 2041 pgoff_t start, pgoff_t end);
2044 2042
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 244677cc082b..43fc95d822d5 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -79,10 +79,6 @@ struct fsl_spi_platform_data {
79 u16 max_chipselect; 79 u16 max_chipselect;
80 void (*cs_control)(struct spi_device *spi, bool on); 80 void (*cs_control)(struct spi_device *spi, bool on);
81 u32 sysclk; 81 u32 sysclk;
82
83 /* Legacy hooks, used by mpc52xx_psc_spi driver. */
84 void (*activate_cs)(u8 cs, u8 polarity);
85 void (*deactivate_cs)(u8 cs, u8 polarity);
86}; 82};
87 83
88struct mpc8xx_pcmcia_ops { 84struct mpc8xx_pcmcia_ops {
diff --git a/include/linux/gcd.h b/include/linux/gcd.h
new file mode 100644
index 000000000000..69f5e8a01bad
--- /dev/null
+++ b/include/linux/gcd.h
@@ -0,0 +1,8 @@
1#ifndef _GCD_H
2#define _GCD_H
3
4#include <linux/compiler.h>
5
6unsigned long gcd(unsigned long a, unsigned long b) __attribute_const__;
7
8#endif /* _GCD_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7cbd38d363a2..45fc320a53c6 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -142,7 +142,7 @@ struct gendisk {
142 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
143 143
144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145 145 char *(*nodename)(struct gendisk *gd);
146 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3760e7c5de02..7c777a0da17a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/topology.h> 7#include <linux/topology.h>
8#include <linux/mmdebug.h>
8 9
9struct vm_area_struct; 10struct vm_area_struct;
10 11
@@ -20,7 +21,8 @@ struct vm_area_struct;
20#define __GFP_DMA ((__force gfp_t)0x01u) 21#define __GFP_DMA ((__force gfp_t)0x01u)
21#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 22#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
22#define __GFP_DMA32 ((__force gfp_t)0x04u) 23#define __GFP_DMA32 ((__force gfp_t)0x04u)
23 24#define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */
25#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
24/* 26/*
25 * Action modifiers - doesn't change the zoning 27 * Action modifiers - doesn't change the zoning
26 * 28 *
@@ -50,9 +52,20 @@ struct vm_area_struct;
50#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 52#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
51#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ 53#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
52#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ 54#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */
53#define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */
54 55
55#define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */ 56#ifdef CONFIG_KMEMCHECK
57#define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */
58#else
59#define __GFP_NOTRACK ((__force gfp_t)0)
60#endif
61
62/*
63 * This may seem redundant, but it's a way of annotating false positives vs.
64 * allocations that simply cannot be supported (e.g. page tables).
65 */
66#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
67
68#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */
56#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 69#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
57 70
58/* This equals 0, but use constants in case they ever change */ 71/* This equals 0, but use constants in case they ever change */
@@ -86,7 +99,7 @@ struct vm_area_struct;
86 __GFP_NORETRY|__GFP_NOMEMALLOC) 99 __GFP_NORETRY|__GFP_NOMEMALLOC)
87 100
88/* Control slab gfp mask during early boot */ 101/* Control slab gfp mask during early boot */
89#define SLAB_GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS) 102#define GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)
90 103
91/* Control allocation constraints */ 104/* Control allocation constraints */
92#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) 105#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
@@ -115,24 +128,105 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
115 ((gfp_flags & __GFP_RECLAIMABLE) != 0); 128 ((gfp_flags & __GFP_RECLAIMABLE) != 0);
116} 129}
117 130
118static inline enum zone_type gfp_zone(gfp_t flags) 131#ifdef CONFIG_HIGHMEM
119{ 132#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
133#else
134#define OPT_ZONE_HIGHMEM ZONE_NORMAL
135#endif
136
120#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
121 if (flags & __GFP_DMA) 138#define OPT_ZONE_DMA ZONE_DMA
122 return ZONE_DMA; 139#else
140#define OPT_ZONE_DMA ZONE_NORMAL
123#endif 141#endif
142
124#ifdef CONFIG_ZONE_DMA32 143#ifdef CONFIG_ZONE_DMA32
125 if (flags & __GFP_DMA32) 144#define OPT_ZONE_DMA32 ZONE_DMA32
126 return ZONE_DMA32; 145#else
146#define OPT_ZONE_DMA32 ZONE_NORMAL
127#endif 147#endif
128 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 148
129 (__GFP_HIGHMEM | __GFP_MOVABLE)) 149/*
130 return ZONE_MOVABLE; 150 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
131#ifdef CONFIG_HIGHMEM 151 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
132 if (flags & __GFP_HIGHMEM) 152 * and there are 16 of them to cover all possible combinations of
133 return ZONE_HIGHMEM; 153 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM
154 *
155 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
156 * But GFP_MOVABLE is not only a zone specifier but also an allocation
157 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
158 * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1".
159 *
160 * bit result
161 * =================
162 * 0x0 => NORMAL
163 * 0x1 => DMA or NORMAL
164 * 0x2 => HIGHMEM or NORMAL
165 * 0x3 => BAD (DMA+HIGHMEM)
166 * 0x4 => DMA32 or DMA or NORMAL
167 * 0x5 => BAD (DMA+DMA32)
168 * 0x6 => BAD (HIGHMEM+DMA32)
169 * 0x7 => BAD (HIGHMEM+DMA32+DMA)
170 * 0x8 => NORMAL (MOVABLE+0)
171 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
172 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
173 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
174 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32)
175 * 0xd => BAD (MOVABLE+DMA32+DMA)
176 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
177 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
178 *
179 * ZONES_SHIFT must be <= 2 on 32 bit platforms.
180 */
181
182#if 16 * ZONES_SHIFT > BITS_PER_LONG
183#error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
184#endif
185
186#define GFP_ZONE_TABLE ( \
187 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
188 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
189 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
191 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
192 | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \
193 | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
194 | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
195)
196
197/*
198 * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32
199 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
200 * entry starting with bit 0. Bit is set if the combination is not
201 * allowed.
202 */
203#define GFP_ZONE_BAD ( \
204 1 << (__GFP_DMA | __GFP_HIGHMEM) \
205 | 1 << (__GFP_DMA | __GFP_DMA32) \
206 | 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \
207 | 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \
208 | 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \
209 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \
210 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \
211 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\
212)
213
214static inline enum zone_type gfp_zone(gfp_t flags)
215{
216 enum zone_type z;
217 int bit = flags & GFP_ZONEMASK;
218
219 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
220 ((1 << ZONES_SHIFT) - 1);
221
222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else {
225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
134#endif 227#endif
135 return ZONE_NORMAL; 228 }
229 return z;
136} 230}
137 231
138/* 232/*
@@ -172,30 +266,19 @@ static inline void arch_alloc_page(struct page *page, int order) { }
172#endif 266#endif
173 267
174struct page * 268struct page *
175__alloc_pages_internal(gfp_t gfp_mask, unsigned int order, 269__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
176 struct zonelist *zonelist, nodemask_t *nodemask); 270 struct zonelist *zonelist, nodemask_t *nodemask);
177 271
178static inline struct page * 272static inline struct page *
179__alloc_pages(gfp_t gfp_mask, unsigned int order, 273__alloc_pages(gfp_t gfp_mask, unsigned int order,
180 struct zonelist *zonelist) 274 struct zonelist *zonelist)
181{ 275{
182 return __alloc_pages_internal(gfp_mask, order, zonelist, NULL); 276 return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL);
183} 277}
184 278
185static inline struct page *
186__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
187 struct zonelist *zonelist, nodemask_t *nodemask)
188{
189 return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
190}
191
192
193static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 279static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
194 unsigned int order) 280 unsigned int order)
195{ 281{
196 if (unlikely(order >= MAX_ORDER))
197 return NULL;
198
199 /* Unknown node is current node */ 282 /* Unknown node is current node */
200 if (nid < 0) 283 if (nid < 0)
201 nid = numa_node_id(); 284 nid = numa_node_id();
@@ -203,15 +286,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
203 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 286 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
204} 287}
205 288
289static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
290 unsigned int order)
291{
292 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
293
294 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
295}
296
206#ifdef CONFIG_NUMA 297#ifdef CONFIG_NUMA
207extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); 298extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
208 299
209static inline struct page * 300static inline struct page *
210alloc_pages(gfp_t gfp_mask, unsigned int order) 301alloc_pages(gfp_t gfp_mask, unsigned int order)
211{ 302{
212 if (unlikely(order >= MAX_ORDER))
213 return NULL;
214
215 return alloc_pages_current(gfp_mask, order); 303 return alloc_pages_current(gfp_mask, order);
216} 304}
217extern struct page *alloc_page_vma(gfp_t gfp_mask, 305extern struct page *alloc_page_vma(gfp_t gfp_mask,
@@ -248,4 +336,23 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
248void drain_all_pages(void); 336void drain_all_pages(void);
249void drain_local_pages(void *dummy); 337void drain_local_pages(void *dummy);
250 338
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
351extern gfp_t gfp_allowed_mask;
352
353static inline void set_gfp_allowed_mask(gfp_t mask)
354{
355 gfp_allowed_mask = mask;
356}
357
251#endif /* __LINUX_GFP_H */ 358#endif /* __LINUX_GFP_H */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 1fcb7126a01f..211ff4497269 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -55,7 +55,9 @@ static inline void *kmap(struct page *page)
55 return page_address(page); 55 return page_address(page);
56} 56}
57 57
58#define kunmap(page) do { (void) (page); } while (0) 58static inline void kunmap(struct page *page)
59{
60}
59 61
60static inline void *kmap_atomic(struct page *page, enum km_type idx) 62static inline void *kmap_atomic(struct page *page, enum km_type idx)
61{ 63{
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 0d2f7c8a33d6..7400900de94a 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -30,8 +30,11 @@ struct hrtimer_cpu_base;
30 * Mode arguments of xxx_hrtimer functions: 30 * Mode arguments of xxx_hrtimer functions:
31 */ 31 */
32enum hrtimer_mode { 32enum hrtimer_mode {
33 HRTIMER_MODE_ABS, /* Time value is absolute */ 33 HRTIMER_MODE_ABS = 0x0, /* Time value is absolute */
34 HRTIMER_MODE_REL, /* Time value is relative to now */ 34 HRTIMER_MODE_REL = 0x1, /* Time value is relative to now */
35 HRTIMER_MODE_PINNED = 0x02, /* Timer is bound to CPU */
36 HRTIMER_MODE_ABS_PINNED = 0x02,
37 HRTIMER_MODE_REL_PINNED = 0x03,
35}; 38};
36 39
37/* 40/*
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 03be7f29ca01..a05a5ef33391 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -11,6 +11,8 @@
11 11
12struct ctl_table; 12struct ctl_table;
13 13
14int PageHuge(struct page *page);
15
14static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 16static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
15{ 17{
16 return vma->vm_flags & VM_HUGETLB; 18 return vma->vm_flags & VM_HUGETLB;
@@ -61,6 +63,11 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
61 63
62#else /* !CONFIG_HUGETLB_PAGE */ 64#else /* !CONFIG_HUGETLB_PAGE */
63 65
66static inline int PageHuge(struct page *page)
67{
68 return 0;
69}
70
64static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 71static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
65{ 72{
66 return 0; 73 return 0;
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 3c7361217df8..81736d6a8db7 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -15,4 +15,5 @@ struct pca953x_platform_data {
15 int (*teardown)(struct i2c_client *client, 15 int (*teardown)(struct i2c_client *client,
16 unsigned gpio, unsigned ngpio, 16 unsigned gpio, unsigned ngpio,
17 void *context); 17 void *context);
18 char **names;
18}; 19};
diff --git a/include/linux/init.h b/include/linux/init.h
index b2189803f19a..13b633ed695e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -29,7 +29,7 @@
29 * sign followed by value, e.g.: 29 * sign followed by value, e.g.:
30 * 30 *
31 * static int init_variable __initdata = 0; 31 * static int init_variable __initdata = 0;
32 * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; 32 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
33 * 33 *
34 * Don't forget to initialize data not at file scope, i.e. within a function, 34 * Don't forget to initialize data not at file scope, i.e. within a function,
35 * as gcc otherwise puts the data into the bss section and not into the init 35 * as gcc otherwise puts the data into the bss section and not into the init
@@ -134,6 +134,9 @@ typedef void (*exitcall_t)(void);
134extern initcall_t __con_initcall_start[], __con_initcall_end[]; 134extern initcall_t __con_initcall_start[], __con_initcall_end[];
135extern initcall_t __security_initcall_start[], __security_initcall_end[]; 135extern initcall_t __security_initcall_start[], __security_initcall_end[];
136 136
137/* Used for contructor calls. */
138typedef void (*ctor_fn_t)(void);
139
137/* Defined in init/main.c */ 140/* Defined in init/main.c */
138extern int do_one_initcall(initcall_t fn); 141extern int do_one_initcall(initcall_t fn);
139extern char __initdata boot_command_line[]; 142extern char __initdata boot_command_line[];
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 28b1f30601b5..5368fbdc7801 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -15,18 +15,6 @@
15extern struct files_struct init_files; 15extern struct files_struct init_files;
16extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
17 17
18#define INIT_MM(name) \
19{ \
20 .mm_rb = RB_ROOT, \
21 .pgd = swapper_pg_dir, \
22 .mm_users = ATOMIC_INIT(2), \
23 .mm_count = ATOMIC_INIT(1), \
24 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
25 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
26 .mmlist = LIST_HEAD_INIT(name.mmlist), \
27 .cpu_vm_mask = CPU_MASK_ALL, \
28}
29
30#define INIT_SIGNALS(sig) { \ 18#define INIT_SIGNALS(sig) { \
31 .count = ATOMIC_INIT(1), \ 19 .count = ATOMIC_INIT(1), \
32 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c41e812e9d5e..2721f07e9354 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -472,6 +472,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)
472 __tasklet_hi_schedule(t); 472 __tasklet_hi_schedule(t);
473} 473}
474 474
475extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
476
477/*
478 * This version avoids touching any other tasklets. Needed for kmemcheck
479 * in order not to take any page faults while enqueueing this tasklet;
480 * consider VERY carefully whether you really need this or
481 * tasklet_hi_schedule()...
482 */
483static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
484{
485 if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
486 __tasklet_hi_schedule_first(t);
487}
488
475 489
476static inline void tasklet_disable_nosync(struct tasklet_struct *t) 490static inline void tasklet_disable_nosync(struct tasklet_struct *t)
477{ 491{
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 3bf40e246a80..e408722a84c7 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -94,13 +94,8 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
94#endif 94#endif
95 95
96#if defined(CONFIG_IPC_NS) 96#if defined(CONFIG_IPC_NS)
97extern void free_ipc_ns(struct ipc_namespace *ns);
98extern struct ipc_namespace *copy_ipcs(unsigned long flags, 97extern struct ipc_namespace *copy_ipcs(unsigned long flags,
99 struct ipc_namespace *ns); 98 struct ipc_namespace *ns);
100extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
101 void (*free)(struct ipc_namespace *,
102 struct kern_ipc_perm *));
103
104static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 99static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
105{ 100{
106 if (ns) 101 if (ns)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 883cd44ff765..c5a71c38a95f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -97,12 +97,14 @@ extern const char linux_proc_banner[];
97#define KERN_INFO "<6>" /* informational */ 97#define KERN_INFO "<6>" /* informational */
98#define KERN_DEBUG "<7>" /* debug-level messages */ 98#define KERN_DEBUG "<7>" /* debug-level messages */
99 99
100/* Use the default kernel loglevel */
101#define KERN_DEFAULT "<d>"
100/* 102/*
101 * Annotation for a "continued" line of log printout (only done after a 103 * Annotation for a "continued" line of log printout (only done after a
102 * line that had no enclosing \n). Only to be used by core/arch code 104 * line that had no enclosing \n). Only to be used by core/arch code
103 * during early bootup (a continued line is not SMP-safe otherwise). 105 * during early bootup (a continued line is not SMP-safe otherwise).
104 */ 106 */
105#define KERN_CONT "" 107#define KERN_CONT "<c>"
106 108
107extern int console_printk[]; 109extern int console_printk[];
108 110
@@ -406,7 +408,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
406 * 408 *
407 * Use tracing_on/tracing_off when you want to quickly turn on or off 409 * Use tracing_on/tracing_off when you want to quickly turn on or off
408 * tracing. It simply enables or disables the recording of the trace events. 410 * tracing. It simply enables or disables the recording of the trace events.
409 * This also corresponds to the user space debugfs/tracing/tracing_on 411 * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
410 * file, which gives a means for the kernel and userspace to interact. 412 * file, which gives a means for the kernel and userspace to interact.
411 * Place a tracing_off() in the kernel where you want tracing to end. 413 * Place a tracing_off() in the kernel where you want tracing to end.
412 * From user space, examine the trace, and then echo 1 > tracing_on 414 * From user space, examine the trace, and then echo 1 > tracing_on
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index a77c6007dc99..348fa8874b52 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -5,6 +5,7 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h>
8#include <asm/irq.h> 9#include <asm/irq.h>
9#include <asm/cputime.h> 10#include <asm/cputime.h>
10 11
@@ -31,6 +32,7 @@ struct kernel_stat {
31#ifndef CONFIG_GENERIC_HARDIRQS 32#ifndef CONFIG_GENERIC_HARDIRQS
32 unsigned int irqs[NR_IRQS]; 33 unsigned int irqs[NR_IRQS];
33#endif 34#endif
35 unsigned int softirqs[NR_SOFTIRQS];
34}; 36};
35 37
36DECLARE_PER_CPU(struct kernel_stat, kstat); 38DECLARE_PER_CPU(struct kernel_stat, kstat);
@@ -67,6 +69,16 @@ extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
67 69
68#endif 70#endif
69 71
72static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
73{
74 kstat_this_cpu.softirqs[irq]++;
75}
76
77static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
78{
79 return kstat_cpu(cpu).softirqs[irq];
80}
81
70/* 82/*
71 * Number of interrupts per specific IRQ source, since bootup 83 * Number of interrupts per specific IRQ source, since bootup
72 */ 84 */
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
new file mode 100644
index 000000000000..47b39b7c7e84
--- /dev/null
+++ b/include/linux/kmemcheck.h
@@ -0,0 +1,153 @@
1#ifndef LINUX_KMEMCHECK_H
2#define LINUX_KMEMCHECK_H
3
4#include <linux/mm_types.h>
5#include <linux/types.h>
6
7#ifdef CONFIG_KMEMCHECK
8extern int kmemcheck_enabled;
9
10/* The slab-related functions. */
11void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
12void kmemcheck_free_shadow(struct page *page, int order);
13void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
14 size_t size);
15void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
16
17void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
18 gfp_t gfpflags);
19
20void kmemcheck_show_pages(struct page *p, unsigned int n);
21void kmemcheck_hide_pages(struct page *p, unsigned int n);
22
23bool kmemcheck_page_is_tracked(struct page *p);
24
25void kmemcheck_mark_unallocated(void *address, unsigned int n);
26void kmemcheck_mark_uninitialized(void *address, unsigned int n);
27void kmemcheck_mark_initialized(void *address, unsigned int n);
28void kmemcheck_mark_freed(void *address, unsigned int n);
29
30void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
31void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
32void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
33
34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address);
36
37#else
38#define kmemcheck_enabled 0
39
40static inline void
41kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
42{
43}
44
45static inline void
46kmemcheck_free_shadow(struct page *page, int order)
47{
48}
49
50static inline void
51kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
52 size_t size)
53{
54}
55
56static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
57 size_t size)
58{
59}
60
61static inline void kmemcheck_pagealloc_alloc(struct page *p,
62 unsigned int order, gfp_t gfpflags)
63{
64}
65
66static inline bool kmemcheck_page_is_tracked(struct page *p)
67{
68 return false;
69}
70
71static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
72{
73}
74
75static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
76{
77}
78
79static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
80{
81}
82
83static inline void kmemcheck_mark_freed(void *address, unsigned int n)
84{
85}
86
87static inline void kmemcheck_mark_unallocated_pages(struct page *p,
88 unsigned int n)
89{
90}
91
92static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
93 unsigned int n)
94{
95}
96
97static inline void kmemcheck_mark_initialized_pages(struct page *p,
98 unsigned int n)
99{
100}
101
102#endif /* CONFIG_KMEMCHECK */
103
104/*
105 * Bitfield annotations
106 *
107 * How to use: If you have a struct using bitfields, for example
108 *
109 * struct a {
110 * int x:8, y:8;
111 * };
112 *
113 * then this should be rewritten as
114 *
115 * struct a {
116 * kmemcheck_bitfield_begin(flags);
117 * int x:8, y:8;
118 * kmemcheck_bitfield_end(flags);
119 * };
120 *
121 * Now the "flags_begin" and "flags_end" members may be used to refer to the
122 * beginning and end, respectively, of the bitfield (and things like
123 * &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
124 * fields should be annotated:
125 *
126 * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
127 * kmemcheck_annotate_bitfield(a, flags);
128 *
129 * Note: We provide the same definitions for both kmemcheck and non-
130 * kmemcheck kernels. This makes it harder to introduce accidental errors. It
131 * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield().
132 */
133#define kmemcheck_bitfield_begin(name) \
134 int name##_begin[0];
135
136#define kmemcheck_bitfield_end(name) \
137 int name##_end[0];
138
139#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \
141 int _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \
144 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0)
147
148#define kmemcheck_annotate_variable(var) \
149 do { \
150 kmemcheck_mark_initialized(&(var), sizeof(var)); \
151 } while (0) \
152
153#endif /* LINUX_KMEMCHECK_H */
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h
index 08a92969c76e..ca5bd91d12e1 100644
--- a/include/linux/linux_logo.h
+++ b/include/linux/linux_logo.h
@@ -32,6 +32,22 @@ struct linux_logo {
32 const unsigned char *data; 32 const unsigned char *data;
33}; 33};
34 34
35extern const struct linux_logo logo_linux_mono;
36extern const struct linux_logo logo_linux_vga16;
37extern const struct linux_logo logo_linux_clut224;
38extern const struct linux_logo logo_blackfin_vga16;
39extern const struct linux_logo logo_blackfin_clut224;
40extern const struct linux_logo logo_dec_clut224;
41extern const struct linux_logo logo_mac_clut224;
42extern const struct linux_logo logo_parisc_clut224;
43extern const struct linux_logo logo_sgi_clut224;
44extern const struct linux_logo logo_sun_clut224;
45extern const struct linux_logo logo_superh_mono;
46extern const struct linux_logo logo_superh_vga16;
47extern const struct linux_logo logo_superh_clut224;
48extern const struct linux_logo logo_m32r_clut224;
49extern const struct linux_logo logo_spe_clut224;
50
35extern const struct linux_logo *fb_find_logo(int depth); 51extern const struct linux_logo *fb_find_logo(int depth);
36#ifdef CONFIG_FB_LOGO_EXTRA 52#ifdef CONFIG_FB_LOGO_EXTRA
37extern void fb_append_extra_logo(const struct linux_logo *logo, 53extern void fb_append_extra_logo(const struct linux_logo *logo,
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
new file mode 100644
index 000000000000..ad651f4e45ac
--- /dev/null
+++ b/include/linux/lis3lv02d.h
@@ -0,0 +1,39 @@
1#ifndef __LIS3LV02D_H_
2#define __LIS3LV02D_H_
3
4struct lis3lv02d_platform_data {
5 /* please note: the 'click' feature is only supported for
6 * LIS[32]02DL variants of the chip and will be ignored for
7 * others */
8#define LIS3_CLICK_SINGLE_X (1 << 0)
9#define LIS3_CLICK_DOUBLE_X (1 << 1)
10#define LIS3_CLICK_SINGLE_Y (1 << 2)
11#define LIS3_CLICK_DOUBLE_Y (1 << 3)
12#define LIS3_CLICK_SINGLE_Z (1 << 4)
13#define LIS3_CLICK_DOUBLE_Z (1 << 5)
14 unsigned char click_flags;
15 unsigned char click_thresh_x;
16 unsigned char click_thresh_y;
17 unsigned char click_thresh_z;
18 unsigned char click_time_limit;
19 unsigned char click_latency;
20 unsigned char click_window;
21
22#define LIS3_IRQ1_DISABLE (0 << 0)
23#define LIS3_IRQ1_FF_WU_1 (1 << 0)
24#define LIS3_IRQ1_FF_WU_2 (2 << 0)
25#define LIS3_IRQ1_FF_WU_12 (3 << 0)
26#define LIS3_IRQ1_DATA_READY (4 << 0)
27#define LIS3_IRQ1_CLICK (7 << 0)
28#define LIS3_IRQ2_DISABLE (0 << 3)
29#define LIS3_IRQ2_FF_WU_1 (1 << 3)
30#define LIS3_IRQ2_FF_WU_2 (2 << 3)
31#define LIS3_IRQ2_FF_WU_12 (3 << 3)
32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7)
36 unsigned char irq_cfg;
37};
38
39#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/major.h b/include/linux/major.h
index 058ec15dd060..6a8ca98c9a96 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -145,6 +145,7 @@
145#define UNIX98_PTY_MAJOR_COUNT 8 145#define UNIX98_PTY_MAJOR_COUNT 8
146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) 146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
147 147
148#define DRBD_MAJOR 147
148#define RTF_MAJOR 150 149#define RTF_MAJOR 150
149#define RAW_MAJOR 162 150#define RAW_MAJOR 162
150 151
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 25b9ca93d232..e46a0734ab6e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
95 int priority); 95 int priority);
96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
97int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
97unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 98unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
98 struct zone *zone, 99 struct zone *zone,
99 enum lru_list lru); 100 enum lru_list lru);
@@ -116,7 +117,7 @@ static inline bool mem_cgroup_disabled(void)
116} 117}
117 118
118extern bool mem_cgroup_oom_called(struct task_struct *task); 119extern bool mem_cgroup_oom_called(struct task_struct *task);
119 120void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
120#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 121#else /* CONFIG_CGROUP_MEM_RES_CTLR */
121struct mem_cgroup; 122struct mem_cgroup;
122 123
@@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
239 return 1; 240 return 1;
240} 241}
241 242
243static inline int
244mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
245{
246 return 1;
247}
248
242static inline unsigned long 249static inline unsigned long
243mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, 250mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
244 enum lru_list lru) 251 enum lru_list lru)
@@ -264,6 +271,11 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
264{ 271{
265} 272}
266 273
274static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
275 int val)
276{
277}
278
267#endif /* CONFIG_CGROUP_MEM_CONT */ 279#endif /* CONFIG_CGROUP_MEM_CONT */
268 280
269#endif /* _LINUX_MEMCONTROL_H */ 281#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
new file mode 100644
index 000000000000..7a3f316e3848
--- /dev/null
+++ b/include/linux/mfd/ab3100.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2007-2009 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 */
7
8#include <linux/device.h>
9
10#ifndef MFD_AB3100_H
11#define MFD_AB3100_H
12
13#define ABUNKNOWN 0
14#define AB3000 1
15#define AB3100 2
16
17/*
18 * AB3100, EVENTA1, A2 and A3 event register flags
19 * these are catenated into a single 32-bit flag in the code
20 * for event notification broadcasts.
21 */
22#define AB3100_EVENTA1_ONSWA (0x01<<16)
23#define AB3100_EVENTA1_ONSWB (0x02<<16)
24#define AB3100_EVENTA1_ONSWC (0x04<<16)
25#define AB3100_EVENTA1_DCIO (0x08<<16)
26#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
27#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
28#define AB3100_EVENTA1_VBUS (0x40<<16)
29#define AB3100_EVENTA1_VSET_USB (0x80<<16)
30
31#define AB3100_EVENTA2_READY_TX (0x01<<8)
32#define AB3100_EVENTA2_READY_RX (0x02<<8)
33#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
34#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
35#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
36#define AB3100_EVENTA2_MIDR (0x20<<8)
37#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
38#define AB3100_EVENTA2_ALARM (0x80<<8)
39
40#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
41#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
42#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
43#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
44#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
45#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
46#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
47#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
48
49/* AB3100, STR register flags */
50#define AB3100_STR_ONSWA (0x01)
51#define AB3100_STR_ONSWB (0x02)
52#define AB3100_STR_ONSWC (0x04)
53#define AB3100_STR_DCIO (0x08)
54#define AB3100_STR_BOOT_MODE (0x10)
55#define AB3100_STR_SIM_OFF (0x20)
56#define AB3100_STR_BATT_REMOVAL (0x40)
57#define AB3100_STR_VBUS (0x80)
58
59/**
60 * struct ab3100
61 * @access_mutex: lock out concurrent accesses to the AB3100 registers
62 * @dev: pointer to the containing device
63 * @i2c_client: I2C client for this chip
64 * @testreg_client: secondary client for test registers
65 * @chip_name: name of this chip variant
66 * @chip_id: 8 bit chip ID for this chip variant
67 * @work: an event handling worker
68 * @event_subscribers: event subscribers are listed here
69 * @startup_events: a copy of the first reading of the event registers
70 * @startup_events_read: whether the first events have been read
71 *
72 * This struct is PRIVATE and devices using it should NOT
73 * access ANY fields. It is used as a token for calling the
74 * AB3100 functions.
75 */
76struct ab3100 {
77 struct mutex access_mutex;
78 struct device *dev;
79 struct i2c_client *i2c_client;
80 struct i2c_client *testreg_client;
81 char chip_name[32];
82 u8 chip_id;
83 struct work_struct work;
84 struct blocking_notifier_head event_subscribers;
85 u32 startup_events;
86 bool startup_events_read;
87};
88
89int ab3100_set_register(struct ab3100 *ab3100, u8 reg, u8 regval);
90int ab3100_get_register(struct ab3100 *ab3100, u8 reg, u8 *regval);
91int ab3100_get_register_page(struct ab3100 *ab3100,
92 u8 first_reg, u8 *regvals, u8 numregs);
93int ab3100_mask_and_set_register(struct ab3100 *ab3100,
94 u8 reg, u8 andmask, u8 ormask);
95u8 ab3100_get_chip_type(struct ab3100 *ab3100);
96int ab3100_event_register(struct ab3100 *ab3100,
97 struct notifier_block *nb);
98int ab3100_event_unregister(struct ab3100 *ab3100,
99 struct notifier_block *nb);
100int ab3100_event_registers_startup_state_get(struct ab3100 *ab3100,
101 u32 *fatevent);
102
103#endif
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 322cd6deb9f0..de3c4ad19afb 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -30,6 +30,13 @@ struct asic3_platform_data {
30#define ASIC3_NUM_GPIOS 64 30#define ASIC3_NUM_GPIOS 64
31#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6 31#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
32 32
33#define ASIC3_IRQ_LED0 64
34#define ASIC3_IRQ_LED1 65
35#define ASIC3_IRQ_LED2 66
36#define ASIC3_IRQ_SPI 67
37#define ASIC3_IRQ_SMBUS 68
38#define ASIC3_IRQ_OWM 69
39
33#define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio)) 40#define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio))
34 41
35#define ASIC3_GPIO_BANK_A 0 42#define ASIC3_GPIO_BANK_A 0
@@ -227,8 +234,8 @@ struct asic3_platform_data {
227 234
228 235
229/* Basic control of the SD ASIC */ 236/* Basic control of the SD ASIC */
230#define ASIC3_SDHWCTRL_Base 0x0E00 237#define ASIC3_SDHWCTRL_BASE 0x0E00
231#define ASIC3_SDHWCTRL_SDConf 0x00 238#define ASIC3_SDHWCTRL_SDCONF 0x00
232 239
233#define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */ 240#define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */
234#define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */ 241#define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */
@@ -242,10 +249,10 @@ struct asic3_platform_data {
242/* SD card power supply ctrl 1=enable */ 249/* SD card power supply ctrl 1=enable */
243#define ASIC3_SDHWCTRL_SDPWR (1 << 6) 250#define ASIC3_SDHWCTRL_SDPWR (1 << 6)
244 251
245#define ASIC3_EXTCF_Base 0x1100 252#define ASIC3_EXTCF_BASE 0x1100
246 253
247#define ASIC3_EXTCF_Select 0x00 254#define ASIC3_EXTCF_SELECT 0x00
248#define ASIC3_EXTCF_Reset 0x04 255#define ASIC3_EXTCF_RESET 0x04
249 256
250#define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */ 257#define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */
251#define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */ 258#define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */
@@ -279,222 +286,9 @@ struct asic3_platform_data {
279 * SDIO_CTRL Control registers for SDIO operations 286 * SDIO_CTRL Control registers for SDIO operations
280 * 287 *
281 *****************************************************************************/ 288 *****************************************************************************/
282#define ASIC3_SD_CONFIG_Base 0x0400 /* Assumes 32 bit addressing */ 289#define ASIC3_SD_CONFIG_BASE 0x0400 /* Assumes 32 bit addressing */
283 290#define ASIC3_SD_CTRL_BASE 0x1000
284#define ASIC3_SD_CONFIG_Command 0x08 /* R/W: Command */ 291#define ASIC3_SDIO_CTRL_BASE 0x1200
285
286/* [0:8] SD Control Register Base Address */
287#define ASIC3_SD_CONFIG_Addr0 0x20
288
289/* [9:31] SD Control Register Base Address */
290#define ASIC3_SD_CONFIG_Addr1 0x24
291
292/* R/O: interrupt assigned to pin */
293#define ASIC3_SD_CONFIG_IntPin 0x78
294
295/*
296 * Set to 0x1f to clock SD controller, 0 otherwise.
297 * At 0x82 - Gated Clock Ctrl
298 */
299#define ASIC3_SD_CONFIG_ClkStop 0x80
300
301/* Control clock of SD controller */
302#define ASIC3_SD_CONFIG_ClockMode 0x84
303#define ASIC3_SD_CONFIG_SDHC_PinStatus 0x88 /* R/0: SD pins status */
304#define ASIC3_SD_CONFIG_SDHC_Power1 0x90 /* Power1 - manual pwr ctrl */
305
306/* auto power up after card inserted */
307#define ASIC3_SD_CONFIG_SDHC_Power2 0x92
308
309/* auto power down when card removed */
310#define ASIC3_SD_CONFIG_SDHC_Power3 0x94
311#define ASIC3_SD_CONFIG_SDHC_CardDetect 0x98
312#define ASIC3_SD_CONFIG_SDHC_Slot 0xA0 /* R/O: support slot number */
313#define ASIC3_SD_CONFIG_SDHC_ExtGateClk1 0x1E0 /* Not used */
314#define ASIC3_SD_CONFIG_SDHC_ExtGateClk2 0x1E2 /* Not used*/
315
316/* GPIO Output Reg. , at 0x1EA - GPIO Output Enable Reg. */
317#define ASIC3_SD_CONFIG_SDHC_GPIO_OutAndEnable 0x1E8
318#define ASIC3_SD_CONFIG_SDHC_GPIO_Status 0x1EC /* GPIO Status Reg. */
319
320/* Bit 1: double buffer/single buffer */
321#define ASIC3_SD_CONFIG_SDHC_ExtGateClk3 0x1F0
322
323/* Memory access enable (set to 1 to access SD Controller) */
324#define SD_CONFIG_COMMAND_MAE (1<<1)
325
326#define SD_CONFIG_CLK_ENABLE_ALL 0x1f
327
328#define SD_CONFIG_POWER1_PC_33V 0x0200 /* Set for 3.3 volts */
329#define SD_CONFIG_POWER1_PC_OFF 0x0000 /* Turn off power */
330
331 /* two bits - number of cycles for card detection */
332#define SD_CONFIG_CARDDETECTMODE_CLK ((x) & 0x3)
333
334
335#define ASIC3_SD_CTRL_Base 0x1000
336
337#define ASIC3_SD_CTRL_Cmd 0x00
338#define ASIC3_SD_CTRL_Arg0 0x08
339#define ASIC3_SD_CTRL_Arg1 0x0C
340#define ASIC3_SD_CTRL_StopInternal 0x10
341#define ASIC3_SD_CTRL_TransferSectorCount 0x14
342#define ASIC3_SD_CTRL_Response0 0x18
343#define ASIC3_SD_CTRL_Response1 0x1C
344#define ASIC3_SD_CTRL_Response2 0x20
345#define ASIC3_SD_CTRL_Response3 0x24
346#define ASIC3_SD_CTRL_Response4 0x28
347#define ASIC3_SD_CTRL_Response5 0x2C
348#define ASIC3_SD_CTRL_Response6 0x30
349#define ASIC3_SD_CTRL_Response7 0x34
350#define ASIC3_SD_CTRL_CardStatus 0x38
351#define ASIC3_SD_CTRL_BufferCtrl 0x3C
352#define ASIC3_SD_CTRL_IntMaskCard 0x40
353#define ASIC3_SD_CTRL_IntMaskBuffer 0x44
354#define ASIC3_SD_CTRL_CardClockCtrl 0x48
355#define ASIC3_SD_CTRL_MemCardXferDataLen 0x4C
356#define ASIC3_SD_CTRL_MemCardOptionSetup 0x50
357#define ASIC3_SD_CTRL_ErrorStatus0 0x58
358#define ASIC3_SD_CTRL_ErrorStatus1 0x5C
359#define ASIC3_SD_CTRL_DataPort 0x60
360#define ASIC3_SD_CTRL_TransactionCtrl 0x68
361#define ASIC3_SD_CTRL_SoftwareReset 0x1C0
362
363#define SD_CTRL_SOFTWARE_RESET_CLEAR (1<<0)
364
365#define SD_CTRL_TRANSACTIONCONTROL_SET (1<<8)
366
367#define SD_CTRL_CARDCLOCKCONTROL_FOR_SD_CARD (1<<15)
368#define SD_CTRL_CARDCLOCKCONTROL_ENABLE_CLOCK (1<<8)
369#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_512 (1<<7)
370#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_256 (1<<6)
371#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_128 (1<<5)
372#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_64 (1<<4)
373#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_32 (1<<3)
374#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_16 (1<<2)
375#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_8 (1<<1)
376#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_4 (1<<0)
377#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_2 (0<<0)
378
379#define MEM_CARD_OPTION_REQUIRED 0x000e
380#define MEM_CARD_OPTION_DATA_RESPONSE_TIMEOUT(x) (((x) & 0x0f) << 4)
381#define MEM_CARD_OPTION_C2_MODULE_NOT_PRESENT (1<<14)
382#define MEM_CARD_OPTION_DATA_XFR_WIDTH_1 (1<<15)
383#define MEM_CARD_OPTION_DATA_XFR_WIDTH_4 0
384
385#define SD_CTRL_COMMAND_INDEX(x) ((x) & 0x3f)
386#define SD_CTRL_COMMAND_TYPE_CMD (0 << 6)
387#define SD_CTRL_COMMAND_TYPE_ACMD (1 << 6)
388#define SD_CTRL_COMMAND_TYPE_AUTHENTICATION (2 << 6)
389#define SD_CTRL_COMMAND_RESPONSE_TYPE_NORMAL (0 << 8)
390#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1 (4 << 8)
391#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1B (5 << 8)
392#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R2 (6 << 8)
393#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R3 (7 << 8)
394#define SD_CTRL_COMMAND_DATA_PRESENT (1 << 11)
395#define SD_CTRL_COMMAND_TRANSFER_READ (1 << 12)
396#define SD_CTRL_COMMAND_TRANSFER_WRITE (0 << 12)
397#define SD_CTRL_COMMAND_MULTI_BLOCK (1 << 13)
398#define SD_CTRL_COMMAND_SECURITY_CMD (1 << 14)
399
400#define SD_CTRL_STOP_INTERNAL_ISSSUE_CMD12 (1 << 0)
401#define SD_CTRL_STOP_INTERNAL_AUTO_ISSUE_CMD12 (1 << 8)
402
403#define SD_CTRL_CARDSTATUS_RESPONSE_END (1 << 0)
404#define SD_CTRL_CARDSTATUS_RW_END (1 << 2)
405#define SD_CTRL_CARDSTATUS_CARD_REMOVED_0 (1 << 3)
406#define SD_CTRL_CARDSTATUS_CARD_INSERTED_0 (1 << 4)
407#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_0 (1 << 5)
408#define SD_CTRL_CARDSTATUS_WRITE_PROTECT (1 << 7)
409#define SD_CTRL_CARDSTATUS_CARD_REMOVED_3 (1 << 8)
410#define SD_CTRL_CARDSTATUS_CARD_INSERTED_3 (1 << 9)
411#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_3 (1 << 10)
412
413#define SD_CTRL_BUFFERSTATUS_CMD_INDEX_ERROR (1 << 0)
414#define SD_CTRL_BUFFERSTATUS_CRC_ERROR (1 << 1)
415#define SD_CTRL_BUFFERSTATUS_STOP_BIT_END_ERROR (1 << 2)
416#define SD_CTRL_BUFFERSTATUS_DATA_TIMEOUT (1 << 3)
417#define SD_CTRL_BUFFERSTATUS_BUFFER_OVERFLOW (1 << 4)
418#define SD_CTRL_BUFFERSTATUS_BUFFER_UNDERFLOW (1 << 5)
419#define SD_CTRL_BUFFERSTATUS_CMD_TIMEOUT (1 << 6)
420#define SD_CTRL_BUFFERSTATUS_UNK7 (1 << 7)
421#define SD_CTRL_BUFFERSTATUS_BUFFER_READ_ENABLE (1 << 8)
422#define SD_CTRL_BUFFERSTATUS_BUFFER_WRITE_ENABLE (1 << 9)
423#define SD_CTRL_BUFFERSTATUS_ILLEGAL_FUNCTION (1 << 13)
424#define SD_CTRL_BUFFERSTATUS_CMD_BUSY (1 << 14)
425#define SD_CTRL_BUFFERSTATUS_ILLEGAL_ACCESS (1 << 15)
426
427#define SD_CTRL_INTMASKCARD_RESPONSE_END (1 << 0)
428#define SD_CTRL_INTMASKCARD_RW_END (1 << 2)
429#define SD_CTRL_INTMASKCARD_CARD_REMOVED_0 (1 << 3)
430#define SD_CTRL_INTMASKCARD_CARD_INSERTED_0 (1 << 4)
431#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_0 (1 << 5)
432#define SD_CTRL_INTMASKCARD_UNK6 (1 << 6)
433#define SD_CTRL_INTMASKCARD_WRITE_PROTECT (1 << 7)
434#define SD_CTRL_INTMASKCARD_CARD_REMOVED_3 (1 << 8)
435#define SD_CTRL_INTMASKCARD_CARD_INSERTED_3 (1 << 9)
436#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_3 (1 << 10)
437
438#define SD_CTRL_INTMASKBUFFER_CMD_INDEX_ERROR (1 << 0)
439#define SD_CTRL_INTMASKBUFFER_CRC_ERROR (1 << 1)
440#define SD_CTRL_INTMASKBUFFER_STOP_BIT_END_ERROR (1 << 2)
441#define SD_CTRL_INTMASKBUFFER_DATA_TIMEOUT (1 << 3)
442#define SD_CTRL_INTMASKBUFFER_BUFFER_OVERFLOW (1 << 4)
443#define SD_CTRL_INTMASKBUFFER_BUFFER_UNDERFLOW (1 << 5)
444#define SD_CTRL_INTMASKBUFFER_CMD_TIMEOUT (1 << 6)
445#define SD_CTRL_INTMASKBUFFER_UNK7 (1 << 7)
446#define SD_CTRL_INTMASKBUFFER_BUFFER_READ_ENABLE (1 << 8)
447#define SD_CTRL_INTMASKBUFFER_BUFFER_WRITE_ENABLE (1 << 9)
448#define SD_CTRL_INTMASKBUFFER_ILLEGAL_FUNCTION (1 << 13)
449#define SD_CTRL_INTMASKBUFFER_CMD_BUSY (1 << 14)
450#define SD_CTRL_INTMASKBUFFER_ILLEGAL_ACCESS (1 << 15)
451
452#define SD_CTRL_DETAIL0_RESPONSE_CMD_ERROR (1 << 0)
453#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 2)
454#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_CMD12 (1 << 3)
455#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_READ_DATA (1 << 4)
456#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_WRITE_CRC_STATUS (1 << 5)
457#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 8)
458#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_CMD12 (1 << 9)
459#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_READ_DATA (1 << 10)
460#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_WRITE_CMD (1 << 11)
461
462#define SD_CTRL_DETAIL1_NO_CMD_RESPONSE (1 << 0)
463#define SD_CTRL_DETAIL1_TIMEOUT_READ_DATA (1 << 4)
464#define SD_CTRL_DETAIL1_TIMEOUT_CRS_STATUS (1 << 5)
465#define SD_CTRL_DETAIL1_TIMEOUT_CRC_BUSY (1 << 6)
466
467#define ASIC3_SDIO_CTRL_Base 0x1200
468
469#define ASIC3_SDIO_CTRL_Cmd 0x00
470#define ASIC3_SDIO_CTRL_CardPortSel 0x04
471#define ASIC3_SDIO_CTRL_Arg0 0x08
472#define ASIC3_SDIO_CTRL_Arg1 0x0C
473#define ASIC3_SDIO_CTRL_TransferBlockCount 0x14
474#define ASIC3_SDIO_CTRL_Response0 0x18
475#define ASIC3_SDIO_CTRL_Response1 0x1C
476#define ASIC3_SDIO_CTRL_Response2 0x20
477#define ASIC3_SDIO_CTRL_Response3 0x24
478#define ASIC3_SDIO_CTRL_Response4 0x28
479#define ASIC3_SDIO_CTRL_Response5 0x2C
480#define ASIC3_SDIO_CTRL_Response6 0x30
481#define ASIC3_SDIO_CTRL_Response7 0x34
482#define ASIC3_SDIO_CTRL_CardStatus 0x38
483#define ASIC3_SDIO_CTRL_BufferCtrl 0x3C
484#define ASIC3_SDIO_CTRL_IntMaskCard 0x40
485#define ASIC3_SDIO_CTRL_IntMaskBuffer 0x44
486#define ASIC3_SDIO_CTRL_CardXferDataLen 0x4C
487#define ASIC3_SDIO_CTRL_CardOptionSetup 0x50
488#define ASIC3_SDIO_CTRL_ErrorStatus0 0x54
489#define ASIC3_SDIO_CTRL_ErrorStatus1 0x58
490#define ASIC3_SDIO_CTRL_DataPort 0x60
491#define ASIC3_SDIO_CTRL_TransactionCtrl 0x68
492#define ASIC3_SDIO_CTRL_CardIntCtrl 0x6C
493#define ASIC3_SDIO_CTRL_ClocknWaitCtrl 0x70
494#define ASIC3_SDIO_CTRL_HostInformation 0x74
495#define ASIC3_SDIO_CTRL_ErrorCtrl 0x78
496#define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
497#define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
498 292
499#define ASIC3_MAP_SIZE_32BIT 0x2000 293#define ASIC3_MAP_SIZE_32BIT 0x2000
500#define ASIC3_MAP_SIZE_16BIT 0x1000 294#define ASIC3_MAP_SIZE_16BIT 0x1000
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
new file mode 100644
index 000000000000..c12c3c0932bf
--- /dev/null
+++ b/include/linux/mfd/ezx-pcap.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright 2009 Daniel Ribeiro <drwyrm@gmail.com>
3 *
4 * For further information, please see http://wiki.openezx.org/PCAP2
5 */
6
7#ifndef EZX_PCAP_H
8#define EZX_PCAP_H
9
10struct pcap_subdev {
11 int id;
12 const char *name;
13 void *platform_data;
14};
15
16struct pcap_platform_data {
17 unsigned int irq_base;
18 unsigned int config;
19 void (*init) (void *); /* board specific init */
20 int num_subdevs;
21 struct pcap_subdev *subdevs;
22};
23
24struct pcap_chip;
25
26int ezx_pcap_write(struct pcap_chip *, u8, u32);
27int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
28int pcap_to_irq(struct pcap_chip *, int);
29int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
30int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
31
32#define PCAP_SECOND_PORT 1
33#define PCAP_CS_AH 2
34
35#define PCAP_REGISTER_WRITE_OP_BIT 0x80000000
36#define PCAP_REGISTER_READ_OP_BIT 0x00000000
37
38#define PCAP_REGISTER_VALUE_MASK 0x01ffffff
39#define PCAP_REGISTER_ADDRESS_MASK 0x7c000000
40#define PCAP_REGISTER_ADDRESS_SHIFT 26
41#define PCAP_REGISTER_NUMBER 32
42#define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff
43#define PCAP_MASK_ALL_INTERRUPT 0x01ffffff
44
45/* registers acessible by both pcap ports */
46#define PCAP_REG_ISR 0x0 /* Interrupt Status */
47#define PCAP_REG_MSR 0x1 /* Interrupt Mask */
48#define PCAP_REG_PSTAT 0x2 /* Processor Status */
49#define PCAP_REG_VREG2 0x6 /* Regulator Bank 2 Control */
50#define PCAP_REG_AUXVREG 0x7 /* Auxiliary Regulator Control */
51#define PCAP_REG_BATT 0x8 /* Battery Control */
52#define PCAP_REG_ADC 0x9 /* AD Control */
53#define PCAP_REG_ADR 0xa /* AD Result */
54#define PCAP_REG_CODEC 0xb /* Audio Codec Control */
55#define PCAP_REG_RX_AMPS 0xc /* RX Audio Amplifiers Control */
56#define PCAP_REG_ST_DAC 0xd /* Stereo DAC Control */
57#define PCAP_REG_BUSCTRL 0x14 /* Connectivity Control */
58#define PCAP_REG_PERIPH 0x15 /* Peripheral Control */
59#define PCAP_REG_LOWPWR 0x18 /* Regulator Low Power Control */
60#define PCAP_REG_TX_AMPS 0x1a /* TX Audio Amplifiers Control */
61#define PCAP_REG_GP 0x1b /* General Purpose */
62#define PCAP_REG_TEST1 0x1c
63#define PCAP_REG_TEST2 0x1d
64#define PCAP_REG_VENDOR_TEST1 0x1e
65#define PCAP_REG_VENDOR_TEST2 0x1f
66
67/* registers acessible by pcap port 1 only (a1200, e2 & e6) */
68#define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */
69#define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */
70#define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */
71#define PCAP_REG_RTC_TOD 0xe /* RTC Time of Day */
72#define PCAP_REG_RTC_TODA 0xf /* RTC Time of Day Alarm */
73#define PCAP_REG_RTC_DAY 0x10 /* RTC Day */
74#define PCAP_REG_RTC_DAYA 0x11 /* RTC Day Alarm */
75#define PCAP_REG_MTRTMR 0x12 /* AD Monitor Timer */
76#define PCAP_REG_PWR 0x13 /* Power Control */
77#define PCAP_REG_AUXVREG_MASK 0x16 /* Auxiliary Regulator Mask */
78#define PCAP_REG_VENDOR_REV 0x17
79#define PCAP_REG_PERIPH_MASK 0x19 /* Peripheral Mask */
80
81/* PCAP2 Interrupts */
82#define PCAP_NIRQS 23
83#define PCAP_IRQ_ADCDONE 0 /* ADC done port 1 */
84#define PCAP_IRQ_TS 1 /* Touch Screen */
85#define PCAP_IRQ_1HZ 2 /* 1HZ timer */
86#define PCAP_IRQ_WH 3 /* ADC above high limit */
87#define PCAP_IRQ_WL 4 /* ADC below low limit */
88#define PCAP_IRQ_TODA 5 /* Time of day alarm */
89#define PCAP_IRQ_USB4V 6 /* USB above 4V */
90#define PCAP_IRQ_ONOFF 7 /* On/Off button */
91#define PCAP_IRQ_ONOFF2 8 /* On/Off button 2 */
92#define PCAP_IRQ_USB1V 9 /* USB above 1V */
93#define PCAP_IRQ_MOBPORT 10
94#define PCAP_IRQ_MIC 11 /* Mic attach/HS button */
95#define PCAP_IRQ_HS 12 /* Headset attach */
96#define PCAP_IRQ_ST 13
97#define PCAP_IRQ_PC 14 /* Power Cut */
98#define PCAP_IRQ_WARM 15
99#define PCAP_IRQ_EOL 16 /* Battery End Of Life */
100#define PCAP_IRQ_CLK 17
101#define PCAP_IRQ_SYSRST 18 /* System Reset */
102#define PCAP_IRQ_DUMMY 19
103#define PCAP_IRQ_ADCDONE2 20 /* ADC done port 2 */
104#define PCAP_IRQ_SOFTRESET 21
105#define PCAP_IRQ_MNEXB 22
106
107/* voltage regulators */
108#define V1 0
109#define V2 1
110#define V3 2
111#define V4 3
112#define V5 4
113#define V6 5
114#define V7 6
115#define V8 7
116#define V9 8
117#define V10 9
118#define VAUX1 10
119#define VAUX2 11
120#define VAUX3 12
121#define VAUX4 13
122#define VSIM 14
123#define VSIM2 15
124#define VVIB 16
125#define SW1 17
126#define SW2 18
127#define SW3 19
128#define SW1S 20
129#define SW2S 21
130
131#define PCAP_BATT_DAC_MASK 0x000000ff
132#define PCAP_BATT_DAC_SHIFT 0
133#define PCAP_BATT_B_FDBK (1 << 8)
134#define PCAP_BATT_EXT_ISENSE (1 << 9)
135#define PCAP_BATT_V_COIN_MASK 0x00003c00
136#define PCAP_BATT_V_COIN_SHIFT 10
137#define PCAP_BATT_I_COIN (1 << 14)
138#define PCAP_BATT_COIN_CH_EN (1 << 15)
139#define PCAP_BATT_EOL_SEL_MASK 0x000e0000
140#define PCAP_BATT_EOL_SEL_SHIFT 17
141#define PCAP_BATT_EOL_CMP_EN (1 << 20)
142#define PCAP_BATT_BATT_DET_EN (1 << 21)
143#define PCAP_BATT_THERMBIAS_CTRL (1 << 22)
144
145#define PCAP_ADC_ADEN (1 << 0)
146#define PCAP_ADC_RAND (1 << 1)
147#define PCAP_ADC_AD_SEL1 (1 << 2)
148#define PCAP_ADC_AD_SEL2 (1 << 3)
149#define PCAP_ADC_ADA1_MASK 0x00000070
150#define PCAP_ADC_ADA1_SHIFT 4
151#define PCAP_ADC_ADA2_MASK 0x00000380
152#define PCAP_ADC_ADA2_SHIFT 7
153#define PCAP_ADC_ATO_MASK 0x00003c00
154#define PCAP_ADC_ATO_SHIFT 10
155#define PCAP_ADC_ATOX (1 << 14)
156#define PCAP_ADC_MTR1 (1 << 15)
157#define PCAP_ADC_MTR2 (1 << 16)
158#define PCAP_ADC_TS_M_MASK 0x000e0000
159#define PCAP_ADC_TS_M_SHIFT 17
160#define PCAP_ADC_TS_REF_LOWPWR (1 << 20)
161#define PCAP_ADC_TS_REFENB (1 << 21)
162#define PCAP_ADC_BATT_I_POLARITY (1 << 22)
163#define PCAP_ADC_BATT_I_ADC (1 << 23)
164
165#define PCAP_ADC_BANK_0 0
166#define PCAP_ADC_BANK_1 1
167/* ADC bank 0 */
168#define PCAP_ADC_CH_COIN 0
169#define PCAP_ADC_CH_BATT 1
170#define PCAP_ADC_CH_BPLUS 2
171#define PCAP_ADC_CH_MOBPORTB 3
172#define PCAP_ADC_CH_TEMPERATURE 4
173#define PCAP_ADC_CH_CHARGER_ID 5
174#define PCAP_ADC_CH_AD6 6
175/* ADC bank 1 */
176#define PCAP_ADC_CH_AD7 0
177#define PCAP_ADC_CH_AD8 1
178#define PCAP_ADC_CH_AD9 2
179#define PCAP_ADC_CH_TS_X1 3
180#define PCAP_ADC_CH_TS_X2 4
181#define PCAP_ADC_CH_TS_Y1 5
182#define PCAP_ADC_CH_TS_Y2 6
183
184#define PCAP_ADC_T_NOW 0
185#define PCAP_ADC_T_IN_BURST 1
186#define PCAP_ADC_T_OUT_BURST 2
187
188#define PCAP_ADC_ATO_IN_BURST 6
189#define PCAP_ADC_ATO_OUT_BURST 0
190
191#define PCAP_ADC_TS_M_XY 1
192#define PCAP_ADC_TS_M_PRESSURE 2
193#define PCAP_ADC_TS_M_PLATE_X 3
194#define PCAP_ADC_TS_M_PLATE_Y 4
195#define PCAP_ADC_TS_M_STANDBY 5
196#define PCAP_ADC_TS_M_NONTS 6
197
198#define PCAP_ADR_ADD1_MASK 0x000003ff
199#define PCAP_ADR_ADD1_SHIFT 0
200#define PCAP_ADR_ADD2_MASK 0x000ffc00
201#define PCAP_ADR_ADD2_SHIFT 10
202#define PCAP_ADR_ADINC1 (1 << 20)
203#define PCAP_ADR_ADINC2 (1 << 21)
204#define PCAP_ADR_ASC (1 << 22)
205#define PCAP_ADR_ONESHOT (1 << 23)
206
207#define PCAP_BUSCTRL_FSENB (1 << 0)
208#define PCAP_BUSCTRL_USB_SUSPEND (1 << 1)
209#define PCAP_BUSCTRL_USB_PU (1 << 2)
210#define PCAP_BUSCTRL_USB_PD (1 << 3)
211#define PCAP_BUSCTRL_VUSB_EN (1 << 4)
212#define PCAP_BUSCTRL_USB_PS (1 << 5)
213#define PCAP_BUSCTRL_VUSB_MSTR_EN (1 << 6)
214#define PCAP_BUSCTRL_VBUS_PD_ENB (1 << 7)
215#define PCAP_BUSCTRL_CURRLIM (1 << 8)
216#define PCAP_BUSCTRL_RS232ENB (1 << 9)
217#define PCAP_BUSCTRL_RS232_DIR (1 << 10)
218#define PCAP_BUSCTRL_SE0_CONN (1 << 11)
219#define PCAP_BUSCTRL_USB_PDM (1 << 12)
220#define PCAP_BUSCTRL_BUS_PRI_ADJ (1 << 24)
221
222/* leds */
223#define PCAP_LED0 0
224#define PCAP_LED1 1
225#define PCAP_BL0 2
226#define PCAP_BL1 3
227#define PCAP_VIB 4
228#define PCAP_LED_3MA 0
229#define PCAP_LED_4MA 1
230#define PCAP_LED_5MA 2
231#define PCAP_LED_9MA 3
232#define PCAP_LED_GPIO_VAL_MASK 0x00ffffff
233#define PCAP_LED_GPIO_EN 0x01000000
234#define PCAP_LED_GPIO_INVERT 0x02000000
235#define PCAP_LED_T_MASK 0xf
236#define PCAP_LED_C_MASK 0x3
237#define PCAP_BL_MASK 0x1f
238#define PCAP_BL0_SHIFT 0
239#define PCAP_LED0_EN (1 << 5)
240#define PCAP_LED1_EN (1 << 6)
241#define PCAP_LED0_T_SHIFT 7
242#define PCAP_LED1_T_SHIFT 11
243#define PCAP_LED0_C_SHIFT 15
244#define PCAP_LED1_C_SHIFT 17
245#define PCAP_BL1_SHIFT 20
246#define PCAP_VIB_MASK 0x3
247#define PCAP_VIB_SHIFT 20
248#define PCAP_VIB_EN (1 << 19)
249
250/* RTC */
251#define PCAP_RTC_DAY_MASK 0x3fff
252#define PCAP_RTC_TOD_MASK 0xffff
253#define PCAP_RTC_PC_MASK 0x7
254#define SEC_PER_DAY 86400
255
256#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index c377118884e6..6b9c5d06690c 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -22,7 +22,7 @@
22 * data for the MMC controller 22 * data for the MMC controller
23 */ 23 */
24struct tmio_mmc_data { 24struct tmio_mmc_data {
25 unsigned int hclk; 25 const unsigned int hclk;
26}; 26};
27 27
28/* 28/*
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
new file mode 100644
index 000000000000..e11f4d9f1c2e
--- /dev/null
+++ b/include/linux/mg_disk.h
@@ -0,0 +1,45 @@
1/*
2 * include/linux/mg_disk.c
3 *
4 * Private data for mflash platform driver
5 *
6 * (c) 2008 mGine Co.,LTD
7 * (c) 2008 unsik Kim <donari75@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __MG_DISK_H__
15#define __MG_DISK_H__
16
17/* name for platform device */
18#define MG_DEV_NAME "mg_disk"
19
20/* names of GPIO resource */
21#define MG_RST_PIN "mg_rst"
22/* except MG_BOOT_DEV, reset-out pin should be assigned */
23#define MG_RSTOUT_PIN "mg_rstout"
24
25/* device attribution */
26/* use mflash as boot device */
27#define MG_BOOT_DEV (1 << 0)
28/* use mflash as storage device */
29#define MG_STORAGE_DEV (1 << 1)
30/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
31#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
32
33/* private driver data */
34struct mg_drv_data {
35 /* disk resource */
36 u32 use_polling;
37
38 /* device attribution */
39 u32 dev_attr;
40
41 /* internally used */
42 void *host;
43};
44
45#endif
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index beb6ec99cfef..052117744629 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,6 +41,7 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode;
44}; 45};
45 46
46extern int misc_register(struct miscdevice * misc); 47extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ad613ed66ab0..d88d6fc530ad 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -7,7 +7,6 @@
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/mmdebug.h>
11#include <linux/mmzone.h> 10#include <linux/mmzone.h>
12#include <linux/rbtree.h> 11#include <linux/rbtree.h>
13#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
@@ -725,7 +724,7 @@ static inline int shmem_lock(struct file *file, int lock,
725 return 0; 724 return 0;
726} 725}
727#endif 726#endif
728struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 727struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
729 728
730int shmem_zero_setup(struct vm_area_struct *); 729int shmem_zero_setup(struct vm_area_struct *);
731 730
@@ -793,6 +792,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
793 struct vm_area_struct *vma); 792 struct vm_area_struct *vma);
794void unmap_mapping_range(struct address_space *mapping, 793void unmap_mapping_range(struct address_space *mapping,
795 loff_t const holebegin, loff_t const holelen, int even_cows); 794 loff_t const holebegin, loff_t const holelen, int even_cows);
795int follow_pfn(struct vm_area_struct *vma, unsigned long address,
796 unsigned long *pfn);
796int follow_phys(struct vm_area_struct *vma, unsigned long address, 797int follow_phys(struct vm_area_struct *vma, unsigned long address,
797 unsigned int flags, unsigned long *prot, resource_size_t *phys); 798 unsigned int flags, unsigned long *prot, resource_size_t *phys);
798int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 799int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
@@ -824,8 +825,11 @@ static inline int handle_mm_fault(struct mm_struct *mm,
824extern int make_pages_present(unsigned long addr, unsigned long end); 825extern int make_pages_present(unsigned long addr, unsigned long end);
825extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 826extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
826 827
827int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 828int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
828 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 829 unsigned long start, int len, int write, int force,
830 struct page **pages, struct vm_area_struct **vmas);
831int get_user_pages_fast(unsigned long start, int nr_pages, int write,
832 struct page **pages);
829 833
830extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 834extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
831extern void do_invalidatepage(struct page *page, unsigned long offset); 835extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -850,19 +854,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
850 unsigned long end, unsigned long newflags); 854 unsigned long end, unsigned long newflags);
851 855
852/* 856/*
853 * get_user_pages_fast provides equivalent functionality to get_user_pages,
854 * operating on current and current->mm (force=0 and doesn't return any vmas).
855 *
856 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
857 * can be made about locking. get_user_pages_fast is to be implemented in a
858 * way that is advantageous (vs get_user_pages()) when the user memory area is
859 * already faulted in and present in ptes. However if the pages have to be
860 * faulted in, it may turn out to be slightly slower).
861 */
862int get_user_pages_fast(unsigned long start, int nr_pages, int write,
863 struct page **pages);
864
865/*
866 * A callback you can register to apply pressure to ageable caches. 857 * A callback you can register to apply pressure to ageable caches.
867 * 858 *
868 * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should 859 * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should
@@ -1061,7 +1052,8 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1061extern void set_dma_reserve(unsigned long new_dma_reserve); 1052extern void set_dma_reserve(unsigned long new_dma_reserve);
1062extern void memmap_init_zone(unsigned long, int, unsigned long, 1053extern void memmap_init_zone(unsigned long, int, unsigned long,
1063 unsigned long, enum memmap_context); 1054 unsigned long, enum memmap_context);
1064extern void setup_per_zone_pages_min(void); 1055extern void setup_per_zone_wmarks(void);
1056extern void calculate_zone_inactive_ratio(struct zone *zone);
1065extern void mem_init(void); 1057extern void mem_init(void);
1066extern void __init mmap_init(void); 1058extern void __init mmap_init(void);
1067extern void show_mem(void); 1059extern void show_mem(void);
@@ -1178,8 +1170,6 @@ void task_dirty_inc(struct task_struct *tsk);
1178#define VM_MAX_READAHEAD 128 /* kbytes */ 1170#define VM_MAX_READAHEAD 128 /* kbytes */
1179#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ 1171#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
1180 1172
1181int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
1182 pgoff_t offset, unsigned long nr_to_read);
1183int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1173int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
1184 pgoff_t offset, unsigned long nr_to_read); 1174 pgoff_t offset, unsigned long nr_to_read);
1185 1175
@@ -1197,6 +1187,9 @@ void page_cache_async_readahead(struct address_space *mapping,
1197 unsigned long size); 1187 unsigned long size);
1198 1188
1199unsigned long max_sane_readahead(unsigned long nr); 1189unsigned long max_sane_readahead(unsigned long nr);
1190unsigned long ra_submit(struct file_ra_state *ra,
1191 struct address_space *mapping,
1192 struct file *filp);
1200 1193
1201/* Do stack extension */ 1194/* Do stack extension */
1202extern int expand_stack(struct vm_area_struct *vma, unsigned long address); 1195extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0e80e26ecf21..7acc8439d9b3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -98,6 +98,14 @@ struct page {
98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
99 unsigned long debug_flags; /* Use atomic bitops on this */ 99 unsigned long debug_flags; /* Use atomic bitops on this */
100#endif 100#endif
101
102#ifdef CONFIG_KMEMCHECK
103 /*
104 * kmemcheck wants to track the status of each byte in a page; this
105 * is a pointer to such a status block. NULL if not tracked.
106 */
107 void *shadow;
108#endif
101}; 109};
102 110
103/* 111/*
@@ -232,6 +240,8 @@ struct mm_struct {
232 240
233 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
234 242
243 s8 oom_adj; /* OOM kill score adjustment (bit shift) */
244
235 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
236 246
237 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index c7211ab6dd4b..39751c8cde9c 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -28,4 +28,12 @@
28#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 28#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
29#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105 29#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105
30 30
31#define SDIO_VENDOR_ID_SIANO 0x039a
32#define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
33#define SDIO_DEVICE_ID_SIANO_NICE 0x0202
34#define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300
35#define SDIO_DEVICE_ID_SIANO_VENICE 0x0301
36#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
37#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
38
31#endif 39#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a47c879e1304..889598537370 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled;
50 50
51static inline int get_pageblock_migratetype(struct page *page) 51static inline int get_pageblock_migratetype(struct page *page)
52{ 52{
53 if (unlikely(page_group_by_mobility_disabled))
54 return MIGRATE_UNMOVABLE;
55
56 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); 53 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
57} 54}
58 55
@@ -86,13 +83,8 @@ enum zone_stat_item {
86 NR_ACTIVE_ANON, /* " " " " " */ 83 NR_ACTIVE_ANON, /* " " " " " */
87 NR_INACTIVE_FILE, /* " " " " " */ 84 NR_INACTIVE_FILE, /* " " " " " */
88 NR_ACTIVE_FILE, /* " " " " " */ 85 NR_ACTIVE_FILE, /* " " " " " */
89#ifdef CONFIG_UNEVICTABLE_LRU
90 NR_UNEVICTABLE, /* " " " " " */ 86 NR_UNEVICTABLE, /* " " " " " */
91 NR_MLOCK, /* mlock()ed pages found and moved off LRU */ 87 NR_MLOCK, /* mlock()ed pages found and moved off LRU */
92#else
93 NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */
94 NR_MLOCK = NR_ACTIVE_FILE,
95#endif
96 NR_ANON_PAGES, /* Mapped anonymous pages */ 88 NR_ANON_PAGES, /* Mapped anonymous pages */
97 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 89 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
98 only modified from process context */ 90 only modified from process context */
@@ -135,11 +127,7 @@ enum lru_list {
135 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, 127 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
136 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, 128 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
137 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, 129 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
138#ifdef CONFIG_UNEVICTABLE_LRU
139 LRU_UNEVICTABLE, 130 LRU_UNEVICTABLE,
140#else
141 LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */
142#endif
143 NR_LRU_LISTS 131 NR_LRU_LISTS
144}; 132};
145 133
@@ -159,13 +147,20 @@ static inline int is_active_lru(enum lru_list l)
159 147
160static inline int is_unevictable_lru(enum lru_list l) 148static inline int is_unevictable_lru(enum lru_list l)
161{ 149{
162#ifdef CONFIG_UNEVICTABLE_LRU
163 return (l == LRU_UNEVICTABLE); 150 return (l == LRU_UNEVICTABLE);
164#else
165 return 0;
166#endif
167} 151}
168 152
153enum zone_watermarks {
154 WMARK_MIN,
155 WMARK_LOW,
156 WMARK_HIGH,
157 NR_WMARK
158};
159
160#define min_wmark_pages(z) (z->watermark[WMARK_MIN])
161#define low_wmark_pages(z) (z->watermark[WMARK_LOW])
162#define high_wmark_pages(z) (z->watermark[WMARK_HIGH])
163
169struct per_cpu_pages { 164struct per_cpu_pages {
170 int count; /* number of pages in the list */ 165 int count; /* number of pages in the list */
171 int high; /* high watermark, emptying needed */ 166 int high; /* high watermark, emptying needed */
@@ -278,7 +273,10 @@ struct zone_reclaim_stat {
278 273
279struct zone { 274struct zone {
280 /* Fields commonly accessed by the page allocator */ 275 /* Fields commonly accessed by the page allocator */
281 unsigned long pages_min, pages_low, pages_high; 276
277 /* zone watermarks, access with *_wmark_pages(zone) macros */
278 unsigned long watermark[NR_WMARK];
279
282 /* 280 /*
283 * We don't know if the memory that we're going to allocate will be freeable 281 * We don't know if the memory that we're going to allocate will be freeable
284 * or/and it will be released eventually, so to avoid totally wasting several 282 * or/and it will be released eventually, so to avoid totally wasting several
@@ -323,9 +321,9 @@ struct zone {
323 321
324 /* Fields commonly accessed by the page reclaim scanner */ 322 /* Fields commonly accessed by the page reclaim scanner */
325 spinlock_t lru_lock; 323 spinlock_t lru_lock;
326 struct { 324 struct zone_lru {
327 struct list_head list; 325 struct list_head list;
328 unsigned long nr_scan; 326 unsigned long nr_saved_scan; /* accumulated for batching */
329 } lru[NR_LRU_LISTS]; 327 } lru[NR_LRU_LISTS];
330 328
331 struct zone_reclaim_stat reclaim_stat; 329 struct zone_reclaim_stat reclaim_stat;
diff --git a/include/linux/module.h b/include/linux/module.h
index a7bc6e7b43a7..098bdb7bfacf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -363,6 +363,12 @@ struct module
363 local_t ref; 363 local_t ref;
364#endif 364#endif
365#endif 365#endif
366
367#ifdef CONFIG_CONSTRUCTORS
368 /* Constructor functions. */
369 ctor_fn_t *ctors;
370 unsigned int num_ctors;
371#endif
366}; 372};
367#ifndef MODULE_ARCH_INIT 373#ifndef MODULE_ARCH_INIT
368#define MODULE_ARCH_INIT {} 374#define MODULE_ARCH_INIT {}
@@ -697,4 +703,21 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
697 703
698#define __MODULE_STRING(x) __stringify(x) 704#define __MODULE_STRING(x) __stringify(x)
699 705
706
707#ifdef CONFIG_GENERIC_BUG
708int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
709 struct module *);
710void module_bug_cleanup(struct module *);
711
712#else /* !CONFIG_GENERIC_BUG */
713
714static inline int module_bug_finalize(const Elf_Ehdr *hdr,
715 const Elf_Shdr *sechdrs,
716 struct module *mod)
717{
718 return 0;
719}
720static inline void module_bug_cleanup(struct module *mod) {}
721#endif /* CONFIG_GENERIC_BUG */
722
700#endif /* _LINUX_MODULE_H */ 723#endif /* _LINUX_MODULE_H */
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index 6316fafe5c2a..6913b71d9ab2 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -132,6 +132,39 @@ struct ubi_device_info {
132 dev_t cdev; 132 dev_t cdev;
133}; 133};
134 134
135/*
136 * enum - volume notification types.
137 * @UBI_VOLUME_ADDED: volume has been added
138 * @UBI_VOLUME_REMOVED: start volume volume
139 * @UBI_VOLUME_RESIZED: volume size has been re-sized
140 * @UBI_VOLUME_RENAMED: volume name has been re-named
141 * @UBI_VOLUME_UPDATED: volume name has been updated
142 *
143 * These constants define which type of event has happened when a volume
144 * notification function is invoked.
145 */
146enum {
147 UBI_VOLUME_ADDED,
148 UBI_VOLUME_REMOVED,
149 UBI_VOLUME_RESIZED,
150 UBI_VOLUME_RENAMED,
151 UBI_VOLUME_UPDATED,
152};
153
154/*
155 * struct ubi_notification - UBI notification description structure.
156 * @di: UBI device description object
157 * @vi: UBI volume description object
158 *
159 * UBI notifiers are called with a pointer to an object of this type. The
160 * object describes the notification. Namely, it provides a description of the
161 * UBI device and UBI volume the notification informs about.
162 */
163struct ubi_notification {
164 struct ubi_device_info di;
165 struct ubi_volume_info vi;
166};
167
135/* UBI descriptor given to users when they open UBI volumes */ 168/* UBI descriptor given to users when they open UBI volumes */
136struct ubi_volume_desc; 169struct ubi_volume_desc;
137 170
@@ -141,6 +174,10 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc,
141struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); 174struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
142struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, 175struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
143 int mode); 176 int mode);
177int ubi_register_volume_notifier(struct notifier_block *nb,
178 int ignore_existing);
179int ubi_unregister_volume_notifier(struct notifier_block *nb);
180
144void ubi_close_volume(struct ubi_volume_desc *desc); 181void ubi_close_volume(struct ubi_volume_desc *desc);
145int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 182int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
146 int len, int check); 183 int len, int check);
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 52b1a76c1b43..d47beef08dfd 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -3,8 +3,23 @@
3 3
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6/* unicode character */ 6/* Unicode has changed over the years. Unicode code points no longer
7typedef __u16 wchar_t; 7 * fit into 16 bits; as of Unicode 5 valid code points range from 0
8 * to 0x10ffff (17 planes, where each plane holds 65536 code points).
9 *
10 * The original decision to represent Unicode characters as 16-bit
11 * wchar_t values is now outdated. But plane 0 still includes the
12 * most commonly used characters, so we will retain it. The newer
13 * 32-bit unicode_t type can be used when it is necessary to
14 * represent the full Unicode character set.
15 */
16
17/* Plane-0 Unicode character */
18typedef u16 wchar_t;
19#define MAX_WCHAR_T 0xffff
20
21/* Arbitrary Unicode character */
22typedef u32 unicode_t;
8 23
9struct nls_table { 24struct nls_table {
10 const char *charset; 25 const char *charset;
@@ -21,6 +36,13 @@ struct nls_table {
21/* this value hold the maximum octet of charset */ 36/* this value hold the maximum octet of charset */
22#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */ 37#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
23 38
39/* Byte order for UTF-16 strings */
40enum utf16_endian {
41 UTF16_HOST_ENDIAN,
42 UTF16_LITTLE_ENDIAN,
43 UTF16_BIG_ENDIAN
44};
45
24/* nls.c */ 46/* nls.c */
25extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
26extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
@@ -28,10 +50,11 @@ extern struct nls_table *load_nls(char *);
28extern void unload_nls(struct nls_table *); 50extern void unload_nls(struct nls_table *);
29extern struct nls_table *load_nls_default(void); 51extern struct nls_table *load_nls_default(void);
30 52
31extern int utf8_mbtowc(wchar_t *, const __u8 *, int); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
32extern int utf8_mbstowcs(wchar_t *, const __u8 *, int); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
33extern int utf8_wctomb(__u8 *, wchar_t, int); 55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs);
34extern int utf8_wcstombs(__u8 *, const wchar_t *, int); 56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen);
35 58
36static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c) 59static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
37{ 60{
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 848025cd7087..829b94b156f2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state)
408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE])
409 409
410extern int nr_node_ids; 410extern int nr_node_ids;
411extern int nr_online_nodes;
412
413static inline void node_set_online(int nid)
414{
415 node_set_state(nid, N_ONLINE);
416 nr_online_nodes = num_node_state(N_ONLINE);
417}
418
419static inline void node_set_offline(int nid)
420{
421 node_clear_state(nid, N_ONLINE);
422 nr_online_nodes = num_node_state(N_ONLINE);
423}
411#else 424#else
412 425
413static inline int node_state(int node, enum node_states state) 426static inline int node_state(int node, enum node_states state)
@@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state)
434#define first_online_node 0 447#define first_online_node 0
435#define next_online_node(nid) (MAX_NUMNODES) 448#define next_online_node(nid) (MAX_NUMNODES)
436#define nr_node_ids 1 449#define nr_node_ids 1
450#define nr_online_nodes 1
437 451
452#define node_set_online(node) node_set_state((node), N_ONLINE)
453#define node_set_offline(node) node_clear_state((node), N_ONLINE)
438#endif 454#endif
439 455
440#define node_online_map node_states[N_ONLINE] 456#define node_online_map node_states[N_ONLINE]
@@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state)
454#define node_online(node) node_state((node), N_ONLINE) 470#define node_online(node) node_state((node), N_ONLINE)
455#define node_possible(node) node_state((node), N_POSSIBLE) 471#define node_possible(node) node_state((node), N_POSSIBLE)
456 472
457#define node_set_online(node) node_set_state((node), N_ONLINE)
458#define node_set_offline(node) node_clear_state((node), N_ONLINE)
459
460#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) 473#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
461#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 474#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
462 475
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 62214c7d2d93..e2e5ce543595 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -95,9 +95,7 @@ enum pageflags {
95 PG_reclaim, /* To be reclaimed asap */ 95 PG_reclaim, /* To be reclaimed asap */
96 PG_buddy, /* Page is free, on buddy lists */ 96 PG_buddy, /* Page is free, on buddy lists */
97 PG_swapbacked, /* Page is backed by RAM/swap */ 97 PG_swapbacked, /* Page is backed by RAM/swap */
98#ifdef CONFIG_UNEVICTABLE_LRU
99 PG_unevictable, /* Page is "unevictable" */ 98 PG_unevictable, /* Page is "unevictable" */
100#endif
101#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 99#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
102 PG_mlocked, /* Page is vma mlocked */ 100 PG_mlocked, /* Page is vma mlocked */
103#endif 101#endif
@@ -120,7 +118,6 @@ enum pageflags {
120 PG_savepinned = PG_dirty, 118 PG_savepinned = PG_dirty,
121 119
122 /* SLOB */ 120 /* SLOB */
123 PG_slob_page = PG_active,
124 PG_slob_free = PG_private, 121 PG_slob_free = PG_private,
125 122
126 /* SLUB */ 123 /* SLUB */
@@ -203,7 +200,6 @@ PAGEFLAG(SavePinned, savepinned); /* Xen */
203PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 200PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
204PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 201PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
205 202
206__PAGEFLAG(SlobPage, slob_page)
207__PAGEFLAG(SlobFree, slob_free) 203__PAGEFLAG(SlobFree, slob_free)
208 204
209__PAGEFLAG(SlubFrozen, slub_frozen) 205__PAGEFLAG(SlubFrozen, slub_frozen)
@@ -248,14 +244,8 @@ PAGEFLAG_FALSE(SwapCache)
248 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache) 244 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
249#endif 245#endif
250 246
251#ifdef CONFIG_UNEVICTABLE_LRU
252PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 247PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
253 TESTCLEARFLAG(Unevictable, unevictable) 248 TESTCLEARFLAG(Unevictable, unevictable)
254#else
255PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
256 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
257 __CLEARPAGEFLAG_NOOP(Unevictable)
258#endif
259 249
260#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 250#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
261#define MLOCK_PAGES 1 251#define MLOCK_PAGES 1
@@ -382,12 +372,6 @@ static inline void __ClearPageTail(struct page *page)
382 372
383#endif /* !PAGEFLAGS_EXTENDED */ 373#endif /* !PAGEFLAGS_EXTENDED */
384 374
385#ifdef CONFIG_UNEVICTABLE_LRU
386#define __PG_UNEVICTABLE (1 << PG_unevictable)
387#else
388#define __PG_UNEVICTABLE 0
389#endif
390
391#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 375#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
392#define __PG_MLOCKED (1 << PG_mlocked) 376#define __PG_MLOCKED (1 << PG_mlocked)
393#else 377#else
@@ -403,7 +387,7 @@ static inline void __ClearPageTail(struct page *page)
403 1 << PG_private | 1 << PG_private_2 | \ 387 1 << PG_private | 1 << PG_private_2 | \
404 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 388 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
405 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 389 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
406 __PG_UNEVICTABLE | __PG_MLOCKED) 390 1 << PG_unevictable | __PG_MLOCKED)
407 391
408/* 392/*
409 * Flags checked when a page is prepped for return by the page allocator. 393 * Flags checked when a page is prepped for return by the page allocator.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 34da5230faab..aec3252afcf5 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -22,9 +22,7 @@ enum mapping_flags {
22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */ 22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
25#ifdef CONFIG_UNEVICTABLE_LRU
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 25 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27#endif
28}; 26};
29 27
30static inline void mapping_set_error(struct address_space *mapping, int error) 28static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -37,8 +35,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
37 } 35 }
38} 36}
39 37
40#ifdef CONFIG_UNEVICTABLE_LRU
41
42static inline void mapping_set_unevictable(struct address_space *mapping) 38static inline void mapping_set_unevictable(struct address_space *mapping)
43{ 39{
44 set_bit(AS_UNEVICTABLE, &mapping->flags); 40 set_bit(AS_UNEVICTABLE, &mapping->flags);
@@ -55,14 +51,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return test_bit(AS_UNEVICTABLE, &mapping->flags); 51 return test_bit(AS_UNEVICTABLE, &mapping->flags);
56 return !!mapping; 52 return !!mapping;
57} 53}
58#else
59static inline void mapping_set_unevictable(struct address_space *mapping) { }
60static inline void mapping_clear_unevictable(struct address_space *mapping) { }
61static inline int mapping_unevictable(struct address_space *mapping)
62{
63 return 0;
64}
65#endif
66 54
67static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 55static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
68{ 56{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 72698d89e767..8e366bb0705f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -124,6 +124,14 @@ typedef int __bitwise pci_power_t;
124#define PCI_UNKNOWN ((pci_power_t __force) 5) 124#define PCI_UNKNOWN ((pci_power_t __force) 5)
125#define PCI_POWER_ERROR ((pci_power_t __force) -1) 125#define PCI_POWER_ERROR ((pci_power_t __force) -1)
126 126
127/* Remember to update this when the list above changes! */
128extern const char *pci_power_names[];
129
130static inline const char *pci_power_name(pci_power_t state)
131{
132 return pci_power_names[1 + (int) state];
133}
134
127#define PCI_PM_D2_DELAY 200 135#define PCI_PM_D2_DELAY 200
128#define PCI_PM_D3_WAIT 10 136#define PCI_PM_D3_WAIT 10
129#define PCI_PM_BUS_WAIT 50 137#define PCI_PM_BUS_WAIT 50
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3435c1f3effa..a3b000365795 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -104,6 +104,7 @@
104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
107#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330
107#define PCI_CLASS_SERIAL_FIBER 0x0c04 108#define PCI_CLASS_SERIAL_FIBER 0x0c04
108#define PCI_CLASS_SERIAL_SMBUS 0x0c05 109#define PCI_CLASS_SERIAL_SMBUS 0x0c05
109 110
@@ -2253,6 +2254,8 @@
2253#define PCI_DEVICE_ID_MPC8547E 0x0018 2254#define PCI_DEVICE_ID_MPC8547E 0x0018
2254#define PCI_DEVICE_ID_MPC8545E 0x0019 2255#define PCI_DEVICE_ID_MPC8545E 0x0019
2255#define PCI_DEVICE_ID_MPC8545 0x001a 2256#define PCI_DEVICE_ID_MPC8545 0x001a
2257#define PCI_DEVICE_ID_MPC8569E 0x0061
2258#define PCI_DEVICE_ID_MPC8569 0x0060
2256#define PCI_DEVICE_ID_MPC8568E 0x0020 2259#define PCI_DEVICE_ID_MPC8568E 0x0020
2257#define PCI_DEVICE_ID_MPC8568 0x0021 2260#define PCI_DEVICE_ID_MPC8568 0x0021
2258#define PCI_DEVICE_ID_MPC8567E 0x0022 2261#define PCI_DEVICE_ID_MPC8567E 0x0022
@@ -2265,6 +2268,8 @@
2265#define PCI_DEVICE_ID_MPC8572 0x0041 2268#define PCI_DEVICE_ID_MPC8572 0x0041
2266#define PCI_DEVICE_ID_MPC8536E 0x0050 2269#define PCI_DEVICE_ID_MPC8536E 0x0050
2267#define PCI_DEVICE_ID_MPC8536 0x0051 2270#define PCI_DEVICE_ID_MPC8536 0x0051
2271#define PCI_DEVICE_ID_P2020E 0x0070
2272#define PCI_DEVICE_ID_P2020 0x0071
2268#define PCI_DEVICE_ID_MPC8641 0x7010 2273#define PCI_DEVICE_ID_MPC8641 0x7010
2269#define PCI_DEVICE_ID_MPC8641D 0x7011 2274#define PCI_DEVICE_ID_MPC8641D 0x7011
2270#define PCI_DEVICE_ID_MPC8610 0x7018 2275#define PCI_DEVICE_ID_MPC8610 0x7018
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index b67bb5d7b221..8dc5123b6305 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -36,8 +36,8 @@ extern struct device platform_bus;
36 36
37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
38extern int platform_get_irq(struct platform_device *, unsigned int); 38extern int platform_get_irq(struct platform_device *, unsigned int);
39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *); 39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
40extern int platform_get_irq_byname(struct platform_device *, char *); 40extern int platform_get_irq_byname(struct platform_device *, const char *);
41extern int platform_add_devices(struct platform_device **, int); 41extern int platform_add_devices(struct platform_device **, int);
42 42
43extern struct platform_device *platform_device_register_simple(const char *, int id, 43extern struct platform_device *platform_device_register_simple(const char *, int id,
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8c24ef8d9976..fa287f25138d 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -32,6 +32,7 @@ typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_
32 32
33typedef struct poll_table_struct { 33typedef struct poll_table_struct {
34 poll_queue_proc qproc; 34 poll_queue_proc qproc;
35 unsigned long key;
35} poll_table; 36} poll_table;
36 37
37static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 38static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
@@ -43,10 +44,12 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres
43static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 44static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
44{ 45{
45 pt->qproc = qproc; 46 pt->qproc = qproc;
47 pt->key = ~0UL; /* all events enabled */
46} 48}
47 49
48struct poll_table_entry { 50struct poll_table_entry {
49 struct file *filp; 51 struct file *filp;
52 unsigned long key;
50 wait_queue_t wait; 53 wait_queue_t wait;
51 wait_queue_head_t *wait_address; 54 wait_queue_head_t *wait_address;
52}; 55};
diff --git a/include/linux/pps.h b/include/linux/pps.h
new file mode 100644
index 000000000000..cfe5c7214ec6
--- /dev/null
+++ b/include/linux/pps.h
@@ -0,0 +1,122 @@
1/*
2 * PPS API header
3 *
4 * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21
22#ifndef _PPS_H_
23#define _PPS_H_
24
25#define PPS_VERSION "5.3.6"
26#define PPS_MAX_SOURCES 16 /* should be enough... */
27
28/* Implementation note: the logical states ``assert'' and ``clear''
29 * are implemented in terms of the chip register, i.e. ``assert''
30 * means the bit is set. */
31
32/*
33 * 3.2 New data structures
34 */
35
36#define PPS_API_VERS_1 1
37#define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */
38#define PPS_MAX_NAME_LEN 32
39
40/* 32-bit vs. 64-bit compatibility.
41 *
42 * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other
43 * architectures it's 8 bytes. On i386, there will be no padding between the
44 * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct
45 * pps_kparams. But on most platforms there will be padding to ensure correct
46 * alignment.
47 *
48 * The simple fix is probably to add an explicit padding.
49 * [David Woodhouse]
50 */
51struct pps_ktime {
52 __s64 sec;
53 __s32 nsec;
54 __u32 flags;
55};
56#define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */
57
58struct pps_kinfo {
59 __u32 assert_sequence; /* seq. num. of assert event */
60 __u32 clear_sequence; /* seq. num. of clear event */
61 struct pps_ktime assert_tu; /* time of assert event */
62 struct pps_ktime clear_tu; /* time of clear event */
63 int current_mode; /* current mode bits */
64};
65
66struct pps_kparams {
67 int api_version; /* API version # */
68 int mode; /* mode bits */
69 struct pps_ktime assert_off_tu; /* offset compensation for assert */
70 struct pps_ktime clear_off_tu; /* offset compensation for clear */
71};
72
73/*
74 * 3.3 Mode bit definitions
75 */
76
77/* Device/implementation parameters */
78#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
79#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
80#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
81
82#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
83#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
84
85#define PPS_CANWAIT 0x100 /* can we wait for an event? */
86#define PPS_CANPOLL 0x200 /* bit reserved for future use */
87
88/* Kernel actions */
89#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
90#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
91
92/* Timestamp formats */
93#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
94#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
95
96/*
97 * 3.4.4 New functions: disciplining the kernel timebase
98 */
99
100/* Kernel consumers */
101#define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */
102#define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to
103 use a phase-locked loop */
104#define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to
105 use a frequency-locked loop */
106/*
107 * Here begins the implementation-specific part!
108 */
109
110struct pps_fdata {
111 struct pps_kinfo info;
112 struct pps_ktime timeout;
113};
114
115#include <linux/ioctl.h>
116
117#define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *)
118#define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *)
119#define PPS_GETCAP _IOR('p', 0xa3, int *)
120#define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *)
121
122#endif /* _PPS_H_ */
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
new file mode 100644
index 000000000000..e0a193f830ef
--- /dev/null
+++ b/include/linux/pps_kernel.h
@@ -0,0 +1,89 @@
1/*
2 * PPS API kernel header
3 *
4 * Copyright (C) 2009 Rodolfo Giometti <giometti@linux.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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <linux/pps.h>
22
23#include <linux/cdev.h>
24#include <linux/device.h>
25#include <linux/time.h>
26
27/*
28 * Global defines
29 */
30
31/* The specific PPS source info */
32struct pps_source_info {
33 char name[PPS_MAX_NAME_LEN]; /* simbolic name */
34 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
35 int mode; /* PPS's allowed mode */
36
37 void (*echo)(int source, int event, void *data); /* PPS echo function */
38
39 struct module *owner;
40 struct device *dev;
41};
42
43/* The main struct */
44struct pps_device {
45 struct pps_source_info info; /* PSS source info */
46
47 struct pps_kparams params; /* PPS's current params */
48
49 __u32 assert_sequence; /* PPS' assert event seq # */
50 __u32 clear_sequence; /* PPS' clear event seq # */
51 struct pps_ktime assert_tu;
52 struct pps_ktime clear_tu;
53 int current_mode; /* PPS mode at event time */
54
55 int go; /* PPS event is arrived? */
56 wait_queue_head_t queue; /* PPS event queue */
57
58 unsigned int id; /* PPS source unique ID */
59 struct cdev cdev;
60 struct device *dev;
61 int devno;
62 struct fasync_struct *async_queue; /* fasync method */
63 spinlock_t lock;
64
65 atomic_t usage; /* usage count */
66};
67
68/*
69 * Global variables
70 */
71
72extern spinlock_t pps_idr_lock;
73extern struct idr pps_idr;
74extern struct timespec pps_irq_ts[];
75
76extern struct device_attribute pps_attrs[];
77
78/*
79 * Exported functions
80 */
81
82struct pps_device *pps_get_source(int source);
83extern void pps_put_source(struct pps_device *pps);
84extern int pps_register_source(struct pps_source_info *info,
85 int default_params);
86extern void pps_unregister_source(int source);
87extern int pps_register_cdev(struct pps_device *pps);
88extern void pps_unregister_cdev(struct pps_device *pps);
89extern void pps_event(int source, struct pps_ktime *ts, int event, void *data);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 59e133d39d50..7456d7d87a19 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -81,7 +81,6 @@
81 81
82 82
83extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 83extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
84extern struct task_struct *ptrace_get_task_struct(pid_t pid);
85extern int ptrace_traceme(void); 84extern int ptrace_traceme(void);
86extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 85extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
87extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 86extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 355f6e80db0d..c5da74918096 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items); 167 unsigned long first_index, unsigned int max_items);
168unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
169 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
170unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
171 unsigned long index, unsigned long max_scan);
170int radix_tree_preload(gfp_t gfp_mask); 172int radix_tree_preload(gfp_t gfp_mask);
171void radix_tree_init(void); 173void radix_tree_init(void);
172void *radix_tree_tag_set(struct radix_tree_root *root, 174void *radix_tree_tag_set(struct radix_tree_root *root,
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 6ba830fa8538..ffa2efbbe382 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -232,7 +232,7 @@ struct mdp_superblock_1 {
232 __le64 reshape_position; /* next address in array-space for reshape */ 232 __le64 reshape_position; /* next address in array-space for reshape */
233 __le32 delta_disks; /* change in number of raid_disks */ 233 __le32 delta_disks; /* change in number of raid_disks */
234 __le32 new_layout; /* new layout */ 234 __le32 new_layout; /* new layout */
235 __le32 new_chunk; /* new chunk size (bytes) */ 235 __le32 new_chunk; /* new chunk size (512byte sectors) */
236 __u8 pad1[128-124]; /* set to 0 when written */ 236 __u8 pad1[128-124]; /* set to 0 when written */
237 237
238 /* constant this-device information - 64 bytes */ 238 /* constant this-device information - 64 bytes */
diff --git a/include/linux/regulator/lp3971.h b/include/linux/regulator/lp3971.h
new file mode 100644
index 000000000000..61401649fe7d
--- /dev/null
+++ b/include/linux/regulator/lp3971.h
@@ -0,0 +1,51 @@
1/*
2 * National Semiconductors LP3971 PMIC chip client interface
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Author: Marek Szyprowski <m.szyprowski@samsung.com>
6 *
7 * Based on wm8400.h
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef __LINUX_REGULATOR_LP3971_H
25#define __LINUX_REGULATOR_LP3971_H
26
27#include <linux/regulator/machine.h>
28
29#define LP3971_LDO1 0
30#define LP3971_LDO2 1
31#define LP3971_LDO3 2
32#define LP3971_LDO4 3
33#define LP3971_LDO5 4
34
35#define LP3971_DCDC1 5
36#define LP3971_DCDC2 6
37#define LP3971_DCDC3 7
38
39#define LP3971_NUM_REGULATORS 8
40
41struct lp3971_regulator_subdev {
42 int id;
43 struct regulator_init_data *initdata;
44};
45
46struct lp3971_platform_data {
47 int num_regulators;
48 struct lp3971_regulator_subdev *regulators;
49};
50
51#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
new file mode 100644
index 000000000000..44563192bf16
--- /dev/null
+++ b/include/linux/regulator/max1586.h
@@ -0,0 +1,63 @@
1/*
2 * max1586.h -- Voltage regulation for the Maxim 1586
3 *
4 * Copyright (C) 2008 Robert Jarzmik
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef REGULATOR_MAX1586
22#define REGULATOR_MAX1586
23
24#include <linux/regulator/machine.h>
25
26#define MAX1586_V3 0
27#define MAX1586_V6 1
28
29/* precalculated values for v3_gain */
30#define MAX1586_GAIN_NO_R24 1000000 /* 700000 .. 1475000 mV */
31#define MAX1586_GAIN_R24_3k32 1051098 /* 735768 .. 1550369 mV */
32#define MAX1586_GAIN_R24_5k11 1078648 /* 755053 .. 1591005 mV */
33#define MAX1586_GAIN_R24_7k5 1115432 /* 780802 .. 1645262 mV */
34
35/**
36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...)
40 */
41struct max1586_subdev_data {
42 int id;
43 char *name;
44 struct regulator_init_data *platform_data;
45};
46
47/**
48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2)
50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
53 * This can be calculated as ((1 + R24/R25 + R24/185.5kOhm) * 1e6)
54 * for an external resistor configuration as described in the
55 * data sheet (R25=100kOhm).
56 */
57struct max1586_platform_data {
58 int num_subdevs;
59 struct max1586_subdev_data *subdevs;
60 int v3_gain;
61};
62
63#endif
diff --git a/include/linux/regulator/userspace-consumer.h b/include/linux/regulator/userspace-consumer.h
new file mode 100644
index 000000000000..b4554ce9d4bb
--- /dev/null
+++ b/include/linux/regulator/userspace-consumer.h
@@ -0,0 +1,25 @@
1#ifndef __REGULATOR_PLATFORM_CONSUMER_H_
2#define __REGULATOR_PLATFORM_CONSUMER_H_
3
4struct regulator_consumer_supply;
5
6/**
7 * struct regulator_userspace_consumer_data - line consumer
8 * initialisation data.
9 *
10 * @name: Name for the consumer line
11 * @num_supplies: Number of supplies feeding the line
12 * @supplies: Supplies configuration.
13 * @init_on: Set if the regulators supplying the line should be
14 * enabled during initialisation
15 */
16struct regulator_userspace_consumer_data {
17 const char *name;
18
19 int num_supplies;
20 struct regulator_bulk_data *supplies;
21
22 bool init_on;
23};
24
25#endif /* __REGULATOR_PLATFORM_CONSUMER_H_ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 2245c78d5876..dd31e7bae35c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -660,23 +660,54 @@ static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
660 cpu_to_le32(type2uniqueness(type))) 660 cpu_to_le32(type2uniqueness(type)))
661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); 661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
662} 662}
663
663static inline void set_le_ih_k_type(struct item_head *ih, int type) 664static inline void set_le_ih_k_type(struct item_head *ih, int type)
664{ 665{
665 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); 666 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
666} 667}
667 668
668#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) 669static inline int is_direntry_le_key(int version, struct reiserfs_key *key)
669#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) 670{
670#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) 671 return le_key_k_type(version, key) == TYPE_DIRENTRY;
671#define is_statdata_le_key(version,key) (le_key_k_type (version, key) == TYPE_STAT_DATA) 672}
673
674static inline int is_direct_le_key(int version, struct reiserfs_key *key)
675{
676 return le_key_k_type(version, key) == TYPE_DIRECT;
677}
678
679static inline int is_indirect_le_key(int version, struct reiserfs_key *key)
680{
681 return le_key_k_type(version, key) == TYPE_INDIRECT;
682}
683
684static inline int is_statdata_le_key(int version, struct reiserfs_key *key)
685{
686 return le_key_k_type(version, key) == TYPE_STAT_DATA;
687}
672 688
673// 689//
674// item header has version. 690// item header has version.
675// 691//
676#define is_direntry_le_ih(ih) is_direntry_le_key (ih_version (ih), &((ih)->ih_key)) 692static inline int is_direntry_le_ih(struct item_head *ih)
677#define is_direct_le_ih(ih) is_direct_le_key (ih_version (ih), &((ih)->ih_key)) 693{
678#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) 694 return is_direntry_le_key(ih_version(ih), &ih->ih_key);
679#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) 695}
696
697static inline int is_direct_le_ih(struct item_head *ih)
698{
699 return is_direct_le_key(ih_version(ih), &ih->ih_key);
700}
701
702static inline int is_indirect_le_ih(struct item_head *ih)
703{
704 return is_indirect_le_key(ih_version(ih), &ih->ih_key);
705}
706
707static inline int is_statdata_le_ih(struct item_head *ih)
708{
709 return is_statdata_le_key(ih_version(ih), &ih->ih_key);
710}
680 711
681// 712//
682// key is pointer to cpu key, result is cpu 713// key is pointer to cpu key, result is cpu
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 4c5bcf6ca7e8..511f42fc6816 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -49,6 +49,8 @@ struct res_counter {
49 struct res_counter *parent; 49 struct res_counter *parent;
50}; 50};
51 51
52#define RESOURCE_MAX (unsigned long long)LLONG_MAX
53
52/** 54/**
53 * Helpers to interact with userspace 55 * Helpers to interact with userspace
54 * res_counter_read_u64() - returns the value of the specified member. 56 * res_counter_read_u64() - returns the value of the specified member.
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 8670f1575fe1..29f8599e6bea 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_RING_BUFFER_H 1#ifndef _LINUX_RING_BUFFER_H
2#define _LINUX_RING_BUFFER_H 2#define _LINUX_RING_BUFFER_H
3 3
4#include <linux/kmemcheck.h>
4#include <linux/mm.h> 5#include <linux/mm.h>
5#include <linux/seq_file.h> 6#include <linux/seq_file.h>
6 7
@@ -11,7 +12,10 @@ struct ring_buffer_iter;
11 * Don't refer to this struct directly, use functions below. 12 * Don't refer to this struct directly, use functions below.
12 */ 13 */
13struct ring_buffer_event { 14struct ring_buffer_event {
15 kmemcheck_bitfield_begin(bitfield);
14 u32 type_len:5, time_delta:27; 16 u32 type_len:5, time_delta:27;
17 kmemcheck_bitfield_end(bitfield);
18
15 u32 array[]; 19 u32 array[];
16}; 20};
17 21
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b35bc0e19cd9..216d024f830d 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma,
83/* 83/*
84 * Called from mm/vmscan.c to handle paging out 84 * Called from mm/vmscan.c to handle paging out
85 */ 85 */
86int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt); 86int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags);
87int try_to_unmap(struct page *, int ignore_refs); 88int try_to_unmap(struct page *, int ignore_refs);
88 89
89/* 90/*
@@ -105,18 +106,11 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 */ 106 */
106int page_mkclean(struct page *); 107int page_mkclean(struct page *);
107 108
108#ifdef CONFIG_UNEVICTABLE_LRU
109/* 109/*
110 * called in munlock()/munmap() path to check for other vmas holding 110 * called in munlock()/munmap() path to check for other vmas holding
111 * the page mlocked. 111 * the page mlocked.
112 */ 112 */
113int try_to_munlock(struct page *); 113int try_to_munlock(struct page *);
114#else
115static inline int try_to_munlock(struct page *page)
116{
117 return 0; /* a.k.a. SWAP_SUCCESS */
118}
119#endif
120 114
121#else /* !CONFIG_MMU */ 115#else /* !CONFIG_MMU */
122 116
@@ -124,7 +118,7 @@ static inline int try_to_munlock(struct page *page)
124#define anon_vma_prepare(vma) (0) 118#define anon_vma_prepare(vma) (0)
125#define anon_vma_link(vma) do {} while (0) 119#define anon_vma_link(vma) do {} while (0)
126 120
127#define page_referenced(page,l,cnt) TestClearPageReferenced(page) 121#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
128#define try_to_unmap(page, refs) SWAP_FAIL 122#define try_to_unmap(page, refs) SWAP_FAIL
129 123
130static inline int page_mkclean(struct page *page) 124static inline int page_mkclean(struct page *page)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fea9d188dbff..4d0754269884 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -92,7 +92,6 @@ struct sched_param {
92 92
93#include <asm/processor.h> 93#include <asm/processor.h>
94 94
95struct mem_cgroup;
96struct exec_domain; 95struct exec_domain;
97struct futex_pi_state; 96struct futex_pi_state;
98struct robust_list_head; 97struct robust_list_head;
@@ -261,6 +260,7 @@ extern void task_rq_unlock_wait(struct task_struct *p);
261extern cpumask_var_t nohz_cpu_mask; 260extern cpumask_var_t nohz_cpu_mask;
262#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 261#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
263extern int select_nohz_load_balancer(int cpu); 262extern int select_nohz_load_balancer(int cpu);
263extern int get_nohz_load_balancer(void);
264#else 264#else
265static inline int select_nohz_load_balancer(int cpu) 265static inline int select_nohz_load_balancer(int cpu)
266{ 266{
@@ -673,7 +673,7 @@ struct user_struct {
673 struct task_group *tg; 673 struct task_group *tg;
674#ifdef CONFIG_SYSFS 674#ifdef CONFIG_SYSFS
675 struct kobject kobj; 675 struct kobject kobj;
676 struct work_struct work; 676 struct delayed_work work;
677#endif 677#endif
678#endif 678#endif
679 679
@@ -1177,7 +1177,6 @@ struct task_struct {
1177 * a short time 1177 * a short time
1178 */ 1178 */
1179 unsigned char fpu_counter; 1179 unsigned char fpu_counter;
1180 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1181#ifdef CONFIG_BLK_DEV_IO_TRACE 1180#ifdef CONFIG_BLK_DEV_IO_TRACE
1182 unsigned int btrace_seq; 1181 unsigned int btrace_seq;
1183#endif 1182#endif
@@ -1317,7 +1316,8 @@ struct task_struct {
1317/* Thread group tracking */ 1316/* Thread group tracking */
1318 u32 parent_exec_id; 1317 u32 parent_exec_id;
1319 u32 self_exec_id; 1318 u32 self_exec_id;
1320/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1319/* Protection of (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed,
1320 * mempolicy */
1321 spinlock_t alloc_lock; 1321 spinlock_t alloc_lock;
1322 1322
1323#ifdef CONFIG_GENERIC_HARDIRQS 1323#ifdef CONFIG_GENERIC_HARDIRQS
@@ -1385,8 +1385,7 @@ struct task_struct {
1385 cputime_t acct_timexpd; /* stime + utime since last update */ 1385 cputime_t acct_timexpd; /* stime + utime since last update */
1386#endif 1386#endif
1387#ifdef CONFIG_CPUSETS 1387#ifdef CONFIG_CPUSETS
1388 nodemask_t mems_allowed; 1388 nodemask_t mems_allowed; /* Protected by alloc_lock */
1389 int cpuset_mems_generation;
1390 int cpuset_mem_spread_rotor; 1389 int cpuset_mem_spread_rotor;
1391#endif 1390#endif
1392#ifdef CONFIG_CGROUPS 1391#ifdef CONFIG_CGROUPS
@@ -1409,7 +1408,7 @@ struct task_struct {
1409 struct list_head perf_counter_list; 1408 struct list_head perf_counter_list;
1410#endif 1409#endif
1411#ifdef CONFIG_NUMA 1410#ifdef CONFIG_NUMA
1412 struct mempolicy *mempolicy; 1411 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1413 short il_next; 1412 short il_next;
1414#endif 1413#endif
1415 atomic_t fs_excl; /* holding fs exclusive resources */ 1414 atomic_t fs_excl; /* holding fs exclusive resources */
@@ -1796,11 +1795,23 @@ extern unsigned int sysctl_sched_child_runs_first;
1796extern unsigned int sysctl_sched_features; 1795extern unsigned int sysctl_sched_features;
1797extern unsigned int sysctl_sched_migration_cost; 1796extern unsigned int sysctl_sched_migration_cost;
1798extern unsigned int sysctl_sched_nr_migrate; 1797extern unsigned int sysctl_sched_nr_migrate;
1798extern unsigned int sysctl_timer_migration;
1799 1799
1800int sched_nr_latency_handler(struct ctl_table *table, int write, 1800int sched_nr_latency_handler(struct ctl_table *table, int write,
1801 struct file *file, void __user *buffer, size_t *length, 1801 struct file *file, void __user *buffer, size_t *length,
1802 loff_t *ppos); 1802 loff_t *ppos);
1803#endif 1803#endif
1804#ifdef CONFIG_SCHED_DEBUG
1805static inline unsigned int get_sysctl_timer_migration(void)
1806{
1807 return sysctl_timer_migration;
1808}
1809#else
1810static inline unsigned int get_sysctl_timer_migration(void)
1811{
1812 return 1;
1813}
1814#endif
1804extern unsigned int sysctl_sched_rt_period; 1815extern unsigned int sysctl_sched_rt_period;
1805extern int sysctl_sched_rt_runtime; 1816extern int sysctl_sched_rt_runtime;
1806 1817
@@ -1867,9 +1878,6 @@ extern struct pid_namespace init_pid_ns;
1867/* 1878/*
1868 * find a task by one of its numerical ids 1879 * find a task by one of its numerical ids
1869 * 1880 *
1870 * find_task_by_pid_type_ns():
1871 * it is the most generic call - it finds a task by all id,
1872 * type and namespace specified
1873 * find_task_by_pid_ns(): 1881 * find_task_by_pid_ns():
1874 * finds a task by its pid in the specified namespace 1882 * finds a task by its pid in the specified namespace
1875 * find_task_by_vpid(): 1883 * find_task_by_vpid():
@@ -1878,9 +1886,6 @@ extern struct pid_namespace init_pid_ns;
1878 * see also find_vpid() etc in include/linux/pid.h 1886 * see also find_vpid() etc in include/linux/pid.h
1879 */ 1887 */
1880 1888
1881extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1882 struct pid_namespace *ns);
1883
1884extern struct task_struct *find_task_by_vpid(pid_t nr); 1889extern struct task_struct *find_task_by_vpid(pid_t nr);
1885extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1890extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1886 struct pid_namespace *ns); 1891 struct pid_namespace *ns);
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 004f3b3342c5..0c6a86b79596 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -43,6 +43,7 @@ int seq_release(struct inode *, struct file *);
43int seq_escape(struct seq_file *, const char *, const char *); 43int seq_escape(struct seq_file *, const char *, const char *);
44int seq_putc(struct seq_file *m, char c); 44int seq_putc(struct seq_file *m, char c);
45int seq_puts(struct seq_file *m, const char *s); 45int seq_puts(struct seq_file *m, const char *s);
46int seq_write(struct seq_file *seq, const void *data, size_t len);
46 47
47int seq_printf(struct seq_file *, const char *, ...) 48int seq_printf(struct seq_file *, const char *, ...)
48 __attribute__ ((format (printf,2,3))); 49 __attribute__ ((format (printf,2,3)));
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 3d289367aae9..b47b3f039d14 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -15,6 +15,7 @@
15#define _LINUX_SKBUFF_H 15#define _LINUX_SKBUFF_H
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kmemcheck.h>
18#include <linux/compiler.h> 19#include <linux/compiler.h>
19#include <linux/time.h> 20#include <linux/time.h>
20#include <linux/cache.h> 21#include <linux/cache.h>
@@ -343,6 +344,7 @@ struct sk_buff {
343 }; 344 };
344 }; 345 };
345 __u32 priority; 346 __u32 priority;
347 kmemcheck_bitfield_begin(flags1);
346 __u8 local_df:1, 348 __u8 local_df:1,
347 cloned:1, 349 cloned:1,
348 ip_summed:2, 350 ip_summed:2,
@@ -353,6 +355,7 @@ struct sk_buff {
353 ipvs_property:1, 355 ipvs_property:1,
354 peeked:1, 356 peeked:1,
355 nf_trace:1; 357 nf_trace:1;
358 kmemcheck_bitfield_end(flags1);
356 __be16 protocol; 359 __be16 protocol;
357 360
358 void (*destructor)(struct sk_buff *skb); 361 void (*destructor)(struct sk_buff *skb);
@@ -372,12 +375,16 @@ struct sk_buff {
372 __u16 tc_verd; /* traffic control verdict */ 375 __u16 tc_verd; /* traffic control verdict */
373#endif 376#endif
374#endif 377#endif
378
379 kmemcheck_bitfield_begin(flags2);
375#ifdef CONFIG_IPV6_NDISC_NODETYPE 380#ifdef CONFIG_IPV6_NDISC_NODETYPE
376 __u8 ndisc_nodetype:2; 381 __u8 ndisc_nodetype:2;
377#endif 382#endif
378#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
379 __u8 do_not_encrypt:1; 384 __u8 do_not_encrypt:1;
380#endif 385#endif
386 kmemcheck_bitfield_end(flags2);
387
381 /* 0/13/14 bit hole */ 388 /* 0/13/14 bit hole */
382 389
383#ifdef CONFIG_NET_DMA 390#ifdef CONFIG_NET_DMA
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 219b8fb4651d..2da8372519f5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -64,6 +64,13 @@
64 64
65#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ 65#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */
66 66
67/* Don't track use of uninitialized memory */
68#ifdef CONFIG_KMEMCHECK
69# define SLAB_NOTRACK 0x01000000UL
70#else
71# define SLAB_NOTRACK 0x00000000UL
72#endif
73
67/* The following flags affect the page allocator grouping pages by mobility */ 74/* The following flags affect the page allocator grouping pages by mobility */
68#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 75#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
69#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 76#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 713f841ecaa9..850d057500de 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -16,6 +16,87 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h> 17#include <linux/kmemtrace.h>
18 18
19/*
20 * struct kmem_cache
21 *
22 * manages a cache.
23 */
24
25struct kmem_cache {
26/* 1) per-cpu data, touched during every alloc/free */
27 struct array_cache *array[NR_CPUS];
28/* 2) Cache tunables. Protected by cache_chain_mutex */
29 unsigned int batchcount;
30 unsigned int limit;
31 unsigned int shared;
32
33 unsigned int buffer_size;
34 u32 reciprocal_buffer_size;
35/* 3) touched by every alloc & free from the backend */
36
37 unsigned int flags; /* constant flags */
38 unsigned int num; /* # of objs per slab */
39
40/* 4) cache_grow/shrink */
41 /* order of pgs per slab (2^n) */
42 unsigned int gfporder;
43
44 /* force GFP flags, e.g. GFP_DMA */
45 gfp_t gfpflags;
46
47 size_t colour; /* cache colouring range */
48 unsigned int colour_off; /* colour offset */
49 struct kmem_cache *slabp_cache;
50 unsigned int slab_size;
51 unsigned int dflags; /* dynamic flags */
52
53 /* constructor func */
54 void (*ctor)(void *obj);
55
56/* 5) cache creation/removal */
57 const char *name;
58 struct list_head next;
59
60/* 6) statistics */
61#ifdef CONFIG_DEBUG_SLAB
62 unsigned long num_active;
63 unsigned long num_allocations;
64 unsigned long high_mark;
65 unsigned long grown;
66 unsigned long reaped;
67 unsigned long errors;
68 unsigned long max_freeable;
69 unsigned long node_allocs;
70 unsigned long node_frees;
71 unsigned long node_overflow;
72 atomic_t allochit;
73 atomic_t allocmiss;
74 atomic_t freehit;
75 atomic_t freemiss;
76
77 /*
78 * If debugging is enabled, then the allocator can add additional
79 * fields and/or padding to every object. buffer_size contains the total
80 * object size including these internal fields, the following two
81 * variables contain the offset to the user object and its size.
82 */
83 int obj_offset;
84 int obj_size;
85#endif /* CONFIG_DEBUG_SLAB */
86
87 /*
88 * We put nodelists[] at the end of kmem_cache, because we want to size
89 * this array to nr_node_ids slots instead of MAX_NUMNODES
90 * (see kmem_cache_init())
91 * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache
92 * is statically defined, so we reserve the max number of nodes.
93 */
94 struct kmem_list3 *nodelists[MAX_NUMNODES];
95 /*
96 * Do not add fields after nodelists[]
97 */
98};
99
19/* Size description struct for general caches. */ 100/* Size description struct for general caches. */
20struct cache_sizes { 101struct cache_sizes {
21 size_t cs_size; 102 size_t cs_size;
diff --git a/include/linux/smp.h b/include/linux/smp.h
index a69db820eed6..9e3d8af09207 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -177,7 +177,6 @@ static inline void init_call_single_data(void)
177 177
178#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) 178#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
179#define put_cpu() preempt_enable() 179#define put_cpu() preempt_enable()
180#define put_cpu_no_resched() preempt_enable_no_resched()
181 180
182/* 181/*
183 * Callback to arch code if there's nosmp or maxcpus=0 on the 182 * Callback to arch code if there's nosmp or maxcpus=0 on the
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a0faa18f7b1b..9c4cd27f4685 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -245,6 +245,9 @@ struct spi_master {
245 */ 245 */
246 u16 dma_alignment; 246 u16 dma_alignment;
247 247
248 /* spi_device.mode flags understood by this controller driver */
249 u16 mode_bits;
250
248 /* Setup mode and clock, etc (spi driver may call many times). 251 /* Setup mode and clock, etc (spi driver may call many times).
249 * 252 *
250 * IMPORTANT: this may be called when transfers to another 253 * IMPORTANT: this may be called when transfers to another
@@ -523,30 +526,7 @@ static inline void spi_message_free(struct spi_message *m)
523 kfree(m); 526 kfree(m);
524} 527}
525 528
526/** 529extern int spi_setup(struct spi_device *spi);
527 * spi_setup - setup SPI mode and clock rate
528 * @spi: the device whose settings are being modified
529 * Context: can sleep, and no requests are queued to the device
530 *
531 * SPI protocol drivers may need to update the transfer mode if the
532 * device doesn't work with its default. They may likewise need
533 * to update clock rates or word sizes from initial values. This function
534 * changes those settings, and must be called from a context that can sleep.
535 * Except for SPI_CS_HIGH, which takes effect immediately, the changes take
536 * effect the next time the device is selected and data is transferred to
537 * or from it. When this function returns, the spi device is deselected.
538 *
539 * Note that this call will fail if the protocol driver specifies an option
540 * that the underlying controller or its driver does not support. For
541 * example, not all hardware supports wire transfers using nine bit words,
542 * LSB-first wire encoding, or active-high chipselects.
543 */
544static inline int
545spi_setup(struct spi_device *spi)
546{
547 return spi->master->setup(spi);
548}
549
550 530
551/** 531/**
552 * spi_async - asynchronous SPI transfer 532 * spi_async - asynchronous SPI transfer
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 1a8cecc4f38c..51efbef38fb0 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -4,6 +4,8 @@
4struct task_struct; 4struct task_struct;
5 5
6#ifdef CONFIG_STACKTRACE 6#ifdef CONFIG_STACKTRACE
7struct task_struct;
8
7struct stack_trace { 9struct stack_trace {
8 unsigned int nr_entries, max_entries; 10 unsigned int nr_entries, max_entries;
9 unsigned long *entries; 11 unsigned long *entries;
@@ -11,6 +13,7 @@ struct stack_trace {
11}; 13};
12 14
13extern void save_stack_trace(struct stack_trace *trace); 15extern void save_stack_trace(struct stack_trace *trace);
16extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp);
14extern void save_stack_trace_tsk(struct task_struct *tsk, 17extern void save_stack_trace_tsk(struct task_struct *tsk,
15 struct stack_trace *trace); 18 struct stack_trace *trace);
16 19
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d476aad3ff57..c88b36665f79 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -129,9 +129,10 @@ enum {
129 129
130#define SWAP_CLUSTER_MAX 32 130#define SWAP_CLUSTER_MAX 32
131 131
132#define SWAP_MAP_MAX 0x7fff 132#define SWAP_MAP_MAX 0x7ffe
133#define SWAP_MAP_BAD 0x8000 133#define SWAP_MAP_BAD 0x7fff
134 134#define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */
135#define SWAP_COUNT_MASK (~SWAP_HAS_CACHE)
135/* 136/*
136 * The in-memory structure used to track swap areas. 137 * The in-memory structure used to track swap areas.
137 */ 138 */
@@ -235,7 +236,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
235} 236}
236#endif 237#endif
237 238
238#ifdef CONFIG_UNEVICTABLE_LRU
239extern int page_evictable(struct page *page, struct vm_area_struct *vma); 239extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 240extern void scan_mapping_unevictable_pages(struct address_space *);
241 241
@@ -244,24 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
244 void __user *, size_t *, loff_t *); 244 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 245extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 246extern void scan_unevictable_unregister_node(struct node *node);
247#else
248static inline int page_evictable(struct page *page,
249 struct vm_area_struct *vma)
250{
251 return 1;
252}
253
254static inline void scan_mapping_unevictable_pages(struct address_space *mapping)
255{
256}
257
258static inline int scan_unevictable_register_node(struct node *node)
259{
260 return 0;
261}
262
263static inline void scan_unevictable_unregister_node(struct node *node) { }
264#endif
265 247
266extern int kswapd_run(int nid); 248extern int kswapd_run(int nid);
267 249
@@ -274,7 +256,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
274 256
275#ifdef CONFIG_SWAP 257#ifdef CONFIG_SWAP
276/* linux/mm/page_io.c */ 258/* linux/mm/page_io.c */
277extern int swap_readpage(struct file *, struct page *); 259extern int swap_readpage(struct page *);
278extern int swap_writepage(struct page *page, struct writeback_control *wbc); 260extern int swap_writepage(struct page *page, struct writeback_control *wbc);
279extern void end_swap_bio_read(struct bio *bio, int err); 261extern void end_swap_bio_read(struct bio *bio, int err);
280 262
@@ -300,9 +282,11 @@ extern long total_swap_pages;
300extern void si_swapinfo(struct sysinfo *); 282extern void si_swapinfo(struct sysinfo *);
301extern swp_entry_t get_swap_page(void); 283extern swp_entry_t get_swap_page(void);
302extern swp_entry_t get_swap_page_of_type(int); 284extern swp_entry_t get_swap_page_of_type(int);
303extern int swap_duplicate(swp_entry_t); 285extern void swap_duplicate(swp_entry_t);
286extern int swapcache_prepare(swp_entry_t);
304extern int valid_swaphandles(swp_entry_t, unsigned long *); 287extern int valid_swaphandles(swp_entry_t, unsigned long *);
305extern void swap_free(swp_entry_t); 288extern void swap_free(swp_entry_t);
289extern void swapcache_free(swp_entry_t, struct page *page);
306extern int free_swap_and_cache(swp_entry_t); 290extern int free_swap_and_cache(swp_entry_t);
307extern int swap_type_of(dev_t, sector_t, struct block_device **); 291extern int swap_type_of(dev_t, sector_t, struct block_device **);
308extern unsigned int count_swap_pages(int, int); 292extern unsigned int count_swap_pages(int, int);
@@ -335,10 +319,11 @@ static inline void disable_swap_token(void)
335} 319}
336 320
337#ifdef CONFIG_CGROUP_MEM_RES_CTLR 321#ifdef CONFIG_CGROUP_MEM_RES_CTLR
338extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent); 322extern void
323mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
339#else 324#else
340static inline void 325static inline void
341mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 326mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
342{ 327{
343} 328}
344#endif 329#endif
@@ -370,12 +355,20 @@ static inline void show_swap_cache_info(void)
370} 355}
371 356
372#define free_swap_and_cache(swp) is_migration_entry(swp) 357#define free_swap_and_cache(swp) is_migration_entry(swp)
373#define swap_duplicate(swp) is_migration_entry(swp) 358#define swapcache_prepare(swp) is_migration_entry(swp)
359
360static inline void swap_duplicate(swp_entry_t swp)
361{
362}
374 363
375static inline void swap_free(swp_entry_t swp) 364static inline void swap_free(swp_entry_t swp)
376{ 365{
377} 366}
378 367
368static inline void swapcache_free(swp_entry_t swp, struct page *page)
369{
370}
371
379static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, 372static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
380 struct vm_area_struct *vma, unsigned long addr) 373 struct vm_area_struct *vma, unsigned long addr)
381{ 374{
@@ -431,12 +424,6 @@ static inline swp_entry_t get_swap_page(void)
431#define has_swap_token(x) 0 424#define has_swap_token(x) 0
432#define disable_swap_token() do { } while(0) 425#define disable_swap_token() do { } while(0)
433 426
434static inline int mem_cgroup_cache_charge_swapin(struct page *page,
435 struct mm_struct *mm, gfp_t mask, bool locked)
436{
437 return 0;
438}
439
440static inline void 427static inline void
441mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 428mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
442{ 429{
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 418d90f5effe..fa4242cdade8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -434,6 +434,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
434asmlinkage long sys_fcntl64(unsigned int fd, 434asmlinkage long sys_fcntl64(unsigned int fd,
435 unsigned int cmd, unsigned long arg); 435 unsigned int cmd, unsigned long arg);
436#endif 436#endif
437asmlinkage long sys_pipe(int __user *fildes);
437asmlinkage long sys_pipe2(int __user *fildes, int flags); 438asmlinkage long sys_pipe2(int __user *fildes, int flags);
438asmlinkage long sys_dup(unsigned int fildes); 439asmlinkage long sys_dup(unsigned int fildes);
439asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); 440asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
@@ -751,8 +752,6 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
751asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 752asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
752 struct timespec __user *, const sigset_t __user *, 753 struct timespec __user *, const sigset_t __user *,
753 size_t); 754 size_t);
754asmlinkage long sys_pipe2(int __user *, int);
755asmlinkage long sys_pipe(int __user *);
756 755
757int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 756int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
758 757
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 469b82d88b3b..0482229c07db 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -97,10 +97,12 @@ extern void tick_clock_notify(void);
97extern int tick_check_oneshot_change(int allow_nohz); 97extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 98extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu); 99extern void tick_check_idle(int cpu);
100extern int tick_oneshot_mode_active(void);
100# else 101# else
101static inline void tick_clock_notify(void) { } 102static inline void tick_clock_notify(void) { }
102static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 103static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
103static inline void tick_check_idle(int cpu) { } 104static inline void tick_check_idle(int cpu) { }
105static inline int tick_oneshot_mode_active(void) { return 0; }
104# endif 106# endif
105 107
106#else /* CONFIG_GENERIC_CLOCKEVENTS */ 108#else /* CONFIG_GENERIC_CLOCKEVENTS */
@@ -109,6 +111,7 @@ static inline void tick_cancel_sched_timer(int cpu) { }
109static inline void tick_clock_notify(void) { } 111static inline void tick_clock_notify(void) { }
110static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 112static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
111static inline void tick_check_idle(int cpu) { } 113static inline void tick_check_idle(int cpu) { }
114static inline int tick_oneshot_mode_active(void) { return 0; }
112#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 115#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
113 116
114# ifdef CONFIG_NO_HZ 117# ifdef CONFIG_NO_HZ
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6cdb6f3331f1..ccf882eed8f8 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -163,7 +163,10 @@ extern void add_timer_on(struct timer_list *timer, int cpu);
163extern int del_timer(struct timer_list * timer); 163extern int del_timer(struct timer_list * timer);
164extern int mod_timer(struct timer_list *timer, unsigned long expires); 164extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
166 167
168#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1
167/* 170/*
168 * The jiffies value which is added to now, when there is no timer 171 * The jiffies value which is added to now, when there is no timer
169 * in the timer wheel: 172 * in the timer wheel:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475fcff64..e6967d10d9e5 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -170,17 +170,37 @@ struct timex {
170#include <asm/timex.h> 170#include <asm/timex.h>
171 171
172/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 173 * SHIFT_PLL is used as a dampening factor to define how much we
174 * for a slightly underdamped convergence characteristic. SHIFT_KH 174 * adjust the frequency correction for a given offset in PLL mode.
175 * establishes the damping of the FLL and is chosen by wisdom and black 175 * It also used in dampening the offset correction, to define how
176 * art. 176 * much of the current value in time_offset we correct for each
177 * second. Changing this value changes the stiffness of the ntp
178 * adjustment code. A lower value makes it more flexible, reducing
179 * NTP convergence time. A higher value makes it stiffer, increasing
180 * convergence time, but making the clock more stable.
177 * 181 *
178 * MAXTC establishes the maximum time constant of the PLL. With the 182 * In David Mills' nanokernel reference implementation SHIFT_PLL is 4.
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from 183 * However this seems to increase convergence time much too long.
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, 184 *
181 * respectively. 185 * https://lists.ntp.org/pipermail/hackers/2008-January/003487.html
186 *
187 * In the above mailing list discussion, it seems the value of 4
188 * was appropriate for other Unix systems with HZ=100, and that
189 * SHIFT_PLL should be decreased as HZ increases. However, Linux's
190 * clock steering implementation is HZ independent.
191 *
192 * Through experimentation, a SHIFT_PLL value of 2 was found to allow
193 * for fast convergence (very similar to the NTPv3 code used prior to
194 * v2.6.19), with good clock stability.
195 *
196 *
197 * SHIFT_FLL is used as a dampening factor to define how much we
198 * adjust the frequency correction for a given offset in FLL mode.
199 * In David Mills' nanokernel reference implementation SHIFT_FLL is 2.
200 *
201 * MAXTC establishes the maximum time constant of the PLL.
182 */ 202 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */ 203#define SHIFT_PLL 2 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */ 204#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */ 205#define MAXTC 10 /* maximum time constant (shift) */
186 206
@@ -192,10 +212,10 @@ struct timex {
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 212#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 213#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 214#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 215#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 216 PPM_SCALE + 1)
197 217
198#define MAXPHASE 500000000l /* max phase error (ns) */ 218#define MAXPHASE 500000000L /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */ 219#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) 220#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */ 221#define MINSEC 256 /* min interval between updates (s) */
@@ -260,6 +280,9 @@ extern int do_adjtimex(struct timex *);
260 280
261int read_current_timer(unsigned long *timer_val); 281int read_current_timer(unsigned long *timer_val);
262 282
283/* The clock frequency of the i8253/i8254 PIT */
284#define PIT_TICK_RATE 1193182ul
285
263#endif /* KERNEL */ 286#endif /* KERNEL */
264 287
265#endif /* LINUX_TIMEX_H */ 288#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index eb96603d92db..17ba82efa483 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -143,7 +143,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
143 * 143 *
144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing. 144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
145 * 145 *
146 * Called with task_lock() held on @task. 146 * @task->cred_guard_mutex is held by the caller through the do_execve().
147 */ 147 */
148static inline int tracehook_unsafe_exec(struct task_struct *task) 148static inline int tracehook_unsafe_exec(struct task_struct *task)
149{ 149{
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 14df7e635d43..b9dc4ca0246f 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -198,7 +198,7 @@ static inline void tracepoint_synchronize_unregister(void)
198 * * This is how the trace record is structured and will 198 * * This is how the trace record is structured and will
199 * * be saved into the ring buffer. These are the fields 199 * * be saved into the ring buffer. These are the fields
200 * * that will be exposed to user-space in 200 * * that will be exposed to user-space in
201 * * /debug/tracing/events/<*>/format. 201 * * /sys/kernel/debug/tracing/events/<*>/format.
202 * * 202 * *
203 * * The declared 'local variable' is called '__entry' 203 * * The declared 'local variable' is called '__entry'
204 * * 204 * *
@@ -258,7 +258,7 @@ static inline void tracepoint_synchronize_unregister(void)
258 * tracepoint callback (this is used by programmatic plugins and 258 * tracepoint callback (this is used by programmatic plugins and
259 * can also by used by generic instrumentation like SystemTap), and 259 * can also by used by generic instrumentation like SystemTap), and
260 * it is also used to expose a structured trace record in 260 * it is also used to expose a structured trace record in
261 * /debug/tracing/events/. 261 * /sys/kernel/debug/tracing/events/.
262 */ 262 */
263 263
264#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 264#define TRACE_EVENT(name, proto, args, struct, assign, print) \
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1f8d08..84929e914034 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -36,6 +36,7 @@ struct wusb_dev;
36 * - configs have one (often) or more interfaces; 36 * - configs have one (often) or more interfaces;
37 * - interfaces have one (usually) or more settings; 37 * - interfaces have one (usually) or more settings;
38 * - each interface setting has zero or (usually) more endpoints. 38 * - each interface setting has zero or (usually) more endpoints.
39 * - a SuperSpeed endpoint has a companion descriptor
39 * 40 *
40 * And there might be other descriptors mixed in with those. 41 * And there might be other descriptors mixed in with those.
41 * 42 *
@@ -44,6 +45,19 @@ struct wusb_dev;
44 45
45struct ep_device; 46struct ep_device;
46 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
47/** 61/**
48 * struct usb_host_endpoint - host-side endpoint descriptor and queue 62 * struct usb_host_endpoint - host-side endpoint descriptor and queue
49 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
@@ -51,6 +65,7 @@ struct ep_device;
51 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
52 * with one or more transfer descriptors (TDs) per urb 66 * with one or more transfer descriptors (TDs) per urb
53 * @ep_dev: ep_device for sysfs info 67 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
54 * @extra: descriptors following this endpoint in the configuration 69 * @extra: descriptors following this endpoint in the configuration
55 * @extralen: how many bytes of "extra" are valid 70 * @extralen: how many bytes of "extra" are valid
56 * @enabled: URBs may be submitted to this endpoint 71 * @enabled: URBs may be submitted to this endpoint
@@ -63,6 +78,7 @@ struct usb_host_endpoint {
63 struct list_head urb_list; 78 struct list_head urb_list;
64 void *hcpriv; 79 void *hcpriv;
65 struct ep_device *ep_dev; /* For sysfs info */ 80 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
66 82
67 unsigned char *extra; /* Extra descriptors */ 83 unsigned char *extra; /* Extra descriptors */
68 int extralen; 84 int extralen;
@@ -336,7 +352,6 @@ struct usb_bus {
336#ifdef CONFIG_USB_DEVICEFS 352#ifdef CONFIG_USB_DEVICEFS
337 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 353 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
338#endif 354#endif
339 struct device *dev; /* device for this bus */
340 355
341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 356#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
342 struct mon_bus *mon_bus; /* non-null when associated */ 357 struct mon_bus *mon_bus; /* non-null when associated */
@@ -363,6 +378,7 @@ struct usb_tt;
363 * struct usb_device - kernel's representation of a USB device 378 * struct usb_device - kernel's representation of a USB device
364 * @devnum: device number; address on a USB bus 379 * @devnum: device number; address on a USB bus
365 * @devpath: device ID string for use in messages (e.g., /port/...) 380 * @devpath: device ID string for use in messages (e.g., /port/...)
381 * @route: tree topology hex string for use with xHCI
366 * @state: device state: configured, not attached, etc. 382 * @state: device state: configured, not attached, etc.
367 * @speed: device speed: high/full/low (or error) 383 * @speed: device speed: high/full/low (or error)
368 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub 384 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
@@ -420,6 +436,7 @@ struct usb_tt;
420 * @skip_sys_resume: skip the next system resume 436 * @skip_sys_resume: skip the next system resume
421 * @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
422 * specific data for the device. 438 * specific data for the device.
439 * @slot_id: Slot ID assigned by xHCI
423 * 440 *
424 * Notes: 441 * Notes:
425 * Usbcore drivers should not set usbdev->state directly. Instead use 442 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -428,6 +445,7 @@ struct usb_tt;
428struct usb_device { 445struct usb_device {
429 int devnum; 446 int devnum;
430 char devpath [16]; 447 char devpath [16];
448 u32 route;
431 enum usb_device_state state; 449 enum usb_device_state state;
432 enum usb_device_speed speed; 450 enum usb_device_speed speed;
433 451
@@ -503,6 +521,7 @@ struct usb_device {
503 unsigned skip_sys_resume:1; 521 unsigned skip_sys_resume:1;
504#endif 522#endif
505 struct wusb_dev *wusb_dev; 523 struct wusb_dev *wusb_dev;
524 int slot_id;
506}; 525};
507#define to_usb_device(d) container_of(d, struct usb_device, dev) 526#define to_usb_device(d) container_of(d, struct usb_device, dev)
508 527
@@ -869,6 +888,8 @@ struct usb_driver {
869 * struct usb_device_driver - identifies USB device driver to usbcore 888 * struct usb_device_driver - identifies USB device driver to usbcore
870 * @name: The driver name should be unique among USB drivers, 889 * @name: The driver name should be unique among USB drivers,
871 * and should normally be the same as the module name. 890 * and should normally be the same as the module name.
891 * @nodename: Callback to provide a naming hint for a possible
892 * device node to create.
872 * @probe: Called to see if the driver is willing to manage a particular 893 * @probe: Called to see if the driver is willing to manage a particular
873 * device. If it is, probe returns zero and uses dev_set_drvdata() 894 * device. If it is, probe returns zero and uses dev_set_drvdata()
874 * to associate driver-specific data with the device. If unwilling 895 * to associate driver-specific data with the device. If unwilling
@@ -912,6 +933,7 @@ extern struct bus_type usb_bus_type;
912 */ 933 */
913struct usb_class_driver { 934struct usb_class_driver {
914 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev);
915 const struct file_operations *fops; 937 const struct file_operations *fops;
916 int minor_base; 938 int minor_base;
917}; 939};
@@ -1041,7 +1063,9 @@ typedef void (*usb_complete_t)(struct urb *);
1041 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1063 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the
1042 * device driver has provided this DMA address for the setup packet. 1064 * device driver has provided this DMA address for the setup packet.
1043 * The host controller driver should use this in preference to 1065 * The host controller driver should use this in preference to
1044 * setup_packet. 1066 * setup_packet, but the HCD may chose to ignore the address if it must
1067 * copy the setup packet into internal structures. Therefore, setup_packet
1068 * must always point to a valid buffer.
1045 * @start_frame: Returns the initial frame for isochronous transfers. 1069 * @start_frame: Returns the initial frame for isochronous transfers.
1046 * @number_of_packets: Lists the number of ISO transfer buffers. 1070 * @number_of_packets: Lists the number of ISO transfer buffers.
1047 * @interval: Specifies the polling interval for interrupt or isochronous 1071 * @interval: Specifies the polling interval for interrupt or isochronous
@@ -1177,6 +1201,8 @@ struct urb {
1177 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1201 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1178 void *transfer_buffer; /* (in) associated data buffer */ 1202 void *transfer_buffer; /* (in) associated data buffer */
1179 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1203 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1204 struct usb_sg_request *sg; /* (in) scatter gather buffer list */
1205 int num_sgs; /* (in) number of entries in the sg list */
1180 u32 transfer_buffer_length; /* (in) data buffer length */ 1206 u32 transfer_buffer_length; /* (in) data buffer length */
1181 u32 actual_length; /* (return) actual transfer length */ 1207 u32 actual_length; /* (return) actual transfer length */
1182 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1208 unsigned char *setup_packet; /* (in) setup packet (control only) */
@@ -1422,8 +1448,8 @@ struct usb_sg_request {
1422 int status; 1448 int status;
1423 size_t bytes; 1449 size_t bytes;
1424 1450
1425 /* 1451 /* private:
1426 * members below are private: to usbcore, 1452 * members below are private to usbcore,
1427 * and are not provided for driver access! 1453 * and are not provided for driver access!
1428 */ 1454 */
1429 spinlock_t lock; 1455 spinlock_t lock;
@@ -1558,6 +1584,9 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1558#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1584#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1559 format "\n" , ## arg) 1585 format "\n" , ## arg)
1560 1586
1587/* debugfs stuff */
1588extern struct dentry *usb_debug_root;
1589
1561#endif /* __KERNEL__ */ 1590#endif /* __KERNEL__ */
1562 1591
1563#endif 1592#endif
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 8cb025fef634..b5744bc218ab 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,10 +24,75 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff
27 28
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/
30#define HEADER 0x01
31#define INPUT_TERMINAL 0x02
32#define OUTPUT_TERMINAL 0x03
33#define MIXER_UNIT 0x04
34#define SELECTOR_UNIT 0x05
35#define FEATURE_UNIT 0x06
36#define PROCESSING_UNIT 0x07
37#define EXTENSION_UNIT 0x08
38
39#define AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03
42
43#define EP_GENERAL 0x01
44
45#define MS_GENERAL 0x01
46#define MIDI_IN_JACK 0x02
47#define MIDI_OUT_JACK 0x03
48
49/* endpoint attributes */
50#define EP_ATTR_MASK 0x0c
51#define EP_ATTR_ASYNC 0x04
52#define EP_ATTR_ADAPTIVE 0x08
53#define EP_ATTR_SYNC 0x0c
54
55/* cs endpoint attributes */
56#define EP_CS_ATTR_SAMPLE_RATE 0x01
57#define EP_CS_ATTR_PITCH_CONTROL 0x02
58#define EP_CS_ATTR_FILL_MAX 0x80
59
60/* Audio Class specific Request Codes */
61#define USB_AUDIO_SET_INTF 0x21
62#define USB_AUDIO_SET_ENDPOINT 0x22
63#define USB_AUDIO_GET_INTF 0xa1
64#define USB_AUDIO_GET_ENDPOINT 0xa2
65
66#define SET_ 0x00
67#define GET_ 0x80
68
69#define _CUR 0x1
70#define _MIN 0x2
71#define _MAX 0x3
72#define _RES 0x4
73#define _MEM 0x5
74
75#define SET_CUR (SET_ | _CUR)
76#define GET_CUR (GET_ | _CUR)
77#define SET_MIN (SET_ | _MIN)
78#define GET_MIN (GET_ | _MIN)
79#define SET_MAX (SET_ | _MAX)
80#define GET_MAX (GET_ | _MAX)
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91
92/* Terminal Control Selectors */
28/* 4.3.2 Class-Specific AC Interface Descriptor */ 93/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor { 94struct usb_ac_header_descriptor {
30 __u8 bLength; /* 8+n */ 95 __u8 bLength; /* 8 + n */
31 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
32 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */
33 __le16 bcdADC; /* 0x0100 */ 98 __le16 bcdADC; /* 0x0100 */
@@ -36,7 +101,7 @@ struct usb_ac_header_descriptor {
36 __u8 baInterfaceNr[]; /* [n] */ 101 __u8 baInterfaceNr[]; /* [n] */
37} __attribute__ ((packed)); 102} __attribute__ ((packed));
38 103
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) 104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n))
40 105
41/* As above, but more useful for defining your own descriptors: */ 106/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
@@ -50,4 +115,200 @@ struct usb_ac_header_descriptor_##n { \
50 __u8 baInterfaceNr[n]; \ 115 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed)) 116} __attribute__ ((packed))
52 117
118/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
123 __u8 bTerminalID; /* Constant uniquely terminal ID */
124 __le16 wTerminalType; /* USB Audio Terminal Types */
125 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
126 __u8 bNrChannels; /* Number of logical output channels */
127 __le16 wChannelConfig;
128 __u8 iChannelNames;
129 __u8 iTerminal;
130} __attribute__ ((packed));
131
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12
133
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141
142/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
147 __u8 bTerminalID; /* Constant uniquely terminal ID */
148 __le16 wTerminalType; /* USB Audio Terminal Types */
149 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
150 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
151 __u8 iTerminal;
152} __attribute__ ((packed));
153
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9
155
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164
165/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167
168/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \
172 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \
174 __u8 bUnitID; \
175 __u8 bSourceID; \
176 __u8 bControlSize; \
177 __le16 bmaControls[ch + 1]; \
178 __u8 iFeature; \
179} __attribute__ ((packed))
180
181/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */
186 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
187 __u8 bDelay; /* Delay introduced by the data path */
188 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed));
190
191#define USB_DT_AS_HEADER_SIZE 7
192
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5
199
200struct usb_as_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
204 __u8 bFormatType; /* FORMAT_TYPE_1 */
205 __u8 bNrChannels; /* physical channels in the stream */
206 __u8 bSubframeSize; /* */
207 __u8 bBitResolution;
208 __u8 bSamFreqType;
209 __u8 tLowerSamFreq[3];
210 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed));
212
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214
215struct usb_as_formate_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
219 __u8 bFormatType; /* FORMAT_TYPE_1 */
220 __u8 bNrChannels; /* physical channels in the stream */
221 __u8 bSubframeSize; /* */
222 __u8 bBitResolution;
223 __u8 bSamFreqType;
224 __u8 tSamFreq[][3];
225} __attribute__ ((packed));
226
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \
230 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \
232 __u8 bFormatType; \
233 __u8 bNrChannels; \
234 __u8 bSubframeSize; \
235 __u8 bBitResolution; \
236 __u8 bSamFreqType; \
237 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed))
239
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246
247#define USB_AS_ENDPOINT_ASYNC (1 << 2)
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2)
249#define USB_AS_ENDPOINT_SYNC (3 << 2)
250
251struct usb_as_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */
255 __u8 bmAttributes;
256 __u8 bLockDelayUnits;
257 __le16 wLockDelay;
258};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7
260
261#define FU_CONTROL_UNDEFINED 0x00
262#define MUTE_CONTROL 0x01
263#define VOLUME_CONTROL 0x02
264#define BASS_CONTROL 0x03
265#define MID_CONTROL 0x04
266#define TREBLE_CONTROL 0x05
267#define GRAPHIC_EQUALIZER_CONTROL 0x06
268#define AUTOMATIC_GAIN_CONTROL 0x07
269#define DELAY_CONTROL 0x08
270#define BASS_BOOST_CONTROL 0x09
271#define LOUDNESS_CONTROL 0x0a
272
273#define FU_MUTE (1 << (MUTE_CONTROL - 1))
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1))
275#define FU_BASS (1 << (BASS_CONTROL - 1))
276#define FU_MID (1 << (MID_CONTROL - 1))
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1))
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1))
283
284struct usb_audio_control {
285 struct list_head list;
286 const char *name;
287 u8 type;
288 int data[5];
289 int (*set)(struct usb_audio_control *con, u8 cmd, int value);
290 int (*get)(struct usb_audio_control *con, u8 cmd);
291};
292
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector {
306 struct list_head list;
307 struct list_head control;
308 u8 id;
309 const char *name;
310 u8 type;
311 struct usb_descriptor_header *desc;
312};
313
53#endif /* __LINUX_USB_AUDIO_H */ 314#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index b145119a90da..93223638f702 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30
194 196
195/* Conventional codes for class-specific descriptors. The convention is 197/* Conventional codes for class-specific descriptors. The convention is
196 * defined in the USB "Common Class" Spec (3.11). Individual class specs 198 * defined in the USB "Common Class" Spec (3.11). Individual class specs
@@ -535,6 +537,20 @@ static inline int usb_endpoint_is_isoc_out(
535 537
536/*-------------------------------------------------------------------------*/ 538/*-------------------------------------------------------------------------*/
537 539
540/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
541struct usb_ss_ep_comp_descriptor {
542 __u8 bLength;
543 __u8 bDescriptorType;
544
545 __u8 bMaxBurst;
546 __u8 bmAttributes;
547 __u16 wBytesPerInterval;
548} __attribute__ ((packed));
549
550#define USB_DT_SS_EP_COMP_SIZE 6
551
552/*-------------------------------------------------------------------------*/
553
538/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ 554/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
539struct usb_qualifier_descriptor { 555struct usb_qualifier_descriptor {
540 __u8 bLength; 556 __u8 bLength;
@@ -752,6 +768,7 @@ enum usb_device_speed {
752 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 768 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
753 USB_SPEED_HIGH, /* usb 2.0 */ 769 USB_SPEED_HIGH, /* usb 2.0 */
754 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ 770 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
771 USB_SPEED_SUPER, /* usb 3.0 */
755}; 772};
756 773
757enum usb_device_state { 774enum usb_device_state {
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index acd7b0f06c8a..4f6bb3d2160e 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -124,6 +124,7 @@ struct usb_function {
124 void (*suspend)(struct usb_function *); 124 void (*suspend)(struct usb_function *);
125 void (*resume)(struct usb_function *); 125 void (*resume)(struct usb_function *);
126 126
127 /* private: */
127 /* internals */ 128 /* internals */
128 struct list_head list; 129 struct list_head list;
129}; 130};
@@ -219,6 +220,7 @@ struct usb_configuration {
219 220
220 struct usb_composite_dev *cdev; 221 struct usb_composite_dev *cdev;
221 222
223 /* private: */
222 /* internals */ 224 /* internals */
223 struct list_head list; 225 struct list_head list;
224 struct list_head functions; 226 struct list_head functions;
@@ -321,6 +323,7 @@ struct usb_composite_dev {
321 323
322 struct usb_configuration *config; 324 struct usb_configuration *config;
323 325
326 /* private: */
324 /* internals */ 327 /* internals */
325 struct usb_device_descriptor desc; 328 struct usb_device_descriptor desc;
326 struct list_head configs; 329 struct list_head configs;
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
new file mode 100644
index 000000000000..e115ae6df1da
--- /dev/null
+++ b/include/linux/usb/langwell_otg.h
@@ -0,0 +1,177 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H__
21#define __LANGWELL_OTG_H__
22
23/* notify transceiver driver about OTG events */
24extern void langwell_update_transceiver(void);
25/* HCD register bus driver */
26extern int langwell_register_host(struct pci_driver *host_driver);
27/* HCD unregister bus driver */
28extern void langwell_unregister_host(struct pci_driver *host_driver);
29/* DCD register bus driver */
30extern int langwell_register_peripheral(struct pci_driver *client_driver);
31/* DCD unregister bus driver */
32extern void langwell_unregister_peripheral(struct pci_driver *client_driver);
33/* No silent failure, output warning message */
34extern void langwell_otg_nsf_msg(unsigned long message);
35
36#define CI_USBCMD 0x30
37# define USBCMD_RST BIT(1)
38# define USBCMD_RS BIT(0)
39#define CI_USBSTS 0x34
40# define USBSTS_SLI BIT(8)
41# define USBSTS_URI BIT(6)
42# define USBSTS_PCI BIT(2)
43#define CI_PORTSC1 0x74
44# define PORTSC_PP BIT(12)
45# define PORTSC_LS (BIT(11) | BIT(10))
46# define PORTSC_SUSP BIT(7)
47# define PORTSC_CCS BIT(0)
48#define CI_HOSTPC1 0xb4
49# define HOSTPC1_PHCD BIT(22)
50#define CI_OTGSC 0xf4
51# define OTGSC_DPIE BIT(30)
52# define OTGSC_1MSE BIT(29)
53# define OTGSC_BSEIE BIT(28)
54# define OTGSC_BSVIE BIT(27)
55# define OTGSC_ASVIE BIT(26)
56# define OTGSC_AVVIE BIT(25)
57# define OTGSC_IDIE BIT(24)
58# define OTGSC_DPIS BIT(22)
59# define OTGSC_1MSS BIT(21)
60# define OTGSC_BSEIS BIT(20)
61# define OTGSC_BSVIS BIT(19)
62# define OTGSC_ASVIS BIT(18)
63# define OTGSC_AVVIS BIT(17)
64# define OTGSC_IDIS BIT(16)
65# define OTGSC_DPS BIT(14)
66# define OTGSC_1MST BIT(13)
67# define OTGSC_BSE BIT(12)
68# define OTGSC_BSV BIT(11)
69# define OTGSC_ASV BIT(10)
70# define OTGSC_AVV BIT(9)
71# define OTGSC_ID BIT(8)
72# define OTGSC_HABA BIT(7)
73# define OTGSC_HADP BIT(6)
74# define OTGSC_IDPU BIT(5)
75# define OTGSC_DP BIT(4)
76# define OTGSC_OT BIT(3)
77# define OTGSC_HAAR BIT(2)
78# define OTGSC_VC BIT(1)
79# define OTGSC_VD BIT(0)
80# define OTGSC_INTEN_MASK (0x7f << 24)
81# define OTGSC_INTSTS_MASK (0x7f << 16)
82#define CI_USBMODE 0xf8
83# define USBMODE_CM (BIT(1) | BIT(0))
84# define USBMODE_IDLE 0
85# define USBMODE_DEVICE 0x2
86# define USBMODE_HOST 0x3
87
88#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
89
90struct otg_hsm {
91 /* Input */
92 int a_bus_resume;
93 int a_bus_suspend;
94 int a_conn;
95 int a_sess_vld;
96 int a_srp_det;
97 int a_vbus_vld;
98 int b_bus_resume;
99 int b_bus_suspend;
100 int b_conn;
101 int b_se0_srp;
102 int b_sess_end;
103 int b_sess_vld;
104 int id;
105
106 /* Internal variables */
107 int a_set_b_hnp_en;
108 int b_srp_done;
109 int b_hnp_enable;
110
111 /* Timeout indicator for timers */
112 int a_wait_vrise_tmout;
113 int a_wait_bcon_tmout;
114 int a_aidl_bdis_tmout;
115 int b_ase0_brst_tmout;
116 int b_bus_suspend_tmout;
117 int b_srp_res_tmout;
118
119 /* Informative variables */
120 int a_bus_drop;
121 int a_bus_req;
122 int a_clr_err;
123 int a_suspend_req;
124 int b_bus_req;
125
126 /* Output */
127 int drv_vbus;
128 int loc_conn;
129 int loc_sof;
130
131 /* Others */
132 int b_bus_suspend_vld;
133};
134
135#define TA_WAIT_VRISE 100
136#define TA_WAIT_BCON 30000
137#define TA_AIDL_BDIS 15000
138#define TB_ASE0_BRST 5000
139#define TB_SE0_SRP 2
140#define TB_SRP_RES 100
141#define TB_BUS_SUSPEND 500
142
143struct langwell_otg_timer {
144 unsigned long expires; /* Number of count increase to timeout */
145 unsigned long count; /* Tick counter */
146 void (*function)(unsigned long); /* Timeout function */
147 unsigned long data; /* Data passed to function */
148 struct list_head list;
149};
150
151struct langwell_otg {
152 struct otg_transceiver otg;
153 struct otg_hsm hsm;
154 void __iomem *regs;
155 unsigned region;
156 struct pci_driver *host_ops;
157 struct pci_driver *client_ops;
158 struct pci_dev *pdev;
159 struct work_struct work;
160 struct workqueue_struct *qwork;
161 spinlock_t lock;
162 spinlock_t wq_lock;
163};
164
165static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg)
166{
167 return container_of(otg, struct langwell_otg, otg);
168}
169
170#ifdef DEBUG
171#define otg_dbg(fmt, args...) \
172 printk(KERN_DEBUG fmt , ## args)
173#else
174#define otg_dbg(fmt, args...) \
175 do { } while (0)
176#endif /* DEBUG */
177#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
new file mode 100644
index 000000000000..c949178a6530
--- /dev/null
+++ b/include/linux/usb/langwell_udc.h
@@ -0,0 +1,310 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1aaa826396a1..2443c0e7a80c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,10 +80,10 @@ struct otg_transceiver {
80 80
81/* for board-specific init logic */ 81/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 82extern int otg_set_transceiver(struct otg_transceiver *);
83#ifdef CONFIG_NOP_USB_XCEIV 83
84/* sometimes transceivers are accessed only through e.g. ULPI */
84extern void usb_nop_xceiv_register(void); 85extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void); 86extern void usb_nop_xceiv_unregister(void);
86#endif
87 87
88 88
89/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
new file mode 100644
index 000000000000..e9f0384fa20c
--- /dev/null
+++ b/include/linux/usb/r8a66597.h
@@ -0,0 +1,44 @@
1/*
2 * R8A66597 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#ifndef __LINUX_USB_R8A66597_H
24#define __LINUX_USB_R8A66597_H
25
26#define R8A66597_PLATDATA_XTAL_12MHZ 0x01
27#define R8A66597_PLATDATA_XTAL_24MHZ 0x02
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29
30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power);
33
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2;
36
37 /* set one = 3.3V, set zero = 1.5V */
38 unsigned vif:1;
39
40 /* set one = big endian, set zero = little endian */
41 unsigned endian:1;
42};
43#endif
44
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 8cdfed738fe4..44801d26a37a 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -15,6 +15,7 @@
15 15
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 19
19#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
20#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -26,6 +27,13 @@
26/* parity check flag */ 27/* parity check flag */
27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 28#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
28 29
30enum port_dev_state {
31 PORT_UNREGISTERED,
32 PORT_REGISTERING,
33 PORT_REGISTERED,
34 PORT_UNREGISTERING,
35};
36
29/** 37/**
30 * usb_serial_port: structure for the specific ports of a device. 38 * usb_serial_port: structure for the specific ports of a device.
31 * @serial: pointer back to the struct usb_serial owner of this port. 39 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -91,12 +99,17 @@ struct usb_serial_port {
91 int write_urb_busy; 99 int write_urb_busy;
92 __u8 bulk_out_endpointAddress; 100 __u8 bulk_out_endpointAddress;
93 101
102 int tx_bytes_flight;
103 int urbs_in_flight;
104
94 wait_queue_head_t write_wait; 105 wait_queue_head_t write_wait;
95 struct work_struct work; 106 struct work_struct work;
96 char throttled; 107 char throttled;
97 char throttle_req; 108 char throttle_req;
98 char console; 109 char console;
110 unsigned long sysrq; /* sysrq timeout */
99 struct device dev; 111 struct device dev;
112 enum port_dev_state dev_state;
100}; 113};
101#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 114#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
102 115
@@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * This will be called when the struct usb_serial structure is fully set 194 * This will be called when the struct usb_serial structure is fully set
182 * set up. Do any local initialization of the device, or any private 195 * set up. Do any local initialization of the device, or any private
183 * memory structure allocation at this point in time. 196 * memory structure allocation at this point in time.
184 * @shutdown: pointer to the driver's shutdown function. This will be 197 * @disconnect: pointer to the driver's disconnect function. This will be
185 * called when the device is removed from the system. 198 * called when the device is unplugged or unbound from the driver.
199 * @release: pointer to the driver's release function. This will be called
200 * when the usb_serial data structure is about to be destroyed.
186 * @usb_driver: pointer to the struct usb_driver that controls this 201 * @usb_driver: pointer to the struct usb_driver that controls this
187 * device. This is necessary to allow dynamic ids to be added to 202 * device. This is necessary to allow dynamic ids to be added to
188 * the driver from sysfs. 203 * the driver from sysfs.
@@ -207,12 +222,14 @@ struct usb_serial_driver {
207 struct device_driver driver; 222 struct device_driver driver;
208 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
209 struct usb_dynids dynids; 224 struct usb_dynids dynids;
225 int max_in_flight_urbs;
210 226
211 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 227 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
212 int (*attach)(struct usb_serial *serial); 228 int (*attach)(struct usb_serial *serial);
213 int (*calc_num_ports) (struct usb_serial *serial); 229 int (*calc_num_ports) (struct usb_serial *serial);
214 230
215 void (*shutdown)(struct usb_serial *serial); 231 void (*disconnect)(struct usb_serial *serial);
232 void (*release)(struct usb_serial *serial);
216 233
217 int (*port_probe)(struct usb_serial_port *port); 234 int (*port_probe)(struct usb_serial_port *port);
218 int (*port_remove)(struct usb_serial_port *port); 235 int (*port_remove)(struct usb_serial_port *port);
@@ -294,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
294extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 311extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
295extern void usb_serial_generic_throttle(struct tty_struct *tty); 312extern void usb_serial_generic_throttle(struct tty_struct *tty);
296extern void usb_serial_generic_unthrottle(struct tty_struct *tty); 313extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
297extern void usb_serial_generic_shutdown(struct usb_serial *serial); 314extern void usb_serial_generic_disconnect(struct usb_serial *serial);
315extern void usb_serial_generic_release(struct usb_serial *serial);
298extern int usb_serial_generic_register(int debug); 316extern int usb_serial_generic_register(int debug);
299extern void usb_serial_generic_deregister(void); 317extern void usb_serial_generic_deregister(void);
318extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port,
319 gfp_t mem_flags);
320extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
321 unsigned int ch);
322extern int usb_serial_handle_break(struct usb_serial_port *port);
323
300 324
301extern int usb_serial_bus_register(struct usb_serial_driver *device); 325extern int usb_serial_bus_register(struct usb_serial_driver *device);
302extern void usb_serial_bus_deregister(struct usb_serial_driver *device); 326extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 11232676bfff..3656b300de3a 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -22,12 +22,12 @@ struct old_utsname {
22}; 22};
23 23
24struct new_utsname { 24struct new_utsname {
25 char sysname[65]; 25 char sysname[__NEW_UTS_LEN + 1];
26 char nodename[65]; 26 char nodename[__NEW_UTS_LEN + 1];
27 char release[65]; 27 char release[__NEW_UTS_LEN + 1];
28 char version[65]; 28 char version[__NEW_UTS_LEN + 1];
29 char machine[65]; 29 char machine[__NEW_UTS_LEN + 1];
30 char domainname[65]; 30 char domainname[__NEW_UTS_LEN + 1];
31}; 31};
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ebb2ea6b4995..f24eceecc5a6 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -347,7 +347,8 @@ struct v4l2_pix_format {
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ 350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
351#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
351 352
352/* 353/*
353 * F O R M A T E N U M E R A T I O N 354 * F O R M A T E N U M E R A T I O N
diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h
new file mode 100644
index 000000000000..8f6a95882b09
--- /dev/null
+++ b/include/linux/vlynq.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.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, or
7 * (at your option) any later version.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef __VLYNQ_H__
20#define __VLYNQ_H__
21
22#include <linux/device.h>
23#include <linux/module.h>
24#include <linux/types.h>
25
26#define VLYNQ_NUM_IRQS 32
27
28struct vlynq_mapping {
29 u32 size;
30 u32 offset;
31};
32
33enum vlynq_divisor {
34 vlynq_div_auto = 0,
35 vlynq_ldiv1,
36 vlynq_ldiv2,
37 vlynq_ldiv3,
38 vlynq_ldiv4,
39 vlynq_ldiv5,
40 vlynq_ldiv6,
41 vlynq_ldiv7,
42 vlynq_ldiv8,
43 vlynq_rdiv1,
44 vlynq_rdiv2,
45 vlynq_rdiv3,
46 vlynq_rdiv4,
47 vlynq_rdiv5,
48 vlynq_rdiv6,
49 vlynq_rdiv7,
50 vlynq_rdiv8,
51 vlynq_div_external
52};
53
54struct vlynq_device_id {
55 u32 id;
56 enum vlynq_divisor divisor;
57 unsigned long driver_data;
58};
59
60struct vlynq_regs;
61struct vlynq_device {
62 u32 id, dev_id;
63 int local_irq;
64 int remote_irq;
65 enum vlynq_divisor divisor;
66 u32 regs_start, regs_end;
67 u32 mem_start, mem_end;
68 u32 irq_start, irq_end;
69 int irq;
70 int enabled;
71 struct vlynq_regs *local;
72 struct vlynq_regs *remote;
73 struct device dev;
74};
75
76struct vlynq_driver {
77 char *name;
78 struct vlynq_device_id *id_table;
79 int (*probe)(struct vlynq_device *dev, struct vlynq_device_id *id);
80 void (*remove)(struct vlynq_device *dev);
81 struct device_driver driver;
82};
83
84struct plat_vlynq_ops {
85 int (*on)(struct vlynq_device *dev);
86 void (*off)(struct vlynq_device *dev);
87};
88
89static inline struct vlynq_driver *to_vlynq_driver(struct device_driver *drv)
90{
91 return container_of(drv, struct vlynq_driver, driver);
92}
93
94static inline struct vlynq_device *to_vlynq_device(struct device *device)
95{
96 return container_of(device, struct vlynq_device, dev);
97}
98
99extern struct bus_type vlynq_bus_type;
100
101extern int __vlynq_register_driver(struct vlynq_driver *driver,
102 struct module *owner);
103
104static inline int vlynq_register_driver(struct vlynq_driver *driver)
105{
106 return __vlynq_register_driver(driver, THIS_MODULE);
107}
108
109static inline void *vlynq_get_drvdata(struct vlynq_device *dev)
110{
111 return dev_get_drvdata(&dev->dev);
112}
113
114static inline void vlynq_set_drvdata(struct vlynq_device *dev, void *data)
115{
116 dev_set_drvdata(&dev->dev, data);
117}
118
119static inline u32 vlynq_mem_start(struct vlynq_device *dev)
120{
121 return dev->mem_start;
122}
123
124static inline u32 vlynq_mem_end(struct vlynq_device *dev)
125{
126 return dev->mem_end;
127}
128
129static inline u32 vlynq_mem_len(struct vlynq_device *dev)
130{
131 return dev->mem_end - dev->mem_start + 1;
132}
133
134static inline int vlynq_virq_to_irq(struct vlynq_device *dev, int virq)
135{
136 int irq = dev->irq_start + virq;
137 if ((irq < dev->irq_start) || (irq > dev->irq_end))
138 return -EINVAL;
139
140 return irq;
141}
142
143static inline int vlynq_irq_to_virq(struct vlynq_device *dev, int irq)
144{
145 if ((irq < dev->irq_start) || (irq > dev->irq_end))
146 return -EINVAL;
147
148 return irq - dev->irq_start;
149}
150
151extern void vlynq_unregister_driver(struct vlynq_driver *driver);
152extern int vlynq_enable_device(struct vlynq_device *dev);
153extern void vlynq_disable_device(struct vlynq_device *dev);
154extern int vlynq_set_local_mapping(struct vlynq_device *dev, u32 tx_offset,
155 struct vlynq_mapping *mapping);
156extern int vlynq_set_remote_mapping(struct vlynq_device *dev, u32 tx_offset,
157 struct vlynq_mapping *mapping);
158extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq);
159extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq);
160
161#endif /* __VLYNQ_H__ */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 524cd1b28ecb..81a97cf8f0a0 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -36,12 +36,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36 FOR_ALL_ZONES(PGSTEAL), 36 FOR_ALL_ZONES(PGSTEAL),
37 FOR_ALL_ZONES(PGSCAN_KSWAPD), 37 FOR_ALL_ZONES(PGSCAN_KSWAPD),
38 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
39#ifdef CONFIG_NUMA
40 PGSCAN_ZONE_RECLAIM_FAILED,
41#endif
39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 43 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE 44#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 45 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif 46#endif
44#ifdef CONFIG_UNEVICTABLE_LRU
45 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ 47 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */
46 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ 48 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */
47 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ 49 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */
@@ -50,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
50 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 52 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
51 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 53 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
52 UNEVICTABLE_MLOCKFREED, 54 UNEVICTABLE_MLOCKFREED,
53#endif
54 NR_VM_EVENT_ITEMS 55 NR_VM_EVENT_ITEMS
55}; 56};
56 57
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
index 9797fec7748a..3adeff82212f 100644
--- a/include/linux/w1-gpio.h
+++ b/include/linux/w1-gpio.h
@@ -18,6 +18,7 @@
18struct w1_gpio_platform_data { 18struct w1_gpio_platform_data {
19 unsigned int pin; 19 unsigned int pin;
20 unsigned int is_open_drain:1; 20 unsigned int is_open_drain:1;
21 void (*enable_external_pullup)(int enable);
21}; 22};
22 23
23#endif /* _LINUX_W1_GPIO_H */ 24#endif /* _LINUX_W1_GPIO_H */
diff --git a/include/media/adv7343.h b/include/media/adv7343.h
new file mode 100644
index 000000000000..d6f8a4e1a1fc
--- /dev/null
+++ b/include/media/adv7343.h
@@ -0,0 +1,23 @@
1/*
2 * ADV7343 header file
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef ADV7343_H
17#define ADV7343_H
18
19#define ADV7343_COMPOSITE_ID (0)
20#define ADV7343_COMPONENT_ID (1)
21#define ADV7343_SVIDEO_ID (2)
22
23#endif /* End of #ifndef ADV7343_H */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 07963d705400..3ad4ed5402fb 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -7,7 +7,7 @@ struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 IR_KEYTAB_TYPE *ir_codes; 9 IR_KEYTAB_TYPE *ir_codes;
10 struct i2c_client c; 10 struct i2c_client *c;
11 struct input_dev *input; 11 struct input_dev *input;
12 struct ir_input_state ir; 12 struct ir_input_state ir;
13 13
@@ -15,7 +15,15 @@ struct IR_i2c {
15 unsigned char old; 15 unsigned char old;
16 16
17 struct delayed_work work; 17 struct delayed_work work;
18 char name[32];
18 char phys[32]; 19 char phys[32];
19 int (*get_key)(struct IR_i2c*, u32*, u32*); 20 int (*get_key)(struct IR_i2c*, u32*, u32*);
20}; 21};
22
23/* Can be passed when instantiating an ir_video i2c device */
24struct IR_i2c_init_data {
25 IR_KEYTAB_TYPE *ir_codes;
26 const char *name;
27 int (*get_key)(struct IR_i2c*, u32*, u32*);
28};
21#endif 29#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 37013688af44..23ecead35e7a 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -60,7 +60,7 @@ struct soc_camera_file {
60 60
61struct soc_camera_host { 61struct soc_camera_host {
62 struct list_head list; 62 struct list_head list;
63 struct device dev; 63 struct device *dev;
64 unsigned char nr; /* Host number */ 64 unsigned char nr; /* Host number */
65 void *priv; 65 void *priv;
66 const char *drv_name; 66 const char *drv_name;
@@ -92,11 +92,16 @@ struct soc_camera_host_ops {
92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) 92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
93#define SOCAM_SENSOR_INVERT_DATA (1 << 4) 93#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
94 94
95struct i2c_board_info;
96
95struct soc_camera_link { 97struct soc_camera_link {
96 /* Camera bus id, used to match a camera and a bus */ 98 /* Camera bus id, used to match a camera and a bus */
97 int bus_id; 99 int bus_id;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 100 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 101 unsigned long flags;
102 int i2c_adapter_id;
103 struct i2c_board_info *board_info;
104 const char *module_name;
100 /* Optional callbacks to power on or off and reset the sensor */ 105 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 106 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 107 int (*reset)(struct device *);
@@ -107,6 +112,7 @@ struct soc_camera_link {
107 */ 112 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); 113 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *); 114 unsigned long (*query_bus_param)(struct soc_camera_link *);
115 void (*free_bus)(struct soc_camera_link *);
110}; 116};
111 117
112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 118static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -116,7 +122,7 @@ static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
116 122
117static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 123static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
118{ 124{
119 return container_of(dev, struct soc_camera_host, dev); 125 return dev_get_drvdata(dev);
120} 126}
121 127
122extern int soc_camera_host_register(struct soc_camera_host *ici); 128extern int soc_camera_host_register(struct soc_camera_host *ici);
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 7d4e2db78076..cbf97f45fbec 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -124,6 +124,8 @@
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */ 124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */ 125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78 126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
127#define TUNER_PHILIPS_FM1216MK5 79
128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
127 129
128/* tv card specific */ 130/* tv card specific */
129#define TDA9887_PRESENT (1<<0) 131#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 1be461a29077..4d7e2272c42f 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -137,6 +137,12 @@ enum {
137 /* module saa7191: just ident 7191 */ 137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191, 138 V4L2_IDENT_SAA7191 = 7191,
139 139
140 /* module ths7303: just ident 7303 */
141 V4L2_IDENT_THS7303 = 7303,
142
143 /* module adv7343: just ident 7343 */
144 V4L2_IDENT_ADV7343 = 7343,
145
140 /* module wm8739: just ident 8739 */ 146 /* module wm8739: just ident 8739 */
141 V4L2_IDENT_WM8739 = 8739, 147 V4L2_IDENT_WM8739 = 8739,
142 148
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 0dd3e8e8653e..5d5d550e63ad 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -30,7 +30,7 @@
30 basic V4L2 device-level support. 30 basic V4L2 device-level support.
31 */ 31 */
32 32
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 16)
34 34
35struct v4l2_device { 35struct v4l2_device {
36 /* dev->driver_data points to this struct. 36 /* dev->driver_data points to this struct.
@@ -53,10 +53,31 @@ struct v4l2_device {
53 dev may be NULL in rare cases (ISA devices). In that case you 53 dev may be NULL in rare cases (ISA devices). In that case you
54 must fill in the v4l2_dev->name field before calling this function. */ 54 must fill in the v4l2_dev->name field before calling this function. */
55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); 55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
56
57/* Optional function to initialize the name field of struct v4l2_device using
58 the driver name and a driver-global atomic_t instance.
59 This function will increment the instance counter and returns the instance
60 value used in the name.
61
62 Example:
63
64 static atomic_t drv_instance = ATOMIC_INIT(0);
65
66 ...
67
68 instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance);
69
70 The first time this is called the name field will be set to foo0 and
71 this function returns 0. If the name ends with a digit (e.g. cx18),
72 then the name will be set to cx18-0 since cx180 looks really odd. */
73int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
74 atomic_t *instance);
75
56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. 76/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
57 Since the parent disappears this ensures that v4l2_dev doesn't have an 77 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */ 78 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); 79void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
80
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */ 81/* Unregister all sub-devices and any other resources related to v4l2_dev. */
61void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 82void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
62 83
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 17856081c809..a503e1cee78b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -230,12 +230,16 @@ struct v4l2_subdev_ops {
230 230
231#define V4L2_SUBDEV_NAME_SIZE 32 231#define V4L2_SUBDEV_NAME_SIZE 32
232 232
233/* Set this flag if this subdev is a i2c device. */
234#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
235
233/* Each instance of a subdev driver should create this struct, either 236/* Each instance of a subdev driver should create this struct, either
234 stand-alone or embedded in a larger struct. 237 stand-alone or embedded in a larger struct.
235 */ 238 */
236struct v4l2_subdev { 239struct v4l2_subdev {
237 struct list_head list; 240 struct list_head list;
238 struct module *owner; 241 struct module *owner;
242 u32 flags;
239 struct v4l2_device *v4l2_dev; 243 struct v4l2_device *v4l2_dev;
240 const struct v4l2_subdev_ops *ops; 244 const struct v4l2_subdev_ops *ops;
241 /* name must be unique */ 245 /* name must be unique */
@@ -264,6 +268,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
264 BUG_ON(!ops || !ops->core); 268 BUG_ON(!ops || !ops->core);
265 sd->ops = ops; 269 sd->ops = ops;
266 sd->v4l2_dev = NULL; 270 sd->v4l2_dev = NULL;
271 sd->flags = 0;
267 sd->name[0] = '\0'; 272 sd->name[0] = '\0';
268 sd->grp_id = 0; 273 sd->grp_id = 0;
269 sd->priv = NULL; 274 sd->priv = NULL;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 20a6957af870..47004f35cc7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -17,6 +17,7 @@
17#define _INET_SOCK_H 17#define _INET_SOCK_H
18 18
19 19
20#include <linux/kmemcheck.h>
20#include <linux/string.h> 21#include <linux/string.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/jhash.h> 23#include <linux/jhash.h>
@@ -66,14 +67,16 @@ struct inet_request_sock {
66 __be32 loc_addr; 67 __be32 loc_addr;
67 __be32 rmt_addr; 68 __be32 rmt_addr;
68 __be16 rmt_port; 69 __be16 rmt_port;
69 u16 snd_wscale : 4, 70 kmemcheck_bitfield_begin(flags);
70 rcv_wscale : 4, 71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
71 tstamp_ok : 1, 73 tstamp_ok : 1,
72 sack_ok : 1, 74 sack_ok : 1,
73 wscale_ok : 1, 75 wscale_ok : 1,
74 ecn_ok : 1, 76 ecn_ok : 1,
75 acked : 1, 77 acked : 1,
76 no_srccheck: 1; 78 no_srccheck: 1;
79 kmemcheck_bitfield_end(flags);
77 struct ip_options *opt; 80 struct ip_options *opt;
78}; 81};
79 82
@@ -199,9 +202,12 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
199static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 202static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
200{ 203{
201 struct request_sock *req = reqsk_alloc(ops); 204 struct request_sock *req = reqsk_alloc(ops);
205 struct inet_request_sock *ireq = inet_rsk(req);
202 206
203 if (req != NULL) 207 if (req != NULL) {
204 inet_rsk(req)->opt = NULL; 208 kmemcheck_annotate_bitfield(ireq, flags);
209 ireq->opt = NULL;
210 }
205 211
206 return req; 212 return req;
207} 213}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 4b8ece22b8e9..b63b80fac567 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -16,6 +16,7 @@
16#define _INET_TIMEWAIT_SOCK_ 16#define _INET_TIMEWAIT_SOCK_
17 17
18 18
19#include <linux/kmemcheck.h>
19#include <linux/list.h> 20#include <linux/list.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/timer.h> 22#include <linux/timer.h>
@@ -127,10 +128,12 @@ struct inet_timewait_sock {
127 __be32 tw_rcv_saddr; 128 __be32 tw_rcv_saddr;
128 __be16 tw_dport; 129 __be16 tw_dport;
129 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags);
130 /* And these are ours. */ 132 /* And these are ours. */
131 __u8 tw_ipv6only:1, 133 __u8 tw_ipv6only:1,
132 tw_transparent:1; 134 tw_transparent:1;
133 /* 15 bits hole, try to pack */ 135 /* 14 bits hole, try to pack */
136 kmemcheck_bitfield_end(flags);
134 __u16 tw_ipv6_offset; 137 __u16 tw_ipv6_offset;
135 unsigned long tw_ttd; 138 unsigned long tw_ttd;
136 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
diff --git a/include/net/sock.h b/include/net/sock.h
index 570c7a12b54e..07133c5e9868 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -218,9 +218,11 @@ struct sock {
218#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
219#define sk_prot __sk_common.skc_prot 219#define sk_prot __sk_common.skc_prot
220#define sk_net __sk_common.skc_net 220#define sk_net __sk_common.skc_net
221 kmemcheck_bitfield_begin(flags);
221 unsigned char sk_shutdown : 2, 222 unsigned char sk_shutdown : 2,
222 sk_no_check : 2, 223 sk_no_check : 2,
223 sk_userlocks : 4; 224 sk_userlocks : 4;
225 kmemcheck_bitfield_end(flags);
224 unsigned char sk_protocol; 226 unsigned char sk_protocol;
225 unsigned short sk_type; 227 unsigned short sk_type;
226 int sk_rcvbuf; 228 int sk_rcvbuf;
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
new file mode 100644
index 000000000000..33b2750e9283
--- /dev/null
+++ b/include/scsi/Kbuild
@@ -0,0 +1,4 @@
1header-y += scsi.h
2header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h
new file mode 100644
index 000000000000..a4b233318179
--- /dev/null
+++ b/include/scsi/scsi_bsg_fc.h
@@ -0,0 +1,322 @@
1/*
2 * FC Transport BSG Interface
3 *
4 * Copyright (C) 2008 James Smart, Emulex Corporation
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; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef SCSI_BSG_FC_H
23#define SCSI_BSG_FC_H
24
25/*
26 * This file intended to be included by both kernel and user space
27 */
28
29#include <scsi/scsi.h>
30
31/*
32 * FC Transport SGIO v4 BSG Message Support
33 */
34
35/* Default BSG request timeout (in seconds) */
36#define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
37
38
39/*
40 * Request Message Codes supported by the FC Transport
41 */
42
43/* define the class masks for the message codes */
44#define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
45#define FC_BSG_HST_MASK 0x80000000 /* fc host class */
46#define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
47
48 /* fc_host Message Codes */
49#define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
50#define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
51#define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
52#define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
53#define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
54
55 /* fc_rport Message Codes */
56#define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
57#define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
58
59
60
61/*
62 * FC Address Identifiers in Message Structures :
63 *
64 * Whenever a command payload contains a FC Address Identifier
65 * (aka port_id), the value is effectively in big-endian
66 * order, thus the array elements are decoded as follows:
67 * element [0] is bits 23:16 of the FC Address Identifier
68 * element [1] is bits 15:8 of the FC Address Identifier
69 * element [2] is bits 7:0 of the FC Address Identifier
70 */
71
72
73/*
74 * FC Host Messages
75 */
76
77/* FC_BSG_HST_ADDR_PORT : */
78
79/* Request:
80 * This message requests the FC host to login to the remote port
81 * at the specified N_Port_Id. The remote port is to be enumerated
82 * with the transport upon completion of the login.
83 */
84struct fc_bsg_host_add_rport {
85 uint8_t reserved;
86
87 /* FC Address Identier of the remote port to login to */
88 uint8_t port_id[3];
89};
90
91/* Response:
92 * There is no additional response data - fc_bsg_reply->result is sufficient
93 */
94
95
96/* FC_BSG_HST_DEL_RPORT : */
97
98/* Request:
99 * This message requests the FC host to remove an enumerated
100 * remote port and to terminate the login to it.
101 *
102 * Note: The driver is free to reject this request if it desires to
103 * remain logged in with the remote port.
104 */
105struct fc_bsg_host_del_rport {
106 uint8_t reserved;
107
108 /* FC Address Identier of the remote port to logout of */
109 uint8_t port_id[3];
110};
111
112/* Response:
113 * There is no additional response data - fc_bsg_reply->result is sufficient
114 */
115
116
117/* FC_BSG_HST_ELS_NOLOGIN : */
118
119/* Request:
120 * This message requests the FC_Host to send an ELS to a specific
121 * N_Port_ID. The host does not need to log into the remote port,
122 * nor does it need to enumerate the rport for further traffic
123 * (although, the FC host is free to do so if it desires).
124 */
125struct fc_bsg_host_els {
126 /*
127 * ELS Command Code being sent (must be the same as byte 0
128 * of the payload)
129 */
130 uint8_t command_code;
131
132 /* FC Address Identier of the remote port to send the ELS to */
133 uint8_t port_id[3];
134};
135
136/* Response:
137 */
138/* fc_bsg_ctels_reply->status values */
139#define FC_CTELS_STATUS_OK 0x00000000
140#define FC_CTELS_STATUS_REJECT 0x00000001
141#define FC_CTELS_STATUS_P_RJT 0x00000002
142#define FC_CTELS_STATUS_F_RJT 0x00000003
143#define FC_CTELS_STATUS_P_BSY 0x00000004
144#define FC_CTELS_STATUS_F_BSY 0x00000006
145struct fc_bsg_ctels_reply {
146 /*
147 * Note: An ELS LS_RJT may be reported in 2 ways:
148 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
149 * is to look into the ELS receive payload to determine
150 * LS_ACC or LS_RJT (by contents of word 0). The reject
151 * data will be in word 1.
152 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
153 * rjt_data field will contain valid data.
154 *
155 * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
156 * the receive payload word 0 indicates LS_ACC
157 * (e.g. value is 0x02xxxxxx).
158 *
159 * Note: Similarly, a CT Reject may be reported in 2 ways:
160 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
161 * is to look into the CT receive payload to determine
162 * Accept or Reject (by contents of word 2). The reject
163 * data will be in word 3.
164 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
165 * rjt_data field will contain valid data.
166 *
167 * Note: x_RJT/BSY status will indicae that the rjt_data field
168 * is valid and contains the reason/explanation values.
169 */
170 uint32_t status; /* See FC_CTELS_STATUS_xxx */
171
172 /* valid if status is not FC_CTELS_STATUS_OK */
173 struct {
174 uint8_t action; /* fragment_id for CT REJECT */
175 uint8_t reason_code;
176 uint8_t reason_explanation;
177 uint8_t vendor_unique;
178 } rjt_data;
179};
180
181
182/* FC_BSG_HST_CT : */
183
184/* Request:
185 * This message requests that a CT Request be performed with the
186 * indicated N_Port_ID. The driver is responsible for logging in with
187 * the fabric and/or N_Port_ID, etc as per FC rules. This request does
188 * not mandate that the driver must enumerate the destination in the
189 * transport. The driver is allowed to decide whether to enumerate it,
190 * and whether to tear it down after the request.
191 */
192struct fc_bsg_host_ct {
193 uint8_t reserved;
194
195 /* FC Address Identier of the remote port to send the ELS to */
196 uint8_t port_id[3];
197
198 /*
199 * We need words 0-2 of the generic preamble for the LLD's
200 */
201 uint32_t preamble_word0; /* revision & IN_ID */
202 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
203 uint32_t preamble_word2; /* Cmd Code, Max Size */
204
205};
206/* Response:
207 *
208 * The reply structure is an fc_bsg_ctels_reply structure
209 */
210
211
212/* FC_BSG_HST_VENDOR : */
213
214/* Request:
215 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
216 * formatting requirements specified in scsi_netlink.h
217 */
218struct fc_bsg_host_vendor {
219 /*
220 * Identifies the vendor that the message is formatted for. This
221 * should be the recipient of the message.
222 */
223 uint64_t vendor_id;
224
225 /* start of vendor command area */
226 uint32_t vendor_cmd[0];
227};
228
229/* Response:
230 */
231struct fc_bsg_host_vendor_reply {
232 /* start of vendor response area */
233 uint32_t vendor_rsp[0];
234};
235
236
237
238/*
239 * FC Remote Port Messages
240 */
241
242/* FC_BSG_RPT_ELS : */
243
244/* Request:
245 * This message requests that an ELS be performed with the rport.
246 */
247struct fc_bsg_rport_els {
248 /*
249 * ELS Command Code being sent (must be the same as
250 * byte 0 of the payload)
251 */
252 uint8_t els_code;
253};
254
255/* Response:
256 *
257 * The reply structure is an fc_bsg_ctels_reply structure
258 */
259
260
261/* FC_BSG_RPT_CT : */
262
263/* Request:
264 * This message requests that a CT Request be performed with the rport.
265 */
266struct fc_bsg_rport_ct {
267 /*
268 * We need words 0-2 of the generic preamble for the LLD's
269 */
270 uint32_t preamble_word0; /* revision & IN_ID */
271 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
272 uint32_t preamble_word2; /* Cmd Code, Max Size */
273};
274/* Response:
275 *
276 * The reply structure is an fc_bsg_ctels_reply structure
277 */
278
279
280
281
282/* request (CDB) structure of the sg_io_v4 */
283struct fc_bsg_request {
284 uint32_t msgcode;
285 union {
286 struct fc_bsg_host_add_rport h_addrport;
287 struct fc_bsg_host_del_rport h_delrport;
288 struct fc_bsg_host_els h_els;
289 struct fc_bsg_host_ct h_ct;
290 struct fc_bsg_host_vendor h_vendor;
291
292 struct fc_bsg_rport_els r_els;
293 struct fc_bsg_rport_ct r_ct;
294 } rqst_data;
295};
296
297
298/* response (request sense data) structure of the sg_io_v4 */
299struct fc_bsg_reply {
300 /*
301 * The completion result. Result exists in two forms:
302 * if negative, it is an -Exxx system errno value. There will
303 * be no further reply information supplied.
304 * else, it's the 4-byte scsi error result, with driver, host,
305 * msg and status fields. The per-msgcode reply structure
306 * will contain valid data.
307 */
308 uint32_t result;
309
310 /* If there was reply_payload, how much was recevied ? */
311 uint32_t reply_payload_rcv_len;
312
313 union {
314 struct fc_bsg_host_vendor_reply vendor_reply;
315
316 struct fc_bsg_ctels_reply ctels_reply;
317 } reply_data;
318};
319
320
321#endif /* SCSI_BSG_FC_H */
322
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index d123ca84e732..b62a097b3ecb 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -478,6 +478,15 @@ struct scsi_host_template {
478 * module_init/module_exit. 478 * module_init/module_exit.
479 */ 479 */
480 struct list_head legacy_hosts; 480 struct list_head legacy_hosts;
481
482 /*
483 * Vendor Identifier associated with the host
484 *
485 * Note: When specifying vendor_id, be sure to read the
486 * Vendor Type and ID formatting requirements specified in
487 * scsi_netlink.h
488 */
489 u64 vendor_id;
481}; 490};
482 491
483/* 492/*
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 68a8d873bbd9..fc50bd64aa4e 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -33,7 +33,6 @@
33 33
34struct scsi_transport_template; 34struct scsi_transport_template;
35 35
36
37/* 36/*
38 * FC Port definitions - Following FC HBAAPI guidelines 37 * FC Port definitions - Following FC HBAAPI guidelines
39 * 38 *
@@ -352,6 +351,7 @@ struct fc_rport { /* aka fc_starget_attrs */
352 struct delayed_work fail_io_work; 351 struct delayed_work fail_io_work;
353 struct work_struct stgt_delete_work; 352 struct work_struct stgt_delete_work;
354 struct work_struct rport_delete_work; 353 struct work_struct rport_delete_work;
354 struct request_queue *rqst_q; /* bsg support */
355} __attribute__((aligned(sizeof(unsigned long)))); 355} __attribute__((aligned(sizeof(unsigned long))));
356 356
357/* bit field values for struct fc_rport "flags" field: */ 357/* bit field values for struct fc_rport "flags" field: */
@@ -514,6 +514,9 @@ struct fc_host_attrs {
514 struct workqueue_struct *work_q; 514 struct workqueue_struct *work_q;
515 char devloss_work_q_name[20]; 515 char devloss_work_q_name[20];
516 struct workqueue_struct *devloss_work_q; 516 struct workqueue_struct *devloss_work_q;
517
518 /* bsg support */
519 struct request_queue *rqst_q;
517}; 520};
518 521
519#define shost_to_fc_host(x) \ 522#define shost_to_fc_host(x) \
@@ -579,6 +582,47 @@ struct fc_host_attrs {
579 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 582 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
580 583
581 584
585struct fc_bsg_buffer {
586 unsigned int payload_len;
587 int sg_cnt;
588 struct scatterlist *sg_list;
589};
590
591/* Values for fc_bsg_job->state_flags (bitflags) */
592#define FC_RQST_STATE_INPROGRESS 0
593#define FC_RQST_STATE_DONE 1
594
595struct fc_bsg_job {
596 struct Scsi_Host *shost;
597 struct fc_rport *rport;
598 struct device *dev;
599 struct request *req;
600 spinlock_t job_lock;
601 unsigned int state_flags;
602 unsigned int ref_cnt;
603 void (*job_done)(struct fc_bsg_job *);
604
605 struct fc_bsg_request *request;
606 struct fc_bsg_reply *reply;
607 unsigned int request_len;
608 unsigned int reply_len;
609 /*
610 * On entry : reply_len indicates the buffer size allocated for
611 * the reply.
612 *
613 * Upon completion : the message handler must set reply_len
614 * to indicates the size of the reply to be returned to the
615 * caller.
616 */
617
618 /* DMA payloads for the request/response */
619 struct fc_bsg_buffer request_payload;
620 struct fc_bsg_buffer reply_payload;
621
622 void *dd_data; /* Used for driver-specific storage */
623};
624
625
582/* The functions by which the transport class and the driver communicate */ 626/* The functions by which the transport class and the driver communicate */
583struct fc_function_template { 627struct fc_function_template {
584 void (*get_rport_dev_loss_tmo)(struct fc_rport *); 628 void (*get_rport_dev_loss_tmo)(struct fc_rport *);
@@ -614,9 +658,14 @@ struct fc_function_template {
614 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); 658 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
615 int (* it_nexus_response)(struct Scsi_Host *, u64, int); 659 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
616 660
661 /* bsg support */
662 int (*bsg_request)(struct fc_bsg_job *);
663 int (*bsg_timeout)(struct fc_bsg_job *);
664
617 /* allocation lengths for host-specific data */ 665 /* allocation lengths for host-specific data */
618 u32 dd_fcrport_size; 666 u32 dd_fcrport_size;
619 u32 dd_fcvport_size; 667 u32 dd_fcvport_size;
668 u32 dd_bsg_size;
620 669
621 /* 670 /*
622 * The driver sets these to tell the transport class it 671 * The driver sets these to tell the transport class it
@@ -737,7 +786,6 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state)
737 vport->vport_state = new_state; 786 vport->vport_state = new_state;
738} 787}
739 788
740
741struct scsi_transport_template *fc_attach_transport( 789struct scsi_transport_template *fc_attach_transport(
742 struct fc_function_template *); 790 struct fc_function_template *);
743void fc_release_transport(struct scsi_transport_template *); 791void fc_release_transport(struct scsi_transport_template *);
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 286e9628ed8b..7497a383b1a4 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -36,8 +36,10 @@ struct spi_transport_attrs {
36 unsigned int width:1; /* 0 - narrow, 1 - wide */ 36 unsigned int width:1; /* 0 - narrow, 1 - wide */
37 unsigned int max_width:1; 37 unsigned int max_width:1;
38 unsigned int iu:1; /* Information Units enabled */ 38 unsigned int iu:1; /* Information Units enabled */
39 unsigned int max_iu:1;
39 unsigned int dt:1; /* DT clocking enabled */ 40 unsigned int dt:1; /* DT clocking enabled */
40 unsigned int qas:1; /* Quick Arbitration and Selection enabled */ 41 unsigned int qas:1; /* Quick Arbitration and Selection enabled */
42 unsigned int max_qas:1;
41 unsigned int wr_flow:1; /* Write Flow control enabled */ 43 unsigned int wr_flow:1; /* Write Flow control enabled */
42 unsigned int rd_strm:1; /* Read streaming enabled */ 44 unsigned int rd_strm:1; /* Read streaming enabled */
43 unsigned int rti:1; /* Retain Training Information */ 45 unsigned int rti:1; /* Retain Training Information */
@@ -77,8 +79,10 @@ struct spi_host_attrs {
77#define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) 79#define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width)
78#define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) 80#define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width)
79#define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) 81#define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu)
82#define spi_max_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_iu)
80#define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) 83#define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt)
81#define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) 84#define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas)
85#define spi_max_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_qas)
82#define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) 86#define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow)
83#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) 87#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm)
84#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) 88#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti)
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index c3b2a2aa7140..f0736cff2ca3 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -136,6 +136,15 @@
136#define S1DREG_DELAYOFF 0xFFFE 136#define S1DREG_DELAYOFF 0xFFFE
137#define S1DREG_DELAYON 0xFFFF 137#define S1DREG_DELAYON 0xFFFF
138 138
139#define BBLT_FIFO_EMPTY 0x00
140#define BBLT_FIFO_NOT_EMPTY 0x40
141#define BBLT_FIFO_NOT_FULL 0x30
142#define BBLT_FIFO_HALF_FULL 0x20
143#define BBLT_FIFO_FULL 0x10
144
145#define BBLT_SOLID_FILL 0x0c
146
147
139/* Note: all above defines should go in separate header files 148/* Note: all above defines should go in separate header files
140 when implementing other S1D13xxx chip support. */ 149 when implementing other S1D13xxx chip support. */
141 150