aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/Kbuild9
-rw-r--r--include/asm-generic/Kbuild.asm67
-rw-r--r--include/asm-generic/atomic.h47
-rw-r--r--include/asm-generic/bitops/find.h39
-rw-r--r--include/asm-generic/cmpxchg-local.h1
-rw-r--r--include/asm-generic/cputime.h6
-rw-r--r--include/asm-generic/dma-mapping-broken.h3
-rw-r--r--include/asm-generic/fcntl.h14
-rw-r--r--include/asm-generic/gpio.h33
-rw-r--r--include/asm-generic/hardirq.h2
-rw-r--r--include/asm-generic/io.h30
-rw-r--r--include/asm-generic/ioctls.h10
-rw-r--r--include/asm-generic/irqflags.h52
-rw-r--r--include/asm-generic/kdebug.h2
-rw-r--r--include/asm-generic/local64.h96
-rw-r--r--include/asm-generic/percpu.h29
-rw-r--r--include/asm-generic/pgtable.h6
-rw-r--r--include/asm-generic/statfs.h9
-rw-r--r--include/asm-generic/syscalls.h6
-rw-r--r--include/asm-generic/system.h20
-rw-r--r--include/asm-generic/termbits.h1
-rw-r--r--include/asm-generic/topology.h20
-rw-r--r--include/asm-generic/unistd.h39
-rw-r--r--include/asm-generic/vmlinux.lds.h22
24 files changed, 406 insertions, 157 deletions
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index eb62334cda29..53f91b1ae53a 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -3,6 +3,8 @@ header-y += bitsperlong.h
3header-y += errno-base.h 3header-y += errno-base.h
4header-y += errno.h 4header-y += errno.h
5header-y += fcntl.h 5header-y += fcntl.h
6header-y += int-l64.h
7header-y += int-ll64.h
6header-y += ioctl.h 8header-y += ioctl.h
7header-y += ioctls.h 9header-y += ioctls.h
8header-y += ipcbuf.h 10header-y += ipcbuf.h
@@ -12,10 +14,12 @@ header-y += msgbuf.h
12header-y += param.h 14header-y += param.h
13header-y += poll.h 15header-y += poll.h
14header-y += posix_types.h 16header-y += posix_types.h
17header-y += resource.h
15header-y += sembuf.h 18header-y += sembuf.h
16header-y += setup.h 19header-y += setup.h
17header-y += shmbuf.h 20header-y += shmbuf.h
18header-y += shmparam.h 21header-y += shmparam.h
22header-y += siginfo.h
19header-y += signal-defs.h 23header-y += signal-defs.h
20header-y += signal.h 24header-y += signal.h
21header-y += socket.h 25header-y += socket.h
@@ -28,8 +32,3 @@ header-y += termios.h
28header-y += types.h 32header-y += types.h
29header-y += ucontext.h 33header-y += ucontext.h
30header-y += unistd.h 34header-y += unistd.h
31
32unifdef-y += int-l64.h
33unifdef-y += int-ll64.h
34unifdef-y += resource.h
35unifdef-y += siginfo.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 96d7c9804dc1..c5d2e5dd871b 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,5 +1,5 @@
1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ 1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
3header-y += kvm.h 3header-y += kvm.h
4endif 4endif
5 5
@@ -9,36 +9,37 @@ header-y += kvm_para.h
9endif 9endif
10 10
11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
13unifdef-y += a.out.h 13header-y += a.out.h
14endif 14endif
15unifdef-y += auxvec.h 15
16unifdef-y += byteorder.h 16header-y += auxvec.h
17unifdef-y += bitsperlong.h 17header-y += bitsperlong.h
18unifdef-y += errno.h 18header-y += byteorder.h
19unifdef-y += fcntl.h 19header-y += errno.h
20unifdef-y += ioctl.h 20header-y += fcntl.h
21unifdef-y += ioctls.h 21header-y += ioctl.h
22unifdef-y += ipcbuf.h 22header-y += ioctls.h
23unifdef-y += mman.h 23header-y += ipcbuf.h
24unifdef-y += msgbuf.h 24header-y += mman.h
25unifdef-y += param.h 25header-y += msgbuf.h
26unifdef-y += poll.h 26header-y += param.h
27unifdef-y += posix_types.h 27header-y += poll.h
28unifdef-y += ptrace.h 28header-y += posix_types.h
29unifdef-y += resource.h 29header-y += ptrace.h
30unifdef-y += sembuf.h 30header-y += resource.h
31unifdef-y += setup.h 31header-y += sembuf.h
32unifdef-y += shmbuf.h 32header-y += setup.h
33unifdef-y += sigcontext.h 33header-y += shmbuf.h
34unifdef-y += siginfo.h 34header-y += sigcontext.h
35unifdef-y += signal.h 35header-y += siginfo.h
36unifdef-y += socket.h 36header-y += signal.h
37unifdef-y += sockios.h 37header-y += socket.h
38unifdef-y += stat.h 38header-y += sockios.h
39unifdef-y += statfs.h 39header-y += stat.h
40unifdef-y += swab.h 40header-y += statfs.h
41unifdef-y += termbits.h 41header-y += swab.h
42unifdef-y += termios.h 42header-y += termbits.h
43unifdef-y += types.h 43header-y += termios.h
44unifdef-y += unistd.h 44header-y += types.h
45header-y += unistd.h
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 058129e9b04c..e994197f84b7 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -43,6 +43,7 @@
43 */ 43 */
44#define atomic_set(v, i) (((v)->counter) = (i)) 44#define atomic_set(v, i) (((v)->counter) = (i))
45 45
46#include <linux/irqflags.h>
46#include <asm/system.h> 47#include <asm/system.h>
47 48
48/** 49/**
@@ -57,11 +58,11 @@ static inline int atomic_add_return(int i, atomic_t *v)
57 unsigned long flags; 58 unsigned long flags;
58 int temp; 59 int temp;
59 60
60 local_irq_save(flags); 61 raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */
61 temp = v->counter; 62 temp = v->counter;
62 temp += i; 63 temp += i;
63 v->counter = temp; 64 v->counter = temp;
64 local_irq_restore(flags); 65 raw_local_irq_restore(flags);
65 66
66 return temp; 67 return temp;
67} 68}
@@ -78,11 +79,11 @@ static inline int atomic_sub_return(int i, atomic_t *v)
78 unsigned long flags; 79 unsigned long flags;
79 int temp; 80 int temp;
80 81
81 local_irq_save(flags); 82 raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */
82 temp = v->counter; 83 temp = v->counter;
83 temp -= i; 84 temp -= i;
84 v->counter = temp; 85 v->counter = temp;
85 local_irq_restore(flags); 86 raw_local_irq_restore(flags);
86 87
87 return temp; 88 return temp;
88} 89}
@@ -119,14 +120,23 @@ static inline void atomic_dec(atomic_t *v)
119#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) 120#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
120#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) 121#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
121 122
122#define atomic_add_unless(v, a, u) \ 123#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
123({ \ 124#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
124 int c, old; \ 125
125 c = atomic_read(v); \ 126#define cmpxchg_local(ptr, o, n) \
126 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 127 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
127 c = old; \ 128 (unsigned long)(n), sizeof(*(ptr))))
128 c != (u); \ 129
129}) 130#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
131
132static inline int atomic_add_unless(atomic_t *v, int a, int u)
133{
134 int c, old;
135 c = atomic_read(v);
136 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
137 c = old;
138 return c != u;
139}
130 140
131#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 141#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
132 142
@@ -135,20 +145,11 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
135 unsigned long flags; 145 unsigned long flags;
136 146
137 mask = ~mask; 147 mask = ~mask;
138 local_irq_save(flags); 148 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
139 *addr &= mask; 149 *addr &= mask;
140 local_irq_restore(flags); 150 raw_local_irq_restore(flags);
141} 151}
142 152
143#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
144#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
145
146#define cmpxchg_local(ptr, o, n) \
147 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
148 (unsigned long)(n), sizeof(*(ptr))))
149
150#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
151
152/* Assume that atomic operations are already serializing */ 153/* Assume that atomic operations are already serializing */
153#define smp_mb__before_atomic_dec() barrier() 154#define smp_mb__before_atomic_dec() barrier()
154#define smp_mb__after_atomic_dec() barrier() 155#define smp_mb__after_atomic_dec() barrier()
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h
index 1914e9742512..110fa700f853 100644
--- a/include/asm-generic/bitops/find.h
+++ b/include/asm-generic/bitops/find.h
@@ -1,15 +1,50 @@
1#ifndef _ASM_GENERIC_BITOPS_FIND_H_ 1#ifndef _ASM_GENERIC_BITOPS_FIND_H_
2#define _ASM_GENERIC_BITOPS_FIND_H_ 2#define _ASM_GENERIC_BITOPS_FIND_H_
3 3
4#ifndef CONFIG_GENERIC_FIND_NEXT_BIT 4/**
5 * find_next_bit - find the next set bit in a memory region
6 * @addr: The address to base the search on
7 * @offset: The bitnumber to start searching at
8 * @size: The bitmap size in bits
9 */
5extern unsigned long find_next_bit(const unsigned long *addr, unsigned long 10extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
6 size, unsigned long offset); 11 size, unsigned long offset);
7 12
13/**
14 * find_next_zero_bit - find the next cleared bit in a memory region
15 * @addr: The address to base the search on
16 * @offset: The bitnumber to start searching at
17 * @size: The bitmap size in bits
18 */
8extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned 19extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
9 long size, unsigned long offset); 20 long size, unsigned long offset);
10#endif 21
22#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
23
24/**
25 * find_first_bit - find the first set bit in a memory region
26 * @addr: The address to start the search at
27 * @size: The maximum size to search
28 *
29 * Returns the bit number of the first set bit.
30 */
31extern unsigned long find_first_bit(const unsigned long *addr,
32 unsigned long size);
33
34/**
35 * find_first_zero_bit - find the first cleared bit in a memory region
36 * @addr: The address to start the search at
37 * @size: The maximum size to search
38 *
39 * Returns the bit number of the first cleared bit.
40 */
41extern unsigned long find_first_zero_bit(const unsigned long *addr,
42 unsigned long size);
43#else /* CONFIG_GENERIC_FIND_FIRST_BIT */
11 44
12#define find_first_bit(addr, size) find_next_bit((addr), (size), 0) 45#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
13#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 46#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
14 47
48#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
49
15#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */ 50#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
index b2ba2fc8829a..2533fddd34a6 100644
--- a/include/asm-generic/cmpxchg-local.h
+++ b/include/asm-generic/cmpxchg-local.h
@@ -2,6 +2,7 @@
2#define __ASM_GENERIC_CMPXCHG_LOCAL_H 2#define __ASM_GENERIC_CMPXCHG_LOCAL_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/irqflags.h>
5 6
6extern unsigned long wrong_size_cmpxchg(volatile void *ptr); 7extern unsigned long wrong_size_cmpxchg(volatile void *ptr);
7 8
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index ca0f239f0e13..2bcc5c7c22a6 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -33,10 +33,10 @@ typedef u64 cputime64_t;
33 33
34 34
35/* 35/*
36 * Convert cputime to milliseconds and back. 36 * Convert cputime to microseconds and back.
37 */ 37 */
38#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct) 38#define cputime_to_usecs(__ct) jiffies_to_usecs(__ct);
39#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs) 39#define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs);
40 40
41/* 41/*
42 * Convert cputime to seconds and back. 42 * Convert cputime to seconds and back.
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index 82cd0cb1c3fe..ccf7b4f34a3c 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -72,9 +72,6 @@ dma_set_mask(struct device *dev, u64 mask);
72extern int 72extern int
73dma_get_cache_alignment(void); 73dma_get_cache_alignment(void);
74 74
75extern int
76dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
77
78extern void 75extern void
79dma_cache_sync(struct device *dev, void *vaddr, size_t size, 76dma_cache_sync(struct device *dev, void *vaddr, size_t size,
80 enum dma_data_direction direction); 77 enum dma_data_direction direction);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index fcd268ce0674..0fc16e3f0bfc 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -3,6 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/*
7 * FMODE_EXEC is 0x20
8 * FMODE_NONOTIFY is 0x1000000
9 * These cannot be used by userspace O_* until internal and external open
10 * flags are split.
11 * -Eric Paris
12 */
13
14/*
15 * When introducing new O_* bits, please check its uniqueness in fcntl_init().
16 */
17
6#define O_ACCMODE 00000003 18#define O_ACCMODE 00000003
7#define O_RDONLY 00000000 19#define O_RDONLY 00000000
8#define O_WRONLY 00000001 20#define O_WRONLY 00000001
@@ -110,7 +122,7 @@
110 122
111struct f_owner_ex { 123struct f_owner_ex {
112 int type; 124 int type;
113 pid_t pid; 125 __kernel_pid_t pid;
114}; 126};
115 127
116/* for F_[GET|SET]FL */ 128/* for F_[GET|SET]FL */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 4f3d75e1ad39..ff5c66080c8c 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -16,21 +16,34 @@
16 * While the GPIO programming interface defines valid GPIO numbers 16 * While the GPIO programming interface defines valid GPIO numbers
17 * to be in the range 0..MAX_INT, this library restricts them to the 17 * to be in the range 0..MAX_INT, this library restricts them to the
18 * smaller range 0..ARCH_NR_GPIOS-1. 18 * smaller range 0..ARCH_NR_GPIOS-1.
19 *
20 * ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of
21 * builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is
22 * actually an estimate of a board-specific value.
19 */ 23 */
20 24
21#ifndef ARCH_NR_GPIOS 25#ifndef ARCH_NR_GPIOS
22#define ARCH_NR_GPIOS 256 26#define ARCH_NR_GPIOS 256
23#endif 27#endif
24 28
29/*
30 * "valid" GPIO numbers are nonnegative and may be passed to
31 * setup routines like gpio_request(). only some valid numbers
32 * can successfully be requested and used.
33 *
34 * Invalid GPIO numbers are useful for indicating no-such-GPIO in
35 * platform data and other tables.
36 */
37
25static inline int gpio_is_valid(int number) 38static inline int gpio_is_valid(int number)
26{ 39{
27 /* only some non-negative numbers are valid */
28 return ((unsigned)number) < ARCH_NR_GPIOS; 40 return ((unsigned)number) < ARCH_NR_GPIOS;
29} 41}
30 42
31struct device; 43struct device;
32struct seq_file; 44struct seq_file;
33struct module; 45struct module;
46struct device_node;
34 47
35/** 48/**
36 * struct gpio_chip - abstract a GPIO controller 49 * struct gpio_chip - abstract a GPIO controller
@@ -106,6 +119,17 @@ struct gpio_chip {
106 const char *const *names; 119 const char *const *names;
107 unsigned can_sleep:1; 120 unsigned can_sleep:1;
108 unsigned exported:1; 121 unsigned exported:1;
122
123#if defined(CONFIG_OF_GPIO)
124 /*
125 * If CONFIG_OF is enabled, then all GPIO controllers described in the
126 * device tree automatically may have an OF translation
127 */
128 struct device_node *of_node;
129 int of_gpio_n_cells;
130 int (*of_xlate)(struct gpio_chip *gc, struct device_node *np,
131 const void *gpio_spec, u32 *flags);
132#endif
109}; 133};
110 134
111extern const char *gpiochip_is_requested(struct gpio_chip *chip, 135extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -115,6 +139,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
115/* add/remove chips */ 139/* add/remove chips */
116extern int gpiochip_add(struct gpio_chip *chip); 140extern int gpiochip_add(struct gpio_chip *chip);
117extern int __must_check gpiochip_remove(struct gpio_chip *chip); 141extern int __must_check gpiochip_remove(struct gpio_chip *chip);
142extern struct gpio_chip *gpiochip_find(void *data,
143 int (*match)(struct gpio_chip *chip,
144 void *data));
118 145
119 146
120/* Always use the library code for GPIO management calls, 147/* Always use the library code for GPIO management calls,
@@ -183,7 +210,7 @@ extern void gpio_unexport(unsigned gpio);
183 210
184#endif /* CONFIG_GPIO_SYSFS */ 211#endif /* CONFIG_GPIO_SYSFS */
185 212
186#else /* !CONFIG_HAVE_GPIO_LIB */ 213#else /* !CONFIG_GPIOLIB */
187 214
188static inline int gpio_is_valid(int number) 215static inline int gpio_is_valid(int number)
189{ 216{
@@ -212,7 +239,7 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
212 gpio_set_value(gpio, value); 239 gpio_set_value(gpio, value);
213} 240}
214 241
215#endif /* !CONFIG_HAVE_GPIO_LIB */ 242#endif /* !CONFIG_GPIOLIB */
216 243
217#ifndef CONFIG_GPIO_SYSFS 244#ifndef CONFIG_GPIO_SYSFS
218 245
diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h
index 62f59080e5cc..04d0a977cd43 100644
--- a/include/asm-generic/hardirq.h
+++ b/include/asm-generic/hardirq.h
@@ -3,13 +3,13 @@
3 3
4#include <linux/cache.h> 4#include <linux/cache.h>
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/irq.h>
7 6
8typedef struct { 7typedef struct {
9 unsigned int __softirq_pending; 8 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t; 9} ____cacheline_aligned irq_cpustat_t;
11 10
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 11#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
12#include <linux/irq.h>
13 13
14#ifndef ack_bad_irq 14#ifndef ack_bad_irq
15static inline void ack_bad_irq(unsigned int irq) 15static inline void ack_bad_irq(unsigned int irq)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index bcee6365dca0..3577ca11a0be 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -19,7 +19,9 @@
19#include <asm-generic/iomap.h> 19#include <asm-generic/iomap.h>
20#endif 20#endif
21 21
22#ifndef mmiowb
22#define mmiowb() do {} while (0) 23#define mmiowb() do {} while (0)
24#endif
23 25
24/*****************************************************************************/ 26/*****************************************************************************/
25/* 27/*
@@ -28,39 +30,51 @@
28 * differently. On the simple architectures, we just read/write the 30 * differently. On the simple architectures, we just read/write the
29 * memory location directly. 31 * memory location directly.
30 */ 32 */
33#ifndef __raw_readb
31static inline u8 __raw_readb(const volatile void __iomem *addr) 34static inline u8 __raw_readb(const volatile void __iomem *addr)
32{ 35{
33 return *(const volatile u8 __force *) addr; 36 return *(const volatile u8 __force *) addr;
34} 37}
38#endif
35 39
40#ifndef __raw_readw
36static inline u16 __raw_readw(const volatile void __iomem *addr) 41static inline u16 __raw_readw(const volatile void __iomem *addr)
37{ 42{
38 return *(const volatile u16 __force *) addr; 43 return *(const volatile u16 __force *) addr;
39} 44}
45#endif
40 46
47#ifndef __raw_readl
41static inline u32 __raw_readl(const volatile void __iomem *addr) 48static inline u32 __raw_readl(const volatile void __iomem *addr)
42{ 49{
43 return *(const volatile u32 __force *) addr; 50 return *(const volatile u32 __force *) addr;
44} 51}
52#endif
45 53
46#define readb __raw_readb 54#define readb __raw_readb
47#define readw(addr) __le16_to_cpu(__raw_readw(addr)) 55#define readw(addr) __le16_to_cpu(__raw_readw(addr))
48#define readl(addr) __le32_to_cpu(__raw_readl(addr)) 56#define readl(addr) __le32_to_cpu(__raw_readl(addr))
49 57
58#ifndef __raw_writeb
50static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 59static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
51{ 60{
52 *(volatile u8 __force *) addr = b; 61 *(volatile u8 __force *) addr = b;
53} 62}
63#endif
54 64
65#ifndef __raw_writew
55static inline void __raw_writew(u16 b, volatile void __iomem *addr) 66static inline void __raw_writew(u16 b, volatile void __iomem *addr)
56{ 67{
57 *(volatile u16 __force *) addr = b; 68 *(volatile u16 __force *) addr = b;
58} 69}
70#endif
59 71
72#ifndef __raw_writel
60static inline void __raw_writel(u32 b, volatile void __iomem *addr) 73static inline void __raw_writel(u32 b, volatile void __iomem *addr)
61{ 74{
62 *(volatile u32 __force *) addr = b; 75 *(volatile u32 __force *) addr = b;
63} 76}
77#endif
64 78
65#define writeb __raw_writeb 79#define writeb __raw_writeb
66#define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) 80#define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr)
@@ -122,6 +136,7 @@ static inline void outl(u32 b, unsigned long addr)
122#define outw_p(x, addr) outw((x), (addr)) 136#define outw_p(x, addr) outw((x), (addr))
123#define outl_p(x, addr) outl((x), (addr)) 137#define outl_p(x, addr) outl((x), (addr))
124 138
139#ifndef insb
125static inline void insb(unsigned long addr, void *buffer, int count) 140static inline void insb(unsigned long addr, void *buffer, int count)
126{ 141{
127 if (count) { 142 if (count) {
@@ -132,7 +147,9 @@ static inline void insb(unsigned long addr, void *buffer, int count)
132 } while (--count); 147 } while (--count);
133 } 148 }
134} 149}
150#endif
135 151
152#ifndef insw
136static inline void insw(unsigned long addr, void *buffer, int count) 153static inline void insw(unsigned long addr, void *buffer, int count)
137{ 154{
138 if (count) { 155 if (count) {
@@ -143,7 +160,9 @@ static inline void insw(unsigned long addr, void *buffer, int count)
143 } while (--count); 160 } while (--count);
144 } 161 }
145} 162}
163#endif
146 164
165#ifndef insl
147static inline void insl(unsigned long addr, void *buffer, int count) 166static inline void insl(unsigned long addr, void *buffer, int count)
148{ 167{
149 if (count) { 168 if (count) {
@@ -154,7 +173,9 @@ static inline void insl(unsigned long addr, void *buffer, int count)
154 } while (--count); 173 } while (--count);
155 } 174 }
156} 175}
176#endif
157 177
178#ifndef outsb
158static inline void outsb(unsigned long addr, const void *buffer, int count) 179static inline void outsb(unsigned long addr, const void *buffer, int count)
159{ 180{
160 if (count) { 181 if (count) {
@@ -164,7 +185,9 @@ static inline void outsb(unsigned long addr, const void *buffer, int count)
164 } while (--count); 185 } while (--count);
165 } 186 }
166} 187}
188#endif
167 189
190#ifndef outsw
168static inline void outsw(unsigned long addr, const void *buffer, int count) 191static inline void outsw(unsigned long addr, const void *buffer, int count)
169{ 192{
170 if (count) { 193 if (count) {
@@ -174,7 +197,9 @@ static inline void outsw(unsigned long addr, const void *buffer, int count)
174 } while (--count); 197 } while (--count);
175 } 198 }
176} 199}
200#endif
177 201
202#ifndef outsl
178static inline void outsl(unsigned long addr, const void *buffer, int count) 203static inline void outsl(unsigned long addr, const void *buffer, int count)
179{ 204{
180 if (count) { 205 if (count) {
@@ -184,15 +209,20 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
184 } while (--count); 209 } while (--count);
185 } 210 }
186} 211}
212#endif
187 213
188#ifndef CONFIG_GENERIC_IOMAP 214#ifndef CONFIG_GENERIC_IOMAP
189#define ioread8(addr) readb(addr) 215#define ioread8(addr) readb(addr)
190#define ioread16(addr) readw(addr) 216#define ioread16(addr) readw(addr)
217#define ioread16be(addr) be16_to_cpu(ioread16(addr))
191#define ioread32(addr) readl(addr) 218#define ioread32(addr) readl(addr)
219#define ioread32be(addr) be32_to_cpu(ioread32(addr))
192 220
193#define iowrite8(v, addr) writeb((v), (addr)) 221#define iowrite8(v, addr) writeb((v), (addr))
194#define iowrite16(v, addr) writew((v), (addr)) 222#define iowrite16(v, addr) writew((v), (addr))
223#define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr))
195#define iowrite32(v, addr) writel((v), (addr)) 224#define iowrite32(v, addr) writel((v), (addr))
225#define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr))
196 226
197#define ioread8_rep(p, dst, count) \ 227#define ioread8_rep(p, dst, count) \
198 insb((unsigned long) (p), (dst), (count)) 228 insb((unsigned long) (p), (dst), (count))
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a799e20a769e..a3216655d657 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -62,13 +62,16 @@
62#define TCSETSW2 _IOW('T', 0x2C, struct termios2) 62#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
63#define TCSETSF2 _IOW('T', 0x2D, struct termios2) 63#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
64#define TIOCGRS485 0x542E 64#define TIOCGRS485 0x542E
65#ifndef TIOCSRS485
65#define TIOCSRS485 0x542F 66#define TIOCSRS485 0x542F
67#endif
66#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 68#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
67#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ 69#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
68#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ 70#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
69#define TCSETX 0x5433 71#define TCSETX 0x5433
70#define TCSETXF 0x5434 72#define TCSETXF 0x5434
71#define TCSETXW 0x5435 73#define TCSETXW 0x5435
74#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
72 75
73#define FIONCLEX 0x5450 76#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451 77#define FIOCLEX 0x5451
@@ -87,12 +90,10 @@
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 90#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88 91
89/* 92/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for 93 * Some arches already define FIOQSIZE due to a historical
91 * TIOCGHAYESESP on others 94 * conflict with a Hayes modem-specific ioctl value.
92 */ 95 */
93#ifndef FIOQSIZE 96#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460 97# define FIOQSIZE 0x5460
97#endif 98#endif
98 99
@@ -104,6 +105,7 @@
104#define TIOCPKT_START 8 105#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16 106#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32 107#define TIOCPKT_DOSTOP 32
108#define TIOCPKT_IOCTL 64
107 109
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 110#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109 111
diff --git a/include/asm-generic/irqflags.h b/include/asm-generic/irqflags.h
index 9aebf618275a..1f40d0024cf3 100644
--- a/include/asm-generic/irqflags.h
+++ b/include/asm-generic/irqflags.h
@@ -5,68 +5,62 @@
5 * All architectures should implement at least the first two functions, 5 * All architectures should implement at least the first two functions,
6 * usually inline assembly will be the best way. 6 * usually inline assembly will be the best way.
7 */ 7 */
8#ifndef RAW_IRQ_DISABLED 8#ifndef ARCH_IRQ_DISABLED
9#define RAW_IRQ_DISABLED 0 9#define ARCH_IRQ_DISABLED 0
10#define RAW_IRQ_ENABLED 1 10#define ARCH_IRQ_ENABLED 1
11#endif 11#endif
12 12
13/* read interrupt enabled status */ 13/* read interrupt enabled status */
14#ifndef __raw_local_save_flags 14#ifndef arch_local_save_flags
15unsigned long __raw_local_save_flags(void); 15unsigned long arch_local_save_flags(void);
16#endif 16#endif
17 17
18/* set interrupt enabled status */ 18/* set interrupt enabled status */
19#ifndef raw_local_irq_restore 19#ifndef arch_local_irq_restore
20void raw_local_irq_restore(unsigned long flags); 20void arch_local_irq_restore(unsigned long flags);
21#endif 21#endif
22 22
23/* get status and disable interrupts */ 23/* get status and disable interrupts */
24#ifndef __raw_local_irq_save 24#ifndef arch_local_irq_save
25static inline unsigned long __raw_local_irq_save(void) 25static inline unsigned long arch_local_irq_save(void)
26{ 26{
27 unsigned long flags; 27 unsigned long flags;
28 flags = __raw_local_save_flags(); 28 flags = arch_local_save_flags();
29 raw_local_irq_restore(RAW_IRQ_DISABLED); 29 arch_local_irq_restore(ARCH_IRQ_DISABLED);
30 return flags; 30 return flags;
31} 31}
32#endif 32#endif
33 33
34/* test flags */ 34/* test flags */
35#ifndef raw_irqs_disabled_flags 35#ifndef arch_irqs_disabled_flags
36static inline int raw_irqs_disabled_flags(unsigned long flags) 36static inline int arch_irqs_disabled_flags(unsigned long flags)
37{ 37{
38 return flags == RAW_IRQ_DISABLED; 38 return flags == ARCH_IRQ_DISABLED;
39} 39}
40#endif 40#endif
41 41
42/* unconditionally enable interrupts */ 42/* unconditionally enable interrupts */
43#ifndef raw_local_irq_enable 43#ifndef arch_local_irq_enable
44static inline void raw_local_irq_enable(void) 44static inline void arch_local_irq_enable(void)
45{ 45{
46 raw_local_irq_restore(RAW_IRQ_ENABLED); 46 arch_local_irq_restore(ARCH_IRQ_ENABLED);
47} 47}
48#endif 48#endif
49 49
50/* unconditionally disable interrupts */ 50/* unconditionally disable interrupts */
51#ifndef raw_local_irq_disable 51#ifndef arch_local_irq_disable
52static inline void raw_local_irq_disable(void) 52static inline void arch_local_irq_disable(void)
53{ 53{
54 raw_local_irq_restore(RAW_IRQ_DISABLED); 54 arch_local_irq_restore(ARCH_IRQ_DISABLED);
55} 55}
56#endif 56#endif
57 57
58/* test hardware interrupt enable bit */ 58/* test hardware interrupt enable bit */
59#ifndef raw_irqs_disabled 59#ifndef arch_irqs_disabled
60static inline int raw_irqs_disabled(void) 60static inline int arch_irqs_disabled(void)
61{ 61{
62 return raw_irqs_disabled_flags(__raw_local_save_flags()); 62 return arch_irqs_disabled_flags(arch_local_save_flags());
63} 63}
64#endif 64#endif
65 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 */ 66#endif /* __ASM_GENERIC_IRQFLAGS_H */
diff --git a/include/asm-generic/kdebug.h b/include/asm-generic/kdebug.h
index 11e57b6a85fc..d1814497bcdb 100644
--- a/include/asm-generic/kdebug.h
+++ b/include/asm-generic/kdebug.h
@@ -3,7 +3,7 @@
3 3
4enum die_val { 4enum die_val {
5 DIE_UNUSED, 5 DIE_UNUSED,
6 DIE_OOPS=1 6 DIE_OOPS = 1,
7}; 7};
8 8
9#endif /* _ASM_GENERIC_KDEBUG_H */ 9#endif /* _ASM_GENERIC_KDEBUG_H */
diff --git a/include/asm-generic/local64.h b/include/asm-generic/local64.h
new file mode 100644
index 000000000000..02ac760c1a8b
--- /dev/null
+++ b/include/asm-generic/local64.h
@@ -0,0 +1,96 @@
1#ifndef _ASM_GENERIC_LOCAL64_H
2#define _ASM_GENERIC_LOCAL64_H
3
4#include <linux/percpu.h>
5#include <asm/types.h>
6
7/*
8 * A signed long type for operations which are atomic for a single CPU.
9 * Usually used in combination with per-cpu variables.
10 *
11 * This is the default implementation, which uses atomic64_t. Which is
12 * rather pointless. The whole point behind local64_t is that some processors
13 * can perform atomic adds and subtracts in a manner which is atomic wrt IRQs
14 * running on this CPU. local64_t allows exploitation of such capabilities.
15 */
16
17/* Implement in terms of atomics. */
18
19#if BITS_PER_LONG == 64
20
21#include <asm/local.h>
22
23typedef struct {
24 local_t a;
25} local64_t;
26
27#define LOCAL64_INIT(i) { LOCAL_INIT(i) }
28
29#define local64_read(l) local_read(&(l)->a)
30#define local64_set(l,i) local_set((&(l)->a),(i))
31#define local64_inc(l) local_inc(&(l)->a)
32#define local64_dec(l) local_dec(&(l)->a)
33#define local64_add(i,l) local_add((i),(&(l)->a))
34#define local64_sub(i,l) local_sub((i),(&(l)->a))
35
36#define local64_sub_and_test(i, l) local_sub_and_test((i), (&(l)->a))
37#define local64_dec_and_test(l) local_dec_and_test(&(l)->a)
38#define local64_inc_and_test(l) local_inc_and_test(&(l)->a)
39#define local64_add_negative(i, l) local_add_negative((i), (&(l)->a))
40#define local64_add_return(i, l) local_add_return((i), (&(l)->a))
41#define local64_sub_return(i, l) local_sub_return((i), (&(l)->a))
42#define local64_inc_return(l) local_inc_return(&(l)->a)
43
44#define local64_cmpxchg(l, o, n) local_cmpxchg((&(l)->a), (o), (n))
45#define local64_xchg(l, n) local_xchg((&(l)->a), (n))
46#define local64_add_unless(l, _a, u) local_add_unless((&(l)->a), (_a), (u))
47#define local64_inc_not_zero(l) local_inc_not_zero(&(l)->a)
48
49/* Non-atomic variants, ie. preemption disabled and won't be touched
50 * in interrupt, etc. Some archs can optimize this case well. */
51#define __local64_inc(l) local64_set((l), local64_read(l) + 1)
52#define __local64_dec(l) local64_set((l), local64_read(l) - 1)
53#define __local64_add(i,l) local64_set((l), local64_read(l) + (i))
54#define __local64_sub(i,l) local64_set((l), local64_read(l) - (i))
55
56#else /* BITS_PER_LONG != 64 */
57
58#include <asm/atomic.h>
59
60/* Don't use typedef: don't want them to be mixed with atomic_t's. */
61typedef struct {
62 atomic64_t a;
63} local64_t;
64
65#define LOCAL64_INIT(i) { ATOMIC_LONG_INIT(i) }
66
67#define local64_read(l) atomic64_read(&(l)->a)
68#define local64_set(l,i) atomic64_set((&(l)->a),(i))
69#define local64_inc(l) atomic64_inc(&(l)->a)
70#define local64_dec(l) atomic64_dec(&(l)->a)
71#define local64_add(i,l) atomic64_add((i),(&(l)->a))
72#define local64_sub(i,l) atomic64_sub((i),(&(l)->a))
73
74#define local64_sub_and_test(i, l) atomic64_sub_and_test((i), (&(l)->a))
75#define local64_dec_and_test(l) atomic64_dec_and_test(&(l)->a)
76#define local64_inc_and_test(l) atomic64_inc_and_test(&(l)->a)
77#define local64_add_negative(i, l) atomic64_add_negative((i), (&(l)->a))
78#define local64_add_return(i, l) atomic64_add_return((i), (&(l)->a))
79#define local64_sub_return(i, l) atomic64_sub_return((i), (&(l)->a))
80#define local64_inc_return(l) atomic64_inc_return(&(l)->a)
81
82#define local64_cmpxchg(l, o, n) atomic64_cmpxchg((&(l)->a), (o), (n))
83#define local64_xchg(l, n) atomic64_xchg((&(l)->a), (n))
84#define local64_add_unless(l, _a, u) atomic64_add_unless((&(l)->a), (_a), (u))
85#define local64_inc_not_zero(l) atomic64_inc_not_zero(&(l)->a)
86
87/* Non-atomic variants, ie. preemption disabled and won't be touched
88 * in interrupt, etc. Some archs can optimize this case well. */
89#define __local64_inc(l) local64_set((l), local64_read(l) + 1)
90#define __local64_dec(l) local64_set((l), local64_read(l) - 1)
91#define __local64_add(i,l) local64_set((l), local64_read(l) + (i))
92#define __local64_sub(i,l) local64_set((l), local64_read(l) - (i))
93
94#endif /* BITS_PER_LONG != 64 */
95
96#endif /* _ASM_GENERIC_LOCAL64_H */
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index b5043a9890d8..d17784ea37ff 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -55,14 +55,18 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
55 */ 55 */
56#define per_cpu(var, cpu) \ 56#define per_cpu(var, cpu) \
57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) 57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
58#define __get_cpu_var(var) \
59 (*SHIFT_PERCPU_PTR(&(var), my_cpu_offset))
60#define __raw_get_cpu_var(var) \
61 (*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset))
62 58
63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 59#ifndef __this_cpu_ptr
64#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) 60#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
61#endif
62#ifdef CONFIG_DEBUG_PREEMPT
63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset)
64#else
65#define this_cpu_ptr(ptr) __this_cpu_ptr(ptr)
66#endif
65 67
68#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
69#define __raw_get_cpu_var(var) (*__this_cpu_ptr(&(var)))
66 70
67#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 71#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
68extern void setup_per_cpu_areas(void); 72extern void setup_per_cpu_areas(void);
@@ -70,11 +74,16 @@ extern void setup_per_cpu_areas(void);
70 74
71#else /* ! SMP */ 75#else /* ! SMP */
72 76
73#define per_cpu(var, cpu) (*((void)(cpu), &(var))) 77#define VERIFY_PERCPU_PTR(__p) ({ \
74#define __get_cpu_var(var) (var) 78 __verify_pcpu_ptr((__p)); \
75#define __raw_get_cpu_var(var) (var) 79 (typeof(*(__p)) __kernel __force *)(__p); \
76#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 80})
77#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) 81
82#define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var))))
83#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
84#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
85#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
86#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr)
78 87
79#endif /* SMP */ 88#endif /* SMP */
80 89
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index e2bd73e8f9c0..6f3c6ae4fe03 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -108,7 +108,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
108#endif 108#endif
109 109
110#ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY 110#ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY
111#define page_clear_dirty(page) do { } while (0) 111#define page_clear_dirty(page, mapped) do { } while (0)
112#endif 112#endif
113 113
114#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY 114#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
129#define move_pte(pte, prot, old_addr, new_addr) (pte) 129#define move_pte(pte, prot, old_addr, new_addr) (pte)
130#endif 130#endif
131 131
132#ifndef flush_tlb_fix_spurious_fault
133#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
134#endif
135
132#ifndef pgprot_noncached 136#ifndef pgprot_noncached
133#define pgprot_noncached(prot) (prot) 137#define pgprot_noncached(prot) (prot)
134#endif 138#endif
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 3b4fb3e52f0d..0fd28e028de1 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -33,7 +33,8 @@ struct statfs {
33 __kernel_fsid_t f_fsid; 33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen; 34 __statfs_word f_namelen;
35 __statfs_word f_frsize; 35 __statfs_word f_frsize;
36 __statfs_word f_spare[5]; 36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
37}; 38};
38 39
39/* 40/*
@@ -55,7 +56,8 @@ struct statfs64 {
55 __kernel_fsid_t f_fsid; 56 __kernel_fsid_t f_fsid;
56 __statfs_word f_namelen; 57 __statfs_word f_namelen;
57 __statfs_word f_frsize; 58 __statfs_word f_frsize;
58 __statfs_word f_spare[5]; 59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
59} ARCH_PACK_STATFS64; 61} ARCH_PACK_STATFS64;
60 62
61/* 63/*
@@ -77,7 +79,8 @@ struct compat_statfs64 {
77 __kernel_fsid_t f_fsid; 79 __kernel_fsid_t f_fsid;
78 __u32 f_namelen; 80 __u32 f_namelen;
79 __u32 f_frsize; 81 __u32 f_frsize;
80 __u32 f_spare[5]; 82 __u32 f_flags;
83 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64; 84} ARCH_PACK_COMPAT_STATFS64;
82 85
83#endif 86#endif
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index df84e3b04555..d89dec864d42 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -23,8 +23,10 @@ asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif 23#endif
24 24
25#ifndef sys_execve 25#ifndef sys_execve
26asmlinkage long sys_execve(char __user *filename, char __user * __user *argv, 26asmlinkage long sys_execve(const char __user *filename,
27 char __user * __user *envp, struct pt_regs *regs); 27 const char __user *const __user *argv,
28 const char __user *const __user *envp,
29 struct pt_regs *regs);
28#endif 30#endif
29 31
30#ifndef sys_mmap2 32#ifndef sys_mmap2
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index efa403b5e121..4b0b9cbbfae5 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -21,6 +21,7 @@
21#include <linux/irqflags.h> 21#include <linux/irqflags.h>
22 22
23#include <asm/cmpxchg-local.h> 23#include <asm/cmpxchg-local.h>
24#include <asm/cmpxchg.h>
24 25
25struct task_struct; 26struct task_struct;
26 27
@@ -136,25 +137,6 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
136#define xchg(ptr, x) \ 137#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) 138 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138 139
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__ */ 140#endif /* !__ASSEMBLY__ */
159 141
160#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
index 1c9773d48cb0..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/asm-generic/termbits.h
@@ -178,6 +178,7 @@ struct ktermios {
178#define FLUSHO 0010000 178#define FLUSHO 0010000
179#define PENDIN 0040000 179#define PENDIN 0040000
180#define IEXTEN 0100000 180#define IEXTEN 0100000
181#define EXTPROC 0200000
181 182
182/* tcflow() and TCXONC use these */ 183/* tcflow() and TCXONC use these */
183#define TCOOFF 0 184#define TCOOFF 0
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index fd60700503c8..fc824e2828f3 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2002, IBM Corp. 6 * Copyright (C) 2002, IBM Corp.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -34,9 +34,16 @@
34#ifndef cpu_to_node 34#ifndef cpu_to_node
35#define cpu_to_node(cpu) ((void)(cpu),0) 35#define cpu_to_node(cpu) ((void)(cpu),0)
36#endif 36#endif
37#ifndef set_numa_node
38#define set_numa_node(node)
39#endif
40#ifndef set_cpu_numa_node
41#define set_cpu_numa_node(cpu, node)
42#endif
37#ifndef cpu_to_mem 43#ifndef cpu_to_mem
38#define cpu_to_mem(cpu) ((void)(cpu),0) 44#define cpu_to_mem(cpu) ((void)(cpu),0)
39#endif 45#endif
46
40#ifndef parent_node 47#ifndef parent_node
41#define parent_node(node) ((void)(node),0) 48#define parent_node(node) ((void)(node),0)
42#endif 49#endif
@@ -55,4 +62,15 @@
55 62
56#endif /* CONFIG_NUMA */ 63#endif /* CONFIG_NUMA */
57 64
65#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES)
66
67#ifndef set_numa_mem
68#define set_numa_mem(node)
69#endif
70#ifndef set_cpu_numa_mem
71#define set_cpu_numa_mem(cpu, node)
72#endif
73
74#endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */
75
58#endif /* _ASM_GENERIC_TOPOLOGY_H */ 76#endif /* _ASM_GENERIC_TOPOLOGY_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 6a0b30f78a62..b969770196c2 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -18,7 +18,7 @@
18#define __SYSCALL(x, y) 18#define __SYSCALL(x, y)
19#endif 19#endif
20 20
21#if __BITS_PER_LONG == 32 21#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) 22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
23#else 23#else
24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) 24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
@@ -241,8 +241,13 @@ __SYSCALL(__NR_sync, sys_sync)
241__SYSCALL(__NR_fsync, sys_fsync) 241__SYSCALL(__NR_fsync, sys_fsync)
242#define __NR_fdatasync 83 242#define __NR_fdatasync 83
243__SYSCALL(__NR_fdatasync, sys_fdatasync) 243__SYSCALL(__NR_fdatasync, sys_fdatasync)
244#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
245#define __NR_sync_file_range2 84
246__SYSCALL(__NR_sync_file_range2, sys_sync_file_range2)
247#else
244#define __NR_sync_file_range 84 248#define __NR_sync_file_range 84
245__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */ 249__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
250#endif
246 251
247/* fs/timerfd.c */ 252/* fs/timerfd.c */
248#define __NR_timerfd_create 85 253#define __NR_timerfd_create 85
@@ -580,7 +585,7 @@ __SYSCALL(__NR_execve, sys_execve) /* .long sys_execve_wrapper */
580__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) 585__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
581/* mm/fadvise.c */ 586/* mm/fadvise.c */
582#define __NR3264_fadvise64 223 587#define __NR3264_fadvise64 223
583__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64) 588__SYSCALL(__NR3264_fadvise64, sys_fadvise64_64)
584 589
585/* mm/, CONFIG_MMU only */ 590/* mm/, CONFIG_MMU only */
586#ifndef __ARCH_NOMMU 591#ifndef __ARCH_NOMMU
@@ -627,8 +632,23 @@ __SYSCALL(__NR_accept4, sys_accept4)
627#define __NR_recvmmsg 243 632#define __NR_recvmmsg 243
628__SYSCALL(__NR_recvmmsg, sys_recvmmsg) 633__SYSCALL(__NR_recvmmsg, sys_recvmmsg)
629 634
635/*
636 * Architectures may provide up to 16 syscalls of their own
637 * starting with this value.
638 */
639#define __NR_arch_specific_syscall 244
640
641#define __NR_wait4 260
642__SYSCALL(__NR_wait4, sys_wait4)
643#define __NR_prlimit64 261
644__SYSCALL(__NR_prlimit64, sys_prlimit64)
645#define __NR_fanotify_init 262
646__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
647#define __NR_fanotify_mark 263
648__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
649
630#undef __NR_syscalls 650#undef __NR_syscalls
631#define __NR_syscalls 244 651#define __NR_syscalls 264
632 652
633/* 653/*
634 * All syscalls below here should go away really, 654 * All syscalls below here should go away really,
@@ -694,7 +714,8 @@ __SYSCALL(__NR_signalfd, sys_signalfd)
694#define __NR_syscalls (__NR_signalfd+1) 714#define __NR_syscalls (__NR_signalfd+1)
695#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 715#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
696 716
697#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T) 717#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
718 defined(__ARCH_WANT_SYSCALL_OFF_T)
698#define __NR_sendfile 1046 719#define __NR_sendfile 1046
699__SYSCALL(__NR_sendfile, sys_sendfile) 720__SYSCALL(__NR_sendfile, sys_sendfile)
700#define __NR_ftruncate 1047 721#define __NR_ftruncate 1047
@@ -740,6 +761,7 @@ __SYSCALL(__NR_getpgrp, sys_getpgrp)
740__SYSCALL(__NR_pause, sys_pause) 761__SYSCALL(__NR_pause, sys_pause)
741#define __NR_time 1062 762#define __NR_time 1062
742#define __ARCH_WANT_SYS_TIME 763#define __ARCH_WANT_SYS_TIME
764#define __ARCH_WANT_COMPAT_SYS_TIME
743__SYSCALL(__NR_time, sys_time) 765__SYSCALL(__NR_time, sys_time)
744#define __NR_utime 1063 766#define __NR_utime 1063
745#define __ARCH_WANT_SYS_UTIME 767#define __ARCH_WANT_SYS_UTIME
@@ -763,8 +785,8 @@ __SYSCALL(__NR_epoll_wait, sys_epoll_wait)
763__SYSCALL(__NR_ustat, sys_ustat) 785__SYSCALL(__NR_ustat, sys_ustat)
764#define __NR_vfork 1071 786#define __NR_vfork 1071
765__SYSCALL(__NR_vfork, sys_vfork) 787__SYSCALL(__NR_vfork, sys_vfork)
766#define __NR_wait4 1072 788#define __NR_oldwait4 1072
767__SYSCALL(__NR_wait4, sys_wait4) 789__SYSCALL(__NR_oldwait4, sys_wait4)
768#define __NR_recv 1073 790#define __NR_recv 1073
769__SYSCALL(__NR_recv, sys_recv) 791__SYSCALL(__NR_recv, sys_recv)
770#define __NR_send 1074 792#define __NR_send 1074
@@ -801,7 +823,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
801 * Here we map the numbers so that both versions 823 * Here we map the numbers so that both versions
802 * use the same syscall table layout. 824 * use the same syscall table layout.
803 */ 825 */
804#if __BITS_PER_LONG == 64 826#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
805#define __NR_fcntl __NR3264_fcntl 827#define __NR_fcntl __NR3264_fcntl
806#define __NR_statfs __NR3264_statfs 828#define __NR_statfs __NR3264_statfs
807#define __NR_fstatfs __NR3264_fstatfs 829#define __NR_fstatfs __NR3264_fstatfs
@@ -848,6 +870,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
848#endif 870#endif
849#define __ARCH_WANT_SYS_RT_SIGACTION 871#define __ARCH_WANT_SYS_RT_SIGACTION
850#define __ARCH_WANT_SYS_RT_SIGSUSPEND 872#define __ARCH_WANT_SYS_RT_SIGSUSPEND
873#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
851 874
852/* 875/*
853 * "Conditional" syscalls 876 * "Conditional" syscalls
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 0c6387d6a6ae..bd69d79208de 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -150,16 +150,13 @@
150#define DATA_DATA \ 150#define DATA_DATA \
151 *(.data) \ 151 *(.data) \
152 *(.ref.data) \ 152 *(.ref.data) \
153 *(.data..shared_aligned) /* percpu related */ \
153 DEV_KEEP(init.data) \ 154 DEV_KEEP(init.data) \
154 DEV_KEEP(exit.data) \ 155 DEV_KEEP(exit.data) \
155 CPU_KEEP(init.data) \ 156 CPU_KEEP(init.data) \
156 CPU_KEEP(exit.data) \ 157 CPU_KEEP(exit.data) \
157 MEM_KEEP(init.data) \ 158 MEM_KEEP(init.data) \
158 MEM_KEEP(exit.data) \ 159 MEM_KEEP(exit.data) \
159 . = ALIGN(8); \
160 VMLINUX_SYMBOL(__start___markers) = .; \
161 *(__markers) \
162 VMLINUX_SYMBOL(__stop___markers) = .; \
163 . = ALIGN(32); \ 160 . = ALIGN(32); \
164 VMLINUX_SYMBOL(__start___tracepoints) = .; \ 161 VMLINUX_SYMBOL(__start___tracepoints) = .; \
165 *(__tracepoints) \ 162 *(__tracepoints) \
@@ -224,6 +221,8 @@
224 \ 221 \
225 BUG_TABLE \ 222 BUG_TABLE \
226 \ 223 \
224 JUMP_TABLE \
225 \
227 /* PCI quirks */ \ 226 /* PCI quirks */ \
228 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ 227 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
229 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ 228 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
@@ -567,6 +566,14 @@
567#define BUG_TABLE 566#define BUG_TABLE
568#endif 567#endif
569 568
569#define JUMP_TABLE \
570 . = ALIGN(8); \
571 __jump_table : AT(ADDR(__jump_table) - LOAD_OFFSET) { \
572 VMLINUX_SYMBOL(__start___jump_table) = .; \
573 *(__jump_table) \
574 VMLINUX_SYMBOL(__stop___jump_table) = .; \
575 }
576
570#ifdef CONFIG_PM_TRACE 577#ifdef CONFIG_PM_TRACE
571#define TRACEDATA \ 578#define TRACEDATA \
572 . = ALIGN(4); \ 579 . = ALIGN(4); \
@@ -630,7 +637,7 @@
630 637
631#ifdef CONFIG_BLK_DEV_INITRD 638#ifdef CONFIG_BLK_DEV_INITRD
632#define INIT_RAM_FS \ 639#define INIT_RAM_FS \
633 . = ALIGN(PAGE_SIZE); \ 640 . = ALIGN(4); \
634 VMLINUX_SYMBOL(__initramfs_start) = .; \ 641 VMLINUX_SYMBOL(__initramfs_start) = .; \
635 *(.init.ramfs) \ 642 *(.init.ramfs) \
636 . = ALIGN(8); \ 643 . = ALIGN(8); \
@@ -654,6 +661,7 @@
654 EXIT_DATA \ 661 EXIT_DATA \
655 EXIT_CALL \ 662 EXIT_CALL \
656 *(.discard) \ 663 *(.discard) \
664 *(.discard.*) \
657 } 665 }
658 666
659/** 667/**
@@ -681,7 +689,9 @@
681 - LOAD_OFFSET) { \ 689 - LOAD_OFFSET) { \
682 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 690 VMLINUX_SYMBOL(__per_cpu_start) = .; \
683 *(.data..percpu..first) \ 691 *(.data..percpu..first) \
692 . = ALIGN(PAGE_SIZE); \
684 *(.data..percpu..page_aligned) \ 693 *(.data..percpu..page_aligned) \
694 *(.data..percpu..readmostly) \
685 *(.data..percpu) \ 695 *(.data..percpu) \
686 *(.data..percpu..shared_aligned) \ 696 *(.data..percpu..shared_aligned) \
687 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 697 VMLINUX_SYMBOL(__per_cpu_end) = .; \
@@ -707,7 +717,9 @@
707 VMLINUX_SYMBOL(__per_cpu_load) = .; \ 717 VMLINUX_SYMBOL(__per_cpu_load) = .; \
708 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 718 VMLINUX_SYMBOL(__per_cpu_start) = .; \
709 *(.data..percpu..first) \ 719 *(.data..percpu..first) \
720 . = ALIGN(PAGE_SIZE); \
710 *(.data..percpu..page_aligned) \ 721 *(.data..percpu..page_aligned) \
722 *(.data..percpu..readmostly) \
711 *(.data..percpu) \ 723 *(.data..percpu) \
712 *(.data..percpu..shared_aligned) \ 724 *(.data..percpu..shared_aligned) \
713 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 725 VMLINUX_SYMBOL(__per_cpu_end) = .; \