aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@gmail.com>2009-06-15 09:50:49 -0400
committerVegard Nossum <vegard.nossum@gmail.com>2009-06-15 09:50:49 -0400
commit722f2a6c87f34ee0fd0130a8cf45f81e0705594a (patch)
tree50b054df34d2731eb0ba0cf1a6c27e43e7eed428 /include
parent7a0aeb14e18ad59394bd9bbc6e57fb345819e748 (diff)
parent45e3e1935e2857c54783291107d33323b3ef33c8 (diff)
Merge commit 'linus/master' into HEAD
Conflicts: MAINTAINERS Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/Kbuild22
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/atomic-long.h258
-rw-r--r--include/asm-generic/atomic.h321
-rw-r--r--include/asm-generic/auxvec.h8
-rw-r--r--include/asm-generic/bitops.h24
-rw-r--r--include/asm-generic/bitops/atomic.h1
-rw-r--r--include/asm-generic/bitsperlong.h32
-rw-r--r--include/asm-generic/bugs.h10
-rw-r--r--include/asm-generic/cache.h12
-rw-r--r--include/asm-generic/cacheflush.h30
-rw-r--r--include/asm-generic/checksum.h79
-rw-r--r--include/asm-generic/current.h9
-rw-r--r--include/asm-generic/delay.h9
-rw-r--r--include/asm-generic/dma.h15
-rw-r--r--include/asm-generic/fb.h12
-rw-r--r--include/asm-generic/getorder.h24
-rw-r--r--include/asm-generic/hardirq.h34
-rw-r--r--include/asm-generic/hw_irq.h9
-rw-r--r--include/asm-generic/int-l64.h2
-rw-r--r--include/asm-generic/int-ll64.h2
-rw-r--r--include/asm-generic/io.h300
-rw-r--r--include/asm-generic/ioctls.h110
-rw-r--r--include/asm-generic/ipcbuf.h34
-rw-r--r--include/asm-generic/irq.h18
-rw-r--r--include/asm-generic/irqflags.h72
-rw-r--r--include/asm-generic/kmap_types.h32
-rw-r--r--include/asm-generic/linkage.h8
-rw-r--r--include/asm-generic/mman-common.h41
-rw-r--r--include/asm-generic/mman.h51
-rw-r--r--include/asm-generic/mmu.h15
-rw-r--r--include/asm-generic/mmu_context.h45
-rw-r--r--include/asm-generic/module.h22
-rw-r--r--include/asm-generic/msgbuf.h47
-rw-r--r--include/asm-generic/mutex.h9
-rw-r--r--include/asm-generic/page.h109
-rw-r--r--include/asm-generic/param.h24
-rw-r--r--include/asm-generic/parport.h23
-rw-r--r--include/asm-generic/pci.h8
-rw-r--r--include/asm-generic/pgalloc.h12
-rw-r--r--include/asm-generic/posix_types.h165
-rw-r--r--include/asm-generic/rtc.h2
-rw-r--r--include/asm-generic/scatterlist.h43
-rw-r--r--include/asm-generic/segment.h9
-rw-r--r--include/asm-generic/sembuf.h38
-rw-r--r--include/asm-generic/serial.h13
-rw-r--r--include/asm-generic/setup.h6
-rw-r--r--include/asm-generic/shmbuf.h59
-rw-r--r--include/asm-generic/shmparam.h6
-rw-r--r--include/asm-generic/signal-defs.h28
-rw-r--r--include/asm-generic/signal.h137
-rw-r--r--include/asm-generic/socket.h63
-rw-r--r--include/asm-generic/sockios.h13
-rw-r--r--include/asm-generic/spinlock.h11
-rw-r--r--include/asm-generic/stat.h72
-rw-r--r--include/asm-generic/string.h10
-rw-r--r--include/asm-generic/swab.h18
-rw-r--r--include/asm-generic/syscalls.h60
-rw-r--r--include/asm-generic/system.h161
-rw-r--r--include/asm-generic/termbits.h198
-rw-r--r--include/asm-generic/termios-base.h77
-rw-r--r--include/asm-generic/termios.h105
-rw-r--r--include/asm-generic/timex.h22
-rw-r--r--include/asm-generic/tlbflush.h18
-rw-r--r--include/asm-generic/types.h42
-rw-r--r--include/asm-generic/uaccess-unaligned.h26
-rw-r--r--include/asm-generic/uaccess.h333
-rw-r--r--include/asm-generic/ucontext.h12
-rw-r--r--include/asm-generic/unaligned.h30
-rw-r--r--include/asm-generic/unistd.h854
-rw-r--r--include/asm-generic/user.h8
-rw-r--r--include/asm-generic/vga.h24
-rw-r--r--include/asm-generic/vmlinux.lds.h241
-rw-r--r--include/drm/drmP.h126
-rw-r--r--include/drm/drm_hashtab.h2
-rw-r--r--include/drm/drm_mm.h90
-rw-r--r--include/drm/drm_pciids.h9
-rw-r--r--include/linux/amba/pl022.h264
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/cb710.h231
-rw-r--r--include/linux/clk.h13
-rw-r--r--include/linux/compiler.h5
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/dlm.h4
-rw-r--r--include/linux/fuse.h31
-rw-r--r--include/linux/genhd.h1
-rw-r--r--include/linux/gfp.h3
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/i2c-ocores.h2
-rw-r--r--include/linux/ide.h46
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/init.h7
-rw-r--r--include/linux/interrupt.h6
-rw-r--r--include/linux/keyboard.h1
-rw-r--r--include/linux/lguest.h4
-rw-r--r--include/linux/lguest_launcher.h3
-rw-r--r--include/linux/mfd/tmio.h7
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/linux/module.h1
-rw-r--r--include/linux/moduleparam.h40
-rw-r--r--include/linux/page_cgroup.h18
-rw-r--r--include/linux/pci_ids.h13
-rw-r--r--include/linux/perf_counter.h22
-rw-r--r--include/linux/pm.h11
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/section-names.h6
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/slob_def.h5
-rw-r--r--include/linux/slub_def.h2
-rw-r--r--include/linux/suspend.h18
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/ultrasound.h2
-rw-r--r--include/linux/virtio.h15
-rw-r--r--include/linux/virtio_config.h49
-rw-r--r--include/linux/virtio_pci.h10
-rw-r--r--include/linux/virtio_ring.h8
-rw-r--r--include/scsi/fc/fc_fip.h7
-rw-r--r--include/scsi/iscsi_if.h49
-rw-r--r--include/scsi/libfc.h1
-rw-r--r--include/scsi/libiscsi.h8
-rw-r--r--include/scsi/osd_attributes.h74
-rw-r--r--include/scsi/osd_initiator.h14
-rw-r--r--include/scsi/osd_protocol.h8
-rw-r--r--include/scsi/scsi_transport_iscsi.h8
-rw-r--r--include/sound/asound.h1
-rw-r--r--include/sound/core.h11
-rw-r--r--include/sound/driver.h1
-rw-r--r--include/sound/pcm.h76
-rw-r--r--include/sound/soc-dai.h30
-rw-r--r--include/sound/soc-dapm.h24
-rw-r--r--include/sound/soc.h34
-rw-r--r--include/sound/wm9081.h25
-rw-r--r--include/video/pxa168fb.h127
136 files changed, 5820 insertions, 608 deletions
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 4c9932a2503f..eb62334cda29 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -1,11 +1,33 @@
1header-y += auxvec.h
2header-y += bitsperlong.h
1header-y += errno-base.h 3header-y += errno-base.h
2header-y += errno.h 4header-y += errno.h
3header-y += fcntl.h 5header-y += fcntl.h
4header-y += ioctl.h 6header-y += ioctl.h
7header-y += ioctls.h
8header-y += ipcbuf.h
9header-y += mman-common.h
5header-y += mman.h 10header-y += mman.h
11header-y += msgbuf.h
12header-y += param.h
6header-y += poll.h 13header-y += poll.h
14header-y += posix_types.h
15header-y += sembuf.h
16header-y += setup.h
17header-y += shmbuf.h
18header-y += shmparam.h
19header-y += signal-defs.h
7header-y += signal.h 20header-y += signal.h
21header-y += socket.h
22header-y += sockios.h
23header-y += stat.h
8header-y += statfs.h 24header-y += statfs.h
25header-y += swab.h
26header-y += termbits.h
27header-y += termios.h
28header-y += types.h
29header-y += ucontext.h
30header-y += unistd.h
9 31
10unifdef-y += int-l64.h 32unifdef-y += int-l64.h
11unifdef-y += int-ll64.h 33unifdef-y += int-ll64.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 70d185534b9d..290910e4ede4 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -9,6 +9,7 @@ unifdef-y += a.out.h
9endif 9endif
10unifdef-y += auxvec.h 10unifdef-y += auxvec.h
11unifdef-y += byteorder.h 11unifdef-y += byteorder.h
12unifdef-y += bitsperlong.h
12unifdef-y += errno.h 13unifdef-y += errno.h
13unifdef-y += fcntl.h 14unifdef-y += fcntl.h
14unifdef-y += ioctl.h 15unifdef-y += ioctl.h
diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h
new file mode 100644
index 000000000000..b7babf0206b8
--- /dev/null
+++ b/include/asm-generic/atomic-long.h
@@ -0,0 +1,258 @@
1#ifndef _ASM_GENERIC_ATOMIC_LONG_H
2#define _ASM_GENERIC_ATOMIC_LONG_H
3/*
4 * Copyright (C) 2005 Silicon Graphics, Inc.
5 * Christoph Lameter
6 *
7 * Allows to provide arch independent atomic definitions without the need to
8 * edit all arch specific atomic.h files.
9 */
10
11#include <asm/types.h>
12
13/*
14 * Suppport for atomic_long_t
15 *
16 * Casts for parameters are avoided for existing atomic functions in order to
17 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
18 * macros of a platform may have.
19 */
20
21#if BITS_PER_LONG == 64
22
23typedef atomic64_t atomic_long_t;
24
25#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
26
27static inline long atomic_long_read(atomic_long_t *l)
28{
29 atomic64_t *v = (atomic64_t *)l;
30
31 return (long)atomic64_read(v);
32}
33
34static inline void atomic_long_set(atomic_long_t *l, long i)
35{
36 atomic64_t *v = (atomic64_t *)l;
37
38 atomic64_set(v, i);
39}
40
41static inline void atomic_long_inc(atomic_long_t *l)
42{
43 atomic64_t *v = (atomic64_t *)l;
44
45 atomic64_inc(v);
46}
47
48static inline void atomic_long_dec(atomic_long_t *l)
49{
50 atomic64_t *v = (atomic64_t *)l;
51
52 atomic64_dec(v);
53}
54
55static inline void atomic_long_add(long i, atomic_long_t *l)
56{
57 atomic64_t *v = (atomic64_t *)l;
58
59 atomic64_add(i, v);
60}
61
62static inline void atomic_long_sub(long i, atomic_long_t *l)
63{
64 atomic64_t *v = (atomic64_t *)l;
65
66 atomic64_sub(i, v);
67}
68
69static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
70{
71 atomic64_t *v = (atomic64_t *)l;
72
73 return atomic64_sub_and_test(i, v);
74}
75
76static inline int atomic_long_dec_and_test(atomic_long_t *l)
77{
78 atomic64_t *v = (atomic64_t *)l;
79
80 return atomic64_dec_and_test(v);
81}
82
83static inline int atomic_long_inc_and_test(atomic_long_t *l)
84{
85 atomic64_t *v = (atomic64_t *)l;
86
87 return atomic64_inc_and_test(v);
88}
89
90static inline int atomic_long_add_negative(long i, atomic_long_t *l)
91{
92 atomic64_t *v = (atomic64_t *)l;
93
94 return atomic64_add_negative(i, v);
95}
96
97static inline long atomic_long_add_return(long i, atomic_long_t *l)
98{
99 atomic64_t *v = (atomic64_t *)l;
100
101 return (long)atomic64_add_return(i, v);
102}
103
104static inline long atomic_long_sub_return(long i, atomic_long_t *l)
105{
106 atomic64_t *v = (atomic64_t *)l;
107
108 return (long)atomic64_sub_return(i, v);
109}
110
111static inline long atomic_long_inc_return(atomic_long_t *l)
112{
113 atomic64_t *v = (atomic64_t *)l;
114
115 return (long)atomic64_inc_return(v);
116}
117
118static inline long atomic_long_dec_return(atomic_long_t *l)
119{
120 atomic64_t *v = (atomic64_t *)l;
121
122 return (long)atomic64_dec_return(v);
123}
124
125static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
126{
127 atomic64_t *v = (atomic64_t *)l;
128
129 return (long)atomic64_add_unless(v, a, u);
130}
131
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133
134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \
137 (atomic64_xchg((atomic64_t *)(v), (new)))
138
139#else /* BITS_PER_LONG == 64 */
140
141typedef atomic_t atomic_long_t;
142
143#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
144static inline long atomic_long_read(atomic_long_t *l)
145{
146 atomic_t *v = (atomic_t *)l;
147
148 return (long)atomic_read(v);
149}
150
151static inline void atomic_long_set(atomic_long_t *l, long i)
152{
153 atomic_t *v = (atomic_t *)l;
154
155 atomic_set(v, i);
156}
157
158static inline void atomic_long_inc(atomic_long_t *l)
159{
160 atomic_t *v = (atomic_t *)l;
161
162 atomic_inc(v);
163}
164
165static inline void atomic_long_dec(atomic_long_t *l)
166{
167 atomic_t *v = (atomic_t *)l;
168
169 atomic_dec(v);
170}
171
172static inline void atomic_long_add(long i, atomic_long_t *l)
173{
174 atomic_t *v = (atomic_t *)l;
175
176 atomic_add(i, v);
177}
178
179static inline void atomic_long_sub(long i, atomic_long_t *l)
180{
181 atomic_t *v = (atomic_t *)l;
182
183 atomic_sub(i, v);
184}
185
186static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
187{
188 atomic_t *v = (atomic_t *)l;
189
190 return atomic_sub_and_test(i, v);
191}
192
193static inline int atomic_long_dec_and_test(atomic_long_t *l)
194{
195 atomic_t *v = (atomic_t *)l;
196
197 return atomic_dec_and_test(v);
198}
199
200static inline int atomic_long_inc_and_test(atomic_long_t *l)
201{
202 atomic_t *v = (atomic_t *)l;
203
204 return atomic_inc_and_test(v);
205}
206
207static inline int atomic_long_add_negative(long i, atomic_long_t *l)
208{
209 atomic_t *v = (atomic_t *)l;
210
211 return atomic_add_negative(i, v);
212}
213
214static inline long atomic_long_add_return(long i, atomic_long_t *l)
215{
216 atomic_t *v = (atomic_t *)l;
217
218 return (long)atomic_add_return(i, v);
219}
220
221static inline long atomic_long_sub_return(long i, atomic_long_t *l)
222{
223 atomic_t *v = (atomic_t *)l;
224
225 return (long)atomic_sub_return(i, v);
226}
227
228static inline long atomic_long_inc_return(atomic_long_t *l)
229{
230 atomic_t *v = (atomic_t *)l;
231
232 return (long)atomic_inc_return(v);
233}
234
235static inline long atomic_long_dec_return(atomic_long_t *l)
236{
237 atomic_t *v = (atomic_t *)l;
238
239 return (long)atomic_dec_return(v);
240}
241
242static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
243{
244 atomic_t *v = (atomic_t *)l;
245
246 return (long)atomic_add_unless(v, a, u);
247}
248
249#define atomic_long_inc_not_zero(l) atomic_inc_not_zero((atomic_t *)(l))
250
251#define atomic_long_cmpxchg(l, old, new) \
252 (atomic_cmpxchg((atomic_t *)(l), (old), (new)))
253#define atomic_long_xchg(v, new) \
254 (atomic_xchg((atomic_t *)(v), (new)))
255
256#endif /* BITS_PER_LONG == 64 */
257
258#endif /* _ASM_GENERIC_ATOMIC_LONG_H */
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 81d3be459efb..c99c64dc5f3d 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -1,258 +1,165 @@
1#ifndef _ASM_GENERIC_ATOMIC_H
2#define _ASM_GENERIC_ATOMIC_H
3/* 1/*
4 * Copyright (C) 2005 Silicon Graphics, Inc. 2 * Generic C implementation of atomic counter operations
5 * Christoph Lameter 3 * Originally implemented for MN10300.
6 * 4 *
7 * Allows to provide arch independent atomic definitions without the need to 5 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8 * edit all arch specific atomic.h files. 6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
9 */ 12 */
13#ifndef __ASM_GENERIC_ATOMIC_H
14#define __ASM_GENERIC_ATOMIC_H
10 15
11#include <asm/types.h> 16#ifdef CONFIG_SMP
17#error not SMP safe
18#endif
12 19
13/* 20/*
14 * Suppport for atomic_long_t 21 * Atomic operations that C can't guarantee us. Useful for
15 * 22 * resource counting etc..
16 * Casts for parameters are avoided for existing atomic functions in order to
17 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
18 * macros of a platform may have.
19 */ 23 */
20 24
21#if BITS_PER_LONG == 64 25#define ATOMIC_INIT(i) { (i) }
22
23typedef atomic64_t atomic_long_t;
24
25#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
26 26
27static inline long atomic_long_read(atomic_long_t *l) 27#ifdef __KERNEL__
28{
29 atomic64_t *v = (atomic64_t *)l;
30
31 return (long)atomic64_read(v);
32}
33
34static inline void atomic_long_set(atomic_long_t *l, long i)
35{
36 atomic64_t *v = (atomic64_t *)l;
37
38 atomic64_set(v, i);
39}
40
41static inline void atomic_long_inc(atomic_long_t *l)
42{
43 atomic64_t *v = (atomic64_t *)l;
44
45 atomic64_inc(v);
46}
47
48static inline void atomic_long_dec(atomic_long_t *l)
49{
50 atomic64_t *v = (atomic64_t *)l;
51
52 atomic64_dec(v);
53}
54
55static inline void atomic_long_add(long i, atomic_long_t *l)
56{
57 atomic64_t *v = (atomic64_t *)l;
58
59 atomic64_add(i, v);
60}
61
62static inline void atomic_long_sub(long i, atomic_long_t *l)
63{
64 atomic64_t *v = (atomic64_t *)l;
65
66 atomic64_sub(i, v);
67}
68
69static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
70{
71 atomic64_t *v = (atomic64_t *)l;
72
73 return atomic64_sub_and_test(i, v);
74}
75
76static inline int atomic_long_dec_and_test(atomic_long_t *l)
77{
78 atomic64_t *v = (atomic64_t *)l;
79
80 return atomic64_dec_and_test(v);
81}
82
83static inline int atomic_long_inc_and_test(atomic_long_t *l)
84{
85 atomic64_t *v = (atomic64_t *)l;
86
87 return atomic64_inc_and_test(v);
88}
89
90static inline int atomic_long_add_negative(long i, atomic_long_t *l)
91{
92 atomic64_t *v = (atomic64_t *)l;
93
94 return atomic64_add_negative(i, v);
95}
96
97static inline long atomic_long_add_return(long i, atomic_long_t *l)
98{
99 atomic64_t *v = (atomic64_t *)l;
100
101 return (long)atomic64_add_return(i, v);
102}
103
104static inline long atomic_long_sub_return(long i, atomic_long_t *l)
105{
106 atomic64_t *v = (atomic64_t *)l;
107 28
108 return (long)atomic64_sub_return(i, v); 29/**
109} 30 * atomic_read - read atomic variable
110 31 * @v: pointer of type atomic_t
111static inline long atomic_long_inc_return(atomic_long_t *l) 32 *
112{ 33 * Atomically reads the value of @v. Note that the guaranteed
113 atomic64_t *v = (atomic64_t *)l; 34 * useful range of an atomic_t is only 24 bits.
114 35 */
115 return (long)atomic64_inc_return(v); 36#define atomic_read(v) ((v)->counter)
116}
117
118static inline long atomic_long_dec_return(atomic_long_t *l)
119{
120 atomic64_t *v = (atomic64_t *)l;
121
122 return (long)atomic64_dec_return(v);
123}
124
125static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
126{
127 atomic64_t *v = (atomic64_t *)l;
128
129 return (long)atomic64_add_unless(v, a, u);
130}
131
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133
134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \
137 (atomic64_xchg((atomic64_t *)(v), (new)))
138
139#else /* BITS_PER_LONG == 64 */
140
141typedef atomic_t atomic_long_t;
142
143#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
144static inline long atomic_long_read(atomic_long_t *l)
145{
146 atomic_t *v = (atomic_t *)l;
147
148 return (long)atomic_read(v);
149}
150 37
151static inline void atomic_long_set(atomic_long_t *l, long i) 38/**
152{ 39 * atomic_set - set atomic variable
153 atomic_t *v = (atomic_t *)l; 40 * @v: pointer of type atomic_t
41 * @i: required value
42 *
43 * Atomically sets the value of @v to @i. Note that the guaranteed
44 * useful range of an atomic_t is only 24 bits.
45 */
46#define atomic_set(v, i) (((v)->counter) = (i))
154 47
155 atomic_set(v, i); 48#include <asm/system.h>
156}
157 49
158static inline void atomic_long_inc(atomic_long_t *l) 50/**
51 * atomic_add_return - add integer to atomic variable
52 * @i: integer value to add
53 * @v: pointer of type atomic_t
54 *
55 * Atomically adds @i to @v and returns the result
56 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
57 */
58static inline int atomic_add_return(int i, atomic_t *v)
159{ 59{
160 atomic_t *v = (atomic_t *)l; 60 unsigned long flags;
161 61 int temp;
162 atomic_inc(v);
163}
164 62
165static inline void atomic_long_dec(atomic_long_t *l) 63 local_irq_save(flags);
166{ 64 temp = v->counter;
167 atomic_t *v = (atomic_t *)l; 65 temp += i;
66 v->counter = temp;
67 local_irq_restore(flags);
168 68
169 atomic_dec(v); 69 return temp;
170} 70}
171 71
172static inline void atomic_long_add(long i, atomic_long_t *l) 72/**
73 * atomic_sub_return - subtract integer from atomic variable
74 * @i: integer value to subtract
75 * @v: pointer of type atomic_t
76 *
77 * Atomically subtracts @i from @v and returns the result
78 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
79 */
80static inline int atomic_sub_return(int i, atomic_t *v)
173{ 81{
174 atomic_t *v = (atomic_t *)l; 82 unsigned long flags;
175 83 int temp;
176 atomic_add(i, v);
177}
178 84
179static inline void atomic_long_sub(long i, atomic_long_t *l) 85 local_irq_save(flags);
180{ 86 temp = v->counter;
181 atomic_t *v = (atomic_t *)l; 87 temp -= i;
88 v->counter = temp;
89 local_irq_restore(flags);
182 90
183 atomic_sub(i, v); 91 return temp;
184} 92}
185 93
186static inline int atomic_long_sub_and_test(long i, atomic_long_t *l) 94static inline int atomic_add_negative(int i, atomic_t *v)
187{ 95{
188 atomic_t *v = (atomic_t *)l; 96 return atomic_add_return(i, v) < 0;
189
190 return atomic_sub_and_test(i, v);
191} 97}
192 98
193static inline int atomic_long_dec_and_test(atomic_long_t *l) 99static inline void atomic_add(int i, atomic_t *v)
194{ 100{
195 atomic_t *v = (atomic_t *)l; 101 atomic_add_return(i, v);
196
197 return atomic_dec_and_test(v);
198} 102}
199 103
200static inline int atomic_long_inc_and_test(atomic_long_t *l) 104static inline void atomic_sub(int i, atomic_t *v)
201{ 105{
202 atomic_t *v = (atomic_t *)l; 106 atomic_sub_return(i, v);
203
204 return atomic_inc_and_test(v);
205} 107}
206 108
207static inline int atomic_long_add_negative(long i, atomic_long_t *l) 109static inline void atomic_inc(atomic_t *v)
208{ 110{
209 atomic_t *v = (atomic_t *)l; 111 atomic_add_return(1, v);
210
211 return atomic_add_negative(i, v);
212} 112}
213 113
214static inline long atomic_long_add_return(long i, atomic_long_t *l) 114static inline void atomic_dec(atomic_t *v)
215{ 115{
216 atomic_t *v = (atomic_t *)l; 116 atomic_sub_return(1, v);
217
218 return (long)atomic_add_return(i, v);
219} 117}
220 118
221static inline long atomic_long_sub_return(long i, atomic_long_t *l) 119#define atomic_dec_return(v) atomic_sub_return(1, (v))
222{ 120#define atomic_inc_return(v) atomic_add_return(1, (v))
223 atomic_t *v = (atomic_t *)l;
224 121
225 return (long)atomic_sub_return(i, v); 122#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
226} 123#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
124#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
227 125
228static inline long atomic_long_inc_return(atomic_long_t *l) 126#define atomic_add_unless(v, a, u) \
229{ 127({ \
230 atomic_t *v = (atomic_t *)l; 128 int c, old; \
129 c = atomic_read(v); \
130 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
131 c = old; \
132 c != (u); \
133})
231 134
232 return (long)atomic_inc_return(v); 135#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
233}
234 136
235static inline long atomic_long_dec_return(atomic_long_t *l) 137static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
236{ 138{
237 atomic_t *v = (atomic_t *)l; 139 unsigned long flags;
238 140
239 return (long)atomic_dec_return(v); 141 mask = ~mask;
142 local_irq_save(flags);
143 *addr &= mask;
144 local_irq_restore(flags);
240} 145}
241 146
242static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u) 147#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
243{ 148#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
244 atomic_t *v = (atomic_t *)l;
245 149
246 return (long)atomic_add_unless(v, a, u); 150#define cmpxchg_local(ptr, o, n) \
247} 151 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
152 (unsigned long)(n), sizeof(*(ptr))))
248 153
249#define atomic_long_inc_not_zero(l) atomic_inc_not_zero((atomic_t *)(l)) 154#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
250 155
251#define atomic_long_cmpxchg(l, old, new) \ 156/* Assume that atomic operations are already serializing */
252 (atomic_cmpxchg((atomic_t *)(l), (old), (new))) 157#define smp_mb__before_atomic_dec() barrier()
253#define atomic_long_xchg(v, new) \ 158#define smp_mb__after_atomic_dec() barrier()
254 (atomic_xchg((atomic_t *)(v), (new))) 159#define smp_mb__before_atomic_inc() barrier()
160#define smp_mb__after_atomic_inc() barrier()
255 161
256#endif /* BITS_PER_LONG == 64 */ 162#include <asm-generic/atomic-long.h>
257 163
258#endif /* _ASM_GENERIC_ATOMIC_H */ 164#endif /* __KERNEL__ */
165#endif /* __ASM_GENERIC_ATOMIC_H */
diff --git a/include/asm-generic/auxvec.h b/include/asm-generic/auxvec.h
new file mode 100644
index 000000000000..b99573b0ad12
--- /dev/null
+++ b/include/asm-generic/auxvec.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_AUXVEC_H
2#define __ASM_GENERIC_AUXVEC_H
3/*
4 * Not all architectures need their own auxvec.h, the most
5 * common definitions are already in linux/auxvec.h.
6 */
7
8#endif /* __ASM_GENERIC_AUXVEC_H */
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index c9f369c4bd7e..a54f4421a24d 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -1,19 +1,29 @@
1#ifndef _ASM_GENERIC_BITOPS_H_ 1#ifndef __ASM_GENERIC_BITOPS_H
2#define _ASM_GENERIC_BITOPS_H_ 2#define __ASM_GENERIC_BITOPS_H
3 3
4/* 4/*
5 * For the benefit of those who are trying to port Linux to another 5 * For the benefit of those who are trying to port Linux to another
6 * architecture, here are some C-language equivalents. You should 6 * architecture, here are some C-language equivalents. You should
7 * recode these in the native assembly language, if at all possible. 7 * recode these in the native assembly language, if at all possible.
8 * 8 *
9 * C language equivalents written by Theodore Ts'o, 9/26/92 9 * C language equivalents written by Theodore Ts'o, 9/26/92
10 */ 10 */
11 11
12#include <asm-generic/bitops/atomic.h> 12#include <linux/irqflags.h>
13#include <asm-generic/bitops/non-atomic.h> 13#include <linux/compiler.h>
14
15/*
16 * clear_bit may not imply a memory barrier
17 */
18#ifndef smp_mb__before_clear_bit
19#define smp_mb__before_clear_bit() smp_mb()
20#define smp_mb__after_clear_bit() smp_mb()
21#endif
22
14#include <asm-generic/bitops/__ffs.h> 23#include <asm-generic/bitops/__ffs.h>
15#include <asm-generic/bitops/ffz.h> 24#include <asm-generic/bitops/ffz.h>
16#include <asm-generic/bitops/fls.h> 25#include <asm-generic/bitops/fls.h>
26#include <asm-generic/bitops/__fls.h>
17#include <asm-generic/bitops/fls64.h> 27#include <asm-generic/bitops/fls64.h>
18#include <asm-generic/bitops/find.h> 28#include <asm-generic/bitops/find.h>
19 29
@@ -26,8 +36,10 @@
26#include <asm-generic/bitops/hweight.h> 36#include <asm-generic/bitops/hweight.h>
27#include <asm-generic/bitops/lock.h> 37#include <asm-generic/bitops/lock.h>
28 38
39#include <asm-generic/bitops/atomic.h>
40#include <asm-generic/bitops/non-atomic.h>
29#include <asm-generic/bitops/ext2-non-atomic.h> 41#include <asm-generic/bitops/ext2-non-atomic.h>
30#include <asm-generic/bitops/ext2-atomic.h> 42#include <asm-generic/bitops/ext2-atomic.h>
31#include <asm-generic/bitops/minix.h> 43#include <asm-generic/bitops/minix.h>
32 44
33#endif /* _ASM_GENERIC_BITOPS_H */ 45#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index 4657f3e410fc..c8946465e63a 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_BITOPS_ATOMIC_H_ 2#define _ASM_GENERIC_BITOPS_ATOMIC_H_
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/system.h>
5 6
6#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
7#include <asm/spinlock.h> 8#include <asm/spinlock.h>
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
new file mode 100644
index 000000000000..4ae54e07de83
--- /dev/null
+++ b/include/asm-generic/bitsperlong.h
@@ -0,0 +1,32 @@
1#ifndef __ASM_GENERIC_BITS_PER_LONG
2#define __ASM_GENERIC_BITS_PER_LONG
3
4/*
5 * There seems to be no way of detecting this automatically from user
6 * space, so 64 bit architectures should override this in their
7 * bitsperlong.h. In particular, an architecture that supports
8 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
9 * to decide it, but rather check a compiler provided macro.
10 */
11#ifndef __BITS_PER_LONG
12#define __BITS_PER_LONG 32
13#endif
14
15#ifdef __KERNEL__
16
17#ifdef CONFIG_64BIT
18#define BITS_PER_LONG 64
19#else
20#define BITS_PER_LONG 32
21#endif /* CONFIG_64BIT */
22
23/*
24 * FIXME: The check currently breaks x86-64 build, so it's
25 * temporarily disabled. Please fix x86-64 and reenable
26 */
27#if 0 && BITS_PER_LONG != __BITS_PER_LONG
28#error Inconsistent word size. Check asm/bitsperlong.h
29#endif
30
31#endif /* __KERNEL__ */
32#endif /* __ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/bugs.h b/include/asm-generic/bugs.h
new file mode 100644
index 000000000000..6c4f62ea714d
--- /dev/null
+++ b/include/asm-generic/bugs.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_GENERIC_BUGS_H
2#define __ASM_GENERIC_BUGS_H
3/*
4 * This file is included by 'init/main.c' to check for
5 * architecture-dependent bugs.
6 */
7
8static inline void check_bugs(void) { }
9
10#endif /* __ASM_GENERIC_BUGS_H */
diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h
new file mode 100644
index 000000000000..1bfcfe5c2237
--- /dev/null
+++ b/include/asm-generic/cache.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_CACHE_H
2#define __ASM_GENERIC_CACHE_H
3/*
4 * 32 bytes appears to be the most common cache line size,
5 * so make that the default here. Architectures with larger
6 * cache lines need to provide their own cache.h.
7 */
8
9#define L1_CACHE_SHIFT 5
10#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
11
12#endif /* __ASM_GENERIC_CACHE_H */
diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
new file mode 100644
index 000000000000..ba4ec39a1131
--- /dev/null
+++ b/include/asm-generic/cacheflush.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_CACHEFLUSH_H
2#define __ASM_CACHEFLUSH_H
3
4/* Keep includes the same across arches. */
5#include <linux/mm.h>
6
7/*
8 * The cache doesn't need to be flushed when TLB entries change when
9 * the cache is mapped to physical memory, not virtual memory
10 */
11#define flush_cache_all() do { } while (0)
12#define flush_cache_mm(mm) do { } while (0)
13#define flush_cache_dup_mm(mm) do { } while (0)
14#define flush_cache_range(vma, start, end) do { } while (0)
15#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
16#define flush_dcache_page(page) do { } while (0)
17#define flush_dcache_mmap_lock(mapping) do { } while (0)
18#define flush_dcache_mmap_unlock(mapping) do { } while (0)
19#define flush_icache_range(start, end) do { } while (0)
20#define flush_icache_page(vma,pg) do { } while (0)
21#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
22#define flush_cache_vmap(start, end) do { } while (0)
23#define flush_cache_vunmap(start, end) do { } while (0)
24
25#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
26 memcpy(dst, src, len)
27#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
28 memcpy(dst, src, len)
29
30#endif /* __ASM_CACHEFLUSH_H */
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
new file mode 100644
index 000000000000..4647c762d970
--- /dev/null
+++ b/include/asm-generic/checksum.h
@@ -0,0 +1,79 @@
1#ifndef __ASM_GENERIC_CHECKSUM_H
2#define __ASM_GENERIC_CHECKSUM_H
3
4/*
5 * computes the checksum of a memory block at buff, length len,
6 * and adds in "sum" (32-bit)
7 *
8 * returns a 32-bit number suitable for feeding into itself
9 * or csum_tcpudp_magic
10 *
11 * this function must be called with even lengths, except
12 * for the last fragment, which may be odd
13 *
14 * it's best to have buff aligned on a 32-bit boundary
15 */
16extern __wsum csum_partial(const void *buff, int len, __wsum sum);
17
18/*
19 * the same as csum_partial, but copies from src while it
20 * checksums
21 *
22 * here even more important to align src and dst on a 32-bit (or even
23 * better 64-bit) boundary
24 */
25extern __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum);
26
27/*
28 * the same as csum_partial_copy, but copies from user space.
29 *
30 * here even more important to align src and dst on a 32-bit (or even
31 * better 64-bit) boundary
32 */
33extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
34 int len, __wsum sum, int *csum_err);
35
36#define csum_partial_copy_nocheck(src, dst, len, sum) \
37 csum_partial_copy((src), (dst), (len), (sum))
38
39/*
40 * This is a version of ip_compute_csum() optimized for IP headers,
41 * which always checksum on 4 octet boundaries.
42 */
43extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
44
45/*
46 * Fold a partial checksum
47 */
48static inline __sum16 csum_fold(__wsum csum)
49{
50 u32 sum = (__force u32)csum;
51 sum = (sum & 0xffff) + (sum >> 16);
52 sum = (sum & 0xffff) + (sum >> 16);
53 return (__force __sum16)~sum;
54}
55
56#ifndef csum_tcpudp_nofold
57/*
58 * computes the checksum of the TCP/UDP pseudo-header
59 * returns a 16-bit checksum, already complemented
60 */
61extern __wsum
62csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
63 unsigned short proto, __wsum sum);
64#endif
65
66static inline __sum16
67csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
68 unsigned short proto, __wsum sum)
69{
70 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
71}
72
73/*
74 * this routine is used for miscellaneous IP-like checksums, mainly
75 * in icmp.c
76 */
77extern __sum16 ip_compute_csum(const void *buff, int len);
78
79#endif /* __ASM_GENERIC_CHECKSUM_H */
diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
new file mode 100644
index 000000000000..5e86f6ae7cab
--- /dev/null
+++ b/include/asm-generic/current.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_CURRENT_H
2#define __ASM_GENERIC_CURRENT_H
3
4#include <linux/thread_info.h>
5
6#define get_current() (current_thread_info()->task)
7#define current get_current()
8
9#endif /* __ASM_GENERIC_CURRENT_H */
diff --git a/include/asm-generic/delay.h b/include/asm-generic/delay.h
new file mode 100644
index 000000000000..4586fec75ddb
--- /dev/null
+++ b/include/asm-generic/delay.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_DELAY_H
2#define __ASM_GENERIC_DELAY_H
3
4extern void __udelay(unsigned long usecs);
5extern void __delay(unsigned long loops);
6
7#define udelay(n) __udelay(n)
8
9#endif /* __ASM_GENERIC_DELAY_H */
diff --git a/include/asm-generic/dma.h b/include/asm-generic/dma.h
new file mode 100644
index 000000000000..9dfc3a7f36d2
--- /dev/null
+++ b/include/asm-generic/dma.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_GENERIC_DMA_H
2#define __ASM_GENERIC_DMA_H
3/*
4 * This file traditionally describes the i8237 PC style DMA controller.
5 * Most architectures don't have these any more and can get the minimal
6 * implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS.
7 *
8 * Some code relies on seeing MAX_DMA_ADDRESS though.
9 */
10#define MAX_DMA_ADDRESS PAGE_OFFSET
11
12extern int request_dma(unsigned int dmanr, const char *device_id);
13extern void free_dma(unsigned int dmanr);
14
15#endif /* __ASM_GENERIC_DMA_H */
diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
new file mode 100644
index 000000000000..fe8ca7fcea00
--- /dev/null
+++ b/include/asm-generic/fb.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_FB_H_
2#define __ASM_GENERIC_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* __ASM_GENERIC_FB_H_ */
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
new file mode 100644
index 000000000000..67e7245dc9b3
--- /dev/null
+++ b/include/asm-generic/getorder.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_GENERIC_GETORDER_H
2#define __ASM_GENERIC_GETORDER_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/compiler.h>
7
8/* Pure 2^n version of get_order */
9static inline __attribute_const__ int get_order(unsigned long size)
10{
11 int order;
12
13 size = (size - 1) >> (PAGE_SHIFT - 1);
14 order = -1;
15 do {
16 size >>= 1;
17 order++;
18 } while (size);
19 return order;
20}
21
22#endif /* __ASSEMBLY__ */
23
24#endif /* __ASM_GENERIC_GETORDER_H */
diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h
new file mode 100644
index 000000000000..3d5d2c906ab3
--- /dev/null
+++ b/include/asm-generic/hardirq.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_GENERIC_HARDIRQ_H
2#define __ASM_GENERIC_HARDIRQ_H
3
4#include <linux/cache.h>
5#include <linux/threads.h>
6#include <linux/irq.h>
7
8typedef struct {
9 unsigned long __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13
14#ifndef HARDIRQ_BITS
15#define HARDIRQ_BITS 8
16#endif
17
18/*
19 * The hardirq mask has to be large enough to have
20 * space for potentially all IRQ sources in the system
21 * nesting on a single CPU:
22 */
23#if (1 << HARDIRQ_BITS) < NR_IRQS
24# error HARDIRQ_BITS is too low!
25#endif
26
27#ifndef ack_bad_irq
28static inline void ack_bad_irq(unsigned int irq)
29{
30 printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
31}
32#endif
33
34#endif /* __ASM_GENERIC_HARDIRQ_H */
diff --git a/include/asm-generic/hw_irq.h b/include/asm-generic/hw_irq.h
new file mode 100644
index 000000000000..89036d7b40e0
--- /dev/null
+++ b/include/asm-generic/hw_irq.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_HW_IRQ_H
2#define __ASM_GENERIC_HW_IRQ_H
3/*
4 * hw_irq.h has internal declarations for the low-level interrupt
5 * controller, like the original i8259A.
6 * In general, this is not needed for new architectures.
7 */
8
9#endif /* __ASM_GENERIC_HW_IRQ_H */
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 2af9b75d77db..1ca3efc976cc 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_GENERIC_INT_L64_H 8#ifndef _ASM_GENERIC_INT_L64_H
9#define _ASM_GENERIC_INT_L64_H 9#define _ASM_GENERIC_INT_L64_H
10 10
11#include <asm/bitsperlong.h>
12
11#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
12/* 14/*
13 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index f9bc9ac29b36..f394147c0739 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_GENERIC_INT_LL64_H 8#ifndef _ASM_GENERIC_INT_LL64_H
9#define _ASM_GENERIC_INT_LL64_H 9#define _ASM_GENERIC_INT_LL64_H
10 10
11#include <asm/bitsperlong.h>
12
11#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
12/* 14/*
13 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
new file mode 100644
index 000000000000..bcee6365dca0
--- /dev/null
+++ b/include/asm-generic/io.h
@@ -0,0 +1,300 @@
1/* Generic I/O port emulation, based on MN10300 code
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.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 Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef __ASM_GENERIC_IO_H
12#define __ASM_GENERIC_IO_H
13
14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cacheflush.h>
16#include <linux/types.h>
17
18#ifdef CONFIG_GENERIC_IOMAP
19#include <asm-generic/iomap.h>
20#endif
21
22#define mmiowb() do {} while (0)
23
24/*****************************************************************************/
25/*
26 * readX/writeX() are used to access memory mapped devices. On some
27 * architectures the memory mapped IO stuff needs to be accessed
28 * differently. On the simple architectures, we just read/write the
29 * memory location directly.
30 */
31static inline u8 __raw_readb(const volatile void __iomem *addr)
32{
33 return *(const volatile u8 __force *) addr;
34}
35
36static inline u16 __raw_readw(const volatile void __iomem *addr)
37{
38 return *(const volatile u16 __force *) addr;
39}
40
41static inline u32 __raw_readl(const volatile void __iomem *addr)
42{
43 return *(const volatile u32 __force *) addr;
44}
45
46#define readb __raw_readb
47#define readw(addr) __le16_to_cpu(__raw_readw(addr))
48#define readl(addr) __le32_to_cpu(__raw_readl(addr))
49
50static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
51{
52 *(volatile u8 __force *) addr = b;
53}
54
55static inline void __raw_writew(u16 b, volatile void __iomem *addr)
56{
57 *(volatile u16 __force *) addr = b;
58}
59
60static inline void __raw_writel(u32 b, volatile void __iomem *addr)
61{
62 *(volatile u32 __force *) addr = b;
63}
64
65#define writeb __raw_writeb
66#define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr)
67#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
68
69#ifdef CONFIG_64BIT
70static inline u64 __raw_readq(const volatile void __iomem *addr)
71{
72 return *(const volatile u64 __force *) addr;
73}
74#define readq(addr) __le64_to_cpu(__raw_readq(addr))
75
76static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
77{
78 *(volatile u64 __force *) addr = b;
79}
80#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
81#endif
82
83/*****************************************************************************/
84/*
85 * traditional input/output functions
86 */
87
88static inline u8 inb(unsigned long addr)
89{
90 return readb((volatile void __iomem *) addr);
91}
92
93static inline u16 inw(unsigned long addr)
94{
95 return readw((volatile void __iomem *) addr);
96}
97
98static inline u32 inl(unsigned long addr)
99{
100 return readl((volatile void __iomem *) addr);
101}
102
103static inline void outb(u8 b, unsigned long addr)
104{
105 writeb(b, (volatile void __iomem *) addr);
106}
107
108static inline void outw(u16 b, unsigned long addr)
109{
110 writew(b, (volatile void __iomem *) addr);
111}
112
113static inline void outl(u32 b, unsigned long addr)
114{
115 writel(b, (volatile void __iomem *) addr);
116}
117
118#define inb_p(addr) inb(addr)
119#define inw_p(addr) inw(addr)
120#define inl_p(addr) inl(addr)
121#define outb_p(x, addr) outb((x), (addr))
122#define outw_p(x, addr) outw((x), (addr))
123#define outl_p(x, addr) outl((x), (addr))
124
125static inline void insb(unsigned long addr, void *buffer, int count)
126{
127 if (count) {
128 u8 *buf = buffer;
129 do {
130 u8 x = inb(addr);
131 *buf++ = x;
132 } while (--count);
133 }
134}
135
136static inline void insw(unsigned long addr, void *buffer, int count)
137{
138 if (count) {
139 u16 *buf = buffer;
140 do {
141 u16 x = inw(addr);
142 *buf++ = x;
143 } while (--count);
144 }
145}
146
147static inline void insl(unsigned long addr, void *buffer, int count)
148{
149 if (count) {
150 u32 *buf = buffer;
151 do {
152 u32 x = inl(addr);
153 *buf++ = x;
154 } while (--count);
155 }
156}
157
158static inline void outsb(unsigned long addr, const void *buffer, int count)
159{
160 if (count) {
161 const u8 *buf = buffer;
162 do {
163 outb(*buf++, addr);
164 } while (--count);
165 }
166}
167
168static inline void outsw(unsigned long addr, const void *buffer, int count)
169{
170 if (count) {
171 const u16 *buf = buffer;
172 do {
173 outw(*buf++, addr);
174 } while (--count);
175 }
176}
177
178static inline void outsl(unsigned long addr, const void *buffer, int count)
179{
180 if (count) {
181 const u32 *buf = buffer;
182 do {
183 outl(*buf++, addr);
184 } while (--count);
185 }
186}
187
188#ifndef CONFIG_GENERIC_IOMAP
189#define ioread8(addr) readb(addr)
190#define ioread16(addr) readw(addr)
191#define ioread32(addr) readl(addr)
192
193#define iowrite8(v, addr) writeb((v), (addr))
194#define iowrite16(v, addr) writew((v), (addr))
195#define iowrite32(v, addr) writel((v), (addr))
196
197#define ioread8_rep(p, dst, count) \
198 insb((unsigned long) (p), (dst), (count))
199#define ioread16_rep(p, dst, count) \
200 insw((unsigned long) (p), (dst), (count))
201#define ioread32_rep(p, dst, count) \
202 insl((unsigned long) (p), (dst), (count))
203
204#define iowrite8_rep(p, src, count) \
205 outsb((unsigned long) (p), (src), (count))
206#define iowrite16_rep(p, src, count) \
207 outsw((unsigned long) (p), (src), (count))
208#define iowrite32_rep(p, src, count) \
209 outsl((unsigned long) (p), (src), (count))
210#endif /* CONFIG_GENERIC_IOMAP */
211
212
213#define IO_SPACE_LIMIT 0xffffffff
214
215#ifdef __KERNEL__
216
217#include <linux/vmalloc.h>
218#define __io_virt(x) ((void __force *) (x))
219
220#ifndef CONFIG_GENERIC_IOMAP
221/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
222struct pci_dev;
223extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
224static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
225{
226}
227#endif /* CONFIG_GENERIC_IOMAP */
228
229/*
230 * Change virtual addresses to physical addresses and vv.
231 * These are pretty trivial
232 */
233static inline unsigned long virt_to_phys(volatile void *address)
234{
235 return __pa((unsigned long)address);
236}
237
238static inline void *phys_to_virt(unsigned long address)
239{
240 return __va(address);
241}
242
243/*
244 * Change "struct page" to physical address.
245 */
246static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
247{
248 return (void __iomem*) (unsigned long)offset;
249}
250
251#define __ioremap(offset, size, flags) ioremap(offset, size)
252
253#ifndef ioremap_nocache
254#define ioremap_nocache ioremap
255#endif
256
257#ifndef ioremap_wc
258#define ioremap_wc ioremap_nocache
259#endif
260
261static inline void iounmap(void *addr)
262{
263}
264
265#ifndef CONFIG_GENERIC_IOMAP
266static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
267{
268 return (void __iomem *) port;
269}
270
271static inline void ioport_unmap(void __iomem *p)
272{
273}
274#else /* CONFIG_GENERIC_IOMAP */
275extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
276extern void ioport_unmap(void __iomem *p);
277#endif /* CONFIG_GENERIC_IOMAP */
278
279#define xlate_dev_kmem_ptr(p) p
280#define xlate_dev_mem_ptr(p) ((void *) (p))
281
282#ifndef virt_to_bus
283static inline unsigned long virt_to_bus(volatile void *address)
284{
285 return ((unsigned long) address);
286}
287
288static inline void *bus_to_virt(unsigned long address)
289{
290 return (void *) address;
291}
292#endif
293
294#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
295#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
296#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
297
298#endif /* __KERNEL__ */
299
300#endif /* __ASM_GENERIC_IO_H */
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
new file mode 100644
index 000000000000..a799e20a769e
--- /dev/null
+++ b/include/asm-generic/ioctls.h
@@ -0,0 +1,110 @@
1#ifndef __ASM_GENERIC_IOCTLS_H
2#define __ASM_GENERIC_IOCTLS_H
3
4#include <linux/ioctl.h>
5
6/*
7 * These are the most common definitions for tty ioctl numbers.
8 * Most of them do not use the recommended _IOC(), but there is
9 * probably some source code out there hardcoding the number,
10 * so we might as well use them for all new platforms.
11 *
12 * The architectures that use different values here typically
13 * try to be compatible with some Unix variants for the same
14 * architecture.
15 */
16
17/* 0x54 is just a magic number to make these relatively unique ('T') */
18
19#define TCGETS 0x5401
20#define TCSETS 0x5402
21#define TCSETSW 0x5403
22#define TCSETSF 0x5404
23#define TCGETA 0x5405
24#define TCSETA 0x5406
25#define TCSETAW 0x5407
26#define TCSETAF 0x5408
27#define TCSBRK 0x5409
28#define TCXONC 0x540A
29#define TCFLSH 0x540B
30#define TIOCEXCL 0x540C
31#define TIOCNXCL 0x540D
32#define TIOCSCTTY 0x540E
33#define TIOCGPGRP 0x540F
34#define TIOCSPGRP 0x5410
35#define TIOCOUTQ 0x5411
36#define TIOCSTI 0x5412
37#define TIOCGWINSZ 0x5413
38#define TIOCSWINSZ 0x5414
39#define TIOCMGET 0x5415
40#define TIOCMBIS 0x5416
41#define TIOCMBIC 0x5417
42#define TIOCMSET 0x5418
43#define TIOCGSOFTCAR 0x5419
44#define TIOCSSOFTCAR 0x541A
45#define FIONREAD 0x541B
46#define TIOCINQ FIONREAD
47#define TIOCLINUX 0x541C
48#define TIOCCONS 0x541D
49#define TIOCGSERIAL 0x541E
50#define TIOCSSERIAL 0x541F
51#define TIOCPKT 0x5420
52#define FIONBIO 0x5421
53#define TIOCNOTTY 0x5422
54#define TIOCSETD 0x5423
55#define TIOCGETD 0x5424
56#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
57#define TIOCSBRK 0x5427 /* BSD compatibility */
58#define TIOCCBRK 0x5428 /* BSD compatibility */
59#define TIOCGSID 0x5429 /* Return the session ID of FD */
60#define TCGETS2 _IOR('T', 0x2A, struct termios2)
61#define TCSETS2 _IOW('T', 0x2B, struct termios2)
62#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
63#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
64#define TIOCGRS485 0x542E
65#define TIOCSRS485 0x542F
66#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
67#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
68#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
69#define TCSETX 0x5433
70#define TCSETXF 0x5434
71#define TCSETXW 0x5435
72
73#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451
75#define FIOASYNC 0x5452
76#define TIOCSERCONFIG 0x5453
77#define TIOCSERGWILD 0x5454
78#define TIOCSERSWILD 0x5455
79#define TIOCGLCKTRMIOS 0x5456
80#define TIOCSLCKTRMIOS 0x5457
81#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
82#define TIOCSERGETLSR 0x5459 /* Get line status register */
83#define TIOCSERGETMULTI 0x545A /* Get multiport config */
84#define TIOCSERSETMULTI 0x545B /* Set multiport config */
85
86#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88
89/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for
91 * TIOCGHAYESESP on others
92 */
93#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460
97#endif
98
99/* Used for packet mode */
100#define TIOCPKT_DATA 0
101#define TIOCPKT_FLUSHREAD 1
102#define TIOCPKT_FLUSHWRITE 2
103#define TIOCPKT_STOP 4
104#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32
107
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109
110#endif /* __ASM_GENERIC_IOCTLS_H */
diff --git a/include/asm-generic/ipcbuf.h b/include/asm-generic/ipcbuf.h
new file mode 100644
index 000000000000..76982b2a1b58
--- /dev/null
+++ b/include/asm-generic/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_GENERIC_IPCBUF_H
2#define __ASM_GENERIC_IPCBUF_H
3
4/*
5 * The generic ipc64_perm structure:
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * ipc64_perm was originally meant to be architecture specific, but
10 * everyone just ended up making identical copies without specific
11 * optimizations, so we may just as well all use the same one.
12 *
13 * Pad space is left for:
14 * - 32-bit mode_t on architectures that only had 16 bit
15 * - 32-bit seq
16 * - 2 miscellaneous 32-bit values
17 */
18
19struct ipc64_perm {
20 __kernel_key_t key;
21 __kernel_uid32_t uid;
22 __kernel_gid32_t gid;
23 __kernel_uid32_t cuid;
24 __kernel_gid32_t cgid;
25 __kernel_mode_t mode;
26 /* pad if mode_t is u16: */
27 unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
28 unsigned short seq;
29 unsigned short __pad2;
30 unsigned long __unused1;
31 unsigned long __unused2;
32};
33
34#endif /* __ASM_GENERIC_IPCBUF_H */
diff --git a/include/asm-generic/irq.h b/include/asm-generic/irq.h
new file mode 100644
index 000000000000..b90ec0bc485f
--- /dev/null
+++ b/include/asm-generic/irq.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_GENERIC_IRQ_H
2#define __ASM_GENERIC_IRQ_H
3
4/*
5 * NR_IRQS is the upper bound of how many interrupts can be handled
6 * in the platform. It is used to size the static irq_map array,
7 * so don't make it too big.
8 */
9#ifndef NR_IRQS
10#define NR_IRQS 64
11#endif
12
13static inline int irq_canonicalize(int irq)
14{
15 return irq;
16}
17
18#endif /* __ASM_GENERIC_IRQ_H */
diff --git a/include/asm-generic/irqflags.h b/include/asm-generic/irqflags.h
new file mode 100644
index 000000000000..9aebf618275a
--- /dev/null
+++ b/include/asm-generic/irqflags.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_GENERIC_IRQFLAGS_H
2#define __ASM_GENERIC_IRQFLAGS_H
3
4/*
5 * All architectures should implement at least the first two functions,
6 * usually inline assembly will be the best way.
7 */
8#ifndef RAW_IRQ_DISABLED
9#define RAW_IRQ_DISABLED 0
10#define RAW_IRQ_ENABLED 1
11#endif
12
13/* read interrupt enabled status */
14#ifndef __raw_local_save_flags
15unsigned long __raw_local_save_flags(void);
16#endif
17
18/* set interrupt enabled status */
19#ifndef raw_local_irq_restore
20void raw_local_irq_restore(unsigned long flags);
21#endif
22
23/* get status and disable interrupts */
24#ifndef __raw_local_irq_save
25static inline unsigned long __raw_local_irq_save(void)
26{
27 unsigned long flags;
28 flags = __raw_local_save_flags();
29 raw_local_irq_restore(RAW_IRQ_DISABLED);
30 return flags;
31}
32#endif
33
34/* test flags */
35#ifndef raw_irqs_disabled_flags
36static inline int raw_irqs_disabled_flags(unsigned long flags)
37{
38 return flags == RAW_IRQ_DISABLED;
39}
40#endif
41
42/* unconditionally enable interrupts */
43#ifndef raw_local_irq_enable
44static inline void raw_local_irq_enable(void)
45{
46 raw_local_irq_restore(RAW_IRQ_ENABLED);
47}
48#endif
49
50/* unconditionally disable interrupts */
51#ifndef raw_local_irq_disable
52static inline void raw_local_irq_disable(void)
53{
54 raw_local_irq_restore(RAW_IRQ_DISABLED);
55}
56#endif
57
58/* test hardware interrupt enable bit */
59#ifndef raw_irqs_disabled
60static inline int raw_irqs_disabled(void)
61{
62 return raw_irqs_disabled_flags(__raw_local_save_flags());
63}
64#endif
65
66#define raw_local_save_flags(flags) \
67 do { (flags) = __raw_local_save_flags(); } while (0)
68
69#define raw_local_irq_save(flags) \
70 do { (flags) = __raw_local_irq_save(); } while (0)
71
72#endif /* __ASM_GENERIC_IRQFLAGS_H */
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
new file mode 100644
index 000000000000..58c33055c304
--- /dev/null
+++ b/include/asm-generic/kmap_types.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_GENERIC_KMAP_TYPES_H
2#define _ASM_GENERIC_KMAP_TYPES_H
3
4#ifdef CONFIG_DEBUG_HIGHMEM
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_SYNC_ICACHE,
25D(14) KM_SYNC_DCACHE,
26D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
27D(16) KM_TYPE_NR
28};
29
30#undef D
31
32#endif
diff --git a/include/asm-generic/linkage.h b/include/asm-generic/linkage.h
new file mode 100644
index 000000000000..fef7a01e5415
--- /dev/null
+++ b/include/asm-generic/linkage.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_LINKAGE_H
2#define __ASM_GENERIC_LINKAGE_H
3/*
4 * linux/linkage.h provides reasonable defaults.
5 * an architecture can override them by providing its own version.
6 */
7
8#endif /* __ASM_GENERIC_LINKAGE_H */
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
new file mode 100644
index 000000000000..3b69ad34189a
--- /dev/null
+++ b/include/asm-generic/mman-common.h
@@ -0,0 +1,41 @@
1#ifndef __ASM_GENERIC_MMAN_COMMON_H
2#define __ASM_GENERIC_MMAN_COMMON_H
3
4/*
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8
9#define PROT_READ 0x1 /* page can be read */
10#define PROT_WRITE 0x2 /* page can be written */
11#define PROT_EXEC 0x4 /* page can be executed */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */
13#define PROT_NONE 0x0 /* page can not be accessed */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
16
17#define MAP_SHARED 0x01 /* Share changes */
18#define MAP_PRIVATE 0x02 /* Changes are private */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22
23#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MADV_NORMAL 0 /* no further special treatment */
28#define MADV_RANDOM 1 /* expect random page references */
29#define MADV_SEQUENTIAL 2 /* expect sequential page references */
30#define MADV_WILLNEED 3 /* will need these pages */
31#define MADV_DONTNEED 4 /* don't need these pages */
32
33/* common parameters: try to keep these consistent across architectures */
34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */
37
38/* compatibility flags */
39#define MAP_FILE 0
40
41#endif /* __ASM_GENERIC_MMAN_COMMON_H */
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
index 5e3dde2ee5ad..7cab4de2bca6 100644
--- a/include/asm-generic/mman.h
+++ b/include/asm-generic/mman.h
@@ -1,41 +1,18 @@
1#ifndef _ASM_GENERIC_MMAN_H 1#ifndef __ASM_GENERIC_MMAN_H
2#define _ASM_GENERIC_MMAN_H 2#define __ASM_GENERIC_MMAN_H
3 3
4/* 4#include <asm-generic/mman-common.h>
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8 5
9#define PROT_READ 0x1 /* page can be read */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
10#define PROT_WRITE 0x2 /* page can be written */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
11#define PROT_EXEC 0x4 /* page can be executed */ 8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */ 9#define MAP_LOCKED 0x2000 /* pages are locked */
13#define PROT_NONE 0x0 /* page can not be accessed */ 10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
16 14
17#define MAP_SHARED 0x01 /* Share changes */ 15#define MCL_CURRENT 1 /* lock all current mappings */
18#define MAP_PRIVATE 0x02 /* Changes are private */ 16#define MCL_FUTURE 2 /* lock all future mappings */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22 17
23#define MS_ASYNC 1 /* sync memory asynchronously */ 18#endif /* __ASM_GENERIC_MMAN_H */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MADV_NORMAL 0 /* no further special treatment */
28#define MADV_RANDOM 1 /* expect random page references */
29#define MADV_SEQUENTIAL 2 /* expect sequential page references */
30#define MADV_WILLNEED 3 /* will need these pages */
31#define MADV_DONTNEED 4 /* don't need these pages */
32
33/* common parameters: try to keep these consistent across architectures */
34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */
37
38/* compatibility flags */
39#define MAP_FILE 0
40
41#endif
diff --git a/include/asm-generic/mmu.h b/include/asm-generic/mmu.h
new file mode 100644
index 000000000000..4f4aa56d6b52
--- /dev/null
+++ b/include/asm-generic/mmu.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_GENERIC_MMU_H
2#define __ASM_GENERIC_MMU_H
3
4/*
5 * This is the mmu.h header for nommu implementations.
6 * Architectures with an MMU need something more complex.
7 */
8#ifndef __ASSEMBLY__
9typedef struct {
10 struct vm_list_struct *vmlist;
11 unsigned long end_brk;
12} mm_context_t;
13#endif
14
15#endif /* __ASM_GENERIC_MMU_H */
diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu_context.h
new file mode 100644
index 000000000000..a7eec910ba6c
--- /dev/null
+++ b/include/asm-generic/mmu_context.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_GENERIC_MMU_CONTEXT_H
2#define __ASM_GENERIC_MMU_CONTEXT_H
3
4/*
5 * Generic hooks for NOMMU architectures, which do not need to do
6 * anything special here.
7 */
8
9#include <asm-generic/mm_hooks.h>
10
11struct task_struct;
12struct mm_struct;
13
14static inline void enter_lazy_tlb(struct mm_struct *mm,
15 struct task_struct *tsk)
16{
17}
18
19static inline int init_new_context(struct task_struct *tsk,
20 struct mm_struct *mm)
21{
22 return 0;
23}
24
25static inline void destroy_context(struct mm_struct *mm)
26{
27}
28
29static inline void deactivate_mm(struct task_struct *task,
30 struct mm_struct *mm)
31{
32}
33
34static inline void switch_mm(struct mm_struct *prev,
35 struct mm_struct *next,
36 struct task_struct *tsk)
37{
38}
39
40static inline void activate_mm(struct mm_struct *prev_mm,
41 struct mm_struct *next_mm)
42{
43}
44
45#endif /* __ASM_GENERIC_MMU_CONTEXT_H */
diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h
new file mode 100644
index 000000000000..ed5b44de4c91
--- /dev/null
+++ b/include/asm-generic/module.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_GENERIC_MODULE_H
2#define __ASM_GENERIC_MODULE_H
3
4/*
5 * Many architectures just need a simple module
6 * loader without arch specific data.
7 */
8struct mod_arch_specific
9{
10};
11
12#ifdef CONFIG_64BIT
13#define Elf_Shdr Elf64_Shdr
14#define Elf_Sym Elf64_Sym
15#define Elf_Ehdr Elf64_Ehdr
16#else
17#define Elf_Shdr Elf32_Shdr
18#define Elf_Sym Elf32_Sym
19#define Elf_Ehdr Elf32_Ehdr
20#endif
21
22#endif /* __ASM_GENERIC_MODULE_H */
diff --git a/include/asm-generic/msgbuf.h b/include/asm-generic/msgbuf.h
new file mode 100644
index 000000000000..aec850d9159e
--- /dev/null
+++ b/include/asm-generic/msgbuf.h
@@ -0,0 +1,47 @@
1#ifndef __ASM_GENERIC_MSGBUF_H
2#define __ASM_GENERIC_MSGBUF_H
3
4#include <asm/bitsperlong.h>
5/*
6 * generic msqid64_ds structure.
7 *
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * msqid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first three padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23
24struct msqid64_ds {
25 struct ipc64_perm msg_perm;
26 __kernel_time_t msg_stime; /* last msgsnd time */
27#if __BITS_PER_LONG != 64
28 unsigned long __unused1;
29#endif
30 __kernel_time_t msg_rtime; /* last msgrcv time */
31#if __BITS_PER_LONG != 64
32 unsigned long __unused2;
33#endif
34 __kernel_time_t msg_ctime; /* last change time */
35#if __BITS_PER_LONG != 64
36 unsigned long __unused3;
37#endif
38 unsigned long msg_cbytes; /* current number of bytes on queue */
39 unsigned long msg_qnum; /* number of messages in queue */
40 unsigned long msg_qbytes; /* max number of bytes on queue */
41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
42 __kernel_pid_t msg_lrpid; /* last receive pid */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47#endif /* __ASM_GENERIC_MSGBUF_H */
diff --git a/include/asm-generic/mutex.h b/include/asm-generic/mutex.h
new file mode 100644
index 000000000000..fe91ab502793
--- /dev/null
+++ b/include/asm-generic/mutex.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_MUTEX_H
2#define __ASM_GENERIC_MUTEX_H
3/*
4 * Pull in the generic implementation for the mutex fastpath,
5 * which is a reasonable default on many architectures.
6 */
7
8#include <asm-generic/mutex-dec.h>
9#endif /* __ASM_GENERIC_MUTEX_H */
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 14db733b8e68..75fec18cdc59 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -1,24 +1,99 @@
1#ifndef _ASM_GENERIC_PAGE_H 1#ifndef __ASM_GENERIC_PAGE_H
2#define _ASM_GENERIC_PAGE_H 2#define __ASM_GENERIC_PAGE_H
3/*
4 * Generic page.h implementation, for NOMMU architectures.
5 * This provides the dummy definitions for the memory management.
6 */
7
8#ifdef CONFIG_MMU
9#error need to prove a real asm/page.h
10#endif
11
12
13/* PAGE_SHIFT determines the page size */
14
15#define PAGE_SHIFT 12
16#ifdef __ASSEMBLY__
17#define PAGE_SIZE (1 << PAGE_SHIFT)
18#else
19#define PAGE_SIZE (1UL << PAGE_SHIFT)
20#endif
21#define PAGE_MASK (~(PAGE_SIZE-1))
22
23#include <asm/setup.h>
24
25#ifndef __ASSEMBLY__
26
27#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
28#define free_user_page(page, addr) free_page(addr)
29
30#define clear_page(page) memset((page), 0, PAGE_SIZE)
31#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
32
33#define clear_user_page(page, vaddr, pg) clear_page(page)
34#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
35
36/*
37 * These are used to make use of C type-checking..
38 */
39typedef struct {
40 unsigned long pte;
41} pte_t;
42typedef struct {
43 unsigned long pmd[16];
44} pmd_t;
45typedef struct {
46 unsigned long pgd;
47} pgd_t;
48typedef struct {
49 unsigned long pgprot;
50} pgprot_t;
51typedef struct page *pgtable_t;
52
53#define pte_val(x) ((x).pte)
54#define pmd_val(x) ((&x)->pmd[0])
55#define pgd_val(x) ((x).pgd)
56#define pgprot_val(x) ((x).pgprot)
57
58#define __pte(x) ((pte_t) { (x) } )
59#define __pmd(x) ((pmd_t) { (x) } )
60#define __pgd(x) ((pgd_t) { (x) } )
61#define __pgprot(x) ((pgprot_t) { (x) } )
62
63extern unsigned long memory_start;
64extern unsigned long memory_end;
65
66#endif /* !__ASSEMBLY__ */
67
68#ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
69#define PAGE_OFFSET (CONFIG_KERNEL_RAM_BASE_ADDRESS)
70#else
71#define PAGE_OFFSET (0)
72#endif
3 73
4#ifndef __ASSEMBLY__ 74#ifndef __ASSEMBLY__
5 75
6#include <linux/compiler.h> 76#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
77#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
78
79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
81
82#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
83#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
84
85#ifndef page_to_phys
86#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
87#endif
88
89#define pfn_valid(pfn) ((pfn) < max_mapnr)
7 90
8/* Pure 2^n version of get_order */ 91#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
9static __inline__ __attribute_const__ int get_order(unsigned long size) 92 ((void *)(kaddr) < (void *)memory_end))
10{
11 int order;
12 93
13 size = (size - 1) >> (PAGE_SHIFT - 1); 94#endif /* __ASSEMBLY__ */
14 order = -1;
15 do {
16 size >>= 1;
17 order++;
18 } while (size);
19 return order;
20}
21 95
22#endif /* __ASSEMBLY__ */ 96#include <asm-generic/memory_model.h>
97#include <asm-generic/getorder.h>
23 98
24#endif /* _ASM_GENERIC_PAGE_H */ 99#endif /* __ASM_GENERIC_PAGE_H */
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
new file mode 100644
index 000000000000..cdf8251bfb6c
--- /dev/null
+++ b/include/asm-generic/param.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
6# define USER_HZ 100 /* some user interfaces are */
7# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#ifndef EXEC_PAGESIZE
15#define EXEC_PAGESIZE 4096
16#endif
17
18#ifndef NOGROUP
19#define NOGROUP (-1)
20#endif
21
22#define MAXHOSTNAMELEN 64 /* max length of hostname */
23
24#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h
new file mode 100644
index 000000000000..40528cb977e8
--- /dev/null
+++ b/include/asm-generic/parport.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_GENERIC_PARPORT_H
2#define __ASM_GENERIC_PARPORT_H
3
4/*
5 * An ISA bus may have i8255 parallel ports at well-known
6 * locations in the I/O space, which are scanned by
7 * parport_pc_find_isa_ports.
8 *
9 * Without ISA support, the driver will only attach
10 * to devices on the PCI bus.
11 */
12
13static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
14static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
15{
16#ifdef CONFIG_ISA
17 return parport_pc_find_isa_ports(autoirq, autodma);
18#else
19 return 0;
20#endif
21}
22
23#endif /* __ASM_GENERIC_PARPORT_H */
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index c36a77d3bf44..515c6e2e3218 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -52,4 +52,12 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
52} 52}
53#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */ 53#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
54 54
55/*
56 * By default, assume that no iommu is in use and that the PCI
57 * space is mapped to address physical 0.
58 */
59#ifndef PCI_DMA_BUS_IS_PHYS
60#define PCI_DMA_BUS_IS_PHYS (1)
55#endif 61#endif
62
63#endif /* _ASM_GENERIC_PCI_H */
diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h
new file mode 100644
index 000000000000..9e429d08b1f8
--- /dev/null
+++ b/include/asm-generic/pgalloc.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_PGALLOC_H
2#define __ASM_GENERIC_PGALLOC_H
3/*
4 * an empty file is enough for a nommu architecture
5 */
6#ifdef CONFIG_MMU
7#error need to implement an architecture specific asm/pgalloc.h
8#endif
9
10#define check_pgt_cache() do { } while (0)
11
12#endif /* __ASM_GENERIC_PGALLOC_H */
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
new file mode 100644
index 000000000000..3dab00860e71
--- /dev/null
+++ b/include/asm-generic/posix_types.h
@@ -0,0 +1,165 @@
1#ifndef __ASM_GENERIC_POSIX_TYPES_H
2#define __ASM_GENERIC_POSIX_TYPES_H
3
4#include <asm/bitsperlong.h>
5/*
6 * This file is generally used by user-level software, so you need to
7 * be a little careful about namespace pollution etc.
8 *
9 * First the types that are often defined in different ways across
10 * architectures, so that you can override them.
11 */
12
13#ifndef __kernel_ino_t
14typedef unsigned long __kernel_ino_t;
15#endif
16
17#ifndef __kernel_mode_t
18typedef unsigned int __kernel_mode_t;
19#endif
20
21#ifndef __kernel_nlink_t
22typedef unsigned long __kernel_nlink_t;
23#endif
24
25#ifndef __kernel_pid_t
26typedef int __kernel_pid_t;
27#endif
28
29#ifndef __kernel_ipc_pid_t
30typedef int __kernel_ipc_pid_t;
31#endif
32
33#ifndef __kernel_uid_t
34typedef unsigned int __kernel_uid_t;
35typedef unsigned int __kernel_gid_t;
36#endif
37
38#ifndef __kernel_suseconds_t
39typedef long __kernel_suseconds_t;
40#endif
41
42#ifndef __kernel_daddr_t
43typedef int __kernel_daddr_t;
44#endif
45
46#ifndef __kernel_uid32_t
47typedef __kernel_uid_t __kernel_uid32_t;
48typedef __kernel_gid_t __kernel_gid32_t;
49#endif
50
51#ifndef __kernel_old_uid_t
52typedef __kernel_uid_t __kernel_old_uid_t;
53typedef __kernel_gid_t __kernel_old_gid_t;
54#endif
55
56#ifndef __kernel_old_dev_t
57typedef unsigned int __kernel_old_dev_t;
58#endif
59
60/*
61 * Most 32 bit architectures use "unsigned int" size_t,
62 * and all 64 bit architectures use "unsigned long" size_t.
63 */
64#ifndef __kernel_size_t
65#if __BITS_PER_LONG != 64
66typedef unsigned int __kernel_size_t;
67typedef int __kernel_ssize_t;
68typedef int __kernel_ptrdiff_t;
69#else
70typedef unsigned long __kernel_size_t;
71typedef long __kernel_ssize_t;
72typedef long __kernel_ptrdiff_t;
73#endif
74#endif
75
76/*
77 * anything below here should be completely generic
78 */
79typedef long __kernel_off_t;
80typedef long long __kernel_loff_t;
81typedef long __kernel_time_t;
82typedef long __kernel_clock_t;
83typedef int __kernel_timer_t;
84typedef int __kernel_clockid_t;
85typedef char * __kernel_caddr_t;
86typedef unsigned short __kernel_uid16_t;
87typedef unsigned short __kernel_gid16_t;
88
89typedef struct {
90 int val[2];
91} __kernel_fsid_t;
92
93#ifdef __KERNEL__
94
95#undef __FD_SET
96static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
97{
98 unsigned long __tmp = __fd / __NFDBITS;
99 unsigned long __rem = __fd % __NFDBITS;
100 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
101}
102
103#undef __FD_CLR
104static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
105{
106 unsigned long __tmp = __fd / __NFDBITS;
107 unsigned long __rem = __fd % __NFDBITS;
108 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
109}
110
111#undef __FD_ISSET
112static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
113{
114 unsigned long __tmp = __fd / __NFDBITS;
115 unsigned long __rem = __fd % __NFDBITS;
116 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
117}
118
119/*
120 * This will unroll the loop for the normal constant case (8 ints,
121 * for a 256-bit fd_set)
122 */
123#undef __FD_ZERO
124static inline void __FD_ZERO(__kernel_fd_set *__p)
125{
126 unsigned long *__tmp = __p->fds_bits;
127 int __i;
128
129 if (__builtin_constant_p(__FDSET_LONGS)) {
130 switch (__FDSET_LONGS) {
131 case 16:
132 __tmp[ 0] = 0; __tmp[ 1] = 0;
133 __tmp[ 2] = 0; __tmp[ 3] = 0;
134 __tmp[ 4] = 0; __tmp[ 5] = 0;
135 __tmp[ 6] = 0; __tmp[ 7] = 0;
136 __tmp[ 8] = 0; __tmp[ 9] = 0;
137 __tmp[10] = 0; __tmp[11] = 0;
138 __tmp[12] = 0; __tmp[13] = 0;
139 __tmp[14] = 0; __tmp[15] = 0;
140 return;
141
142 case 8:
143 __tmp[ 0] = 0; __tmp[ 1] = 0;
144 __tmp[ 2] = 0; __tmp[ 3] = 0;
145 __tmp[ 4] = 0; __tmp[ 5] = 0;
146 __tmp[ 6] = 0; __tmp[ 7] = 0;
147 return;
148
149 case 4:
150 __tmp[ 0] = 0; __tmp[ 1] = 0;
151 __tmp[ 2] = 0; __tmp[ 3] = 0;
152 return;
153 }
154 }
155 __i = __FDSET_LONGS;
156 while (__i) {
157 __i--;
158 *__tmp = 0;
159 __tmp++;
160 }
161}
162
163#endif /* __KERNEL__ */
164
165#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 763e3b060f43..fa86f240c874 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -202,7 +202,7 @@ static inline unsigned int get_rtc_ss(void)
202{ 202{
203 struct rtc_time h; 203 struct rtc_time h;
204 204
205 __get_rtc_time(&h); 205 get_rtc_time(&h);
206 return h.tm_sec; 206 return h.tm_sec;
207} 207}
208 208
diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h
new file mode 100644
index 000000000000..8b9454496a7c
--- /dev/null
+++ b/include/asm-generic/scatterlist.h
@@ -0,0 +1,43 @@
1#ifndef __ASM_GENERIC_SCATTERLIST_H
2#define __ASM_GENERIC_SCATTERLIST_H
3
4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13 dma_addr_t dma_address;
14 unsigned int dma_length;
15};
16
17/*
18 * These macros should be used after a dma_map_sg call has been done
19 * to get bus addresses of each of the SG entries and their lengths.
20 * You should only work with the number of sg entries pci_map_sg
21 * returns, or alternatively stop on the first sg_dma_len(sg) which
22 * is 0.
23 */
24#define sg_dma_address(sg) ((sg)->dma_address)
25#ifndef sg_dma_len
26/*
27 * Normally, you have an iommu on 64 bit machines, but not on 32 bit
28 * machines. Architectures that are differnt should override this.
29 */
30#if __BITS_PER_LONG == 64
31#define sg_dma_len(sg) ((sg)->dma_length)
32#else
33#define sg_dma_len(sg) ((sg)->length)
34#endif /* 64 bit */
35#endif /* sg_dma_len */
36
37#ifndef ISA_DMA_THRESHOLD
38#define ISA_DMA_THRESHOLD (~0UL)
39#endif
40
41#define ARCH_HAS_SG_CHAIN
42
43#endif /* __ASM_GENERIC_SCATTERLIST_H */
diff --git a/include/asm-generic/segment.h b/include/asm-generic/segment.h
new file mode 100644
index 000000000000..5580eace622c
--- /dev/null
+++ b/include/asm-generic/segment.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_SEGMENT_H
2#define __ASM_GENERIC_SEGMENT_H
3/*
4 * Only here because we have some old header files that expect it...
5 *
6 * New architectures probably don't want to have their own version.
7 */
8
9#endif /* __ASM_GENERIC_SEGMENT_H */
diff --git a/include/asm-generic/sembuf.h b/include/asm-generic/sembuf.h
new file mode 100644
index 000000000000..4cb2c13e5090
--- /dev/null
+++ b/include/asm-generic/sembuf.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_GENERIC_SEMBUF_H
2#define __ASM_GENERIC_SEMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The semid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * semid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23struct semid64_ds {
24 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26#if __BITS_PER_LONG != 64
27 unsigned long __unused1;
28#endif
29 __kernel_time_t sem_ctime; /* last change time */
30#if __BITS_PER_LONG != 64
31 unsigned long __unused2;
32#endif
33 unsigned long sem_nsems; /* no. of semaphores in array */
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* __ASM_GENERIC_SEMBUF_H */
diff --git a/include/asm-generic/serial.h b/include/asm-generic/serial.h
new file mode 100644
index 000000000000..5e291090fe04
--- /dev/null
+++ b/include/asm-generic/serial.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_GENERIC_SERIAL_H
2#define __ASM_GENERIC_SERIAL_H
3
4/*
5 * This should not be an architecture specific #define, oh well.
6 *
7 * Traditionally, it just describes i8250 and related serial ports
8 * that have this clock rate.
9 */
10
11#define BASE_BAUD (1843200 / 16)
12
13#endif /* __ASM_GENERIC_SERIAL_H */
diff --git a/include/asm-generic/setup.h b/include/asm-generic/setup.h
new file mode 100644
index 000000000000..6fc26a51003c
--- /dev/null
+++ b/include/asm-generic/setup.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SETUP_H
2#define __ASM_GENERIC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* __ASM_GENERIC_SETUP_H */
diff --git a/include/asm-generic/shmbuf.h b/include/asm-generic/shmbuf.h
new file mode 100644
index 000000000000..5768fa60ac82
--- /dev/null
+++ b/include/asm-generic/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef __ASM_GENERIC_SHMBUF_H
2#define __ASM_GENERIC_SHMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The shmid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * shmid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 *
20 * Pad space is left for:
21 * - 64-bit time_t to solve y2038 problem
22 * - 2 miscellaneous 32-bit values
23 */
24
25struct shmid64_ds {
26 struct ipc64_perm shm_perm; /* operation perms */
27 size_t shm_segsz; /* size of segment (bytes) */
28 __kernel_time_t shm_atime; /* last attach time */
29#if __BITS_PER_LONG != 64
30 unsigned long __unused1;
31#endif
32 __kernel_time_t shm_dtime; /* last detach time */
33#if __BITS_PER_LONG != 64
34 unsigned long __unused2;
35#endif
36 __kernel_time_t shm_ctime; /* last change time */
37#if __BITS_PER_LONG != 64
38 unsigned long __unused3;
39#endif
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/include/asm-generic/shmparam.h b/include/asm-generic/shmparam.h
new file mode 100644
index 000000000000..51a3852de733
--- /dev/null
+++ b/include/asm-generic/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SHMPARAM_H
2#define __ASM_GENERIC_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_GENERIC_SHMPARAM_H */
diff --git a/include/asm-generic/signal-defs.h b/include/asm-generic/signal-defs.h
new file mode 100644
index 000000000000..00f95df54297
--- /dev/null
+++ b/include/asm-generic/signal-defs.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_GENERIC_SIGNAL_DEFS_H
2#define __ASM_GENERIC_SIGNAL_DEFS_H
3
4#include <linux/compiler.h>
5
6#ifndef SIG_BLOCK
7#define SIG_BLOCK 0 /* for blocking signals */
8#endif
9#ifndef SIG_UNBLOCK
10#define SIG_UNBLOCK 1 /* for unblocking signals */
11#endif
12#ifndef SIG_SETMASK
13#define SIG_SETMASK 2 /* for setting the signal mask */
14#endif
15
16#ifndef __ASSEMBLY__
17typedef void __signalfn_t(int);
18typedef __signalfn_t __user *__sighandler_t;
19
20typedef void __restorefn_t(void);
21typedef __restorefn_t __user *__sigrestore_t;
22
23#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */
24#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */
25#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */
26#endif
27
28#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index dae1d8720076..555c0aee8a47 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -1,28 +1,131 @@
1#ifndef __ASM_GENERIC_SIGNAL_H 1#ifndef __ASM_GENERIC_SIGNAL_H
2#define __ASM_GENERIC_SIGNAL_H 2#define __ASM_GENERIC_SIGNAL_H
3 3
4#include <linux/compiler.h> 4#include <linux/types.h>
5 5
6#ifndef SIG_BLOCK 6#define _NSIG 64
7#define SIG_BLOCK 0 /* for blocking signals */ 7#define _NSIG_BPW __BITS_PER_LONG
8#endif 8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9#ifndef SIG_UNBLOCK 9
10#define SIG_UNBLOCK 1 /* for unblocking signals */ 10#define SIGHUP 1
11#endif 11#define SIGINT 2
12#ifndef SIG_SETMASK 12#define SIGQUIT 3
13#define SIG_SETMASK 2 /* for setting the signal mask */ 13#define SIGILL 4
14#define SIGTRAP 5
15#define SIGABRT 6
16#define SIGIOT 6
17#define SIGBUS 7
18#define SIGFPE 8
19#define SIGKILL 9
20#define SIGUSR1 10
21#define SIGSEGV 11
22#define SIGUSR2 12
23#define SIGPIPE 13
24#define SIGALRM 14
25#define SIGTERM 15
26#define SIGSTKFLT 16
27#define SIGCHLD 17
28#define SIGCONT 18
29#define SIGSTOP 19
30#define SIGTSTP 20
31#define SIGTTIN 21
32#define SIGTTOU 22
33#define SIGURG 23
34#define SIGXCPU 24
35#define SIGXFSZ 25
36#define SIGVTALRM 26
37#define SIGPROF 27
38#define SIGWINCH 28
39#define SIGIO 29
40#define SIGPOLL SIGIO
41/*
42#define SIGLOST 29
43*/
44#define SIGPWR 30
45#define SIGSYS 31
46#define SIGUNUSED 31
47
48/* These should not be considered constants from userland. */
49#define SIGRTMIN 32
50#ifndef SIGRTMAX
51#define SIGRTMAX _NSIG
14#endif 52#endif
15 53
54/*
55 * SA_FLAGS values:
56 *
57 * SA_ONSTACK indicates that a registered stack_t will be used.
58 * SA_RESTART flag to get restarting signals (which were the default long ago)
59 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
60 * SA_RESETHAND clears the handler when the signal is delivered.
61 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
62 * SA_NODEFER prevents the current signal from being masked in the handler.
63 *
64 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
65 * Unix names RESETHAND and NODEFER respectively.
66 */
67#define SA_NOCLDSTOP 0x00000001
68#define SA_NOCLDWAIT 0x00000002
69#define SA_SIGINFO 0x00000004
70#define SA_ONSTACK 0x08000000
71#define SA_RESTART 0x10000000
72#define SA_NODEFER 0x40000000
73#define SA_RESETHAND 0x80000000
74
75#define SA_NOMASK SA_NODEFER
76#define SA_ONESHOT SA_RESETHAND
77
78/*
79 * New architectures should not define the obsolete
80 * SA_RESTORER 0x04000000
81 */
82
83/*
84 * sigaltstack controls
85 */
86#define SS_ONSTACK 1
87#define SS_DISABLE 2
88
89#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192
91
16#ifndef __ASSEMBLY__ 92#ifndef __ASSEMBLY__
17typedef void __signalfn_t(int); 93typedef struct {
18typedef __signalfn_t __user *__sighandler_t; 94 unsigned long sig[_NSIG_WORDS];
95} sigset_t;
96
97/* not actually used, but required for linux/syscalls.h */
98typedef unsigned long old_sigset_t;
19 99
20typedef void __restorefn_t(void); 100#include <asm-generic/signal-defs.h>
21typedef __restorefn_t __user *__sigrestore_t;
22 101
23#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */ 102struct sigaction {
24#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */ 103 __sighandler_t sa_handler;
25#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */ 104 unsigned long sa_flags;
105#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
26#endif 107#endif
108 sigset_t sa_mask; /* mask last for extensibility */
109};
110
111struct k_sigaction {
112 struct sigaction sa;
113};
114
115typedef struct sigaltstack {
116 void __user *ss_sp;
117 int ss_flags;
118 size_t ss_size;
119} stack_t;
120
121#ifdef __KERNEL__
122
123#include <asm/sigcontext.h>
124#undef __HAVE_ARCH_SIG_BITOPS
125
126#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127
128#endif /* __KERNEL__ */
129#endif /* __ASSEMBLY__ */
27 130
28#endif /* __ASM_GENERIC_SIGNAL_H */ 131#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
new file mode 100644
index 000000000000..5d79e409241c
--- /dev/null
+++ b/include/asm-generic/socket.h
@@ -0,0 +1,63 @@
1#ifndef __ASM_GENERIC_SOCKET_H
2#define __ASM_GENERIC_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26
27#ifndef SO_PASSCRED /* powerpc only differs in these */
28#define SO_PASSCRED 16
29#define SO_PEERCRED 17
30#define SO_RCVLOWAT 18
31#define SO_SNDLOWAT 19
32#define SO_RCVTIMEO 20
33#define SO_SNDTIMEO 21
34#endif
35
36/* Security levels - as per NRL IPv6 - don't actually do anything */
37#define SO_SECURITY_AUTHENTICATION 22
38#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
39#define SO_SECURITY_ENCRYPTION_NETWORK 24
40
41#define SO_BINDTODEVICE 25
42
43/* Socket filtering */
44#define SO_ATTACH_FILTER 26
45#define SO_DETACH_FILTER 27
46
47#define SO_PEERNAME 28
48#define SO_TIMESTAMP 29
49#define SCM_TIMESTAMP SO_TIMESTAMP
50
51#define SO_ACCEPTCONN 30
52
53#define SO_PEERSEC 31
54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
57
58#define SO_MARK 36
59
60#define SO_TIMESTAMPING 37
61#define SCM_TIMESTAMPING SO_TIMESTAMPING
62
63#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/sockios.h b/include/asm-generic/sockios.h
new file mode 100644
index 000000000000..9a61a369b901
--- /dev/null
+++ b/include/asm-generic/sockios.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_GENERIC_SOCKIOS_H
2#define __ASM_GENERIC_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ASM_GENERIC_SOCKIOS_H */
diff --git a/include/asm-generic/spinlock.h b/include/asm-generic/spinlock.h
new file mode 100644
index 000000000000..1547a03ac50f
--- /dev/null
+++ b/include/asm-generic/spinlock.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_GENERIC_SPINLOCK_H
2#define __ASM_GENERIC_SPINLOCK_H
3/*
4 * You need to implement asm/spinlock.h for SMP support. The generic
5 * version does not handle SMP.
6 */
7#ifdef CONFIG_SMP
8#error need an architecture specific asm/spinlock.h
9#endif
10
11#endif /* __ASM_GENERIC_SPINLOCK_H */
diff --git a/include/asm-generic/stat.h b/include/asm-generic/stat.h
new file mode 100644
index 000000000000..47e64170305d
--- /dev/null
+++ b/include/asm-generic/stat.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_GENERIC_STAT_H
2#define __ASM_GENERIC_STAT_H
3
4/*
5 * Everybody gets this wrong and has to stick with it for all
6 * eternity. Hopefully, this version gets used by new architectures
7 * so they don't fall into the same traps.
8 *
9 * stat64 is copied from powerpc64, with explicit padding added.
10 * stat is the same structure layout on 64-bit, without the 'long long'
11 * types.
12 *
13 * By convention, 64 bit architectures use the stat interface, while
14 * 32 bit architectures use the stat64 interface. Note that we don't
15 * provide an __old_kernel_stat here, which new architecture should
16 * not have to start with.
17 */
18
19#include <asm/bitsperlong.h>
20
21#define STAT_HAVE_NSEC 1
22
23struct stat {
24 unsigned long st_dev; /* Device. */
25 unsigned long st_ino; /* File serial number. */
26 unsigned int st_mode; /* File mode. */
27 unsigned int st_nlink; /* Link count. */
28 unsigned int st_uid; /* User ID of the file's owner. */
29 unsigned int st_gid; /* Group ID of the file's group. */
30 unsigned long st_rdev; /* Device number, if device. */
31 unsigned long __pad1;
32 long st_size; /* Size of file, in bytes. */
33 int st_blksize; /* Optimal block size for I/O. */
34 int __pad2;
35 long st_blocks; /* Number 512-byte blocks allocated. */
36 int st_atime; /* Time of last access. */
37 unsigned int st_atime_nsec;
38 int st_mtime; /* Time of last modification. */
39 unsigned int st_mtime_nsec;
40 int st_ctime; /* Time of last status change. */
41 unsigned int st_ctime_nsec;
42 unsigned int __unused4;
43 unsigned int __unused5;
44};
45
46#if __BITS_PER_LONG != 64
47/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
48struct stat64 {
49 unsigned long long st_dev; /* Device. */
50 unsigned long long st_ino; /* File serial number. */
51 unsigned int st_mode; /* File mode. */
52 unsigned int st_nlink; /* Link count. */
53 unsigned int st_uid; /* User ID of the file's owner. */
54 unsigned int st_gid; /* Group ID of the file's group. */
55 unsigned long long st_rdev; /* Device number, if device. */
56 unsigned long long __pad1;
57 long long st_size; /* Size of file, in bytes. */
58 int st_blksize; /* Optimal block size for I/O. */
59 int __pad2;
60 long long st_blocks; /* Number 512-byte blocks allocated. */
61 int st_atime; /* Time of last access. */
62 unsigned int st_atime_nsec;
63 int st_mtime; /* Time of last modification. */
64 unsigned int st_mtime_nsec;
65 int st_ctime; /* Time of last status change. */
66 unsigned int st_ctime_nsec;
67 unsigned int __unused4;
68 unsigned int __unused5;
69};
70#endif
71
72#endif /* __ASM_GENERIC_STAT_H */
diff --git a/include/asm-generic/string.h b/include/asm-generic/string.h
new file mode 100644
index 000000000000..de5e0201459f
--- /dev/null
+++ b/include/asm-generic/string.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_GENERIC_STRING_H
2#define __ASM_GENERIC_STRING_H
3/*
4 * The kernel provides all required functions in lib/string.c
5 *
6 * Architectures probably want to provide at least their own optimized
7 * memcpy and memset functions though.
8 */
9
10#endif /* __ASM_GENERIC_STRING_H */
diff --git a/include/asm-generic/swab.h b/include/asm-generic/swab.h
new file mode 100644
index 000000000000..a8e9029d9eba
--- /dev/null
+++ b/include/asm-generic/swab.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_GENERIC_SWAB_H
2#define _ASM_GENERIC_SWAB_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * 32 bit architectures typically (but not always) want to
8 * set __SWAB_64_THRU_32__. In user space, this is only
9 * valid if the compiler supports 64 bit data types.
10 */
11
12#if __BITS_PER_LONG == 32
13#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
14#define __SWAB_64_THRU_32__
15#endif
16#endif
17
18#endif /* _ASM_GENERIC_SWAB_H */
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
new file mode 100644
index 000000000000..df84e3b04555
--- /dev/null
+++ b/include/asm-generic/syscalls.h
@@ -0,0 +1,60 @@
1#ifndef __ASM_GENERIC_SYSCALLS_H
2#define __ASM_GENERIC_SYSCALLS_H
3
4#include <linux/compiler.h>
5#include <linux/linkage.h>
6
7/*
8 * Calling conventions for these system calls can differ, so
9 * it's possible to override them.
10 */
11#ifndef sys_clone
12asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
13 void __user *parent_tid, void __user *child_tid,
14 struct pt_regs *regs);
15#endif
16
17#ifndef sys_fork
18asmlinkage long sys_fork(struct pt_regs *regs);
19#endif
20
21#ifndef sys_vfork
22asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif
24
25#ifndef sys_execve
26asmlinkage long sys_execve(char __user *filename, char __user * __user *argv,
27 char __user * __user *envp, struct pt_regs *regs);
28#endif
29
30#ifndef sys_mmap2
31asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
32 unsigned long prot, unsigned long flags,
33 unsigned long fd, unsigned long pgoff);
34#endif
35
36#ifndef sys_mmap
37asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, off_t pgoff);
40#endif
41
42#ifndef sys_sigaltstack
43asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
44 struct pt_regs *);
45#endif
46
47#ifndef sys_rt_sigreturn
48asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
49#endif
50
51#ifndef sys_rt_sigsuspend
52asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
53#endif
54
55#ifndef sys_rt_sigaction
56asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
57 struct sigaction __user *oact, size_t sigsetsize);
58#endif
59
60#endif /* __ASM_GENERIC_SYSCALLS_H */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
new file mode 100644
index 000000000000..efa403b5e121
--- /dev/null
+++ b/include/asm-generic/system.h
@@ -0,0 +1,161 @@
1/* Generic system definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SYSTEM_H
15#define __ASM_GENERIC_SYSTEM_H
16
17#ifdef __KERNEL__
18#ifndef __ASSEMBLY__
19
20#include <linux/types.h>
21#include <linux/irqflags.h>
22
23#include <asm/cmpxchg-local.h>
24
25struct task_struct;
26
27/* context switching is now performed out-of-line in switch_to.S */
28extern struct task_struct *__switch_to(struct task_struct *,
29 struct task_struct *);
30#define switch_to(prev, next, last) \
31 do { \
32 ((last) = __switch_to((prev), (next))); \
33 } while (0)
34
35#define arch_align_stack(x) (x)
36
37#define nop() asm volatile ("nop")
38
39#endif /* !__ASSEMBLY__ */
40
41/*
42 * Force strict CPU ordering.
43 * And yes, this is required on UP too when we're talking
44 * to devices.
45 *
46 * This implementation only contains a compiler barrier.
47 */
48
49#define mb() asm volatile ("": : :"memory")
50#define rmb() mb()
51#define wmb() asm volatile ("": : :"memory")
52
53#ifdef CONFIG_SMP
54#define smp_mb() mb()
55#define smp_rmb() rmb()
56#define smp_wmb() wmb()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#endif
62
63#define set_mb(var, value) do { var = value; mb(); } while (0)
64#define set_wmb(var, value) do { var = value; wmb(); } while (0)
65
66#define read_barrier_depends() do {} while (0)
67#define smp_read_barrier_depends() do {} while (0)
68
69/*
70 * we make sure local_irq_enable() doesn't cause priority inversion
71 */
72#ifndef __ASSEMBLY__
73
74/* This function doesn't exist, so you'll get a linker error
75 * if something tries to do an invalid xchg(). */
76extern void __xchg_called_with_bad_pointer(void);
77
78static inline
79unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
80{
81 unsigned long ret, flags;
82
83 switch (size) {
84 case 1:
85#ifdef __xchg_u8
86 return __xchg_u8(x, ptr);
87#else
88 local_irq_save(flags);
89 ret = *(volatile u8 *)ptr;
90 *(volatile u8 *)ptr = x;
91 local_irq_restore(flags);
92 return ret;
93#endif /* __xchg_u8 */
94
95 case 2:
96#ifdef __xchg_u16
97 return __xchg_u16(x, ptr);
98#else
99 local_irq_save(flags);
100 ret = *(volatile u16 *)ptr;
101 *(volatile u16 *)ptr = x;
102 local_irq_restore(flags);
103 return ret;
104#endif /* __xchg_u16 */
105
106 case 4:
107#ifdef __xchg_u32
108 return __xchg_u32(x, ptr);
109#else
110 local_irq_save(flags);
111 ret = *(volatile u32 *)ptr;
112 *(volatile u32 *)ptr = x;
113 local_irq_restore(flags);
114 return ret;
115#endif /* __xchg_u32 */
116
117#ifdef CONFIG_64BIT
118 case 8:
119#ifdef __xchg_u64
120 return __xchg_u64(x, ptr);
121#else
122 local_irq_save(flags);
123 ret = *(volatile u64 *)ptr;
124 *(volatile u64 *)ptr = x;
125 local_irq_restore(flags);
126 return ret;
127#endif /* __xchg_u64 */
128#endif /* CONFIG_64BIT */
129
130 default:
131 __xchg_called_with_bad_pointer();
132 return x;
133 }
134}
135
136#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138
139static inline unsigned long __cmpxchg(volatile unsigned long *m,
140 unsigned long old, unsigned long new)
141{
142 unsigned long retval;
143 unsigned long flags;
144
145 local_irq_save(flags);
146 retval = *m;
147 if (retval == old)
148 *m = new;
149 local_irq_restore(flags);
150 return retval;
151}
152
153#define cmpxchg(ptr, o, n) \
154 ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
155 (unsigned long)(o), \
156 (unsigned long)(n)))
157
158#endif /* !__ASSEMBLY__ */
159
160#endif /* __KERNEL__ */
161#endif /* __ASM_GENERIC_SYSTEM_H */
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
new file mode 100644
index 000000000000..1c9773d48cb0
--- /dev/null
+++ b/include/asm-generic/termbits.h
@@ -0,0 +1,198 @@
1#ifndef __ASM_GENERIC_TERMBITS_H
2#define __ASM_GENERIC_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */
162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
165/* c_lflag bits */
166#define ISIG 0000001
167#define ICANON 0000002
168#define XCASE 0000004
169#define ECHO 0000010
170#define ECHOE 0000020
171#define ECHOK 0000040
172#define ECHONL 0000100
173#define NOFLSH 0000200
174#define TOSTOP 0000400
175#define ECHOCTL 0001000
176#define ECHOPRT 0002000
177#define ECHOKE 0004000
178#define FLUSHO 0010000
179#define PENDIN 0040000
180#define IEXTEN 0100000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* __ASM_GENERIC_TERMBITS_H */
diff --git a/include/asm-generic/termios-base.h b/include/asm-generic/termios-base.h
new file mode 100644
index 000000000000..0a769feb22b0
--- /dev/null
+++ b/include/asm-generic/termios-base.h
@@ -0,0 +1,77 @@
1/* termios.h: generic termios/termio user copying/translation
2 */
3
4#ifndef _ASM_GENERIC_TERMIOS_BASE_H
5#define _ASM_GENERIC_TERMIOS_BASE_H
6
7#include <asm/uaccess.h>
8
9#ifndef __ARCH_TERMIO_GETPUT
10
11/*
12 * Translate a "termio" structure into a "termios". Ugh.
13 */
14static inline int user_termio_to_kernel_termios(struct ktermios *termios,
15 struct termio __user *termio)
16{
17 unsigned short tmp;
18
19 if (get_user(tmp, &termio->c_iflag) < 0)
20 goto fault;
21 termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
22
23 if (get_user(tmp, &termio->c_oflag) < 0)
24 goto fault;
25 termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
26
27 if (get_user(tmp, &termio->c_cflag) < 0)
28 goto fault;
29 termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
30
31 if (get_user(tmp, &termio->c_lflag) < 0)
32 goto fault;
33 termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
34
35 if (get_user(termios->c_line, &termio->c_line) < 0)
36 goto fault;
37
38 if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
39 goto fault;
40
41 return 0;
42
43 fault:
44 return -EFAULT;
45}
46
47/*
48 * Translate a "termios" structure into a "termio". Ugh.
49 */
50static inline int kernel_termios_to_user_termio(struct termio __user *termio,
51 struct ktermios *termios)
52{
53 if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
54 put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
55 put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
56 put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
57 put_user(termios->c_line, &termio->c_line) < 0 ||
58 copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
59 return -EFAULT;
60
61 return 0;
62}
63
64#ifndef user_termios_to_kernel_termios
65#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
66#endif
67
68#ifndef kernel_termios_to_user_termios
69#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
70#endif
71
72#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
73#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
74
75#endif /* __ARCH_TERMIO_GETPUT */
76
77#endif /* _ASM_GENERIC_TERMIOS_BASE_H */
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index 7d39ecc92d94..d0922adc56d4 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -1,18 +1,68 @@
1/* termios.h: generic termios/termio user copying/translation
2 */
3
4#ifndef _ASM_GENERIC_TERMIOS_H 1#ifndef _ASM_GENERIC_TERMIOS_H
5#define _ASM_GENERIC_TERMIOS_H 2#define _ASM_GENERIC_TERMIOS_H
3/*
4 * Most architectures have straight copies of the x86 code, with
5 * varying levels of bug fixes on top. Usually it's a good idea
6 * to use this generic version instead, but be careful to avoid
7 * ABI changes.
8 * New architectures should not provide their own version.
9 */
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49#ifdef __KERNEL__
6 50
7#include <asm/uaccess.h> 51#include <asm/uaccess.h>
8 52
9#ifndef __ARCH_TERMIO_GETPUT 53/* intr=^C quit=^\ erase=del kill=^U
54 eof=^D vtime=\0 vmin=\1 sxtc=\0
55 start=^Q stop=^S susp=^Z eol=\0
56 reprint=^R discard=^U werase=^W lnext=^V
57 eol2=\0
58*/
59#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
10 60
11/* 61/*
12 * Translate a "termio" structure into a "termios". Ugh. 62 * Translate a "termio" structure into a "termios". Ugh.
13 */ 63 */
14static inline int user_termio_to_kernel_termios(struct ktermios *termios, 64static inline int user_termio_to_kernel_termios(struct ktermios *termios,
15 struct termio __user *termio) 65 const struct termio __user *termio)
16{ 66{
17 unsigned short tmp; 67 unsigned short tmp;
18 68
@@ -61,17 +111,44 @@ static inline int kernel_termios_to_user_termio(struct termio __user *termio,
61 return 0; 111 return 0;
62} 112}
63 113
64#ifndef user_termios_to_kernel_termios 114#ifdef TCGETS2
65#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 115static inline int user_termios_to_kernel_termios(struct ktermios *k,
66#endif 116 struct termios2 __user *u)
117{
118 return copy_from_user(k, u, sizeof(struct termios2));
119}
67 120
68#ifndef kernel_termios_to_user_termios 121static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
69#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 122 struct ktermios *k)
70#endif 123{
124 return copy_to_user(u, k, sizeof(struct termios2));
125}
71 126
72#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) 127static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
73#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) 128 struct termios __user *u)
129{
130 return copy_from_user(k, u, sizeof(struct termios));
131}
132
133static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
134 struct ktermios *k)
135{
136 return copy_to_user(u, k, sizeof(struct termios));
137}
138#else /* TCGETS2 */
139static inline int user_termios_to_kernel_termios(struct ktermios *k,
140 struct termios __user *u)
141{
142 return copy_from_user(k, u, sizeof(struct termios));
143}
144
145static inline int kernel_termios_to_user_termios(struct termios __user *u,
146 struct ktermios *k)
147{
148 return copy_to_user(u, k, sizeof(struct termios));
149}
150#endif /* TCGETS2 */
74 151
75#endif /* __ARCH_TERMIO_GETPUT */ 152#endif /* __KERNEL__ */
76 153
77#endif /* _ASM_GENERIC_TERMIOS_H */ 154#endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/timex.h b/include/asm-generic/timex.h
new file mode 100644
index 000000000000..b2243cb8d6f6
--- /dev/null
+++ b/include/asm-generic/timex.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_GENERIC_TIMEX_H
2#define __ASM_GENERIC_TIMEX_H
3
4/*
5 * If you have a cycle counter, return the value here.
6 */
7typedef unsigned long cycles_t;
8#ifndef get_cycles
9static inline cycles_t get_cycles(void)
10{
11 return 0;
12}
13#endif
14
15/*
16 * Architectures are encouraged to implement read_current_timer
17 * and define this in order to avoid the expensive delay loop
18 * calibration during boot.
19 */
20#undef ARCH_HAS_READ_CURRENT_TIMER
21
22#endif /* __ASM_GENERIC_TIMEX_H */
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h
new file mode 100644
index 000000000000..c7af037024c7
--- /dev/null
+++ b/include/asm-generic/tlbflush.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_GENERIC_TLBFLUSH_H
2#define __ASM_GENERIC_TLBFLUSH_H
3/*
4 * This is a dummy tlbflush implementation that can be used on all
5 * nommu architectures.
6 * If you have an MMU, you need to write your own functions.
7 */
8#ifdef CONFIG_MMU
9#error need to implement an architecture specific asm/tlbflush.h
10#endif
11
12static inline void flush_tlb_mm(struct mm_struct *mm)
13{
14 BUG();
15}
16
17
18#endif /* __ASM_GENERIC_TLBFLUSH_H */
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
new file mode 100644
index 000000000000..fba7d33ca3f2
--- /dev/null
+++ b/include/asm-generic/types.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_GENERIC_TYPES_H
2#define _ASM_GENERIC_TYPES_H
3/*
4 * int-ll64 is used practically everywhere now,
5 * so use it as a reasonable default.
6 */
7#include <asm-generic/int-ll64.h>
8
9#ifndef __ASSEMBLY__
10
11typedef unsigned short umode_t;
12
13#endif /* __ASSEMBLY__ */
14
15/*
16 * These aren't exported outside the kernel to avoid name space clashes
17 */
18#ifdef __KERNEL__
19#ifndef __ASSEMBLY__
20/*
21 * DMA addresses may be very different from physical addresses
22 * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit
23 * systems, while sparc64 uses 32 bit DMA addresses for 64 bit
24 * physical addresses.
25 * This default defines dma_addr_t to have the same size as
26 * phys_addr_t, which is the most common way.
27 * Do not define the dma64_addr_t type, which never really
28 * worked.
29 */
30#ifndef dma_addr_t
31#ifdef CONFIG_PHYS_ADDR_T_64BIT
32typedef u64 dma_addr_t;
33#else
34typedef u32 dma_addr_t;
35#endif /* CONFIG_PHYS_ADDR_T_64BIT */
36#endif /* dma_addr_t */
37
38#endif /* __ASSEMBLY__ */
39
40#endif /* __KERNEL__ */
41
42#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/uaccess-unaligned.h b/include/asm-generic/uaccess-unaligned.h
new file mode 100644
index 000000000000..67deb898f0c5
--- /dev/null
+++ b/include/asm-generic/uaccess-unaligned.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_GENERIC_UACCESS_UNALIGNED_H
2#define __ASM_GENERIC_UACCESS_UNALIGNED_H
3
4/*
5 * This macro should be used instead of __get_user() when accessing
6 * values at locations that are not known to be aligned.
7 */
8#define __get_user_unaligned(x, ptr) \
9({ \
10 __typeof__ (*(ptr)) __x; \
11 __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
12 (x) = __x; \
13})
14
15
16/*
17 * This macro should be used instead of __put_user() when accessing
18 * values at locations that are not known to be aligned.
19 */
20#define __put_user_unaligned(x, ptr) \
21({ \
22 __typeof__ (*(ptr)) __x = (x); \
23 __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
24})
25
26#endif /* __ASM_GENERIC_UACCESS_UNALIGNED_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 549cb3a1640a..6d8cab22e294 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -1,26 +1,325 @@
1#ifndef _ASM_GENERIC_UACCESS_H_ 1#ifndef __ASM_GENERIC_UACCESS_H
2#define _ASM_GENERIC_UACCESS_H_ 2#define __ASM_GENERIC_UACCESS_H
3 3
4/* 4/*
5 * This macro should be used instead of __get_user() when accessing 5 * User space memory access functions, these should work
6 * values at locations that are not known to be aligned. 6 * on a ny machine that has kernel and user data in the same
7 * address space, e.g. all NOMMU machines.
7 */ 8 */
8#define __get_user_unaligned(x, ptr) \ 9#include <linux/sched.h>
9({ \ 10#include <linux/mm.h>
10 __typeof__ (*(ptr)) __x; \ 11#include <linux/string.h>
11 __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \ 12
12 (x) = __x; \ 13#include <asm/segment.h>
13}) 14
15#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
16
17#ifndef KERNEL_DS
18#define KERNEL_DS MAKE_MM_SEG(~0UL)
19#endif
20
21#ifndef USER_DS
22#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
23#endif
24
25#ifndef get_fs
26#define get_ds() (KERNEL_DS)
27#define get_fs() (current_thread_info()->addr_limit)
28
29static inline void set_fs(mm_segment_t fs)
30{
31 current_thread_info()->addr_limit = fs;
32}
33#endif
14 34
35#define segment_eq(a, b) ((a).seg == (b).seg)
36
37#define VERIFY_READ 0
38#define VERIFY_WRITE 1
39
40#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size))
41
42/*
43 * The architecture should really override this if possible, at least
44 * doing a check on the get_fs()
45 */
46#ifndef __access_ok
47static inline int __access_ok(unsigned long addr, unsigned long size)
48{
49 return 1;
50}
51#endif
15 52
16/* 53/*
17 * This macro should be used instead of __put_user() when accessing 54 * The exception table consists of pairs of addresses: the first is the
18 * values at locations that are not known to be aligned. 55 * address of an instruction that is allowed to fault, and the second is
56 * the address at which the program should continue. No registers are
57 * modified, so it is entirely up to the continuation code to figure out
58 * what to do.
59 *
60 * All the routines below use bits of fixup code that are out of line
61 * with the main instruction path. This means when everything is well,
62 * we don't even have to jump over them. Further, they do not intrude
63 * on our cache or tlb entries.
19 */ 64 */
20#define __put_user_unaligned(x, ptr) \ 65
21({ \ 66struct exception_table_entry
22 __typeof__ (*(ptr)) __x = (x); \ 67{
23 __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \ 68 unsigned long insn, fixup;
69};
70
71/* Returns 0 if exception not found and fixup otherwise. */
72extern unsigned long search_exception_table(unsigned long);
73
74/*
75 * architectures with an MMU should override these two
76 */
77#ifndef __copy_from_user
78static inline __must_check long __copy_from_user(void *to,
79 const void __user * from, unsigned long n)
80{
81 if (__builtin_constant_p(n)) {
82 switch(n) {
83 case 1:
84 *(u8 *)to = *(u8 __force *)from;
85 return 0;
86 case 2:
87 *(u16 *)to = *(u16 __force *)from;
88 return 0;
89 case 4:
90 *(u32 *)to = *(u32 __force *)from;
91 return 0;
92#ifdef CONFIG_64BIT
93 case 8:
94 *(u64 *)to = *(u64 __force *)from;
95 return 0;
96#endif
97 default:
98 break;
99 }
100 }
101
102 memcpy(to, (const void __force *)from, n);
103 return 0;
104}
105#endif
106
107#ifndef __copy_to_user
108static inline __must_check long __copy_to_user(void __user *to,
109 const void *from, unsigned long n)
110{
111 if (__builtin_constant_p(n)) {
112 switch(n) {
113 case 1:
114 *(u8 __force *)to = *(u8 *)from;
115 return 0;
116 case 2:
117 *(u16 __force *)to = *(u16 *)from;
118 return 0;
119 case 4:
120 *(u32 __force *)to = *(u32 *)from;
121 return 0;
122#ifdef CONFIG_64BIT
123 case 8:
124 *(u64 __force *)to = *(u64 *)from;
125 return 0;
126#endif
127 default:
128 break;
129 }
130 }
131
132 memcpy((void __force *)to, from, n);
133 return 0;
134}
135#endif
136
137/*
138 * These are the main single-value transfer routines. They automatically
139 * use the right size if we just have the right pointer type.
140 * This version just falls back to copy_{from,to}_user, which should
141 * provide a fast-path for small values.
142 */
143#define __put_user(x, ptr) \
144({ \
145 __typeof__(*(ptr)) __x = (x); \
146 int __pu_err = -EFAULT; \
147 __chk_user_ptr(ptr); \
148 switch (sizeof (*(ptr))) { \
149 case 1: \
150 case 2: \
151 case 4: \
152 case 8: \
153 __pu_err = __put_user_fn(sizeof (*(ptr)), \
154 ptr, &__x); \
155 break; \
156 default: \
157 __put_user_bad(); \
158 break; \
159 } \
160 __pu_err; \
161})
162
163#define put_user(x, ptr) \
164({ \
165 might_sleep(); \
166 __access_ok(ptr, sizeof (*ptr)) ? \
167 __put_user(x, ptr) : \
168 -EFAULT; \
24}) 169})
25 170
26#endif /* _ASM_GENERIC_UACCESS_H */ 171static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
172{
173 size = __copy_to_user(ptr, x, size);
174 return size ? -EFAULT : size;
175}
176
177extern int __put_user_bad(void) __attribute__((noreturn));
178
179#define __get_user(x, ptr) \
180({ \
181 int __gu_err = -EFAULT; \
182 __chk_user_ptr(ptr); \
183 switch (sizeof(*(ptr))) { \
184 case 1: { \
185 unsigned char __x; \
186 __gu_err = __get_user_fn(sizeof (*(ptr)), \
187 ptr, &__x); \
188 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
189 break; \
190 }; \
191 case 2: { \
192 unsigned short __x; \
193 __gu_err = __get_user_fn(sizeof (*(ptr)), \
194 ptr, &__x); \
195 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
196 break; \
197 }; \
198 case 4: { \
199 unsigned int __x; \
200 __gu_err = __get_user_fn(sizeof (*(ptr)), \
201 ptr, &__x); \
202 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
203 break; \
204 }; \
205 case 8: { \
206 unsigned long long __x; \
207 __gu_err = __get_user_fn(sizeof (*(ptr)), \
208 ptr, &__x); \
209 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
210 break; \
211 }; \
212 default: \
213 __get_user_bad(); \
214 break; \
215 } \
216 __gu_err; \
217})
218
219#define get_user(x, ptr) \
220({ \
221 might_sleep(); \
222 __access_ok(ptr, sizeof (*ptr)) ? \
223 __get_user(x, ptr) : \
224 -EFAULT; \
225})
226
227static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
228{
229 size = __copy_from_user(x, ptr, size);
230 return size ? -EFAULT : size;
231}
232
233extern int __get_user_bad(void) __attribute__((noreturn));
234
235#ifndef __copy_from_user_inatomic
236#define __copy_from_user_inatomic __copy_from_user
237#endif
238
239#ifndef __copy_to_user_inatomic
240#define __copy_to_user_inatomic __copy_to_user
241#endif
242
243static inline long copy_from_user(void *to,
244 const void __user * from, unsigned long n)
245{
246 might_sleep();
247 if (__access_ok(from, n))
248 return __copy_from_user(to, from, n);
249 else
250 return n;
251}
252
253static inline long copy_to_user(void __user *to,
254 const void *from, unsigned long n)
255{
256 might_sleep();
257 if (__access_ok(to, n))
258 return __copy_to_user(to, from, n);
259 else
260 return n;
261}
262
263/*
264 * Copy a null terminated string from userspace.
265 */
266#ifndef __strncpy_from_user
267static inline long
268__strncpy_from_user(char *dst, const char __user *src, long count)
269{
270 char *tmp;
271 strncpy(dst, (const char __force *)src, count);
272 for (tmp = dst; *tmp && count > 0; tmp++, count--)
273 ;
274 return (tmp - dst);
275}
276#endif
277
278static inline long
279strncpy_from_user(char *dst, const char __user *src, long count)
280{
281 if (!__access_ok(src, 1))
282 return -EFAULT;
283 return __strncpy_from_user(dst, src, count);
284}
285
286/*
287 * Return the size of a string (including the ending 0)
288 *
289 * Return 0 on exception, a value greater than N if too long
290 */
291#ifndef strnlen_user
292static inline long strnlen_user(const char __user *src, long n)
293{
294 return strlen((void * __force)src) + 1;
295}
296#endif
297
298static inline long strlen_user(const char __user *src)
299{
300 return strnlen_user(src, 32767);
301}
302
303/*
304 * Zero Userspace
305 */
306#ifndef __clear_user
307static inline __must_check unsigned long
308__clear_user(void __user *to, unsigned long n)
309{
310 memset((void __force *)to, 0, n);
311 return 0;
312}
313#endif
314
315static inline __must_check unsigned long
316clear_user(void __user *to, unsigned long n)
317{
318 might_sleep();
319 if (!__access_ok(to, n))
320 return n;
321
322 return __clear_user(to, n);
323}
324
325#endif /* __ASM_GENERIC_UACCESS_H */
diff --git a/include/asm-generic/ucontext.h b/include/asm-generic/ucontext.h
new file mode 100644
index 000000000000..ad77343e8a9a
--- /dev/null
+++ b/include/asm-generic/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_UCONTEXT_H
2#define __ASM_GENERIC_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* __ASM_GENERIC_UCONTEXT_H */
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
new file mode 100644
index 000000000000..03cf5936bad6
--- /dev/null
+++ b/include/asm-generic/unaligned.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_GENERIC_UNALIGNED_H
2#define __ASM_GENERIC_UNALIGNED_H
3
4/*
5 * This is the most generic implementation of unaligned accesses
6 * and should work almost anywhere.
7 *
8 * If an architecture can handle unaligned accesses in hardware,
9 * it may want to use the linux/unaligned/access_ok.h implementation
10 * instead.
11 */
12#include <asm/byteorder.h>
13
14#if defined(__LITTLE_ENDIAN)
15# include <linux/unaligned/le_struct.h>
16# include <linux/unaligned/be_byteshift.h>
17# include <linux/unaligned/generic.h>
18# define get_unaligned __get_unaligned_le
19# define put_unaligned __put_unaligned_le
20#elif defined(__BIG_ENDIAN)
21# include <linux/unaligned/be_struct.h>
22# include <linux/unaligned/le_byteshift.h>
23# include <linux/unaligned/generic.h>
24# define get_unaligned __get_unaligned_be
25# define put_unaligned __put_unaligned_be
26#else
27# error need to define endianess
28#endif
29
30#endif /* __ASM_GENERIC_UNALIGNED_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
new file mode 100644
index 000000000000..5b34b6233d6d
--- /dev/null
+++ b/include/asm-generic/unistd.h
@@ -0,0 +1,854 @@
1#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
2#define _ASM_GENERIC_UNISTD_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * This file contains the system call numbers, based on the
8 * layout of the x86-64 architecture, which embeds the
9 * pointer to the syscall in the table.
10 *
11 * As a basic principle, no duplication of functionality
12 * should be added, e.g. we don't use lseek when llseek
13 * is present. New architectures should use this file
14 * and implement the less feature-full calls in user space.
15 */
16
17#ifndef __SYSCALL
18#define __SYSCALL(x, y)
19#endif
20
21#if __BITS_PER_LONG == 32
22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
23#else
24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
25#endif
26
27#define __NR_io_setup 0
28__SYSCALL(__NR_io_setup, sys_io_setup)
29#define __NR_io_destroy 1
30__SYSCALL(__NR_io_destroy, sys_io_destroy)
31#define __NR_io_submit 2
32__SYSCALL(__NR_io_submit, sys_io_submit)
33#define __NR_io_cancel 3
34__SYSCALL(__NR_io_cancel, sys_io_cancel)
35#define __NR_io_getevents 4
36__SYSCALL(__NR_io_getevents, sys_io_getevents)
37
38/* fs/xattr.c */
39#define __NR_setxattr 5
40__SYSCALL(__NR_setxattr, sys_setxattr)
41#define __NR_lsetxattr 6
42__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
43#define __NR_fsetxattr 7
44__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
45#define __NR_getxattr 8
46__SYSCALL(__NR_getxattr, sys_getxattr)
47#define __NR_lgetxattr 9
48__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
49#define __NR_fgetxattr 10
50__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
51#define __NR_listxattr 11
52__SYSCALL(__NR_listxattr, sys_listxattr)
53#define __NR_llistxattr 12
54__SYSCALL(__NR_llistxattr, sys_llistxattr)
55#define __NR_flistxattr 13
56__SYSCALL(__NR_flistxattr, sys_flistxattr)
57#define __NR_removexattr 14
58__SYSCALL(__NR_removexattr, sys_removexattr)
59#define __NR_lremovexattr 15
60__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
61#define __NR_fremovexattr 16
62__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
63
64/* fs/dcache.c */
65#define __NR_getcwd 17
66__SYSCALL(__NR_getcwd, sys_getcwd)
67
68/* fs/cookies.c */
69#define __NR_lookup_dcookie 18
70__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
71
72/* fs/eventfd.c */
73#define __NR_eventfd2 19
74__SYSCALL(__NR_eventfd2, sys_eventfd2)
75
76/* fs/eventpoll.c */
77#define __NR_epoll_create1 20
78__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
79#define __NR_epoll_ctl 21
80__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
81#define __NR_epoll_pwait 22
82__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
83
84/* fs/fcntl.c */
85#define __NR_dup 23
86__SYSCALL(__NR_dup, sys_dup)
87#define __NR_dup3 24
88__SYSCALL(__NR_dup3, sys_dup3)
89#define __NR3264_fcntl 25
90__SC_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl)
91
92/* fs/inotify_user.c */
93#define __NR_inotify_init1 26
94__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
95#define __NR_inotify_add_watch 27
96__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
97#define __NR_inotify_rm_watch 28
98__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
99
100/* fs/ioctl.c */
101#define __NR_ioctl 29
102__SYSCALL(__NR_ioctl, sys_ioctl)
103
104/* fs/ioprio.c */
105#define __NR_ioprio_set 30
106__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
107#define __NR_ioprio_get 31
108__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
109
110/* fs/locks.c */
111#define __NR_flock 32
112__SYSCALL(__NR_flock, sys_flock)
113
114/* fs/namei.c */
115#define __NR_mknodat 33
116__SYSCALL(__NR_mknodat, sys_mknodat)
117#define __NR_mkdirat 34
118__SYSCALL(__NR_mkdirat, sys_mkdirat)
119#define __NR_unlinkat 35
120__SYSCALL(__NR_unlinkat, sys_unlinkat)
121#define __NR_symlinkat 36
122__SYSCALL(__NR_symlinkat, sys_symlinkat)
123#define __NR_linkat 37
124__SYSCALL(__NR_linkat, sys_linkat)
125#define __NR_renameat 38
126__SYSCALL(__NR_renameat, sys_renameat)
127
128/* fs/namespace.c */
129#define __NR_umount2 39
130__SYSCALL(__NR_umount2, sys_umount)
131#define __NR_mount 40
132__SYSCALL(__NR_mount, sys_mount)
133#define __NR_pivot_root 41
134__SYSCALL(__NR_pivot_root, sys_pivot_root)
135
136/* fs/nfsctl.c */
137#define __NR_nfsservctl 42
138__SYSCALL(__NR_nfsservctl, sys_nfsservctl)
139
140/* fs/open.c */
141#define __NR3264_statfs 43
142__SC_3264(__NR3264_statfs, sys_statfs64, sys_statfs)
143#define __NR3264_fstatfs 44
144__SC_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs)
145#define __NR3264_truncate 45
146__SC_3264(__NR3264_truncate, sys_truncate64, sys_truncate)
147#define __NR3264_ftruncate 46
148__SC_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate)
149
150#define __NR_fallocate 47
151__SYSCALL(__NR_fallocate, sys_fallocate)
152#define __NR_faccessat 48
153__SYSCALL(__NR_faccessat, sys_faccessat)
154#define __NR_chdir 49
155__SYSCALL(__NR_chdir, sys_chdir)
156#define __NR_fchdir 50
157__SYSCALL(__NR_fchdir, sys_fchdir)
158#define __NR_chroot 51
159__SYSCALL(__NR_chroot, sys_chroot)
160#define __NR_fchmod 52
161__SYSCALL(__NR_fchmod, sys_fchmod)
162#define __NR_fchmodat 53
163__SYSCALL(__NR_fchmodat, sys_fchmodat)
164#define __NR_fchownat 54
165__SYSCALL(__NR_fchownat, sys_fchownat)
166#define __NR_fchown 55
167__SYSCALL(__NR_fchown, sys_fchown)
168#define __NR_openat 56
169__SYSCALL(__NR_openat, sys_openat)
170#define __NR_close 57
171__SYSCALL(__NR_close, sys_close)
172#define __NR_vhangup 58
173__SYSCALL(__NR_vhangup, sys_vhangup)
174
175/* fs/pipe.c */
176#define __NR_pipe2 59
177__SYSCALL(__NR_pipe2, sys_pipe2)
178
179/* fs/quota.c */
180#define __NR_quotactl 60
181__SYSCALL(__NR_quotactl, sys_quotactl)
182
183/* fs/readdir.c */
184#define __NR_getdents64 61
185__SYSCALL(__NR_getdents64, sys_getdents64)
186
187/* fs/read_write.c */
188#define __NR3264_lseek 62
189__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
190#define __NR_read 63
191__SYSCALL(__NR_read, sys_read)
192#define __NR_write 64
193__SYSCALL(__NR_write, sys_write)
194#define __NR_readv 65
195__SYSCALL(__NR_readv, sys_readv)
196#define __NR_writev 66
197__SYSCALL(__NR_writev, sys_writev)
198#define __NR_pread64 67
199__SYSCALL(__NR_pread64, sys_pread64)
200#define __NR_pwrite64 68
201__SYSCALL(__NR_pwrite64, sys_pwrite64)
202#define __NR_preadv 69
203__SYSCALL(__NR_preadv, sys_preadv)
204#define __NR_pwritev 70
205__SYSCALL(__NR_pwritev, sys_pwritev)
206
207/* fs/sendfile.c */
208#define __NR3264_sendfile 71
209__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile)
210
211/* fs/select.c */
212#define __NR_pselect6 72
213__SYSCALL(__NR_pselect6, sys_pselect6)
214#define __NR_ppoll 73
215__SYSCALL(__NR_ppoll, sys_ppoll)
216
217/* fs/signalfd.c */
218#define __NR_signalfd4 74
219__SYSCALL(__NR_signalfd4, sys_signalfd4)
220
221/* fs/splice.c */
222#define __NR_vmsplice 75
223__SYSCALL(__NR_vmsplice, sys_vmsplice)
224#define __NR_splice 76
225__SYSCALL(__NR_splice, sys_splice)
226#define __NR_tee 77
227__SYSCALL(__NR_tee, sys_tee)
228
229/* fs/stat.c */
230#define __NR_readlinkat 78
231__SYSCALL(__NR_readlinkat, sys_readlinkat)
232#define __NR3264_fstatat 79
233__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
234#define __NR3264_fstat 80
235__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
236
237/* fs/sync.c */
238#define __NR_sync 81
239__SYSCALL(__NR_sync, sys_sync)
240#define __NR_fsync 82
241__SYSCALL(__NR_fsync, sys_fsync)
242#define __NR_fdatasync 83
243__SYSCALL(__NR_fdatasync, sys_fdatasync)
244#define __NR_sync_file_range 84
245__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */
246
247/* fs/timerfd.c */
248#define __NR_timerfd_create 85
249__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
250#define __NR_timerfd_settime 86
251__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
252#define __NR_timerfd_gettime 87
253__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
254
255/* fs/utimes.c */
256#define __NR_utimensat 88
257__SYSCALL(__NR_utimensat, sys_utimensat)
258
259/* kernel/acct.c */
260#define __NR_acct 89
261__SYSCALL(__NR_acct, sys_acct)
262
263/* kernel/capability.c */
264#define __NR_capget 90
265__SYSCALL(__NR_capget, sys_capget)
266#define __NR_capset 91
267__SYSCALL(__NR_capset, sys_capset)
268
269/* kernel/exec_domain.c */
270#define __NR_personality 92
271__SYSCALL(__NR_personality, sys_personality)
272
273/* kernel/exit.c */
274#define __NR_exit 93
275__SYSCALL(__NR_exit, sys_exit)
276#define __NR_exit_group 94
277__SYSCALL(__NR_exit_group, sys_exit_group)
278#define __NR_waitid 95
279__SYSCALL(__NR_waitid, sys_waitid)
280
281/* kernel/fork.c */
282#define __NR_set_tid_address 96
283__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
284#define __NR_unshare 97
285__SYSCALL(__NR_unshare, sys_unshare)
286
287/* kernel/futex.c */
288#define __NR_futex 98
289__SYSCALL(__NR_futex, sys_futex)
290#define __NR_set_robust_list 99
291__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
292#define __NR_get_robust_list 100
293__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
294
295/* kernel/hrtimer.c */
296#define __NR_nanosleep 101
297__SYSCALL(__NR_nanosleep, sys_nanosleep)
298
299/* kernel/itimer.c */
300#define __NR_getitimer 102
301__SYSCALL(__NR_getitimer, sys_getitimer)
302#define __NR_setitimer 103
303__SYSCALL(__NR_setitimer, sys_setitimer)
304
305/* kernel/kexec.c */
306#define __NR_kexec_load 104
307__SYSCALL(__NR_kexec_load, sys_kexec_load)
308
309/* kernel/module.c */
310#define __NR_init_module 105
311__SYSCALL(__NR_init_module, sys_init_module)
312#define __NR_delete_module 106
313__SYSCALL(__NR_delete_module, sys_delete_module)
314
315/* kernel/posix-timers.c */
316#define __NR_timer_create 107
317__SYSCALL(__NR_timer_create, sys_timer_create)
318#define __NR_timer_gettime 108
319__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
320#define __NR_timer_getoverrun 109
321__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
322#define __NR_timer_settime 110
323__SYSCALL(__NR_timer_settime, sys_timer_settime)
324#define __NR_timer_delete 111
325__SYSCALL(__NR_timer_delete, sys_timer_delete)
326#define __NR_clock_settime 112
327__SYSCALL(__NR_clock_settime, sys_clock_settime)
328#define __NR_clock_gettime 113
329__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
330#define __NR_clock_getres 114
331__SYSCALL(__NR_clock_getres, sys_clock_getres)
332#define __NR_clock_nanosleep 115
333__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
334
335/* kernel/printk.c */
336#define __NR_syslog 116
337__SYSCALL(__NR_syslog, sys_syslog)
338
339/* kernel/ptrace.c */
340#define __NR_ptrace 117
341__SYSCALL(__NR_ptrace, sys_ptrace)
342
343/* kernel/sched.c */
344#define __NR_sched_setparam 118
345__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
346#define __NR_sched_setscheduler 119
347__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
348#define __NR_sched_getscheduler 120
349__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
350#define __NR_sched_getparam 121
351__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
352#define __NR_sched_setaffinity 122
353__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
354#define __NR_sched_getaffinity 123
355__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
356#define __NR_sched_yield 124
357__SYSCALL(__NR_sched_yield, sys_sched_yield)
358#define __NR_sched_get_priority_max 125
359__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
360#define __NR_sched_get_priority_min 126
361__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
362#define __NR_sched_rr_get_interval 127
363__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
364
365/* kernel/signal.c */
366#define __NR_restart_syscall 128
367__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
368#define __NR_kill 129
369__SYSCALL(__NR_kill, sys_kill)
370#define __NR_tkill 130
371__SYSCALL(__NR_tkill, sys_tkill)
372#define __NR_tgkill 131
373__SYSCALL(__NR_tgkill, sys_tgkill)
374#define __NR_sigaltstack 132
375__SYSCALL(__NR_sigaltstack, sys_sigaltstack)
376#define __NR_rt_sigsuspend 133
377__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) /* __ARCH_WANT_SYS_RT_SIGSUSPEND */
378#define __NR_rt_sigaction 134
379__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) /* __ARCH_WANT_SYS_RT_SIGACTION */
380#define __NR_rt_sigprocmask 135
381__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
382#define __NR_rt_sigpending 136
383__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
384#define __NR_rt_sigtimedwait 137
385__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait)
386#define __NR_rt_sigqueueinfo 138
387__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo)
388#define __NR_rt_sigreturn 139
389__SYSCALL(__NR_rt_sigreturn, sys_rt_sigreturn) /* sys_rt_sigreturn_wrapper, */
390
391/* kernel/sys.c */
392#define __NR_setpriority 140
393__SYSCALL(__NR_setpriority, sys_setpriority)
394#define __NR_getpriority 141
395__SYSCALL(__NR_getpriority, sys_getpriority)
396#define __NR_reboot 142
397__SYSCALL(__NR_reboot, sys_reboot)
398#define __NR_setregid 143
399__SYSCALL(__NR_setregid, sys_setregid)
400#define __NR_setgid 144
401__SYSCALL(__NR_setgid, sys_setgid)
402#define __NR_setreuid 145
403__SYSCALL(__NR_setreuid, sys_setreuid)
404#define __NR_setuid 146
405__SYSCALL(__NR_setuid, sys_setuid)
406#define __NR_setresuid 147
407__SYSCALL(__NR_setresuid, sys_setresuid)
408#define __NR_getresuid 148
409__SYSCALL(__NR_getresuid, sys_getresuid)
410#define __NR_setresgid 149
411__SYSCALL(__NR_setresgid, sys_setresgid)
412#define __NR_getresgid 150
413__SYSCALL(__NR_getresgid, sys_getresgid)
414#define __NR_setfsuid 151
415__SYSCALL(__NR_setfsuid, sys_setfsuid)
416#define __NR_setfsgid 152
417__SYSCALL(__NR_setfsgid, sys_setfsgid)
418#define __NR_times 153
419__SYSCALL(__NR_times, sys_times)
420#define __NR_setpgid 154
421__SYSCALL(__NR_setpgid, sys_setpgid)
422#define __NR_getpgid 155
423__SYSCALL(__NR_getpgid, sys_getpgid)
424#define __NR_getsid 156
425__SYSCALL(__NR_getsid, sys_getsid)
426#define __NR_setsid 157
427__SYSCALL(__NR_setsid, sys_setsid)
428#define __NR_getgroups 158
429__SYSCALL(__NR_getgroups, sys_getgroups)
430#define __NR_setgroups 159
431__SYSCALL(__NR_setgroups, sys_setgroups)
432#define __NR_uname 160
433__SYSCALL(__NR_uname, sys_newuname)
434#define __NR_sethostname 161
435__SYSCALL(__NR_sethostname, sys_sethostname)
436#define __NR_setdomainname 162
437__SYSCALL(__NR_setdomainname, sys_setdomainname)
438#define __NR_getrlimit 163
439__SYSCALL(__NR_getrlimit, sys_getrlimit)
440#define __NR_setrlimit 164
441__SYSCALL(__NR_setrlimit, sys_setrlimit)
442#define __NR_getrusage 165
443__SYSCALL(__NR_getrusage, sys_getrusage)
444#define __NR_umask 166
445__SYSCALL(__NR_umask, sys_umask)
446#define __NR_prctl 167
447__SYSCALL(__NR_prctl, sys_prctl)
448#define __NR_getcpu 168
449__SYSCALL(__NR_getcpu, sys_getcpu)
450
451/* kernel/time.c */
452#define __NR_gettimeofday 169
453__SYSCALL(__NR_gettimeofday, sys_gettimeofday)
454#define __NR_settimeofday 170
455__SYSCALL(__NR_settimeofday, sys_settimeofday)
456#define __NR_adjtimex 171
457__SYSCALL(__NR_adjtimex, sys_adjtimex)
458
459/* kernel/timer.c */
460#define __NR_getpid 172
461__SYSCALL(__NR_getpid, sys_getpid)
462#define __NR_getppid 173
463__SYSCALL(__NR_getppid, sys_getppid)
464#define __NR_getuid 174
465__SYSCALL(__NR_getuid, sys_getuid)
466#define __NR_geteuid 175
467__SYSCALL(__NR_geteuid, sys_geteuid)
468#define __NR_getgid 176
469__SYSCALL(__NR_getgid, sys_getgid)
470#define __NR_getegid 177
471__SYSCALL(__NR_getegid, sys_getegid)
472#define __NR_gettid 178
473__SYSCALL(__NR_gettid, sys_gettid)
474#define __NR_sysinfo 179
475__SYSCALL(__NR_sysinfo, sys_sysinfo)
476
477/* ipc/mqueue.c */
478#define __NR_mq_open 180
479__SYSCALL(__NR_mq_open, sys_mq_open)
480#define __NR_mq_unlink 181
481__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
482#define __NR_mq_timedsend 182
483__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
484#define __NR_mq_timedreceive 183
485__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
486#define __NR_mq_notify 184
487__SYSCALL(__NR_mq_notify, sys_mq_notify)
488#define __NR_mq_getsetattr 185
489__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
490
491/* ipc/msg.c */
492#define __NR_msgget 186
493__SYSCALL(__NR_msgget, sys_msgget)
494#define __NR_msgctl 187
495__SYSCALL(__NR_msgctl, sys_msgctl)
496#define __NR_msgrcv 188
497__SYSCALL(__NR_msgrcv, sys_msgrcv)
498#define __NR_msgsnd 189
499__SYSCALL(__NR_msgsnd, sys_msgsnd)
500
501/* ipc/sem.c */
502#define __NR_semget 190
503__SYSCALL(__NR_semget, sys_semget)
504#define __NR_semctl 191
505__SYSCALL(__NR_semctl, sys_semctl)
506#define __NR_semtimedop 192
507__SYSCALL(__NR_semtimedop, sys_semtimedop)
508#define __NR_semop 193
509__SYSCALL(__NR_semop, sys_semop)
510
511/* ipc/shm.c */
512#define __NR_shmget 194
513__SYSCALL(__NR_shmget, sys_shmget)
514#define __NR_shmctl 195
515__SYSCALL(__NR_shmctl, sys_shmctl)
516#define __NR_shmat 196
517__SYSCALL(__NR_shmat, sys_shmat)
518#define __NR_shmdt 197
519__SYSCALL(__NR_shmdt, sys_shmdt)
520
521/* net/socket.c */
522#define __NR_socket 198
523__SYSCALL(__NR_socket, sys_socket)
524#define __NR_socketpair 199
525__SYSCALL(__NR_socketpair, sys_socketpair)
526#define __NR_bind 200
527__SYSCALL(__NR_bind, sys_bind)
528#define __NR_listen 201
529__SYSCALL(__NR_listen, sys_listen)
530#define __NR_accept 202
531__SYSCALL(__NR_accept, sys_accept)
532#define __NR_connect 203
533__SYSCALL(__NR_connect, sys_connect)
534#define __NR_getsockname 204
535__SYSCALL(__NR_getsockname, sys_getsockname)
536#define __NR_getpeername 205
537__SYSCALL(__NR_getpeername, sys_getpeername)
538#define __NR_sendto 206
539__SYSCALL(__NR_sendto, sys_sendto)
540#define __NR_recvfrom 207
541__SYSCALL(__NR_recvfrom, sys_recvfrom)
542#define __NR_setsockopt 208
543__SYSCALL(__NR_setsockopt, sys_setsockopt)
544#define __NR_getsockopt 209
545__SYSCALL(__NR_getsockopt, sys_getsockopt)
546#define __NR_shutdown 210
547__SYSCALL(__NR_shutdown, sys_shutdown)
548#define __NR_sendmsg 211
549__SYSCALL(__NR_sendmsg, sys_sendmsg)
550#define __NR_recvmsg 212
551__SYSCALL(__NR_recvmsg, sys_recvmsg)
552
553/* mm/filemap.c */
554#define __NR_readahead 213
555__SYSCALL(__NR_readahead, sys_readahead)
556
557/* mm/nommu.c, also with MMU */
558#define __NR_brk 214
559__SYSCALL(__NR_brk, sys_brk)
560#define __NR_munmap 215
561__SYSCALL(__NR_munmap, sys_munmap)
562#define __NR_mremap 216
563__SYSCALL(__NR_mremap, sys_mremap)
564
565/* security/keys/keyctl.c */
566#define __NR_add_key 217
567__SYSCALL(__NR_add_key, sys_add_key)
568#define __NR_request_key 218
569__SYSCALL(__NR_request_key, sys_request_key)
570#define __NR_keyctl 219
571__SYSCALL(__NR_keyctl, sys_keyctl)
572
573/* arch/example/kernel/sys_example.c */
574#define __NR_clone 220
575__SYSCALL(__NR_clone, sys_clone) /* .long sys_clone_wrapper */
576#define __NR_execve 221
577__SYSCALL(__NR_execve, sys_execve) /* .long sys_execve_wrapper */
578
579#define __NR3264_mmap 222
580__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
581/* mm/fadvise.c */
582#define __NR3264_fadvise64 223
583__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64)
584
585/* mm/, CONFIG_MMU only */
586#ifndef __ARCH_NOMMU
587#define __NR_swapon 224
588__SYSCALL(__NR_swapon, sys_swapon)
589#define __NR_swapoff 225
590__SYSCALL(__NR_swapoff, sys_swapoff)
591#define __NR_mprotect 226
592__SYSCALL(__NR_mprotect, sys_mprotect)
593#define __NR_msync 227
594__SYSCALL(__NR_msync, sys_msync)
595#define __NR_mlock 228
596__SYSCALL(__NR_mlock, sys_mlock)
597#define __NR_munlock 229
598__SYSCALL(__NR_munlock, sys_munlock)
599#define __NR_mlockall 230
600__SYSCALL(__NR_mlockall, sys_mlockall)
601#define __NR_munlockall 231
602__SYSCALL(__NR_munlockall, sys_munlockall)
603#define __NR_mincore 232
604__SYSCALL(__NR_mincore, sys_mincore)
605#define __NR_madvise 233
606__SYSCALL(__NR_madvise, sys_madvise)
607#define __NR_remap_file_pages 234
608__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
609#define __NR_mbind 235
610__SYSCALL(__NR_mbind, sys_mbind)
611#define __NR_get_mempolicy 236
612__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
613#define __NR_set_mempolicy 237
614__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
615#define __NR_migrate_pages 238
616__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
617#define __NR_move_pages 239
618__SYSCALL(__NR_move_pages, sys_move_pages)
619#endif
620
621#undef __NR_syscalls
622#define __NR_syscalls 240
623
624/*
625 * All syscalls below here should go away really,
626 * these are provided for both review and as a porting
627 * help for the C library version.
628*
629 * Last chance: are any of these important enought to
630 * enable by default?
631 */
632#ifdef __ARCH_WANT_SYSCALL_NO_AT
633#define __NR_open 1024
634__SYSCALL(__NR_open, sys_open)
635#define __NR_link 1025
636__SYSCALL(__NR_link, sys_link)
637#define __NR_unlink 1026
638__SYSCALL(__NR_unlink, sys_unlink)
639#define __NR_mknod 1027
640__SYSCALL(__NR_mknod, sys_mknod)
641#define __NR_chmod 1028
642__SYSCALL(__NR_chmod, sys_chmod)
643#define __NR_chown 1029
644__SYSCALL(__NR_chown, sys_chown)
645#define __NR_mkdir 1030
646__SYSCALL(__NR_mkdir, sys_mkdir)
647#define __NR_rmdir 1031
648__SYSCALL(__NR_rmdir, sys_rmdir)
649#define __NR_lchown 1032
650__SYSCALL(__NR_lchown, sys_lchown)
651#define __NR_access 1033
652__SYSCALL(__NR_access, sys_access)
653#define __NR_rename 1034
654__SYSCALL(__NR_rename, sys_rename)
655#define __NR_readlink 1035
656__SYSCALL(__NR_readlink, sys_readlink)
657#define __NR_symlink 1036
658__SYSCALL(__NR_symlink, sys_symlink)
659#define __NR_utimes 1037
660__SYSCALL(__NR_utimes, sys_utimes)
661#define __NR3264_stat 1038
662__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
663#define __NR3264_lstat 1039
664__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
665
666#undef __NR_syscalls
667#define __NR_syscalls (__NR3264_lstat+1)
668#endif /* __ARCH_WANT_SYSCALL_NO_AT */
669
670#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
671#define __NR_pipe 1040
672__SYSCALL(__NR_pipe, sys_pipe)
673#define __NR_dup2 1041
674__SYSCALL(__NR_dup2, sys_dup2)
675#define __NR_epoll_create 1042
676__SYSCALL(__NR_epoll_create, sys_epoll_create)
677#define __NR_inotify_init 1043
678__SYSCALL(__NR_inotify_init, sys_inotify_init)
679#define __NR_eventfd 1044
680__SYSCALL(__NR_eventfd, sys_eventfd)
681#define __NR_signalfd 1045
682__SYSCALL(__NR_signalfd, sys_signalfd)
683
684#undef __NR_syscalls
685#define __NR_syscalls (__NR_signalfd+1)
686#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
687
688#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T)
689#define __NR_sendfile 1046
690__SYSCALL(__NR_sendfile, sys_sendfile)
691#define __NR_ftruncate 1047
692__SYSCALL(__NR_ftruncate, sys_ftruncate)
693#define __NR_truncate 1048
694__SYSCALL(__NR_truncate, sys_truncate)
695#define __NR_stat 1049
696__SYSCALL(__NR_stat, sys_newstat)
697#define __NR_lstat 1050
698__SYSCALL(__NR_lstat, sys_newlstat)
699#define __NR_fstat 1051
700__SYSCALL(__NR_fstat, sys_newfstat)
701#define __NR_fcntl 1052
702__SYSCALL(__NR_fcntl, sys_fcntl)
703#define __NR_fadvise64 1053
704#define __ARCH_WANT_SYS_FADVISE64
705__SYSCALL(__NR_fadvise64, sys_fadvise64)
706#define __NR_newfstatat 1054
707#define __ARCH_WANT_SYS_NEWFSTATAT
708__SYSCALL(__NR_newfstatat, sys_newfstatat)
709#define __NR_fstatfs 1055
710__SYSCALL(__NR_fstatfs, sys_fstatfs)
711#define __NR_statfs 1056
712__SYSCALL(__NR_statfs, sys_statfs)
713#define __NR_lseek 1057
714__SYSCALL(__NR_lseek, sys_lseek)
715#define __NR_mmap 1058
716__SYSCALL(__NR_mmap, sys_mmap)
717
718#undef __NR_syscalls
719#define __NR_syscalls (__NR_mmap+1)
720#endif /* 32 bit off_t syscalls */
721
722#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
723#define __NR_alarm 1059
724#define __ARCH_WANT_SYS_ALARM
725__SYSCALL(__NR_alarm, sys_alarm)
726#define __NR_getpgrp 1060
727#define __ARCH_WANT_SYS_GETPGRP
728__SYSCALL(__NR_getpgrp, sys_getpgrp)
729#define __NR_pause 1061
730#define __ARCH_WANT_SYS_PAUSE
731__SYSCALL(__NR_pause, sys_pause)
732#define __NR_time 1062
733#define __ARCH_WANT_SYS_TIME
734__SYSCALL(__NR_time, sys_time)
735#define __NR_utime 1063
736#define __ARCH_WANT_SYS_UTIME
737__SYSCALL(__NR_utime, sys_utime)
738
739#define __NR_creat 1064
740__SYSCALL(__NR_creat, sys_creat)
741#define __NR_getdents 1065
742#define __ARCH_WANT_SYS_GETDENTS
743__SYSCALL(__NR_getdents, sys_getdents)
744#define __NR_futimesat 1066
745__SYSCALL(__NR_futimesat, sys_futimesat)
746#define __NR_select 1067
747#define __ARCH_WANT_SYS_SELECT
748__SYSCALL(__NR_select, sys_select)
749#define __NR_poll 1068
750__SYSCALL(__NR_poll, sys_poll)
751#define __NR_epoll_wait 1069
752__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
753#define __NR_ustat 1070
754__SYSCALL(__NR_ustat, sys_ustat)
755#define __NR_vfork 1071
756__SYSCALL(__NR_vfork, sys_vfork)
757#define __NR_wait4 1072
758__SYSCALL(__NR_wait4, sys_wait4)
759#define __NR_recv 1073
760__SYSCALL(__NR_recv, sys_recv)
761#define __NR_send 1074
762__SYSCALL(__NR_send, sys_send)
763#define __NR_bdflush 1075
764__SYSCALL(__NR_bdflush, sys_bdflush)
765#define __NR_umount 1076
766__SYSCALL(__NR_umount, sys_oldumount)
767#define __ARCH_WANT_SYS_OLDUMOUNT
768#define __NR_uselib 1077
769__SYSCALL(__NR_uselib, sys_uselib)
770#define __NR__sysctl 1078
771__SYSCALL(__NR__sysctl, sys_sysctl)
772
773#define __NR_fork 1079
774#ifdef CONFIG_MMU
775__SYSCALL(__NR_fork, sys_fork)
776#else
777__SYSCALL(__NR_fork, sys_ni_syscall)
778#endif /* CONFIG_MMU */
779
780#undef __NR_syscalls
781#define __NR_syscalls (__NR_fork+1)
782
783#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
784
785/*
786 * 32 bit systems traditionally used different
787 * syscalls for off_t and loff_t arguments, while
788 * 64 bit systems only need the off_t version.
789 * For new 32 bit platforms, there is no need to
790 * implement the old 32 bit off_t syscalls, so
791 * they take different names.
792 * Here we map the numbers so that both versions
793 * use the same syscall table layout.
794 */
795#if __BITS_PER_LONG == 64
796#define __NR_fcntl __NR3264_fcntl
797#define __NR_statfs __NR3264_statfs
798#define __NR_fstatfs __NR3264_fstatfs
799#define __NR_truncate __NR3264_truncate
800#define __NR_ftruncate __NR3264_truncate
801#define __NR_lseek __NR3264_lseek
802#define __NR_sendfile __NR3264_sendfile
803#define __NR_newfstatat __NR3264_fstatat
804#define __NR_fstat __NR3264_fstat
805#define __NR_mmap __NR3264_mmap
806#define __NR_fadvise64 __NR3264_fadvise64
807#ifdef __NR3264_stat
808#define __NR_stat __NR3264_stat
809#define __NR_lstat __NR3264_lstat
810#endif
811#else
812#define __NR_fcntl64 __NR3264_fcntl
813#define __NR_statfs64 __NR3264_statfs
814#define __NR_fstatfs64 __NR3264_fstatfs
815#define __NR_truncate64 __NR3264_truncate
816#define __NR_ftruncate64 __NR3264_truncate
817#define __NR_llseek __NR3264_lseek
818#define __NR_sendfile64 __NR3264_sendfile
819#define __NR_fstatat64 __NR3264_fstatat
820#define __NR_fstat64 __NR3264_fstat
821#define __NR_mmap2 __NR3264_mmap
822#define __NR_fadvise64_64 __NR3264_fadvise64
823#ifdef __NR3264_stat
824#define __NR_stat64 __NR3264_stat
825#define __NR_lstat64 __NR3264_lstat
826#endif
827#endif
828
829#ifdef __KERNEL__
830
831/*
832 * These are required system calls, we should
833 * invert the logic eventually and let them
834 * be selected by default.
835 */
836#if __BITS_PER_LONG == 32
837#define __ARCH_WANT_STAT64
838#define __ARCH_WANT_SYS_LLSEEK
839#endif
840#define __ARCH_WANT_SYS_RT_SIGACTION
841#define __ARCH_WANT_SYS_RT_SIGSUSPEND
842
843/*
844 * "Conditional" syscalls
845 *
846 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
847 * but it doesn't work on all toolchains, so we just do it by hand
848 */
849#ifndef cond_syscall
850#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
851#endif
852
853#endif /* __KERNEL__ */
854#endif /* _ASM_GENERIC_UNISTD_H */
diff --git a/include/asm-generic/user.h b/include/asm-generic/user.h
new file mode 100644
index 000000000000..8b9c3c960aeb
--- /dev/null
+++ b/include/asm-generic/user.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_USER_H
2#define __ASM_GENERIC_USER_H
3/*
4 * This file may define a 'struct user' structure. However, it it only
5 * used for a.out file, which are not supported on new architectures.
6 */
7
8#endif /* __ASM_GENERIC_USER_H */
diff --git a/include/asm-generic/vga.h b/include/asm-generic/vga.h
new file mode 100644
index 000000000000..36c8ff52016b
--- /dev/null
+++ b/include/asm-generic/vga.h
@@ -0,0 +1,24 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6#ifndef __ASM_GENERIC_VGA_H
7#define __ASM_GENERIC_VGA_H
8
9/*
10 * On most architectures that support VGA, we can just
11 * recalculate addresses and then access the videoram
12 * directly without any black magic.
13 *
14 * Everyone else needs to ioremap the address and use
15 * proper I/O accesses.
16 */
17#ifndef VGA_MAP_MEM
18#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
19#endif
20
21#define vga_readb(x) (*(x))
22#define vga_writeb(x, y) (*(y) = (x))
23
24#endif /* _ASM_GENERIC_VGA_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f1736ca7922c..6bdba10fef4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1,4 +1,57 @@
1#include <linux/section-names.h> 1/*
2 * Helper macros to support writing architecture specific
3 * linker scripts.
4 *
5 * A minimal linker scripts has following content:
6 * [This is a sample, architectures may have special requiriements]
7 *
8 * OUTPUT_FORMAT(...)
9 * OUTPUT_ARCH(...)
10 * ENTRY(...)
11 * SECTIONS
12 * {
13 * . = START;
14 * __init_begin = .;
15 * HEAD_TEXT_SECTION
16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...)
18 * PERCPU(PAGE_SIZE)
19 * __init_end = .;
20 *
21 * _stext = .;
22 * TEXT_SECTION = 0
23 * _etext = .;
24 *
25 * _sdata = .;
26 * RO_DATA_SECTION(PAGE_SIZE)
27 * RW_DATA_SECTION(...)
28 * _edata = .;
29 *
30 * EXCEPTION_TABLE(...)
31 * NOTES
32 *
33 * __bss_start = .;
34 * BSS_SECTION(0, 0)
35 * __bss_stop = .;
36 * _end = .;
37 *
38 * /DISCARD/ : {
39 * EXIT_TEXT
40 * EXIT_DATA
41 * EXIT_CALL
42 * }
43 * STABS_DEBUG
44 * DWARF_DEBUG
45 * }
46 *
47 * [__init_begin, __init_end] is the init section that may be freed after init
48 * [_stext, _etext] is the text section
49 * [_sdata, _edata] is the data section
50 *
51 * Some of the included output section have their own set of constants.
52 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
53 * [__nosave_begin, __nosave_end] for the nosave data
54 */
2 55
3#ifndef LOAD_OFFSET 56#ifndef LOAD_OFFSET
4#define LOAD_OFFSET 0 57#define LOAD_OFFSET 0
@@ -116,7 +169,36 @@
116 FTRACE_EVENTS() \ 169 FTRACE_EVENTS() \
117 TRACE_SYSCALLS() 170 TRACE_SYSCALLS()
118 171
119#define RO_DATA(align) \ 172/*
173 * Data section helpers
174 */
175#define NOSAVE_DATA \
176 . = ALIGN(PAGE_SIZE); \
177 VMLINUX_SYMBOL(__nosave_begin) = .; \
178 *(.data.nosave) \
179 . = ALIGN(PAGE_SIZE); \
180 VMLINUX_SYMBOL(__nosave_end) = .;
181
182#define PAGE_ALIGNED_DATA(page_align) \
183 . = ALIGN(page_align); \
184 *(.data.page_aligned)
185
186#define READ_MOSTLY_DATA(align) \
187 . = ALIGN(align); \
188 *(.data.read_mostly)
189
190#define CACHELINE_ALIGNED_DATA(align) \
191 . = ALIGN(align); \
192 *(.data.cacheline_aligned)
193
194#define INIT_TASK(align) \
195 . = ALIGN(align); \
196 *(.data.init_task)
197
198/*
199 * Read only Data
200 */
201#define RO_DATA_SECTION(align) \
120 . = ALIGN((align)); \ 202 . = ALIGN((align)); \
121 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 203 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
122 VMLINUX_SYMBOL(__start_rodata) = .; \ 204 VMLINUX_SYMBOL(__start_rodata) = .; \
@@ -270,9 +352,10 @@
270 } \ 352 } \
271 . = ALIGN((align)); 353 . = ALIGN((align));
272 354
273/* RODATA provided for backward compatibility. 355/* RODATA & RO_DATA provided for backward compatibility.
274 * All archs are supposed to use RO_DATA() */ 356 * All archs are supposed to use RO_DATA() */
275#define RODATA RO_DATA(4096) 357#define RODATA RO_DATA_SECTION(4096)
358#define RO_DATA(align) RO_DATA_SECTION(align)
276 359
277#define SECURITY_INIT \ 360#define SECURITY_INIT \
278 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 361 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@@ -330,16 +413,42 @@
330#endif 413#endif
331 414
332/* Section used for early init (in .S files) */ 415/* Section used for early init (in .S files) */
333#define HEAD_TEXT *(HEAD_TEXT_SECTION) 416#define HEAD_TEXT *(.head.text)
417
418#define HEAD_TEXT_SECTION \
419 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
420 HEAD_TEXT \
421 }
422
423/*
424 * Exception table
425 */
426#define EXCEPTION_TABLE(align) \
427 . = ALIGN(align); \
428 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
429 VMLINUX_SYMBOL(__start___ex_table) = .; \
430 *(__ex_table) \
431 VMLINUX_SYMBOL(__stop___ex_table) = .; \
432 }
433
434/*
435 * Init task
436 */
437#define INIT_TASK_DATA(align) \
438 . = ALIGN(align); \
439 .data.init_task : { \
440 INIT_TASK \
441 }
334 442
335/* init and exit section handling */ 443/* init and exit section handling */
336#define INIT_DATA \ 444#define INIT_DATA \
337 *(.init.data) \ 445 *(.init.data) \
338 DEV_DISCARD(init.data) \ 446 DEV_DISCARD(init.data) \
339 DEV_DISCARD(init.rodata) \
340 CPU_DISCARD(init.data) \ 447 CPU_DISCARD(init.data) \
341 CPU_DISCARD(init.rodata) \
342 MEM_DISCARD(init.data) \ 448 MEM_DISCARD(init.data) \
449 *(.init.rodata) \
450 DEV_DISCARD(init.rodata) \
451 CPU_DISCARD(init.rodata) \
343 MEM_DISCARD(init.rodata) 452 MEM_DISCARD(init.rodata)
344 453
345#define INIT_TEXT \ 454#define INIT_TEXT \
@@ -363,9 +472,35 @@
363 CPU_DISCARD(exit.text) \ 472 CPU_DISCARD(exit.text) \
364 MEM_DISCARD(exit.text) 473 MEM_DISCARD(exit.text)
365 474
366 /* DWARF debug sections. 475#define EXIT_CALL \
367 Symbols in the DWARF debugging sections are relative to 476 *(.exitcall.exit)
368 the beginning of the section so we begin them at 0. */ 477
478/*
479 * bss (Block Started by Symbol) - uninitialized data
480 * zeroed during startup
481 */
482#define SBSS \
483 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
484 *(.sbss) \
485 *(.scommon) \
486 }
487
488#define BSS(bss_align) \
489 . = ALIGN(bss_align); \
490 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
491 VMLINUX_SYMBOL(__bss_start) = .; \
492 *(.bss.page_aligned) \
493 *(.dynbss) \
494 *(.bss) \
495 *(COMMON) \
496 VMLINUX_SYMBOL(__bss_stop) = .; \
497 }
498
499/*
500 * DWARF debug sections.
501 * Symbols in the DWARF debugging sections are relative to
502 * the beginning of the section so we begin them at 0.
503 */
369#define DWARF_DEBUG \ 504#define DWARF_DEBUG \
370 /* DWARF 1 */ \ 505 /* DWARF 1 */ \
371 .debug 0 : { *(.debug) } \ 506 .debug 0 : { *(.debug) } \
@@ -432,6 +567,12 @@
432 VMLINUX_SYMBOL(__stop_notes) = .; \ 567 VMLINUX_SYMBOL(__stop_notes) = .; \
433 } 568 }
434 569
570#define INIT_SETUP(initsetup_align) \
571 . = ALIGN(initsetup_align); \
572 VMLINUX_SYMBOL(__setup_start) = .; \
573 *(.init.setup) \
574 VMLINUX_SYMBOL(__setup_end) = .;
575
435#define INITCALLS \ 576#define INITCALLS \
436 *(.initcallearly.init) \ 577 *(.initcallearly.init) \
437 VMLINUX_SYMBOL(__early_initcall_end) = .; \ 578 VMLINUX_SYMBOL(__early_initcall_end) = .; \
@@ -453,6 +594,31 @@
453 *(.initcall7.init) \ 594 *(.initcall7.init) \
454 *(.initcall7s.init) 595 *(.initcall7s.init)
455 596
597#define INIT_CALLS \
598 VMLINUX_SYMBOL(__initcall_start) = .; \
599 INITCALLS \
600 VMLINUX_SYMBOL(__initcall_end) = .;
601
602#define CON_INITCALL \
603 VMLINUX_SYMBOL(__con_initcall_start) = .; \
604 *(.con_initcall.init) \
605 VMLINUX_SYMBOL(__con_initcall_end) = .;
606
607#define SECURITY_INITCALL \
608 VMLINUX_SYMBOL(__security_initcall_start) = .; \
609 *(.security_initcall.init) \
610 VMLINUX_SYMBOL(__security_initcall_end) = .;
611
612#ifdef CONFIG_BLK_DEV_INITRD
613#define INIT_RAM_FS \
614 . = ALIGN(PAGE_SIZE); \
615 VMLINUX_SYMBOL(__initramfs_start) = .; \
616 *(.init.ramfs) \
617 VMLINUX_SYMBOL(__initramfs_end) = .;
618#else
619#define INITRAMFS
620#endif
621
456/** 622/**
457 * PERCPU_VADDR - define output section for percpu area 623 * PERCPU_VADDR - define output section for percpu area
458 * @vaddr: explicit base address (optional) 624 * @vaddr: explicit base address (optional)
@@ -509,3 +675,58 @@
509 *(.data.percpu.shared_aligned) \ 675 *(.data.percpu.shared_aligned) \
510 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 676 VMLINUX_SYMBOL(__per_cpu_end) = .; \
511 } 677 }
678
679
680/*
681 * Definition of the high level *_SECTION macros
682 * They will fit only a subset of the architectures
683 */
684
685
686/*
687 * Writeable data.
688 * All sections are combined in a single .data section.
689 * The sections following CONSTRUCTORS are arranged so their
690 * typical alignment matches.
691 * A cacheline is typical/always less than a PAGE_SIZE so
692 * the sections that has this restriction (or similar)
693 * is located before the ones requiring PAGE_SIZE alignment.
694 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
695 * matches the requirment of PAGE_ALIGNED_DATA.
696 *
697 * use 0 as page_align if page_aligned data is not used */
698#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \
699 . = ALIGN(PAGE_SIZE); \
700 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
701 INIT_TASK(inittask) \
702 CACHELINE_ALIGNED_DATA(cacheline) \
703 READ_MOSTLY_DATA(cacheline) \
704 DATA_DATA \
705 CONSTRUCTORS \
706 NOSAVE_DATA(nosave) \
707 PAGE_ALIGNED_DATA(pagealigned) \
708 }
709
710#define INIT_TEXT_SECTION(inittext_align) \
711 . = ALIGN(inittext_align); \
712 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
713 VMLINUX_SYMBOL(_sinittext) = .; \
714 INIT_TEXT \
715 VMLINUX_SYMBOL(_einittext) = .; \
716 }
717
718#define INIT_DATA_SECTION(initsetup_align) \
719 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
720 INIT_DATA \
721 INIT_SETUP(initsetup_align) \
722 INIT_CALLS \
723 CON_INITCALL \
724 SECURITY_INITCALL \
725 INIT_RAM_FS \
726 }
727
728#define BSS_SECTION(sbss_align, bss_align) \
729 SBSS \
730 BSS(bss_align) \
731 . = ALIGN(4);
732
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b84d8ae35e6f..d4ddc22e46bb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -86,7 +86,17 @@ struct drm_device;
86 86
87#include "drm_os_linux.h" 87#include "drm_os_linux.h"
88#include "drm_hashtab.h" 88#include "drm_hashtab.h"
89#include "drm_mm.h"
89 90
91#define DRM_UT_CORE 0x01
92#define DRM_UT_DRIVER 0x02
93#define DRM_UT_KMS 0x04
94#define DRM_UT_MODE 0x08
95
96extern void drm_ut_debug_printk(unsigned int request_level,
97 const char *prefix,
98 const char *function_name,
99 const char *format, ...);
90/***********************************************************************/ 100/***********************************************************************/
91/** \name DRM template customization defaults */ 101/** \name DRM template customization defaults */
92/*@{*/ 102/*@{*/
@@ -186,15 +196,57 @@ struct drm_device;
186 * \param arg arguments 196 * \param arg arguments
187 */ 197 */
188#if DRM_DEBUG_CODE 198#if DRM_DEBUG_CODE
189#define DRM_DEBUG(fmt, arg...) \ 199#define DRM_DEBUG(fmt, args...) \
200 do { \
201 drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME, \
202 __func__, fmt, ##args); \
203 } while (0)
204
205#define DRM_DEBUG_DRIVER(prefix, fmt, args...) \
206 do { \
207 drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \
208 __func__, fmt, ##args); \
209 } while (0)
210#define DRM_DEBUG_KMS(prefix, fmt, args...) \
211 do { \
212 drm_ut_debug_printk(DRM_UT_KMS, prefix, \
213 __func__, fmt, ##args); \
214 } while (0)
215#define DRM_DEBUG_MODE(prefix, fmt, args...) \
216 do { \
217 drm_ut_debug_printk(DRM_UT_MODE, prefix, \
218 __func__, fmt, ##args); \
219 } while (0)
220#define DRM_LOG(fmt, args...) \
221 do { \
222 drm_ut_debug_printk(DRM_UT_CORE, NULL, \
223 NULL, fmt, ##args); \
224 } while (0)
225#define DRM_LOG_KMS(fmt, args...) \
226 do { \
227 drm_ut_debug_printk(DRM_UT_KMS, NULL, \
228 NULL, fmt, ##args); \
229 } while (0)
230#define DRM_LOG_MODE(fmt, args...) \
231 do { \
232 drm_ut_debug_printk(DRM_UT_MODE, NULL, \
233 NULL, fmt, ##args); \
234 } while (0)
235#define DRM_LOG_DRIVER(fmt, args...) \
190 do { \ 236 do { \
191 if ( drm_debug ) \ 237 drm_ut_debug_printk(DRM_UT_DRIVER, NULL, \
192 printk(KERN_DEBUG \ 238 NULL, fmt, ##args); \
193 "[" DRM_NAME ":%s] " fmt , \
194 __func__ , ##arg); \
195 } while (0) 239 } while (0)
196#else 240#else
241#define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0)
242#define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0)
243#define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0)
197#define DRM_DEBUG(fmt, arg...) do { } while (0) 244#define DRM_DEBUG(fmt, arg...) do { } while (0)
245#define DRM_LOG(fmt, arg...) do { } while (0)
246#define DRM_LOG_KMS(fmt, args...) do { } while (0)
247#define DRM_LOG_MODE(fmt, arg...) do { } while (0)
248#define DRM_LOG_DRIVER(fmt, arg...) do { } while (0)
249
198#endif 250#endif
199 251
200#define DRM_PROC_LIMIT (PAGE_SIZE-80) 252#define DRM_PROC_LIMIT (PAGE_SIZE-80)
@@ -237,15 +289,15 @@ struct drm_device;
237 * \param dev DRM device. 289 * \param dev DRM device.
238 * \param filp file pointer of the caller. 290 * \param filp file pointer of the caller.
239 */ 291 */
240#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \ 292#define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \
241do { \ 293do { \
242 if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock) || \ 294 if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \
243 file_priv->master->lock.file_priv != file_priv) { \ 295 _file_priv->master->lock.file_priv != _file_priv) { \
244 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ 296 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
245 __func__, _DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock),\ 297 __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\
246 file_priv->master->lock.file_priv, file_priv); \ 298 _file_priv->master->lock.file_priv, _file_priv); \
247 return -EINVAL; \ 299 return -EINVAL; \
248 } \ 300 } \
249} while (0) 301} while (0)
250 302
251/** 303/**
@@ -502,26 +554,6 @@ struct drm_sigdata {
502}; 554};
503 555
504 556
505/*
506 * Generic memory manager structs
507 */
508
509struct drm_mm_node {
510 struct list_head fl_entry;
511 struct list_head ml_entry;
512 int free;
513 unsigned long start;
514 unsigned long size;
515 struct drm_mm *mm;
516 void *private;
517};
518
519struct drm_mm {
520 struct list_head fl_entry;
521 struct list_head ml_entry;
522};
523
524
525/** 557/**
526 * Kernel side of a mapping 558 * Kernel side of a mapping
527 */ 559 */
@@ -1385,22 +1417,6 @@ extern char *drm_get_connector_status_name(enum drm_connector_status status);
1385extern int drm_sysfs_connector_add(struct drm_connector *connector); 1417extern int drm_sysfs_connector_add(struct drm_connector *connector);
1386extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1418extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1387 1419
1388/*
1389 * Basic memory manager support (drm_mm.c)
1390 */
1391extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
1392 unsigned long size,
1393 unsigned alignment);
1394extern void drm_mm_put_block(struct drm_mm_node * cur);
1395extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size,
1396 unsigned alignment, int best_match);
1397extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size);
1398extern void drm_mm_takedown(struct drm_mm *mm);
1399extern int drm_mm_clean(struct drm_mm *mm);
1400extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
1401extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
1402extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1403
1404/* Graphics Execution Manager library functions (drm_gem.c) */ 1420/* Graphics Execution Manager library functions (drm_gem.c) */
1405int drm_gem_init(struct drm_device *dev); 1421int drm_gem_init(struct drm_device *dev);
1406void drm_gem_destroy(struct drm_device *dev); 1422void drm_gem_destroy(struct drm_device *dev);
@@ -1522,18 +1538,14 @@ static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
1522 1538
1523static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 1539static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1524{ 1540{
1525 u8 *addr; 1541 if (size * nmemb <= PAGE_SIZE)
1526
1527 if (size <= PAGE_SIZE)
1528 return kcalloc(nmemb, size, GFP_KERNEL); 1542 return kcalloc(nmemb, size, GFP_KERNEL);
1529 1543
1530 addr = vmalloc(nmemb * size); 1544 if (size != 0 && nmemb > ULONG_MAX / size)
1531 if (!addr)
1532 return NULL; 1545 return NULL;
1533 1546
1534 memset(addr, 0, nmemb * size); 1547 return __vmalloc(size * nmemb,
1535 1548 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1536 return addr;
1537} 1549}
1538 1550
1539static __inline void drm_free_large(void *ptr) 1551static __inline void drm_free_large(void *ptr)
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index cd2b189e1be6..0af087a4d3b3 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -35,6 +35,8 @@
35#ifndef DRM_HASHTAB_H 35#ifndef DRM_HASHTAB_H
36#define DRM_HASHTAB_H 36#define DRM_HASHTAB_H
37 37
38#include <linux/list.h>
39
38#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member) 40#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
39 41
40struct drm_hash_item { 42struct drm_hash_item {
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
new file mode 100644
index 000000000000..5662f4278ef3
--- /dev/null
+++ b/include/drm/drm_mm.h
@@ -0,0 +1,90 @@
1/**************************************************************************
2 *
3 * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX. 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/*
29 * Authors:
30 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
31 */
32
33#ifndef _DRM_MM_H_
34#define _DRM_MM_H_
35
36/*
37 * Generic range manager structs
38 */
39#include <linux/list.h>
40
41struct drm_mm_node {
42 struct list_head fl_entry;
43 struct list_head ml_entry;
44 int free;
45 unsigned long start;
46 unsigned long size;
47 struct drm_mm *mm;
48 void *private;
49};
50
51struct drm_mm {
52 struct list_head fl_entry;
53 struct list_head ml_entry;
54 struct list_head unused_nodes;
55 int num_unused;
56 spinlock_t unused_lock;
57};
58
59/*
60 * Basic range manager support (drm_mm.c)
61 */
62
63extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent,
64 unsigned long size,
65 unsigned alignment);
66extern struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *parent,
67 unsigned long size,
68 unsigned alignment);
69extern void drm_mm_put_block(struct drm_mm_node *cur);
70extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
71 unsigned long size,
72 unsigned alignment,
73 int best_match);
74extern int drm_mm_init(struct drm_mm *mm, unsigned long start,
75 unsigned long size);
76extern void drm_mm_takedown(struct drm_mm *mm);
77extern int drm_mm_clean(struct drm_mm *mm);
78extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
79extern int drm_mm_remove_space_from_tail(struct drm_mm *mm,
80 unsigned long size);
81extern int drm_mm_add_space_to_tail(struct drm_mm *mm,
82 unsigned long size, int atomic);
83extern int drm_mm_pre_get(struct drm_mm *mm);
84
85static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
86{
87 return block->mm;
88}
89
90#endif
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index fc55db780199..f8634ab53b8f 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -254,6 +254,11 @@
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}, \
258 {0x1002, 0x94A1, 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}, \
261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 262 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 263 {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 264 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
@@ -268,6 +273,8 @@
268 {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}, \
269 {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}, \
270 {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}, \
277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
271 {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}, \
272 {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}, \
273 {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}, \
@@ -536,4 +543,6 @@
536 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 543 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
537 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 544 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
538 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 545 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
546 {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
547 {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
539 {0, 0, 0} 548 {0, 0, 0}
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
new file mode 100644
index 000000000000..dcad0ffd1755
--- /dev/null
+++ b/include/linux/amba/pl022.h
@@ -0,0 +1,264 @@
1/*
2 * include/linux/amba/pl022.h
3 *
4 * Copyright (C) 2008-2009 ST-Ericsson AB
5 * Copyright (C) 2006 STMicroelectronics Pvt. Ltd.
6 *
7 * Author: Linus Walleij <linus.walleij@stericsson.com>
8 *
9 * Initial version inspired by:
10 * linux-2.6.17-rc3-mm1/drivers/spi/pxa2xx_spi.c
11 * Initial adoption to PL022 by:
12 * Sachin Verma <sachin.verma@st.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 */
24
25#ifndef _SSP_PL022_H
26#define _SSP_PL022_H
27
28#include <linux/device.h>
29
30/**
31 * whether SSP is in loopback mode or not
32 */
33enum ssp_loopback {
34 LOOPBACK_DISABLED,
35 LOOPBACK_ENABLED
36};
37
38/**
39 * enum ssp_interface - interfaces allowed for this SSP Controller
40 * @SSP_INTERFACE_MOTOROLA_SPI: Motorola Interface
41 * @SSP_INTERFACE_TI_SYNC_SERIAL: Texas Instrument Synchronous Serial
42 * interface
43 * @SSP_INTERFACE_NATIONAL_MICROWIRE: National Semiconductor Microwire
44 * interface
45 * @SSP_INTERFACE_UNIDIRECTIONAL: Unidirectional interface (STn8810
46 * &STn8815 only)
47 */
48enum ssp_interface {
49 SSP_INTERFACE_MOTOROLA_SPI,
50 SSP_INTERFACE_TI_SYNC_SERIAL,
51 SSP_INTERFACE_NATIONAL_MICROWIRE,
52 SSP_INTERFACE_UNIDIRECTIONAL
53};
54
55/**
56 * enum ssp_hierarchy - whether SSP is configured as Master or Slave
57 */
58enum ssp_hierarchy {
59 SSP_MASTER,
60 SSP_SLAVE
61};
62
63/**
64 * enum ssp_clock_params - clock parameters, to set SSP clock at a
65 * desired freq
66 */
67struct ssp_clock_params {
68 u8 cpsdvsr; /* value from 2 to 254 (even only!) */
69 u8 scr; /* value from 0 to 255 */
70};
71
72/**
73 * enum ssp_rx_endian - endianess of Rx FIFO Data
74 */
75enum ssp_rx_endian {
76 SSP_RX_MSB,
77 SSP_RX_LSB
78};
79
80/**
81 * enum ssp_tx_endian - endianess of Tx FIFO Data
82 */
83enum ssp_tx_endian {
84 SSP_TX_MSB,
85 SSP_TX_LSB
86};
87
88/**
89 * enum ssp_data_size - number of bits in one data element
90 */
91enum ssp_data_size {
92 SSP_DATA_BITS_4 = 0x03, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
93 SSP_DATA_BITS_7, SSP_DATA_BITS_8, SSP_DATA_BITS_9,
94 SSP_DATA_BITS_10, SSP_DATA_BITS_11, SSP_DATA_BITS_12,
95 SSP_DATA_BITS_13, SSP_DATA_BITS_14, SSP_DATA_BITS_15,
96 SSP_DATA_BITS_16, SSP_DATA_BITS_17, SSP_DATA_BITS_18,
97 SSP_DATA_BITS_19, SSP_DATA_BITS_20, SSP_DATA_BITS_21,
98 SSP_DATA_BITS_22, SSP_DATA_BITS_23, SSP_DATA_BITS_24,
99 SSP_DATA_BITS_25, SSP_DATA_BITS_26, SSP_DATA_BITS_27,
100 SSP_DATA_BITS_28, SSP_DATA_BITS_29, SSP_DATA_BITS_30,
101 SSP_DATA_BITS_31, SSP_DATA_BITS_32
102};
103
104/**
105 * enum ssp_mode - SSP mode of operation (Communication modes)
106 */
107enum ssp_mode {
108 INTERRUPT_TRANSFER,
109 POLLING_TRANSFER,
110 DMA_TRANSFER
111};
112
113/**
114 * enum ssp_rx_level_trig - receive FIFO watermark level which triggers
115 * IT: Interrupt fires when _N_ or more elements in RX FIFO.
116 */
117enum ssp_rx_level_trig {
118 SSP_RX_1_OR_MORE_ELEM,
119 SSP_RX_4_OR_MORE_ELEM,
120 SSP_RX_8_OR_MORE_ELEM,
121 SSP_RX_16_OR_MORE_ELEM,
122 SSP_RX_32_OR_MORE_ELEM
123};
124
125/**
126 * Transmit FIFO watermark level which triggers (IT Interrupt fires
127 * when _N_ or more empty locations in TX FIFO)
128 */
129enum ssp_tx_level_trig {
130 SSP_TX_1_OR_MORE_EMPTY_LOC,
131 SSP_TX_4_OR_MORE_EMPTY_LOC,
132 SSP_TX_8_OR_MORE_EMPTY_LOC,
133 SSP_TX_16_OR_MORE_EMPTY_LOC,
134 SSP_TX_32_OR_MORE_EMPTY_LOC
135};
136
137/**
138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139 * @SSP_CLK_RISING_EDGE: Receive data on rising edge
140 * @SSP_CLK_FALLING_EDGE: Receive data on falling edge
141 */
142enum ssp_spi_clk_phase {
143 SSP_CLK_RISING_EDGE,
144 SSP_CLK_FALLING_EDGE
145};
146
147/**
148 * enum SPI Clock Polarity - clock polarity (Motorola SPI interface only)
149 * @SSP_CLK_POL_IDLE_LOW: Low inactive level
150 * @SSP_CLK_POL_IDLE_HIGH: High inactive level
151 */
152enum ssp_spi_clk_pol {
153 SSP_CLK_POL_IDLE_LOW,
154 SSP_CLK_POL_IDLE_HIGH
155};
156
157/**
158 * Microwire Conrol Lengths Command size in microwire format
159 */
160enum ssp_microwire_ctrl_len {
161 SSP_BITS_4 = 0x03, SSP_BITS_5, SSP_BITS_6,
162 SSP_BITS_7, SSP_BITS_8, SSP_BITS_9,
163 SSP_BITS_10, SSP_BITS_11, SSP_BITS_12,
164 SSP_BITS_13, SSP_BITS_14, SSP_BITS_15,
165 SSP_BITS_16, SSP_BITS_17, SSP_BITS_18,
166 SSP_BITS_19, SSP_BITS_20, SSP_BITS_21,
167 SSP_BITS_22, SSP_BITS_23, SSP_BITS_24,
168 SSP_BITS_25, SSP_BITS_26, SSP_BITS_27,
169 SSP_BITS_28, SSP_BITS_29, SSP_BITS_30,
170 SSP_BITS_31, SSP_BITS_32
171};
172
173/**
174 * enum Microwire Wait State
175 * @SSP_MWIRE_WAIT_ZERO: No wait state inserted after last command bit
176 * @SSP_MWIRE_WAIT_ONE: One wait state inserted after last command bit
177 */
178enum ssp_microwire_wait_state {
179 SSP_MWIRE_WAIT_ZERO,
180 SSP_MWIRE_WAIT_ONE
181};
182
183/**
184 * enum Microwire - whether Full/Half Duplex
185 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
186 * SSPRXD not used
187 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
188 * an input.
189 */
190enum ssp_duplex {
191 SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
192 SSP_MICROWIRE_CHANNEL_HALF_DUPLEX
193};
194
195/**
196 * CHIP select/deselect commands
197 */
198enum ssp_chip_select {
199 SSP_CHIP_SELECT,
200 SSP_CHIP_DESELECT
201};
202
203
204/**
205 * struct pl022_ssp_master - device.platform_data for SPI controller devices.
206 * @num_chipselect: chipselects are used to distinguish individual
207 * SPI slaves, and are numbered from zero to num_chipselects - 1.
208 * each slave has a chipselect signal, but it's common that not
209 * every chipselect is connected to a slave.
210 * @enable_dma: if true enables DMA driven transfers.
211 */
212struct pl022_ssp_controller {
213 u16 bus_id;
214 u8 num_chipselect;
215 u8 enable_dma:1;
216};
217
218/**
219 * struct ssp_config_chip - spi_board_info.controller_data for SPI
220 * slave devices, copied to spi_device.controller_data.
221 *
222 * @lbm: used for test purpose to internally connect RX and TX
223 * @iface: Interface type(Motorola, TI, Microwire, Universal)
224 * @hierarchy: sets whether interface is master or slave
225 * @slave_tx_disable: SSPTXD is disconnected (in slave mode only)
226 * @clk_freq: Tune freq parameters of SSP(when in master mode)
227 * @endian_rx: Endianess of Data in Rx FIFO
228 * @endian_tx: Endianess of Data in Tx FIFO
229 * @data_size: Width of data element(4 to 32 bits)
230 * @com_mode: communication mode: polling, Interrupt or DMA
231 * @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode)
232 * @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode)
233 * @clk_phase: Motorola SPI interface Clock phase
234 * @clk_pol: Motorola SPI interface Clock polarity
235 * @ctrl_len: Microwire interface: Control length
236 * @wait_state: Microwire interface: Wait state
237 * @duplex: Microwire interface: Full/Half duplex
238 * @cs_control: function pointer to board-specific function to
239 * assert/deassert I/O port to control HW generation of devices chip-select.
240 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
241 * @dma_config: DMA configuration for SSP controller and peripheral
242 */
243struct pl022_config_chip {
244 struct device *dev;
245 enum ssp_loopback lbm;
246 enum ssp_interface iface;
247 enum ssp_hierarchy hierarchy;
248 bool slave_tx_disable;
249 struct ssp_clock_params clk_freq;
250 enum ssp_rx_endian endian_rx;
251 enum ssp_tx_endian endian_tx;
252 enum ssp_data_size data_size;
253 enum ssp_mode com_mode;
254 enum ssp_rx_level_trig rx_lev_trig;
255 enum ssp_tx_level_trig tx_lev_trig;
256 enum ssp_spi_clk_phase clk_phase;
257 enum ssp_spi_clk_pol clk_pol;
258 enum ssp_microwire_ctrl_len ctrl_len;
259 enum ssp_microwire_wait_state wait_state;
260 enum ssp_duplex duplex;
261 void (*cs_control) (u32 control);
262};
263
264#endif /* _SSP_PL022_H */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 64a982ea5d5f..5a5a7fd62490 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -114,6 +114,9 @@
114#define UART011_IFLS_TX4_8 (2 << 0) 114#define UART011_IFLS_TX4_8 (2 << 0)
115#define UART011_IFLS_TX6_8 (3 << 0) 115#define UART011_IFLS_TX6_8 (3 << 0)
116#define UART011_IFLS_TX7_8 (4 << 0) 116#define UART011_IFLS_TX7_8 (4 << 0)
117/* special values for ST vendor with deeper fifo */
118#define UART011_IFLS_RX_HALF (5 << 3)
119#define UART011_IFLS_TX_HALF (5 << 0)
117 120
118#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */ 121#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
119#define UART011_BEIM (1 << 9) /* break error interrupt mask */ 122#define UART011_BEIM (1 << 9) /* break error interrupt mask */
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 2f1f95737acb..57b1846a3c87 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -10,6 +10,7 @@
10 * @bus_width: Number of data lines wired up the slot 10 * @bus_width: Number of data lines wired up the slot
11 * @detect_pin: GPIO pin wired to the card detect switch 11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor 12 * @wp_pin: GPIO pin wired to the write protect sensor
13 * @detect_is_active_high: The state of the detect pin when it is active
13 * 14 *
14 * If a given slot is not present on the board, @bus_width should be 15 * If a given slot is not present on the board, @bus_width should be
15 * set to 0. The other fields are ignored in this case. 16 * set to 0. The other fields are ignored in this case.
@@ -24,6 +25,7 @@ struct mci_slot_pdata {
24 unsigned int bus_width; 25 unsigned int bus_width;
25 int detect_pin; 26 int detect_pin;
26 int wp_pin; 27 int wp_pin;
28 bool detect_is_active_high;
27}; 29};
28 30
29/** 31/**
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ebdfde8fe556..0b1a6cae9de1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1226,6 +1226,8 @@ struct block_device_operations {
1226 int (*direct_access) (struct block_device *, sector_t, 1226 int (*direct_access) (struct block_device *, sector_t,
1227 void **, unsigned long *); 1227 void **, unsigned long *);
1228 int (*media_changed) (struct gendisk *); 1228 int (*media_changed) (struct gendisk *);
1229 unsigned long long (*set_capacity) (struct gendisk *,
1230 unsigned long long);
1229 int (*revalidate_disk) (struct gendisk *); 1231 int (*revalidate_disk) (struct gendisk *);
1230 int (*getgeo)(struct block_device *, struct hd_geometry *); 1232 int (*getgeo)(struct block_device *, struct hd_geometry *);
1231 struct module *owner; 1233 struct module *owner;
diff --git a/include/linux/cb710.h b/include/linux/cb710.h
new file mode 100644
index 000000000000..63bc9a4d2926
--- /dev/null
+++ b/include/linux/cb710.h
@@ -0,0 +1,231 @@
1/*
2 * cb710/cb710.h
3 *
4 * Copyright by Michał Mirosław, 2008-2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef LINUX_CB710_DRIVER_H
11#define LINUX_CB710_DRIVER_H
12
13#include <linux/io.h>
14#include <linux/interrupt.h>
15#include <linux/spinlock.h>
16#include <linux/pci.h>
17#include <linux/platform_device.h>
18#include <linux/mmc/host.h>
19
20struct cb710_slot;
21
22typedef int (*cb710_irq_handler_t)(struct cb710_slot *);
23
24/* per-virtual-slot structure */
25struct cb710_slot {
26 struct platform_device pdev;
27 void __iomem *iobase;
28 cb710_irq_handler_t irq_handler;
29};
30
31/* per-device structure */
32struct cb710_chip {
33 struct pci_dev *pdev;
34 void __iomem *iobase;
35 unsigned platform_id;
36#ifdef CONFIG_CB710_DEBUG_ASSUMPTIONS
37 atomic_t slot_refs_count;
38#endif
39 unsigned slot_mask;
40 unsigned slots;
41 spinlock_t irq_lock;
42 struct cb710_slot slot[0];
43};
44
45/* NOTE: cb710_chip.slots is modified only during device init/exit and
46 * they are all serialized wrt themselves */
47
48/* cb710_chip.slot_mask values */
49#define CB710_SLOT_MMC 1
50#define CB710_SLOT_MS 2
51#define CB710_SLOT_SM 4
52
53/* slot port accessors - so the logic is more clear in the code */
54#define CB710_PORT_ACCESSORS(t) \
55static inline void cb710_write_port_##t(struct cb710_slot *slot, \
56 unsigned port, u##t value) \
57{ \
58 iowrite##t(value, slot->iobase + port); \
59} \
60 \
61static inline u##t cb710_read_port_##t(struct cb710_slot *slot, \
62 unsigned port) \
63{ \
64 return ioread##t(slot->iobase + port); \
65} \
66 \
67static inline void cb710_modify_port_##t(struct cb710_slot *slot, \
68 unsigned port, u##t set, u##t clear) \
69{ \
70 iowrite##t( \
71 (ioread##t(slot->iobase + port) & ~clear)|set, \
72 slot->iobase + port); \
73}
74
75CB710_PORT_ACCESSORS(8)
76CB710_PORT_ACCESSORS(16)
77CB710_PORT_ACCESSORS(32)
78
79void cb710_pci_update_config_reg(struct pci_dev *pdev,
80 int reg, uint32_t and, uint32_t xor);
81void cb710_set_irq_handler(struct cb710_slot *slot,
82 cb710_irq_handler_t handler);
83
84/* some device struct walking */
85
86static inline struct cb710_slot *cb710_pdev_to_slot(
87 struct platform_device *pdev)
88{
89 return container_of(pdev, struct cb710_slot, pdev);
90}
91
92static inline struct cb710_chip *cb710_slot_to_chip(struct cb710_slot *slot)
93{
94 return dev_get_drvdata(slot->pdev.dev.parent);
95}
96
97static inline struct device *cb710_slot_dev(struct cb710_slot *slot)
98{
99 return &slot->pdev.dev;
100}
101
102static inline struct device *cb710_chip_dev(struct cb710_chip *chip)
103{
104 return &chip->pdev->dev;
105}
106
107/* debugging aids */
108
109#ifdef CONFIG_CB710_DEBUG
110void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
111#else
112#define cb710_dump_regs(c, d) do {} while (0)
113#endif
114
115#define CB710_DUMP_REGS_MMC 0x0F
116#define CB710_DUMP_REGS_MS 0x30
117#define CB710_DUMP_REGS_SM 0xC0
118#define CB710_DUMP_REGS_ALL 0xFF
119#define CB710_DUMP_REGS_MASK 0xFF
120
121#define CB710_DUMP_ACCESS_8 0x100
122#define CB710_DUMP_ACCESS_16 0x200
123#define CB710_DUMP_ACCESS_32 0x400
124#define CB710_DUMP_ACCESS_ALL 0x700
125#define CB710_DUMP_ACCESS_MASK 0x700
126
127#endif /* LINUX_CB710_DRIVER_H */
128/*
129 * cb710/sgbuf2.h
130 *
131 * Copyright by Michał Mirosław, 2008-2009
132 *
133 * This program is free software; you can redistribute it and/or modify
134 * it under the terms of the GNU General Public License version 2 as
135 * published by the Free Software Foundation.
136 */
137#ifndef LINUX_CB710_SG_H
138#define LINUX_CB710_SG_H
139
140#include <linux/highmem.h>
141#include <linux/scatterlist.h>
142
143/**
144 * cb710_sg_miter_stop_writing - stop mapping iteration after writing
145 * @miter: sg mapping iter to be stopped
146 *
147 * Description:
148 * Stops mapping iterator @miter. @miter should have been started
149 * started using sg_miter_start(). A stopped iteration can be
150 * resumed by calling sg_miter_next() on it. This is useful when
151 * resources (kmap) need to be released during iteration.
152 *
153 * This is a convenience wrapper that will be optimized out for arches
154 * that don't need flush_kernel_dcache_page().
155 *
156 * Context:
157 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
158 */
159static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
160{
161 if (miter->page)
162 flush_kernel_dcache_page(miter->page);
163 sg_miter_stop(miter);
164}
165
166/*
167 * 32-bit PIO mapping sg iterator
168 *
169 * Hides scatterlist access issues - fragment boundaries, alignment, page
170 * mapping - for drivers using 32-bit-word-at-a-time-PIO (ie. PCI devices
171 * without DMA support).
172 *
173 * Best-case reading (transfer from device):
174 * sg_miter_start();
175 * cb710_sg_dwiter_write_from_io();
176 * cb710_sg_miter_stop_writing();
177 *
178 * Best-case writing (transfer to device):
179 * sg_miter_start();
180 * cb710_sg_dwiter_read_to_io();
181 * sg_miter_stop();
182 */
183
184uint32_t cb710_sg_dwiter_read_next_block(struct sg_mapping_iter *miter);
185void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t data);
186
187/**
188 * cb710_sg_dwiter_write_from_io - transfer data to mapped buffer from 32-bit IO port
189 * @miter: sg mapping iter
190 * @port: PIO port - IO or MMIO address
191 * @count: number of 32-bit words to transfer
192 *
193 * Description:
194 * Reads @count 32-bit words from register @port and stores it in
195 * buffer iterated by @miter. Data that would overflow the buffer
196 * is silently ignored. Iterator is advanced by 4*@count bytes
197 * or to the buffer's end whichever is closer.
198 *
199 * Context:
200 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
201 */
202static inline void cb710_sg_dwiter_write_from_io(struct sg_mapping_iter *miter,
203 void __iomem *port, size_t count)
204{
205 while (count-- > 0)
206 cb710_sg_dwiter_write_next_block(miter, ioread32(port));
207}
208
209/**
210 * cb710_sg_dwiter_read_to_io - transfer data to 32-bit IO port from mapped buffer
211 * @miter: sg mapping iter
212 * @port: PIO port - IO or MMIO address
213 * @count: number of 32-bit words to transfer
214 *
215 * Description:
216 * Writes @count 32-bit words to register @port from buffer iterated
217 * through @miter. If buffer ends before @count words are written
218 * missing data is replaced by zeroes. @miter is advanced by 4*@count
219 * bytes or to the buffer's end whichever is closer.
220 *
221 * Context:
222 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
223 */
224static inline void cb710_sg_dwiter_read_to_io(struct sg_mapping_iter *miter,
225 void __iomem *port, size_t count)
226{
227 while (count-- > 0)
228 iowrite32(cb710_sg_dwiter_read_next_block(miter), port);
229}
230
231#endif /* LINUX_CB710_SG_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1db9bbf444a3..1d37f42ac294 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
142 */ 142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id); 143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144 144
145/**
146 * clk_add_alias - add a new clock alias
147 * @alias: name for clock alias
148 * @alias_dev_name: device name
149 * @id: platform specific clock name
150 * @dev: device
151 *
152 * Allows using generic clock names for drivers by adding a new alias.
153 * Assumes clkdev, see clkdev.h for more info.
154 */
155int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
156 struct device *dev);
157
145#endif 158#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 37bcb50a4d7c..04fb5135b4e1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -261,6 +261,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
261# define __section(S) __attribute__ ((__section__(#S))) 261# define __section(S) __attribute__ ((__section__(#S)))
262#endif 262#endif
263 263
264/* Are two types/vars the same type (ignoring qualifiers)? */
265#ifndef __same_type
266# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
267#endif
268
264/* 269/*
265 * Prevent the compiler from merging or refetching accesses. The compiler 270 * Prevent the compiler from merging or refetching accesses. The compiler
266 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 271 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/device.h b/include/linux/device.h
index 5d5c197bad45..a4a7b10aaa48 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -62,8 +62,6 @@ struct bus_type {
62 void (*shutdown)(struct device *dev); 62 void (*shutdown)(struct device *dev);
63 63
64 int (*suspend)(struct device *dev, pm_message_t state); 64 int (*suspend)(struct device *dev, pm_message_t state);
65 int (*suspend_late)(struct device *dev, pm_message_t state);
66 int (*resume_early)(struct device *dev);
67 int (*resume)(struct device *dev); 65 int (*resume)(struct device *dev);
68 66
69 struct dev_pm_ops *pm; 67 struct dev_pm_ops *pm;
@@ -291,9 +289,6 @@ struct device_type {
291 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 289 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
292 void (*release)(struct device *dev); 290 void (*release)(struct device *dev);
293 291
294 int (*suspend)(struct device *dev, pm_message_t state);
295 int (*resume)(struct device *dev);
296
297 struct dev_pm_ops *pm; 292 struct dev_pm_ops *pm;
298}; 293};
299 294
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index b9cd38603fd8..0b3518c42356 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -81,8 +81,8 @@ struct dlm_lksb {
81 * the cluster, the calling node joins it. 81 * the cluster, the calling node joins it.
82 */ 82 */
83 83
84int dlm_new_lockspace(char *name, int namelen, dlm_lockspace_t **lockspace, 84int dlm_new_lockspace(const char *name, int namelen,
85 uint32_t flags, int lvblen); 85 dlm_lockspace_t **lockspace, uint32_t flags, int lvblen);
86 86
87/* 87/*
88 * dlm_release_lockspace 88 * dlm_release_lockspace
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 162e5defe683..d41ed593f79f 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -121,6 +121,13 @@ struct fuse_file_lock {
121#define FUSE_BIG_WRITES (1 << 5) 121#define FUSE_BIG_WRITES (1 << 5)
122 122
123/** 123/**
124 * CUSE INIT request/reply flags
125 *
126 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
127 */
128#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
129
130/**
124 * Release flags 131 * Release flags
125 */ 132 */
126#define FUSE_RELEASE_FLUSH (1 << 0) 133#define FUSE_RELEASE_FLUSH (1 << 0)
@@ -210,6 +217,9 @@ enum fuse_opcode {
210 FUSE_DESTROY = 38, 217 FUSE_DESTROY = 38,
211 FUSE_IOCTL = 39, 218 FUSE_IOCTL = 39,
212 FUSE_POLL = 40, 219 FUSE_POLL = 40,
220
221 /* CUSE specific operations */
222 CUSE_INIT = 4096,
213}; 223};
214 224
215enum fuse_notify_code { 225enum fuse_notify_code {
@@ -401,6 +411,27 @@ struct fuse_init_out {
401 __u32 max_write; 411 __u32 max_write;
402}; 412};
403 413
414#define CUSE_INIT_INFO_MAX 4096
415
416struct cuse_init_in {
417 __u32 major;
418 __u32 minor;
419 __u32 unused;
420 __u32 flags;
421};
422
423struct cuse_init_out {
424 __u32 major;
425 __u32 minor;
426 __u32 unused;
427 __u32 flags;
428 __u32 max_read;
429 __u32 max_write;
430 __u32 dev_major; /* chardev major */
431 __u32 dev_minor; /* chardev minor */
432 __u32 spare[10];
433};
434
404struct fuse_interrupt_in { 435struct fuse_interrupt_in {
405 __u64 unique; 436 __u64 unique;
406}; 437};
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 149fda264c86..7cbd38d363a2 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -114,6 +114,7 @@ struct hd_struct {
114#define GENHD_FL_UP 16 114#define GENHD_FL_UP 16
115#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 115#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
116#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ 116#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
117#define GENHD_FL_NATIVE_CAPACITY 128
117 118
118#define BLK_SCSI_MAX_CMDS (256) 119#define BLK_SCSI_MAX_CMDS (256)
119#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) 120#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3885e7f75562..80e14b8c2e78 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -97,6 +97,9 @@ struct vm_area_struct;
97 __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\ 97 __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\
98 __GFP_NORETRY|__GFP_NOMEMALLOC) 98 __GFP_NORETRY|__GFP_NOMEMALLOC)
99 99
100/* Control slab gfp mask during early boot */
101#define SLAB_GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)
102
100/* Control allocation constraints */ 103/* Control allocation constraints */
101#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) 104#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
102 105
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a72876e43589..53489fd4d700 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -238,6 +238,42 @@ struct hid_item {
238#define HID_GD_RIGHT 0x00010092 238#define HID_GD_RIGHT 0x00010092
239#define HID_GD_LEFT 0x00010093 239#define HID_GD_LEFT 0x00010093
240 240
241#define HID_DG_DIGITIZER 0x000d0001
242#define HID_DG_PEN 0x000d0002
243#define HID_DG_LIGHTPEN 0x000d0003
244#define HID_DG_TOUCHSCREEN 0x000d0004
245#define HID_DG_TOUCHPAD 0x000d0005
246#define HID_DG_STYLUS 0x000d0020
247#define HID_DG_PUCK 0x000d0021
248#define HID_DG_FINGER 0x000d0022
249#define HID_DG_TIPPRESSURE 0x000d0030
250#define HID_DG_BARRELPRESSURE 0x000d0031
251#define HID_DG_INRANGE 0x000d0032
252#define HID_DG_TOUCH 0x000d0033
253#define HID_DG_UNTOUCH 0x000d0034
254#define HID_DG_TAP 0x000d0035
255#define HID_DG_TABLETFUNCTIONKEY 0x000d0039
256#define HID_DG_PROGRAMCHANGEKEY 0x000d003a
257#define HID_DG_INVERT 0x000d003c
258#define HID_DG_TIPSWITCH 0x000d0042
259#define HID_DG_TIPSWITCH2 0x000d0043
260#define HID_DG_BARRELSWITCH 0x000d0044
261#define HID_DG_ERASER 0x000d0045
262#define HID_DG_TABLETPICK 0x000d0046
263/*
264 * as of May 20, 2009 the usages below are not yet in the official USB spec
265 * but are being pushed by Microsft as described in their paper "Digitizer
266 * Drivers for Windows Touch and Pen-Based Computers"
267 */
268#define HID_DG_CONFIDENCE 0x000d0047
269#define HID_DG_WIDTH 0x000d0048
270#define HID_DG_HEIGHT 0x000d0049
271#define HID_DG_CONTACTID 0x000d0051
272#define HID_DG_INPUTMODE 0x000d0052
273#define HID_DG_DEVICEINDEX 0x000d0053
274#define HID_DG_CONTACTCOUNT 0x000d0054
275#define HID_DG_CONTACTMAX 0x000d0055
276
241/* 277/*
242 * HID report types --- Ouch! HID spec says 1 2 3! 278 * HID report types --- Ouch! HID spec says 1 2 3!
243 */ 279 */
diff --git a/include/linux/i2c-ocores.h b/include/linux/i2c-ocores.h
index 8ed591b0887e..4d5e57ff6614 100644
--- a/include/linux/i2c-ocores.h
+++ b/include/linux/i2c-ocores.h
@@ -14,6 +14,8 @@
14struct ocores_i2c_platform_data { 14struct ocores_i2c_platform_data {
15 u32 regstep; /* distance between registers */ 15 u32 regstep; /* distance between registers */
16 u32 clock_khz; /* input clock in kHz */ 16 u32 clock_khz; /* input clock in kHz */
17 u8 num_devices; /* number of devices in the devices list */
18 struct i2c_board_info const *devices; /* devices connected to the bus */
17}; 19};
18 20
19#endif /* _LINUX_I2C_OCORES_H */ 21#endif /* _LINUX_I2C_OCORES_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 867cb68d8461..a6c6a2fad7c8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -178,7 +178,7 @@ typedef u8 hwif_chipset_t;
178/* 178/*
179 * Structure to hold all information about the location of this port 179 * Structure to hold all information about the location of this port
180 */ 180 */
181typedef struct hw_regs_s { 181struct ide_hw {
182 union { 182 union {
183 struct ide_io_ports io_ports; 183 struct ide_io_ports io_ports;
184 unsigned long io_ports_array[IDE_NR_PORTS]; 184 unsigned long io_ports_array[IDE_NR_PORTS];
@@ -186,12 +186,11 @@ typedef struct hw_regs_s {
186 186
187 int irq; /* our irq number */ 187 int irq; /* our irq number */
188 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 188 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
189 hwif_chipset_t chipset;
190 struct device *dev, *parent; 189 struct device *dev, *parent;
191 unsigned long config; 190 unsigned long config;
192} hw_regs_t; 191};
193 192
194static inline void ide_std_init_ports(hw_regs_t *hw, 193static inline void ide_std_init_ports(struct ide_hw *hw,
195 unsigned long io_addr, 194 unsigned long io_addr,
196 unsigned long ctl_addr) 195 unsigned long ctl_addr)
197{ 196{
@@ -218,21 +217,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
218 217
219/* 218/*
220 * Special Driver Flags 219 * Special Driver Flags
221 *
222 * set_geometry : respecify drive geometry
223 * recalibrate : seek to cyl 0
224 * set_multmode : set multmode count
225 * reserved : unused
226 */ 220 */
227typedef union { 221enum {
228 unsigned all : 8; 222 IDE_SFLAG_SET_GEOMETRY = (1 << 0),
229 struct { 223 IDE_SFLAG_RECALIBRATE = (1 << 1),
230 unsigned set_geometry : 1; 224 IDE_SFLAG_SET_MULTMODE = (1 << 2),
231 unsigned recalibrate : 1; 225};
232 unsigned set_multmode : 1;
233 unsigned reserved : 5;
234 } b;
235} special_t;
236 226
237/* 227/*
238 * Status returned from various ide_ functions 228 * Status returned from various ide_ functions
@@ -391,6 +381,7 @@ struct ide_drive_s;
391struct ide_disk_ops { 381struct ide_disk_ops {
392 int (*check)(struct ide_drive_s *, const char *); 382 int (*check)(struct ide_drive_s *, const char *);
393 int (*get_capacity)(struct ide_drive_s *); 383 int (*get_capacity)(struct ide_drive_s *);
384 u64 (*set_capacity)(struct ide_drive_s *, u64);
394 void (*setup)(struct ide_drive_s *); 385 void (*setup)(struct ide_drive_s *);
395 void (*flush)(struct ide_drive_s *); 386 void (*flush)(struct ide_drive_s *);
396 int (*init_media)(struct ide_drive_s *, struct gendisk *); 387 int (*init_media)(struct ide_drive_s *, struct gendisk *);
@@ -468,6 +459,8 @@ enum {
468 IDE_DFLAG_NICE1 = (1 << 5), 459 IDE_DFLAG_NICE1 = (1 << 5),
469 /* device is physically present */ 460 /* device is physically present */
470 IDE_DFLAG_PRESENT = (1 << 6), 461 IDE_DFLAG_PRESENT = (1 << 6),
462 /* disable Host Protected Area */
463 IDE_DFLAG_NOHPA = (1 << 7),
471 /* id read from device (synthetic if not set) */ 464 /* id read from device (synthetic if not set) */
472 IDE_DFLAG_ID_READ = (1 << 8), 465 IDE_DFLAG_ID_READ = (1 << 8),
473 IDE_DFLAG_NOPROBE = (1 << 9), 466 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -506,6 +499,7 @@ enum {
506 /* write protect */ 499 /* write protect */
507 IDE_DFLAG_WP = (1 << 29), 500 IDE_DFLAG_WP = (1 << 29),
508 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), 501 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30),
502 IDE_DFLAG_NIEN_QUIRK = (1 << 31),
509}; 503};
510 504
511struct ide_drive_s { 505struct ide_drive_s {
@@ -530,14 +524,13 @@ struct ide_drive_s {
530 unsigned long sleep; /* sleep until this time */ 524 unsigned long sleep; /* sleep until this time */
531 unsigned long timeout; /* max time to wait for irq */ 525 unsigned long timeout; /* max time to wait for irq */
532 526
533 special_t special; /* special action flags */ 527 u8 special_flags; /* special action flags */
534 528
535 u8 select; /* basic drive/head select reg value */ 529 u8 select; /* basic drive/head select reg value */
536 u8 retry_pio; /* retrying dma capable host in pio */ 530 u8 retry_pio; /* retrying dma capable host in pio */
537 u8 waiting_for_dma; /* dma currently in progress */ 531 u8 waiting_for_dma; /* dma currently in progress */
538 u8 dma; /* atapi dma flag */ 532 u8 dma; /* atapi dma flag */
539 533
540 u8 quirk_list; /* considered quirky, set for a specific host */
541 u8 init_speed; /* transfer rate set at boot */ 534 u8 init_speed; /* transfer rate set at boot */
542 u8 current_speed; /* current transfer rate set */ 535 u8 current_speed; /* current transfer rate set */
543 u8 desired_speed; /* desired transfer rate set */ 536 u8 desired_speed; /* desired transfer rate set */
@@ -562,8 +555,7 @@ struct ide_drive_s {
562 unsigned int drive_data; /* used by set_pio_mode/dev_select() */ 555 unsigned int drive_data; /* used by set_pio_mode/dev_select() */
563 unsigned int failures; /* current failure count */ 556 unsigned int failures; /* current failure count */
564 unsigned int max_failures; /* maximum allowed failure count */ 557 unsigned int max_failures; /* maximum allowed failure count */
565 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 558 u64 probed_capacity;/* initial/native media capacity */
566
567 u64 capacity64; /* total number of sectors */ 559 u64 capacity64; /* total number of sectors */
568 560
569 int lun; /* logical unit */ 561 int lun; /* logical unit */
@@ -1222,7 +1214,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1222} 1214}
1223 1215
1224void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, 1216void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
1225 hw_regs_t *, hw_regs_t **); 1217 struct ide_hw *, struct ide_hw **);
1226void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1218void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1227 1219
1228#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1220#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1461,16 +1453,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1461void ide_register_region(struct gendisk *); 1453void ide_register_region(struct gendisk *);
1462void ide_unregister_region(struct gendisk *); 1454void ide_unregister_region(struct gendisk *);
1463 1455
1456void ide_check_nien_quirk_list(ide_drive_t *);
1464void ide_undecoded_slave(ide_drive_t *); 1457void ide_undecoded_slave(ide_drive_t *);
1465 1458
1466void ide_port_apply_params(ide_hwif_t *); 1459void ide_port_apply_params(ide_hwif_t *);
1467int ide_sysfs_register_port(ide_hwif_t *); 1460int ide_sysfs_register_port(ide_hwif_t *);
1468 1461
1469struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1462struct ide_host *ide_host_alloc(const struct ide_port_info *, struct ide_hw **,
1463 unsigned int);
1470void ide_host_free(struct ide_host *); 1464void ide_host_free(struct ide_host *);
1471int ide_host_register(struct ide_host *, const struct ide_port_info *, 1465int ide_host_register(struct ide_host *, const struct ide_port_info *,
1472 hw_regs_t **); 1466 struct ide_hw **);
1473int ide_host_add(const struct ide_port_info *, hw_regs_t **, 1467int ide_host_add(const struct ide_port_info *, struct ide_hw **, unsigned int,
1474 struct ide_host **); 1468 struct ide_host **);
1475void ide_host_remove(struct ide_host *); 1469void ide_host_remove(struct ide_host *);
1476int ide_legacy_device_add(const struct ide_port_info *, unsigned long); 1470int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index cfe4fe1b7132..60e8934d10b5 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -79,6 +79,7 @@
79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
80#define ETH_P_TIPC 0x88CA /* TIPC */ 80#define ETH_P_TIPC 0x88CA /* TIPC */
81#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 81#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
82#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
82#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 83#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
83 84
84/* 85/*
diff --git a/include/linux/init.h b/include/linux/init.h
index 0e06c176f185..b2189803f19a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,8 +2,6 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/section-names.h>
6#include <linux/stringify.h>
7 5
8/* These macros are used to mark some functions or 6/* These macros are used to mark some functions or
9 * initialized data (doesn't apply to uninitialized data) 7 * initialized data (doesn't apply to uninitialized data)
@@ -101,7 +99,7 @@
101#define __memexitconst __section(.memexit.rodata) 99#define __memexitconst __section(.memexit.rodata)
102 100
103/* For assembly routines */ 101/* For assembly routines */
104#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax" 102#define __HEAD .section ".head.text","ax"
105#define __INIT .section ".init.text","ax" 103#define __INIT .section ".init.text","ax"
106#define __FINIT .previous 104#define __FINIT .previous
107 105
@@ -225,7 +223,8 @@ struct obs_kernel_param {
225 * obs_kernel_param "array" too far apart in .init.setup. 223 * obs_kernel_param "array" too far apart in .init.setup.
226 */ 224 */
227#define __setup_param(str, unique_id, fn, early) \ 225#define __setup_param(str, unique_id, fn, early) \
228 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 226 static const char __setup_str_##unique_id[] __initconst \
227 __aligned(1) = str; \
229 static struct obs_kernel_param __setup_##unique_id \ 228 static struct obs_kernel_param __setup_##unique_id \
230 __used __section(.init.setup) \ 229 __used __section(.init.setup) \
231 __attribute__((aligned((sizeof(long))))) \ 230 __attribute__((aligned((sizeof(long))))) \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index dd574d51bcaa..2721f07e9354 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -183,6 +183,7 @@ extern void disable_irq(unsigned int irq);
183extern void enable_irq(unsigned int irq); 183extern void enable_irq(unsigned int irq);
184 184
185/* The following three functions are for the core kernel use only. */ 185/* The following three functions are for the core kernel use only. */
186#ifdef CONFIG_GENERIC_HARDIRQS
186extern void suspend_device_irqs(void); 187extern void suspend_device_irqs(void);
187extern void resume_device_irqs(void); 188extern void resume_device_irqs(void);
188#ifdef CONFIG_PM_SLEEP 189#ifdef CONFIG_PM_SLEEP
@@ -190,6 +191,11 @@ extern int check_wakeup_irqs(void);
190#else 191#else
191static inline int check_wakeup_irqs(void) { return 0; } 192static inline int check_wakeup_irqs(void) { return 0; }
192#endif 193#endif
194#else
195static inline void suspend_device_irqs(void) { };
196static inline void resume_device_irqs(void) { };
197static inline int check_wakeup_irqs(void) { return 0; }
198#endif
193 199
194#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 200#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
195 201
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index a3c984d780f0..33a63f62d57f 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -56,6 +56,7 @@ extern int unregister_keyboard_notifier(struct notifier_block *nb);
56#define KT_ASCII 9 56#define KT_ASCII 9
57#define KT_LOCK 10 57#define KT_LOCK 10
58#define KT_SLOCK 12 58#define KT_SLOCK 12
59#define KT_DEAD2 13
59#define KT_BRL 14 60#define KT_BRL 14
60 61
61#define K(t,v) (((t)<<8)|(v)) 62#define K(t,v) (((t)<<8)|(v))
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 175e63f4a8c0..7bc1440fc473 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -30,6 +30,10 @@ struct lguest_data
30 /* Wallclock time set by the Host. */ 30 /* Wallclock time set by the Host. */
31 struct timespec time; 31 struct timespec time;
32 32
33 /* Interrupt pending set by the Host. The Guest should do a hypercall
34 * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */
35 int irq_pending;
36
33 /* Async hypercall ring. Instead of directly making hypercalls, we can 37 /* Async hypercall ring. Instead of directly making hypercalls, we can
34 * place them in here for processing the next time the Host wants. 38 * place them in here for processing the next time the Host wants.
35 * This batching can be quite efficient. */ 39 * This batching can be quite efficient. */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index a53407a4165c..bfefbdf7498a 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -57,7 +57,8 @@ enum lguest_req
57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */ 57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
58 LHREQ_GETDMA, /* No longer used */ 58 LHREQ_GETDMA, /* No longer used */
59 LHREQ_IRQ, /* + irq */ 59 LHREQ_IRQ, /* + irq */
60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 60 LHREQ_BREAK, /* No longer used */
61 LHREQ_EVENTFD, /* + address, fd. */
61}; 62};
62 63
63/* The alignment to use between consumer and producer parts of vring. 64/* The alignment to use between consumer and producer parts of vring.
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 516d955ab8a1..c377118884e6 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -19,6 +19,13 @@
19 } while (0) 19 } while (0)
20 20
21/* 21/*
22 * data for the MMC controller
23 */
24struct tmio_mmc_data {
25 unsigned int hclk;
26};
27
28/*
22 * data for the NAND controller 29 * data for the NAND controller
23 */ 30 */
24struct tmio_nand_data { 31struct tmio_nand_data {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 3aff8a6a389e..ce7cc6c7bcbb 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -210,6 +210,7 @@ struct mlx4_caps {
210 int num_comp_vectors; 210 int num_comp_vectors;
211 int num_mpts; 211 int num_mpts;
212 int num_mtt_segs; 212 int num_mtt_segs;
213 int mtts_per_seg;
213 int fmr_reserved_mtts; 214 int fmr_reserved_mtts;
214 int reserved_mtts; 215 int reserved_mtts;
215 int reserved_mrws; 216 int reserved_mrws;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bf8f11982dae..9f29d86e5dc9 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -165,6 +165,7 @@ enum {
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4, 165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6, 167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
168 MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
168}; 169};
169 170
170struct mlx4_wqe_ctrl_seg { 171struct mlx4_wqe_ctrl_seg {
diff --git a/include/linux/module.h b/include/linux/module.h
index a8f2c0aa4c32..a7bc6e7b43a7 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -77,6 +77,7 @@ search_extable(const struct exception_table_entry *first,
77void sort_extable(struct exception_table_entry *start, 77void sort_extable(struct exception_table_entry *start,
78 struct exception_table_entry *finish); 78 struct exception_table_entry *finish);
79void sort_main_extable(void); 79void sort_main_extable(void);
80void trim_init_extable(struct module *m);
80 81
81#ifdef MODULE 82#ifdef MODULE
82#define MODULE_GENERIC_TABLE(gtype,name) \ 83#define MODULE_GENERIC_TABLE(gtype,name) \
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index a4f0b931846c..6547c3cdbc4c 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -36,9 +36,14 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
38 38
39/* Flag bits for kernel_param.flags */
40#define KPARAM_KMALLOCED 1
41#define KPARAM_ISBOOL 2
42
39struct kernel_param { 43struct kernel_param {
40 const char *name; 44 const char *name;
41 unsigned int perm; 45 u16 perm;
46 u16 flags;
42 param_set_fn set; 47 param_set_fn set;
43 param_get_fn get; 48 param_get_fn get;
44 union { 49 union {
@@ -79,7 +84,7 @@ struct kparam_array
79 parameters. perm sets the visibility in sysfs: 000 means it's 84 parameters. perm sets the visibility in sysfs: 000 means it's
80 not there, read bits mean it's readable, write bits mean it's 85 not there, read bits mean it's readable, write bits mean it's
81 writable. */ 86 writable. */
82#define __module_param_call(prefix, name, set, get, arg, perm) \ 87#define __module_param_call(prefix, name, set, get, arg, isbool, perm) \
83 /* Default value instead of permissions? */ \ 88 /* Default value instead of permissions? */ \
84 static int __param_perm_check_##name __attribute__((unused)) = \ 89 static int __param_perm_check_##name __attribute__((unused)) = \
85 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 90 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -88,10 +93,13 @@ struct kparam_array
88 static struct kernel_param __moduleparam_const __param_##name \ 93 static struct kernel_param __moduleparam_const __param_##name \
89 __used \ 94 __used \
90 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 95 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
91 = { __param_str_##name, perm, set, get, { arg } } 96 = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \
97 set, get, { arg } }
92 98
93#define module_param_call(name, set, get, arg, perm) \ 99#define module_param_call(name, set, get, arg, perm) \
94 __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm) 100 __module_param_call(MODULE_PARAM_PREFIX, \
101 name, set, get, arg, \
102 __same_type(*(arg), bool), perm)
95 103
96/* Helper functions: type is byte, short, ushort, int, uint, long, 104/* Helper functions: type is byte, short, ushort, int, uint, long,
97 ulong, charp, bool or invbool, or XXX if you define param_get_XXX, 105 ulong, charp, bool or invbool, or XXX if you define param_get_XXX,
@@ -120,15 +128,16 @@ struct kparam_array
120#define core_param(name, var, type, perm) \ 128#define core_param(name, var, type, perm) \
121 param_check_##type(name, &(var)); \ 129 param_check_##type(name, &(var)); \
122 __module_param_call("", name, param_set_##type, param_get_##type, \ 130 __module_param_call("", name, param_set_##type, param_get_##type, \
123 &var, perm) 131 &var, __same_type(var, bool), perm)
124#endif /* !MODULE */ 132#endif /* !MODULE */
125 133
126/* Actually copy string: maxlen param is usually sizeof(string). */ 134/* Actually copy string: maxlen param is usually sizeof(string). */
127#define module_param_string(name, string, len, perm) \ 135#define module_param_string(name, string, len, perm) \
128 static const struct kparam_string __param_string_##name \ 136 static const struct kparam_string __param_string_##name \
129 = { len, string }; \ 137 = { len, string }; \
130 module_param_call(name, param_set_copystring, param_get_string, \ 138 __module_param_call(MODULE_PARAM_PREFIX, name, \
131 .str = &__param_string_##name, perm); \ 139 param_set_copystring, param_get_string, \
140 .str = &__param_string_##name, 0, perm); \
132 __MODULE_PARM_TYPE(name, "string") 141 __MODULE_PARM_TYPE(name, "string")
133 142
134/* Called on module insert or kernel boot */ 143/* Called on module insert or kernel boot */
@@ -186,21 +195,30 @@ extern int param_set_charp(const char *val, struct kernel_param *kp);
186extern int param_get_charp(char *buffer, struct kernel_param *kp); 195extern int param_get_charp(char *buffer, struct kernel_param *kp);
187#define param_check_charp(name, p) __param_check(name, p, char *) 196#define param_check_charp(name, p) __param_check(name, p, char *)
188 197
198/* For historical reasons "bool" parameters can be (unsigned) "int". */
189extern int param_set_bool(const char *val, struct kernel_param *kp); 199extern int param_set_bool(const char *val, struct kernel_param *kp);
190extern int param_get_bool(char *buffer, struct kernel_param *kp); 200extern int param_get_bool(char *buffer, struct kernel_param *kp);
191#define param_check_bool(name, p) __param_check(name, p, int) 201#define param_check_bool(name, p) \
202 static inline void __check_##name(void) \
203 { \
204 BUILD_BUG_ON(!__same_type(*(p), bool) && \
205 !__same_type(*(p), unsigned int) && \
206 !__same_type(*(p), int)); \
207 }
192 208
193extern int param_set_invbool(const char *val, struct kernel_param *kp); 209extern int param_set_invbool(const char *val, struct kernel_param *kp);
194extern int param_get_invbool(char *buffer, struct kernel_param *kp); 210extern int param_get_invbool(char *buffer, struct kernel_param *kp);
195#define param_check_invbool(name, p) __param_check(name, p, int) 211#define param_check_invbool(name, p) __param_check(name, p, bool)
196 212
197/* Comma-separated array: *nump is set to number they actually specified. */ 213/* Comma-separated array: *nump is set to number they actually specified. */
198#define module_param_array_named(name, array, type, nump, perm) \ 214#define module_param_array_named(name, array, type, nump, perm) \
199 static const struct kparam_array __param_arr_##name \ 215 static const struct kparam_array __param_arr_##name \
200 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ 216 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\
201 sizeof(array[0]), array }; \ 217 sizeof(array[0]), array }; \
202 module_param_call(name, param_array_set, param_array_get, \ 218 __module_param_call(MODULE_PARAM_PREFIX, name, \
203 .arr = &__param_arr_##name, perm); \ 219 param_array_set, param_array_get, \
220 .arr = &__param_arr_##name, \
221 __same_type(array[0], bool), perm); \
204 __MODULE_PARM_TYPE(name, "array of " #type) 222 __MODULE_PARM_TYPE(name, "array of " #type)
205 223
206#define module_param_array(name, type, nump, perm) \ 224#define module_param_array(name, type, nump, perm) \
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 7339c7bf7331..13f126c89ae8 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -18,7 +18,19 @@ struct page_cgroup {
18}; 18};
19 19
20void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 20void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat);
21void __init page_cgroup_init(void); 21
22#ifdef CONFIG_SPARSEMEM
23static inline void __init page_cgroup_init_flatmem(void)
24{
25}
26extern void __init page_cgroup_init(void);
27#else
28void __init page_cgroup_init_flatmem(void);
29static inline void __init page_cgroup_init(void)
30{
31}
32#endif
33
22struct page_cgroup *lookup_page_cgroup(struct page *page); 34struct page_cgroup *lookup_page_cgroup(struct page *page);
23 35
24enum { 36enum {
@@ -87,6 +99,10 @@ static inline void page_cgroup_init(void)
87{ 99{
88} 100}
89 101
102static inline void __init page_cgroup_init_flatmem(void)
103{
104}
105
90#endif 106#endif
91 107
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d7d1c41a0b17..9f36e1cdbf01 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1005,6 +1005,7 @@
1005#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 1005#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196
1006#define PCI_DEVICE_ID_PLX_9030 0x9030 1006#define PCI_DEVICE_ID_PLX_9030 0x9030
1007#define PCI_DEVICE_ID_PLX_9050 0x9050 1007#define PCI_DEVICE_ID_PLX_9050 0x9050
1008#define PCI_DEVICE_ID_PLX_9056 0x9056
1008#define PCI_DEVICE_ID_PLX_9080 0x9080 1009#define PCI_DEVICE_ID_PLX_9080 0x9080
1009#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 1010#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
1010 1011
@@ -1314,6 +1315,13 @@
1314 1315
1315#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */ 1316#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */
1316#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 1317#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
1318#define PCI_DEVICE_ID_CREATIVE_20K1 0x0005
1319#define PCI_DEVICE_ID_CREATIVE_20K2 0x000b
1320#define PCI_SUBDEVICE_ID_CREATIVE_SB0760 0x0024
1321#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041
1322#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042
1323#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043
1324#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000
1317 1325
1318#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ 1326#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */
1319#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 1327#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938
@@ -1847,6 +1855,10 @@
1847#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 1855#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107
1848#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 1856#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108
1849 1857
1858#define PCI_VENDOR_ID_DIGIGRAM 0x1369
1859#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM 0xc001
1860#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM 0xc002
1861
1850#define PCI_VENDOR_ID_KAWASAKI 0x136b 1862#define PCI_VENDOR_ID_KAWASAKI 0x136b
1851#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 1863#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01
1852 1864
@@ -2115,6 +2127,7 @@
2115#define PCI_VENDOR_ID_MAINPINE 0x1522 2127#define PCI_VENDOR_ID_MAINPINE 0x1522
2116#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 2128#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100
2117#define PCI_VENDOR_ID_ENE 0x1524 2129#define PCI_VENDOR_ID_ENE 0x1524
2130#define PCI_DEVICE_ID_ENE_CB710_FLASH 0x0510
2118#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 2131#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
2119#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 2132#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551
2120#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750 2133#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6e133954e2e4..1b3118a1023a 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -120,6 +120,8 @@ enum perf_counter_sample_format {
120 PERF_SAMPLE_ID = 1U << 6, 120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7, 121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8, 122 PERF_SAMPLE_PERIOD = 1U << 8,
123
124 PERF_SAMPLE_MAX = 1U << 9, /* non-ABI */
123}; 125};
124 126
125/* 127/*
@@ -131,17 +133,26 @@ enum perf_counter_read_format {
131 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, 133 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
132 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, 134 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
133 PERF_FORMAT_ID = 1U << 2, 135 PERF_FORMAT_ID = 1U << 2,
136
137 PERF_FORMAT_MAX = 1U << 3, /* non-ABI */
134}; 138};
135 139
140#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
141
136/* 142/*
137 * Hardware event to monitor via a performance monitoring counter: 143 * Hardware event to monitor via a performance monitoring counter:
138 */ 144 */
139struct perf_counter_attr { 145struct perf_counter_attr {
146
140 /* 147 /*
141 * Major type: hardware/software/tracepoint/etc. 148 * Major type: hardware/software/tracepoint/etc.
142 */ 149 */
143 __u32 type; 150 __u32 type;
144 __u32 __reserved_1; 151
152 /*
153 * Size of the attr structure, for fwd/bwd compat.
154 */
155 __u32 size;
145 156
146 /* 157 /*
147 * Type specific configuration information. 158 * Type specific configuration information.
@@ -168,12 +179,12 @@ struct perf_counter_attr {
168 comm : 1, /* include comm data */ 179 comm : 1, /* include comm data */
169 freq : 1, /* use freq, not period */ 180 freq : 1, /* use freq, not period */
170 181
171 __reserved_2 : 53; 182 __reserved_1 : 53;
172 183
173 __u32 wakeup_events; /* wakeup every n events */ 184 __u32 wakeup_events; /* wakeup every n events */
174 __u32 __reserved_3; 185 __u32 __reserved_2;
175 186
176 __u64 __reserved_4; 187 __u64 __reserved_3;
177}; 188};
178 189
179/* 190/*
@@ -621,7 +632,8 @@ extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
621static inline int is_software_counter(struct perf_counter *counter) 632static inline int is_software_counter(struct perf_counter *counter)
622{ 633{
623 return (counter->attr.type != PERF_TYPE_RAW) && 634 return (counter->attr.type != PERF_TYPE_RAW) &&
624 (counter->attr.type != PERF_TYPE_HARDWARE); 635 (counter->attr.type != PERF_TYPE_HARDWARE) &&
636 (counter->attr.type != PERF_TYPE_HW_CACHE);
625} 637}
626 638
627extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64); 639extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 1d4e2d289821..b3f74764a586 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -382,14 +382,13 @@ struct dev_pm_info {
382#ifdef CONFIG_PM_SLEEP 382#ifdef CONFIG_PM_SLEEP
383extern void device_pm_lock(void); 383extern void device_pm_lock(void);
384extern int sysdev_resume(void); 384extern int sysdev_resume(void);
385extern void device_power_up(pm_message_t state); 385extern void dpm_resume_noirq(pm_message_t state);
386extern void device_resume(pm_message_t state); 386extern void dpm_resume_end(pm_message_t state);
387 387
388extern void device_pm_unlock(void); 388extern void device_pm_unlock(void);
389extern int sysdev_suspend(pm_message_t state); 389extern int sysdev_suspend(pm_message_t state);
390extern int device_power_down(pm_message_t state); 390extern int dpm_suspend_noirq(pm_message_t state);
391extern int device_suspend(pm_message_t state); 391extern int dpm_suspend_start(pm_message_t state);
392extern int device_prepare_suspend(pm_message_t state);
393 392
394extern void __suspend_report_result(const char *function, void *fn, int ret); 393extern void __suspend_report_result(const char *function, void *fn, int ret);
395 394
@@ -403,7 +402,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
403#define device_pm_lock() do {} while (0) 402#define device_pm_lock() do {} while (0)
404#define device_pm_unlock() do {} while (0) 403#define device_pm_unlock() do {} while (0)
405 404
406static inline int device_suspend(pm_message_t state) 405static inline int dpm_suspend_start(pm_message_t state)
407{ 406{
408 return 0; 407 return 0;
409} 408}
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index ca3c88773028..b063c7328ba5 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -446,6 +446,7 @@ int pnp_start_dev(struct pnp_dev *dev);
446int pnp_stop_dev(struct pnp_dev *dev); 446int pnp_stop_dev(struct pnp_dev *dev);
447int pnp_activate_dev(struct pnp_dev *dev); 447int pnp_activate_dev(struct pnp_dev *dev);
448int pnp_disable_dev(struct pnp_dev *dev); 448int pnp_disable_dev(struct pnp_dev *dev);
449int pnp_range_reserved(resource_size_t start, resource_size_t end);
449 450
450/* protocol helpers */ 451/* protocol helpers */
451int pnp_is_active(struct pnp_dev *dev); 452int pnp_is_active(struct pnp_dev *dev);
@@ -476,6 +477,7 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
476static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 477static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
477static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 478static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
478static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 479static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
480static inline int pnp_range_reserved(resource_size_t start, resource_size_t end) { return 0;}
479 481
480/* protocol helpers */ 482/* protocol helpers */
481static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } 483static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
diff --git a/include/linux/section-names.h b/include/linux/section-names.h
deleted file mode 100644
index c956f4eb2adf..000000000000
--- a/include/linux/section-names.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __LINUX_SECTION_NAMES_H
2#define __LINUX_SECTION_NAMES_H
3
4#define HEAD_TEXT_SECTION .head.text
5
6#endif /* !__LINUX_SECTION_NAMES_H */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index e339fcf17cd3..2da8372519f5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -326,4 +326,6 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
326 return kmalloc_node(size, flags | __GFP_ZERO, node); 326 return kmalloc_node(size, flags | __GFP_ZERO, node);
327} 327}
328 328
329void __init kmem_cache_init_late(void);
330
329#endif /* _LINUX_SLAB_H */ 331#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..bb5368df4be8 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -34,4 +34,9 @@ static __always_inline void *__kmalloc(size_t size, gfp_t flags)
34 return kmalloc(size, flags); 34 return kmalloc(size, flags);
35} 35}
36 36
37static inline void kmem_cache_init_late(void)
38{
39 /* Nothing to do */
40}
41
37#endif /* __LINUX_SLOB_DEF_H */ 42#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index be5d40c43bd2..4dcbc2c71491 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -302,4 +302,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
302} 302}
303#endif 303#endif
304 304
305void __init kmem_cache_init_late(void);
306
305#endif /* _LINUX_SLUB_DEF_H */ 307#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 795032edfc46..cd15df6c63cd 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -245,11 +245,6 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
245 245
246extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 246extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
247extern int hibernate(void); 247extern int hibernate(void);
248extern int hibernate_nvs_register(unsigned long start, unsigned long size);
249extern int hibernate_nvs_alloc(void);
250extern void hibernate_nvs_free(void);
251extern void hibernate_nvs_save(void);
252extern void hibernate_nvs_restore(void);
253extern bool system_entering_hibernation(void); 248extern bool system_entering_hibernation(void);
254#else /* CONFIG_HIBERNATION */ 249#else /* CONFIG_HIBERNATION */
255static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 250static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
@@ -258,6 +253,16 @@ static inline void swsusp_unset_page_free(struct page *p) {}
258 253
259static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 254static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
260static inline int hibernate(void) { return -ENOSYS; } 255static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */
258
259#ifdef CONFIG_HIBERNATION_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void);
262extern void hibernate_nvs_free(void);
263extern void hibernate_nvs_save(void);
264extern void hibernate_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */
261static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 266static inline int hibernate_nvs_register(unsigned long a, unsigned long b)
262{ 267{
263 return 0; 268 return 0;
@@ -266,8 +271,7 @@ static inline int hibernate_nvs_alloc(void) { return 0; }
266static inline void hibernate_nvs_free(void) {} 271static inline void hibernate_nvs_free(void) {}
267static inline void hibernate_nvs_save(void) {} 272static inline void hibernate_nvs_save(void) {}
268static inline void hibernate_nvs_restore(void) {} 273static inline void hibernate_nvs_restore(void) {}
269static inline bool system_entering_hibernation(void) { return false; } 274#endif /* CONFIG_HIBERNATION_NVS */
270#endif /* CONFIG_HIBERNATION */
271 275
272#ifdef CONFIG_PM_SLEEP 276#ifdef CONFIG_PM_SLEEP
273void save_processor_state(void); 277void save_processor_state(void);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c6c84ad8bd71..418d90f5effe 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
758 758
759 759
760asmlinkage long sys_perf_counter_open( 760asmlinkage long sys_perf_counter_open(
761 const struct perf_counter_attr __user *attr_uptr, 761 struct perf_counter_attr __user *attr_uptr,
762 pid_t pid, int cpu, int group_fd, unsigned long flags); 762 pid_t pid, int cpu, int group_fd, unsigned long flags);
763#endif 763#endif
diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h
index 6b7703e75cec..71339dc531c5 100644
--- a/include/linux/ultrasound.h
+++ b/include/linux/ultrasound.h
@@ -34,7 +34,7 @@
34 * _GUS_VOICEOFF - Stops voice (no parameters) 34 * _GUS_VOICEOFF - Stops voice (no parameters)
35 * _GUS_VOICEFADE - Stops the voice smoothly. 35 * _GUS_VOICEFADE - Stops the voice smoothly.
36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) 36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
37 * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) 37 * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) 38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 06005fa9e982..4fca4f5440ba 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -10,14 +10,17 @@
10 10
11/** 11/**
12 * virtqueue - a queue to register buffers for sending or receiving. 12 * virtqueue - a queue to register buffers for sending or receiving.
13 * @list: the chain of virtqueues for this device
13 * @callback: the function to call when buffers are consumed (can be NULL). 14 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging)
14 * @vdev: the virtio device this queue was created for. 16 * @vdev: the virtio device this queue was created for.
15 * @vq_ops: the operations for this virtqueue (see below). 17 * @vq_ops: the operations for this virtqueue (see below).
16 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
17 */ 19 */
18struct virtqueue 20struct virtqueue {
19{ 21 struct list_head list;
20 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name;
21 struct virtio_device *vdev; 24 struct virtio_device *vdev;
22 struct virtqueue_ops *vq_ops; 25 struct virtqueue_ops *vq_ops;
23 void *priv; 26 void *priv;
@@ -76,15 +79,16 @@ struct virtqueue_ops {
76 * @dev: underlying device. 79 * @dev: underlying device.
77 * @id: the device type identification (used to match it with a driver). 80 * @id: the device type identification (used to match it with a driver).
78 * @config: the configuration ops for this device. 81 * @config: the configuration ops for this device.
82 * @vqs: the list of virtqueues for this device.
79 * @features: the features supported by both driver and device. 83 * @features: the features supported by both driver and device.
80 * @priv: private pointer for the driver's use. 84 * @priv: private pointer for the driver's use.
81 */ 85 */
82struct virtio_device 86struct virtio_device {
83{
84 int index; 87 int index;
85 struct device dev; 88 struct device dev;
86 struct virtio_device_id id; 89 struct virtio_device_id id;
87 struct virtio_config_ops *config; 90 struct virtio_config_ops *config;
91 struct list_head vqs;
88 /* Note that this is a Linux set_bit-style bitmap. */ 92 /* Note that this is a Linux set_bit-style bitmap. */
89 unsigned long features[1]; 93 unsigned long features[1];
90 void *priv; 94 void *priv;
@@ -99,8 +103,7 @@ void unregister_virtio_device(struct virtio_device *dev);
99 * @id_table: the ids serviced by this driver. 103 * @id_table: the ids serviced by this driver.
100 * @feature_table: an array of feature numbers supported by this device. 104 * @feature_table: an array of feature numbers supported by this device.
101 * @feature_table_size: number of entries in the feature table array. 105 * @feature_table_size: number of entries in the feature table array.
102 * @probe: the function to call when a device is found. Returns a token for 106 * @probe: the function to call when a device is found. Returns 0 or -errno.
103 * remove, or PTR_ERR().
104 * @remove: the function when a device is removed. 107 * @remove: the function when a device is removed.
105 * @config_changed: optional function to call when the device configuration 108 * @config_changed: optional function to call when the device configuration
106 * changes; may be called in interrupt context. 109 * changes; may be called in interrupt context.
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index bf8ec283b232..99f514575f6a 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -29,6 +29,7 @@
29#define VIRTIO_F_NOTIFY_ON_EMPTY 24 29#define VIRTIO_F_NOTIFY_ON_EMPTY 24
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32#include <linux/err.h>
32#include <linux/virtio.h> 33#include <linux/virtio.h>
33 34
34/** 35/**
@@ -49,15 +50,26 @@
49 * @set_status: write the status byte 50 * @set_status: write the status byte
50 * vdev: the virtio_device 51 * vdev: the virtio_device
51 * status: the new status byte 52 * status: the new status byte
53 * @request_vqs: request the specified number of virtqueues
54 * vdev: the virtio_device
55 * max_vqs: the max number of virtqueues we want
56 * If supplied, must call before any virtqueues are instantiated.
57 * To modify the max number of virtqueues after request_vqs has been
58 * called, call free_vqs and then request_vqs with a new value.
59 * @free_vqs: cleanup resources allocated by request_vqs
60 * vdev: the virtio_device
61 * If supplied, must call after all virtqueues have been deleted.
52 * @reset: reset the device 62 * @reset: reset the device
53 * vdev: the virtio device 63 * vdev: the virtio device
54 * After this, status and feature negotiation must be done again 64 * After this, status and feature negotiation must be done again
55 * @find_vq: find a virtqueue and instantiate it. 65 * @find_vqs: find virtqueues and instantiate them.
56 * vdev: the virtio_device 66 * vdev: the virtio_device
57 * index: the 0-based virtqueue number in case there's more than one. 67 * nvqs: the number of virtqueues to find
58 * callback: the virqtueue callback 68 * vqs: on success, includes new virtqueues
59 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). 69 * callbacks: array of callbacks, for each virtqueue
60 * @del_vq: free a virtqueue found by find_vq(). 70 * names: array of virtqueue names (mainly for debugging)
71 * Returns 0 on success or error status
72 * @del_vqs: free virtqueues found by find_vqs().
61 * @get_features: get the array of feature bits for this device. 73 * @get_features: get the array of feature bits for this device.
62 * vdev: the virtio_device 74 * vdev: the virtio_device
63 * Returns the first 32 feature bits (all we currently need). 75 * Returns the first 32 feature bits (all we currently need).
@@ -66,6 +78,7 @@
66 * This gives the final feature bits for the device: it can change 78 * This gives the final feature bits for the device: it can change
67 * the dev->feature bits if it wants. 79 * the dev->feature bits if it wants.
68 */ 80 */
81typedef void vq_callback_t(struct virtqueue *);
69struct virtio_config_ops 82struct virtio_config_ops
70{ 83{
71 void (*get)(struct virtio_device *vdev, unsigned offset, 84 void (*get)(struct virtio_device *vdev, unsigned offset,
@@ -75,10 +88,11 @@ struct virtio_config_ops
75 u8 (*get_status)(struct virtio_device *vdev); 88 u8 (*get_status)(struct virtio_device *vdev);
76 void (*set_status)(struct virtio_device *vdev, u8 status); 89 void (*set_status)(struct virtio_device *vdev, u8 status);
77 void (*reset)(struct virtio_device *vdev); 90 void (*reset)(struct virtio_device *vdev);
78 struct virtqueue *(*find_vq)(struct virtio_device *vdev, 91 int (*find_vqs)(struct virtio_device *, unsigned nvqs,
79 unsigned index, 92 struct virtqueue *vqs[],
80 void (*callback)(struct virtqueue *)); 93 vq_callback_t *callbacks[],
81 void (*del_vq)(struct virtqueue *vq); 94 const char *names[]);
95 void (*del_vqs)(struct virtio_device *);
82 u32 (*get_features)(struct virtio_device *vdev); 96 u32 (*get_features)(struct virtio_device *vdev);
83 void (*finalize_features)(struct virtio_device *vdev); 97 void (*finalize_features)(struct virtio_device *vdev);
84}; 98};
@@ -99,7 +113,9 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
99 if (__builtin_constant_p(fbit)) 113 if (__builtin_constant_p(fbit))
100 BUILD_BUG_ON(fbit >= 32); 114 BUILD_BUG_ON(fbit >= 32);
101 115
102 virtio_check_driver_offered_feature(vdev, fbit); 116 if (fbit < VIRTIO_TRANSPORT_F_START)
117 virtio_check_driver_offered_feature(vdev, fbit);
118
103 return test_bit(fbit, vdev->features); 119 return test_bit(fbit, vdev->features);
104} 120}
105 121
@@ -126,5 +142,18 @@ static inline int virtio_config_buf(struct virtio_device *vdev,
126 vdev->config->get(vdev, offset, buf, len); 142 vdev->config->get(vdev, offset, buf, len);
127 return 0; 143 return 0;
128} 144}
145
146static inline
147struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
148 vq_callback_t *c, const char *n)
149{
150 vq_callback_t *callbacks[] = { c };
151 const char *names[] = { n };
152 struct virtqueue *vq;
153 int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names);
154 if (err < 0)
155 return ERR_PTR(err);
156 return vq;
157}
129#endif /* __KERNEL__ */ 158#endif /* __KERNEL__ */
130#endif /* _LINUX_VIRTIO_CONFIG_H */ 159#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
index cd0fd5d181a6..9a3d7c48c622 100644
--- a/include/linux/virtio_pci.h
+++ b/include/linux/virtio_pci.h
@@ -47,9 +47,17 @@
47/* The bit of the ISR which indicates a device configuration change. */ 47/* The bit of the ISR which indicates a device configuration change. */
48#define VIRTIO_PCI_ISR_CONFIG 0x2 48#define VIRTIO_PCI_ISR_CONFIG 0x2
49 49
50/* MSI-X registers: only enabled if MSI-X is enabled. */
51/* A 16-bit vector for configuration changes. */
52#define VIRTIO_MSI_CONFIG_VECTOR 20
53/* A 16-bit vector for selected queue notifications. */
54#define VIRTIO_MSI_QUEUE_VECTOR 22
55/* Vector value used to disable MSI for queue */
56#define VIRTIO_MSI_NO_VECTOR 0xffff
57
50/* The remaining space is defined by each driver as the per-driver 58/* The remaining space is defined by each driver as the per-driver
51 * configuration space */ 59 * configuration space */
52#define VIRTIO_PCI_CONFIG 20 60#define VIRTIO_PCI_CONFIG(dev) ((dev)->msix_enabled ? 24 : 20)
53 61
54/* Virtio ABI version, this must match exactly */ 62/* Virtio ABI version, this must match exactly */
55#define VIRTIO_PCI_ABI_VERSION 0 63#define VIRTIO_PCI_ABI_VERSION 0
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 71e03722fb59..693e0ec5afa6 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -14,6 +14,8 @@
14#define VRING_DESC_F_NEXT 1 14#define VRING_DESC_F_NEXT 1
15/* This marks a buffer as write-only (otherwise read-only). */ 15/* This marks a buffer as write-only (otherwise read-only). */
16#define VRING_DESC_F_WRITE 2 16#define VRING_DESC_F_WRITE 2
17/* This means the buffer contains a list of buffer descriptors. */
18#define VRING_DESC_F_INDIRECT 4
17 19
18/* The Host uses this in used->flags to advise the Guest: don't kick me when 20/* The Host uses this in used->flags to advise the Guest: don't kick me when
19 * you add a buffer. It's unreliable, so it's simply an optimization. Guest 21 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
@@ -24,6 +26,9 @@
24 * optimization. */ 26 * optimization. */
25#define VRING_AVAIL_F_NO_INTERRUPT 1 27#define VRING_AVAIL_F_NO_INTERRUPT 1
26 28
29/* We support indirect buffer descriptors */
30#define VIRTIO_RING_F_INDIRECT_DESC 28
31
27/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 32/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
28struct vring_desc 33struct vring_desc
29{ 34{
@@ -119,7 +124,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
119 struct virtio_device *vdev, 124 struct virtio_device *vdev,
120 void *pages, 125 void *pages,
121 void (*notify)(struct virtqueue *vq), 126 void (*notify)(struct virtqueue *vq),
122 void (*callback)(struct virtqueue *vq)); 127 void (*callback)(struct virtqueue *vq),
128 const char *name);
123void vring_del_virtqueue(struct virtqueue *vq); 129void vring_del_virtqueue(struct virtqueue *vq);
124/* Filter out transport-specific feature bits. */ 130/* Filter out transport-specific feature bits. */
125void vring_transport_features(struct virtio_device *vdev); 131void vring_transport_features(struct virtio_device *vdev);
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 0627a9ae6347..3d138c1fcf8a 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -22,13 +22,6 @@
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf 22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
23 */ 23 */
24 24
25/*
26 * The FIP ethertype eventually goes in net/if_ether.h.
27 */
28#ifndef ETH_P_FIP
29#define ETH_P_FIP 0x8914 /* FIP Ethertype */
30#endif
31
32#define FIP_DEF_PRI 128 /* default selection priority */ 25#define FIP_DEF_PRI 128 /* default selection priority */
33#define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */ 26#define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
34#define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */ 27#define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index d0ed5226f8c4..4426f00da5ff 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -22,6 +22,11 @@
22#define ISCSI_IF_H 22#define ISCSI_IF_H
23 23
24#include <scsi/iscsi_proto.h> 24#include <scsi/iscsi_proto.h>
25#include <linux/in.h>
26#include <linux/in6.h>
27
28#define ISCSI_NL_GRP_ISCSID 1
29#define ISCSI_NL_GRP_UIP 2
25 30
26#define UEVENT_BASE 10 31#define UEVENT_BASE 10
27#define KEVENT_BASE 100 32#define KEVENT_BASE 100
@@ -50,7 +55,10 @@ enum iscsi_uevent_e {
50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, 55 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, 56 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
52 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17, 57 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
53 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18, 58 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
59 ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
60
61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
54 62
55 /* up events */ 63 /* up events */
56 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 64 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -59,6 +67,9 @@ enum iscsi_uevent_e {
59 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, 67 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
60 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, 68 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
61 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, 69 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
70
71 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
72 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
62}; 73};
63 74
64enum iscsi_tgt_dscvr { 75enum iscsi_tgt_dscvr {
@@ -131,6 +142,10 @@ struct iscsi_uevent {
131 struct msg_transport_connect { 142 struct msg_transport_connect {
132 uint32_t non_blocking; 143 uint32_t non_blocking;
133 } ep_connect; 144 } ep_connect;
145 struct msg_transport_connect_through_host {
146 uint32_t host_no;
147 uint32_t non_blocking;
148 } ep_connect_through_host;
134 struct msg_transport_poll { 149 struct msg_transport_poll {
135 uint64_t ep_handle; 150 uint64_t ep_handle;
136 uint32_t timeout_ms; 151 uint32_t timeout_ms;
@@ -154,6 +169,9 @@ struct iscsi_uevent {
154 uint32_t param; /* enum iscsi_host_param */ 169 uint32_t param; /* enum iscsi_host_param */
155 uint32_t len; 170 uint32_t len;
156 } set_host_param; 171 } set_host_param;
172 struct msg_set_path {
173 uint32_t host_no;
174 } set_path;
157 } u; 175 } u;
158 union { 176 union {
159 /* messages k -> u */ 177 /* messages k -> u */
@@ -187,10 +205,39 @@ struct iscsi_uevent {
187 struct msg_transport_connect_ret { 205 struct msg_transport_connect_ret {
188 uint64_t handle; 206 uint64_t handle;
189 } ep_connect_ret; 207 } ep_connect_ret;
208 struct msg_req_path {
209 uint32_t host_no;
210 } req_path;
211 struct msg_notify_if_down {
212 uint32_t host_no;
213 } notify_if_down;
190 } r; 214 } r;
191} __attribute__ ((aligned (sizeof(uint64_t)))); 215} __attribute__ ((aligned (sizeof(uint64_t))));
192 216
193/* 217/*
218 * To keep the struct iscsi_uevent size the same for userspace code
219 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
220 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
221 * struct iscsi_uevent in the NETLINK_ISCSI message.
222 */
223struct iscsi_path {
224 uint64_t handle;
225 uint8_t mac_addr[6];
226 uint8_t mac_addr_old[6];
227 uint32_t ip_addr_len; /* 4 or 16 */
228 union {
229 struct in_addr v4_addr;
230 struct in6_addr v6_addr;
231 } src;
232 union {
233 struct in_addr v4_addr;
234 struct in6_addr v6_addr;
235 } dst;
236 uint16_t vlan_id;
237 uint16_t pmtu;
238} __attribute__ ((aligned (sizeof(uint64_t))));
239
240/*
194 * Common error codes 241 * Common error codes
195 */ 242 */
196enum iscsi_err { 243enum iscsi_err {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 45f9cc642c46..ebdd9f4cf070 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -679,6 +679,7 @@ struct fc_lport {
679 unsigned int e_d_tov; 679 unsigned int e_d_tov;
680 unsigned int r_a_tov; 680 unsigned int r_a_tov;
681 u8 max_retry_count; 681 u8 max_retry_count;
682 u8 max_rport_retry_count;
682 u16 link_speed; 683 u16 link_speed;
683 u16 link_supported_speeds; 684 u16 link_supported_speeds;
684 u16 lro_xid; /* max xid for fcoe lro */ 685 u16 lro_xid; /* max xid for fcoe lro */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 0289f5745fb9..196525cd402f 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -82,9 +82,12 @@ enum {
82 82
83 83
84enum { 84enum {
85 ISCSI_TASK_FREE,
85 ISCSI_TASK_COMPLETED, 86 ISCSI_TASK_COMPLETED,
86 ISCSI_TASK_PENDING, 87 ISCSI_TASK_PENDING,
87 ISCSI_TASK_RUNNING, 88 ISCSI_TASK_RUNNING,
89 ISCSI_TASK_ABRT_TMF, /* aborted due to TMF */
90 ISCSI_TASK_ABRT_SESS_RECOV, /* aborted due to session recovery */
88}; 91};
89 92
90struct iscsi_r2t_info { 93struct iscsi_r2t_info {
@@ -181,9 +184,7 @@ struct iscsi_conn {
181 184
182 /* xmit */ 185 /* xmit */
183 struct list_head mgmtqueue; /* mgmt (control) xmit queue */ 186 struct list_head mgmtqueue; /* mgmt (control) xmit queue */
184 struct list_head mgmt_run_list; /* list of control tasks */ 187 struct list_head cmdqueue; /* data-path cmd queue */
185 struct list_head xmitqueue; /* data-path cmd queue */
186 struct list_head run_list; /* list of cmds in progress */
187 struct list_head requeue; /* tasks needing another run */ 188 struct list_head requeue; /* tasks needing another run */
188 struct work_struct xmitwork; /* per-conn. xmit workqueue */ 189 struct work_struct xmitwork; /* per-conn. xmit workqueue */
189 unsigned long suspend_tx; /* suspend Tx */ 190 unsigned long suspend_tx; /* suspend Tx */
@@ -406,6 +407,7 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
406 char *, int); 407 char *, int);
407extern int iscsi_verify_itt(struct iscsi_conn *, itt_t); 408extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
408extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); 409extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
410extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t);
409extern void iscsi_requeue_task(struct iscsi_task *task); 411extern void iscsi_requeue_task(struct iscsi_task *task);
410extern void iscsi_put_task(struct iscsi_task *task); 412extern void iscsi_put_task(struct iscsi_task *task);
411extern void __iscsi_get_task(struct iscsi_task *task); 413extern void __iscsi_get_task(struct iscsi_task *task);
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
index f888a6fda073..56e920ade326 100644
--- a/include/scsi/osd_attributes.h
+++ b/include/scsi/osd_attributes.h
@@ -29,6 +29,7 @@ enum {
29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1, 29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2, 30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3, 31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
32 OSD_APAGE_PARTITION_ATTR_ACCESS = OSD_APAGE_PARTITION_FIRST + 4,
32 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5, 33 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
33 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF, 34 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
34 35
@@ -51,7 +52,9 @@ enum {
51 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF, 52 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
52 53
53 OSD_APAGE_COMMON_FIRST = 0xF0000000, 54 OSD_APAGE_COMMON_FIRST = 0xF0000000,
54 OSD_APAGE_COMMON_LAST = 0xFFFFFFFE, 55 OSD_APAGE_COMMON_LAST = 0xFFFFFFFD,
56
57 OSD_APAGE_CURRENT_COMMAND = 0xFFFFFFFE,
55 58
56 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF, 59 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
57}; 60};
@@ -106,10 +109,30 @@ enum {
106 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */ 109 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
107 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */ 110 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
108 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */ 111 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
112 OSD_ATTR_RI_MAX_CDB_CONTINUATION_LEN = 0xA, /* 4 */
109 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */ 113 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
110 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */ 114 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
111 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */ 115 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
112 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */ 116 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
117 OARI_DEFAULT_ISOLATION_METHOD = 0X110, /* 1 */
118 OARI_SUPPORTED_ISOLATION_METHODS = 0X111, /* 32 */
119
120 OARI_DATA_ATOMICITY_GUARANTEE = 0X120, /* 8 */
121 OARI_DATA_ATOMICITY_ALIGNMENT = 0X121, /* 8 */
122 OARI_ATTRIBUTES_ATOMICITY_GUARANTEE = 0X122, /* 8 */
123 OARI_DATA_ATTRIBUTES_ATOMICITY_MULTIPLIER = 0X123, /* 1 */
124
125 OARI_MAXIMUM_SNAPSHOTS_COUNT = 0X1C1, /* 0 or 4 */
126 OARI_MAXIMUM_CLONES_COUNT = 0X1C2, /* 0 or 4 */
127 OARI_MAXIMUM_BRANCH_DEPTH = 0X1CC, /* 0 or 4 */
128 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_FIRST = 0X200, /* 0 or 4 */
129 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_LAST = 0X2ff, /* 0 or 4 */
130 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_FIRST = 0X300, /* 0 or 4 */
131 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_LAST = 0X30F, /* 0 or 4 */
132 OARI_SUPPORT_FOR_DUPLICATED_OBJECT_FREEZING = 0X310, /* 0 or 4 */
133 OARI_SUPPORT_FOR_SNAPSHOT_REFRESHING = 0X311, /* 0 or 1 */
134 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_FIRST = 0X7000001,/* 0 or 4 */
135 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_LAST = 0X700FFFF,/* 0 or 4 */
113}; 136};
114/* Root_Information_attributes_page does not have a get_page structure */ 137/* Root_Information_attributes_page does not have a get_page structure */
115 138
@@ -120,7 +143,15 @@ enum {
120 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */ 143 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
121 OSD_ATTR_PI_USERNAME = 0x9, /* variable */ 144 OSD_ATTR_PI_USERNAME = 0x9, /* variable */
122 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */ 145 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_PI_USED_CAPACITY_INCREMENT = 0x84, /* 0 or 8 */
123 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */ 147 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
148
149 OSD_ATTR_PI_ACTUAL_DATA_SPACE = 0xD1, /* 0 or 8 */
150 OSD_ATTR_PI_RESERVED_DATA_SPACE = 0xD2, /* 0 or 8 */
151 OSD_ATTR_PI_DEFAULT_SNAPSHOT_DUPLICATION_METHOD = 0x200,/* 0 or 4 */
152 OSD_ATTR_PI_DEFAULT_CLONE_DUPLICATION_METHOD = 0x201,/* 0 or 4 */
153 OSD_ATTR_PI_DEFAULT_SP_TIME_OF_DUPLICATION = 0x300,/* 0 or 4 */
154 OSD_ATTR_PI_DEFAULT_CLONE_TIME_OF_DUPLICATION = 0x301,/* 0 or 4 */
124}; 155};
125/* Partition Information attributes page does not have a get_page structure */ 156/* Partition Information attributes page does not have a get_page structure */
126 157
@@ -131,6 +162,7 @@ enum {
131 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */ 162 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
132 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */ 163 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
133 OSD_ATTR_CI_USERNAME = 0x9, /* variable */ 164 OSD_ATTR_CI_USERNAME = 0x9, /* variable */
165 OSD_ATTR_CI_COLLECTION_TYPE = 0xA, /* 1 */
134 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */ 166 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
135}; 167};
136/* Collection Information attributes page does not have a get_page structure */ 168/* Collection Information attributes page does not have a get_page structure */
@@ -144,6 +176,8 @@ enum {
144 OSD_ATTR_OI_USERNAME = 0x9, /* variable */ 176 OSD_ATTR_OI_USERNAME = 0x9, /* variable */
145 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */ 177 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */ 178 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
179 SD_ATTR_OI_ACTUAL_DATA_SPACE = 0XD1, /* 0 OR 8 */
180 SD_ATTR_OI_RESERVED_DATA_SPACE = 0XD2, /* 0 OR 8 */
147}; 181};
148/* Object Information attributes page does not have a get_page structure */ 182/* Object Information attributes page does not have a get_page structure */
149 183
@@ -248,7 +282,18 @@ struct object_timestamps_attributes_page {
248 struct osd_timestamp data_modified_time; 282 struct osd_timestamp data_modified_time;
249} __packed; 283} __packed;
250 284
251/* 7.1.2.19 Collections attributes page */ 285/* OSD2r05: 7.1.3.19 Attributes Access attributes page
286 * (OSD_APAGE_PARTITION_ATTR_ACCESS)
287 *
288 * each attribute is of the form below. Total array length is deduced
289 * from the attribute's length
290 * (See allowed_attributes_access of the struct osd_cap_object_descriptor)
291 */
292struct attributes_access_attr {
293 struct osd_attributes_list_attrid attr_list[0];
294} __packed;
295
296/* OSD2r05: 7.1.2.21 Collections attributes page */
252/* TBD */ 297/* TBD */
253 298
254/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */ 299/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
@@ -324,4 +369,29 @@ struct object_security_attributes_page {
324 __be32 policy_access_tag; 369 __be32 policy_access_tag;
325} __packed; 370} __packed;
326 371
372/* OSD2r05: 7.1.3.31 Current Command attributes page
373 * (OSD_APAGE_CURRENT_COMMAND)
374 */
375enum {
376 OSD_ATTR_CC_RESPONSE_INTEGRITY_CHECK_VALUE = 0x1, /* 32 */
377 OSD_ATTR_CC_OBJECT_TYPE = 0x2, /* 1 */
378 OSD_ATTR_CC_PARTITION_ID = 0x3, /* 8 */
379 OSD_ATTR_CC_OBJECT_ID = 0x4, /* 8 */
380 OSD_ATTR_CC_STARTING_BYTE_ADDRESS_OF_APPEND = 0x5, /* 8 */
381 OSD_ATTR_CC_CHANGE_IN_USED_CAPACITY = 0x6, /* 8 */
382};
383
384/*TBD: osdv1_current_command_attributes_page */
385
386struct osdv2_current_command_attributes_page {
387 struct osd_attr_page_header hdr; /* id=0xFFFFFFFE, size=0x44 */
388 u8 response_integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
389 u8 object_type;
390 u8 reserved[3];
391 __be64 partition_id;
392 __be64 object_id;
393 __be64 starting_byte_address_of_append;
394 __be64 change_in_used_capacity;
395};
396
327#endif /*ndef __OSD_ATTRIBUTES_H__*/ 397#endif /*ndef __OSD_ATTRIBUTES_H__*/
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index b24d9616eb46..02bd9f716357 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -18,6 +18,7 @@
18#include "osd_types.h" 18#include "osd_types.h"
19 19
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <scsi/scsi_device.h>
21 22
22/* Note: "NI" in comments below means "Not Implemented yet" */ 23/* Note: "NI" in comments below means "Not Implemented yet" */
23 24
@@ -47,6 +48,7 @@ enum osd_std_version {
47 */ 48 */
48struct osd_dev { 49struct osd_dev {
49 struct scsi_device *scsi_device; 50 struct scsi_device *scsi_device;
51 struct file *file;
50 unsigned def_timeout; 52 unsigned def_timeout;
51 53
52#ifdef OSD_VER1_SUPPORT 54#ifdef OSD_VER1_SUPPORT
@@ -69,6 +71,10 @@ void osd_dev_fini(struct osd_dev *od);
69 71
70/* some hi level device operations */ 72/* some hi level device operations */
71int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ 73int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */
74static inline struct request_queue *osd_request_queue(struct osd_dev *od)
75{
76 return od->scsi_device->request_queue;
77}
72 78
73/* we might want to use function vector in the future */ 79/* we might want to use function vector in the future */
74static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v) 80static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
@@ -363,7 +369,9 @@ void osd_req_create_object(struct osd_request *or, struct osd_obj_id *);
363void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *); 369void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
364 370
365void osd_req_write(struct osd_request *or, 371void osd_req_write(struct osd_request *or,
366 const struct osd_obj_id *, struct bio *data_out, u64 offset); 372 const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
373int osd_req_write_kern(struct osd_request *or,
374 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
367void osd_req_append(struct osd_request *or, 375void osd_req_append(struct osd_request *or,
368 const struct osd_obj_id *, struct bio *data_out);/* NI */ 376 const struct osd_obj_id *, struct bio *data_out);/* NI */
369void osd_req_create_write(struct osd_request *or, 377void osd_req_create_write(struct osd_request *or,
@@ -378,7 +386,9 @@ void osd_req_flush_object(struct osd_request *or,
378 /*V2*/ u64 offset, /*V2*/ u64 len); 386 /*V2*/ u64 offset, /*V2*/ u64 len);
379 387
380void osd_req_read(struct osd_request *or, 388void osd_req_read(struct osd_request *or,
381 const struct osd_obj_id *, struct bio *data_in, u64 offset); 389 const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
390int osd_req_read_kern(struct osd_request *or,
391 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
382 392
383/* 393/*
384 * Root/Partition/Collection/Object Attributes commands 394 * Root/Partition/Collection/Object Attributes commands
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 62b2ab8c69d4..2cc8e8b1cc19 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -303,7 +303,15 @@ enum osd_service_actions {
303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21) 303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22) 304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23) 305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
306
307 OSD_ACT_V2(CREATE_CLONE, 0x28)
308 OSD_ACT_V2(CREATE_SNAPSHOT, 0x29)
309 OSD_ACT_V2(DETACH_CLONE, 0x2A)
310 OSD_ACT_V2(REFRESH_SNAPSHOT_CLONE, 0x2B)
311 OSD_ACT_V2(RESTORE_PARTITION_FROM_SNAPSHOT, 0x2C)
312
306 OSD_ACT_V2(READ_MAP, 0x31) 313 OSD_ACT_V2(READ_MAP, 0x31)
314 OSD_ACT_V2(READ_MAPS_COMPARE, 0x32)
307 315
308 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C) 316 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
309 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D) 317 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 457588e1119b..349c7f30720d 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -126,12 +126,14 @@ struct iscsi_transport {
126 int *index, int *age); 126 int *index, int *age);
127 127
128 void (*session_recovery_timedout) (struct iscsi_cls_session *session); 128 void (*session_recovery_timedout) (struct iscsi_cls_session *session);
129 struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr, 129 struct iscsi_endpoint *(*ep_connect) (struct Scsi_Host *shost,
130 struct sockaddr *dst_addr,
130 int non_blocking); 131 int non_blocking);
131 int (*ep_poll) (struct iscsi_endpoint *ep, int timeout_ms); 132 int (*ep_poll) (struct iscsi_endpoint *ep, int timeout_ms);
132 void (*ep_disconnect) (struct iscsi_endpoint *ep); 133 void (*ep_disconnect) (struct iscsi_endpoint *ep);
133 int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type, 134 int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type,
134 uint32_t enable, struct sockaddr *dst_addr); 135 uint32_t enable, struct sockaddr *dst_addr);
136 int (*set_path) (struct Scsi_Host *shost, struct iscsi_path *params);
135}; 137};
136 138
137/* 139/*
@@ -148,6 +150,10 @@ extern void iscsi_conn_error_event(struct iscsi_cls_conn *conn,
148extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 150extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
149 char *data, uint32_t data_size); 151 char *data, uint32_t data_size);
150 152
153extern int iscsi_offload_mesg(struct Scsi_Host *shost,
154 struct iscsi_transport *transport, uint32_t type,
155 char *data, uint16_t data_size);
156
151struct iscsi_cls_conn { 157struct iscsi_cls_conn {
152 struct list_head conn_list; /* item in connlist */ 158 struct list_head conn_list; /* item in connlist */
153 void *dd_data; /* LLD private data */ 159 void *dd_data; /* LLD private data */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 6add80fc2512..82aed3f47534 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -255,6 +255,7 @@ typedef int __bitwise snd_pcm_subformat_t;
255#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ 255#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
256#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 256#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
257#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 257#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
258#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
258 259
259typedef int __bitwise snd_pcm_state_t; 260typedef int __bitwise snd_pcm_state_t;
260#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ 261#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
diff --git a/include/sound/core.h b/include/sound/core.h
index 3dea79829acc..309cb9659a05 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -300,19 +300,10 @@ int snd_card_create(int idx, const char *id,
300 struct module *module, int extra_size, 300 struct module *module, int extra_size,
301 struct snd_card **card_ret); 301 struct snd_card **card_ret);
302 302
303static inline __deprecated
304struct snd_card *snd_card_new(int idx, const char *id,
305 struct module *module, int extra_size)
306{
307 struct snd_card *card;
308 if (snd_card_create(idx, id, module, extra_size, &card) < 0)
309 return NULL;
310 return card;
311}
312
313int snd_card_disconnect(struct snd_card *card); 303int snd_card_disconnect(struct snd_card *card);
314int snd_card_free(struct snd_card *card); 304int snd_card_free(struct snd_card *card);
315int snd_card_free_when_closed(struct snd_card *card); 305int snd_card_free_when_closed(struct snd_card *card);
306void snd_card_set_id(struct snd_card *card, const char *id);
316int snd_card_register(struct snd_card *card); 307int snd_card_register(struct snd_card *card);
317int snd_card_info_init(void); 308int snd_card_info_init(void);
318int snd_card_info_done(void); 309int snd_card_info_done(void);
diff --git a/include/sound/driver.h b/include/sound/driver.h
deleted file mode 100644
index f0359437d01a..000000000000
--- a/include/sound/driver.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning "This file is deprecated"
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c17296891617..23893523dc8c 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -98,6 +98,7 @@ struct snd_pcm_ops {
98#define SNDRV_PCM_IOCTL1_INFO 1 98#define SNDRV_PCM_IOCTL1_INFO 1
99#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2 99#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
100#define SNDRV_PCM_IOCTL1_GSTATE 3 100#define SNDRV_PCM_IOCTL1_GSTATE 3
101#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4
101 102
102#define SNDRV_PCM_TRIGGER_STOP 0 103#define SNDRV_PCM_TRIGGER_STOP 0
103#define SNDRV_PCM_TRIGGER_START 1 104#define SNDRV_PCM_TRIGGER_START 1
@@ -270,6 +271,7 @@ struct snd_pcm_runtime {
270 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ 271 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
271 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ 272 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
272 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ 273 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
274 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */
273 275
274 /* -- HW params -- */ 276 /* -- HW params -- */
275 snd_pcm_access_t access; /* access mode */ 277 snd_pcm_access_t access; /* access mode */
@@ -486,80 +488,6 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream);
486void snd_pcm_vma_notify_data(void *client, void *data); 488void snd_pcm_vma_notify_data(void *client, void *data);
487int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); 489int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
488 490
489#if BITS_PER_LONG >= 64
490
491static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
492{
493 *rem = *n % div;
494 *n /= div;
495}
496
497#elif defined(i386)
498
499static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
500{
501 u_int32_t low, high;
502 low = *n & 0xffffffff;
503 high = *n >> 32;
504 if (high) {
505 u_int32_t high1 = high % div;
506 high /= div;
507 asm("divl %2":"=a" (low), "=d" (*rem):"rm" (div), "a" (low), "d" (high1));
508 *n = (u_int64_t)high << 32 | low;
509 } else {
510 *n = low / div;
511 *rem = low % div;
512 }
513}
514#else
515
516static inline void divl(u_int32_t high, u_int32_t low,
517 u_int32_t div,
518 u_int32_t *q, u_int32_t *r)
519{
520 u_int64_t n = (u_int64_t)high << 32 | low;
521 u_int64_t d = (u_int64_t)div << 31;
522 u_int32_t q1 = 0;
523 int c = 32;
524 while (n > 0xffffffffU) {
525 q1 <<= 1;
526 if (n >= d) {
527 n -= d;
528 q1 |= 1;
529 }
530 d >>= 1;
531 c--;
532 }
533 q1 <<= c;
534 if (n) {
535 low = n;
536 *q = q1 | (low / div);
537 *r = low % div;
538 } else {
539 *r = 0;
540 *q = q1;
541 }
542 return;
543}
544
545static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
546{
547 u_int32_t low, high;
548 low = *n & 0xffffffff;
549 high = *n >> 32;
550 if (high) {
551 u_int32_t high1 = high % div;
552 u_int32_t low1 = low;
553 high /= div;
554 divl(high1, low1, div, &low, rem);
555 *n = (u_int64_t)high << 32 | low;
556 } else {
557 *n = low / div;
558 *rem = low % div;
559 }
560}
561#endif
562
563/* 491/*
564 * PCM library 492 * PCM library
565 */ 493 */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 13676472ddfc..352d7eee9b6d 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -45,24 +45,6 @@ struct snd_pcm_substream;
45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */ 45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */
46 46
47/* 47/*
48 * DAI Left/Right Clocks.
49 *
50 * Specifies whether the DAI can support different samples for similtanious
51 * playback and capture. This usually requires a seperate physical frame
52 * clock for playback and capture.
53 */
54#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
55#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
56
57/*
58 * TDM
59 *
60 * Time Division Multiplexing. Allows PCM data to be multplexed with other
61 * data on the DAI.
62 */
63#define SND_SOC_DAIFMT_TDM (1 << 6)
64
65/*
66 * DAI hardware signal inversions. 48 * DAI hardware signal inversions.
67 * 49 *
68 * Specifies whether the DAI can also support inverted clocks for the specified 50 * Specifies whether the DAI can also support inverted clocks for the specified
@@ -96,6 +78,10 @@ struct snd_pcm_substream;
96#define SND_SOC_CLOCK_IN 0 78#define SND_SOC_CLOCK_IN 0
97#define SND_SOC_CLOCK_OUT 1 79#define SND_SOC_CLOCK_OUT 1
98 80
81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\
82 SNDRV_PCM_FMTBIT_S32_LE |\
83 SNDRV_PCM_FMTBIT_S32_BE)
84
99struct snd_soc_dai_ops; 85struct snd_soc_dai_ops;
100struct snd_soc_dai; 86struct snd_soc_dai;
101struct snd_ac97_bus_ops; 87struct snd_ac97_bus_ops;
@@ -208,6 +194,7 @@ struct snd_soc_dai {
208 /* DAI capabilities */ 194 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture; 195 struct snd_soc_pcm_stream capture;
210 struct snd_soc_pcm_stream playback; 196 struct snd_soc_pcm_stream playback;
197 unsigned int symmetric_rates:1;
211 198
212 /* DAI runtime info */ 199 /* DAI runtime info */
213 struct snd_pcm_runtime *runtime; 200 struct snd_pcm_runtime *runtime;
@@ -219,11 +206,8 @@ struct snd_soc_dai {
219 /* DAI private data */ 206 /* DAI private data */
220 void *private_data; 207 void *private_data;
221 208
222 /* parent codec/platform */ 209 /* parent platform */
223 union { 210 struct snd_soc_platform *platform;
224 struct snd_soc_codec *codec;
225 struct snd_soc_platform *platform;
226 };
227 211
228 struct list_head list; 212 struct list_head list;
229}; 213};
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index a7def6a9a030..ec8a45f9a069 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -140,16 +140,30 @@
140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
142 .shift = wshift, .invert = winvert} 142 .shift = wshift, .invert = winvert}
143#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
144 wevent, wflags) \
145{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
146 .shift = wshift, .invert = winvert, \
147 .event = wevent, .event_flags = wflags}
143#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \ 148#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
144{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 149{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
145 .shift = wshift, .invert = winvert} 150 .shift = wshift, .invert = winvert}
151#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
152 wevent, wflags) \
153{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
154 .shift = wshift, .invert = winvert, \
155 .event = wevent, .event_flags = wflags}
146 156
147/* generic register modifier widget */ 157/* generic widgets */
148#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 158#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
149{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ 159{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \
150 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 160 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \
151 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 161 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \
152 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 162 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
163#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
164{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
165 .shift = wshift, .invert = winvert, .event = wevent, \
166 .event_flags = wflags}
153 167
154/* dapm kcontrol types */ 168/* dapm kcontrol types */
155#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ 169#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
@@ -265,8 +279,6 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
265/* dapm events */ 279/* dapm events */
266int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 280int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
267 int event); 281 int event);
268int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
269 enum snd_soc_bias_level level);
270 282
271/* dapm sys fs - used by the core */ 283/* dapm sys fs - used by the core */
272int snd_soc_dapm_sys_add(struct device *dev); 284int snd_soc_dapm_sys_add(struct device *dev);
@@ -298,6 +310,7 @@ enum snd_soc_dapm_type {
298 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */ 310 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */
299 snd_soc_dapm_pre, /* machine specific pre widget - exec first */ 311 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
300 snd_soc_dapm_post, /* machine specific post widget - exec last */ 312 snd_soc_dapm_post, /* machine specific post widget - exec last */
313 snd_soc_dapm_supply, /* power/clock supply */
301}; 314};
302 315
303/* 316/*
@@ -357,6 +370,8 @@ struct snd_soc_dapm_widget {
357 unsigned char suspend:1; /* was active before suspend */ 370 unsigned char suspend:1; /* was active before suspend */
358 unsigned char pmdown:1; /* waiting for timeout */ 371 unsigned char pmdown:1; /* waiting for timeout */
359 372
373 int (*power_check)(struct snd_soc_dapm_widget *w);
374
360 /* external events */ 375 /* external events */
361 unsigned short event_flags; /* flags to specify event types */ 376 unsigned short event_flags; /* flags to specify event types */
362 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); 377 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int);
@@ -368,6 +383,9 @@ struct snd_soc_dapm_widget {
368 /* widget input and outputs */ 383 /* widget input and outputs */
369 struct list_head sources; 384 struct list_head sources;
370 struct list_head sinks; 385 struct list_head sinks;
386
387 /* used during DAPM updates */
388 struct list_head power_list;
371}; 389};
372 390
373#endif 391#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a40bc6f316fc..cf6111d72b17 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -118,6 +118,14 @@
118 .info = snd_soc_info_volsw, \ 118 .info = snd_soc_info_volsw, \
119 .get = xhandler_get, .put = xhandler_put, \ 119 .get = xhandler_get, .put = xhandler_put, \
120 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 120 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
121#define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\
122 xhandler_get, xhandler_put) \
123{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
124 .info = snd_soc_info_volsw, \
125 .get = xhandler_get, .put = xhandler_put, \
126 .private_value = (unsigned long)&(struct soc_mixer_control) \
127 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
128 .max = xmax, .invert = xinvert} }
121#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 129#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
122 xhandler_get, xhandler_put, tlv_array) \ 130 xhandler_get, xhandler_put, tlv_array) \
123{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 131{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -206,10 +214,6 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
206 struct snd_soc_jack_gpio *gpios); 214 struct snd_soc_jack_gpio *gpios);
207#endif 215#endif
208 216
209/* codec IO */
210#define snd_soc_read(codec, reg) codec->read(codec, reg)
211#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
212
213/* codec register bit access */ 217/* codec register bit access */
214int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 218int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
215 unsigned short mask, unsigned short value); 219 unsigned short mask, unsigned short value);
@@ -331,6 +335,7 @@ struct snd_soc_codec {
331 struct module *owner; 335 struct module *owner;
332 struct mutex mutex; 336 struct mutex mutex;
333 struct device *dev; 337 struct device *dev;
338 struct snd_soc_device *socdev;
334 339
335 struct list_head list; 340 struct list_head list;
336 341
@@ -364,6 +369,8 @@ struct snd_soc_codec {
364 enum snd_soc_bias_level bias_level; 369 enum snd_soc_bias_level bias_level;
365 enum snd_soc_bias_level suspend_bias_level; 370 enum snd_soc_bias_level suspend_bias_level;
366 struct delayed_work delayed_work; 371 struct delayed_work delayed_work;
372 struct list_head up_list;
373 struct list_head down_list;
367 374
368 /* codec DAI's */ 375 /* codec DAI's */
369 struct snd_soc_dai *dai; 376 struct snd_soc_dai *dai;
@@ -417,6 +424,12 @@ struct snd_soc_dai_link {
417 /* codec/machine specific init - e.g. add machine controls */ 424 /* codec/machine specific init - e.g. add machine controls */
418 int (*init)(struct snd_soc_codec *codec); 425 int (*init)(struct snd_soc_codec *codec);
419 426
427 /* Symmetry requirements */
428 unsigned int symmetric_rates:1;
429
430 /* Symmetry data - only valid if symmetry is being enforced */
431 unsigned int rate;
432
420 /* DAI pcm */ 433 /* DAI pcm */
421 struct snd_pcm *pcm; 434 struct snd_pcm *pcm;
422}; 435};
@@ -490,6 +503,19 @@ struct soc_enum {
490 void *dapm; 503 void *dapm;
491}; 504};
492 505
506/* codec IO */
507static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
508 unsigned int reg)
509{
510 return codec->read(codec, reg);
511}
512
513static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
514 unsigned int reg, unsigned int val)
515{
516 return codec->write(codec, reg, val);
517}
518
493#include <sound/soc-dai.h> 519#include <sound/soc-dai.h>
494 520
495#endif 521#endif
diff --git a/include/sound/wm9081.h b/include/sound/wm9081.h
new file mode 100644
index 000000000000..e173ddbf6bd4
--- /dev/null
+++ b/include/sound/wm9081.h
@@ -0,0 +1,25 @@
1/*
2 * linux/sound/wm9081.h -- Platform data for WM9081
3 *
4 * Copyright 2009 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM_9081_H
12#define __LINUX_SND_WM_9081_H
13
14struct wm9081_retune_mobile_setting {
15 const char *name;
16 unsigned int rate;
17 u16 config[20];
18};
19
20struct wm9081_retune_mobile_config {
21 struct wm9081_retune_mobile_setting *configs;
22 int num_configs;
23};
24
25#endif
diff --git a/include/video/pxa168fb.h b/include/video/pxa168fb.h
new file mode 100644
index 000000000000..b5cc72fe0461
--- /dev/null
+++ b/include/video/pxa168fb.h
@@ -0,0 +1,127 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/pxa168fb.h
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_MACH_PXA168FB_H
12#define __ASM_MACH_PXA168FB_H
13
14#include <linux/fb.h>
15#include <linux/interrupt.h>
16
17/* Dumb interface */
18#define PIN_MODE_DUMB_24 0
19#define PIN_MODE_DUMB_18_SPI 1
20#define PIN_MODE_DUMB_18_GPIO 2
21#define PIN_MODE_DUMB_16_SPI 3
22#define PIN_MODE_DUMB_16_GPIO 4
23#define PIN_MODE_DUMB_12_SPI_GPIO 5
24#define PIN_MODE_SMART_18_SPI 6
25#define PIN_MODE_SMART_16_SPI 7
26#define PIN_MODE_SMART_8_SPI_GPIO 8
27
28/* Dumb interface pin allocation */
29#define DUMB_MODE_RGB565 0
30#define DUMB_MODE_RGB565_UPPER 1
31#define DUMB_MODE_RGB666 2
32#define DUMB_MODE_RGB666_UPPER 3
33#define DUMB_MODE_RGB444 4
34#define DUMB_MODE_RGB444_UPPER 5
35#define DUMB_MODE_RGB888 6
36
37/* default fb buffer size WVGA-32bits */
38#define DEFAULT_FB_SIZE (800 * 480 * 4)
39
40/*
41 * Buffer pixel format
42 * bit0 is for rb swap.
43 * bit12 is for Y UorV swap
44 */
45#define PIX_FMT_RGB565 0
46#define PIX_FMT_BGR565 1
47#define PIX_FMT_RGB1555 2
48#define PIX_FMT_BGR1555 3
49#define PIX_FMT_RGB888PACK 4
50#define PIX_FMT_BGR888PACK 5
51#define PIX_FMT_RGB888UNPACK 6
52#define PIX_FMT_BGR888UNPACK 7
53#define PIX_FMT_RGBA888 8
54#define PIX_FMT_BGRA888 9
55#define PIX_FMT_YUV422PACK 10
56#define PIX_FMT_YVU422PACK 11
57#define PIX_FMT_YUV422PLANAR 12
58#define PIX_FMT_YVU422PLANAR 13
59#define PIX_FMT_YUV420PLANAR 14
60#define PIX_FMT_YVU420PLANAR 15
61#define PIX_FMT_PSEUDOCOLOR 20
62#define PIX_FMT_UYVY422PACK (0x1000|PIX_FMT_YUV422PACK)
63
64/*
65 * PXA LCD controller private state.
66 */
67struct pxa168fb_info {
68 struct device *dev;
69 struct clk *clk;
70 struct fb_info *info;
71
72 void __iomem *reg_base;
73 dma_addr_t fb_start_dma;
74 u32 pseudo_palette[16];
75
76 int pix_fmt;
77 unsigned is_blanked:1;
78 unsigned panel_rbswap:1;
79 unsigned active:1;
80};
81
82/*
83 * PXA fb machine information
84 */
85struct pxa168fb_mach_info {
86 char id[16];
87
88 int num_modes;
89 struct fb_videomode *modes;
90
91 /*
92 * Pix_fmt
93 */
94 unsigned pix_fmt;
95
96 /*
97 * I/O pin allocation.
98 */
99 unsigned io_pin_allocation_mode:4;
100
101 /*
102 * Dumb panel -- assignment of R/G/B component info to the 24
103 * available external data lanes.
104 */
105 unsigned dumb_mode:4;
106 unsigned panel_rgb_reverse_lanes:1;
107
108 /*
109 * Dumb panel -- GPIO output data.
110 */
111 unsigned gpio_output_mask:8;
112 unsigned gpio_output_data:8;
113
114 /*
115 * Dumb panel -- configurable output signal polarity.
116 */
117 unsigned invert_composite_blank:1;
118 unsigned invert_pix_val_ena:1;
119 unsigned invert_pixclock:1;
120 unsigned invert_vsync:1;
121 unsigned invert_hsync:1;
122 unsigned panel_rbswap:1;
123 unsigned active:1;
124 unsigned enable_lcd:1;
125};
126
127#endif /* __ASM_MACH_PXA168FB_H */