aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/asm-generic
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/Kbuild.asm46
-rw-r--r--include/asm-generic/atomic.h3
-rw-r--r--include/asm-generic/barrier.h50
-rw-r--r--include/asm-generic/bitops/atomic.h2
-rw-r--r--include/asm-generic/bitops/builtin-__ffs.h15
-rw-r--r--include/asm-generic/bitops/builtin-__fls.h15
-rw-r--r--include/asm-generic/bitops/builtin-ffs.h17
-rw-r--r--include/asm-generic/bitops/builtin-fls.h16
-rw-r--r--include/asm-generic/bitops/count_zeros.h57
-rw-r--r--include/asm-generic/bitops/le.h10
-rw-r--r--include/asm-generic/bitsperlong.h17
-rw-r--r--include/asm-generic/bug.h37
-rw-r--r--include/asm-generic/checksum.h4
-rw-r--r--include/asm-generic/clkdev.h28
-rw-r--r--include/asm-generic/cmpxchg.h88
-rw-r--r--include/asm-generic/cputime.h64
-rw-r--r--include/asm-generic/dma-coherent.h5
-rw-r--r--include/asm-generic/dma-contiguous.h28
-rw-r--r--include/asm-generic/dma-mapping-common.h70
-rw-r--r--include/asm-generic/exec.h19
-rw-r--r--include/asm-generic/getorder.h53
-rw-r--r--include/asm-generic/gpio.h83
-rw-r--r--include/asm-generic/int-l64.h26
-rw-r--r--include/asm-generic/int-ll64.h31
-rw-r--r--include/asm-generic/io-64-nonatomic-hi-lo.h28
-rw-r--r--include/asm-generic/io-64-nonatomic-lo-hi.h28
-rw-r--r--include/asm-generic/io.h68
-rw-r--r--include/asm-generic/ioctl.h95
-rw-r--r--include/asm-generic/iomap.h11
-rw-r--r--include/asm-generic/kmap_types.h34
-rw-r--r--include/asm-generic/kvm_para.h21
-rw-r--r--include/asm-generic/mmu.h6
-rw-r--r--include/asm-generic/module.h40
-rw-r--r--include/asm-generic/mutex-xchg.h11
-rw-r--r--include/asm-generic/page.h14
-rw-r--r--include/asm-generic/param.h20
-rw-r--r--include/asm-generic/parport.h4
-rw-r--r--include/asm-generic/pci-bridge.h12
-rw-r--r--include/asm-generic/pci.h24
-rw-r--r--include/asm-generic/pci_iomap.h35
-rw-r--r--include/asm-generic/pgtable.h303
-rw-r--r--include/asm-generic/resource.h66
-rw-r--r--include/asm-generic/rwsem.h132
-rw-r--r--include/asm-generic/siginfo.h269
-rw-r--r--include/asm-generic/signal.h119
-rw-r--r--include/asm-generic/sizes.h49
-rw-r--r--include/asm-generic/statfs.h81
-rw-r--r--include/asm-generic/switch_to.h30
-rw-r--r--include/asm-generic/syscall.h14
-rw-r--r--include/asm-generic/syscalls.h20
-rw-r--r--include/asm-generic/termios.h49
-rw-r--r--include/asm-generic/tlb.h28
-rw-r--r--include/asm-generic/tlbflush.h2
-rw-r--r--include/asm-generic/trace_clock.h16
-rw-r--r--include/asm-generic/uaccess.h7
-rw-r--r--include/asm-generic/unistd.h903
-rw-r--r--include/asm-generic/vmlinux.lds.h50
-rw-r--r--include/asm-generic/word-at-a-time.h52
-rw-r--r--include/asm-generic/xor.h4
59 files changed, 2032 insertions, 1397 deletions
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index d2ee86b4c09..c5d2e5dd871 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1 +1,45 @@
1include include/uapi/asm-generic/Kbuild.asm 1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
3header-y += kvm.h
4endif
5
6ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
7 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
8header-y += kvm_para.h
9endif
10
11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
13header-y += a.out.h
14endif
15
16header-y += auxvec.h
17header-y += bitsperlong.h
18header-y += byteorder.h
19header-y += errno.h
20header-y += fcntl.h
21header-y += ioctl.h
22header-y += ioctls.h
23header-y += ipcbuf.h
24header-y += mman.h
25header-y += msgbuf.h
26header-y += param.h
27header-y += poll.h
28header-y += posix_types.h
29header-y += ptrace.h
30header-y += resource.h
31header-y += sembuf.h
32header-y += setup.h
33header-y += shmbuf.h
34header-y += sigcontext.h
35header-y += siginfo.h
36header-y += signal.h
37header-y += socket.h
38header-y += sockios.h
39header-y += stat.h
40header-y += statfs.h
41header-y += swab.h
42header-y += termbits.h
43header-y += termios.h
44header-y += types.h
45header-y += unistd.h
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 1ced6413ea0..e37963c1df4 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -15,8 +15,6 @@
15#ifndef __ASM_GENERIC_ATOMIC_H 15#ifndef __ASM_GENERIC_ATOMIC_H
16#define __ASM_GENERIC_ATOMIC_H 16#define __ASM_GENERIC_ATOMIC_H
17 17
18#include <asm/cmpxchg.h>
19
20#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
21/* Force people to define core atomics */ 19/* Force people to define core atomics */
22# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ 20# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \
@@ -54,6 +52,7 @@
54#define atomic_set(v, i) (((v)->counter) = (i)) 52#define atomic_set(v, i) (((v)->counter) = (i))
55 53
56#include <linux/irqflags.h> 54#include <linux/irqflags.h>
55#include <asm/system.h>
57 56
58/** 57/**
59 * atomic_add_return - add integer to atomic variable 58 * atomic_add_return - add integer to atomic variable
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
deleted file mode 100644
index 639d7a4d033..00000000000
--- a/include/asm-generic/barrier.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* Generic barrier 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_BARRIER_H
15#define __ASM_GENERIC_BARRIER_H
16
17#ifndef __ASSEMBLY__
18
19#define nop() asm volatile ("nop")
20
21/*
22 * Force strict CPU ordering.
23 * And yes, this is required on UP too when we're talking
24 * to devices.
25 *
26 * This implementation only contains a compiler barrier.
27 */
28
29#define mb() asm volatile ("": : :"memory")
30#define rmb() mb()
31#define wmb() asm volatile ("": : :"memory")
32
33#ifdef CONFIG_SMP
34#define smp_mb() mb()
35#define smp_rmb() rmb()
36#define smp_wmb() wmb()
37#else
38#define smp_mb() barrier()
39#define smp_rmb() barrier()
40#define smp_wmb() barrier()
41#endif
42
43#define set_mb(var, value) do { var = value; mb(); } while (0)
44#define set_wmb(var, value) do { var = value; wmb(); } while (0)
45
46#define read_barrier_depends() do {} while (0)
47#define smp_read_barrier_depends() do {} while (0)
48
49#endif /* !__ASSEMBLY__ */
50#endif /* __ASM_GENERIC_BARRIER_H */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index 9ae6c34dc19..ecc44a8e2b4 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -2,7 +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 <linux/irqflags.h> 5#include <asm/system.h>
6 6
7#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
8#include <asm/spinlock.h> 8#include <asm/spinlock.h>
diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h
deleted file mode 100644
index 90041e3a41f..00000000000
--- a/include/asm-generic/bitops/builtin-__ffs.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
3
4/**
5 * __ffs - find first bit in word.
6 * @word: The word to search
7 *
8 * Undefined if no bit exists, so code should check against 0 first.
9 */
10static __always_inline unsigned long __ffs(unsigned long word)
11{
12 return __builtin_ctzl(word);
13}
14
15#endif
diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h
deleted file mode 100644
index 0248f386635..00000000000
--- a/include/asm-generic/bitops/builtin-__fls.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
3
4/**
5 * __fls - find last (most-significant) set bit in a long word
6 * @word: the word to search
7 *
8 * Undefined if no set bit exists, so code should check against 0 first.
9 */
10static __always_inline unsigned long __fls(unsigned long word)
11{
12 return (sizeof(word) * 8) - 1 - __builtin_clzl(word);
13}
14
15#endif
diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h
deleted file mode 100644
index 064825829e1..00000000000
--- a/include/asm-generic/bitops/builtin-ffs.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
3
4/**
5 * ffs - find first bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as
9 * the libc and compiler builtin ffs routines, therefore
10 * differs in spirit from the above ffz (man ffs).
11 */
12static __always_inline int ffs(int x)
13{
14 return __builtin_ffs(x);
15}
16
17#endif
diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h
deleted file mode 100644
index eda652d0ac7..00000000000
--- a/include/asm-generic/bitops/builtin-fls.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
3
4/**
5 * fls - find last (most-significant) bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as ffs.
9 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
10 */
11static __always_inline int fls(int x)
12{
13 return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
14}
15
16#endif
diff --git a/include/asm-generic/bitops/count_zeros.h b/include/asm-generic/bitops/count_zeros.h
deleted file mode 100644
index 97520d21fe6..00000000000
--- a/include/asm-generic/bitops/count_zeros.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/* Count leading and trailing zeros functions
2 *
3 * Copyright (C) 2012 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
12#ifndef _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
13#define _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
14
15#include <asm/bitops.h>
16
17/**
18 * count_leading_zeros - Count the number of zeros from the MSB back
19 * @x: The value
20 *
21 * Count the number of leading zeros from the MSB going towards the LSB in @x.
22 *
23 * If the MSB of @x is set, the result is 0.
24 * If only the LSB of @x is set, then the result is BITS_PER_LONG-1.
25 * If @x is 0 then the result is COUNT_LEADING_ZEROS_0.
26 */
27static inline int count_leading_zeros(unsigned long x)
28{
29 if (sizeof(x) == 4)
30 return BITS_PER_LONG - fls(x);
31 else
32 return BITS_PER_LONG - fls64(x);
33}
34
35#define COUNT_LEADING_ZEROS_0 BITS_PER_LONG
36
37/**
38 * count_trailing_zeros - Count the number of zeros from the LSB forwards
39 * @x: The value
40 *
41 * Count the number of trailing zeros from the LSB going towards the MSB in @x.
42 *
43 * If the LSB of @x is set, the result is 0.
44 * If only the MSB of @x is set, then the result is BITS_PER_LONG-1.
45 * If @x is 0 then the result is COUNT_TRAILING_ZEROS_0.
46 */
47static inline int count_trailing_zeros(unsigned long x)
48{
49#define COUNT_TRAILING_ZEROS_0 (-1)
50
51 if (sizeof(x) == 4)
52 return ffs(x);
53 else
54 return (x != 0) ? __ffs(x) : COUNT_TRAILING_ZEROS_0;
55}
56
57#endif /* _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 61731543c00..f95c663a6a4 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -54,16 +54,6 @@ static inline int test_bit_le(int nr, const void *addr)
54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr); 54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
55} 55}
56 56
57static inline void set_bit_le(int nr, void *addr)
58{
59 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
60}
61
62static inline void clear_bit_le(int nr, void *addr)
63{
64 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
65}
66
67static inline void __set_bit_le(int nr, void *addr) 57static inline void __set_bit_le(int nr, void *addr)
68{ 58{
69 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); 59 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index d1d70aa1902..4ae54e07de8 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -1,8 +1,18 @@
1#ifndef __ASM_GENERIC_BITS_PER_LONG 1#ifndef __ASM_GENERIC_BITS_PER_LONG
2#define __ASM_GENERIC_BITS_PER_LONG 2#define __ASM_GENERIC_BITS_PER_LONG
3 3
4#include <uapi/asm-generic/bitsperlong.h> 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
5 14
15#ifdef __KERNEL__
6 16
7#ifdef CONFIG_64BIT 17#ifdef CONFIG_64BIT
8#define BITS_PER_LONG 64 18#define BITS_PER_LONG 64
@@ -18,8 +28,5 @@
18#error Inconsistent word size. Check asm/bitsperlong.h 28#error Inconsistent word size. Check asm/bitsperlong.h
19#endif 29#endif
20 30
21#ifndef BITS_PER_LONG_LONG 31#endif /* __KERNEL__ */
22#define BITS_PER_LONG_LONG 64
23#endif
24
25#endif /* __ASM_GENERIC_BITS_PER_LONG */ 32#endif /* __ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 7d10f962aa1..dfb0ec666c9 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -3,18 +3,10 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6#ifdef CONFIG_GENERIC_BUG
7#define BUGFLAG_WARNING (1 << 0)
8#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
9#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
10#endif
11
12#ifndef __ASSEMBLY__
13#include <linux/kernel.h>
14
15#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
16 7
17#ifdef CONFIG_GENERIC_BUG 8#ifdef CONFIG_GENERIC_BUG
9#ifndef __ASSEMBLY__
18struct bug_entry { 10struct bug_entry {
19#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 11#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
20 unsigned long bug_addr; 12 unsigned long bug_addr;
@@ -31,6 +23,12 @@ struct bug_entry {
31#endif 23#endif
32 unsigned short flags; 24 unsigned short flags;
33}; 25};
26#endif /* __ASSEMBLY__ */
27
28#define BUGFLAG_WARNING (1 << 0)
29#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
30#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
31
34#endif /* CONFIG_GENERIC_BUG */ 32#endif /* CONFIG_GENERIC_BUG */
35 33
36/* 34/*
@@ -62,14 +60,15 @@ struct bug_entry {
62 * to provide better diagnostics. 60 * to provide better diagnostics.
63 */ 61 */
64#ifndef __WARN_TAINT 62#ifndef __WARN_TAINT
65extern __printf(3, 4) 63#ifndef __ASSEMBLY__
66void warn_slowpath_fmt(const char *file, const int line, 64extern void warn_slowpath_fmt(const char *file, const int line,
67 const char *fmt, ...); 65 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
68extern __printf(4, 5) 66extern void warn_slowpath_fmt_taint(const char *file, const int line,
69void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, 67 unsigned taint, const char *fmt, ...)
70 const char *fmt, ...); 68 __attribute__((format(printf, 4, 5)));
71extern void warn_slowpath_null(const char *file, const int line); 69extern void warn_slowpath_null(const char *file, const int line);
72#define WANT_WARN_ON_SLOWPATH 70#define WANT_WARN_ON_SLOWPATH
71#endif
73#define __WARN() warn_slowpath_null(__FILE__, __LINE__) 72#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
74#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) 73#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
75#define __WARN_printf_taint(taint, arg...) \ 74#define __WARN_printf_taint(taint, arg...) \
@@ -134,7 +133,7 @@ extern void warn_slowpath_null(const char *file, const int line);
134#endif 133#endif
135 134
136#define WARN_ON_ONCE(condition) ({ \ 135#define WARN_ON_ONCE(condition) ({ \
137 static bool __section(.data.unlikely) __warned; \ 136 static bool __warned; \
138 int __ret_warn_once = !!(condition); \ 137 int __ret_warn_once = !!(condition); \
139 \ 138 \
140 if (unlikely(__ret_warn_once)) \ 139 if (unlikely(__ret_warn_once)) \
@@ -144,7 +143,7 @@ extern void warn_slowpath_null(const char *file, const int line);
144}) 143})
145 144
146#define WARN_ONCE(condition, format...) ({ \ 145#define WARN_ONCE(condition, format...) ({ \
147 static bool __section(.data.unlikely) __warned; \ 146 static bool __warned; \
148 int __ret_warn_once = !!(condition); \ 147 int __ret_warn_once = !!(condition); \
149 \ 148 \
150 if (unlikely(__ret_warn_once)) \ 149 if (unlikely(__ret_warn_once)) \
@@ -154,7 +153,7 @@ extern void warn_slowpath_null(const char *file, const int line);
154}) 153})
155 154
156#define WARN_TAINT_ONCE(condition, taint, format...) ({ \ 155#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
157 static bool __section(.data.unlikely) __warned; \ 156 static bool __warned; \
158 int __ret_warn_once = !!(condition); \ 157 int __ret_warn_once = !!(condition); \
159 \ 158 \
160 if (unlikely(__ret_warn_once)) \ 159 if (unlikely(__ret_warn_once)) \
@@ -202,6 +201,4 @@ extern void warn_slowpath_null(const char *file, const int line);
202# define WARN_ON_SMP(x) ({0;}) 201# define WARN_ON_SMP(x) ({0;})
203#endif 202#endif
204 203
205#endif /* __ASSEMBLY__ */
206
207#endif 204#endif
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index c084767c88b..4647c762d97 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -33,10 +33,8 @@ extern __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
33extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, 33extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
34 int len, __wsum sum, int *csum_err); 34 int len, __wsum sum, int *csum_err);
35 35
36#ifndef csum_partial_copy_nocheck
37#define csum_partial_copy_nocheck(src, dst, len, sum) \ 36#define csum_partial_copy_nocheck(src, dst, len, sum) \
38 csum_partial_copy((src), (dst), (len), (sum)) 37 csum_partial_copy((src), (dst), (len), (sum))
39#endif
40 38
41/* 39/*
42 * This is a version of ip_compute_csum() optimized for IP headers, 40 * This is a version of ip_compute_csum() optimized for IP headers,
@@ -65,14 +63,12 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
65 unsigned short proto, __wsum sum); 63 unsigned short proto, __wsum sum);
66#endif 64#endif
67 65
68#ifndef csum_tcpudp_magic
69static inline __sum16 66static inline __sum16
70csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 67csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
71 unsigned short proto, __wsum sum) 68 unsigned short proto, __wsum sum)
72{ 69{
73 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 70 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
74} 71}
75#endif
76 72
77/* 73/*
78 * this routine is used for miscellaneous IP-like checksums, mainly 74 * this routine is used for miscellaneous IP-like checksums, mainly
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h
deleted file mode 100644
index 90a32a61dd2..00000000000
--- a/include/asm-generic/clkdev.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * include/asm-generic/clkdev.h
3 *
4 * Based on the ARM clkdev.h:
5 * Copyright (C) 2008 Russell King.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Helper for the clk API to assist looking up a struct clk.
12 */
13#ifndef __ASM_CLKDEV_H
14#define __ASM_CLKDEV_H
15
16#include <linux/slab.h>
17
18struct clk;
19
20static inline int __clk_get(struct clk *clk) { return 1; }
21static inline void __clk_put(struct clk *clk) { }
22
23static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
24{
25 return kzalloc(size, GFP_KERNEL);
26}
27
28#endif
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
index 14883026015..213ac6e8fe3 100644
--- a/include/asm-generic/cmpxchg.h
+++ b/include/asm-generic/cmpxchg.h
@@ -1,98 +1,22 @@
1/*
2 * Generic UP xchg and cmpxchg using interrupt disablement. Does not
3 * support SMP.
4 */
5
6#ifndef __ASM_GENERIC_CMPXCHG_H 1#ifndef __ASM_GENERIC_CMPXCHG_H
7#define __ASM_GENERIC_CMPXCHG_H 2#define __ASM_GENERIC_CMPXCHG_H
8 3
4/*
5 * Generic cmpxchg
6 *
7 * Uses the local cmpxchg. Does not support SMP.
8 */
9#ifdef CONFIG_SMP 9#ifdef CONFIG_SMP
10#error "Cannot use generic cmpxchg on SMP" 10#error "Cannot use generic cmpxchg on SMP"
11#endif 11#endif
12 12
13#include <linux/types.h>
14#include <linux/irqflags.h>
15
16#ifndef xchg
17
18/*
19 * This function doesn't exist, so you'll get a linker error if
20 * something tries to do an invalidly-sized xchg().
21 */
22extern void __xchg_called_with_bad_pointer(void);
23
24static inline
25unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
26{
27 unsigned long ret, flags;
28
29 switch (size) {
30 case 1:
31#ifdef __xchg_u8
32 return __xchg_u8(x, ptr);
33#else
34 local_irq_save(flags);
35 ret = *(volatile u8 *)ptr;
36 *(volatile u8 *)ptr = x;
37 local_irq_restore(flags);
38 return ret;
39#endif /* __xchg_u8 */
40
41 case 2:
42#ifdef __xchg_u16
43 return __xchg_u16(x, ptr);
44#else
45 local_irq_save(flags);
46 ret = *(volatile u16 *)ptr;
47 *(volatile u16 *)ptr = x;
48 local_irq_restore(flags);
49 return ret;
50#endif /* __xchg_u16 */
51
52 case 4:
53#ifdef __xchg_u32
54 return __xchg_u32(x, ptr);
55#else
56 local_irq_save(flags);
57 ret = *(volatile u32 *)ptr;
58 *(volatile u32 *)ptr = x;
59 local_irq_restore(flags);
60 return ret;
61#endif /* __xchg_u32 */
62
63#ifdef CONFIG_64BIT
64 case 8:
65#ifdef __xchg_u64
66 return __xchg_u64(x, ptr);
67#else
68 local_irq_save(flags);
69 ret = *(volatile u64 *)ptr;
70 *(volatile u64 *)ptr = x;
71 local_irq_restore(flags);
72 return ret;
73#endif /* __xchg_u64 */
74#endif /* CONFIG_64BIT */
75
76 default:
77 __xchg_called_with_bad_pointer();
78 return x;
79 }
80}
81
82#define xchg(ptr, x) \
83 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
84
85#endif /* xchg */
86
87/* 13/*
88 * Atomic compare and exchange. 14 * Atomic compare and exchange.
89 * 15 *
90 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether 16 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether
91 * a cmpxchg primitive faster than repeated local irq save/restore exists. 17 * a cmpxchg primitive faster than repeated local irq save/restore exists.
92 */ 18 */
93#include <asm-generic/cmpxchg-local.h>
94
95#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) 19#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
96#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) 20#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
97 21
98#endif /* __ASM_GENERIC_CMPXCHG_H */ 22#endif
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 9a62937c56c..61e03dd7939 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -4,66 +4,70 @@
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/jiffies.h> 5#include <linux/jiffies.h>
6 6
7typedef unsigned long __nocast cputime_t; 7typedef unsigned long cputime_t;
8 8
9#define cputime_zero (0UL)
9#define cputime_one_jiffy jiffies_to_cputime(1) 10#define cputime_one_jiffy jiffies_to_cputime(1)
10#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct) 11#define cputime_max ((~0UL >> 1) - 1)
12#define cputime_add(__a, __b) ((__a) + (__b))
13#define cputime_sub(__a, __b) ((__a) - (__b))
14#define cputime_div(__a, __n) ((__a) / (__n))
15#define cputime_halve(__a) ((__a) >> 1)
16#define cputime_eq(__a, __b) ((__a) == (__b))
17#define cputime_gt(__a, __b) ((__a) > (__b))
18#define cputime_ge(__a, __b) ((__a) >= (__b))
19#define cputime_lt(__a, __b) ((__a) < (__b))
20#define cputime_le(__a, __b) ((__a) <= (__b))
21#define cputime_to_jiffies(__ct) (__ct)
11#define cputime_to_scaled(__ct) (__ct) 22#define cputime_to_scaled(__ct) (__ct)
12#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz) 23#define jiffies_to_cputime(__hz) (__hz)
13 24
14typedef u64 __nocast cputime64_t; 25typedef u64 cputime64_t;
15 26
16#define cputime64_to_jiffies64(__ct) (__force u64)(__ct) 27#define cputime64_zero (0ULL)
17#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif) 28#define cputime64_add(__a, __b) ((__a) + (__b))
29#define cputime64_sub(__a, __b) ((__a) - (__b))
30#define cputime64_to_jiffies64(__ct) (__ct)
31#define jiffies64_to_cputime64(__jif) (__jif)
32#define cputime_to_cputime64(__ct) ((u64) __ct)
33#define cputime64_gt(__a, __b) ((__a) > (__b))
18 34
19#define nsecs_to_cputime64(__ct) \ 35#define nsecs_to_cputime64(__ct) nsecs_to_jiffies64(__ct)
20 jiffies64_to_cputime64(nsecs_to_jiffies64(__ct))
21 36
22 37
23/* 38/*
24 * Convert cputime to microseconds and back. 39 * Convert cputime to microseconds and back.
25 */ 40 */
26#define cputime_to_usecs(__ct) \ 41#define cputime_to_usecs(__ct) jiffies_to_usecs(__ct);
27 jiffies_to_usecs(cputime_to_jiffies(__ct)) 42#define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs);
28#define usecs_to_cputime(__usec) \
29 jiffies_to_cputime(usecs_to_jiffies(__usec))
30#define usecs_to_cputime64(__usec) \
31 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
32 43
33/* 44/*
34 * Convert cputime to seconds and back. 45 * Convert cputime to seconds and back.
35 */ 46 */
36#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ) 47#define cputime_to_secs(jif) ((jif) / HZ)
37#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ) 48#define secs_to_cputime(sec) ((sec) * HZ)
38 49
39/* 50/*
40 * Convert cputime to timespec and back. 51 * Convert cputime to timespec and back.
41 */ 52 */
42#define timespec_to_cputime(__val) \ 53#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
43 jiffies_to_cputime(timespec_to_jiffies(__val)) 54#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
44#define cputime_to_timespec(__ct,__val) \
45 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
46 55
47/* 56/*
48 * Convert cputime to timeval and back. 57 * Convert cputime to timeval and back.
49 */ 58 */
50#define timeval_to_cputime(__val) \ 59#define timeval_to_cputime(__val) timeval_to_jiffies(__val)
51 jiffies_to_cputime(timeval_to_jiffies(__val)) 60#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val)
52#define cputime_to_timeval(__ct,__val) \
53 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
54 61
55/* 62/*
56 * Convert cputime to clock and back. 63 * Convert cputime to clock and back.
57 */ 64 */
58#define cputime_to_clock_t(__ct) \ 65#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
59 jiffies_to_clock_t(cputime_to_jiffies(__ct)) 66#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
60#define clock_t_to_cputime(__x) \
61 jiffies_to_cputime(clock_t_to_jiffies(__x))
62 67
63/* 68/*
64 * Convert cputime64 to clock. 69 * Convert cputime64 to clock.
65 */ 70 */
66#define cputime64_to_clock_t(__ct) \ 71#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
67 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
68 72
69#endif 73#endif
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h
index 2be8a2dbc86..85a3ffaa024 100644
--- a/include/asm-generic/dma-coherent.h
+++ b/include/asm-generic/dma-coherent.h
@@ -3,15 +3,13 @@
3 3
4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT 4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
5/* 5/*
6 * These three functions are only for dma allocator. 6 * These two functions are only for dma allocator.
7 * Don't use them in device drivers. 7 * Don't use them in device drivers.
8 */ 8 */
9int dma_alloc_from_coherent(struct device *dev, ssize_t size, 9int dma_alloc_from_coherent(struct device *dev, ssize_t size,
10 dma_addr_t *dma_handle, void **ret); 10 dma_addr_t *dma_handle, void **ret);
11int dma_release_from_coherent(struct device *dev, int order, void *vaddr); 11int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
12 12
13int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
14 void *cpu_addr, size_t size, int *ret);
15/* 13/*
16 * Standard interface 14 * Standard interface
17 */ 15 */
@@ -29,7 +27,6 @@ dma_mark_declared_memory_occupied(struct device *dev,
29#else 27#else
30#define dma_alloc_from_coherent(dev, size, handle, ret) (0) 28#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
31#define dma_release_from_coherent(dev, order, vaddr) (0) 29#define dma_release_from_coherent(dev, order, vaddr) (0)
32#define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0)
33#endif 30#endif
34 31
35#endif 32#endif
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h
deleted file mode 100644
index 294b1e755ab..00000000000
--- a/include/asm-generic/dma-contiguous.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef ASM_DMA_CONTIGUOUS_H
2#define ASM_DMA_CONTIGUOUS_H
3
4#ifdef __KERNEL__
5#ifdef CONFIG_CMA
6
7#include <linux/device.h>
8#include <linux/dma-contiguous.h>
9
10static inline struct cma *dev_get_cma_area(struct device *dev)
11{
12 if (dev && dev->cma_area)
13 return dev->cma_area;
14 return dma_contiguous_default_area;
15}
16
17static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
18{
19 if (dev)
20 dev->cma_area = cma;
21 if (!dev && !dma_contiguous_default_area)
22 dma_contiguous_default_area = cma;
23}
24
25#endif
26#endif
27
28#endif
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index de8bf89940f..0c80bb38773 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -2,7 +2,6 @@
2#define _ASM_GENERIC_DMA_MAPPING_H 2#define _ASM_GENERIC_DMA_MAPPING_H
3 3
4#include <linux/kmemcheck.h> 4#include <linux/kmemcheck.h>
5#include <linux/bug.h>
6#include <linux/scatterlist.h> 5#include <linux/scatterlist.h>
7#include <linux/dma-debug.h> 6#include <linux/dma-debug.h>
8#include <linux/dma-attrs.h> 7#include <linux/dma-attrs.h>
@@ -124,12 +123,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
124 size_t size, 123 size_t size,
125 enum dma_data_direction dir) 124 enum dma_data_direction dir)
126{ 125{
127 const struct dma_map_ops *ops = get_dma_ops(dev); 126 dma_sync_single_for_cpu(dev, addr + offset, size, dir);
128
129 BUG_ON(!valid_dma_direction(dir));
130 if (ops->sync_single_for_cpu)
131 ops->sync_single_for_cpu(dev, addr + offset, size, dir);
132 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
133} 127}
134 128
135static inline void dma_sync_single_range_for_device(struct device *dev, 129static inline void dma_sync_single_range_for_device(struct device *dev,
@@ -138,12 +132,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
138 size_t size, 132 size_t size,
139 enum dma_data_direction dir) 133 enum dma_data_direction dir)
140{ 134{
141 const struct dma_map_ops *ops = get_dma_ops(dev); 135 dma_sync_single_for_device(dev, addr + offset, size, dir);
142
143 BUG_ON(!valid_dma_direction(dir));
144 if (ops->sync_single_for_device)
145 ops->sync_single_for_device(dev, addr + offset, size, dir);
146 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
147} 136}
148 137
149static inline void 138static inline void
@@ -176,59 +165,4 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
176#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) 165#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
177#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) 166#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
178 167
179extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
180 void *cpu_addr, dma_addr_t dma_addr, size_t size);
181
182/**
183 * dma_mmap_attrs - map a coherent DMA allocation into user space
184 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
185 * @vma: vm_area_struct describing requested user mapping
186 * @cpu_addr: kernel CPU-view address returned from dma_alloc_attrs
187 * @handle: device-view address returned from dma_alloc_attrs
188 * @size: size of memory originally requested in dma_alloc_attrs
189 * @attrs: attributes of mapping properties requested in dma_alloc_attrs
190 *
191 * Map a coherent DMA buffer previously allocated by dma_alloc_attrs
192 * into user space. The coherent DMA buffer must not be freed by the
193 * driver until the user space mapping has been released.
194 */
195static inline int
196dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
197 dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs)
198{
199 struct dma_map_ops *ops = get_dma_ops(dev);
200 BUG_ON(!ops);
201 if (ops->mmap)
202 return ops->mmap(dev, vma, cpu_addr, dma_addr, size, attrs);
203 return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
204}
205
206#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
207
208static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
209 void *cpu_addr, dma_addr_t dma_addr, size_t size)
210{
211 DEFINE_DMA_ATTRS(attrs);
212 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
213 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
214}
215
216int
217dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
218 void *cpu_addr, dma_addr_t dma_addr, size_t size);
219
220static inline int
221dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr,
222 dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs)
223{
224 struct dma_map_ops *ops = get_dma_ops(dev);
225 BUG_ON(!ops);
226 if (ops->get_sgtable)
227 return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size,
228 attrs);
229 return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
230}
231
232#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL)
233
234#endif 168#endif
diff --git a/include/asm-generic/exec.h b/include/asm-generic/exec.h
deleted file mode 100644
index 567766b0074..00000000000
--- a/include/asm-generic/exec.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* Generic process execution 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_EXEC_H
15#define __ASM_GENERIC_EXEC_H
16
17#define arch_align_stack(x) (x)
18
19#endif /* __ASM_GENERIC_EXEC_H */
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
index 65e4468ac53..67e7245dc9b 100644
--- a/include/asm-generic/getorder.h
+++ b/include/asm-generic/getorder.h
@@ -4,58 +4,21 @@
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <linux/log2.h>
8 7
9/* 8/* Pure 2^n version of get_order */
10 * Runtime evaluation of get_order() 9static inline __attribute_const__ int get_order(unsigned long size)
11 */
12static inline __attribute_const__
13int __get_order(unsigned long size)
14{ 10{
15 int order; 11 int order;
16 12
17 size--; 13 size = (size - 1) >> (PAGE_SHIFT - 1);
18 size >>= PAGE_SHIFT; 14 order = -1;
19#if BITS_PER_LONG == 32 15 do {
20 order = fls(size); 16 size >>= 1;
21#else 17 order++;
22 order = fls64(size); 18 } while (size);
23#endif
24 return order; 19 return order;
25} 20}
26 21
27/**
28 * get_order - Determine the allocation order of a memory size
29 * @size: The size for which to get the order
30 *
31 * Determine the allocation order of a particular sized block of memory. This
32 * is on a logarithmic scale, where:
33 *
34 * 0 -> 2^0 * PAGE_SIZE and below
35 * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
36 * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
37 * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
38 * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
39 * ...
40 *
41 * The order returned is used to find the smallest allocation granule required
42 * to hold an object of the specified size.
43 *
44 * The result is undefined if the size is 0.
45 *
46 * This function may be used to initialise variables with compile time
47 * evaluations of constants.
48 */
49#define get_order(n) \
50( \
51 __builtin_constant_p(n) ? ( \
52 ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \
53 (((n) < (1UL << PAGE_SHIFT)) ? 0 : \
54 ilog2((n) - 1) - PAGE_SHIFT + 1) \
55 ) : \
56 __get_order(n) \
57)
58
59#endif /* __ASSEMBLY__ */ 22#endif /* __ASSEMBLY__ */
60 23
61#endif /* __ASM_GENERIC_GETORDER_H */ 24#endif /* __ASM_GENERIC_GETORDER_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 20ca7663975..d494001b122 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -4,8 +4,6 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/of.h>
8#include <linux/pinctrl/pinctrl.h>
9 7
10#ifdef CONFIG_GPIOLIB 8#ifdef CONFIG_GPIOLIB
11 9
@@ -43,7 +41,6 @@ static inline bool gpio_is_valid(int number)
43} 41}
44 42
45struct device; 43struct device;
46struct gpio;
47struct seq_file; 44struct seq_file;
48struct module; 45struct module;
49struct device_node; 46struct device_node;
@@ -57,14 +54,10 @@ struct device_node;
57 * enabling module power and clock; may sleep 54 * enabling module power and clock; may sleep
58 * @free: optional hook for chip-specific deactivation, such as 55 * @free: optional hook for chip-specific deactivation, such as
59 * disabling module power and clock; may sleep 56 * disabling module power and clock; may sleep
60 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
61 * (same as GPIOF_DIR_XXX), or negative error
62 * @direction_input: configures signal "offset" as input, or returns error 57 * @direction_input: configures signal "offset" as input, or returns error
63 * @get: returns value for signal "offset"; for output signals this 58 * @get: returns value for signal "offset"; for output signals this
64 * returns either the value actually sensed, or zero 59 * returns either the value actually sensed, or zero
65 * @direction_output: configures signal "offset" as output, or returns error 60 * @direction_output: configures signal "offset" as output, or returns error
66 * @set_debounce: optional hook for setting debounce time for specified gpio in
67 * interrupt triggered gpio chips
68 * @set: assigns output value for signal "offset" 61 * @set: assigns output value for signal "offset"
69 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings; 62 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
70 * implementation may not sleep 63 * implementation may not sleep
@@ -103,8 +96,7 @@ struct gpio_chip {
103 unsigned offset); 96 unsigned offset);
104 void (*free)(struct gpio_chip *chip, 97 void (*free)(struct gpio_chip *chip,
105 unsigned offset); 98 unsigned offset);
106 int (*get_direction)(struct gpio_chip *chip, 99
107 unsigned offset);
108 int (*direction_input)(struct gpio_chip *chip, 100 int (*direction_input)(struct gpio_chip *chip,
109 unsigned offset); 101 unsigned offset);
110 int (*get)(struct gpio_chip *chip, 102 int (*get)(struct gpio_chip *chip,
@@ -135,23 +127,13 @@ struct gpio_chip {
135 */ 127 */
136 struct device_node *of_node; 128 struct device_node *of_node;
137 int of_gpio_n_cells; 129 int of_gpio_n_cells;
138 int (*of_xlate)(struct gpio_chip *gc, 130 int (*of_xlate)(struct gpio_chip *gc, struct device_node *np,
139 const struct of_phandle_args *gpiospec, u32 *flags); 131 const void *gpio_spec, u32 *flags);
140#endif
141#ifdef CONFIG_PINCTRL
142 /*
143 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
144 * describe the actual pin range which they serve in an SoC. This
145 * information would be used by pinctrl subsystem to configure
146 * corresponding pins for gpio usage.
147 */
148 struct list_head pin_ranges;
149#endif 132#endif
150}; 133};
151 134
152extern const char *gpiochip_is_requested(struct gpio_chip *chip, 135extern const char *gpiochip_is_requested(struct gpio_chip *chip,
153 unsigned offset); 136 unsigned offset);
154extern struct gpio_chip *gpio_to_chip(unsigned gpio);
155extern int __must_check gpiochip_reserve(int start, int ngpio); 137extern int __must_check gpiochip_reserve(int start, int ngpio);
156 138
157/* add/remove chips */ 139/* add/remove chips */
@@ -188,16 +170,22 @@ extern int __gpio_cansleep(unsigned gpio);
188 170
189extern int __gpio_to_irq(unsigned gpio); 171extern int __gpio_to_irq(unsigned gpio);
190 172
173/**
174 * struct gpio - a structure describing a GPIO with configuration
175 * @gpio: the GPIO number
176 * @flags: GPIO configuration as specified by GPIOF_*
177 * @label: a literal description string of this GPIO
178 */
179struct gpio {
180 unsigned gpio;
181 unsigned long flags;
182 const char *label;
183};
184
191extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 185extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
192extern int gpio_request_array(const struct gpio *array, size_t num); 186extern int gpio_request_array(const struct gpio *array, size_t num);
193extern void gpio_free_array(const struct gpio *array, size_t num); 187extern void gpio_free_array(const struct gpio *array, size_t num);
194 188
195/* bindings for managed devices that want to request gpios */
196int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
197int devm_gpio_request_one(struct device *dev, unsigned gpio,
198 unsigned long flags, const char *label);
199void devm_gpio_free(struct device *dev, unsigned int gpio);
200
201#ifdef CONFIG_GPIO_SYSFS 189#ifdef CONFIG_GPIO_SYSFS
202 190
203/* 191/*
@@ -232,13 +220,13 @@ static inline int gpio_cansleep(unsigned gpio)
232static inline int gpio_get_value_cansleep(unsigned gpio) 220static inline int gpio_get_value_cansleep(unsigned gpio)
233{ 221{
234 might_sleep(); 222 might_sleep();
235 return __gpio_get_value(gpio); 223 return gpio_get_value(gpio);
236} 224}
237 225
238static inline void gpio_set_value_cansleep(unsigned gpio, int value) 226static inline void gpio_set_value_cansleep(unsigned gpio, int value)
239{ 227{
240 might_sleep(); 228 might_sleep();
241 __gpio_set_value(gpio, value); 229 gpio_set_value(gpio, value);
242} 230}
243 231
244#endif /* !CONFIG_GPIOLIB */ 232#endif /* !CONFIG_GPIOLIB */
@@ -270,41 +258,4 @@ static inline void gpio_unexport(unsigned gpio)
270} 258}
271#endif /* CONFIG_GPIO_SYSFS */ 259#endif /* CONFIG_GPIO_SYSFS */
272 260
273#ifdef CONFIG_PINCTRL
274
275/**
276 * struct gpio_pin_range - pin range controlled by a gpio chip
277 * @head: list for maintaining set of pin ranges, used internally
278 * @pctldev: pinctrl device which handles corresponding pins
279 * @range: actual range of pins controlled by a gpio controller
280 */
281
282struct gpio_pin_range {
283 struct list_head node;
284 struct pinctrl_dev *pctldev;
285 struct pinctrl_gpio_range range;
286};
287
288int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289 unsigned int gpio_offset, unsigned int pin_offset,
290 unsigned int npins);
291void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292
293#else
294
295static inline int
296gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297 unsigned int gpio_offset, unsigned int pin_offset,
298 unsigned int npins)
299{
300 return 0;
301}
302
303static inline void
304gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305{
306}
307
308#endif /* CONFIG_PINCTRL */
309
310#endif /* _ASM_GENERIC_GPIO_H */ 261#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 27d4ec0dfce..1ca3efc976c 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -4,11 +4,33 @@
4 * Integer declarations for architectures which use "long" 4 * Integer declarations for architectures which use "long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
7#ifndef _ASM_GENERIC_INT_L64_H 8#ifndef _ASM_GENERIC_INT_L64_H
8#define _ASM_GENERIC_INT_L64_H 9#define _ASM_GENERIC_INT_L64_H
9 10
10#include <uapi/asm-generic/int-l64.h> 11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
11 21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28typedef __signed__ long __s64;
29typedef unsigned long __u64;
30
31#endif /* __ASSEMBLY__ */
32
33#ifdef __KERNEL__
12 34
13#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
14 36
@@ -46,4 +68,6 @@ typedef unsigned long u64;
46 68
47#endif /* __ASSEMBLY__ */ 69#endif /* __ASSEMBLY__ */
48 70
71#endif /* __KERNEL__ */
72
49#endif /* _ASM_GENERIC_INT_L64_H */ 73#endif /* _ASM_GENERIC_INT_L64_H */
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index 4cd84855cb4..f394147c073 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -4,11 +4,38 @@
4 * Integer declarations for architectures which use "long long" 4 * Integer declarations for architectures which use "long long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
7#ifndef _ASM_GENERIC_INT_LL64_H 8#ifndef _ASM_GENERIC_INT_LL64_H
8#define _ASM_GENERIC_INT_LL64_H 9#define _ASM_GENERIC_INT_LL64_H
9 10
10#include <uapi/asm-generic/int-ll64.h> 11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
11 21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#ifdef __GNUC__
29__extension__ typedef __signed__ long long __s64;
30__extension__ typedef unsigned long long __u64;
31#else
32typedef __signed__ long long __s64;
33typedef unsigned long long __u64;
34#endif
35
36#endif /* __ASSEMBLY__ */
37
38#ifdef __KERNEL__
12 39
13#ifndef __ASSEMBLY__ 40#ifndef __ASSEMBLY__
14 41
@@ -46,4 +73,6 @@ typedef unsigned long long u64;
46 73
47#endif /* __ASSEMBLY__ */ 74#endif /* __ASSEMBLY__ */
48 75
76#endif /* __KERNEL__ */
77
49#endif /* _ASM_GENERIC_INT_LL64_H */ 78#endif /* _ASM_GENERIC_INT_LL64_H */
diff --git a/include/asm-generic/io-64-nonatomic-hi-lo.h b/include/asm-generic/io-64-nonatomic-hi-lo.h
deleted file mode 100644
index a6806a94250..00000000000
--- a/include/asm-generic/io-64-nonatomic-hi-lo.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_IO_64_NONATOMIC_HI_LO_H_
2#define _ASM_IO_64_NONATOMIC_HI_LO_H_
3
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
7#ifndef readq
8static inline __u64 readq(const volatile void __iomem *addr)
9{
10 const volatile u32 __iomem *p = addr;
11 u32 low, high;
12
13 high = readl(p + 1);
14 low = readl(p);
15
16 return low + ((u64)high << 32);
17}
18#endif
19
20#ifndef writeq
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{
23 writel(val >> 32, addr + 4);
24 writel(val, addr);
25}
26#endif
27
28#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */
diff --git a/include/asm-generic/io-64-nonatomic-lo-hi.h b/include/asm-generic/io-64-nonatomic-lo-hi.h
deleted file mode 100644
index ca546b1ff8b..00000000000
--- a/include/asm-generic/io-64-nonatomic-lo-hi.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_IO_64_NONATOMIC_LO_HI_H_
2#define _ASM_IO_64_NONATOMIC_LO_HI_H_
3
4#include <linux/io.h>
5#include <asm-generic/int-ll64.h>
6
7#ifndef readq
8static inline __u64 readq(const volatile void __iomem *addr)
9{
10 const volatile u32 __iomem *p = addr;
11 u32 low, high;
12
13 low = readl(p);
14 high = readl(p + 1);
15
16 return low + ((u64)high << 32);
17}
18#endif
19
20#ifndef writeq
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{
23 writel(val, addr);
24 writel(val >> 32, addr + 4);
25}
26#endif
27
28#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 33bbbae4ddc..912088773a6 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -12,14 +12,13 @@
12#define __ASM_GENERIC_IO_H 12#define __ASM_GENERIC_IO_H
13 13
14#include <asm/page.h> /* I/O is all done through memory accesses */ 14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cacheflush.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17#ifdef CONFIG_GENERIC_IOMAP 18#ifdef CONFIG_GENERIC_IOMAP
18#include <asm-generic/iomap.h> 19#include <asm-generic/iomap.h>
19#endif 20#endif
20 21
21#include <asm-generic/pci_iomap.h>
22
23#ifndef mmiowb 22#ifndef mmiowb
24#define mmiowb() do {} while (0) 23#define mmiowb() do {} while (0)
25#endif 24#endif
@@ -82,25 +81,19 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr)
82#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr) 81#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
83 82
84#ifdef CONFIG_64BIT 83#ifdef CONFIG_64BIT
85#ifndef __raw_readq
86static inline u64 __raw_readq(const volatile void __iomem *addr) 84static inline u64 __raw_readq(const volatile void __iomem *addr)
87{ 85{
88 return *(const volatile u64 __force *) addr; 86 return *(const volatile u64 __force *) addr;
89} 87}
90#endif
91
92#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 88#define readq(addr) __le64_to_cpu(__raw_readq(addr))
93 89
94#ifndef __raw_writeq
95static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 90static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
96{ 91{
97 *(volatile u64 __force *) addr = b; 92 *(volatile u64 __force *) addr = b;
98} 93}
94#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
99#endif 95#endif
100 96
101#define writeq(b, addr) __raw_writeq(__cpu_to_le64(b), addr)
102#endif /* CONFIG_64BIT */
103
104#ifndef PCI_IOBASE 97#ifndef PCI_IOBASE
105#define PCI_IOBASE ((void __iomem *) 0) 98#define PCI_IOBASE ((void __iomem *) 0)
106#endif 99#endif
@@ -153,7 +146,7 @@ static inline void insb(unsigned long addr, void *buffer, int count)
153 if (count) { 146 if (count) {
154 u8 *buf = buffer; 147 u8 *buf = buffer;
155 do { 148 do {
156 u8 x = __raw_readb(addr + PCI_IOBASE); 149 u8 x = inb(addr);
157 *buf++ = x; 150 *buf++ = x;
158 } while (--count); 151 } while (--count);
159 } 152 }
@@ -166,7 +159,7 @@ static inline void insw(unsigned long addr, void *buffer, int count)
166 if (count) { 159 if (count) {
167 u16 *buf = buffer; 160 u16 *buf = buffer;
168 do { 161 do {
169 u16 x = __raw_readw(addr + PCI_IOBASE); 162 u16 x = inw(addr);
170 *buf++ = x; 163 *buf++ = x;
171 } while (--count); 164 } while (--count);
172 } 165 }
@@ -179,7 +172,7 @@ static inline void insl(unsigned long addr, void *buffer, int count)
179 if (count) { 172 if (count) {
180 u32 *buf = buffer; 173 u32 *buf = buffer;
181 do { 174 do {
182 u32 x = __raw_readl(addr + PCI_IOBASE); 175 u32 x = inl(addr);
183 *buf++ = x; 176 *buf++ = x;
184 } while (--count); 177 } while (--count);
185 } 178 }
@@ -192,7 +185,7 @@ static inline void outsb(unsigned long addr, const void *buffer, int count)
192 if (count) { 185 if (count) {
193 const u8 *buf = buffer; 186 const u8 *buf = buffer;
194 do { 187 do {
195 __raw_writeb(*buf++, addr + PCI_IOBASE); 188 outb(*buf++, addr);
196 } while (--count); 189 } while (--count);
197 } 190 }
198} 191}
@@ -204,7 +197,7 @@ static inline void outsw(unsigned long addr, const void *buffer, int count)
204 if (count) { 197 if (count) {
205 const u16 *buf = buffer; 198 const u16 *buf = buffer;
206 do { 199 do {
207 __raw_writew(*buf++, addr + PCI_IOBASE); 200 outw(*buf++, addr);
208 } while (--count); 201 } while (--count);
209 } 202 }
210} 203}
@@ -216,12 +209,42 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
216 if (count) { 209 if (count) {
217 const u32 *buf = buffer; 210 const u32 *buf = buffer;
218 do { 211 do {
219 __raw_writel(*buf++, addr + PCI_IOBASE); 212 outl(*buf++, addr);
220 } while (--count); 213 } while (--count);
221 } 214 }
222} 215}
223#endif 216#endif
224 217
218static inline void readsl(const void __iomem *addr, void *buf, int len)
219{
220 insl(addr - PCI_IOBASE, buf, len);
221}
222
223static inline void readsw(const void __iomem *addr, void *buf, int len)
224{
225 insw(addr - PCI_IOBASE, buf, len);
226}
227
228static inline void readsb(const void __iomem *addr, void *buf, int len)
229{
230 insb(addr - PCI_IOBASE, buf, len);
231}
232
233static inline void writesl(const void __iomem *addr, const void *buf, int len)
234{
235 outsl(addr - PCI_IOBASE, buf, len);
236}
237
238static inline void writesw(const void __iomem *addr, const void *buf, int len)
239{
240 outsw(addr - PCI_IOBASE, buf, len);
241}
242
243static inline void writesb(const void __iomem *addr, const void *buf, int len)
244{
245 outsb(addr - PCI_IOBASE, buf, len);
246}
247
225#ifndef CONFIG_GENERIC_IOMAP 248#ifndef CONFIG_GENERIC_IOMAP
226#define ioread8(addr) readb(addr) 249#define ioread8(addr) readb(addr)
227#define ioread16(addr) readw(addr) 250#define ioread16(addr) readw(addr)
@@ -260,21 +283,18 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
260#define __io_virt(x) ((void __force *) (x)) 283#define __io_virt(x) ((void __force *) (x))
261 284
262#ifndef CONFIG_GENERIC_IOMAP 285#ifndef CONFIG_GENERIC_IOMAP
286/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
263struct pci_dev; 287struct pci_dev;
264extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 288extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
265
266#ifndef pci_iounmap
267static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
268{ 290{
269} 291}
270#endif
271#endif /* CONFIG_GENERIC_IOMAP */ 292#endif /* CONFIG_GENERIC_IOMAP */
272 293
273/* 294/*
274 * Change virtual addresses to physical addresses and vv. 295 * Change virtual addresses to physical addresses and vv.
275 * These are pretty trivial 296 * These are pretty trivial
276 */ 297 */
277#ifndef virt_to_phys
278static inline unsigned long virt_to_phys(volatile void *address) 298static inline unsigned long virt_to_phys(volatile void *address)
279{ 299{
280 return __pa((unsigned long)address); 300 return __pa((unsigned long)address);
@@ -284,7 +304,6 @@ static inline void *phys_to_virt(unsigned long address)
284{ 304{
285 return __va(address); 305 return __va(address);
286} 306}
287#endif
288 307
289/* 308/*
290 * Change "struct page" to physical address. 309 * Change "struct page" to physical address.
@@ -308,7 +327,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
308#define ioremap_wc ioremap_nocache 327#define ioremap_wc ioremap_nocache
309#endif 328#endif
310 329
311static inline void iounmap(void __iomem *addr) 330static inline void iounmap(void *addr)
312{ 331{
313} 332}
314#endif /* CONFIG_MMU */ 333#endif /* CONFIG_MMU */
@@ -344,16 +363,9 @@ static inline void *bus_to_virt(unsigned long address)
344} 363}
345#endif 364#endif
346 365
347#ifndef memset_io
348#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) 366#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
349#endif
350
351#ifndef memcpy_fromio
352#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c)) 367#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
353#endif
354#ifndef memcpy_toio
355#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c)) 368#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
356#endif
357 369
358#endif /* __KERNEL__ */ 370#endif /* __KERNEL__ */
359 371
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index d17295b290f..15828b2d663 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -1,12 +1,105 @@
1#ifndef _ASM_GENERIC_IOCTL_H 1#ifndef _ASM_GENERIC_IOCTL_H
2#define _ASM_GENERIC_IOCTL_H 2#define _ASM_GENERIC_IOCTL_H
3 3
4#include <uapi/asm-generic/ioctl.h> 4/* ioctl command encoding: 32 bits total, command in lower 16 bits,
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
5 13
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24
25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
37
38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
40#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
41#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
42
43#define _IOC_NRSHIFT 0
44#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
45#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
47
48/*
49 * Direction bits, which any architecture can choose to override
50 * before including this file.
51 */
52
53#ifndef _IOC_NONE
54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
64
65#define _IOC(dir,type,nr,size) \
66 (((dir) << _IOC_DIRSHIFT) | \
67 ((type) << _IOC_TYPESHIFT) | \
68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT))
70
71#ifdef __KERNEL__
6/* provoke compile error for invalid uses of size argument */ 72/* provoke compile error for invalid uses of size argument */
7extern unsigned int __invalid_size_argument_for_IOC; 73extern unsigned int __invalid_size_argument_for_IOC;
8#define _IOC_TYPECHECK(t) \ 74#define _IOC_TYPECHECK(t) \
9 ((sizeof(t) == sizeof(t[1]) && \ 75 ((sizeof(t) == sizeof(t[1]) && \
10 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ 76 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
11 sizeof(t) : __invalid_size_argument_for_IOC) 77 sizeof(t) : __invalid_size_argument_for_IOC)
78#else
79#define _IOC_TYPECHECK(t) (sizeof(t))
80#endif
81
82/* used to create numbers */
83#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
84#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
85#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
86#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
87#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
88#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
89#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
90
91/* used to decode ioctl numbers.. */
92#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
93#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
94#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
95#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
96
97/* ...and for the drivers/sound files... */
98
99#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
100#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
101#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
102#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
103#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
104
12#endif /* _ASM_GENERIC_IOCTL_H */ 105#endif /* _ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 6afd7d6a989..98dcd76ce83 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -67,15 +67,18 @@ extern void ioport_unmap(void __iomem *);
67#endif 67#endif
68 68
69#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
72extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 73extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
73#elif defined(CONFIG_GENERIC_IOMAP) 74#else
74struct pci_dev; 75struct pci_dev;
76static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
77{
78 return NULL;
79}
75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 80static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
76{ } 81{ }
77#endif 82#endif
78 83
79#include <asm-generic/pci_iomap.h>
80
81#endif 84#endif
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index 90f99c74dd3..0232ccb76f2 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -2,9 +2,39 @@
2#define _ASM_GENERIC_KMAP_TYPES_H 2#define _ASM_GENERIC_KMAP_TYPES_H
3 3
4#ifdef __WITH_KM_FENCE 4#ifdef __WITH_KM_FENCE
5# define KM_TYPE_NR 41 5# define KMAP_D(n) __KM_FENCE_##n ,
6#else 6#else
7# define KM_TYPE_NR 20 7# define KMAP_D(n)
8#endif 8#endif
9 9
10enum km_type {
11KMAP_D(0) KM_BOUNCE_READ,
12KMAP_D(1) KM_SKB_SUNRPC_DATA,
13KMAP_D(2) KM_SKB_DATA_SOFTIRQ,
14KMAP_D(3) KM_USER0,
15KMAP_D(4) KM_USER1,
16KMAP_D(5) KM_BIO_SRC_IRQ,
17KMAP_D(6) KM_BIO_DST_IRQ,
18KMAP_D(7) KM_PTE0,
19KMAP_D(8) KM_PTE1,
20KMAP_D(9) KM_IRQ0,
21KMAP_D(10) KM_IRQ1,
22KMAP_D(11) KM_SOFTIRQ0,
23KMAP_D(12) KM_SOFTIRQ1,
24KMAP_D(13) KM_SYNC_ICACHE,
25KMAP_D(14) KM_SYNC_DCACHE,
26/* UML specific, for copy_*_user - used in do_op_one_page */
27KMAP_D(15) KM_UML_USERCOPY,
28KMAP_D(16) KM_IRQ_PTE,
29KMAP_D(17) KM_NMI,
30KMAP_D(18) KM_NMI_PTE,
31KMAP_D(19) KM_KDB,
32/*
33 * Remember to update debug_kmap_atomic() when adding new kmap types!
34 */
35KMAP_D(20) KM_TYPE_NR
36};
37
38#undef KMAP_D
39
10#endif 40#endif
diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h
deleted file mode 100644
index 9d96605f160..00000000000
--- a/include/asm-generic/kvm_para.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_GENERIC_KVM_PARA_H
2#define _ASM_GENERIC_KVM_PARA_H
3
4#include <uapi/asm-generic/kvm_para.h>
5
6
7/*
8 * This function is used by architectures that support kvm to avoid issuing
9 * false soft lockup messages.
10 */
11static inline bool kvm_check_and_clear_guest_paused(void)
12{
13 return false;
14}
15
16static inline unsigned int kvm_arch_para_features(void)
17{
18 return 0;
19}
20
21#endif
diff --git a/include/asm-generic/mmu.h b/include/asm-generic/mmu.h
index 0ed3f1cfb85..4f4aa56d6b5 100644
--- a/include/asm-generic/mmu.h
+++ b/include/asm-generic/mmu.h
@@ -7,12 +7,8 @@
7 */ 7 */
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9typedef struct { 9typedef struct {
10 struct vm_list_struct *vmlist;
10 unsigned long end_brk; 11 unsigned long end_brk;
11
12#ifdef CONFIG_BINFMT_ELF_FDPIC
13 unsigned long exec_fdpic_loadmap;
14 unsigned long interp_fdpic_loadmap;
15#endif
16} mm_context_t; 12} mm_context_t;
17#endif 13#endif
18 14
diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h
index 14dc41d185a..ed5b44de4c9 100644
--- a/include/asm-generic/module.h
+++ b/include/asm-generic/module.h
@@ -5,44 +5,18 @@
5 * Many architectures just need a simple module 5 * Many architectures just need a simple module
6 * loader without arch specific data. 6 * loader without arch specific data.
7 */ 7 */
8#ifndef CONFIG_HAVE_MOD_ARCH_SPECIFIC
9struct mod_arch_specific 8struct mod_arch_specific
10{ 9{
11}; 10};
12#endif
13 11
14#ifdef CONFIG_64BIT 12#ifdef CONFIG_64BIT
15#define Elf_Shdr Elf64_Shdr 13#define Elf_Shdr Elf64_Shdr
16#define Elf_Phdr Elf64_Phdr 14#define Elf_Sym Elf64_Sym
17#define Elf_Sym Elf64_Sym 15#define Elf_Ehdr Elf64_Ehdr
18#define Elf_Dyn Elf64_Dyn 16#else
19#define Elf_Ehdr Elf64_Ehdr 17#define Elf_Shdr Elf32_Shdr
20#define Elf_Addr Elf64_Addr 18#define Elf_Sym Elf32_Sym
21#ifdef CONFIG_MODULES_USE_ELF_REL 19#define Elf_Ehdr Elf32_Ehdr
22#define Elf_Rel Elf64_Rel
23#endif
24#ifdef CONFIG_MODULES_USE_ELF_RELA
25#define Elf_Rela Elf64_Rela
26#endif
27#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
28#define ELF_R_SYM(X) ELF64_R_SYM(X)
29
30#else /* CONFIG_64BIT */
31
32#define Elf_Shdr Elf32_Shdr
33#define Elf_Phdr Elf32_Phdr
34#define Elf_Sym Elf32_Sym
35#define Elf_Dyn Elf32_Dyn
36#define Elf_Ehdr Elf32_Ehdr
37#define Elf_Addr Elf32_Addr
38#ifdef CONFIG_MODULES_USE_ELF_REL
39#define Elf_Rel Elf32_Rel
40#endif
41#ifdef CONFIG_MODULES_USE_ELF_RELA
42#define Elf_Rela Elf32_Rela
43#endif
44#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
45#define ELF_R_SYM(X) ELF32_R_SYM(X)
46#endif 20#endif
47 21
48#endif /* __ASM_GENERIC_MODULE_H */ 22#endif /* __ASM_GENERIC_MODULE_H */
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index c04e0db8a2d..580a6d35c70 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -26,13 +26,7 @@ static inline void
26__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) 26__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
27{ 27{
28 if (unlikely(atomic_xchg(count, 0) != 1)) 28 if (unlikely(atomic_xchg(count, 0) != 1))
29 /* 29 fail_fn(count);
30 * We failed to acquire the lock, so mark it contended
31 * to ensure that any waiting tasks are woken up by the
32 * unlock slow path.
33 */
34 if (likely(atomic_xchg(count, -1) != 1))
35 fail_fn(count);
36} 30}
37 31
38/** 32/**
@@ -49,8 +43,7 @@ static inline int
49__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 43__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
50{ 44{
51 if (unlikely(atomic_xchg(count, 0) != 1)) 45 if (unlikely(atomic_xchg(count, 0) != 1))
52 if (likely(atomic_xchg(count, -1) != 1)) 46 return fail_fn(count);
53 return fail_fn(count);
54 return 0; 47 return 0;
55} 48}
56 49
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 37d1fe28960..75fec18cdc5 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -71,26 +71,22 @@ extern unsigned long memory_end;
71#define PAGE_OFFSET (0) 71#define PAGE_OFFSET (0)
72#endif 72#endif
73 73
74#ifndef ARCH_PFN_OFFSET
75#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
76#endif
77
78#ifndef __ASSEMBLY__ 74#ifndef __ASSEMBLY__
79 75
80#define __va(x) ((void *)((unsigned long) (x))) 76#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
81#define __pa(x) ((unsigned long) (x)) 77#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
82 78
83#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
84#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
85 81
86#define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr)) 82#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
87#define page_to_virt(page) pfn_to_virt(page_to_pfn(page)) 83#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
88 84
89#ifndef page_to_phys 85#ifndef page_to_phys
90#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 86#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
91#endif 87#endif
92 88
93#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr) 89#define pfn_valid(pfn) ((pfn) < max_mapnr)
94 90
95#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 91#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
96 ((void *)(kaddr) < (void *)memory_end)) 92 ((void *)(kaddr) < (void *)memory_end))
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
index 04e715bccce..cdf8251bfb6 100644
--- a/include/asm-generic/param.h
+++ b/include/asm-generic/param.h
@@ -1,10 +1,24 @@
1#ifndef __ASM_GENERIC_PARAM_H 1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H 2#define __ASM_GENERIC_PARAM_H
3 3
4#include <uapi/asm-generic/param.h> 4#ifdef __KERNEL__
5
6# undef HZ
7# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
8# define USER_HZ 100 /* some user interfaces are */ 6# define USER_HZ 100 /* some user interfaces are */
9# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */ 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
10#endif /* __ASM_GENERIC_PARAM_H */ 24#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h
index 2c9f9d4336c..40528cb977e 100644
--- a/include/asm-generic/parport.h
+++ b/include/asm-generic/parport.h
@@ -10,8 +10,8 @@
10 * to devices on the PCI bus. 10 * to devices on the PCI bus.
11 */ 11 */
12 12
13static int parport_pc_find_isa_ports(int autoirq, int autodma); 13static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
14static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 14static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
15{ 15{
16#ifdef CONFIG_ISA 16#ifdef CONFIG_ISA
17 return parport_pc_find_isa_ports(autoirq, autodma); 17 return parport_pc_find_isa_ports(autoirq, autodma);
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index 20db2e5a0a6..4a5aca2a2c9 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -30,12 +30,6 @@ enum {
30 PCI_ENABLE_PROC_DOMAINS = 0x00000010, 30 PCI_ENABLE_PROC_DOMAINS = 0x00000010,
31 /* ... except for domain 0 */ 31 /* ... except for domain 0 */
32 PCI_COMPAT_DOMAIN_0 = 0x00000020, 32 PCI_COMPAT_DOMAIN_0 = 0x00000020,
33
34 /* PCIe downstream ports are bridges that normally lead to only a
35 * device 0, but if this is set, we scan all possible devices, not
36 * just device 0.
37 */
38 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040,
39}; 33};
40 34
41#ifdef CONFIG_PCI 35#ifdef CONFIG_PCI
@@ -51,11 +45,6 @@ static inline void pci_add_flags(int flags)
51 pci_flags |= flags; 45 pci_flags |= flags;
52} 46}
53 47
54static inline void pci_clear_flags(int flags)
55{
56 pci_flags &= ~flags;
57}
58
59static inline int pci_has_flag(int flag) 48static inline int pci_has_flag(int flag)
60{ 49{
61 return pci_flags & flag; 50 return pci_flags & flag;
@@ -63,7 +52,6 @@ static inline int pci_has_flag(int flag)
63#else 52#else
64static inline void pci_set_flags(int flags) { } 53static inline void pci_set_flags(int flags) { }
65static inline void pci_add_flags(int flags) { } 54static inline void pci_add_flags(int flags) { }
66static inline void pci_clear_flags(int flags) { }
67static inline int pci_has_flag(int flag) 55static inline int pci_has_flag(int flag)
68{ 56{
69 return 0; 57 return 0;
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index e80a0495e5b..26373cff454 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -6,6 +6,30 @@
6#ifndef _ASM_GENERIC_PCI_H 6#ifndef _ASM_GENERIC_PCI_H
7#define _ASM_GENERIC_PCI_H 7#define _ASM_GENERIC_PCI_H
8 8
9/**
10 * pcibios_resource_to_bus - convert resource to PCI bus address
11 * @dev: device which owns this resource
12 * @region: converted bus-centric region (start,end)
13 * @res: resource to convert
14 *
15 * Convert a resource to a PCI device bus address or bus window.
16 */
17static inline void
18pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
19 struct resource *res)
20{
21 region->start = res->start;
22 region->end = res->end;
23}
24
25static inline void
26pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
27 struct pci_bus_region *region)
28{
29 res->start = region->start;
30 res->end = region->end;
31}
32
9static inline struct resource * 33static inline struct resource *
10pcibios_select_root(struct pci_dev *pdev, struct resource *res) 34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
11{ 35{
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
deleted file mode 100644
index ce37349860f..00000000000
--- a/include/asm-generic/pci_iomap.h
+++ /dev/null
@@ -1,35 +0,0 @@
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_PCI_IOMAP_H
12#define __ASM_GENERIC_PCI_IOMAP_H
13
14struct pci_dev;
15#ifdef CONFIG_PCI
16/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
17extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
18/* Create a virtual mapping cookie for a port on a given PCI device.
19 * Do not call this directly, it exists to make it easier for architectures
20 * to override */
21#ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
22extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
23 unsigned int nr);
24#else
25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
26#endif
27
28#elif defined(CONFIG_GENERIC_PCI_IOMAP)
29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
30{
31 return NULL;
32}
33#endif
34
35#endif /* __ASM_GENERIC_IO_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 701beab27aa..76bff2bff15 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -5,7 +5,6 @@
5#ifdef CONFIG_MMU 5#ifdef CONFIG_MMU
6 6
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/bug.h>
9 8
10#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 9#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
11extern int ptep_set_access_flags(struct vm_area_struct *vma, 10extern int ptep_set_access_flags(struct vm_area_struct *vma,
@@ -87,7 +86,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
87 pmd_t *pmdp) 86 pmd_t *pmdp)
88{ 87{
89 pmd_t pmd = *pmdp; 88 pmd_t pmd = *pmdp;
90 pmd_clear(pmdp); 89 pmd_clear(mm, address, pmdp);
91 return pmd; 90 return pmd;
92} 91}
93#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 92#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -158,21 +157,9 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
158#endif 157#endif
159 158
160#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH 159#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
161extern void pmdp_splitting_flush(struct vm_area_struct *vma, 160extern pmd_t pmdp_splitting_flush(struct vm_area_struct *vma,
162 unsigned long address, pmd_t *pmdp); 161 unsigned long address,
163#endif 162 pmd_t *pmdp);
164
165#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT
166extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
167#endif
168
169#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW
170extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
171#endif
172
173#ifndef __HAVE_ARCH_PMDP_INVALIDATE
174extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
175 pmd_t *pmdp);
176#endif 163#endif
177 164
178#ifndef __HAVE_ARCH_PTE_SAME 165#ifndef __HAVE_ARCH_PTE_SAME
@@ -219,10 +206,6 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
219#define move_pte(pte, prot, old_addr, new_addr) (pte) 206#define move_pte(pte, prot, old_addr, new_addr) (pte)
220#endif 207#endif
221 208
222#ifndef pte_accessible
223# define pte_accessible(pte) ((void)(pte),1)
224#endif
225
226#ifndef flush_tlb_fix_spurious_fault 209#ifndef flush_tlb_fix_spurious_fault
227#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) 210#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
228#endif 211#endif
@@ -398,89 +381,50 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
398 381
399#ifndef __HAVE_PFNMAP_TRACKING 382#ifndef __HAVE_PFNMAP_TRACKING
400/* 383/*
401 * Interfaces that can be used by architecture code to keep track of 384 * Interface that can be used by architecture code to keep track of
402 * memory type of pfn mappings specified by the remap_pfn_range, 385 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
403 * vm_insert_pfn. 386 *
404 */ 387 * track_pfn_vma_new is called when a _new_ pfn mapping is being established
405 388 * for physical range indicated by pfn and size.
406/*
407 * track_pfn_remap is called when a _new_ pfn mapping is being established
408 * by remap_pfn_range() for physical range indicated by pfn and size.
409 */
410static inline int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
411 unsigned long pfn, unsigned long addr,
412 unsigned long size)
413{
414 return 0;
415}
416
417/*
418 * track_pfn_insert is called when a _new_ single pfn is established
419 * by vm_insert_pfn().
420 */ 389 */
421static inline int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot, 390static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
422 unsigned long pfn) 391 unsigned long pfn, unsigned long size)
423{ 392{
424 return 0; 393 return 0;
425} 394}
426 395
427/* 396/*
428 * track_pfn_copy is called when vma that is covering the pfnmap gets 397 * Interface that can be used by architecture code to keep track of
398 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
399 *
400 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets
429 * copied through copy_page_range(). 401 * copied through copy_page_range().
430 */ 402 */
431static inline int track_pfn_copy(struct vm_area_struct *vma) 403static inline int track_pfn_vma_copy(struct vm_area_struct *vma)
432{ 404{
433 return 0; 405 return 0;
434} 406}
435 407
436/* 408/*
409 * Interface that can be used by architecture code to keep track of
410 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
411 *
437 * untrack_pfn_vma is called while unmapping a pfnmap for a region. 412 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
438 * untrack can be called for a specific region indicated by pfn and size or 413 * untrack can be called for a specific region indicated by pfn and size or
439 * can be for the entire vma (in which case pfn, size are zero). 414 * can be for the entire vma (in which case size can be zero).
440 */ 415 */
441static inline void untrack_pfn(struct vm_area_struct *vma, 416static inline void untrack_pfn_vma(struct vm_area_struct *vma,
442 unsigned long pfn, unsigned long size) 417 unsigned long pfn, unsigned long size)
443{ 418{
444} 419}
445#else 420#else
446extern int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, 421extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
447 unsigned long pfn, unsigned long addr, 422 unsigned long pfn, unsigned long size);
448 unsigned long size); 423extern int track_pfn_vma_copy(struct vm_area_struct *vma);
449extern int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot, 424extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
450 unsigned long pfn); 425 unsigned long size);
451extern int track_pfn_copy(struct vm_area_struct *vma);
452extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
453 unsigned long size);
454#endif
455
456#ifdef __HAVE_COLOR_ZERO_PAGE
457static inline int is_zero_pfn(unsigned long pfn)
458{
459 extern unsigned long zero_pfn;
460 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
461 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
462}
463
464static inline unsigned long my_zero_pfn(unsigned long addr)
465{
466 return page_to_pfn(ZERO_PAGE(addr));
467}
468#else
469static inline int is_zero_pfn(unsigned long pfn)
470{
471 extern unsigned long zero_pfn;
472 return pfn == zero_pfn;
473}
474
475static inline unsigned long my_zero_pfn(unsigned long addr)
476{
477 extern unsigned long zero_pfn;
478 return zero_pfn;
479}
480#endif 426#endif
481 427
482#ifdef CONFIG_MMU
483
484#ifndef CONFIG_TRANSPARENT_HUGEPAGE 428#ifndef CONFIG_TRANSPARENT_HUGEPAGE
485static inline int pmd_trans_huge(pmd_t pmd) 429static inline int pmd_trans_huge(pmd_t pmd)
486{ 430{
@@ -497,200 +441,7 @@ static inline int pmd_write(pmd_t pmd)
497 return 0; 441 return 0;
498} 442}
499#endif /* __HAVE_ARCH_PMD_WRITE */ 443#endif /* __HAVE_ARCH_PMD_WRITE */
500#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
501
502#ifndef pmd_read_atomic
503static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
504{
505 /*
506 * Depend on compiler for an atomic pmd read. NOTE: this is
507 * only going to work, if the pmdval_t isn't larger than
508 * an unsigned long.
509 */
510 return *pmdp;
511}
512#endif
513
514/*
515 * This function is meant to be used by sites walking pagetables with
516 * the mmap_sem hold in read mode to protect against MADV_DONTNEED and
517 * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd
518 * into a null pmd and the transhuge page fault can convert a null pmd
519 * into an hugepmd or into a regular pmd (if the hugepage allocation
520 * fails). While holding the mmap_sem in read mode the pmd becomes
521 * stable and stops changing under us only if it's not null and not a
522 * transhuge pmd. When those races occurs and this function makes a
523 * difference vs the standard pmd_none_or_clear_bad, the result is
524 * undefined so behaving like if the pmd was none is safe (because it
525 * can return none anyway). The compiler level barrier() is critically
526 * important to compute the two checks atomically on the same pmdval.
527 *
528 * For 32bit kernels with a 64bit large pmd_t this automatically takes
529 * care of reading the pmd atomically to avoid SMP race conditions
530 * against pmd_populate() when the mmap_sem is hold for reading by the
531 * caller (a special atomic read not done by "gcc" as in the generic
532 * version above, is also needed when THP is disabled because the page
533 * fault can populate the pmd from under us).
534 */
535static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
536{
537 pmd_t pmdval = pmd_read_atomic(pmd);
538 /*
539 * The barrier will stabilize the pmdval in a register or on
540 * the stack so that it will stop changing under the code.
541 *
542 * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE,
543 * pmd_read_atomic is allowed to return a not atomic pmdval
544 * (for example pointing to an hugepage that has never been
545 * mapped in the pmd). The below checks will only care about
546 * the low part of the pmd with 32bit PAE x86 anyway, with the
547 * exception of pmd_none(). So the important thing is that if
548 * the low part of the pmd is found null, the high part will
549 * be also null or the pmd_none() check below would be
550 * confused.
551 */
552#ifdef CONFIG_TRANSPARENT_HUGEPAGE
553 barrier();
554#endif
555 if (pmd_none(pmdval))
556 return 1;
557 if (unlikely(pmd_bad(pmdval))) {
558 if (!pmd_trans_huge(pmdval))
559 pmd_clear_bad(pmd);
560 return 1;
561 }
562 return 0;
563}
564
565/*
566 * This is a noop if Transparent Hugepage Support is not built into
567 * the kernel. Otherwise it is equivalent to
568 * pmd_none_or_trans_huge_or_clear_bad(), and shall only be called in
569 * places that already verified the pmd is not none and they want to
570 * walk ptes while holding the mmap sem in read mode (write mode don't
571 * need this). If THP is not enabled, the pmd can't go away under the
572 * code even if MADV_DONTNEED runs, but if THP is enabled we need to
573 * run a pmd_trans_unstable before walking the ptes after
574 * split_huge_page_pmd returns (because it may have run when the pmd
575 * become null, but then a page fault can map in a THP and not a
576 * regular page).
577 */
578static inline int pmd_trans_unstable(pmd_t *pmd)
579{
580#ifdef CONFIG_TRANSPARENT_HUGEPAGE
581 return pmd_none_or_trans_huge_or_clear_bad(pmd);
582#else
583 return 0;
584#endif
585}
586
587#ifdef CONFIG_NUMA_BALANCING
588#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
589/*
590 * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the
591 * same bit too). It's set only when _PAGE_PRESET is not set and it's
592 * never set if _PAGE_PRESENT is set.
593 *
594 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
595 * fault triggers on those regions if pte/pmd_numa returns true
596 * (because _PAGE_PRESENT is not set).
597 */
598#ifndef pte_numa
599static inline int pte_numa(pte_t pte)
600{
601 return (pte_flags(pte) &
602 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
603}
604#endif
605
606#ifndef pmd_numa
607static inline int pmd_numa(pmd_t pmd)
608{
609 return (pmd_flags(pmd) &
610 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
611}
612#endif
613
614/*
615 * pte/pmd_mknuma sets the _PAGE_ACCESSED bitflag automatically
616 * because they're called by the NUMA hinting minor page fault. If we
617 * wouldn't set the _PAGE_ACCESSED bitflag here, the TLB miss handler
618 * would be forced to set it later while filling the TLB after we
619 * return to userland. That would trigger a second write to memory
620 * that we optimize away by setting _PAGE_ACCESSED here.
621 */
622#ifndef pte_mknonnuma
623static inline pte_t pte_mknonnuma(pte_t pte)
624{
625 pte = pte_clear_flags(pte, _PAGE_NUMA);
626 return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED);
627}
628#endif
629
630#ifndef pmd_mknonnuma
631static inline pmd_t pmd_mknonnuma(pmd_t pmd)
632{
633 pmd = pmd_clear_flags(pmd, _PAGE_NUMA);
634 return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED);
635}
636#endif
637
638#ifndef pte_mknuma
639static inline pte_t pte_mknuma(pte_t pte)
640{
641 pte = pte_set_flags(pte, _PAGE_NUMA);
642 return pte_clear_flags(pte, _PAGE_PRESENT);
643}
644#endif
645
646#ifndef pmd_mknuma
647static inline pmd_t pmd_mknuma(pmd_t pmd)
648{
649 pmd = pmd_set_flags(pmd, _PAGE_NUMA);
650 return pmd_clear_flags(pmd, _PAGE_PRESENT);
651}
652#endif 444#endif
653#else
654extern int pte_numa(pte_t pte);
655extern int pmd_numa(pmd_t pmd);
656extern pte_t pte_mknonnuma(pte_t pte);
657extern pmd_t pmd_mknonnuma(pmd_t pmd);
658extern pte_t pte_mknuma(pte_t pte);
659extern pmd_t pmd_mknuma(pmd_t pmd);
660#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
661#else
662static inline int pmd_numa(pmd_t pmd)
663{
664 return 0;
665}
666
667static inline int pte_numa(pte_t pte)
668{
669 return 0;
670}
671
672static inline pte_t pte_mknonnuma(pte_t pte)
673{
674 return pte;
675}
676
677static inline pmd_t pmd_mknonnuma(pmd_t pmd)
678{
679 return pmd;
680}
681
682static inline pte_t pte_mknuma(pte_t pte)
683{
684 return pte;
685}
686
687static inline pmd_t pmd_mknuma(pmd_t pmd)
688{
689 return pmd;
690}
691#endif /* CONFIG_NUMA_BALANCING */
692
693#endif /* CONFIG_MMU */
694 445
695#endif /* !__ASSEMBLY__ */ 446#endif /* !__ASSEMBLY__ */
696 447
diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index b4ea8f50fc6..61fa862fe08 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -1,8 +1,70 @@
1#ifndef _ASM_GENERIC_RESOURCE_H 1#ifndef _ASM_GENERIC_RESOURCE_H
2#define _ASM_GENERIC_RESOURCE_H 2#define _ASM_GENERIC_RESOURCE_H
3 3
4#include <uapi/asm-generic/resource.h> 4/*
5 * Resource limit IDs
6 *
7 * ( Compatibility detail: there are architectures that have
8 * a different rlimit ID order in the 5-9 range and want
9 * to keep that order for binary compatibility. The reasons
10 * are historic and all new rlimits are identical across all
11 * arches. If an arch has such special order for some rlimits
12 * then it defines them prior including asm-generic/resource.h. )
13 */
14
15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */
19#define RLIMIT_CORE 4 /* max core file size */
20
21#ifndef RLIMIT_RSS
22# define RLIMIT_RSS 5 /* max resident set size */
23#endif
24
25#ifndef RLIMIT_NPROC
26# define RLIMIT_NPROC 6 /* max number of processes */
27#endif
28
29#ifndef RLIMIT_NOFILE
30# define RLIMIT_NOFILE 7 /* max number of open files */
31#endif
5 32
33#ifndef RLIMIT_MEMLOCK
34# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
35#endif
36
37#ifndef RLIMIT_AS
38# define RLIMIT_AS 9 /* address space limit */
39#endif
40
41#define RLIMIT_LOCKS 10 /* maximum file locks held */
42#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
43#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
44#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
45 0-39 for nice level 19 .. -20 */
46#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
47#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
48#define RLIM_NLIMITS 16
49
50/*
51 * SuS says limits have to be unsigned.
52 * Which makes a ton more sense anyway.
53 *
54 * Some architectures override this (for compatibility reasons):
55 */
56#ifndef RLIM_INFINITY
57# define RLIM_INFINITY (~0UL)
58#endif
59
60/*
61 * RLIMIT_STACK default maximum - some architectures override it:
62 */
63#ifndef _STK_LIM_MAX
64# define _STK_LIM_MAX RLIM_INFINITY
65#endif
66
67#ifdef __KERNEL__
6 68
7/* 69/*
8 * boot-time rlimit defaults for the init task: 70 * boot-time rlimit defaults for the init task:
@@ -27,4 +89,6 @@
27 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \ 89 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \
28} 90}
29 91
92#endif /* __KERNEL__ */
93
30#endif 94#endif
diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h
deleted file mode 100644
index bb1e2cdeb9b..00000000000
--- a/include/asm-generic/rwsem.h
+++ /dev/null
@@ -1,132 +0,0 @@
1#ifndef _ASM_POWERPC_RWSEM_H
2#define _ASM_POWERPC_RWSEM_H
3
4#ifndef _LINUX_RWSEM_H
5#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
6#endif
7
8#ifdef __KERNEL__
9
10/*
11 * R/W semaphores for PPC using the stuff in lib/rwsem.c.
12 * Adapted largely from include/asm-i386/rwsem.h
13 * by Paul Mackerras <paulus@samba.org>.
14 */
15
16/*
17 * the semaphore definition
18 */
19#ifdef CONFIG_PPC64
20# define RWSEM_ACTIVE_MASK 0xffffffffL
21#else
22# define RWSEM_ACTIVE_MASK 0x0000ffffL
23#endif
24
25#define RWSEM_UNLOCKED_VALUE 0x00000000L
26#define RWSEM_ACTIVE_BIAS 0x00000001L
27#define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1)
28#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
29#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
30
31/*
32 * lock for reading
33 */
34static inline void __down_read(struct rw_semaphore *sem)
35{
36 if (unlikely(atomic_long_inc_return((atomic_long_t *)&sem->count) <= 0))
37 rwsem_down_read_failed(sem);
38}
39
40static inline int __down_read_trylock(struct rw_semaphore *sem)
41{
42 long tmp;
43
44 while ((tmp = sem->count) >= 0) {
45 if (tmp == cmpxchg(&sem->count, tmp,
46 tmp + RWSEM_ACTIVE_READ_BIAS)) {
47 return 1;
48 }
49 }
50 return 0;
51}
52
53/*
54 * lock for writing
55 */
56static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
57{
58 long tmp;
59
60 tmp = atomic_long_add_return(RWSEM_ACTIVE_WRITE_BIAS,
61 (atomic_long_t *)&sem->count);
62 if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS))
63 rwsem_down_write_failed(sem);
64}
65
66static inline void __down_write(struct rw_semaphore *sem)
67{
68 __down_write_nested(sem, 0);
69}
70
71static inline int __down_write_trylock(struct rw_semaphore *sem)
72{
73 long tmp;
74
75 tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE,
76 RWSEM_ACTIVE_WRITE_BIAS);
77 return tmp == RWSEM_UNLOCKED_VALUE;
78}
79
80/*
81 * unlock after reading
82 */
83static inline void __up_read(struct rw_semaphore *sem)
84{
85 long tmp;
86
87 tmp = atomic_long_dec_return((atomic_long_t *)&sem->count);
88 if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0))
89 rwsem_wake(sem);
90}
91
92/*
93 * unlock after writing
94 */
95static inline void __up_write(struct rw_semaphore *sem)
96{
97 if (unlikely(atomic_long_sub_return(RWSEM_ACTIVE_WRITE_BIAS,
98 (atomic_long_t *)&sem->count) < 0))
99 rwsem_wake(sem);
100}
101
102/*
103 * implement atomic add functionality
104 */
105static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
106{
107 atomic_long_add(delta, (atomic_long_t *)&sem->count);
108}
109
110/*
111 * downgrade write lock to read lock
112 */
113static inline void __downgrade_write(struct rw_semaphore *sem)
114{
115 long tmp;
116
117 tmp = atomic_long_add_return(-RWSEM_WAITING_BIAS,
118 (atomic_long_t *)&sem->count);
119 if (tmp < 0)
120 rwsem_downgrade_wake(sem);
121}
122
123/*
124 * implement exchange and add functionality
125 */
126static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
127{
128 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);
129}
130
131#endif /* __KERNEL__ */
132#endif /* _ASM_POWERPC_RWSEM_H */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index b685d3bd32e..0dd4e87f6fb 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -1,8 +1,123 @@
1#ifndef _ASM_GENERIC_SIGINFO_H 1#ifndef _ASM_GENERIC_SIGINFO_H
2#define _ASM_GENERIC_SIGINFO_H 2#define _ASM_GENERIC_SIGINFO_H
3 3
4#include <uapi/asm-generic/siginfo.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12/*
13 * This is the size (including padding) of the part of the
14 * struct siginfo that is before the union.
15 */
16#ifndef __ARCH_SI_PREAMBLE_SIZE
17#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
18#endif
19
20#define SI_MAX_SIZE 128
21#ifndef SI_PAD_SIZE
22#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
23#endif
24
25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif
28
29/*
30 * The default "si_band" type is "long", as specified by POSIX.
31 * However, some architectures want to override this to "int"
32 * for historical compatibility reasons, so we allow that.
33 */
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef HAVE_ARCH_SIGINFO_T
39
40typedef struct siginfo {
41 int si_signo;
42 int si_errno;
43 int si_code;
44
45 union {
46 int _pad[SI_PAD_SIZE];
47
48 /* kill() */
49 struct {
50 __kernel_pid_t _pid; /* sender's pid */
51 __ARCH_SI_UID_T _uid; /* sender's uid */
52 } _kill;
53
54 /* POSIX.1b timers */
55 struct {
56 __kernel_timer_t _tid; /* timer id */
57 int _overrun; /* overrun count */
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval; /* same as below */
60 int _sys_private; /* not to be passed to user */
61 } _timer;
62
63 /* POSIX.1b signals */
64 struct {
65 __kernel_pid_t _pid; /* sender's pid */
66 __ARCH_SI_UID_T _uid; /* sender's uid */
67 sigval_t _sigval;
68 } _rt;
69
70 /* SIGCHLD */
71 struct {
72 __kernel_pid_t _pid; /* which child */
73 __ARCH_SI_UID_T _uid; /* sender's uid */
74 int _status; /* exit code */
75 __kernel_clock_t _utime;
76 __kernel_clock_t _stime;
77 } _sigchld;
78
79 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
80 struct {
81 void __user *_addr; /* faulting insn/memory ref. */
82#ifdef __ARCH_SI_TRAPNO
83 int _trapno; /* TRAP # which caused the signal */
84#endif
85 short _addr_lsb; /* LSB of the reported address */
86 } _sigfault;
87
88 /* SIGPOLL */
89 struct {
90 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
91 int _fd;
92 } _sigpoll;
93 } _sifields;
94} siginfo_t;
95
96#endif
97
98/*
99 * How these fields are to be accessed.
100 */
101#define si_pid _sifields._kill._pid
102#define si_uid _sifields._kill._uid
103#define si_tid _sifields._timer._tid
104#define si_overrun _sifields._timer._overrun
105#define si_sys_private _sifields._timer._sys_private
106#define si_status _sifields._sigchld._status
107#define si_utime _sifields._sigchld._utime
108#define si_stime _sifields._sigchld._stime
109#define si_value _sifields._rt._sigval
110#define si_int _sifields._rt._sigval.sival_int
111#define si_ptr _sifields._rt._sigval.sival_ptr
112#define si_addr _sifields._sigfault._addr
113#ifdef __ARCH_SI_TRAPNO
114#define si_trapno _sifields._sigfault._trapno
115#endif
116#define si_addr_lsb _sifields._sigfault._addr_lsb
117#define si_band _sifields._sigpoll._band
118#define si_fd _sifields._sigpoll._fd
119
120#ifdef __KERNEL__
6#define __SI_MASK 0xffff0000u 121#define __SI_MASK 0xffff0000u
7#define __SI_KILL (0 << 16) 122#define __SI_KILL (0 << 16)
8#define __SI_TIMER (1 << 16) 123#define __SI_TIMER (1 << 16)
@@ -11,8 +126,156 @@
11#define __SI_CHLD (4 << 16) 126#define __SI_CHLD (4 << 16)
12#define __SI_RT (5 << 16) 127#define __SI_RT (5 << 16)
13#define __SI_MESGQ (6 << 16) 128#define __SI_MESGQ (6 << 16)
14#define __SI_SYS (7 << 16)
15#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 129#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
130#else
131#define __SI_KILL 0
132#define __SI_TIMER 0
133#define __SI_POLL 0
134#define __SI_FAULT 0
135#define __SI_CHLD 0
136#define __SI_RT 0
137#define __SI_MESGQ 0
138#define __SI_CODE(T,N) (N)
139#endif
140
141/*
142 * si_code values
143 * Digital reserves positive values for kernel-generated signals.
144 */
145#define SI_USER 0 /* sent by kill, sigsend, raise */
146#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
147#define SI_QUEUE -1 /* sent by sigqueue */
148#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
149#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
150#define SI_ASYNCIO -4 /* sent by AIO completion */
151#define SI_SIGIO -5 /* sent by queued SIGIO */
152#define SI_TKILL -6 /* sent by tkill system call */
153#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
154
155#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
156#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
157
158/*
159 * SIGILL si_codes
160 */
161#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
162#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
163#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
164#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
165#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
166#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
167#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
168#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
169#define NSIGILL 8
170
171/*
172 * SIGFPE si_codes
173 */
174#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
175#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
176#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
177#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
178#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
179#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
180#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
181#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
182#define NSIGFPE 8
183
184/*
185 * SIGSEGV si_codes
186 */
187#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
188#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
189#define NSIGSEGV 2
190
191/*
192 * SIGBUS si_codes
193 */
194#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
195#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
196#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
197/* hardware memory error consumed on a machine check: action required */
198#define BUS_MCEERR_AR (__SI_FAULT|4)
199/* hardware memory error detected in process but not consumed: action optional*/
200#define BUS_MCEERR_AO (__SI_FAULT|5)
201#define NSIGBUS 5
202
203/*
204 * SIGTRAP si_codes
205 */
206#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
207#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
208#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
209#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
210#define NSIGTRAP 4
211
212/*
213 * SIGCHLD si_codes
214 */
215#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
216#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
217#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
218#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
219#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
220#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
221#define NSIGCHLD 6
222
223/*
224 * SIGPOLL si_codes
225 */
226#define POLL_IN (__SI_POLL|1) /* data input available */
227#define POLL_OUT (__SI_POLL|2) /* output buffers available */
228#define POLL_MSG (__SI_POLL|3) /* input message available */
229#define POLL_ERR (__SI_POLL|4) /* i/o error */
230#define POLL_PRI (__SI_POLL|5) /* high priority input available */
231#define POLL_HUP (__SI_POLL|6) /* device disconnected */
232#define NSIGPOLL 6
233
234/*
235 * sigevent definitions
236 *
237 * It seems likely that SIGEV_THREAD will have to be handled from
238 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
239 * thread manager then catches and does the appropriate nonsense.
240 * However, everything is written out here so as to not get lost.
241 */
242#define SIGEV_SIGNAL 0 /* notify via signal */
243#define SIGEV_NONE 1 /* other notification: meaningless */
244#define SIGEV_THREAD 2 /* deliver via thread creation */
245#define SIGEV_THREAD_ID 4 /* deliver to thread */
246
247/*
248 * This works because the alignment is ok on all current architectures
249 * but we leave open this being overridden in the future
250 */
251#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
252#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
253#endif
254
255#define SIGEV_MAX_SIZE 64
256#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
257 / sizeof(int))
258
259typedef struct sigevent {
260 sigval_t sigev_value;
261 int sigev_signo;
262 int sigev_notify;
263 union {
264 int _pad[SIGEV_PAD_SIZE];
265 int _tid;
266
267 struct {
268 void (*_function)(sigval_t);
269 void *_attribute; /* really pthread_attr_t */
270 } _sigev_thread;
271 } _sigev_un;
272} sigevent_t;
273
274#define sigev_notify_function _sigev_un._sigev_thread._function
275#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
276#define sigev_notify_thread_id _sigev_un._tid
277
278#ifdef __KERNEL__
16 279
17struct siginfo; 280struct siginfo;
18void do_schedule_next_timer(struct siginfo *info); 281void do_schedule_next_timer(struct siginfo *info);
@@ -34,4 +297,6 @@ static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
34 297
35extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from); 298extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
36 299
300#endif /* __KERNEL__ */
301
37#endif 302#endif
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index d840c90a157..555c0aee8a4 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -1,14 +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 <uapi/asm-generic/signal.h> 4#include <linux/types.h>
5
6#define _NSIG 64
7#define _NSIG_BPW __BITS_PER_LONG
8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9
10#define SIGHUP 1
11#define SIGINT 2
12#define SIGQUIT 3
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
52#endif
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
5 91
6#ifndef __ASSEMBLY__ 92#ifndef __ASSEMBLY__
93typedef struct {
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;
99
100#include <asm-generic/signal-defs.h>
101
102struct sigaction {
103 __sighandler_t sa_handler;
104 unsigned long sa_flags;
7#ifdef SA_RESTORER 105#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
8#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__
9 122
10#include <asm/sigcontext.h> 123#include <asm/sigcontext.h>
11#undef __HAVE_ARCH_SIG_BITOPS 124#undef __HAVE_ARCH_SIG_BITOPS
12 125
126#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127
128#endif /* __KERNEL__ */
13#endif /* __ASSEMBLY__ */ 129#endif /* __ASSEMBLY__ */
130
14#endif /* _ASM_GENERIC_SIGNAL_H */ 131#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/sizes.h b/include/asm-generic/sizes.h
index 1dcfad9629e..ea5d4ef8106 100644
--- a/include/asm-generic/sizes.h
+++ b/include/asm-generic/sizes.h
@@ -1,2 +1,47 @@
1/* This is a placeholder, to be removed over time */ 1/*
2#include <linux/sizes.h> 2 * linux/include/asm-generic/sizes.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_GENERIC_SIZES_H__
9#define __ASM_GENERIC_SIZES_H__
10
11#define SZ_1 0x00000001
12#define SZ_2 0x00000002
13#define SZ_4 0x00000004
14#define SZ_8 0x00000008
15#define SZ_16 0x00000010
16#define SZ_32 0x00000020
17#define SZ_64 0x00000040
18#define SZ_128 0x00000080
19#define SZ_256 0x00000100
20#define SZ_512 0x00000200
21
22#define SZ_1K 0x00000400
23#define SZ_2K 0x00000800
24#define SZ_4K 0x00001000
25#define SZ_8K 0x00002000
26#define SZ_16K 0x00004000
27#define SZ_32K 0x00008000
28#define SZ_64K 0x00010000
29#define SZ_128K 0x00020000
30#define SZ_256K 0x00040000
31#define SZ_512K 0x00080000
32
33#define SZ_1M 0x00100000
34#define SZ_2M 0x00200000
35#define SZ_4M 0x00400000
36#define SZ_8M 0x00800000
37#define SZ_16M 0x01000000
38#define SZ_32M 0x02000000
39#define SZ_64M 0x04000000
40#define SZ_128M 0x08000000
41#define SZ_256M 0x10000000
42#define SZ_512M 0x20000000
43
44#define SZ_1G 0x40000000
45#define SZ_2G 0x80000000
46
47#endif /* __ASM_GENERIC_SIZES_H__ */
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 4b934e9ec97..0fd28e028de 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -1,7 +1,86 @@
1#ifndef _GENERIC_STATFS_H 1#ifndef _GENERIC_STATFS_H
2#define _GENERIC_STATFS_H 2#define _GENERIC_STATFS_H
3 3
4#include <uapi/asm-generic/statfs.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__
6typedef __kernel_fsid_t fsid_t; 7typedef __kernel_fsid_t fsid_t;
7#endif 8#endif
9
10/*
11 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
12 * Yes, they differ in signedness as well as size.
13 * Special cases can override it for themselves -- except for S390x, which
14 * is just a little too special for us. And MIPS, which I'm not touching
15 * with a 10' pole.
16 */
17#ifndef __statfs_word
18#if BITS_PER_LONG == 64
19#define __statfs_word long
20#else
21#define __statfs_word __u32
22#endif
23#endif
24
25struct statfs {
26 __statfs_word f_type;
27 __statfs_word f_bsize;
28 __statfs_word f_blocks;
29 __statfs_word f_bfree;
30 __statfs_word f_bavail;
31 __statfs_word f_files;
32 __statfs_word f_ffree;
33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen;
35 __statfs_word f_frsize;
36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
38};
39
40/*
41 * ARM needs to avoid the 32-bit padding at the end, for consistency
42 * between EABI and OABI
43 */
44#ifndef ARCH_PACK_STATFS64
45#define ARCH_PACK_STATFS64
46#endif
47
48struct statfs64 {
49 __statfs_word f_type;
50 __statfs_word f_bsize;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_bavail;
54 __u64 f_files;
55 __u64 f_ffree;
56 __kernel_fsid_t f_fsid;
57 __statfs_word f_namelen;
58 __statfs_word f_frsize;
59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
61} ARCH_PACK_STATFS64;
62
63/*
64 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
65 * to be compatible with the i386 ABI
66 */
67#ifndef ARCH_PACK_COMPAT_STATFS64
68#define ARCH_PACK_COMPAT_STATFS64
69#endif
70
71struct compat_statfs64 {
72 __u32 f_type;
73 __u32 f_bsize;
74 __u64 f_blocks;
75 __u64 f_bfree;
76 __u64 f_bavail;
77 __u64 f_files;
78 __u64 f_ffree;
79 __kernel_fsid_t f_fsid;
80 __u32 f_namelen;
81 __u32 f_frsize;
82 __u32 f_flags;
83 __u32 f_spare[4];
84} ARCH_PACK_COMPAT_STATFS64;
85
86#endif
diff --git a/include/asm-generic/switch_to.h b/include/asm-generic/switch_to.h
deleted file mode 100644
index 052c4ac04fd..00000000000
--- a/include/asm-generic/switch_to.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* Generic task switch macro wrapper, 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_SWITCH_TO_H
15#define __ASM_GENERIC_SWITCH_TO_H
16
17#include <linux/thread_info.h>
18
19/*
20 * Context switching is now performed out-of-line in switch_to.S
21 */
22extern struct task_struct *__switch_to(struct task_struct *,
23 struct task_struct *);
24
25#define switch_to(prev, next, last) \
26 do { \
27 ((last) = __switch_to((prev), (next))); \
28 } while (0)
29
30#endif /* __ASM_GENERIC_SWITCH_TO_H */
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 5b09392db67..5c122ae6bfa 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -142,18 +142,4 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
142 unsigned int i, unsigned int n, 142 unsigned int i, unsigned int n,
143 const unsigned long *args); 143 const unsigned long *args);
144 144
145/**
146 * syscall_get_arch - return the AUDIT_ARCH for the current system call
147 * @task: task of interest, must be in system call entry tracing
148 * @regs: task_pt_regs() of @task
149 *
150 * Returns the AUDIT_ARCH_* based on the system call convention in use.
151 *
152 * It's only valid to call this when @task is stopped on entry to a system
153 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
154 *
155 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
156 * provide an implementation of this.
157 */
158int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
159#endif /* _ASM_SYSCALL_H */ 145#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 58f466ff00d..d89dec864d4 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -8,6 +8,26 @@
8 * Calling conventions for these system calls can differ, so 8 * Calling conventions for these system calls can differ, so
9 * it's possible to override them. 9 * it's possible to override them.
10 */ 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(const char __user *filename,
27 const char __user *const __user *argv,
28 const char __user *const __user *envp,
29 struct pt_regs *regs);
30#endif
11 31
12#ifndef sys_mmap2 32#ifndef sys_mmap2
13asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 33asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index 4fa6fe0fc2a..d0922adc56d 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -1,9 +1,54 @@
1#ifndef _ASM_GENERIC_TERMIOS_H 1#ifndef _ASM_GENERIC_TERMIOS_H
2#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 */
3 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__
4 50
5#include <asm/uaccess.h> 51#include <asm/uaccess.h>
6#include <uapi/asm-generic/termios.h>
7 52
8/* intr=^C quit=^\ erase=del kill=^U 53/* intr=^C quit=^\ erase=del kill=^U
9 eof=^D vtime=\0 vmin=\1 sxtc=\0 54 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -104,4 +149,6 @@ static inline int kernel_termios_to_user_termios(struct termios __user *u,
104} 149}
105#endif /* TCGETS2 */ 150#endif /* TCGETS2 */
106 151
152#endif /* __KERNEL__ */
153
107#endif /* _ASM_GENERIC_TERMIOS_H */ 154#endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 25f01d0bc14..e58fa777fa0 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -78,14 +78,6 @@ struct mmu_gather_batch {
78#define MAX_GATHER_BATCH \ 78#define MAX_GATHER_BATCH \
79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *)) 79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *))
80 80
81/*
82 * Limit the maximum number of mmu_gather batches to reduce a risk of soft
83 * lockups for non-preemptible kernels on huge machines when a lot of memory
84 * is zapped during unmapping.
85 * 10K pages freed at once should be safe even without a preemption point.
86 */
87#define MAX_GATHER_BATCH_COUNT (10000UL/MAX_GATHER_BATCH)
88
89/* struct mmu_gather is an opaque type used by the mm code for passing around 81/* struct mmu_gather is an opaque type used by the mm code for passing around
90 * any data needed by arch specific code for tlb_remove_page. 82 * any data needed by arch specific code for tlb_remove_page.
91 */ 83 */
@@ -94,8 +86,6 @@ struct mmu_gather {
94#ifdef CONFIG_HAVE_RCU_TABLE_FREE 86#ifdef CONFIG_HAVE_RCU_TABLE_FREE
95 struct mmu_table_batch *batch; 87 struct mmu_table_batch *batch;
96#endif 88#endif
97 unsigned long start;
98 unsigned long end;
99 unsigned int need_flush : 1, /* Did free PTEs */ 89 unsigned int need_flush : 1, /* Did free PTEs */
100 fast_mode : 1; /* No batching */ 90 fast_mode : 1; /* No batching */
101 91
@@ -104,7 +94,6 @@ struct mmu_gather {
104 struct mmu_gather_batch *active; 94 struct mmu_gather_batch *active;
105 struct mmu_gather_batch local; 95 struct mmu_gather_batch local;
106 struct page *__pages[MMU_GATHER_BUNDLE]; 96 struct page *__pages[MMU_GATHER_BUNDLE];
107 unsigned int batch_count;
108}; 97};
109 98
110#define HAVE_GENERIC_MMU_GATHER 99#define HAVE_GENERIC_MMU_GATHER
@@ -124,8 +113,7 @@ static inline int tlb_fast_mode(struct mmu_gather *tlb)
124 113
125void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm); 114void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm);
126void tlb_flush_mmu(struct mmu_gather *tlb); 115void tlb_flush_mmu(struct mmu_gather *tlb);
127void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, 116void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end);
128 unsigned long end);
129int __tlb_remove_page(struct mmu_gather *tlb, struct page *page); 117int __tlb_remove_page(struct mmu_gather *tlb, struct page *page);
130 118
131/* tlb_remove_page 119/* tlb_remove_page
@@ -151,20 +139,6 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
151 __tlb_remove_tlb_entry(tlb, ptep, address); \ 139 __tlb_remove_tlb_entry(tlb, ptep, address); \
152 } while (0) 140 } while (0)
153 141
154/**
155 * tlb_remove_pmd_tlb_entry - remember a pmd mapping for later tlb invalidation
156 * This is a nop so far, because only x86 needs it.
157 */
158#ifndef __tlb_remove_pmd_tlb_entry
159#define __tlb_remove_pmd_tlb_entry(tlb, pmdp, address) do {} while (0)
160#endif
161
162#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
163 do { \
164 tlb->need_flush = 1; \
165 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
166 } while (0)
167
168#define pte_free_tlb(tlb, ptep, address) \ 142#define pte_free_tlb(tlb, ptep, address) \
169 do { \ 143 do { \
170 tlb->need_flush = 1; \ 144 tlb->need_flush = 1; \
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h
index d6d0a88430f..c7af037024c 100644
--- a/include/asm-generic/tlbflush.h
+++ b/include/asm-generic/tlbflush.h
@@ -9,8 +9,6 @@
9#error need to implement an architecture specific asm/tlbflush.h 9#error need to implement an architecture specific asm/tlbflush.h
10#endif 10#endif
11 11
12#include <linux/bug.h>
13
14static inline void flush_tlb_mm(struct mm_struct *mm) 12static inline void flush_tlb_mm(struct mm_struct *mm)
15{ 13{
16 BUG(); 14 BUG();
diff --git a/include/asm-generic/trace_clock.h b/include/asm-generic/trace_clock.h
deleted file mode 100644
index 6726f1bafb5..00000000000
--- a/include/asm-generic/trace_clock.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_GENERIC_TRACE_CLOCK_H
2#define _ASM_GENERIC_TRACE_CLOCK_H
3/*
4 * Arch-specific trace clocks.
5 */
6
7/*
8 * Additional trace clocks added to the trace_clocks
9 * array in kernel/trace/trace.c
10 * None if the architecture has not defined it.
11 */
12#ifndef ARCH_TRACE_CLOCKS
13# define ARCH_TRACE_CLOCKS
14#endif
15
16#endif /* _ASM_GENERIC_TRACE_CLOCK_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 9788568f797..ac68c999b6c 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -289,14 +289,9 @@ strncpy_from_user(char *dst, const char __user *src, long count)
289 * Return 0 on exception, a value greater than N if too long 289 * Return 0 on exception, a value greater than N if too long
290 */ 290 */
291#ifndef __strnlen_user 291#ifndef __strnlen_user
292#define __strnlen_user(s, n) (strnlen((s), (n)) + 1) 292#define __strnlen_user strnlen
293#endif 293#endif
294 294
295/*
296 * Unlike strnlen, strnlen_user includes the nul terminator in
297 * its returned count. Callers should check for a returned value
298 * greater than N as an indication the string is too long.
299 */
300static inline long strnlen_user(const char __user *src, long n) 295static inline long strnlen_user(const char __user *src, long n)
301{ 296{
302 if (!access_ok(VERIFY_READ, src, 1)) 297 if (!access_ok(VERIFY_READ, src, 1))
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index a36991ab334..f4c38d8c667 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -1,4 +1,902 @@
1#include <uapi/asm-generic/unistd.h> 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 || defined(__SYSCALL_COMPAT)
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#ifdef __SYSCALL_COMPAT
28#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
29#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
30#else
31#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
32#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
33#endif
34
35#define __NR_io_setup 0
36__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
37#define __NR_io_destroy 1
38__SYSCALL(__NR_io_destroy, sys_io_destroy)
39#define __NR_io_submit 2
40__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
41#define __NR_io_cancel 3
42__SYSCALL(__NR_io_cancel, sys_io_cancel)
43#define __NR_io_getevents 4
44__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
45
46/* fs/xattr.c */
47#define __NR_setxattr 5
48__SYSCALL(__NR_setxattr, sys_setxattr)
49#define __NR_lsetxattr 6
50__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
51#define __NR_fsetxattr 7
52__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
53#define __NR_getxattr 8
54__SYSCALL(__NR_getxattr, sys_getxattr)
55#define __NR_lgetxattr 9
56__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
57#define __NR_fgetxattr 10
58__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
59#define __NR_listxattr 11
60__SYSCALL(__NR_listxattr, sys_listxattr)
61#define __NR_llistxattr 12
62__SYSCALL(__NR_llistxattr, sys_llistxattr)
63#define __NR_flistxattr 13
64__SYSCALL(__NR_flistxattr, sys_flistxattr)
65#define __NR_removexattr 14
66__SYSCALL(__NR_removexattr, sys_removexattr)
67#define __NR_lremovexattr 15
68__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
69#define __NR_fremovexattr 16
70__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
71
72/* fs/dcache.c */
73#define __NR_getcwd 17
74__SYSCALL(__NR_getcwd, sys_getcwd)
75
76/* fs/cookies.c */
77#define __NR_lookup_dcookie 18
78__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
79
80/* fs/eventfd.c */
81#define __NR_eventfd2 19
82__SYSCALL(__NR_eventfd2, sys_eventfd2)
83
84/* fs/eventpoll.c */
85#define __NR_epoll_create1 20
86__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
87#define __NR_epoll_ctl 21
88__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
89#define __NR_epoll_pwait 22
90__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
91
92/* fs/fcntl.c */
93#define __NR_dup 23
94__SYSCALL(__NR_dup, sys_dup)
95#define __NR_dup3 24
96__SYSCALL(__NR_dup3, sys_dup3)
97#define __NR3264_fcntl 25
98__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
99
100/* fs/inotify_user.c */
101#define __NR_inotify_init1 26
102__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
103#define __NR_inotify_add_watch 27
104__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
105#define __NR_inotify_rm_watch 28
106__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
107
108/* fs/ioctl.c */
109#define __NR_ioctl 29
110__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
111
112/* fs/ioprio.c */
113#define __NR_ioprio_set 30
114__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
115#define __NR_ioprio_get 31
116__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
117
118/* fs/locks.c */
119#define __NR_flock 32
120__SYSCALL(__NR_flock, sys_flock)
121
122/* fs/namei.c */
123#define __NR_mknodat 33
124__SYSCALL(__NR_mknodat, sys_mknodat)
125#define __NR_mkdirat 34
126__SYSCALL(__NR_mkdirat, sys_mkdirat)
127#define __NR_unlinkat 35
128__SYSCALL(__NR_unlinkat, sys_unlinkat)
129#define __NR_symlinkat 36
130__SYSCALL(__NR_symlinkat, sys_symlinkat)
131#define __NR_linkat 37
132__SYSCALL(__NR_linkat, sys_linkat)
133#define __NR_renameat 38
134__SYSCALL(__NR_renameat, sys_renameat)
135
136/* fs/namespace.c */
137#define __NR_umount2 39
138__SYSCALL(__NR_umount2, sys_umount)
139#define __NR_mount 40
140__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
141#define __NR_pivot_root 41
142__SYSCALL(__NR_pivot_root, sys_pivot_root)
143
144/* fs/nfsctl.c */
145#define __NR_nfsservctl 42
146__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
147
148/* fs/open.c */
149#define __NR3264_statfs 43
150__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
151 compat_sys_statfs64)
152#define __NR3264_fstatfs 44
153__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
154 compat_sys_fstatfs64)
155#define __NR3264_truncate 45
156__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
157 compat_sys_truncate64)
158#define __NR3264_ftruncate 46
159__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
160 compat_sys_ftruncate64)
161
162#define __NR_fallocate 47
163__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
164#define __NR_faccessat 48
165__SYSCALL(__NR_faccessat, sys_faccessat)
166#define __NR_chdir 49
167__SYSCALL(__NR_chdir, sys_chdir)
168#define __NR_fchdir 50
169__SYSCALL(__NR_fchdir, sys_fchdir)
170#define __NR_chroot 51
171__SYSCALL(__NR_chroot, sys_chroot)
172#define __NR_fchmod 52
173__SYSCALL(__NR_fchmod, sys_fchmod)
174#define __NR_fchmodat 53
175__SYSCALL(__NR_fchmodat, sys_fchmodat)
176#define __NR_fchownat 54
177__SYSCALL(__NR_fchownat, sys_fchownat)
178#define __NR_fchown 55
179__SYSCALL(__NR_fchown, sys_fchown)
180#define __NR_openat 56
181__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
182#define __NR_close 57
183__SYSCALL(__NR_close, sys_close)
184#define __NR_vhangup 58
185__SYSCALL(__NR_vhangup, sys_vhangup)
186
187/* fs/pipe.c */
188#define __NR_pipe2 59
189__SYSCALL(__NR_pipe2, sys_pipe2)
190
191/* fs/quota.c */
192#define __NR_quotactl 60
193__SYSCALL(__NR_quotactl, sys_quotactl)
194
195/* fs/readdir.c */
196#define __NR_getdents64 61
197__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
198
199/* fs/read_write.c */
200#define __NR3264_lseek 62
201__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
202#define __NR_read 63
203__SYSCALL(__NR_read, sys_read)
204#define __NR_write 64
205__SYSCALL(__NR_write, sys_write)
206#define __NR_readv 65
207__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
208#define __NR_writev 66
209__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
210#define __NR_pread64 67
211__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
212#define __NR_pwrite64 68
213__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
214#define __NR_preadv 69
215__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
216#define __NR_pwritev 70
217__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
218
219/* fs/sendfile.c */
220#define __NR3264_sendfile 71
221__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile)
222
223/* fs/select.c */
224#define __NR_pselect6 72
225__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
226#define __NR_ppoll 73
227__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
228
229/* fs/signalfd.c */
230#define __NR_signalfd4 74
231__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
232
233/* fs/splice.c */
234#define __NR_vmsplice 75
235__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
236#define __NR_splice 76
237__SYSCALL(__NR_splice, sys_splice)
238#define __NR_tee 77
239__SYSCALL(__NR_tee, sys_tee)
240
241/* fs/stat.c */
242#define __NR_readlinkat 78
243__SYSCALL(__NR_readlinkat, sys_readlinkat)
244#define __NR3264_fstatat 79
245__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
246#define __NR3264_fstat 80
247__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
248
249/* fs/sync.c */
250#define __NR_sync 81
251__SYSCALL(__NR_sync, sys_sync)
252#define __NR_fsync 82
253__SYSCALL(__NR_fsync, sys_fsync)
254#define __NR_fdatasync 83
255__SYSCALL(__NR_fdatasync, sys_fdatasync)
256#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
257#define __NR_sync_file_range2 84
258__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
259 compat_sys_sync_file_range2)
260#else
261#define __NR_sync_file_range 84
262__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
263 compat_sys_sync_file_range)
264#endif
265
266/* fs/timerfd.c */
267#define __NR_timerfd_create 85
268__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
269#define __NR_timerfd_settime 86
270__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
271 compat_sys_timerfd_settime)
272#define __NR_timerfd_gettime 87
273__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
274 compat_sys_timerfd_gettime)
275
276/* fs/utimes.c */
277#define __NR_utimensat 88
278__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
279
280/* kernel/acct.c */
281#define __NR_acct 89
282__SYSCALL(__NR_acct, sys_acct)
283
284/* kernel/capability.c */
285#define __NR_capget 90
286__SYSCALL(__NR_capget, sys_capget)
287#define __NR_capset 91
288__SYSCALL(__NR_capset, sys_capset)
289
290/* kernel/exec_domain.c */
291#define __NR_personality 92
292__SYSCALL(__NR_personality, sys_personality)
293
294/* kernel/exit.c */
295#define __NR_exit 93
296__SYSCALL(__NR_exit, sys_exit)
297#define __NR_exit_group 94
298__SYSCALL(__NR_exit_group, sys_exit_group)
299#define __NR_waitid 95
300__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
301
302/* kernel/fork.c */
303#define __NR_set_tid_address 96
304__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
305#define __NR_unshare 97
306__SYSCALL(__NR_unshare, sys_unshare)
307
308/* kernel/futex.c */
309#define __NR_futex 98
310__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
311#define __NR_set_robust_list 99
312__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
313 compat_sys_set_robust_list)
314#define __NR_get_robust_list 100
315__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
316 compat_sys_get_robust_list)
317
318/* kernel/hrtimer.c */
319#define __NR_nanosleep 101
320__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
321
322/* kernel/itimer.c */
323#define __NR_getitimer 102
324__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
325#define __NR_setitimer 103
326__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
327
328/* kernel/kexec.c */
329#define __NR_kexec_load 104
330__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
331
332/* kernel/module.c */
333#define __NR_init_module 105
334__SYSCALL(__NR_init_module, sys_init_module)
335#define __NR_delete_module 106
336__SYSCALL(__NR_delete_module, sys_delete_module)
337
338/* kernel/posix-timers.c */
339#define __NR_timer_create 107
340__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
341#define __NR_timer_gettime 108
342__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
343#define __NR_timer_getoverrun 109
344__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
345#define __NR_timer_settime 110
346__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
347#define __NR_timer_delete 111
348__SYSCALL(__NR_timer_delete, sys_timer_delete)
349#define __NR_clock_settime 112
350__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
351#define __NR_clock_gettime 113
352__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
353#define __NR_clock_getres 114
354__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
355#define __NR_clock_nanosleep 115
356__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
357 compat_sys_clock_nanosleep)
358
359/* kernel/printk.c */
360#define __NR_syslog 116
361__SYSCALL(__NR_syslog, sys_syslog)
362
363/* kernel/ptrace.c */
364#define __NR_ptrace 117
365__SYSCALL(__NR_ptrace, sys_ptrace)
366
367/* kernel/sched.c */
368#define __NR_sched_setparam 118
369__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
370#define __NR_sched_setscheduler 119
371__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
372#define __NR_sched_getscheduler 120
373__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
374#define __NR_sched_getparam 121
375__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
376#define __NR_sched_setaffinity 122
377__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
378 compat_sys_sched_setaffinity)
379#define __NR_sched_getaffinity 123
380__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
381 compat_sys_sched_getaffinity)
382#define __NR_sched_yield 124
383__SYSCALL(__NR_sched_yield, sys_sched_yield)
384#define __NR_sched_get_priority_max 125
385__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
386#define __NR_sched_get_priority_min 126
387__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
388#define __NR_sched_rr_get_interval 127
389__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
390 compat_sys_sched_rr_get_interval)
391
392/* kernel/signal.c */
393#define __NR_restart_syscall 128
394__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
395#define __NR_kill 129
396__SYSCALL(__NR_kill, sys_kill)
397#define __NR_tkill 130
398__SYSCALL(__NR_tkill, sys_tkill)
399#define __NR_tgkill 131
400__SYSCALL(__NR_tgkill, sys_tgkill)
401#define __NR_sigaltstack 132
402__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
403#define __NR_rt_sigsuspend 133
404__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
405#define __NR_rt_sigaction 134
406__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
407#define __NR_rt_sigprocmask 135
408__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
409#define __NR_rt_sigpending 136
410__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
411#define __NR_rt_sigtimedwait 137
412__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
413 compat_sys_rt_sigtimedwait)
414#define __NR_rt_sigqueueinfo 138
415__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
416 compat_sys_rt_sigqueueinfo)
417#define __NR_rt_sigreturn 139
418__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
419
420/* kernel/sys.c */
421#define __NR_setpriority 140
422__SYSCALL(__NR_setpriority, sys_setpriority)
423#define __NR_getpriority 141
424__SYSCALL(__NR_getpriority, sys_getpriority)
425#define __NR_reboot 142
426__SYSCALL(__NR_reboot, sys_reboot)
427#define __NR_setregid 143
428__SYSCALL(__NR_setregid, sys_setregid)
429#define __NR_setgid 144
430__SYSCALL(__NR_setgid, sys_setgid)
431#define __NR_setreuid 145
432__SYSCALL(__NR_setreuid, sys_setreuid)
433#define __NR_setuid 146
434__SYSCALL(__NR_setuid, sys_setuid)
435#define __NR_setresuid 147
436__SYSCALL(__NR_setresuid, sys_setresuid)
437#define __NR_getresuid 148
438__SYSCALL(__NR_getresuid, sys_getresuid)
439#define __NR_setresgid 149
440__SYSCALL(__NR_setresgid, sys_setresgid)
441#define __NR_getresgid 150
442__SYSCALL(__NR_getresgid, sys_getresgid)
443#define __NR_setfsuid 151
444__SYSCALL(__NR_setfsuid, sys_setfsuid)
445#define __NR_setfsgid 152
446__SYSCALL(__NR_setfsgid, sys_setfsgid)
447#define __NR_times 153
448__SC_COMP(__NR_times, sys_times, compat_sys_times)
449#define __NR_setpgid 154
450__SYSCALL(__NR_setpgid, sys_setpgid)
451#define __NR_getpgid 155
452__SYSCALL(__NR_getpgid, sys_getpgid)
453#define __NR_getsid 156
454__SYSCALL(__NR_getsid, sys_getsid)
455#define __NR_setsid 157
456__SYSCALL(__NR_setsid, sys_setsid)
457#define __NR_getgroups 158
458__SYSCALL(__NR_getgroups, sys_getgroups)
459#define __NR_setgroups 159
460__SYSCALL(__NR_setgroups, sys_setgroups)
461#define __NR_uname 160
462__SYSCALL(__NR_uname, sys_newuname)
463#define __NR_sethostname 161
464__SYSCALL(__NR_sethostname, sys_sethostname)
465#define __NR_setdomainname 162
466__SYSCALL(__NR_setdomainname, sys_setdomainname)
467#define __NR_getrlimit 163
468__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
469#define __NR_setrlimit 164
470__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
471#define __NR_getrusage 165
472__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
473#define __NR_umask 166
474__SYSCALL(__NR_umask, sys_umask)
475#define __NR_prctl 167
476__SYSCALL(__NR_prctl, sys_prctl)
477#define __NR_getcpu 168
478__SYSCALL(__NR_getcpu, sys_getcpu)
479
480/* kernel/time.c */
481#define __NR_gettimeofday 169
482__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
483#define __NR_settimeofday 170
484__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
485#define __NR_adjtimex 171
486__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
487
488/* kernel/timer.c */
489#define __NR_getpid 172
490__SYSCALL(__NR_getpid, sys_getpid)
491#define __NR_getppid 173
492__SYSCALL(__NR_getppid, sys_getppid)
493#define __NR_getuid 174
494__SYSCALL(__NR_getuid, sys_getuid)
495#define __NR_geteuid 175
496__SYSCALL(__NR_geteuid, sys_geteuid)
497#define __NR_getgid 176
498__SYSCALL(__NR_getgid, sys_getgid)
499#define __NR_getegid 177
500__SYSCALL(__NR_getegid, sys_getegid)
501#define __NR_gettid 178
502__SYSCALL(__NR_gettid, sys_gettid)
503#define __NR_sysinfo 179
504__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
505
506/* ipc/mqueue.c */
507#define __NR_mq_open 180
508__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
509#define __NR_mq_unlink 181
510__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
511#define __NR_mq_timedsend 182
512__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
513#define __NR_mq_timedreceive 183
514__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
515 compat_sys_mq_timedreceive)
516#define __NR_mq_notify 184
517__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
518#define __NR_mq_getsetattr 185
519__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
520
521/* ipc/msg.c */
522#define __NR_msgget 186
523__SYSCALL(__NR_msgget, sys_msgget)
524#define __NR_msgctl 187
525__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
526#define __NR_msgrcv 188
527__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
528#define __NR_msgsnd 189
529__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
530
531/* ipc/sem.c */
532#define __NR_semget 190
533__SYSCALL(__NR_semget, sys_semget)
534#define __NR_semctl 191
535__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
536#define __NR_semtimedop 192
537__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
538#define __NR_semop 193
539__SYSCALL(__NR_semop, sys_semop)
540
541/* ipc/shm.c */
542#define __NR_shmget 194
543__SYSCALL(__NR_shmget, sys_shmget)
544#define __NR_shmctl 195
545__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
546#define __NR_shmat 196
547__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
548#define __NR_shmdt 197
549__SYSCALL(__NR_shmdt, sys_shmdt)
550
551/* net/socket.c */
552#define __NR_socket 198
553__SYSCALL(__NR_socket, sys_socket)
554#define __NR_socketpair 199
555__SYSCALL(__NR_socketpair, sys_socketpair)
556#define __NR_bind 200
557__SYSCALL(__NR_bind, sys_bind)
558#define __NR_listen 201
559__SYSCALL(__NR_listen, sys_listen)
560#define __NR_accept 202
561__SYSCALL(__NR_accept, sys_accept)
562#define __NR_connect 203
563__SYSCALL(__NR_connect, sys_connect)
564#define __NR_getsockname 204
565__SYSCALL(__NR_getsockname, sys_getsockname)
566#define __NR_getpeername 205
567__SYSCALL(__NR_getpeername, sys_getpeername)
568#define __NR_sendto 206
569__SYSCALL(__NR_sendto, sys_sendto)
570#define __NR_recvfrom 207
571__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
572#define __NR_setsockopt 208
573__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
574#define __NR_getsockopt 209
575__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
576#define __NR_shutdown 210
577__SYSCALL(__NR_shutdown, sys_shutdown)
578#define __NR_sendmsg 211
579__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
580#define __NR_recvmsg 212
581__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
582
583/* mm/filemap.c */
584#define __NR_readahead 213
585__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
586
587/* mm/nommu.c, also with MMU */
588#define __NR_brk 214
589__SYSCALL(__NR_brk, sys_brk)
590#define __NR_munmap 215
591__SYSCALL(__NR_munmap, sys_munmap)
592#define __NR_mremap 216
593__SYSCALL(__NR_mremap, sys_mremap)
594
595/* security/keys/keyctl.c */
596#define __NR_add_key 217
597__SYSCALL(__NR_add_key, sys_add_key)
598#define __NR_request_key 218
599__SYSCALL(__NR_request_key, sys_request_key)
600#define __NR_keyctl 219
601__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
602
603/* arch/example/kernel/sys_example.c */
604#define __NR_clone 220
605__SYSCALL(__NR_clone, sys_clone)
606#define __NR_execve 221
607__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
608
609#define __NR3264_mmap 222
610__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
611/* mm/fadvise.c */
612#define __NR3264_fadvise64 223
613__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
614
615/* mm/, CONFIG_MMU only */
616#ifndef __ARCH_NOMMU
617#define __NR_swapon 224
618__SYSCALL(__NR_swapon, sys_swapon)
619#define __NR_swapoff 225
620__SYSCALL(__NR_swapoff, sys_swapoff)
621#define __NR_mprotect 226
622__SYSCALL(__NR_mprotect, sys_mprotect)
623#define __NR_msync 227
624__SYSCALL(__NR_msync, sys_msync)
625#define __NR_mlock 228
626__SYSCALL(__NR_mlock, sys_mlock)
627#define __NR_munlock 229
628__SYSCALL(__NR_munlock, sys_munlock)
629#define __NR_mlockall 230
630__SYSCALL(__NR_mlockall, sys_mlockall)
631#define __NR_munlockall 231
632__SYSCALL(__NR_munlockall, sys_munlockall)
633#define __NR_mincore 232
634__SYSCALL(__NR_mincore, sys_mincore)
635#define __NR_madvise 233
636__SYSCALL(__NR_madvise, sys_madvise)
637#define __NR_remap_file_pages 234
638__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
639#define __NR_mbind 235
640__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
641#define __NR_get_mempolicy 236
642__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
643#define __NR_set_mempolicy 237
644__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
645#define __NR_migrate_pages 238
646__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
647#define __NR_move_pages 239
648__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
649#endif
650
651#define __NR_rt_tgsigqueueinfo 240
652__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
653 compat_sys_rt_tgsigqueueinfo)
654#define __NR_perf_event_open 241
655__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
656#define __NR_accept4 242
657__SYSCALL(__NR_accept4, sys_accept4)
658#define __NR_recvmmsg 243
659__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
660
661/*
662 * Architectures may provide up to 16 syscalls of their own
663 * starting with this value.
664 */
665#define __NR_arch_specific_syscall 244
666
667#define __NR_wait4 260
668__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
669#define __NR_prlimit64 261
670__SYSCALL(__NR_prlimit64, sys_prlimit64)
671#define __NR_fanotify_init 262
672__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
673#define __NR_fanotify_mark 263
674__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
675#define __NR_name_to_handle_at 264
676__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
677#define __NR_open_by_handle_at 265
678__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
679 compat_sys_open_by_handle_at)
680#define __NR_clock_adjtime 266
681__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
682#define __NR_syncfs 267
683__SYSCALL(__NR_syncfs, sys_syncfs)
684#define __NR_setns 268
685__SYSCALL(__NR_setns, sys_setns)
686#define __NR_sendmmsg 269
687__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
688
689#undef __NR_syscalls
690#define __NR_syscalls 270
691
692/*
693 * All syscalls below here should go away really,
694 * these are provided for both review and as a porting
695 * help for the C library version.
696*
697 * Last chance: are any of these important enough to
698 * enable by default?
699 */
700#ifdef __ARCH_WANT_SYSCALL_NO_AT
701#define __NR_open 1024
702__SYSCALL(__NR_open, sys_open)
703#define __NR_link 1025
704__SYSCALL(__NR_link, sys_link)
705#define __NR_unlink 1026
706__SYSCALL(__NR_unlink, sys_unlink)
707#define __NR_mknod 1027
708__SYSCALL(__NR_mknod, sys_mknod)
709#define __NR_chmod 1028
710__SYSCALL(__NR_chmod, sys_chmod)
711#define __NR_chown 1029
712__SYSCALL(__NR_chown, sys_chown)
713#define __NR_mkdir 1030
714__SYSCALL(__NR_mkdir, sys_mkdir)
715#define __NR_rmdir 1031
716__SYSCALL(__NR_rmdir, sys_rmdir)
717#define __NR_lchown 1032
718__SYSCALL(__NR_lchown, sys_lchown)
719#define __NR_access 1033
720__SYSCALL(__NR_access, sys_access)
721#define __NR_rename 1034
722__SYSCALL(__NR_rename, sys_rename)
723#define __NR_readlink 1035
724__SYSCALL(__NR_readlink, sys_readlink)
725#define __NR_symlink 1036
726__SYSCALL(__NR_symlink, sys_symlink)
727#define __NR_utimes 1037
728__SYSCALL(__NR_utimes, sys_utimes)
729#define __NR3264_stat 1038
730__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
731#define __NR3264_lstat 1039
732__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
733
734#undef __NR_syscalls
735#define __NR_syscalls (__NR3264_lstat+1)
736#endif /* __ARCH_WANT_SYSCALL_NO_AT */
737
738#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
739#define __NR_pipe 1040
740__SYSCALL(__NR_pipe, sys_pipe)
741#define __NR_dup2 1041
742__SYSCALL(__NR_dup2, sys_dup2)
743#define __NR_epoll_create 1042
744__SYSCALL(__NR_epoll_create, sys_epoll_create)
745#define __NR_inotify_init 1043
746__SYSCALL(__NR_inotify_init, sys_inotify_init)
747#define __NR_eventfd 1044
748__SYSCALL(__NR_eventfd, sys_eventfd)
749#define __NR_signalfd 1045
750__SYSCALL(__NR_signalfd, sys_signalfd)
751
752#undef __NR_syscalls
753#define __NR_syscalls (__NR_signalfd+1)
754#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
755
756#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
757 defined(__ARCH_WANT_SYSCALL_OFF_T)
758#define __NR_sendfile 1046
759__SYSCALL(__NR_sendfile, sys_sendfile)
760#define __NR_ftruncate 1047
761__SYSCALL(__NR_ftruncate, sys_ftruncate)
762#define __NR_truncate 1048
763__SYSCALL(__NR_truncate, sys_truncate)
764#define __NR_stat 1049
765__SYSCALL(__NR_stat, sys_newstat)
766#define __NR_lstat 1050
767__SYSCALL(__NR_lstat, sys_newlstat)
768#define __NR_fstat 1051
769__SYSCALL(__NR_fstat, sys_newfstat)
770#define __NR_fcntl 1052
771__SYSCALL(__NR_fcntl, sys_fcntl)
772#define __NR_fadvise64 1053
773#define __ARCH_WANT_SYS_FADVISE64
774__SYSCALL(__NR_fadvise64, sys_fadvise64)
775#define __NR_newfstatat 1054
776#define __ARCH_WANT_SYS_NEWFSTATAT
777__SYSCALL(__NR_newfstatat, sys_newfstatat)
778#define __NR_fstatfs 1055
779__SYSCALL(__NR_fstatfs, sys_fstatfs)
780#define __NR_statfs 1056
781__SYSCALL(__NR_statfs, sys_statfs)
782#define __NR_lseek 1057
783__SYSCALL(__NR_lseek, sys_lseek)
784#define __NR_mmap 1058
785__SYSCALL(__NR_mmap, sys_mmap)
786
787#undef __NR_syscalls
788#define __NR_syscalls (__NR_mmap+1)
789#endif /* 32 bit off_t syscalls */
790
791#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
792#define __NR_alarm 1059
793#define __ARCH_WANT_SYS_ALARM
794__SYSCALL(__NR_alarm, sys_alarm)
795#define __NR_getpgrp 1060
796#define __ARCH_WANT_SYS_GETPGRP
797__SYSCALL(__NR_getpgrp, sys_getpgrp)
798#define __NR_pause 1061
799#define __ARCH_WANT_SYS_PAUSE
800__SYSCALL(__NR_pause, sys_pause)
801#define __NR_time 1062
802#define __ARCH_WANT_SYS_TIME
803#define __ARCH_WANT_COMPAT_SYS_TIME
804__SYSCALL(__NR_time, sys_time)
805#define __NR_utime 1063
806#define __ARCH_WANT_SYS_UTIME
807__SYSCALL(__NR_utime, sys_utime)
808
809#define __NR_creat 1064
810__SYSCALL(__NR_creat, sys_creat)
811#define __NR_getdents 1065
812#define __ARCH_WANT_SYS_GETDENTS
813__SYSCALL(__NR_getdents, sys_getdents)
814#define __NR_futimesat 1066
815__SYSCALL(__NR_futimesat, sys_futimesat)
816#define __NR_select 1067
817#define __ARCH_WANT_SYS_SELECT
818__SYSCALL(__NR_select, sys_select)
819#define __NR_poll 1068
820__SYSCALL(__NR_poll, sys_poll)
821#define __NR_epoll_wait 1069
822__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
823#define __NR_ustat 1070
824__SYSCALL(__NR_ustat, sys_ustat)
825#define __NR_vfork 1071
826__SYSCALL(__NR_vfork, sys_vfork)
827#define __NR_oldwait4 1072
828__SYSCALL(__NR_oldwait4, sys_wait4)
829#define __NR_recv 1073
830__SYSCALL(__NR_recv, sys_recv)
831#define __NR_send 1074
832__SYSCALL(__NR_send, sys_send)
833#define __NR_bdflush 1075
834__SYSCALL(__NR_bdflush, sys_bdflush)
835#define __NR_umount 1076
836__SYSCALL(__NR_umount, sys_oldumount)
837#define __ARCH_WANT_SYS_OLDUMOUNT
838#define __NR_uselib 1077
839__SYSCALL(__NR_uselib, sys_uselib)
840#define __NR__sysctl 1078
841__SYSCALL(__NR__sysctl, sys_sysctl)
842
843#define __NR_fork 1079
844#ifdef CONFIG_MMU
845__SYSCALL(__NR_fork, sys_fork)
846#else
847__SYSCALL(__NR_fork, sys_ni_syscall)
848#endif /* CONFIG_MMU */
849
850#undef __NR_syscalls
851#define __NR_syscalls (__NR_fork+1)
852
853#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
854
855/*
856 * 32 bit systems traditionally used different
857 * syscalls for off_t and loff_t arguments, while
858 * 64 bit systems only need the off_t version.
859 * For new 32 bit platforms, there is no need to
860 * implement the old 32 bit off_t syscalls, so
861 * they take different names.
862 * Here we map the numbers so that both versions
863 * use the same syscall table layout.
864 */
865#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
866#define __NR_fcntl __NR3264_fcntl
867#define __NR_statfs __NR3264_statfs
868#define __NR_fstatfs __NR3264_fstatfs
869#define __NR_truncate __NR3264_truncate
870#define __NR_ftruncate __NR3264_ftruncate
871#define __NR_lseek __NR3264_lseek
872#define __NR_sendfile __NR3264_sendfile
873#define __NR_newfstatat __NR3264_fstatat
874#define __NR_fstat __NR3264_fstat
875#define __NR_mmap __NR3264_mmap
876#define __NR_fadvise64 __NR3264_fadvise64
877#ifdef __NR3264_stat
878#define __NR_stat __NR3264_stat
879#define __NR_lstat __NR3264_lstat
880#endif
881#else
882#define __NR_fcntl64 __NR3264_fcntl
883#define __NR_statfs64 __NR3264_statfs
884#define __NR_fstatfs64 __NR3264_fstatfs
885#define __NR_truncate64 __NR3264_truncate
886#define __NR_ftruncate64 __NR3264_ftruncate
887#define __NR_llseek __NR3264_lseek
888#define __NR_sendfile64 __NR3264_sendfile
889#define __NR_fstatat64 __NR3264_fstatat
890#define __NR_fstat64 __NR3264_fstat
891#define __NR_mmap2 __NR3264_mmap
892#define __NR_fadvise64_64 __NR3264_fadvise64
893#ifdef __NR3264_stat
894#define __NR_stat64 __NR3264_stat
895#define __NR_lstat64 __NR3264_lstat
896#endif
897#endif
898
899#ifdef __KERNEL__
2 900
3/* 901/*
4 * These are required system calls, we should 902 * These are required system calls, we should
@@ -22,3 +920,6 @@
22#ifndef cond_syscall 920#ifndef cond_syscall
23#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 921#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
24#endif 922#endif
923
924#endif /* __KERNEL__ */
925#endif /* _ASM_GENERIC_UNISTD_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d1ea7ce0b4c..ff4d370a4e8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,7 +167,6 @@
167 CPU_KEEP(exit.data) \ 167 CPU_KEEP(exit.data) \
168 MEM_KEEP(init.data) \ 168 MEM_KEEP(init.data) \
169 MEM_KEEP(exit.data) \ 169 MEM_KEEP(exit.data) \
170 *(.data.unlikely) \
171 STRUCT_ALIGN(); \ 170 STRUCT_ALIGN(); \
172 *(__tracepoints) \ 171 *(__tracepoints) \
173 /* implement dynamic printk debug */ \ 172 /* implement dynamic printk debug */ \
@@ -223,6 +222,7 @@
223 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ 222 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
224 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\ 223 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
225 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \ 224 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
225 *(__markers_strings) /* Markers: strings */ \
226 *(__tracepoints_strings)/* Tracepoints: strings */ \ 226 *(__tracepoints_strings)/* Tracepoints: strings */ \
227 } \ 227 } \
228 \ 228 \
@@ -473,7 +473,7 @@
473#ifdef CONFIG_CONSTRUCTORS 473#ifdef CONFIG_CONSTRUCTORS
474#define KERNEL_CTORS() . = ALIGN(8); \ 474#define KERNEL_CTORS() . = ALIGN(8); \
475 VMLINUX_SYMBOL(__ctors_start) = .; \ 475 VMLINUX_SYMBOL(__ctors_start) = .; \
476 *(.ctors) \ 476 *(CONFIG_GCOV_CTORS) \
477 VMLINUX_SYMBOL(__ctors_end) = .; 477 VMLINUX_SYMBOL(__ctors_end) = .;
478#else 478#else
479#define KERNEL_CTORS() 479#define KERNEL_CTORS()
@@ -486,8 +486,8 @@
486 CPU_DISCARD(init.data) \ 486 CPU_DISCARD(init.data) \
487 MEM_DISCARD(init.data) \ 487 MEM_DISCARD(init.data) \
488 KERNEL_CTORS() \ 488 KERNEL_CTORS() \
489 MCOUNT_REC() \
490 *(.init.rodata) \ 489 *(.init.rodata) \
490 MCOUNT_REC() \
491 FTRACE_EVENTS() \ 491 FTRACE_EVENTS() \
492 TRACE_SYSCALLS() \ 492 TRACE_SYSCALLS() \
493 DEV_DISCARD(init.rodata) \ 493 DEV_DISCARD(init.rodata) \
@@ -530,18 +530,9 @@
530 *(.scommon) \ 530 *(.scommon) \
531 } 531 }
532 532
533/*
534 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
535 * sections to the front of bss.
536 */
537#ifndef BSS_FIRST_SECTIONS
538#define BSS_FIRST_SECTIONS
539#endif
540
541#define BSS(bss_align) \ 533#define BSS(bss_align) \
542 . = ALIGN(bss_align); \ 534 . = ALIGN(bss_align); \
543 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ 535 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
544 BSS_FIRST_SECTIONS \
545 *(.bss..page_aligned) \ 536 *(.bss..page_aligned) \
546 *(.dynbss) \ 537 *(.dynbss) \
547 *(.bss) \ 538 *(.bss) \
@@ -625,23 +616,30 @@
625 *(.init.setup) \ 616 *(.init.setup) \
626 VMLINUX_SYMBOL(__setup_end) = .; 617 VMLINUX_SYMBOL(__setup_end) = .;
627 618
628#define INIT_CALLS_LEVEL(level) \ 619#define INITCALLS \
629 VMLINUX_SYMBOL(__initcall##level##_start) = .; \ 620 *(.initcallearly.init) \
630 *(.initcall##level##.init) \ 621 VMLINUX_SYMBOL(__early_initcall_end) = .; \
631 *(.initcall##level##s.init) \ 622 *(.initcall0.init) \
623 *(.initcall0s.init) \
624 *(.initcall1.init) \
625 *(.initcall1s.init) \
626 *(.initcall2.init) \
627 *(.initcall2s.init) \
628 *(.initcall3.init) \
629 *(.initcall3s.init) \
630 *(.initcall4.init) \
631 *(.initcall4s.init) \
632 *(.initcall5.init) \
633 *(.initcall5s.init) \
634 *(.initcallrootfs.init) \
635 *(.initcall6.init) \
636 *(.initcall6s.init) \
637 *(.initcall7.init) \
638 *(.initcall7s.init)
632 639
633#define INIT_CALLS \ 640#define INIT_CALLS \
634 VMLINUX_SYMBOL(__initcall_start) = .; \ 641 VMLINUX_SYMBOL(__initcall_start) = .; \
635 *(.initcallearly.init) \ 642 INITCALLS \
636 INIT_CALLS_LEVEL(0) \
637 INIT_CALLS_LEVEL(1) \
638 INIT_CALLS_LEVEL(2) \
639 INIT_CALLS_LEVEL(3) \
640 INIT_CALLS_LEVEL(4) \
641 INIT_CALLS_LEVEL(5) \
642 INIT_CALLS_LEVEL(rootfs) \
643 INIT_CALLS_LEVEL(6) \
644 INIT_CALLS_LEVEL(7) \
645 VMLINUX_SYMBOL(__initcall_end) = .; 643 VMLINUX_SYMBOL(__initcall_end) = .;
646 644
647#define CON_INITCALL \ 645#define CON_INITCALL \
diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h
deleted file mode 100644
index 3f21f1b72e4..00000000000
--- a/include/asm-generic/word-at-a-time.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _ASM_WORD_AT_A_TIME_H
2#define _ASM_WORD_AT_A_TIME_H
3
4/*
5 * This says "generic", but it's actually big-endian only.
6 * Little-endian can use more efficient versions of these
7 * interfaces, see for example
8 * arch/x86/include/asm/word-at-a-time.h
9 * for those.
10 */
11
12#include <linux/kernel.h>
13
14struct word_at_a_time {
15 const unsigned long high_bits, low_bits;
16};
17
18#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0xfe) + 1, REPEAT_BYTE(0x7f) }
19
20/* Bit set in the bytes that have a zero */
21static inline long prep_zero_mask(unsigned long val, unsigned long rhs, const struct word_at_a_time *c)
22{
23 unsigned long mask = (val & c->low_bits) + c->low_bits;
24 return ~(mask | rhs);
25}
26
27#define create_zero_mask(mask) (mask)
28
29static inline long find_zero(unsigned long mask)
30{
31 long byte = 0;
32#ifdef CONFIG_64BIT
33 if (mask >> 32)
34 mask >>= 32;
35 else
36 byte = 4;
37#endif
38 if (mask >> 16)
39 mask >>= 16;
40 else
41 byte += 2;
42 return (mask >> 8) ? byte : byte + 1;
43}
44
45static inline bool has_zero(unsigned long val, unsigned long *data, const struct word_at_a_time *c)
46{
47 unsigned long rhs = val | c->low_bits;
48 *data = rhs;
49 return (val + c->high_bits) & ~rhs;
50}
51
52#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/include/asm-generic/xor.h b/include/asm-generic/xor.h
index b4d843225af..6028fb86225 100644
--- a/include/asm-generic/xor.h
+++ b/include/asm-generic/xor.h
@@ -693,7 +693,7 @@ static struct xor_block_template xor_block_32regs = {
693 .do_5 = xor_32regs_5, 693 .do_5 = xor_32regs_5,
694}; 694};
695 695
696static struct xor_block_template xor_block_8regs_p __maybe_unused = { 696static struct xor_block_template xor_block_8regs_p = {
697 .name = "8regs_prefetch", 697 .name = "8regs_prefetch",
698 .do_2 = xor_8regs_p_2, 698 .do_2 = xor_8regs_p_2,
699 .do_3 = xor_8regs_p_3, 699 .do_3 = xor_8regs_p_3,
@@ -701,7 +701,7 @@ static struct xor_block_template xor_block_8regs_p __maybe_unused = {
701 .do_5 = xor_8regs_p_5, 701 .do_5 = xor_8regs_p_5,
702}; 702};
703 703
704static struct xor_block_template xor_block_32regs_p __maybe_unused = { 704static struct xor_block_template xor_block_32regs_p = {
705 .name = "32regs_prefetch", 705 .name = "32regs_prefetch",
706 .do_2 = xor_32regs_p_2, 706 .do_2 = xor_32regs_p_2,
707 .do_3 = xor_32regs_p_3, 707 .do_3 = xor_32regs_p_3,