aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild11
-rw-r--r--include/asm-alpha/Kbuild10
-rw-r--r--include/asm-arm/arch-s3c2410/regs-power.h34
-rw-r--r--include/asm-arm/elf.h2
-rw-r--r--include/asm-arm/page.h4
-rw-r--r--include/asm-generic/Kbuild15
-rw-r--r--include/asm-generic/Kbuild.asm38
-rw-r--r--include/asm-generic/audit_change_attr.h4
-rw-r--r--include/asm-generic/audit_dir_write.h4
-rw-r--r--include/asm-i386/Kbuild9
-rw-r--r--include/asm-i386/system.h8
-rw-r--r--include/asm-ia64/Kbuild18
-rw-r--r--include/asm-m68k/page.h8
-rw-r--r--include/asm-parisc/page.h18
-rw-r--r--include/asm-powerpc/Kbuild45
-rw-r--r--include/asm-powerpc/cputable.h27
-rw-r--r--include/asm-powerpc/hvcall.h121
-rw-r--r--include/asm-powerpc/ibmebus.h2
-rw-r--r--include/asm-powerpc/ide.h12
-rw-r--r--include/asm-powerpc/io.h183
-rw-r--r--include/asm-powerpc/irq.h24
-rw-r--r--include/asm-powerpc/iseries/hv_call_xm.h17
-rw-r--r--include/asm-powerpc/iseries/hv_lp_config.h13
-rw-r--r--include/asm-powerpc/iseries/iseries_io.h60
-rw-r--r--include/asm-powerpc/iseries/it_exp_vpd_panel.h51
-rw-r--r--include/asm-powerpc/iseries/it_lp_naca.h80
-rw-r--r--include/asm-powerpc/iseries/it_lp_queue.h2
-rw-r--r--include/asm-powerpc/iseries/vio.h28
-rw-r--r--include/asm-powerpc/lppaca.h23
-rw-r--r--include/asm-powerpc/paca.h3
-rw-r--r--include/asm-powerpc/page.h6
-rw-r--r--include/asm-powerpc/ppc-pci.h11
-rw-r--r--include/asm-powerpc/processor.h1
-rw-r--r--include/asm-powerpc/prom.h40
-rw-r--r--include/asm-powerpc/ptrace.h4
-rw-r--r--include/asm-powerpc/reg.h1
-rw-r--r--include/asm-powerpc/rtas.h16
-rw-r--r--include/asm-powerpc/smu.h2
-rw-r--r--include/asm-powerpc/spu.h2
-rw-r--r--include/asm-powerpc/system.h5
-rw-r--r--include/asm-powerpc/vio.h4
-rw-r--r--include/asm-ppc/io.h26
-rw-r--r--include/asm-ppc/mpc8260_pci9.h4
-rw-r--r--include/asm-ppc/reg_booke.h16
-rw-r--r--include/asm-s390/Kbuild12
-rw-r--r--include/asm-s390/appldata.h90
-rw-r--r--include/asm-s390/cio.h7
-rw-r--r--include/asm-s390/dma.h2
-rw-r--r--include/asm-s390/futex.h87
-rw-r--r--include/asm-s390/io.h2
-rw-r--r--include/asm-s390/kdebug.h59
-rw-r--r--include/asm-s390/kprobes.h114
-rw-r--r--include/asm-s390/lowcore.h14
-rw-r--r--include/asm-s390/monwriter.h33
-rw-r--r--include/asm-s390/pgalloc.h67
-rw-r--r--include/asm-s390/pgtable.h124
-rw-r--r--include/asm-s390/processor.h17
-rw-r--r--include/asm-s390/setup.h66
-rw-r--r--include/asm-s390/smp.h2
-rw-r--r--include/asm-s390/uaccess.h172
-rw-r--r--include/asm-s390/unistd.h170
-rw-r--r--include/asm-s390/z90crypt.h212
-rw-r--r--include/asm-s390/zcrypt.h285
-rw-r--r--include/asm-sparc/Kbuild24
-rw-r--r--include/asm-sparc64/Kbuild27
-rw-r--r--include/asm-x86_64/Kbuild18
-rw-r--r--include/crypto/algapi.h156
-rw-r--r--include/crypto/twofish.h22
-rw-r--r--include/linux/Kbuild400
-rw-r--r--include/linux/byteorder/Kbuild9
-rw-r--r--include/linux/crypto.h689
-rw-r--r--include/linux/dvb/Kbuild11
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/mtd/cfi.h13
-rw-r--r--include/linux/netfilter/Kbuild47
-rw-r--r--include/linux/netfilter_arp/Kbuild5
-rw-r--r--include/linux/netfilter_bridge/Kbuild21
-rw-r--r--include/linux/netfilter_ipv4/Kbuild82
-rw-r--r--include/linux/netfilter_ipv6/Kbuild27
-rw-r--r--include/linux/nfsd/Kbuild9
-rw-r--r--include/linux/raid/Kbuild3
-rw-r--r--include/linux/scatterlist.h4
-rw-r--r--include/linux/sunrpc/Kbuild2
-rw-r--r--include/linux/sunrpc/gss_krb5.h19
-rw-r--r--include/linux/sunrpc/gss_spkm3.h4
-rw-r--r--include/linux/tc_act/Kbuild5
-rw-r--r--include/linux/tc_ematch/Kbuild5
-rw-r--r--include/mtd/Kbuild8
-rw-r--r--include/mtd/mtd-abi.h1
-rw-r--r--include/net/ah.h30
-rw-r--r--include/net/esp.h31
-rw-r--r--include/net/ipcomp.h5
-rw-r--r--include/net/sctp/constants.h4
-rw-r--r--include/net/sctp/sctp.h11
-rw-r--r--include/net/sctp/structs.h3
-rw-r--r--include/net/xfrm.h12
-rw-r--r--include/rdma/Kbuild2
-rw-r--r--include/rdma/ib_addr.h17
-rw-r--r--include/rdma/ib_sa.h45
-rw-r--r--include/rdma/ib_user_verbs.h2
-rw-r--r--include/rdma/ib_verbs.h31
-rw-r--r--include/rdma/iw_cm.h258
-rw-r--r--include/rdma/rdma_cm.h12
-rw-r--r--include/scsi/Kbuild4
-rw-r--r--include/sound/Kbuild12
-rw-r--r--include/video/Kbuild2
107 files changed, 3180 insertions, 1471 deletions
diff --git a/include/Kbuild b/include/Kbuild
index cb2534800b19..2d03f995865f 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,2 +1,9 @@
1header-y += asm-generic/ linux/ scsi/ sound/ mtd/ rdma/ video/ 1header-y += asm-generic/
2header-y += asm-$(ARCH)/ 2header-y += linux/
3header-y += scsi/
4header-y += sound/
5header-y += mtd/
6header-y += rdma/
7header-y += video/
8
9header-y += asm-$(ARCH)/
diff --git a/include/asm-alpha/Kbuild b/include/asm-alpha/Kbuild
index 2b06b3bad5ff..b7c8f188b313 100644
--- a/include/asm-alpha/Kbuild
+++ b/include/asm-alpha/Kbuild
@@ -1,5 +1,11 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += console.h fpu.h sysinfo.h compiler.h 3header-y += gentrap.h
4header-y += regdef.h
5header-y += pal.h
6header-y += reg.h
4 7
5header-y += gentrap.h regdef.h pal.h reg.h 8unifdef-y += console.h
9unifdef-y += fpu.h
10unifdef-y += sysinfo.h
11unifdef-y += compiler.h
diff --git a/include/asm-arm/arch-s3c2410/regs-power.h b/include/asm-arm/arch-s3c2410/regs-power.h
new file mode 100644
index 000000000000..6c319ea2afac
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/regs-power.h
@@ -0,0 +1,34 @@
1/* linux/include/asm/arch-s3c2410/regs-power.h
2 *
3 * Copyright (c) 2003,2004,2005,2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C24XX power control register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_PWR
14#define __ASM_ARM_REGS_PWR __FILE__
15
16#define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR)
17
18#define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20)
19#define S3C2412_PWRCFG S3C24XX_PWRREG(0x24)
20
21#define S3C2412_PWRCFG_BATF_IGNORE (0<<0)
22#define S3C2412_PWRCFG_BATF_SLEEP (3<<0)
23#define S3C2412_PWRCFG_BATF_MASK (3<<0)
24
25#define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0<<6)
26#define S3C2412_PWRCFG_STANDBYWFI_IDLE (1<<6)
27#define S3C2412_PWRCFG_STANDBYWFI_STOP (2<<6)
28#define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3<<6)
29#define S3C2412_PWRCFG_STANDBYWFI_MASK (3<<6)
30
31#define S3C2412_PWRCFG_RTC_MASKIRQ (1<<8)
32#define S3C2412_PWRCFG_NAND_NORST (1<<9)
33
34#endif /* __ASM_ARM_REGS_PWR */
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 71061ca5c5d0..ae7baa6c73f7 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -8,7 +8,9 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#include <asm/user.h> 10#include <asm/user.h>
11#ifdef __KERNEL
11#include <asm/procinfo.h> 12#include <asm/procinfo.h>
13#endif
12 14
13typedef unsigned long elf_greg_t; 15typedef unsigned long elf_greg_t;
14typedef unsigned long elf_freg_t[3]; 16typedef unsigned long elf_freg_t[3];
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 63d12f0244c5..b721270b9986 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -193,8 +193,8 @@ extern pmd_t *top_pmd;
193#define ARCH_SLAB_MINALIGN 8 193#define ARCH_SLAB_MINALIGN 8
194#endif 194#endif
195 195
196#endif /* __KERNEL__ */
197
198#include <asm-generic/page.h> 196#include <asm-generic/page.h>
199 197
198#endif /* __KERNEL__ */
199
200#endif 200#endif
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 70594b275a6e..3c06be381701 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -1,3 +1,12 @@
1header-y += atomic.h errno-base.h errno.h fcntl.h ioctl.h ipc.h mman.h \ 1header-y += atomic.h
2 signal.h statfs.h 2header-y += errno-base.h
3unifdef-y := resource.h siginfo.h 3header-y += errno.h
4header-y += fcntl.h
5header-y += ioctl.h
6header-y += ipc.h
7header-y += mman.h
8header-y += signal.h
9header-y += statfs.h
10
11unifdef-y += resource.h
12unifdef-y += siginfo.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index c00de6028fa8..a84c3d88a189 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,8 +1,34 @@
1unifdef-y += a.out.h auxvec.h byteorder.h errno.h fcntl.h ioctl.h \ 1unifdef-y += a.out.h
2 ioctls.h ipcbuf.h mman.h msgbuf.h param.h poll.h \ 2unifdef-y += auxvec.h
3 posix_types.h ptrace.h resource.h sembuf.h shmbuf.h shmparam.h \ 3unifdef-y += byteorder.h
4 sigcontext.h siginfo.h signal.h socket.h sockios.h stat.h \ 4unifdef-y += errno.h
5 statfs.h termbits.h termios.h types.h unistd.h user.h 5unifdef-y += fcntl.h
6unifdef-y += ioctl.h
7unifdef-y += ioctls.h
8unifdef-y += ipcbuf.h
9unifdef-y += mman.h
10unifdef-y += msgbuf.h
11unifdef-y += param.h
12unifdef-y += poll.h
13unifdef-y += posix_types.h
14unifdef-y += ptrace.h
15unifdef-y += resource.h
16unifdef-y += sembuf.h
17unifdef-y += shmbuf.h
18unifdef-y += sigcontext.h
19unifdef-y += siginfo.h
20unifdef-y += signal.h
21unifdef-y += socket.h
22unifdef-y += sockios.h
23unifdef-y += stat.h
24unifdef-y += statfs.h
25unifdef-y += termbits.h
26unifdef-y += termios.h
27unifdef-y += types.h
28unifdef-y += unistd.h
29unifdef-y += user.h
6 30
7# These probably shouldn't be exported 31# These probably shouldn't be exported
8unifdef-y += elf.h page.h 32unifdef-y += shmparam.h
33unifdef-y += elf.h
34unifdef-y += page.h
diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h
index cb05bf69745a..50764550a60c 100644
--- a/include/asm-generic/audit_change_attr.h
+++ b/include/asm-generic/audit_change_attr.h
@@ -1,16 +1,20 @@
1__NR_chmod, 1__NR_chmod,
2__NR_fchmod, 2__NR_fchmod,
3#ifdef __NR_chown
3__NR_chown, 4__NR_chown,
4__NR_fchown, 5__NR_fchown,
5__NR_lchown, 6__NR_lchown,
7#endif
6__NR_setxattr, 8__NR_setxattr,
7__NR_lsetxattr, 9__NR_lsetxattr,
8__NR_fsetxattr, 10__NR_fsetxattr,
9__NR_removexattr, 11__NR_removexattr,
10__NR_lremovexattr, 12__NR_lremovexattr,
11__NR_fremovexattr, 13__NR_fremovexattr,
14#ifdef __NR_fchownat
12__NR_fchownat, 15__NR_fchownat,
13__NR_fchmodat, 16__NR_fchmodat,
17#endif
14#ifdef __NR_chown32 18#ifdef __NR_chown32
15__NR_chown32, 19__NR_chown32,
16__NR_fchown32, 20__NR_fchown32,
diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h
index 161a7a58fbab..6621bd82cbe8 100644
--- a/include/asm-generic/audit_dir_write.h
+++ b/include/asm-generic/audit_dir_write.h
@@ -1,14 +1,18 @@
1__NR_rename, 1__NR_rename,
2__NR_mkdir, 2__NR_mkdir,
3__NR_rmdir, 3__NR_rmdir,
4#ifdef __NR_creat
4__NR_creat, 5__NR_creat,
6#endif
5__NR_link, 7__NR_link,
6__NR_unlink, 8__NR_unlink,
7__NR_symlink, 9__NR_symlink,
8__NR_mknod, 10__NR_mknod,
11#ifdef __NR_mkdirat
9__NR_mkdirat, 12__NR_mkdirat,
10__NR_mknodat, 13__NR_mknodat,
11__NR_unlinkat, 14__NR_unlinkat,
12__NR_renameat, 15__NR_renameat,
13__NR_linkat, 16__NR_linkat,
14__NR_symlinkat, 17__NR_symlinkat,
18#endif
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
index 2308190321da..b75a348d0c1c 100644
--- a/include/asm-i386/Kbuild
+++ b/include/asm-i386/Kbuild
@@ -1,5 +1,10 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += boot.h debugreg.h ldt.h ucontext.h 3header-y += boot.h
4header-y += debugreg.h
5header-y += ldt.h
6header-y += ucontext.h
4 7
5unifdef-y += mtrr.h setup.h vm86.h 8unifdef-y += mtrr.h
9unifdef-y += setup.h
10unifdef-y += vm86.h
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 49928eb33f8b..098bcee94e38 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -11,9 +11,14 @@
11struct task_struct; /* one of the stranger aspects of C forward declarations.. */ 11struct task_struct; /* one of the stranger aspects of C forward declarations.. */
12extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); 12extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
13 13
14/*
15 * Saving eflags is important. It switches not only IOPL between tasks,
16 * it also protects other tasks from NT leaking through sysenter etc.
17 */
14#define switch_to(prev,next,last) do { \ 18#define switch_to(prev,next,last) do { \
15 unsigned long esi,edi; \ 19 unsigned long esi,edi; \
16 asm volatile("pushl %%ebp\n\t" \ 20 asm volatile("pushfl\n\t" /* Save flags */ \
21 "pushl %%ebp\n\t" \
17 "movl %%esp,%0\n\t" /* save ESP */ \ 22 "movl %%esp,%0\n\t" /* save ESP */ \
18 "movl %5,%%esp\n\t" /* restore ESP */ \ 23 "movl %5,%%esp\n\t" /* restore ESP */ \
19 "movl $1f,%1\n\t" /* save EIP */ \ 24 "movl $1f,%1\n\t" /* save EIP */ \
@@ -21,6 +26,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
21 "jmp __switch_to\n" \ 26 "jmp __switch_to\n" \
22 "1:\t" \ 27 "1:\t" \
23 "popl %%ebp\n\t" \ 28 "popl %%ebp\n\t" \
29 "popfl" \
24 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ 30 :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
25 "=a" (last),"=S" (esi),"=D" (edi) \ 31 "=a" (last),"=S" (esi),"=D" (edi) \
26 :"m" (next->thread.esp),"m" (next->thread.eip), \ 32 :"m" (next->thread.esp),"m" (next->thread.eip), \
diff --git a/include/asm-ia64/Kbuild b/include/asm-ia64/Kbuild
index f1cb00f39c22..15818a18bc52 100644
--- a/include/asm-ia64/Kbuild
+++ b/include/asm-ia64/Kbuild
@@ -1,7 +1,17 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += break.h fpu.h fpswa.h gcc_intrin.h ia64regs.h \ 3header-y += break.h
4 intel_intrin.h intrinsics.h perfmon_default_smpl.h \ 4header-y += fpu.h
5 ptrace_offsets.h rse.h setup.h ucontext.h 5header-y += fpswa.h
6header-y += gcc_intrin.h
7header-y += ia64regs.h
8header-y += intel_intrin.h
9header-y += intrinsics.h
10header-y += perfmon_default_smpl.h
11header-y += ptrace_offsets.h
12header-y += rse.h
13header-y += setup.h
14header-y += ucontext.h
6 15
7unifdef-y += perfmon.h ustack.h 16unifdef-y += perfmon.h
17unifdef-y += ustack.h
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index db017f838c29..fcc165ddd09e 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -2,6 +2,8 @@
2#define _M68K_PAGE_H 2#define _M68K_PAGE_H
3 3
4 4
5#ifdef __KERNEL__
6
5/* PAGE_SHIFT determines the page size */ 7/* PAGE_SHIFT determines the page size */
6#ifndef CONFIG_SUN3 8#ifndef CONFIG_SUN3
7#define PAGE_SHIFT (12) 9#define PAGE_SHIFT (12)
@@ -15,8 +17,6 @@
15#endif 17#endif
16#define PAGE_MASK (~(PAGE_SIZE-1)) 18#define PAGE_MASK (~(PAGE_SIZE-1))
17 19
18#ifdef __KERNEL__
19
20#include <asm/setup.h> 20#include <asm/setup.h>
21 21
22#if PAGE_SHIFT < 13 22#if PAGE_SHIFT < 13
@@ -175,8 +175,8 @@ static inline void *__va(unsigned long x)
175#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 175#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
176 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 176 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
177 177
178#endif /* __KERNEL__ */
179
180#include <asm-generic/page.h> 178#include <asm-generic/page.h>
181 179
180#endif /* __KERNEL__ */
181
182#endif /* _M68K_PAGE_H */ 182#endif /* _M68K_PAGE_H */
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 0695bc958d56..57d6d82756dd 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -1,22 +1,14 @@
1#ifndef _PARISC_PAGE_H 1#ifndef _PARISC_PAGE_H
2#define _PARISC_PAGE_H 2#define _PARISC_PAGE_H
3 3
4#if !defined(__KERNEL__)
5/* this is for userspace applications (4k page size) */
6# define PAGE_SHIFT 12 /* 4k */
7# define PAGE_SIZE (1UL << PAGE_SHIFT)
8# define PAGE_MASK (~(PAGE_SIZE-1))
9#endif
10
11
12#ifdef __KERNEL__ 4#ifdef __KERNEL__
13 5
14#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) 6#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
15# define PAGE_SHIFT 12 /* 4k */ 7# define PAGE_SHIFT 12
16#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB) 8#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
17# define PAGE_SHIFT 14 /* 16k */ 9# define PAGE_SHIFT 14
18#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB) 10#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
19# define PAGE_SHIFT 16 /* 64k */ 11# define PAGE_SHIFT 16
20#else 12#else
21# error "unknown default kernel page size" 13# error "unknown default kernel page size"
22#endif 14#endif
@@ -188,9 +180,9 @@ extern int npmem_ranges;
188#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 180#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
189 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 181 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
190 182
191#endif /* __KERNEL__ */
192
193#include <asm-generic/memory_model.h> 183#include <asm-generic/memory_model.h>
194#include <asm-generic/page.h> 184#include <asm-generic/page.h>
195 185
186#endif /* __KERNEL__ */
187
196#endif /* _PARISC_PAGE_H */ 188#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
index ac61d7eb6021..9827849953a3 100644
--- a/include/asm-powerpc/Kbuild
+++ b/include/asm-powerpc/Kbuild
@@ -1,10 +1,41 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += a.out.h asm-compat.h bootx.h byteorder.h cputable.h elf.h \ 3header-y += auxvec.h
4 nvram.h param.h posix_types.h ptrace.h seccomp.h signal.h \ 4header-y += ioctls.h
5 termios.h types.h unistd.h 5header-y += mman.h
6header-y += sembuf.h
7header-y += siginfo.h
8header-y += stat.h
9header-y += errno.h
10header-y += ipcbuf.h
11header-y += msgbuf.h
12header-y += shmbuf.h
13header-y += socket.h
14header-y += termbits.h
15header-y += fcntl.h
16header-y += ipc.h
17header-y += poll.h
18header-y += shmparam.h
19header-y += sockios.h
20header-y += ucontext.h
21header-y += ioctl.h
22header-y += linkage.h
23header-y += resource.h
24header-y += sigcontext.h
25header-y += statfs.h
6 26
7header-y += auxvec.h ioctls.h mman.h sembuf.h siginfo.h stat.h errno.h \ 27unifdef-y += a.out.h
8 ipcbuf.h msgbuf.h shmbuf.h socket.h termbits.h fcntl.h ipc.h \ 28unifdef-y += asm-compat.h
9 poll.h shmparam.h sockios.h ucontext.h ioctl.h linkage.h \ 29unifdef-y += bootx.h
10 resource.h sigcontext.h statfs.h 30unifdef-y += byteorder.h
31unifdef-y += cputable.h
32unifdef-y += elf.h
33unifdef-y += nvram.h
34unifdef-y += param.h
35unifdef-y += posix_types.h
36unifdef-y += ptrace.h
37unifdef-y += seccomp.h
38unifdef-y += signal.h
39unifdef-y += termios.h
40unifdef-y += types.h
41unifdef-y += unistd.h
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 1ba3c9983614..12707ab9dc98 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -23,6 +23,7 @@
23#define PPC_FEATURE_SMT 0x00004000 23#define PPC_FEATURE_SMT 0x00004000
24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
25#define PPC_FEATURE_ARCH_2_05 0x00001000 25#define PPC_FEATURE_ARCH_2_05 0x00001000
26#define PPC_FEATURE_PA6T 0x00000800
26 27
27#define PPC_FEATURE_TRUE_LE 0x00000002 28#define PPC_FEATURE_TRUE_LE 0x00000002
28#define PPC_FEATURE_PPC_LE 0x00000001 29#define PPC_FEATURE_PPC_LE 0x00000001
@@ -36,6 +37,7 @@
36struct cpu_spec; 37struct cpu_spec;
37 38
38typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 39typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
40typedef void (*cpu_restore_t)(void);
39 41
40enum powerpc_oprofile_type { 42enum powerpc_oprofile_type {
41 PPC_OPROFILE_INVALID = 0, 43 PPC_OPROFILE_INVALID = 0,
@@ -65,6 +67,8 @@ struct cpu_spec {
65 * BHT, SPD, etc... from head.S before branching to identify_machine 67 * BHT, SPD, etc... from head.S before branching to identify_machine
66 */ 68 */
67 cpu_setup_t cpu_setup; 69 cpu_setup_t cpu_setup;
70 /* Used to restore cpu setup on secondary processors and at resume */
71 cpu_restore_t cpu_restore;
68 72
69 /* Used by oprofile userspace to select the right counters */ 73 /* Used by oprofile userspace to select the right counters */
70 char *oprofile_cpu_type; 74 char *oprofile_cpu_type;
@@ -145,7 +149,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
145 149
146#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 150#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
147 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 151 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
148 CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL) 152 CPU_FTR_NODSISRALIGN)
149 153
150/* iSeries doesn't support large pages */ 154/* iSeries doesn't support large pages */
151#ifdef CONFIG_PPC_ISERIES 155#ifdef CONFIG_PPC_ISERIES
@@ -310,24 +314,29 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
310 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 314 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
311 CPU_FTR_MMCRA | CPU_FTR_CTRL) 315 CPU_FTR_MMCRA | CPU_FTR_CTRL)
312#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 316#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
313 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA) 317 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
318 CPU_FTR_MMCRA)
314#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 319#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
315 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 320 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
316 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) 321 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
317#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 322#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
318 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
319 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 324 CPU_FTR_MMCRA | CPU_FTR_SMT | \
320 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 325 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
321 CPU_FTR_PURR) 326 CPU_FTR_PURR)
322#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 327#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 328 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
324 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 329 CPU_FTR_MMCRA | CPU_FTR_SMT | \
325 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 330 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
326 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) 331 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE)
327#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 332#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
328 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
329 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
330 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 335 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
336#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
339 CPU_FTR_PURR | CPU_FTR_REAL_LE)
331#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
332 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
333#endif 342#endif
@@ -336,7 +345,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
336#define CPU_FTRS_POSSIBLE \ 345#define CPU_FTRS_POSSIBLE \
337 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 346 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
338 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 347 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
339 CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE) 348 CPU_FTRS_CELL | CPU_FTRS_PA6T)
340#else 349#else
341enum { 350enum {
342 CPU_FTRS_POSSIBLE = 351 CPU_FTRS_POSSIBLE =
@@ -375,7 +384,7 @@ enum {
375#define CPU_FTRS_ALWAYS \ 384#define CPU_FTRS_ALWAYS \
376 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 385 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
377 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ 386 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \
378 CPU_FTRS_CELL & CPU_FTRS_POSSIBLE) 387 CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
379#else 388#else
380enum { 389enum {
381 CPU_FTRS_ALWAYS = 390 CPU_FTRS_ALWAYS =
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 0d3c4e85711a..257d1cecb8c9 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -164,9 +164,15 @@
164#define H_VIO_SIGNAL 0x104 164#define H_VIO_SIGNAL 0x104
165#define H_SEND_CRQ 0x108 165#define H_SEND_CRQ 0x108
166#define H_COPY_RDMA 0x110 166#define H_COPY_RDMA 0x110
167#define H_REGISTER_LOGICAL_LAN 0x114
168#define H_FREE_LOGICAL_LAN 0x118
169#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
170#define H_SEND_LOGICAL_LAN 0x120
171#define H_MULTICAST_CTRL 0x130
167#define H_SET_XDABR 0x134 172#define H_SET_XDABR 0x134
168#define H_STUFF_TCE 0x138 173#define H_STUFF_TCE 0x138
169#define H_PUT_TCE_INDIRECT 0x13C 174#define H_PUT_TCE_INDIRECT 0x13C
175#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
170#define H_VTERM_PARTNER_INFO 0x150 176#define H_VTERM_PARTNER_INFO 0x150
171#define H_REGISTER_VTERM 0x154 177#define H_REGISTER_VTERM 0x154
172#define H_FREE_VTERM 0x158 178#define H_FREE_VTERM 0x158
@@ -196,102 +202,59 @@
196#define H_GET_HCA_INFO 0x1B8 202#define H_GET_HCA_INFO 0x1B8
197#define H_GET_PERF_COUNT 0x1BC 203#define H_GET_PERF_COUNT 0x1BC
198#define H_MANAGE_TRACE 0x1C0 204#define H_MANAGE_TRACE 0x1C0
205#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
199#define H_QUERY_INT_STATE 0x1E4 206#define H_QUERY_INT_STATE 0x1E4
200#define H_POLL_PENDING 0x1D8 207#define H_POLL_PENDING 0x1D8
201#define H_JOIN 0x298 208#define H_JOIN 0x298
202#define H_VASI_STATE 0x2A4 209#define H_VASI_STATE 0x2A4
203#define H_ENABLE_CRQ 0x2B0 210#define H_ENABLE_CRQ 0x2B0
211#define MAX_HCALL_OPCODE H_ENABLE_CRQ
204 212
205#ifndef __ASSEMBLY__ 213#ifndef __ASSEMBLY__
206 214
207/* plpar_hcall() -- Generic call interface using above opcodes 215/**
216 * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
217 * @opcode: The hypervisor call to make.
208 * 218 *
209 * The actual call interface is a hypervisor call instruction with 219 * This call supports up to 7 arguments and only returns the status of
210 * the opcode in R3 and input args in R4-R7. 220 * the hcall. Use this version where possible, its slightly faster than
211 * Status is returned in R3 with variable output values in R4-R11. 221 * the other plpar_hcalls.
212 * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now
213 * and return only two out args which MUST ALWAYS BE PROVIDED.
214 */
215long plpar_hcall(unsigned long opcode,
216 unsigned long arg1,
217 unsigned long arg2,
218 unsigned long arg3,
219 unsigned long arg4,
220 unsigned long *out1,
221 unsigned long *out2,
222 unsigned long *out3);
223
224/* Same as plpar_hcall but for those opcodes that return no values
225 * other than status. Slightly more efficient.
226 */ 222 */
227long plpar_hcall_norets(unsigned long opcode, ...); 223long plpar_hcall_norets(unsigned long opcode, ...);
228 224
229/* 225/**
230 * Special hcall interface for ibmveth support. 226 * plpar_hcall: - Make a pseries hypervisor call
231 * Takes 8 input parms. Returns a rc and stores the 227 * @opcode: The hypervisor call to make.
232 * R4 return value in *out1. 228 * @retbuf: Buffer to store up to 4 return arguments in.
233 */
234long plpar_hcall_8arg_2ret(unsigned long opcode,
235 unsigned long arg1,
236 unsigned long arg2,
237 unsigned long arg3,
238 unsigned long arg4,
239 unsigned long arg5,
240 unsigned long arg6,
241 unsigned long arg7,
242 unsigned long arg8,
243 unsigned long *out1);
244
245/* plpar_hcall_4out()
246 * 229 *
247 * same as plpar_hcall except with 4 output arguments. 230 * This call supports up to 6 arguments and 4 return arguments. Use
231 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
248 * 232 *
233 * Used for all but the craziest of phyp interfaces (see plpar_hcall9)
249 */ 234 */
250long plpar_hcall_4out(unsigned long opcode, 235#define PLPAR_HCALL_BUFSIZE 4
251 unsigned long arg1, 236long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
252 unsigned long arg2,
253 unsigned long arg3,
254 unsigned long arg4,
255 unsigned long *out1,
256 unsigned long *out2,
257 unsigned long *out3,
258 unsigned long *out4);
259 237
260long plpar_hcall_7arg_7ret(unsigned long opcode, 238/**
261 unsigned long arg1, 239 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
262 unsigned long arg2, 240 * @opcode: The hypervisor call to make.
263 unsigned long arg3, 241 * @retbuf: Buffer to store up to 9 return arguments in.
264 unsigned long arg4, 242 *
265 unsigned long arg5, 243 * This call supports up to 9 arguments and 9 return arguments. Use
266 unsigned long arg6, 244 * PLPAR_HCALL9_BUFSIZE to size the return argument buffer.
267 unsigned long arg7, 245 */
268 unsigned long *out1, 246#define PLPAR_HCALL9_BUFSIZE 9
269 unsigned long *out2, 247long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
270 unsigned long *out3,
271 unsigned long *out4,
272 unsigned long *out5,
273 unsigned long *out6,
274 unsigned long *out7);
275 248
276long plpar_hcall_9arg_9ret(unsigned long opcode, 249/* For hcall instrumentation. One structure per-hcall, per-CPU */
277 unsigned long arg1, 250struct hcall_stats {
278 unsigned long arg2, 251 unsigned long num_calls; /* number of calls (on this CPU) */
279 unsigned long arg3, 252 unsigned long tb_total; /* total wall time (mftb) of calls. */
280 unsigned long arg4, 253 unsigned long purr_total; /* total cpu time (PURR) of calls. */
281 unsigned long arg5, 254};
282 unsigned long arg6, 255void update_hcall_stats(unsigned long opcode, unsigned long tb_delta,
283 unsigned long arg7, 256 unsigned long purr_delta);
284 unsigned long arg8, 257#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)
285 unsigned long arg9,
286 unsigned long *out1,
287 unsigned long *out2,
288 unsigned long *out3,
289 unsigned long *out4,
290 unsigned long *out5,
291 unsigned long *out6,
292 unsigned long *out7,
293 unsigned long *out8,
294 unsigned long *out9);
295 258
296#endif /* __ASSEMBLY__ */ 259#endif /* __ASSEMBLY__ */
297#endif /* __KERNEL__ */ 260#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 7a42723d107c..7ab195a27888 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops;
48extern struct bus_type ibmebus_bus_type; 48extern struct bus_type ibmebus_bus_type;
49 49
50struct ibmebus_dev { 50struct ibmebus_dev {
51 char *name; 51 const char *name;
52 struct of_device ofdev; 52 struct of_device ofdev;
53}; 53};
54 54
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index b09b42af6a1e..c8390f9485de 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -12,6 +12,7 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <asm/mpc8xx.h> 13#include <asm/mpc8xx.h>
14#endif 14#endif
15#include <asm/io.h>
15 16
16#ifndef MAX_HWIFS 17#ifndef MAX_HWIFS
17#ifdef __powerpc64__ 18#ifdef __powerpc64__
@@ -21,15 +22,14 @@
21#endif 22#endif
22#endif 23#endif
23 24
25#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
26#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
27#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
28#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
29
24#ifndef __powerpc64__ 30#ifndef __powerpc64__
25#include <linux/hdreg.h> 31#include <linux/hdreg.h>
26#include <linux/ioport.h> 32#include <linux/ioport.h>
27#include <asm/io.h>
28
29extern void __ide_mm_insw(void __iomem *port, void *addr, u32 count);
30extern void __ide_mm_outsw(void __iomem *port, void *addr, u32 count);
31extern void __ide_mm_insl(void __iomem *port, void *addr, u32 count);
32extern void __ide_mm_outsl(void __iomem *port, void *addr, u32 count);
33 33
34struct ide_machdep_calls { 34struct ide_machdep_calls {
35 int (*default_irq)(unsigned long base); 35 int (*default_irq)(unsigned long base);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 212428db0d8b..46bae1cf385b 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -20,20 +20,11 @@ extern int check_legacy_ioport(unsigned long base_port);
20#include <asm/page.h> 20#include <asm/page.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#include <asm/paca.h> 22#include <asm/paca.h>
23#ifdef CONFIG_PPC_ISERIES
24#include <asm/iseries/iseries_io.h>
25#endif
26#include <asm/synch.h> 23#include <asm/synch.h>
27#include <asm/delay.h> 24#include <asm/delay.h>
28 25
29#include <asm-generic/iomap.h> 26#include <asm-generic/iomap.h>
30 27
31#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
32#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
33#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
34#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
35
36
37#define SIO_CONFIG_RA 0x398 28#define SIO_CONFIG_RA 0x398
38#define SIO_CONFIG_RD 0x399 29#define SIO_CONFIG_RD 0x399
39 30
@@ -43,42 +34,53 @@ extern unsigned long isa_io_base;
43extern unsigned long pci_io_base; 34extern unsigned long pci_io_base;
44 35
45#ifdef CONFIG_PPC_ISERIES 36#ifdef CONFIG_PPC_ISERIES
46/* __raw_* accessors aren't supported on iSeries */ 37
47#define __raw_readb(addr) { BUG(); 0; } 38extern int in_8(const volatile unsigned char __iomem *addr);
48#define __raw_readw(addr) { BUG(); 0; } 39extern void out_8(volatile unsigned char __iomem *addr, int val);
49#define __raw_readl(addr) { BUG(); 0; } 40extern int in_le16(const volatile unsigned short __iomem *addr);
50#define __raw_readq(addr) { BUG(); 0; } 41extern int in_be16(const volatile unsigned short __iomem *addr);
51#define __raw_writeb(v, addr) { BUG(); 0; } 42extern void out_le16(volatile unsigned short __iomem *addr, int val);
52#define __raw_writew(v, addr) { BUG(); 0; } 43extern void out_be16(volatile unsigned short __iomem *addr, int val);
53#define __raw_writel(v, addr) { BUG(); 0; } 44extern unsigned in_le32(const volatile unsigned __iomem *addr);
54#define __raw_writeq(v, addr) { BUG(); 0; } 45extern unsigned in_be32(const volatile unsigned __iomem *addr);
55#define readb(addr) iSeries_Read_Byte(addr) 46extern void out_le32(volatile unsigned __iomem *addr, int val);
56#define readw(addr) iSeries_Read_Word(addr) 47extern void out_be32(volatile unsigned __iomem *addr, int val);
57#define readl(addr) iSeries_Read_Long(addr) 48extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
58#define writeb(data, addr) iSeries_Write_Byte((data),(addr)) 49extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
59#define writew(data, addr) iSeries_Write_Word((data),(addr)) 50extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
60#define writel(data, addr) iSeries_Write_Long((data),(addr)) 51extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
61#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) 52
62#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) 53extern unsigned char __raw_readb(const volatile void __iomem *addr);
63#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) 54extern unsigned short __raw_readw(const volatile void __iomem *addr);
64 55extern unsigned int __raw_readl(const volatile void __iomem *addr);
65#define inb(addr) readb(((void __iomem *)(long)(addr))) 56extern unsigned long __raw_readq(const volatile void __iomem *addr);
66#define inw(addr) readw(((void __iomem *)(long)(addr))) 57extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
67#define inl(addr) readl(((void __iomem *)(long)(addr))) 58extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
68#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) 59extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
69#define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) 60extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
70#define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) 61
71/* 62extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
72 * The *_ns versions below don't do byte-swapping. 63extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
73 * Neither do the standard versions now, these are just here 64 unsigned long n);
74 * for older code. 65extern void memcpy_toio(volatile void __iomem *dest, const void *src,
75 */ 66 unsigned long n);
76#define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 67
77#define insw(port, buf, ns) _insw_ns((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 68#else /* CONFIG_PPC_ISERIES */
78#define insl(port, buf, nl) _insl_ns((u8 __iomem *)((port)+pci_io_base), (buf), (nl)) 69
79#define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 70#define in_8(addr) __in_8((addr))
80#define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 71#define out_8(addr, val) __out_8((addr), (val))
81#else 72#define in_le16(addr) __in_le16((addr))
73#define in_be16(addr) __in_be16((addr))
74#define out_le16(addr, val) __out_le16((addr), (val))
75#define out_be16(addr, val) __out_be16((addr), (val))
76#define in_le32(addr) __in_le32((addr))
77#define in_be32(addr) __in_be32((addr))
78#define out_le32(addr, val) __out_le32((addr), (val))
79#define out_be32(addr, val) __out_be32((addr), (val))
80#define in_le64(addr) __in_le64((addr))
81#define in_be64(addr) __in_be64((addr))
82#define out_le64(addr, val) __out_le64((addr), (val))
83#define out_be64(addr, val) __out_be64((addr), (val))
82 84
83static inline unsigned char __raw_readb(const volatile void __iomem *addr) 85static inline unsigned char __raw_readb(const volatile void __iomem *addr)
84{ 86{
@@ -112,23 +114,11 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
112{ 114{
113 *(volatile unsigned long __force *)addr = v; 115 *(volatile unsigned long __force *)addr = v;
114} 116}
115#define readb(addr) eeh_readb(addr)
116#define readw(addr) eeh_readw(addr)
117#define readl(addr) eeh_readl(addr)
118#define readq(addr) eeh_readq(addr)
119#define writeb(data, addr) eeh_writeb((data), (addr))
120#define writew(data, addr) eeh_writew((data), (addr))
121#define writel(data, addr) eeh_writel((data), (addr))
122#define writeq(data, addr) eeh_writeq((data), (addr))
123#define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) 117#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
124#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) 118#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
125#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) 119#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
126#define inb(port) eeh_inb((unsigned long)port) 120
127#define outb(val, port) eeh_outb(val, (unsigned long)port) 121#endif /* CONFIG_PPC_ISERIES */
128#define inw(port) eeh_inw((unsigned long)port)
129#define outw(val, port) eeh_outw(val, (unsigned long)port)
130#define inl(port) eeh_inl((unsigned long)port)
131#define outl(val, port) eeh_outl(val, (unsigned long)port)
132 122
133/* 123/*
134 * The insw/outsw/insl/outsl macros don't do byte-swapping. 124 * The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -138,30 +128,37 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
138#define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) 128#define insb(port, buf, ns) eeh_insb((port), (buf), (ns))
139#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 129#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
140#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 130#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
141#define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
142#define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
143
144#endif
145 131
146#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 132#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
147#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 133#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
148#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 134#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
149 135
136#define readb(addr) eeh_readb(addr)
137#define readw(addr) eeh_readw(addr)
138#define readl(addr) eeh_readl(addr)
139#define readq(addr) eeh_readq(addr)
140#define writeb(data, addr) eeh_writeb((data), (addr))
141#define writew(data, addr) eeh_writew((data), (addr))
142#define writel(data, addr) eeh_writel((data), (addr))
143#define writeq(data, addr) eeh_writeq((data), (addr))
144#define inb(port) eeh_inb((unsigned long)port)
145#define outb(val, port) eeh_outb(val, (unsigned long)port)
146#define inw(port) eeh_inw((unsigned long)port)
147#define outw(val, port) eeh_outw(val, (unsigned long)port)
148#define inl(port) eeh_inl((unsigned long)port)
149#define outl(val, port) eeh_outl(val, (unsigned long)port)
150
150#define readb_relaxed(addr) readb(addr) 151#define readb_relaxed(addr) readb(addr)
151#define readw_relaxed(addr) readw(addr) 152#define readw_relaxed(addr) readw(addr)
152#define readl_relaxed(addr) readl(addr) 153#define readl_relaxed(addr) readl(addr)
153#define readq_relaxed(addr) readq(addr) 154#define readq_relaxed(addr) readq(addr)
154 155
155extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 156extern void _insb(volatile u8 __iomem *port, void *buf, long count);
156extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 157extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
157extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 158extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
158extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 159extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
159extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 160extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
160extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 161extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
161extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
162extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
163extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
164extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
165 162
166static inline void mmiowb(void) 163static inline void mmiowb(void)
167{ 164{
@@ -180,14 +177,6 @@ static inline void mmiowb(void)
180#define inl_p(port) inl(port) 177#define inl_p(port) inl(port)
181#define outl_p(val, port) (udelay(1), outl((val), (port))) 178#define outl_p(val, port) (udelay(1), outl((val), (port)))
182 179
183/*
184 * The *_ns versions below don't do byte-swapping.
185 * Neither do the standard versions now, these are just here
186 * for older code.
187 */
188#define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
189#define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
190
191 180
192#define IO_SPACE_LIMIT ~(0UL) 181#define IO_SPACE_LIMIT ~(0UL)
193 182
@@ -279,7 +268,7 @@ static inline void iosync(void)
279 * and should not be used directly by device drivers. Use inb/readb 268 * and should not be used directly by device drivers. Use inb/readb
280 * instead. 269 * instead.
281 */ 270 */
282static inline int in_8(const volatile unsigned char __iomem *addr) 271static inline int __in_8(const volatile unsigned char __iomem *addr)
283{ 272{
284 int ret; 273 int ret;
285 274
@@ -288,14 +277,14 @@ static inline int in_8(const volatile unsigned char __iomem *addr)
288 return ret; 277 return ret;
289} 278}
290 279
291static inline void out_8(volatile unsigned char __iomem *addr, int val) 280static inline void __out_8(volatile unsigned char __iomem *addr, int val)
292{ 281{
293 __asm__ __volatile__("sync; stb%U0%X0 %1,%0" 282 __asm__ __volatile__("sync; stb%U0%X0 %1,%0"
294 : "=m" (*addr) : "r" (val)); 283 : "=m" (*addr) : "r" (val));
295 get_paca()->io_sync = 1; 284 get_paca()->io_sync = 1;
296} 285}
297 286
298static inline int in_le16(const volatile unsigned short __iomem *addr) 287static inline int __in_le16(const volatile unsigned short __iomem *addr)
299{ 288{
300 int ret; 289 int ret;
301 290
@@ -304,7 +293,7 @@ static inline int in_le16(const volatile unsigned short __iomem *addr)
304 return ret; 293 return ret;
305} 294}
306 295
307static inline int in_be16(const volatile unsigned short __iomem *addr) 296static inline int __in_be16(const volatile unsigned short __iomem *addr)
308{ 297{
309 int ret; 298 int ret;
310 299
@@ -313,21 +302,21 @@ static inline int in_be16(const volatile unsigned short __iomem *addr)
313 return ret; 302 return ret;
314} 303}
315 304
316static inline void out_le16(volatile unsigned short __iomem *addr, int val) 305static inline void __out_le16(volatile unsigned short __iomem *addr, int val)
317{ 306{
318 __asm__ __volatile__("sync; sthbrx %1,0,%2" 307 __asm__ __volatile__("sync; sthbrx %1,0,%2"
319 : "=m" (*addr) : "r" (val), "r" (addr)); 308 : "=m" (*addr) : "r" (val), "r" (addr));
320 get_paca()->io_sync = 1; 309 get_paca()->io_sync = 1;
321} 310}
322 311
323static inline void out_be16(volatile unsigned short __iomem *addr, int val) 312static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
324{ 313{
325 __asm__ __volatile__("sync; sth%U0%X0 %1,%0" 314 __asm__ __volatile__("sync; sth%U0%X0 %1,%0"
326 : "=m" (*addr) : "r" (val)); 315 : "=m" (*addr) : "r" (val));
327 get_paca()->io_sync = 1; 316 get_paca()->io_sync = 1;
328} 317}
329 318
330static inline unsigned in_le32(const volatile unsigned __iomem *addr) 319static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
331{ 320{
332 unsigned ret; 321 unsigned ret;
333 322
@@ -336,7 +325,7 @@ static inline unsigned in_le32(const volatile unsigned __iomem *addr)
336 return ret; 325 return ret;
337} 326}
338 327
339static inline unsigned in_be32(const volatile unsigned __iomem *addr) 328static inline unsigned __in_be32(const volatile unsigned __iomem *addr)
340{ 329{
341 unsigned ret; 330 unsigned ret;
342 331
@@ -345,21 +334,21 @@ static inline unsigned in_be32(const volatile unsigned __iomem *addr)
345 return ret; 334 return ret;
346} 335}
347 336
348static inline void out_le32(volatile unsigned __iomem *addr, int val) 337static inline void __out_le32(volatile unsigned __iomem *addr, int val)
349{ 338{
350 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) 339 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
351 : "r" (val), "r" (addr)); 340 : "r" (val), "r" (addr));
352 get_paca()->io_sync = 1; 341 get_paca()->io_sync = 1;
353} 342}
354 343
355static inline void out_be32(volatile unsigned __iomem *addr, int val) 344static inline void __out_be32(volatile unsigned __iomem *addr, int val)
356{ 345{
357 __asm__ __volatile__("sync; stw%U0%X0 %1,%0" 346 __asm__ __volatile__("sync; stw%U0%X0 %1,%0"
358 : "=m" (*addr) : "r" (val)); 347 : "=m" (*addr) : "r" (val));
359 get_paca()->io_sync = 1; 348 get_paca()->io_sync = 1;
360} 349}
361 350
362static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) 351static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
363{ 352{
364 unsigned long tmp, ret; 353 unsigned long tmp, ret;
365 354
@@ -379,7 +368,7 @@ static inline unsigned long in_le64(const volatile unsigned long __iomem *addr)
379 return ret; 368 return ret;
380} 369}
381 370
382static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) 371static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
383{ 372{
384 unsigned long ret; 373 unsigned long ret;
385 374
@@ -388,7 +377,7 @@ static inline unsigned long in_be64(const volatile unsigned long __iomem *addr)
388 return ret; 377 return ret;
389} 378}
390 379
391static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) 380static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
392{ 381{
393 unsigned long tmp; 382 unsigned long tmp;
394 383
@@ -406,15 +395,13 @@ static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long
406 get_paca()->io_sync = 1; 395 get_paca()->io_sync = 1;
407} 396}
408 397
409static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) 398static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
410{ 399{
411 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); 400 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
412 get_paca()->io_sync = 1; 401 get_paca()->io_sync = 1;
413} 402}
414 403
415#ifndef CONFIG_PPC_ISERIES
416#include <asm/eeh.h> 404#include <asm/eeh.h>
417#endif
418 405
419/** 406/**
420 * check_signature - find BIOS signatures 407 * check_signature - find BIOS signatures
@@ -430,7 +417,6 @@ static inline int check_signature(const volatile void __iomem * io_addr,
430 const unsigned char *signature, int length) 417 const unsigned char *signature, int length)
431{ 418{
432 int retval = 0; 419 int retval = 0;
433#ifndef CONFIG_PPC_ISERIES
434 do { 420 do {
435 if (readb(io_addr) != *signature) 421 if (readb(io_addr) != *signature)
436 goto out; 422 goto out;
@@ -440,7 +426,6 @@ static inline int check_signature(const volatile void __iomem * io_addr,
440 } while (length); 426 } while (length);
441 retval = 1; 427 retval = 1;
442out: 428out:
443#endif
444 return retval; 429 return retval;
445} 430}
446 431
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index d903a62959da..4da41efb1319 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -137,7 +137,7 @@ struct irq_map_entry {
137extern struct irq_map_entry irq_map[NR_IRQS]; 137extern struct irq_map_entry irq_map[NR_IRQS];
138 138
139 139
140/*** 140/**
141 * irq_alloc_host - Allocate a new irq_host data structure 141 * irq_alloc_host - Allocate a new irq_host data structure
142 * @node: device-tree node of the interrupt controller 142 * @node: device-tree node of the interrupt controller
143 * @revmap_type: type of reverse mapping to use 143 * @revmap_type: type of reverse mapping to use
@@ -159,14 +159,14 @@ extern struct irq_host *irq_alloc_host(unsigned int revmap_type,
159 irq_hw_number_t inval_irq); 159 irq_hw_number_t inval_irq);
160 160
161 161
162/*** 162/**
163 * irq_find_host - Locates a host for a given device node 163 * irq_find_host - Locates a host for a given device node
164 * @node: device-tree node of the interrupt controller 164 * @node: device-tree node of the interrupt controller
165 */ 165 */
166extern struct irq_host *irq_find_host(struct device_node *node); 166extern struct irq_host *irq_find_host(struct device_node *node);
167 167
168 168
169/*** 169/**
170 * irq_set_default_host - Set a "default" host 170 * irq_set_default_host - Set a "default" host
171 * @host: default host pointer 171 * @host: default host pointer
172 * 172 *
@@ -178,7 +178,7 @@ extern struct irq_host *irq_find_host(struct device_node *node);
178extern void irq_set_default_host(struct irq_host *host); 178extern void irq_set_default_host(struct irq_host *host);
179 179
180 180
181/*** 181/**
182 * irq_set_virq_count - Set the maximum number of virt irqs 182 * irq_set_virq_count - Set the maximum number of virt irqs
183 * @count: number of linux virtual irqs, capped with NR_IRQS 183 * @count: number of linux virtual irqs, capped with NR_IRQS
184 * 184 *
@@ -188,7 +188,7 @@ extern void irq_set_default_host(struct irq_host *host);
188extern void irq_set_virq_count(unsigned int count); 188extern void irq_set_virq_count(unsigned int count);
189 189
190 190
191/*** 191/**
192 * irq_create_mapping - Map a hardware interrupt into linux virq space 192 * irq_create_mapping - Map a hardware interrupt into linux virq space
193 * @host: host owning this hardware interrupt or NULL for default host 193 * @host: host owning this hardware interrupt or NULL for default host
194 * @hwirq: hardware irq number in that host space 194 * @hwirq: hardware irq number in that host space
@@ -202,13 +202,13 @@ extern unsigned int irq_create_mapping(struct irq_host *host,
202 irq_hw_number_t hwirq); 202 irq_hw_number_t hwirq);
203 203
204 204
205/*** 205/**
206 * irq_dispose_mapping - Unmap an interrupt 206 * irq_dispose_mapping - Unmap an interrupt
207 * @virq: linux virq number of the interrupt to unmap 207 * @virq: linux virq number of the interrupt to unmap
208 */ 208 */
209extern void irq_dispose_mapping(unsigned int virq); 209extern void irq_dispose_mapping(unsigned int virq);
210 210
211/*** 211/**
212 * irq_find_mapping - Find a linux virq from an hw irq number. 212 * irq_find_mapping - Find a linux virq from an hw irq number.
213 * @host: host owning this hardware interrupt 213 * @host: host owning this hardware interrupt
214 * @hwirq: hardware irq number in that host space 214 * @hwirq: hardware irq number in that host space
@@ -221,7 +221,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host,
221 irq_hw_number_t hwirq); 221 irq_hw_number_t hwirq);
222 222
223 223
224/*** 224/**
225 * irq_radix_revmap - Find a linux virq from a hw irq number. 225 * irq_radix_revmap - Find a linux virq from a hw irq number.
226 * @host: host owning this hardware interrupt 226 * @host: host owning this hardware interrupt
227 * @hwirq: hardware irq number in that host space 227 * @hwirq: hardware irq number in that host space
@@ -232,7 +232,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host,
232extern unsigned int irq_radix_revmap(struct irq_host *host, 232extern unsigned int irq_radix_revmap(struct irq_host *host,
233 irq_hw_number_t hwirq); 233 irq_hw_number_t hwirq);
234 234
235/*** 235/**
236 * irq_linear_revmap - Find a linux virq from a hw irq number. 236 * irq_linear_revmap - Find a linux virq from a hw irq number.
237 * @host: host owning this hardware interrupt 237 * @host: host owning this hardware interrupt
238 * @hwirq: hardware irq number in that host space 238 * @hwirq: hardware irq number in that host space
@@ -247,7 +247,7 @@ extern unsigned int irq_linear_revmap(struct irq_host *host,
247 247
248 248
249 249
250/*** 250/**
251 * irq_alloc_virt - Allocate virtual irq numbers 251 * irq_alloc_virt - Allocate virtual irq numbers
252 * @host: host owning these new virtual irqs 252 * @host: host owning these new virtual irqs
253 * @count: number of consecutive numbers to allocate 253 * @count: number of consecutive numbers to allocate
@@ -261,7 +261,7 @@ extern unsigned int irq_alloc_virt(struct irq_host *host,
261 unsigned int count, 261 unsigned int count,
262 unsigned int hint); 262 unsigned int hint);
263 263
264/*** 264/**
265 * irq_free_virt - Free virtual irq numbers 265 * irq_free_virt - Free virtual irq numbers
266 * @virq: virtual irq number of the first interrupt to free 266 * @virq: virtual irq number of the first interrupt to free
267 * @count: number of interrupts to free 267 * @count: number of interrupts to free
@@ -300,7 +300,7 @@ extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
300 300
301/* -- End OF helpers -- */ 301/* -- End OF helpers -- */
302 302
303/*** 303/**
304 * irq_early_init - Init irq remapping subsystem 304 * irq_early_init - Init irq remapping subsystem
305 */ 305 */
306extern void irq_early_init(void); 306extern void irq_early_init(void);
diff --git a/include/asm-powerpc/iseries/hv_call_xm.h b/include/asm-powerpc/iseries/hv_call_xm.h
index ca9202cb01ed..392ac3f54df0 100644
--- a/include/asm-powerpc/iseries/hv_call_xm.h
+++ b/include/asm-powerpc/iseries/hv_call_xm.h
@@ -16,23 +16,6 @@
16#define HvCallXmSetTce HvCallXm + 11 16#define HvCallXmSetTce HvCallXm + 11
17#define HvCallXmSetTces HvCallXm + 13 17#define HvCallXmSetTces HvCallXm + 13
18 18
19/*
20 * Structure passed to HvCallXm_getTceTableParms
21 */
22struct iommu_table_cb {
23 unsigned long itc_busno; /* Bus number for this tce table */
24 unsigned long itc_start; /* Will be NULL for secondary */
25 unsigned long itc_totalsize; /* Size (in pages) of whole table */
26 unsigned long itc_offset; /* Index into real tce table of the
27 start of our section */
28 unsigned long itc_size; /* Size (in pages) of our section */
29 unsigned long itc_index; /* Index of this tce table */
30 unsigned short itc_maxtables; /* Max num of tables for partition */
31 unsigned char itc_virtbus; /* Flag to indicate virtual bus */
32 unsigned char itc_slotno; /* IOA Tce Slot Index */
33 unsigned char itc_rsvd[4];
34};
35
36static inline void HvCallXm_getTceTableParms(u64 cb) 19static inline void HvCallXm_getTceTableParms(u64 cb)
37{ 20{
38 HvCall1(HvCallXmGetTceTableParms, cb); 21 HvCall1(HvCallXmGetTceTableParms, cb);
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h
index df8b20739719..a006fd1e4a2c 100644
--- a/include/asm-powerpc/iseries/hv_lp_config.h
+++ b/include/asm-powerpc/iseries/hv_lp_config.h
@@ -25,7 +25,6 @@
25 25
26#include <asm/iseries/hv_call_sc.h> 26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iseries/hv_types.h> 27#include <asm/iseries/hv_types.h>
28#include <asm/iseries/it_lp_naca.h>
29 28
30enum { 29enum {
31 HvCallCfg_Cur = 0, 30 HvCallCfg_Cur = 0,
@@ -44,16 +43,8 @@ enum {
44#define HvCallCfgGetHostingLpIndex HvCallCfg + 32 43#define HvCallCfgGetHostingLpIndex HvCallCfg + 32
45 44
46extern HvLpIndex HvLpConfig_getLpIndex_outline(void); 45extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
47 46extern HvLpIndex HvLpConfig_getLpIndex(void);
48static inline HvLpIndex HvLpConfig_getLpIndex(void) 47extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void);
49{
50 return itLpNaca.xLpIndex;
51}
52
53static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
54{
55 return itLpNaca.xPrimaryLpIndex;
56}
57 48
58static inline u64 HvLpConfig_getMsChunks(void) 49static inline u64 HvLpConfig_getMsChunks(void)
59{ 50{
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
deleted file mode 100644
index f29009bd63c9..000000000000
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
2#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
3
4
5#ifdef CONFIG_PPC_ISERIES
6#include <linux/types.h>
7/*
8 * Created by Allan Trautman on Thu Dec 28 2000.
9 *
10 * Remaps the io.h for the iSeries Io
11 * Copyright (C) 2000 Allan H Trautman, IBM Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the:
25 * Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330,
27 * Boston, MA 02111-1307 USA
28 *
29 * Change Activity:
30 * Created December 28, 2000
31 * End Change Activity
32 */
33
34#ifdef CONFIG_PCI
35extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
36extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
37extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
38extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress);
39extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
40extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
41
42extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
43extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
44 size_t n);
45extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n);
47#else
48static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
49{
50 return 0xff;
51}
52
53static inline void iSeries_Write_Byte(u8 IoData,
54 volatile void __iomem *IoAddress)
55{
56}
57#endif /* CONFIG_PCI */
58
59#endif /* CONFIG_PPC_ISERIES */
60#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
deleted file mode 100644
index 304a609ae21a..000000000000
--- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (C) 2002 Dave Boutcher IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
19#define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
20
21/*
22 * This struct maps the panel information
23 *
24 * Warning:
25 * This data must match the architecture for the panel information
26 */
27
28#include <asm/types.h>
29
30struct ItExtVpdPanel {
31 /* Definition of the Extended Vpd On Panel Data Area */
32 char systemSerial[8];
33 char mfgID[4];
34 char reserved1[24];
35 char machineType[4];
36 char systemID[6];
37 char somUniqueCnt[4];
38 char serialNumberCount;
39 char reserved2[7];
40 u16 bbu3;
41 u16 bbu2;
42 u16 bbu1;
43 char xLocationLabel[8];
44 u8 xRsvd1[6];
45 u16 xFrameId;
46 u8 xRsvd2[48];
47};
48
49extern struct ItExtVpdPanel xItExtVpdPanel;
50
51#endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h
deleted file mode 100644
index 4fdcf052927f..000000000000
--- a/include/asm-powerpc/iseries/it_lp_naca.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H
19#define _ASM_POWERPC_ISERIES_IT_LP_NACA_H
20
21#include <linux/types.h>
22
23/*
24 * This control block contains the data that is shared between the
25 * hypervisor (PLIC) and the OS.
26 */
27
28struct ItLpNaca {
29// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
30 u32 xDesc; // Eye catcher x00-x03
31 u16 xSize; // Size of this class x04-x05
32 u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07
33 u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08
34 u8 xPrimaryLpIndex; // LP Index of Primary x09-x09
35 u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A
36 u8 xLpIndex; // LP Index x0B-x0B
37 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D
38 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F
39 u8 xPirEnvironMode; // Piranha or hardware x10-x10
40 u8 xPirConsoleMode; // Piranha console indicator x11-x11
41 u8 xPirDasdMode; // Piranha dasd indicator x12-x12
42 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17
43 u8 flags; // flags, see below x18-x1F
44 u8 xSpVpdFormat; // VPD areas are in CSP format ...
45 u8 xIntProcRatio; // Ratio of int procs to procs ...
46 u8 xRsvd1_2[5]; // Reserved ...
47 u16 xRsvd1_3; // Reserved x20-x21
48 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23
49 u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25
50 u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27
51 u64 xLoadAreaAddr; // ER address of load area x28-x2F
52 u32 xLoadAreaChunks; // Chunks for the load area x30-x33
53 u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37
54 // doing an ASR switch on PASE
55 // system call.
56 u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f
57 u8 xRsvd1_4[64]; // x40-x7F
58
59// CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
60 u8 xRsvd2_0[128]; // Reserved x00-x7F
61
62// CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators
63// NB: Padding required to keep xInterrruptHdlr at x300 which is required
64// for v4r4 PLIC.
65 u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F
66 u8 xRsvd3_0[384]; // Reserved 180-2FF
67
68// CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt
69// handlers
70 u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF
71};
72
73extern struct ItLpNaca itLpNaca;
74
75#define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */
76#define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */
77#define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
78#define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
79
80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index 284c5a7db3ac..3f6814769295 100644
--- a/include/asm-powerpc/iseries/it_lp_queue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -27,8 +27,6 @@
27#include <asm/types.h> 27#include <asm/types.h>
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
29 29
30struct HvLpEvent;
31
32#define IT_LP_MAX_QUEUES 8 30#define IT_LP_MAX_QUEUES 8
33 31
34#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */ 32#define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 72a97d37aac3..7a95d296abd1 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -122,6 +122,34 @@ enum viorc {
122 viorc_openRejected = 0x0301 122 viorc_openRejected = 0x0301
123}; 123};
124 124
125/*
126 * The structure of the events that flow between us and OS/400 for chario
127 * events. You can't mess with this unless the OS/400 side changes too.
128 */
129struct viocharlpevent {
130 struct HvLpEvent event;
131 u32 reserved;
132 u16 version;
133 u16 subtype_result_code;
134 u8 virtual_device;
135 u8 len;
136 u8 data[VIOCHAR_MAX_DATA];
137};
138
139#define VIOCHAR_WINDOW 10
140
141enum viocharsubtype {
142 viocharopen = 0x0001,
143 viocharclose = 0x0002,
144 viochardata = 0x0003,
145 viocharack = 0x0004,
146 viocharconfig = 0x0005
147};
148
149enum viochar_rc {
150 viochar_rc_ebusy = 1
151};
152
125struct device; 153struct device;
126 154
127extern struct device *iSeries_vio_dev; 155extern struct device *iSeries_vio_dev;
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h
index 4dc514aabfe7..821ea0c512b4 100644
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -27,7 +27,9 @@
27// 27//
28// 28//
29//---------------------------------------------------------------------------- 29//----------------------------------------------------------------------------
30#include <linux/cache.h>
30#include <asm/types.h> 31#include <asm/types.h>
32#include <asm/mmu.h>
31 33
32/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k 34/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
33 * alignment is sufficient to prevent this */ 35 * alignment is sufficient to prevent this */
@@ -114,7 +116,7 @@ struct lppaca {
114 116
115 117
116//============================================================================= 118//=============================================================================
117// CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors 119// CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors
118//============================================================================= 120//=============================================================================
119 // This is the yield_count. An "odd" value (low bit on) means that 121 // This is the yield_count. An "odd" value (low bit on) means that
120 // the processor is yielded (either because of an OS yield or a PLIC 122 // the processor is yielded (either because of an OS yield or a PLIC
@@ -126,12 +128,29 @@ struct lppaca {
126 u8 reserved6[124]; // Reserved x04-x7F 128 u8 reserved6[124]; // Reserved x04-x7F
127 129
128//============================================================================= 130//=============================================================================
129// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data 131// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
130//============================================================================= 132//=============================================================================
131 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 133 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
132} __attribute__((__aligned__(0x400))); 134} __attribute__((__aligned__(0x400)));
133 135
134extern struct lppaca lppaca[]; 136extern struct lppaca lppaca[];
135 137
138/*
139 * SLB shadow buffer structure as defined in the PAPR. The save_area
140 * contains adjacent ESID and VSID pairs for each shadowed SLB. The
141 * ESID is stored in the lower 64bits, then the VSID.
142 */
143struct slb_shadow {
144 u32 persistent; // Number of persistent SLBs x00-x03
145 u32 buffer_length; // Total shadow buffer length x04-x07
146 u64 reserved; // Alignment x08-x0f
147 struct {
148 u64 esid;
149 u64 vsid;
150 } save_area[SLB_NUM_BOLTED]; // x10-x40
151} ____cacheline_aligned;
152
153extern struct slb_shadow slb_shadow[];
154
136#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
137#endif /* _ASM_POWERPC_LPPACA_H */ 156#endif /* _ASM_POWERPC_LPPACA_H */
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 3d5d590bc4b0..0a4e5c93e8e6 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -23,6 +23,7 @@
23register struct paca_struct *local_paca asm("r13"); 23register struct paca_struct *local_paca asm("r13");
24#define get_paca() local_paca 24#define get_paca() local_paca
25#define get_lppaca() (get_paca()->lppaca_ptr) 25#define get_lppaca() (get_paca()->lppaca_ptr)
26#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
26 27
27struct task_struct; 28struct task_struct;
28 29
@@ -99,6 +100,8 @@ struct paca_struct {
99 u64 user_time; /* accumulated usermode TB ticks */ 100 u64 user_time; /* accumulated usermode TB ticks */
100 u64 system_time; /* accumulated system TB ticks */ 101 u64 system_time; /* accumulated system TB ticks */
101 u64 startpurr; /* PURR/TB value snapshot */ 102 u64 startpurr; /* PURR/TB value snapshot */
103
104 struct slb_shadow *slb_shadow_ptr;
102}; 105};
103 106
104extern struct paca_struct paca[]; 107extern struct paca_struct paca[];
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index fb597b37c2a2..b4d38b0b15f8 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -55,12 +55,6 @@
55#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 55#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
56#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) 56#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
57 57
58#ifdef CONFIG_DISCONTIGMEM
59#define page_to_pfn(page) discontigmem_page_to_pfn(page)
60#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
61#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
62#endif
63
64#ifdef CONFIG_FLATMEM 58#ifdef CONFIG_FLATMEM
65#define pfn_valid(pfn) ((pfn) < max_mapnr) 59#define pfn_valid(pfn) ((pfn) < max_mapnr)
66#endif 60#endif
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index cf79bc7ebb55..1115756c79f9 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -69,6 +69,17 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr);
69void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 69void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
70 70
71/** 71/**
72 * rtas_pci_enableo - enable IO transfers for this slot
73 * @pdn: pci device node
74 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
75 *
76 * Enable I/O transfers to this slot
77 */
78#define EEH_THAW_MMIO 2
79#define EEH_THAW_DMA 3
80int rtas_pci_enable(struct pci_dn *pdn, int function);
81
82/**
72 * rtas_set_slot_reset -- unfreeze a frozen slot 83 * rtas_set_slot_reset -- unfreeze a frozen slot
73 * 84 *
74 * Clear the EEH-frozen condition on a slot. This routine 85 * Clear the EEH-frozen condition on a slot. This routine
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 22e54a2a6604..6cb6fb19e57f 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -32,6 +32,7 @@
32#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ 32#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
35#define _CHRP_briq 0x07 /* TotalImpact's briQ */
35 36
36#if defined(__KERNEL__) && defined(CONFIG_PPC32) 37#if defined(__KERNEL__) && defined(CONFIG_PPC32)
37 38
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index d0fa1b9aed35..524629769336 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -72,8 +72,8 @@ struct property {
72}; 72};
73 73
74struct device_node { 74struct device_node {
75 char *name; 75 const char *name;
76 char *type; 76 const char *type;
77 phandle node; 77 phandle node;
78 phandle linux_phandle; 78 phandle linux_phandle;
79 char *full_name; 79 char *full_name;
@@ -160,7 +160,7 @@ extern void unflatten_device_tree(void);
160extern void early_init_devtree(void *); 160extern void early_init_devtree(void *);
161extern int device_is_compatible(struct device_node *device, const char *); 161extern int device_is_compatible(struct device_node *device, const char *);
162extern int machine_is_compatible(const char *compat); 162extern int machine_is_compatible(const char *compat);
163extern void *get_property(struct device_node *node, const char *name, 163extern const void *get_property(struct device_node *node, const char *name,
164 int *lenp); 164 int *lenp);
165extern void print_properties(struct device_node *node); 165extern void print_properties(struct device_node *node);
166extern int prom_n_addr_cells(struct device_node* np); 166extern int prom_n_addr_cells(struct device_node* np);
@@ -197,8 +197,8 @@ extern int release_OF_resource(struct device_node* node, int index);
197 */ 197 */
198 198
199 199
200/* Helper to read a big number */ 200/* Helper to read a big number; size is in cells (not bytes) */
201static inline u64 of_read_number(u32 *cell, int size) 201static inline u64 of_read_number(const u32 *cell, int size)
202{ 202{
203 u64 r = 0; 203 u64 r = 0;
204 while (size--) 204 while (size--)
@@ -206,18 +206,28 @@ static inline u64 of_read_number(u32 *cell, int size)
206 return r; 206 return r;
207} 207}
208 208
209/* Like of_read_number, but we want an unsigned long result */
210#ifdef CONFIG_PPC32
211static inline unsigned long of_read_ulong(const u32 *cell, int size)
212{
213 return cell[size-1];
214}
215#else
216#define of_read_ulong(cell, size) of_read_number(cell, size)
217#endif
218
209/* Translate an OF address block into a CPU physical address 219/* Translate an OF address block into a CPU physical address
210 */ 220 */
211#define OF_BAD_ADDR ((u64)-1) 221#define OF_BAD_ADDR ((u64)-1)
212extern u64 of_translate_address(struct device_node *np, u32 *addr); 222extern u64 of_translate_address(struct device_node *np, const u32 *addr);
213 223
214/* Extract an address from a device, returns the region size and 224/* Extract an address from a device, returns the region size and
215 * the address space flags too. The PCI version uses a BAR number 225 * the address space flags too. The PCI version uses a BAR number
216 * instead of an absolute index 226 * instead of an absolute index
217 */ 227 */
218extern u32 *of_get_address(struct device_node *dev, int index, 228extern const u32 *of_get_address(struct device_node *dev, int index,
219 u64 *size, unsigned int *flags); 229 u64 *size, unsigned int *flags);
220extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, 230extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
221 u64 *size, unsigned int *flags); 231 u64 *size, unsigned int *flags);
222 232
223/* Get an address as a resource. Note that if your address is 233/* Get an address as a resource. Note that if your address is
@@ -234,7 +244,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar,
234/* Parse the ibm,dma-window property of an OF node into the busno, phys and 244/* Parse the ibm,dma-window property of an OF node into the busno, phys and
235 * size parameters. 245 * size parameters.
236 */ 246 */
237void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 247void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
238 unsigned long *busno, unsigned long *phys, unsigned long *size); 248 unsigned long *busno, unsigned long *phys, unsigned long *size);
239 249
240extern void kdump_move_device_tree(void); 250extern void kdump_move_device_tree(void);
@@ -259,7 +269,7 @@ struct of_irq {
259 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ 269 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
260}; 270};
261 271
262/*** 272/**
263 * of_irq_map_init - Initialize the irq remapper 273 * of_irq_map_init - Initialize the irq remapper
264 * @flags: flags defining workarounds to enable 274 * @flags: flags defining workarounds to enable
265 * 275 *
@@ -272,7 +282,7 @@ struct of_irq {
272 282
273extern void of_irq_map_init(unsigned int flags); 283extern void of_irq_map_init(unsigned int flags);
274 284
275/*** 285/**
276 * of_irq_map_raw - Low level interrupt tree parsing 286 * of_irq_map_raw - Low level interrupt tree parsing
277 * @parent: the device interrupt parent 287 * @parent: the device interrupt parent
278 * @intspec: interrupt specifier ("interrupts" property of the device) 288 * @intspec: interrupt specifier ("interrupts" property of the device)
@@ -289,12 +299,12 @@ extern void of_irq_map_init(unsigned int flags);
289 * 299 *
290 */ 300 */
291 301
292extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, 302extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
293 u32 ointsize, u32 *addr, 303 u32 ointsize, const u32 *addr,
294 struct of_irq *out_irq); 304 struct of_irq *out_irq);
295 305
296 306
297/*** 307/**
298 * of_irq_map_one - Resolve an interrupt for a device 308 * of_irq_map_one - Resolve an interrupt for a device
299 * @device: the device whose interrupt is to be resolved 309 * @device: the device whose interrupt is to be resolved
300 * @index: index of the interrupt to resolve 310 * @index: index of the interrupt to resolve
@@ -307,7 +317,7 @@ extern int of_irq_map_raw(struct device_node *parent, u32 *intspec,
307extern int of_irq_map_one(struct device_node *device, int index, 317extern int of_irq_map_one(struct device_node *device, int index,
308 struct of_irq *out_irq); 318 struct of_irq *out_irq);
309 319
310/*** 320/**
311 * of_irq_map_pci - Resolve the interrupt for a PCI device 321 * of_irq_map_pci - Resolve the interrupt for a PCI device
312 * @pdev: the device whose interrupt is to be resolved 322 * @pdev: the device whose interrupt is to be resolved
313 * @out_irq: structure of_irq filled by this function 323 * @out_irq: structure of_irq filled by this function
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index dc4cb9cc73a1..4435efe85d0e 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -215,12 +215,10 @@ do { \
215#define PTRACE_GETVRREGS 18 215#define PTRACE_GETVRREGS 18
216#define PTRACE_SETVRREGS 19 216#define PTRACE_SETVRREGS 19
217 217
218#ifndef __powerpc64__
219/* Get/set all the upper 32-bits of the SPE registers, accumulator, and 218/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
220 * spefscr, in one go */ 219 * spefscr, in one go */
221#define PTRACE_GETEVRREGS 20 220#define PTRACE_GETEVRREGS 20
222#define PTRACE_SETEVRREGS 21 221#define PTRACE_SETEVRREGS 21
223#endif /* __powerpc64__ */
224 222
225/* 223/*
226 * Get or set a debug register. The first 16 are DABR registers and the 224 * Get or set a debug register. The first 16 are DABR registers and the
@@ -235,7 +233,6 @@ do { \
235#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 233#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
236#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 234#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
237 235
238#ifdef __powerpc64__
239/* Calls to trace a 64bit program from a 32bit program */ 236/* Calls to trace a 64bit program from a 32bit program */
240#define PPC_PTRACE_PEEKTEXT_3264 0x95 237#define PPC_PTRACE_PEEKTEXT_3264 0x95
241#define PPC_PTRACE_PEEKDATA_3264 0x94 238#define PPC_PTRACE_PEEKDATA_3264 0x94
@@ -243,6 +240,5 @@ do { \
243#define PPC_PTRACE_POKEDATA_3264 0x92 240#define PPC_PTRACE_POKEDATA_3264 0x92
244#define PPC_PTRACE_PEEKUSR_3264 0x91 241#define PPC_PTRACE_PEEKUSR_3264 0x91
245#define PPC_PTRACE_POKEUSR_3264 0x90 242#define PPC_PTRACE_POKEUSR_3264 0x90
246#endif /* __powerpc64__ */
247 243
248#endif /* _ASM_POWERPC_PTRACE_H */ 244#endif /* _ASM_POWERPC_PTRACE_H */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index cf73475a0c69..3a9fcc15811b 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -592,6 +592,7 @@
592#define PV_630p 0x0041 592#define PV_630p 0x0041
593#define PV_970MP 0x0044 593#define PV_970MP 0x0044
594#define PV_BE 0x0070 594#define PV_BE 0x0070
595#define PV_PA6T 0x0090
595 596
596/* 597/*
597 * Number of entries in the SLB. If this ever changes we should handle 598 * Number of entries in the SLB. If this ever changes we should handle
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 82a27e9a041f..d34f9e1f242c 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -230,5 +230,21 @@ extern unsigned long rtas_rmo_buf;
230 230
231#define GLOBAL_INTERRUPT_QUEUE 9005 231#define GLOBAL_INTERRUPT_QUEUE 9005
232 232
233/**
234 * rtas_config_addr - Format a busno, devfn and reg for RTAS.
235 * @busno: The bus number.
236 * @devfn: The device and function number as encoded by PCI_DEVFN().
237 * @reg: The register number.
238 *
239 * This function encodes the given busno, devfn and register number as
240 * required for RTAS calls that take a "config_addr" parameter.
241 * See PAPR requirement 7.3.4-1 for more info.
242 */
243static inline u32 rtas_config_addr(int busno, int devfn, int reg)
244{
245 return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) |
246 (devfn << 8) | (reg & 0xff);
247}
248
233#endif /* __KERNEL__ */ 249#endif /* __KERNEL__ */
234#endif /* _POWERPC_RTAS_H */ 250#endif /* _POWERPC_RTAS_H */
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 51e65fc46a03..e49f644ca63a 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -517,7 +517,7 @@ struct smu_sdbp_cpupiddata {
517 * This returns the pointer to an SMU "sdb" partition data or NULL 517 * This returns the pointer to an SMU "sdb" partition data or NULL
518 * if not found. The data format is described below 518 * if not found. The data format is described below
519 */ 519 */
520extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 520extern const struct smu_sdbp_header *smu_get_sdb_partition(int id,
521 unsigned int *size); 521 unsigned int *size);
522 522
523/* Get "sdb" partition data from an SMU satellite */ 523/* Get "sdb" partition data from an SMU satellite */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index c02d105d8294..b42b53c40f5d 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -106,7 +106,7 @@ struct spu_context;
106struct spu_runqueue; 106struct spu_runqueue;
107 107
108struct spu { 108struct spu {
109 char *name; 109 const char *name;
110 unsigned long local_store_phys; 110 unsigned long local_store_phys;
111 u8 *local_store; 111 u8 *local_store;
112 unsigned long problem_phys; 112 unsigned long problem_phys;
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 4c9f5229e833..4b41deaa8d8d 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -177,11 +177,6 @@ extern u32 booke_wdt_enabled;
177extern u32 booke_wdt_period; 177extern u32 booke_wdt_period;
178#endif /* CONFIG_BOOKE_WDT */ 178#endif /* CONFIG_BOOKE_WDT */
179 179
180/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
181extern unsigned char e2a(unsigned char);
182extern unsigned char* strne2a(unsigned char *dest,
183 const unsigned char *src, size_t n);
184
185struct device_node; 180struct device_node;
186extern void note_scsi_host(struct device_node *, void *); 181extern void note_scsi_host(struct device_node *, void *);
187 182
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index dc9bd101ca14..4b51d42e1419 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -46,8 +46,8 @@ struct iommu_table;
46 */ 46 */
47struct vio_dev { 47struct vio_dev {
48 struct iommu_table *iommu_table; /* vio_map_* uses this */ 48 struct iommu_table *iommu_table; /* vio_map_* uses this */
49 char *name; 49 const char *name;
50 char *type; 50 const char *type;
51 uint32_t unit_address; 51 uint32_t unit_address;
52 unsigned int irq; 52 unsigned int irq;
53 struct device dev; 53 struct device dev;
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 680555be22ec..3d9a9e6f3321 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -327,26 +327,12 @@ __do_out_asm(outl, "stwbrx")
327#define inl_p(port) inl((port)) 327#define inl_p(port) inl((port))
328#define outl_p(val, port) outl((val), (port)) 328#define outl_p(val, port) outl((val), (port))
329 329
330extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 330extern void _insb(volatile u8 __iomem *port, void *buf, long count);
331extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 331extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
332extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 332extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
333extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 333extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
334extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 334extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
335extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 335extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
336extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
337extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
338extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
339extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
340
341/*
342 * The *_ns versions below don't do byte-swapping.
343 * Neither do the standard versions now, these are just here
344 * for older code.
345 */
346#define insw_ns(port, buf, ns) _insw_ns((port)+___IO_BASE, (buf), (ns))
347#define outsw_ns(port, buf, ns) _outsw_ns((port)+___IO_BASE, (buf), (ns))
348#define insl_ns(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl))
349#define outsl_ns(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl))
350 336
351 337
352#define IO_SPACE_LIMIT ~0 338#define IO_SPACE_LIMIT ~0
diff --git a/include/asm-ppc/mpc8260_pci9.h b/include/asm-ppc/mpc8260_pci9.h
index 26b3f6e787bc..9f7176881c56 100644
--- a/include/asm-ppc/mpc8260_pci9.h
+++ b/include/asm-ppc/mpc8260_pci9.h
@@ -30,8 +30,6 @@
30#undef inb 30#undef inb
31#undef inw 31#undef inw
32#undef inl 32#undef inl
33#undef insw_ns
34#undef insl_ns
35#undef memcpy_fromio 33#undef memcpy_fromio
36 34
37extern int readb(volatile unsigned char *addr); 35extern int readb(volatile unsigned char *addr);
@@ -43,8 +41,6 @@ extern void insl(unsigned port, void *buf, int nl);
43extern int inb(unsigned port); 41extern int inb(unsigned port);
44extern int inw(unsigned port); 42extern int inw(unsigned port);
45extern unsigned inl(unsigned port); 43extern unsigned inl(unsigned port);
46extern void insw_ns(unsigned port, void *buf, int ns);
47extern void insl_ns(unsigned port, void *buf, int nl);
48extern void *memcpy_fromio(void *dest, unsigned long src, size_t count); 44extern void *memcpy_fromio(void *dest, unsigned long src, size_t count);
49 45
50#endif /* !__CONFIG_8260_PCI9_DEFS */ 46#endif /* !__CONFIG_8260_PCI9_DEFS */
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h
index 4944c0fb8bea..602fbadeaf48 100644
--- a/include/asm-ppc/reg_booke.h
+++ b/include/asm-ppc/reg_booke.h
@@ -300,14 +300,14 @@ do { \
300#define DBSR_IC 0x80000000 /* Instruction Completion */ 300#define DBSR_IC 0x80000000 /* Instruction Completion */
301#define DBSR_BT 0x40000000 /* Branch taken */ 301#define DBSR_BT 0x40000000 /* Branch taken */
302#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */ 302#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
303#define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */ 303#define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */
304#define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */ 304#define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */
305#define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */ 305#define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */
306#define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */ 306#define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */
307#define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */ 307#define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */
308#define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */ 308#define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */
309#define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */ 309#define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */
310#define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */ 310#define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */
311#endif 311#endif
312 312
313/* Bit definitions related to the ESR. */ 313/* Bit definitions related to the ESR. */
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild
index ed8955f49e47..088969d55e72 100644
--- a/include/asm-s390/Kbuild
+++ b/include/asm-s390/Kbuild
@@ -1,4 +1,12 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += cmb.h debug.h 3header-y += dasd.h
4header-y += dasd.h qeth.h tape390.h ucontext.h vtoc.h z90crypt.h 4header-y += monwriter.h
5header-y += qeth.h
6header-y += tape390.h
7header-y += ucontext.h
8header-y += vtoc.h
9header-y += z90crypt.h
10
11unifdef-y += cmb.h
12unifdef-y += debug.h
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h
new file mode 100644
index 000000000000..b1770703b706
--- /dev/null
+++ b/include/asm-s390/appldata.h
@@ -0,0 +1,90 @@
1/*
2 * include/asm-s390/appldata.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 *
6 * Author(s): Melissa Howland <melissah@us.ibm.com>
7 */
8
9#ifndef _ASM_S390_APPLDATA_H
10#define _ASM_S390_APPLDATA_H
11
12#include <asm/io.h>
13
14#ifndef CONFIG_64BIT
15
16#define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */
17#define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */
18#define APPLDATA_GEN_EVENT_REC 0x02
19#define APPLDATA_START_CONFIG_REC 0x03
20
21/*
22 * Parameter list for DIAGNOSE X'DC'
23 */
24struct appldata_parameter_list {
25 u16 diag; /* The DIAGNOSE code X'00DC' */
26 u8 function; /* The function code for the DIAGNOSE */
27 u8 parlist_length; /* Length of the parameter list */
28 u32 product_id_addr; /* Address of the 16-byte product ID */
29 u16 reserved;
30 u16 buffer_length; /* Length of the application data buffer */
31 u32 buffer_addr; /* Address of the application data buffer */
32} __attribute__ ((packed));
33
34#else /* CONFIG_64BIT */
35
36#define APPLDATA_START_INTERVAL_REC 0x80
37#define APPLDATA_STOP_REC 0x81
38#define APPLDATA_GEN_EVENT_REC 0x82
39#define APPLDATA_START_CONFIG_REC 0x83
40
41/*
42 * Parameter list for DIAGNOSE X'DC'
43 */
44struct appldata_parameter_list {
45 u16 diag;
46 u8 function;
47 u8 parlist_length;
48 u32 unused01;
49 u16 reserved;
50 u16 buffer_length;
51 u32 unused02;
52 u64 product_id_addr;
53 u64 buffer_addr;
54} __attribute__ ((packed));
55
56#endif /* CONFIG_64BIT */
57
58struct appldata_product_id {
59 char prod_nr[7]; /* product number */
60 u16 prod_fn; /* product function */
61 u8 record_nr; /* record number */
62 u16 version_nr; /* version */
63 u16 release_nr; /* release */
64 u16 mod_lvl; /* modification level */
65} __attribute__ ((packed));
66
67static inline int appldata_asm(struct appldata_product_id *id,
68 unsigned short fn, void *buffer,
69 unsigned short length)
70{
71 struct appldata_parameter_list parm_list;
72 int ry;
73
74 if (!MACHINE_IS_VM)
75 return -ENOSYS;
76 parm_list.diag = 0xdc;
77 parm_list.function = fn;
78 parm_list.parlist_length = sizeof(parm_list);
79 parm_list.buffer_length = length;
80 parm_list.product_id_addr = (unsigned long) id;
81 parm_list.buffer_addr = virt_to_phys(buffer);
82 asm volatile(
83 "diag %1,%0,0xdc"
84 : "=d" (ry)
85 : "d" (&parm_list), "m" (parm_list), "m" (*id)
86 : "cc");
87 return ry;
88}
89
90#endif /* _ASM_S390_APPLDATA_H */
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index 28fdd6e2b8ba..da063cd5f0a0 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -270,6 +270,11 @@ struct diag210 {
270 __u32 vrdccrft : 8; /* real device feature (output) */ 270 __u32 vrdccrft : 8; /* real device feature (output) */
271} __attribute__ ((packed,aligned(4))); 271} __attribute__ ((packed,aligned(4)));
272 272
273struct ccw_dev_id {
274 u8 ssid;
275 u16 devno;
276};
277
273extern int diag210(struct diag210 *addr); 278extern int diag210(struct diag210 *addr);
274 279
275extern void wait_cons_dev(void); 280extern void wait_cons_dev(void);
@@ -280,6 +285,8 @@ extern void cio_reset_channel_paths(void);
280 285
281extern void css_schedule_reprobe(void); 286extern void css_schedule_reprobe(void);
282 287
288extern void reipl_ccw_dev(struct ccw_dev_id *id);
289
283#endif 290#endif
284 291
285#endif 292#endif
diff --git a/include/asm-s390/dma.h b/include/asm-s390/dma.h
index 02720c449cd8..7425c6af6cd4 100644
--- a/include/asm-s390/dma.h
+++ b/include/asm-s390/dma.h
@@ -11,6 +11,6 @@
11 11
12#define MAX_DMA_ADDRESS 0x80000000 12#define MAX_DMA_ADDRESS 0x80000000
13 13
14#define free_dma(x) 14#define free_dma(x) do { } while (0)
15 15
16#endif /* _ASM_DMA_H */ 16#endif /* _ASM_DMA_H */
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index ffedf14f89f6..5e261e1de671 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -7,75 +7,21 @@
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10#ifndef __s390x__
11#define __futex_atomic_fixup \
12 ".section __ex_table,\"a\"\n" \
13 " .align 4\n" \
14 " .long 0b,4b,2b,4b,3b,4b\n" \
15 ".previous"
16#else /* __s390x__ */
17#define __futex_atomic_fixup \
18 ".section __ex_table,\"a\"\n" \
19 " .align 8\n" \
20 " .quad 0b,4b,2b,4b,3b,4b\n" \
21 ".previous"
22#endif /* __s390x__ */
23
24#define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
25 asm volatile(" sacf 256\n" \
26 "0: l %1,0(%6)\n" \
27 "1: " insn \
28 "2: cs %1,%2,0(%6)\n" \
29 "3: jl 1b\n" \
30 " lhi %0,0\n" \
31 "4: sacf 0\n" \
32 __futex_atomic_fixup \
33 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
34 "=m" (*uaddr) \
35 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
36 "m" (*uaddr) : "cc" );
37
38static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 10static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
39{ 11{
40 int op = (encoded_op >> 28) & 7; 12 int op = (encoded_op >> 28) & 7;
41 int cmp = (encoded_op >> 24) & 15; 13 int cmp = (encoded_op >> 24) & 15;
42 int oparg = (encoded_op << 8) >> 20; 14 int oparg = (encoded_op << 8) >> 20;
43 int cmparg = (encoded_op << 20) >> 20; 15 int cmparg = (encoded_op << 20) >> 20;
44 int oldval = 0, newval, ret; 16 int oldval, ret;
17
45 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
46 oparg = 1 << oparg; 19 oparg = 1 << oparg;
47 20
48 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
49 return -EFAULT; 22 return -EFAULT;
50 23
51 inc_preempt_count(); 24 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval);
52
53 switch (op) {
54 case FUTEX_OP_SET:
55 __futex_atomic_op("lr %2,%5\n",
56 ret, oldval, newval, uaddr, oparg);
57 break;
58 case FUTEX_OP_ADD:
59 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
60 ret, oldval, newval, uaddr, oparg);
61 break;
62 case FUTEX_OP_OR:
63 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
64 ret, oldval, newval, uaddr, oparg);
65 break;
66 case FUTEX_OP_ANDN:
67 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
68 ret, oldval, newval, uaddr, oparg);
69 break;
70 case FUTEX_OP_XOR:
71 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
72 ret, oldval, newval, uaddr, oparg);
73 break;
74 default:
75 ret = -ENOSYS;
76 }
77
78 dec_preempt_count();
79 25
80 if (!ret) { 26 if (!ret) {
81 switch (cmp) { 27 switch (cmp) {
@@ -91,32 +37,13 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
91 return ret; 37 return ret;
92} 38}
93 39
94static inline int 40static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr,
95futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 41 int oldval, int newval)
96{ 42{
97 int ret;
98
99 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
100 return -EFAULT; 44 return -EFAULT;
101 asm volatile(" sacf 256\n" 45
102 " cs %1,%4,0(%5)\n" 46 return uaccess.futex_atomic_cmpxchg(uaddr, oldval, newval);
103 "0: lr %0,%1\n"
104 "1: sacf 0\n"
105#ifndef __s390x__
106 ".section __ex_table,\"a\"\n"
107 " .align 4\n"
108 " .long 0b,1b\n"
109 ".previous"
110#else /* __s390x__ */
111 ".section __ex_table,\"a\"\n"
112 " .align 8\n"
113 " .quad 0b,1b\n"
114 ".previous"
115#endif /* __s390x__ */
116 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
117 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
118 : "cc", "memory" );
119 return oldval;
120} 47}
121 48
122#endif /* __KERNEL__ */ 49#endif /* __KERNEL__ */
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index d4614b35f423..a6cc27e77007 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -116,7 +116,7 @@ extern void iounmap(void *addr);
116#define outb(x,addr) ((void) writeb(x,addr)) 116#define outb(x,addr) ((void) writeb(x,addr))
117#define outb_p(x,addr) outb(x,addr) 117#define outb_p(x,addr) outb(x,addr)
118 118
119#define mmiowb() 119#define mmiowb() do { } while (0)
120 120
121/* 121/*
122 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 122 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
new file mode 100644
index 000000000000..40cc68025e01
--- /dev/null
+++ b/include/asm-s390/kdebug.h
@@ -0,0 +1,59 @@
1#ifndef _S390_KDEBUG_H
2#define _S390_KDEBUG_H
3
4/*
5 * Feb 2006 Ported to s390 <grundym@us.ibm.com>
6 */
7#include <linux/notifier.h>
8
9struct pt_regs;
10
11struct die_args {
12 struct pt_regs *regs;
13 const char *str;
14 long err;
15 int trapnr;
16 int signr;
17};
18
19/* Note - you should never unregister because that can race with NMIs.
20 * If you really want to do it first unregister - then synchronize_sched
21 * - then free.
22 */
23extern int register_die_notifier(struct notifier_block *);
24extern int unregister_die_notifier(struct notifier_block *);
25extern int register_page_fault_notifier(struct notifier_block *);
26extern int unregister_page_fault_notifier(struct notifier_block *);
27extern struct atomic_notifier_head s390die_chain;
28
29
30enum die_val {
31 DIE_OOPS = 1,
32 DIE_BPT,
33 DIE_SSTEP,
34 DIE_PANIC,
35 DIE_NMI,
36 DIE_DIE,
37 DIE_NMIWATCHDOG,
38 DIE_KERNELDEBUG,
39 DIE_TRAP,
40 DIE_GPF,
41 DIE_CALL,
42 DIE_NMI_IPI,
43 DIE_PAGE_FAULT,
44};
45
46static inline int notify_die(enum die_val val, const char *str,
47 struct pt_regs *regs, long err, int trap, int sig)
48{
49 struct die_args args = {
50 .regs = regs,
51 .str = str,
52 .err = err,
53 .trapnr = trap,
54 .signr = sig
55 };
56 return atomic_notifier_call_chain(&s390die_chain, val, &args);
57}
58
59#endif
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h
new file mode 100644
index 000000000000..b847ff0ec3fa
--- /dev/null
+++ b/include/asm-s390/kprobes.h
@@ -0,0 +1,114 @@
1#ifndef _ASM_S390_KPROBES_H
2#define _ASM_S390_KPROBES_H
3/*
4 * Kernel Probes (KProbes)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright (C) IBM Corporation, 2002, 2006
21 *
22 * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
23 * Probes initial implementation ( includes suggestions from
24 * Rusty Russell).
25 * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli
26 * <ananth@in.ibm.com>
27 * 2005-Dec Used as a template for s390 by Mike Grundy
28 * <grundym@us.ibm.com>
29 */
30#include <linux/types.h>
31#include <linux/ptrace.h>
32#include <linux/percpu.h>
33
34#define __ARCH_WANT_KPROBES_INSN_SLOT
35struct pt_regs;
36struct kprobe;
37
38typedef u16 kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x0002
40
41/* Maximum instruction size is 3 (16bit) halfwords: */
42#define MAX_INSN_SIZE 0x0003
43#define MAX_STACK_SIZE 64
44#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
45 (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
46 ? (MAX_STACK_SIZE) \
47 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
48
49#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
50
51#define ARCH_SUPPORTS_KRETPROBES
52#define ARCH_INACTIVE_KPROBE_COUNT 0
53
54#define KPROBE_SWAP_INST 0x10
55
56#define FIXUP_PSW_NORMAL 0x08
57#define FIXUP_BRANCH_NOT_TAKEN 0x04
58#define FIXUP_RETURN_REGISTER 0x02
59#define FIXUP_NOT_REQUIRED 0x01
60
61/* Architecture specific copy of original instruction */
62struct arch_specific_insn {
63 /* copy of original instruction */
64 kprobe_opcode_t *insn;
65 int fixup;
66 int ilen;
67 int reg;
68};
69
70struct ins_replace_args {
71 kprobe_opcode_t *ptr;
72 kprobe_opcode_t old;
73 kprobe_opcode_t new;
74};
75struct prev_kprobe {
76 struct kprobe *kp;
77 unsigned long status;
78 unsigned long saved_psw;
79 unsigned long kprobe_saved_imask;
80 unsigned long kprobe_saved_ctl[3];
81};
82
83/* per-cpu kprobe control block */
84struct kprobe_ctlblk {
85 unsigned long kprobe_status;
86 unsigned long kprobe_saved_imask;
87 unsigned long kprobe_saved_ctl[3];
88 struct pt_regs jprobe_saved_regs;
89 unsigned long jprobe_saved_r14;
90 unsigned long jprobe_saved_r15;
91 struct prev_kprobe prev_kprobe;
92 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
93};
94
95void arch_remove_kprobe(struct kprobe *p);
96void kretprobe_trampoline(void);
97int is_prohibited_opcode(kprobe_opcode_t *instruction);
98void get_instruction_type(struct arch_specific_insn *ainsn);
99
100#define flush_insn_slot(p) do { } while (0)
101
102#endif /* _ASM_S390_KPROBES_H */
103
104#ifdef CONFIG_KPROBES
105
106extern int kprobe_exceptions_notify(struct notifier_block *self,
107 unsigned long val, void *data);
108#else /* !CONFIG_KPROBES */
109static inline int kprobe_exceptions_notify(struct notifier_block *self,
110 unsigned long val, void *data)
111{
112 return 0;
113}
114#endif
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 596c8b172104..18695d10dedf 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -35,6 +35,7 @@
35#define __LC_IO_NEW_PSW 0x01f0 35#define __LC_IO_NEW_PSW 0x01f0
36#endif /* !__s390x__ */ 36#endif /* !__s390x__ */
37 37
38#define __LC_IPL_PARMBLOCK_PTR 0x014
38#define __LC_EXT_PARAMS 0x080 39#define __LC_EXT_PARAMS 0x080
39#define __LC_CPU_ADDRESS 0x084 40#define __LC_CPU_ADDRESS 0x084
40#define __LC_EXT_INT_CODE 0x086 41#define __LC_EXT_INT_CODE 0x086
@@ -47,6 +48,7 @@
47#define __LC_PER_ATMID 0x096 48#define __LC_PER_ATMID 0x096
48#define __LC_PER_ADDRESS 0x098 49#define __LC_PER_ADDRESS 0x098
49#define __LC_PER_ACCESS_ID 0x0A1 50#define __LC_PER_ACCESS_ID 0x0A1
51#define __LC_AR_MODE_ID 0x0A3
50 52
51#define __LC_SUBCHANNEL_ID 0x0B8 53#define __LC_SUBCHANNEL_ID 0x0B8
52#define __LC_SUBCHANNEL_NR 0x0BA 54#define __LC_SUBCHANNEL_NR 0x0BA
@@ -106,18 +108,28 @@
106#define __LC_INT_CLOCK 0xDE8 108#define __LC_INT_CLOCK 0xDE8
107#endif /* __s390x__ */ 109#endif /* __s390x__ */
108 110
109#define __LC_PANIC_MAGIC 0xE00
110 111
112#define __LC_PANIC_MAGIC 0xE00
111#ifndef __s390x__ 113#ifndef __s390x__
112#define __LC_PFAULT_INTPARM 0x080 114#define __LC_PFAULT_INTPARM 0x080
113#define __LC_CPU_TIMER_SAVE_AREA 0x0D8 115#define __LC_CPU_TIMER_SAVE_AREA 0x0D8
116#define __LC_CLOCK_COMP_SAVE_AREA 0x0E0
117#define __LC_PSW_SAVE_AREA 0x100
118#define __LC_PREFIX_SAVE_AREA 0x108
114#define __LC_AREGS_SAVE_AREA 0x120 119#define __LC_AREGS_SAVE_AREA 0x120
120#define __LC_FPREGS_SAVE_AREA 0x160
115#define __LC_GPREGS_SAVE_AREA 0x180 121#define __LC_GPREGS_SAVE_AREA 0x180
116#define __LC_CREGS_SAVE_AREA 0x1C0 122#define __LC_CREGS_SAVE_AREA 0x1C0
117#else /* __s390x__ */ 123#else /* __s390x__ */
118#define __LC_PFAULT_INTPARM 0x11B8 124#define __LC_PFAULT_INTPARM 0x11B8
125#define __LC_FPREGS_SAVE_AREA 0x1200
119#define __LC_GPREGS_SAVE_AREA 0x1280 126#define __LC_GPREGS_SAVE_AREA 0x1280
127#define __LC_PSW_SAVE_AREA 0x1300
128#define __LC_PREFIX_SAVE_AREA 0x1318
129#define __LC_FP_CREG_SAVE_AREA 0x131C
130#define __LC_TODREG_SAVE_AREA 0x1324
120#define __LC_CPU_TIMER_SAVE_AREA 0x1328 131#define __LC_CPU_TIMER_SAVE_AREA 0x1328
132#define __LC_CLOCK_COMP_SAVE_AREA 0x1331
121#define __LC_AREGS_SAVE_AREA 0x1340 133#define __LC_AREGS_SAVE_AREA 0x1340
122#define __LC_CREGS_SAVE_AREA 0x1380 134#define __LC_CREGS_SAVE_AREA 0x1380
123#endif /* __s390x__ */ 135#endif /* __s390x__ */
diff --git a/include/asm-s390/monwriter.h b/include/asm-s390/monwriter.h
new file mode 100644
index 000000000000..f0cbf96c52e6
--- /dev/null
+++ b/include/asm-s390/monwriter.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-s390/monwriter.h
3 *
4 * Copyright (C) IBM Corp. 2006
5 * Character device driver for writing z/VM APPLDATA monitor records
6 * Version 1.0
7 * Author(s): Melissa Howland <melissah@us.ibm.com>
8 *
9 */
10
11#ifndef _ASM_390_MONWRITER_H
12#define _ASM_390_MONWRITER_H
13
14/* mon_function values */
15#define MONWRITE_START_INTERVAL 0x00 /* start interval recording */
16#define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */
17#define MONWRITE_GEN_EVENT 0x02 /* generate event record */
18#define MONWRITE_START_CONFIG 0x03 /* start configuration recording */
19
20/* the header the app uses in its write() data */
21struct monwrite_hdr {
22 unsigned char mon_function;
23 unsigned short applid;
24 unsigned char record_num;
25 unsigned short version;
26 unsigned short release;
27 unsigned short mod_level;
28 unsigned short datalen;
29 unsigned char hdrlen;
30
31} __attribute__((packed));
32
33#endif /* _ASM_390_MONWRITER_H */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index a78e853e0dd5..803bc7064418 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -22,6 +22,16 @@
22extern void diag10(unsigned long addr); 22extern void diag10(unsigned long addr);
23 23
24/* 24/*
25 * Page allocation orders.
26 */
27#ifndef __s390x__
28# define PGD_ALLOC_ORDER 1
29#else /* __s390x__ */
30# define PMD_ALLOC_ORDER 2
31# define PGD_ALLOC_ORDER 2
32#endif /* __s390x__ */
33
34/*
25 * Allocate and free page tables. The xxx_kernel() versions are 35 * Allocate and free page tables. The xxx_kernel() versions are
26 * used to allocate a kernel page table - this turns on ASN bits 36 * used to allocate a kernel page table - this turns on ASN bits
27 * if any. 37 * if any.
@@ -29,30 +39,23 @@ extern void diag10(unsigned long addr);
29 39
30static inline pgd_t *pgd_alloc(struct mm_struct *mm) 40static inline pgd_t *pgd_alloc(struct mm_struct *mm)
31{ 41{
32 pgd_t *pgd; 42 pgd_t *pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER);
33 int i; 43 int i;
34 44
45 if (!pgd)
46 return NULL;
47 for (i = 0; i < PTRS_PER_PGD; i++)
35#ifndef __s390x__ 48#ifndef __s390x__
36 pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1); 49 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
37 if (pgd != NULL) 50#else
38 for (i = 0; i < USER_PTRS_PER_PGD; i++) 51 pgd_clear(pgd + i);
39 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); 52#endif
40#else /* __s390x__ */
41 pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2);
42 if (pgd != NULL)
43 for (i = 0; i < PTRS_PER_PGD; i++)
44 pgd_clear(pgd + i);
45#endif /* __s390x__ */
46 return pgd; 53 return pgd;
47} 54}
48 55
49static inline void pgd_free(pgd_t *pgd) 56static inline void pgd_free(pgd_t *pgd)
50{ 57{
51#ifndef __s390x__ 58 free_pages((unsigned long) pgd, PGD_ALLOC_ORDER);
52 free_pages((unsigned long) pgd, 1);
53#else /* __s390x__ */
54 free_pages((unsigned long) pgd, 2);
55#endif /* __s390x__ */
56} 59}
57 60
58#ifndef __s390x__ 61#ifndef __s390x__
@@ -68,20 +71,19 @@ static inline void pgd_free(pgd_t *pgd)
68#else /* __s390x__ */ 71#else /* __s390x__ */
69static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) 72static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
70{ 73{
71 pmd_t *pmd; 74 pmd_t *pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER);
72 int i; 75 int i;
73 76
74 pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2); 77 if (!pmd)
75 if (pmd != NULL) { 78 return NULL;
76 for (i=0; i < PTRS_PER_PMD; i++) 79 for (i=0; i < PTRS_PER_PMD; i++)
77 pmd_clear(pmd+i); 80 pmd_clear(pmd + i);
78 }
79 return pmd; 81 return pmd;
80} 82}
81 83
82static inline void pmd_free (pmd_t *pmd) 84static inline void pmd_free (pmd_t *pmd)
83{ 85{
84 free_pages((unsigned long) pmd, 2); 86 free_pages((unsigned long) pmd, PMD_ALLOC_ORDER);
85} 87}
86 88
87#define __pmd_free_tlb(tlb,pmd) \ 89#define __pmd_free_tlb(tlb,pmd) \
@@ -123,15 +125,14 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
123static inline pte_t * 125static inline pte_t *
124pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) 126pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
125{ 127{
126 pte_t *pte; 128 pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT);
127 int i; 129 int i;
128 130
129 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 131 if (!pte)
130 if (pte != NULL) { 132 return NULL;
131 for (i=0; i < PTRS_PER_PTE; i++) { 133 for (i=0; i < PTRS_PER_PTE; i++) {
132 pte_clear(mm, vmaddr, pte+i); 134 pte_clear(mm, vmaddr, pte + i);
133 vmaddr += PAGE_SIZE; 135 vmaddr += PAGE_SIZE;
134 }
135 } 136 }
136 return pte; 137 return pte;
137} 138}
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 24312387fa24..1a07028d575e 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -89,19 +89,6 @@ extern char empty_zero_page[PAGE_SIZE];
89# define PTRS_PER_PGD 2048 89# define PTRS_PER_PGD 2048
90#endif /* __s390x__ */ 90#endif /* __s390x__ */
91 91
92/*
93 * pgd entries used up by user/kernel:
94 */
95#ifndef __s390x__
96# define USER_PTRS_PER_PGD 512
97# define USER_PGD_PTRS 512
98# define KERNEL_PGD_PTRS 512
99#else /* __s390x__ */
100# define USER_PTRS_PER_PGD 2048
101# define USER_PGD_PTRS 2048
102# define KERNEL_PGD_PTRS 2048
103#endif /* __s390x__ */
104
105#define FIRST_USER_ADDRESS 0 92#define FIRST_USER_ADDRESS 0
106 93
107#define pte_ERROR(e) \ 94#define pte_ERROR(e) \
@@ -216,12 +203,14 @@ extern char empty_zero_page[PAGE_SIZE];
216#define _PAGE_RO 0x200 /* HW read-only */ 203#define _PAGE_RO 0x200 /* HW read-only */
217#define _PAGE_INVALID 0x400 /* HW invalid */ 204#define _PAGE_INVALID 0x400 /* HW invalid */
218 205
219/* Mask and four different kinds of invalid pages. */ 206/* Mask and six different types of pages. */
220#define _PAGE_INVALID_MASK 0x601 207#define _PAGE_TYPE_MASK 0x601
221#define _PAGE_INVALID_EMPTY 0x400 208#define _PAGE_TYPE_EMPTY 0x400
222#define _PAGE_INVALID_NONE 0x401 209#define _PAGE_TYPE_NONE 0x401
223#define _PAGE_INVALID_SWAP 0x600 210#define _PAGE_TYPE_SWAP 0x600
224#define _PAGE_INVALID_FILE 0x601 211#define _PAGE_TYPE_FILE 0x601
212#define _PAGE_TYPE_RO 0x200
213#define _PAGE_TYPE_RW 0x000
225 214
226#ifndef __s390x__ 215#ifndef __s390x__
227 216
@@ -280,15 +269,14 @@ extern char empty_zero_page[PAGE_SIZE];
280#endif /* __s390x__ */ 269#endif /* __s390x__ */
281 270
282/* 271/*
283 * No mapping available 272 * Page protection definitions.
284 */ 273 */
285#define PAGE_NONE_SHARED __pgprot(_PAGE_INVALID_NONE) 274#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
286#define PAGE_NONE_PRIVATE __pgprot(_PAGE_INVALID_NONE) 275#define PAGE_RO __pgprot(_PAGE_TYPE_RO)
287#define PAGE_RO_SHARED __pgprot(_PAGE_RO) 276#define PAGE_RW __pgprot(_PAGE_TYPE_RW)
288#define PAGE_RO_PRIVATE __pgprot(_PAGE_RO) 277
289#define PAGE_COPY __pgprot(_PAGE_RO) 278#define PAGE_KERNEL PAGE_RW
290#define PAGE_SHARED __pgprot(0) 279#define PAGE_COPY PAGE_RO
291#define PAGE_KERNEL __pgprot(0)
292 280
293/* 281/*
294 * The S390 can't do page protection for execute, and considers that the 282 * The S390 can't do page protection for execute, and considers that the
@@ -296,23 +284,23 @@ extern char empty_zero_page[PAGE_SIZE];
296 * the closest we can get.. 284 * the closest we can get..
297 */ 285 */
298 /*xwr*/ 286 /*xwr*/
299#define __P000 PAGE_NONE_PRIVATE 287#define __P000 PAGE_NONE
300#define __P001 PAGE_RO_PRIVATE 288#define __P001 PAGE_RO
301#define __P010 PAGE_COPY 289#define __P010 PAGE_RO
302#define __P011 PAGE_COPY 290#define __P011 PAGE_RO
303#define __P100 PAGE_RO_PRIVATE 291#define __P100 PAGE_RO
304#define __P101 PAGE_RO_PRIVATE 292#define __P101 PAGE_RO
305#define __P110 PAGE_COPY 293#define __P110 PAGE_RO
306#define __P111 PAGE_COPY 294#define __P111 PAGE_RO
307 295
308#define __S000 PAGE_NONE_SHARED 296#define __S000 PAGE_NONE
309#define __S001 PAGE_RO_SHARED 297#define __S001 PAGE_RO
310#define __S010 PAGE_SHARED 298#define __S010 PAGE_RW
311#define __S011 PAGE_SHARED 299#define __S011 PAGE_RW
312#define __S100 PAGE_RO_SHARED 300#define __S100 PAGE_RO
313#define __S101 PAGE_RO_SHARED 301#define __S101 PAGE_RO
314#define __S110 PAGE_SHARED 302#define __S110 PAGE_RW
315#define __S111 PAGE_SHARED 303#define __S111 PAGE_RW
316 304
317/* 305/*
318 * Certain architectures need to do special things when PTEs 306 * Certain architectures need to do special things when PTEs
@@ -377,18 +365,18 @@ static inline int pmd_bad(pmd_t pmd)
377 365
378static inline int pte_none(pte_t pte) 366static inline int pte_none(pte_t pte)
379{ 367{
380 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; 368 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY;
381} 369}
382 370
383static inline int pte_present(pte_t pte) 371static inline int pte_present(pte_t pte)
384{ 372{
385 return !(pte_val(pte) & _PAGE_INVALID) || 373 return !(pte_val(pte) & _PAGE_INVALID) ||
386 (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; 374 (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE;
387} 375}
388 376
389static inline int pte_file(pte_t pte) 377static inline int pte_file(pte_t pte)
390{ 378{
391 return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; 379 return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE;
392} 380}
393 381
394#define pte_same(a,b) (pte_val(a) == pte_val(b)) 382#define pte_same(a,b) (pte_val(a) == pte_val(b))
@@ -461,7 +449,7 @@ static inline void pmd_clear(pmd_t * pmdp)
461 449
462static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 450static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
463{ 451{
464 pte_val(*ptep) = _PAGE_INVALID_EMPTY; 452 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
465} 453}
466 454
467/* 455/*
@@ -477,7 +465,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
477 465
478static inline pte_t pte_wrprotect(pte_t pte) 466static inline pte_t pte_wrprotect(pte_t pte)
479{ 467{
480 /* Do not clobber _PAGE_INVALID_NONE pages! */ 468 /* Do not clobber _PAGE_TYPE_NONE pages! */
481 if (!(pte_val(pte) & _PAGE_INVALID)) 469 if (!(pte_val(pte) & _PAGE_INVALID))
482 pte_val(pte) |= _PAGE_RO; 470 pte_val(pte) |= _PAGE_RO;
483 return pte; 471 return pte;
@@ -556,26 +544,30 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
556 return pte; 544 return pte;
557} 545}
558 546
559static inline pte_t 547static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
560ptep_clear_flush(struct vm_area_struct *vma,
561 unsigned long address, pte_t *ptep)
562{ 548{
563 pte_t pte = *ptep; 549 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
564#ifndef __s390x__ 550#ifndef __s390x__
565 if (!(pte_val(pte) & _PAGE_INVALID)) {
566 /* S390 has 1mb segments, we are emulating 4MB segments */ 551 /* S390 has 1mb segments, we are emulating 4MB segments */
567 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); 552 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00);
568 __asm__ __volatile__ ("ipte %2,%3" 553#else
569 : "=m" (*ptep) : "m" (*ptep), 554 /* ipte in zarch mode can do the math */
570 "a" (pto), "a" (address) ); 555 pte_t *pto = ptep;
556#endif
557 asm volatile ("ipte %2,%3"
558 : "=m" (*ptep) : "m" (*ptep),
559 "a" (pto), "a" (address) );
571 } 560 }
572#else /* __s390x__ */ 561 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
573 if (!(pte_val(pte) & _PAGE_INVALID)) 562}
574 __asm__ __volatile__ ("ipte %2,%3" 563
575 : "=m" (*ptep) : "m" (*ptep), 564static inline pte_t
576 "a" (ptep), "a" (address) ); 565ptep_clear_flush(struct vm_area_struct *vma,
577#endif /* __s390x__ */ 566 unsigned long address, pte_t *ptep)
578 pte_val(*ptep) = _PAGE_INVALID_EMPTY; 567{
568 pte_t pte = *ptep;
569
570 __ptep_ipte(address, ptep);
579 return pte; 571 return pte;
580} 572}
581 573
@@ -755,7 +747,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
755{ 747{
756 pte_t pte; 748 pte_t pte;
757 offset &= __SWP_OFFSET_MASK; 749 offset &= __SWP_OFFSET_MASK;
758 pte_val(pte) = _PAGE_INVALID_SWAP | ((type & 0x1f) << 2) | 750 pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) |
759 ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); 751 ((offset & 1UL) << 7) | ((offset & ~1UL) << 11);
760 return pte; 752 return pte;
761} 753}
@@ -778,7 +770,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
778 770
779#define pgoff_to_pte(__off) \ 771#define pgoff_to_pte(__off) \
780 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ 772 ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
781 | _PAGE_INVALID_FILE }) 773 | _PAGE_TYPE_FILE })
782 774
783#endif /* !__ASSEMBLY__ */ 775#endif /* !__ASSEMBLY__ */
784 776
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 5b71d3731723..a3a4e5fd30d7 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -339,4 +339,21 @@ int unregister_idle_notifier(struct notifier_block *nb);
339 339
340#endif 340#endif
341 341
342/*
343 * Helper macro for exception table entries
344 */
345#ifndef __s390x__
346#define EX_TABLE(_fault,_target) \
347 ".section __ex_table,\"a\"\n" \
348 " .align 4\n" \
349 " .long " #_fault "," #_target "\n" \
350 ".previous\n"
351#else
352#define EX_TABLE(_fault,_target) \
353 ".section __ex_table,\"a\"\n" \
354 " .align 8\n" \
355 " .quad " #_fault "," #_target "\n" \
356 ".previous\n"
357#endif
358
342#endif /* __ASM_S390_PROCESSOR_H */ 359#endif /* __ASM_S390_PROCESSOR_H */
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 19e31979309a..f1959732b6fd 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -14,8 +14,6 @@
14 14
15#define PARMAREA 0x10400 15#define PARMAREA 0x10400
16#define COMMAND_LINE_SIZE 896 16#define COMMAND_LINE_SIZE 896
17#define RAMDISK_ORIGIN 0x800000
18#define RAMDISK_SIZE 0x800000
19#define MEMORY_CHUNKS 16 /* max 0x7fff */ 17#define MEMORY_CHUNKS 16 /* max 0x7fff */
20#define IPL_PARMBLOCK_ORIGIN 0x2000 18#define IPL_PARMBLOCK_ORIGIN 0x2000
21 19
@@ -46,10 +44,12 @@ extern unsigned long machine_flags;
46#define MACHINE_HAS_IEEE (machine_flags & 2) 44#define MACHINE_HAS_IEEE (machine_flags & 2)
47#define MACHINE_HAS_CSP (machine_flags & 8) 45#define MACHINE_HAS_CSP (machine_flags & 8)
48#define MACHINE_HAS_DIAG44 (1) 46#define MACHINE_HAS_DIAG44 (1)
47#define MACHINE_HAS_MVCOS (0)
49#else /* __s390x__ */ 48#else /* __s390x__ */
50#define MACHINE_HAS_IEEE (1) 49#define MACHINE_HAS_IEEE (1)
51#define MACHINE_HAS_CSP (1) 50#define MACHINE_HAS_CSP (1)
52#define MACHINE_HAS_DIAG44 (machine_flags & 32) 51#define MACHINE_HAS_DIAG44 (machine_flags & 32)
52#define MACHINE_HAS_MVCOS (machine_flags & 512)
53#endif /* __s390x__ */ 53#endif /* __s390x__ */
54 54
55 55
@@ -70,52 +70,76 @@ extern unsigned int console_irq;
70#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 70#define SET_CONSOLE_3215 do { console_mode = 2; } while (0)
71#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 71#define SET_CONSOLE_3270 do { console_mode = 3; } while (0)
72 72
73struct ipl_list_header { 73
74 u32 length; 74struct ipl_list_hdr {
75 u8 reserved[3]; 75 u32 len;
76 u8 reserved1[3];
76 u8 version; 77 u8 version;
78 u32 blk0_len;
79 u8 pbt;
80 u8 flags;
81 u16 reserved2;
77} __attribute__((packed)); 82} __attribute__((packed));
78 83
79struct ipl_block_fcp { 84struct ipl_block_fcp {
80 u32 length; 85 u8 reserved1[313-1];
81 u8 pbt; 86 u8 opt;
82 u8 reserved1[322-1]; 87 u8 reserved2[3];
88 u16 reserved3;
83 u16 devno; 89 u16 devno;
84 u8 reserved2[4]; 90 u8 reserved4[4];
85 u64 wwpn; 91 u64 wwpn;
86 u64 lun; 92 u64 lun;
87 u32 bootprog; 93 u32 bootprog;
88 u8 reserved3[12]; 94 u8 reserved5[12];
89 u64 br_lba; 95 u64 br_lba;
90 u32 scp_data_len; 96 u32 scp_data_len;
91 u8 reserved4[260]; 97 u8 reserved6[260];
92 u8 scp_data[]; 98 u8 scp_data[];
93} __attribute__((packed)); 99} __attribute__((packed));
94 100
101struct ipl_block_ccw {
102 u8 load_param[8];
103 u8 reserved1[84];
104 u8 reserved2[2];
105 u16 devno;
106 u8 vm_flags;
107 u8 reserved3[3];
108 u32 vm_parm_len;
109} __attribute__((packed));
110
95struct ipl_parameter_block { 111struct ipl_parameter_block {
112 struct ipl_list_hdr hdr;
96 union { 113 union {
97 u32 length; 114 struct ipl_block_fcp fcp;
98 struct ipl_list_header header; 115 struct ipl_block_ccw ccw;
99 } hdr; 116 } ipl_info;
100 struct ipl_block_fcp fcp;
101} __attribute__((packed)); 117} __attribute__((packed));
102 118
103#define IPL_MAX_SUPPORTED_VERSION (0) 119#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
120 sizeof(struct ipl_block_fcp))
104 121
105#define IPL_TYPE_FCP (0) 122#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
123 sizeof(struct ipl_block_ccw))
124
125#define IPL_MAX_SUPPORTED_VERSION (0)
106 126
107/* 127/*
108 * IPL validity flags and parameters as detected in head.S 128 * IPL validity flags and parameters as detected in head.S
109 */ 129 */
110extern u32 ipl_parameter_flags; 130extern u32 ipl_flags;
111extern u16 ipl_devno; 131extern u16 ipl_devno;
112 132
113#define IPL_DEVNO_VALID (ipl_parameter_flags & 1) 133void do_reipl(void);
114#define IPL_PARMBLOCK_VALID (ipl_parameter_flags & 2) 134
135enum {
136 IPL_DEVNO_VALID = 1,
137 IPL_PARMBLOCK_VALID = 2,
138};
115 139
116#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ 140#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
117 IPL_PARMBLOCK_ORIGIN) 141 IPL_PARMBLOCK_ORIGIN)
118#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) 142#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
119 143
120#else /* __ASSEMBLY__ */ 144#else /* __ASSEMBLY__ */
121 145
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index 657646054c5e..9fb02e9779c9 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -104,7 +104,7 @@ smp_call_function_on(void (*func) (void *info), void *info,
104#define smp_cpu_not_running(cpu) 1 104#define smp_cpu_not_running(cpu) 1
105#define smp_get_cpu(cpu) ({ 0; }) 105#define smp_get_cpu(cpu) ({ 0; })
106#define smp_put_cpu(cpu) ({ 0; }) 106#define smp_put_cpu(cpu) ({ 0; })
107#define smp_setup_cpu_possible_map() 107#define smp_setup_cpu_possible_map() do { } while (0)
108#endif 108#endif
109 109
110#endif 110#endif
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 0b7c0ca4c3d7..e2047b0c9092 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -47,7 +47,7 @@
47 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ 47 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
48 asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ 48 asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \
49}) 49})
50#else 50#else /* __s390x__ */
51#define set_fs(x) \ 51#define set_fs(x) \
52({ \ 52({ \
53 unsigned long __pto; \ 53 unsigned long __pto; \
@@ -56,7 +56,7 @@
56 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ 56 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
57 asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ 57 asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \
58}) 58})
59#endif 59#endif /* __s390x__ */
60 60
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
@@ -85,76 +85,51 @@ struct exception_table_entry
85 unsigned long insn, fixup; 85 unsigned long insn, fixup;
86}; 86};
87 87
88#ifndef __s390x__ 88struct uaccess_ops {
89#define __uaccess_fixup \ 89 size_t (*copy_from_user)(size_t, const void __user *, void *);
90 ".section .fixup,\"ax\"\n" \ 90 size_t (*copy_from_user_small)(size_t, const void __user *, void *);
91 "2: lhi %0,%4\n" \ 91 size_t (*copy_to_user)(size_t, void __user *, const void *);
92 " bras 1,3f\n" \ 92 size_t (*copy_to_user_small)(size_t, void __user *, const void *);
93 " .long 1b\n" \ 93 size_t (*copy_in_user)(size_t, void __user *, const void __user *);
94 "3: l 1,0(1)\n" \ 94 size_t (*clear_user)(size_t, void __user *);
95 " br 1\n" \ 95 size_t (*strnlen_user)(size_t, const char __user *);
96 ".previous\n" \ 96 size_t (*strncpy_from_user)(size_t, const char __user *, char *);
97 ".section __ex_table,\"a\"\n" \ 97 int (*futex_atomic_op)(int op, int __user *, int oparg, int *old);
98 " .align 4\n" \ 98 int (*futex_atomic_cmpxchg)(int __user *, int old, int new);
99 " .long 0b,2b\n" \ 99};
100 ".previous" 100
101#define __uaccess_clobber "cc", "1" 101extern struct uaccess_ops uaccess;
102#else /* __s390x__ */ 102extern struct uaccess_ops uaccess_std;
103#define __uaccess_fixup \ 103extern struct uaccess_ops uaccess_mvcos;
104 ".section .fixup,\"ax\"\n" \ 104
105 "2: lghi %0,%4\n" \ 105static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
106 " jg 1b\n" \ 106{
107 ".previous\n" \ 107 size = uaccess.copy_to_user_small(size, ptr, x);
108 ".section __ex_table,\"a\"\n" \ 108 return size ? -EFAULT : size;
109 " .align 8\n" \ 109}
110 " .quad 0b,2b\n" \ 110
111 ".previous" 111static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
112#define __uaccess_clobber "cc" 112{
113#endif /* __s390x__ */ 113 size = uaccess.copy_from_user_small(size, ptr, x);
114 return size ? -EFAULT : size;
115}
114 116
115/* 117/*
116 * These are the main single-value transfer routines. They automatically 118 * These are the main single-value transfer routines. They automatically
117 * use the right size if we just have the right pointer type. 119 * use the right size if we just have the right pointer type.
118 */ 120 */
119#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
120#define __put_user_asm(x, ptr, err) \
121({ \
122 err = 0; \
123 asm volatile( \
124 "0: mvcs 0(%1,%2),%3,%0\n" \
125 "1:\n" \
126 __uaccess_fixup \
127 : "+&d" (err) \
128 : "d" (sizeof(*(ptr))), "a" (ptr), "Q" (x), \
129 "K" (-EFAULT) \
130 : __uaccess_clobber ); \
131})
132#else
133#define __put_user_asm(x, ptr, err) \
134({ \
135 err = 0; \
136 asm volatile( \
137 "0: mvcs 0(%1,%2),0(%3),%0\n" \
138 "1:\n" \
139 __uaccess_fixup \
140 : "+&d" (err) \
141 : "d" (sizeof(*(ptr))), "a" (ptr), "a" (&(x)), \
142 "K" (-EFAULT), "m" (x) \
143 : __uaccess_clobber ); \
144})
145#endif
146
147#define __put_user(x, ptr) \ 121#define __put_user(x, ptr) \
148({ \ 122({ \
149 __typeof__(*(ptr)) __x = (x); \ 123 __typeof__(*(ptr)) __x = (x); \
150 int __pu_err; \ 124 int __pu_err = -EFAULT; \
151 __chk_user_ptr(ptr); \ 125 __chk_user_ptr(ptr); \
152 switch (sizeof (*(ptr))) { \ 126 switch (sizeof (*(ptr))) { \
153 case 1: \ 127 case 1: \
154 case 2: \ 128 case 2: \
155 case 4: \ 129 case 4: \
156 case 8: \ 130 case 8: \
157 __put_user_asm(__x, ptr, __pu_err); \ 131 __pu_err = __put_user_fn(sizeof (*(ptr)), \
132 ptr, &__x); \
158 break; \ 133 break; \
159 default: \ 134 default: \
160 __put_user_bad(); \ 135 __put_user_bad(); \
@@ -172,60 +147,36 @@ struct exception_table_entry
172 147
173extern int __put_user_bad(void) __attribute__((noreturn)); 148extern int __put_user_bad(void) __attribute__((noreturn));
174 149
175#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
176#define __get_user_asm(x, ptr, err) \
177({ \
178 err = 0; \
179 asm volatile ( \
180 "0: mvcp %O1(%2,%R1),0(%3),%0\n" \
181 "1:\n" \
182 __uaccess_fixup \
183 : "+&d" (err), "=Q" (x) \
184 : "d" (sizeof(*(ptr))), "a" (ptr), \
185 "K" (-EFAULT) \
186 : __uaccess_clobber ); \
187})
188#else
189#define __get_user_asm(x, ptr, err) \
190({ \
191 err = 0; \
192 asm volatile ( \
193 "0: mvcp 0(%2,%5),0(%3),%0\n" \
194 "1:\n" \
195 __uaccess_fixup \
196 : "+&d" (err), "=m" (x) \
197 : "d" (sizeof(*(ptr))), "a" (ptr), \
198 "K" (-EFAULT), "a" (&(x)) \
199 : __uaccess_clobber ); \
200})
201#endif
202
203#define __get_user(x, ptr) \ 150#define __get_user(x, ptr) \
204({ \ 151({ \
205 int __gu_err; \ 152 int __gu_err = -EFAULT; \
206 __chk_user_ptr(ptr); \ 153 __chk_user_ptr(ptr); \
207 switch (sizeof(*(ptr))) { \ 154 switch (sizeof(*(ptr))) { \
208 case 1: { \ 155 case 1: { \
209 unsigned char __x; \ 156 unsigned char __x; \
210 __get_user_asm(__x, ptr, __gu_err); \ 157 __gu_err = __get_user_fn(sizeof (*(ptr)), \
158 ptr, &__x); \
211 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 159 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
212 break; \ 160 break; \
213 }; \ 161 }; \
214 case 2: { \ 162 case 2: { \
215 unsigned short __x; \ 163 unsigned short __x; \
216 __get_user_asm(__x, ptr, __gu_err); \ 164 __gu_err = __get_user_fn(sizeof (*(ptr)), \
165 ptr, &__x); \
217 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 166 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
218 break; \ 167 break; \
219 }; \ 168 }; \
220 case 4: { \ 169 case 4: { \
221 unsigned int __x; \ 170 unsigned int __x; \
222 __get_user_asm(__x, ptr, __gu_err); \ 171 __gu_err = __get_user_fn(sizeof (*(ptr)), \
172 ptr, &__x); \
223 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 173 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
224 break; \ 174 break; \
225 }; \ 175 }; \
226 case 8: { \ 176 case 8: { \
227 unsigned long long __x; \ 177 unsigned long long __x; \
228 __get_user_asm(__x, ptr, __gu_err); \ 178 __gu_err = __get_user_fn(sizeof (*(ptr)), \
179 ptr, &__x); \
229 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 180 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
230 break; \ 181 break; \
231 }; \ 182 }; \
@@ -247,8 +198,6 @@ extern int __get_user_bad(void) __attribute__((noreturn));
247#define __put_user_unaligned __put_user 198#define __put_user_unaligned __put_user
248#define __get_user_unaligned __get_user 199#define __get_user_unaligned __get_user
249 200
250extern long __copy_to_user_asm(const void *from, long n, void __user *to);
251
252/** 201/**
253 * __copy_to_user: - Copy a block of data into user space, with less checking. 202 * __copy_to_user: - Copy a block of data into user space, with less checking.
254 * @to: Destination address, in user space. 203 * @to: Destination address, in user space.
@@ -266,7 +215,10 @@ extern long __copy_to_user_asm(const void *from, long n, void __user *to);
266static inline unsigned long 215static inline unsigned long
267__copy_to_user(void __user *to, const void *from, unsigned long n) 216__copy_to_user(void __user *to, const void *from, unsigned long n)
268{ 217{
269 return __copy_to_user_asm(from, n, to); 218 if (__builtin_constant_p(n) && (n <= 256))
219 return uaccess.copy_to_user_small(n, to, from);
220 else
221 return uaccess.copy_to_user(n, to, from);
270} 222}
271 223
272#define __copy_to_user_inatomic __copy_to_user 224#define __copy_to_user_inatomic __copy_to_user
@@ -294,8 +246,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
294 return n; 246 return n;
295} 247}
296 248
297extern long __copy_from_user_asm(void *to, long n, const void __user *from);
298
299/** 249/**
300 * __copy_from_user: - Copy a block of data from user space, with less checking. 250 * __copy_from_user: - Copy a block of data from user space, with less checking.
301 * @to: Destination address, in kernel space. 251 * @to: Destination address, in kernel space.
@@ -316,7 +266,10 @@ extern long __copy_from_user_asm(void *to, long n, const void __user *from);
316static inline unsigned long 266static inline unsigned long
317__copy_from_user(void *to, const void __user *from, unsigned long n) 267__copy_from_user(void *to, const void __user *from, unsigned long n)
318{ 268{
319 return __copy_from_user_asm(to, n, from); 269 if (__builtin_constant_p(n) && (n <= 256))
270 return uaccess.copy_from_user_small(n, from, to);
271 else
272 return uaccess.copy_from_user(n, from, to);
320} 273}
321 274
322/** 275/**
@@ -346,13 +299,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
346 return n; 299 return n;
347} 300}
348 301
349extern unsigned long __copy_in_user_asm(const void __user *from, long n,
350 void __user *to);
351
352static inline unsigned long 302static inline unsigned long
353__copy_in_user(void __user *to, const void __user *from, unsigned long n) 303__copy_in_user(void __user *to, const void __user *from, unsigned long n)
354{ 304{
355 return __copy_in_user_asm(from, n, to); 305 return uaccess.copy_in_user(n, to, from);
356} 306}
357 307
358static inline unsigned long 308static inline unsigned long
@@ -360,34 +310,28 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
360{ 310{
361 might_sleep(); 311 might_sleep();
362 if (__access_ok(from,n) && __access_ok(to,n)) 312 if (__access_ok(from,n) && __access_ok(to,n))
363 n = __copy_in_user_asm(from, n, to); 313 n = __copy_in_user(to, from, n);
364 return n; 314 return n;
365} 315}
366 316
367/* 317/*
368 * Copy a null terminated string from userspace. 318 * Copy a null terminated string from userspace.
369 */ 319 */
370extern long __strncpy_from_user_asm(long count, char *dst,
371 const char __user *src);
372
373static inline long 320static inline long
374strncpy_from_user(char *dst, const char __user *src, long count) 321strncpy_from_user(char *dst, const char __user *src, long count)
375{ 322{
376 long res = -EFAULT; 323 long res = -EFAULT;
377 might_sleep(); 324 might_sleep();
378 if (access_ok(VERIFY_READ, src, 1)) 325 if (access_ok(VERIFY_READ, src, 1))
379 res = __strncpy_from_user_asm(count, dst, src); 326 res = uaccess.strncpy_from_user(count, src, dst);
380 return res; 327 return res;
381} 328}
382 329
383
384extern long __strnlen_user_asm(long count, const char __user *src);
385
386static inline unsigned long 330static inline unsigned long
387strnlen_user(const char __user * src, unsigned long n) 331strnlen_user(const char __user * src, unsigned long n)
388{ 332{
389 might_sleep(); 333 might_sleep();
390 return __strnlen_user_asm(n, src); 334 return uaccess.strnlen_user(n, src);
391} 335}
392 336
393/** 337/**
@@ -410,12 +354,10 @@ strnlen_user(const char __user * src, unsigned long n)
410 * Zero Userspace 354 * Zero Userspace
411 */ 355 */
412 356
413extern long __clear_user_asm(void __user *to, long n);
414
415static inline unsigned long 357static inline unsigned long
416__clear_user(void __user *to, unsigned long n) 358__clear_user(void __user *to, unsigned long n)
417{ 359{
418 return __clear_user_asm(to, n); 360 return uaccess.clear_user(n, to);
419} 361}
420 362
421static inline unsigned long 363static inline unsigned long
@@ -423,7 +365,7 @@ clear_user(void __user *to, unsigned long n)
423{ 365{
424 might_sleep(); 366 might_sleep();
425 if (access_ok(VERIFY_WRITE, to, n)) 367 if (access_ok(VERIFY_WRITE, to, n))
426 n = __clear_user_asm(to, n); 368 n = uaccess.clear_user(n, to);
427 return n; 369 return n;
428} 370}
429 371
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index aa7a243862e1..02b942d85c37 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -25,17 +25,12 @@
25#define __NR_unlink 10 25#define __NR_unlink 10
26#define __NR_execve 11 26#define __NR_execve 11
27#define __NR_chdir 12 27#define __NR_chdir 12
28#define __NR_time 13
29#define __NR_mknod 14 28#define __NR_mknod 14
30#define __NR_chmod 15 29#define __NR_chmod 15
31#define __NR_lchown 16
32#define __NR_lseek 19 30#define __NR_lseek 19
33#define __NR_getpid 20 31#define __NR_getpid 20
34#define __NR_mount 21 32#define __NR_mount 21
35#define __NR_umount 22 33#define __NR_umount 22
36#define __NR_setuid 23
37#define __NR_getuid 24
38#define __NR_stime 25
39#define __NR_ptrace 26 34#define __NR_ptrace 26
40#define __NR_alarm 27 35#define __NR_alarm 27
41#define __NR_pause 29 36#define __NR_pause 29
@@ -51,11 +46,7 @@
51#define __NR_pipe 42 46#define __NR_pipe 42
52#define __NR_times 43 47#define __NR_times 43
53#define __NR_brk 45 48#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48 49#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51 50#define __NR_acct 51
60#define __NR_umount2 52 51#define __NR_umount2 52
61#define __NR_ioctl 54 52#define __NR_ioctl 54
@@ -69,18 +60,13 @@
69#define __NR_getpgrp 65 60#define __NR_getpgrp 65
70#define __NR_setsid 66 61#define __NR_setsid 66
71#define __NR_sigaction 67 62#define __NR_sigaction 67
72#define __NR_setreuid 70
73#define __NR_setregid 71
74#define __NR_sigsuspend 72 63#define __NR_sigsuspend 72
75#define __NR_sigpending 73 64#define __NR_sigpending 73
76#define __NR_sethostname 74 65#define __NR_sethostname 74
77#define __NR_setrlimit 75 66#define __NR_setrlimit 75
78#define __NR_getrlimit 76
79#define __NR_getrusage 77 67#define __NR_getrusage 77
80#define __NR_gettimeofday 78 68#define __NR_gettimeofday 78
81#define __NR_settimeofday 79 69#define __NR_settimeofday 79
82#define __NR_getgroups 80
83#define __NR_setgroups 81
84#define __NR_symlink 83 70#define __NR_symlink 83
85#define __NR_readlink 85 71#define __NR_readlink 85
86#define __NR_uselib 86 72#define __NR_uselib 86
@@ -92,12 +78,10 @@
92#define __NR_truncate 92 78#define __NR_truncate 92
93#define __NR_ftruncate 93 79#define __NR_ftruncate 93
94#define __NR_fchmod 94 80#define __NR_fchmod 94
95#define __NR_fchown 95
96#define __NR_getpriority 96 81#define __NR_getpriority 96
97#define __NR_setpriority 97 82#define __NR_setpriority 97
98#define __NR_statfs 99 83#define __NR_statfs 99
99#define __NR_fstatfs 100 84#define __NR_fstatfs 100
100#define __NR_ioperm 101
101#define __NR_socketcall 102 85#define __NR_socketcall 102
102#define __NR_syslog 103 86#define __NR_syslog 103
103#define __NR_setitimer 104 87#define __NR_setitimer 104
@@ -131,11 +115,7 @@
131#define __NR_sysfs 135 115#define __NR_sysfs 135
132#define __NR_personality 136 116#define __NR_personality 136
133#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 117#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
134#define __NR_setfsuid 138
135#define __NR_setfsgid 139
136#define __NR__llseek 140
137#define __NR_getdents 141 118#define __NR_getdents 141
138#define __NR__newselect 142
139#define __NR_flock 143 119#define __NR_flock 143
140#define __NR_msync 144 120#define __NR_msync 144
141#define __NR_readv 145 121#define __NR_readv 145
@@ -157,13 +137,9 @@
157#define __NR_sched_rr_get_interval 161 137#define __NR_sched_rr_get_interval 161
158#define __NR_nanosleep 162 138#define __NR_nanosleep 162
159#define __NR_mremap 163 139#define __NR_mremap 163
160#define __NR_setresuid 164
161#define __NR_getresuid 165
162#define __NR_query_module 167 140#define __NR_query_module 167
163#define __NR_poll 168 141#define __NR_poll 168
164#define __NR_nfsservctl 169 142#define __NR_nfsservctl 169
165#define __NR_setresgid 170
166#define __NR_getresgid 171
167#define __NR_prctl 172 143#define __NR_prctl 172
168#define __NR_rt_sigreturn 173 144#define __NR_rt_sigreturn 173
169#define __NR_rt_sigaction 174 145#define __NR_rt_sigaction 174
@@ -174,7 +150,6 @@
174#define __NR_rt_sigsuspend 179 150#define __NR_rt_sigsuspend 179
175#define __NR_pread64 180 151#define __NR_pread64 180
176#define __NR_pwrite64 181 152#define __NR_pwrite64 181
177#define __NR_chown 182
178#define __NR_getcwd 183 153#define __NR_getcwd 183
179#define __NR_capget 184 154#define __NR_capget 184
180#define __NR_capset 185 155#define __NR_capset 185
@@ -183,39 +158,11 @@
183#define __NR_getpmsg 188 158#define __NR_getpmsg 188
184#define __NR_putpmsg 189 159#define __NR_putpmsg 189
185#define __NR_vfork 190 160#define __NR_vfork 190
186#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
187#define __NR_mmap2 192
188#define __NR_truncate64 193
189#define __NR_ftruncate64 194
190#define __NR_stat64 195
191#define __NR_lstat64 196
192#define __NR_fstat64 197
193#define __NR_lchown32 198
194#define __NR_getuid32 199
195#define __NR_getgid32 200
196#define __NR_geteuid32 201
197#define __NR_getegid32 202
198#define __NR_setreuid32 203
199#define __NR_setregid32 204
200#define __NR_getgroups32 205
201#define __NR_setgroups32 206
202#define __NR_fchown32 207
203#define __NR_setresuid32 208
204#define __NR_getresuid32 209
205#define __NR_setresgid32 210
206#define __NR_getresgid32 211
207#define __NR_chown32 212
208#define __NR_setuid32 213
209#define __NR_setgid32 214
210#define __NR_setfsuid32 215
211#define __NR_setfsgid32 216
212#define __NR_pivot_root 217 161#define __NR_pivot_root 217
213#define __NR_mincore 218 162#define __NR_mincore 218
214#define __NR_madvise 219 163#define __NR_madvise 219
215#define __NR_getdents64 220 164#define __NR_getdents64 220
216#define __NR_fcntl64 221
217#define __NR_readahead 222 165#define __NR_readahead 222
218#define __NR_sendfile64 223
219#define __NR_setxattr 224 166#define __NR_setxattr 224
220#define __NR_lsetxattr 225 167#define __NR_lsetxattr 225
221#define __NR_fsetxattr 226 168#define __NR_fsetxattr 226
@@ -256,7 +203,6 @@
256#define __NR_clock_getres (__NR_timer_create+7) 203#define __NR_clock_getres (__NR_timer_create+7)
257#define __NR_clock_nanosleep (__NR_timer_create+8) 204#define __NR_clock_nanosleep (__NR_timer_create+8)
258/* Number 263 is reserved for vserver */ 205/* Number 263 is reserved for vserver */
259#define __NR_fadvise64_64 264
260#define __NR_statfs64 265 206#define __NR_statfs64 265
261#define __NR_fstatfs64 266 207#define __NR_fstatfs64 266
262#define __NR_remap_file_pages 267 208#define __NR_remap_file_pages 267
@@ -285,7 +231,6 @@
285#define __NR_mknodat 290 231#define __NR_mknodat 290
286#define __NR_fchownat 291 232#define __NR_fchownat 291
287#define __NR_futimesat 292 233#define __NR_futimesat 292
288#define __NR_fstatat64 293
289#define __NR_unlinkat 294 234#define __NR_unlinkat 294
290#define __NR_renameat 295 235#define __NR_renameat 295
291#define __NR_linkat 296 236#define __NR_linkat 296
@@ -310,62 +255,65 @@
310 * have a different name although they do the same (e.g. __NR_chown32 255 * have a different name although they do the same (e.g. __NR_chown32
311 * is __NR_chown on 64 bit). 256 * is __NR_chown on 64 bit).
312 */ 257 */
313#ifdef __s390x__ 258#ifndef __s390x__
314#undef __NR_time 259
315#undef __NR_lchown 260#define __NR_time 13
316#undef __NR_setuid 261#define __NR_lchown 16
317#undef __NR_getuid 262#define __NR_setuid 23
318#undef __NR_stime 263#define __NR_getuid 24
319#undef __NR_setgid 264#define __NR_stime 25
320#undef __NR_getgid 265#define __NR_setgid 46
321#undef __NR_geteuid 266#define __NR_getgid 47
322#undef __NR_getegid 267#define __NR_geteuid 49
323#undef __NR_setreuid 268#define __NR_getegid 50
324#undef __NR_setregid 269#define __NR_setreuid 70
325#undef __NR_getrlimit 270#define __NR_setregid 71
326#undef __NR_getgroups 271#define __NR_getrlimit 76
327#undef __NR_setgroups 272#define __NR_getgroups 80
328#undef __NR_fchown 273#define __NR_setgroups 81
329#undef __NR_ioperm 274#define __NR_fchown 95
330#undef __NR_setfsuid 275#define __NR_ioperm 101
331#undef __NR_setfsgid 276#define __NR_setfsuid 138
332#undef __NR__llseek 277#define __NR_setfsgid 139
333#undef __NR__newselect 278#define __NR__llseek 140
334#undef __NR_setresuid 279#define __NR__newselect 142
335#undef __NR_getresuid 280#define __NR_setresuid 164
336#undef __NR_setresgid 281#define __NR_getresuid 165
337#undef __NR_getresgid 282#define __NR_setresgid 170
338#undef __NR_chown 283#define __NR_getresgid 171
339#undef __NR_ugetrlimit 284#define __NR_chown 182
340#undef __NR_mmap2 285#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
341#undef __NR_truncate64 286#define __NR_mmap2 192
342#undef __NR_ftruncate64 287#define __NR_truncate64 193
343#undef __NR_stat64 288#define __NR_ftruncate64 194
344#undef __NR_lstat64 289#define __NR_stat64 195
345#undef __NR_fstat64 290#define __NR_lstat64 196
346#undef __NR_lchown32 291#define __NR_fstat64 197
347#undef __NR_getuid32 292#define __NR_lchown32 198
348#undef __NR_getgid32 293#define __NR_getuid32 199
349#undef __NR_geteuid32 294#define __NR_getgid32 200
350#undef __NR_getegid32 295#define __NR_geteuid32 201
351#undef __NR_setreuid32 296#define __NR_getegid32 202
352#undef __NR_setregid32 297#define __NR_setreuid32 203
353#undef __NR_getgroups32 298#define __NR_setregid32 204
354#undef __NR_setgroups32 299#define __NR_getgroups32 205
355#undef __NR_fchown32 300#define __NR_setgroups32 206
356#undef __NR_setresuid32 301#define __NR_fchown32 207
357#undef __NR_getresuid32 302#define __NR_setresuid32 208
358#undef __NR_setresgid32 303#define __NR_getresuid32 209
359#undef __NR_getresgid32 304#define __NR_setresgid32 210
360#undef __NR_chown32 305#define __NR_getresgid32 211
361#undef __NR_setuid32 306#define __NR_chown32 212
362#undef __NR_setgid32 307#define __NR_setuid32 213
363#undef __NR_setfsuid32 308#define __NR_setgid32 214
364#undef __NR_setfsgid32 309#define __NR_setfsuid32 215
365#undef __NR_fcntl64 310#define __NR_setfsgid32 216
366#undef __NR_sendfile64 311#define __NR_fcntl64 221
367#undef __NR_fadvise64_64 312#define __NR_sendfile64 223
368#undef __NR_fstatat64 313#define __NR_fadvise64_64 264
314#define __NR_fstatat64 293
315
316#else
369 317
370#define __NR_select 142 318#define __NR_select 142
371#define __NR_getrlimit 191 /* SuS compliant getrlimit */ 319#define __NR_getrlimit 191 /* SuS compliant getrlimit */
diff --git a/include/asm-s390/z90crypt.h b/include/asm-s390/z90crypt.h
deleted file mode 100644
index 31a2439b07bd..000000000000
--- a/include/asm-s390/z90crypt.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2 * include/asm-s390/z90crypt.h
3 *
4 * z90crypt 1.3.3 (user-visible header)
5 *
6 * Copyright (C) 2001, 2005 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_Z90CRYPT_H
28#define __ASM_S390_Z90CRYPT_H
29#include <linux/ioctl.h>
30
31#define z90crypt_VERSION 1
32#define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards
33#define z90crypt_VARIANT 3 // 3 = CEX2A support
34
35/**
36 * struct ica_rsa_modexpo
37 *
38 * Requirements:
39 * - outputdatalength is at least as large as inputdatalength.
40 * - All key parts are right justified in their fields, padded on
41 * the left with zeroes.
42 * - length(b_key) = inputdatalength
43 * - length(n_modulus) = inputdatalength
44 */
45struct ica_rsa_modexpo {
46 char __user * inputdata;
47 unsigned int inputdatalength;
48 char __user * outputdata;
49 unsigned int outputdatalength;
50 char __user * b_key;
51 char __user * n_modulus;
52};
53
54/**
55 * struct ica_rsa_modexpo_crt
56 *
57 * Requirements:
58 * - inputdatalength is even.
59 * - outputdatalength is at least as large as inputdatalength.
60 * - All key parts are right justified in their fields, padded on
61 * the left with zeroes.
62 * - length(bp_key) = inputdatalength/2 + 8
63 * - length(bq_key) = inputdatalength/2
64 * - length(np_key) = inputdatalength/2 + 8
65 * - length(nq_key) = inputdatalength/2
66 * - length(u_mult_inv) = inputdatalength/2 + 8
67 */
68struct ica_rsa_modexpo_crt {
69 char __user * inputdata;
70 unsigned int inputdatalength;
71 char __user * outputdata;
72 unsigned int outputdatalength;
73 char __user * bp_key;
74 char __user * bq_key;
75 char __user * np_prime;
76 char __user * nq_prime;
77 char __user * u_mult_inv;
78};
79
80#define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks
81
82/**
83 * Interface notes:
84 *
85 * The ioctl()s which are implemented (along with relevant details)
86 * are:
87 *
88 * ICARSAMODEXPO
89 * Perform an RSA operation using a Modulus-Exponent pair
90 * This takes an ica_rsa_modexpo struct as its arg.
91 *
92 * NOTE: please refer to the comments preceding this structure
93 * for the implementation details for the contents of the
94 * block
95 *
96 * ICARSACRT
97 * Perform an RSA operation using a Chinese-Remainder Theorem key
98 * This takes an ica_rsa_modexpo_crt struct as its arg.
99 *
100 * NOTE: please refer to the comments preceding this structure
101 * for the implementation details for the contents of the
102 * block
103 *
104 * Z90STAT_TOTALCOUNT
105 * Return an integer count of all device types together.
106 *
107 * Z90STAT_PCICACOUNT
108 * Return an integer count of all PCICAs.
109 *
110 * Z90STAT_PCICCCOUNT
111 * Return an integer count of all PCICCs.
112 *
113 * Z90STAT_PCIXCCMCL2COUNT
114 * Return an integer count of all MCL2 PCIXCCs.
115 *
116 * Z90STAT_PCIXCCMCL3COUNT
117 * Return an integer count of all MCL3 PCIXCCs.
118 *
119 * Z90STAT_CEX2CCOUNT
120 * Return an integer count of all CEX2Cs.
121 *
122 * Z90STAT_CEX2ACOUNT
123 * Return an integer count of all CEX2As.
124 *
125 * Z90STAT_REQUESTQ_COUNT
126 * Return an integer count of the number of entries waiting to be
127 * sent to a device.
128 *
129 * Z90STAT_PENDINGQ_COUNT
130 * Return an integer count of the number of entries sent to a
131 * device awaiting the reply.
132 *
133 * Z90STAT_TOTALOPEN_COUNT
134 * Return an integer count of the number of open file handles.
135 *
136 * Z90STAT_DOMAIN_INDEX
137 * Return the integer value of the Cryptographic Domain.
138 *
139 * Z90STAT_STATUS_MASK
140 * Return an 64 element array of unsigned chars for the status of
141 * all devices.
142 * 0x01: PCICA
143 * 0x02: PCICC
144 * 0x03: PCIXCC_MCL2
145 * 0x04: PCIXCC_MCL3
146 * 0x05: CEX2C
147 * 0x06: CEX2A
148 * 0x0d: device is disabled via the proc filesystem
149 *
150 * Z90STAT_QDEPTH_MASK
151 * Return an 64 element array of unsigned chars for the queue
152 * depth of all devices.
153 *
154 * Z90STAT_PERDEV_REQCNT
155 * Return an 64 element array of unsigned integers for the number
156 * of successfully completed requests per device since the device
157 * was detected and made available.
158 *
159 * ICAZ90STATUS (deprecated)
160 * Return some device driver status in a ica_z90_status struct
161 * This takes an ica_z90_status struct as its arg.
162 *
163 * NOTE: this ioctl() is deprecated, and has been replaced with
164 * single ioctl()s for each type of status being requested
165 *
166 * Z90STAT_PCIXCCCOUNT (deprecated)
167 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
168 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
169 * MCL2 PCIXCCs.
170 *
171 * Z90QUIESCE (not recommended)
172 * Quiesce the driver. This is intended to stop all new
173 * requests from being processed. Its use is NOT recommended,
174 * except in circumstances where there is no other way to stop
175 * callers from accessing the driver. Its original use was to
176 * allow the driver to be "drained" of work in preparation for
177 * a system shutdown.
178 *
179 * NOTE: once issued, this ban on new work cannot be undone
180 * except by unloading and reloading the driver.
181 */
182
183/**
184 * Supported ioctl calls
185 */
186#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0)
187#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0)
188
189/* DEPRECATED status calls (bound for removal at some point) */
190#define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status)
191#define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int)
192
193/* unrelated to ICA callers */
194#define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11)
195
196/* New status calls */
197#define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int)
198#define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int)
199#define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int)
200#define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int)
201#define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int)
202#define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int)
203#define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int)
204#define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int)
205#define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int)
206#define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int)
207#define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int)
208#define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64])
209#define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64])
210#define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64])
211
212#endif /* __ASM_S390_Z90CRYPT_H */
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h
new file mode 100644
index 000000000000..7244c68464f2
--- /dev/null
+++ b/include/asm-s390/zcrypt.h
@@ -0,0 +1,285 @@
1/*
2 * include/asm-s390/zcrypt.h
3 *
4 * zcrypt 2.1.0 (user-visible header)
5 *
6 * Copyright (C) 2001, 2006 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_ZCRYPT_H
28#define __ASM_S390_ZCRYPT_H
29
30#define ZCRYPT_VERSION 2
31#define ZCRYPT_RELEASE 1
32#define ZCRYPT_VARIANT 0
33
34#include <linux/ioctl.h>
35#include <linux/compiler.h>
36
37/**
38 * struct ica_rsa_modexpo
39 *
40 * Requirements:
41 * - outputdatalength is at least as large as inputdatalength.
42 * - All key parts are right justified in their fields, padded on
43 * the left with zeroes.
44 * - length(b_key) = inputdatalength
45 * - length(n_modulus) = inputdatalength
46 */
47struct ica_rsa_modexpo {
48 char __user * inputdata;
49 unsigned int inputdatalength;
50 char __user * outputdata;
51 unsigned int outputdatalength;
52 char __user * b_key;
53 char __user * n_modulus;
54};
55
56/**
57 * struct ica_rsa_modexpo_crt
58 *
59 * Requirements:
60 * - inputdatalength is even.
61 * - outputdatalength is at least as large as inputdatalength.
62 * - All key parts are right justified in their fields, padded on
63 * the left with zeroes.
64 * - length(bp_key) = inputdatalength/2 + 8
65 * - length(bq_key) = inputdatalength/2
66 * - length(np_key) = inputdatalength/2 + 8
67 * - length(nq_key) = inputdatalength/2
68 * - length(u_mult_inv) = inputdatalength/2 + 8
69 */
70struct ica_rsa_modexpo_crt {
71 char __user * inputdata;
72 unsigned int inputdatalength;
73 char __user * outputdata;
74 unsigned int outputdatalength;
75 char __user * bp_key;
76 char __user * bq_key;
77 char __user * np_prime;
78 char __user * nq_prime;
79 char __user * u_mult_inv;
80};
81
82/**
83 * CPRBX
84 * Note that all shorts and ints are big-endian.
85 * All pointer fields are 16 bytes long, and mean nothing.
86 *
87 * A request CPRB is followed by a request_parameter_block.
88 *
89 * The request (or reply) parameter block is organized thus:
90 * function code
91 * VUD block
92 * key block
93 */
94struct ica_CPRBX {
95 unsigned short cprb_len; /* CPRB length 220 */
96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */
97 unsigned char pad_000[3]; /* Alignment pad bytes */
98 unsigned char func_id[2]; /* function id 0x5432 */
99 unsigned char cprb_flags[4]; /* Flags */
100 unsigned int req_parml; /* request parameter buffer len */
101 unsigned int req_datal; /* request data buffer */
102 unsigned int rpl_msgbl; /* reply message block length */
103 unsigned int rpld_parml; /* replied parameter block len */
104 unsigned int rpl_datal; /* reply data block len */
105 unsigned int rpld_datal; /* replied data block len */
106 unsigned int req_extbl; /* request extension block len */
107 unsigned char pad_001[4]; /* reserved */
108 unsigned int rpld_extbl; /* replied extension block len */
109 unsigned char padx000[16 - sizeof (char *)];
110 unsigned char * req_parmb; /* request parm block 'address' */
111 unsigned char padx001[16 - sizeof (char *)];
112 unsigned char * req_datab; /* request data block 'address' */
113 unsigned char padx002[16 - sizeof (char *)];
114 unsigned char * rpl_parmb; /* reply parm block 'address' */
115 unsigned char padx003[16 - sizeof (char *)];
116 unsigned char * rpl_datab; /* reply data block 'address' */
117 unsigned char padx004[16 - sizeof (char *)];
118 unsigned char * req_extb; /* request extension block 'addr'*/
119 unsigned char padx005[16 - sizeof (char *)];
120 unsigned char * rpl_extb; /* reply extension block 'addres'*/
121 unsigned short ccp_rtcode; /* server return code */
122 unsigned short ccp_rscode; /* server reason code */
123 unsigned int mac_data_len; /* Mac Data Length */
124 unsigned char logon_id[8]; /* Logon Identifier */
125 unsigned char mac_value[8]; /* Mac Value */
126 unsigned char mac_content_flgs;/* Mac content flag byte */
127 unsigned char pad_002; /* Alignment */
128 unsigned short domain; /* Domain */
129 unsigned char usage_domain[4];/* Usage domain */
130 unsigned char cntrl_domain[4];/* Control domain */
131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */
132 unsigned char pad_004[36]; /* reserved */
133};
134
135/**
136 * xcRB
137 */
138struct ica_xcRB {
139 unsigned short agent_ID;
140 unsigned int user_defined;
141 unsigned short request_ID;
142 unsigned int request_control_blk_length;
143 unsigned char padding1[16 - sizeof (char *)];
144 char __user * request_control_blk_addr;
145 unsigned int request_data_length;
146 char padding2[16 - sizeof (char *)];
147 char __user * request_data_address;
148 unsigned int reply_control_blk_length;
149 char padding3[16 - sizeof (char *)];
150 char __user * reply_control_blk_addr;
151 unsigned int reply_data_length;
152 char padding4[16 - sizeof (char *)];
153 char __user * reply_data_addr;
154 unsigned short priority_window;
155 unsigned int status;
156} __attribute__((packed));
157#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
158
159#define ZCRYPT_IOCTL_MAGIC 'z'
160
161/**
162 * Interface notes:
163 *
164 * The ioctl()s which are implemented (along with relevant details)
165 * are:
166 *
167 * ICARSAMODEXPO
168 * Perform an RSA operation using a Modulus-Exponent pair
169 * This takes an ica_rsa_modexpo struct as its arg.
170 *
171 * NOTE: please refer to the comments preceding this structure
172 * for the implementation details for the contents of the
173 * block
174 *
175 * ICARSACRT
176 * Perform an RSA operation using a Chinese-Remainder Theorem key
177 * This takes an ica_rsa_modexpo_crt struct as its arg.
178 *
179 * NOTE: please refer to the comments preceding this structure
180 * for the implementation details for the contents of the
181 * block
182 *
183 * Z90STAT_TOTALCOUNT
184 * Return an integer count of all device types together.
185 *
186 * Z90STAT_PCICACOUNT
187 * Return an integer count of all PCICAs.
188 *
189 * Z90STAT_PCICCCOUNT
190 * Return an integer count of all PCICCs.
191 *
192 * Z90STAT_PCIXCCMCL2COUNT
193 * Return an integer count of all MCL2 PCIXCCs.
194 *
195 * Z90STAT_PCIXCCMCL3COUNT
196 * Return an integer count of all MCL3 PCIXCCs.
197 *
198 * Z90STAT_CEX2CCOUNT
199 * Return an integer count of all CEX2Cs.
200 *
201 * Z90STAT_CEX2ACOUNT
202 * Return an integer count of all CEX2As.
203 *
204 * Z90STAT_REQUESTQ_COUNT
205 * Return an integer count of the number of entries waiting to be
206 * sent to a device.
207 *
208 * Z90STAT_PENDINGQ_COUNT
209 * Return an integer count of the number of entries sent to a
210 * device awaiting the reply.
211 *
212 * Z90STAT_TOTALOPEN_COUNT
213 * Return an integer count of the number of open file handles.
214 *
215 * Z90STAT_DOMAIN_INDEX
216 * Return the integer value of the Cryptographic Domain.
217 *
218 * Z90STAT_STATUS_MASK
219 * Return an 64 element array of unsigned chars for the status of
220 * all devices.
221 * 0x01: PCICA
222 * 0x02: PCICC
223 * 0x03: PCIXCC_MCL2
224 * 0x04: PCIXCC_MCL3
225 * 0x05: CEX2C
226 * 0x06: CEX2A
227 * 0x0d: device is disabled via the proc filesystem
228 *
229 * Z90STAT_QDEPTH_MASK
230 * Return an 64 element array of unsigned chars for the queue
231 * depth of all devices.
232 *
233 * Z90STAT_PERDEV_REQCNT
234 * Return an 64 element array of unsigned integers for the number
235 * of successfully completed requests per device since the device
236 * was detected and made available.
237 *
238 * ICAZ90STATUS (deprecated)
239 * Return some device driver status in a ica_z90_status struct
240 * This takes an ica_z90_status struct as its arg.
241 *
242 * NOTE: this ioctl() is deprecated, and has been replaced with
243 * single ioctl()s for each type of status being requested
244 *
245 * Z90STAT_PCIXCCCOUNT (deprecated)
246 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
247 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
248 * MCL2 PCIXCCs.
249 *
250 * Z90QUIESCE (not recommended)
251 * Quiesce the driver. This is intended to stop all new
252 * requests from being processed. Its use is NOT recommended,
253 * except in circumstances where there is no other way to stop
254 * callers from accessing the driver. Its original use was to
255 * allow the driver to be "drained" of work in preparation for
256 * a system shutdown.
257 *
258 * NOTE: once issued, this ban on new work cannot be undone
259 * except by unloading and reloading the driver.
260 */
261
262/**
263 * Supported ioctl calls
264 */
265#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
266#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
267#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
268
269/* New status calls */
270#define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
271#define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int)
272#define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int)
273#define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int)
274#define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int)
275#define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int)
276#define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int)
277#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
278#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
279#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
280#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
281#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
282#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
283#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
284
285#endif /* __ASM_S390_ZCRYPT_H */
diff --git a/include/asm-sparc/Kbuild b/include/asm-sparc/Kbuild
index e2a57fd7abfa..b22b67a64ecc 100644
--- a/include/asm-sparc/Kbuild
+++ b/include/asm-sparc/Kbuild
@@ -1,6 +1,22 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += fbio.h perfctr.h psr.h 3header-y += apc.h
4header-y += apc.h asi.h auxio.h bpp.h head.h ipc.h jsflash.h \ 4header-y += asi.h
5 openpromio.h pbm.h pconf.h pgtsun4.h reg.h traps.h \ 5header-y += auxio.h
6 turbosparc.h vfc_ioctls.h winmacro.h 6header-y += bpp.h
7header-y += head.h
8header-y += ipc.h
9header-y += jsflash.h
10header-y += openpromio.h
11header-y += pbm.h
12header-y += pconf.h
13header-y += pgtsun4.h
14header-y += reg.h
15header-y += traps.h
16header-y += turbosparc.h
17header-y += vfc_ioctls.h
18header-y += winmacro.h
19
20unifdef-y += fbio.h
21unifdef-y += perfctr.h
22unifdef-y += psr.h
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
index 9284c3cb27ec..4b59ce46cc2d 100644
--- a/include/asm-sparc64/Kbuild
+++ b/include/asm-sparc64/Kbuild
@@ -4,7 +4,26 @@ ALTARCH := sparc
4ARCHDEF := defined __sparc__ && defined __arch64__ 4ARCHDEF := defined __sparc__ && defined __arch64__
5ALTARCHDEF := defined __sparc__ && !defined __arch64__ 5ALTARCHDEF := defined __sparc__ && !defined __arch64__
6 6
7unifdef-y += fbio.h perfctr.h 7header-y += apb.h
8header-y += apb.h asi.h bbc.h bpp.h display7seg.h envctrl.h floppy.h \ 8header-y += asi.h
9 ipc.h kdebug.h mostek.h openprom.h openpromio.h parport.h \ 9header-y += bbc.h
10 pconf.h psrcompat.h pstate.h reg.h uctx.h utrap.h watchdog.h 10header-y += bpp.h
11header-y += display7seg.h
12header-y += envctrl.h
13header-y += floppy.h
14header-y += ipc.h
15header-y += kdebug.h
16header-y += mostek.h
17header-y += openprom.h
18header-y += openpromio.h
19header-y += parport.h
20header-y += pconf.h
21header-y += psrcompat.h
22header-y += pstate.h
23header-y += reg.h
24header-y += uctx.h
25header-y += utrap.h
26header-y += watchdog.h
27
28unifdef-y += fbio.h
29unifdef-y += perfctr.h
diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild
index dc4d101e8a16..40f2f13fe174 100644
--- a/include/asm-x86_64/Kbuild
+++ b/include/asm-x86_64/Kbuild
@@ -4,8 +4,18 @@ ALTARCH := i386
4ARCHDEF := defined __x86_64__ 4ARCHDEF := defined __x86_64__
5ALTARCHDEF := defined __i386__ 5ALTARCHDEF := defined __i386__
6 6
7header-y += boot.h bootsetup.h cpufeature.h debugreg.h ldt.h \ 7header-y += boot.h
8 msr.h prctl.h setup.h sigcontext32.h ucontext.h \ 8header-y += bootsetup.h
9 vsyscall32.h 9header-y += cpufeature.h
10header-y += debugreg.h
11header-y += ldt.h
12header-y += msr.h
13header-y += prctl.h
14header-y += setup.h
15header-y += sigcontext32.h
16header-y += ucontext.h
17header-y += vsyscall32.h
10 18
11unifdef-y += mce.h mtrr.h vsyscall.h 19unifdef-y += mce.h
20unifdef-y += mtrr.h
21unifdef-y += vsyscall.h
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
new file mode 100644
index 000000000000..5748aecdb414
--- /dev/null
+++ b/include/crypto/algapi.h
@@ -0,0 +1,156 @@
1/*
2 * Cryptographic API for algorithms (i.e., low-level API).
3 *
4 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12#ifndef _CRYPTO_ALGAPI_H
13#define _CRYPTO_ALGAPI_H
14
15#include <linux/crypto.h>
16
17struct module;
18struct seq_file;
19
20struct crypto_type {
21 unsigned int (*ctxsize)(struct crypto_alg *alg);
22 int (*init)(struct crypto_tfm *tfm);
23 void (*exit)(struct crypto_tfm *tfm);
24 void (*show)(struct seq_file *m, struct crypto_alg *alg);
25};
26
27struct crypto_instance {
28 struct crypto_alg alg;
29
30 struct crypto_template *tmpl;
31 struct hlist_node list;
32
33 void *__ctx[] CRYPTO_MINALIGN_ATTR;
34};
35
36struct crypto_template {
37 struct list_head list;
38 struct hlist_head instances;
39 struct module *module;
40
41 struct crypto_instance *(*alloc)(void *param, unsigned int len);
42 void (*free)(struct crypto_instance *inst);
43
44 char name[CRYPTO_MAX_ALG_NAME];
45};
46
47struct crypto_spawn {
48 struct list_head list;
49 struct crypto_alg *alg;
50 struct crypto_instance *inst;
51};
52
53struct scatter_walk {
54 struct scatterlist *sg;
55 unsigned int offset;
56};
57
58struct blkcipher_walk {
59 union {
60 struct {
61 struct page *page;
62 unsigned long offset;
63 } phys;
64
65 struct {
66 u8 *page;
67 u8 *addr;
68 } virt;
69 } src, dst;
70
71 struct scatter_walk in;
72 unsigned int nbytes;
73
74 struct scatter_walk out;
75 unsigned int total;
76
77 void *page;
78 u8 *buffer;
79 u8 *iv;
80
81 int flags;
82};
83
84extern const struct crypto_type crypto_blkcipher_type;
85extern const struct crypto_type crypto_hash_type;
86
87void crypto_mod_put(struct crypto_alg *alg);
88
89int crypto_register_template(struct crypto_template *tmpl);
90void crypto_unregister_template(struct crypto_template *tmpl);
91struct crypto_template *crypto_lookup_template(const char *name);
92
93int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
94 struct crypto_instance *inst);
95void crypto_drop_spawn(struct crypto_spawn *spawn);
96struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn);
97
98struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len,
99 u32 type, u32 mask);
100struct crypto_instance *crypto_alloc_instance(const char *name,
101 struct crypto_alg *alg);
102
103int blkcipher_walk_done(struct blkcipher_desc *desc,
104 struct blkcipher_walk *walk, int err);
105int blkcipher_walk_virt(struct blkcipher_desc *desc,
106 struct blkcipher_walk *walk);
107int blkcipher_walk_phys(struct blkcipher_desc *desc,
108 struct blkcipher_walk *walk);
109
110static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
111{
112 unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm);
113 unsigned long align = crypto_tfm_alg_alignmask(tfm);
114
115 if (align <= crypto_tfm_ctx_alignment())
116 align = 1;
117 return (void *)ALIGN(addr, align);
118}
119
120static inline void *crypto_instance_ctx(struct crypto_instance *inst)
121{
122 return inst->__ctx;
123}
124
125static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm)
126{
127 return crypto_tfm_ctx(&tfm->base);
128}
129
130static inline void *crypto_blkcipher_ctx_aligned(struct crypto_blkcipher *tfm)
131{
132 return crypto_tfm_ctx_aligned(&tfm->base);
133}
134
135static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm)
136{
137 return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher;
138}
139
140static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm)
141{
142 return crypto_tfm_ctx_aligned(&tfm->base);
143}
144
145static inline void blkcipher_walk_init(struct blkcipher_walk *walk,
146 struct scatterlist *dst,
147 struct scatterlist *src,
148 unsigned int nbytes)
149{
150 walk->in.sg = src;
151 walk->out.sg = dst;
152 walk->total = nbytes;
153}
154
155#endif /* _CRYPTO_ALGAPI_H */
156
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h
new file mode 100644
index 000000000000..c408522595c6
--- /dev/null
+++ b/include/crypto/twofish.h
@@ -0,0 +1,22 @@
1#ifndef _CRYPTO_TWOFISH_H
2#define _CRYPTO_TWOFISH_H
3
4#include <linux/types.h>
5
6#define TF_MIN_KEY_SIZE 16
7#define TF_MAX_KEY_SIZE 32
8#define TF_BLOCK_SIZE 16
9
10struct crypto_tfm;
11
12/* Structure for an expanded Twofish key. s contains the key-dependent
13 * S-boxes composed with the MDS matrix; w contains the eight "whitening"
14 * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note
15 * that k[i] corresponds to what the Twofish paper calls K[i+8]. */
16struct twofish_ctx {
17 u32 s[4][256], w[8], k[32];
18};
19
20int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len);
21
22#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2b8a7d68fae3..7d076d97b2f7 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,63 +1,343 @@
1header-y := byteorder/ dvb/ hdlc/ isdn/ nfsd/ raid/ sunrpc/ tc_act/ \ 1header-y += byteorder/
2 netfilter/ netfilter_arp/ netfilter_bridge/ netfilter_ipv4/ \ 2header-y += dvb/
3 netfilter_ipv6/ 3header-y += hdlc/
4header-y += isdn/
5header-y += nfsd/
6header-y += raid/
7header-y += sunrpc/
8header-y += tc_act/
9header-y += netfilter/
10header-y += netfilter_arp/
11header-y += netfilter_bridge/
12header-y += netfilter_ipv4/
13header-y += netfilter_ipv6/
4 14
5header-y += affs_fs.h affs_hardblocks.h aio_abi.h a.out.h arcfb.h \ 15header-y += affs_fs.h
6 atmapi.h atmbr2684.h atmclip.h atm_eni.h atm_he.h \ 16header-y += affs_hardblocks.h
7 atm_idt77105.h atmioc.h atmlec.h atmmpc.h atm_nicstar.h \ 17header-y += aio_abi.h
8 atmppp.h atmsap.h atmsvc.h atm_zatm.h auto_fs4.h auxvec.h \ 18header-y += a.out.h
9 awe_voice.h ax25.h b1lli.h baycom.h bfs_fs.h blkpg.h \ 19header-y += arcfb.h
10 bpqether.h cdk.h chio.h coda_psdev.h coff.h comstats.h \ 20header-y += atmapi.h
11 consolemap.h cycx_cfm.h dm-ioctl.h dn.h dqblk_v1.h \ 21header-y += atmbr2684.h
12 dqblk_v2.h dqblk_xfs.h efs_fs_sb.h elf-fdpic.h elf.h elf-em.h \ 22header-y += atmclip.h
13 fadvise.h fd.h fdreg.h ftape-header-segment.h ftape-vendors.h \ 23header-y += atm_eni.h
14 fuse.h futex.h genetlink.h gen_stats.h gigaset_dev.h hdsmart.h \ 24header-y += atm_he.h
15 hpfs_fs.h hysdn_if.h i2c-dev.h i8k.h icmp.h \ 25header-y += atm_idt77105.h
16 if_arcnet.h if_arp.h if_bonding.h if_cablemodem.h if_fc.h \ 26header-y += atmioc.h
17 if_fddi.h if.h if_hippi.h if_infiniband.h if_packet.h \ 27header-y += atmlec.h
18 if_plip.h if_ppp.h if_slip.h if_strip.h if_tunnel.h in6.h \ 28header-y += atmmpc.h
19 in_route.h ioctl.h ip.h ipmi_msgdefs.h ip_mp_alg.h ipsec.h \ 29header-y += atm_nicstar.h
20 ipx.h irda.h isdn_divertif.h iso_fs.h ite_gpio.h ixjuser.h \ 30header-y += atmppp.h
21 jffs2.h keyctl.h limits.h major.h matroxfb.h meye.h minix_fs.h \ 31header-y += atmsap.h
22 mmtimer.h mqueue.h mtio.h ncp_no.h netfilter_arp.h netrom.h \ 32header-y += atmsvc.h
23 nfs2.h nfs4_mount.h nfs_mount.h openprom_fs.h param.h \ 33header-y += atm_zatm.h
24 pci_ids.h pci_regs.h personality.h pfkeyv2.h pg.h pkt_cls.h \ 34header-y += auto_fs4.h
25 pkt_sched.h posix_types.h ppdev.h prctl.h ps2esdi.h qic117.h \ 35header-y += auxvec.h
26 qnxtypes.h quotaio_v1.h quotaio_v2.h radeonfb.h raw.h \ 36header-y += awe_voice.h
27 resource.h rose.h sctp.h smbno.h snmp.h sockios.h som.h \ 37header-y += ax25.h
28 sound.h stddef.h synclink.h telephony.h termios.h ticable.h \ 38header-y += b1lli.h
29 times.h tiocl.h tipc.h toshiba.h ultrasound.h un.h utime.h \ 39header-y += baycom.h
30 utsname.h video_decoder.h video_encoder.h videotext.h vt.h \ 40header-y += bfs_fs.h
31 wavefront.h wireless.h xattr.h x25.h zorro_ids.h 41header-y += blkpg.h
42header-y += bpqether.h
43header-y += cdk.h
44header-y += chio.h
45header-y += coda_psdev.h
46header-y += coff.h
47header-y += comstats.h
48header-y += consolemap.h
49header-y += cycx_cfm.h
50header-y += dm-ioctl.h
51header-y += dn.h
52header-y += dqblk_v1.h
53header-y += dqblk_v2.h
54header-y += dqblk_xfs.h
55header-y += efs_fs_sb.h
56header-y += elf-fdpic.h
57header-y += elf.h
58header-y += elf-em.h
59header-y += fadvise.h
60header-y += fd.h
61header-y += fdreg.h
62header-y += ftape-header-segment.h
63header-y += ftape-vendors.h
64header-y += fuse.h
65header-y += futex.h
66header-y += genetlink.h
67header-y += gen_stats.h
68header-y += gigaset_dev.h
69header-y += hdsmart.h
70header-y += hpfs_fs.h
71header-y += hysdn_if.h
72header-y += i2c-dev.h
73header-y += i8k.h
74header-y += icmp.h
75header-y += if_arcnet.h
76header-y += if_arp.h
77header-y += if_bonding.h
78header-y += if_cablemodem.h
79header-y += if_fc.h
80header-y += if_fddi.h
81header-y += if.h
82header-y += if_hippi.h
83header-y += if_infiniband.h
84header-y += if_packet.h
85header-y += if_plip.h
86header-y += if_ppp.h
87header-y += if_slip.h
88header-y += if_strip.h
89header-y += if_tunnel.h
90header-y += in6.h
91header-y += in_route.h
92header-y += ioctl.h
93header-y += ip.h
94header-y += ipmi_msgdefs.h
95header-y += ip_mp_alg.h
96header-y += ipsec.h
97header-y += ipx.h
98header-y += irda.h
99header-y += isdn_divertif.h
100header-y += iso_fs.h
101header-y += ite_gpio.h
102header-y += ixjuser.h
103header-y += jffs2.h
104header-y += keyctl.h
105header-y += limits.h
106header-y += major.h
107header-y += matroxfb.h
108header-y += meye.h
109header-y += minix_fs.h
110header-y += mmtimer.h
111header-y += mqueue.h
112header-y += mtio.h
113header-y += ncp_no.h
114header-y += netfilter_arp.h
115header-y += netrom.h
116header-y += nfs2.h
117header-y += nfs4_mount.h
118header-y += nfs_mount.h
119header-y += openprom_fs.h
120header-y += param.h
121header-y += pci_ids.h
122header-y += pci_regs.h
123header-y += personality.h
124header-y += pfkeyv2.h
125header-y += pg.h
126header-y += pkt_cls.h
127header-y += pkt_sched.h
128header-y += posix_types.h
129header-y += ppdev.h
130header-y += prctl.h
131header-y += ps2esdi.h
132header-y += qic117.h
133header-y += qnxtypes.h
134header-y += quotaio_v1.h
135header-y += quotaio_v2.h
136header-y += radeonfb.h
137header-y += raw.h
138header-y += resource.h
139header-y += rose.h
140header-y += sctp.h
141header-y += smbno.h
142header-y += snmp.h
143header-y += sockios.h
144header-y += som.h
145header-y += sound.h
146header-y += stddef.h
147header-y += synclink.h
148header-y += telephony.h
149header-y += termios.h
150header-y += ticable.h
151header-y += times.h
152header-y += tiocl.h
153header-y += tipc.h
154header-y += toshiba.h
155header-y += ultrasound.h
156header-y += un.h
157header-y += utime.h
158header-y += utsname.h
159header-y += video_decoder.h
160header-y += video_encoder.h
161header-y += videotext.h
162header-y += vt.h
163header-y += wavefront.h
164header-y += wireless.h
165header-y += xattr.h
166header-y += x25.h
167header-y += zorro_ids.h
32 168
33unifdef-y += acct.h adb.h adfs_fs.h agpgart.h apm_bios.h atalk.h \ 169unifdef-y += acct.h
34 atmarp.h atmdev.h atm.h atm_tcp.h audit.h auto_fs.h binfmts.h \ 170unifdef-y += adb.h
35 capability.h capi.h cciss_ioctl.h cdrom.h cm4000_cs.h \ 171unifdef-y += adfs_fs.h
36 cn_proc.h coda.h connector.h cramfs_fs.h cuda.h cyclades.h \ 172unifdef-y += agpgart.h
37 dccp.h dirent.h divert.h elfcore.h errno.h errqueue.h \ 173unifdef-y += apm_bios.h
38 ethtool.h eventpoll.h ext2_fs.h ext3_fs.h fb.h fcntl.h \ 174unifdef-y += atalk.h
39 filter.h flat.h fs.h ftape.h gameport.h generic_serial.h \ 175unifdef-y += atmarp.h
40 genhd.h hayesesp.h hdlcdrv.h hdlc.h hdreg.h hiddev.h hpet.h \ 176unifdef-y += atmdev.h
41 i2c.h i2o-dev.h icmpv6.h if_bridge.h if_ec.h \ 177unifdef-y += atm.h
42 if_eql.h if_ether.h if_frad.h if_ltalk.h if_pppox.h \ 178unifdef-y += atm_tcp.h
43 if_shaper.h if_tr.h if_tun.h if_vlan.h if_wanpipe.h igmp.h \ 179unifdef-y += audit.h
44 inet_diag.h in.h inotify.h input.h ipc.h ipmi.h ipv6.h \ 180unifdef-y += auto_fs.h
45 ipv6_route.h isdn.h isdnif.h isdn_ppp.h isicom.h jbd.h \ 181unifdef-y += binfmts.h
46 joystick.h kdev_t.h kd.h kernelcapi.h kernel.h keyboard.h \ 182unifdef-y += capability.h
47 llc.h loop.h lp.h mempolicy.h mii.h mman.h mroute.h msdos_fs.h \ 183unifdef-y += capi.h
48 msg.h nbd.h ncp_fs.h ncp.h ncp_mount.h netdevice.h \ 184unifdef-y += cciss_ioctl.h
49 netfilter_bridge.h netfilter_decnet.h netfilter.h \ 185unifdef-y += cdrom.h
50 netfilter_ipv4.h netfilter_ipv6.h netfilter_logging.h net.h \ 186unifdef-y += cm4000_cs.h
51 netlink.h nfs3.h nfs4.h nfsacl.h nfs_fs.h nfs.h nfs_idmap.h \ 187unifdef-y += cn_proc.h
52 n_r3964.h nubus.h nvram.h parport.h patchkey.h pci.h pktcdvd.h \ 188unifdef-y += coda.h
53 pmu.h poll.h ppp_defs.h ppp-comp.h ptrace.h qnx4_fs.h quota.h \ 189unifdef-y += connector.h
54 random.h reboot.h reiserfs_fs.h reiserfs_xattr.h romfs_fs.h \ 190unifdef-y += cramfs_fs.h
55 route.h rtc.h rtnetlink.h scc.h sched.h sdla.h \ 191unifdef-y += cuda.h
56 selinux_netlink.h sem.h serial_core.h serial.h serio.h shm.h \ 192unifdef-y += cyclades.h
57 signal.h smb_fs.h smb.h smb_mount.h socket.h sonet.h sonypi.h \ 193unifdef-y += dccp.h
58 soundcard.h stat.h sysctl.h tcp.h time.h timex.h tty.h types.h \ 194unifdef-y += dirent.h
59 udf_fs_i.h udp.h uinput.h uio.h unistd.h usb_ch9.h \ 195unifdef-y += divert.h
60 usbdevice_fs.h user.h videodev2.h videodev.h wait.h \ 196unifdef-y += elfcore.h
61 wanrouter.h watchdog.h xfrm.h zftape.h 197unifdef-y += errno.h
198unifdef-y += errqueue.h
199unifdef-y += ethtool.h
200unifdef-y += eventpoll.h
201unifdef-y += ext2_fs.h
202unifdef-y += ext3_fs.h
203unifdef-y += fb.h
204unifdef-y += fcntl.h
205unifdef-y += filter.h
206unifdef-y += flat.h
207unifdef-y += fs.h
208unifdef-y += ftape.h
209unifdef-y += gameport.h
210unifdef-y += generic_serial.h
211unifdef-y += genhd.h
212unifdef-y += hayesesp.h
213unifdef-y += hdlcdrv.h
214unifdef-y += hdlc.h
215unifdef-y += hdreg.h
216unifdef-y += hiddev.h
217unifdef-y += hpet.h
218unifdef-y += i2c.h
219unifdef-y += i2o-dev.h
220unifdef-y += icmpv6.h
221unifdef-y += if_bridge.h
222unifdef-y += if_ec.h
223unifdef-y += if_eql.h
224unifdef-y += if_ether.h
225unifdef-y += if_frad.h
226unifdef-y += if_ltalk.h
227unifdef-y += if_pppox.h
228unifdef-y += if_shaper.h
229unifdef-y += if_tr.h
230unifdef-y += if_tun.h
231unifdef-y += if_vlan.h
232unifdef-y += if_wanpipe.h
233unifdef-y += igmp.h
234unifdef-y += inet_diag.h
235unifdef-y += in.h
236unifdef-y += inotify.h
237unifdef-y += input.h
238unifdef-y += ipc.h
239unifdef-y += ipmi.h
240unifdef-y += ipv6.h
241unifdef-y += ipv6_route.h
242unifdef-y += isdn.h
243unifdef-y += isdnif.h
244unifdef-y += isdn_ppp.h
245unifdef-y += isicom.h
246unifdef-y += jbd.h
247unifdef-y += joystick.h
248unifdef-y += kdev_t.h
249unifdef-y += kd.h
250unifdef-y += kernelcapi.h
251unifdef-y += kernel.h
252unifdef-y += keyboard.h
253unifdef-y += llc.h
254unifdef-y += loop.h
255unifdef-y += lp.h
256unifdef-y += mempolicy.h
257unifdef-y += mii.h
258unifdef-y += mman.h
259unifdef-y += mroute.h
260unifdef-y += msdos_fs.h
261unifdef-y += msg.h
262unifdef-y += nbd.h
263unifdef-y += ncp_fs.h
264unifdef-y += ncp.h
265unifdef-y += ncp_mount.h
266unifdef-y += netdevice.h
267unifdef-y += netfilter_bridge.h
268unifdef-y += netfilter_decnet.h
269unifdef-y += netfilter.h
270unifdef-y += netfilter_ipv4.h
271unifdef-y += netfilter_ipv6.h
272unifdef-y += netfilter_logging.h
273unifdef-y += net.h
274unifdef-y += netlink.h
275unifdef-y += nfs3.h
276unifdef-y += nfs4.h
277unifdef-y += nfsacl.h
278unifdef-y += nfs_fs.h
279unifdef-y += nfs.h
280unifdef-y += nfs_idmap.h
281unifdef-y += n_r3964.h
282unifdef-y += nubus.h
283unifdef-y += nvram.h
284unifdef-y += parport.h
285unifdef-y += patchkey.h
286unifdef-y += pci.h
287unifdef-y += pktcdvd.h
288unifdef-y += pmu.h
289unifdef-y += poll.h
290unifdef-y += ppp_defs.h
291unifdef-y += ppp-comp.h
292unifdef-y += ptrace.h
293unifdef-y += qnx4_fs.h
294unifdef-y += quota.h
295unifdef-y += random.h
296unifdef-y += reboot.h
297unifdef-y += reiserfs_fs.h
298unifdef-y += reiserfs_xattr.h
299unifdef-y += romfs_fs.h
300unifdef-y += route.h
301unifdef-y += rtc.h
302unifdef-y += rtnetlink.h
303unifdef-y += scc.h
304unifdef-y += sched.h
305unifdef-y += sdla.h
306unifdef-y += selinux_netlink.h
307unifdef-y += sem.h
308unifdef-y += serial_core.h
309unifdef-y += serial.h
310unifdef-y += serio.h
311unifdef-y += shm.h
312unifdef-y += signal.h
313unifdef-y += smb_fs.h
314unifdef-y += smb.h
315unifdef-y += smb_mount.h
316unifdef-y += socket.h
317unifdef-y += sonet.h
318unifdef-y += sonypi.h
319unifdef-y += soundcard.h
320unifdef-y += stat.h
321unifdef-y += sysctl.h
322unifdef-y += tcp.h
323unifdef-y += time.h
324unifdef-y += timex.h
325unifdef-y += tty.h
326unifdef-y += types.h
327unifdef-y += udf_fs_i.h
328unifdef-y += udp.h
329unifdef-y += uinput.h
330unifdef-y += uio.h
331unifdef-y += unistd.h
332unifdef-y += usb_ch9.h
333unifdef-y += usbdevice_fs.h
334unifdef-y += user.h
335unifdef-y += videodev2.h
336unifdef-y += videodev.h
337unifdef-y += wait.h
338unifdef-y += wanrouter.h
339unifdef-y += watchdog.h
340unifdef-y += xfrm.h
341unifdef-y += zftape.h
62 342
63objhdr-y := version.h 343objhdr-y += version.h
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 84a57d4fb212..56499ab9e32e 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,2 +1,7 @@
1unifdef-y += generic.h swabb.h swab.h 1header-y += big_endian.h
2header-y += big_endian.h little_endian.h pdp_endian.h 2header-y += little_endian.h
3header-y += pdp_endian.h
4
5unifdef-y += generic.h
6unifdef-y += swabb.h
7unifdef-y += swab.h
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 7f946241b879..8f2ffa4caabf 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -17,20 +17,36 @@
17#ifndef _LINUX_CRYPTO_H 17#ifndef _LINUX_CRYPTO_H
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <asm/atomic.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/slab.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <asm/page.h> 26#include <linux/uaccess.h>
26 27
27/* 28/*
28 * Algorithm masks and types. 29 * Algorithm masks and types.
29 */ 30 */
30#define CRYPTO_ALG_TYPE_MASK 0x000000ff 31#define CRYPTO_ALG_TYPE_MASK 0x0000000f
31#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001
32#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
33#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005
37
38#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
39
40#define CRYPTO_ALG_LARVAL 0x00000010
41#define CRYPTO_ALG_DEAD 0x00000020
42#define CRYPTO_ALG_DYING 0x00000040
43#define CRYPTO_ALG_ASYNC 0x00000080
44
45/*
46 * Set this bit if and only if the algorithm requires another algorithm of
47 * the same type to handle corner cases.
48 */
49#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
34 50
35/* 51/*
36 * Transform masks and values (for crt_flags). 52 * Transform masks and values (for crt_flags).
@@ -61,8 +77,37 @@
61#define CRYPTO_DIR_ENCRYPT 1 77#define CRYPTO_DIR_ENCRYPT 1
62#define CRYPTO_DIR_DECRYPT 0 78#define CRYPTO_DIR_DECRYPT 0
63 79
80/*
81 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
82 * declaration) is used to ensure that the crypto_tfm context structure is
83 * aligned correctly for the given architecture so that there are no alignment
84 * faults for C data types. In particular, this is required on platforms such
85 * as arm where pointers are 32-bit aligned but there are data types such as
86 * u64 which require 64-bit alignment.
87 */
88#if defined(ARCH_KMALLOC_MINALIGN)
89#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
90#elif defined(ARCH_SLAB_MINALIGN)
91#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
92#endif
93
94#ifdef CRYPTO_MINALIGN
95#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
96#else
97#define CRYPTO_MINALIGN_ATTR
98#endif
99
64struct scatterlist; 100struct scatterlist;
101struct crypto_blkcipher;
102struct crypto_hash;
65struct crypto_tfm; 103struct crypto_tfm;
104struct crypto_type;
105
106struct blkcipher_desc {
107 struct crypto_blkcipher *tfm;
108 void *info;
109 u32 flags;
110};
66 111
67struct cipher_desc { 112struct cipher_desc {
68 struct crypto_tfm *tfm; 113 struct crypto_tfm *tfm;
@@ -72,30 +117,50 @@ struct cipher_desc {
72 void *info; 117 void *info;
73}; 118};
74 119
120struct hash_desc {
121 struct crypto_hash *tfm;
122 u32 flags;
123};
124
75/* 125/*
76 * Algorithms: modular crypto algorithm implementations, managed 126 * Algorithms: modular crypto algorithm implementations, managed
77 * via crypto_register_alg() and crypto_unregister_alg(). 127 * via crypto_register_alg() and crypto_unregister_alg().
78 */ 128 */
129struct blkcipher_alg {
130 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
131 unsigned int keylen);
132 int (*encrypt)(struct blkcipher_desc *desc,
133 struct scatterlist *dst, struct scatterlist *src,
134 unsigned int nbytes);
135 int (*decrypt)(struct blkcipher_desc *desc,
136 struct scatterlist *dst, struct scatterlist *src,
137 unsigned int nbytes);
138
139 unsigned int min_keysize;
140 unsigned int max_keysize;
141 unsigned int ivsize;
142};
143
79struct cipher_alg { 144struct cipher_alg {
80 unsigned int cia_min_keysize; 145 unsigned int cia_min_keysize;
81 unsigned int cia_max_keysize; 146 unsigned int cia_max_keysize;
82 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key, 147 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
83 unsigned int keylen, u32 *flags); 148 unsigned int keylen);
84 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 149 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
85 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 150 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
86 151
87 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, 152 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
88 u8 *dst, const u8 *src, 153 u8 *dst, const u8 *src,
89 unsigned int nbytes); 154 unsigned int nbytes) __deprecated;
90 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, 155 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
91 u8 *dst, const u8 *src, 156 u8 *dst, const u8 *src,
92 unsigned int nbytes); 157 unsigned int nbytes) __deprecated;
93 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, 158 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
94 u8 *dst, const u8 *src, 159 u8 *dst, const u8 *src,
95 unsigned int nbytes); 160 unsigned int nbytes) __deprecated;
96 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, 161 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
97 u8 *dst, const u8 *src, 162 u8 *dst, const u8 *src,
98 unsigned int nbytes); 163 unsigned int nbytes) __deprecated;
99}; 164};
100 165
101struct digest_alg { 166struct digest_alg {
@@ -105,7 +170,20 @@ struct digest_alg {
105 unsigned int len); 170 unsigned int len);
106 void (*dia_final)(struct crypto_tfm *tfm, u8 *out); 171 void (*dia_final)(struct crypto_tfm *tfm, u8 *out);
107 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key, 172 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key,
108 unsigned int keylen, u32 *flags); 173 unsigned int keylen);
174};
175
176struct hash_alg {
177 int (*init)(struct hash_desc *desc);
178 int (*update)(struct hash_desc *desc, struct scatterlist *sg,
179 unsigned int nbytes);
180 int (*final)(struct hash_desc *desc, u8 *out);
181 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
182 unsigned int nbytes, u8 *out);
183 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
184 unsigned int keylen);
185
186 unsigned int digestsize;
109}; 187};
110 188
111struct compress_alg { 189struct compress_alg {
@@ -115,30 +193,40 @@ struct compress_alg {
115 unsigned int slen, u8 *dst, unsigned int *dlen); 193 unsigned int slen, u8 *dst, unsigned int *dlen);
116}; 194};
117 195
196#define cra_blkcipher cra_u.blkcipher
118#define cra_cipher cra_u.cipher 197#define cra_cipher cra_u.cipher
119#define cra_digest cra_u.digest 198#define cra_digest cra_u.digest
199#define cra_hash cra_u.hash
120#define cra_compress cra_u.compress 200#define cra_compress cra_u.compress
121 201
122struct crypto_alg { 202struct crypto_alg {
123 struct list_head cra_list; 203 struct list_head cra_list;
204 struct list_head cra_users;
205
124 u32 cra_flags; 206 u32 cra_flags;
125 unsigned int cra_blocksize; 207 unsigned int cra_blocksize;
126 unsigned int cra_ctxsize; 208 unsigned int cra_ctxsize;
127 unsigned int cra_alignmask; 209 unsigned int cra_alignmask;
128 210
129 int cra_priority; 211 int cra_priority;
212 atomic_t cra_refcnt;
130 213
131 char cra_name[CRYPTO_MAX_ALG_NAME]; 214 char cra_name[CRYPTO_MAX_ALG_NAME];
132 char cra_driver_name[CRYPTO_MAX_ALG_NAME]; 215 char cra_driver_name[CRYPTO_MAX_ALG_NAME];
133 216
217 const struct crypto_type *cra_type;
218
134 union { 219 union {
220 struct blkcipher_alg blkcipher;
135 struct cipher_alg cipher; 221 struct cipher_alg cipher;
136 struct digest_alg digest; 222 struct digest_alg digest;
223 struct hash_alg hash;
137 struct compress_alg compress; 224 struct compress_alg compress;
138 } cra_u; 225 } cra_u;
139 226
140 int (*cra_init)(struct crypto_tfm *tfm); 227 int (*cra_init)(struct crypto_tfm *tfm);
141 void (*cra_exit)(struct crypto_tfm *tfm); 228 void (*cra_exit)(struct crypto_tfm *tfm);
229 void (*cra_destroy)(struct crypto_alg *alg);
142 230
143 struct module *cra_module; 231 struct module *cra_module;
144}; 232};
@@ -153,20 +241,39 @@ int crypto_unregister_alg(struct crypto_alg *alg);
153 * Algorithm query interface. 241 * Algorithm query interface.
154 */ 242 */
155#ifdef CONFIG_CRYPTO 243#ifdef CONFIG_CRYPTO
156int crypto_alg_available(const char *name, u32 flags); 244int crypto_alg_available(const char *name, u32 flags)
245 __deprecated_for_modules;
246int crypto_has_alg(const char *name, u32 type, u32 mask);
157#else 247#else
248static int crypto_alg_available(const char *name, u32 flags);
249 __deprecated_for_modules;
158static inline int crypto_alg_available(const char *name, u32 flags) 250static inline int crypto_alg_available(const char *name, u32 flags)
159{ 251{
160 return 0; 252 return 0;
161} 253}
254
255static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
256{
257 return 0;
258}
162#endif 259#endif
163 260
164/* 261/*
165 * Transforms: user-instantiated objects which encapsulate algorithms 262 * Transforms: user-instantiated objects which encapsulate algorithms
166 * and core processing logic. Managed via crypto_alloc_tfm() and 263 * and core processing logic. Managed via crypto_alloc_*() and
167 * crypto_free_tfm(), as well as the various helpers below. 264 * crypto_free_*(), as well as the various helpers below.
168 */ 265 */
169 266
267struct blkcipher_tfm {
268 void *iv;
269 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
270 unsigned int keylen);
271 int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
272 struct scatterlist *src, unsigned int nbytes);
273 int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst,
274 struct scatterlist *src, unsigned int nbytes);
275};
276
170struct cipher_tfm { 277struct cipher_tfm {
171 void *cit_iv; 278 void *cit_iv;
172 unsigned int cit_ivsize; 279 unsigned int cit_ivsize;
@@ -190,20 +297,20 @@ struct cipher_tfm {
190 struct scatterlist *src, 297 struct scatterlist *src,
191 unsigned int nbytes, u8 *iv); 298 unsigned int nbytes, u8 *iv);
192 void (*cit_xor_block)(u8 *dst, const u8 *src); 299 void (*cit_xor_block)(u8 *dst, const u8 *src);
300 void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
301 void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
193}; 302};
194 303
195struct digest_tfm { 304struct hash_tfm {
196 void (*dit_init)(struct crypto_tfm *tfm); 305 int (*init)(struct hash_desc *desc);
197 void (*dit_update)(struct crypto_tfm *tfm, 306 int (*update)(struct hash_desc *desc,
198 struct scatterlist *sg, unsigned int nsg); 307 struct scatterlist *sg, unsigned int nsg);
199 void (*dit_final)(struct crypto_tfm *tfm, u8 *out); 308 int (*final)(struct hash_desc *desc, u8 *out);
200 void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, 309 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
201 unsigned int nsg, u8 *out); 310 unsigned int nsg, u8 *out);
202 int (*dit_setkey)(struct crypto_tfm *tfm, 311 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
203 const u8 *key, unsigned int keylen); 312 unsigned int keylen);
204#ifdef CONFIG_CRYPTO_HMAC 313 unsigned int digestsize;
205 void *dit_hmac_block;
206#endif
207}; 314};
208 315
209struct compress_tfm { 316struct compress_tfm {
@@ -215,8 +322,9 @@ struct compress_tfm {
215 u8 *dst, unsigned int *dlen); 322 u8 *dst, unsigned int *dlen);
216}; 323};
217 324
325#define crt_blkcipher crt_u.blkcipher
218#define crt_cipher crt_u.cipher 326#define crt_cipher crt_u.cipher
219#define crt_digest crt_u.digest 327#define crt_hash crt_u.hash
220#define crt_compress crt_u.compress 328#define crt_compress crt_u.compress
221 329
222struct crypto_tfm { 330struct crypto_tfm {
@@ -224,30 +332,43 @@ struct crypto_tfm {
224 u32 crt_flags; 332 u32 crt_flags;
225 333
226 union { 334 union {
335 struct blkcipher_tfm blkcipher;
227 struct cipher_tfm cipher; 336 struct cipher_tfm cipher;
228 struct digest_tfm digest; 337 struct hash_tfm hash;
229 struct compress_tfm compress; 338 struct compress_tfm compress;
230 } crt_u; 339 } crt_u;
231 340
232 struct crypto_alg *__crt_alg; 341 struct crypto_alg *__crt_alg;
233 342
234 char __crt_ctx[] __attribute__ ((__aligned__)); 343 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
344};
345
346#define crypto_cipher crypto_tfm
347#define crypto_comp crypto_tfm
348
349struct crypto_blkcipher {
350 struct crypto_tfm base;
351};
352
353struct crypto_hash {
354 struct crypto_tfm base;
355};
356
357enum {
358 CRYPTOA_UNSPEC,
359 CRYPTOA_ALG,
360};
361
362struct crypto_attr_alg {
363 char name[CRYPTO_MAX_ALG_NAME];
235}; 364};
236 365
237/* 366/*
238 * Transform user interface. 367 * Transform user interface.
239 */ 368 */
240 369
241/*
242 * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm.
243 * If that fails and the kernel supports dynamically loadable modules, it
244 * will then attempt to load a module of the same name or alias. A refcount
245 * is grabbed on the algorithm which is then associated with the new transform.
246 *
247 * crypto_free_tfm() frees up the transform and any associated resources,
248 * then drops the refcount on the associated algorithm.
249 */
250struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 370struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
371struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
251void crypto_free_tfm(struct crypto_tfm *tfm); 372void crypto_free_tfm(struct crypto_tfm *tfm);
252 373
253/* 374/*
@@ -258,6 +379,16 @@ static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
258 return tfm->__crt_alg->cra_name; 379 return tfm->__crt_alg->cra_name;
259} 380}
260 381
382static inline const char *crypto_tfm_alg_driver_name(struct crypto_tfm *tfm)
383{
384 return tfm->__crt_alg->cra_driver_name;
385}
386
387static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm)
388{
389 return tfm->__crt_alg->cra_priority;
390}
391
261static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) 392static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
262{ 393{
263 return module_name(tfm->__crt_alg->cra_module); 394 return module_name(tfm->__crt_alg->cra_module);
@@ -268,18 +399,23 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
268 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 399 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
269} 400}
270 401
402static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
403 __deprecated;
271static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) 404static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
272{ 405{
273 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 406 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
274 return tfm->__crt_alg->cra_cipher.cia_min_keysize; 407 return tfm->__crt_alg->cra_cipher.cia_min_keysize;
275} 408}
276 409
410static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
411 __deprecated;
277static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) 412static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
278{ 413{
279 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 414 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
280 return tfm->__crt_alg->cra_cipher.cia_max_keysize; 415 return tfm->__crt_alg->cra_cipher.cia_max_keysize;
281} 416}
282 417
418static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated;
283static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) 419static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
284{ 420{
285 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 421 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
@@ -302,6 +438,21 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
302 return tfm->__crt_alg->cra_alignmask; 438 return tfm->__crt_alg->cra_alignmask;
303} 439}
304 440
441static inline u32 crypto_tfm_get_flags(struct crypto_tfm *tfm)
442{
443 return tfm->crt_flags;
444}
445
446static inline void crypto_tfm_set_flags(struct crypto_tfm *tfm, u32 flags)
447{
448 tfm->crt_flags |= flags;
449}
450
451static inline void crypto_tfm_clear_flags(struct crypto_tfm *tfm, u32 flags)
452{
453 tfm->crt_flags &= ~flags;
454}
455
305static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) 456static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
306{ 457{
307 return tfm->__crt_ctx; 458 return tfm->__crt_ctx;
@@ -316,50 +467,374 @@ static inline unsigned int crypto_tfm_ctx_alignment(void)
316/* 467/*
317 * API wrappers. 468 * API wrappers.
318 */ 469 */
319static inline void crypto_digest_init(struct crypto_tfm *tfm) 470static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
471 struct crypto_tfm *tfm)
320{ 472{
321 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 473 return (struct crypto_blkcipher *)tfm;
322 tfm->crt_digest.dit_init(tfm);
323} 474}
324 475
325static inline void crypto_digest_update(struct crypto_tfm *tfm, 476static inline struct crypto_blkcipher *crypto_blkcipher_cast(
326 struct scatterlist *sg, 477 struct crypto_tfm *tfm)
327 unsigned int nsg)
328{ 478{
329 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 479 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER);
330 tfm->crt_digest.dit_update(tfm, sg, nsg); 480 return __crypto_blkcipher_cast(tfm);
331} 481}
332 482
333static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) 483static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
484 const char *alg_name, u32 type, u32 mask)
334{ 485{
335 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 486 type &= ~CRYPTO_ALG_TYPE_MASK;
336 tfm->crt_digest.dit_final(tfm, out); 487 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
488 mask |= CRYPTO_ALG_TYPE_MASK;
489
490 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
337} 491}
338 492
339static inline void crypto_digest_digest(struct crypto_tfm *tfm, 493static inline struct crypto_tfm *crypto_blkcipher_tfm(
340 struct scatterlist *sg, 494 struct crypto_blkcipher *tfm)
341 unsigned int nsg, u8 *out)
342{ 495{
343 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 496 return &tfm->base;
344 tfm->crt_digest.dit_digest(tfm, sg, nsg, out);
345} 497}
346 498
347static inline int crypto_digest_setkey(struct crypto_tfm *tfm, 499static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
500{
501 crypto_free_tfm(crypto_blkcipher_tfm(tfm));
502}
503
504static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
505{
506 type &= ~CRYPTO_ALG_TYPE_MASK;
507 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
508 mask |= CRYPTO_ALG_TYPE_MASK;
509
510 return crypto_has_alg(alg_name, type, mask);
511}
512
513static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm)
514{
515 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm));
516}
517
518static inline struct blkcipher_tfm *crypto_blkcipher_crt(
519 struct crypto_blkcipher *tfm)
520{
521 return &crypto_blkcipher_tfm(tfm)->crt_blkcipher;
522}
523
524static inline struct blkcipher_alg *crypto_blkcipher_alg(
525 struct crypto_blkcipher *tfm)
526{
527 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher;
528}
529
530static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm)
531{
532 return crypto_blkcipher_alg(tfm)->ivsize;
533}
534
535static inline unsigned int crypto_blkcipher_blocksize(
536 struct crypto_blkcipher *tfm)
537{
538 return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm));
539}
540
541static inline unsigned int crypto_blkcipher_alignmask(
542 struct crypto_blkcipher *tfm)
543{
544 return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm));
545}
546
547static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm)
548{
549 return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm));
550}
551
552static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm,
553 u32 flags)
554{
555 crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags);
556}
557
558static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm,
559 u32 flags)
560{
561 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags);
562}
563
564static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
565 const u8 *key, unsigned int keylen)
566{
567 return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm),
568 key, keylen);
569}
570
571static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
572 struct scatterlist *dst,
573 struct scatterlist *src,
574 unsigned int nbytes)
575{
576 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
577 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
578}
579
580static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
581 struct scatterlist *dst,
582 struct scatterlist *src,
583 unsigned int nbytes)
584{
585 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
586}
587
588static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
589 struct scatterlist *dst,
590 struct scatterlist *src,
591 unsigned int nbytes)
592{
593 desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
594 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
595}
596
597static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
598 struct scatterlist *dst,
599 struct scatterlist *src,
600 unsigned int nbytes)
601{
602 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
603}
604
605static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm,
606 const u8 *src, unsigned int len)
607{
608 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len);
609}
610
611static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm,
612 u8 *dst, unsigned int len)
613{
614 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len);
615}
616
617static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm)
618{
619 return (struct crypto_cipher *)tfm;
620}
621
622static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm)
623{
624 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
625 return __crypto_cipher_cast(tfm);
626}
627
628static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
629 u32 type, u32 mask)
630{
631 type &= ~CRYPTO_ALG_TYPE_MASK;
632 type |= CRYPTO_ALG_TYPE_CIPHER;
633 mask |= CRYPTO_ALG_TYPE_MASK;
634
635 return __crypto_cipher_cast(crypto_alloc_base(alg_name, type, mask));
636}
637
638static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
639{
640 return tfm;
641}
642
643static inline void crypto_free_cipher(struct crypto_cipher *tfm)
644{
645 crypto_free_tfm(crypto_cipher_tfm(tfm));
646}
647
648static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask)
649{
650 type &= ~CRYPTO_ALG_TYPE_MASK;
651 type |= CRYPTO_ALG_TYPE_CIPHER;
652 mask |= CRYPTO_ALG_TYPE_MASK;
653
654 return crypto_has_alg(alg_name, type, mask);
655}
656
657static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm)
658{
659 return &crypto_cipher_tfm(tfm)->crt_cipher;
660}
661
662static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm)
663{
664 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm));
665}
666
667static inline unsigned int crypto_cipher_alignmask(struct crypto_cipher *tfm)
668{
669 return crypto_tfm_alg_alignmask(crypto_cipher_tfm(tfm));
670}
671
672static inline u32 crypto_cipher_get_flags(struct crypto_cipher *tfm)
673{
674 return crypto_tfm_get_flags(crypto_cipher_tfm(tfm));
675}
676
677static inline void crypto_cipher_set_flags(struct crypto_cipher *tfm,
678 u32 flags)
679{
680 crypto_tfm_set_flags(crypto_cipher_tfm(tfm), flags);
681}
682
683static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
684 u32 flags)
685{
686 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
687}
688
689static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
348 const u8 *key, unsigned int keylen) 690 const u8 *key, unsigned int keylen)
349{ 691{
350 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); 692 return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm),
351 if (tfm->crt_digest.dit_setkey == NULL) 693 key, keylen);
352 return -ENOSYS; 694}
353 return tfm->crt_digest.dit_setkey(tfm, key, keylen); 695
696static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
697 u8 *dst, const u8 *src)
698{
699 crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
700 dst, src);
701}
702
703static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
704 u8 *dst, const u8 *src)
705{
706 crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm),
707 dst, src);
708}
709
710void crypto_digest_init(struct crypto_tfm *tfm) __deprecated_for_modules;
711void crypto_digest_update(struct crypto_tfm *tfm,
712 struct scatterlist *sg, unsigned int nsg)
713 __deprecated_for_modules;
714void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
715 __deprecated_for_modules;
716void crypto_digest_digest(struct crypto_tfm *tfm,
717 struct scatterlist *sg, unsigned int nsg, u8 *out)
718 __deprecated_for_modules;
719
720static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
721{
722 return (struct crypto_hash *)tfm;
723}
724
725static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm)
726{
727 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_HASH) &
728 CRYPTO_ALG_TYPE_HASH_MASK);
729 return __crypto_hash_cast(tfm);
354} 730}
355 731
356static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, 732static int crypto_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
733 unsigned int keylen) __deprecated;
734static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
357 const u8 *key, unsigned int keylen) 735 const u8 *key, unsigned int keylen)
358{ 736{
359 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 737 return tfm->crt_hash.setkey(crypto_hash_cast(tfm), key, keylen);
360 return tfm->crt_cipher.cit_setkey(tfm, key, keylen); 738}
739
740static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
741 u32 type, u32 mask)
742{
743 type &= ~CRYPTO_ALG_TYPE_MASK;
744 type |= CRYPTO_ALG_TYPE_HASH;
745 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
746
747 return __crypto_hash_cast(crypto_alloc_base(alg_name, type, mask));
748}
749
750static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
751{
752 return &tfm->base;
753}
754
755static inline void crypto_free_hash(struct crypto_hash *tfm)
756{
757 crypto_free_tfm(crypto_hash_tfm(tfm));
758}
759
760static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
761{
762 type &= ~CRYPTO_ALG_TYPE_MASK;
763 type |= CRYPTO_ALG_TYPE_HASH;
764 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
765
766 return crypto_has_alg(alg_name, type, mask);
767}
768
769static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm)
770{
771 return &crypto_hash_tfm(tfm)->crt_hash;
772}
773
774static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm)
775{
776 return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm));
777}
778
779static inline unsigned int crypto_hash_alignmask(struct crypto_hash *tfm)
780{
781 return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm));
782}
783
784static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm)
785{
786 return crypto_hash_crt(tfm)->digestsize;
787}
788
789static inline u32 crypto_hash_get_flags(struct crypto_hash *tfm)
790{
791 return crypto_tfm_get_flags(crypto_hash_tfm(tfm));
792}
793
794static inline void crypto_hash_set_flags(struct crypto_hash *tfm, u32 flags)
795{
796 crypto_tfm_set_flags(crypto_hash_tfm(tfm), flags);
361} 797}
362 798
799static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags)
800{
801 crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags);
802}
803
804static inline int crypto_hash_init(struct hash_desc *desc)
805{
806 return crypto_hash_crt(desc->tfm)->init(desc);
807}
808
809static inline int crypto_hash_update(struct hash_desc *desc,
810 struct scatterlist *sg,
811 unsigned int nbytes)
812{
813 return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
814}
815
816static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
817{
818 return crypto_hash_crt(desc->tfm)->final(desc, out);
819}
820
821static inline int crypto_hash_digest(struct hash_desc *desc,
822 struct scatterlist *sg,
823 unsigned int nbytes, u8 *out)
824{
825 return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
826}
827
828static inline int crypto_hash_setkey(struct crypto_hash *hash,
829 const u8 *key, unsigned int keylen)
830{
831 return crypto_hash_crt(hash)->setkey(hash, key, keylen);
832}
833
834static int crypto_cipher_encrypt(struct crypto_tfm *tfm,
835 struct scatterlist *dst,
836 struct scatterlist *src,
837 unsigned int nbytes) __deprecated;
363static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, 838static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
364 struct scatterlist *dst, 839 struct scatterlist *dst,
365 struct scatterlist *src, 840 struct scatterlist *src,
@@ -369,16 +844,23 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
369 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); 844 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
370} 845}
371 846
847static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
848 struct scatterlist *dst,
849 struct scatterlist *src,
850 unsigned int nbytes, u8 *iv) __deprecated;
372static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, 851static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
373 struct scatterlist *dst, 852 struct scatterlist *dst,
374 struct scatterlist *src, 853 struct scatterlist *src,
375 unsigned int nbytes, u8 *iv) 854 unsigned int nbytes, u8 *iv)
376{ 855{
377 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 856 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
378 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
379 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); 857 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
380} 858}
381 859
860static int crypto_cipher_decrypt(struct crypto_tfm *tfm,
861 struct scatterlist *dst,
862 struct scatterlist *src,
863 unsigned int nbytes) __deprecated;
382static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, 864static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
383 struct scatterlist *dst, 865 struct scatterlist *dst,
384 struct scatterlist *src, 866 struct scatterlist *src,
@@ -388,16 +870,21 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
388 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); 870 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
389} 871}
390 872
873static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
874 struct scatterlist *dst,
875 struct scatterlist *src,
876 unsigned int nbytes, u8 *iv) __deprecated;
391static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, 877static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
392 struct scatterlist *dst, 878 struct scatterlist *dst,
393 struct scatterlist *src, 879 struct scatterlist *src,
394 unsigned int nbytes, u8 *iv) 880 unsigned int nbytes, u8 *iv)
395{ 881{
396 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); 882 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
397 BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
398 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); 883 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
399} 884}
400 885
886static void crypto_cipher_set_iv(struct crypto_tfm *tfm,
887 const u8 *src, unsigned int len) __deprecated;
401static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, 888static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
402 const u8 *src, unsigned int len) 889 const u8 *src, unsigned int len)
403{ 890{
@@ -405,6 +892,8 @@ static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
405 memcpy(tfm->crt_cipher.cit_iv, src, len); 892 memcpy(tfm->crt_cipher.cit_iv, src, len);
406} 893}
407 894
895static void crypto_cipher_get_iv(struct crypto_tfm *tfm,
896 u8 *dst, unsigned int len) __deprecated;
408static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, 897static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
409 u8 *dst, unsigned int len) 898 u8 *dst, unsigned int len)
410{ 899{
@@ -412,34 +901,70 @@ static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
412 memcpy(dst, tfm->crt_cipher.cit_iv, len); 901 memcpy(dst, tfm->crt_cipher.cit_iv, len);
413} 902}
414 903
415static inline int crypto_comp_compress(struct crypto_tfm *tfm, 904static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
905{
906 return (struct crypto_comp *)tfm;
907}
908
909static inline struct crypto_comp *crypto_comp_cast(struct crypto_tfm *tfm)
910{
911 BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_COMPRESS) &
912 CRYPTO_ALG_TYPE_MASK);
913 return __crypto_comp_cast(tfm);
914}
915
916static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
917 u32 type, u32 mask)
918{
919 type &= ~CRYPTO_ALG_TYPE_MASK;
920 type |= CRYPTO_ALG_TYPE_COMPRESS;
921 mask |= CRYPTO_ALG_TYPE_MASK;
922
923 return __crypto_comp_cast(crypto_alloc_base(alg_name, type, mask));
924}
925
926static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
927{
928 return tfm;
929}
930
931static inline void crypto_free_comp(struct crypto_comp *tfm)
932{
933 crypto_free_tfm(crypto_comp_tfm(tfm));
934}
935
936static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask)
937{
938 type &= ~CRYPTO_ALG_TYPE_MASK;
939 type |= CRYPTO_ALG_TYPE_COMPRESS;
940 mask |= CRYPTO_ALG_TYPE_MASK;
941
942 return crypto_has_alg(alg_name, type, mask);
943}
944
945static inline const char *crypto_comp_name(struct crypto_comp *tfm)
946{
947 return crypto_tfm_alg_name(crypto_comp_tfm(tfm));
948}
949
950static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm)
951{
952 return &crypto_comp_tfm(tfm)->crt_compress;
953}
954
955static inline int crypto_comp_compress(struct crypto_comp *tfm,
416 const u8 *src, unsigned int slen, 956 const u8 *src, unsigned int slen,
417 u8 *dst, unsigned int *dlen) 957 u8 *dst, unsigned int *dlen)
418{ 958{
419 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 959 return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen);
420 return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen);
421} 960}
422 961
423static inline int crypto_comp_decompress(struct crypto_tfm *tfm, 962static inline int crypto_comp_decompress(struct crypto_comp *tfm,
424 const u8 *src, unsigned int slen, 963 const u8 *src, unsigned int slen,
425 u8 *dst, unsigned int *dlen) 964 u8 *dst, unsigned int *dlen)
426{ 965{
427 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); 966 return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen);
428 return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen);
429} 967}
430 968
431/*
432 * HMAC support.
433 */
434#ifdef CONFIG_CRYPTO_HMAC
435void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen);
436void crypto_hmac_update(struct crypto_tfm *tfm,
437 struct scatterlist *sg, unsigned int nsg);
438void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
439 unsigned int *keylen, u8 *out);
440void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen,
441 struct scatterlist *sg, unsigned int nsg, u8 *out);
442#endif /* CONFIG_CRYPTO_HMAC */
443
444#endif /* _LINUX_CRYPTO_H */ 969#endif /* _LINUX_CRYPTO_H */
445 970
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
index 63973af72fd5..d97b3a51e227 100644
--- a/include/linux/dvb/Kbuild
+++ b/include/linux/dvb/Kbuild
@@ -1,2 +1,9 @@
1header-y += ca.h frontend.h net.h osd.h version.h 1header-y += ca.h
2unifdef-y := audio.h dmx.h video.h 2header-y += frontend.h
3header-y += net.h
4header-y += osd.h
5header-y += version.h
6
7unifdef-y += audio.h
8unifdef-y += dmx.h
9unifdef-y += video.h
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f0b135cd86da..224178a000d2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1013,6 +1013,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1013 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1013 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1014} 1014}
1015 1015
1016pgprot_t vm_get_page_prot(unsigned long vm_flags);
1016struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1017struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1017struct page *vmalloc_to_page(void *addr); 1018struct page *vmalloc_to_page(void *addr);
1018unsigned long vmalloc_to_pfn(void *addr); 1019unsigned long vmalloc_to_pfn(void *addr);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f6977708585c..f7ca0b09075d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -148,6 +148,17 @@ struct ccw_device_id {
148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 148#define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04
149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 149#define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08
150 150
151/* s390 AP bus devices */
152struct ap_device_id {
153 __u16 match_flags; /* which fields to match against */
154 __u8 dev_type; /* device type */
155 __u8 pad1;
156 __u32 pad2;
157 kernel_ulong_t driver_info;
158};
159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161
151 162
152#define PNP_ID_LEN 8 163#define PNP_ID_LEN 8
153#define PNP_MAX_DEVICES 8 164#define PNP_MAX_DEVICES 8
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 09bfae6938b3..123948b14547 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -199,6 +199,18 @@ struct cfi_pri_amdstd {
199 uint8_t TopBottom; 199 uint8_t TopBottom;
200} __attribute__((packed)); 200} __attribute__((packed));
201 201
202/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
203
204struct cfi_pri_atmel {
205 uint8_t pri[3];
206 uint8_t MajorVersion;
207 uint8_t MinorVersion;
208 uint8_t Features;
209 uint8_t BottomBoot;
210 uint8_t BurstMode;
211 uint8_t PageMode;
212} __attribute__((packed));
213
202struct cfi_pri_query { 214struct cfi_pri_query {
203 uint8_t NumFields; 215 uint8_t NumFields;
204 uint32_t ProtField[1]; /* Not host ordered */ 216 uint32_t ProtField[1]; /* Not host ordered */
@@ -464,6 +476,7 @@ struct cfi_fixup {
464#define CFI_ID_ANY 0xffff 476#define CFI_ID_ANY 0xffff
465 477
466#define CFI_MFR_AMD 0x0001 478#define CFI_MFR_AMD 0x0001
479#define CFI_MFR_ATMEL 0x001F
467#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 480#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
468 481
469void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 482void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index d06311acd448..9a285cecf249 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -1,11 +1,38 @@
1header-y := nf_conntrack_sctp.h nf_conntrack_tuple_common.h \ 1header-y += nf_conntrack_sctp.h
2 nfnetlink_conntrack.h nfnetlink_log.h nfnetlink_queue.h \ 2header-y += nf_conntrack_tuple_common.h
3 xt_CLASSIFY.h xt_comment.h xt_connbytes.h xt_connmark.h \ 3header-y += nfnetlink_conntrack.h
4 xt_CONNMARK.h xt_conntrack.h xt_dccp.h xt_esp.h \ 4header-y += nfnetlink_log.h
5 xt_helper.h xt_length.h xt_limit.h xt_mac.h xt_mark.h \ 5header-y += nfnetlink_queue.h
6 xt_MARK.h xt_multiport.h xt_NFQUEUE.h xt_pkttype.h \ 6header-y += xt_CLASSIFY.h
7 xt_policy.h xt_realm.h xt_sctp.h xt_state.h xt_string.h \ 7header-y += xt_comment.h
8 xt_tcpmss.h xt_tcpudp.h 8header-y += xt_connbytes.h
9header-y += xt_connmark.h
10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h
12header-y += xt_dccp.h
13header-y += xt_esp.h
14header-y += xt_helper.h
15header-y += xt_length.h
16header-y += xt_limit.h
17header-y += xt_mac.h
18header-y += xt_mark.h
19header-y += xt_MARK.h
20header-y += xt_multiport.h
21header-y += xt_NFQUEUE.h
22header-y += xt_pkttype.h
23header-y += xt_policy.h
24header-y += xt_realm.h
25header-y += xt_sctp.h
26header-y += xt_state.h
27header-y += xt_string.h
28header-y += xt_tcpmss.h
29header-y += xt_tcpudp.h
30header-y += xt_SECMARK.h
31header-y += xt_CONNSECMARK.h
9 32
10unifdef-y := nf_conntrack_common.h nf_conntrack_ftp.h \ 33unifdef-y += nf_conntrack_common.h
11 nf_conntrack_tcp.h nfnetlink.h x_tables.h xt_physdev.h 34unifdef-y += nf_conntrack_ftp.h
35unifdef-y += nf_conntrack_tcp.h
36unifdef-y += nfnetlink.h
37unifdef-y += x_tables.h
38unifdef-y += xt_physdev.h
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
index 198ec5e7b17d..4f13dfcb92ea 100644
--- a/include/linux/netfilter_arp/Kbuild
+++ b/include/linux/netfilter_arp/Kbuild
@@ -1,2 +1,3 @@
1header-y := arpt_mangle.h 1header-y += arpt_mangle.h
2unifdef-y := arp_tables.h 2
3unifdef-y += arp_tables.h
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
index 5b1aba6abbad..76ff4c47d8c4 100644
--- a/include/linux/netfilter_bridge/Kbuild
+++ b/include/linux/netfilter_bridge/Kbuild
@@ -1,4 +1,17 @@
1header-y += ebt_among.h ebt_arp.h ebt_arpreply.h ebt_ip.h ebt_limit.h \ 1header-y += ebt_among.h
2 ebt_log.h ebt_mark_m.h ebt_mark_t.h ebt_nat.h ebt_pkttype.h \ 2header-y += ebt_arp.h
3 ebt_redirect.h ebt_stp.h ebt_ulog.h ebt_vlan.h 3header-y += ebt_arpreply.h
4unifdef-y := ebtables.h ebt_802_3.h 4header-y += ebt_ip.h
5header-y += ebt_limit.h
6header-y += ebt_log.h
7header-y += ebt_mark_m.h
8header-y += ebt_mark_t.h
9header-y += ebt_nat.h
10header-y += ebt_pkttype.h
11header-y += ebt_redirect.h
12header-y += ebt_stp.h
13header-y += ebt_ulog.h
14header-y += ebt_vlan.h
15
16unifdef-y += ebtables.h
17unifdef-y += ebt_802_3.h
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 04e4d2721689..591c1a809c00 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,21 +1,63 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_helper_h323_asn1.h
3header-y += ip_conntrack_helper_h323_types.h
4header-y += ip_conntrack_protocol.h
5header-y += ip_conntrack_sctp.h
6header-y += ip_conntrack_tcp.h
7header-y += ip_conntrack_tftp.h
8header-y += ip_nat_pptp.h
9header-y += ipt_addrtype.h
10header-y += ipt_ah.h
11header-y += ipt_CLASSIFY.h
12header-y += ipt_CLUSTERIP.h
13header-y += ipt_comment.h
14header-y += ipt_connbytes.h
15header-y += ipt_connmark.h
16header-y += ipt_CONNMARK.h
17header-y += ipt_conntrack.h
18header-y += ipt_dccp.h
19header-y += ipt_dscp.h
20header-y += ipt_DSCP.h
21header-y += ipt_ecn.h
22header-y += ipt_ECN.h
23header-y += ipt_esp.h
24header-y += ipt_hashlimit.h
25header-y += ipt_helper.h
26header-y += ipt_iprange.h
27header-y += ipt_length.h
28header-y += ipt_limit.h
29header-y += ipt_LOG.h
30header-y += ipt_mac.h
31header-y += ipt_mark.h
32header-y += ipt_MARK.h
33header-y += ipt_multiport.h
34header-y += ipt_NFQUEUE.h
35header-y += ipt_owner.h
36header-y += ipt_physdev.h
37header-y += ipt_pkttype.h
38header-y += ipt_policy.h
39header-y += ipt_realm.h
40header-y += ipt_recent.h
41header-y += ipt_REJECT.h
42header-y += ipt_SAME.h
43header-y += ipt_sctp.h
44header-y += ipt_state.h
45header-y += ipt_string.h
46header-y += ipt_tcpmss.h
47header-y += ipt_TCPMSS.h
48header-y += ipt_tos.h
49header-y += ipt_TOS.h
50header-y += ipt_ttl.h
51header-y += ipt_TTL.h
52header-y += ipt_ULOG.h
1 53
2header-y := ip_conntrack_helper.h ip_conntrack_helper_h323_asn1.h \ 54unifdef-y += ip_conntrack.h
3 ip_conntrack_helper_h323_types.h ip_conntrack_protocol.h \ 55unifdef-y += ip_conntrack_h323.h
4 ip_conntrack_sctp.h ip_conntrack_tcp.h ip_conntrack_tftp.h \ 56unifdef-y += ip_conntrack_irc.h
5 ip_nat_pptp.h ipt_addrtype.h ipt_ah.h \ 57unifdef-y += ip_conntrack_pptp.h
6 ipt_CLASSIFY.h ipt_CLUSTERIP.h ipt_comment.h \ 58unifdef-y += ip_conntrack_proto_gre.h
7 ipt_connbytes.h ipt_connmark.h ipt_CONNMARK.h \ 59unifdef-y += ip_conntrack_tuple.h
8 ipt_conntrack.h ipt_dccp.h ipt_dscp.h ipt_DSCP.h ipt_ecn.h \ 60unifdef-y += ip_nat.h
9 ipt_ECN.h ipt_esp.h ipt_hashlimit.h ipt_helper.h \ 61unifdef-y += ip_nat_rule.h
10 ipt_iprange.h ipt_length.h ipt_limit.h ipt_LOG.h ipt_mac.h \ 62unifdef-y += ip_queue.h
11 ipt_mark.h ipt_MARK.h ipt_multiport.h ipt_NFQUEUE.h \ 63unifdef-y += ip_tables.h
12 ipt_owner.h ipt_physdev.h ipt_pkttype.h ipt_policy.h \
13 ipt_realm.h ipt_recent.h ipt_REJECT.h ipt_SAME.h \
14 ipt_sctp.h ipt_state.h ipt_string.h ipt_tcpmss.h \
15 ipt_TCPMSS.h ipt_tos.h ipt_TOS.h ipt_ttl.h ipt_TTL.h \
16 ipt_ULOG.h
17
18unifdef-y := ip_conntrack.h ip_conntrack_h323.h ip_conntrack_irc.h \
19 ip_conntrack_pptp.h ip_conntrack_proto_gre.h \
20 ip_conntrack_tuple.h ip_nat.h ip_nat_rule.h ip_queue.h \
21 ip_tables.h
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index 913ddbf55b4b..9dd978d149ff 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,6 +1,21 @@
1header-y += ip6t_HL.h ip6t_LOG.h ip6t_MARK.h ip6t_REJECT.h ip6t_ah.h \ 1header-y += ip6t_HL.h
2 ip6t_esp.h ip6t_frag.h ip6t_hl.h ip6t_ipv6header.h \ 2header-y += ip6t_LOG.h
3 ip6t_length.h ip6t_limit.h ip6t_mac.h ip6t_mark.h \ 3header-y += ip6t_MARK.h
4 ip6t_multiport.h ip6t_opts.h ip6t_owner.h ip6t_policy.h \ 4header-y += ip6t_REJECT.h
5 ip6t_physdev.h ip6t_rt.h 5header-y += ip6t_ah.h
6unifdef-y := ip6_tables.h 6header-y += ip6t_esp.h
7header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h
10header-y += ip6t_length.h
11header-y += ip6t_limit.h
12header-y += ip6t_mac.h
13header-y += ip6t_mark.h
14header-y += ip6t_multiport.h
15header-y += ip6t_opts.h
16header-y += ip6t_owner.h
17header-y += ip6t_policy.h
18header-y += ip6t_physdev.h
19header-y += ip6t_rt.h
20
21unifdef-y += ip6_tables.h
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index c8c545665885..d9c5455808e5 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,2 +1,7 @@
1unifdef-y := const.h export.h stats.h syscall.h nfsfh.h debug.h auth.h 1unifdef-y += const.h
2 2unifdef-y += export.h
3unifdef-y += stats.h
4unifdef-y += syscall.h
5unifdef-y += nfsfh.h
6unifdef-y += debug.h
7unifdef-y += auth.h
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
index 73fa27a8d552..2415a64c5e51 100644
--- a/include/linux/raid/Kbuild
+++ b/include/linux/raid/Kbuild
@@ -1 +1,2 @@
1header-y += md_p.h md_u.h 1header-y += md_p.h
2header-y += md_u.h
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 66ff545552f7..4efbd9c445f5 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -5,7 +5,7 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/string.h> 6#include <linux/string.h>
7 7
8static inline void sg_set_buf(struct scatterlist *sg, void *buf, 8static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
9 unsigned int buflen) 9 unsigned int buflen)
10{ 10{
11 sg->page = virt_to_page(buf); 11 sg->page = virt_to_page(buf);
@@ -13,7 +13,7 @@ static inline void sg_set_buf(struct scatterlist *sg, void *buf,
13 sg->length = buflen; 13 sg->length = buflen;
14} 14}
15 15
16static inline void sg_init_one(struct scatterlist *sg, void *buf, 16static inline void sg_init_one(struct scatterlist *sg, const void *buf,
17 unsigned int buflen) 17 unsigned int buflen)
18{ 18{
19 memset(sg, 0, sizeof(*sg)); 19 memset(sg, 0, sizeof(*sg));
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
index 0d1d768a27bf..fb438f158eee 100644
--- a/include/linux/sunrpc/Kbuild
+++ b/include/linux/sunrpc/Kbuild
@@ -1 +1 @@
unifdef-y := debug.h unifdef-y += debug.h
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 1279280d7196..e30ba201910a 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -46,8 +46,8 @@ struct krb5_ctx {
46 unsigned char seed[16]; 46 unsigned char seed[16];
47 int signalg; 47 int signalg;
48 int sealalg; 48 int sealalg;
49 struct crypto_tfm *enc; 49 struct crypto_blkcipher *enc;
50 struct crypto_tfm *seq; 50 struct crypto_blkcipher *seq;
51 s32 endtime; 51 s32 endtime;
52 u32 seq_send; 52 u32 seq_send;
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
@@ -136,26 +136,27 @@ gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset,
136 136
137 137
138u32 138u32
139krb5_encrypt(struct crypto_tfm * key, 139krb5_encrypt(struct crypto_blkcipher *key,
140 void *iv, void *in, void *out, int length); 140 void *iv, void *in, void *out, int length);
141 141
142u32 142u32
143krb5_decrypt(struct crypto_tfm * key, 143krb5_decrypt(struct crypto_blkcipher *key,
144 void *iv, void *in, void *out, int length); 144 void *iv, void *in, void *out, int length);
145 145
146int 146int
147gss_encrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *outbuf, int offset, 147gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *outbuf,
148 struct page **pages); 148 int offset, struct page **pages);
149 149
150int 150int
151gss_decrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *inbuf, int offset); 151gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
152 int offset);
152 153
153s32 154s32
154krb5_make_seq_num(struct crypto_tfm * key, 155krb5_make_seq_num(struct crypto_blkcipher *key,
155 int direction, 156 int direction,
156 s32 seqnum, unsigned char *cksum, unsigned char *buf); 157 s32 seqnum, unsigned char *cksum, unsigned char *buf);
157 158
158s32 159s32
159krb5_get_seq_num(struct crypto_tfm * key, 160krb5_get_seq_num(struct crypto_blkcipher *key,
160 unsigned char *cksum, 161 unsigned char *cksum,
161 unsigned char *buf, int *direction, s32 * seqnum); 162 unsigned char *buf, int *direction, s32 * seqnum);
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 336e218c2782..2cf3fbb40b4f 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -19,9 +19,9 @@ struct spkm3_ctx {
19 unsigned int req_flags ; 19 unsigned int req_flags ;
20 struct xdr_netobj share_key; 20 struct xdr_netobj share_key;
21 int conf_alg; 21 int conf_alg;
22 struct crypto_tfm* derived_conf_key; 22 struct crypto_blkcipher *derived_conf_key;
23 int intg_alg; 23 int intg_alg;
24 struct crypto_tfm* derived_integ_key; 24 struct crypto_blkcipher *derived_integ_key;
25 int keyestb_alg; /* alg used to get share_key */ 25 int keyestb_alg; /* alg used to get share_key */
26 int owf_alg; /* one way function */ 26 int owf_alg; /* one way function */
27}; 27};
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
index 5251a505b2f1..78dfbac36375 100644
--- a/include/linux/tc_act/Kbuild
+++ b/include/linux/tc_act/Kbuild
@@ -1 +1,4 @@
1header-y += tc_gact.h tc_ipt.h tc_mirred.h tc_pedit.h 1header-y += tc_gact.h
2header-y += tc_ipt.h
3header-y += tc_mirred.h
4header-y += tc_pedit.h
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild
index 381e93018df6..4a58a1c32a00 100644
--- a/include/linux/tc_ematch/Kbuild
+++ b/include/linux/tc_ematch/Kbuild
@@ -1 +1,4 @@
1headers-y := tc_em_cmp.h tc_em_meta.h tc_em_nbyte.h tc_em_text.h 1header-y += tc_em_cmp.h
2header-y += tc_em_meta.h
3header-y += tc_em_nbyte.h
4header-y += tc_em_text.h
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index e1da2a5b2a57..13e7a3c6d794 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -1,2 +1,6 @@
1unifdef-y := mtd-abi.h 1header-y += inftl-user.h
2header-y := inftl-user.h jffs2-user.h mtd-user.h nftl-user.h 2header-y += jffs2-user.h
3header-y += mtd-user.h
4header-y += nftl-user.h
5
6unifdef-y += mtd-abi.h
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1da3f7fa7993..b0a67b7ffdcd 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -34,6 +34,7 @@ struct mtd_oob_buf {
34#define MTD_WRITEABLE 0x400 /* Device is writeable */ 34#define MTD_WRITEABLE 0x400 /* Device is writeable */
35#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 35#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
36#define MTD_NO_ERASE 0x1000 /* No erase necessary */ 36#define MTD_NO_ERASE 0x1000 /* No erase necessary */
37#define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */
37 38
38// Some common devices / combinations of capabilities 39// Some common devices / combinations of capabilities
39#define MTD_CAP_ROM 0 40#define MTD_CAP_ROM 0
diff --git a/include/net/ah.h b/include/net/ah.h
index ceff00afae09..8f257c159902 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -1,6 +1,7 @@
1#ifndef _NET_AH_H 1#ifndef _NET_AH_H
2#define _NET_AH_H 2#define _NET_AH_H
3 3
4#include <linux/crypto.h>
4#include <net/xfrm.h> 5#include <net/xfrm.h>
5 6
6/* This is the maximum truncated ICV length that we know of. */ 7/* This is the maximum truncated ICV length that we know of. */
@@ -14,22 +15,29 @@ struct ah_data
14 int icv_full_len; 15 int icv_full_len;
15 int icv_trunc_len; 16 int icv_trunc_len;
16 17
17 void (*icv)(struct ah_data*, 18 struct crypto_hash *tfm;
18 struct sk_buff *skb, u8 *icv);
19
20 struct crypto_tfm *tfm;
21}; 19};
22 20
23static inline void 21static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb,
24ah_hmac_digest(struct ah_data *ahp, struct sk_buff *skb, u8 *auth_data) 22 u8 *auth_data)
25{ 23{
26 struct crypto_tfm *tfm = ahp->tfm; 24 struct hash_desc desc;
25 int err;
26
27 desc.tfm = ahp->tfm;
28 desc.flags = 0;
27 29
28 memset(auth_data, 0, ahp->icv_trunc_len); 30 memset(auth_data, 0, ahp->icv_trunc_len);
29 crypto_hmac_init(tfm, ahp->key, &ahp->key_len); 31 err = crypto_hash_init(&desc);
30 skb_icv_walk(skb, tfm, 0, skb->len, crypto_hmac_update); 32 if (unlikely(err))
31 crypto_hmac_final(tfm, ahp->key, &ahp->key_len, ahp->work_icv); 33 goto out;
32 memcpy(auth_data, ahp->work_icv, ahp->icv_trunc_len); 34 err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update);
35 if (unlikely(err))
36 goto out;
37 err = crypto_hash_final(&desc, ahp->work_icv);
38
39out:
40 return err;
33} 41}
34 42
35#endif 43#endif
diff --git a/include/net/esp.h b/include/net/esp.h
index 90cd94fad7d9..064366d66eea 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -1,6 +1,7 @@
1#ifndef _NET_ESP_H 1#ifndef _NET_ESP_H
2#define _NET_ESP_H 2#define _NET_ESP_H
3 3
4#include <linux/crypto.h>
4#include <net/xfrm.h> 5#include <net/xfrm.h>
5#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
6 7
@@ -21,7 +22,7 @@ struct esp_data
21 * >= crypto_tfm_alg_ivsize(tfm). */ 22 * >= crypto_tfm_alg_ivsize(tfm). */
22 int ivlen; 23 int ivlen;
23 int padlen; /* 0..255 */ 24 int padlen; /* 0..255 */
24 struct crypto_tfm *tfm; /* crypto handle */ 25 struct crypto_blkcipher *tfm; /* crypto handle */
25 } conf; 26 } conf;
26 27
27 /* Integrity. It is active when icv_full_len != 0 */ 28 /* Integrity. It is active when icv_full_len != 0 */
@@ -34,7 +35,7 @@ struct esp_data
34 void (*icv)(struct esp_data*, 35 void (*icv)(struct esp_data*,
35 struct sk_buff *skb, 36 struct sk_buff *skb,
36 int offset, int len, u8 *icv); 37 int offset, int len, u8 *icv);
37 struct crypto_tfm *tfm; 38 struct crypto_hash *tfm;
38 } auth; 39 } auth;
39}; 40};
40 41
@@ -42,18 +43,22 @@ extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
42extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 43extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
43extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 44extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
44 45
45static inline void 46static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
46esp_hmac_digest(struct esp_data *esp, struct sk_buff *skb, int offset, 47 int offset, int len)
47 int len, u8 *auth_data)
48{ 48{
49 struct crypto_tfm *tfm = esp->auth.tfm; 49 struct hash_desc desc;
50 char *icv = esp->auth.work_icv; 50 int err;
51 51
52 memset(auth_data, 0, esp->auth.icv_trunc_len); 52 desc.tfm = esp->auth.tfm;
53 crypto_hmac_init(tfm, esp->auth.key, &esp->auth.key_len); 53 desc.flags = 0;
54 skb_icv_walk(skb, tfm, offset, len, crypto_hmac_update); 54
55 crypto_hmac_final(tfm, esp->auth.key, &esp->auth.key_len, icv); 55 err = crypto_hash_init(&desc);
56 memcpy(auth_data, icv, esp->auth.icv_trunc_len); 56 if (unlikely(err))
57 return err;
58 err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update);
59 if (unlikely(err))
60 return err;
61 return crypto_hash_final(&desc, esp->auth.work_icv);
57} 62}
58 63
59#endif 64#endif
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h
index e651a57ecdd5..87c1af3e5e82 100644
--- a/include/net/ipcomp.h
+++ b/include/net/ipcomp.h
@@ -1,11 +1,14 @@
1#ifndef _NET_IPCOMP_H 1#ifndef _NET_IPCOMP_H
2#define _NET_IPCOMP_H 2#define _NET_IPCOMP_H
3 3
4#include <linux/crypto.h>
5#include <linux/types.h>
6
4#define IPCOMP_SCRATCH_SIZE 65400 7#define IPCOMP_SCRATCH_SIZE 65400
5 8
6struct ipcomp_data { 9struct ipcomp_data {
7 u16 threshold; 10 u16 threshold;
8 struct crypto_tfm **tfms; 11 struct crypto_comp **tfms;
9}; 12};
10 13
11#endif 14#endif
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index c51541ee0247..57166bfdf8eb 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -312,9 +312,9 @@ enum { SCTP_MAX_GABS = 16 };
312 */ 312 */
313 313
314#if defined (CONFIG_SCTP_HMAC_MD5) 314#if defined (CONFIG_SCTP_HMAC_MD5)
315#define SCTP_COOKIE_HMAC_ALG "md5" 315#define SCTP_COOKIE_HMAC_ALG "hmac(md5)"
316#elif defined (CONFIG_SCTP_HMAC_SHA1) 316#elif defined (CONFIG_SCTP_HMAC_SHA1)
317#define SCTP_COOKIE_HMAC_ALG "sha1" 317#define SCTP_COOKIE_HMAC_ALG "hmac(sha1)"
318#else 318#else
319#define SCTP_COOKIE_HMAC_ALG NULL 319#define SCTP_COOKIE_HMAC_ALG NULL
320#endif 320#endif
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 92eae0e0f3f1..1c1abce5f6b6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -330,17 +330,6 @@ static inline void sctp_v6_exit(void) { return; }
330 330
331#endif /* #if defined(CONFIG_IPV6) */ 331#endif /* #if defined(CONFIG_IPV6) */
332 332
333/* Some wrappers, in case crypto not available. */
334#if defined (CONFIG_CRYPTO_HMAC)
335#define sctp_crypto_alloc_tfm crypto_alloc_tfm
336#define sctp_crypto_free_tfm crypto_free_tfm
337#define sctp_crypto_hmac crypto_hmac
338#else
339#define sctp_crypto_alloc_tfm(x...) NULL
340#define sctp_crypto_free_tfm(x...)
341#define sctp_crypto_hmac(x...)
342#endif
343
344 333
345/* Map an association to an assoc_id. */ 334/* Map an association to an assoc_id. */
346static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) 335static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index e5aa7ff1f5b5..0412e730c765 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -87,6 +87,7 @@ struct sctp_bind_addr;
87struct sctp_ulpq; 87struct sctp_ulpq;
88struct sctp_ep_common; 88struct sctp_ep_common;
89struct sctp_ssnmap; 89struct sctp_ssnmap;
90struct crypto_hash;
90 91
91 92
92#include <net/sctp/tsnmap.h> 93#include <net/sctp/tsnmap.h>
@@ -264,7 +265,7 @@ struct sctp_sock {
264 struct sctp_pf *pf; 265 struct sctp_pf *pf;
265 266
266 /* Access to HMAC transform. */ 267 /* Access to HMAC transform. */
267 struct crypto_tfm *hmac; 268 struct crypto_hash *hmac;
268 269
269 /* What is our base endpointer? */ 270 /* What is our base endpointer? */
270 struct sctp_endpoint *ep; 271 struct sctp_endpoint *ep;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9c5ee9f20b65..3ecd9fa1ed4b 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -8,7 +8,6 @@
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/skbuff.h> 9#include <linux/skbuff.h>
10#include <linux/socket.h> 10#include <linux/socket.h>
11#include <linux/crypto.h>
12#include <linux/pfkeyv2.h> 11#include <linux/pfkeyv2.h>
13#include <linux/in6.h> 12#include <linux/in6.h>
14#include <linux/mutex.h> 13#include <linux/mutex.h>
@@ -855,6 +854,7 @@ struct xfrm_algo_comp_info {
855 854
856struct xfrm_algo_desc { 855struct xfrm_algo_desc {
857 char *name; 856 char *name;
857 char *compat;
858 u8 available:1; 858 u8 available:1;
859 union { 859 union {
860 struct xfrm_algo_auth_info auth; 860 struct xfrm_algo_auth_info auth;
@@ -984,11 +984,13 @@ extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe);
984extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 984extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe);
985extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 985extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe);
986 986
987struct crypto_tfm; 987struct hash_desc;
988typedef void (icv_update_fn_t)(struct crypto_tfm *, struct scatterlist *, unsigned int); 988struct scatterlist;
989typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
990 unsigned int);
989 991
990extern void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, 992extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm,
991 int offset, int len, icv_update_fn_t icv_update); 993 int offset, int len, icv_update_fn_t icv_update);
992 994
993static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, 995static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
994 int family) 996 int family)
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild
index eb710ba9b1a0..e7c043216558 100644
--- a/include/rdma/Kbuild
+++ b/include/rdma/Kbuild
@@ -1 +1 @@
header-y := ib_user_mad.h header-y += ib_user_mad.h
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 0ff67398928d..81b62307621d 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -40,7 +40,7 @@ struct rdma_dev_addr {
40 unsigned char src_dev_addr[MAX_ADDR_LEN]; 40 unsigned char src_dev_addr[MAX_ADDR_LEN];
41 unsigned char dst_dev_addr[MAX_ADDR_LEN]; 41 unsigned char dst_dev_addr[MAX_ADDR_LEN];
42 unsigned char broadcast[MAX_ADDR_LEN]; 42 unsigned char broadcast[MAX_ADDR_LEN];
43 enum ib_node_type dev_type; 43 enum rdma_node_type dev_type;
44}; 44};
45 45
46/** 46/**
@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
72 72
73void rdma_addr_cancel(struct rdma_dev_addr *addr); 73void rdma_addr_cancel(struct rdma_dev_addr *addr);
74 74
75int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
76 const unsigned char *dst_dev_addr);
77
75static inline int ip_addr_size(struct sockaddr *addr) 78static inline int ip_addr_size(struct sockaddr *addr)
76{ 79{
77 return addr->sa_family == AF_INET6 ? 80 return addr->sa_family == AF_INET6 ?
@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
113 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); 116 memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
114} 117}
115 118
119static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr,
120 union ib_gid *gid)
121{
122 memcpy(gid, dev_addr->src_dev_addr, sizeof *gid);
123}
124
125static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr,
126 union ib_gid *gid)
127{
128 memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid);
129}
130
116#endif /* IB_ADDR_H */ 131#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index c99e4420fd7e..97715b0c20b6 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved. 3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4 * Copyright (c) 2006 Intel Corporation. All rights reserved.
4 * 5 *
5 * This software is available to you under a choice of one of two 6 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
@@ -36,8 +37,11 @@
36#ifndef IB_SA_H 37#ifndef IB_SA_H
37#define IB_SA_H 38#define IB_SA_H
38 39
40#include <linux/completion.h>
39#include <linux/compiler.h> 41#include <linux/compiler.h>
40 42
43#include <asm/atomic.h>
44
41#include <rdma/ib_verbs.h> 45#include <rdma/ib_verbs.h>
42#include <rdma/ib_mad.h> 46#include <rdma/ib_mad.h>
43 47
@@ -79,8 +83,8 @@ enum {
79}; 83};
80 84
81enum ib_sa_selector { 85enum ib_sa_selector {
82 IB_SA_GTE = 0, 86 IB_SA_GT = 0,
83 IB_SA_LTE = 1, 87 IB_SA_LT = 1,
84 IB_SA_EQ = 2, 88 IB_SA_EQ = 2,
85 /* 89 /*
86 * The meaning of "best" depends on the attribute: for 90 * The meaning of "best" depends on the attribute: for
@@ -250,11 +254,28 @@ struct ib_sa_service_rec {
250 u64 data64[2]; 254 u64 data64[2];
251}; 255};
252 256
257struct ib_sa_client {
258 atomic_t users;
259 struct completion comp;
260};
261
262/**
263 * ib_sa_register_client - Register an SA client.
264 */
265void ib_sa_register_client(struct ib_sa_client *client);
266
267/**
268 * ib_sa_unregister_client - Deregister an SA client.
269 * @client: Client object to deregister.
270 */
271void ib_sa_unregister_client(struct ib_sa_client *client);
272
253struct ib_sa_query; 273struct ib_sa_query;
254 274
255void ib_sa_cancel_query(int id, struct ib_sa_query *query); 275void ib_sa_cancel_query(int id, struct ib_sa_query *query);
256 276
257int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, 277int ib_sa_path_rec_get(struct ib_sa_client *client,
278 struct ib_device *device, u8 port_num,
258 struct ib_sa_path_rec *rec, 279 struct ib_sa_path_rec *rec,
259 ib_sa_comp_mask comp_mask, 280 ib_sa_comp_mask comp_mask,
260 int timeout_ms, gfp_t gfp_mask, 281 int timeout_ms, gfp_t gfp_mask,
@@ -264,7 +285,8 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
264 void *context, 285 void *context,
265 struct ib_sa_query **query); 286 struct ib_sa_query **query);
266 287
267int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, 288int ib_sa_mcmember_rec_query(struct ib_sa_client *client,
289 struct ib_device *device, u8 port_num,
268 u8 method, 290 u8 method,
269 struct ib_sa_mcmember_rec *rec, 291 struct ib_sa_mcmember_rec *rec,
270 ib_sa_comp_mask comp_mask, 292 ib_sa_comp_mask comp_mask,
@@ -275,7 +297,8 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
275 void *context, 297 void *context,
276 struct ib_sa_query **query); 298 struct ib_sa_query **query);
277 299
278int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, 300int ib_sa_service_rec_query(struct ib_sa_client *client,
301 struct ib_device *device, u8 port_num,
279 u8 method, 302 u8 method,
280 struct ib_sa_service_rec *rec, 303 struct ib_sa_service_rec *rec,
281 ib_sa_comp_mask comp_mask, 304 ib_sa_comp_mask comp_mask,
@@ -288,6 +311,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
288 311
289/** 312/**
290 * ib_sa_mcmember_rec_set - Start an MCMember set query 313 * ib_sa_mcmember_rec_set - Start an MCMember set query
314 * @client:SA client
291 * @device:device to send query on 315 * @device:device to send query on
292 * @port_num: port number to send query on 316 * @port_num: port number to send query on
293 * @rec:MCMember Record to send in query 317 * @rec:MCMember Record to send in query
@@ -311,7 +335,8 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num,
311 * cancel the query. 335 * cancel the query.
312 */ 336 */
313static inline int 337static inline int
314ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, 338ib_sa_mcmember_rec_set(struct ib_sa_client *client,
339 struct ib_device *device, u8 port_num,
315 struct ib_sa_mcmember_rec *rec, 340 struct ib_sa_mcmember_rec *rec,
316 ib_sa_comp_mask comp_mask, 341 ib_sa_comp_mask comp_mask,
317 int timeout_ms, gfp_t gfp_mask, 342 int timeout_ms, gfp_t gfp_mask,
@@ -321,7 +346,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
321 void *context, 346 void *context,
322 struct ib_sa_query **query) 347 struct ib_sa_query **query)
323{ 348{
324 return ib_sa_mcmember_rec_query(device, port_num, 349 return ib_sa_mcmember_rec_query(client, device, port_num,
325 IB_MGMT_METHOD_SET, 350 IB_MGMT_METHOD_SET,
326 rec, comp_mask, 351 rec, comp_mask,
327 timeout_ms, gfp_mask, callback, 352 timeout_ms, gfp_mask, callback,
@@ -330,6 +355,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
330 355
331/** 356/**
332 * ib_sa_mcmember_rec_delete - Start an MCMember delete query 357 * ib_sa_mcmember_rec_delete - Start an MCMember delete query
358 * @client:SA client
333 * @device:device to send query on 359 * @device:device to send query on
334 * @port_num: port number to send query on 360 * @port_num: port number to send query on
335 * @rec:MCMember Record to send in query 361 * @rec:MCMember Record to send in query
@@ -353,7 +379,8 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num,
353 * cancel the query. 379 * cancel the query.
354 */ 380 */
355static inline int 381static inline int
356ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, 382ib_sa_mcmember_rec_delete(struct ib_sa_client *client,
383 struct ib_device *device, u8 port_num,
357 struct ib_sa_mcmember_rec *rec, 384 struct ib_sa_mcmember_rec *rec,
358 ib_sa_comp_mask comp_mask, 385 ib_sa_comp_mask comp_mask,
359 int timeout_ms, gfp_t gfp_mask, 386 int timeout_ms, gfp_t gfp_mask,
@@ -363,7 +390,7 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num,
363 void *context, 390 void *context,
364 struct ib_sa_query **query) 391 struct ib_sa_query **query)
365{ 392{
366 return ib_sa_mcmember_rec_query(device, port_num, 393 return ib_sa_mcmember_rec_query(client, device, port_num,
367 IB_SA_METHOD_DELETE, 394 IB_SA_METHOD_DELETE,
368 rec, comp_mask, 395 rec, comp_mask,
369 timeout_ms, gfp_mask, callback, 396 timeout_ms, gfp_mask, callback,
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 7b5372010f4b..db1b814b62cc 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -275,6 +275,8 @@ struct ib_uverbs_resize_cq {
275 275
276struct ib_uverbs_resize_cq_resp { 276struct ib_uverbs_resize_cq_resp {
277 __u32 cqe; 277 __u32 cqe;
278 __u32 reserved;
279 __u64 driver_data[0];
278}; 280};
279 281
280struct ib_uverbs_poll_cq { 282struct ib_uverbs_poll_cq {
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ee1f3a355666..8eacc3510993 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -56,12 +56,22 @@ union ib_gid {
56 } global; 56 } global;
57}; 57};
58 58
59enum ib_node_type { 59enum rdma_node_type {
60 IB_NODE_CA = 1, 60 /* IB values map to NodeInfo:NodeType. */
61 IB_NODE_SWITCH, 61 RDMA_NODE_IB_CA = 1,
62 IB_NODE_ROUTER 62 RDMA_NODE_IB_SWITCH,
63 RDMA_NODE_IB_ROUTER,
64 RDMA_NODE_RNIC
63}; 65};
64 66
67enum rdma_transport_type {
68 RDMA_TRANSPORT_IB,
69 RDMA_TRANSPORT_IWARP
70};
71
72enum rdma_transport_type
73rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__;
74
65enum ib_device_cap_flags { 75enum ib_device_cap_flags {
66 IB_DEVICE_RESIZE_MAX_WR = 1, 76 IB_DEVICE_RESIZE_MAX_WR = 1,
67 IB_DEVICE_BAD_PKEY_CNTR = (1<<1), 77 IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
@@ -78,6 +88,9 @@ enum ib_device_cap_flags {
78 IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), 88 IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
79 IB_DEVICE_SRQ_RESIZE = (1<<13), 89 IB_DEVICE_SRQ_RESIZE = (1<<13),
80 IB_DEVICE_N_NOTIFY_CQ = (1<<14), 90 IB_DEVICE_N_NOTIFY_CQ = (1<<14),
91 IB_DEVICE_ZERO_STAG = (1<<15),
92 IB_DEVICE_SEND_W_INV = (1<<16),
93 IB_DEVICE_MEM_WINDOW = (1<<17)
81}; 94};
82 95
83enum ib_atomic_cap { 96enum ib_atomic_cap {
@@ -835,6 +848,8 @@ struct ib_cache {
835 u8 *lmc_cache; 848 u8 *lmc_cache;
836}; 849};
837 850
851struct iw_cm_verbs;
852
838struct ib_device { 853struct ib_device {
839 struct device *dma_device; 854 struct device *dma_device;
840 855
@@ -851,6 +866,8 @@ struct ib_device {
851 866
852 u32 flags; 867 u32 flags;
853 868
869 struct iw_cm_verbs *iwcm;
870
854 int (*query_device)(struct ib_device *device, 871 int (*query_device)(struct ib_device *device,
855 struct ib_device_attr *device_attr); 872 struct ib_device_attr *device_attr);
856 int (*query_port)(struct ib_device *device, 873 int (*query_port)(struct ib_device *device,
@@ -888,7 +905,8 @@ struct ib_device {
888 struct ib_udata *udata); 905 struct ib_udata *udata);
889 int (*modify_srq)(struct ib_srq *srq, 906 int (*modify_srq)(struct ib_srq *srq,
890 struct ib_srq_attr *srq_attr, 907 struct ib_srq_attr *srq_attr,
891 enum ib_srq_attr_mask srq_attr_mask); 908 enum ib_srq_attr_mask srq_attr_mask,
909 struct ib_udata *udata);
892 int (*query_srq)(struct ib_srq *srq, 910 int (*query_srq)(struct ib_srq *srq,
893 struct ib_srq_attr *srq_attr); 911 struct ib_srq_attr *srq_attr);
894 int (*destroy_srq)(struct ib_srq *srq); 912 int (*destroy_srq)(struct ib_srq *srq);
@@ -900,7 +918,8 @@ struct ib_device {
900 struct ib_udata *udata); 918 struct ib_udata *udata);
901 int (*modify_qp)(struct ib_qp *qp, 919 int (*modify_qp)(struct ib_qp *qp,
902 struct ib_qp_attr *qp_attr, 920 struct ib_qp_attr *qp_attr,
903 int qp_attr_mask); 921 int qp_attr_mask,
922 struct ib_udata *udata);
904 int (*query_qp)(struct ib_qp *qp, 923 int (*query_qp)(struct ib_qp *qp,
905 struct ib_qp_attr *qp_attr, 924 struct ib_qp_attr *qp_attr,
906 int qp_attr_mask, 925 int qp_attr_mask,
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h
new file mode 100644
index 000000000000..aeefa9b740dc
--- /dev/null
+++ b/include/rdma/iw_cm.h
@@ -0,0 +1,258 @@
1/*
2 * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
3 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33#ifndef IW_CM_H
34#define IW_CM_H
35
36#include <linux/in.h>
37#include <rdma/ib_cm.h>
38
39struct iw_cm_id;
40
41enum iw_cm_event_type {
42 IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
43 IW_CM_EVENT_CONNECT_REPLY, /* reply from active connect request */
44 IW_CM_EVENT_ESTABLISHED, /* passive side accept successful */
45 IW_CM_EVENT_DISCONNECT, /* orderly shutdown */
46 IW_CM_EVENT_CLOSE /* close complete */
47};
48
49enum iw_cm_event_status {
50 IW_CM_EVENT_STATUS_OK = 0, /* request successful */
51 IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */
52 IW_CM_EVENT_STATUS_REJECTED, /* connect request rejected */
53 IW_CM_EVENT_STATUS_TIMEOUT, /* the operation timed out */
54 IW_CM_EVENT_STATUS_RESET, /* reset from remote peer */
55 IW_CM_EVENT_STATUS_EINVAL, /* asynchronous failure for bad parm */
56};
57
58struct iw_cm_event {
59 enum iw_cm_event_type event;
60 enum iw_cm_event_status status;
61 struct sockaddr_in local_addr;
62 struct sockaddr_in remote_addr;
63 void *private_data;
64 u8 private_data_len;
65 void* provider_data;
66};
67
68/**
69 * iw_cm_handler - Function to be called by the IW CM when delivering events
70 * to the client.
71 *
72 * @cm_id: The IW CM identifier associated with the event.
73 * @event: Pointer to the event structure.
74 */
75typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
76 struct iw_cm_event *event);
77
78/**
79 * iw_event_handler - Function called by the provider when delivering provider
80 * events to the IW CM. Returns either 0 indicating the event was processed
81 * or -errno if the event could not be processed.
82 *
83 * @cm_id: The IW CM identifier associated with the event.
84 * @event: Pointer to the event structure.
85 */
86typedef int (*iw_event_handler)(struct iw_cm_id *cm_id,
87 struct iw_cm_event *event);
88
89struct iw_cm_id {
90 iw_cm_handler cm_handler; /* client callback function */
91 void *context; /* client cb context */
92 struct ib_device *device;
93 struct sockaddr_in local_addr;
94 struct sockaddr_in remote_addr;
95 void *provider_data; /* provider private data */
96 iw_event_handler event_handler; /* cb for provider
97 events */
98 /* Used by provider to add and remove refs on IW cm_id */
99 void (*add_ref)(struct iw_cm_id *);
100 void (*rem_ref)(struct iw_cm_id *);
101};
102
103struct iw_cm_conn_param {
104 const void *private_data;
105 u16 private_data_len;
106 u32 ord;
107 u32 ird;
108 u32 qpn;
109};
110
111struct iw_cm_verbs {
112 void (*add_ref)(struct ib_qp *qp);
113
114 void (*rem_ref)(struct ib_qp *qp);
115
116 struct ib_qp * (*get_qp)(struct ib_device *device,
117 int qpn);
118
119 int (*connect)(struct iw_cm_id *cm_id,
120 struct iw_cm_conn_param *conn_param);
121
122 int (*accept)(struct iw_cm_id *cm_id,
123 struct iw_cm_conn_param *conn_param);
124
125 int (*reject)(struct iw_cm_id *cm_id,
126 const void *pdata, u8 pdata_len);
127
128 int (*create_listen)(struct iw_cm_id *cm_id,
129 int backlog);
130
131 int (*destroy_listen)(struct iw_cm_id *cm_id);
132};
133
134/**
135 * iw_create_cm_id - Create an IW CM identifier.
136 *
137 * @device: The IB device on which to create the IW CM identier.
138 * @event_handler: User callback invoked to report events associated with the
139 * returned IW CM identifier.
140 * @context: User specified context associated with the id.
141 */
142struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
143 iw_cm_handler cm_handler, void *context);
144
145/**
146 * iw_destroy_cm_id - Destroy an IW CM identifier.
147 *
148 * @cm_id: The previously created IW CM identifier to destroy.
149 *
150 * The client can assume that no events will be delivered for the CM ID after
151 * this function returns.
152 */
153void iw_destroy_cm_id(struct iw_cm_id *cm_id);
154
155/**
156 * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP
157 *
158 * @cm_id: The IW CM idenfier to unbind from the QP.
159 * @qp: The QP
160 *
161 * This is called by the provider when destroying the QP to ensure
162 * that any references held by the IWCM are released. It may also
163 * be called by the IWCM when destroying a CM_ID to that any
164 * references held by the provider are released.
165 */
166void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp);
167
168/**
169 * iw_cm_get_qp - Return the ib_qp associated with a QPN
170 *
171 * @ib_device: The IB device
172 * @qpn: The queue pair number
173 */
174struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn);
175
176/**
177 * iw_cm_listen - Listen for incoming connection requests on the
178 * specified IW CM id.
179 *
180 * @cm_id: The IW CM identifier.
181 * @backlog: The maximum number of outstanding un-accepted inbound listen
182 * requests to queue.
183 *
184 * The source address and port number are specified in the IW CM identifier
185 * structure.
186 */
187int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
188
189/**
190 * iw_cm_accept - Called to accept an incoming connect request.
191 *
192 * @cm_id: The IW CM identifier associated with the connection request.
193 * @iw_param: Pointer to a structure containing connection establishment
194 * parameters.
195 *
196 * The specified cm_id will have been provided in the event data for a
197 * CONNECT_REQUEST event. Subsequent events related to this connection will be
198 * delivered to the specified IW CM identifier prior and may occur prior to
199 * the return of this function. If this function returns a non-zero value, the
200 * client can assume that no events will be delivered to the specified IW CM
201 * identifier.
202 */
203int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
204
205/**
206 * iw_cm_reject - Reject an incoming connection request.
207 *
208 * @cm_id: Connection identifier associated with the request.
209 * @private_daa: Pointer to data to deliver to the remote peer as part of the
210 * reject message.
211 * @private_data_len: The number of bytes in the private_data parameter.
212 *
213 * The client can assume that no events will be delivered to the specified IW
214 * CM identifier following the return of this function. The private_data
215 * buffer is available for reuse when this function returns.
216 */
217int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
218 u8 private_data_len);
219
220/**
221 * iw_cm_connect - Called to request a connection to a remote peer.
222 *
223 * @cm_id: The IW CM identifier for the connection.
224 * @iw_param: Pointer to a structure containing connection establishment
225 * parameters.
226 *
227 * Events may be delivered to the specified IW CM identifier prior to the
228 * return of this function. If this function returns a non-zero value, the
229 * client can assume that no events will be delivered to the specified IW CM
230 * identifier.
231 */
232int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
233
234/**
235 * iw_cm_disconnect - Close the specified connection.
236 *
237 * @cm_id: The IW CM identifier to close.
238 * @abrupt: If 0, the connection will be closed gracefully, otherwise, the
239 * connection will be reset.
240 *
241 * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is
242 * delivered.
243 */
244int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
245
246/**
247 * iw_cm_init_qp_attr - Called to initialize the attributes of the QP
248 * associated with a IW CM identifier.
249 *
250 * @cm_id: The IW CM identifier associated with the QP
251 * @qp_attr: Pointer to the QP attributes structure.
252 * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are
253 * valid.
254 */
255int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
256 int *qp_attr_mask);
257
258#endif /* IW_CM_H */
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 402c63d7226b..deb5a0a4cee5 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -117,6 +117,14 @@ struct rdma_cm_id {
117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, 117struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
118 void *context, enum rdma_port_space ps); 118 void *context, enum rdma_port_space ps);
119 119
120/**
121 * rdma_destroy_id - Destroys an RDMA identifier.
122 *
123 * @id: RDMA identifier.
124 *
125 * Note: calling this function has the effect of canceling in-flight
126 * asynchronous operations associated with the id.
127 */
120void rdma_destroy_id(struct rdma_cm_id *id); 128void rdma_destroy_id(struct rdma_cm_id *id);
121 129
122/** 130/**
@@ -237,6 +245,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog);
237 * Typically, this routine is only called by the listener to accept a connection 245 * Typically, this routine is only called by the listener to accept a connection
238 * request. It must also be called on the active side of a connection if the 246 * request. It must also be called on the active side of a connection if the
239 * user is performing their own QP transitions. 247 * user is performing their own QP transitions.
248 *
249 * In the case of error, a reject message is sent to the remote side and the
250 * state of the qp associated with the id is modified to error, such that any
251 * previously posted receive buffers would be flushed.
240 */ 252 */
241int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); 253int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
242 254
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index 14a033d73314..744f85011f1e 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -1,2 +1,4 @@
1header-y += scsi.h 1header-y += scsi.h
2unifdef-y := scsi_ioctl.h sg.h 2
3unifdef-y += scsi_ioctl.h
4unifdef-y += sg.h
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
index 3a5a3df61496..fd054a344324 100644
--- a/include/sound/Kbuild
+++ b/include/sound/Kbuild
@@ -1,2 +1,10 @@
1header-y := asound_fm.h hdsp.h hdspm.h sfnt_info.h sscape_ioctl.h 1header-y += asound_fm.h
2unifdef-y := asequencer.h asound.h emu10k1.h sb16_csp.h 2header-y += hdsp.h
3header-y += hdspm.h
4header-y += sfnt_info.h
5header-y += sscape_ioctl.h
6
7unifdef-y += asequencer.h
8unifdef-y += asound.h
9unifdef-y += emu10k1.h
10unifdef-y += sb16_csp.h
diff --git a/include/video/Kbuild b/include/video/Kbuild
index 76a60737cc15..a14f9c045b8c 100644
--- a/include/video/Kbuild
+++ b/include/video/Kbuild
@@ -1 +1 @@
unifdef-y := sisfb.h unifdef-y += sisfb.h