aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/elf.h3
-rw-r--r--include/asm-alpha/page.h3
-rw-r--r--include/asm-alpha/system.h15
-rw-r--r--include/asm-alpha/user.h2
-rw-r--r--include/asm-arm/elf.h3
-rw-r--r--include/asm-arm/page.h5
-rw-r--r--include/asm-arm/system.h15
-rw-r--r--include/asm-arm/user.h2
-rw-r--r--include/asm-avr32/elf.h2
-rw-r--r--include/asm-avr32/page.h4
-rw-r--r--include/asm-avr32/system.h23
-rw-r--r--include/asm-avr32/user.h2
-rw-r--r--include/asm-blackfin/elf.h2
-rw-r--r--include/asm-blackfin/page.h3
-rw-r--r--include/asm-blackfin/system.h57
-rw-r--r--include/asm-blackfin/user.h2
-rw-r--r--include/asm-cris/elf.h3
-rw-r--r--include/asm-cris/page.h4
-rw-r--r--include/asm-cris/system.h15
-rw-r--r--include/asm-cris/user.h2
-rw-r--r--include/asm-frv/Kbuild1
-rw-r--r--include/asm-frv/elf.h2
-rw-r--r--include/asm-frv/page.h4
-rw-r--r--include/asm-frv/system.h24
-rw-r--r--include/asm-generic/Kbuild.asm5
-rw-r--r--include/asm-generic/cmpxchg-local.h65
-rw-r--r--include/asm-generic/cmpxchg.h22
-rw-r--r--include/asm-h8300/elf.h2
-rw-r--r--include/asm-h8300/page.h4
-rw-r--r--include/asm-h8300/system.h15
-rw-r--r--include/asm-h8300/user.h3
-rw-r--r--include/asm-ia64/elf.h3
-rw-r--r--include/asm-ia64/intrinsics.h12
-rw-r--r--include/asm-ia64/page.h3
-rw-r--r--include/asm-ia64/user.h2
-rw-r--r--include/asm-m32r/elf.h2
-rw-r--r--include/asm-m32r/local.h362
-rw-r--r--include/asm-m32r/page.h2
-rw-r--r--include/asm-m32r/system.h115
-rw-r--r--include/asm-m32r/user.h2
-rw-r--r--include/asm-m68k/elf.h2
-rw-r--r--include/asm-m68k/motorola_pgtable.h3
-rw-r--r--include/asm-m68k/page.h5
-rw-r--r--include/asm-m68k/system.h27
-rw-r--r--include/asm-m68k/user.h3
-rw-r--r--include/asm-m68knommu/elf.h2
-rw-r--r--include/asm-m68knommu/page.h4
-rw-r--r--include/asm-m68knommu/system.h28
-rw-r--r--include/asm-mips/cmpxchg.h17
-rw-r--r--include/asm-mips/elf.h4
-rw-r--r--include/asm-mips/page.h5
-rw-r--r--include/asm-mips/user.h6
-rw-r--r--include/asm-parisc/atomic.h33
-rw-r--r--include/asm-parisc/elf.h3
-rw-r--r--include/asm-parisc/page.h4
-rw-r--r--include/asm-powerpc/cputable.h2
-rw-r--r--include/asm-powerpc/dcr-native.h47
-rw-r--r--include/asm-powerpc/elf.h2
-rw-r--r--include/asm-powerpc/mpc512x.h22
-rw-r--r--include/asm-powerpc/mpc52xx_psc.h48
-rw-r--r--include/asm-powerpc/oprofile_impl.h2
-rw-r--r--include/asm-powerpc/page.h3
-rw-r--r--include/asm-powerpc/page_32.h2
-rw-r--r--include/asm-powerpc/page_64.h2
-rw-r--r--include/asm-powerpc/ptrace.h2
-rw-r--r--include/asm-powerpc/reg.h4
-rw-r--r--include/asm-powerpc/reg_booke.h62
-rw-r--r--include/asm-powerpc/reg_fsl_emb.h72
-rw-r--r--include/asm-powerpc/system.h20
-rw-r--r--include/asm-powerpc/user.h6
-rw-r--r--include/asm-powerpc/vio.h2
-rw-r--r--include/asm-ppc/system.h51
-rw-r--r--include/asm-s390/elf.h2
-rw-r--r--include/asm-s390/kexec.h2
-rw-r--r--include/asm-s390/page.h3
-rw-r--r--include/asm-s390/system.h44
-rw-r--r--include/asm-s390/user.h3
-rw-r--r--include/asm-sh/page.h3
-rw-r--r--include/asm-sh/user.h2
-rw-r--r--include/asm-sparc/atomic.h36
-rw-r--r--include/asm-sparc/elf.h3
-rw-r--r--include/asm-sparc/page.h4
-rw-r--r--include/asm-sparc/system.h48
-rw-r--r--include/asm-sparc64/elf.h4
-rw-r--r--include/asm-sparc64/page.h3
-rw-r--r--include/asm-sparc64/system.h29
-rw-r--r--include/asm-v850/elf.h2
-rw-r--r--include/asm-v850/page.h4
-rw-r--r--include/asm-v850/system.h15
-rw-r--r--include/asm-v850/user.h6
-rw-r--r--include/asm-x86/Kbuild2
-rw-r--r--include/asm-x86/cmpxchg_64.h22
-rw-r--r--include/asm-x86/elf.h3
-rw-r--r--include/asm-x86/mmzone_32.h4
-rw-r--r--include/asm-x86/termios.h74
-rw-r--r--include/asm-x86/user.h14
-rw-r--r--include/asm-x86/user_32.h2
-rw-r--r--include/asm-x86/user_64.h2
-rw-r--r--include/asm-xtensa/elf.h3
-rw-r--r--include/asm-xtensa/page.h3
-rw-r--r--include/asm-xtensa/system.h22
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/a.out.h8
-rw-r--r--include/linux/bootmem.h17
-rw-r--r--include/linux/cgroup.h16
-rw-r--r--include/linux/cgroup_subsys.h5
-rw-r--r--include/linux/cpufreq.h4
-rw-r--r--include/linux/ds1wm.h1
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/elf.h3
-rw-r--r--include/linux/elfcore.h4
-rw-r--r--include/linux/err.h13
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/ext4_fs.h2
-rw-r--r--include/linux/fs.h19
-rw-r--r--include/linux/hayesesp.h4
-rw-r--r--include/linux/isicom.h2
-rw-r--r--include/linux/istallion.h1
-rw-r--r--include/linux/kexec.h12
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/memcontrol.h190
-rw-r--r--include/linux/mfd/asic3.h497
-rw-r--r--include/linux/mm_types.h6
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/qnx4_fs.h1
-rw-r--r--include/linux/res_counter.h127
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/serial167.h14
-rw-r--r--include/linux/shm.h8
-rw-r--r--include/linux/stallion.h1
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/linux/tty.h7
133 files changed, 2177 insertions, 485 deletions
diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h
index 4b518e3b952c..fc1002ea1e0c 100644
--- a/include/asm-alpha/elf.h
+++ b/include/asm-alpha/elf.h
@@ -144,8 +144,6 @@ extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
144 : amask (AMASK_CIX) ? "ev6" : "ev67"); \ 144 : amask (AMASK_CIX) ? "ev6" : "ev67"); \
145}) 145})
146 146
147#ifdef __KERNEL__
148
149#define SET_PERSONALITY(EX, IBCS2) \ 147#define SET_PERSONALITY(EX, IBCS2) \
150 set_personality(((EX).e_flags & EF_ALPHA_32BIT) \ 148 set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
151 ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX) 149 ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
@@ -164,5 +162,4 @@ extern int alpha_l3_cacheshape;
164 NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape); \ 162 NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape); \
165 } while (0) 163 } while (0)
166 164
167#endif /* __KERNEL__ */
168#endif /* __ASM_ALPHA_ELF_H */ 165#endif /* __ASM_ALPHA_ELF_H */
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index 8cc97bfd3789..05f09f997d82 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -1,8 +1,6 @@
1#ifndef _ALPHA_PAGE_H 1#ifndef _ALPHA_PAGE_H
2#define _ALPHA_PAGE_H 2#define _ALPHA_PAGE_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/const.h> 4#include <linux/const.h>
7#include <asm/pal.h> 5#include <asm/pal.h>
8 6
@@ -98,5 +96,4 @@ typedef unsigned long pgprot_t;
98#include <asm-generic/memory_model.h> 96#include <asm-generic/memory_model.h>
99#include <asm-generic/page.h> 97#include <asm-generic/page.h>
100 98
101#endif /* __KERNEL__ */
102#endif /* _ALPHA_PAGE_H */ 99#endif /* _ALPHA_PAGE_H */
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index fd9dc889f36c..ed221d6408fc 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -681,13 +681,18 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
681 return old; 681 return old;
682} 682}
683 683
684#define cmpxchg(ptr,o,n) \ 684#define cmpxchg(ptr, o, n) \
685 ({ \ 685 ({ \
686 __typeof__(*(ptr)) _o_ = (o); \ 686 __typeof__(*(ptr)) _o_ = (o); \
687 __typeof__(*(ptr)) _n_ = (n); \ 687 __typeof__(*(ptr)) _n_ = (n); \
688 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ 688 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
689 (unsigned long)_n_, sizeof(*(ptr))); \ 689 (unsigned long)_n_, sizeof(*(ptr))); \
690 }) 690 })
691#define cmpxchg64(ptr, o, n) \
692 ({ \
693 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
694 cmpxchg((ptr), (o), (n)); \
695 })
691 696
692static inline unsigned long 697static inline unsigned long
693__cmpxchg_u8_local(volatile char *m, long old, long new) 698__cmpxchg_u8_local(volatile char *m, long old, long new)
@@ -803,13 +808,19 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
803 return old; 808 return old;
804} 809}
805 810
806#define cmpxchg_local(ptr,o,n) \ 811#define cmpxchg_local(ptr, o, n) \
807 ({ \ 812 ({ \
808 __typeof__(*(ptr)) _o_ = (o); \ 813 __typeof__(*(ptr)) _o_ = (o); \
809 __typeof__(*(ptr)) _n_ = (n); \ 814 __typeof__(*(ptr)) _n_ = (n); \
810 (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ 815 (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
811 (unsigned long)_n_, sizeof(*(ptr))); \ 816 (unsigned long)_n_, sizeof(*(ptr))); \
812 }) 817 })
818#define cmpxchg64_local(ptr, o, n) \
819 ({ \
820 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
821 cmpxchg_local((ptr), (o), (n)); \
822 })
823
813 824
814#endif /* __ASSEMBLY__ */ 825#endif /* __ASSEMBLY__ */
815 826
diff --git a/include/asm-alpha/user.h b/include/asm-alpha/user.h
index 7e417fc9d491..a4eb6a4ca8d1 100644
--- a/include/asm-alpha/user.h
+++ b/include/asm-alpha/user.h
@@ -39,7 +39,7 @@ struct user {
39 unsigned long start_data; /* data starting address */ 39 unsigned long start_data; /* data starting address */
40 unsigned long start_stack; /* stack starting address */ 40 unsigned long start_stack; /* stack starting address */
41 long int signal; /* signal causing core dump */ 41 long int signal; /* signal causing core dump */
42 struct regs * u_ar0; /* help gdb find registers */ 42 unsigned long u_ar0; /* help gdb find registers */
43 unsigned long magic; /* identifies a core file */ 43 unsigned long magic; /* identifies a core file */
44 char u_comm[32]; /* user command name */ 44 char u_comm[32]; /* user command name */
45}; 45};
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index ec1c685562ce..4ca751627489 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -41,7 +41,6 @@ typedef struct user_fp elf_fpregset_t;
41#endif 41#endif
42#define ELF_ARCH EM_ARM 42#define ELF_ARCH EM_ARM
43 43
44#ifdef __KERNEL__
45#ifndef __ASSEMBLY__ 44#ifndef __ASSEMBLY__
46/* 45/*
47 * This yields a string that ld.so will use to load implementation 46 * This yields a string that ld.so will use to load implementation
@@ -115,5 +114,3 @@ extern char elf_platform[];
115 } while (0) 114 } while (0)
116 115
117#endif 116#endif
118
119#endif
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 7e85db77d99b..31ff12f4ffb7 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -10,9 +10,6 @@
10#ifndef _ASMARM_PAGE_H 10#ifndef _ASMARM_PAGE_H
11#define _ASMARM_PAGE_H 11#define _ASMARM_PAGE_H
12 12
13
14#ifdef __KERNEL__
15
16/* PAGE_SHIFT determines the page size */ 13/* PAGE_SHIFT determines the page size */
17#define PAGE_SHIFT 12 14#define PAGE_SHIFT 12
18#define PAGE_SIZE (1UL << PAGE_SHIFT) 15#define PAGE_SIZE (1UL << PAGE_SHIFT)
@@ -192,6 +189,4 @@ typedef unsigned long pgprot_t;
192 189
193#include <asm-generic/page.h> 190#include <asm-generic/page.h>
194 191
195#endif /* __KERNEL__ */
196
197#endif 192#endif
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 28425c473e71..6335de9a2bb3 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -363,6 +363,21 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
363extern void disable_hlt(void); 363extern void disable_hlt(void);
364extern void enable_hlt(void); 364extern void enable_hlt(void);
365 365
366#include <asm-generic/cmpxchg-local.h>
367
368/*
369 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
370 * them available.
371 */
372#define cmpxchg_local(ptr, o, n) \
373 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
374 (unsigned long)(n), sizeof(*(ptr))))
375#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
376
377#ifndef CONFIG_SMP
378#include <asm-generic/cmpxchg.h>
379#endif
380
366#endif /* __ASSEMBLY__ */ 381#endif /* __ASSEMBLY__ */
367 382
368#define arch_align_stack(x) (x) 383#define arch_align_stack(x) (x)
diff --git a/include/asm-arm/user.h b/include/asm-arm/user.h
index 3e8b0f879159..825c1e7c582d 100644
--- a/include/asm-arm/user.h
+++ b/include/asm-arm/user.h
@@ -67,7 +67,7 @@ struct user{
67 esp register. */ 67 esp register. */
68 long int signal; /* Signal that caused the core dump. */ 68 long int signal; /* Signal that caused the core dump. */
69 int reserved; /* No longer used */ 69 int reserved; /* No longer used */
70 struct pt_regs * u_ar0; /* Used by gdb to help find the values for */ 70 unsigned long u_ar0; /* Used by gdb to help find the values for */
71 /* the registers. */ 71 /* the registers. */
72 unsigned long magic; /* To uniquely identify a core file */ 72 unsigned long magic; /* To uniquely identify a core file */
73 char u_comm[32]; /* User command that was responsible */ 73 char u_comm[32]; /* User command that was responsible */
diff --git a/include/asm-avr32/elf.h b/include/asm-avr32/elf.h
index d334b4994d2d..64ce40ee1d58 100644
--- a/include/asm-avr32/elf.h
+++ b/include/asm-avr32/elf.h
@@ -103,8 +103,6 @@ typedef struct user_fpu_struct elf_fpregset_t;
103 103
104#define ELF_PLATFORM (NULL) 104#define ELF_PLATFORM (NULL)
105 105
106#ifdef __KERNEL__
107#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 106#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
108#endif
109 107
110#endif /* __ASM_AVR32_ELF_H */ 108#endif /* __ASM_AVR32_ELF_H */
diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h
index 0f630b3e9932..ee23499cec34 100644
--- a/include/asm-avr32/page.h
+++ b/include/asm-avr32/page.h
@@ -8,8 +8,6 @@
8#ifndef __ASM_AVR32_PAGE_H 8#ifndef __ASM_AVR32_PAGE_H
9#define __ASM_AVR32_PAGE_H 9#define __ASM_AVR32_PAGE_H
10 10
11#ifdef __KERNEL__
12
13/* PAGE_SHIFT determines the page size */ 11/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12 12#define PAGE_SHIFT 12
15#ifdef __ASSEMBLY__ 13#ifdef __ASSEMBLY__
@@ -107,6 +105,4 @@ static inline int get_order(unsigned long size)
107 */ 105 */
108#define HIGHMEM_START 0x20000000UL 106#define HIGHMEM_START 0x20000000UL
109 107
110#endif /* __KERNEL__ */
111
112#endif /* __ASM_AVR32_PAGE_H */ 108#endif /* __ASM_AVR32_PAGE_H */
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index c600cc15cbcb..9702c2213e1e 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -145,6 +145,29 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
145 (unsigned long)(new), \ 145 (unsigned long)(new), \
146 sizeof(*(ptr)))) 146 sizeof(*(ptr))))
147 147
148#include <asm-generic/cmpxchg-local.h>
149
150static inline unsigned long __cmpxchg_local(volatile void *ptr,
151 unsigned long old,
152 unsigned long new, int size)
153{
154 switch (size) {
155 case 4:
156 return __cmpxchg_u32(ptr, old, new);
157 default:
158 return __cmpxchg_local_generic(ptr, old, new, size);
159 }
160
161 return old;
162}
163
164#define cmpxchg_local(ptr, old, new) \
165 ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old), \
166 (unsigned long)(new), \
167 sizeof(*(ptr))))
168
169#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
170
148struct pt_regs; 171struct pt_regs;
149void NORET_TYPE die(const char *str, struct pt_regs *regs, long err); 172void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
150void _exception(long signr, struct pt_regs *regs, int code, 173void _exception(long signr, struct pt_regs *regs, int code,
diff --git a/include/asm-avr32/user.h b/include/asm-avr32/user.h
index 060fb3acee49..7e9152f81f5e 100644
--- a/include/asm-avr32/user.h
+++ b/include/asm-avr32/user.h
@@ -51,7 +51,7 @@ struct user {
51 unsigned long start_data; /* data starting address */ 51 unsigned long start_data; /* data starting address */
52 unsigned long start_stack; /* stack starting address */ 52 unsigned long start_stack; /* stack starting address */
53 long int signal; /* signal causing core dump */ 53 long int signal; /* signal causing core dump */
54 struct regs * u_ar0; /* help gdb find registers */ 54 unsigned long u_ar0; /* help gdb find registers */
55 unsigned long magic; /* identifies a core file */ 55 unsigned long magic; /* identifies a core file */
56 char u_comm[32]; /* user command name */ 56 char u_comm[32]; /* user command name */
57}; 57};
diff --git a/include/asm-blackfin/elf.h b/include/asm-blackfin/elf.h
index 5264b5536a70..30303fc8292c 100644
--- a/include/asm-blackfin/elf.h
+++ b/include/asm-blackfin/elf.h
@@ -120,8 +120,6 @@ do { \
120 120
121#define ELF_PLATFORM (NULL) 121#define ELF_PLATFORM (NULL)
122 122
123#ifdef __KERNEL__
124#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 123#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
125#endif
126 124
127#endif 125#endif
diff --git a/include/asm-blackfin/page.h b/include/asm-blackfin/page.h
index 8bc86717021c..d5c9d1433781 100644
--- a/include/asm-blackfin/page.h
+++ b/include/asm-blackfin/page.h
@@ -11,8 +11,6 @@
11#endif 11#endif
12#define PAGE_MASK (~(PAGE_SIZE-1)) 12#define PAGE_MASK (~(PAGE_SIZE-1))
13 13
14#ifdef __KERNEL__
15
16#include <asm/setup.h> 14#include <asm/setup.h>
17 15
18#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
@@ -88,6 +86,5 @@ extern unsigned long memory_end;
88#include <asm-generic/page.h> 86#include <asm-generic/page.h>
89 87
90#endif /* __ASSEMBLY__ */ 88#endif /* __ASSEMBLY__ */
91#endif /* __KERNEL__ */
92 89
93#endif /* _BLACKFIN_PAGE_H */ 90#endif /* _BLACKFIN_PAGE_H */
diff --git a/include/asm-blackfin/system.h b/include/asm-blackfin/system.h
index 4a927379ee1c..51494ef5bb41 100644
--- a/include/asm-blackfin/system.h
+++ b/include/asm-blackfin/system.h
@@ -183,55 +183,20 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
183 return tmp; 183 return tmp;
184} 184}
185 185
186#include <asm-generic/cmpxchg-local.h>
187
186/* 188/*
187 * Atomic compare and exchange. Compare OLD with MEM, if identical, 189 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
188 * store NEW in MEM. Return the initial value in MEM. Success is 190 * them available.
189 * indicated by comparing RETURN with OLD.
190 */ 191 */
191static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, 192#define cmpxchg_local(ptr, o, n) \
192 unsigned long new, int size) 193 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
193{ 194 (unsigned long)(n), sizeof(*(ptr))))
194 unsigned long tmp = 0; 195#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
195 unsigned long flags = 0;
196
197 local_irq_save(flags);
198
199 switch (size) {
200 case 1:
201 __asm__ __volatile__
202 ("%0 = b%3 (z);\n\t"
203 "CC = %1 == %0;\n\t"
204 "IF !CC JUMP 1f;\n\t"
205 "b%3 = %2;\n\t"
206 "1:\n\t"
207 : "=&d" (tmp) : "d" (old), "d" (new), "m" (*__xg(ptr)) : "memory");
208 break;
209 case 2:
210 __asm__ __volatile__
211 ("%0 = w%3 (z);\n\t"
212 "CC = %1 == %0;\n\t"
213 "IF !CC JUMP 1f;\n\t"
214 "w%3 = %2;\n\t"
215 "1:\n\t"
216 : "=&d" (tmp) : "d" (old), "d" (new), "m" (*__xg(ptr)) : "memory");
217 break;
218 case 4:
219 __asm__ __volatile__
220 ("%0 = %3;\n\t"
221 "CC = %1 == %0;\n\t"
222 "IF !CC JUMP 1f;\n\t"
223 "%3 = %2;\n\t"
224 "1:\n\t"
225 : "=&d" (tmp) : "d" (old), "d" (new), "m" (*__xg(ptr)) : "memory");
226 break;
227 }
228 local_irq_restore(flags);
229 return tmp;
230}
231 196
232#define cmpxchg(ptr,o,n)\ 197#ifndef CONFIG_SMP
233 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 198#include <asm-generic/cmpxchg.h>
234 (unsigned long)(n),sizeof(*(ptr)))) 199#endif
235 200
236#define prepare_to_switch() do { } while(0) 201#define prepare_to_switch() do { } while(0)
237 202
diff --git a/include/asm-blackfin/user.h b/include/asm-blackfin/user.h
index abc34629bd59..afe6a0e1f7ce 100644
--- a/include/asm-blackfin/user.h
+++ b/include/asm-blackfin/user.h
@@ -75,7 +75,7 @@ struct user {
75 esp register. */ 75 esp register. */
76 long int signal; /* Signal that caused the core dump. */ 76 long int signal; /* Signal that caused the core dump. */
77 int reserved; /* No longer used */ 77 int reserved; /* No longer used */
78 struct user_regs_struct *u_ar0; 78 unsigned long u_ar0;
79 /* Used by gdb to help find the values for */ 79 /* Used by gdb to help find the values for */
80 /* the registers. */ 80 /* the registers. */
81 unsigned long magic; /* To uniquely identify a core file */ 81 unsigned long magic; /* To uniquely identify a core file */
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index 96a40c1de57c..001f64ad11e8 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -45,7 +45,6 @@ typedef unsigned long elf_fpregset_t;
45#define ELF_DATA ELFDATA2LSB 45#define ELF_DATA ELFDATA2LSB
46#define ELF_ARCH EM_CRIS 46#define ELF_ARCH EM_CRIS
47 47
48#ifdef __KERNEL__
49#include <asm/arch/elf.h> 48#include <asm/arch/elf.h>
50 49
51/* The master for these definitions is {binutils}/include/elf/cris.h: */ 50/* The master for these definitions is {binutils}/include/elf/cris.h: */
@@ -91,6 +90,4 @@ typedef unsigned long elf_fpregset_t;
91 90
92#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 91#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
93 92
94#endif /* __KERNEL__ */
95
96#endif 93#endif
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index b84353ef6998..3b0156c46311 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -1,8 +1,6 @@
1#ifndef _CRIS_PAGE_H 1#ifndef _CRIS_PAGE_H
2#define _CRIS_PAGE_H 2#define _CRIS_PAGE_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/arch/page.h> 4#include <asm/arch/page.h>
7#include <linux/const.h> 5#include <linux/const.h>
8 6
@@ -74,7 +72,5 @@ typedef struct { unsigned long pgprot; } pgprot_t;
74#include <asm-generic/memory_model.h> 72#include <asm-generic/memory_model.h>
75#include <asm-generic/page.h> 73#include <asm-generic/page.h>
76 74
77#endif /* __KERNEL__ */
78
79#endif /* _CRIS_PAGE_H */ 75#endif /* _CRIS_PAGE_H */
80 76
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index fea0e8d57cb5..5bcfe5a10907 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -66,6 +66,21 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
66 return x; 66 return x;
67} 67}
68 68
69#include <asm-generic/cmpxchg-local.h>
70
71/*
72 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
73 * them available.
74 */
75#define cmpxchg_local(ptr, o, n) \
76 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
77 (unsigned long)(n), sizeof(*(ptr))))
78#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
79
80#ifndef CONFIG_SMP
81#include <asm-generic/cmpxchg.h>
82#endif
83
69#define arch_align_stack(x) (x) 84#define arch_align_stack(x) (x)
70 85
71void default_idle(void); 86void default_idle(void);
diff --git a/include/asm-cris/user.h b/include/asm-cris/user.h
index 2538e2a003df..73e60fcbcf38 100644
--- a/include/asm-cris/user.h
+++ b/include/asm-cris/user.h
@@ -38,7 +38,7 @@ struct user {
38 unsigned long start_data; /* data starting address */ 38 unsigned long start_data; /* data starting address */
39 unsigned long start_stack; /* stack starting address */ 39 unsigned long start_stack; /* stack starting address */
40 long int signal; /* signal causing core dump */ 40 long int signal; /* signal causing core dump */
41 struct regs * u_ar0; /* help gdb find registers */ 41 unsigned long u_ar0; /* help gdb find registers */
42 unsigned long magic; /* identifies a core file */ 42 unsigned long magic; /* identifies a core file */
43 char u_comm[32]; /* user command name */ 43 char u_comm[32]; /* user command name */
44}; 44};
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index 966a9836d556..bc3f12c5b7e0 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -4,4 +4,3 @@ header-y += registers.h
4 4
5unifdef-y += termios.h 5unifdef-y += termios.h
6unifdef-y += ptrace.h 6unifdef-y += ptrace.h
7unifdef-y += page.h
diff --git a/include/asm-frv/elf.h b/include/asm-frv/elf.h
index 7df58a3e6e4a..9fb946bb7dc9 100644
--- a/include/asm-frv/elf.h
+++ b/include/asm-frv/elf.h
@@ -137,8 +137,6 @@ do { \
137 137
138#define ELF_PLATFORM (NULL) 138#define ELF_PLATFORM (NULL)
139 139
140#ifdef __KERNEL__
141#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 140#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
142#endif
143 141
144#endif 142#endif
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index bd9bd2d9cc78..cacc045700de 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_PAGE_H 1#ifndef _ASM_PAGE_H
2#define _ASM_PAGE_H 2#define _ASM_PAGE_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/virtconvert.h> 4#include <asm/virtconvert.h>
7#include <asm/mem-layout.h> 5#include <asm/mem-layout.h>
8#include <asm/sections.h> 6#include <asm/sections.h>
@@ -79,6 +77,4 @@ extern unsigned long max_pfn;
79#include <asm-generic/memory_model.h> 77#include <asm-generic/memory_model.h>
80#include <asm-generic/page.h> 78#include <asm-generic/page.h>
81 79
82#endif /* __KERNEL__ */
83
84#endif /* _ASM_PAGE_H */ 80#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index 9f5663ba19f8..59be5443a68f 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -268,5 +268,29 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
268 268
269#endif 269#endif
270 270
271#include <asm-generic/cmpxchg-local.h>
272
273static inline unsigned long __cmpxchg_local(volatile void *ptr,
274 unsigned long old,
275 unsigned long new, int size)
276{
277 switch (size) {
278 case 4:
279 return cmpxchg(ptr, old, new);
280 default:
281 return __cmpxchg_local_generic(ptr, old, new, size);
282 }
283
284 return old;
285}
286
287/*
288 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
289 * them available.
290 */
291#define cmpxchg_local(ptr, o, n) \
292 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
293 (unsigned long)(n), sizeof(*(ptr))))
294#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
271 295
272#endif /* _ASM_SYSTEM_H */ 296#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 8fd81713cfc0..57ba60635959 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -27,8 +27,3 @@ unifdef-y += termbits.h
27unifdef-y += termios.h 27unifdef-y += termios.h
28unifdef-y += types.h 28unifdef-y += types.h
29unifdef-y += unistd.h 29unifdef-y += unistd.h
30unifdef-y += user.h
31
32# These probably shouldn't be exported
33unifdef-y += elf.h
34unifdef-y += page.h
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
new file mode 100644
index 000000000000..b2ba2fc8829a
--- /dev/null
+++ b/include/asm-generic/cmpxchg-local.h
@@ -0,0 +1,65 @@
1#ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H
2#define __ASM_GENERIC_CMPXCHG_LOCAL_H
3
4#include <linux/types.h>
5
6extern unsigned long wrong_size_cmpxchg(volatile void *ptr);
7
8/*
9 * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned
10 * long parameter, supporting various types of architectures.
11 */
12static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
13 unsigned long old, unsigned long new, int size)
14{
15 unsigned long flags, prev;
16
17 /*
18 * Sanity checking, compile-time.
19 */
20 if (size == 8 && sizeof(unsigned long) != 8)
21 wrong_size_cmpxchg(ptr);
22
23 local_irq_save(flags);
24 switch (size) {
25 case 1: prev = *(u8 *)ptr;
26 if (prev == old)
27 *(u8 *)ptr = (u8)new;
28 break;
29 case 2: prev = *(u16 *)ptr;
30 if (prev == old)
31 *(u16 *)ptr = (u16)new;
32 break;
33 case 4: prev = *(u32 *)ptr;
34 if (prev == old)
35 *(u32 *)ptr = (u32)new;
36 break;
37 case 8: prev = *(u64 *)ptr;
38 if (prev == old)
39 *(u64 *)ptr = (u64)new;
40 break;
41 default:
42 wrong_size_cmpxchg(ptr);
43 }
44 local_irq_restore(flags);
45 return prev;
46}
47
48/*
49 * Generic version of __cmpxchg64_local. Takes an u64 parameter.
50 */
51static inline u64 __cmpxchg64_local_generic(volatile void *ptr,
52 u64 old, u64 new)
53{
54 u64 prev;
55 unsigned long flags;
56
57 local_irq_save(flags);
58 prev = *(u64 *)ptr;
59 if (prev == old)
60 *(u64 *)ptr = new;
61 local_irq_restore(flags);
62 return prev;
63}
64
65#endif
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
new file mode 100644
index 000000000000..213ac6e8fe39
--- /dev/null
+++ b/include/asm-generic/cmpxchg.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_GENERIC_CMPXCHG_H
2#define __ASM_GENERIC_CMPXCHG_H
3
4/*
5 * Generic cmpxchg
6 *
7 * Uses the local cmpxchg. Does not support SMP.
8 */
9#ifdef CONFIG_SMP
10#error "Cannot use generic cmpxchg on SMP"
11#endif
12
13/*
14 * Atomic compare and exchange.
15 *
16 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether
17 * a cmpxchg primitive faster than repeated local irq save/restore exists.
18 */
19#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
20#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
21
22#endif
diff --git a/include/asm-h8300/elf.h b/include/asm-h8300/elf.h
index 7ba6a0af447c..26bfc7e641da 100644
--- a/include/asm-h8300/elf.h
+++ b/include/asm-h8300/elf.h
@@ -55,9 +55,7 @@ typedef unsigned long elf_fpregset_t;
55 55
56#define ELF_PLATFORM (NULL) 56#define ELF_PLATFORM (NULL)
57 57
58#ifdef __KERNEL__
59#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 58#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
60#endif
61 59
62#define R_H8_NONE 0 60#define R_H8_NONE 0
63#define R_H8_DIR32 1 61#define R_H8_DIR32 1
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index c8cc81a3aca5..a83492449130 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -1,8 +1,6 @@
1#ifndef _H8300_PAGE_H 1#ifndef _H8300_PAGE_H
2#define _H8300_PAGE_H 2#define _H8300_PAGE_H
3 3
4#ifdef __KERNEL__
5
6/* PAGE_SHIFT determines the page size */ 4/* PAGE_SHIFT determines the page size */
7 5
8#define PAGE_SHIFT (12) 6#define PAGE_SHIFT (12)
@@ -79,6 +77,4 @@ extern unsigned long memory_end;
79#include <asm-generic/memory_model.h> 77#include <asm-generic/memory_model.h>
80#include <asm-generic/page.h> 78#include <asm-generic/page.h>
81 79
82#endif /* __KERNEL__ */
83
84#endif /* _H8300_PAGE_H */ 80#endif /* _H8300_PAGE_H */
diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h
index 2c1e83f7b419..4b8e475908ae 100644
--- a/include/asm-h8300/system.h
+++ b/include/asm-h8300/system.h
@@ -138,6 +138,21 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
138 asm("jmp @@0"); \ 138 asm("jmp @@0"); \
139}) 139})
140 140
141#include <asm-generic/cmpxchg-local.h>
142
143/*
144 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
145 * them available.
146 */
147#define cmpxchg_local(ptr, o, n) \
148 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
149 (unsigned long)(n), sizeof(*(ptr))))
150#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
151
152#ifndef CONFIG_SMP
153#include <asm-generic/cmpxchg.h>
154#endif
155
141#define arch_align_stack(x) (x) 156#define arch_align_stack(x) (x)
142 157
143#endif /* _H8300_SYSTEM_H */ 158#endif /* _H8300_SYSTEM_H */
diff --git a/include/asm-h8300/user.h b/include/asm-h8300/user.h
index 6c64f99af3e1..14a9e18950f1 100644
--- a/include/asm-h8300/user.h
+++ b/include/asm-h8300/user.h
@@ -62,8 +62,7 @@ struct user{
62 esp register. */ 62 esp register. */
63 long int signal; /* Signal that caused the core dump. */ 63 long int signal; /* Signal that caused the core dump. */
64 int reserved; /* No longer used */ 64 int reserved; /* No longer used */
65 struct user_regs_struct *u_ar0; 65 unsigned long u_ar0; /* Used by gdb to help find the values for */
66 /* Used by gdb to help find the values for */
67 /* the registers. */ 66 /* the registers. */
68 unsigned long magic; /* To uniquely identify a core file */ 67 unsigned long magic; /* To uniquely identify a core file */
69 char u_comm[32]; /* User command that was responsible */ 68 char u_comm[32]; /* User command that was responsible */
diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h
index f10e29b60b00..f8e83eca67a2 100644
--- a/include/asm-ia64/elf.h
+++ b/include/asm-ia64/elf.h
@@ -177,7 +177,6 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
177 relevant until we have real hardware to play with... */ 177 relevant until we have real hardware to play with... */
178#define ELF_PLATFORM NULL 178#define ELF_PLATFORM NULL
179 179
180#ifdef __KERNEL__
181#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 180#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
182#define elf_read_implies_exec(ex, executable_stack) \ 181#define elf_read_implies_exec(ex, executable_stack) \
183 ((executable_stack!=EXSTACK_DISABLE_X) && ((ex).e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK) != 0) 182 ((executable_stack!=EXSTACK_DISABLE_X) && ((ex).e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK) != 0)
@@ -248,6 +247,4 @@ do { \
248 } \ 247 } \
249} while (0) 248} while (0)
250 249
251#endif /* __KERNEL__ */
252
253#endif /* _ASM_IA64_ELF_H */ 250#endif /* _ASM_IA64_ELF_H */
diff --git a/include/asm-ia64/intrinsics.h b/include/asm-ia64/intrinsics.h
index 3a95aa432e99..f1135b5b94c3 100644
--- a/include/asm-ia64/intrinsics.h
+++ b/include/asm-ia64/intrinsics.h
@@ -153,11 +153,17 @@ extern long ia64_cmpxchg_called_with_bad_pointer (void);
153 (__typeof__(old)) _r_; \ 153 (__typeof__(old)) _r_; \
154}) 154})
155 155
156#define cmpxchg_acq(ptr,o,n) ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr))) 156#define cmpxchg_acq(ptr, o, n) \
157#define cmpxchg_rel(ptr,o,n) ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr))) 157 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
158#define cmpxchg_rel(ptr, o, n) \
159 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
158 160
159/* for compatibility with other platforms: */ 161/* for compatibility with other platforms: */
160#define cmpxchg(ptr,o,n) cmpxchg_acq(ptr,o,n) 162#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
163#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
164
165#define cmpxchg_local cmpxchg
166#define cmpxchg64_local cmpxchg64
161 167
162#ifdef CONFIG_IA64_DEBUG_CMPXCHG 168#ifdef CONFIG_IA64_DEBUG_CMPXCHG
163# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; 169# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index d6345464a2b3..8a8aa3fd7cd4 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -7,8 +7,6 @@
7 * David Mosberger-Tang <davidm@hpl.hp.com> 7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */ 8 */
9 9
10# ifdef __KERNEL__
11
12#include <asm/intrinsics.h> 10#include <asm/intrinsics.h>
13#include <asm/types.h> 11#include <asm/types.h>
14 12
@@ -227,5 +225,4 @@ get_order (unsigned long size)
227 (((current->personality & READ_IMPLIES_EXEC) != 0) \ 225 (((current->personality & READ_IMPLIES_EXEC) != 0) \
228 ? VM_EXEC : 0)) 226 ? VM_EXEC : 0))
229 227
230# endif /* __KERNEL__ */
231#endif /* _ASM_IA64_PAGE_H */ 228#endif /* _ASM_IA64_PAGE_H */
diff --git a/include/asm-ia64/user.h b/include/asm-ia64/user.h
index 78e5a20140aa..8b9821110348 100644
--- a/include/asm-ia64/user.h
+++ b/include/asm-ia64/user.h
@@ -44,7 +44,7 @@ struct user {
44 unsigned long start_data; /* data starting address */ 44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */ 45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */ 46 long int signal; /* signal causing core dump */
47 struct regs * u_ar0; /* help gdb find registers */ 47 unsigned long u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */ 48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */ 49 char u_comm[32]; /* user command name */
50}; 50};
diff --git a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h
index bbee8b25d175..67bcd77494a5 100644
--- a/include/asm-m32r/elf.h
+++ b/include/asm-m32r/elf.h
@@ -129,8 +129,6 @@ typedef elf_fpreg_t elf_fpregset_t;
129 intent than poking at uname or /proc/cpuinfo. */ 129 intent than poking at uname or /proc/cpuinfo. */
130#define ELF_PLATFORM (NULL) 130#define ELF_PLATFORM (NULL)
131 131
132#ifdef __KERNEL__
133#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 132#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
134#endif
135 133
136#endif /* _ASM_M32R__ELF_H */ 134#endif /* _ASM_M32R__ELF_H */
diff --git a/include/asm-m32r/local.h b/include/asm-m32r/local.h
index def29d095740..22256d138630 100644
--- a/include/asm-m32r/local.h
+++ b/include/asm-m32r/local.h
@@ -1,6 +1,366 @@
1#ifndef __M32R_LOCAL_H 1#ifndef __M32R_LOCAL_H
2#define __M32R_LOCAL_H 2#define __M32R_LOCAL_H
3 3
4#include <asm-generic/local.h> 4/*
5 * linux/include/asm-m32r/local.h
6 *
7 * M32R version:
8 * Copyright (C) 2001, 2002 Hitoshi Yamamoto
9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 * Copyright (C) 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
11 */
12
13#include <linux/percpu.h>
14#include <asm/assembler.h>
15#include <asm/system.h>
16#include <asm/local.h>
17
18/*
19 * Atomic operations that C can't guarantee us. Useful for
20 * resource counting etc..
21 */
22
23/*
24 * Make sure gcc doesn't try to be clever and move things around
25 * on us. We need to use _exactly_ the address the user gave us,
26 * not some alias that contains the same information.
27 */
28typedef struct { volatile int counter; } local_t;
29
30#define LOCAL_INIT(i) { (i) }
31
32/**
33 * local_read - read local variable
34 * @l: pointer of type local_t
35 *
36 * Atomically reads the value of @l.
37 */
38#define local_read(l) ((l)->counter)
39
40/**
41 * local_set - set local variable
42 * @l: pointer of type local_t
43 * @i: required value
44 *
45 * Atomically sets the value of @l to @i.
46 */
47#define local_set(l, i) (((l)->counter) = (i))
48
49/**
50 * local_add_return - add long to local variable and return it
51 * @i: long value to add
52 * @l: pointer of type local_t
53 *
54 * Atomically adds @i to @l and return (@i + @l).
55 */
56static inline long local_add_return(long i, local_t *l)
57{
58 unsigned long flags;
59 long result;
60
61 local_irq_save(flags);
62 __asm__ __volatile__ (
63 "# local_add_return \n\t"
64 DCACHE_CLEAR("%0", "r4", "%1")
65 "ld %0, @%1; \n\t"
66 "add %0, %2; \n\t"
67 "st %0, @%1; \n\t"
68 : "=&r" (result)
69 : "r" (&l->counter), "r" (i)
70 : "memory"
71#ifdef CONFIG_CHIP_M32700_TS1
72 , "r4"
73#endif /* CONFIG_CHIP_M32700_TS1 */
74 );
75 local_irq_restore(flags);
76
77 return result;
78}
79
80/**
81 * local_sub_return - subtract long from local variable and return it
82 * @i: long value to subtract
83 * @l: pointer of type local_t
84 *
85 * Atomically subtracts @i from @l and return (@l - @i).
86 */
87static inline long local_sub_return(long i, local_t *l)
88{
89 unsigned long flags;
90 long result;
91
92 local_irq_save(flags);
93 __asm__ __volatile__ (
94 "# local_sub_return \n\t"
95 DCACHE_CLEAR("%0", "r4", "%1")
96 "ld %0, @%1; \n\t"
97 "sub %0, %2; \n\t"
98 "st %0, @%1; \n\t"
99 : "=&r" (result)
100 : "r" (&l->counter), "r" (i)
101 : "memory"
102#ifdef CONFIG_CHIP_M32700_TS1
103 , "r4"
104#endif /* CONFIG_CHIP_M32700_TS1 */
105 );
106 local_irq_restore(flags);
107
108 return result;
109}
110
111/**
112 * local_add - add long to local variable
113 * @i: long value to add
114 * @l: pointer of type local_t
115 *
116 * Atomically adds @i to @l.
117 */
118#define local_add(i, l) ((void) local_add_return((i), (l)))
119
120/**
121 * local_sub - subtract the local variable
122 * @i: long value to subtract
123 * @l: pointer of type local_t
124 *
125 * Atomically subtracts @i from @l.
126 */
127#define local_sub(i, l) ((void) local_sub_return((i), (l)))
128
129/**
130 * local_sub_and_test - subtract value from variable and test result
131 * @i: integer value to subtract
132 * @l: pointer of type local_t
133 *
134 * Atomically subtracts @i from @l and returns
135 * true if the result is zero, or false for all
136 * other cases.
137 */
138#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
139
140/**
141 * local_inc_return - increment local variable and return it
142 * @l: pointer of type local_t
143 *
144 * Atomically increments @l by 1 and returns the result.
145 */
146static inline long local_inc_return(local_t *l)
147{
148 unsigned long flags;
149 long result;
150
151 local_irq_save(flags);
152 __asm__ __volatile__ (
153 "# local_inc_return \n\t"
154 DCACHE_CLEAR("%0", "r4", "%1")
155 "ld %0, @%1; \n\t"
156 "addi %0, #1; \n\t"
157 "st %0, @%1; \n\t"
158 : "=&r" (result)
159 : "r" (&l->counter)
160 : "memory"
161#ifdef CONFIG_CHIP_M32700_TS1
162 , "r4"
163#endif /* CONFIG_CHIP_M32700_TS1 */
164 );
165 local_irq_restore(flags);
166
167 return result;
168}
169
170/**
171 * local_dec_return - decrement local variable and return it
172 * @l: pointer of type local_t
173 *
174 * Atomically decrements @l by 1 and returns the result.
175 */
176static inline long local_dec_return(local_t *l)
177{
178 unsigned long flags;
179 long result;
180
181 local_irq_save(flags);
182 __asm__ __volatile__ (
183 "# local_dec_return \n\t"
184 DCACHE_CLEAR("%0", "r4", "%1")
185 "ld %0, @%1; \n\t"
186 "addi %0, #-1; \n\t"
187 "st %0, @%1; \n\t"
188 : "=&r" (result)
189 : "r" (&l->counter)
190 : "memory"
191#ifdef CONFIG_CHIP_M32700_TS1
192 , "r4"
193#endif /* CONFIG_CHIP_M32700_TS1 */
194 );
195 local_irq_restore(flags);
196
197 return result;
198}
199
200/**
201 * local_inc - increment local variable
202 * @l: pointer of type local_t
203 *
204 * Atomically increments @l by 1.
205 */
206#define local_inc(l) ((void)local_inc_return(l))
207
208/**
209 * local_dec - decrement local variable
210 * @l: pointer of type local_t
211 *
212 * Atomically decrements @l by 1.
213 */
214#define local_dec(l) ((void)local_dec_return(l))
215
216/**
217 * local_inc_and_test - increment and test
218 * @l: pointer of type local_t
219 *
220 * Atomically increments @l by 1
221 * and returns true if the result is zero, or false for all
222 * other cases.
223 */
224#define local_inc_and_test(l) (local_inc_return(l) == 0)
225
226/**
227 * local_dec_and_test - decrement and test
228 * @l: pointer of type local_t
229 *
230 * Atomically decrements @l by 1 and
231 * returns true if the result is 0, or false for all
232 * other cases.
233 */
234#define local_dec_and_test(l) (local_dec_return(l) == 0)
235
236/**
237 * local_add_negative - add and test if negative
238 * @l: pointer of type local_t
239 * @i: integer value to add
240 *
241 * Atomically adds @i to @l and returns true
242 * if the result is negative, or false when
243 * result is greater than or equal to zero.
244 */
245#define local_add_negative(i, l) (local_add_return((i), (l)) < 0)
246
247#define local_cmpxchg(l, o, n) (cmpxchg_local(&((l)->counter), (o), (n)))
248#define local_xchg(v, new) (xchg_local(&((l)->counter), new))
249
250/**
251 * local_add_unless - add unless the number is a given value
252 * @l: pointer of type local_t
253 * @a: the amount to add to l...
254 * @u: ...unless l is equal to u.
255 *
256 * Atomically adds @a to @l, so long as it was not @u.
257 * Returns non-zero if @l was not @u, and zero otherwise.
258 */
259static inline int local_add_unless(local_t *l, long a, long u)
260{
261 long c, old;
262 c = local_read(l);
263 for (;;) {
264 if (unlikely(c == (u)))
265 break;
266 old = local_cmpxchg((l), c, c + (a));
267 if (likely(old == c))
268 break;
269 c = old;
270 }
271 return c != (u);
272}
273
274#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
275
276static inline void local_clear_mask(unsigned long mask, local_t *addr)
277{
278 unsigned long flags;
279 unsigned long tmp;
280
281 local_irq_save(flags);
282 __asm__ __volatile__ (
283 "# local_clear_mask \n\t"
284 DCACHE_CLEAR("%0", "r5", "%1")
285 "ld %0, @%1; \n\t"
286 "and %0, %2; \n\t"
287 "st %0, @%1; \n\t"
288 : "=&r" (tmp)
289 : "r" (addr), "r" (~mask)
290 : "memory"
291#ifdef CONFIG_CHIP_M32700_TS1
292 , "r5"
293#endif /* CONFIG_CHIP_M32700_TS1 */
294 );
295 local_irq_restore(flags);
296}
297
298static inline void local_set_mask(unsigned long mask, local_t *addr)
299{
300 unsigned long flags;
301 unsigned long tmp;
302
303 local_irq_save(flags);
304 __asm__ __volatile__ (
305 "# local_set_mask \n\t"
306 DCACHE_CLEAR("%0", "r5", "%1")
307 "ld %0, @%1; \n\t"
308 "or %0, %2; \n\t"
309 "st %0, @%1; \n\t"
310 : "=&r" (tmp)
311 : "r" (addr), "r" (mask)
312 : "memory"
313#ifdef CONFIG_CHIP_M32700_TS1
314 , "r5"
315#endif /* CONFIG_CHIP_M32700_TS1 */
316 );
317 local_irq_restore(flags);
318}
319
320/* Atomic operations are already serializing on m32r */
321#define smp_mb__before_local_dec() barrier()
322#define smp_mb__after_local_dec() barrier()
323#define smp_mb__before_local_inc() barrier()
324#define smp_mb__after_local_inc() barrier()
325
326/* Use these for per-cpu local_t variables: on some archs they are
327 * much more efficient than these naive implementations. Note they take
328 * a variable, not an address.
329 */
330
331#define __local_inc(l) ((l)->a.counter++)
332#define __local_dec(l) ((l)->a.counter++)
333#define __local_add(i, l) ((l)->a.counter += (i))
334#define __local_sub(i, l) ((l)->a.counter -= (i))
335
336/* Use these for per-cpu local_t variables: on some archs they are
337 * much more efficient than these naive implementations. Note they take
338 * a variable, not an address.
339 */
340
341/* Need to disable preemption for the cpu local counters otherwise we could
342 still access a variable of a previous CPU in a non local way. */
343#define cpu_local_wrap_v(l) \
344 ({ local_t res__; \
345 preempt_disable(); \
346 res__ = (l); \
347 preempt_enable(); \
348 res__; })
349#define cpu_local_wrap(l) \
350 ({ preempt_disable(); \
351 l; \
352 preempt_enable(); }) \
353
354#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
355#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
356#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
357#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
358#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
359#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
360
361#define __cpu_local_inc(l) cpu_local_inc(l)
362#define __cpu_local_dec(l) cpu_local_dec(l)
363#define __cpu_local_add(i, l) cpu_local_add((i), (l))
364#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
5 365
6#endif /* __M32R_LOCAL_H */ 366#endif /* __M32R_LOCAL_H */
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 04fd183a2c58..05d43bbbf940 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -6,7 +6,6 @@
6#define PAGE_SIZE (1UL << PAGE_SHIFT) 6#define PAGE_SIZE (1UL << PAGE_SHIFT)
7#define PAGE_MASK (~(PAGE_SIZE-1)) 7#define PAGE_MASK (~(PAGE_SIZE-1))
8 8
9#ifdef __KERNEL__
10#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
11 10
12extern void clear_page(void *to); 11extern void clear_page(void *to);
@@ -87,5 +86,4 @@ typedef struct { unsigned long pgprot; } pgprot_t;
87#include <asm-generic/memory_model.h> 86#include <asm-generic/memory_model.h>
88#include <asm-generic/page.h> 87#include <asm-generic/page.h>
89 88
90#endif /* __KERNEL__ */
91#endif /* _ASM_M32R_PAGE_H */ 89#endif /* _ASM_M32R_PAGE_H */
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 2365de5c2955..70a57c8c002b 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -121,12 +121,13 @@ static inline void local_irq_disable(void)
121 121
122#define nop() __asm__ __volatile__ ("nop" : : ) 122#define nop() __asm__ __volatile__ ("nop" : : )
123 123
124#define xchg(ptr,x) \ 124#define xchg(ptr, x) \
125 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 125 ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
126#define xchg_local(ptr, x) \
127 ((__typeof__(*(ptr)))__xchg_local((unsigned long)(x), (ptr), \
128 sizeof(*(ptr))))
126 129
127#ifdef CONFIG_SMP
128extern void __xchg_called_with_bad_pointer(void); 130extern void __xchg_called_with_bad_pointer(void);
129#endif
130 131
131#ifdef CONFIG_CHIP_M32700_TS1 132#ifdef CONFIG_CHIP_M32700_TS1
132#define DCACHE_CLEAR(reg0, reg1, addr) \ 133#define DCACHE_CLEAR(reg0, reg1, addr) \
@@ -146,7 +147,7 @@ extern void __xchg_called_with_bad_pointer(void);
146#endif /* CONFIG_CHIP_M32700_TS1 */ 147#endif /* CONFIG_CHIP_M32700_TS1 */
147 148
148static __always_inline unsigned long 149static __always_inline unsigned long
149__xchg(unsigned long x, volatile void * ptr, int size) 150__xchg(unsigned long x, volatile void *ptr, int size)
150{ 151{
151 unsigned long flags; 152 unsigned long flags;
152 unsigned long tmp = 0; 153 unsigned long tmp = 0;
@@ -186,9 +187,45 @@ __xchg(unsigned long x, volatile void * ptr, int size)
186#endif /* CONFIG_CHIP_M32700_TS1 */ 187#endif /* CONFIG_CHIP_M32700_TS1 */
187 ); 188 );
188 break; 189 break;
190#endif /* CONFIG_SMP */
191 default:
192 __xchg_called_with_bad_pointer();
193 }
194
195 local_irq_restore(flags);
196
197 return (tmp);
198}
199
200static __always_inline unsigned long
201__xchg_local(unsigned long x, volatile void *ptr, int size)
202{
203 unsigned long flags;
204 unsigned long tmp = 0;
205
206 local_irq_save(flags);
207
208 switch (size) {
209 case 1:
210 __asm__ __volatile__ (
211 "ldb %0, @%2 \n\t"
212 "stb %1, @%2 \n\t"
213 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
214 break;
215 case 2:
216 __asm__ __volatile__ (
217 "ldh %0, @%2 \n\t"
218 "sth %1, @%2 \n\t"
219 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
220 break;
221 case 4:
222 __asm__ __volatile__ (
223 "ld %0, @%2 \n\t"
224 "st %1, @%2 \n\t"
225 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
226 break;
189 default: 227 default:
190 __xchg_called_with_bad_pointer(); 228 __xchg_called_with_bad_pointer();
191#endif /* CONFIG_SMP */
192 } 229 }
193 230
194 local_irq_restore(flags); 231 local_irq_restore(flags);
@@ -228,6 +265,37 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
228 return retval; 265 return retval;
229} 266}
230 267
268static inline unsigned long
269__cmpxchg_local_u32(volatile unsigned int *p, unsigned int old,
270 unsigned int new)
271{
272 unsigned long flags;
273 unsigned int retval;
274
275 local_irq_save(flags);
276 __asm__ __volatile__ (
277 DCACHE_CLEAR("%0", "r4", "%1")
278 "ld %0, @%1; \n"
279 " bne %0, %2, 1f; \n"
280 "st %3, @%1; \n"
281 " bra 2f; \n"
282 " .fillinsn \n"
283 "1:"
284 "st %0, @%1; \n"
285 " .fillinsn \n"
286 "2:"
287 : "=&r" (retval)
288 : "r" (p), "r" (old), "r" (new)
289 : "cbit", "memory"
290#ifdef CONFIG_CHIP_M32700_TS1
291 , "r4"
292#endif /* CONFIG_CHIP_M32700_TS1 */
293 );
294 local_irq_restore(flags);
295
296 return retval;
297}
298
231/* This function doesn't exist, so you'll get a linker error 299/* This function doesn't exist, so you'll get a linker error
232 if something tries to do an invalid cmpxchg(). */ 300 if something tries to do an invalid cmpxchg(). */
233extern void __cmpxchg_called_with_bad_pointer(void); 301extern void __cmpxchg_called_with_bad_pointer(void);
@@ -247,13 +315,34 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
247 return old; 315 return old;
248} 316}
249 317
250#define cmpxchg(ptr,o,n) \ 318#define cmpxchg(ptr, o, n) \
251 ({ \ 319 ((__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)(o), \
252 __typeof__(*(ptr)) _o_ = (o); \ 320 (unsigned long)(n), sizeof(*(ptr))))
253 __typeof__(*(ptr)) _n_ = (n); \ 321
254 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ 322#include <asm-generic/cmpxchg-local.h>
255 (unsigned long)_n_, sizeof(*(ptr))); \ 323
256 }) 324static inline unsigned long __cmpxchg_local(volatile void *ptr,
325 unsigned long old,
326 unsigned long new, int size)
327{
328 switch (size) {
329 case 4:
330 return __cmpxchg_local_u32(ptr, old, new);
331 default:
332 return __cmpxchg_local_generic(ptr, old, new, size);
333 }
334
335 return old;
336}
337
338/*
339 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
340 * them available.
341 */
342#define cmpxchg_local(ptr, o, n) \
343 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
344 (unsigned long)(n), sizeof(*(ptr))))
345#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
257 346
258#endif /* __KERNEL__ */ 347#endif /* __KERNEL__ */
259 348
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h
index 035258d713d0..03b3c11c2aff 100644
--- a/include/asm-m32r/user.h
+++ b/include/asm-m32r/user.h
@@ -38,7 +38,7 @@ struct user {
38 unsigned long start_data; /* data starting address */ 38 unsigned long start_data; /* data starting address */
39 unsigned long start_stack; /* stack starting address */ 39 unsigned long start_stack; /* stack starting address */
40 long int signal; /* signal causing core dump */ 40 long int signal; /* signal causing core dump */
41 struct regs * u_ar0; /* help gdb find registers */ 41 unsigned long u_ar0; /* help gdb find registers */
42 unsigned long magic; /* identifies a core file */ 42 unsigned long magic; /* identifies a core file */
43 char u_comm[32]; /* user command name */ 43 char u_comm[32]; /* user command name */
44}; 44};
diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h
index eb63b85f9336..14ea42152b97 100644
--- a/include/asm-m68k/elf.h
+++ b/include/asm-m68k/elf.h
@@ -114,8 +114,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
114 114
115#define ELF_PLATFORM (NULL) 115#define ELF_PLATFORM (NULL)
116 116
117#ifdef __KERNEL__
118#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 117#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
119#endif
120 118
121#endif 119#endif
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index d029b75bcf04..13135d4821d8 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -191,7 +191,8 @@ static inline pte_t pte_mkcache(pte_t pte)
191#define pgd_index(address) ((address) >> PGDIR_SHIFT) 191#define pgd_index(address) ((address) >> PGDIR_SHIFT)
192 192
193/* to find an entry in a page-table-directory */ 193/* to find an entry in a page-table-directory */
194static inline pgd_t *pgd_offset(struct mm_struct *mm, unsigned long address) 194static inline pgd_t *pgd_offset(const struct mm_struct *mm,
195 unsigned long address)
195{ 196{
196 return mm->pgd + pgd_index(address); 197 return mm->pgd + pgd_index(address);
197} 198}
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 1431ea0b59e0..3f29e2a03a43 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -1,9 +1,6 @@
1#ifndef _M68K_PAGE_H 1#ifndef _M68K_PAGE_H
2#define _M68K_PAGE_H 2#define _M68K_PAGE_H
3 3
4
5#ifdef __KERNEL__
6
7#include <linux/const.h> 4#include <linux/const.h>
8 5
9/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
@@ -230,6 +227,4 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
230 227
231#include <asm-generic/page.h> 228#include <asm-generic/page.h>
232 229
233#endif /* __KERNEL__ */
234
235#endif /* _M68K_PAGE_H */ 230#endif /* _M68K_PAGE_H */
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index caa9b1663e45..dbb6515ffd5b 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -154,6 +154,10 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
154} 154}
155#endif 155#endif
156 156
157#include <asm-generic/cmpxchg-local.h>
158
159#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
160
157/* 161/*
158 * Atomic compare and exchange. Compare OLD with MEM, if identical, 162 * Atomic compare and exchange. Compare OLD with MEM, if identical,
159 * store NEW in MEM. Return the initial value in MEM. Success is 163 * store NEW in MEM. Return the initial value in MEM. Success is
@@ -185,9 +189,26 @@ static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
185 return old; 189 return old;
186} 190}
187 191
188#define cmpxchg(ptr,o,n)\ 192#define cmpxchg(ptr, o, n) \
189 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 193 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
190 (unsigned long)(n),sizeof(*(ptr)))) 194 (unsigned long)(n), sizeof(*(ptr))))
195#define cmpxchg_local(ptr, o, n) \
196 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
197 (unsigned long)(n), sizeof(*(ptr))))
198#else
199
200/*
201 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
202 * them available.
203 */
204#define cmpxchg_local(ptr, o, n) \
205 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
206 (unsigned long)(n), sizeof(*(ptr))))
207
208#ifndef CONFIG_SMP
209#include <asm-generic/cmpxchg.h>
210#endif
211
191#endif 212#endif
192 213
193#define arch_align_stack(x) (x) 214#define arch_align_stack(x) (x)
diff --git a/include/asm-m68k/user.h b/include/asm-m68k/user.h
index 8c56ccab4849..f1f478d6e050 100644
--- a/include/asm-m68k/user.h
+++ b/include/asm-m68k/user.h
@@ -72,8 +72,7 @@ struct user{
72 esp register. */ 72 esp register. */
73 long int signal; /* Signal that caused the core dump. */ 73 long int signal; /* Signal that caused the core dump. */
74 int reserved; /* No longer used */ 74 int reserved; /* No longer used */
75 struct user_regs_struct *u_ar0; 75 unsigned long u_ar0; /* Used by gdb to help find the values for */
76 /* Used by gdb to help find the values for */
77 /* the registers. */ 76 /* the registers. */
78 struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */ 77 struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
79 unsigned long magic; /* To uniquely identify a core file */ 78 unsigned long magic; /* To uniquely identify a core file */
diff --git a/include/asm-m68knommu/elf.h b/include/asm-m68knommu/elf.h
index 40b1ed6827db..27f0ec70fba8 100644
--- a/include/asm-m68knommu/elf.h
+++ b/include/asm-m68knommu/elf.h
@@ -105,8 +105,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
105 105
106#define ELF_PLATFORM (NULL) 106#define ELF_PLATFORM (NULL)
107 107
108#ifdef __KERNEL__
109#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 108#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
110#endif
111 109
112#endif 110#endif
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index 9efa0a9851b1..6af480c7f291 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -1,8 +1,6 @@
1#ifndef _M68KNOMMU_PAGE_H 1#ifndef _M68KNOMMU_PAGE_H
2#define _M68KNOMMU_PAGE_H 2#define _M68KNOMMU_PAGE_H
3 3
4#ifdef __KERNEL__
5
6/* PAGE_SHIFT determines the page size */ 4/* PAGE_SHIFT determines the page size */
7 5
8#define PAGE_SHIFT (12) 6#define PAGE_SHIFT (12)
@@ -78,6 +76,4 @@ extern unsigned long memory_end;
78 76
79#include <asm-generic/page.h> 77#include <asm-generic/page.h>
80 78
81#endif /* __KERNEL__ */
82
83#endif /* _M68KNOMMU_PAGE_H */ 79#endif /* _M68KNOMMU_PAGE_H */
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index ee2dc07bae0e..039ab3f81732 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -186,26 +186,20 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
186} 186}
187#endif 187#endif
188 188
189#include <asm-generic/cmpxchg-local.h>
190
189/* 191/*
190 * Atomic compare and exchange. Compare OLD with MEM, if identical, 192 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
191 * store NEW in MEM. Return the initial value in MEM. Success is 193 * them available.
192 * indicated by comparing RETURN with OLD.
193 */ 194 */
194#define __HAVE_ARCH_CMPXCHG 1 195#define cmpxchg_local(ptr, o, n) \
195 196 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
196static __inline__ unsigned long 197 (unsigned long)(n), sizeof(*(ptr))))
197cmpxchg(volatile int *p, int old, int new) 198#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
198{
199 unsigned long flags;
200 int prev;
201
202 local_irq_save(flags);
203 if ((prev = *p) == old)
204 *p = new;
205 local_irq_restore(flags);
206 return(prev);
207}
208 199
200#ifndef CONFIG_SMP
201#include <asm-generic/cmpxchg.h>
202#endif
209 203
210#if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \ 204#if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \
211 defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 ) 205 defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 )
diff --git a/include/asm-mips/cmpxchg.h b/include/asm-mips/cmpxchg.h
index a5ec0e5dc5b8..4a812c3ceb90 100644
--- a/include/asm-mips/cmpxchg.h
+++ b/include/asm-mips/cmpxchg.h
@@ -104,4 +104,21 @@ extern void __cmpxchg_called_with_bad_pointer(void);
104#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_llsc_mb()) 104#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_llsc_mb())
105#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, ) 105#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, )
106 106
107#define cmpxchg64(ptr, o, n) \
108 ({ \
109 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
110 cmpxchg((ptr), (o), (n)); \
111 })
112
113#ifdef CONFIG_64BIT
114#define cmpxchg64_local(ptr, o, n) \
115 ({ \
116 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
117 cmpxchg_local((ptr), (o), (n)); \
118 })
119#else
120#include <asm-generic/cmpxchg-local.h>
121#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
122#endif
123
107#endif /* __ASM_CMPXCHG_H */ 124#endif /* __ASM_CMPXCHG_H */
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index 766f91ad5cd3..f69f7acba637 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -239,8 +239,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
239 239
240#endif /* !defined(ELF_ARCH) */ 240#endif /* !defined(ELF_ARCH) */
241 241
242#ifdef __KERNEL__
243
244struct mips_abi; 242struct mips_abi;
245 243
246extern struct mips_abi mips_abi; 244extern struct mips_abi mips_abi;
@@ -328,8 +326,6 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
328#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ 326#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
329 dump_task_fpu(tsk, elf_fpregs) 327 dump_task_fpu(tsk, elf_fpregs)
330 328
331#endif /* __KERNEL__ */
332
333#define USE_ELF_CORE_DUMP 329#define USE_ELF_CORE_DUMP
334#define ELF_EXEC_PAGESIZE PAGE_SIZE 330#define ELF_EXEC_PAGESIZE PAGE_SIZE
335 331
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index d2ea983bec06..635aa44d2290 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -9,9 +9,6 @@
9#ifndef _ASM_PAGE_H 9#ifndef _ASM_PAGE_H
10#define _ASM_PAGE_H 10#define _ASM_PAGE_H
11 11
12
13#ifdef __KERNEL__
14
15#include <spaces.h> 12#include <spaces.h>
16 13
17/* 14/*
@@ -190,6 +187,4 @@ typedef struct { unsigned long pgprot; } pgprot_t;
190#include <asm-generic/memory_model.h> 187#include <asm-generic/memory_model.h>
191#include <asm-generic/page.h> 188#include <asm-generic/page.h>
192 189
193#endif /* defined (__KERNEL__) */
194
195#endif /* _ASM_PAGE_H */ 190#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h
index 61f2a093b91b..afa83a4c1888 100644
--- a/include/asm-mips/user.h
+++ b/include/asm-mips/user.h
@@ -8,8 +8,6 @@
8#ifndef _ASM_USER_H 8#ifndef _ASM_USER_H
9#define _ASM_USER_H 9#define _ASM_USER_H
10 10
11#ifdef __KERNEL__
12
13#include <asm/page.h> 11#include <asm/page.h>
14#include <asm/reg.h> 12#include <asm/reg.h>
15 13
@@ -46,7 +44,7 @@ struct user {
46 unsigned long start_data; /* data starting address */ 44 unsigned long start_data; /* data starting address */
47 unsigned long start_stack; /* stack starting address */ 45 unsigned long start_stack; /* stack starting address */
48 long int signal; /* signal causing core dump */ 46 long int signal; /* signal causing core dump */
49 struct regs * u_ar0; /* help gdb find registers */ 47 unsigned long u_ar0; /* help gdb find registers */
50 unsigned long magic; /* identifies a core file */ 48 unsigned long magic; /* identifies a core file */
51 char u_comm[32]; /* user command name */ 49 char u_comm[32]; /* user command name */
52}; 50};
@@ -57,6 +55,4 @@ struct user {
57#define HOST_DATA_START_ADDR (u.start_data) 55#define HOST_DATA_START_ADDR (u.start_data)
58#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
59 57
60#endif /* __KERNEL__ */
61
62#endif /* _ASM_USER_H */ 58#endif /* _ASM_USER_H */
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index e894ee35074b..57fcc4a5ebb4 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -122,6 +122,39 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
122 (unsigned long)_n_, sizeof(*(ptr))); \ 122 (unsigned long)_n_, sizeof(*(ptr))); \
123 }) 123 })
124 124
125#include <asm-generic/cmpxchg-local.h>
126
127static inline unsigned long __cmpxchg_local(volatile void *ptr,
128 unsigned long old,
129 unsigned long new_, int size)
130{
131 switch (size) {
132#ifdef CONFIG_64BIT
133 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
134#endif
135 case 4: return __cmpxchg_u32(ptr, old, new_);
136 default:
137 return __cmpxchg_local_generic(ptr, old, new_, size);
138 }
139}
140
141/*
142 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
143 * them available.
144 */
145#define cmpxchg_local(ptr, o, n) \
146 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
147 (unsigned long)(n), sizeof(*(ptr))))
148#ifdef CONFIG_64BIT
149#define cmpxchg64_local(ptr, o, n) \
150 ({ \
151 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
152 cmpxchg_local((ptr), (o), (n)); \
153 })
154#else
155#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
156#endif
157
125/* Note that we need not lock read accesses - aligned word writes/reads 158/* Note that we need not lock read accesses - aligned word writes/reads
126 * are atomic, so a reader never sees unconsistent values. 159 * are atomic, so a reader never sees unconsistent values.
127 * 160 *
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
index 8e7946a141de..ce0c0d844c7d 100644
--- a/include/asm-parisc/elf.h
+++ b/include/asm-parisc/elf.h
@@ -237,14 +237,11 @@ typedef unsigned long elf_greg_t;
237 237
238#define ELF_PLATFORM ("PARISC\0" /*+((boot_cpu_data.x86-3)*5) */) 238#define ELF_PLATFORM ("PARISC\0" /*+((boot_cpu_data.x86-3)*5) */)
239 239
240#ifdef __KERNEL__
241#define SET_PERSONALITY(ex, ibcs2) \ 240#define SET_PERSONALITY(ex, ibcs2) \
242 current->personality = PER_LINUX; \ 241 current->personality = PER_LINUX; \
243 current->thread.map_base = DEFAULT_MAP_BASE; \ 242 current->thread.map_base = DEFAULT_MAP_BASE; \
244 current->thread.task_size = DEFAULT_TASK_SIZE \ 243 current->thread.task_size = DEFAULT_TASK_SIZE \
245 244
246#endif
247
248/* 245/*
249 * Fill in general registers in a core dump. This saves pretty 246 * Fill in general registers in a core dump. This saves pretty
250 * much the same registers as hp-ux, although in a different order. 247 * much the same registers as hp-ux, although in a different order.
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index b59a1504fc7a..b08d9151c71e 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -1,8 +1,6 @@
1#ifndef _PARISC_PAGE_H 1#ifndef _PARISC_PAGE_H
2#define _PARISC_PAGE_H 2#define _PARISC_PAGE_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/const.h> 4#include <linux/const.h>
7 5
8#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) 6#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
@@ -175,6 +173,4 @@ extern int npmem_ranges;
175#include <asm-generic/memory_model.h> 173#include <asm-generic/memory_model.h>
176#include <asm-generic/page.h> 174#include <asm-generic/page.h>
177 175
178#endif /* __KERNEL__ */
179
180#endif /* _PARISC_PAGE_H */ 176#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 528ef183c221..1e79673b7316 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -46,7 +46,7 @@ enum powerpc_oprofile_type {
46 PPC_OPROFILE_RS64 = 1, 46 PPC_OPROFILE_RS64 = 1,
47 PPC_OPROFILE_POWER4 = 2, 47 PPC_OPROFILE_POWER4 = 2,
48 PPC_OPROFILE_G4 = 3, 48 PPC_OPROFILE_G4 = 3,
49 PPC_OPROFILE_BOOKE = 4, 49 PPC_OPROFILE_FSL_EMB = 4,
50 PPC_OPROFILE_CELL = 5, 50 PPC_OPROFILE_CELL = 5,
51 PPC_OPROFILE_PA6T = 6, 51 PPC_OPROFILE_PA6T = 6,
52}; 52};
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index af5fb31af559..be6c879e8760 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -59,25 +59,36 @@ do { \
59/* R/W of indirect DCRs make use of standard naming conventions for DCRs */ 59/* R/W of indirect DCRs make use of standard naming conventions for DCRs */
60extern spinlock_t dcr_ind_lock; 60extern spinlock_t dcr_ind_lock;
61 61
62#define mfdcri(base, reg) \ 62static inline unsigned __mfdcri(int base_addr, int base_data, int reg)
63({ \ 63{
64 unsigned long flags; \ 64 unsigned long flags;
65 unsigned int val; \ 65 unsigned int val;
66 spin_lock_irqsave(&dcr_ind_lock, flags); \
67 mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \
68 val = mfdcr(DCRN_ ## base ## _CONFIG_DATA); \
69 spin_unlock_irqrestore(&dcr_ind_lock, flags); \
70 val; \
71})
72 66
73#define mtdcri(base, reg, data) \ 67 spin_lock_irqsave(&dcr_ind_lock, flags);
74do { \ 68 __mtdcr(base_addr, reg);
75 unsigned long flags; \ 69 val = __mfdcr(base_data);
76 spin_lock_irqsave(&dcr_ind_lock, flags); \ 70 spin_unlock_irqrestore(&dcr_ind_lock, flags);
77 mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \ 71 return val;
78 mtdcr(DCRN_ ## base ## _CONFIG_DATA, data); \ 72}
79 spin_unlock_irqrestore(&dcr_ind_lock, flags); \ 73
80} while (0) 74static inline void __mtdcri(int base_addr, int base_data, int reg,
75 unsigned val)
76{
77 unsigned long flags;
78
79 spin_lock_irqsave(&dcr_ind_lock, flags);
80 __mtdcr(base_addr, reg);
81 __mtdcr(base_data, val);
82 spin_unlock_irqrestore(&dcr_ind_lock, flags);
83}
84
85#define mfdcri(base, reg) __mfdcri(DCRN_ ## base ## _CONFIG_ADDR, \
86 DCRN_ ## base ## _CONFIG_DATA, \
87 reg)
88
89#define mtdcri(base, reg, data) __mtdcri(DCRN_ ## base ## _CONFIG_ADDR, \
90 DCRN_ ## base ## _CONFIG_DATA, \
91 reg, data)
81 92
82#endif /* __ASSEMBLY__ */ 93#endif /* __ASSEMBLY__ */
83#endif /* __KERNEL__ */ 94#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 6bd07ef78ac4..9080d85cb9d0 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -165,8 +165,10 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
165 * This is used to ensure we don't load something for the wrong architecture. 165 * This is used to ensure we don't load something for the wrong architecture.
166 */ 166 */
167#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) 167#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
168#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC)
168 169
169#define USE_ELF_CORE_DUMP 170#define USE_ELF_CORE_DUMP
171#define CORE_DUMP_USE_REGSET
170#define ELF_EXEC_PAGESIZE PAGE_SIZE 172#define ELF_EXEC_PAGESIZE PAGE_SIZE
171 173
172/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 174/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
diff --git a/include/asm-powerpc/mpc512x.h b/include/asm-powerpc/mpc512x.h
new file mode 100644
index 000000000000..c48a1658eeac
--- /dev/null
+++ b/include/asm-powerpc/mpc512x.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
3 *
4 * Author: John Rigby, <jrigby@freescale.com>, Friday Apr 13 2007
5 *
6 * Description:
7 * MPC5121 Prototypes and definitions
8 *
9 * This is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_POWERPC_MPC512x_H__
17#define __ASM_POWERPC_MPC512x_H__
18
19extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
20
21#endif /* __ASM_POWERPC_MPC512x_H__ */
22
diff --git a/include/asm-powerpc/mpc52xx_psc.h b/include/asm-powerpc/mpc52xx_psc.h
index bea42b95390f..710c5d36efaa 100644
--- a/include/asm-powerpc/mpc52xx_psc.h
+++ b/include/asm-powerpc/mpc52xx_psc.h
@@ -190,5 +190,53 @@ struct mpc52xx_psc_fifo {
190 u16 tflwfptr; /* PSC + 0x9e */ 190 u16 tflwfptr; /* PSC + 0x9e */
191}; 191};
192 192
193#define MPC512x_PSC_FIFO_RESET_SLICE 0x80
194#define MPC512x_PSC_FIFO_ENABLE_SLICE 0x01
195#define MPC512x_PSC_FIFO_ENABLE_DMA 0x04
196
197#define MPC512x_PSC_FIFO_EMPTY 0x1
198#define MPC512x_PSC_FIFO_FULL 0x2
199#define MPC512x_PSC_FIFO_ALARM 0x4
200#define MPC512x_PSC_FIFO_URERR 0x8
201#define MPC512x_PSC_FIFO_ORERR 0x01
202#define MPC512x_PSC_FIFO_MEMERROR 0x02
203
204struct mpc512x_psc_fifo {
205 u32 reserved1[10];
206 u32 txcmd; /* PSC + 0x80 */
207 u32 txalarm; /* PSC + 0x84 */
208 u32 txsr; /* PSC + 0x88 */
209 u32 txisr; /* PSC + 0x8c */
210 u32 tximr; /* PSC + 0x90 */
211 u32 txcnt; /* PSC + 0x94 */
212 u32 txptr; /* PSC + 0x98 */
213 u32 txsz; /* PSC + 0x9c */
214 u32 reserved2[7];
215 union {
216 u8 txdata_8;
217 u16 txdata_16;
218 u32 txdata_32;
219 } txdata; /* PSC + 0xbc */
220#define txdata_8 txdata.txdata_8
221#define txdata_16 txdata.txdata_16
222#define txdata_32 txdata.txdata_32
223 u32 rxcmd; /* PSC + 0xc0 */
224 u32 rxalarm; /* PSC + 0xc4 */
225 u32 rxsr; /* PSC + 0xc8 */
226 u32 rxisr; /* PSC + 0xcc */
227 u32 rximr; /* PSC + 0xd0 */
228 u32 rxcnt; /* PSC + 0xd4 */
229 u32 rxptr; /* PSC + 0xd8 */
230 u32 rxsz; /* PSC + 0xdc */
231 u32 reserved3[7];
232 union {
233 u8 rxdata_8;
234 u16 rxdata_16;
235 u32 rxdata_32;
236 } rxdata; /* PSC + 0xfc */
237#define rxdata_8 rxdata.rxdata_8
238#define rxdata_16 rxdata.rxdata_16
239#define rxdata_32 rxdata.rxdata_32
240};
193 241
194#endif /* __ASM_MPC52xx_PSC_H__ */ 242#endif /* __ASM_MPC52xx_PSC_H__ */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 938fefb4c4bc..95035c602ba6 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -54,7 +54,7 @@ struct op_powerpc_model {
54 int num_counters; 54 int num_counters;
55}; 55};
56 56
57extern struct op_powerpc_model op_model_fsl_booke; 57extern struct op_powerpc_model op_model_fsl_emb;
58extern struct op_powerpc_model op_model_rs64; 58extern struct op_powerpc_model op_model_rs64;
59extern struct op_powerpc_model op_model_power4; 59extern struct op_powerpc_model op_model_power4;
60extern struct op_powerpc_model op_model_7450; 60extern struct op_powerpc_model op_model_7450;
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index 236a9210e5fc..61e3725bbd37 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#ifdef __KERNEL__
14#include <asm/asm-compat.h> 13#include <asm/asm-compat.h>
15#include <asm/kdump.h> 14#include <asm/kdump.h>
16 15
@@ -194,6 +193,4 @@ struct vm_area_struct;
194#include <asm-generic/memory_model.h> 193#include <asm-generic/memory_model.h>
195#endif /* __ASSEMBLY__ */ 194#endif /* __ASSEMBLY__ */
196 195
197#endif /* __KERNEL__ */
198
199#endif /* _ASM_POWERPC_PAGE_H */ 196#endif /* _ASM_POWERPC_PAGE_H */
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 17110aff26e7..65ea19eec956 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -1,6 +1,5 @@
1#ifndef _ASM_POWERPC_PAGE_32_H 1#ifndef _ASM_POWERPC_PAGE_32_H
2#define _ASM_POWERPC_PAGE_32_H 2#define _ASM_POWERPC_PAGE_32_H
3#ifdef __KERNEL__
4 3
5#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 4#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
6 5
@@ -32,5 +31,4 @@ extern void copy_page(void *to, void *from);
32 31
33#endif /* __ASSEMBLY__ */ 32#endif /* __ASSEMBLY__ */
34 33
35#endif /* __KERNEL__ */
36#endif /* _ASM_POWERPC_PAGE_32_H */ 34#endif /* _ASM_POWERPC_PAGE_32_H */
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 4ee82c61e4d7..67834eae5702 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -1,6 +1,5 @@
1#ifndef _ASM_POWERPC_PAGE_64_H 1#ifndef _ASM_POWERPC_PAGE_64_H
2#define _ASM_POWERPC_PAGE_64_H 2#define _ASM_POWERPC_PAGE_64_H
3#ifdef __KERNEL__
4 3
5/* 4/*
6 * Copyright (C) 2001 PPC64 Team, IBM Corp 5 * Copyright (C) 2001 PPC64 Team, IBM Corp
@@ -183,5 +182,4 @@ do { \
183 182
184#include <asm-generic/page.h> 183#include <asm-generic/page.h>
185 184
186#endif /* __KERNEL__ */
187#endif /* _ASM_POWERPC_PAGE_64_H */ 185#endif /* _ASM_POWERPC_PAGE_64_H */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index ffc150f602b8..891d68932f39 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -55,6 +55,8 @@ struct pt_regs {
55 55
56#ifdef __powerpc64__ 56#ifdef __powerpc64__
57 57
58#define __ARCH_WANT_COMPAT_SYS_PTRACE
59
58#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ 60#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
59 61
60/* Size of dummy stack frame allocated when calling signal handler. */ 62/* Size of dummy stack frame allocated when calling signal handler. */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 2408a29507e5..0d6238987df8 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -18,6 +18,10 @@
18#include <asm/reg_booke.h> 18#include <asm/reg_booke.h>
19#endif /* CONFIG_BOOKE || CONFIG_40x */ 19#endif /* CONFIG_BOOKE || CONFIG_40x */
20 20
21#ifdef CONFIG_FSL_EMB_PERFMON
22#include <asm/reg_fsl_emb.h>
23#endif
24
21#ifdef CONFIG_8xx 25#ifdef CONFIG_8xx
22#include <asm/reg_8xx.h> 26#include <asm/reg_8xx.h>
23#endif /* CONFIG_8xx */ 27#endif /* CONFIG_8xx */
diff --git a/include/asm-powerpc/reg_booke.h b/include/asm-powerpc/reg_booke.h
index 0405ef479814..cf54a3f31753 100644
--- a/include/asm-powerpc/reg_booke.h
+++ b/include/asm-powerpc/reg_booke.h
@@ -9,68 +9,6 @@
9#ifndef __ASM_POWERPC_REG_BOOKE_H__ 9#ifndef __ASM_POWERPC_REG_BOOKE_H__
10#define __ASM_POWERPC_REG_BOOKE_H__ 10#define __ASM_POWERPC_REG_BOOKE_H__
11 11
12#ifndef __ASSEMBLY__
13/* Performance Monitor Registers */
14#define mfpmr(rn) ({unsigned int rval; \
15 asm volatile("mfpmr %0," __stringify(rn) \
16 : "=r" (rval)); rval;})
17#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
18#endif /* __ASSEMBLY__ */
19
20/* Freescale Book E Performance Monitor APU Registers */
21#define PMRN_PMC0 0x010 /* Performance Monitor Counter 0 */
22#define PMRN_PMC1 0x011 /* Performance Monitor Counter 1 */
23#define PMRN_PMC2 0x012 /* Performance Monitor Counter 1 */
24#define PMRN_PMC3 0x013 /* Performance Monitor Counter 1 */
25#define PMRN_PMLCA0 0x090 /* PM Local Control A0 */
26#define PMRN_PMLCA1 0x091 /* PM Local Control A1 */
27#define PMRN_PMLCA2 0x092 /* PM Local Control A2 */
28#define PMRN_PMLCA3 0x093 /* PM Local Control A3 */
29
30#define PMLCA_FC 0x80000000 /* Freeze Counter */
31#define PMLCA_FCS 0x40000000 /* Freeze in Supervisor */
32#define PMLCA_FCU 0x20000000 /* Freeze in User */
33#define PMLCA_FCM1 0x10000000 /* Freeze when PMM==1 */
34#define PMLCA_FCM0 0x08000000 /* Freeze when PMM==0 */
35#define PMLCA_CE 0x04000000 /* Condition Enable */
36
37#define PMLCA_EVENT_MASK 0x007f0000 /* Event field */
38#define PMLCA_EVENT_SHIFT 16
39
40#define PMRN_PMLCB0 0x110 /* PM Local Control B0 */
41#define PMRN_PMLCB1 0x111 /* PM Local Control B1 */
42#define PMRN_PMLCB2 0x112 /* PM Local Control B2 */
43#define PMRN_PMLCB3 0x113 /* PM Local Control B3 */
44
45#define PMLCB_THRESHMUL_MASK 0x0700 /* Threshhold Multiple Field */
46#define PMLCB_THRESHMUL_SHIFT 8
47
48#define PMLCB_THRESHOLD_MASK 0x003f /* Threshold Field */
49#define PMLCB_THRESHOLD_SHIFT 0
50
51#define PMRN_PMGC0 0x190 /* PM Global Control 0 */
52
53#define PMGC0_FAC 0x80000000 /* Freeze all Counters */
54#define PMGC0_PMIE 0x40000000 /* Interrupt Enable */
55#define PMGC0_FCECE 0x20000000 /* Freeze countes on
56 Enabled Condition or
57 Event */
58
59#define PMRN_UPMC0 0x000 /* User Performance Monitor Counter 0 */
60#define PMRN_UPMC1 0x001 /* User Performance Monitor Counter 1 */
61#define PMRN_UPMC2 0x002 /* User Performance Monitor Counter 1 */
62#define PMRN_UPMC3 0x003 /* User Performance Monitor Counter 1 */
63#define PMRN_UPMLCA0 0x080 /* User PM Local Control A0 */
64#define PMRN_UPMLCA1 0x081 /* User PM Local Control A1 */
65#define PMRN_UPMLCA2 0x082 /* User PM Local Control A2 */
66#define PMRN_UPMLCA3 0x083 /* User PM Local Control A3 */
67#define PMRN_UPMLCB0 0x100 /* User PM Local Control B0 */
68#define PMRN_UPMLCB1 0x101 /* User PM Local Control B1 */
69#define PMRN_UPMLCB2 0x102 /* User PM Local Control B2 */
70#define PMRN_UPMLCB3 0x103 /* User PM Local Control B3 */
71#define PMRN_UPMGC0 0x180 /* User PM Global Control 0 */
72
73
74/* Machine State Register (MSR) Fields */ 12/* Machine State Register (MSR) Fields */
75#define MSR_UCLE (1<<26) /* User-mode cache lock enable */ 13#define MSR_UCLE (1<<26) /* User-mode cache lock enable */
76#define MSR_SPE (1<<25) /* Enable SPE */ 14#define MSR_SPE (1<<25) /* Enable SPE */
diff --git a/include/asm-powerpc/reg_fsl_emb.h b/include/asm-powerpc/reg_fsl_emb.h
new file mode 100644
index 000000000000..1e180a594589
--- /dev/null
+++ b/include/asm-powerpc/reg_fsl_emb.h
@@ -0,0 +1,72 @@
1/*
2 * Contains register definitions for the Freescale Embedded Performance
3 * Monitor.
4 */
5#ifdef __KERNEL__
6#ifndef __ASM_POWERPC_REG_FSL_EMB_H__
7#define __ASM_POWERPC_REG_FSL_EMB_H__
8
9#ifndef __ASSEMBLY__
10/* Performance Monitor Registers */
11#define mfpmr(rn) ({unsigned int rval; \
12 asm volatile("mfpmr %0," __stringify(rn) \
13 : "=r" (rval)); rval;})
14#define mtpmr(rn, v) asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
15#endif /* __ASSEMBLY__ */
16
17/* Freescale Book E Performance Monitor APU Registers */
18#define PMRN_PMC0 0x010 /* Performance Monitor Counter 0 */
19#define PMRN_PMC1 0x011 /* Performance Monitor Counter 1 */
20#define PMRN_PMC2 0x012 /* Performance Monitor Counter 1 */
21#define PMRN_PMC3 0x013 /* Performance Monitor Counter 1 */
22#define PMRN_PMLCA0 0x090 /* PM Local Control A0 */
23#define PMRN_PMLCA1 0x091 /* PM Local Control A1 */
24#define PMRN_PMLCA2 0x092 /* PM Local Control A2 */
25#define PMRN_PMLCA3 0x093 /* PM Local Control A3 */
26
27#define PMLCA_FC 0x80000000 /* Freeze Counter */
28#define PMLCA_FCS 0x40000000 /* Freeze in Supervisor */
29#define PMLCA_FCU 0x20000000 /* Freeze in User */
30#define PMLCA_FCM1 0x10000000 /* Freeze when PMM==1 */
31#define PMLCA_FCM0 0x08000000 /* Freeze when PMM==0 */
32#define PMLCA_CE 0x04000000 /* Condition Enable */
33
34#define PMLCA_EVENT_MASK 0x007f0000 /* Event field */
35#define PMLCA_EVENT_SHIFT 16
36
37#define PMRN_PMLCB0 0x110 /* PM Local Control B0 */
38#define PMRN_PMLCB1 0x111 /* PM Local Control B1 */
39#define PMRN_PMLCB2 0x112 /* PM Local Control B2 */
40#define PMRN_PMLCB3 0x113 /* PM Local Control B3 */
41
42#define PMLCB_THRESHMUL_MASK 0x0700 /* Threshhold Multiple Field */
43#define PMLCB_THRESHMUL_SHIFT 8
44
45#define PMLCB_THRESHOLD_MASK 0x003f /* Threshold Field */
46#define PMLCB_THRESHOLD_SHIFT 0
47
48#define PMRN_PMGC0 0x190 /* PM Global Control 0 */
49
50#define PMGC0_FAC 0x80000000 /* Freeze all Counters */
51#define PMGC0_PMIE 0x40000000 /* Interrupt Enable */
52#define PMGC0_FCECE 0x20000000 /* Freeze countes on
53 Enabled Condition or
54 Event */
55
56#define PMRN_UPMC0 0x000 /* User Performance Monitor Counter 0 */
57#define PMRN_UPMC1 0x001 /* User Performance Monitor Counter 1 */
58#define PMRN_UPMC2 0x002 /* User Performance Monitor Counter 1 */
59#define PMRN_UPMC3 0x003 /* User Performance Monitor Counter 1 */
60#define PMRN_UPMLCA0 0x080 /* User PM Local Control A0 */
61#define PMRN_UPMLCA1 0x081 /* User PM Local Control A1 */
62#define PMRN_UPMLCA2 0x082 /* User PM Local Control A2 */
63#define PMRN_UPMLCA3 0x083 /* User PM Local Control A3 */
64#define PMRN_UPMLCB0 0x100 /* User PM Local Control B0 */
65#define PMRN_UPMLCB1 0x101 /* User PM Local Control B1 */
66#define PMRN_UPMLCB2 0x102 /* User PM Local Control B2 */
67#define PMRN_UPMLCB3 0x103 /* User PM Local Control B3 */
68#define PMRN_UPMGC0 0x180 /* User PM Global Control 0 */
69
70
71#endif /* __ASM_POWERPC_REG_FSL_EMB_H__ */
72#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index bc9739dff5e7..29552ff182aa 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -65,7 +65,7 @@
65struct task_struct; 65struct task_struct;
66struct pt_regs; 66struct pt_regs;
67 67
68#ifdef CONFIG_DEBUGGER 68#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
69 69
70extern int (*__debugger)(struct pt_regs *regs); 70extern int (*__debugger)(struct pt_regs *regs);
71extern int (*__debugger_ipi)(struct pt_regs *regs); 71extern int (*__debugger_ipi)(struct pt_regs *regs);
@@ -463,7 +463,7 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
463 return old; 463 return old;
464} 464}
465 465
466#define cmpxchg(ptr,o,n) \ 466#define cmpxchg(ptr, o, n) \
467 ({ \ 467 ({ \
468 __typeof__(*(ptr)) _o_ = (o); \ 468 __typeof__(*(ptr)) _o_ = (o); \
469 __typeof__(*(ptr)) _n_ = (n); \ 469 __typeof__(*(ptr)) _n_ = (n); \
@@ -472,7 +472,7 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
472 }) 472 })
473 473
474 474
475#define cmpxchg_local(ptr,o,n) \ 475#define cmpxchg_local(ptr, o, n) \
476 ({ \ 476 ({ \
477 __typeof__(*(ptr)) _o_ = (o); \ 477 __typeof__(*(ptr)) _o_ = (o); \
478 __typeof__(*(ptr)) _n_ = (n); \ 478 __typeof__(*(ptr)) _n_ = (n); \
@@ -492,6 +492,20 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
492 */ 492 */
493#define NET_IP_ALIGN 0 493#define NET_IP_ALIGN 0
494#define NET_SKB_PAD L1_CACHE_BYTES 494#define NET_SKB_PAD L1_CACHE_BYTES
495
496#define cmpxchg64(ptr, o, n) \
497 ({ \
498 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
499 cmpxchg((ptr), (o), (n)); \
500 })
501#define cmpxchg64_local(ptr, o, n) \
502 ({ \
503 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
504 cmpxchg_local((ptr), (o), (n)); \
505 })
506#else
507#include <asm-generic/cmpxchg-local.h>
508#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
495#endif 509#endif
496 510
497#define arch_align_stack(x) (x) 511#define arch_align_stack(x) (x)
diff --git a/include/asm-powerpc/user.h b/include/asm-powerpc/user.h
index e59ade4b3dfb..3fd4545dd74e 100644
--- a/include/asm-powerpc/user.h
+++ b/include/asm-powerpc/user.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_POWERPC_USER_H 1#ifndef _ASM_POWERPC_USER_H
2#define _ASM_POWERPC_USER_H 2#define _ASM_POWERPC_USER_H
3 3
4#ifdef __KERNEL__
5
6#include <asm/ptrace.h> 4#include <asm/ptrace.h>
7#include <asm/page.h> 5#include <asm/page.h>
8 6
@@ -40,7 +38,7 @@ struct user {
40 unsigned long start_data; /* data starting address */ 38 unsigned long start_data; /* data starting address */
41 unsigned long start_stack; /* stack starting address */ 39 unsigned long start_stack; /* stack starting address */
42 long int signal; /* signal causing core dump */ 40 long int signal; /* signal causing core dump */
43 struct regs * u_ar0; /* help gdb find registers */ 41 unsigned long u_ar0; /* help gdb find registers */
44 unsigned long magic; /* identifies a core file */ 42 unsigned long magic; /* identifies a core file */
45 char u_comm[32]; /* user command name */ 43 char u_comm[32]; /* user command name */
46}; 44};
@@ -50,6 +48,4 @@ struct user {
50#define HOST_TEXT_START_ADDR (u.start_code) 48#define HOST_TEXT_START_ADDR (u.start_code)
51#define HOST_DATA_START_ADDR (u.start_data) 49#define HOST_DATA_START_ADDR (u.start_data)
52#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 50#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
53
54#endif /* __KERNEL__ */
55#endif /* _ASM_POWERPC_USER_H */ 51#endif /* _ASM_POWERPC_USER_H */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 9204c15839c5..56512a968dab 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -66,7 +66,7 @@ extern void __devinit vio_unregister_device(struct vio_dev *dev);
66 66
67struct device_node; 67struct device_node;
68 68
69extern struct vio_dev * __devinit vio_register_device_node( 69extern struct vio_dev *vio_register_device_node(
70 struct device_node *node_vdev); 70 struct device_node *node_vdev);
71extern const void *vio_get_attribute(struct vio_dev *vdev, char *which, 71extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
72 int *length); 72 int *length);
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 51df94c73846..0593cb889d45 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -209,12 +209,34 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
209 return prev; 209 return prev;
210} 210}
211 211
212static inline unsigned long
213__cmpxchg_u32_local(volatile unsigned int *p, unsigned int old,
214 unsigned int new)
215{
216 unsigned int prev;
217
218 __asm__ __volatile__ ("\n\
2191: lwarx %0,0,%2 \n\
220 cmpw 0,%0,%3 \n\
221 bne 2f \n"
222 PPC405_ERR77(0,%2)
223" stwcx. %4,0,%2 \n\
224 bne- 1b\n"
225"2:"
226 : "=&r" (prev), "=m" (*p)
227 : "r" (p), "r" (old), "r" (new), "m" (*p)
228 : "cc", "memory");
229
230 return prev;
231}
232
212/* This function doesn't exist, so you'll get a linker error 233/* This function doesn't exist, so you'll get a linker error
213 if something tries to do an invalid cmpxchg(). */ 234 if something tries to do an invalid cmpxchg(). */
214extern void __cmpxchg_called_with_bad_pointer(void); 235extern void __cmpxchg_called_with_bad_pointer(void);
215 236
216static __inline__ unsigned long 237static __inline__ unsigned long
217__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 238__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
239 unsigned int size)
218{ 240{
219 switch (size) { 241 switch (size) {
220 case 4: 242 case 4:
@@ -228,7 +250,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
228 return old; 250 return old;
229} 251}
230 252
231#define cmpxchg(ptr,o,n) \ 253#define cmpxchg(ptr, o, n) \
232 ({ \ 254 ({ \
233 __typeof__(*(ptr)) _o_ = (o); \ 255 __typeof__(*(ptr)) _o_ = (o); \
234 __typeof__(*(ptr)) _n_ = (n); \ 256 __typeof__(*(ptr)) _n_ = (n); \
@@ -236,6 +258,31 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
236 (unsigned long)_n_, sizeof(*(ptr))); \ 258 (unsigned long)_n_, sizeof(*(ptr))); \
237 }) 259 })
238 260
261#include <asm-generic/cmpxchg-local.h>
262
263static inline unsigned long __cmpxchg_local(volatile void *ptr,
264 unsigned long old,
265 unsigned long new, int size)
266{
267 switch (size) {
268 case 4:
269 return __cmpxchg_u32_local(ptr, old, new);
270 default:
271 return __cmpxchg_local_generic(ptr, old, new, size);
272 }
273
274 return old;
275}
276
277/*
278 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
279 * them available.
280 */
281#define cmpxchg_local(ptr, o, n) \
282 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
283 (unsigned long)(n), sizeof(*(ptr))))
284#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
285
239#define arch_align_stack(x) (x) 286#define arch_align_stack(x) (x)
240 287
241#endif /* __KERNEL__ */ 288#endif /* __KERNEL__ */
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index 91d06325cc79..b73a424d0f97 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -113,7 +113,6 @@
113typedef s390_fp_regs elf_fpregset_t; 113typedef s390_fp_regs elf_fpregset_t;
114typedef s390_regs elf_gregset_t; 114typedef s390_regs elf_gregset_t;
115 115
116#ifdef __KERNEL__
117#include <linux/sched.h> /* for task_struct */ 116#include <linux/sched.h> /* for task_struct */
118#include <asm/system.h> /* for save_access_regs */ 117#include <asm/system.h> /* for save_access_regs */
119 118
@@ -214,6 +213,5 @@ do { \
214 clear_thread_flag(TIF_31BIT); \ 213 clear_thread_flag(TIF_31BIT); \
215} while (0) 214} while (0)
216#endif /* __s390x__ */ 215#endif /* __s390x__ */
217#endif
218 216
219#endif 217#endif
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h
index 7592af708b41..f219c6411e0b 100644
--- a/include/asm-s390/kexec.h
+++ b/include/asm-s390/kexec.h
@@ -10,7 +10,9 @@
10#ifndef _S390_KEXEC_H 10#ifndef _S390_KEXEC_H
11#define _S390_KEXEC_H 11#define _S390_KEXEC_H
12 12
13#ifdef __KERNEL__
13#include <asm/page.h> 14#include <asm/page.h>
15#endif
14#include <asm/processor.h> 16#include <asm/processor.h>
15/* 17/*
16 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. 18 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 584d0ee3c7f6..a55f9d979dfb 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -19,7 +19,6 @@
19#define PAGE_DEFAULT_ACC 0 19#define PAGE_DEFAULT_ACC 0
20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) 20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
21 21
22#ifdef __KERNEL__
23#include <asm/setup.h> 22#include <asm/setup.h>
24#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
25 24
@@ -172,6 +171,4 @@ static inline int pfn_valid(unsigned long pfn)
172#include <asm-generic/memory_model.h> 171#include <asm-generic/memory_model.h>
173#include <asm-generic/page.h> 172#include <asm-generic/page.h>
174 173
175#endif /* __KERNEL__ */
176
177#endif /* _S390_PAGE_H */ 174#endif /* _S390_PAGE_H */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 44bda786eef7..15aba30601a3 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -201,9 +201,9 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
201 201
202#define __HAVE_ARCH_CMPXCHG 1 202#define __HAVE_ARCH_CMPXCHG 1
203 203
204#define cmpxchg(ptr,o,n)\ 204#define cmpxchg(ptr, o, n) \
205 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 205 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
206 (unsigned long)(n),sizeof(*(ptr)))) 206 (unsigned long)(n), sizeof(*(ptr))))
207 207
208extern void __cmpxchg_called_with_bad_pointer(void); 208extern void __cmpxchg_called_with_bad_pointer(void);
209 209
@@ -355,6 +355,44 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
355 355
356#include <linux/irqflags.h> 356#include <linux/irqflags.h>
357 357
358#include <asm-generic/cmpxchg-local.h>
359
360static inline unsigned long __cmpxchg_local(volatile void *ptr,
361 unsigned long old,
362 unsigned long new, int size)
363{
364 switch (size) {
365 case 1:
366 case 2:
367 case 4:
368#ifdef __s390x__
369 case 8:
370#endif
371 return __cmpxchg(ptr, old, new, size);
372 default:
373 return __cmpxchg_local_generic(ptr, old, new, size);
374 }
375
376 return old;
377}
378
379/*
380 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
381 * them available.
382 */
383#define cmpxchg_local(ptr, o, n) \
384 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
385 (unsigned long)(n), sizeof(*(ptr))))
386#ifdef __s390x__
387#define cmpxchg64_local(ptr, o, n) \
388 ({ \
389 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
390 cmpxchg_local((ptr), (o), (n)); \
391 })
392#else
393#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
394#endif
395
358/* 396/*
359 * Use to set psw mask except for the first byte which 397 * Use to set psw mask except for the first byte which
360 * won't be changed by this function. 398 * won't be changed by this function.
diff --git a/include/asm-s390/user.h b/include/asm-s390/user.h
index 1dc74baf03c4..1b050e35fdc6 100644
--- a/include/asm-s390/user.h
+++ b/include/asm-s390/user.h
@@ -63,8 +63,7 @@ struct user {
63 the top of the stack is always found in the 63 the top of the stack is always found in the
64 esp register. */ 64 esp register. */
65 long int signal; /* Signal that caused the core dump. */ 65 long int signal; /* Signal that caused the core dump. */
66 struct user_regs_struct *u_ar0; 66 unsigned long u_ar0; /* Used by gdb to help find the values for */
67 /* Used by gdb to help find the values for */
68 /* the registers. */ 67 /* the registers. */
69 unsigned long magic; /* To uniquely identify a core file */ 68 unsigned long magic; /* To uniquely identify a core file */
70 char u_comm[32]; /* User command that was responsible */ 69 char u_comm[32]; /* User command that was responsible */
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 002e64a4f049..e0fe02950f52 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -7,8 +7,6 @@
7 7
8#include <linux/const.h> 8#include <linux/const.h>
9 9
10#ifdef __KERNEL__
11
12/* PAGE_SHIFT determines the page size */ 10/* PAGE_SHIFT determines the page size */
13#if defined(CONFIG_PAGE_SIZE_4KB) 11#if defined(CONFIG_PAGE_SIZE_4KB)
14# define PAGE_SHIFT 12 12# define PAGE_SHIFT 12
@@ -178,5 +176,4 @@ typedef struct { unsigned long pgd; } pgd_t;
178#define ARCH_SLAB_MINALIGN 8 176#define ARCH_SLAB_MINALIGN 8
179#endif 177#endif
180 178
181#endif /* __KERNEL__ */
182#endif /* __ASM_SH_PAGE_H */ 179#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/user.h b/include/asm-sh/user.h
index 1a4f43c75126..8fd3cf6c58d4 100644
--- a/include/asm-sh/user.h
+++ b/include/asm-sh/user.h
@@ -52,7 +52,7 @@ struct user {
52 unsigned long start_data; /* data starting address */ 52 unsigned long start_data; /* data starting address */
53 unsigned long start_stack; /* stack starting address */ 53 unsigned long start_stack; /* stack starting address */
54 long int signal; /* signal causing core dump */ 54 long int signal; /* signal causing core dump */
55 struct regs * u_ar0; /* help gdb find registers */ 55 unsigned long u_ar0; /* help gdb find registers */
56 struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */ 56 struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */
57 unsigned long magic; /* identifies a core file */ 57 unsigned long magic; /* identifies a core file */
58 char u_comm[32]; /* user command name */ 58 char u_comm[32]; /* user command name */
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index 3328950dbfe6..5c944b5a8040 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -17,42 +17,6 @@ typedef struct { volatile int counter; } atomic_t;
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20/* Emulate cmpxchg() the same way we emulate atomics,
21 * by hashing the object address and indexing into an array
22 * of spinlocks to get a bit of performance...
23 *
24 * See arch/sparc/lib/atomic32.c for implementation.
25 *
26 * Cribbed from <asm-parisc/atomic.h>
27 */
28#define __HAVE_ARCH_CMPXCHG 1
29
30/* bug catcher for when unsupported size is used - won't link */
31extern void __cmpxchg_called_with_bad_pointer(void);
32/* we only need to support cmpxchg of a u32 on sparc */
33extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
34
35/* don't worry...optimizer will get rid of most of this */
36static inline unsigned long
37__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
38{
39 switch(size) {
40 case 4:
41 return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_);
42 default:
43 __cmpxchg_called_with_bad_pointer();
44 break;
45 }
46 return old;
47}
48
49#define cmpxchg(ptr,o,n) ({ \
50 __typeof__(*(ptr)) _o_ = (o); \
51 __typeof__(*(ptr)) _n_ = (n); \
52 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
53 (unsigned long)_n_, sizeof(*(ptr))); \
54})
55
56#define ATOMIC_INIT(i) { (i) } 20#define ATOMIC_INIT(i) { (i) }
57 21
58extern int __atomic_add_return(int, atomic_t *); 22extern int __atomic_add_return(int, atomic_t *);
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index aaf6ef40ee2f..668814e1e539 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -85,7 +85,6 @@ typedef struct {
85 unsigned int pr_q[64]; 85 unsigned int pr_q[64];
86} elf_fpregset_t; 86} elf_fpregset_t;
87 87
88#ifdef __KERNEL__
89#include <asm/mbus.h> 88#include <asm/mbus.h>
90#include <asm/uaccess.h> 89#include <asm/uaccess.h>
91 90
@@ -166,6 +165,4 @@ do { unsigned long *dest = &(__elf_regs[0]); \
166 165
167#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 166#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
168 167
169#endif /* __KERNEL__ */
170
171#endif /* !(__ASMSPARC_ELF_H) */ 168#endif /* !(__ASMSPARC_ELF_H) */
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index ff57648eb8f8..cbc48c0c4e15 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -8,8 +8,6 @@
8#ifndef _SPARC_PAGE_H 8#ifndef _SPARC_PAGE_H
9#define _SPARC_PAGE_H 9#define _SPARC_PAGE_H
10 10
11#ifdef __KERNEL__
12
13#ifdef CONFIG_SUN4 11#ifdef CONFIG_SUN4
14#define PAGE_SHIFT 13 12#define PAGE_SHIFT 13
15#else 13#else
@@ -163,6 +161,4 @@ extern unsigned long pfn_base;
163#include <asm-generic/memory_model.h> 161#include <asm-generic/memory_model.h>
164#include <asm-generic/page.h> 162#include <asm-generic/page.h>
165 163
166#endif /* __KERNEL__ */
167
168#endif /* _SPARC_PAGE_H */ 164#endif /* _SPARC_PAGE_H */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 2655d142b22d..45e47c159a6e 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -225,6 +225,54 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int
225 return x; 225 return x;
226} 226}
227 227
228/* Emulate cmpxchg() the same way we emulate atomics,
229 * by hashing the object address and indexing into an array
230 * of spinlocks to get a bit of performance...
231 *
232 * See arch/sparc/lib/atomic32.c for implementation.
233 *
234 * Cribbed from <asm-parisc/atomic.h>
235 */
236#define __HAVE_ARCH_CMPXCHG 1
237
238/* bug catcher for when unsupported size is used - won't link */
239extern void __cmpxchg_called_with_bad_pointer(void);
240/* we only need to support cmpxchg of a u32 on sparc */
241extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
242
243/* don't worry...optimizer will get rid of most of this */
244static inline unsigned long
245__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
246{
247 switch (size) {
248 case 4:
249 return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_);
250 default:
251 __cmpxchg_called_with_bad_pointer();
252 break;
253 }
254 return old;
255}
256
257#define cmpxchg(ptr, o, n) \
258({ \
259 __typeof__(*(ptr)) _o_ = (o); \
260 __typeof__(*(ptr)) _n_ = (n); \
261 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
262 (unsigned long)_n_, sizeof(*(ptr))); \
263})
264
265#include <asm-generic/cmpxchg-local.h>
266
267/*
268 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
269 * them available.
270 */
271#define cmpxchg_local(ptr, o, n) \
272 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
273 (unsigned long)(n), sizeof(*(ptr))))
274#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
275
228extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); 276extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn));
229 277
230#endif /* __KERNEL__ */ 278#endif /* __KERNEL__ */
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 8653e8665009..dc7bc63e507e 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -7,11 +7,9 @@
7 */ 7 */
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#ifdef __KERNEL__
11#include <asm/processor.h> 10#include <asm/processor.h>
12#include <asm/uaccess.h> 11#include <asm/uaccess.h>
13#include <asm/spitfire.h> 12#include <asm/spitfire.h>
14#endif
15 13
16/* 14/*
17 * Sparc section types 15 * Sparc section types
@@ -175,7 +173,6 @@ static inline unsigned int sparc64_elf_hwcap(void)
175 173
176#define ELF_PLATFORM (NULL) 174#define ELF_PLATFORM (NULL)
177 175
178#ifdef __KERNEL__
179#define SET_PERSONALITY(ex, ibcs2) \ 176#define SET_PERSONALITY(ex, ibcs2) \
180do { unsigned long new_flags = current_thread_info()->flags; \ 177do { unsigned long new_flags = current_thread_info()->flags; \
181 new_flags &= _TIF_32BIT; \ 178 new_flags &= _TIF_32BIT; \
@@ -194,6 +191,5 @@ do { unsigned long new_flags = current_thread_info()->flags; \
194 else if (current->personality != PER_LINUX32) \ 191 else if (current->personality != PER_LINUX32) \
195 set_personality(PER_LINUX); \ 192 set_personality(PER_LINUX); \
196} while (0) 193} while (0)
197#endif
198 194
199#endif /* !(__ASM_SPARC64_ELF_H) */ 195#endif /* !(__ASM_SPARC64_ELF_H) */
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 7af1077451ff..cdf950e017ee 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -3,8 +3,6 @@
3#ifndef _SPARC64_PAGE_H 3#ifndef _SPARC64_PAGE_H
4#define _SPARC64_PAGE_H 4#define _SPARC64_PAGE_H
5 5
6#ifdef __KERNEL__
7
8#include <linux/const.h> 6#include <linux/const.h>
9 7
10#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB) 8#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
@@ -143,5 +141,4 @@ typedef unsigned long pgprot_t;
143 141
144#include <asm-generic/page.h> 142#include <asm-generic/page.h>
145 143
146#endif /* __KERNEL__ */
147#endif /* _SPARC64_PAGE_H */ 144#endif /* _SPARC64_PAGE_H */
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 99a669c190c7..1faefa6d3708 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -8,6 +8,7 @@
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9 9
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <asm-generic/cmpxchg-local.h>
11 12
12/* 13/*
13 * Sparc (general) CPU types 14 * Sparc (general) CPU types
@@ -315,6 +316,34 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
315 (unsigned long)_n_, sizeof(*(ptr))); \ 316 (unsigned long)_n_, sizeof(*(ptr))); \
316 }) 317 })
317 318
319/*
320 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
321 * them available.
322 */
323
324static inline unsigned long __cmpxchg_local(volatile void *ptr,
325 unsigned long old,
326 unsigned long new, int size)
327{
328 switch (size) {
329 case 4:
330 case 8: return __cmpxchg(ptr, old, new, size);
331 default:
332 return __cmpxchg_local_generic(ptr, old, new, size);
333 }
334
335 return old;
336}
337
338#define cmpxchg_local(ptr, o, n) \
339 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
340 (unsigned long)(n), sizeof(*(ptr))))
341#define cmpxchg64_local(ptr, o, n) \
342 ({ \
343 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
344 cmpxchg_local((ptr), (o), (n)); \
345 })
346
318#endif /* !(__ASSEMBLY__) */ 347#endif /* !(__ASSEMBLY__) */
319 348
320#define arch_align_stack(x) (x) 349#define arch_align_stack(x) (x)
diff --git a/include/asm-v850/elf.h b/include/asm-v850/elf.h
index 7db8edffb1c6..28f5b176ff1a 100644
--- a/include/asm-v850/elf.h
+++ b/include/asm-v850/elf.h
@@ -94,8 +94,6 @@ typedef struct user_fpu_struct elf_fpregset_t;
94 0; \ 94 0; \
95 } while (0) 95 } while (0)
96 96
97#ifdef __KERNEL__
98#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 97#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
99#endif
100 98
101#endif /* __V850_ELF_H__ */ 99#endif /* __V850_ELF_H__ */
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index d693ffb1364d..661d8cd08839 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -14,8 +14,6 @@
14#ifndef __V850_PAGE_H__ 14#ifndef __V850_PAGE_H__
15#define __V850_PAGE_H__ 15#define __V850_PAGE_H__
16 16
17#ifdef __KERNEL__
18
19#include <asm/machdep.h> 17#include <asm/machdep.h>
20 18
21 19
@@ -126,6 +124,4 @@ typedef unsigned long pgprot_t;
126#include <asm-generic/memory_model.h> 124#include <asm-generic/memory_model.h>
127#include <asm-generic/page.h> 125#include <asm-generic/page.h>
128 126
129#endif /* KERNEL */
130
131#endif /* __V850_PAGE_H__ */ 127#endif /* __V850_PAGE_H__ */
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h
index a34ddfafd561..7daf1fdee119 100644
--- a/include/asm-v850/system.h
+++ b/include/asm-v850/system.h
@@ -103,6 +103,21 @@ static inline unsigned long __xchg (unsigned long with,
103 return tmp; 103 return tmp;
104} 104}
105 105
106#include <asm-generic/cmpxchg-local.h>
107
108/*
109 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
110 * them available.
111 */
112#define cmpxchg_local(ptr, o, n) \
113 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
114 (unsigned long)(n), sizeof(*(ptr))))
115#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
116
117#ifndef CONFIG_SMP
118#include <asm-generic/cmpxchg.h>
119#endif
120
106#define arch_align_stack(x) (x) 121#define arch_align_stack(x) (x)
107 122
108#endif /* __V850_SYSTEM_H__ */ 123#endif /* __V850_SYSTEM_H__ */
diff --git a/include/asm-v850/user.h b/include/asm-v850/user.h
index ccf4cea6dc9c..63cdc567d272 100644
--- a/include/asm-v850/user.h
+++ b/include/asm-v850/user.h
@@ -3,8 +3,6 @@
3 3
4/* Adapted from <asm-ppc/user.h>. */ 4/* Adapted from <asm-ppc/user.h>. */
5 5
6#ifdef __KERNEL__
7
8#include <linux/ptrace.h> 6#include <linux/ptrace.h>
9#include <asm/page.h> 7#include <asm/page.h>
10 8
@@ -40,7 +38,7 @@ struct user {
40 unsigned long start_data; /* data starting address */ 38 unsigned long start_data; /* data starting address */
41 unsigned long start_stack; /* stack starting address */ 39 unsigned long start_stack; /* stack starting address */
42 long int signal; /* signal causing core dump */ 40 long int signal; /* signal causing core dump */
43 struct regs * u_ar0; /* help gdb find registers */ 41 unsigned long u_ar0; /* help gdb find registers */
44 unsigned long magic; /* identifies a core file */ 42 unsigned long magic; /* identifies a core file */
45 char u_comm[32]; /* user command name */ 43 char u_comm[32]; /* user command name */
46}; 44};
@@ -51,6 +49,4 @@ struct user {
51#define HOST_DATA_START_ADDR (u.start_data) 49#define HOST_DATA_START_ADDR (u.start_data)
52#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 50#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
53 51
54#endif /* __KERNEL__ */
55
56#endif /* __V850_USER_H__ */ 52#endif /* __V850_USER_H__ */
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 3c6f0f80e827..b04a7ff46df1 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -22,7 +22,5 @@ unifdef-y += posix_types_64.h
22unifdef-y += ptrace.h 22unifdef-y += ptrace.h
23unifdef-y += unistd_32.h 23unifdef-y += unistd_32.h
24unifdef-y += unistd_64.h 24unifdef-y += unistd_64.h
25unifdef-y += user_32.h
26unifdef-y += user_64.h
27unifdef-y += vm86.h 25unifdef-y += vm86.h
28unifdef-y += vsyscall.h 26unifdef-y += vsyscall.h
diff --git a/include/asm-x86/cmpxchg_64.h b/include/asm-x86/cmpxchg_64.h
index 5e182062e6ec..56f5b41e071c 100644
--- a/include/asm-x86/cmpxchg_64.h
+++ b/include/asm-x86/cmpxchg_64.h
@@ -124,11 +124,21 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
124 return old; 124 return old;
125} 125}
126 126
127#define cmpxchg(ptr,o,n)\ 127#define cmpxchg(ptr, o, n) \
128 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 128 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
129 (unsigned long)(n),sizeof(*(ptr)))) 129 (unsigned long)(n), sizeof(*(ptr))))
130#define cmpxchg_local(ptr,o,n)\ 130#define cmpxchg64(ptr, o, n) \
131 ((__typeof__(*(ptr)))__cmpxchg_local((ptr),(unsigned long)(o),\ 131 ({ \
132 (unsigned long)(n),sizeof(*(ptr)))) 132 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
133 cmpxchg((ptr), (o), (n)); \
134 })
135#define cmpxchg_local(ptr, o, n) \
136 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
137 (unsigned long)(n), sizeof(*(ptr))))
138#define cmpxchg64_local(ptr, o, n) \
139 ({ \
140 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
141 cmpxchg_local((ptr), (o), (n)); \
142 })
133 143
134#endif 144#endif
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
index d9c94e707289..fb62f9941e38 100644
--- a/include/asm-x86/elf.h
+++ b/include/asm-x86/elf.h
@@ -72,7 +72,6 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
72 72
73#endif 73#endif
74 74
75#ifdef __KERNEL__
76#include <asm/vdso.h> 75#include <asm/vdso.h>
77 76
78extern unsigned int vdso_enabled; 77extern unsigned int vdso_enabled;
@@ -321,6 +320,4 @@ extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
321extern unsigned long arch_randomize_brk(struct mm_struct *mm); 320extern unsigned long arch_randomize_brk(struct mm_struct *mm);
322#define arch_randomize_brk arch_randomize_brk 321#define arch_randomize_brk arch_randomize_brk
323 322
324#endif /* __KERNEL__ */
325
326#endif 323#endif
diff --git a/include/asm-x86/mmzone_32.h b/include/asm-x86/mmzone_32.h
index 5d6f4ce6e6d6..274a59566c45 100644
--- a/include/asm-x86/mmzone_32.h
+++ b/include/asm-x86/mmzone_32.h
@@ -107,8 +107,8 @@ static inline int pfn_valid(int pfn)
107/* 107/*
108 * Following are macros that are specific to this numa platform. 108 * Following are macros that are specific to this numa platform.
109 */ 109 */
110#define reserve_bootmem(addr, size) \ 110#define reserve_bootmem(addr, size, flags) \
111 reserve_bootmem_node(NODE_DATA(0), (addr), (size)) 111 reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
112#define alloc_bootmem(x) \ 112#define alloc_bootmem(x) \
113 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 113 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
114#define alloc_bootmem_low(x) \ 114#define alloc_bootmem_low(x) \
diff --git a/include/asm-x86/termios.h b/include/asm-x86/termios.h
index d501748700d2..f72956331c49 100644
--- a/include/asm-x86/termios.h
+++ b/include/asm-x86/termios.h
@@ -41,6 +41,8 @@ struct termio {
41 41
42#ifdef __KERNEL__ 42#ifdef __KERNEL__
43 43
44#include <asm/uaccess.h>
45
44/* intr=^C quit=^\ erase=del kill=^U 46/* intr=^C quit=^\ erase=del kill=^U
45 eof=^D vtime=\0 vmin=\1 sxtc=\0 47 eof=^D vtime=\0 vmin=\1 sxtc=\0
46 start=^Q stop=^S susp=^Z eol=\0 48 start=^Q stop=^S susp=^Z eol=\0
@@ -58,39 +60,53 @@ struct termio {
58 *(unsigned short *) &(termios)->x = __tmp; \ 60 *(unsigned short *) &(termios)->x = __tmp; \
59} 61}
60 62
61#define user_termio_to_kernel_termios(termios, termio) \ 63static inline int user_termio_to_kernel_termios(struct ktermios *termios,
62({ \ 64 struct termio __user *termio)
63 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ 65{
64 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ 66 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
65 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ 67 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
66 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ 68 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
67 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ 69 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
68}) 70 return copy_from_user(termios->c_cc, termio->c_cc, NCC);
71}
69 72
70/* 73/*
71 * Translate a "termios" structure into a "termio". Ugh. 74 * Translate a "termios" structure into a "termio". Ugh.
72 */ 75 */
73#define kernel_termios_to_user_termio(termio, termios) \ 76static inline int kernel_termios_to_user_termio(struct termio __user *termio,
74({ \ 77 struct ktermios *termios)
75 put_user((termios)->c_iflag, &(termio)->c_iflag); \ 78{
76 put_user((termios)->c_oflag, &(termio)->c_oflag); \ 79 put_user((termios)->c_iflag, &(termio)->c_iflag);
77 put_user((termios)->c_cflag, &(termio)->c_cflag); \ 80 put_user((termios)->c_oflag, &(termio)->c_oflag);
78 put_user((termios)->c_lflag, &(termio)->c_lflag); \ 81 put_user((termios)->c_cflag, &(termio)->c_cflag);
79 put_user((termios)->c_line, &(termio)->c_line); \ 82 put_user((termios)->c_lflag, &(termio)->c_lflag);
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 83 put_user((termios)->c_line, &(termio)->c_line);
81}) 84 return copy_to_user((termio)->c_cc, (termios)->c_cc, NCC);
82 85}
83#define user_termios_to_kernel_termios(k, u) \ 86
84 copy_from_user(k, u, sizeof(struct termios2)) 87static inline int user_termios_to_kernel_termios(struct ktermios *k,
85 88 struct termios2 __user *u)
86#define kernel_termios_to_user_termios(u, k) \ 89{
87 copy_to_user(u, k, sizeof(struct termios2)) 90 return copy_from_user(k, u, sizeof(struct termios2));
88 91}
89#define user_termios_to_kernel_termios_1(k, u) \ 92
90 copy_from_user(k, u, sizeof(struct termios)) 93static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
91 94 struct ktermios *k)
92#define kernel_termios_to_user_termios_1(u, k) \ 95{
93 copy_to_user(u, k, sizeof(struct termios)) 96 return copy_to_user(u, k, sizeof(struct termios2));
97}
98
99static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
100 struct termios __user *u)
101{
102 return copy_from_user(k, u, sizeof(struct termios));
103}
104
105static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
106 struct ktermios *k)
107{
108 return copy_to_user(u, k, sizeof(struct termios));
109}
94 110
95#endif /* __KERNEL__ */ 111#endif /* __KERNEL__ */
96 112
diff --git a/include/asm-x86/user.h b/include/asm-x86/user.h
index 484715abe74a..999873b22e7f 100644
--- a/include/asm-x86/user.h
+++ b/include/asm-x86/user.h
@@ -1,13 +1,5 @@
1#ifdef __KERNEL__ 1#ifdef CONFIG_X86_32
2# ifdef CONFIG_X86_32 2# include "user_32.h"
3# include "user_32.h"
4# else
5# include "user_64.h"
6# endif
7#else 3#else
8# ifdef __i386__ 4# include "user_64.h"
9# include "user_32.h"
10# else
11# include "user_64.h"
12# endif
13#endif 5#endif
diff --git a/include/asm-x86/user_32.h b/include/asm-x86/user_32.h
index ed8b8fc6906c..6157da6f882c 100644
--- a/include/asm-x86/user_32.h
+++ b/include/asm-x86/user_32.h
@@ -116,7 +116,7 @@ struct user{
116 esp register. */ 116 esp register. */
117 long int signal; /* Signal that caused the core dump. */ 117 long int signal; /* Signal that caused the core dump. */
118 int reserved; /* No longer used */ 118 int reserved; /* No longer used */
119 struct user_pt_regs * u_ar0; /* Used by gdb to help find the values for */ 119 unsigned long u_ar0; /* Used by gdb to help find the values for */
120 /* the registers. */ 120 /* the registers. */
121 struct user_i387_struct* u_fpstate; /* Math Co-processor pointer. */ 121 struct user_i387_struct* u_fpstate; /* Math Co-processor pointer. */
122 unsigned long magic; /* To uniquely identify a core file */ 122 unsigned long magic; /* To uniquely identify a core file */
diff --git a/include/asm-x86/user_64.h b/include/asm-x86/user_64.h
index a5449d456cc0..963616455609 100644
--- a/include/asm-x86/user_64.h
+++ b/include/asm-x86/user_64.h
@@ -118,7 +118,7 @@ struct user{
118 long int signal; /* Signal that caused the core dump. */ 118 long int signal; /* Signal that caused the core dump. */
119 int reserved; /* No longer used */ 119 int reserved; /* No longer used */
120 int pad1; 120 int pad1;
121 struct user_pt_regs * u_ar0; /* Used by gdb to help find the values for */ 121 unsigned long u_ar0; /* Used by gdb to help find the values for */
122 /* the registers. */ 122 /* the registers. */
123 struct user_i387_struct* u_fpstate; /* Math Co-processor pointer. */ 123 struct user_i387_struct* u_fpstate; /* Math Co-processor pointer. */
124 unsigned long magic; /* To uniquely identify a core file */ 124 unsigned long magic; /* To uniquely identify a core file */
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index 7083d46766a8..467384542502 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -257,8 +257,6 @@ extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
257 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \ 257 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \
258 } while (0) 258 } while (0)
259 259
260#ifdef __KERNEL__
261
262#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 260#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
263 261
264struct task_struct; 262struct task_struct;
@@ -272,5 +270,4 @@ extern void do_save_fpregs (elf_fpregset_t*, struct pt_regs*,
272extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*, 270extern int do_restore_fpregs (elf_fpregset_t*, struct pt_regs*,
273 struct task_struct*); 271 struct task_struct*);
274 272
275#endif /* __KERNEL__ */
276#endif /* _XTENSA_ELF_H */ 273#endif /* _XTENSA_ELF_H */
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h
index 55ce2c9749a3..1adedbf41d01 100644
--- a/include/asm-xtensa/page.h
+++ b/include/asm-xtensa/page.h
@@ -11,8 +11,6 @@
11#ifndef _XTENSA_PAGE_H 11#ifndef _XTENSA_PAGE_H
12#define _XTENSA_PAGE_H 12#define _XTENSA_PAGE_H
13 13
14#ifdef __KERNEL__
15
16#include <asm/processor.h> 14#include <asm/processor.h>
17#include <asm/types.h> 15#include <asm/types.h>
18#include <asm/cache.h> 16#include <asm/cache.h>
@@ -174,5 +172,4 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*);
174 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 172 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
175 173
176#include <asm-generic/memory_model.h> 174#include <asm-generic/memory_model.h>
177#endif /* __KERNEL__ */
178#endif /* _XTENSA_PAGE_H */ 175#endif /* _XTENSA_PAGE_H */
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index ddc970847ae9..e0cb9116d8ab 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -156,8 +156,30 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
156 (unsigned long)_n_, sizeof (*(ptr))); \ 156 (unsigned long)_n_, sizeof (*(ptr))); \
157 }) 157 })
158 158
159#include <asm-generic/cmpxchg-local.h>
159 160
161static inline unsigned long __cmpxchg_local(volatile void *ptr,
162 unsigned long old,
163 unsigned long new, int size)
164{
165 switch (size) {
166 case 4:
167 return __cmpxchg_u32(ptr, old, new);
168 default:
169 return __cmpxchg_local_generic(ptr, old, new, size);
170 }
160 171
172 return old;
173}
174
175/*
176 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
177 * them available.
178 */
179#define cmpxchg_local(ptr, o, n) \
180 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
181 (unsigned long)(n), sizeof(*(ptr))))
182#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
161 183
162/* 184/*
163 * xchg_u32 185 * xchg_u32
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 93631229fd5c..2ebf068ba504 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -18,7 +18,6 @@ header-y += usb/
18 18
19header-y += affs_hardblocks.h 19header-y += affs_hardblocks.h
20header-y += aio_abi.h 20header-y += aio_abi.h
21header-y += a.out.h
22header-y += arcfb.h 21header-y += arcfb.h
23header-y += atmapi.h 22header-y += atmapi.h
24header-y += atmbr2684.h 23header-y += atmbr2684.h
@@ -60,7 +59,6 @@ header-y += dqblk_v2.h
60header-y += dqblk_xfs.h 59header-y += dqblk_xfs.h
61header-y += efs_fs_sb.h 60header-y += efs_fs_sb.h
62header-y += elf-fdpic.h 61header-y += elf-fdpic.h
63header-y += elf.h
64header-y += elf-em.h 62header-y += elf-em.h
65header-y += fadvise.h 63header-y += fadvise.h
66header-y += fd.h 64header-y += fd.h
@@ -190,6 +188,7 @@ unifdef-y += dccp.h
190unifdef-y += dirent.h 188unifdef-y += dirent.h
191unifdef-y += dlm.h 189unifdef-y += dlm.h
192unifdef-y += edd.h 190unifdef-y += edd.h
191unifdef-y += elf.h
193unifdef-y += elfcore.h 192unifdef-y += elfcore.h
194unifdef-y += errno.h 193unifdef-y += errno.h
195unifdef-y += errqueue.h 194unifdef-y += errqueue.h
@@ -344,7 +343,6 @@ unifdef-y += uinput.h
344unifdef-y += uio.h 343unifdef-y += uio.h
345unifdef-y += unistd.h 344unifdef-y += unistd.h
346unifdef-y += usbdevice_fs.h 345unifdef-y += usbdevice_fs.h
347unifdef-y += user.h
348unifdef-y += utsname.h 346unifdef-y += utsname.h
349unifdef-y += videodev2.h 347unifdef-y += videodev2.h
350unifdef-y += videodev.h 348unifdef-y += videodev.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index f913cc3e1b0d..82cd918f2ab7 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -128,12 +128,20 @@ enum machine_type {
128#endif 128#endif
129 129
130#ifdef linux 130#ifdef linux
131#ifdef __KERNEL__
131#include <asm/page.h> 132#include <asm/page.h>
133#else
134#include <unistd.h>
135#endif
132#if defined(__i386__) || defined(__mc68000__) 136#if defined(__i386__) || defined(__mc68000__)
133#define SEGMENT_SIZE 1024 137#define SEGMENT_SIZE 1024
134#else 138#else
135#ifndef SEGMENT_SIZE 139#ifndef SEGMENT_SIZE
140#ifdef __KERNEL__
136#define SEGMENT_SIZE PAGE_SIZE 141#define SEGMENT_SIZE PAGE_SIZE
142#else
143#define SEGMENT_SIZE getpagesize()
144#endif
137#endif 145#endif
138#endif 146#endif
139#endif 147#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0365ec9fc0c9..4e4e340592fb 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -60,8 +60,20 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
60 unsigned long goal, 60 unsigned long goal,
61 unsigned long limit); 61 unsigned long limit);
62 62
63/*
64 * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
65 * the architecture-specific code should honor this)
66 */
67#define BOOTMEM_DEFAULT 0
68#define BOOTMEM_EXCLUSIVE (1<<0)
69
63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 70#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
64extern void reserve_bootmem(unsigned long addr, unsigned long size); 71/*
72 * If flags is 0, then the return value is always 0 (success). If
73 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
74 * memory already was reserved.
75 */
76extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
65#define alloc_bootmem(x) \ 77#define alloc_bootmem(x) \
66 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 78 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
67#define alloc_bootmem_low(x) \ 79#define alloc_bootmem_low(x) \
@@ -84,7 +96,8 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
84 unsigned long endpfn); 96 unsigned long endpfn);
85extern void reserve_bootmem_node(pg_data_t *pgdat, 97extern void reserve_bootmem_node(pg_data_t *pgdat,
86 unsigned long physaddr, 98 unsigned long physaddr,
87 unsigned long size); 99 unsigned long size,
100 int flags);
88extern void free_bootmem_node(pg_data_t *pgdat, 101extern void free_bootmem_node(pg_data_t *pgdat,
89 unsigned long addr, 102 unsigned long addr,
90 unsigned long size); 103 unsigned long size);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 87479328d46d..ff9055fc3d2a 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -14,6 +14,7 @@
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <linux/rcupdate.h> 15#include <linux/rcupdate.h>
16#include <linux/cgroupstats.h> 16#include <linux/cgroupstats.h>
17#include <linux/prio_heap.h>
17 18
18#ifdef CONFIG_CGROUPS 19#ifdef CONFIG_CGROUPS
19 20
@@ -207,6 +208,14 @@ struct cftype {
207 int (*release) (struct inode *inode, struct file *file); 208 int (*release) (struct inode *inode, struct file *file);
208}; 209};
209 210
211struct cgroup_scanner {
212 struct cgroup *cg;
213 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
214 void (*process_task)(struct task_struct *p,
215 struct cgroup_scanner *scan);
216 struct ptr_heap *heap;
217};
218
210/* Add a new file to the given cgroup directory. Should only be 219/* Add a new file to the given cgroup directory. Should only be
211 * called by subsystems from within a populate() method */ 220 * called by subsystems from within a populate() method */
212int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys, 221int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys,
@@ -233,6 +242,7 @@ int cgroup_is_descendant(const struct cgroup *cont);
233struct cgroup_subsys { 242struct cgroup_subsys {
234 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 243 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
235 struct cgroup *cont); 244 struct cgroup *cont);
245 void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
236 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont); 246 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
237 int (*can_attach)(struct cgroup_subsys *ss, 247 int (*can_attach)(struct cgroup_subsys *ss,
238 struct cgroup *cont, struct task_struct *tsk); 248 struct cgroup *cont, struct task_struct *tsk);
@@ -298,11 +308,17 @@ struct cgroup_iter {
298 * returns NULL or until you want to end the iteration 308 * returns NULL or until you want to end the iteration
299 * 309 *
300 * 3) call cgroup_iter_end() to destroy the iterator. 310 * 3) call cgroup_iter_end() to destroy the iterator.
311 *
312 * Or, call cgroup_scan_tasks() to iterate through every task in a cpuset.
313 * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task()
314 * callback, but not while calling the process_task() callback.
301 */ 315 */
302void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it); 316void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it);
303struct task_struct *cgroup_iter_next(struct cgroup *cont, 317struct task_struct *cgroup_iter_next(struct cgroup *cont,
304 struct cgroup_iter *it); 318 struct cgroup_iter *it);
305void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it); 319void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it);
320int cgroup_scan_tasks(struct cgroup_scanner *scan);
321int cgroup_attach_task(struct cgroup *, struct task_struct *);
306 322
307#else /* !CONFIG_CGROUPS */ 323#else /* !CONFIG_CGROUPS */
308 324
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 9ec43186ba80..228235c5ae53 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -37,3 +37,8 @@ SUBSYS(cpuacct)
37 37
38/* */ 38/* */
39 39
40#ifdef CONFIG_CGROUP_MEM_CONT
41SUBSYS(mem_cgroup)
42#endif
43
44/* */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 23932d7741a9..ddd8652fc3f3 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -167,6 +167,10 @@ struct cpufreq_governor {
167 char name[CPUFREQ_NAME_LEN]; 167 char name[CPUFREQ_NAME_LEN];
168 int (*governor) (struct cpufreq_policy *policy, 168 int (*governor) (struct cpufreq_policy *policy,
169 unsigned int event); 169 unsigned int event);
170 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
171 char *buf);
172 int (*store_setspeed) (struct cpufreq_policy *policy,
173 unsigned int freq);
170 unsigned int max_transition_latency; /* HW must be able to switch to 174 unsigned int max_transition_latency; /* HW must be able to switch to
171 next freq faster than this value in nano secs or we 175 next freq faster than this value in nano secs or we
172 will fallback to performance governor */ 176 will fallback to performance governor */
diff --git a/include/linux/ds1wm.h b/include/linux/ds1wm.h
index 31f6e3c427fb..d3c65e48a2e7 100644
--- a/include/linux/ds1wm.h
+++ b/include/linux/ds1wm.h
@@ -6,6 +6,7 @@ struct ds1wm_platform_data {
6 * e.g. on h5xxx and h2200 this is 2 6 * e.g. on h5xxx and h2200 this is 2
7 * (registers aligned to 4-byte boundaries), 7 * (registers aligned to 4-byte boundaries),
8 * while on hx4700 this is 1 */ 8 * while on hx4700 this is 1 */
9 int active_high;
9 void (*enable)(struct platform_device *pdev); 10 void (*enable)(struct platform_device *pdev);
10 void (*disable)(struct platform_device *pdev); 11 void (*disable)(struct platform_device *pdev);
11}; 12};
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index dd57fe523e97..a695d63a07af 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -41,7 +41,7 @@ extern const struct inode_operations efs_dir_inode_operations;
41extern const struct file_operations efs_dir_operations; 41extern const struct file_operations efs_dir_operations;
42extern const struct address_space_operations efs_symlink_aops; 42extern const struct address_space_operations efs_symlink_aops;
43 43
44extern void efs_read_inode(struct inode *); 44extern struct inode *efs_iget(struct super_block *, unsigned long);
45extern efs_block_t efs_map_block(struct inode *, efs_block_t); 45extern efs_block_t efs_map_block(struct inode *, efs_block_t);
46extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); 46extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
47 47
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 7ceb24d87c1a..bad1b16ec49a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -3,7 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/elf-em.h> 5#include <linux/elf-em.h>
6#ifdef __KERNEL__
6#include <asm/elf.h> 7#include <asm/elf.h>
8#endif
7 9
8struct file; 10struct file;
9 11
@@ -355,6 +357,7 @@ typedef struct elf64_shdr {
355#define NT_AUXV 6 357#define NT_AUXV 6
356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 358#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 359#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
358#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 361#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
359 362
360 363
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 9631dddae348..5ca54d77079f 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -4,7 +4,9 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <linux/time.h> 6#include <linux/time.h>
7#ifdef __KERNEL__
7#include <linux/user.h> 8#include <linux/user.h>
9#endif
8#include <linux/ptrace.h> 10#include <linux/ptrace.h>
9 11
10struct elf_siginfo 12struct elf_siginfo
@@ -14,7 +16,9 @@ struct elf_siginfo
14 int si_errno; /* errno */ 16 int si_errno; /* errno */
15}; 17};
16 18
19#ifdef __KERNEL__
17#include <asm/elf.h> 20#include <asm/elf.h>
21#endif
18 22
19#ifndef __KERNEL__ 23#ifndef __KERNEL__
20typedef elf_greg_t greg_t; 24typedef elf_greg_t greg_t;
diff --git a/include/linux/err.h b/include/linux/err.h
index 1ab1d44f8d3b..ec87f3142bf3 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -34,6 +34,19 @@ static inline long IS_ERR(const void *ptr)
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37/**
38 * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
39 * @ptr: The pointer to cast.
40 *
41 * Explicitly cast an error-valued pointer to another pointer type in such a
42 * way as to make it clear that's what's going on.
43 */
44static inline void *ERR_CAST(const void *ptr)
45{
46 /* cast away the const */
47 return (void *) ptr;
48}
49
37#endif 50#endif
38 51
39#endif /* _LINUX_ERR_H */ 52#endif /* _LINUX_ERR_H */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 241c01cb92b2..36c540396377 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -823,7 +823,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
823 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, 823 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
824 int create, int extend_disksize); 824 int create, int extend_disksize);
825 825
826extern void ext3_read_inode (struct inode *); 826extern struct inode *ext3_iget(struct super_block *, unsigned long);
827extern int ext3_write_inode (struct inode *, int); 827extern int ext3_write_inode (struct inode *, int);
828extern int ext3_setattr (struct dentry *, struct iattr *); 828extern int ext3_setattr (struct dentry *, struct iattr *);
829extern void ext3_delete_inode (struct inode *); 829extern void ext3_delete_inode (struct inode *);
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 1852313fc7c7..c4f635a4dd25 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -1024,7 +1024,7 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
1024 struct buffer_head *bh_result, 1024 struct buffer_head *bh_result,
1025 int create, int extend_disksize); 1025 int create, int extend_disksize);
1026 1026
1027extern void ext4_read_inode (struct inode *); 1027extern struct inode *ext4_iget(struct super_block *, unsigned long);
1028extern int ext4_write_inode (struct inode *, int); 1028extern int ext4_write_inode (struct inode *, int);
1029extern int ext4_setattr (struct dentry *, struct iattr *); 1029extern int ext4_setattr (struct dentry *, struct iattr *);
1030extern void ext4_delete_inode (struct inode *); 1030extern void ext4_delete_inode (struct inode *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 109734bf6377..36b7abefacbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1241,8 +1241,6 @@ struct super_operations {
1241 struct inode *(*alloc_inode)(struct super_block *sb); 1241 struct inode *(*alloc_inode)(struct super_block *sb);
1242 void (*destroy_inode)(struct inode *); 1242 void (*destroy_inode)(struct inode *);
1243 1243
1244 void (*read_inode) (struct inode *);
1245
1246 void (*dirty_inode) (struct inode *); 1244 void (*dirty_inode) (struct inode *);
1247 int (*write_inode) (struct inode *, int); 1245 int (*write_inode) (struct inode *, int);
1248 void (*put_inode) (struct inode *); 1246 void (*put_inode) (struct inode *);
@@ -1767,19 +1765,8 @@ extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*te
1767extern struct inode * iget_locked(struct super_block *, unsigned long); 1765extern struct inode * iget_locked(struct super_block *, unsigned long);
1768extern void unlock_new_inode(struct inode *); 1766extern void unlock_new_inode(struct inode *);
1769 1767
1770static inline struct inode *iget(struct super_block *sb, unsigned long ino)
1771{
1772 struct inode *inode = iget_locked(sb, ino);
1773
1774 if (inode && (inode->i_state & I_NEW)) {
1775 sb->s_op->read_inode(inode);
1776 unlock_new_inode(inode);
1777 }
1778
1779 return inode;
1780}
1781
1782extern void __iget(struct inode * inode); 1768extern void __iget(struct inode * inode);
1769extern void iget_failed(struct inode *);
1783extern void clear_inode(struct inode *); 1770extern void clear_inode(struct inode *);
1784extern void destroy_inode(struct inode *); 1771extern void destroy_inode(struct inode *);
1785extern struct inode *new_inode(struct super_block *); 1772extern struct inode *new_inode(struct super_block *);
@@ -1941,7 +1928,9 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
1941extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); 1928extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
1942extern int vfs_fstat(unsigned int, struct kstat *); 1929extern int vfs_fstat(unsigned int, struct kstat *);
1943 1930
1944extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); 1931extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
1932extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1933 unsigned long arg);
1945 1934
1946extern void get_filesystem(struct file_system_type *fs); 1935extern void get_filesystem(struct file_system_type *fs);
1947extern void put_filesystem(struct file_system_type *fs); 1936extern void put_filesystem(struct file_system_type *fs);
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index b436be7a7fff..2177ee5b2fe2 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -71,7 +71,6 @@ struct hayes_esp_config {
71#define ESP_STAT_NEVER_DMA 0x08 71#define ESP_STAT_NEVER_DMA 0x08
72#define ESP_STAT_USE_PIO 0x10 72#define ESP_STAT_USE_PIO 0x10
73 73
74#define ESP_EVENT_WRITE_WAKEUP 0
75#define ESP_MAGIC 0x53ee 74#define ESP_MAGIC 0x53ee
76#define ESP_XMIT_SIZE 4096 75#define ESP_XMIT_SIZE 4096
77 76
@@ -92,7 +91,6 @@ struct esp_struct {
92 unsigned short closing_wait2; 91 unsigned short closing_wait2;
93 int IER; /* Interrupt Enable Register */ 92 int IER; /* Interrupt Enable Register */
94 int MCR; /* Modem control register */ 93 int MCR; /* Modem control register */
95 unsigned long event;
96 unsigned long last_active; 94 unsigned long last_active;
97 int line; 95 int line;
98 int count; /* # of fd on device */ 96 int count; /* # of fd on device */
@@ -101,8 +99,6 @@ struct esp_struct {
101 int xmit_head; 99 int xmit_head;
102 int xmit_tail; 100 int xmit_tail;
103 int xmit_cnt; 101 int xmit_cnt;
104 struct work_struct tqueue;
105 struct work_struct tqueue_hangup;
106 wait_queue_head_t open_wait; 102 wait_queue_head_t open_wait;
107 wait_queue_head_t close_wait; 103 wait_queue_head_t close_wait;
108 wait_queue_head_t delta_msr_wait; 104 wait_queue_head_t delta_msr_wait;
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 45b3d48f0978..8f4c71759d73 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -37,8 +37,6 @@
37#define BOARD_COUNT 4 37#define BOARD_COUNT 4
38#define PORT_COUNT (BOARD_COUNT*16) 38#define PORT_COUNT (BOARD_COUNT*16)
39 39
40#define SERIAL_TYPE_NORMAL 1
41
42/* character sizes */ 40/* character sizes */
43 41
44#define ISICOM_CS5 0x0000 42#define ISICOM_CS5 0x0000
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 106a5e85e5c4..5a84fe944b74 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -71,7 +71,6 @@ struct stliport {
71 wait_queue_head_t open_wait; 71 wait_queue_head_t open_wait;
72 wait_queue_head_t close_wait; 72 wait_queue_head_t close_wait;
73 wait_queue_head_t raw_wait; 73 wait_queue_head_t raw_wait;
74 struct work_struct tqhangup;
75 struct asysigs asig; 74 struct asysigs asig;
76 unsigned long addr; 75 unsigned long addr;
77 unsigned long rxoffset; 76 unsigned long rxoffset;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2d9c448d8c52..3265968cd2cd 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -127,17 +127,21 @@ void vmcoreinfo_append_str(const char *fmt, ...)
127 __attribute__ ((format (printf, 1, 2))); 127 __attribute__ ((format (printf, 1, 2)));
128unsigned long paddr_vmcoreinfo_note(void); 128unsigned long paddr_vmcoreinfo_note(void);
129 129
130#define VMCOREINFO_OSRELEASE(name) \
131 vmcoreinfo_append_str("OSRELEASE=%s\n", #name)
132#define VMCOREINFO_PAGESIZE(value) \
133 vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
130#define VMCOREINFO_SYMBOL(name) \ 134#define VMCOREINFO_SYMBOL(name) \
131 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) 135 vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
132#define VMCOREINFO_SIZE(name) \ 136#define VMCOREINFO_SIZE(name) \
133 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ 137 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
134 (unsigned long)sizeof(struct name))
135#define VMCOREINFO_TYPEDEF_SIZE(name) \
136 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
137 (unsigned long)sizeof(name)) 138 (unsigned long)sizeof(name))
139#define VMCOREINFO_STRUCT_SIZE(name) \
140 vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
141 (unsigned long)sizeof(struct name))
138#define VMCOREINFO_OFFSET(name, field) \ 142#define VMCOREINFO_OFFSET(name, field) \
139 vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ 143 vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
140 (unsigned long)&(((struct name *)0)->field)) 144 (unsigned long)offsetof(struct name, field))
141#define VMCOREINFO_LENGTH(name, value) \ 145#define VMCOREINFO_LENGTH(name, value) \
142 vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) 146 vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
143#define VMCOREINFO_NUMBER(name) \ 147#define VMCOREINFO_NUMBER(name) \
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 00f89fd6c52a..0201f6f51cea 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -38,6 +38,11 @@ struct led_classdev {
38 void (*brightness_set)(struct led_classdev *led_cdev, 38 void (*brightness_set)(struct led_classdev *led_cdev,
39 enum led_brightness brightness); 39 enum led_brightness brightness);
40 40
41 /* Activate hardware accelerated blink */
42 int (*blink_set)(struct led_classdev *led_cdev,
43 unsigned long *delay_on,
44 unsigned long *delay_off);
45
41 struct device *dev; 46 struct device *dev;
42 struct list_head node; /* LED Device list */ 47 struct list_head node; /* LED Device list */
43 char *default_trigger; /* Trigger to use */ 48 char *default_trigger; /* Trigger to use */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
new file mode 100644
index 000000000000..9815951ec995
--- /dev/null
+++ b/include/linux/memcontrol.h
@@ -0,0 +1,190 @@
1/* memcontrol.h - Memory Controller
2 *
3 * Copyright IBM Corporation, 2007
4 * Author Balbir Singh <balbir@linux.vnet.ibm.com>
5 *
6 * Copyright 2007 OpenVZ SWsoft Inc
7 * Author: Pavel Emelianov <xemul@openvz.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef _LINUX_MEMCONTROL_H
21#define _LINUX_MEMCONTROL_H
22
23#include <linux/rcupdate.h>
24#include <linux/mm.h>
25
26struct mem_cgroup;
27struct page_cgroup;
28struct page;
29struct mm_struct;
30
31#ifdef CONFIG_CGROUP_MEM_CONT
32
33extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
34extern void mm_free_cgroup(struct mm_struct *mm);
35extern void page_assign_page_cgroup(struct page *page,
36 struct page_cgroup *pc);
37extern struct page_cgroup *page_get_page_cgroup(struct page *page);
38extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
39 gfp_t gfp_mask);
40extern void mem_cgroup_uncharge(struct page_cgroup *pc);
41extern void mem_cgroup_uncharge_page(struct page *page);
42extern void mem_cgroup_move_lists(struct page_cgroup *pc, bool active);
43extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
44 struct list_head *dst,
45 unsigned long *scanned, int order,
46 int mode, struct zone *z,
47 struct mem_cgroup *mem_cont,
48 int active);
49extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
50extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
51 gfp_t gfp_mask);
52int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
53
54static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
55{
56 return rcu_dereference(mm->mem_cgroup);
57}
58
59extern int mem_cgroup_prepare_migration(struct page *page);
60extern void mem_cgroup_end_migration(struct page *page);
61extern void mem_cgroup_page_migration(struct page *page, struct page *newpage);
62
63/*
64 * For memory reclaim.
65 */
66extern int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem);
67extern long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem);
68
69extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
70extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
71 int priority);
72extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
73 int priority);
74
75extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
76 struct zone *zone, int priority);
77extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
78 struct zone *zone, int priority);
79
80#else /* CONFIG_CGROUP_MEM_CONT */
81static inline void mm_init_cgroup(struct mm_struct *mm,
82 struct task_struct *p)
83{
84}
85
86static inline void mm_free_cgroup(struct mm_struct *mm)
87{
88}
89
90static inline void page_assign_page_cgroup(struct page *page,
91 struct page_cgroup *pc)
92{
93}
94
95static inline struct page_cgroup *page_get_page_cgroup(struct page *page)
96{
97 return NULL;
98}
99
100static inline int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
101 gfp_t gfp_mask)
102{
103 return 0;
104}
105
106static inline void mem_cgroup_uncharge(struct page_cgroup *pc)
107{
108}
109
110static inline void mem_cgroup_uncharge_page(struct page *page)
111{
112}
113
114static inline void mem_cgroup_move_lists(struct page_cgroup *pc,
115 bool active)
116{
117}
118
119static inline int mem_cgroup_cache_charge(struct page *page,
120 struct mm_struct *mm,
121 gfp_t gfp_mask)
122{
123 return 0;
124}
125
126static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
127{
128 return NULL;
129}
130
131static inline int task_in_mem_cgroup(struct task_struct *task,
132 const struct mem_cgroup *mem)
133{
134 return 1;
135}
136
137static inline int mem_cgroup_prepare_migration(struct page *page)
138{
139 return 0;
140}
141
142static inline void mem_cgroup_end_migration(struct page *page)
143{
144}
145
146static inline void
147mem_cgroup_page_migration(struct page *page, struct page *newpage)
148{
149}
150
151static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
152{
153 return 0;
154}
155
156static inline int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
157{
158 return 0;
159}
160
161static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
162{
163 return 0;
164}
165
166static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
167 int priority)
168{
169}
170
171static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
172 int priority)
173{
174}
175
176static inline long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
177 struct zone *zone, int priority)
178{
179 return 0;
180}
181
182static inline long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
183 struct zone *zone, int priority)
184{
185 return 0;
186}
187#endif /* CONFIG_CGROUP_MEM_CONT */
188
189#endif /* _LINUX_MEMCONTROL_H */
190
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
new file mode 100644
index 000000000000..4ab2162db13b
--- /dev/null
+++ b/include/linux/mfd/asic3.h
@@ -0,0 +1,497 @@
1/*
2 * include/linux/mfd/asic3.h
3 *
4 * Compaq ASIC3 headers.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Copyright 2001 Compaq Computer Corporation.
11 * Copyright 2007 OpendHand.
12 */
13
14#ifndef __ASIC3_H__
15#define __ASIC3_H__
16
17#include <linux/types.h>
18
19struct asic3 {
20 void __iomem *mapping;
21 unsigned int bus_shift;
22 unsigned int irq_nr;
23 unsigned int irq_base;
24 spinlock_t lock;
25 u16 irq_bothedge[4];
26 struct device *dev;
27};
28
29struct asic3_platform_data {
30 struct {
31 u32 dir;
32 u32 init;
33 u32 sleep_mask;
34 u32 sleep_out;
35 u32 batt_fault_out;
36 u32 sleep_conf;
37 u32 alt_function;
38 } gpio_a, gpio_b, gpio_c, gpio_d;
39
40 unsigned int bus_shift;
41
42 unsigned int irq_base;
43
44 struct platform_device **children;
45 unsigned int n_children;
46};
47
48int asic3_gpio_get_value(struct asic3 *asic, unsigned gpio);
49void asic3_gpio_set_value(struct asic3 *asic, unsigned gpio, int val);
50
51#define ASIC3_NUM_GPIO_BANKS 4
52#define ASIC3_GPIOS_PER_BANK 16
53#define ASIC3_NUM_GPIOS 64
54#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
55
56#define ASIC3_GPIO_BANK_A 0
57#define ASIC3_GPIO_BANK_B 1
58#define ASIC3_GPIO_BANK_C 2
59#define ASIC3_GPIO_BANK_D 3
60
61#define ASIC3_GPIO(bank, gpio) \
62 ((ASIC3_GPIOS_PER_BANK * ASIC3_GPIO_BANK_##bank) + (gpio))
63#define ASIC3_GPIO_bit(gpio) (1 << (gpio & 0xf))
64/* All offsets below are specified with this address bus shift */
65#define ASIC3_DEFAULT_ADDR_SHIFT 2
66
67#define ASIC3_OFFSET(base, reg) (ASIC3_##base##_Base + ASIC3_##base##_##reg)
68#define ASIC3_GPIO_OFFSET(base, reg) \
69 (ASIC3_GPIO_##base##_Base + ASIC3_GPIO_##reg)
70
71#define ASIC3_GPIO_A_Base 0x0000
72#define ASIC3_GPIO_B_Base 0x0100
73#define ASIC3_GPIO_C_Base 0x0200
74#define ASIC3_GPIO_D_Base 0x0300
75
76#define ASIC3_GPIO_Mask 0x00 /* R/W 0:don't mask */
77#define ASIC3_GPIO_Direction 0x04 /* R/W 0:input */
78#define ASIC3_GPIO_Out 0x08 /* R/W 0:output low */
79#define ASIC3_GPIO_TriggerType 0x0c /* R/W 0:level */
80#define ASIC3_GPIO_EdgeTrigger 0x10 /* R/W 0:falling */
81#define ASIC3_GPIO_LevelTrigger 0x14 /* R/W 0:low level detect */
82#define ASIC3_GPIO_SleepMask 0x18 /* R/W 0:don't mask in sleep mode */
83#define ASIC3_GPIO_SleepOut 0x1c /* R/W level 0:low in sleep mode */
84#define ASIC3_GPIO_BattFaultOut 0x20 /* R/W level 0:low in batt_fault */
85#define ASIC3_GPIO_IntStatus 0x24 /* R/W 0:none, 1:detect */
86#define ASIC3_GPIO_AltFunction 0x28 /* R/W 1:LED register control */
87#define ASIC3_GPIO_SleepConf 0x2c /*
88 * R/W bit 1: autosleep
89 * 0: disable gposlpout in normal mode,
90 * enable gposlpout in sleep mode.
91 */
92#define ASIC3_GPIO_Status 0x30 /* R Pin status */
93
94#define ASIC3_SPI_Base 0x0400
95#define ASIC3_SPI_Control 0x0000
96#define ASIC3_SPI_TxData 0x0004
97#define ASIC3_SPI_RxData 0x0008
98#define ASIC3_SPI_Int 0x000c
99#define ASIC3_SPI_Status 0x0010
100
101#define SPI_CONTROL_SPR(clk) ((clk) & 0x0f) /* Clock rate */
102
103#define ASIC3_PWM_0_Base 0x0500
104#define ASIC3_PWM_1_Base 0x0600
105#define ASIC3_PWM_TimeBase 0x0000
106#define ASIC3_PWM_PeriodTime 0x0004
107#define ASIC3_PWM_DutyTime 0x0008
108
109#define PWM_TIMEBASE_VALUE(x) ((x)&0xf) /* Low 4 bits sets time base */
110#define PWM_TIMEBASE_ENABLE (1 << 4) /* Enable clock */
111
112#define ASIC3_LED_0_Base 0x0700
113#define ASIC3_LED_1_Base 0x0800
114#define ASIC3_LED_2_Base 0x0900
115#define ASIC3_LED_TimeBase 0x0000 /* R/W 7 bits */
116#define ASIC3_LED_PeriodTime 0x0004 /* R/W 12 bits */
117#define ASIC3_LED_DutyTime 0x0008 /* R/W 12 bits */
118#define ASIC3_LED_AutoStopCount 0x000c /* R/W 16 bits */
119
120/* LED TimeBase bits - match ASIC2 */
121#define LED_TBS 0x0f /* Low 4 bits sets time base, max = 13 */
122 /* Note: max = 5 on hx4700 */
123 /* 0: maximum time base */
124 /* 1: maximum time base / 2 */
125 /* n: maximum time base / 2^n */
126
127#define LED_EN (1 << 4) /* LED ON/OFF 0:off, 1:on */
128#define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */
129#define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */
130
131#define ASIC3_CLOCK_Base 0x0A00
132#define ASIC3_CLOCK_CDEX 0x00
133#define ASIC3_CLOCK_SEL 0x04
134
135#define CLOCK_CDEX_SOURCE (1 << 0) /* 2 bits */
136#define CLOCK_CDEX_SOURCE0 (1 << 0)
137#define CLOCK_CDEX_SOURCE1 (1 << 1)
138#define CLOCK_CDEX_SPI (1 << 2)
139#define CLOCK_CDEX_OWM (1 << 3)
140#define CLOCK_CDEX_PWM0 (1 << 4)
141#define CLOCK_CDEX_PWM1 (1 << 5)
142#define CLOCK_CDEX_LED0 (1 << 6)
143#define CLOCK_CDEX_LED1 (1 << 7)
144#define CLOCK_CDEX_LED2 (1 << 8)
145
146/* Clocks settings: 1 for 24.576 MHz, 0 for 12.288Mhz */
147#define CLOCK_CDEX_SD_HOST (1 << 9) /* R/W: SD host clock source */
148#define CLOCK_CDEX_SD_BUS (1 << 10) /* R/W: SD bus clock source ctrl */
149#define CLOCK_CDEX_SMBUS (1 << 11)
150#define CLOCK_CDEX_CONTROL_CX (1 << 12)
151
152#define CLOCK_CDEX_EX0 (1 << 13) /* R/W: 32.768 kHz crystal */
153#define CLOCK_CDEX_EX1 (1 << 14) /* R/W: 24.576 MHz crystal */
154
155#define CLOCK_SEL_SD_HCLK_SEL (1 << 0) /* R/W: SDIO host clock select */
156#define CLOCK_SEL_SD_BCLK_SEL (1 << 1) /* R/W: SDIO bus clock select */
157
158/* R/W: INT clock source control (32.768 kHz) */
159#define CLOCK_SEL_CX (1 << 2)
160
161
162#define ASIC3_INTR_Base 0x0B00
163
164#define ASIC3_INTR_IntMask 0x00 /* Interrupt mask control */
165#define ASIC3_INTR_PIntStat 0x04 /* Peripheral interrupt status */
166#define ASIC3_INTR_IntCPS 0x08 /* Interrupt timer clock pre-scale */
167#define ASIC3_INTR_IntTBS 0x0c /* Interrupt timer set */
168
169#define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */
170#define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */
171#define ASIC3_INTMASK_MASK0 (1 << 2)
172#define ASIC3_INTMASK_MASK1 (1 << 3)
173#define ASIC3_INTMASK_MASK2 (1 << 4)
174#define ASIC3_INTMASK_MASK3 (1 << 5)
175#define ASIC3_INTMASK_MASK4 (1 << 6)
176#define ASIC3_INTMASK_MASK5 (1 << 7)
177
178#define ASIC3_INTR_PERIPHERAL_A (1 << 0)
179#define ASIC3_INTR_PERIPHERAL_B (1 << 1)
180#define ASIC3_INTR_PERIPHERAL_C (1 << 2)
181#define ASIC3_INTR_PERIPHERAL_D (1 << 3)
182#define ASIC3_INTR_LED0 (1 << 4)
183#define ASIC3_INTR_LED1 (1 << 5)
184#define ASIC3_INTR_LED2 (1 << 6)
185#define ASIC3_INTR_SPI (1 << 7)
186#define ASIC3_INTR_SMBUS (1 << 8)
187#define ASIC3_INTR_OWM (1 << 9)
188
189#define ASIC3_INTR_CPS(x) ((x)&0x0f) /* 4 bits, max 14 */
190#define ASIC3_INTR_CPS_SET (1 << 4) /* Time base enable */
191
192
193/* Basic control of the SD ASIC */
194#define ASIC3_SDHWCTRL_Base 0x0E00
195#define ASIC3_SDHWCTRL_SDConf 0x00
196
197#define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */
198#define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */
199#define ASIC3_SDHWCTRL_PCLR (1 << 2) /* All registers of SDIO cleared */
200#define ASIC3_SDHWCTRL_LEVCD (1 << 3) /* SD card detection: 0:low */
201
202/* SD card write protection: 0=high */
203#define ASIC3_SDHWCTRL_LEVWP (1 << 4)
204#define ASIC3_SDHWCTRL_SDLED (1 << 5) /* SD card LED signal 0=disable */
205
206/* SD card power supply ctrl 1=enable */
207#define ASIC3_SDHWCTRL_SDPWR (1 << 6)
208
209#define ASIC3_EXTCF_Base 0x1100
210
211#define ASIC3_EXTCF_Select 0x00
212#define ASIC3_EXTCF_Reset 0x04
213
214#define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */
215#define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */
216#define ASIC3_EXTCF_SMOD2 (1 << 2) /* slot number of mode 2 */
217#define ASIC3_EXTCF_OWM_EN (1 << 4) /* enable onewire module */
218#define ASIC3_EXTCF_OWM_SMB (1 << 5) /* OWM bus selection */
219#define ASIC3_EXTCF_OWM_RESET (1 << 6) /* ?? used by OWM and CF */
220#define ASIC3_EXTCF_CF0_SLEEP_MODE (1 << 7) /* CF0 sleep state */
221#define ASIC3_EXTCF_CF1_SLEEP_MODE (1 << 8) /* CF1 sleep state */
222#define ASIC3_EXTCF_CF0_PWAIT_EN (1 << 10) /* CF0 PWAIT_n control */
223#define ASIC3_EXTCF_CF1_PWAIT_EN (1 << 11) /* CF1 PWAIT_n control */
224#define ASIC3_EXTCF_CF0_BUF_EN (1 << 12) /* CF0 buffer control */
225#define ASIC3_EXTCF_CF1_BUF_EN (1 << 13) /* CF1 buffer control */
226#define ASIC3_EXTCF_SD_MEM_ENABLE (1 << 14)
227#define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */
228
229/*********************************************
230 * The Onewire interface registers
231 *
232 * OWM_CMD
233 * OWM_DAT
234 * OWM_INTR
235 * OWM_INTEN
236 * OWM_CLKDIV
237 *
238 *********************************************/
239
240#define ASIC3_OWM_Base 0xC00
241
242#define ASIC3_OWM_CMD 0x00
243#define ASIC3_OWM_DAT 0x04
244#define ASIC3_OWM_INTR 0x08
245#define ASIC3_OWM_INTEN 0x0C
246#define ASIC3_OWM_CLKDIV 0x10
247
248#define ASIC3_OWM_CMD_ONEWR (1 << 0)
249#define ASIC3_OWM_CMD_SRA (1 << 1)
250#define ASIC3_OWM_CMD_DQO (1 << 2)
251#define ASIC3_OWM_CMD_DQI (1 << 3)
252
253#define ASIC3_OWM_INTR_PD (1 << 0)
254#define ASIC3_OWM_INTR_PDR (1 << 1)
255#define ASIC3_OWM_INTR_TBE (1 << 2)
256#define ASIC3_OWM_INTR_TEMP (1 << 3)
257#define ASIC3_OWM_INTR_RBF (1 << 4)
258
259#define ASIC3_OWM_INTEN_EPD (1 << 0)
260#define ASIC3_OWM_INTEN_IAS (1 << 1)
261#define ASIC3_OWM_INTEN_ETBE (1 << 2)
262#define ASIC3_OWM_INTEN_ETMT (1 << 3)
263#define ASIC3_OWM_INTEN_ERBF (1 << 4)
264
265#define ASIC3_OWM_CLKDIV_PRE (3 << 0) /* two bits wide at bit 0 */
266#define ASIC3_OWM_CLKDIV_DIV (7 << 2) /* 3 bits wide at bit 2 */
267
268
269/*****************************************************************************
270 * The SD configuration registers are at a completely different location
271 * in memory. They are divided into three sets of registers:
272 *
273 * SD_CONFIG Core configuration register
274 * SD_CTRL Control registers for SD operations
275 * SDIO_CTRL Control registers for SDIO operations
276 *
277 *****************************************************************************/
278#define ASIC3_SD_CONFIG_Base 0x0400 /* Assumes 32 bit addressing */
279
280#define ASIC3_SD_CONFIG_Command 0x08 /* R/W: Command */
281
282/* [0:8] SD Control Register Base Address */
283#define ASIC3_SD_CONFIG_Addr0 0x20
284
285/* [9:31] SD Control Register Base Address */
286#define ASIC3_SD_CONFIG_Addr1 0x24
287
288/* R/O: interrupt assigned to pin */
289#define ASIC3_SD_CONFIG_IntPin 0x78
290
291/*
292 * Set to 0x1f to clock SD controller, 0 otherwise.
293 * At 0x82 - Gated Clock Ctrl
294 */
295#define ASIC3_SD_CONFIG_ClkStop 0x80
296
297/* Control clock of SD controller */
298#define ASIC3_SD_CONFIG_ClockMode 0x84
299#define ASIC3_SD_CONFIG_SDHC_PinStatus 0x88 /* R/0: SD pins status */
300#define ASIC3_SD_CONFIG_SDHC_Power1 0x90 /* Power1 - manual pwr ctrl */
301
302/* auto power up after card inserted */
303#define ASIC3_SD_CONFIG_SDHC_Power2 0x92
304
305/* auto power down when card removed */
306#define ASIC3_SD_CONFIG_SDHC_Power3 0x94
307#define ASIC3_SD_CONFIG_SDHC_CardDetect 0x98
308#define ASIC3_SD_CONFIG_SDHC_Slot 0xA0 /* R/O: support slot number */
309#define ASIC3_SD_CONFIG_SDHC_ExtGateClk1 0x1E0 /* Not used */
310#define ASIC3_SD_CONFIG_SDHC_ExtGateClk2 0x1E2 /* Not used*/
311
312/* GPIO Output Reg. , at 0x1EA - GPIO Output Enable Reg. */
313#define ASIC3_SD_CONFIG_SDHC_GPIO_OutAndEnable 0x1E8
314#define ASIC3_SD_CONFIG_SDHC_GPIO_Status 0x1EC /* GPIO Status Reg. */
315
316/* Bit 1: double buffer/single buffer */
317#define ASIC3_SD_CONFIG_SDHC_ExtGateClk3 0x1F0
318
319/* Memory access enable (set to 1 to access SD Controller) */
320#define SD_CONFIG_COMMAND_MAE (1<<1)
321
322#define SD_CONFIG_CLK_ENABLE_ALL 0x1f
323
324#define SD_CONFIG_POWER1_PC_33V 0x0200 /* Set for 3.3 volts */
325#define SD_CONFIG_POWER1_PC_OFF 0x0000 /* Turn off power */
326
327 /* two bits - number of cycles for card detection */
328#define SD_CONFIG_CARDDETECTMODE_CLK ((x) & 0x3)
329
330
331#define ASIC3_SD_CTRL_Base 0x1000
332
333#define ASIC3_SD_CTRL_Cmd 0x00
334#define ASIC3_SD_CTRL_Arg0 0x08
335#define ASIC3_SD_CTRL_Arg1 0x0C
336#define ASIC3_SD_CTRL_StopInternal 0x10
337#define ASIC3_SD_CTRL_TransferSectorCount 0x14
338#define ASIC3_SD_CTRL_Response0 0x18
339#define ASIC3_SD_CTRL_Response1 0x1C
340#define ASIC3_SD_CTRL_Response2 0x20
341#define ASIC3_SD_CTRL_Response3 0x24
342#define ASIC3_SD_CTRL_Response4 0x28
343#define ASIC3_SD_CTRL_Response5 0x2C
344#define ASIC3_SD_CTRL_Response6 0x30
345#define ASIC3_SD_CTRL_Response7 0x34
346#define ASIC3_SD_CTRL_CardStatus 0x38
347#define ASIC3_SD_CTRL_BufferCtrl 0x3C
348#define ASIC3_SD_CTRL_IntMaskCard 0x40
349#define ASIC3_SD_CTRL_IntMaskBuffer 0x44
350#define ASIC3_SD_CTRL_CardClockCtrl 0x48
351#define ASIC3_SD_CTRL_MemCardXferDataLen 0x4C
352#define ASIC3_SD_CTRL_MemCardOptionSetup 0x50
353#define ASIC3_SD_CTRL_ErrorStatus0 0x58
354#define ASIC3_SD_CTRL_ErrorStatus1 0x5C
355#define ASIC3_SD_CTRL_DataPort 0x60
356#define ASIC3_SD_CTRL_TransactionCtrl 0x68
357#define ASIC3_SD_CTRL_SoftwareReset 0x1C0
358
359#define SD_CTRL_SOFTWARE_RESET_CLEAR (1<<0)
360
361#define SD_CTRL_TRANSACTIONCONTROL_SET (1<<8)
362
363#define SD_CTRL_CARDCLOCKCONTROL_FOR_SD_CARD (1<<15)
364#define SD_CTRL_CARDCLOCKCONTROL_ENABLE_CLOCK (1<<8)
365#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_512 (1<<7)
366#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_256 (1<<6)
367#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_128 (1<<5)
368#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_64 (1<<4)
369#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_32 (1<<3)
370#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_16 (1<<2)
371#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_8 (1<<1)
372#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_4 (1<<0)
373#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_2 (0<<0)
374
375#define MEM_CARD_OPTION_REQUIRED 0x000e
376#define MEM_CARD_OPTION_DATA_RESPONSE_TIMEOUT(x) (((x) & 0x0f) << 4)
377#define MEM_CARD_OPTION_C2_MODULE_NOT_PRESENT (1<<14)
378#define MEM_CARD_OPTION_DATA_XFR_WIDTH_1 (1<<15)
379#define MEM_CARD_OPTION_DATA_XFR_WIDTH_4 0
380
381#define SD_CTRL_COMMAND_INDEX(x) ((x) & 0x3f)
382#define SD_CTRL_COMMAND_TYPE_CMD (0 << 6)
383#define SD_CTRL_COMMAND_TYPE_ACMD (1 << 6)
384#define SD_CTRL_COMMAND_TYPE_AUTHENTICATION (2 << 6)
385#define SD_CTRL_COMMAND_RESPONSE_TYPE_NORMAL (0 << 8)
386#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1 (4 << 8)
387#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1B (5 << 8)
388#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R2 (6 << 8)
389#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R3 (7 << 8)
390#define SD_CTRL_COMMAND_DATA_PRESENT (1 << 11)
391#define SD_CTRL_COMMAND_TRANSFER_READ (1 << 12)
392#define SD_CTRL_COMMAND_TRANSFER_WRITE (0 << 12)
393#define SD_CTRL_COMMAND_MULTI_BLOCK (1 << 13)
394#define SD_CTRL_COMMAND_SECURITY_CMD (1 << 14)
395
396#define SD_CTRL_STOP_INTERNAL_ISSSUE_CMD12 (1 << 0)
397#define SD_CTRL_STOP_INTERNAL_AUTO_ISSUE_CMD12 (1 << 8)
398
399#define SD_CTRL_CARDSTATUS_RESPONSE_END (1 << 0)
400#define SD_CTRL_CARDSTATUS_RW_END (1 << 2)
401#define SD_CTRL_CARDSTATUS_CARD_REMOVED_0 (1 << 3)
402#define SD_CTRL_CARDSTATUS_CARD_INSERTED_0 (1 << 4)
403#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_0 (1 << 5)
404#define SD_CTRL_CARDSTATUS_WRITE_PROTECT (1 << 7)
405#define SD_CTRL_CARDSTATUS_CARD_REMOVED_3 (1 << 8)
406#define SD_CTRL_CARDSTATUS_CARD_INSERTED_3 (1 << 9)
407#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_3 (1 << 10)
408
409#define SD_CTRL_BUFFERSTATUS_CMD_INDEX_ERROR (1 << 0)
410#define SD_CTRL_BUFFERSTATUS_CRC_ERROR (1 << 1)
411#define SD_CTRL_BUFFERSTATUS_STOP_BIT_END_ERROR (1 << 2)
412#define SD_CTRL_BUFFERSTATUS_DATA_TIMEOUT (1 << 3)
413#define SD_CTRL_BUFFERSTATUS_BUFFER_OVERFLOW (1 << 4)
414#define SD_CTRL_BUFFERSTATUS_BUFFER_UNDERFLOW (1 << 5)
415#define SD_CTRL_BUFFERSTATUS_CMD_TIMEOUT (1 << 6)
416#define SD_CTRL_BUFFERSTATUS_UNK7 (1 << 7)
417#define SD_CTRL_BUFFERSTATUS_BUFFER_READ_ENABLE (1 << 8)
418#define SD_CTRL_BUFFERSTATUS_BUFFER_WRITE_ENABLE (1 << 9)
419#define SD_CTRL_BUFFERSTATUS_ILLEGAL_FUNCTION (1 << 13)
420#define SD_CTRL_BUFFERSTATUS_CMD_BUSY (1 << 14)
421#define SD_CTRL_BUFFERSTATUS_ILLEGAL_ACCESS (1 << 15)
422
423#define SD_CTRL_INTMASKCARD_RESPONSE_END (1 << 0)
424#define SD_CTRL_INTMASKCARD_RW_END (1 << 2)
425#define SD_CTRL_INTMASKCARD_CARD_REMOVED_0 (1 << 3)
426#define SD_CTRL_INTMASKCARD_CARD_INSERTED_0 (1 << 4)
427#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_0 (1 << 5)
428#define SD_CTRL_INTMASKCARD_UNK6 (1 << 6)
429#define SD_CTRL_INTMASKCARD_WRITE_PROTECT (1 << 7)
430#define SD_CTRL_INTMASKCARD_CARD_REMOVED_3 (1 << 8)
431#define SD_CTRL_INTMASKCARD_CARD_INSERTED_3 (1 << 9)
432#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_3 (1 << 10)
433
434#define SD_CTRL_INTMASKBUFFER_CMD_INDEX_ERROR (1 << 0)
435#define SD_CTRL_INTMASKBUFFER_CRC_ERROR (1 << 1)
436#define SD_CTRL_INTMASKBUFFER_STOP_BIT_END_ERROR (1 << 2)
437#define SD_CTRL_INTMASKBUFFER_DATA_TIMEOUT (1 << 3)
438#define SD_CTRL_INTMASKBUFFER_BUFFER_OVERFLOW (1 << 4)
439#define SD_CTRL_INTMASKBUFFER_BUFFER_UNDERFLOW (1 << 5)
440#define SD_CTRL_INTMASKBUFFER_CMD_TIMEOUT (1 << 6)
441#define SD_CTRL_INTMASKBUFFER_UNK7 (1 << 7)
442#define SD_CTRL_INTMASKBUFFER_BUFFER_READ_ENABLE (1 << 8)
443#define SD_CTRL_INTMASKBUFFER_BUFFER_WRITE_ENABLE (1 << 9)
444#define SD_CTRL_INTMASKBUFFER_ILLEGAL_FUNCTION (1 << 13)
445#define SD_CTRL_INTMASKBUFFER_CMD_BUSY (1 << 14)
446#define SD_CTRL_INTMASKBUFFER_ILLEGAL_ACCESS (1 << 15)
447
448#define SD_CTRL_DETAIL0_RESPONSE_CMD_ERROR (1 << 0)
449#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 2)
450#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_CMD12 (1 << 3)
451#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_READ_DATA (1 << 4)
452#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_WRITE_CRC_STATUS (1 << 5)
453#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 8)
454#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_CMD12 (1 << 9)
455#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_READ_DATA (1 << 10)
456#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_WRITE_CMD (1 << 11)
457
458#define SD_CTRL_DETAIL1_NO_CMD_RESPONSE (1 << 0)
459#define SD_CTRL_DETAIL1_TIMEOUT_READ_DATA (1 << 4)
460#define SD_CTRL_DETAIL1_TIMEOUT_CRS_STATUS (1 << 5)
461#define SD_CTRL_DETAIL1_TIMEOUT_CRC_BUSY (1 << 6)
462
463#define ASIC3_SDIO_CTRL_Base 0x1200
464
465#define ASIC3_SDIO_CTRL_Cmd 0x00
466#define ASIC3_SDIO_CTRL_CardPortSel 0x04
467#define ASIC3_SDIO_CTRL_Arg0 0x08
468#define ASIC3_SDIO_CTRL_Arg1 0x0C
469#define ASIC3_SDIO_CTRL_TransferBlockCount 0x14
470#define ASIC3_SDIO_CTRL_Response0 0x18
471#define ASIC3_SDIO_CTRL_Response1 0x1C
472#define ASIC3_SDIO_CTRL_Response2 0x20
473#define ASIC3_SDIO_CTRL_Response3 0x24
474#define ASIC3_SDIO_CTRL_Response4 0x28
475#define ASIC3_SDIO_CTRL_Response5 0x2C
476#define ASIC3_SDIO_CTRL_Response6 0x30
477#define ASIC3_SDIO_CTRL_Response7 0x34
478#define ASIC3_SDIO_CTRL_CardStatus 0x38
479#define ASIC3_SDIO_CTRL_BufferCtrl 0x3C
480#define ASIC3_SDIO_CTRL_IntMaskCard 0x40
481#define ASIC3_SDIO_CTRL_IntMaskBuffer 0x44
482#define ASIC3_SDIO_CTRL_CardXferDataLen 0x4C
483#define ASIC3_SDIO_CTRL_CardOptionSetup 0x50
484#define ASIC3_SDIO_CTRL_ErrorStatus0 0x54
485#define ASIC3_SDIO_CTRL_ErrorStatus1 0x58
486#define ASIC3_SDIO_CTRL_DataPort 0x60
487#define ASIC3_SDIO_CTRL_TransactionCtrl 0x68
488#define ASIC3_SDIO_CTRL_CardIntCtrl 0x6C
489#define ASIC3_SDIO_CTRL_ClocknWaitCtrl 0x70
490#define ASIC3_SDIO_CTRL_HostInformation 0x74
491#define ASIC3_SDIO_CTRL_ErrorCtrl 0x78
492#define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
493#define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
494
495#define ASIC3_MAP_SIZE 0x2000
496
497#endif /* __ASIC3_H__ */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index f4c03e0b355e..34023c65d466 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -88,6 +88,9 @@ struct page {
88 void *virtual; /* Kernel virtual address (NULL if 88 void *virtual; /* Kernel virtual address (NULL if
89 not kmapped, ie. highmem) */ 89 not kmapped, ie. highmem) */
90#endif /* WANT_PAGE_VIRTUAL */ 90#endif /* WANT_PAGE_VIRTUAL */
91#ifdef CONFIG_CGROUP_MEM_CONT
92 unsigned long page_cgroup;
93#endif
91}; 94};
92 95
93/* 96/*
@@ -219,6 +222,9 @@ struct mm_struct {
219 /* aio bits */ 222 /* aio bits */
220 rwlock_t ioctx_list_lock; 223 rwlock_t ioctx_list_lock;
221 struct kioctx *ioctx_list; 224 struct kioctx *ioctx_list;
225#ifdef CONFIG_CGROUP_MEM_CONT
226 struct mem_cgroup *mem_cgroup;
227#endif
222}; 228};
223 229
224#endif /* _LINUX_MM_TYPES_H */ 230#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index b5f33efcb8e2..6981016dcc25 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -50,6 +50,7 @@ extern struct device_node *of_find_matching_node(struct device_node *from,
50extern struct device_node *of_find_node_by_path(const char *path); 50extern struct device_node *of_find_node_by_path(const char *path);
51extern struct device_node *of_find_node_by_phandle(phandle handle); 51extern struct device_node *of_find_node_by_phandle(phandle handle);
52extern struct device_node *of_get_parent(const struct device_node *node); 52extern struct device_node *of_get_parent(const struct device_node *node);
53extern struct device_node *of_get_next_parent(struct device_node *node);
53extern struct device_node *of_get_next_child(const struct device_node *node, 54extern struct device_node *of_get_next_child(const struct device_node *node,
54 struct device_node *prev); 55 struct device_node *prev);
55#define for_each_child_of_node(parent, child) \ 56#define for_each_child_of_node(parent, child) \
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 19bc9b8b6191..34a196ee7941 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -110,6 +110,7 @@ struct qnx4_inode_info {
110 struct inode vfs_inode; 110 struct inode vfs_inode;
111}; 111};
112 112
113extern struct inode *qnx4_iget(struct super_block *, unsigned long);
113extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd); 114extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
114extern unsigned long qnx4_count_free_blocks(struct super_block *sb); 115extern unsigned long qnx4_count_free_blocks(struct super_block *sb);
115extern unsigned long qnx4_block_map(struct inode *inode, long iblock); 116extern unsigned long qnx4_block_map(struct inode *inode, long iblock);
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
new file mode 100644
index 000000000000..61363ce896d5
--- /dev/null
+++ b/include/linux/res_counter.h
@@ -0,0 +1,127 @@
1#ifndef __RES_COUNTER_H__
2#define __RES_COUNTER_H__
3
4/*
5 * Resource Counters
6 * Contain common data types and routines for resource accounting
7 *
8 * Copyright 2007 OpenVZ SWsoft Inc
9 *
10 * Author: Pavel Emelianov <xemul@openvz.org>
11 *
12 */
13
14#include <linux/cgroup.h>
15
16/*
17 * The core object. the cgroup that wishes to account for some
18 * resource may include this counter into its structures and use
19 * the helpers described beyond
20 */
21
22struct res_counter {
23 /*
24 * the current resource consumption level
25 */
26 unsigned long long usage;
27 /*
28 * the limit that usage cannot exceed
29 */
30 unsigned long long limit;
31 /*
32 * the number of unsuccessful attempts to consume the resource
33 */
34 unsigned long long failcnt;
35 /*
36 * the lock to protect all of the above.
37 * the routines below consider this to be IRQ-safe
38 */
39 spinlock_t lock;
40};
41
42/*
43 * Helpers to interact with userspace
44 * res_counter_read/_write - put/get the specified fields from the
45 * res_counter struct to/from the user
46 *
47 * @counter: the counter in question
48 * @member: the field to work with (see RES_xxx below)
49 * @buf: the buffer to opeate on,...
50 * @nbytes: its size...
51 * @pos: and the offset.
52 */
53
54ssize_t res_counter_read(struct res_counter *counter, int member,
55 const char __user *buf, size_t nbytes, loff_t *pos,
56 int (*read_strategy)(unsigned long long val, char *s));
57ssize_t res_counter_write(struct res_counter *counter, int member,
58 const char __user *buf, size_t nbytes, loff_t *pos,
59 int (*write_strategy)(char *buf, unsigned long long *val));
60
61/*
62 * the field descriptors. one for each member of res_counter
63 */
64
65enum {
66 RES_USAGE,
67 RES_LIMIT,
68 RES_FAILCNT,
69};
70
71/*
72 * helpers for accounting
73 */
74
75void res_counter_init(struct res_counter *counter);
76
77/*
78 * charge - try to consume more resource.
79 *
80 * @counter: the counter
81 * @val: the amount of the resource. each controller defines its own
82 * units, e.g. numbers, bytes, Kbytes, etc
83 *
84 * returns 0 on success and <0 if the counter->usage will exceed the
85 * counter->limit _locked call expects the counter->lock to be taken
86 */
87
88int res_counter_charge_locked(struct res_counter *counter, unsigned long val);
89int res_counter_charge(struct res_counter *counter, unsigned long val);
90
91/*
92 * uncharge - tell that some portion of the resource is released
93 *
94 * @counter: the counter
95 * @val: the amount of the resource
96 *
97 * these calls check for usage underflow and show a warning on the console
98 * _locked call expects the counter->lock to be taken
99 */
100
101void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
102void res_counter_uncharge(struct res_counter *counter, unsigned long val);
103
104static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
105{
106 if (cnt->usage < cnt->limit)
107 return true;
108
109 return false;
110}
111
112/*
113 * Helper function to detect if the cgroup is within it's limit or
114 * not. It's currently called from cgroup_rss_prepare()
115 */
116static inline bool res_counter_check_under_limit(struct res_counter *cnt)
117{
118 bool ret;
119 unsigned long flags;
120
121 spin_lock_irqsave(&cnt->lock, flags);
122 ret = res_counter_limit_check_locked(cnt);
123 spin_unlock_irqrestore(&cnt->lock, flags);
124 return ret;
125}
126
127#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 97347f22fc20..1383692ac5bd 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -8,6 +8,7 @@
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/memcontrol.h>
11 12
12/* 13/*
13 * The anon_vma heads a list of private "related" vmas, to scan if 14 * The anon_vma heads a list of private "related" vmas, to scan if
@@ -86,7 +87,7 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma,
86/* 87/*
87 * Called from mm/vmscan.c to handle paging out 88 * Called from mm/vmscan.c to handle paging out
88 */ 89 */
89int page_referenced(struct page *, int is_locked); 90int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt);
90int try_to_unmap(struct page *, int ignore_refs); 91int try_to_unmap(struct page *, int ignore_refs);
91 92
92/* 93/*
@@ -114,7 +115,7 @@ int page_mkclean(struct page *);
114#define anon_vma_prepare(vma) (0) 115#define anon_vma_prepare(vma) (0)
115#define anon_vma_link(vma) do {} while (0) 116#define anon_vma_link(vma) do {} while (0)
116 117
117#define page_referenced(page,l) TestClearPageReferenced(page) 118#define page_referenced(page,l,cnt) TestClearPageReferenced(page)
118#define try_to_unmap(page, refs) SWAP_FAIL 119#define try_to_unmap(page, refs) SWAP_FAIL
119 120
120static inline int page_mkclean(struct page *page) 121static inline int page_mkclean(struct page *page)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7c8ca05c3cae..8a4812c1c038 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -92,6 +92,7 @@ struct sched_param {
92 92
93#include <asm/processor.h> 93#include <asm/processor.h>
94 94
95struct mem_cgroup;
95struct exec_domain; 96struct exec_domain;
96struct futex_pi_state; 97struct futex_pi_state;
97struct robust_list_head; 98struct robust_list_head;
diff --git a/include/linux/serial167.h b/include/linux/serial167.h
index 71b6df2516a6..59c81b708562 100644
--- a/include/linux/serial167.h
+++ b/include/linux/serial167.h
@@ -37,7 +37,6 @@ struct cyclades_port {
37 int ignore_status_mask; 37 int ignore_status_mask;
38 int close_delay; 38 int close_delay;
39 int IER; /* Interrupt Enable Register */ 39 int IER; /* Interrupt Enable Register */
40 unsigned long event;
41 unsigned long last_active; 40 unsigned long last_active;
42 int count; /* # of fd on device */ 41 int count; /* # of fd on device */
43 int x_char; /* to be pushed out ASAP */ 42 int x_char; /* to be pushed out ASAP */
@@ -49,7 +48,6 @@ struct cyclades_port {
49 int xmit_cnt; 48 int xmit_cnt;
50 int default_threshold; 49 int default_threshold;
51 int default_timeout; 50 int default_timeout;
52 struct work_struct tqueue;
53 wait_queue_head_t open_wait; 51 wait_queue_head_t open_wait;
54 wait_queue_head_t close_wait; 52 wait_queue_head_t close_wait;
55 struct cyclades_monitor mon; 53 struct cyclades_monitor mon;
@@ -67,18 +65,6 @@ struct cyclades_port {
67#define CYGETDEFTIMEOUT 0x435908 65#define CYGETDEFTIMEOUT 0x435908
68#define CYSETDEFTIMEOUT 0x435909 66#define CYSETDEFTIMEOUT 0x435909
69 67
70/*
71 * Events are used to schedule things to happen at timer-interrupt
72 * time, instead of at cy interrupt time.
73 */
74#define Cy_EVENT_READ_PROCESS 0
75#define Cy_EVENT_WRITE_WAKEUP 1
76#define Cy_EVENT_HANGUP 2
77#define Cy_EVENT_BREAK 3
78#define Cy_EVENT_OPEN_WAKEUP 4
79
80
81
82#define CyMaxChipsPerCard 1 68#define CyMaxChipsPerCard 1
83 69
84/**** cd2401 registers ****/ 70/**** cd2401 registers ****/
diff --git a/include/linux/shm.h b/include/linux/shm.h
index eeaed921a1dc..eca6235a46c0 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -3,7 +3,11 @@
3 3
4#include <linux/ipc.h> 4#include <linux/ipc.h>
5#include <linux/errno.h> 5#include <linux/errno.h>
6#ifdef __KERNEL__
6#include <asm/page.h> 7#include <asm/page.h>
8#else
9#include <unistd.h>
10#endif
7 11
8/* 12/*
9 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can 13 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
@@ -13,7 +17,11 @@
13#define SHMMAX 0x2000000 /* max shared seg size (bytes) */ 17#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
14#define SHMMIN 1 /* min shared seg size (bytes) */ 18#define SHMMIN 1 /* min shared seg size (bytes) */
15#define SHMMNI 4096 /* max num of segs system wide */ 19#define SHMMNI 4096 /* max num of segs system wide */
20#ifdef __KERNEL__
16#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ 21#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
22#else
23#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
24#endif
17#define SHMSEG SHMMNI /* max shared segs per process */ 25#define SHMSEG SHMMNI /* max shared segs per process */
18 26
19#ifdef __KERNEL__ 27#ifdef __KERNEL__
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index 94b4a10b912f..0424d75a5aaa 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -95,7 +95,6 @@ struct stlport {
95 struct tty_struct *tty; 95 struct tty_struct *tty;
96 wait_queue_head_t open_wait; 96 wait_queue_head_t open_wait;
97 wait_queue_head_t close_wait; 97 wait_queue_head_t close_wait;
98 struct work_struct tqueue;
99 comstats_t stats; 98 comstats_t stats;
100 struct stlrq tx; 99 struct stlrq tx;
101}; 100};
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 353153ea0bd5..3ca5c4bd6d3f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -5,6 +5,7 @@
5#include <linux/linkage.h> 5#include <linux/linkage.h>
6#include <linux/mmzone.h> 6#include <linux/mmzone.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/memcontrol.h>
8#include <linux/sched.h> 9#include <linux/sched.h>
9 10
10#include <asm/atomic.h> 11#include <asm/atomic.h>
@@ -182,6 +183,9 @@ extern void swap_setup(void);
182/* linux/mm/vmscan.c */ 183/* linux/mm/vmscan.c */
183extern unsigned long try_to_free_pages(struct zone **zones, int order, 184extern unsigned long try_to_free_pages(struct zone **zones, int order,
184 gfp_t gfp_mask); 185 gfp_t gfp_mask);
186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
187 gfp_t gfp_mask);
188extern int __isolate_lru_page(struct page *page, int mode);
185extern unsigned long shrink_all_memory(unsigned long nr_pages); 189extern unsigned long shrink_all_memory(unsigned long nr_pages);
186extern int vm_swappiness; 190extern int vm_swappiness;
187extern int remove_mapping(struct address_space *mapping, struct page *page); 191extern int remove_mapping(struct address_space *mapping, struct page *page);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5824a9777ad7..dd8e08fe8855 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -53,13 +53,6 @@
53 */ 53 */
54#define __DISABLED_CHAR '\0' 54#define __DISABLED_CHAR '\0'
55 55
56/*
57 * This is the flip buffer used for the tty driver. The buffer is
58 * located in the tty structure, and is used as a high speed interface
59 * between the tty driver and the tty line discipline.
60 */
61#define TTY_FLIPBUF_SIZE 512
62
63struct tty_buffer { 56struct tty_buffer {
64 struct tty_buffer *next; 57 struct tty_buffer *next;
65 char *char_buf_ptr; 58 char *char_buf_ptr;