aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-11-05 13:09:12 -0500
committerOlof Johansson <olof@lixom.net>2012-11-05 13:09:12 -0500
commit6d06721570aa0c38d886e3036796d59983963a27 (patch)
treed674cf54e26837bee89095c211ffa362c8546f03
parent148a8698763130c96004ef419b5f0d44a93d413c (diff)
parent54ec52b6dd3b0ba4bc4eb97e7e1b2534705b326c (diff)
Merge branch 'depends/tty' into next/headers
Merging in Greg's tty tree including a cleanup patch needed by the OMAP serial header cleanups. * depends/tty: (305 commits) tty/serial/8250: Make omap hardware workarounds local to 8250.h serial/8250/8250_early: Prevent rounding error in uartclk serial: samsung: use clk_prepare_enable and clk_disable_unprepare TTY: Report warning when low_latency flag is wrongly used console: use might_sleep in console_lock TTY: move tty buffers to tty_port TTY: add port -> tty link TTY: tty_buffer, cache pointer to tty->buf TTY: move TTY_FLUSH* flags to tty_port TTY: n_tty, propagate n_tty_data TTY: move ldisc data from tty_struct: locks TTY: move ldisc data from tty_struct: read_* and echo_* and canon_* stuff TTY: move ldisc data from tty_struct: bitmaps TTY: move ldisc data from tty_struct: simple members TTY: n_tty, add ldisc data to n_tty TTY: audit, stop accessing tty->icount TTY: n_tty, remove bogus checks TTY: n_tty, simplify read_buf+echo_buf allocation TTY: hci_ldisc, remove invalid check in open TTY: ldisc, wait for idle ldisc in release ...
-rw-r--r--.gitignore6
-rw-r--r--Documentation/DocBook/media/Makefile76
-rw-r--r--Documentation/DocBook/networking.tmpl4
-rw-r--r--Documentation/IPMI.txt65
-rw-r--r--Documentation/hwmon/coretemp1
-rw-r--r--Documentation/hwmon/submitting-patches3
-rw-r--r--Documentation/sysrq.txt1
-rw-r--r--MAINTAINERS24
-rw-r--r--Makefile17
-rw-r--r--arch/arm/boot/dts/Makefile2
-rw-r--r--arch/arm/boot/dts/dove.dtsi49
-rw-r--r--arch/arm/boot/dts/imx6q-arm2.dts10
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxl.dtsi18
-rw-r--r--arch/arm/boot/dts/wm8505.dtsi4
-rw-r--r--arch/arm/kernel/entry-common.S4
-rw-r--r--arch/arm/mach-dove/common.c8
-rw-r--r--arch/arm/mach-dove/pcie.c5
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c2
-rw-r--r--arch/arm/mach-kirkwood/common.c4
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c12
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/clockdomain.c15
-rw-r--r--arch/arm/mach-omap2/devices.c2
-rw-r--r--arch/arm/mach-omap2/gpmc.c24
-rw-r--r--arch/arm/mach-omap2/timer.c2
-rw-r--r--arch/arm/mach-prima2/include/mach/gpio.h13
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c2
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c2
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c22
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c2
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c2
-rw-r--r--arch/arm/mach-tegra/board.h2
-rw-r--r--arch/arm/mach-tegra/tegra20_clocks_data.c1
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks.c2
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks_data.c1
-rw-r--r--arch/arm/mach-tegra/timer.c2
-rw-r--r--arch/arm/plat-omap/debug-devices.c1
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h9
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/linkage.h7
-rw-r--r--arch/arm64/include/asm/processor.h10
-rw-r--r--arch/arm64/include/uapi/asm/ptrace.h3
-rw-r--r--arch/arm64/kernel/ptrace.c73
-rw-r--r--arch/arm64/kernel/setup.c12
-rw-r--r--arch/arm64/kernel/smp.c1
-rw-r--r--arch/arm64/kernel/vdso.c20
-rw-r--r--arch/frv/kernel/entry.S4
-rw-r--r--arch/frv/kernel/process.c2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/hexagon/include/asm/Kbuild3
-rw-r--r--arch/hexagon/include/asm/atomic.h2
-rw-r--r--arch/hexagon/include/asm/barrier.h2
-rw-r--r--arch/hexagon/include/asm/bitops.h2
-rw-r--r--arch/hexagon/include/asm/cache.h2
-rw-r--r--arch/hexagon/include/asm/cacheflush.h2
-rw-r--r--arch/hexagon/include/asm/checksum.h2
-rw-r--r--arch/hexagon/include/asm/cmpxchg.h2
-rw-r--r--arch/hexagon/include/asm/delay.h2
-rw-r--r--arch/hexagon/include/asm/dma-mapping.h2
-rw-r--r--arch/hexagon/include/asm/dma.h2
-rw-r--r--arch/hexagon/include/asm/elf.h2
-rw-r--r--arch/hexagon/include/asm/exec.h2
-rw-r--r--arch/hexagon/include/asm/fixmap.h2
-rw-r--r--arch/hexagon/include/asm/hexagon_vm.h2
-rw-r--r--arch/hexagon/include/asm/intrinsics.h2
-rw-r--r--arch/hexagon/include/asm/io.h2
-rw-r--r--arch/hexagon/include/asm/irq.h2
-rw-r--r--arch/hexagon/include/asm/irqflags.h2
-rw-r--r--arch/hexagon/include/asm/kgdb.h2
-rw-r--r--arch/hexagon/include/asm/linkage.h2
-rw-r--r--arch/hexagon/include/asm/mem-layout.h2
-rw-r--r--arch/hexagon/include/asm/mmu.h2
-rw-r--r--arch/hexagon/include/asm/mmu_context.h2
-rw-r--r--arch/hexagon/include/asm/module.h2
-rw-r--r--arch/hexagon/include/asm/page.h2
-rw-r--r--arch/hexagon/include/asm/perf_event.h2
-rw-r--r--arch/hexagon/include/asm/pgalloc.h2
-rw-r--r--arch/hexagon/include/asm/pgtable.h2
-rw-r--r--arch/hexagon/include/asm/processor.h2
-rw-r--r--arch/hexagon/include/asm/smp.h2
-rw-r--r--arch/hexagon/include/asm/spinlock.h2
-rw-r--r--arch/hexagon/include/asm/spinlock_types.h2
-rw-r--r--arch/hexagon/include/asm/string.h2
-rw-r--r--arch/hexagon/include/asm/suspend.h2
-rw-r--r--arch/hexagon/include/asm/switch_to.h2
-rw-r--r--arch/hexagon/include/asm/syscall.h2
-rw-r--r--arch/hexagon/include/asm/thread_info.h2
-rw-r--r--arch/hexagon/include/asm/time.h2
-rw-r--r--arch/hexagon/include/asm/timer-regs.h2
-rw-r--r--arch/hexagon/include/asm/timex.h2
-rw-r--r--arch/hexagon/include/asm/tlb.h2
-rw-r--r--arch/hexagon/include/asm/tlbflush.h2
-rw-r--r--arch/hexagon/include/asm/traps.h2
-rw-r--r--arch/hexagon/include/asm/uaccess.h2
-rw-r--r--arch/hexagon/include/asm/vdso.h2
-rw-r--r--arch/hexagon/include/asm/vm_fault.h2
-rw-r--r--arch/hexagon/include/asm/vm_mmu.h2
-rw-r--r--arch/hexagon/include/uapi/asm/Kbuild12
-rw-r--r--arch/hexagon/include/uapi/asm/bitsperlong.h (renamed from arch/hexagon/include/asm/bitsperlong.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/byteorder.h (renamed from arch/hexagon/include/asm/byteorder.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/kvm_para.h (renamed from arch/hexagon/include/asm/kvm_para.h)0
-rw-r--r--arch/hexagon/include/uapi/asm/param.h (renamed from arch/hexagon/include/asm/param.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/ptrace.h (renamed from arch/hexagon/include/asm/ptrace.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/registers.h (renamed from arch/hexagon/include/asm/registers.h)17
-rw-r--r--arch/hexagon/include/uapi/asm/setup.h (renamed from arch/hexagon/include/asm/setup.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/sigcontext.h (renamed from arch/hexagon/include/asm/sigcontext.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/signal.h (renamed from arch/hexagon/include/asm/signal.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/swab.h (renamed from arch/hexagon/include/asm/swab.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/unistd.h (renamed from arch/hexagon/include/asm/unistd.h)2
-rw-r--r--arch/hexagon/include/uapi/asm/user.h (renamed from arch/hexagon/include/asm/user.h)18
-rw-r--r--arch/hexagon/kernel/asm-offsets.c2
-rw-r--r--arch/hexagon/kernel/dma.c2
-rw-r--r--arch/hexagon/kernel/head.S2
-rw-r--r--arch/hexagon/kernel/hexagon_ksyms.c2
-rw-r--r--arch/hexagon/kernel/irq_cpu.c2
-rw-r--r--arch/hexagon/kernel/kgdb.c2
-rw-r--r--arch/hexagon/kernel/module.c2
-rw-r--r--arch/hexagon/kernel/process.c2
-rw-r--r--arch/hexagon/kernel/ptrace.c2
-rw-r--r--arch/hexagon/kernel/reset.c2
-rw-r--r--arch/hexagon/kernel/setup.c2
-rw-r--r--arch/hexagon/kernel/signal.c2
-rw-r--r--arch/hexagon/kernel/smp.c2
-rw-r--r--arch/hexagon/kernel/stacktrace.c2
-rw-r--r--arch/hexagon/kernel/syscall.c2
-rw-r--r--arch/hexagon/kernel/syscalltab.c2
-rw-r--r--arch/hexagon/kernel/time.c2
-rw-r--r--arch/hexagon/kernel/topology.c2
-rw-r--r--arch/hexagon/kernel/trampoline.S2
-rw-r--r--arch/hexagon/kernel/traps.c2
-rw-r--r--arch/hexagon/kernel/vdso.c2
-rw-r--r--arch/hexagon/kernel/vm_entry.S2
-rw-r--r--arch/hexagon/kernel/vm_events.c2
-rw-r--r--arch/hexagon/kernel/vm_init_segtable.S2
-rw-r--r--arch/hexagon/kernel/vm_ops.S2
-rw-r--r--arch/hexagon/kernel/vm_switch.S2
-rw-r--r--arch/hexagon/kernel/vm_vectors.S2
-rw-r--r--arch/hexagon/kernel/vmlinux.lds.S2
-rw-r--r--arch/hexagon/lib/checksum.c2
-rw-r--r--arch/hexagon/lib/io.c2
-rw-r--r--arch/hexagon/lib/memcpy.S2
-rw-r--r--arch/hexagon/lib/memset.S2
-rw-r--r--arch/hexagon/mm/cache.c2
-rw-r--r--arch/hexagon/mm/copy_from_user.S2
-rw-r--r--arch/hexagon/mm/copy_to_user.S2
-rw-r--r--arch/hexagon/mm/copy_user_template.S2
-rw-r--r--arch/hexagon/mm/init.c2
-rw-r--r--arch/hexagon/mm/ioremap.c2
-rw-r--r--arch/hexagon/mm/pgalloc.c2
-rw-r--r--arch/hexagon/mm/strnlen_user.S2
-rw-r--r--arch/hexagon/mm/uaccess.c2
-rw-r--r--arch/hexagon/mm/vm_fault.c2
-rw-r--r--arch/hexagon/mm/vm_tlb.c2
-rw-r--r--arch/ia64/include/uapi/asm/Kbuild2
-rw-r--r--arch/ia64/include/uapi/asm/kvm_para.h0
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/delay.h6
-rw-r--r--arch/mips/include/asm/pgtable-64.h15
-rw-r--r--arch/mips/jz4740/serial.h3
-rw-r--r--arch/mips/kernel/smp-cmp.c2
-rw-r--r--arch/mips/lib/delay.c6
-rw-r--r--arch/mips/lib/dump_tlb.c4
-rw-r--r--arch/mips/mm/tlb-r4k.c1
-rw-r--r--arch/mips/mm/tlbex.c56
-rw-r--r--arch/mn10300/include/uapi/asm/setup.h4
-rw-r--r--arch/parisc/include/asm/Kbuild9
-rw-r--r--arch/parisc/include/asm/auxvec.h4
-rw-r--r--arch/parisc/include/asm/compat_signal.h2
-rw-r--r--arch/parisc/include/asm/cputime.h6
-rw-r--r--arch/parisc/include/asm/device.h7
-rw-r--r--arch/parisc/include/asm/div64.h1
-rw-r--r--arch/parisc/include/asm/emergency-restart.h6
-rw-r--r--arch/parisc/include/asm/hw_irq.h8
-rw-r--r--arch/parisc/include/asm/irq_regs.h1
-rw-r--r--arch/parisc/include/asm/kdebug.h1
-rw-r--r--arch/parisc/include/asm/kvm_para.h1
-rw-r--r--arch/parisc/include/asm/local.h1
-rw-r--r--arch/parisc/include/asm/local64.h1
-rw-r--r--arch/parisc/include/asm/mutex.h9
-rw-r--r--arch/parisc/include/asm/param.h1
-rw-r--r--arch/parisc/include/asm/pdc.h423
-rw-r--r--arch/parisc/include/asm/percpu.h7
-rw-r--r--arch/parisc/include/asm/poll.h1
-rw-r--r--arch/parisc/include/asm/ptrace.h46
-rw-r--r--arch/parisc/include/asm/real.h5
-rw-r--r--arch/parisc/include/asm/segment.h6
-rw-r--r--arch/parisc/include/asm/signal.h113
-rw-r--r--arch/parisc/include/asm/termios.h41
-rw-r--r--arch/parisc/include/asm/topology.h6
-rw-r--r--arch/parisc/include/asm/unistd.h835
-rw-r--r--arch/parisc/include/asm/user.h5
-rw-r--r--arch/parisc/include/asm/vga.h6
-rw-r--r--arch/parisc/include/asm/xor.h1
-rw-r--r--arch/parisc/include/uapi/asm/Kbuild28
-rw-r--r--arch/parisc/include/uapi/asm/bitsperlong.h (renamed from arch/parisc/include/asm/bitsperlong.h)0
-rw-r--r--arch/parisc/include/uapi/asm/byteorder.h (renamed from arch/parisc/include/asm/byteorder.h)0
-rw-r--r--arch/parisc/include/uapi/asm/errno.h (renamed from arch/parisc/include/asm/errno.h)0
-rw-r--r--arch/parisc/include/uapi/asm/fcntl.h (renamed from arch/parisc/include/asm/fcntl.h)0
-rw-r--r--arch/parisc/include/uapi/asm/ioctl.h (renamed from arch/parisc/include/asm/ioctl.h)0
-rw-r--r--arch/parisc/include/uapi/asm/ioctls.h (renamed from arch/parisc/include/asm/ioctls.h)0
-rw-r--r--arch/parisc/include/uapi/asm/ipcbuf.h (renamed from arch/parisc/include/asm/ipcbuf.h)0
-rw-r--r--arch/parisc/include/uapi/asm/mman.h (renamed from arch/parisc/include/asm/mman.h)0
-rw-r--r--arch/parisc/include/uapi/asm/msgbuf.h (renamed from arch/parisc/include/asm/msgbuf.h)0
-rw-r--r--arch/parisc/include/uapi/asm/pdc.h427
-rw-r--r--arch/parisc/include/uapi/asm/posix_types.h (renamed from arch/parisc/include/asm/posix_types.h)0
-rw-r--r--arch/parisc/include/uapi/asm/ptrace.h47
-rw-r--r--arch/parisc/include/uapi/asm/resource.h (renamed from arch/parisc/include/asm/resource.h)0
-rw-r--r--arch/parisc/include/uapi/asm/sembuf.h (renamed from arch/parisc/include/asm/sembuf.h)0
-rw-r--r--arch/parisc/include/uapi/asm/setup.h (renamed from arch/parisc/include/asm/setup.h)0
-rw-r--r--arch/parisc/include/uapi/asm/shmbuf.h (renamed from arch/parisc/include/asm/shmbuf.h)0
-rw-r--r--arch/parisc/include/uapi/asm/sigcontext.h (renamed from arch/parisc/include/asm/sigcontext.h)0
-rw-r--r--arch/parisc/include/uapi/asm/siginfo.h (renamed from arch/parisc/include/asm/siginfo.h)0
-rw-r--r--arch/parisc/include/uapi/asm/signal.h118
-rw-r--r--arch/parisc/include/uapi/asm/socket.h (renamed from arch/parisc/include/asm/socket.h)0
-rw-r--r--arch/parisc/include/uapi/asm/sockios.h (renamed from arch/parisc/include/asm/sockios.h)0
-rw-r--r--arch/parisc/include/uapi/asm/stat.h (renamed from arch/parisc/include/asm/stat.h)0
-rw-r--r--arch/parisc/include/uapi/asm/statfs.h (renamed from arch/parisc/include/asm/statfs.h)0
-rw-r--r--arch/parisc/include/uapi/asm/swab.h (renamed from arch/parisc/include/asm/swab.h)0
-rw-r--r--arch/parisc/include/uapi/asm/termbits.h (renamed from arch/parisc/include/asm/termbits.h)0
-rw-r--r--arch/parisc/include/uapi/asm/termios.h43
-rw-r--r--arch/parisc/include/uapi/asm/types.h (renamed from arch/parisc/include/asm/types.h)0
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h837
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_32.h1
-rw-r--r--arch/powerpc/include/asm/processor.h4
-rw-r--r--arch/powerpc/kernel/sysfs.c2
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c4
-rw-r--r--arch/powerpc/perf/core-book3s.c2
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c62
-rw-r--r--arch/s390/include/uapi/asm/Kbuild2
-rw-r--r--arch/s390/include/uapi/asm/kvm_para.h0
-rw-r--r--arch/sh/include/asm/Kbuild11
-rw-r--r--arch/sh/include/asm/hw_breakpoint.h4
-rw-r--r--arch/sh/include/asm/posix_types.h8
-rw-r--r--arch/sh/include/asm/ptrace.h34
-rw-r--r--arch/sh/include/asm/ptrace_32.h75
-rw-r--r--arch/sh/include/asm/ptrace_64.h12
-rw-r--r--arch/sh/include/asm/setup.h5
-rw-r--r--arch/sh/include/asm/types.h5
-rw-r--r--arch/sh/include/asm/unistd.h9
-rw-r--r--arch/sh/include/uapi/asm/Kbuild22
-rw-r--r--arch/sh/include/uapi/asm/auxvec.h (renamed from arch/sh/include/asm/auxvec.h)0
-rw-r--r--arch/sh/include/uapi/asm/byteorder.h (renamed from arch/sh/include/asm/byteorder.h)0
-rw-r--r--arch/sh/include/uapi/asm/cachectl.h (renamed from arch/sh/include/asm/cachectl.h)0
-rw-r--r--arch/sh/include/uapi/asm/cpu-features.h (renamed from arch/sh/include/asm/cpu-features.h)0
-rw-r--r--arch/sh/include/uapi/asm/hw_breakpoint.h4
-rw-r--r--arch/sh/include/uapi/asm/ioctls.h (renamed from arch/sh/include/asm/ioctls.h)0
-rw-r--r--arch/sh/include/uapi/asm/posix_types.h7
-rw-r--r--arch/sh/include/uapi/asm/posix_types_32.h (renamed from arch/sh/include/asm/posix_types_32.h)0
-rw-r--r--arch/sh/include/uapi/asm/posix_types_64.h (renamed from arch/sh/include/asm/posix_types_64.h)0
-rw-r--r--arch/sh/include/uapi/asm/ptrace.h34
-rw-r--r--arch/sh/include/uapi/asm/ptrace_32.h77
-rw-r--r--arch/sh/include/uapi/asm/ptrace_64.h14
-rw-r--r--arch/sh/include/uapi/asm/setup.h1
-rw-r--r--arch/sh/include/uapi/asm/sigcontext.h (renamed from arch/sh/include/asm/sigcontext.h)0
-rw-r--r--arch/sh/include/uapi/asm/signal.h (renamed from arch/sh/include/asm/signal.h)0
-rw-r--r--arch/sh/include/uapi/asm/sockios.h (renamed from arch/sh/include/asm/sockios.h)0
-rw-r--r--arch/sh/include/uapi/asm/stat.h (renamed from arch/sh/include/asm/stat.h)0
-rw-r--r--arch/sh/include/uapi/asm/swab.h (renamed from arch/sh/include/asm/swab.h)0
-rw-r--r--arch/sh/include/uapi/asm/types.h1
-rw-r--r--arch/sh/include/uapi/asm/unistd.h7
-rw-r--r--arch/sh/include/uapi/asm/unistd_32.h (renamed from arch/sh/include/asm/unistd_32.h)3
-rw-r--r--arch/sh/include/uapi/asm/unistd_64.h (renamed from arch/sh/include/asm/unistd_64.h)3
-rw-r--r--arch/sh/kernel/syscalls_32.S1
-rw-r--r--arch/sh/kernel/syscalls_64.S1
-rw-r--r--arch/sparc/include/asm/ptrace.h13
-rw-r--r--arch/sparc/include/asm/smp_64.h2
-rw-r--r--arch/sparc/include/uapi/asm/sigcontext.h4
-rw-r--r--arch/sparc/kernel/perf_event.c15
-rw-r--r--arch/sparc/kernel/process_64.c120
-rw-r--r--arch/sparc/kernel/smp_64.c11
-rw-r--r--arch/sparc/mm/ultra.S64
-rw-r--r--arch/tile/include/arch/Kbuild1
-rw-r--r--arch/tile/include/asm/Kbuild3
-rw-r--r--arch/tile/include/uapi/asm/Kbuild3
-rw-r--r--arch/x86/Makefile2
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c9
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c6
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event.c6
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kernel/setup.c17
-rw-r--r--arch/x86/realmode/rm/wakeup_asm.S15
-rw-r--r--arch/xtensa/boot/boot-redboot/bootstrap.S8
-rw-r--r--arch/xtensa/include/asm/Kbuild28
-rw-r--r--arch/xtensa/include/asm/atomic.h12
-rw-r--r--arch/xtensa/include/asm/bitsperlong.h1
-rw-r--r--arch/xtensa/include/asm/bug.h18
-rw-r--r--arch/xtensa/include/asm/cacheflush.h2
-rw-r--r--arch/xtensa/include/asm/cmpxchg.h4
-rw-r--r--arch/xtensa/include/asm/coprocessor.h5
-rw-r--r--arch/xtensa/include/asm/cputime.h6
-rw-r--r--arch/xtensa/include/asm/delay.h2
-rw-r--r--arch/xtensa/include/asm/device.h7
-rw-r--r--arch/xtensa/include/asm/div64.h16
-rw-r--r--arch/xtensa/include/asm/emergency-restart.h6
-rw-r--r--arch/xtensa/include/asm/errno.h16
-rw-r--r--arch/xtensa/include/asm/fcntl.h1
-rw-r--r--arch/xtensa/include/asm/futex.h1
-rw-r--r--arch/xtensa/include/asm/hardirq.h16
-rw-r--r--arch/xtensa/include/asm/ioctl.h1
-rw-r--r--arch/xtensa/include/asm/irq_regs.h1
-rw-r--r--arch/xtensa/include/asm/irqflags.h4
-rw-r--r--arch/xtensa/include/asm/kdebug.h1
-rw-r--r--arch/xtensa/include/asm/kmap_types.h6
-rw-r--r--arch/xtensa/include/asm/kvm_para.h1
-rw-r--r--arch/xtensa/include/asm/local.h16
-rw-r--r--arch/xtensa/include/asm/local64.h1
-rw-r--r--arch/xtensa/include/asm/mmu_context.h4
-rw-r--r--arch/xtensa/include/asm/param.h20
-rw-r--r--arch/xtensa/include/asm/percpu.h16
-rw-r--r--arch/xtensa/include/asm/ptrace.h66
-rw-r--r--arch/xtensa/include/asm/regs.h55
-rw-r--r--arch/xtensa/include/asm/resource.h16
-rw-r--r--arch/xtensa/include/asm/scatterlist.h16
-rw-r--r--arch/xtensa/include/asm/sections.h16
-rw-r--r--arch/xtensa/include/asm/siginfo.h16
-rw-r--r--arch/xtensa/include/asm/signal.h134
-rw-r--r--arch/xtensa/include/asm/statfs.h17
-rw-r--r--arch/xtensa/include/asm/termios.h105
-rw-r--r--arch/xtensa/include/asm/timex.h8
-rw-r--r--arch/xtensa/include/asm/tlbflush.h8
-rw-r--r--arch/xtensa/include/asm/topology.h16
-rw-r--r--arch/xtensa/include/asm/types.h15
-rw-r--r--arch/xtensa/include/asm/unistd.h702
-rw-r--r--arch/xtensa/include/asm/xor.h16
-rw-r--r--arch/xtensa/include/uapi/asm/Kbuild22
-rw-r--r--arch/xtensa/include/uapi/asm/auxvec.h (renamed from arch/xtensa/include/asm/auxvec.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/byteorder.h (renamed from arch/xtensa/include/asm/byteorder.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/ioctls.h (renamed from arch/xtensa/include/asm/ioctls.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/ipcbuf.h (renamed from arch/xtensa/include/asm/ipcbuf.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/mman.h (renamed from arch/xtensa/include/asm/mman.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/msgbuf.h (renamed from arch/xtensa/include/asm/msgbuf.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/param.h30
-rw-r--r--arch/xtensa/include/uapi/asm/poll.h (renamed from arch/xtensa/include/asm/poll.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/posix_types.h (renamed from arch/xtensa/include/asm/posix_types.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/ptrace.h77
-rw-r--r--arch/xtensa/include/uapi/asm/sembuf.h (renamed from arch/xtensa/include/asm/sembuf.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/setup.h (renamed from arch/xtensa/include/asm/setup.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/shmbuf.h (renamed from arch/xtensa/include/asm/shmbuf.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/sigcontext.h (renamed from arch/xtensa/include/asm/sigcontext.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/signal.h148
-rw-r--r--arch/xtensa/include/uapi/asm/socket.h (renamed from arch/xtensa/include/asm/socket.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/sockios.h (renamed from arch/xtensa/include/asm/sockios.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/stat.h (renamed from arch/xtensa/include/asm/stat.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/swab.h (renamed from arch/xtensa/include/asm/swab.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/termbits.h (renamed from arch/xtensa/include/asm/termbits.h)0
-rw-r--r--arch/xtensa/include/uapi/asm/types.h28
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h762
-rw-r--r--arch/xtensa/kernel/align.S38
-rw-r--r--arch/xtensa/kernel/coprocessor.S20
-rw-r--r--arch/xtensa/kernel/entry.S254
-rw-r--r--arch/xtensa/kernel/head.S36
-rw-r--r--arch/xtensa/kernel/irq.c6
-rw-r--r--arch/xtensa/kernel/process.c29
-rw-r--r--arch/xtensa/kernel/setup.c4
-rw-r--r--arch/xtensa/kernel/syscall.c1
-rw-r--r--arch/xtensa/kernel/traps.c22
-rw-r--r--arch/xtensa/kernel/vectors.S44
-rw-r--r--arch/xtensa/lib/memcopy.S309
-rw-r--r--arch/xtensa/mm/fault.c3
-rw-r--r--arch/xtensa/platforms/iss/console.c9
-rw-r--r--arch/xtensa/platforms/iss/include/platform/simcall.h9
-rw-r--r--arch/xtensa/platforms/iss/setup.c10
-rw-r--r--arch/xtensa/platforms/xt2000/setup.c10
-rw-r--r--drivers/Makefile4
-rw-r--r--drivers/acpi/Makefile5
-rw-r--r--drivers/bluetooth/hci_ldisc.c7
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/agp/intel-gtt.c2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c36
-rw-r--r--drivers/firmware/memmap.c4
-rw-r--r--drivers/gpio/gpio-mvebu.c3
-rw-r--r--drivers/gpu/drm/drm_info.c2
-rw-r--r--drivers/gpu/drm/i915/dvo_ch7xxx.c6
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h9
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c19
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c47
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c3
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c72
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/fan.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c6
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c8
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c7
-rw-r--r--drivers/gpu/drm/radeon/ni.c12
-rw-r--r--drivers/gpu/drm/radeon/r600.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon.h14
-rw-r--r--drivers/gpu/drm/radeon/radeon_acpi.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c374
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c22
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c48
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c2
-rw-r--r--drivers/gpu/drm/radeon/si.c7
-rw-r--r--drivers/hwmon/coretemp.c7
-rw-r--r--drivers/hwmon/pmbus/Kconfig2
-rw-r--r--drivers/media/Kconfig18
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c10
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c2
-rw-r--r--drivers/of/address.c24
-rw-r--r--drivers/of/irq.c8
-rw-r--r--drivers/of/platform.c2
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c2
-rw-r--r--drivers/pinctrl/pinctrl-bcm2835.c5
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c26
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c10
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c35
-rw-r--r--drivers/pinctrl/pinctrl-xway.c2
-rw-r--r--drivers/s390/net/qeth_l2_main.c11
-rw-r--r--drivers/s390/net/qeth_l3_main.c11
-rw-r--r--drivers/s390/net/smsgiucv.c2
-rw-r--r--drivers/scsi/arm/fas216.c2
-rw-r--r--drivers/scsi/arm/oak.c1
-rw-r--r--drivers/sh/intc/access.c45
-rw-r--r--drivers/sh/intc/chip.c4
-rw-r--r--drivers/spi/spi-s3c64xx.c6
-rw-r--r--drivers/staging/dgrp/dgrp_mon_ops.c1
-rw-r--r--drivers/staging/dgrp/dgrp_specproc.c7
-rw-r--r--drivers/staging/dgrp/dgrp_tty.c10
-rw-r--r--drivers/thermal/Kconfig2
-rw-r--r--drivers/tty/n_tty.c752
-rw-r--r--drivers/tty/pty.c30
-rw-r--r--drivers/tty/serial/8250/8250.c9
-rw-r--r--drivers/tty/serial/8250/8250.h36
-rw-r--r--drivers/tty/serial/8250/8250_early.c2
-rw-r--r--drivers/tty/serial/8250/8250_hp300.c20
-rw-r--r--drivers/tty/serial/Kconfig4
-rw-r--r--drivers/tty/serial/samsung.c16
-rw-r--r--drivers/tty/serial/sccnxp.c1
-rw-r--r--drivers/tty/serial/sh-sci.c3
-rw-r--r--drivers/tty/sysrq.c1
-rw-r--r--drivers/tty/tty_audit.c15
-rw-r--r--drivers/tty/tty_buffer.c228
-rw-r--r--drivers/tty/tty_io.c15
-rw-r--r--drivers/tty/tty_ldisc.c15
-rw-r--r--drivers/tty/tty_port.c2
-rw-r--r--drivers/tty/vt/selection.c9
-rw-r--r--drivers/usb/class/cdc-acm.c22
-rw-r--r--drivers/usb/core/devio.c1
-rw-r--r--drivers/usb/core/driver.c4
-rw-r--r--drivers/usb/core/hub.c36
-rw-r--r--drivers/usb/dwc3/core.c4
-rw-r--r--drivers/usb/dwc3/gadget.c2
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/lpc32xx_udc.c4
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/ehci-orion.c2
-rw-r--r--drivers/usb/host/ehci-vt8500.c10
-rw-r--r--drivers/usb/host/uhci-platform.c9
-rw-r--r--drivers/usb/host/xhci.c3
-rw-r--r--drivers/usb/musb/am35x.c6
-rw-r--r--drivers/usb/renesas_usbhs/mod.c6
-rw-r--r--drivers/usb/renesas_usbhs/pipe.h2
-rw-r--r--drivers/usb/serial/ark3116.c26
-rw-r--r--drivers/usb/serial/belkin_sa.c31
-rw-r--r--drivers/usb/serial/cp210x.c40
-rw-r--r--drivers/usb/serial/cyberjack.c49
-rw-r--r--drivers/usb/serial/cypress_m8.c75
-rw-r--r--drivers/usb/serial/f81232.c43
-rw-r--r--drivers/usb/serial/garmin_gps.c24
-rw-r--r--drivers/usb/serial/io_edgeport.c54
-rw-r--r--drivers/usb/serial/io_tables.h8
-rw-r--r--drivers/usb/serial/io_ti.c91
-rw-r--r--drivers/usb/serial/iuu_phoenix.c76
-rw-r--r--drivers/usb/serial/keyspan_pda.c30
-rw-r--r--drivers/usb/serial/kl5kusb105.c68
-rw-r--r--drivers/usb/serial/kobil_sct.c23
-rw-r--r--drivers/usb/serial/option.c84
-rw-r--r--drivers/usb/serial/oti6858.c68
-rw-r--r--drivers/usb/serial/pl2303.c90
-rw-r--r--drivers/usb/serial/spcp8x5.c46
-rw-r--r--drivers/usb/serial/ssu100.c34
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c88
-rw-r--r--drivers/video/backlight/lm3639_bl.c4
-rw-r--r--drivers/xen/xenbus/xenbus_xs.c2
-rw-r--r--fs/coredump.c5
-rw-r--r--fs/devpts/inode.c61
-rw-r--r--fs/ext2/super.c4
-rw-r--r--fs/ext3/namei.c40
-rw-r--r--fs/ext3/namei.h19
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/lockd/clntxdr.c2
-rw-r--r--fs/lockd/svcproc.c3
-rw-r--r--fs/proc/internal.h4
-rw-r--r--fs/proc/task_mmu.c53
-rw-r--r--fs/quota/dquot.c2
-rw-r--r--fs/xattr.c2
-rw-r--r--include/Kbuild4
-rw-r--r--include/asm-generic/Kbuild0
-rw-r--r--include/drm/Kbuild0
-rw-r--r--include/linux/Kbuild26
-rw-r--r--include/linux/byteorder/Kbuild0
-rw-r--r--include/linux/caif/Kbuild0
-rw-r--r--include/linux/can/Kbuild0
-rw-r--r--include/linux/coredump.h1
-rw-r--r--include/linux/devpts_fs.h20
-rw-r--r--include/linux/dvb/Kbuild8
-rw-r--r--include/linux/dvb/dmx.h130
-rw-r--r--include/linux/dvb/video.h249
-rw-r--r--include/linux/elf-fdpic.h51
-rw-r--r--include/linux/fs.h126
-rw-r--r--include/linux/hsi/Kbuild1
-rw-r--r--include/linux/isdn/Kbuild0
-rw-r--r--include/linux/mmc/Kbuild0
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/ipset/Kbuild0
-rw-r--r--include/linux/netfilter_arp/Kbuild0
-rw-r--r--include/linux/netfilter_bridge/Kbuild0
-rw-r--r--include/linux/netfilter_ipv4/Kbuild0
-rw-r--r--include/linux/netfilter_ipv6/Kbuild0
-rw-r--r--include/linux/nfsd/Kbuild0
-rw-r--r--include/linux/of.h7
-rw-r--r--include/linux/of_address.h4
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/pid_namespace.h8
-rw-r--r--include/linux/ratelimit.h27
-rw-r--r--include/linux/spi/Kbuild0
-rw-r--r--include/linux/sunrpc/Kbuild0
-rw-r--r--include/linux/tc_act/Kbuild0
-rw-r--r--include/linux/tc_ematch/Kbuild0
-rw-r--r--include/linux/tty.h44
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/usb.h11
-rw-r--r--include/linux/usb/Kbuild10
-rw-r--r--include/linux/usb/audio.h524
-rw-r--r--include/linux/usb/ch9.h960
-rw-r--r--include/linux/usb/functionfs.h167
-rw-r--r--include/linux/wimax/Kbuild0
-rw-r--r--include/mtd/Kbuild0
-rw-r--r--include/uapi/asm-generic/kvm_para.h4
-rw-r--r--include/uapi/linux/dvb/Kbuild8
-rw-r--r--include/uapi/linux/dvb/audio.h (renamed from include/linux/dvb/audio.h)0
-rw-r--r--include/uapi/linux/dvb/ca.h (renamed from include/linux/dvb/ca.h)0
-rw-r--r--include/uapi/linux/dvb/dmx.h155
-rw-r--r--include/uapi/linux/dvb/frontend.h (renamed from include/linux/dvb/frontend.h)0
-rw-r--r--include/uapi/linux/dvb/net.h (renamed from include/linux/dvb/net.h)0
-rw-r--r--include/uapi/linux/dvb/osd.h (renamed from include/linux/dvb/osd.h)0
-rw-r--r--include/uapi/linux/dvb/version.h (renamed from include/linux/dvb/version.h)0
-rw-r--r--include/uapi/linux/dvb/video.h274
-rw-r--r--include/uapi/linux/elf-fdpic.h42
-rw-r--r--include/uapi/linux/fs.h132
-rw-r--r--include/uapi/linux/hsi/Kbuild1
-rw-r--r--include/uapi/linux/hsi/hsi_char.h (renamed from include/linux/hsi/hsi_char.h)0
-rw-r--r--include/uapi/linux/irqnr.h4
-rw-r--r--include/uapi/linux/usb/Kbuild10
-rw-r--r--include/uapi/linux/usb/audio.h545
-rw-r--r--include/uapi/linux/usb/cdc.h (renamed from include/linux/usb/cdc.h)0
-rw-r--r--include/uapi/linux/usb/ch11.h (renamed from include/linux/usb/ch11.h)0
-rw-r--r--include/uapi/linux/usb/ch9.h993
-rw-r--r--include/uapi/linux/usb/functionfs.h169
-rw-r--r--include/uapi/linux/usb/g_printer.h (renamed from include/linux/usb/g_printer.h)0
-rw-r--r--include/uapi/linux/usb/gadgetfs.h (renamed from include/linux/usb/gadgetfs.h)0
-rw-r--r--include/uapi/linux/usb/midi.h (renamed from include/linux/usb/midi.h)0
-rw-r--r--include/uapi/linux/usb/tmc.h (renamed from include/linux/usb/tmc.h)0
-rw-r--r--include/uapi/linux/usb/video.h (renamed from include/linux/usb/video.h)0
-rw-r--r--include/xen/Kbuild0
-rw-r--r--kernel/module-internal.h3
-rw-r--r--kernel/module.c26
-rw-r--r--kernel/module_signing.c24
-rw-r--r--kernel/pid_namespace.c21
-rw-r--r--kernel/printk.c13
-rw-r--r--kernel/sys.c12
-rw-r--r--lib/dma-debug.c4
-rw-r--r--mm/compaction.c2
-rw-r--r--mm/fremap.c2
-rw-r--r--mm/huge_memory.c1
-rw-r--r--mm/mempolicy.c5
-rw-r--r--mm/slob.c6
-rw-r--r--net/8021q/vlan_core.c9
-rw-r--r--net/ipv6/addrconf.c15
-rw-r--r--net/irda/ircomm/ircomm_tty.c2
-rw-r--r--net/sctp/sm_sideeffect.c3
-rw-r--r--net/sunrpc/cache.c4
-rw-r--r--scripts/Makefile.asm-generic2
-rw-r--r--scripts/Makefile.fwinst4
-rw-r--r--scripts/Makefile.modinst2
-rw-r--r--scripts/Makefile.modpost77
-rw-r--r--scripts/dtc/dtc.h44
-rwxr-xr-x[-rw-r--r--]scripts/sign-file498
-rwxr-xr-xscripts/x509keyid268
-rw-r--r--security/apparmor/Makefile2
-rw-r--r--security/selinux/hooks.c18
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c9
-rw-r--r--sound/pci/hda/hda_intel.c42
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/soc/Makefile5
-rw-r--r--sound/soc/codecs/da9055.c22
-rw-r--r--sound/soc/codecs/twl6040.c8
-rw-r--r--sound/soc/codecs/wm2200.c3
-rw-r--r--sound/soc/omap/ams-delta.c63
-rw-r--r--sound/soc/pxa/mmp-pcm.c2
-rw-r--r--sound/soc/samsung/bells.c4
-rw-r--r--sound/soc/sh/fsi.c15
-rw-r--r--sound/soc/soc-jack.c7
-rw-r--r--tools/lib/traceevent/event-parse.c9
-rw-r--r--tools/lib/traceevent/parse-filter.c15
-rw-r--r--tools/perf/Makefile24
-rw-r--r--tools/perf/perf.h2
-rw-r--r--tools/perf/ui/browsers/hists.c6
-rw-r--r--tools/perf/util/parse-events.c3
-rw-r--r--tools/perf/util/setup.py2
-rw-r--r--tools/perf/util/sort.c6
613 files changed, 9242 insertions, 8317 deletions
diff --git a/.gitignore b/.gitignore
index 0f2f40f71915..92bd0e45dfa1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,10 +14,6 @@
14*.o.* 14*.o.*
15*.a 15*.a
16*.s 16*.s
17*.ko.unsigned
18*.ko.stripped
19*.ko.stripped.dig
20*.ko.stripped.sig
21*.ko 17*.ko
22*.so 18*.so
23*.so.dbg 19*.so.dbg
@@ -95,6 +91,4 @@ GTAGS
95extra_certificates 91extra_certificates
96signing_key.priv 92signing_key.priv
97signing_key.x509 93signing_key.x509
98signing_key.x509.keyid
99signing_key.x509.signer
100x509.genkey 94x509.genkey
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
index 9b7e4c557928..f9fd615427fb 100644
--- a/Documentation/DocBook/media/Makefile
+++ b/Documentation/DocBook/media/Makefile
@@ -56,15 +56,15 @@ FUNCS = \
56 write \ 56 write \
57 57
58IOCTLS = \ 58IOCTLS = \
59 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ 59 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/videodev2.h) \
60 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/audio.h) \ 60 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/audio.h) \
61 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/ca.h) \ 61 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/ca.h) \
62 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/dmx.h) \ 62 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/dmx.h) \
63 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \ 63 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/frontend.h) \
64 $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/net.h) \ 64 $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/net.h) \
65 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/video.h) \ 65 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/video.h) \
66 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ 66 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/media.h) \
67 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ 67 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \
68 VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 68 VIDIOC_SUBDEV_G_FRAME_INTERVAL \
69 VIDIOC_SUBDEV_S_FRAME_INTERVAL \ 69 VIDIOC_SUBDEV_S_FRAME_INTERVAL \
70 VIDIOC_SUBDEV_ENUM_MBUS_CODE \ 70 VIDIOC_SUBDEV_ENUM_MBUS_CODE \
@@ -74,32 +74,32 @@ IOCTLS = \
74 VIDIOC_SUBDEV_S_SELECTION \ 74 VIDIOC_SUBDEV_S_SELECTION \
75 75
76TYPES = \ 76TYPES = \
77 $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \ 77 $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/uapi/linux/videodev2.h) \
78 $(shell perl -ne 'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree)/include/linux/dvb/frontend.h) 78 $(shell perl -ne 'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree)/include/uapi/linux/dvb/frontend.h)
79 79
80ENUMS = \ 80ENUMS = \
81 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ 81 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/videodev2.h) \
82 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/audio.h) \ 82 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/audio.h) \
83 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/ca.h) \ 83 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/ca.h) \
84 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/dmx.h) \ 84 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/dmx.h) \
85 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ 85 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/frontend.h) \
86 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/net.h) \ 86 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/net.h) \
87 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/video.h) \ 87 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/video.h) \
88 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ 88 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \
89 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ 89 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h) \
90 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) 90 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h)
91 91
92STRUCTS = \ 92STRUCTS = \
93 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ 93 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/videodev2.h) \
94 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/linux/dvb/audio.h) \ 94 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/uapi/linux/dvb/audio.h) \
95 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/ca.h) \ 95 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/ca.h) \
96 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/dmx.h) \ 96 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/dmx.h) \
97 $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \ 97 $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/frontend.h) \
98 $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/linux/dvb/net.h) \ 98 $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/net.h) \
99 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/video.h) \ 99 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/video.h) \
100 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ 100 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \
101 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ 101 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \
102 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) 102 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h)
103 103
104ERRORS = \ 104ERRORS = \
105 E2BIG \ 105 E2BIG \
@@ -205,7 +205,7 @@ $(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES)
205 @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/) 205 @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/)
206 @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/) 206 @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/)
207 207
208$(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml 208$(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/uapi/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml
209 @$($(quiet)gen_xml) 209 @$($(quiet)gen_xml)
210 @( \ 210 @( \
211 echo "<programlisting>") > $@ 211 echo "<programlisting>") > $@
@@ -216,7 +216,7 @@ $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_O
216 @( \ 216 @( \
217 echo "</programlisting>") >> $@ 217 echo "</programlisting>") >> $@
218 218
219$(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml 219$(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/uapi/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml
220 @$($(quiet)gen_xml) 220 @$($(quiet)gen_xml)
221 @( \ 221 @( \
222 echo "<programlisting>") > $@ 222 echo "<programlisting>") > $@
@@ -227,7 +227,7 @@ $(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/linux/dvb/audio.h $(MEDIA_OBJ_D
227 @( \ 227 @( \
228 echo "</programlisting>") >> $@ 228 echo "</programlisting>") >> $@
229 229
230$(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml 230$(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/uapi/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml
231 @$($(quiet)gen_xml) 231 @$($(quiet)gen_xml)
232 @( \ 232 @( \
233 echo "<programlisting>") > $@ 233 echo "<programlisting>") > $@
@@ -238,7 +238,7 @@ $(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4
238 @( \ 238 @( \
239 echo "</programlisting>") >> $@ 239 echo "</programlisting>") >> $@
240 240
241$(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml 241$(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/uapi/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml
242 @$($(quiet)gen_xml) 242 @$($(quiet)gen_xml)
243 @( \ 243 @( \
244 echo "<programlisting>") > $@ 244 echo "<programlisting>") > $@
@@ -249,7 +249,7 @@ $(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/
249 @( \ 249 @( \
250 echo "</programlisting>") >> $@ 250 echo "</programlisting>") >> $@
251 251
252$(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml 252$(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/uapi/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml
253 @$($(quiet)gen_xml) 253 @$($(quiet)gen_xml)
254 @( \ 254 @( \
255 echo "<programlisting>") > $@ 255 echo "<programlisting>") > $@
@@ -260,7 +260,7 @@ $(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA
260 @( \ 260 @( \
261 echo "</programlisting>") >> $@ 261 echo "</programlisting>") >> $@
262 262
263$(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml 263$(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/uapi/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml
264 @$($(quiet)gen_xml) 264 @$($(quiet)gen_xml)
265 @( \ 265 @( \
266 echo "<programlisting>") > $@ 266 echo "<programlisting>") > $@
@@ -271,7 +271,7 @@ $(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/
271 @( \ 271 @( \
272 echo "</programlisting>") >> $@ 272 echo "</programlisting>") >> $@
273 273
274$(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml 274$(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/uapi/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml
275 @$($(quiet)gen_xml) 275 @$($(quiet)gen_xml)
276 @( \ 276 @( \
277 echo "<programlisting>") > $@ 277 echo "<programlisting>") > $@
diff --git a/Documentation/DocBook/networking.tmpl b/Documentation/DocBook/networking.tmpl
index 59ad69a9d777..29df25016c7c 100644
--- a/Documentation/DocBook/networking.tmpl
+++ b/Documentation/DocBook/networking.tmpl
@@ -56,7 +56,7 @@
56!Enet/core/filter.c 56!Enet/core/filter.c
57 </sect1> 57 </sect1>
58 <sect1><title>Generic Network Statistics</title> 58 <sect1><title>Generic Network Statistics</title>
59!Iinclude/linux/gen_stats.h 59!Iinclude/uapi/linux/gen_stats.h
60!Enet/core/gen_stats.c 60!Enet/core/gen_stats.c
61!Enet/core/gen_estimator.c 61!Enet/core/gen_estimator.c
62 </sect1> 62 </sect1>
@@ -80,7 +80,7 @@
80!Enet/wimax/op-rfkill.c 80!Enet/wimax/op-rfkill.c
81!Enet/wimax/stack.c 81!Enet/wimax/stack.c
82!Iinclude/net/wimax.h 82!Iinclude/net/wimax.h
83!Iinclude/linux/wimax.h 83!Iinclude/uapi/linux/wimax.h
84 </sect1> 84 </sect1>
85 </chapter> 85 </chapter>
86 86
diff --git a/Documentation/IPMI.txt b/Documentation/IPMI.txt
index b2bea15137d2..16eb4c9e9233 100644
--- a/Documentation/IPMI.txt
+++ b/Documentation/IPMI.txt
@@ -42,13 +42,7 @@ The driver interface depends on your hardware. If your system
42properly provides the SMBIOS info for IPMI, the driver will detect it 42properly provides the SMBIOS info for IPMI, the driver will detect it
43and just work. If you have a board with a standard interface (These 43and just work. If you have a board with a standard interface (These
44will generally be either "KCS", "SMIC", or "BT", consult your hardware 44will generally be either "KCS", "SMIC", or "BT", consult your hardware
45manual), choose the 'IPMI SI handler' option. A driver also exists 45manual), choose the 'IPMI SI handler' option.
46for direct I2C access to the IPMI management controller. Some boards
47support this, but it is unknown if it will work on every board. For
48this, choose 'IPMI SMBus handler', but be ready to try to do some
49figuring to see if it will work on your system if the SMBIOS/APCI
50information is wrong or not present. It is fairly safe to have both
51these enabled and let the drivers auto-detect what is present.
52 46
53You should generally enable ACPI on your system, as systems with IPMI 47You should generally enable ACPI on your system, as systems with IPMI
54can have ACPI tables describing them. 48can have ACPI tables describing them.
@@ -58,8 +52,7 @@ their job correctly, the IPMI controller should be automatically
58detected (via ACPI or SMBIOS tables) and should just work. Sadly, 52detected (via ACPI or SMBIOS tables) and should just work. Sadly,
59many boards do not have this information. The driver attempts 53many boards do not have this information. The driver attempts
60standard defaults, but they may not work. If you fall into this 54standard defaults, but they may not work. If you fall into this
61situation, you need to read the section below named 'The SI Driver' or 55situation, you need to read the section below named 'The SI Driver'.
62"The SMBus Driver" on how to hand-configure your system.
63 56
64IPMI defines a standard watchdog timer. You can enable this with the 57IPMI defines a standard watchdog timer. You can enable this with the
65'IPMI Watchdog Timer' config option. If you compile the driver into 58'IPMI Watchdog Timer' config option. If you compile the driver into
@@ -104,12 +97,7 @@ driver, each open file for this device ties in to the message handler
104as an IPMI user. 97as an IPMI user.
105 98
106ipmi_si - A driver for various system interfaces. This supports KCS, 99ipmi_si - A driver for various system interfaces. This supports KCS,
107SMIC, and BT interfaces. Unless you have an SMBus interface or your 100SMIC, and BT interfaces.
108own custom interface, you probably need to use this.
109
110ipmi_smb - A driver for accessing BMCs on the SMBus. It uses the
111I2C kernel driver's SMBus interfaces to send and receive IPMI messages
112over the SMBus.
113 101
114ipmi_watchdog - IPMI requires systems to have a very capable watchdog 102ipmi_watchdog - IPMI requires systems to have a very capable watchdog
115timer. This driver implements the standard Linux watchdog timer 103timer. This driver implements the standard Linux watchdog timer
@@ -482,53 +470,6 @@ for specifying an interface. Note that when removing an interface,
482only the first three parameters (si type, address type, and address) 470only the first three parameters (si type, address type, and address)
483are used for the comparison. Any options are ignored for removing. 471are used for the comparison. Any options are ignored for removing.
484 472
485The SMBus Driver
486----------------
487
488The SMBus driver allows up to 4 SMBus devices to be configured in the
489system. By default, the driver will register any SMBus interfaces it finds
490in the I2C address range of 0x20 to 0x4f on any adapter. You can change this
491at module load time (for a module) with:
492
493 modprobe ipmi_smb.o
494 addr=<adapter1>,<i2caddr1>[,<adapter2>,<i2caddr2>[,...]]
495 dbg=<flags1>,<flags2>...
496 [defaultprobe=1] [dbg_probe=1]
497
498The addresses are specified in pairs, the first is the adapter ID and the
499second is the I2C address on that adapter.
500
501The debug flags are bit flags for each BMC found, they are:
502IPMI messages: 1, driver state: 2, timing: 4, I2C probe: 8
503
504Setting smb_defaultprobe to zero disabled the default probing of SMBus
505interfaces at address range 0x20 to 0x4f. This means that only the
506BMCs specified on the smb_addr line will be detected.
507
508Setting smb_dbg_probe to 1 will enable debugging of the probing and
509detection process for BMCs on the SMBusses.
510
511Discovering the IPMI compliant BMC on the SMBus can cause devices
512on the I2C bus to fail. The SMBus driver writes a "Get Device ID" IPMI
513message as a block write to the I2C bus and waits for a response.
514This action can be detrimental to some I2C devices. It is highly recommended
515that the known I2c address be given to the SMBus driver in the smb_addr
516parameter. The default address range will not be used when a smb_addr
517parameter is provided.
518
519When compiled into the kernel, the addresses can be specified on the
520kernel command line as:
521
522 ipmb_smb.addr=<adapter1>,<i2caddr1>[,<adapter2>,<i2caddr2>[,...]]
523 ipmi_smb.dbg=<flags1>,<flags2>...
524 ipmi_smb.defaultprobe=0 ipmi_smb.dbg_probe=1
525
526These are the same options as on the module command line.
527
528Note that you might need some I2C changes if CONFIG_IPMI_PANIC_EVENT
529is enabled along with this, so the I2C driver knows to run to
530completion during sending a panic event.
531
532 473
533Other Pieces 474Other Pieces
534------------ 475------------
diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index c86b50c03ea8..f17256f069ba 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -105,6 +105,7 @@ Process Processor TjMax(C)
105 330/230 125 105 330/230 125
106 E680/660/640/620 90 106 E680/660/640/620 90
107 E680T/660T/640T/620T 110 107 E680T/660T/640T/620T 110
108 CE4170/4150/4110 110
108 109
10945nm Core2 Processors 11045nm Core2 Processors
110 Solo ULV SU3500/3300 100 111 Solo ULV SU3500/3300 100
diff --git a/Documentation/hwmon/submitting-patches b/Documentation/hwmon/submitting-patches
index 790f774a3032..843751c41fea 100644
--- a/Documentation/hwmon/submitting-patches
+++ b/Documentation/hwmon/submitting-patches
@@ -60,8 +60,7 @@ increase the chances of your change being accepted.
60 60
61* Add the driver to Kconfig and Makefile in alphabetical order. 61* Add the driver to Kconfig and Makefile in alphabetical order.
62 62
63* Make sure that all dependencies are listed in Kconfig. For new drivers, it 63* Make sure that all dependencies are listed in Kconfig.
64 is most likely prudent to add a dependency on EXPERIMENTAL.
65 64
66* Avoid forward declarations if you can. Rearrange the code if necessary. 65* Avoid forward declarations if you can. Rearrange the code if necessary.
67 66
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 642f84495b29..2a4cdda4828e 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -116,6 +116,7 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
116'w' - Dumps tasks that are in uninterruptable (blocked) state. 116'w' - Dumps tasks that are in uninterruptable (blocked) state.
117 117
118'x' - Used by xmon interface on ppc/powerpc platforms. 118'x' - Used by xmon interface on ppc/powerpc platforms.
119 Show global PMU Registers on sparc64.
119 120
120'y' - Show global CPU Registers [SPARC-64 specific] 121'y' - Show global CPU Registers [SPARC-64 specific]
121 122
diff --git a/MAINTAINERS b/MAINTAINERS
index e73060fe0788..027ec2bfa135 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -235,6 +235,7 @@ F: drivers/platform/x86/acer-wmi.c
235 235
236ACPI 236ACPI
237M: Len Brown <lenb@kernel.org> 237M: Len Brown <lenb@kernel.org>
238M: Rafael J. Wysocki <rjw@sisk.pl>
238L: linux-acpi@vger.kernel.org 239L: linux-acpi@vger.kernel.org
239W: http://www.lesswatts.org/projects/acpi/ 240W: http://www.lesswatts.org/projects/acpi/
240Q: http://patchwork.kernel.org/project/linux-acpi/list/ 241Q: http://patchwork.kernel.org/project/linux-acpi/list/
@@ -4372,7 +4373,7 @@ F: Documentation/scsi/53c700.txt
4372F: drivers/scsi/53c700* 4373F: drivers/scsi/53c700*
4373 4374
4374LED SUBSYSTEM 4375LED SUBSYSTEM
4375M: Bryan Wu <bryan.wu@canonical.com> 4376M: Bryan Wu <cooloney@gmail.com>
4376M: Richard Purdie <rpurdie@rpsys.net> 4377M: Richard Purdie <rpurdie@rpsys.net>
4377L: linux-leds@vger.kernel.org 4378L: linux-leds@vger.kernel.org
4378T: git git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git 4379T: git git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git
@@ -5019,6 +5020,20 @@ F: net/ipv6/
5019F: include/net/ip* 5020F: include/net/ip*
5020F: arch/x86/net/* 5021F: arch/x86/net/*
5021 5022
5023NETWORKING [IPSEC]
5024M: Steffen Klassert <steffen.klassert@secunet.com>
5025M: Herbert Xu <herbert@gondor.apana.org.au>
5026M: "David S. Miller" <davem@davemloft.net>
5027L: netdev@vger.kernel.org
5028T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
5029S: Maintained
5030F: net/xfrm/
5031F: net/key/
5032F: net/ipv4/xfrm*
5033F: net/ipv6/xfrm*
5034F: include/uapi/linux/xfrm.h
5035F: include/net/xfrm.h
5036
5022NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK) 5037NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK)
5023M: Paul Moore <paul@paul-moore.com> 5038M: Paul Moore <paul@paul-moore.com>
5024L: netdev@vger.kernel.org 5039L: netdev@vger.kernel.org
@@ -7731,6 +7746,13 @@ W: http://www.ideasonboard.org/uvc/
7731S: Maintained 7746S: Maintained
7732F: drivers/media/usb/uvc/ 7747F: drivers/media/usb/uvc/
7733 7748
7749USB WEBCAM GADGET
7750M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7751L: linux-usb@vger.kernel.org
7752S: Maintained
7753F: drivers/usb/gadget/*uvc*.c
7754F: drivers/usb/gadget/webcam.c
7755
7734USB WIRELESS RNDIS DRIVER (rndis_wlan) 7756USB WIRELESS RNDIS DRIVER (rndis_wlan)
7735M: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 7757M: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
7736L: linux-wireless@vger.kernel.org 7758L: linux-wireless@vger.kernel.org
diff --git a/Makefile b/Makefile
index 5be2ee8c90e4..14c93b39b929 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 7 2PATCHLEVEL = 7
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Terrified Chipmunk 5NAME = Terrified Chipmunk
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -437,7 +437,9 @@ endif
437PHONY += asm-generic 437PHONY += asm-generic
438asm-generic: 438asm-generic:
439 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ 439 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
440 obj=arch/$(SRCARCH)/include/generated/asm 440 src=asm obj=arch/$(SRCARCH)/include/generated/asm
441 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
442 src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
441 443
442# To make sure we do not include .config for any of the *config targets 444# To make sure we do not include .config for any of the *config targets
443# catch them early, and hand them over to scripts/kconfig/Makefile 445# catch them early, and hand them over to scripts/kconfig/Makefile
@@ -717,6 +719,17 @@ endif # INSTALL_MOD_STRIP
717export mod_strip_cmd 719export mod_strip_cmd
718 720
719 721
722ifeq ($(CONFIG_MODULE_SIG),y)
723MODSECKEY = ./signing_key.priv
724MODPUBKEY = ./signing_key.x509
725export MODPUBKEY
726mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
727else
728mod_sign_cmd = true
729endif
730export mod_sign_cmd
731
732
720ifeq ($(KBUILD_EXTMOD),) 733ifeq ($(KBUILD_EXTMOD),)
721core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 734core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
722 735
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index c1ce813fcc4a..f37cf9fa5fa0 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -25,6 +25,8 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
25 exynos4210-trats.dtb \ 25 exynos4210-trats.dtb \
26 exynos5250-smdk5250.dtb 26 exynos5250-smdk5250.dtb
27dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb 27dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb
28dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
29 integratorcp.dtb
28dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 30dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
29dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ 31dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
30 kirkwood-dns325.dtb \ 32 kirkwood-dns325.dtb \
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 96fb824b5e6e..5a00022383e7 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -4,21 +4,32 @@
4 compatible = "marvell,dove"; 4 compatible = "marvell,dove";
5 model = "Marvell Armada 88AP510 SoC"; 5 model = "Marvell Armada 88AP510 SoC";
6 6
7 interrupt-parent = <&intc>; 7 soc@f1000000 {
8
9 intc: interrupt-controller {
10 compatible = "marvell,orion-intc";
11 interrupt-controller;
12 #interrupt-cells = <1>;
13 reg = <0xf1020204 0x04>,
14 <0xf1020214 0x04>;
15 };
16
17 mbus@f1000000 {
18 compatible = "simple-bus"; 8 compatible = "simple-bus";
19 ranges = <0 0xf1000000 0x4000000>;
20 #address-cells = <1>; 9 #address-cells = <1>;
21 #size-cells = <1>; 10 #size-cells = <1>;
11 interrupt-parent = <&intc>;
12
13 ranges = <0xc8000000 0xc8000000 0x0100000 /* CESA SRAM 1M */
14 0xe0000000 0xe0000000 0x8000000 /* PCIe0 Mem 128M */
15 0xe8000000 0xe8000000 0x8000000 /* PCIe1 Mem 128M */
16 0xf0000000 0xf0000000 0x0100000 /* ScratchPad 1M */
17 0x00000000 0xf1000000 0x1000000 /* SB/NB regs 16M */
18 0xf2000000 0xf2000000 0x0100000 /* PCIe0 I/O 1M */
19 0xf2100000 0xf2100000 0x0100000 /* PCIe0 I/O 1M */
20 0xf8000000 0xf8000000 0x8000000>; /* BootROM 128M */
21
22 l2: l2-cache {
23 compatible = "marvell,tauros2-cache";
24 marvell,tauros2-cache-features = <0>;
25 };
26
27 intc: interrupt-controller {
28 compatible = "marvell,orion-intc";
29 interrupt-controller;
30 #interrupt-cells = <1>;
31 reg = <0x20204 0x04>, <0x20214 0x04>;
32 };
22 33
23 uart0: serial@12000 { 34 uart0: serial@12000 {
24 compatible = "ns16550a"; 35 compatible = "ns16550a";
@@ -56,11 +67,6 @@
56 status = "disabled"; 67 status = "disabled";
57 }; 68 };
58 69
59 wdt: wdt@20300 {
60 compatible = "marvell,orion-wdt";
61 reg = <0x20300 0x28>;
62 };
63
64 gpio0: gpio@d0400 { 70 gpio0: gpio@d0400 {
65 compatible = "marvell,orion-gpio"; 71 compatible = "marvell,orion-gpio";
66 #gpio-cells = <2>; 72 #gpio-cells = <2>;
@@ -139,5 +145,14 @@
139 nr-ports = <1>; 145 nr-ports = <1>;
140 status = "disabled"; 146 status = "disabled";
141 }; 147 };
148
149 crypto: crypto@30000 {
150 compatible = "marvell,orion-crypto";
151 reg = <0x30000 0x10000>,
152 <0xc8000000 0x800>;
153 reg-names = "regs", "sram";
154 interrupts = <31>;
155 status = "okay";
156 };
142 }; 157 };
143}; 158};
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts
index 15df4c105e89..5bfa02a3f85c 100644
--- a/arch/arm/boot/dts/imx6q-arm2.dts
+++ b/arch/arm/boot/dts/imx6q-arm2.dts
@@ -37,6 +37,13 @@
37 pinctrl_hog: hoggrp { 37 pinctrl_hog: hoggrp {
38 fsl,pins = < 38 fsl,pins = <
39 176 0x80000000 /* MX6Q_PAD_EIM_D25__GPIO_3_25 */ 39 176 0x80000000 /* MX6Q_PAD_EIM_D25__GPIO_3_25 */
40 >;
41 };
42 };
43
44 arm2 {
45 pinctrl_usdhc3_arm2: usdhc3grp-arm2 {
46 fsl,pins = <
40 1363 0x80000000 /* MX6Q_PAD_NANDF_CS0__GPIO_6_11 */ 47 1363 0x80000000 /* MX6Q_PAD_NANDF_CS0__GPIO_6_11 */
41 1369 0x80000000 /* MX6Q_PAD_NANDF_CS1__GPIO_6_14 */ 48 1369 0x80000000 /* MX6Q_PAD_NANDF_CS1__GPIO_6_14 */
42 >; 49 >;
@@ -58,7 +65,8 @@
58 wp-gpios = <&gpio6 14 0>; 65 wp-gpios = <&gpio6 14 0>;
59 vmmc-supply = <&reg_3p3v>; 66 vmmc-supply = <&reg_3p3v>;
60 pinctrl-names = "default"; 67 pinctrl-names = "default";
61 pinctrl-0 = <&pinctrl_usdhc3_1>; 68 pinctrl-0 = <&pinctrl_usdhc3_1
69 &pinctrl_usdhc3_arm2>;
62 status = "okay"; 70 status = "okay";
63 }; 71 };
64 72
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 8ac51c08269d..8fea375c734d 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -48,17 +48,19 @@
48 #size-cells = <0>; 48 #size-cells = <0>;
49 button@1 { 49 button@1 {
50 label = "Function Button"; 50 label = "Function Button";
51 linux,code = <132>; 51 linux,code = <357>;
52 gpios = <&gpio1 9 1>; 52 gpios = <&gpio1 9 1>;
53 }; 53 };
54 button@2 { 54 button@2 {
55 label = "Power-on Switch"; 55 label = "Power-on Switch";
56 linux,code = <116>; 56 linux,code = <0>;
57 linux,input-type = <5>;
57 gpios = <&gpio1 10 1>; 58 gpios = <&gpio1 10 1>;
58 }; 59 };
59 button@3 { 60 button@3 {
60 label = "Power-auto Switch"; 61 label = "Power-auto Switch";
61 linux,code = <142>; 62 linux,code = <1>;
63 linux,input-type = <5>;
62 gpios = <&gpio1 11 1>; 64 gpios = <&gpio1 11 1>;
63 }; 65 };
64 }; 66 };
@@ -67,28 +69,28 @@
67 compatible = "gpio-leds"; 69 compatible = "gpio-leds";
68 70
69 led@1 { 71 led@1 {
70 label = "lschlv2:blue:func"; 72 label = "lsxl:blue:func";
71 gpios = <&gpio1 4 1>; 73 gpios = <&gpio1 4 1>;
72 }; 74 };
73 75
74 led@2 { 76 led@2 {
75 label = "lschlv2:red:alarm"; 77 label = "lsxl:red:alarm";
76 gpios = <&gpio1 5 1>; 78 gpios = <&gpio1 5 1>;
77 }; 79 };
78 80
79 led@3 { 81 led@3 {
80 label = "lschlv2:amber:info"; 82 label = "lsxl:amber:info";
81 gpios = <&gpio1 6 1>; 83 gpios = <&gpio1 6 1>;
82 }; 84 };
83 85
84 led@4 { 86 led@4 {
85 label = "lschlv2:blue:power"; 87 label = "lsxl:blue:power";
86 gpios = <&gpio1 7 1>; 88 gpios = <&gpio1 7 1>;
87 linux,default-trigger = "default-on"; 89 linux,default-trigger = "default-on";
88 }; 90 };
89 91
90 led@5 { 92 led@5 {
91 label = "lschlv2:red:func"; 93 label = "lsxl:red:func";
92 gpios = <&gpio1 16 1>; 94 gpios = <&gpio1 16 1>;
93 }; 95 };
94 }; 96 };
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index b459691655ab..330f833ac3b0 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -71,13 +71,13 @@
71 ehci@d8007100 { 71 ehci@d8007100 {
72 compatible = "via,vt8500-ehci"; 72 compatible = "via,vt8500-ehci";
73 reg = <0xd8007100 0x200>; 73 reg = <0xd8007100 0x200>;
74 interrupts = <43>; 74 interrupts = <1>;
75 }; 75 };
76 76
77 uhci@d8007300 { 77 uhci@d8007300 {
78 compatible = "platform-uhci"; 78 compatible = "platform-uhci";
79 reg = <0xd8007300 0x200>; 79 reg = <0xd8007300 0x200>;
80 interrupts = <43>; 80 interrupts = <0>;
81 }; 81 };
82 82
83 fb@d8050800 { 83 fb@d8050800 {
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 417bac1846bd..34711757ba59 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -88,9 +88,9 @@ ENTRY(ret_from_fork)
88 bl schedule_tail 88 bl schedule_tail
89 cmp r5, #0 89 cmp r5, #0
90 movne r0, r4 90 movne r0, r4
91 movne lr, pc 91 adrne lr, BSYM(1f)
92 movne pc, r5 92 movne pc, r5
93 get_thread_info tsk 931: get_thread_info tsk
94 b ret_slow_syscall 94 b ret_slow_syscall
95ENDPROC(ret_from_fork) 95ENDPROC(ret_from_fork)
96 96
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index b37bef1d5ffa..f723fe13d0f0 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -32,6 +32,7 @@
32#include <linux/irq.h> 32#include <linux/irq.h>
33#include <plat/time.h> 33#include <plat/time.h>
34#include <linux/platform_data/usb-ehci-orion.h> 34#include <linux/platform_data/usb-ehci-orion.h>
35#include <plat/irq.h>
35#include <plat/common.h> 36#include <plat/common.h>
36#include <plat/addr-map.h> 37#include <plat/addr-map.h>
37#include "common.h" 38#include "common.h"
@@ -109,8 +110,8 @@ static void __init dove_clk_init(void)
109 110
110 orion_clkdev_add(NULL, "orion-ehci.0", usb0); 111 orion_clkdev_add(NULL, "orion-ehci.0", usb0);
111 orion_clkdev_add(NULL, "orion-ehci.1", usb1); 112 orion_clkdev_add(NULL, "orion-ehci.1", usb1);
112 orion_clkdev_add(NULL, "mv643xx_eth.0", ge); 113 orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);
113 orion_clkdev_add("0", "sata_mv.0", sata); 114 orion_clkdev_add(NULL, "sata_mv.0", sata);
114 orion_clkdev_add("0", "pcie", pex0); 115 orion_clkdev_add("0", "pcie", pex0);
115 orion_clkdev_add("1", "pcie", pex1); 116 orion_clkdev_add("1", "pcie", pex1);
116 orion_clkdev_add(NULL, "sdhci-dove.0", sdio0); 117 orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
@@ -399,7 +400,7 @@ static void __init dove_dt_init(void)
399 (dove_tclk + 499999) / 1000000); 400 (dove_tclk + 499999) / 1000000);
400 401
401#ifdef CONFIG_CACHE_TAUROS2 402#ifdef CONFIG_CACHE_TAUROS2
402 tauros2_init(); 403 tauros2_init(0);
403#endif 404#endif
404 dove_setup_cpu_mbus(); 405 dove_setup_cpu_mbus();
405 406
@@ -415,7 +416,6 @@ static void __init dove_dt_init(void)
415 dove_ehci0_init(); 416 dove_ehci0_init();
416 dove_ehci1_init(); 417 dove_ehci1_init();
417 dove_pcie_init(1, 1); 418 dove_pcie_init(1, 1);
418 dove_crypto_init();
419 419
420 of_platform_populate(NULL, of_default_bus_match_table, 420 of_platform_populate(NULL, of_default_bus_match_table,
421 dove_auxdata_lookup, NULL); 421 dove_auxdata_lookup, NULL);
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index bb15b26041cb..0ef4435b1657 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/clk.h>
13#include <video/vga.h> 14#include <video/vga.h>
14#include <asm/mach/pci.h> 15#include <asm/mach/pci.h>
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
@@ -188,6 +189,10 @@ static void __init add_pcie_port(int index, void __iomem *base)
188 189
189 if (orion_pcie_link_up(base)) { 190 if (orion_pcie_link_up(base)) {
190 struct pcie_port *pp = &pcie_port[num_pcie_ports++]; 191 struct pcie_port *pp = &pcie_port[num_pcie_ports++];
192 struct clk *clk = clk_get_sys("pcie", (index ? "1" : "0"));
193
194 if (!IS_ERR(clk))
195 clk_prepare_enable(clk);
191 196
192 printk(KERN_INFO "link up\n"); 197 printk(KERN_INFO "link up\n");
193 198
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 70c5a2882409..d94872fed8c0 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -51,9 +51,7 @@ static void __init kirkwood_dt_init(void)
51 51
52 kirkwood_setup_cpu_mbus(); 52 kirkwood_setup_cpu_mbus();
53 53
54#ifdef CONFIG_CACHE_FEROCEON_L2
55 kirkwood_l2_init(); 54 kirkwood_l2_init();
56#endif
57 55
58 /* Setup root of clk tree */ 56 /* Setup root of clk tree */
59 kirkwood_clk_init(); 57 kirkwood_clk_init();
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 3991077f58a2..2c6c218fb79e 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -633,6 +633,7 @@ char * __init kirkwood_id(void)
633 633
634void __init kirkwood_l2_init(void) 634void __init kirkwood_l2_init(void)
635{ 635{
636#ifdef CONFIG_CACHE_FEROCEON_L2
636#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH 637#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
637 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG); 638 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
638 feroceon_l2_init(1); 639 feroceon_l2_init(1);
@@ -640,6 +641,7 @@ void __init kirkwood_l2_init(void)
640 writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG); 641 writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
641 feroceon_l2_init(0); 642 feroceon_l2_init(0);
642#endif 643#endif
644#endif
643} 645}
644 646
645void __init kirkwood_init(void) 647void __init kirkwood_init(void)
@@ -657,9 +659,7 @@ void __init kirkwood_init(void)
657 659
658 kirkwood_setup_cpu_mbus(); 660 kirkwood_setup_cpu_mbus();
659 661
660#ifdef CONFIG_CACHE_FEROCEON_L2
661 kirkwood_l2_init(); 662 kirkwood_l2_init();
662#endif
663 663
664 /* Setup root of clk tree */ 664 /* Setup root of clk tree */
665 kirkwood_clk_init(); 665 kirkwood_clk_init();
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index e50b02249b32..a8fce3ccc707 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -444,16 +444,28 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
444 .lclk_khz_max = 1334, /* results in 5fps CIF, 10fps QCIF */ 444 .lclk_khz_max = 1334, /* results in 5fps CIF, 10fps QCIF */
445}; 445};
446 446
447static struct platform_device ams_delta_audio_device = {
448 .name = "ams-delta-audio",
449 .id = -1,
450};
451
452static struct platform_device cx20442_codec_device = {
453 .name = "cx20442-codec",
454 .id = -1,
455};
456
447static struct platform_device *ams_delta_devices[] __initdata = { 457static struct platform_device *ams_delta_devices[] __initdata = {
448 &latch1_gpio_device, 458 &latch1_gpio_device,
449 &latch2_gpio_device, 459 &latch2_gpio_device,
450 &ams_delta_kp_device, 460 &ams_delta_kp_device,
451 &ams_delta_camera_device, 461 &ams_delta_camera_device,
462 &ams_delta_audio_device,
452}; 463};
453 464
454static struct platform_device *late_devices[] __initdata = { 465static struct platform_device *late_devices[] __initdata = {
455 &ams_delta_nand_device, 466 &ams_delta_nand_device,
456 &ams_delta_lcd_device, 467 &ams_delta_lcd_device,
468 &cx20442_codec_device,
457}; 469};
458 470
459static void __init ams_delta_init(void) 471static void __init ams_delta_init(void)
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index a66eeae3bc5d..2a450c9b9a7b 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3292,7 +3292,7 @@ static struct omap_clk omap44xx_clks[] = {
3292 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X), 3292 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
3293 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X), 3293 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3294 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X), 3294 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3295 CLK(NULL, "gpmc_ck", &dummy_ck, CK_443X), 3295 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
3296 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X), 3296 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
3297 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X), 3297 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
3298 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X), 3298 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 467567ad526a..64e50465a4b5 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -926,15 +926,18 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
926 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_enable) 926 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_enable)
927 return -EINVAL; 927 return -EINVAL;
928 928
929 spin_lock_irqsave(&clkdm->lock, flags);
930
929 /* 931 /*
930 * For arch's with no autodeps, clkcm_clk_enable 932 * For arch's with no autodeps, clkcm_clk_enable
931 * should be called for every clock instance or hwmod that is 933 * should be called for every clock instance or hwmod that is
932 * enabled, so the clkdm can be force woken up. 934 * enabled, so the clkdm can be force woken up.
933 */ 935 */
934 if ((atomic_inc_return(&clkdm->usecount) > 1) && autodeps) 936 if ((atomic_inc_return(&clkdm->usecount) > 1) && autodeps) {
937 spin_unlock_irqrestore(&clkdm->lock, flags);
935 return 0; 938 return 0;
939 }
936 940
937 spin_lock_irqsave(&clkdm->lock, flags);
938 arch_clkdm->clkdm_clk_enable(clkdm); 941 arch_clkdm->clkdm_clk_enable(clkdm);
939 pwrdm_state_switch(clkdm->pwrdm.ptr); 942 pwrdm_state_switch(clkdm->pwrdm.ptr);
940 spin_unlock_irqrestore(&clkdm->lock, flags); 943 spin_unlock_irqrestore(&clkdm->lock, flags);
@@ -951,15 +954,19 @@ static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
951 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable) 954 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
952 return -EINVAL; 955 return -EINVAL;
953 956
957 spin_lock_irqsave(&clkdm->lock, flags);
958
954 if (atomic_read(&clkdm->usecount) == 0) { 959 if (atomic_read(&clkdm->usecount) == 0) {
960 spin_unlock_irqrestore(&clkdm->lock, flags);
955 WARN_ON(1); /* underflow */ 961 WARN_ON(1); /* underflow */
956 return -ERANGE; 962 return -ERANGE;
957 } 963 }
958 964
959 if (atomic_dec_return(&clkdm->usecount) > 0) 965 if (atomic_dec_return(&clkdm->usecount) > 0) {
966 spin_unlock_irqrestore(&clkdm->lock, flags);
960 return 0; 967 return 0;
968 }
961 969
962 spin_lock_irqsave(&clkdm->lock, flags);
963 arch_clkdm->clkdm_clk_disable(clkdm); 970 arch_clkdm->clkdm_clk_disable(clkdm);
964 pwrdm_state_switch(clkdm->pwrdm.ptr); 971 pwrdm_state_switch(clkdm->pwrdm.ptr);
965 spin_unlock_irqrestore(&clkdm->lock, flags); 972 spin_unlock_irqrestore(&clkdm->lock, flags);
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 86a5e13c9f59..2ad491d6910b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -343,7 +343,7 @@ static void __init omap_init_dmic(void)
343 343
344 oh = omap_hwmod_lookup("dmic"); 344 oh = omap_hwmod_lookup("dmic");
345 if (!oh) { 345 if (!oh) {
346 printk(KERN_ERR "Could not look up mcpdm hw_mod\n"); 346 pr_err("Could not look up dmic hw_mod\n");
347 return; 347 return;
348 } 348 }
349 349
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 6af1a5d98e6f..bf6117c32f4b 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -714,9 +714,9 @@ static void __devexit gpmc_mem_exit(void)
714 714
715} 715}
716 716
717static void __devinit gpmc_mem_init(void) 717static int __devinit gpmc_mem_init(void)
718{ 718{
719 int cs; 719 int cs, rc;
720 unsigned long boot_rom_space = 0; 720 unsigned long boot_rom_space = 0;
721 721
722 /* never allocate the first page, to facilitate bug detection; 722 /* never allocate the first page, to facilitate bug detection;
@@ -736,13 +736,21 @@ static void __devinit gpmc_mem_init(void)
736 if (!gpmc_cs_mem_enabled(cs)) 736 if (!gpmc_cs_mem_enabled(cs))
737 continue; 737 continue;
738 gpmc_cs_get_memconf(cs, &base, &size); 738 gpmc_cs_get_memconf(cs, &base, &size);
739 if (gpmc_cs_insert_mem(cs, base, size) < 0) 739 rc = gpmc_cs_insert_mem(cs, base, size);
740 BUG(); 740 if (IS_ERR_VALUE(rc)) {
741 while (--cs >= 0)
742 if (gpmc_cs_mem_enabled(cs))
743 gpmc_cs_delete_mem(cs);
744 return rc;
745 }
741 } 746 }
747
748 return 0;
742} 749}
743 750
744static __devinit int gpmc_probe(struct platform_device *pdev) 751static __devinit int gpmc_probe(struct platform_device *pdev)
745{ 752{
753 int rc;
746 u32 l; 754 u32 l;
747 struct resource *res; 755 struct resource *res;
748 756
@@ -782,7 +790,13 @@ static __devinit int gpmc_probe(struct platform_device *pdev)
782 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), 790 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
783 GPMC_REVISION_MINOR(l)); 791 GPMC_REVISION_MINOR(l));
784 792
785 gpmc_mem_init(); 793 rc = gpmc_mem_init();
794 if (IS_ERR_VALUE(rc)) {
795 clk_disable_unprepare(gpmc_l3_clk);
796 clk_put(gpmc_l3_clk);
797 dev_err(gpmc_dev, "failed to reserve memory\n");
798 return rc;
799 }
786 800
787 if (IS_ERR_VALUE(gpmc_setup_irq())) 801 if (IS_ERR_VALUE(gpmc_setup_irq()))
788 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); 802 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 45598ac819be..565e5755c9bc 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -467,7 +467,7 @@ OMAP_SYS_TIMER(3_am33xx)
467#ifdef CONFIG_ARCH_OMAP4 467#ifdef CONFIG_ARCH_OMAP4
468#ifdef CONFIG_LOCAL_TIMERS 468#ifdef CONFIG_LOCAL_TIMERS
469static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 469static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
470 OMAP44XX_LOCAL_TWD_BASE, 29 + OMAP_INTC_START); 470 OMAP44XX_LOCAL_TWD_BASE, 29);
471#endif 471#endif
472 472
473static void __init omap4_timer_init(void) 473static void __init omap4_timer_init(void)
diff --git a/arch/arm/mach-prima2/include/mach/gpio.h b/arch/arm/mach-prima2/include/mach/gpio.h
deleted file mode 100644
index 1904bb03876e..000000000000
--- a/arch/arm/mach-prima2/include/mach/gpio.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __MACH_GPIO_H
2#define __MACH_GPIO_H
3
4/* Pull up/down values */
5enum sirfsoc_gpio_pull {
6 SIRFSOC_GPIO_PULL_NONE,
7 SIRFSOC_GPIO_PULL_UP,
8 SIRFSOC_GPIO_PULL_DOWN,
9};
10
11void sirfsoc_gpio_set_pull(unsigned gpio, unsigned mode);
12
13#endif
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
index 749220f91a70..4407b1730539 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c
@@ -163,7 +163,7 @@ static struct clk_lookup s3c2440_clk_lookup[] = {
163 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), 163 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
164}; 164};
165 165
166static int s3c2440_clk_add(struct device *dev, struct subsys_interface *sif) 166static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif)
167{ 167{
168 struct clk *clock_upll; 168 struct clk *clock_upll;
169 struct clk *clock_h; 169 struct clk *clock_h;
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 2912eab3b967..3cc8b1c21da9 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1196,7 +1196,7 @@ static void __init eva_init(void)
1196 1196
1197#ifdef CONFIG_CACHE_L2X0 1197#ifdef CONFIG_CACHE_L2X0
1198 /* Early BRESP enable, Shared attribute override enable, 32K*8way */ 1198 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
1199 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff); 1199 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
1200#endif 1200#endif
1201 1201
1202 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); 1202 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 3cafb6ab5e9a..37b2a3133b3b 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -24,17 +24,17 @@
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/common.h> 25#include <mach/common.h>
26 26
27#define FRQMR 0xffc80014 27#define FRQMR IOMEM(0xffc80014)
28#define MSTPCR0 0xffc80030 28#define MSTPCR0 IOMEM(0xffc80030)
29#define MSTPCR1 0xffc80034 29#define MSTPCR1 IOMEM(0xffc80034)
30#define MSTPCR3 0xffc8003c 30#define MSTPCR3 IOMEM(0xffc8003c)
31#define MSTPSR1 0xffc80044 31#define MSTPSR1 IOMEM(0xffc80044)
32#define MSTPSR4 0xffc80048 32#define MSTPSR4 IOMEM(0xffc80048)
33#define MSTPSR6 0xffc8004c 33#define MSTPSR6 IOMEM(0xffc8004c)
34#define MSTPCR4 0xffc80050 34#define MSTPCR4 IOMEM(0xffc80050)
35#define MSTPCR5 0xffc80054 35#define MSTPCR5 IOMEM(0xffc80054)
36#define MSTPCR6 0xffc80058 36#define MSTPCR6 IOMEM(0xffc80058)
37#define MSTPCR7 0xffc80040 37#define MSTPCR7 IOMEM(0xffc80040)
38 38
39/* ioremap() through clock mapping mandatory to avoid 39/* ioremap() through clock mapping mandatory to avoid
40 * collision with ARM coherent DMA virtual memory range. 40 * collision with ARM coherent DMA virtual memory range.
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 57e235f4ac74..aa5325cd1c42 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -182,7 +182,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
182 .init_early = tegra20_init_early, 182 .init_early = tegra20_init_early,
183 .init_irq = tegra_dt_init_irq, 183 .init_irq = tegra_dt_init_irq,
184 .handle_irq = gic_handle_irq, 184 .handle_irq = gic_handle_irq,
185 .timer = &tegra_timer, 185 .timer = &tegra_sys_timer,
186 .init_machine = tegra_dt_init, 186 .init_machine = tegra_dt_init,
187 .init_late = tegra_dt_init_late, 187 .init_late = tegra_dt_init_late,
188 .restart = tegra_assert_system_reset, 188 .restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index e4a676d4ddf7..5e92a81f9a2e 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -89,7 +89,7 @@ DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
89 .init_early = tegra30_init_early, 89 .init_early = tegra30_init_early,
90 .init_irq = tegra_dt_init_irq, 90 .init_irq = tegra_dt_init_irq,
91 .handle_irq = gic_handle_irq, 91 .handle_irq = gic_handle_irq,
92 .timer = &tegra_timer, 92 .timer = &tegra_sys_timer,
93 .init_machine = tegra30_dt_init, 93 .init_machine = tegra30_dt_init,
94 .init_late = tegra_init_late, 94 .init_late = tegra_init_late,
95 .restart = tegra_assert_system_reset, 95 .restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index f88e5143c767..91fbe733a21e 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -55,5 +55,5 @@ static inline int harmony_pcie_init(void) { return 0; }
55 55
56void __init tegra_paz00_wifikill_init(void); 56void __init tegra_paz00_wifikill_init(void);
57 57
58extern struct sys_timer tegra_timer; 58extern struct sys_timer tegra_sys_timer;
59#endif 59#endif
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c
index cc9b5fd8c3d3..8d398a33adf7 100644
--- a/arch/arm/mach-tegra/tegra20_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra20_clocks_data.c
@@ -953,6 +953,7 @@ PERIPH_CLK(pcie_xclk, NULL, "pcie_xclk", 74, 0, 26000000, mux_clk_m,
953static struct clk *tegra_list_clks[] = { 953static struct clk *tegra_list_clks[] = {
954 &tegra_apbdma, 954 &tegra_apbdma,
955 &tegra_rtc, 955 &tegra_rtc,
956 &tegra_timer,
956 &tegra_i2s1, 957 &tegra_i2s1,
957 &tegra_i2s2, 958 &tegra_i2s2,
958 &tegra_spdif_out, 959 &tegra_spdif_out,
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c
index 5cd502c27163..e9de5dfd94ec 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.c
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -1199,7 +1199,7 @@ static long tegra30_pll_round_rate(struct clk_hw *hw, unsigned long rate,
1199{ 1199{
1200 struct clk_tegra *c = to_clk_tegra(hw); 1200 struct clk_tegra *c = to_clk_tegra(hw);
1201 unsigned long input_rate = *prate; 1201 unsigned long input_rate = *prate;
1202 unsigned long output_rate = *prate; 1202 u64 output_rate = *prate;
1203 const struct clk_pll_freq_table *sel; 1203 const struct clk_pll_freq_table *sel;
1204 struct clk_pll_freq_table cfg; 1204 struct clk_pll_freq_table cfg;
1205 int mul; 1205 int mul;
diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c b/arch/arm/mach-tegra/tegra30_clocks_data.c
index d92cb556ae35..3d2e5532a9ea 100644
--- a/arch/arm/mach-tegra/tegra30_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra30_clocks_data.c
@@ -1143,6 +1143,7 @@ struct clk *tegra_list_clks[] = {
1143 &tegra_apbdma, 1143 &tegra_apbdma,
1144 &tegra_rtc, 1144 &tegra_rtc,
1145 &tegra_kbc, 1145 &tegra_kbc,
1146 &tegra_timer,
1146 &tegra_kfuse, 1147 &tegra_kfuse,
1147 &tegra_fuse, 1148 &tegra_fuse,
1148 &tegra_fuse_burn, 1149 &tegra_fuse_burn,
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index eccdce983043..d3b8c8e7368f 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -245,7 +245,7 @@ static void __init tegra_init_timer(void)
245 register_persistent_clock(NULL, tegra_read_persistent_clock); 245 register_persistent_clock(NULL, tegra_read_persistent_clock);
246} 246}
247 247
248struct sys_timer tegra_timer = { 248struct sys_timer tegra_sys_timer = {
249 .init = tegra_init_timer, 249 .init = tegra_init_timer,
250}; 250};
251 251
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index c7a4c0902b38..5a4678edd65a 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -16,6 +16,7 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include "../mach-omap2/debug-devices.h"
19 20
20/* Many OMAP development platforms reuse the same "debug board"; these 21/* Many OMAP development platforms reuse the same "debug board"; these
21 * platforms include H2, H3, H4, and Perseus2. 22 * platforms include H2, H3, H4, and Perseus2.
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 65fce44dce34..b780470d03ea 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -109,15 +109,6 @@
109#define OMAP5UART4 OMAP4UART4 109#define OMAP5UART4 OMAP4UART4
110#define ZOOM_UART 95 /* Only on zoom2/3 */ 110#define ZOOM_UART 95 /* Only on zoom2/3 */
111 111
112/* This is only used by 8250.c for omap1510 */
113#define is_omap_port(pt) ({int __ret = 0; \
114 if ((pt)->port.mapbase == OMAP1_UART1_BASE || \
115 (pt)->port.mapbase == OMAP1_UART2_BASE || \
116 (pt)->port.mapbase == OMAP1_UART3_BASE) \
117 __ret = 1; \
118 __ret; \
119 })
120
121#ifndef __ASSEMBLER__ 112#ifndef __ASSEMBLER__
122 113
123struct omap_board_data; 114struct omap_board_data;
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7ff68c946073..ef54a59a9e89 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -22,6 +22,7 @@ config ARM64
22 select HAVE_PERF_EVENTS 22 select HAVE_PERF_EVENTS
23 select HAVE_SPARSE_IRQ 23 select HAVE_SPARSE_IRQ
24 select IRQ_DOMAIN 24 select IRQ_DOMAIN
25 select MODULES_USE_ELF_RELA
25 select NO_BOOTMEM 26 select NO_BOOTMEM
26 select OF 27 select OF
27 select OF_EARLY_FLATTREE 28 select OF_EARLY_FLATTREE
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index fe77e51a7847..a581a2205938 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -18,7 +18,6 @@ generic-y += ipcbuf.h
18generic-y += irq_regs.h 18generic-y += irq_regs.h
19generic-y += kdebug.h 19generic-y += kdebug.h
20generic-y += kmap_types.h 20generic-y += kmap_types.h
21generic-y += linkage.h
22generic-y += local.h 21generic-y += local.h
23generic-y += local64.h 22generic-y += local64.h
24generic-y += mman.h 23generic-y += mman.h
diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h
new file mode 100644
index 000000000000..636c1bced7d4
--- /dev/null
+++ b/arch/arm64/include/asm/linkage.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .align 4
5#define __ALIGN_STR ".align 4"
6
7#endif
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 39a208a392f7..5d810044feda 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -92,30 +92,20 @@ static inline void start_thread_common(struct pt_regs *regs, unsigned long pc)
92static inline void start_thread(struct pt_regs *regs, unsigned long pc, 92static inline void start_thread(struct pt_regs *regs, unsigned long pc,
93 unsigned long sp) 93 unsigned long sp)
94{ 94{
95 unsigned long *stack = (unsigned long *)sp;
96
97 start_thread_common(regs, pc); 95 start_thread_common(regs, pc);
98 regs->pstate = PSR_MODE_EL0t; 96 regs->pstate = PSR_MODE_EL0t;
99 regs->sp = sp; 97 regs->sp = sp;
100 regs->regs[2] = stack[2]; /* x2 (envp) */
101 regs->regs[1] = stack[1]; /* x1 (argv) */
102 regs->regs[0] = stack[0]; /* x0 (argc) */
103} 98}
104 99
105#ifdef CONFIG_COMPAT 100#ifdef CONFIG_COMPAT
106static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, 101static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
107 unsigned long sp) 102 unsigned long sp)
108{ 103{
109 unsigned int *stack = (unsigned int *)sp;
110
111 start_thread_common(regs, pc); 104 start_thread_common(regs, pc);
112 regs->pstate = COMPAT_PSR_MODE_USR; 105 regs->pstate = COMPAT_PSR_MODE_USR;
113 if (pc & 1) 106 if (pc & 1)
114 regs->pstate |= COMPAT_PSR_T_BIT; 107 regs->pstate |= COMPAT_PSR_T_BIT;
115 regs->compat_sp = sp; 108 regs->compat_sp = sp;
116 regs->regs[2] = stack[2]; /* x2 (envp) */
117 regs->regs[1] = stack[1]; /* x1 (argv) */
118 regs->regs[0] = stack[0]; /* x0 (argc) */
119} 109}
120#endif 110#endif
121 111
diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h
index 9b131b4efa0b..6913643bbe54 100644
--- a/arch/arm64/include/uapi/asm/ptrace.h
+++ b/arch/arm64/include/uapi/asm/ptrace.h
@@ -79,13 +79,14 @@ struct user_fpsimd_state {
79 79
80struct user_hwdebug_state { 80struct user_hwdebug_state {
81 __u32 dbg_info; 81 __u32 dbg_info;
82 __u32 pad;
82 struct { 83 struct {
83 __u64 addr; 84 __u64 addr;
84 __u32 ctrl; 85 __u32 ctrl;
86 __u32 pad;
85 } dbg_regs[16]; 87 } dbg_regs[16];
86}; 88};
87 89
88
89#endif /* __ASSEMBLY__ */ 90#endif /* __ASSEMBLY__ */
90 91
91#endif /* _UAPI__ASM_PTRACE_H */ 92#endif /* _UAPI__ASM_PTRACE_H */
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 2ea3968367c2..6e1e77f1831c 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -234,28 +234,33 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type,
234 struct arch_hw_breakpoint_ctrl ctrl, 234 struct arch_hw_breakpoint_ctrl ctrl,
235 struct perf_event_attr *attr) 235 struct perf_event_attr *attr)
236{ 236{
237 int err, len, type; 237 int err, len, type, disabled = !ctrl.enabled;
238 238
239 err = arch_bp_generic_fields(ctrl, &len, &type); 239 if (disabled) {
240 if (err) 240 len = 0;
241 return err; 241 type = HW_BREAKPOINT_EMPTY;
242 242 } else {
243 switch (note_type) { 243 err = arch_bp_generic_fields(ctrl, &len, &type);
244 case NT_ARM_HW_BREAK: 244 if (err)
245 if ((type & HW_BREAKPOINT_X) != type) 245 return err;
246 return -EINVAL; 246
247 break; 247 switch (note_type) {
248 case NT_ARM_HW_WATCH: 248 case NT_ARM_HW_BREAK:
249 if ((type & HW_BREAKPOINT_RW) != type) 249 if ((type & HW_BREAKPOINT_X) != type)
250 return -EINVAL;
251 break;
252 case NT_ARM_HW_WATCH:
253 if ((type & HW_BREAKPOINT_RW) != type)
254 return -EINVAL;
255 break;
256 default:
250 return -EINVAL; 257 return -EINVAL;
251 break; 258 }
252 default:
253 return -EINVAL;
254 } 259 }
255 260
256 attr->bp_len = len; 261 attr->bp_len = len;
257 attr->bp_type = type; 262 attr->bp_type = type;
258 attr->disabled = !ctrl.enabled; 263 attr->disabled = disabled;
259 264
260 return 0; 265 return 0;
261} 266}
@@ -372,7 +377,7 @@ static int ptrace_hbp_set_addr(unsigned int note_type,
372 377
373#define PTRACE_HBP_ADDR_SZ sizeof(u64) 378#define PTRACE_HBP_ADDR_SZ sizeof(u64)
374#define PTRACE_HBP_CTRL_SZ sizeof(u32) 379#define PTRACE_HBP_CTRL_SZ sizeof(u32)
375#define PTRACE_HBP_REG_OFF sizeof(u32) 380#define PTRACE_HBP_PAD_SZ sizeof(u32)
376 381
377static int hw_break_get(struct task_struct *target, 382static int hw_break_get(struct task_struct *target,
378 const struct user_regset *regset, 383 const struct user_regset *regset,
@@ -380,7 +385,7 @@ static int hw_break_get(struct task_struct *target,
380 void *kbuf, void __user *ubuf) 385 void *kbuf, void __user *ubuf)
381{ 386{
382 unsigned int note_type = regset->core_note_type; 387 unsigned int note_type = regset->core_note_type;
383 int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit; 388 int ret, idx = 0, offset, limit;
384 u32 info, ctrl; 389 u32 info, ctrl;
385 u64 addr; 390 u64 addr;
386 391
@@ -389,11 +394,20 @@ static int hw_break_get(struct task_struct *target,
389 if (ret) 394 if (ret)
390 return ret; 395 return ret;
391 396
392 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0, 4); 397 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0,
398 sizeof(info));
399 if (ret)
400 return ret;
401
402 /* Pad */
403 offset = offsetof(struct user_hwdebug_state, pad);
404 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, offset,
405 offset + PTRACE_HBP_PAD_SZ);
393 if (ret) 406 if (ret)
394 return ret; 407 return ret;
395 408
396 /* (address, ctrl) registers */ 409 /* (address, ctrl) registers */
410 offset = offsetof(struct user_hwdebug_state, dbg_regs);
397 limit = regset->n * regset->size; 411 limit = regset->n * regset->size;
398 while (count && offset < limit) { 412 while (count && offset < limit) {
399 ret = ptrace_hbp_get_addr(note_type, target, idx, &addr); 413 ret = ptrace_hbp_get_addr(note_type, target, idx, &addr);
@@ -413,6 +427,13 @@ static int hw_break_get(struct task_struct *target,
413 if (ret) 427 if (ret)
414 return ret; 428 return ret;
415 offset += PTRACE_HBP_CTRL_SZ; 429 offset += PTRACE_HBP_CTRL_SZ;
430
431 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
432 offset,
433 offset + PTRACE_HBP_PAD_SZ);
434 if (ret)
435 return ret;
436 offset += PTRACE_HBP_PAD_SZ;
416 idx++; 437 idx++;
417 } 438 }
418 439
@@ -425,12 +446,13 @@ static int hw_break_set(struct task_struct *target,
425 const void *kbuf, const void __user *ubuf) 446 const void *kbuf, const void __user *ubuf)
426{ 447{
427 unsigned int note_type = regset->core_note_type; 448 unsigned int note_type = regset->core_note_type;
428 int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit; 449 int ret, idx = 0, offset, limit;
429 u32 ctrl; 450 u32 ctrl;
430 u64 addr; 451 u64 addr;
431 452
432 /* Resource info */ 453 /* Resource info and pad */
433 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, 4); 454 offset = offsetof(struct user_hwdebug_state, dbg_regs);
455 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
434 if (ret) 456 if (ret)
435 return ret; 457 return ret;
436 458
@@ -454,6 +476,13 @@ static int hw_break_set(struct task_struct *target,
454 if (ret) 476 if (ret)
455 return ret; 477 return ret;
456 offset += PTRACE_HBP_CTRL_SZ; 478 offset += PTRACE_HBP_CTRL_SZ;
479
480 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
481 offset,
482 offset + PTRACE_HBP_PAD_SZ);
483 if (ret)
484 return ret;
485 offset += PTRACE_HBP_PAD_SZ;
457 idx++; 486 idx++;
458 } 487 }
459 488
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 48ffb9fb3fe3..7665a9bfdb1e 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -170,7 +170,19 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
170 170
171void __init early_init_dt_add_memory_arch(u64 base, u64 size) 171void __init early_init_dt_add_memory_arch(u64 base, u64 size)
172{ 172{
173 base &= PAGE_MASK;
173 size &= PAGE_MASK; 174 size &= PAGE_MASK;
175 if (base + size < PHYS_OFFSET) {
176 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
177 base, base + size);
178 return;
179 }
180 if (base < PHYS_OFFSET) {
181 pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
182 base, PHYS_OFFSET);
183 size -= PHYS_OFFSET - base;
184 base = PHYS_OFFSET;
185 }
174 memblock_add(base, size); 186 memblock_add(base, size);
175} 187}
176 188
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index b711525be21f..226b6bf6e9c2 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -46,7 +46,6 @@
46#include <asm/sections.h> 46#include <asm/sections.h>
47#include <asm/tlbflush.h> 47#include <asm/tlbflush.h>
48#include <asm/ptrace.h> 48#include <asm/ptrace.h>
49#include <asm/mmu_context.h>
50 49
51/* 50/*
52 * as from 2.5, kernels no longer have an init_tasks structure 51 * as from 2.5, kernels no longer have an init_tasks structure
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 17948fc7d663..ba457943a16b 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -28,6 +28,7 @@
28#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/signal.h> 29#include <linux/signal.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/timekeeper_internal.h>
31#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
32 33
33#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
@@ -222,11 +223,10 @@ struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
222/* 223/*
223 * Update the vDSO data page to keep in sync with kernel timekeeping. 224 * Update the vDSO data page to keep in sync with kernel timekeeping.
224 */ 225 */
225void update_vsyscall(struct timespec *ts, struct timespec *wtm, 226void update_vsyscall(struct timekeeper *tk)
226 struct clocksource *clock, u32 mult)
227{ 227{
228 struct timespec xtime_coarse; 228 struct timespec xtime_coarse;
229 u32 use_syscall = strcmp(clock->name, "arch_sys_counter"); 229 u32 use_syscall = strcmp(tk->clock->name, "arch_sys_counter");
230 230
231 ++vdso_data->tb_seq_count; 231 ++vdso_data->tb_seq_count;
232 smp_wmb(); 232 smp_wmb();
@@ -237,13 +237,13 @@ void update_vsyscall(struct timespec *ts, struct timespec *wtm,
237 vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; 237 vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec;
238 238
239 if (!use_syscall) { 239 if (!use_syscall) {
240 vdso_data->cs_cycle_last = clock->cycle_last; 240 vdso_data->cs_cycle_last = tk->clock->cycle_last;
241 vdso_data->xtime_clock_sec = ts->tv_sec; 241 vdso_data->xtime_clock_sec = tk->xtime_sec;
242 vdso_data->xtime_clock_nsec = ts->tv_nsec; 242 vdso_data->xtime_clock_nsec = tk->xtime_nsec >> tk->shift;
243 vdso_data->cs_mult = mult; 243 vdso_data->cs_mult = tk->mult;
244 vdso_data->cs_shift = clock->shift; 244 vdso_data->cs_shift = tk->shift;
245 vdso_data->wtm_clock_sec = wtm->tv_sec; 245 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
246 vdso_data->wtm_clock_nsec = wtm->tv_nsec; 246 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
247 } 247 }
248 248
249 smp_wmb(); 249 smp_wmb();
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 002732960315..ee0beb354e4d 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -867,8 +867,8 @@ ret_from_fork:
867ret_from_kernel_thread: 867ret_from_kernel_thread:
868 lddi.p @(gr28,#REG_GR(8)),gr20 868 lddi.p @(gr28,#REG_GR(8)),gr20
869 call schedule_tail 869 call schedule_tail
870 or.p gr20,gr20,gr8 870 calll.p @(gr21,gr0)
871 calll @(gr21,gr0) 871 or gr20,gr20,gr8
872 bra sys_exit 872 bra sys_exit
873 873
874 .globl ret_from_kernel_execve 874 .globl ret_from_kernel_execve
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 655d90d20bb0..e1e3aa196aa4 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -194,7 +194,7 @@ int copy_thread(unsigned long clone_flags,
194 memset(childregs, 0, sizeof(struct pt_regs)); 194 memset(childregs, 0, sizeof(struct pt_regs));
195 childregs->gr9 = usp; /* function */ 195 childregs->gr9 = usp; /* function */
196 childregs->gr8 = arg; 196 childregs->gr8 = arg;
197 chilregs->psr = PSR_S; 197 childregs->psr = PSR_S;
198 p->thread.pc = (unsigned long) ret_from_kernel_thread; 198 p->thread.pc = (unsigned long) ret_from_kernel_thread;
199 save_user_regs(p->thread.user); 199 save_user_regs(p->thread.user);
200 return 0; 200 return 0;
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 1f1e5efb3385..b8993c87d3de 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -112,9 +112,11 @@ char __initdata redboot_command_line[COMMAND_LINE_SIZE];
112#ifdef CONFIG_PM 112#ifdef CONFIG_PM
113#define __pminit 113#define __pminit
114#define __pminitdata 114#define __pminitdata
115#define __pminitconst
115#else 116#else
116#define __pminit __init 117#define __pminit __init
117#define __pminitdata __initdata 118#define __pminitdata __initdata
119#define __pminitconst __initconst
118#endif 120#endif
119 121
120struct clock_cmode { 122struct clock_cmode {
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 3364b6966d26..3bfa9b30f448 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -1,8 +1,5 @@
1include include/asm-generic/Kbuild.asm
2 1
3header-y += registers.h
4header-y += ucontext.h 2header-y += ucontext.h
5header-y += user.h
6 3
7generic-y += auxvec.h 4generic-y += auxvec.h
8generic-y += bug.h 5generic-y += bug.h
diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h
index 3e258043337b..468fbb0781cd 100644
--- a/arch/hexagon/include/asm/atomic.h
+++ b/arch/hexagon/include/asm/atomic.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Atomic operations for the Hexagon architecture 2 * Atomic operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/include/asm/barrier.h b/arch/hexagon/include/asm/barrier.h
index a4ed6e26cb1d..1041a8e70ce8 100644
--- a/arch/hexagon/include/asm/barrier.h
+++ b/arch/hexagon/include/asm/barrier.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory barrier definitions for the Hexagon architecture 2 * Memory barrier definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
index 4caa649ad78b..9b1e4afbab3c 100644
--- a/arch/hexagon/include/asm/bitops.h
+++ b/arch/hexagon/include/asm/bitops.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Bit operations for the Hexagon architecture 2 * Bit operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/include/asm/cache.h b/arch/hexagon/include/asm/cache.h
index 0f01de2eb4ab..f4ca594fdf8c 100644
--- a/arch/hexagon/include/asm/cache.h
+++ b/arch/hexagon/include/asm/cache.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Cache definitions for the Hexagon architecture 2 * Cache definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/cacheflush.h b/arch/hexagon/include/asm/cacheflush.h
index 6865c1be927a..49e0896ec240 100644
--- a/arch/hexagon/include/asm/cacheflush.h
+++ b/arch/hexagon/include/asm/cacheflush.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Cache flush operations for the Hexagon architecture 2 * Cache flush operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/checksum.h b/arch/hexagon/include/asm/checksum.h
index 3ce4ecd44f82..46ec8a7fd65f 100644
--- a/arch/hexagon/include/asm/checksum.h
+++ b/arch/hexagon/include/asm/checksum.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h
index c5f9527e1df6..9e7802911a57 100644
--- a/arch/hexagon/include/asm/cmpxchg.h
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * xchg/cmpxchg operations for the Hexagon architecture 2 * xchg/cmpxchg operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/include/asm/delay.h b/arch/hexagon/include/asm/delay.h
index 9ab12e9a872b..53079719d667 100644
--- a/arch/hexagon/include/asm/delay.h
+++ b/arch/hexagon/include/asm/delay.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
index 233ed3d2d25e..85e9935660cb 100644
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ b/arch/hexagon/include/asm/dma-mapping.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * DMA operations for the Hexagon architecture 2 * DMA operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/dma.h b/arch/hexagon/include/asm/dma.h
index da6d2f61a93a..9e34ff49f3b7 100644
--- a/arch/hexagon/include/asm/dma.h
+++ b/arch/hexagon/include/asm/dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 82b499621e05..1ba4b3bff5ed 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ELF definitions for the Hexagon architecture 2 * ELF definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/exec.h b/arch/hexagon/include/asm/exec.h
index 350e6d497d44..c32b2132614b 100644
--- a/arch/hexagon/include/asm/exec.h
+++ b/arch/hexagon/include/asm/exec.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Process execution related definitions for the Hexagon architecture 2 * Process execution related definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/fixmap.h b/arch/hexagon/include/asm/fixmap.h
index b27f4941645b..b75b6bf4269c 100644
--- a/arch/hexagon/include/asm/fixmap.h
+++ b/arch/hexagon/include/asm/fixmap.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Fixmap support for Hexagon - enough to support highmem features 2 * Fixmap support for Hexagon - enough to support highmem features
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/hexagon_vm.h b/arch/hexagon/include/asm/hexagon_vm.h
index 182cb9d54769..c144bee6cabe 100644
--- a/arch/hexagon/include/asm/hexagon_vm.h
+++ b/arch/hexagon/include/asm/hexagon_vm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Declarations for to Hexagon Virtal Machine. 2 * Declarations for to Hexagon Virtal Machine.
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/intrinsics.h b/arch/hexagon/include/asm/intrinsics.h
index 1c02186d2e9a..ca587737fb2a 100644
--- a/arch/hexagon/include/asm/intrinsics.h
+++ b/arch/hexagon/include/asm/intrinsics.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
index b3acc2cc71bf..e527cfeff5ba 100644
--- a/arch/hexagon/include/asm/io.h
+++ b/arch/hexagon/include/asm/io.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * IO definitions for the Hexagon architecture 2 * IO definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/irq.h b/arch/hexagon/include/asm/irq.h
index ded8c15cf3e5..51661db389d6 100644
--- a/arch/hexagon/include/asm/irq.h
+++ b/arch/hexagon/include/asm/irq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/irqflags.h b/arch/hexagon/include/asm/irqflags.h
index ec1523655416..e5fd9492d60f 100644
--- a/arch/hexagon/include/asm/irqflags.h
+++ b/arch/hexagon/include/asm/irqflags.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * IRQ support for the Hexagon architecture 2 * IRQ support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/kgdb.h b/arch/hexagon/include/asm/kgdb.h
index 9e8779702f10..32a6fb66944a 100644
--- a/arch/hexagon/include/asm/kgdb.h
+++ b/arch/hexagon/include/asm/kgdb.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/hexagon/include/asm/kgdb.h - Hexagon KGDB Support 2 * arch/hexagon/include/asm/kgdb.h - Hexagon KGDB Support
3 * 3 *
4 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/linkage.h b/arch/hexagon/include/asm/linkage.h
index a00b85f680b8..31b4cbe7e583 100644
--- a/arch/hexagon/include/asm/linkage.h
+++ b/arch/hexagon/include/asm/linkage.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h
index 72e5dcda79f5..af16e977c55e 100644
--- a/arch/hexagon/include/asm/mem-layout.h
+++ b/arch/hexagon/include/asm/mem-layout.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory layout definitions for the Hexagon architecture 2 * Memory layout definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/mmu.h b/arch/hexagon/include/asm/mmu.h
index 30a5d8d2659d..2288b19fd0f2 100644
--- a/arch/hexagon/include/asm/mmu.h
+++ b/arch/hexagon/include/asm/mmu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/mmu_context.h b/arch/hexagon/include/asm/mmu_context.h
index b4fe5a5411b6..d423d2e73c30 100644
--- a/arch/hexagon/include/asm/mmu_context.h
+++ b/arch/hexagon/include/asm/mmu_context.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * MM context support for the Hexagon architecture 2 * MM context support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/module.h b/arch/hexagon/include/asm/module.h
index 72ba494e6d7d..6b4323acef44 100644
--- a/arch/hexagon/include/asm/module.h
+++ b/arch/hexagon/include/asm/module.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h
index edd97626c482..692adc213429 100644
--- a/arch/hexagon/include/asm/page.h
+++ b/arch/hexagon/include/asm/page.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Page management definitions for the Hexagon architecture 2 * Page management definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/perf_event.h b/arch/hexagon/include/asm/perf_event.h
index 8b8526b491c7..430978b1de38 100644
--- a/arch/hexagon/include/asm/perf_event.h
+++ b/arch/hexagon/include/asm/perf_event.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
index 13443c775131..679bf6d66487 100644
--- a/arch/hexagon/include/asm/pgalloc.h
+++ b/arch/hexagon/include/asm/pgalloc.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Page table support for the Hexagon architecture 2 * Page table support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index ca619bf225ef..20d55f69fe55 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Page table support for the Hexagon architecture 2 * Page table support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h
index e8ea459002a4..a03323ab9d44 100644
--- a/arch/hexagon/include/asm/processor.h
+++ b/arch/hexagon/include/asm/processor.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Process/processor support for the Hexagon architecture 2 * Process/processor support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/smp.h b/arch/hexagon/include/asm/smp.h
index 87c869a6a897..2b9b974e0952 100644
--- a/arch/hexagon/include/asm/smp.h
+++ b/arch/hexagon/include/asm/smp.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMP definitions for the Hexagon architecture 2 * SMP definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/spinlock.h b/arch/hexagon/include/asm/spinlock.h
index 168a920485a8..12ca4ebc0338 100644
--- a/arch/hexagon/include/asm/spinlock.h
+++ b/arch/hexagon/include/asm/spinlock.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Spinlock support for the Hexagon architecture 2 * Spinlock support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/include/asm/spinlock_types.h b/arch/hexagon/include/asm/spinlock_types.h
index 99b5a7575c21..7a906b5214a4 100644
--- a/arch/hexagon/include/asm/spinlock_types.h
+++ b/arch/hexagon/include/asm/spinlock_types.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Spinlock support for the Hexagon architecture 2 * Spinlock support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/string.h b/arch/hexagon/include/asm/string.h
index f4489c15942c..7d37f47a1d07 100644
--- a/arch/hexagon/include/asm/string.h
+++ b/arch/hexagon/include/asm/string.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/suspend.h b/arch/hexagon/include/asm/suspend.h
index 089dd8268791..18b44b557fbc 100644
--- a/arch/hexagon/include/asm/suspend.h
+++ b/arch/hexagon/include/asm/suspend.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/switch_to.h b/arch/hexagon/include/asm/switch_to.h
index 28ca0dfb6064..96745e7b3e3c 100644
--- a/arch/hexagon/include/asm/switch_to.h
+++ b/arch/hexagon/include/asm/switch_to.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Task switching definitions for the Hexagon architecture 2 * Task switching definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index 3e7d61d38d97..fb0e9d48faa6 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Syscall support for the Hexagon architecture 2 * Syscall support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h
index e4a0aad69cbb..f7c32406a711 100644
--- a/arch/hexagon/include/asm/thread_info.h
+++ b/arch/hexagon/include/asm/thread_info.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Thread support for the Hexagon architecture 2 * Thread support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/time.h b/arch/hexagon/include/asm/time.h
index 081b82cac9a9..deda170c03b8 100644
--- a/arch/hexagon/include/asm/time.h
+++ b/arch/hexagon/include/asm/time.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/timer-regs.h b/arch/hexagon/include/asm/timer-regs.h
index d80db239a7b6..79912b8c1e5b 100644
--- a/arch/hexagon/include/asm/timer-regs.h
+++ b/arch/hexagon/include/asm/timer-regs.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Timer support for Hexagon 2 * Timer support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/timex.h b/arch/hexagon/include/asm/timex.h
index b11c62b23f31..f63fe132f072 100644
--- a/arch/hexagon/include/asm/timex.h
+++ b/arch/hexagon/include/asm/timex.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/tlb.h b/arch/hexagon/include/asm/tlb.h
index 473abde01d62..2f00772cc08a 100644
--- a/arch/hexagon/include/asm/tlb.h
+++ b/arch/hexagon/include/asm/tlb.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/tlbflush.h b/arch/hexagon/include/asm/tlbflush.h
index b89a90251225..62d95a9705c4 100644
--- a/arch/hexagon/include/asm/tlbflush.h
+++ b/arch/hexagon/include/asm/tlbflush.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * TLB flush support for Hexagon 2 * TLB flush support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/traps.h b/arch/hexagon/include/asm/traps.h
index 6a407f6e5e24..ec11285012cf 100644
--- a/arch/hexagon/include/asm/traps.h
+++ b/arch/hexagon/include/asm/traps.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Trap support for Hexagon 2 * Trap support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index 7e706eadbf0a..e4127e4d6a5b 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * User memory access support for Hexagon 2 * User memory access support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/vdso.h b/arch/hexagon/include/asm/vdso.h
index 2d95cbba3572..ed08e6c6886d 100644
--- a/arch/hexagon/include/asm/vdso.h
+++ b/arch/hexagon/include/asm/vdso.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * vDSO implementation for Hexagon 2 * vDSO implementation for Hexagon
3 * 3 *
4 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/vm_fault.h b/arch/hexagon/include/asm/vm_fault.h
index cacda36ef5d5..9b0e9c50ceda 100644
--- a/arch/hexagon/include/asm/vm_fault.h
+++ b/arch/hexagon/include/asm/vm_fault.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/vm_mmu.h b/arch/hexagon/include/asm/vm_mmu.h
index 580462de5cca..9a94de7969bb 100644
--- a/arch/hexagon/include/asm/vm_mmu.h
+++ b/arch/hexagon/include/asm/vm_mmu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon VM page table entry definitions 2 * Hexagon VM page table entry definitions
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/uapi/asm/Kbuild b/arch/hexagon/include/uapi/asm/Kbuild
index baebb3da1d44..c31706c38631 100644
--- a/arch/hexagon/include/uapi/asm/Kbuild
+++ b/arch/hexagon/include/uapi/asm/Kbuild
@@ -1,3 +1,15 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += bitsperlong.h
5header-y += byteorder.h
6header-y += kvm_para.h
7header-y += param.h
8header-y += ptrace.h
9header-y += registers.h
10header-y += setup.h
11header-y += sigcontext.h
12header-y += signal.h
13header-y += swab.h
14header-y += unistd.h
15header-y += user.h
diff --git a/arch/hexagon/include/asm/bitsperlong.h b/arch/hexagon/include/uapi/asm/bitsperlong.h
index 2701cae3426e..4a658151383d 100644
--- a/arch/hexagon/include/asm/bitsperlong.h
+++ b/arch/hexagon/include/uapi/asm/bitsperlong.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/byteorder.h b/arch/hexagon/include/uapi/asm/byteorder.h
index 0e19b9fe4ca6..e31f3f7d9a45 100644
--- a/arch/hexagon/include/asm/byteorder.h
+++ b/arch/hexagon/include/uapi/asm/byteorder.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/kvm_para.h b/arch/hexagon/include/uapi/asm/kvm_para.h
index 14fab8f0b957..14fab8f0b957 100644
--- a/arch/hexagon/include/asm/kvm_para.h
+++ b/arch/hexagon/include/uapi/asm/kvm_para.h
diff --git a/arch/hexagon/include/asm/param.h b/arch/hexagon/include/uapi/asm/param.h
index 285344bbd036..5cec8c0417fb 100644
--- a/arch/hexagon/include/asm/param.h
+++ b/arch/hexagon/include/uapi/asm/param.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/ptrace.h b/arch/hexagon/include/uapi/asm/ptrace.h
index 3d2f607cd63c..8ef784047a74 100644
--- a/arch/hexagon/include/asm/ptrace.h
+++ b/arch/hexagon/include/uapi/asm/ptrace.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Ptrace definitions for the Hexagon architecture 2 * Ptrace definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/registers.h b/arch/hexagon/include/uapi/asm/registers.h
index 4dd741be855d..c20406f63b5c 100644
--- a/arch/hexagon/include/asm/registers.h
+++ b/arch/hexagon/include/uapi/asm/registers.h
@@ -1,23 +1,8 @@
1/* 1/*
2 * Register definitions for the Hexagon architecture 2 * Register definitions for the Hexagon architecture
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
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 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */ 3 */
20 4
5
21#ifndef _ASM_REGISTERS_H 6#ifndef _ASM_REGISTERS_H
22#define _ASM_REGISTERS_H 7#define _ASM_REGISTERS_H
23 8
diff --git a/arch/hexagon/include/asm/setup.h b/arch/hexagon/include/uapi/asm/setup.h
index 3b754c50bc0a..e48285e4af96 100644
--- a/arch/hexagon/include/asm/setup.h
+++ b/arch/hexagon/include/uapi/asm/setup.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/sigcontext.h b/arch/hexagon/include/uapi/asm/sigcontext.h
index ce6dcd995220..b6ba5369ccc6 100644
--- a/arch/hexagon/include/asm/sigcontext.h
+++ b/arch/hexagon/include/uapi/asm/sigcontext.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/signal.h b/arch/hexagon/include/uapi/asm/signal.h
index 471c0562e17b..939556817d34 100644
--- a/arch/hexagon/include/asm/signal.h
+++ b/arch/hexagon/include/uapi/asm/signal.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/swab.h b/arch/hexagon/include/uapi/asm/swab.h
index 99cf0be3fb83..9069e9247a2e 100644
--- a/arch/hexagon/include/asm/swab.h
+++ b/arch/hexagon/include/uapi/asm/swab.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
index c0d5565030ae..81312d6a52e6 100644
--- a/arch/hexagon/include/asm/unistd.h
+++ b/arch/hexagon/include/uapi/asm/unistd.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Syscall support for Hexagon 2 * Syscall support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/include/asm/user.h b/arch/hexagon/include/uapi/asm/user.h
index 3a55078543d1..cef13ee1413f 100644
--- a/arch/hexagon/include/asm/user.h
+++ b/arch/hexagon/include/uapi/asm/user.h
@@ -1,21 +1,3 @@
1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA.
17 */
18
19#ifndef HEXAGON_ASM_USER_H 1#ifndef HEXAGON_ASM_USER_H
20#define HEXAGON_ASM_USER_H 2#define HEXAGON_ASM_USER_H
21 3
diff --git a/arch/hexagon/kernel/asm-offsets.c b/arch/hexagon/kernel/asm-offsets.c
index 89ffa514611f..2d5e84d3b00d 100644
--- a/arch/hexagon/kernel/asm-offsets.c
+++ b/arch/hexagon/kernel/asm-offsets.c
@@ -5,7 +5,7 @@
5 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com 5 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
6 * Copyright (C) 2000 MIPS Technologies, Inc. 6 * Copyright (C) 2000 MIPS Technologies, Inc.
7 * 7 *
8 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 8 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 and 11 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 2b48751aa5f7..65c7bdcf565e 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * DMA implementation for Hexagon 2 * DMA implementation for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/head.S b/arch/hexagon/kernel/head.S
index 8e6b819125a3..d859402c73ba 100644
--- a/arch/hexagon/kernel/head.S
+++ b/arch/hexagon/kernel/head.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Early kernel startup code for Hexagon 2 * Early kernel startup code for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/kernel/hexagon_ksyms.c b/arch/hexagon/kernel/hexagon_ksyms.c
index 7f1892471805..32b1379d6877 100644
--- a/arch/hexagon/kernel/hexagon_ksyms.c
+++ b/arch/hexagon/kernel/hexagon_ksyms.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Export of symbols defined in assembly files and/or libgcc. 2 * Export of symbols defined in assembly files and/or libgcc.
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/irq_cpu.c b/arch/hexagon/kernel/irq_cpu.c
index d4416a1a431e..85883e1fdc12 100644
--- a/arch/hexagon/kernel/irq_cpu.c
+++ b/arch/hexagon/kernel/irq_cpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * First-level interrupt controller model for Hexagon. 2 * First-level interrupt controller model for Hexagon.
3 * 3 *
4 * Copyright (c) 2010-2011 Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/kgdb.c b/arch/hexagon/kernel/kgdb.c
index fe4aa1bcca50..344645370646 100644
--- a/arch/hexagon/kernel/kgdb.c
+++ b/arch/hexagon/kernel/kgdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support 2 * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support
3 * 3 *
4 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/module.c b/arch/hexagon/kernel/module.c
index 61a76bae3668..477d07a5646c 100644
--- a/arch/hexagon/kernel/module.c
+++ b/arch/hexagon/kernel/module.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Kernel module loader for Hexagon 2 * Kernel module loader for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index af51de63b835..9f6d7411b574 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Process creation support for Hexagon 2 * Process creation support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
index 96c3b2c4dbad..670b1b0bee63 100644
--- a/arch/hexagon/kernel/ptrace.c
+++ b/arch/hexagon/kernel/ptrace.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Ptrace support for Hexagon 2 * Ptrace support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c
index 4d72fc58e9b1..6aeabc962b3b 100644
--- a/arch/hexagon/kernel/reset.c
+++ b/arch/hexagon/kernel/reset.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 1202f78d25cb..94a387835008 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Arch related setup for Hexagon 2 * Arch related setup for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index 1ea16bec7b91..5047b8b879c0 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Signal support for Hexagon processor 2 * Signal support for Hexagon processor
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c
index 149fbefc1a4d..8e095dffd070 100644
--- a/arch/hexagon/kernel/smp.c
+++ b/arch/hexagon/kernel/smp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMP support for Hexagon 2 * SMP support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c
index 11c597b2ac59..f94918b449a8 100644
--- a/arch/hexagon/kernel/stacktrace.c
+++ b/arch/hexagon/kernel/stacktrace.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Stacktrace support for Hexagon 2 * Stacktrace support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/syscall.c b/arch/hexagon/kernel/syscall.c
index 25a9bfe3445d..319fa6494f58 100644
--- a/arch/hexagon/kernel/syscall.c
+++ b/arch/hexagon/kernel/syscall.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon system calls 2 * Hexagon system calls
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/syscalltab.c b/arch/hexagon/kernel/syscalltab.c
index c550f4177ab8..7024b1ddc08a 100644
--- a/arch/hexagon/kernel/syscalltab.c
+++ b/arch/hexagon/kernel/syscalltab.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * System call table for Hexagon 2 * System call table for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c
index 36ba64185711..9903fad997f3 100644
--- a/arch/hexagon/kernel/time.c
+++ b/arch/hexagon/kernel/time.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Time related functions for Hexagon architecture 2 * Time related functions for Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/topology.c b/arch/hexagon/kernel/topology.c
index ba4475184432..352f27e809fd 100644
--- a/arch/hexagon/kernel/topology.c
+++ b/arch/hexagon/kernel/topology.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * CPU topology for Hexagon 2 * CPU topology for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/trampoline.S b/arch/hexagon/kernel/trampoline.S
index 06c36c036b98..18110a9056b0 100644
--- a/arch/hexagon/kernel/trampoline.S
+++ b/arch/hexagon/kernel/trampoline.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/traps.c b/arch/hexagon/kernel/traps.c
index f08857d0715b..a41eeb8eeaa1 100644
--- a/arch/hexagon/kernel/traps.c
+++ b/arch/hexagon/kernel/traps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Kernel traps/events for Hexagon processor 2 * Kernel traps/events for Hexagon processor
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c
index 5d39f42f7085..0bf5a87e4d0a 100644
--- a/arch/hexagon/kernel/vdso.c
+++ b/arch/hexagon/kernel/vdso.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * vDSO implementation for Hexagon 2 * vDSO implementation for Hexagon
3 * 3 *
4 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S
index 5b99066cbc8d..cd71673ac259 100644
--- a/arch/hexagon/kernel/vm_entry.S
+++ b/arch/hexagon/kernel/vm_entry.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Event entry/exit for Hexagon 2 * Event entry/exit for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_events.c b/arch/hexagon/kernel/vm_events.c
index 591fc1b68635..9b5a4a295a68 100644
--- a/arch/hexagon/kernel/vm_events.c
+++ b/arch/hexagon/kernel/vm_events.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Mostly IRQ support for Hexagon 2 * Mostly IRQ support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_init_segtable.S b/arch/hexagon/kernel/vm_init_segtable.S
index aebb35b6465e..80967f2192b3 100644
--- a/arch/hexagon/kernel/vm_init_segtable.S
+++ b/arch/hexagon/kernel/vm_init_segtable.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Initial page table for Linux kernel under Hexagon VM, 2 * Initial page table for Linux kernel under Hexagon VM,
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_ops.S b/arch/hexagon/kernel/vm_ops.S
index 24d7fcac4ff2..9fb77b3f6cf2 100644
--- a/arch/hexagon/kernel/vm_ops.S
+++ b/arch/hexagon/kernel/vm_ops.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon VM instruction support 2 * Hexagon VM instruction support
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_switch.S b/arch/hexagon/kernel/vm_switch.S
index 0decf2f58e32..62c6df91b3bb 100644
--- a/arch/hexagon/kernel/vm_switch.S
+++ b/arch/hexagon/kernel/vm_switch.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Context switch support for Hexagon 2 * Context switch support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vm_vectors.S b/arch/hexagon/kernel/vm_vectors.S
index 97a4b50b00df..620f42cc582a 100644
--- a/arch/hexagon/kernel/vm_vectors.S
+++ b/arch/hexagon/kernel/vm_vectors.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Event jump tables 2 * Event jump tables
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
index 071d3c30edfb..14e793f6abbf 100644
--- a/arch/hexagon/kernel/vmlinux.lds.S
+++ b/arch/hexagon/kernel/vmlinux.lds.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Linker script for Hexagon kernel 2 * Linker script for Hexagon kernel
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/lib/checksum.c b/arch/hexagon/lib/checksum.c
index 93005522d52b..8169f78a46a7 100644
--- a/arch/hexagon/lib/checksum.c
+++ b/arch/hexagon/lib/checksum.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Checksum functions for Hexagon 2 * Checksum functions for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/lib/io.c b/arch/hexagon/lib/io.c
index 8ae47ba0e705..885c9626d5e0 100644
--- a/arch/hexagon/lib/io.c
+++ b/arch/hexagon/lib/io.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * I/O access functions for Hexagon 2 * I/O access functions for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/lib/memcpy.S b/arch/hexagon/lib/memcpy.S
index 2101c3395665..81c561c4b4d6 100644
--- a/arch/hexagon/lib/memcpy.S
+++ b/arch/hexagon/lib/memcpy.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/hexagon/lib/memset.S b/arch/hexagon/lib/memset.S
index 26d961439ab0..9341889ea3f6 100644
--- a/arch/hexagon/lib/memset.S
+++ b/arch/hexagon/lib/memset.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011 Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/cache.c b/arch/hexagon/mm/cache.c
index c5cf6ee27587..fe14ccf28561 100644
--- a/arch/hexagon/mm/cache.c
+++ b/arch/hexagon/mm/cache.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Cache management functions for Hexagon 2 * Cache management functions for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/copy_from_user.S b/arch/hexagon/mm/copy_from_user.S
index 8eb1d4d61a3d..7fc94f3e6642 100644
--- a/arch/hexagon/mm/copy_from_user.S
+++ b/arch/hexagon/mm/copy_from_user.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * User memory copy functions for kernel 2 * User memory copy functions for kernel
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/copy_to_user.S b/arch/hexagon/mm/copy_to_user.S
index cb9740ed9e7d..0cfbcc09d1d9 100644
--- a/arch/hexagon/mm/copy_to_user.S
+++ b/arch/hexagon/mm/copy_to_user.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * User memory copying routines for the Hexagon Kernel 2 * User memory copying routines for the Hexagon Kernel
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/copy_user_template.S b/arch/hexagon/mm/copy_user_template.S
index 08d7d7b23daa..254d8cc766bb 100644
--- a/arch/hexagon/mm/copy_user_template.S
+++ b/arch/hexagon/mm/copy_user_template.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
index b57d741750b2..69ffcfd28794 100644
--- a/arch/hexagon/mm/init.c
+++ b/arch/hexagon/mm/init.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory subsystem initialization for Hexagon 2 * Memory subsystem initialization for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/ioremap.c b/arch/hexagon/mm/ioremap.c
index 3a37bc3b0116..5905fd5f97f6 100644
--- a/arch/hexagon/mm/ioremap.c
+++ b/arch/hexagon/mm/ioremap.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * I/O remap functions for Hexagon 2 * I/O remap functions for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/pgalloc.c b/arch/hexagon/mm/pgalloc.c
index b175e2d42b89..19760a4611d9 100644
--- a/arch/hexagon/mm/pgalloc.c
+++ b/arch/hexagon/mm/pgalloc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/strnlen_user.S b/arch/hexagon/mm/strnlen_user.S
index 5c6a16c7c72a..0eecb7a768fe 100644
--- a/arch/hexagon/mm/strnlen_user.S
+++ b/arch/hexagon/mm/strnlen_user.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * User string length functions for kernel 2 * User string length functions for kernel
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/uaccess.c b/arch/hexagon/mm/uaccess.c
index e748108b47a7..34127261c2b7 100644
--- a/arch/hexagon/mm/uaccess.c
+++ b/arch/hexagon/mm/uaccess.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 2 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index 513b74cb397e..308ef0ce648b 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory fault handling for Hexagon 2 * Memory fault handling for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011 Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/hexagon/mm/vm_tlb.c b/arch/hexagon/mm/vm_tlb.c
index c6ff41575461..9647d00cb761 100644
--- a/arch/hexagon/mm/vm_tlb.c
+++ b/arch/hexagon/mm/vm_tlb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon Virtual Machine TLB functions 2 * Hexagon Virtual Machine TLB functions
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 and 7 * it under the terms of the GNU General Public License version 2 and
diff --git a/arch/ia64/include/uapi/asm/Kbuild b/arch/ia64/include/uapi/asm/Kbuild
index 30cafac93703..1b3f5eb5fcdb 100644
--- a/arch/ia64/include/uapi/asm/Kbuild
+++ b/arch/ia64/include/uapi/asm/Kbuild
@@ -1,6 +1,8 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += kvm_para.h
5
4header-y += auxvec.h 6header-y += auxvec.h
5header-y += bitsperlong.h 7header-y += bitsperlong.h
6header-y += break.h 8header-y += break.h
diff --git a/arch/ia64/include/uapi/asm/kvm_para.h b/arch/ia64/include/uapi/asm/kvm_para.h
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/arch/ia64/include/uapi/asm/kvm_para.h
+++ /dev/null
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index e69de29bb2d1..533053d12ced 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -0,0 +1 @@
# MIPS headers
diff --git a/arch/mips/include/asm/delay.h b/arch/mips/include/asm/delay.h
index e7cd78277c23..dc0a5f77a35c 100644
--- a/arch/mips/include/asm/delay.h
+++ b/arch/mips/include/asm/delay.h
@@ -13,9 +13,9 @@
13 13
14#include <linux/param.h> 14#include <linux/param.h>
15 15
16extern void __delay(unsigned int loops); 16extern void __delay(unsigned long loops);
17extern void __ndelay(unsigned int ns); 17extern void __ndelay(unsigned long ns);
18extern void __udelay(unsigned int us); 18extern void __udelay(unsigned long us);
19 19
20#define ndelay(ns) __ndelay(ns) 20#define ndelay(ns) __ndelay(ns)
21#define udelay(us) __udelay(us) 21#define udelay(us) __udelay(us)
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index c26e18250079..f5b521d5a67d 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -9,6 +9,7 @@
9#ifndef _ASM_PGTABLE_64_H 9#ifndef _ASM_PGTABLE_64_H
10#define _ASM_PGTABLE_64_H 10#define _ASM_PGTABLE_64_H
11 11
12#include <linux/compiler.h>
12#include <linux/linkage.h> 13#include <linux/linkage.h>
13 14
14#include <asm/addrspace.h> 15#include <asm/addrspace.h>
@@ -172,7 +173,19 @@ static inline int pmd_none(pmd_t pmd)
172 return pmd_val(pmd) == (unsigned long) invalid_pte_table; 173 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
173} 174}
174 175
175#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) 176static inline int pmd_bad(pmd_t pmd)
177{
178#ifdef CONFIG_HUGETLB_PAGE
179 /* pmd_huge(pmd) but inline */
180 if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
181 return 0;
182#endif
183
184 if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
185 return 1;
186
187 return 0;
188}
176 189
177static inline int pmd_present(pmd_t pmd) 190static inline int pmd_present(pmd_t pmd)
178{ 191{
diff --git a/arch/mips/jz4740/serial.h b/arch/mips/jz4740/serial.h
index b9fe3ade0289..8eb715bb1ea8 100644
--- a/arch/mips/jz4740/serial.h
+++ b/arch/mips/jz4740/serial.h
@@ -14,6 +14,9 @@
14 */ 14 */
15 15
16#ifndef __MIPS_JZ4740_SERIAL_H__ 16#ifndef __MIPS_JZ4740_SERIAL_H__
17#define __MIPS_JZ4740_SERIAL_H__
18
19struct uart_port;
17 20
18void jz4740_serial_out(struct uart_port *p, int offset, int value); 21void jz4740_serial_out(struct uart_port *p, int offset, int value);
19 22
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index afc379ca3753..06cd0c610f44 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -97,7 +97,7 @@ static void cmp_init_secondary(void)
97 97
98 /* Enable per-cpu interrupts: platform specific */ 98 /* Enable per-cpu interrupts: platform specific */
99 99
100 c->core = (read_c0_ebase() >> 1) & 0xff; 100 c->core = (read_c0_ebase() >> 1) & 0x1ff;
101#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) 101#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
102 c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE; 102 c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE;
103#endif 103#endif
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 5995969e8c42..dc81ca8dc0dd 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -15,13 +15,17 @@
15#include <asm/compiler.h> 15#include <asm/compiler.h>
16#include <asm/war.h> 16#include <asm/war.h>
17 17
18inline void __delay(unsigned int loops) 18void __delay(unsigned long loops)
19{ 19{
20 __asm__ __volatile__ ( 20 __asm__ __volatile__ (
21 " .set noreorder \n" 21 " .set noreorder \n"
22 " .align 3 \n" 22 " .align 3 \n"
23 "1: bnez %0, 1b \n" 23 "1: bnez %0, 1b \n"
24#if __SIZEOF_LONG__ == 4
24 " subu %0, 1 \n" 25 " subu %0, 1 \n"
26#else
27 " dsubu %0, 1 \n"
28#endif
25 " .set reorder \n" 29 " .set reorder \n"
26 : "=r" (loops) 30 : "=r" (loops)
27 : "0" (loops)); 31 : "0" (loops));
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
index 3f69725556af..a99c1d3fc567 100644
--- a/arch/mips/lib/dump_tlb.c
+++ b/arch/mips/lib/dump_tlb.c
@@ -50,8 +50,9 @@ static void dump_tlb(int first, int last)
50{ 50{
51 unsigned long s_entryhi, entryhi, asid; 51 unsigned long s_entryhi, entryhi, asid;
52 unsigned long long entrylo0, entrylo1; 52 unsigned long long entrylo0, entrylo1;
53 unsigned int s_index, pagemask, c0, c1, i; 53 unsigned int s_index, s_pagemask, pagemask, c0, c1, i;
54 54
55 s_pagemask = read_c0_pagemask();
55 s_entryhi = read_c0_entryhi(); 56 s_entryhi = read_c0_entryhi();
56 s_index = read_c0_index(); 57 s_index = read_c0_index();
57 asid = s_entryhi & 0xff; 58 asid = s_entryhi & 0xff;
@@ -103,6 +104,7 @@ static void dump_tlb(int first, int last)
103 104
104 write_c0_entryhi(s_entryhi); 105 write_c0_entryhi(s_entryhi);
105 write_c0_index(s_index); 106 write_c0_index(s_index);
107 write_c0_pagemask(s_pagemask);
106} 108}
107 109
108void dump_tlb_all(void) 110void dump_tlb_all(void)
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 87b9cfcc30ff..4b9b935a070e 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -320,6 +320,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
320 tlb_write_random(); 320 tlb_write_random();
321 else 321 else
322 tlb_write_indexed(); 322 tlb_write_indexed();
323 tlbw_use_hazard();
323 write_c0_pagemask(PM_DEFAULT_MASK); 324 write_c0_pagemask(PM_DEFAULT_MASK);
324 } else 325 } else
325#endif 326#endif
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 658a520364ce..2833dcb67b5a 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -148,8 +148,8 @@ enum label_id {
148 label_leave, 148 label_leave,
149 label_vmalloc, 149 label_vmalloc,
150 label_vmalloc_done, 150 label_vmalloc_done,
151 label_tlbw_hazard, 151 label_tlbw_hazard_0,
152 label_split, 152 label_split = label_tlbw_hazard_0 + 8,
153 label_tlbl_goaround1, 153 label_tlbl_goaround1,
154 label_tlbl_goaround2, 154 label_tlbl_goaround2,
155 label_nopage_tlbl, 155 label_nopage_tlbl,
@@ -167,7 +167,7 @@ UASM_L_LA(_second_part)
167UASM_L_LA(_leave) 167UASM_L_LA(_leave)
168UASM_L_LA(_vmalloc) 168UASM_L_LA(_vmalloc)
169UASM_L_LA(_vmalloc_done) 169UASM_L_LA(_vmalloc_done)
170UASM_L_LA(_tlbw_hazard) 170/* _tlbw_hazard_x is handled differently. */
171UASM_L_LA(_split) 171UASM_L_LA(_split)
172UASM_L_LA(_tlbl_goaround1) 172UASM_L_LA(_tlbl_goaround1)
173UASM_L_LA(_tlbl_goaround2) 173UASM_L_LA(_tlbl_goaround2)
@@ -181,6 +181,30 @@ UASM_L_LA(_large_segbits_fault)
181UASM_L_LA(_tlb_huge_update) 181UASM_L_LA(_tlb_huge_update)
182#endif 182#endif
183 183
184static int __cpuinitdata hazard_instance;
185
186static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance)
187{
188 switch (instance) {
189 case 0 ... 7:
190 uasm_il_bgezl(p, r, 0, label_tlbw_hazard_0 + instance);
191 return;
192 default:
193 BUG();
194 }
195}
196
197static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance)
198{
199 switch (instance) {
200 case 0 ... 7:
201 uasm_build_label(l, *p, label_tlbw_hazard_0 + instance);
202 break;
203 default:
204 BUG();
205 }
206}
207
184/* 208/*
185 * For debug purposes. 209 * For debug purposes.
186 */ 210 */
@@ -478,21 +502,28 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
478 * This branch uses up a mtc0 hazard nop slot and saves 502 * This branch uses up a mtc0 hazard nop slot and saves
479 * two nops after the tlbw instruction. 503 * two nops after the tlbw instruction.
480 */ 504 */
481 uasm_il_bgezl(p, r, 0, label_tlbw_hazard); 505 uasm_bgezl_hazard(p, r, hazard_instance);
482 tlbw(p); 506 tlbw(p);
483 uasm_l_tlbw_hazard(l, *p); 507 uasm_bgezl_label(l, p, hazard_instance);
508 hazard_instance++;
484 uasm_i_nop(p); 509 uasm_i_nop(p);
485 break; 510 break;
486 511
487 case CPU_R4600: 512 case CPU_R4600:
488 case CPU_R4700: 513 case CPU_R4700:
489 case CPU_R5000:
490 case CPU_R5000A:
491 uasm_i_nop(p); 514 uasm_i_nop(p);
492 tlbw(p); 515 tlbw(p);
493 uasm_i_nop(p); 516 uasm_i_nop(p);
494 break; 517 break;
495 518
519 case CPU_R5000:
520 case CPU_R5000A:
521 case CPU_NEVADA:
522 uasm_i_nop(p); /* QED specifies 2 nops hazard */
523 uasm_i_nop(p); /* QED specifies 2 nops hazard */
524 tlbw(p);
525 break;
526
496 case CPU_R4300: 527 case CPU_R4300:
497 case CPU_5KC: 528 case CPU_5KC:
498 case CPU_TX49XX: 529 case CPU_TX49XX:
@@ -526,17 +557,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
526 tlbw(p); 557 tlbw(p);
527 break; 558 break;
528 559
529 case CPU_NEVADA:
530 uasm_i_nop(p); /* QED specifies 2 nops hazard */
531 /*
532 * This branch uses up a mtc0 hazard nop slot and saves
533 * a nop after the tlbw instruction.
534 */
535 uasm_il_bgezl(p, r, 0, label_tlbw_hazard);
536 tlbw(p);
537 uasm_l_tlbw_hazard(l, *p);
538 break;
539
540 case CPU_RM7000: 560 case CPU_RM7000:
541 uasm_i_nop(p); 561 uasm_i_nop(p);
542 uasm_i_nop(p); 562 uasm_i_nop(p);
diff --git a/arch/mn10300/include/uapi/asm/setup.h b/arch/mn10300/include/uapi/asm/setup.h
index e69de29bb2d1..ae5704fa77ad 100644
--- a/arch/mn10300/include/uapi/asm/setup.h
+++ b/arch/mn10300/include/uapi/asm/setup.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here anymore, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 458371a1565a..bac8debecffb 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,6 +1,5 @@
1include include/asm-generic/Kbuild.asm
2 1
3header-y += pdc.h 2generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \
4generic-y += clkdev.h 3 segment.h topology.h vga.h device.h percpu.h hw_irq.h mutex.h \
5generic-y += word-at-a-time.h 4 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \
6generic-y += exec.h 5 poll.h xor.h clkdev.h exec.h
diff --git a/arch/parisc/include/asm/auxvec.h b/arch/parisc/include/asm/auxvec.h
deleted file mode 100644
index 9c3ac4b89dc9..000000000000
--- a/arch/parisc/include/asm/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMPARISC_AUXVEC_H
2#define __ASMPARISC_AUXVEC_H
3
4#endif
diff --git a/arch/parisc/include/asm/compat_signal.h b/arch/parisc/include/asm/compat_signal.h
deleted file mode 100644
index 6ad02c360b21..000000000000
--- a/arch/parisc/include/asm/compat_signal.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Use generic */
2#include <asm-generic/compat_signal.h>
diff --git a/arch/parisc/include/asm/cputime.h b/arch/parisc/include/asm/cputime.h
deleted file mode 100644
index dcdf2fbd7e72..000000000000
--- a/arch/parisc/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PARISC_CPUTIME_H
2#define __PARISC_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __PARISC_CPUTIME_H */
diff --git a/arch/parisc/include/asm/device.h b/arch/parisc/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/parisc/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/parisc/include/asm/div64.h b/arch/parisc/include/asm/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/arch/parisc/include/asm/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/arch/parisc/include/asm/emergency-restart.h b/arch/parisc/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/parisc/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/parisc/include/asm/hw_irq.h b/arch/parisc/include/asm/hw_irq.h
deleted file mode 100644
index 6707f7df3921..000000000000
--- a/arch/parisc/include/asm/hw_irq.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4/*
5 * linux/include/asm/hw_irq.h
6 */
7
8#endif
diff --git a/arch/parisc/include/asm/irq_regs.h b/arch/parisc/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/parisc/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/parisc/include/asm/kdebug.h b/arch/parisc/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/parisc/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/parisc/include/asm/kvm_para.h b/arch/parisc/include/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b957..000000000000
--- a/arch/parisc/include/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/parisc/include/asm/local.h b/arch/parisc/include/asm/local.h
deleted file mode 100644
index c11c530f74d0..000000000000
--- a/arch/parisc/include/asm/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/arch/parisc/include/asm/local64.h b/arch/parisc/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/parisc/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/parisc/include/asm/mutex.h b/arch/parisc/include/asm/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/arch/parisc/include/asm/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/parisc/include/asm/param.h b/arch/parisc/include/asm/param.h
deleted file mode 100644
index 965d45427975..000000000000
--- a/arch/parisc/include/asm/param.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/param.h>
diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h
index 7f0f2d23059d..7eb616e4bf8a 100644
--- a/arch/parisc/include/asm/pdc.h
+++ b/arch/parisc/include/asm/pdc.h
@@ -1,348 +1,10 @@
1#ifndef _PARISC_PDC_H 1#ifndef _PARISC_PDC_H
2#define _PARISC_PDC_H 2#define _PARISC_PDC_H
3 3
4/* 4#include <uapi/asm/pdc.h>
5 * PDC return values ...
6 * All PDC calls return a subset of these errors.
7 */
8
9#define PDC_WARN 3 /* Call completed with a warning */
10#define PDC_REQ_ERR_1 2 /* See above */
11#define PDC_REQ_ERR_0 1 /* Call would generate a requestor error */
12#define PDC_OK 0 /* Call completed successfully */
13#define PDC_BAD_PROC -1 /* Called non-existent procedure*/
14#define PDC_BAD_OPTION -2 /* Called with non-existent option */
15#define PDC_ERROR -3 /* Call could not complete without an error */
16#define PDC_NE_MOD -5 /* Module not found */
17#define PDC_NE_CELL_MOD -7 /* Cell module not found */
18#define PDC_INVALID_ARG -10 /* Called with an invalid argument */
19#define PDC_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */
20#define PDC_NOT_NARROW -17 /* Narrow mode not supported */
21
22/*
23 * PDC entry points...
24 */
25
26#define PDC_POW_FAIL 1 /* perform a power-fail */
27#define PDC_POW_FAIL_PREPARE 0 /* prepare for powerfail */
28
29#define PDC_CHASSIS 2 /* PDC-chassis functions */
30#define PDC_CHASSIS_DISP 0 /* update chassis display */
31#define PDC_CHASSIS_WARN 1 /* return chassis warnings */
32#define PDC_CHASSIS_DISPWARN 2 /* update&return chassis status */
33#define PDC_RETURN_CHASSIS_INFO 128 /* HVERSION dependent: return chassis LED/LCD info */
34
35#define PDC_PIM 3 /* Get PIM data */
36#define PDC_PIM_HPMC 0 /* Transfer HPMC data */
37#define PDC_PIM_RETURN_SIZE 1 /* Get Max buffer needed for PIM*/
38#define PDC_PIM_LPMC 2 /* Transfer HPMC data */
39#define PDC_PIM_SOFT_BOOT 3 /* Transfer Soft Boot data */
40#define PDC_PIM_TOC 4 /* Transfer TOC data */
41
42#define PDC_MODEL 4 /* PDC model information call */
43#define PDC_MODEL_INFO 0 /* returns information */
44#define PDC_MODEL_BOOTID 1 /* set the BOOT_ID */
45#define PDC_MODEL_VERSIONS 2 /* returns cpu-internal versions*/
46#define PDC_MODEL_SYSMODEL 3 /* return system model info */
47#define PDC_MODEL_ENSPEC 4 /* enable specific option */
48#define PDC_MODEL_DISPEC 5 /* disable specific option */
49#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */
50#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */
51/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
52#define PDC_MODEL_OS64 (1 << 0)
53#define PDC_MODEL_OS32 (1 << 1)
54#define PDC_MODEL_IOPDIR_FDC (1 << 2)
55#define PDC_MODEL_NVA_MASK (3 << 4)
56#define PDC_MODEL_NVA_SUPPORTED (0 << 4)
57#define PDC_MODEL_NVA_SLOW (1 << 4)
58#define PDC_MODEL_NVA_UNSUPPORTED (3 << 4)
59#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */
60#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */
61
62#define PA89_INSTRUCTION_SET 0x4 /* capatibilies returned */
63#define PA90_INSTRUCTION_SET 0x8
64
65#define PDC_CACHE 5 /* return/set cache (& TLB) info*/
66#define PDC_CACHE_INFO 0 /* returns information */
67#define PDC_CACHE_SET_COH 1 /* set coherence state */
68#define PDC_CACHE_RET_SPID 2 /* returns space-ID bits */
69
70#define PDC_HPA 6 /* return HPA of processor */
71#define PDC_HPA_PROCESSOR 0
72#define PDC_HPA_MODULES 1
73
74#define PDC_COPROC 7 /* Co-Processor (usually FP unit(s)) */
75#define PDC_COPROC_CFG 0 /* Co-Processor Cfg (FP unit(s) enabled?) */
76
77#define PDC_IODC 8 /* talk to IODC */
78#define PDC_IODC_READ 0 /* read IODC entry point */
79/* PDC_IODC_RI_ * INDEX parameter of PDC_IODC_READ */
80#define PDC_IODC_RI_DATA_BYTES 0 /* IODC Data Bytes */
81/* 1, 2 obsolete - HVERSION dependent*/
82#define PDC_IODC_RI_INIT 3 /* Initialize module */
83#define PDC_IODC_RI_IO 4 /* Module input/output */
84#define PDC_IODC_RI_SPA 5 /* Module input/output */
85#define PDC_IODC_RI_CONFIG 6 /* Module input/output */
86/* 7 obsolete - HVERSION dependent */
87#define PDC_IODC_RI_TEST 8 /* Module input/output */
88#define PDC_IODC_RI_TLB 9 /* Module input/output */
89#define PDC_IODC_NINIT 2 /* non-destructive init */
90#define PDC_IODC_DINIT 3 /* destructive init */
91#define PDC_IODC_MEMERR 4 /* check for memory errors */
92#define PDC_IODC_INDEX_DATA 0 /* get first 16 bytes from mod IODC */
93#define PDC_IODC_BUS_ERROR -4 /* bus error return value */
94#define PDC_IODC_INVALID_INDEX -5 /* invalid index return value */
95#define PDC_IODC_COUNT -6 /* count is too small */
96
97#define PDC_TOD 9 /* time-of-day clock (TOD) */
98#define PDC_TOD_READ 0 /* read TOD */
99#define PDC_TOD_WRITE 1 /* write TOD */
100
101
102#define PDC_STABLE 10 /* stable storage (sprockets) */
103#define PDC_STABLE_READ 0
104#define PDC_STABLE_WRITE 1
105#define PDC_STABLE_RETURN_SIZE 2
106#define PDC_STABLE_VERIFY_CONTENTS 3
107#define PDC_STABLE_INITIALIZE 4
108
109#define PDC_NVOLATILE 11 /* often not implemented */
110
111#define PDC_ADD_VALID 12 /* Memory validation PDC call */
112#define PDC_ADD_VALID_VERIFY 0 /* Make PDC_ADD_VALID verify region */
113
114#define PDC_INSTR 15 /* get instr to invoke PDCE_CHECK() */
115
116#define PDC_PROC 16 /* (sprockets) */
117
118#define PDC_CONFIG 16 /* (sprockets) */
119#define PDC_CONFIG_DECONFIG 0
120#define PDC_CONFIG_DRECONFIG 1
121#define PDC_CONFIG_DRETURN_CONFIG 2
122
123#define PDC_BLOCK_TLB 18 /* manage hardware block-TLB */
124#define PDC_BTLB_INFO 0 /* returns parameter */
125#define PDC_BTLB_INSERT 1 /* insert BTLB entry */
126#define PDC_BTLB_PURGE 2 /* purge BTLB entries */
127#define PDC_BTLB_PURGE_ALL 3 /* purge all BTLB entries */
128
129#define PDC_TLB 19 /* manage hardware TLB miss handling */
130#define PDC_TLB_INFO 0 /* returns parameter */
131#define PDC_TLB_SETUP 1 /* set up miss handling */
132
133#define PDC_MEM 20 /* Manage memory */
134#define PDC_MEM_MEMINFO 0
135#define PDC_MEM_ADD_PAGE 1
136#define PDC_MEM_CLEAR_PDT 2
137#define PDC_MEM_READ_PDT 3
138#define PDC_MEM_RESET_CLEAR 4
139#define PDC_MEM_GOODMEM 5
140#define PDC_MEM_TABLE 128 /* Non contig mem map (sprockets) */
141#define PDC_MEM_RETURN_ADDRESS_TABLE PDC_MEM_TABLE
142#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES_SIZE 131
143#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES 132
144#define PDC_MEM_GET_PHYSICAL_LOCATION_FROM_MEMORY_ADDRESS 133
145
146#define PDC_MEM_RET_SBE_REPLACED 5 /* PDC_MEM return values */
147#define PDC_MEM_RET_DUPLICATE_ENTRY 4
148#define PDC_MEM_RET_BUF_SIZE_SMALL 1
149#define PDC_MEM_RET_PDT_FULL -11
150#define PDC_MEM_RET_INVALID_PHYSICAL_LOCATION ~0ULL
151
152#define PDC_PSW 21 /* Get/Set default System Mask */
153#define PDC_PSW_MASK 0 /* Return mask */
154#define PDC_PSW_GET_DEFAULTS 1 /* Return defaults */
155#define PDC_PSW_SET_DEFAULTS 2 /* Set default */
156#define PDC_PSW_ENDIAN_BIT 1 /* set for big endian */
157#define PDC_PSW_WIDE_BIT 2 /* set for wide mode */
158
159#define PDC_SYSTEM_MAP 22 /* find system modules */
160#define PDC_FIND_MODULE 0
161#define PDC_FIND_ADDRESS 1
162#define PDC_TRANSLATE_PATH 2
163
164#define PDC_SOFT_POWER 23 /* soft power switch */
165#define PDC_SOFT_POWER_INFO 0 /* return info about the soft power switch */
166#define PDC_SOFT_POWER_ENABLE 1 /* enable/disable soft power switch */
167
168
169/* HVERSION dependent */
170
171/* The PDC_MEM_MAP calls */
172#define PDC_MEM_MAP 128 /* on s700: return page info */
173#define PDC_MEM_MAP_HPA 0 /* returns hpa of a module */
174
175#define PDC_EEPROM 129 /* EEPROM access */
176#define PDC_EEPROM_READ_WORD 0
177#define PDC_EEPROM_WRITE_WORD 1
178#define PDC_EEPROM_READ_BYTE 2
179#define PDC_EEPROM_WRITE_BYTE 3
180#define PDC_EEPROM_EEPROM_PASSWORD -1000
181
182#define PDC_NVM 130 /* NVM (non-volatile memory) access */
183#define PDC_NVM_READ_WORD 0
184#define PDC_NVM_WRITE_WORD 1
185#define PDC_NVM_READ_BYTE 2
186#define PDC_NVM_WRITE_BYTE 3
187
188#define PDC_SEED_ERROR 132 /* (sprockets) */
189
190#define PDC_IO 135 /* log error info, reset IO system */
191#define PDC_IO_READ_AND_CLEAR_ERRORS 0
192#define PDC_IO_RESET 1
193#define PDC_IO_RESET_DEVICES 2
194/* sets bits 6&7 (little endian) of the HcControl Register */
195#define PDC_IO_USB_SUSPEND 0xC000000000000000
196#define PDC_IO_EEPROM_IO_ERR_TABLE_FULL -5 /* return value */
197#define PDC_IO_NO_SUSPEND -6 /* return value */
198
199#define PDC_BROADCAST_RESET 136 /* reset all processors */
200#define PDC_DO_RESET 0 /* option: perform a broadcast reset */
201#define PDC_DO_FIRM_TEST_RESET 1 /* Do broadcast reset with bitmap */
202#define PDC_BR_RECONFIGURATION 2 /* reset w/reconfiguration */
203#define PDC_FIRM_TEST_MAGIC 0xab9ec36fUL /* for this reboot only */
204
205#define PDC_LAN_STATION_ID 138 /* Hversion dependent mechanism for */
206#define PDC_LAN_STATION_ID_READ 0 /* getting the lan station address */
207
208#define PDC_LAN_STATION_ID_SIZE 6
209
210#define PDC_CHECK_RANGES 139 /* (sprockets) */
211
212#define PDC_NV_SECTIONS 141 /* (sprockets) */
213
214#define PDC_PERFORMANCE 142 /* performance monitoring */
215
216#define PDC_SYSTEM_INFO 143 /* system information */
217#define PDC_SYSINFO_RETURN_INFO_SIZE 0
218#define PDC_SYSINFO_RRETURN_SYS_INFO 1
219#define PDC_SYSINFO_RRETURN_ERRORS 2
220#define PDC_SYSINFO_RRETURN_WARNINGS 3
221#define PDC_SYSINFO_RETURN_REVISIONS 4
222#define PDC_SYSINFO_RRETURN_DIAGNOSE 5
223#define PDC_SYSINFO_RRETURN_HV_DIAGNOSE 1005
224
225#define PDC_RDR 144 /* (sprockets) */
226#define PDC_RDR_READ_BUFFER 0
227#define PDC_RDR_READ_SINGLE 1
228#define PDC_RDR_WRITE_SINGLE 2
229
230#define PDC_INTRIGUE 145 /* (sprockets) */
231#define PDC_INTRIGUE_WRITE_BUFFER 0
232#define PDC_INTRIGUE_GET_SCRATCH_BUFSIZE 1
233#define PDC_INTRIGUE_START_CPU_COUNTERS 2
234#define PDC_INTRIGUE_STOP_CPU_COUNTERS 3
235
236#define PDC_STI 146 /* STI access */
237/* same as PDC_PCI_XXX values (see below) */
238
239/* Legacy PDC definitions for same stuff */
240#define PDC_PCI_INDEX 147
241#define PDC_PCI_INTERFACE_INFO 0
242#define PDC_PCI_SLOT_INFO 1
243#define PDC_PCI_INFLIGHT_BYTES 2
244#define PDC_PCI_READ_CONFIG 3
245#define PDC_PCI_WRITE_CONFIG 4
246#define PDC_PCI_READ_PCI_IO 5
247#define PDC_PCI_WRITE_PCI_IO 6
248#define PDC_PCI_READ_CONFIG_DELAY 7
249#define PDC_PCI_UPDATE_CONFIG_DELAY 8
250#define PDC_PCI_PCI_PATH_TO_PCI_HPA 9
251#define PDC_PCI_PCI_HPA_TO_PCI_PATH 10
252#define PDC_PCI_PCI_PATH_TO_PCI_BUS 11
253#define PDC_PCI_PCI_RESERVED 12
254#define PDC_PCI_PCI_INT_ROUTE_SIZE 13
255#define PDC_PCI_GET_INT_TBL_SIZE PDC_PCI_PCI_INT_ROUTE_SIZE
256#define PDC_PCI_PCI_INT_ROUTE 14
257#define PDC_PCI_GET_INT_TBL PDC_PCI_PCI_INT_ROUTE
258#define PDC_PCI_READ_MON_TYPE 15
259#define PDC_PCI_WRITE_MON_TYPE 16
260
261
262/* Get SCSI Interface Card info: SDTR, SCSI ID, mode (SE vs LVD) */
263#define PDC_INITIATOR 163
264#define PDC_GET_INITIATOR 0
265#define PDC_SET_INITIATOR 1
266#define PDC_DELETE_INITIATOR 2
267#define PDC_RETURN_TABLE_SIZE 3
268#define PDC_RETURN_TABLE 4
269
270#define PDC_LINK 165 /* (sprockets) */
271#define PDC_LINK_PCI_ENTRY_POINTS 0 /* list (Arg1) = 0 */
272#define PDC_LINK_USB_ENTRY_POINTS 1 /* list (Arg1) = 1 */
273
274/* cl_class
275 * page 3-33 of IO-Firmware ARS
276 * IODC ENTRY_INIT(Search first) RET[1]
277 */
278#define CL_NULL 0 /* invalid */
279#define CL_RANDOM 1 /* random access (as disk) */
280#define CL_SEQU 2 /* sequential access (as tape) */
281#define CL_DUPLEX 7 /* full-duplex point-to-point (RS-232, Net) */
282#define CL_KEYBD 8 /* half-duplex console (HIL Keyboard) */
283#define CL_DISPL 9 /* half-duplex console (display) */
284#define CL_FC 10 /* FiberChannel access media */
285
286/* IODC ENTRY_INIT() */
287#define ENTRY_INIT_SRCH_FRST 2
288#define ENTRY_INIT_SRCH_NEXT 3
289#define ENTRY_INIT_MOD_DEV 4
290#define ENTRY_INIT_DEV 5
291#define ENTRY_INIT_MOD 6
292#define ENTRY_INIT_MSG 9
293
294/* IODC ENTRY_IO() */
295#define ENTRY_IO_BOOTIN 0
296#define ENTRY_IO_BOOTOUT 1
297#define ENTRY_IO_CIN 2
298#define ENTRY_IO_COUT 3
299#define ENTRY_IO_CLOSE 4
300#define ENTRY_IO_GETMSG 9
301#define ENTRY_IO_BBLOCK_IN 16
302#define ENTRY_IO_BBLOCK_OUT 17
303
304/* IODC ENTRY_SPA() */
305
306/* IODC ENTRY_CONFIG() */
307
308/* IODC ENTRY_TEST() */
309
310/* IODC ENTRY_TLB() */
311
312/* constants for OS (NVM...) */
313#define OS_ID_NONE 0 /* Undefined OS ID */
314#define OS_ID_HPUX 1 /* HP-UX OS */
315#define OS_ID_MPEXL 2 /* MPE XL OS */
316#define OS_ID_OSF 3 /* OSF OS */
317#define OS_ID_HPRT 4 /* HP-RT OS */
318#define OS_ID_NOVEL 5 /* NOVELL OS */
319#define OS_ID_LINUX 6 /* Linux */
320
321
322/* constants for PDC_CHASSIS */
323#define OSTAT_OFF 0
324#define OSTAT_FLT 1
325#define OSTAT_TEST 2
326#define OSTAT_INIT 3
327#define OSTAT_SHUT 4
328#define OSTAT_WARN 5
329#define OSTAT_RUN 6
330#define OSTAT_ON 7
331
332/* Page Zero constant offsets used by the HPMC handler */
333#define BOOT_CONSOLE_HPA_OFFSET 0x3c0
334#define BOOT_CONSOLE_SPA_OFFSET 0x3c4
335#define BOOT_CONSOLE_PATH_OFFSET 0x3a8
336
337/* size of the pdc_result buffer for firmware.c */
338#define NUM_PDC_RESULT 32
339 5
340#if !defined(__ASSEMBLY__) 6#if !defined(__ASSEMBLY__)
341 7
342#include <linux/types.h>
343
344#ifdef __KERNEL__
345
346extern int pdc_type; 8extern int pdc_type;
347 9
348/* Values for pdc_type */ 10/* Values for pdc_type */
@@ -673,88 +335,5 @@ static inline char * os_id_to_string(u16 os_id) {
673 } 335 }
674} 336}
675 337
676#endif /* __KERNEL__ */
677
678/* flags of the device_path */
679#define PF_AUTOBOOT 0x80
680#define PF_AUTOSEARCH 0x40
681#define PF_TIMER 0x0F
682
683struct device_path { /* page 1-69 */
684 unsigned char flags; /* flags see above! */
685 unsigned char bc[6]; /* bus converter routing info */
686 unsigned char mod;
687 unsigned int layers[6];/* device-specific layer-info */
688} __attribute__((aligned(8))) ;
689
690struct pz_device {
691 struct device_path dp; /* see above */
692 /* struct iomod *hpa; */
693 unsigned int hpa; /* HPA base address */
694 /* char *spa; */
695 unsigned int spa; /* SPA base address */
696 /* int (*iodc_io)(struct iomod*, ...); */
697 unsigned int iodc_io; /* device entry point */
698 short pad; /* reserved */
699 unsigned short cl_class;/* see below */
700} __attribute__((aligned(8))) ;
701
702struct zeropage {
703 /* [0x000] initialize vectors (VEC) */
704 unsigned int vec_special; /* must be zero */
705 /* int (*vec_pow_fail)(void);*/
706 unsigned int vec_pow_fail; /* power failure handler */
707 /* int (*vec_toc)(void); */
708 unsigned int vec_toc;
709 unsigned int vec_toclen;
710 /* int (*vec_rendz)(void); */
711 unsigned int vec_rendz;
712 int vec_pow_fail_flen;
713 int vec_pad[10];
714
715 /* [0x040] reserved processor dependent */
716 int pad0[112];
717
718 /* [0x200] reserved */
719 int pad1[84];
720
721 /* [0x350] memory configuration (MC) */
722 int memc_cont; /* contiguous mem size (bytes) */
723 int memc_phsize; /* physical memory size */
724 int memc_adsize; /* additional mem size, bytes of SPA space used by PDC */
725 unsigned int mem_pdc_hi; /* used for 64-bit */
726
727 /* [0x360] various parameters for the boot-CPU */
728 /* unsigned int *mem_booterr[8]; */
729 unsigned int mem_booterr[8]; /* ptr to boot errors */
730 unsigned int mem_free; /* first location, where OS can be loaded */
731 /* struct iomod *mem_hpa; */
732 unsigned int mem_hpa; /* HPA of the boot-CPU */
733 /* int (*mem_pdc)(int, ...); */
734 unsigned int mem_pdc; /* PDC entry point */
735 unsigned int mem_10msec; /* number of clock ticks in 10msec */
736
737 /* [0x390] initial memory module (IMM) */
738 /* struct iomod *imm_hpa; */
739 unsigned int imm_hpa; /* HPA of the IMM */
740 int imm_soft_boot; /* 0 = was hard boot, 1 = was soft boot */
741 unsigned int imm_spa_size; /* SPA size of the IMM in bytes */
742 unsigned int imm_max_mem; /* bytes of mem in IMM */
743
744 /* [0x3A0] boot console, display device and keyboard */
745 struct pz_device mem_cons; /* description of console device */
746 struct pz_device mem_boot; /* description of boot device */
747 struct pz_device mem_kbd; /* description of keyboard device */
748
749 /* [0x430] reserved */
750 int pad430[116];
751
752 /* [0x600] processor dependent */
753 __u32 pad600[1];
754 __u32 proc_sti; /* pointer to STI ROM */
755 __u32 pad608[126];
756};
757
758#endif /* !defined(__ASSEMBLY__) */ 338#endif /* !defined(__ASSEMBLY__) */
759
760#endif /* _PARISC_PDC_H */ 339#endif /* _PARISC_PDC_H */
diff --git a/arch/parisc/include/asm/percpu.h b/arch/parisc/include/asm/percpu.h
deleted file mode 100644
index a0dcd1970128..000000000000
--- a/arch/parisc/include/asm/percpu.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _PARISC_PERCPU_H
2#define _PARISC_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif
7
diff --git a/arch/parisc/include/asm/poll.h b/arch/parisc/include/asm/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/arch/parisc/include/asm/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/arch/parisc/include/asm/ptrace.h b/arch/parisc/include/asm/ptrace.h
index 250ae35aa062..a2db278a5def 100644
--- a/arch/parisc/include/asm/ptrace.h
+++ b/arch/parisc/include/asm/ptrace.h
@@ -1,49 +1,11 @@
1#ifndef _PARISC_PTRACE_H
2#define _PARISC_PTRACE_H
3
4/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg 1/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg
5** Copyright (C) 2000 Grant Grundler, Hewlett-Packard 2** Copyright (C) 2000 Grant Grundler, Hewlett-Packard
6*/ 3*/
4#ifndef _PARISC_PTRACE_H
5#define _PARISC_PTRACE_H
7 6
8#include <linux/types.h> 7#include <uapi/asm/ptrace.h>
9
10/* This struct defines the way the registers are stored on the
11 * stack during a system call.
12 *
13 * N.B. gdb/strace care about the size and offsets within this
14 * structure. If you change things, you may break object compatibility
15 * for those applications.
16 */
17
18struct pt_regs {
19 unsigned long gr[32]; /* PSW is in gr[0] */
20 __u64 fr[32];
21 unsigned long sr[ 8];
22 unsigned long iasq[2];
23 unsigned long iaoq[2];
24 unsigned long cr27;
25 unsigned long pad0; /* available for other uses */
26 unsigned long orig_r28;
27 unsigned long ksp;
28 unsigned long kpc;
29 unsigned long sar; /* CR11 */
30 unsigned long iir; /* CR19 */
31 unsigned long isr; /* CR20 */
32 unsigned long ior; /* CR21 */
33 unsigned long ipsw; /* CR22 */
34};
35
36/*
37 * The numbers chosen here are somewhat arbitrary but absolutely MUST
38 * not overlap with any of the number assigned in <linux/ptrace.h>.
39 *
40 * These ones are taken from IA-64 on the assumption that theirs are
41 * the most correct (and we also want to support PTRACE_SINGLEBLOCK
42 * since we have taken branch traps too)
43 */
44#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
45 8
46#ifdef __KERNEL__
47 9
48#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS)) 10#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS))
49 11
@@ -58,6 +20,4 @@ struct pt_regs {
58unsigned long profile_pc(struct pt_regs *); 20unsigned long profile_pc(struct pt_regs *);
59 21
60 22
61#endif /* __KERNEL__ */
62
63#endif 23#endif
diff --git a/arch/parisc/include/asm/real.h b/arch/parisc/include/asm/real.h
deleted file mode 100644
index 82acb25db395..000000000000
--- a/arch/parisc/include/asm/real.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifndef _PARISC_REAL_H
2#define _PARISC_REAL_H
3
4
5#endif
diff --git a/arch/parisc/include/asm/segment.h b/arch/parisc/include/asm/segment.h
deleted file mode 100644
index 26794ddb6524..000000000000
--- a/arch/parisc/include/asm/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PARISC_SEGMENT_H
2#define __PARISC_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif
diff --git a/arch/parisc/include/asm/signal.h b/arch/parisc/include/asm/signal.h
index c20356375d1d..21abf4fc169a 100644
--- a/arch/parisc/include/asm/signal.h
+++ b/arch/parisc/include/asm/signal.h
@@ -1,129 +1,19 @@
1#ifndef _ASM_PARISC_SIGNAL_H 1#ifndef _ASM_PARISC_SIGNAL_H
2#define _ASM_PARISC_SIGNAL_H 2#define _ASM_PARISC_SIGNAL_H
3 3
4#define SIGHUP 1 4#include <uapi/asm/signal.h>
5#define SIGINT 2
6#define SIGQUIT 3
7#define SIGILL 4
8#define SIGTRAP 5
9#define SIGABRT 6
10#define SIGIOT 6
11#define SIGEMT 7
12#define SIGFPE 8
13#define SIGKILL 9
14#define SIGBUS 10
15#define SIGSEGV 11
16#define SIGSYS 12 /* Linux doesn't use this */
17#define SIGPIPE 13
18#define SIGALRM 14
19#define SIGTERM 15
20#define SIGUSR1 16
21#define SIGUSR2 17
22#define SIGCHLD 18
23#define SIGPWR 19
24#define SIGVTALRM 20
25#define SIGPROF 21
26#define SIGIO 22
27#define SIGPOLL SIGIO
28#define SIGWINCH 23
29#define SIGSTOP 24
30#define SIGTSTP 25
31#define SIGCONT 26
32#define SIGTTIN 27
33#define SIGTTOU 28
34#define SIGURG 29
35#define SIGLOST 30 /* Linux doesn't use this either */
36#define SIGUNUSED 31
37#define SIGRESERVE SIGUNUSED
38 5
39#define SIGXCPU 33
40#define SIGXFSZ 34
41#define SIGSTKFLT 36
42
43/* These should not be considered constants from userland. */
44#define SIGRTMIN 37
45#define SIGRTMAX _NSIG /* it's 44 under HP/UX */
46
47/*
48 * SA_FLAGS values:
49 *
50 * SA_ONSTACK indicates that a registered stack_t will be used.
51 * SA_RESTART flag to get restarting signals (which were the default long ago)
52 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
53 * SA_RESETHAND clears the handler when the signal is delivered.
54 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
55 * SA_NODEFER prevents the current signal from being masked in the handler.
56 *
57 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
58 * Unix names RESETHAND and NODEFER respectively.
59 */
60#define SA_ONSTACK 0x00000001
61#define SA_RESETHAND 0x00000004
62#define SA_NOCLDSTOP 0x00000008
63#define SA_SIGINFO 0x00000010
64#define SA_NODEFER 0x00000020
65#define SA_RESTART 0x00000040
66#define SA_NOCLDWAIT 0x00000080
67#define _SA_SIGGFAULT 0x00000100 /* HPUX */
68
69#define SA_NOMASK SA_NODEFER
70#define SA_ONESHOT SA_RESETHAND
71
72#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
73
74/*
75 * sigaltstack controls
76 */
77#define SS_ONSTACK 1
78#define SS_DISABLE 2
79
80#define MINSIGSTKSZ 2048
81#define SIGSTKSZ 8192
82
83#ifdef __KERNEL__
84 6
85#define _NSIG 64 7#define _NSIG 64
86/* bits-per-word, where word apparently means 'long' not 'int' */ 8/* bits-per-word, where word apparently means 'long' not 'int' */
87#define _NSIG_BPW BITS_PER_LONG 9#define _NSIG_BPW BITS_PER_LONG
88#define _NSIG_WORDS (_NSIG / _NSIG_BPW) 10#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
89 11
90#endif /* __KERNEL__ */
91
92#define SIG_BLOCK 0 /* for blocking signals */
93#define SIG_UNBLOCK 1 /* for unblocking signals */
94#define SIG_SETMASK 2 /* for setting the signal mask */
95
96#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
97#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
98#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
99
100# ifndef __ASSEMBLY__ 12# ifndef __ASSEMBLY__
101
102# include <linux/types.h>
103
104/* Avoid too many header ordering problems. */
105struct siginfo;
106
107/* Type of a signal handler. */
108#ifdef CONFIG_64BIT 13#ifdef CONFIG_64BIT
109/* function pointers on 64-bit parisc are pointers to little structs and the
110 * compiler doesn't support code which changes or tests the address of
111 * the function in the little struct. This is really ugly -PB
112 */
113typedef char __user *__sighandler_t;
114#else 14#else
115typedef void __signalfn_t(int);
116typedef __signalfn_t __user *__sighandler_t;
117#endif 15#endif
118 16
119typedef struct sigaltstack {
120 void __user *ss_sp;
121 int ss_flags;
122 size_t ss_size;
123} stack_t;
124
125#ifdef __KERNEL__
126
127/* Most things should be clean enough to redefine this at will, if care 17/* Most things should be clean enough to redefine this at will, if care
128 is taken to make libc match. */ 18 is taken to make libc match. */
129 19
@@ -148,6 +38,5 @@ struct k_sigaction {
148 38
149#include <asm/sigcontext.h> 39#include <asm/sigcontext.h>
150 40
151#endif /* __KERNEL__ */
152#endif /* !__ASSEMBLY */ 41#endif /* !__ASSEMBLY */
153#endif /* _ASM_PARISC_SIGNAL_H */ 42#endif /* _ASM_PARISC_SIGNAL_H */
diff --git a/arch/parisc/include/asm/termios.h b/arch/parisc/include/asm/termios.h
index a2a57a4548af..9bbc0c8974ea 100644
--- a/arch/parisc/include/asm/termios.h
+++ b/arch/parisc/include/asm/termios.h
@@ -1,45 +1,8 @@
1#ifndef _PARISC_TERMIOS_H 1#ifndef _PARISC_TERMIOS_H
2#define _PARISC_TERMIOS_H 2#define _PARISC_TERMIOS_H
3 3
4#include <asm/termbits.h> 4#include <uapi/asm/termios.h>
5#include <asm/ioctls.h>
6 5
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42#ifdef __KERNEL__
43 6
44/* intr=^C quit=^\ erase=del kill=^U 7/* intr=^C quit=^\ erase=del kill=^U
45 eof=^D vtime=\0 vmin=\1 sxtc=\0 8 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -85,6 +48,4 @@ struct termio {
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) 48#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) 49#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87 50
88#endif /* __KERNEL__ */
89
90#endif /* _PARISC_TERMIOS_H */ 51#endif /* _PARISC_TERMIOS_H */
diff --git a/arch/parisc/include/asm/topology.h b/arch/parisc/include/asm/topology.h
deleted file mode 100644
index d8133eb0b1e7..000000000000
--- a/arch/parisc/include/asm/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_PARISC_TOPOLOGY_H
2#define _ASM_PARISC_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_PARISC_TOPOLOGY_H */
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index d61de64f990a..541639c3f607 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -1,840 +1,8 @@
1#ifndef _ASM_PARISC_UNISTD_H_ 1#ifndef _ASM_PARISC_UNISTD_H_
2#define _ASM_PARISC_UNISTD_H_ 2#define _ASM_PARISC_UNISTD_H_
3 3
4/* 4#include <uapi/asm/unistd.h>
5 * This file contains the system call numbers.
6 */
7
8/*
9 * HP-UX system calls get their native numbers for binary compatibility.
10 */
11
12#define __NR_HPUX_exit 1
13#define __NR_HPUX_fork 2
14#define __NR_HPUX_read 3
15#define __NR_HPUX_write 4
16#define __NR_HPUX_open 5
17#define __NR_HPUX_close 6
18#define __NR_HPUX_wait 7
19#define __NR_HPUX_creat 8
20#define __NR_HPUX_link 9
21#define __NR_HPUX_unlink 10
22#define __NR_HPUX_execv 11
23#define __NR_HPUX_chdir 12
24#define __NR_HPUX_time 13
25#define __NR_HPUX_mknod 14
26#define __NR_HPUX_chmod 15
27#define __NR_HPUX_chown 16
28#define __NR_HPUX_break 17
29#define __NR_HPUX_lchmod 18
30#define __NR_HPUX_lseek 19
31#define __NR_HPUX_getpid 20
32#define __NR_HPUX_mount 21
33#define __NR_HPUX_umount 22
34#define __NR_HPUX_setuid 23
35#define __NR_HPUX_getuid 24
36#define __NR_HPUX_stime 25
37#define __NR_HPUX_ptrace 26
38#define __NR_HPUX_alarm 27
39#define __NR_HPUX_oldfstat 28
40#define __NR_HPUX_pause 29
41#define __NR_HPUX_utime 30
42#define __NR_HPUX_stty 31
43#define __NR_HPUX_gtty 32
44#define __NR_HPUX_access 33
45#define __NR_HPUX_nice 34
46#define __NR_HPUX_ftime 35
47#define __NR_HPUX_sync 36
48#define __NR_HPUX_kill 37
49#define __NR_HPUX_stat 38
50#define __NR_HPUX_setpgrp3 39
51#define __NR_HPUX_lstat 40
52#define __NR_HPUX_dup 41
53#define __NR_HPUX_pipe 42
54#define __NR_HPUX_times 43
55#define __NR_HPUX_profil 44
56#define __NR_HPUX_ki_call 45
57#define __NR_HPUX_setgid 46
58#define __NR_HPUX_getgid 47
59#define __NR_HPUX_sigsys 48
60#define __NR_HPUX_reserved1 49
61#define __NR_HPUX_reserved2 50
62#define __NR_HPUX_acct 51
63#define __NR_HPUX_set_userthreadid 52
64#define __NR_HPUX_oldlock 53
65#define __NR_HPUX_ioctl 54
66#define __NR_HPUX_reboot 55
67#define __NR_HPUX_symlink 56
68#define __NR_HPUX_utssys 57
69#define __NR_HPUX_readlink 58
70#define __NR_HPUX_execve 59
71#define __NR_HPUX_umask 60
72#define __NR_HPUX_chroot 61
73#define __NR_HPUX_fcntl 62
74#define __NR_HPUX_ulimit 63
75#define __NR_HPUX_getpagesize 64
76#define __NR_HPUX_mremap 65
77#define __NR_HPUX_vfork 66
78#define __NR_HPUX_vread 67
79#define __NR_HPUX_vwrite 68
80#define __NR_HPUX_sbrk 69
81#define __NR_HPUX_sstk 70
82#define __NR_HPUX_mmap 71
83#define __NR_HPUX_vadvise 72
84#define __NR_HPUX_munmap 73
85#define __NR_HPUX_mprotect 74
86#define __NR_HPUX_madvise 75
87#define __NR_HPUX_vhangup 76
88#define __NR_HPUX_swapoff 77
89#define __NR_HPUX_mincore 78
90#define __NR_HPUX_getgroups 79
91#define __NR_HPUX_setgroups 80
92#define __NR_HPUX_getpgrp2 81
93#define __NR_HPUX_setpgrp2 82
94#define __NR_HPUX_setitimer 83
95#define __NR_HPUX_wait3 84
96#define __NR_HPUX_swapon 85
97#define __NR_HPUX_getitimer 86
98#define __NR_HPUX_gethostname42 87
99#define __NR_HPUX_sethostname42 88
100#define __NR_HPUX_getdtablesize 89
101#define __NR_HPUX_dup2 90
102#define __NR_HPUX_getdopt 91
103#define __NR_HPUX_fstat 92
104#define __NR_HPUX_select 93
105#define __NR_HPUX_setdopt 94
106#define __NR_HPUX_fsync 95
107#define __NR_HPUX_setpriority 96
108#define __NR_HPUX_socket_old 97
109#define __NR_HPUX_connect_old 98
110#define __NR_HPUX_accept_old 99
111#define __NR_HPUX_getpriority 100
112#define __NR_HPUX_send_old 101
113#define __NR_HPUX_recv_old 102
114#define __NR_HPUX_socketaddr_old 103
115#define __NR_HPUX_bind_old 104
116#define __NR_HPUX_setsockopt_old 105
117#define __NR_HPUX_listen_old 106
118#define __NR_HPUX_vtimes_old 107
119#define __NR_HPUX_sigvector 108
120#define __NR_HPUX_sigblock 109
121#define __NR_HPUX_siggetmask 110
122#define __NR_HPUX_sigpause 111
123#define __NR_HPUX_sigstack 112
124#define __NR_HPUX_recvmsg_old 113
125#define __NR_HPUX_sendmsg_old 114
126#define __NR_HPUX_vtrace_old 115
127#define __NR_HPUX_gettimeofday 116
128#define __NR_HPUX_getrusage 117
129#define __NR_HPUX_getsockopt_old 118
130#define __NR_HPUX_resuba_old 119
131#define __NR_HPUX_readv 120
132#define __NR_HPUX_writev 121
133#define __NR_HPUX_settimeofday 122
134#define __NR_HPUX_fchown 123
135#define __NR_HPUX_fchmod 124
136#define __NR_HPUX_recvfrom_old 125
137#define __NR_HPUX_setresuid 126
138#define __NR_HPUX_setresgid 127
139#define __NR_HPUX_rename 128
140#define __NR_HPUX_truncate 129
141#define __NR_HPUX_ftruncate 130
142#define __NR_HPUX_flock_old 131
143#define __NR_HPUX_sysconf 132
144#define __NR_HPUX_sendto_old 133
145#define __NR_HPUX_shutdown_old 134
146#define __NR_HPUX_socketpair_old 135
147#define __NR_HPUX_mkdir 136
148#define __NR_HPUX_rmdir 137
149#define __NR_HPUX_utimes_old 138
150#define __NR_HPUX_sigcleanup_old 139
151#define __NR_HPUX_setcore 140
152#define __NR_HPUX_getpeername_old 141
153#define __NR_HPUX_gethostid 142
154#define __NR_HPUX_sethostid 143
155#define __NR_HPUX_getrlimit 144
156#define __NR_HPUX_setrlimit 145
157#define __NR_HPUX_killpg_old 146
158#define __NR_HPUX_cachectl 147
159#define __NR_HPUX_quotactl 148
160#define __NR_HPUX_get_sysinfo 149
161#define __NR_HPUX_getsockname_old 150
162#define __NR_HPUX_privgrp 151
163#define __NR_HPUX_rtprio 152
164#define __NR_HPUX_plock 153
165#define __NR_HPUX_reserved3 154
166#define __NR_HPUX_lockf 155
167#define __NR_HPUX_semget 156
168#define __NR_HPUX_osemctl 157
169#define __NR_HPUX_semop 158
170#define __NR_HPUX_msgget 159
171#define __NR_HPUX_omsgctl 160
172#define __NR_HPUX_msgsnd 161
173#define __NR_HPUX_msgrecv 162
174#define __NR_HPUX_shmget 163
175#define __NR_HPUX_oshmctl 164
176#define __NR_HPUX_shmat 165
177#define __NR_HPUX_shmdt 166
178#define __NR_HPUX_m68020_advise 167
179/* [168,189] are for Discless/DUX */
180#define __NR_HPUX_csp 168
181#define __NR_HPUX_cluster 169
182#define __NR_HPUX_mkrnod 170
183#define __NR_HPUX_test 171
184#define __NR_HPUX_unsp_open 172
185#define __NR_HPUX_reserved4 173
186#define __NR_HPUX_getcontext_old 174
187#define __NR_HPUX_osetcontext 175
188#define __NR_HPUX_bigio 176
189#define __NR_HPUX_pipenode 177
190#define __NR_HPUX_lsync 178
191#define __NR_HPUX_getmachineid 179
192#define __NR_HPUX_cnodeid 180
193#define __NR_HPUX_cnodes 181
194#define __NR_HPUX_swapclients 182
195#define __NR_HPUX_rmt_process 183
196#define __NR_HPUX_dskless_stats 184
197#define __NR_HPUX_sigprocmask 185
198#define __NR_HPUX_sigpending 186
199#define __NR_HPUX_sigsuspend 187
200#define __NR_HPUX_sigaction 188
201#define __NR_HPUX_reserved5 189
202#define __NR_HPUX_nfssvc 190
203#define __NR_HPUX_getfh 191
204#define __NR_HPUX_getdomainname 192
205#define __NR_HPUX_setdomainname 193
206#define __NR_HPUX_async_daemon 194
207#define __NR_HPUX_getdirentries 195
208#define __NR_HPUX_statfs 196
209#define __NR_HPUX_fstatfs 197
210#define __NR_HPUX_vfsmount 198
211#define __NR_HPUX_reserved6 199
212#define __NR_HPUX_waitpid 200
213/* 201 - 223 missing */
214#define __NR_HPUX_sigsetreturn 224
215#define __NR_HPUX_sigsetstatemask 225
216/* 226 missing */
217#define __NR_HPUX_cs 227
218#define __NR_HPUX_cds 228
219#define __NR_HPUX_set_no_trunc 229
220#define __NR_HPUX_pathconf 230
221#define __NR_HPUX_fpathconf 231
222/* 232, 233 missing */
223#define __NR_HPUX_nfs_fcntl 234
224#define __NR_HPUX_ogetacl 235
225#define __NR_HPUX_ofgetacl 236
226#define __NR_HPUX_osetacl 237
227#define __NR_HPUX_ofsetacl 238
228#define __NR_HPUX_pstat 239
229#define __NR_HPUX_getaudid 240
230#define __NR_HPUX_setaudid 241
231#define __NR_HPUX_getaudproc 242
232#define __NR_HPUX_setaudproc 243
233#define __NR_HPUX_getevent 244
234#define __NR_HPUX_setevent 245
235#define __NR_HPUX_audwrite 246
236#define __NR_HPUX_audswitch 247
237#define __NR_HPUX_audctl 248
238#define __NR_HPUX_ogetaccess 249
239#define __NR_HPUX_fsctl 250
240/* 251 - 258 missing */
241#define __NR_HPUX_swapfs 259
242#define __NR_HPUX_fss 260
243/* 261 - 266 missing */
244#define __NR_HPUX_tsync 267
245#define __NR_HPUX_getnumfds 268
246#define __NR_HPUX_poll 269
247#define __NR_HPUX_getmsg 270
248#define __NR_HPUX_putmsg 271
249#define __NR_HPUX_fchdir 272
250#define __NR_HPUX_getmount_cnt 273
251#define __NR_HPUX_getmount_entry 274
252#define __NR_HPUX_accept 275
253#define __NR_HPUX_bind 276
254#define __NR_HPUX_connect 277
255#define __NR_HPUX_getpeername 278
256#define __NR_HPUX_getsockname 279
257#define __NR_HPUX_getsockopt 280
258#define __NR_HPUX_listen 281
259#define __NR_HPUX_recv 282
260#define __NR_HPUX_recvfrom 283
261#define __NR_HPUX_recvmsg 284
262#define __NR_HPUX_send 285
263#define __NR_HPUX_sendmsg 286
264#define __NR_HPUX_sendto 287
265#define __NR_HPUX_setsockopt 288
266#define __NR_HPUX_shutdown 289
267#define __NR_HPUX_socket 290
268#define __NR_HPUX_socketpair 291
269#define __NR_HPUX_proc_open 292
270#define __NR_HPUX_proc_close 293
271#define __NR_HPUX_proc_send 294
272#define __NR_HPUX_proc_recv 295
273#define __NR_HPUX_proc_sendrecv 296
274#define __NR_HPUX_proc_syscall 297
275/* 298 - 311 missing */
276#define __NR_HPUX_semctl 312
277#define __NR_HPUX_msgctl 313
278#define __NR_HPUX_shmctl 314
279#define __NR_HPUX_mpctl 315
280#define __NR_HPUX_exportfs 316
281#define __NR_HPUX_getpmsg 317
282#define __NR_HPUX_putpmsg 318
283/* 319 missing */
284#define __NR_HPUX_msync 320
285#define __NR_HPUX_msleep 321
286#define __NR_HPUX_mwakeup 322
287#define __NR_HPUX_msem_init 323
288#define __NR_HPUX_msem_remove 324
289#define __NR_HPUX_adjtime 325
290#define __NR_HPUX_kload 326
291#define __NR_HPUX_fattach 327
292#define __NR_HPUX_fdetach 328
293#define __NR_HPUX_serialize 329
294#define __NR_HPUX_statvfs 330
295#define __NR_HPUX_fstatvfs 331
296#define __NR_HPUX_lchown 332
297#define __NR_HPUX_getsid 333
298#define __NR_HPUX_sysfs 334
299/* 335, 336 missing */
300#define __NR_HPUX_sched_setparam 337
301#define __NR_HPUX_sched_getparam 338
302#define __NR_HPUX_sched_setscheduler 339
303#define __NR_HPUX_sched_getscheduler 340
304#define __NR_HPUX_sched_yield 341
305#define __NR_HPUX_sched_get_priority_max 342
306#define __NR_HPUX_sched_get_priority_min 343
307#define __NR_HPUX_sched_rr_get_interval 344
308#define __NR_HPUX_clock_settime 345
309#define __NR_HPUX_clock_gettime 346
310#define __NR_HPUX_clock_getres 347
311#define __NR_HPUX_timer_create 348
312#define __NR_HPUX_timer_delete 349
313#define __NR_HPUX_timer_settime 350
314#define __NR_HPUX_timer_gettime 351
315#define __NR_HPUX_timer_getoverrun 352
316#define __NR_HPUX_nanosleep 353
317#define __NR_HPUX_toolbox 354
318/* 355 missing */
319#define __NR_HPUX_getdents 356
320#define __NR_HPUX_getcontext 357
321#define __NR_HPUX_sysinfo 358
322#define __NR_HPUX_fcntl64 359
323#define __NR_HPUX_ftruncate64 360
324#define __NR_HPUX_fstat64 361
325#define __NR_HPUX_getdirentries64 362
326#define __NR_HPUX_getrlimit64 363
327#define __NR_HPUX_lockf64 364
328#define __NR_HPUX_lseek64 365
329#define __NR_HPUX_lstat64 366
330#define __NR_HPUX_mmap64 367
331#define __NR_HPUX_setrlimit64 368
332#define __NR_HPUX_stat64 369
333#define __NR_HPUX_truncate64 370
334#define __NR_HPUX_ulimit64 371
335#define __NR_HPUX_pread 372
336#define __NR_HPUX_preadv 373
337#define __NR_HPUX_pwrite 374
338#define __NR_HPUX_pwritev 375
339#define __NR_HPUX_pread64 376
340#define __NR_HPUX_preadv64 377
341#define __NR_HPUX_pwrite64 378
342#define __NR_HPUX_pwritev64 379
343#define __NR_HPUX_setcontext 380
344#define __NR_HPUX_sigaltstack 381
345#define __NR_HPUX_waitid 382
346#define __NR_HPUX_setpgrp 383
347#define __NR_HPUX_recvmsg2 384
348#define __NR_HPUX_sendmsg2 385
349#define __NR_HPUX_socket2 386
350#define __NR_HPUX_socketpair2 387
351#define __NR_HPUX_setregid 388
352#define __NR_HPUX_lwp_create 389
353#define __NR_HPUX_lwp_terminate 390
354#define __NR_HPUX_lwp_wait 391
355#define __NR_HPUX_lwp_suspend 392
356#define __NR_HPUX_lwp_resume 393
357/* 394 missing */
358#define __NR_HPUX_lwp_abort_syscall 395
359#define __NR_HPUX_lwp_info 396
360#define __NR_HPUX_lwp_kill 397
361#define __NR_HPUX_ksleep 398
362#define __NR_HPUX_kwakeup 399
363/* 400 missing */
364#define __NR_HPUX_pstat_getlwp 401
365#define __NR_HPUX_lwp_exit 402
366#define __NR_HPUX_lwp_continue 403
367#define __NR_HPUX_getacl 404
368#define __NR_HPUX_fgetacl 405
369#define __NR_HPUX_setacl 406
370#define __NR_HPUX_fsetacl 407
371#define __NR_HPUX_getaccess 408
372#define __NR_HPUX_lwp_mutex_init 409
373#define __NR_HPUX_lwp_mutex_lock_sys 410
374#define __NR_HPUX_lwp_mutex_unlock 411
375#define __NR_HPUX_lwp_cond_init 412
376#define __NR_HPUX_lwp_cond_signal 413
377#define __NR_HPUX_lwp_cond_broadcast 414
378#define __NR_HPUX_lwp_cond_wait_sys 415
379#define __NR_HPUX_lwp_getscheduler 416
380#define __NR_HPUX_lwp_setscheduler 417
381#define __NR_HPUX_lwp_getstate 418
382#define __NR_HPUX_lwp_setstate 419
383#define __NR_HPUX_lwp_detach 420
384#define __NR_HPUX_mlock 421
385#define __NR_HPUX_munlock 422
386#define __NR_HPUX_mlockall 423
387#define __NR_HPUX_munlockall 424
388#define __NR_HPUX_shm_open 425
389#define __NR_HPUX_shm_unlink 426
390#define __NR_HPUX_sigqueue 427
391#define __NR_HPUX_sigwaitinfo 428
392#define __NR_HPUX_sigtimedwait 429
393#define __NR_HPUX_sigwait 430
394#define __NR_HPUX_aio_read 431
395#define __NR_HPUX_aio_write 432
396#define __NR_HPUX_lio_listio 433
397#define __NR_HPUX_aio_error 434
398#define __NR_HPUX_aio_return 435
399#define __NR_HPUX_aio_cancel 436
400#define __NR_HPUX_aio_suspend 437
401#define __NR_HPUX_aio_fsync 438
402#define __NR_HPUX_mq_open 439
403#define __NR_HPUX_mq_close 440
404#define __NR_HPUX_mq_unlink 441
405#define __NR_HPUX_mq_send 442
406#define __NR_HPUX_mq_receive 443
407#define __NR_HPUX_mq_notify 444
408#define __NR_HPUX_mq_setattr 445
409#define __NR_HPUX_mq_getattr 446
410#define __NR_HPUX_ksem_open 447
411#define __NR_HPUX_ksem_unlink 448
412#define __NR_HPUX_ksem_close 449
413#define __NR_HPUX_ksem_post 450
414#define __NR_HPUX_ksem_wait 451
415#define __NR_HPUX_ksem_read 452
416#define __NR_HPUX_ksem_trywait 453
417#define __NR_HPUX_lwp_rwlock_init 454
418#define __NR_HPUX_lwp_rwlock_destroy 455
419#define __NR_HPUX_lwp_rwlock_rdlock_sys 456
420#define __NR_HPUX_lwp_rwlock_wrlock_sys 457
421#define __NR_HPUX_lwp_rwlock_tryrdlock 458
422#define __NR_HPUX_lwp_rwlock_trywrlock 459
423#define __NR_HPUX_lwp_rwlock_unlock 460
424#define __NR_HPUX_ttrace 461
425#define __NR_HPUX_ttrace_wait 462
426#define __NR_HPUX_lf_wire_mem 463
427#define __NR_HPUX_lf_unwire_mem 464
428#define __NR_HPUX_lf_send_pin_map 465
429#define __NR_HPUX_lf_free_buf 466
430#define __NR_HPUX_lf_wait_nq 467
431#define __NR_HPUX_lf_wakeup_conn_q 468
432#define __NR_HPUX_lf_unused 469
433#define __NR_HPUX_lwp_sema_init 470
434#define __NR_HPUX_lwp_sema_post 471
435#define __NR_HPUX_lwp_sema_wait 472
436#define __NR_HPUX_lwp_sema_trywait 473
437#define __NR_HPUX_lwp_sema_destroy 474
438#define __NR_HPUX_statvfs64 475
439#define __NR_HPUX_fstatvfs64 476
440#define __NR_HPUX_msh_register 477
441#define __NR_HPUX_ptrace64 478
442#define __NR_HPUX_sendfile 479
443#define __NR_HPUX_sendpath 480
444#define __NR_HPUX_sendfile64 481
445#define __NR_HPUX_sendpath64 482
446#define __NR_HPUX_modload 483
447#define __NR_HPUX_moduload 484
448#define __NR_HPUX_modpath 485
449#define __NR_HPUX_getksym 486
450#define __NR_HPUX_modadm 487
451#define __NR_HPUX_modstat 488
452#define __NR_HPUX_lwp_detached_exit 489
453#define __NR_HPUX_crashconf 490
454#define __NR_HPUX_siginhibit 491
455#define __NR_HPUX_sigenable 492
456#define __NR_HPUX_spuctl 493
457#define __NR_HPUX_zerokernelsum 494
458#define __NR_HPUX_nfs_kstat 495
459#define __NR_HPUX_aio_read64 496
460#define __NR_HPUX_aio_write64 497
461#define __NR_HPUX_aio_error64 498
462#define __NR_HPUX_aio_return64 499
463#define __NR_HPUX_aio_cancel64 500
464#define __NR_HPUX_aio_suspend64 501
465#define __NR_HPUX_aio_fsync64 502
466#define __NR_HPUX_lio_listio64 503
467#define __NR_HPUX_recv2 504
468#define __NR_HPUX_recvfrom2 505
469#define __NR_HPUX_send2 506
470#define __NR_HPUX_sendto2 507
471#define __NR_HPUX_acl 508
472#define __NR_HPUX___cnx_p2p_ctl 509
473#define __NR_HPUX___cnx_gsched_ctl 510
474#define __NR_HPUX___cnx_pmon_ctl 511
475
476#define __NR_HPUX_syscalls 512
477
478/*
479 * Linux system call numbers.
480 *
481 * Cary Coutant says that we should just use another syscall gateway
482 * page to avoid clashing with the HPUX space, and I think he's right:
483 * it will would keep a branch out of our syscall entry path, at the
484 * very least. If we decide to change it later, we can ``just'' tweak
485 * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be
486 * 1024 or something. Oh, and recompile libc. =)
487 *
488 * 64-bit HPUX binaries get the syscall gateway address passed in a register
489 * from the kernel at startup, which seems a sane strategy.
490 */
491
492#define __NR_Linux 0
493#define __NR_restart_syscall (__NR_Linux + 0)
494#define __NR_exit (__NR_Linux + 1)
495#define __NR_fork (__NR_Linux + 2)
496#define __NR_read (__NR_Linux + 3)
497#define __NR_write (__NR_Linux + 4)
498#define __NR_open (__NR_Linux + 5)
499#define __NR_close (__NR_Linux + 6)
500#define __NR_waitpid (__NR_Linux + 7)
501#define __NR_creat (__NR_Linux + 8)
502#define __NR_link (__NR_Linux + 9)
503#define __NR_unlink (__NR_Linux + 10)
504#define __NR_execve (__NR_Linux + 11)
505#define __NR_chdir (__NR_Linux + 12)
506#define __NR_time (__NR_Linux + 13)
507#define __NR_mknod (__NR_Linux + 14)
508#define __NR_chmod (__NR_Linux + 15)
509#define __NR_lchown (__NR_Linux + 16)
510#define __NR_socket (__NR_Linux + 17)
511#define __NR_stat (__NR_Linux + 18)
512#define __NR_lseek (__NR_Linux + 19)
513#define __NR_getpid (__NR_Linux + 20)
514#define __NR_mount (__NR_Linux + 21)
515#define __NR_bind (__NR_Linux + 22)
516#define __NR_setuid (__NR_Linux + 23)
517#define __NR_getuid (__NR_Linux + 24)
518#define __NR_stime (__NR_Linux + 25)
519#define __NR_ptrace (__NR_Linux + 26)
520#define __NR_alarm (__NR_Linux + 27)
521#define __NR_fstat (__NR_Linux + 28)
522#define __NR_pause (__NR_Linux + 29)
523#define __NR_utime (__NR_Linux + 30)
524#define __NR_connect (__NR_Linux + 31)
525#define __NR_listen (__NR_Linux + 32)
526#define __NR_access (__NR_Linux + 33)
527#define __NR_nice (__NR_Linux + 34)
528#define __NR_accept (__NR_Linux + 35)
529#define __NR_sync (__NR_Linux + 36)
530#define __NR_kill (__NR_Linux + 37)
531#define __NR_rename (__NR_Linux + 38)
532#define __NR_mkdir (__NR_Linux + 39)
533#define __NR_rmdir (__NR_Linux + 40)
534#define __NR_dup (__NR_Linux + 41)
535#define __NR_pipe (__NR_Linux + 42)
536#define __NR_times (__NR_Linux + 43)
537#define __NR_getsockname (__NR_Linux + 44)
538#define __NR_brk (__NR_Linux + 45)
539#define __NR_setgid (__NR_Linux + 46)
540#define __NR_getgid (__NR_Linux + 47)
541#define __NR_signal (__NR_Linux + 48)
542#define __NR_geteuid (__NR_Linux + 49)
543#define __NR_getegid (__NR_Linux + 50)
544#define __NR_acct (__NR_Linux + 51)
545#define __NR_umount2 (__NR_Linux + 52)
546#define __NR_getpeername (__NR_Linux + 53)
547#define __NR_ioctl (__NR_Linux + 54)
548#define __NR_fcntl (__NR_Linux + 55)
549#define __NR_socketpair (__NR_Linux + 56)
550#define __NR_setpgid (__NR_Linux + 57)
551#define __NR_send (__NR_Linux + 58)
552#define __NR_uname (__NR_Linux + 59)
553#define __NR_umask (__NR_Linux + 60)
554#define __NR_chroot (__NR_Linux + 61)
555#define __NR_ustat (__NR_Linux + 62)
556#define __NR_dup2 (__NR_Linux + 63)
557#define __NR_getppid (__NR_Linux + 64)
558#define __NR_getpgrp (__NR_Linux + 65)
559#define __NR_setsid (__NR_Linux + 66)
560#define __NR_pivot_root (__NR_Linux + 67)
561#define __NR_sgetmask (__NR_Linux + 68)
562#define __NR_ssetmask (__NR_Linux + 69)
563#define __NR_setreuid (__NR_Linux + 70)
564#define __NR_setregid (__NR_Linux + 71)
565#define __NR_mincore (__NR_Linux + 72)
566#define __NR_sigpending (__NR_Linux + 73)
567#define __NR_sethostname (__NR_Linux + 74)
568#define __NR_setrlimit (__NR_Linux + 75)
569#define __NR_getrlimit (__NR_Linux + 76)
570#define __NR_getrusage (__NR_Linux + 77)
571#define __NR_gettimeofday (__NR_Linux + 78)
572#define __NR_settimeofday (__NR_Linux + 79)
573#define __NR_getgroups (__NR_Linux + 80)
574#define __NR_setgroups (__NR_Linux + 81)
575#define __NR_sendto (__NR_Linux + 82)
576#define __NR_symlink (__NR_Linux + 83)
577#define __NR_lstat (__NR_Linux + 84)
578#define __NR_readlink (__NR_Linux + 85)
579#define __NR_uselib (__NR_Linux + 86)
580#define __NR_swapon (__NR_Linux + 87)
581#define __NR_reboot (__NR_Linux + 88)
582#define __NR_mmap2 (__NR_Linux + 89)
583#define __NR_mmap (__NR_Linux + 90)
584#define __NR_munmap (__NR_Linux + 91)
585#define __NR_truncate (__NR_Linux + 92)
586#define __NR_ftruncate (__NR_Linux + 93)
587#define __NR_fchmod (__NR_Linux + 94)
588#define __NR_fchown (__NR_Linux + 95)
589#define __NR_getpriority (__NR_Linux + 96)
590#define __NR_setpriority (__NR_Linux + 97)
591#define __NR_recv (__NR_Linux + 98)
592#define __NR_statfs (__NR_Linux + 99)
593#define __NR_fstatfs (__NR_Linux + 100)
594#define __NR_stat64 (__NR_Linux + 101)
595/* #define __NR_socketcall (__NR_Linux + 102) */
596#define __NR_syslog (__NR_Linux + 103)
597#define __NR_setitimer (__NR_Linux + 104)
598#define __NR_getitimer (__NR_Linux + 105)
599#define __NR_capget (__NR_Linux + 106)
600#define __NR_capset (__NR_Linux + 107)
601#define __NR_pread64 (__NR_Linux + 108)
602#define __NR_pwrite64 (__NR_Linux + 109)
603#define __NR_getcwd (__NR_Linux + 110)
604#define __NR_vhangup (__NR_Linux + 111)
605#define __NR_fstat64 (__NR_Linux + 112)
606#define __NR_vfork (__NR_Linux + 113)
607#define __NR_wait4 (__NR_Linux + 114)
608#define __NR_swapoff (__NR_Linux + 115)
609#define __NR_sysinfo (__NR_Linux + 116)
610#define __NR_shutdown (__NR_Linux + 117)
611#define __NR_fsync (__NR_Linux + 118)
612#define __NR_madvise (__NR_Linux + 119)
613#define __NR_clone (__NR_Linux + 120)
614#define __NR_setdomainname (__NR_Linux + 121)
615#define __NR_sendfile (__NR_Linux + 122)
616#define __NR_recvfrom (__NR_Linux + 123)
617#define __NR_adjtimex (__NR_Linux + 124)
618#define __NR_mprotect (__NR_Linux + 125)
619#define __NR_sigprocmask (__NR_Linux + 126)
620#define __NR_create_module (__NR_Linux + 127)
621#define __NR_init_module (__NR_Linux + 128)
622#define __NR_delete_module (__NR_Linux + 129)
623#define __NR_get_kernel_syms (__NR_Linux + 130)
624#define __NR_quotactl (__NR_Linux + 131)
625#define __NR_getpgid (__NR_Linux + 132)
626#define __NR_fchdir (__NR_Linux + 133)
627#define __NR_bdflush (__NR_Linux + 134)
628#define __NR_sysfs (__NR_Linux + 135)
629#define __NR_personality (__NR_Linux + 136)
630#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */
631#define __NR_setfsuid (__NR_Linux + 138)
632#define __NR_setfsgid (__NR_Linux + 139)
633#define __NR__llseek (__NR_Linux + 140)
634#define __NR_getdents (__NR_Linux + 141)
635#define __NR__newselect (__NR_Linux + 142)
636#define __NR_flock (__NR_Linux + 143)
637#define __NR_msync (__NR_Linux + 144)
638#define __NR_readv (__NR_Linux + 145)
639#define __NR_writev (__NR_Linux + 146)
640#define __NR_getsid (__NR_Linux + 147)
641#define __NR_fdatasync (__NR_Linux + 148)
642#define __NR__sysctl (__NR_Linux + 149)
643#define __NR_mlock (__NR_Linux + 150)
644#define __NR_munlock (__NR_Linux + 151)
645#define __NR_mlockall (__NR_Linux + 152)
646#define __NR_munlockall (__NR_Linux + 153)
647#define __NR_sched_setparam (__NR_Linux + 154)
648#define __NR_sched_getparam (__NR_Linux + 155)
649#define __NR_sched_setscheduler (__NR_Linux + 156)
650#define __NR_sched_getscheduler (__NR_Linux + 157)
651#define __NR_sched_yield (__NR_Linux + 158)
652#define __NR_sched_get_priority_max (__NR_Linux + 159)
653#define __NR_sched_get_priority_min (__NR_Linux + 160)
654#define __NR_sched_rr_get_interval (__NR_Linux + 161)
655#define __NR_nanosleep (__NR_Linux + 162)
656#define __NR_mremap (__NR_Linux + 163)
657#define __NR_setresuid (__NR_Linux + 164)
658#define __NR_getresuid (__NR_Linux + 165)
659#define __NR_sigaltstack (__NR_Linux + 166)
660#define __NR_query_module (__NR_Linux + 167)
661#define __NR_poll (__NR_Linux + 168)
662#define __NR_nfsservctl (__NR_Linux + 169)
663#define __NR_setresgid (__NR_Linux + 170)
664#define __NR_getresgid (__NR_Linux + 171)
665#define __NR_prctl (__NR_Linux + 172)
666#define __NR_rt_sigreturn (__NR_Linux + 173)
667#define __NR_rt_sigaction (__NR_Linux + 174)
668#define __NR_rt_sigprocmask (__NR_Linux + 175)
669#define __NR_rt_sigpending (__NR_Linux + 176)
670#define __NR_rt_sigtimedwait (__NR_Linux + 177)
671#define __NR_rt_sigqueueinfo (__NR_Linux + 178)
672#define __NR_rt_sigsuspend (__NR_Linux + 179)
673#define __NR_chown (__NR_Linux + 180)
674#define __NR_setsockopt (__NR_Linux + 181)
675#define __NR_getsockopt (__NR_Linux + 182)
676#define __NR_sendmsg (__NR_Linux + 183)
677#define __NR_recvmsg (__NR_Linux + 184)
678#define __NR_semop (__NR_Linux + 185)
679#define __NR_semget (__NR_Linux + 186)
680#define __NR_semctl (__NR_Linux + 187)
681#define __NR_msgsnd (__NR_Linux + 188)
682#define __NR_msgrcv (__NR_Linux + 189)
683#define __NR_msgget (__NR_Linux + 190)
684#define __NR_msgctl (__NR_Linux + 191)
685#define __NR_shmat (__NR_Linux + 192)
686#define __NR_shmdt (__NR_Linux + 193)
687#define __NR_shmget (__NR_Linux + 194)
688#define __NR_shmctl (__NR_Linux + 195)
689
690#define __NR_getpmsg (__NR_Linux + 196) /* Somebody *wants* streams? */
691#define __NR_putpmsg (__NR_Linux + 197)
692
693#define __NR_lstat64 (__NR_Linux + 198)
694#define __NR_truncate64 (__NR_Linux + 199)
695#define __NR_ftruncate64 (__NR_Linux + 200)
696#define __NR_getdents64 (__NR_Linux + 201)
697#define __NR_fcntl64 (__NR_Linux + 202)
698#define __NR_attrctl (__NR_Linux + 203)
699#define __NR_acl_get (__NR_Linux + 204)
700#define __NR_acl_set (__NR_Linux + 205)
701#define __NR_gettid (__NR_Linux + 206)
702#define __NR_readahead (__NR_Linux + 207)
703#define __NR_tkill (__NR_Linux + 208)
704#define __NR_sendfile64 (__NR_Linux + 209)
705#define __NR_futex (__NR_Linux + 210)
706#define __NR_sched_setaffinity (__NR_Linux + 211)
707#define __NR_sched_getaffinity (__NR_Linux + 212)
708#define __NR_set_thread_area (__NR_Linux + 213)
709#define __NR_get_thread_area (__NR_Linux + 214)
710#define __NR_io_setup (__NR_Linux + 215)
711#define __NR_io_destroy (__NR_Linux + 216)
712#define __NR_io_getevents (__NR_Linux + 217)
713#define __NR_io_submit (__NR_Linux + 218)
714#define __NR_io_cancel (__NR_Linux + 219)
715#define __NR_alloc_hugepages (__NR_Linux + 220)
716#define __NR_free_hugepages (__NR_Linux + 221)
717#define __NR_exit_group (__NR_Linux + 222)
718#define __NR_lookup_dcookie (__NR_Linux + 223)
719#define __NR_epoll_create (__NR_Linux + 224)
720#define __NR_epoll_ctl (__NR_Linux + 225)
721#define __NR_epoll_wait (__NR_Linux + 226)
722#define __NR_remap_file_pages (__NR_Linux + 227)
723#define __NR_semtimedop (__NR_Linux + 228)
724#define __NR_mq_open (__NR_Linux + 229)
725#define __NR_mq_unlink (__NR_Linux + 230)
726#define __NR_mq_timedsend (__NR_Linux + 231)
727#define __NR_mq_timedreceive (__NR_Linux + 232)
728#define __NR_mq_notify (__NR_Linux + 233)
729#define __NR_mq_getsetattr (__NR_Linux + 234)
730#define __NR_waitid (__NR_Linux + 235)
731#define __NR_fadvise64_64 (__NR_Linux + 236)
732#define __NR_set_tid_address (__NR_Linux + 237)
733#define __NR_setxattr (__NR_Linux + 238)
734#define __NR_lsetxattr (__NR_Linux + 239)
735#define __NR_fsetxattr (__NR_Linux + 240)
736#define __NR_getxattr (__NR_Linux + 241)
737#define __NR_lgetxattr (__NR_Linux + 242)
738#define __NR_fgetxattr (__NR_Linux + 243)
739#define __NR_listxattr (__NR_Linux + 244)
740#define __NR_llistxattr (__NR_Linux + 245)
741#define __NR_flistxattr (__NR_Linux + 246)
742#define __NR_removexattr (__NR_Linux + 247)
743#define __NR_lremovexattr (__NR_Linux + 248)
744#define __NR_fremovexattr (__NR_Linux + 249)
745#define __NR_timer_create (__NR_Linux + 250)
746#define __NR_timer_settime (__NR_Linux + 251)
747#define __NR_timer_gettime (__NR_Linux + 252)
748#define __NR_timer_getoverrun (__NR_Linux + 253)
749#define __NR_timer_delete (__NR_Linux + 254)
750#define __NR_clock_settime (__NR_Linux + 255)
751#define __NR_clock_gettime (__NR_Linux + 256)
752#define __NR_clock_getres (__NR_Linux + 257)
753#define __NR_clock_nanosleep (__NR_Linux + 258)
754#define __NR_tgkill (__NR_Linux + 259)
755#define __NR_mbind (__NR_Linux + 260)
756#define __NR_get_mempolicy (__NR_Linux + 261)
757#define __NR_set_mempolicy (__NR_Linux + 262)
758#define __NR_vserver (__NR_Linux + 263)
759#define __NR_add_key (__NR_Linux + 264)
760#define __NR_request_key (__NR_Linux + 265)
761#define __NR_keyctl (__NR_Linux + 266)
762#define __NR_ioprio_set (__NR_Linux + 267)
763#define __NR_ioprio_get (__NR_Linux + 268)
764#define __NR_inotify_init (__NR_Linux + 269)
765#define __NR_inotify_add_watch (__NR_Linux + 270)
766#define __NR_inotify_rm_watch (__NR_Linux + 271)
767#define __NR_migrate_pages (__NR_Linux + 272)
768#define __NR_pselect6 (__NR_Linux + 273)
769#define __NR_ppoll (__NR_Linux + 274)
770#define __NR_openat (__NR_Linux + 275)
771#define __NR_mkdirat (__NR_Linux + 276)
772#define __NR_mknodat (__NR_Linux + 277)
773#define __NR_fchownat (__NR_Linux + 278)
774#define __NR_futimesat (__NR_Linux + 279)
775#define __NR_fstatat64 (__NR_Linux + 280)
776#define __NR_unlinkat (__NR_Linux + 281)
777#define __NR_renameat (__NR_Linux + 282)
778#define __NR_linkat (__NR_Linux + 283)
779#define __NR_symlinkat (__NR_Linux + 284)
780#define __NR_readlinkat (__NR_Linux + 285)
781#define __NR_fchmodat (__NR_Linux + 286)
782#define __NR_faccessat (__NR_Linux + 287)
783#define __NR_unshare (__NR_Linux + 288)
784#define __NR_set_robust_list (__NR_Linux + 289)
785#define __NR_get_robust_list (__NR_Linux + 290)
786#define __NR_splice (__NR_Linux + 291)
787#define __NR_sync_file_range (__NR_Linux + 292)
788#define __NR_tee (__NR_Linux + 293)
789#define __NR_vmsplice (__NR_Linux + 294)
790#define __NR_move_pages (__NR_Linux + 295)
791#define __NR_getcpu (__NR_Linux + 296)
792#define __NR_epoll_pwait (__NR_Linux + 297)
793#define __NR_statfs64 (__NR_Linux + 298)
794#define __NR_fstatfs64 (__NR_Linux + 299)
795#define __NR_kexec_load (__NR_Linux + 300)
796#define __NR_utimensat (__NR_Linux + 301)
797#define __NR_signalfd (__NR_Linux + 302)
798#define __NR_timerfd (__NR_Linux + 303)
799#define __NR_eventfd (__NR_Linux + 304)
800#define __NR_fallocate (__NR_Linux + 305)
801#define __NR_timerfd_create (__NR_Linux + 306)
802#define __NR_timerfd_settime (__NR_Linux + 307)
803#define __NR_timerfd_gettime (__NR_Linux + 308)
804#define __NR_signalfd4 (__NR_Linux + 309)
805#define __NR_eventfd2 (__NR_Linux + 310)
806#define __NR_epoll_create1 (__NR_Linux + 311)
807#define __NR_dup3 (__NR_Linux + 312)
808#define __NR_pipe2 (__NR_Linux + 313)
809#define __NR_inotify_init1 (__NR_Linux + 314)
810#define __NR_preadv (__NR_Linux + 315)
811#define __NR_pwritev (__NR_Linux + 316)
812#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317)
813#define __NR_perf_event_open (__NR_Linux + 318)
814#define __NR_recvmmsg (__NR_Linux + 319)
815#define __NR_accept4 (__NR_Linux + 320)
816#define __NR_prlimit64 (__NR_Linux + 321)
817#define __NR_fanotify_init (__NR_Linux + 322)
818#define __NR_fanotify_mark (__NR_Linux + 323)
819#define __NR_clock_adjtime (__NR_Linux + 324)
820#define __NR_name_to_handle_at (__NR_Linux + 325)
821#define __NR_open_by_handle_at (__NR_Linux + 326)
822#define __NR_syncfs (__NR_Linux + 327)
823#define __NR_setns (__NR_Linux + 328)
824#define __NR_sendmmsg (__NR_Linux + 329)
825
826#define __NR_Linux_syscalls (__NR_sendmmsg + 1)
827
828
829#define __IGNORE_select /* newselect */
830#define __IGNORE_fadvise64 /* fadvise64_64 */
831#define __IGNORE_utimes /* utime */
832
833
834#define HPUX_GATEWAY_ADDR 0xC0000004
835#define LINUX_GATEWAY_ADDR 0x100
836 5
837#ifdef __KERNEL__
838#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
839 7
840#define SYS_ify(syscall_name) __NR_##syscall_name 8#define SYS_ify(syscall_name) __NR_##syscall_name
@@ -1008,5 +176,4 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
1008 */ 176 */
1009#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 177#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
1010 178
1011#endif /* __KERNEL__ */
1012#endif /* _ASM_PARISC_UNISTD_H_ */ 179#endif /* _ASM_PARISC_UNISTD_H_ */
diff --git a/arch/parisc/include/asm/user.h b/arch/parisc/include/asm/user.h
deleted file mode 100644
index 80224753e508..000000000000
--- a/arch/parisc/include/asm/user.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* This file should not exist, but lots of generic code still includes
2 it. It's a hangover from old a.out days and the traditional core
3 dump format. We are ELF-only, and so are our core dumps. If we
4 need to support HP/UX core format then we'll do it here
5 eventually. */
diff --git a/arch/parisc/include/asm/vga.h b/arch/parisc/include/asm/vga.h
deleted file mode 100644
index 171399a88ca6..000000000000
--- a/arch/parisc/include/asm/vga.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_PARISC_VGA_H__
2#define __ASM_PARISC_VGA_H__
3
4/* nothing */
5
6#endif /* __ASM_PARISC_VGA_H__ */
diff --git a/arch/parisc/include/asm/xor.h b/arch/parisc/include/asm/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/arch/parisc/include/asm/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/arch/parisc/include/uapi/asm/Kbuild b/arch/parisc/include/uapi/asm/Kbuild
index baebb3da1d44..a580642555b6 100644
--- a/arch/parisc/include/uapi/asm/Kbuild
+++ b/arch/parisc/include/uapi/asm/Kbuild
@@ -1,3 +1,31 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += bitsperlong.h
5header-y += byteorder.h
6header-y += errno.h
7header-y += fcntl.h
8header-y += ioctl.h
9header-y += ioctls.h
10header-y += ipcbuf.h
11header-y += mman.h
12header-y += msgbuf.h
13header-y += pdc.h
14header-y += posix_types.h
15header-y += ptrace.h
16header-y += resource.h
17header-y += sembuf.h
18header-y += setup.h
19header-y += shmbuf.h
20header-y += sigcontext.h
21header-y += siginfo.h
22header-y += signal.h
23header-y += socket.h
24header-y += sockios.h
25header-y += stat.h
26header-y += statfs.h
27header-y += swab.h
28header-y += termbits.h
29header-y += termios.h
30header-y += types.h
31header-y += unistd.h
diff --git a/arch/parisc/include/asm/bitsperlong.h b/arch/parisc/include/uapi/asm/bitsperlong.h
index 75196b415d3f..75196b415d3f 100644
--- a/arch/parisc/include/asm/bitsperlong.h
+++ b/arch/parisc/include/uapi/asm/bitsperlong.h
diff --git a/arch/parisc/include/asm/byteorder.h b/arch/parisc/include/uapi/asm/byteorder.h
index 58af2c5f5d61..58af2c5f5d61 100644
--- a/arch/parisc/include/asm/byteorder.h
+++ b/arch/parisc/include/uapi/asm/byteorder.h
diff --git a/arch/parisc/include/asm/errno.h b/arch/parisc/include/uapi/asm/errno.h
index 135ad6047e51..135ad6047e51 100644
--- a/arch/parisc/include/asm/errno.h
+++ b/arch/parisc/include/uapi/asm/errno.h
diff --git a/arch/parisc/include/asm/fcntl.h b/arch/parisc/include/uapi/asm/fcntl.h
index 0304b92ccfea..0304b92ccfea 100644
--- a/arch/parisc/include/asm/fcntl.h
+++ b/arch/parisc/include/uapi/asm/fcntl.h
diff --git a/arch/parisc/include/asm/ioctl.h b/arch/parisc/include/uapi/asm/ioctl.h
index ec8efa02beda..ec8efa02beda 100644
--- a/arch/parisc/include/asm/ioctl.h
+++ b/arch/parisc/include/uapi/asm/ioctl.h
diff --git a/arch/parisc/include/asm/ioctls.h b/arch/parisc/include/uapi/asm/ioctls.h
index 054ec06f9e23..054ec06f9e23 100644
--- a/arch/parisc/include/asm/ioctls.h
+++ b/arch/parisc/include/uapi/asm/ioctls.h
diff --git a/arch/parisc/include/asm/ipcbuf.h b/arch/parisc/include/uapi/asm/ipcbuf.h
index bd956c425785..bd956c425785 100644
--- a/arch/parisc/include/asm/ipcbuf.h
+++ b/arch/parisc/include/uapi/asm/ipcbuf.h
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 12219ebce869..12219ebce869 100644
--- a/arch/parisc/include/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
diff --git a/arch/parisc/include/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h
index fe88f2649418..fe88f2649418 100644
--- a/arch/parisc/include/asm/msgbuf.h
+++ b/arch/parisc/include/uapi/asm/msgbuf.h
diff --git a/arch/parisc/include/uapi/asm/pdc.h b/arch/parisc/include/uapi/asm/pdc.h
new file mode 100644
index 000000000000..702498f7705b
--- /dev/null
+++ b/arch/parisc/include/uapi/asm/pdc.h
@@ -0,0 +1,427 @@
1#ifndef _UAPI_PARISC_PDC_H
2#define _UAPI_PARISC_PDC_H
3
4/*
5 * PDC return values ...
6 * All PDC calls return a subset of these errors.
7 */
8
9#define PDC_WARN 3 /* Call completed with a warning */
10#define PDC_REQ_ERR_1 2 /* See above */
11#define PDC_REQ_ERR_0 1 /* Call would generate a requestor error */
12#define PDC_OK 0 /* Call completed successfully */
13#define PDC_BAD_PROC -1 /* Called non-existent procedure*/
14#define PDC_BAD_OPTION -2 /* Called with non-existent option */
15#define PDC_ERROR -3 /* Call could not complete without an error */
16#define PDC_NE_MOD -5 /* Module not found */
17#define PDC_NE_CELL_MOD -7 /* Cell module not found */
18#define PDC_INVALID_ARG -10 /* Called with an invalid argument */
19#define PDC_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */
20#define PDC_NOT_NARROW -17 /* Narrow mode not supported */
21
22/*
23 * PDC entry points...
24 */
25
26#define PDC_POW_FAIL 1 /* perform a power-fail */
27#define PDC_POW_FAIL_PREPARE 0 /* prepare for powerfail */
28
29#define PDC_CHASSIS 2 /* PDC-chassis functions */
30#define PDC_CHASSIS_DISP 0 /* update chassis display */
31#define PDC_CHASSIS_WARN 1 /* return chassis warnings */
32#define PDC_CHASSIS_DISPWARN 2 /* update&return chassis status */
33#define PDC_RETURN_CHASSIS_INFO 128 /* HVERSION dependent: return chassis LED/LCD info */
34
35#define PDC_PIM 3 /* Get PIM data */
36#define PDC_PIM_HPMC 0 /* Transfer HPMC data */
37#define PDC_PIM_RETURN_SIZE 1 /* Get Max buffer needed for PIM*/
38#define PDC_PIM_LPMC 2 /* Transfer HPMC data */
39#define PDC_PIM_SOFT_BOOT 3 /* Transfer Soft Boot data */
40#define PDC_PIM_TOC 4 /* Transfer TOC data */
41
42#define PDC_MODEL 4 /* PDC model information call */
43#define PDC_MODEL_INFO 0 /* returns information */
44#define PDC_MODEL_BOOTID 1 /* set the BOOT_ID */
45#define PDC_MODEL_VERSIONS 2 /* returns cpu-internal versions*/
46#define PDC_MODEL_SYSMODEL 3 /* return system model info */
47#define PDC_MODEL_ENSPEC 4 /* enable specific option */
48#define PDC_MODEL_DISPEC 5 /* disable specific option */
49#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */
50#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */
51/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
52#define PDC_MODEL_OS64 (1 << 0)
53#define PDC_MODEL_OS32 (1 << 1)
54#define PDC_MODEL_IOPDIR_FDC (1 << 2)
55#define PDC_MODEL_NVA_MASK (3 << 4)
56#define PDC_MODEL_NVA_SUPPORTED (0 << 4)
57#define PDC_MODEL_NVA_SLOW (1 << 4)
58#define PDC_MODEL_NVA_UNSUPPORTED (3 << 4)
59#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */
60#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */
61
62#define PA89_INSTRUCTION_SET 0x4 /* capatibilies returned */
63#define PA90_INSTRUCTION_SET 0x8
64
65#define PDC_CACHE 5 /* return/set cache (& TLB) info*/
66#define PDC_CACHE_INFO 0 /* returns information */
67#define PDC_CACHE_SET_COH 1 /* set coherence state */
68#define PDC_CACHE_RET_SPID 2 /* returns space-ID bits */
69
70#define PDC_HPA 6 /* return HPA of processor */
71#define PDC_HPA_PROCESSOR 0
72#define PDC_HPA_MODULES 1
73
74#define PDC_COPROC 7 /* Co-Processor (usually FP unit(s)) */
75#define PDC_COPROC_CFG 0 /* Co-Processor Cfg (FP unit(s) enabled?) */
76
77#define PDC_IODC 8 /* talk to IODC */
78#define PDC_IODC_READ 0 /* read IODC entry point */
79/* PDC_IODC_RI_ * INDEX parameter of PDC_IODC_READ */
80#define PDC_IODC_RI_DATA_BYTES 0 /* IODC Data Bytes */
81/* 1, 2 obsolete - HVERSION dependent*/
82#define PDC_IODC_RI_INIT 3 /* Initialize module */
83#define PDC_IODC_RI_IO 4 /* Module input/output */
84#define PDC_IODC_RI_SPA 5 /* Module input/output */
85#define PDC_IODC_RI_CONFIG 6 /* Module input/output */
86/* 7 obsolete - HVERSION dependent */
87#define PDC_IODC_RI_TEST 8 /* Module input/output */
88#define PDC_IODC_RI_TLB 9 /* Module input/output */
89#define PDC_IODC_NINIT 2 /* non-destructive init */
90#define PDC_IODC_DINIT 3 /* destructive init */
91#define PDC_IODC_MEMERR 4 /* check for memory errors */
92#define PDC_IODC_INDEX_DATA 0 /* get first 16 bytes from mod IODC */
93#define PDC_IODC_BUS_ERROR -4 /* bus error return value */
94#define PDC_IODC_INVALID_INDEX -5 /* invalid index return value */
95#define PDC_IODC_COUNT -6 /* count is too small */
96
97#define PDC_TOD 9 /* time-of-day clock (TOD) */
98#define PDC_TOD_READ 0 /* read TOD */
99#define PDC_TOD_WRITE 1 /* write TOD */
100
101
102#define PDC_STABLE 10 /* stable storage (sprockets) */
103#define PDC_STABLE_READ 0
104#define PDC_STABLE_WRITE 1
105#define PDC_STABLE_RETURN_SIZE 2
106#define PDC_STABLE_VERIFY_CONTENTS 3
107#define PDC_STABLE_INITIALIZE 4
108
109#define PDC_NVOLATILE 11 /* often not implemented */
110
111#define PDC_ADD_VALID 12 /* Memory validation PDC call */
112#define PDC_ADD_VALID_VERIFY 0 /* Make PDC_ADD_VALID verify region */
113
114#define PDC_INSTR 15 /* get instr to invoke PDCE_CHECK() */
115
116#define PDC_PROC 16 /* (sprockets) */
117
118#define PDC_CONFIG 16 /* (sprockets) */
119#define PDC_CONFIG_DECONFIG 0
120#define PDC_CONFIG_DRECONFIG 1
121#define PDC_CONFIG_DRETURN_CONFIG 2
122
123#define PDC_BLOCK_TLB 18 /* manage hardware block-TLB */
124#define PDC_BTLB_INFO 0 /* returns parameter */
125#define PDC_BTLB_INSERT 1 /* insert BTLB entry */
126#define PDC_BTLB_PURGE 2 /* purge BTLB entries */
127#define PDC_BTLB_PURGE_ALL 3 /* purge all BTLB entries */
128
129#define PDC_TLB 19 /* manage hardware TLB miss handling */
130#define PDC_TLB_INFO 0 /* returns parameter */
131#define PDC_TLB_SETUP 1 /* set up miss handling */
132
133#define PDC_MEM 20 /* Manage memory */
134#define PDC_MEM_MEMINFO 0
135#define PDC_MEM_ADD_PAGE 1
136#define PDC_MEM_CLEAR_PDT 2
137#define PDC_MEM_READ_PDT 3
138#define PDC_MEM_RESET_CLEAR 4
139#define PDC_MEM_GOODMEM 5
140#define PDC_MEM_TABLE 128 /* Non contig mem map (sprockets) */
141#define PDC_MEM_RETURN_ADDRESS_TABLE PDC_MEM_TABLE
142#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES_SIZE 131
143#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES 132
144#define PDC_MEM_GET_PHYSICAL_LOCATION_FROM_MEMORY_ADDRESS 133
145
146#define PDC_MEM_RET_SBE_REPLACED 5 /* PDC_MEM return values */
147#define PDC_MEM_RET_DUPLICATE_ENTRY 4
148#define PDC_MEM_RET_BUF_SIZE_SMALL 1
149#define PDC_MEM_RET_PDT_FULL -11
150#define PDC_MEM_RET_INVALID_PHYSICAL_LOCATION ~0ULL
151
152#define PDC_PSW 21 /* Get/Set default System Mask */
153#define PDC_PSW_MASK 0 /* Return mask */
154#define PDC_PSW_GET_DEFAULTS 1 /* Return defaults */
155#define PDC_PSW_SET_DEFAULTS 2 /* Set default */
156#define PDC_PSW_ENDIAN_BIT 1 /* set for big endian */
157#define PDC_PSW_WIDE_BIT 2 /* set for wide mode */
158
159#define PDC_SYSTEM_MAP 22 /* find system modules */
160#define PDC_FIND_MODULE 0
161#define PDC_FIND_ADDRESS 1
162#define PDC_TRANSLATE_PATH 2
163
164#define PDC_SOFT_POWER 23 /* soft power switch */
165#define PDC_SOFT_POWER_INFO 0 /* return info about the soft power switch */
166#define PDC_SOFT_POWER_ENABLE 1 /* enable/disable soft power switch */
167
168
169/* HVERSION dependent */
170
171/* The PDC_MEM_MAP calls */
172#define PDC_MEM_MAP 128 /* on s700: return page info */
173#define PDC_MEM_MAP_HPA 0 /* returns hpa of a module */
174
175#define PDC_EEPROM 129 /* EEPROM access */
176#define PDC_EEPROM_READ_WORD 0
177#define PDC_EEPROM_WRITE_WORD 1
178#define PDC_EEPROM_READ_BYTE 2
179#define PDC_EEPROM_WRITE_BYTE 3
180#define PDC_EEPROM_EEPROM_PASSWORD -1000
181
182#define PDC_NVM 130 /* NVM (non-volatile memory) access */
183#define PDC_NVM_READ_WORD 0
184#define PDC_NVM_WRITE_WORD 1
185#define PDC_NVM_READ_BYTE 2
186#define PDC_NVM_WRITE_BYTE 3
187
188#define PDC_SEED_ERROR 132 /* (sprockets) */
189
190#define PDC_IO 135 /* log error info, reset IO system */
191#define PDC_IO_READ_AND_CLEAR_ERRORS 0
192#define PDC_IO_RESET 1
193#define PDC_IO_RESET_DEVICES 2
194/* sets bits 6&7 (little endian) of the HcControl Register */
195#define PDC_IO_USB_SUSPEND 0xC000000000000000
196#define PDC_IO_EEPROM_IO_ERR_TABLE_FULL -5 /* return value */
197#define PDC_IO_NO_SUSPEND -6 /* return value */
198
199#define PDC_BROADCAST_RESET 136 /* reset all processors */
200#define PDC_DO_RESET 0 /* option: perform a broadcast reset */
201#define PDC_DO_FIRM_TEST_RESET 1 /* Do broadcast reset with bitmap */
202#define PDC_BR_RECONFIGURATION 2 /* reset w/reconfiguration */
203#define PDC_FIRM_TEST_MAGIC 0xab9ec36fUL /* for this reboot only */
204
205#define PDC_LAN_STATION_ID 138 /* Hversion dependent mechanism for */
206#define PDC_LAN_STATION_ID_READ 0 /* getting the lan station address */
207
208#define PDC_LAN_STATION_ID_SIZE 6
209
210#define PDC_CHECK_RANGES 139 /* (sprockets) */
211
212#define PDC_NV_SECTIONS 141 /* (sprockets) */
213
214#define PDC_PERFORMANCE 142 /* performance monitoring */
215
216#define PDC_SYSTEM_INFO 143 /* system information */
217#define PDC_SYSINFO_RETURN_INFO_SIZE 0
218#define PDC_SYSINFO_RRETURN_SYS_INFO 1
219#define PDC_SYSINFO_RRETURN_ERRORS 2
220#define PDC_SYSINFO_RRETURN_WARNINGS 3
221#define PDC_SYSINFO_RETURN_REVISIONS 4
222#define PDC_SYSINFO_RRETURN_DIAGNOSE 5
223#define PDC_SYSINFO_RRETURN_HV_DIAGNOSE 1005
224
225#define PDC_RDR 144 /* (sprockets) */
226#define PDC_RDR_READ_BUFFER 0
227#define PDC_RDR_READ_SINGLE 1
228#define PDC_RDR_WRITE_SINGLE 2
229
230#define PDC_INTRIGUE 145 /* (sprockets) */
231#define PDC_INTRIGUE_WRITE_BUFFER 0
232#define PDC_INTRIGUE_GET_SCRATCH_BUFSIZE 1
233#define PDC_INTRIGUE_START_CPU_COUNTERS 2
234#define PDC_INTRIGUE_STOP_CPU_COUNTERS 3
235
236#define PDC_STI 146 /* STI access */
237/* same as PDC_PCI_XXX values (see below) */
238
239/* Legacy PDC definitions for same stuff */
240#define PDC_PCI_INDEX 147
241#define PDC_PCI_INTERFACE_INFO 0
242#define PDC_PCI_SLOT_INFO 1
243#define PDC_PCI_INFLIGHT_BYTES 2
244#define PDC_PCI_READ_CONFIG 3
245#define PDC_PCI_WRITE_CONFIG 4
246#define PDC_PCI_READ_PCI_IO 5
247#define PDC_PCI_WRITE_PCI_IO 6
248#define PDC_PCI_READ_CONFIG_DELAY 7
249#define PDC_PCI_UPDATE_CONFIG_DELAY 8
250#define PDC_PCI_PCI_PATH_TO_PCI_HPA 9
251#define PDC_PCI_PCI_HPA_TO_PCI_PATH 10
252#define PDC_PCI_PCI_PATH_TO_PCI_BUS 11
253#define PDC_PCI_PCI_RESERVED 12
254#define PDC_PCI_PCI_INT_ROUTE_SIZE 13
255#define PDC_PCI_GET_INT_TBL_SIZE PDC_PCI_PCI_INT_ROUTE_SIZE
256#define PDC_PCI_PCI_INT_ROUTE 14
257#define PDC_PCI_GET_INT_TBL PDC_PCI_PCI_INT_ROUTE
258#define PDC_PCI_READ_MON_TYPE 15
259#define PDC_PCI_WRITE_MON_TYPE 16
260
261
262/* Get SCSI Interface Card info: SDTR, SCSI ID, mode (SE vs LVD) */
263#define PDC_INITIATOR 163
264#define PDC_GET_INITIATOR 0
265#define PDC_SET_INITIATOR 1
266#define PDC_DELETE_INITIATOR 2
267#define PDC_RETURN_TABLE_SIZE 3
268#define PDC_RETURN_TABLE 4
269
270#define PDC_LINK 165 /* (sprockets) */
271#define PDC_LINK_PCI_ENTRY_POINTS 0 /* list (Arg1) = 0 */
272#define PDC_LINK_USB_ENTRY_POINTS 1 /* list (Arg1) = 1 */
273
274/* cl_class
275 * page 3-33 of IO-Firmware ARS
276 * IODC ENTRY_INIT(Search first) RET[1]
277 */
278#define CL_NULL 0 /* invalid */
279#define CL_RANDOM 1 /* random access (as disk) */
280#define CL_SEQU 2 /* sequential access (as tape) */
281#define CL_DUPLEX 7 /* full-duplex point-to-point (RS-232, Net) */
282#define CL_KEYBD 8 /* half-duplex console (HIL Keyboard) */
283#define CL_DISPL 9 /* half-duplex console (display) */
284#define CL_FC 10 /* FiberChannel access media */
285
286/* IODC ENTRY_INIT() */
287#define ENTRY_INIT_SRCH_FRST 2
288#define ENTRY_INIT_SRCH_NEXT 3
289#define ENTRY_INIT_MOD_DEV 4
290#define ENTRY_INIT_DEV 5
291#define ENTRY_INIT_MOD 6
292#define ENTRY_INIT_MSG 9
293
294/* IODC ENTRY_IO() */
295#define ENTRY_IO_BOOTIN 0
296#define ENTRY_IO_BOOTOUT 1
297#define ENTRY_IO_CIN 2
298#define ENTRY_IO_COUT 3
299#define ENTRY_IO_CLOSE 4
300#define ENTRY_IO_GETMSG 9
301#define ENTRY_IO_BBLOCK_IN 16
302#define ENTRY_IO_BBLOCK_OUT 17
303
304/* IODC ENTRY_SPA() */
305
306/* IODC ENTRY_CONFIG() */
307
308/* IODC ENTRY_TEST() */
309
310/* IODC ENTRY_TLB() */
311
312/* constants for OS (NVM...) */
313#define OS_ID_NONE 0 /* Undefined OS ID */
314#define OS_ID_HPUX 1 /* HP-UX OS */
315#define OS_ID_MPEXL 2 /* MPE XL OS */
316#define OS_ID_OSF 3 /* OSF OS */
317#define OS_ID_HPRT 4 /* HP-RT OS */
318#define OS_ID_NOVEL 5 /* NOVELL OS */
319#define OS_ID_LINUX 6 /* Linux */
320
321
322/* constants for PDC_CHASSIS */
323#define OSTAT_OFF 0
324#define OSTAT_FLT 1
325#define OSTAT_TEST 2
326#define OSTAT_INIT 3
327#define OSTAT_SHUT 4
328#define OSTAT_WARN 5
329#define OSTAT_RUN 6
330#define OSTAT_ON 7
331
332/* Page Zero constant offsets used by the HPMC handler */
333#define BOOT_CONSOLE_HPA_OFFSET 0x3c0
334#define BOOT_CONSOLE_SPA_OFFSET 0x3c4
335#define BOOT_CONSOLE_PATH_OFFSET 0x3a8
336
337/* size of the pdc_result buffer for firmware.c */
338#define NUM_PDC_RESULT 32
339
340#if !defined(__ASSEMBLY__)
341
342#include <linux/types.h>
343
344
345/* flags of the device_path */
346#define PF_AUTOBOOT 0x80
347#define PF_AUTOSEARCH 0x40
348#define PF_TIMER 0x0F
349
350struct device_path { /* page 1-69 */
351 unsigned char flags; /* flags see above! */
352 unsigned char bc[6]; /* bus converter routing info */
353 unsigned char mod;
354 unsigned int layers[6];/* device-specific layer-info */
355} __attribute__((aligned(8))) ;
356
357struct pz_device {
358 struct device_path dp; /* see above */
359 /* struct iomod *hpa; */
360 unsigned int hpa; /* HPA base address */
361 /* char *spa; */
362 unsigned int spa; /* SPA base address */
363 /* int (*iodc_io)(struct iomod*, ...); */
364 unsigned int iodc_io; /* device entry point */
365 short pad; /* reserved */
366 unsigned short cl_class;/* see below */
367} __attribute__((aligned(8))) ;
368
369struct zeropage {
370 /* [0x000] initialize vectors (VEC) */
371 unsigned int vec_special; /* must be zero */
372 /* int (*vec_pow_fail)(void);*/
373 unsigned int vec_pow_fail; /* power failure handler */
374 /* int (*vec_toc)(void); */
375 unsigned int vec_toc;
376 unsigned int vec_toclen;
377 /* int (*vec_rendz)(void); */
378 unsigned int vec_rendz;
379 int vec_pow_fail_flen;
380 int vec_pad[10];
381
382 /* [0x040] reserved processor dependent */
383 int pad0[112];
384
385 /* [0x200] reserved */
386 int pad1[84];
387
388 /* [0x350] memory configuration (MC) */
389 int memc_cont; /* contiguous mem size (bytes) */
390 int memc_phsize; /* physical memory size */
391 int memc_adsize; /* additional mem size, bytes of SPA space used by PDC */
392 unsigned int mem_pdc_hi; /* used for 64-bit */
393
394 /* [0x360] various parameters for the boot-CPU */
395 /* unsigned int *mem_booterr[8]; */
396 unsigned int mem_booterr[8]; /* ptr to boot errors */
397 unsigned int mem_free; /* first location, where OS can be loaded */
398 /* struct iomod *mem_hpa; */
399 unsigned int mem_hpa; /* HPA of the boot-CPU */
400 /* int (*mem_pdc)(int, ...); */
401 unsigned int mem_pdc; /* PDC entry point */
402 unsigned int mem_10msec; /* number of clock ticks in 10msec */
403
404 /* [0x390] initial memory module (IMM) */
405 /* struct iomod *imm_hpa; */
406 unsigned int imm_hpa; /* HPA of the IMM */
407 int imm_soft_boot; /* 0 = was hard boot, 1 = was soft boot */
408 unsigned int imm_spa_size; /* SPA size of the IMM in bytes */
409 unsigned int imm_max_mem; /* bytes of mem in IMM */
410
411 /* [0x3A0] boot console, display device and keyboard */
412 struct pz_device mem_cons; /* description of console device */
413 struct pz_device mem_boot; /* description of boot device */
414 struct pz_device mem_kbd; /* description of keyboard device */
415
416 /* [0x430] reserved */
417 int pad430[116];
418
419 /* [0x600] processor dependent */
420 __u32 pad600[1];
421 __u32 proc_sti; /* pointer to STI ROM */
422 __u32 pad608[126];
423};
424
425#endif /* !defined(__ASSEMBLY__) */
426
427#endif /* _UAPI_PARISC_PDC_H */
diff --git a/arch/parisc/include/asm/posix_types.h b/arch/parisc/include/uapi/asm/posix_types.h
index b9344256f76b..b9344256f76b 100644
--- a/arch/parisc/include/asm/posix_types.h
+++ b/arch/parisc/include/uapi/asm/posix_types.h
diff --git a/arch/parisc/include/uapi/asm/ptrace.h b/arch/parisc/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..c4fa6c8b9ad9
--- /dev/null
+++ b/arch/parisc/include/uapi/asm/ptrace.h
@@ -0,0 +1,47 @@
1/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg
2** Copyright (C) 2000 Grant Grundler, Hewlett-Packard
3*/
4#ifndef _UAPI_PARISC_PTRACE_H
5#define _UAPI_PARISC_PTRACE_H
6
7
8#include <linux/types.h>
9
10/* This struct defines the way the registers are stored on the
11 * stack during a system call.
12 *
13 * N.B. gdb/strace care about the size and offsets within this
14 * structure. If you change things, you may break object compatibility
15 * for those applications.
16 */
17
18struct pt_regs {
19 unsigned long gr[32]; /* PSW is in gr[0] */
20 __u64 fr[32];
21 unsigned long sr[ 8];
22 unsigned long iasq[2];
23 unsigned long iaoq[2];
24 unsigned long cr27;
25 unsigned long pad0; /* available for other uses */
26 unsigned long orig_r28;
27 unsigned long ksp;
28 unsigned long kpc;
29 unsigned long sar; /* CR11 */
30 unsigned long iir; /* CR19 */
31 unsigned long isr; /* CR20 */
32 unsigned long ior; /* CR21 */
33 unsigned long ipsw; /* CR22 */
34};
35
36/*
37 * The numbers chosen here are somewhat arbitrary but absolutely MUST
38 * not overlap with any of the number assigned in <linux/ptrace.h>.
39 *
40 * These ones are taken from IA-64 on the assumption that theirs are
41 * the most correct (and we also want to support PTRACE_SINGLEBLOCK
42 * since we have taken branch traps too)
43 */
44#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
45
46
47#endif /* _UAPI_PARISC_PTRACE_H */
diff --git a/arch/parisc/include/asm/resource.h b/arch/parisc/include/uapi/asm/resource.h
index 8b06343b62ed..8b06343b62ed 100644
--- a/arch/parisc/include/asm/resource.h
+++ b/arch/parisc/include/uapi/asm/resource.h
diff --git a/arch/parisc/include/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h
index 1e59ffd3bd1e..1e59ffd3bd1e 100644
--- a/arch/parisc/include/asm/sembuf.h
+++ b/arch/parisc/include/uapi/asm/sembuf.h
diff --git a/arch/parisc/include/asm/setup.h b/arch/parisc/include/uapi/asm/setup.h
index 7da2e5b8747e..7da2e5b8747e 100644
--- a/arch/parisc/include/asm/setup.h
+++ b/arch/parisc/include/uapi/asm/setup.h
diff --git a/arch/parisc/include/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h
index 0a3eada1863b..0a3eada1863b 100644
--- a/arch/parisc/include/asm/shmbuf.h
+++ b/arch/parisc/include/uapi/asm/shmbuf.h
diff --git a/arch/parisc/include/asm/sigcontext.h b/arch/parisc/include/uapi/asm/sigcontext.h
index 27ef31bb3b6e..27ef31bb3b6e 100644
--- a/arch/parisc/include/asm/sigcontext.h
+++ b/arch/parisc/include/uapi/asm/sigcontext.h
diff --git a/arch/parisc/include/asm/siginfo.h b/arch/parisc/include/uapi/asm/siginfo.h
index d7034728f377..d7034728f377 100644
--- a/arch/parisc/include/asm/siginfo.h
+++ b/arch/parisc/include/uapi/asm/siginfo.h
diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h
new file mode 100644
index 000000000000..b1ddaa243376
--- /dev/null
+++ b/arch/parisc/include/uapi/asm/signal.h
@@ -0,0 +1,118 @@
1#ifndef _UAPI_ASM_PARISC_SIGNAL_H
2#define _UAPI_ASM_PARISC_SIGNAL_H
3
4#define SIGHUP 1
5#define SIGINT 2
6#define SIGQUIT 3
7#define SIGILL 4
8#define SIGTRAP 5
9#define SIGABRT 6
10#define SIGIOT 6
11#define SIGEMT 7
12#define SIGFPE 8
13#define SIGKILL 9
14#define SIGBUS 10
15#define SIGSEGV 11
16#define SIGSYS 12 /* Linux doesn't use this */
17#define SIGPIPE 13
18#define SIGALRM 14
19#define SIGTERM 15
20#define SIGUSR1 16
21#define SIGUSR2 17
22#define SIGCHLD 18
23#define SIGPWR 19
24#define SIGVTALRM 20
25#define SIGPROF 21
26#define SIGIO 22
27#define SIGPOLL SIGIO
28#define SIGWINCH 23
29#define SIGSTOP 24
30#define SIGTSTP 25
31#define SIGCONT 26
32#define SIGTTIN 27
33#define SIGTTOU 28
34#define SIGURG 29
35#define SIGLOST 30 /* Linux doesn't use this either */
36#define SIGUNUSED 31
37#define SIGRESERVE SIGUNUSED
38
39#define SIGXCPU 33
40#define SIGXFSZ 34
41#define SIGSTKFLT 36
42
43/* These should not be considered constants from userland. */
44#define SIGRTMIN 37
45#define SIGRTMAX _NSIG /* it's 44 under HP/UX */
46
47/*
48 * SA_FLAGS values:
49 *
50 * SA_ONSTACK indicates that a registered stack_t will be used.
51 * SA_RESTART flag to get restarting signals (which were the default long ago)
52 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
53 * SA_RESETHAND clears the handler when the signal is delivered.
54 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
55 * SA_NODEFER prevents the current signal from being masked in the handler.
56 *
57 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
58 * Unix names RESETHAND and NODEFER respectively.
59 */
60#define SA_ONSTACK 0x00000001
61#define SA_RESETHAND 0x00000004
62#define SA_NOCLDSTOP 0x00000008
63#define SA_SIGINFO 0x00000010
64#define SA_NODEFER 0x00000020
65#define SA_RESTART 0x00000040
66#define SA_NOCLDWAIT 0x00000080
67#define _SA_SIGGFAULT 0x00000100 /* HPUX */
68
69#define SA_NOMASK SA_NODEFER
70#define SA_ONESHOT SA_RESETHAND
71
72#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
73
74/*
75 * sigaltstack controls
76 */
77#define SS_ONSTACK 1
78#define SS_DISABLE 2
79
80#define MINSIGSTKSZ 2048
81#define SIGSTKSZ 8192
82
83
84#define SIG_BLOCK 0 /* for blocking signals */
85#define SIG_UNBLOCK 1 /* for unblocking signals */
86#define SIG_SETMASK 2 /* for setting the signal mask */
87
88#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
89#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
90#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
91
92# ifndef __ASSEMBLY__
93
94# include <linux/types.h>
95
96/* Avoid too many header ordering problems. */
97struct siginfo;
98
99/* Type of a signal handler. */
100#ifdef CONFIG_64BIT
101/* function pointers on 64-bit parisc are pointers to little structs and the
102 * compiler doesn't support code which changes or tests the address of
103 * the function in the little struct. This is really ugly -PB
104 */
105typedef char __user *__sighandler_t;
106#else
107typedef void __signalfn_t(int);
108typedef __signalfn_t __user *__sighandler_t;
109#endif
110
111typedef struct sigaltstack {
112 void __user *ss_sp;
113 int ss_flags;
114 size_t ss_size;
115} stack_t;
116
117#endif /* !__ASSEMBLY */
118#endif /* _UAPI_ASM_PARISC_SIGNAL_H */
diff --git a/arch/parisc/include/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index 1b52c2c31a7a..1b52c2c31a7a 100644
--- a/arch/parisc/include/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
diff --git a/arch/parisc/include/asm/sockios.h b/arch/parisc/include/uapi/asm/sockios.h
index dabfbc7483f6..dabfbc7483f6 100644
--- a/arch/parisc/include/asm/sockios.h
+++ b/arch/parisc/include/uapi/asm/sockios.h
diff --git a/arch/parisc/include/asm/stat.h b/arch/parisc/include/uapi/asm/stat.h
index d76fbda5d62c..d76fbda5d62c 100644
--- a/arch/parisc/include/asm/stat.h
+++ b/arch/parisc/include/uapi/asm/stat.h
diff --git a/arch/parisc/include/asm/statfs.h b/arch/parisc/include/uapi/asm/statfs.h
index 324bea905dc6..324bea905dc6 100644
--- a/arch/parisc/include/asm/statfs.h
+++ b/arch/parisc/include/uapi/asm/statfs.h
diff --git a/arch/parisc/include/asm/swab.h b/arch/parisc/include/uapi/asm/swab.h
index e78403b129ef..e78403b129ef 100644
--- a/arch/parisc/include/asm/swab.h
+++ b/arch/parisc/include/uapi/asm/swab.h
diff --git a/arch/parisc/include/asm/termbits.h b/arch/parisc/include/uapi/asm/termbits.h
index d1ab92177a5c..d1ab92177a5c 100644
--- a/arch/parisc/include/asm/termbits.h
+++ b/arch/parisc/include/uapi/asm/termbits.h
diff --git a/arch/parisc/include/uapi/asm/termios.h b/arch/parisc/include/uapi/asm/termios.h
new file mode 100644
index 000000000000..f3377395070d
--- /dev/null
+++ b/arch/parisc/include/uapi/asm/termios.h
@@ -0,0 +1,43 @@
1#ifndef _UAPI_PARISC_TERMIOS_H
2#define _UAPI_PARISC_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42
43#endif /* _UAPI_PARISC_TERMIOS_H */
diff --git a/arch/parisc/include/asm/types.h b/arch/parisc/include/uapi/asm/types.h
index 8866f9bbdeaf..8866f9bbdeaf 100644
--- a/arch/parisc/include/asm/types.h
+++ b/arch/parisc/include/uapi/asm/types.h
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..e178f30f2ccc
--- /dev/null
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -0,0 +1,837 @@
1#ifndef _UAPI_ASM_PARISC_UNISTD_H_
2#define _UAPI_ASM_PARISC_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8/*
9 * HP-UX system calls get their native numbers for binary compatibility.
10 */
11
12#define __NR_HPUX_exit 1
13#define __NR_HPUX_fork 2
14#define __NR_HPUX_read 3
15#define __NR_HPUX_write 4
16#define __NR_HPUX_open 5
17#define __NR_HPUX_close 6
18#define __NR_HPUX_wait 7
19#define __NR_HPUX_creat 8
20#define __NR_HPUX_link 9
21#define __NR_HPUX_unlink 10
22#define __NR_HPUX_execv 11
23#define __NR_HPUX_chdir 12
24#define __NR_HPUX_time 13
25#define __NR_HPUX_mknod 14
26#define __NR_HPUX_chmod 15
27#define __NR_HPUX_chown 16
28#define __NR_HPUX_break 17
29#define __NR_HPUX_lchmod 18
30#define __NR_HPUX_lseek 19
31#define __NR_HPUX_getpid 20
32#define __NR_HPUX_mount 21
33#define __NR_HPUX_umount 22
34#define __NR_HPUX_setuid 23
35#define __NR_HPUX_getuid 24
36#define __NR_HPUX_stime 25
37#define __NR_HPUX_ptrace 26
38#define __NR_HPUX_alarm 27
39#define __NR_HPUX_oldfstat 28
40#define __NR_HPUX_pause 29
41#define __NR_HPUX_utime 30
42#define __NR_HPUX_stty 31
43#define __NR_HPUX_gtty 32
44#define __NR_HPUX_access 33
45#define __NR_HPUX_nice 34
46#define __NR_HPUX_ftime 35
47#define __NR_HPUX_sync 36
48#define __NR_HPUX_kill 37
49#define __NR_HPUX_stat 38
50#define __NR_HPUX_setpgrp3 39
51#define __NR_HPUX_lstat 40
52#define __NR_HPUX_dup 41
53#define __NR_HPUX_pipe 42
54#define __NR_HPUX_times 43
55#define __NR_HPUX_profil 44
56#define __NR_HPUX_ki_call 45
57#define __NR_HPUX_setgid 46
58#define __NR_HPUX_getgid 47
59#define __NR_HPUX_sigsys 48
60#define __NR_HPUX_reserved1 49
61#define __NR_HPUX_reserved2 50
62#define __NR_HPUX_acct 51
63#define __NR_HPUX_set_userthreadid 52
64#define __NR_HPUX_oldlock 53
65#define __NR_HPUX_ioctl 54
66#define __NR_HPUX_reboot 55
67#define __NR_HPUX_symlink 56
68#define __NR_HPUX_utssys 57
69#define __NR_HPUX_readlink 58
70#define __NR_HPUX_execve 59
71#define __NR_HPUX_umask 60
72#define __NR_HPUX_chroot 61
73#define __NR_HPUX_fcntl 62
74#define __NR_HPUX_ulimit 63
75#define __NR_HPUX_getpagesize 64
76#define __NR_HPUX_mremap 65
77#define __NR_HPUX_vfork 66
78#define __NR_HPUX_vread 67
79#define __NR_HPUX_vwrite 68
80#define __NR_HPUX_sbrk 69
81#define __NR_HPUX_sstk 70
82#define __NR_HPUX_mmap 71
83#define __NR_HPUX_vadvise 72
84#define __NR_HPUX_munmap 73
85#define __NR_HPUX_mprotect 74
86#define __NR_HPUX_madvise 75
87#define __NR_HPUX_vhangup 76
88#define __NR_HPUX_swapoff 77
89#define __NR_HPUX_mincore 78
90#define __NR_HPUX_getgroups 79
91#define __NR_HPUX_setgroups 80
92#define __NR_HPUX_getpgrp2 81
93#define __NR_HPUX_setpgrp2 82
94#define __NR_HPUX_setitimer 83
95#define __NR_HPUX_wait3 84
96#define __NR_HPUX_swapon 85
97#define __NR_HPUX_getitimer 86
98#define __NR_HPUX_gethostname42 87
99#define __NR_HPUX_sethostname42 88
100#define __NR_HPUX_getdtablesize 89
101#define __NR_HPUX_dup2 90
102#define __NR_HPUX_getdopt 91
103#define __NR_HPUX_fstat 92
104#define __NR_HPUX_select 93
105#define __NR_HPUX_setdopt 94
106#define __NR_HPUX_fsync 95
107#define __NR_HPUX_setpriority 96
108#define __NR_HPUX_socket_old 97
109#define __NR_HPUX_connect_old 98
110#define __NR_HPUX_accept_old 99
111#define __NR_HPUX_getpriority 100
112#define __NR_HPUX_send_old 101
113#define __NR_HPUX_recv_old 102
114#define __NR_HPUX_socketaddr_old 103
115#define __NR_HPUX_bind_old 104
116#define __NR_HPUX_setsockopt_old 105
117#define __NR_HPUX_listen_old 106
118#define __NR_HPUX_vtimes_old 107
119#define __NR_HPUX_sigvector 108
120#define __NR_HPUX_sigblock 109
121#define __NR_HPUX_siggetmask 110
122#define __NR_HPUX_sigpause 111
123#define __NR_HPUX_sigstack 112
124#define __NR_HPUX_recvmsg_old 113
125#define __NR_HPUX_sendmsg_old 114
126#define __NR_HPUX_vtrace_old 115
127#define __NR_HPUX_gettimeofday 116
128#define __NR_HPUX_getrusage 117
129#define __NR_HPUX_getsockopt_old 118
130#define __NR_HPUX_resuba_old 119
131#define __NR_HPUX_readv 120
132#define __NR_HPUX_writev 121
133#define __NR_HPUX_settimeofday 122
134#define __NR_HPUX_fchown 123
135#define __NR_HPUX_fchmod 124
136#define __NR_HPUX_recvfrom_old 125
137#define __NR_HPUX_setresuid 126
138#define __NR_HPUX_setresgid 127
139#define __NR_HPUX_rename 128
140#define __NR_HPUX_truncate 129
141#define __NR_HPUX_ftruncate 130
142#define __NR_HPUX_flock_old 131
143#define __NR_HPUX_sysconf 132
144#define __NR_HPUX_sendto_old 133
145#define __NR_HPUX_shutdown_old 134
146#define __NR_HPUX_socketpair_old 135
147#define __NR_HPUX_mkdir 136
148#define __NR_HPUX_rmdir 137
149#define __NR_HPUX_utimes_old 138
150#define __NR_HPUX_sigcleanup_old 139
151#define __NR_HPUX_setcore 140
152#define __NR_HPUX_getpeername_old 141
153#define __NR_HPUX_gethostid 142
154#define __NR_HPUX_sethostid 143
155#define __NR_HPUX_getrlimit 144
156#define __NR_HPUX_setrlimit 145
157#define __NR_HPUX_killpg_old 146
158#define __NR_HPUX_cachectl 147
159#define __NR_HPUX_quotactl 148
160#define __NR_HPUX_get_sysinfo 149
161#define __NR_HPUX_getsockname_old 150
162#define __NR_HPUX_privgrp 151
163#define __NR_HPUX_rtprio 152
164#define __NR_HPUX_plock 153
165#define __NR_HPUX_reserved3 154
166#define __NR_HPUX_lockf 155
167#define __NR_HPUX_semget 156
168#define __NR_HPUX_osemctl 157
169#define __NR_HPUX_semop 158
170#define __NR_HPUX_msgget 159
171#define __NR_HPUX_omsgctl 160
172#define __NR_HPUX_msgsnd 161
173#define __NR_HPUX_msgrecv 162
174#define __NR_HPUX_shmget 163
175#define __NR_HPUX_oshmctl 164
176#define __NR_HPUX_shmat 165
177#define __NR_HPUX_shmdt 166
178#define __NR_HPUX_m68020_advise 167
179/* [168,189] are for Discless/DUX */
180#define __NR_HPUX_csp 168
181#define __NR_HPUX_cluster 169
182#define __NR_HPUX_mkrnod 170
183#define __NR_HPUX_test 171
184#define __NR_HPUX_unsp_open 172
185#define __NR_HPUX_reserved4 173
186#define __NR_HPUX_getcontext_old 174
187#define __NR_HPUX_osetcontext 175
188#define __NR_HPUX_bigio 176
189#define __NR_HPUX_pipenode 177
190#define __NR_HPUX_lsync 178
191#define __NR_HPUX_getmachineid 179
192#define __NR_HPUX_cnodeid 180
193#define __NR_HPUX_cnodes 181
194#define __NR_HPUX_swapclients 182
195#define __NR_HPUX_rmt_process 183
196#define __NR_HPUX_dskless_stats 184
197#define __NR_HPUX_sigprocmask 185
198#define __NR_HPUX_sigpending 186
199#define __NR_HPUX_sigsuspend 187
200#define __NR_HPUX_sigaction 188
201#define __NR_HPUX_reserved5 189
202#define __NR_HPUX_nfssvc 190
203#define __NR_HPUX_getfh 191
204#define __NR_HPUX_getdomainname 192
205#define __NR_HPUX_setdomainname 193
206#define __NR_HPUX_async_daemon 194
207#define __NR_HPUX_getdirentries 195
208#define __NR_HPUX_statfs 196
209#define __NR_HPUX_fstatfs 197
210#define __NR_HPUX_vfsmount 198
211#define __NR_HPUX_reserved6 199
212#define __NR_HPUX_waitpid 200
213/* 201 - 223 missing */
214#define __NR_HPUX_sigsetreturn 224
215#define __NR_HPUX_sigsetstatemask 225
216/* 226 missing */
217#define __NR_HPUX_cs 227
218#define __NR_HPUX_cds 228
219#define __NR_HPUX_set_no_trunc 229
220#define __NR_HPUX_pathconf 230
221#define __NR_HPUX_fpathconf 231
222/* 232, 233 missing */
223#define __NR_HPUX_nfs_fcntl 234
224#define __NR_HPUX_ogetacl 235
225#define __NR_HPUX_ofgetacl 236
226#define __NR_HPUX_osetacl 237
227#define __NR_HPUX_ofsetacl 238
228#define __NR_HPUX_pstat 239
229#define __NR_HPUX_getaudid 240
230#define __NR_HPUX_setaudid 241
231#define __NR_HPUX_getaudproc 242
232#define __NR_HPUX_setaudproc 243
233#define __NR_HPUX_getevent 244
234#define __NR_HPUX_setevent 245
235#define __NR_HPUX_audwrite 246
236#define __NR_HPUX_audswitch 247
237#define __NR_HPUX_audctl 248
238#define __NR_HPUX_ogetaccess 249
239#define __NR_HPUX_fsctl 250
240/* 251 - 258 missing */
241#define __NR_HPUX_swapfs 259
242#define __NR_HPUX_fss 260
243/* 261 - 266 missing */
244#define __NR_HPUX_tsync 267
245#define __NR_HPUX_getnumfds 268
246#define __NR_HPUX_poll 269
247#define __NR_HPUX_getmsg 270
248#define __NR_HPUX_putmsg 271
249#define __NR_HPUX_fchdir 272
250#define __NR_HPUX_getmount_cnt 273
251#define __NR_HPUX_getmount_entry 274
252#define __NR_HPUX_accept 275
253#define __NR_HPUX_bind 276
254#define __NR_HPUX_connect 277
255#define __NR_HPUX_getpeername 278
256#define __NR_HPUX_getsockname 279
257#define __NR_HPUX_getsockopt 280
258#define __NR_HPUX_listen 281
259#define __NR_HPUX_recv 282
260#define __NR_HPUX_recvfrom 283
261#define __NR_HPUX_recvmsg 284
262#define __NR_HPUX_send 285
263#define __NR_HPUX_sendmsg 286
264#define __NR_HPUX_sendto 287
265#define __NR_HPUX_setsockopt 288
266#define __NR_HPUX_shutdown 289
267#define __NR_HPUX_socket 290
268#define __NR_HPUX_socketpair 291
269#define __NR_HPUX_proc_open 292
270#define __NR_HPUX_proc_close 293
271#define __NR_HPUX_proc_send 294
272#define __NR_HPUX_proc_recv 295
273#define __NR_HPUX_proc_sendrecv 296
274#define __NR_HPUX_proc_syscall 297
275/* 298 - 311 missing */
276#define __NR_HPUX_semctl 312
277#define __NR_HPUX_msgctl 313
278#define __NR_HPUX_shmctl 314
279#define __NR_HPUX_mpctl 315
280#define __NR_HPUX_exportfs 316
281#define __NR_HPUX_getpmsg 317
282#define __NR_HPUX_putpmsg 318
283/* 319 missing */
284#define __NR_HPUX_msync 320
285#define __NR_HPUX_msleep 321
286#define __NR_HPUX_mwakeup 322
287#define __NR_HPUX_msem_init 323
288#define __NR_HPUX_msem_remove 324
289#define __NR_HPUX_adjtime 325
290#define __NR_HPUX_kload 326
291#define __NR_HPUX_fattach 327
292#define __NR_HPUX_fdetach 328
293#define __NR_HPUX_serialize 329
294#define __NR_HPUX_statvfs 330
295#define __NR_HPUX_fstatvfs 331
296#define __NR_HPUX_lchown 332
297#define __NR_HPUX_getsid 333
298#define __NR_HPUX_sysfs 334
299/* 335, 336 missing */
300#define __NR_HPUX_sched_setparam 337
301#define __NR_HPUX_sched_getparam 338
302#define __NR_HPUX_sched_setscheduler 339
303#define __NR_HPUX_sched_getscheduler 340
304#define __NR_HPUX_sched_yield 341
305#define __NR_HPUX_sched_get_priority_max 342
306#define __NR_HPUX_sched_get_priority_min 343
307#define __NR_HPUX_sched_rr_get_interval 344
308#define __NR_HPUX_clock_settime 345
309#define __NR_HPUX_clock_gettime 346
310#define __NR_HPUX_clock_getres 347
311#define __NR_HPUX_timer_create 348
312#define __NR_HPUX_timer_delete 349
313#define __NR_HPUX_timer_settime 350
314#define __NR_HPUX_timer_gettime 351
315#define __NR_HPUX_timer_getoverrun 352
316#define __NR_HPUX_nanosleep 353
317#define __NR_HPUX_toolbox 354
318/* 355 missing */
319#define __NR_HPUX_getdents 356
320#define __NR_HPUX_getcontext 357
321#define __NR_HPUX_sysinfo 358
322#define __NR_HPUX_fcntl64 359
323#define __NR_HPUX_ftruncate64 360
324#define __NR_HPUX_fstat64 361
325#define __NR_HPUX_getdirentries64 362
326#define __NR_HPUX_getrlimit64 363
327#define __NR_HPUX_lockf64 364
328#define __NR_HPUX_lseek64 365
329#define __NR_HPUX_lstat64 366
330#define __NR_HPUX_mmap64 367
331#define __NR_HPUX_setrlimit64 368
332#define __NR_HPUX_stat64 369
333#define __NR_HPUX_truncate64 370
334#define __NR_HPUX_ulimit64 371
335#define __NR_HPUX_pread 372
336#define __NR_HPUX_preadv 373
337#define __NR_HPUX_pwrite 374
338#define __NR_HPUX_pwritev 375
339#define __NR_HPUX_pread64 376
340#define __NR_HPUX_preadv64 377
341#define __NR_HPUX_pwrite64 378
342#define __NR_HPUX_pwritev64 379
343#define __NR_HPUX_setcontext 380
344#define __NR_HPUX_sigaltstack 381
345#define __NR_HPUX_waitid 382
346#define __NR_HPUX_setpgrp 383
347#define __NR_HPUX_recvmsg2 384
348#define __NR_HPUX_sendmsg2 385
349#define __NR_HPUX_socket2 386
350#define __NR_HPUX_socketpair2 387
351#define __NR_HPUX_setregid 388
352#define __NR_HPUX_lwp_create 389
353#define __NR_HPUX_lwp_terminate 390
354#define __NR_HPUX_lwp_wait 391
355#define __NR_HPUX_lwp_suspend 392
356#define __NR_HPUX_lwp_resume 393
357/* 394 missing */
358#define __NR_HPUX_lwp_abort_syscall 395
359#define __NR_HPUX_lwp_info 396
360#define __NR_HPUX_lwp_kill 397
361#define __NR_HPUX_ksleep 398
362#define __NR_HPUX_kwakeup 399
363/* 400 missing */
364#define __NR_HPUX_pstat_getlwp 401
365#define __NR_HPUX_lwp_exit 402
366#define __NR_HPUX_lwp_continue 403
367#define __NR_HPUX_getacl 404
368#define __NR_HPUX_fgetacl 405
369#define __NR_HPUX_setacl 406
370#define __NR_HPUX_fsetacl 407
371#define __NR_HPUX_getaccess 408
372#define __NR_HPUX_lwp_mutex_init 409
373#define __NR_HPUX_lwp_mutex_lock_sys 410
374#define __NR_HPUX_lwp_mutex_unlock 411
375#define __NR_HPUX_lwp_cond_init 412
376#define __NR_HPUX_lwp_cond_signal 413
377#define __NR_HPUX_lwp_cond_broadcast 414
378#define __NR_HPUX_lwp_cond_wait_sys 415
379#define __NR_HPUX_lwp_getscheduler 416
380#define __NR_HPUX_lwp_setscheduler 417
381#define __NR_HPUX_lwp_getstate 418
382#define __NR_HPUX_lwp_setstate 419
383#define __NR_HPUX_lwp_detach 420
384#define __NR_HPUX_mlock 421
385#define __NR_HPUX_munlock 422
386#define __NR_HPUX_mlockall 423
387#define __NR_HPUX_munlockall 424
388#define __NR_HPUX_shm_open 425
389#define __NR_HPUX_shm_unlink 426
390#define __NR_HPUX_sigqueue 427
391#define __NR_HPUX_sigwaitinfo 428
392#define __NR_HPUX_sigtimedwait 429
393#define __NR_HPUX_sigwait 430
394#define __NR_HPUX_aio_read 431
395#define __NR_HPUX_aio_write 432
396#define __NR_HPUX_lio_listio 433
397#define __NR_HPUX_aio_error 434
398#define __NR_HPUX_aio_return 435
399#define __NR_HPUX_aio_cancel 436
400#define __NR_HPUX_aio_suspend 437
401#define __NR_HPUX_aio_fsync 438
402#define __NR_HPUX_mq_open 439
403#define __NR_HPUX_mq_close 440
404#define __NR_HPUX_mq_unlink 441
405#define __NR_HPUX_mq_send 442
406#define __NR_HPUX_mq_receive 443
407#define __NR_HPUX_mq_notify 444
408#define __NR_HPUX_mq_setattr 445
409#define __NR_HPUX_mq_getattr 446
410#define __NR_HPUX_ksem_open 447
411#define __NR_HPUX_ksem_unlink 448
412#define __NR_HPUX_ksem_close 449
413#define __NR_HPUX_ksem_post 450
414#define __NR_HPUX_ksem_wait 451
415#define __NR_HPUX_ksem_read 452
416#define __NR_HPUX_ksem_trywait 453
417#define __NR_HPUX_lwp_rwlock_init 454
418#define __NR_HPUX_lwp_rwlock_destroy 455
419#define __NR_HPUX_lwp_rwlock_rdlock_sys 456
420#define __NR_HPUX_lwp_rwlock_wrlock_sys 457
421#define __NR_HPUX_lwp_rwlock_tryrdlock 458
422#define __NR_HPUX_lwp_rwlock_trywrlock 459
423#define __NR_HPUX_lwp_rwlock_unlock 460
424#define __NR_HPUX_ttrace 461
425#define __NR_HPUX_ttrace_wait 462
426#define __NR_HPUX_lf_wire_mem 463
427#define __NR_HPUX_lf_unwire_mem 464
428#define __NR_HPUX_lf_send_pin_map 465
429#define __NR_HPUX_lf_free_buf 466
430#define __NR_HPUX_lf_wait_nq 467
431#define __NR_HPUX_lf_wakeup_conn_q 468
432#define __NR_HPUX_lf_unused 469
433#define __NR_HPUX_lwp_sema_init 470
434#define __NR_HPUX_lwp_sema_post 471
435#define __NR_HPUX_lwp_sema_wait 472
436#define __NR_HPUX_lwp_sema_trywait 473
437#define __NR_HPUX_lwp_sema_destroy 474
438#define __NR_HPUX_statvfs64 475
439#define __NR_HPUX_fstatvfs64 476
440#define __NR_HPUX_msh_register 477
441#define __NR_HPUX_ptrace64 478
442#define __NR_HPUX_sendfile 479
443#define __NR_HPUX_sendpath 480
444#define __NR_HPUX_sendfile64 481
445#define __NR_HPUX_sendpath64 482
446#define __NR_HPUX_modload 483
447#define __NR_HPUX_moduload 484
448#define __NR_HPUX_modpath 485
449#define __NR_HPUX_getksym 486
450#define __NR_HPUX_modadm 487
451#define __NR_HPUX_modstat 488
452#define __NR_HPUX_lwp_detached_exit 489
453#define __NR_HPUX_crashconf 490
454#define __NR_HPUX_siginhibit 491
455#define __NR_HPUX_sigenable 492
456#define __NR_HPUX_spuctl 493
457#define __NR_HPUX_zerokernelsum 494
458#define __NR_HPUX_nfs_kstat 495
459#define __NR_HPUX_aio_read64 496
460#define __NR_HPUX_aio_write64 497
461#define __NR_HPUX_aio_error64 498
462#define __NR_HPUX_aio_return64 499
463#define __NR_HPUX_aio_cancel64 500
464#define __NR_HPUX_aio_suspend64 501
465#define __NR_HPUX_aio_fsync64 502
466#define __NR_HPUX_lio_listio64 503
467#define __NR_HPUX_recv2 504
468#define __NR_HPUX_recvfrom2 505
469#define __NR_HPUX_send2 506
470#define __NR_HPUX_sendto2 507
471#define __NR_HPUX_acl 508
472#define __NR_HPUX___cnx_p2p_ctl 509
473#define __NR_HPUX___cnx_gsched_ctl 510
474#define __NR_HPUX___cnx_pmon_ctl 511
475
476#define __NR_HPUX_syscalls 512
477
478/*
479 * Linux system call numbers.
480 *
481 * Cary Coutant says that we should just use another syscall gateway
482 * page to avoid clashing with the HPUX space, and I think he's right:
483 * it will would keep a branch out of our syscall entry path, at the
484 * very least. If we decide to change it later, we can ``just'' tweak
485 * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be
486 * 1024 or something. Oh, and recompile libc. =)
487 *
488 * 64-bit HPUX binaries get the syscall gateway address passed in a register
489 * from the kernel at startup, which seems a sane strategy.
490 */
491
492#define __NR_Linux 0
493#define __NR_restart_syscall (__NR_Linux + 0)
494#define __NR_exit (__NR_Linux + 1)
495#define __NR_fork (__NR_Linux + 2)
496#define __NR_read (__NR_Linux + 3)
497#define __NR_write (__NR_Linux + 4)
498#define __NR_open (__NR_Linux + 5)
499#define __NR_close (__NR_Linux + 6)
500#define __NR_waitpid (__NR_Linux + 7)
501#define __NR_creat (__NR_Linux + 8)
502#define __NR_link (__NR_Linux + 9)
503#define __NR_unlink (__NR_Linux + 10)
504#define __NR_execve (__NR_Linux + 11)
505#define __NR_chdir (__NR_Linux + 12)
506#define __NR_time (__NR_Linux + 13)
507#define __NR_mknod (__NR_Linux + 14)
508#define __NR_chmod (__NR_Linux + 15)
509#define __NR_lchown (__NR_Linux + 16)
510#define __NR_socket (__NR_Linux + 17)
511#define __NR_stat (__NR_Linux + 18)
512#define __NR_lseek (__NR_Linux + 19)
513#define __NR_getpid (__NR_Linux + 20)
514#define __NR_mount (__NR_Linux + 21)
515#define __NR_bind (__NR_Linux + 22)
516#define __NR_setuid (__NR_Linux + 23)
517#define __NR_getuid (__NR_Linux + 24)
518#define __NR_stime (__NR_Linux + 25)
519#define __NR_ptrace (__NR_Linux + 26)
520#define __NR_alarm (__NR_Linux + 27)
521#define __NR_fstat (__NR_Linux + 28)
522#define __NR_pause (__NR_Linux + 29)
523#define __NR_utime (__NR_Linux + 30)
524#define __NR_connect (__NR_Linux + 31)
525#define __NR_listen (__NR_Linux + 32)
526#define __NR_access (__NR_Linux + 33)
527#define __NR_nice (__NR_Linux + 34)
528#define __NR_accept (__NR_Linux + 35)
529#define __NR_sync (__NR_Linux + 36)
530#define __NR_kill (__NR_Linux + 37)
531#define __NR_rename (__NR_Linux + 38)
532#define __NR_mkdir (__NR_Linux + 39)
533#define __NR_rmdir (__NR_Linux + 40)
534#define __NR_dup (__NR_Linux + 41)
535#define __NR_pipe (__NR_Linux + 42)
536#define __NR_times (__NR_Linux + 43)
537#define __NR_getsockname (__NR_Linux + 44)
538#define __NR_brk (__NR_Linux + 45)
539#define __NR_setgid (__NR_Linux + 46)
540#define __NR_getgid (__NR_Linux + 47)
541#define __NR_signal (__NR_Linux + 48)
542#define __NR_geteuid (__NR_Linux + 49)
543#define __NR_getegid (__NR_Linux + 50)
544#define __NR_acct (__NR_Linux + 51)
545#define __NR_umount2 (__NR_Linux + 52)
546#define __NR_getpeername (__NR_Linux + 53)
547#define __NR_ioctl (__NR_Linux + 54)
548#define __NR_fcntl (__NR_Linux + 55)
549#define __NR_socketpair (__NR_Linux + 56)
550#define __NR_setpgid (__NR_Linux + 57)
551#define __NR_send (__NR_Linux + 58)
552#define __NR_uname (__NR_Linux + 59)
553#define __NR_umask (__NR_Linux + 60)
554#define __NR_chroot (__NR_Linux + 61)
555#define __NR_ustat (__NR_Linux + 62)
556#define __NR_dup2 (__NR_Linux + 63)
557#define __NR_getppid (__NR_Linux + 64)
558#define __NR_getpgrp (__NR_Linux + 65)
559#define __NR_setsid (__NR_Linux + 66)
560#define __NR_pivot_root (__NR_Linux + 67)
561#define __NR_sgetmask (__NR_Linux + 68)
562#define __NR_ssetmask (__NR_Linux + 69)
563#define __NR_setreuid (__NR_Linux + 70)
564#define __NR_setregid (__NR_Linux + 71)
565#define __NR_mincore (__NR_Linux + 72)
566#define __NR_sigpending (__NR_Linux + 73)
567#define __NR_sethostname (__NR_Linux + 74)
568#define __NR_setrlimit (__NR_Linux + 75)
569#define __NR_getrlimit (__NR_Linux + 76)
570#define __NR_getrusage (__NR_Linux + 77)
571#define __NR_gettimeofday (__NR_Linux + 78)
572#define __NR_settimeofday (__NR_Linux + 79)
573#define __NR_getgroups (__NR_Linux + 80)
574#define __NR_setgroups (__NR_Linux + 81)
575#define __NR_sendto (__NR_Linux + 82)
576#define __NR_symlink (__NR_Linux + 83)
577#define __NR_lstat (__NR_Linux + 84)
578#define __NR_readlink (__NR_Linux + 85)
579#define __NR_uselib (__NR_Linux + 86)
580#define __NR_swapon (__NR_Linux + 87)
581#define __NR_reboot (__NR_Linux + 88)
582#define __NR_mmap2 (__NR_Linux + 89)
583#define __NR_mmap (__NR_Linux + 90)
584#define __NR_munmap (__NR_Linux + 91)
585#define __NR_truncate (__NR_Linux + 92)
586#define __NR_ftruncate (__NR_Linux + 93)
587#define __NR_fchmod (__NR_Linux + 94)
588#define __NR_fchown (__NR_Linux + 95)
589#define __NR_getpriority (__NR_Linux + 96)
590#define __NR_setpriority (__NR_Linux + 97)
591#define __NR_recv (__NR_Linux + 98)
592#define __NR_statfs (__NR_Linux + 99)
593#define __NR_fstatfs (__NR_Linux + 100)
594#define __NR_stat64 (__NR_Linux + 101)
595/* #define __NR_socketcall (__NR_Linux + 102) */
596#define __NR_syslog (__NR_Linux + 103)
597#define __NR_setitimer (__NR_Linux + 104)
598#define __NR_getitimer (__NR_Linux + 105)
599#define __NR_capget (__NR_Linux + 106)
600#define __NR_capset (__NR_Linux + 107)
601#define __NR_pread64 (__NR_Linux + 108)
602#define __NR_pwrite64 (__NR_Linux + 109)
603#define __NR_getcwd (__NR_Linux + 110)
604#define __NR_vhangup (__NR_Linux + 111)
605#define __NR_fstat64 (__NR_Linux + 112)
606#define __NR_vfork (__NR_Linux + 113)
607#define __NR_wait4 (__NR_Linux + 114)
608#define __NR_swapoff (__NR_Linux + 115)
609#define __NR_sysinfo (__NR_Linux + 116)
610#define __NR_shutdown (__NR_Linux + 117)
611#define __NR_fsync (__NR_Linux + 118)
612#define __NR_madvise (__NR_Linux + 119)
613#define __NR_clone (__NR_Linux + 120)
614#define __NR_setdomainname (__NR_Linux + 121)
615#define __NR_sendfile (__NR_Linux + 122)
616#define __NR_recvfrom (__NR_Linux + 123)
617#define __NR_adjtimex (__NR_Linux + 124)
618#define __NR_mprotect (__NR_Linux + 125)
619#define __NR_sigprocmask (__NR_Linux + 126)
620#define __NR_create_module (__NR_Linux + 127)
621#define __NR_init_module (__NR_Linux + 128)
622#define __NR_delete_module (__NR_Linux + 129)
623#define __NR_get_kernel_syms (__NR_Linux + 130)
624#define __NR_quotactl (__NR_Linux + 131)
625#define __NR_getpgid (__NR_Linux + 132)
626#define __NR_fchdir (__NR_Linux + 133)
627#define __NR_bdflush (__NR_Linux + 134)
628#define __NR_sysfs (__NR_Linux + 135)
629#define __NR_personality (__NR_Linux + 136)
630#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */
631#define __NR_setfsuid (__NR_Linux + 138)
632#define __NR_setfsgid (__NR_Linux + 139)
633#define __NR__llseek (__NR_Linux + 140)
634#define __NR_getdents (__NR_Linux + 141)
635#define __NR__newselect (__NR_Linux + 142)
636#define __NR_flock (__NR_Linux + 143)
637#define __NR_msync (__NR_Linux + 144)
638#define __NR_readv (__NR_Linux + 145)
639#define __NR_writev (__NR_Linux + 146)
640#define __NR_getsid (__NR_Linux + 147)
641#define __NR_fdatasync (__NR_Linux + 148)
642#define __NR__sysctl (__NR_Linux + 149)
643#define __NR_mlock (__NR_Linux + 150)
644#define __NR_munlock (__NR_Linux + 151)
645#define __NR_mlockall (__NR_Linux + 152)
646#define __NR_munlockall (__NR_Linux + 153)
647#define __NR_sched_setparam (__NR_Linux + 154)
648#define __NR_sched_getparam (__NR_Linux + 155)
649#define __NR_sched_setscheduler (__NR_Linux + 156)
650#define __NR_sched_getscheduler (__NR_Linux + 157)
651#define __NR_sched_yield (__NR_Linux + 158)
652#define __NR_sched_get_priority_max (__NR_Linux + 159)
653#define __NR_sched_get_priority_min (__NR_Linux + 160)
654#define __NR_sched_rr_get_interval (__NR_Linux + 161)
655#define __NR_nanosleep (__NR_Linux + 162)
656#define __NR_mremap (__NR_Linux + 163)
657#define __NR_setresuid (__NR_Linux + 164)
658#define __NR_getresuid (__NR_Linux + 165)
659#define __NR_sigaltstack (__NR_Linux + 166)
660#define __NR_query_module (__NR_Linux + 167)
661#define __NR_poll (__NR_Linux + 168)
662#define __NR_nfsservctl (__NR_Linux + 169)
663#define __NR_setresgid (__NR_Linux + 170)
664#define __NR_getresgid (__NR_Linux + 171)
665#define __NR_prctl (__NR_Linux + 172)
666#define __NR_rt_sigreturn (__NR_Linux + 173)
667#define __NR_rt_sigaction (__NR_Linux + 174)
668#define __NR_rt_sigprocmask (__NR_Linux + 175)
669#define __NR_rt_sigpending (__NR_Linux + 176)
670#define __NR_rt_sigtimedwait (__NR_Linux + 177)
671#define __NR_rt_sigqueueinfo (__NR_Linux + 178)
672#define __NR_rt_sigsuspend (__NR_Linux + 179)
673#define __NR_chown (__NR_Linux + 180)
674#define __NR_setsockopt (__NR_Linux + 181)
675#define __NR_getsockopt (__NR_Linux + 182)
676#define __NR_sendmsg (__NR_Linux + 183)
677#define __NR_recvmsg (__NR_Linux + 184)
678#define __NR_semop (__NR_Linux + 185)
679#define __NR_semget (__NR_Linux + 186)
680#define __NR_semctl (__NR_Linux + 187)
681#define __NR_msgsnd (__NR_Linux + 188)
682#define __NR_msgrcv (__NR_Linux + 189)
683#define __NR_msgget (__NR_Linux + 190)
684#define __NR_msgctl (__NR_Linux + 191)
685#define __NR_shmat (__NR_Linux + 192)
686#define __NR_shmdt (__NR_Linux + 193)
687#define __NR_shmget (__NR_Linux + 194)
688#define __NR_shmctl (__NR_Linux + 195)
689
690#define __NR_getpmsg (__NR_Linux + 196) /* Somebody *wants* streams? */
691#define __NR_putpmsg (__NR_Linux + 197)
692
693#define __NR_lstat64 (__NR_Linux + 198)
694#define __NR_truncate64 (__NR_Linux + 199)
695#define __NR_ftruncate64 (__NR_Linux + 200)
696#define __NR_getdents64 (__NR_Linux + 201)
697#define __NR_fcntl64 (__NR_Linux + 202)
698#define __NR_attrctl (__NR_Linux + 203)
699#define __NR_acl_get (__NR_Linux + 204)
700#define __NR_acl_set (__NR_Linux + 205)
701#define __NR_gettid (__NR_Linux + 206)
702#define __NR_readahead (__NR_Linux + 207)
703#define __NR_tkill (__NR_Linux + 208)
704#define __NR_sendfile64 (__NR_Linux + 209)
705#define __NR_futex (__NR_Linux + 210)
706#define __NR_sched_setaffinity (__NR_Linux + 211)
707#define __NR_sched_getaffinity (__NR_Linux + 212)
708#define __NR_set_thread_area (__NR_Linux + 213)
709#define __NR_get_thread_area (__NR_Linux + 214)
710#define __NR_io_setup (__NR_Linux + 215)
711#define __NR_io_destroy (__NR_Linux + 216)
712#define __NR_io_getevents (__NR_Linux + 217)
713#define __NR_io_submit (__NR_Linux + 218)
714#define __NR_io_cancel (__NR_Linux + 219)
715#define __NR_alloc_hugepages (__NR_Linux + 220)
716#define __NR_free_hugepages (__NR_Linux + 221)
717#define __NR_exit_group (__NR_Linux + 222)
718#define __NR_lookup_dcookie (__NR_Linux + 223)
719#define __NR_epoll_create (__NR_Linux + 224)
720#define __NR_epoll_ctl (__NR_Linux + 225)
721#define __NR_epoll_wait (__NR_Linux + 226)
722#define __NR_remap_file_pages (__NR_Linux + 227)
723#define __NR_semtimedop (__NR_Linux + 228)
724#define __NR_mq_open (__NR_Linux + 229)
725#define __NR_mq_unlink (__NR_Linux + 230)
726#define __NR_mq_timedsend (__NR_Linux + 231)
727#define __NR_mq_timedreceive (__NR_Linux + 232)
728#define __NR_mq_notify (__NR_Linux + 233)
729#define __NR_mq_getsetattr (__NR_Linux + 234)
730#define __NR_waitid (__NR_Linux + 235)
731#define __NR_fadvise64_64 (__NR_Linux + 236)
732#define __NR_set_tid_address (__NR_Linux + 237)
733#define __NR_setxattr (__NR_Linux + 238)
734#define __NR_lsetxattr (__NR_Linux + 239)
735#define __NR_fsetxattr (__NR_Linux + 240)
736#define __NR_getxattr (__NR_Linux + 241)
737#define __NR_lgetxattr (__NR_Linux + 242)
738#define __NR_fgetxattr (__NR_Linux + 243)
739#define __NR_listxattr (__NR_Linux + 244)
740#define __NR_llistxattr (__NR_Linux + 245)
741#define __NR_flistxattr (__NR_Linux + 246)
742#define __NR_removexattr (__NR_Linux + 247)
743#define __NR_lremovexattr (__NR_Linux + 248)
744#define __NR_fremovexattr (__NR_Linux + 249)
745#define __NR_timer_create (__NR_Linux + 250)
746#define __NR_timer_settime (__NR_Linux + 251)
747#define __NR_timer_gettime (__NR_Linux + 252)
748#define __NR_timer_getoverrun (__NR_Linux + 253)
749#define __NR_timer_delete (__NR_Linux + 254)
750#define __NR_clock_settime (__NR_Linux + 255)
751#define __NR_clock_gettime (__NR_Linux + 256)
752#define __NR_clock_getres (__NR_Linux + 257)
753#define __NR_clock_nanosleep (__NR_Linux + 258)
754#define __NR_tgkill (__NR_Linux + 259)
755#define __NR_mbind (__NR_Linux + 260)
756#define __NR_get_mempolicy (__NR_Linux + 261)
757#define __NR_set_mempolicy (__NR_Linux + 262)
758#define __NR_vserver (__NR_Linux + 263)
759#define __NR_add_key (__NR_Linux + 264)
760#define __NR_request_key (__NR_Linux + 265)
761#define __NR_keyctl (__NR_Linux + 266)
762#define __NR_ioprio_set (__NR_Linux + 267)
763#define __NR_ioprio_get (__NR_Linux + 268)
764#define __NR_inotify_init (__NR_Linux + 269)
765#define __NR_inotify_add_watch (__NR_Linux + 270)
766#define __NR_inotify_rm_watch (__NR_Linux + 271)
767#define __NR_migrate_pages (__NR_Linux + 272)
768#define __NR_pselect6 (__NR_Linux + 273)
769#define __NR_ppoll (__NR_Linux + 274)
770#define __NR_openat (__NR_Linux + 275)
771#define __NR_mkdirat (__NR_Linux + 276)
772#define __NR_mknodat (__NR_Linux + 277)
773#define __NR_fchownat (__NR_Linux + 278)
774#define __NR_futimesat (__NR_Linux + 279)
775#define __NR_fstatat64 (__NR_Linux + 280)
776#define __NR_unlinkat (__NR_Linux + 281)
777#define __NR_renameat (__NR_Linux + 282)
778#define __NR_linkat (__NR_Linux + 283)
779#define __NR_symlinkat (__NR_Linux + 284)
780#define __NR_readlinkat (__NR_Linux + 285)
781#define __NR_fchmodat (__NR_Linux + 286)
782#define __NR_faccessat (__NR_Linux + 287)
783#define __NR_unshare (__NR_Linux + 288)
784#define __NR_set_robust_list (__NR_Linux + 289)
785#define __NR_get_robust_list (__NR_Linux + 290)
786#define __NR_splice (__NR_Linux + 291)
787#define __NR_sync_file_range (__NR_Linux + 292)
788#define __NR_tee (__NR_Linux + 293)
789#define __NR_vmsplice (__NR_Linux + 294)
790#define __NR_move_pages (__NR_Linux + 295)
791#define __NR_getcpu (__NR_Linux + 296)
792#define __NR_epoll_pwait (__NR_Linux + 297)
793#define __NR_statfs64 (__NR_Linux + 298)
794#define __NR_fstatfs64 (__NR_Linux + 299)
795#define __NR_kexec_load (__NR_Linux + 300)
796#define __NR_utimensat (__NR_Linux + 301)
797#define __NR_signalfd (__NR_Linux + 302)
798#define __NR_timerfd (__NR_Linux + 303)
799#define __NR_eventfd (__NR_Linux + 304)
800#define __NR_fallocate (__NR_Linux + 305)
801#define __NR_timerfd_create (__NR_Linux + 306)
802#define __NR_timerfd_settime (__NR_Linux + 307)
803#define __NR_timerfd_gettime (__NR_Linux + 308)
804#define __NR_signalfd4 (__NR_Linux + 309)
805#define __NR_eventfd2 (__NR_Linux + 310)
806#define __NR_epoll_create1 (__NR_Linux + 311)
807#define __NR_dup3 (__NR_Linux + 312)
808#define __NR_pipe2 (__NR_Linux + 313)
809#define __NR_inotify_init1 (__NR_Linux + 314)
810#define __NR_preadv (__NR_Linux + 315)
811#define __NR_pwritev (__NR_Linux + 316)
812#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317)
813#define __NR_perf_event_open (__NR_Linux + 318)
814#define __NR_recvmmsg (__NR_Linux + 319)
815#define __NR_accept4 (__NR_Linux + 320)
816#define __NR_prlimit64 (__NR_Linux + 321)
817#define __NR_fanotify_init (__NR_Linux + 322)
818#define __NR_fanotify_mark (__NR_Linux + 323)
819#define __NR_clock_adjtime (__NR_Linux + 324)
820#define __NR_name_to_handle_at (__NR_Linux + 325)
821#define __NR_open_by_handle_at (__NR_Linux + 326)
822#define __NR_syncfs (__NR_Linux + 327)
823#define __NR_setns (__NR_Linux + 328)
824#define __NR_sendmmsg (__NR_Linux + 329)
825
826#define __NR_Linux_syscalls (__NR_sendmmsg + 1)
827
828
829#define __IGNORE_select /* newselect */
830#define __IGNORE_fadvise64 /* fadvise64_64 */
831#define __IGNORE_utimes /* utime */
832
833
834#define HPUX_GATEWAY_ADDR 0xC0000004
835#define LINUX_GATEWAY_ADDR 0x100
836
837#endif /* _UAPI_ASM_PARISC_UNISTD_H_ */
diff --git a/arch/powerpc/include/asm/kvm_book3s_32.h b/arch/powerpc/include/asm/kvm_book3s_32.h
index 38040ff82063..ce0ef6ce8f86 100644
--- a/arch/powerpc/include/asm/kvm_book3s_32.h
+++ b/arch/powerpc/include/asm/kvm_book3s_32.h
@@ -42,5 +42,6 @@ static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
42#define SID_SHIFT 28 42#define SID_SHIFT 28
43#define ESID_MASK 0xf0000000 43#define ESID_MASK 0xf0000000
44#define VSID_MASK 0x00fffffff0000000ULL 44#define VSID_MASK 0x00fffffff0000000ULL
45#define VPN_SHIFT 12
45 46
46#endif /* __ASM_KVM_BOOK3S_32_H__ */ 47#endif /* __ASM_KVM_BOOK3S_32_H__ */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 8734b3855272..87502046c0dc 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -388,9 +388,9 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
388extern void power7_nap(void); 388extern void power7_nap(void);
389 389
390#ifdef CONFIG_PSERIES_IDLE 390#ifdef CONFIG_PSERIES_IDLE
391extern void update_smt_snooze_delay(int snooze); 391extern void update_smt_snooze_delay(int cpu, int residency);
392#else 392#else
393static inline void update_smt_snooze_delay(int snooze) {} 393static inline void update_smt_snooze_delay(int cpu, int residency) {}
394#endif 394#endif
395 395
396extern void flush_instruction_cache(void); 396extern void flush_instruction_cache(void);
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 8302af649219..cf357a059ddb 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -50,7 +50,7 @@ static ssize_t store_smt_snooze_delay(struct device *dev,
50 return -EINVAL; 50 return -EINVAL;
51 51
52 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; 52 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
53 update_smt_snooze_delay(snooze); 53 update_smt_snooze_delay(cpu->dev.id, snooze);
54 54
55 return count; 55 return count;
56} 56}
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 00aa61268e0d..b0f625a33345 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -173,8 +173,8 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
173 BUG_ON(!map); 173 BUG_ON(!map);
174 174
175 vsid = map->host_vsid; 175 vsid = map->host_vsid;
176 vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) | ((eaddr & ~ESID_MASK) >> VPN_SHIFT) 176 vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) |
177 177 ((eaddr & ~ESID_MASK) >> VPN_SHIFT);
178next_pteg: 178next_pteg:
179 if (rr == 16) { 179 if (rr == 16) {
180 primary = !primary; 180 primary = !primary;
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 0db88f501f91..aa2465e21f1a 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1463,7 +1463,7 @@ static void perf_event_interrupt(struct pt_regs *regs)
1463 if (!event->hw.idx || is_limited_pmc(event->hw.idx)) 1463 if (!event->hw.idx || is_limited_pmc(event->hw.idx))
1464 continue; 1464 continue;
1465 val = read_pmc(event->hw.idx); 1465 val = read_pmc(event->hw.idx);
1466 if (pmc_overflow(val)) { 1466 if ((int)val < 0) {
1467 /* event has overflowed */ 1467 /* event has overflowed */
1468 found = 1; 1468 found = 1;
1469 record_and_restart(event, val, regs); 1469 record_and_restart(event, val, regs);
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 455760b1fe6e..45d00e5fe14d 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -33,13 +33,6 @@ static int max_idle_state = MAX_IDLE_STATE_COUNT - 1;
33static struct cpuidle_device __percpu *pseries_cpuidle_devices; 33static struct cpuidle_device __percpu *pseries_cpuidle_devices;
34static struct cpuidle_state *cpuidle_state_table; 34static struct cpuidle_state *cpuidle_state_table;
35 35
36void update_smt_snooze_delay(int snooze)
37{
38 struct cpuidle_driver *drv = cpuidle_get_driver();
39 if (drv)
40 drv->states[0].target_residency = snooze;
41}
42
43static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) 36static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
44{ 37{
45 38
@@ -66,32 +59,22 @@ static int snooze_loop(struct cpuidle_device *dev,
66{ 59{
67 unsigned long in_purr; 60 unsigned long in_purr;
68 ktime_t kt_before; 61 ktime_t kt_before;
69 unsigned long start_snooze; 62 int cpu = dev->cpu;
70 long snooze = drv->states[0].target_residency;
71 63
72 idle_loop_prolog(&in_purr, &kt_before); 64 idle_loop_prolog(&in_purr, &kt_before);
65 local_irq_enable();
66 set_thread_flag(TIF_POLLING_NRFLAG);
73 67
74 if (snooze) { 68 while ((!need_resched()) && cpu_online(cpu)) {
75 start_snooze = get_tb() + snooze * tb_ticks_per_usec; 69 ppc64_runlatch_off();
76 local_irq_enable(); 70 HMT_low();
77 set_thread_flag(TIF_POLLING_NRFLAG); 71 HMT_very_low();
78
79 while ((snooze < 0) || (get_tb() < start_snooze)) {
80 if (need_resched() || cpu_is_offline(dev->cpu))
81 goto out;
82 ppc64_runlatch_off();
83 HMT_low();
84 HMT_very_low();
85 }
86
87 HMT_medium();
88 clear_thread_flag(TIF_POLLING_NRFLAG);
89 smp_mb();
90 local_irq_disable();
91 } 72 }
92 73
93out:
94 HMT_medium(); 74 HMT_medium();
75 clear_thread_flag(TIF_POLLING_NRFLAG);
76 smp_mb();
77
95 dev->last_residency = 78 dev->last_residency =
96 (int)idle_loop_epilog(in_purr, kt_before); 79 (int)idle_loop_epilog(in_purr, kt_before);
97 return index; 80 return index;
@@ -172,8 +155,8 @@ static struct cpuidle_state dedicated_states[MAX_IDLE_STATE_COUNT] = {
172 .name = "CEDE", 155 .name = "CEDE",
173 .desc = "CEDE", 156 .desc = "CEDE",
174 .flags = CPUIDLE_FLAG_TIME_VALID, 157 .flags = CPUIDLE_FLAG_TIME_VALID,
175 .exit_latency = 1, 158 .exit_latency = 10,
176 .target_residency = 10, 159 .target_residency = 100,
177 .enter = &dedicated_cede_loop }, 160 .enter = &dedicated_cede_loop },
178}; 161};
179 162
@@ -190,6 +173,23 @@ static struct cpuidle_state shared_states[MAX_IDLE_STATE_COUNT] = {
190 .enter = &shared_cede_loop }, 173 .enter = &shared_cede_loop },
191}; 174};
192 175
176void update_smt_snooze_delay(int cpu, int residency)
177{
178 struct cpuidle_driver *drv = cpuidle_get_driver();
179 struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
180
181 if (cpuidle_state_table != dedicated_states)
182 return;
183
184 if (residency < 0) {
185 /* Disable the Nap state on that cpu */
186 if (dev)
187 dev->states_usage[1].disable = 1;
188 } else
189 if (drv)
190 drv->states[1].target_residency = residency;
191}
192
193static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n, 193static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
194 unsigned long action, void *hcpu) 194 unsigned long action, void *hcpu)
195{ 195{
@@ -246,10 +246,6 @@ static int pseries_cpuidle_driver_init(void)
246 drv->states[drv->state_count] = /* structure copy */ 246 drv->states[drv->state_count] = /* structure copy */
247 cpuidle_state_table[idle_state]; 247 cpuidle_state_table[idle_state];
248 248
249 if (cpuidle_state_table == dedicated_states)
250 drv->states[drv->state_count].target_residency =
251 __get_cpu_var(smt_snooze_delay);
252
253 drv->state_count += 1; 249 drv->state_count += 1;
254 } 250 }
255 251
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index 7bf68fff7c5d..59b67ed423b4 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -1,6 +1,8 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += kvm_para.h
5
4header-y += auxvec.h 6header-y += auxvec.h
5header-y += bitsperlong.h 7header-y += bitsperlong.h
6header-y += byteorder.h 8header-y += byteorder.h
diff --git a/arch/s390/include/uapi/asm/kvm_para.h b/arch/s390/include/uapi/asm/kvm_para.h
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/arch/s390/include/uapi/asm/kvm_para.h
+++ /dev/null
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 86eadceff097..29f83beeef7a 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm
2 1
3generic-y += bitsperlong.h 2generic-y += bitsperlong.h
4generic-y += cputime.h 3generic-y += cputime.h
@@ -34,13 +33,3 @@ generic-y += termbits.h
34generic-y += termios.h 33generic-y += termios.h
35generic-y += ucontext.h 34generic-y += ucontext.h
36generic-y += xor.h 35generic-y += xor.h
37
38header-y += cachectl.h
39header-y += cpu-features.h
40header-y += hw_breakpoint.h
41header-y += posix_types_32.h
42header-y += posix_types_64.h
43header-y += ptrace_32.h
44header-y += ptrace_64.h
45header-y += unistd_32.h
46header-y += unistd_64.h
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
index 89890f61a7b9..ec9ad593c3da 100644
--- a/arch/sh/include/asm/hw_breakpoint.h
+++ b/arch/sh/include/asm/hw_breakpoint.h
@@ -1,7 +1,8 @@
1#ifndef __ASM_SH_HW_BREAKPOINT_H 1#ifndef __ASM_SH_HW_BREAKPOINT_H
2#define __ASM_SH_HW_BREAKPOINT_H 2#define __ASM_SH_HW_BREAKPOINT_H
3 3
4#ifdef __KERNEL__ 4#include <uapi/asm/hw_breakpoint.h>
5
5#define __ARCH_HW_BREAKPOINT_H 6#define __ARCH_HW_BREAKPOINT_H
6 7
7#include <linux/kdebug.h> 8#include <linux/kdebug.h>
@@ -66,5 +67,4 @@ extern int register_sh_ubc(struct sh_ubc *);
66 67
67extern struct pmu perf_ops_bp; 68extern struct pmu perf_ops_bp;
68 69
69#endif /* __KERNEL__ */
70#endif /* __ASM_SH_HW_BREAKPOINT_H */ 70#endif /* __ASM_SH_HW_BREAKPOINT_H */
diff --git a/arch/sh/include/asm/posix_types.h b/arch/sh/include/asm/posix_types.h
index f08449bcbde7..1aa781079b1e 100644
--- a/arch/sh/include/asm/posix_types.h
+++ b/arch/sh/include/asm/posix_types.h
@@ -1,13 +1,5 @@
1#ifdef __KERNEL__
2# ifdef CONFIG_SUPERH32 1# ifdef CONFIG_SUPERH32
3# include <asm/posix_types_32.h> 2# include <asm/posix_types_32.h>
4# else 3# else
5# include <asm/posix_types_64.h> 4# include <asm/posix_types_64.h>
6# endif 5# endif
7#else
8# ifdef __SH5__
9# include <asm/posix_types_64.h>
10# else
11# include <asm/posix_types_32.h>
12# endif
13#endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index a4a38dff997a..2506c7db76b7 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -1,42 +1,16 @@
1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
4/* 1/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka 2 * Copyright (C) 1999, 2000 Niibe Yutaka
6 */ 3 */
4#ifndef __ASM_SH_PTRACE_H
5#define __ASM_SH_PTRACE_H
7 6
8#define PTRACE_GETREGS 12 /* General registers */
9#define PTRACE_SETREGS 13
10
11#define PTRACE_GETFPREGS 14 /* FPU registers */
12#define PTRACE_SETFPREGS 15
13
14#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
15
16#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
17#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
18
19#define PTRACE_GETDSPREGS 55 /* DSP registers */
20#define PTRACE_SETDSPREGS 56
21
22#define PT_TEXT_END_ADDR 240
23#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
24#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
25#define PT_TEXT_LEN 252
26
27#if defined(__SH5__) || defined(CONFIG_CPU_SH5)
28#include <asm/ptrace_64.h>
29#else
30#include <asm/ptrace_32.h>
31#endif
32
33#ifdef __KERNEL__
34 7
35#include <linux/stringify.h> 8#include <linux/stringify.h>
36#include <linux/stddef.h> 9#include <linux/stddef.h>
37#include <linux/thread_info.h> 10#include <linux/thread_info.h>
38#include <asm/addrspace.h> 11#include <asm/addrspace.h>
39#include <asm/page.h> 12#include <asm/page.h>
13#include <uapi/asm/ptrace.h>
40 14
41#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 15#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
42#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) 16#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
@@ -140,6 +114,4 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
140#define profile_pc profile_pc 114#define profile_pc profile_pc
141 115
142#include <asm-generic/ptrace.h> 116#include <asm-generic/ptrace.h>
143#endif /* __KERNEL__ */
144
145#endif /* __ASM_SH_PTRACE_H */ 117#endif /* __ASM_SH_PTRACE_H */
diff --git a/arch/sh/include/asm/ptrace_32.h b/arch/sh/include/asm/ptrace_32.h
index 2d3e906aa722..1dd4480c5363 100644
--- a/arch/sh/include/asm/ptrace_32.h
+++ b/arch/sh/include/asm/ptrace_32.h
@@ -1,79 +1,8 @@
1#ifndef __ASM_SH_PTRACE_32_H 1#ifndef __ASM_SH_PTRACE_32_H
2#define __ASM_SH_PTRACE_32_H 2#define __ASM_SH_PTRACE_32_H
3 3
4/* 4#include <uapi/asm/ptrace_32.h>
5 * GCC defines register number like this:
6 * -----------------------------
7 * 0 - 15 are integer registers
8 * 17 - 22 are control/special registers
9 * 24 - 39 fp registers
10 * 40 - 47 xd registers
11 * 48 - fpscr register
12 * -----------------------------
13 *
14 * We follows above, except:
15 * 16 --- program counter (PC)
16 * 22 --- syscall #
17 * 23 --- floating point communication register
18 */
19#define REG_REG0 0
20#define REG_REG15 15
21 5
22#define REG_PC 16
23
24#define REG_PR 17
25#define REG_SR 18
26#define REG_GBR 19
27#define REG_MACH 20
28#define REG_MACL 21
29
30#define REG_SYSCALL 22
31
32#define REG_FPREG0 23
33#define REG_FPREG15 38
34#define REG_XFREG0 39
35#define REG_XFREG15 54
36
37#define REG_FPSCR 55
38#define REG_FPUL 56
39
40/*
41 * This struct defines the way the registers are stored on the
42 * kernel stack during a system call or other kernel entry.
43 */
44struct pt_regs {
45 unsigned long regs[16];
46 unsigned long pc;
47 unsigned long pr;
48 unsigned long sr;
49 unsigned long gbr;
50 unsigned long mach;
51 unsigned long macl;
52 long tra;
53};
54
55/*
56 * This struct defines the way the DSP registers are stored on the
57 * kernel stack during a system call or other kernel entry.
58 */
59struct pt_dspregs {
60 unsigned long a1;
61 unsigned long a0g;
62 unsigned long a1g;
63 unsigned long m0;
64 unsigned long m1;
65 unsigned long a0;
66 unsigned long x0;
67 unsigned long x1;
68 unsigned long y0;
69 unsigned long y1;
70 unsigned long dsr;
71 unsigned long rs;
72 unsigned long re;
73 unsigned long mod;
74};
75
76#ifdef __KERNEL__
77 6
78#define MAX_REG_OFFSET offsetof(struct pt_regs, tra) 7#define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
79static inline long regs_return_value(struct pt_regs *regs) 8static inline long regs_return_value(struct pt_regs *regs)
@@ -81,6 +10,4 @@ static inline long regs_return_value(struct pt_regs *regs)
81 return regs->regs[0]; 10 return regs->regs[0];
82} 11}
83 12
84#endif /* __KERNEL__ */
85
86#endif /* __ASM_SH_PTRACE_32_H */ 13#endif /* __ASM_SH_PTRACE_32_H */
diff --git a/arch/sh/include/asm/ptrace_64.h b/arch/sh/include/asm/ptrace_64.h
index eb3fcceaf64b..97f4b5660f2c 100644
--- a/arch/sh/include/asm/ptrace_64.h
+++ b/arch/sh/include/asm/ptrace_64.h
@@ -1,16 +1,8 @@
1#ifndef __ASM_SH_PTRACE_64_H 1#ifndef __ASM_SH_PTRACE_64_H
2#define __ASM_SH_PTRACE_64_H 2#define __ASM_SH_PTRACE_64_H
3 3
4struct pt_regs { 4#include <uapi/asm/ptrace_64.h>
5 unsigned long long pc;
6 unsigned long long sr;
7 long long syscall_nr;
8 unsigned long long regs[63];
9 unsigned long long tregs[8];
10 unsigned long long pad[2];
11};
12 5
13#ifdef __KERNEL__
14 6
15#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7]) 7#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7])
16static inline long regs_return_value(struct pt_regs *regs) 8static inline long regs_return_value(struct pt_regs *regs)
@@ -18,6 +10,4 @@ static inline long regs_return_value(struct pt_regs *regs)
18 return regs->regs[3]; 10 return regs->regs[3];
19} 11}
20 12
21#endif /* __KERNEL__ */
22
23#endif /* __ASM_SH_PTRACE_64_H */ 13#endif /* __ASM_SH_PTRACE_64_H */
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h
index 465a22df8fd0..99238108e7a5 100644
--- a/arch/sh/include/asm/setup.h
+++ b/arch/sh/include/asm/setup.h
@@ -1,9 +1,8 @@
1#ifndef _SH_SETUP_H 1#ifndef _SH_SETUP_H
2#define _SH_SETUP_H 2#define _SH_SETUP_H
3 3
4#include <asm-generic/setup.h> 4#include <uapi/asm/setup.h>
5 5
6#ifdef __KERNEL__
7/* 6/*
8 * This is set up by the setup-routine at boot-time 7 * This is set up by the setup-routine at boot-time
9 */ 8 */
@@ -22,6 +21,4 @@ void sh_mv_setup(void);
22void check_for_initrd(void); 21void check_for_initrd(void);
23void per_cpu_trap_init(void); 22void per_cpu_trap_init(void);
24 23
25#endif /* __KERNEL__ */
26
27#endif /* _SH_SETUP_H */ 24#endif /* _SH_SETUP_H */
diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h
index f8421f7ad63a..6a31053fa5e3 100644
--- a/arch/sh/include/asm/types.h
+++ b/arch/sh/include/asm/types.h
@@ -1,12 +1,11 @@
1#ifndef __ASM_SH_TYPES_H 1#ifndef __ASM_SH_TYPES_H
2#define __ASM_SH_TYPES_H 2#define __ASM_SH_TYPES_H
3 3
4#include <asm-generic/types.h> 4#include <uapi/asm/types.h>
5 5
6/* 6/*
7 * These aren't exported outside the kernel to avoid name space clashes 7 * These aren't exported outside the kernel to avoid name space clashes
8 */ 8 */
9#ifdef __KERNEL__
10#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
11 10
12#ifdef CONFIG_SUPERH32 11#ifdef CONFIG_SUPERH32
@@ -18,6 +17,4 @@ typedef u64 reg_size_t;
18#endif 17#endif
19 18
20#endif /* __ASSEMBLY__ */ 19#endif /* __ASSEMBLY__ */
21#endif /* __KERNEL__ */
22
23#endif /* __ASM_SH_TYPES_H */ 20#endif /* __ASM_SH_TYPES_H */
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 307201a854f3..38956dfa76f7 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -1,4 +1,3 @@
1#ifdef __KERNEL__
2# ifdef CONFIG_SUPERH32 1# ifdef CONFIG_SUPERH32
3# include <asm/unistd_32.h> 2# include <asm/unistd_32.h>
4# else 3# else
@@ -38,10 +37,4 @@
38 */ 37 */
39# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 38# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
40 39
41#else 40#include <uapi/asm/unistd.h>
42# ifdef __SH5__
43# include <asm/unistd_64.h>
44# else
45# include <asm/unistd_32.h>
46# endif
47#endif
diff --git a/arch/sh/include/uapi/asm/Kbuild b/arch/sh/include/uapi/asm/Kbuild
index baebb3da1d44..60613ae78513 100644
--- a/arch/sh/include/uapi/asm/Kbuild
+++ b/arch/sh/include/uapi/asm/Kbuild
@@ -1,3 +1,25 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h
5header-y += byteorder.h
6header-y += cachectl.h
7header-y += cpu-features.h
8header-y += hw_breakpoint.h
9header-y += ioctls.h
10header-y += posix_types.h
11header-y += posix_types_32.h
12header-y += posix_types_64.h
13header-y += ptrace.h
14header-y += ptrace_32.h
15header-y += ptrace_64.h
16header-y += setup.h
17header-y += sigcontext.h
18header-y += signal.h
19header-y += sockios.h
20header-y += stat.h
21header-y += swab.h
22header-y += types.h
23header-y += unistd.h
24header-y += unistd_32.h
25header-y += unistd_64.h
diff --git a/arch/sh/include/asm/auxvec.h b/arch/sh/include/uapi/asm/auxvec.h
index 8bcc51af9367..8bcc51af9367 100644
--- a/arch/sh/include/asm/auxvec.h
+++ b/arch/sh/include/uapi/asm/auxvec.h
diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/uapi/asm/byteorder.h
index db2f5d7cb17d..db2f5d7cb17d 100644
--- a/arch/sh/include/asm/byteorder.h
+++ b/arch/sh/include/uapi/asm/byteorder.h
diff --git a/arch/sh/include/asm/cachectl.h b/arch/sh/include/uapi/asm/cachectl.h
index 6ffb4b7a212e..6ffb4b7a212e 100644
--- a/arch/sh/include/asm/cachectl.h
+++ b/arch/sh/include/uapi/asm/cachectl.h
diff --git a/arch/sh/include/asm/cpu-features.h b/arch/sh/include/uapi/asm/cpu-features.h
index 694abe490edb..694abe490edb 100644
--- a/arch/sh/include/asm/cpu-features.h
+++ b/arch/sh/include/uapi/asm/cpu-features.h
diff --git a/arch/sh/include/uapi/asm/hw_breakpoint.h b/arch/sh/include/uapi/asm/hw_breakpoint.h
new file mode 100644
index 000000000000..ae5704fa77ad
--- /dev/null
+++ b/arch/sh/include/uapi/asm/hw_breakpoint.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here anymore, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/arch/sh/include/asm/ioctls.h b/arch/sh/include/uapi/asm/ioctls.h
index a6769f352bf6..a6769f352bf6 100644
--- a/arch/sh/include/asm/ioctls.h
+++ b/arch/sh/include/uapi/asm/ioctls.h
diff --git a/arch/sh/include/uapi/asm/posix_types.h b/arch/sh/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000000..dc55e5adfe1e
--- /dev/null
+++ b/arch/sh/include/uapi/asm/posix_types.h
@@ -0,0 +1,7 @@
1#ifndef __KERNEL__
2# ifdef __SH5__
3# include <asm/posix_types_64.h>
4# else
5# include <asm/posix_types_32.h>
6# endif
7#endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/uapi/asm/posix_types_32.h
index ba0bdc423b07..ba0bdc423b07 100644
--- a/arch/sh/include/asm/posix_types_32.h
+++ b/arch/sh/include/uapi/asm/posix_types_32.h
diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/uapi/asm/posix_types_64.h
index 244f7e950e17..244f7e950e17 100644
--- a/arch/sh/include/asm/posix_types_64.h
+++ b/arch/sh/include/uapi/asm/posix_types_64.h
diff --git a/arch/sh/include/uapi/asm/ptrace.h b/arch/sh/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..8b8c5aca9c28
--- /dev/null
+++ b/arch/sh/include/uapi/asm/ptrace.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 1999, 2000 Niibe Yutaka
3 */
4#ifndef _UAPI__ASM_SH_PTRACE_H
5#define _UAPI__ASM_SH_PTRACE_H
6
7
8#define PTRACE_GETREGS 12 /* General registers */
9#define PTRACE_SETREGS 13
10
11#define PTRACE_GETFPREGS 14 /* FPU registers */
12#define PTRACE_SETFPREGS 15
13
14#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
15
16#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
17#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
18
19#define PTRACE_GETDSPREGS 55 /* DSP registers */
20#define PTRACE_SETDSPREGS 56
21
22#define PT_TEXT_END_ADDR 240
23#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
24#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
25#define PT_TEXT_LEN 252
26
27#if defined(__SH5__) || defined(CONFIG_CPU_SH5)
28#include <asm/ptrace_64.h>
29#else
30#include <asm/ptrace_32.h>
31#endif
32
33
34#endif /* _UAPI__ASM_SH_PTRACE_H */
diff --git a/arch/sh/include/uapi/asm/ptrace_32.h b/arch/sh/include/uapi/asm/ptrace_32.h
new file mode 100644
index 000000000000..926e0cefc2bb
--- /dev/null
+++ b/arch/sh/include/uapi/asm/ptrace_32.h
@@ -0,0 +1,77 @@
1#ifndef _UAPI__ASM_SH_PTRACE_32_H
2#define _UAPI__ASM_SH_PTRACE_32_H
3
4/*
5 * GCC defines register number like this:
6 * -----------------------------
7 * 0 - 15 are integer registers
8 * 17 - 22 are control/special registers
9 * 24 - 39 fp registers
10 * 40 - 47 xd registers
11 * 48 - fpscr register
12 * -----------------------------
13 *
14 * We follows above, except:
15 * 16 --- program counter (PC)
16 * 22 --- syscall #
17 * 23 --- floating point communication register
18 */
19#define REG_REG0 0
20#define REG_REG15 15
21
22#define REG_PC 16
23
24#define REG_PR 17
25#define REG_SR 18
26#define REG_GBR 19
27#define REG_MACH 20
28#define REG_MACL 21
29
30#define REG_SYSCALL 22
31
32#define REG_FPREG0 23
33#define REG_FPREG15 38
34#define REG_XFREG0 39
35#define REG_XFREG15 54
36
37#define REG_FPSCR 55
38#define REG_FPUL 56
39
40/*
41 * This struct defines the way the registers are stored on the
42 * kernel stack during a system call or other kernel entry.
43 */
44struct pt_regs {
45 unsigned long regs[16];
46 unsigned long pc;
47 unsigned long pr;
48 unsigned long sr;
49 unsigned long gbr;
50 unsigned long mach;
51 unsigned long macl;
52 long tra;
53};
54
55/*
56 * This struct defines the way the DSP registers are stored on the
57 * kernel stack during a system call or other kernel entry.
58 */
59struct pt_dspregs {
60 unsigned long a1;
61 unsigned long a0g;
62 unsigned long a1g;
63 unsigned long m0;
64 unsigned long m1;
65 unsigned long a0;
66 unsigned long x0;
67 unsigned long x1;
68 unsigned long y0;
69 unsigned long y1;
70 unsigned long dsr;
71 unsigned long rs;
72 unsigned long re;
73 unsigned long mod;
74};
75
76
77#endif /* _UAPI__ASM_SH_PTRACE_32_H */
diff --git a/arch/sh/include/uapi/asm/ptrace_64.h b/arch/sh/include/uapi/asm/ptrace_64.h
new file mode 100644
index 000000000000..0e52ee83e946
--- /dev/null
+++ b/arch/sh/include/uapi/asm/ptrace_64.h
@@ -0,0 +1,14 @@
1#ifndef _UAPI__ASM_SH_PTRACE_64_H
2#define _UAPI__ASM_SH_PTRACE_64_H
3
4struct pt_regs {
5 unsigned long long pc;
6 unsigned long long sr;
7 long long syscall_nr;
8 unsigned long long regs[63];
9 unsigned long long tregs[8];
10 unsigned long long pad[2];
11};
12
13
14#endif /* _UAPI__ASM_SH_PTRACE_64_H */
diff --git a/arch/sh/include/uapi/asm/setup.h b/arch/sh/include/uapi/asm/setup.h
new file mode 100644
index 000000000000..552df83f1a49
--- /dev/null
+++ b/arch/sh/include/uapi/asm/setup.h
@@ -0,0 +1 @@
#include <asm-generic/setup.h>
diff --git a/arch/sh/include/asm/sigcontext.h b/arch/sh/include/uapi/asm/sigcontext.h
index 8ce1435bc0bf..8ce1435bc0bf 100644
--- a/arch/sh/include/asm/sigcontext.h
+++ b/arch/sh/include/uapi/asm/sigcontext.h
diff --git a/arch/sh/include/asm/signal.h b/arch/sh/include/uapi/asm/signal.h
index 9ac530a90bce..9ac530a90bce 100644
--- a/arch/sh/include/asm/signal.h
+++ b/arch/sh/include/uapi/asm/signal.h
diff --git a/arch/sh/include/asm/sockios.h b/arch/sh/include/uapi/asm/sockios.h
index cf8b96b1f9ab..cf8b96b1f9ab 100644
--- a/arch/sh/include/asm/sockios.h
+++ b/arch/sh/include/uapi/asm/sockios.h
diff --git a/arch/sh/include/asm/stat.h b/arch/sh/include/uapi/asm/stat.h
index e1810cc6e3da..e1810cc6e3da 100644
--- a/arch/sh/include/asm/stat.h
+++ b/arch/sh/include/uapi/asm/stat.h
diff --git a/arch/sh/include/asm/swab.h b/arch/sh/include/uapi/asm/swab.h
index 1cd09767a7a3..1cd09767a7a3 100644
--- a/arch/sh/include/asm/swab.h
+++ b/arch/sh/include/uapi/asm/swab.h
diff --git a/arch/sh/include/uapi/asm/types.h b/arch/sh/include/uapi/asm/types.h
new file mode 100644
index 000000000000..b9e79bc580dd
--- /dev/null
+++ b/arch/sh/include/uapi/asm/types.h
@@ -0,0 +1 @@
#include <asm-generic/types.h>
diff --git a/arch/sh/include/uapi/asm/unistd.h b/arch/sh/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..eeef88dd53ce
--- /dev/null
+++ b/arch/sh/include/uapi/asm/unistd.h
@@ -0,0 +1,7 @@
1#ifndef __KERNEL__
2# ifdef __SH5__
3# include <asm/unistd_64.h>
4# else
5# include <asm/unistd_32.h>
6# endif
7#endif
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/uapi/asm/unistd_32.h
index 72fd1e061006..9e465f246dc1 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/uapi/asm/unistd_32.h
@@ -378,7 +378,8 @@
378#define __NR_setns 364 378#define __NR_setns 364
379#define __NR_process_vm_readv 365 379#define __NR_process_vm_readv 365
380#define __NR_process_vm_writev 366 380#define __NR_process_vm_writev 366
381#define __NR_kcmp 367
381 382
382#define NR_syscalls 367 383#define NR_syscalls 368
383 384
384#endif /* __ASM_SH_UNISTD_32_H */ 385#endif /* __ASM_SH_UNISTD_32_H */
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/uapi/asm/unistd_64.h
index a28edc329692..8e3a2edd284e 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/uapi/asm/unistd_64.h
@@ -398,7 +398,8 @@
398#define __NR_setns 375 398#define __NR_setns 375
399#define __NR_process_vm_readv 376 399#define __NR_process_vm_readv 376
400#define __NR_process_vm_writev 377 400#define __NR_process_vm_writev 377
401#define __NR_kcmp 378
401 402
402#define NR_syscalls 378 403#define NR_syscalls 379
403 404
404#endif /* __ASM_SH_UNISTD_64_H */ 405#endif /* __ASM_SH_UNISTD_64_H */
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 4b68f0f79761..fe97ae5e56f1 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -384,3 +384,4 @@ ENTRY(sys_call_table)
384 .long sys_setns 384 .long sys_setns
385 .long sys_process_vm_readv /* 365 */ 385 .long sys_process_vm_readv /* 365 */
386 .long sys_process_vm_writev 386 .long sys_process_vm_writev
387 .long sys_kcmp
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 0956345b36ef..5c7b1c67bdc1 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -404,3 +404,4 @@ sys_call_table:
404 .long sys_setns /* 375 */ 404 .long sys_setns /* 375 */
405 .long sys_process_vm_readv 405 .long sys_process_vm_readv
406 .long sys_process_vm_writev 406 .long sys_process_vm_writev
407 .long sys_kcmp
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index 0c6f6b068289..da43bdc62294 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -42,7 +42,18 @@ struct global_reg_snapshot {
42 struct thread_info *thread; 42 struct thread_info *thread;
43 unsigned long pad1; 43 unsigned long pad1;
44}; 44};
45extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; 45
46struct global_pmu_snapshot {
47 unsigned long pcr[4];
48 unsigned long pic[4];
49};
50
51union global_cpu_snapshot {
52 struct global_reg_snapshot reg;
53 struct global_pmu_snapshot pmu;
54};
55
56extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
46 57
47#define force_successful_syscall_return() \ 58#define force_successful_syscall_return() \
48do { current_thread_info()->syscall_noerror = 1; \ 59do { current_thread_info()->syscall_noerror = 1; \
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 29862a9e9065..dd3bef4b9896 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -48,6 +48,7 @@ extern void smp_fill_in_sib_core_maps(void);
48extern void cpu_play_dead(void); 48extern void cpu_play_dead(void);
49 49
50extern void smp_fetch_global_regs(void); 50extern void smp_fetch_global_regs(void);
51extern void smp_fetch_global_pmu(void);
51 52
52struct seq_file; 53struct seq_file;
53void smp_bogo(struct seq_file *); 54void smp_bogo(struct seq_file *);
@@ -65,6 +66,7 @@ extern void __cpu_die(unsigned int cpu);
65#define hard_smp_processor_id() 0 66#define hard_smp_processor_id() 0
66#define smp_fill_in_sib_core_maps() do { } while (0) 67#define smp_fill_in_sib_core_maps() do { } while (0)
67#define smp_fetch_global_regs() do { } while (0) 68#define smp_fetch_global_regs() do { } while (0)
69#define smp_fetch_global_pmu() do { } while (0)
68 70
69#endif /* !(CONFIG_SMP) */ 71#endif /* !(CONFIG_SMP) */
70 72
diff --git a/arch/sparc/include/uapi/asm/sigcontext.h b/arch/sparc/include/uapi/asm/sigcontext.h
index e69de29bb2d1..ae5704fa77ad 100644
--- a/arch/sparc/include/uapi/asm/sigcontext.h
+++ b/arch/sparc/include/uapi/asm/sigcontext.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here anymore, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index e48651dace1b..885a8af74064 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -817,15 +817,17 @@ static u64 nop_for_index(int idx)
817 817
818static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) 818static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx)
819{ 819{
820 u64 val, mask = mask_for_index(idx); 820 u64 enc, val, mask = mask_for_index(idx);
821 int pcr_index = 0; 821 int pcr_index = 0;
822 822
823 if (sparc_pmu->num_pcrs > 1) 823 if (sparc_pmu->num_pcrs > 1)
824 pcr_index = idx; 824 pcr_index = idx;
825 825
826 enc = perf_event_get_enc(cpuc->events[idx]);
827
826 val = cpuc->pcr[pcr_index]; 828 val = cpuc->pcr[pcr_index];
827 val &= ~mask; 829 val &= ~mask;
828 val |= hwc->config; 830 val |= event_encoding(enc, idx);
829 cpuc->pcr[pcr_index] = val; 831 cpuc->pcr[pcr_index] = val;
830 832
831 pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]); 833 pcr_ops->write_pcr(pcr_index, cpuc->pcr[pcr_index]);
@@ -1738,8 +1740,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1738{ 1740{
1739 unsigned long ufp; 1741 unsigned long ufp;
1740 1742
1741 perf_callchain_store(entry, regs->tpc);
1742
1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1744 do { 1744 do {
1745 struct sparc_stackf *usf, sf; 1745 struct sparc_stackf *usf, sf;
@@ -1760,8 +1760,6 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1760{ 1760{
1761 unsigned long ufp; 1761 unsigned long ufp;
1762 1762
1763 perf_callchain_store(entry, regs->tpc);
1764
1765 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL; 1763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1766 do { 1764 do {
1767 struct sparc_stackf32 *usf, sf; 1765 struct sparc_stackf32 *usf, sf;
@@ -1780,6 +1778,11 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1780void 1778void
1781perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) 1779perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1782{ 1780{
1781 perf_callchain_store(entry, regs->tpc);
1782
1783 if (!current->mm)
1784 return;
1785
1783 flushw_user(); 1786 flushw_user();
1784 if (test_thread_flag(TIF_32BIT)) 1787 if (test_thread_flag(TIF_32BIT))
1785 perf_callchain_user_32(entry, regs); 1788 perf_callchain_user_32(entry, regs);
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index fcaa59421126..d778248ef3f8 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -27,6 +27,7 @@
27#include <linux/tick.h> 27#include <linux/tick.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30#include <linux/perf_event.h>
30#include <linux/elfcore.h> 31#include <linux/elfcore.h>
31#include <linux/sysrq.h> 32#include <linux/sysrq.h>
32#include <linux/nmi.h> 33#include <linux/nmi.h>
@@ -47,6 +48,7 @@
47#include <asm/syscalls.h> 48#include <asm/syscalls.h>
48#include <asm/irq_regs.h> 49#include <asm/irq_regs.h>
49#include <asm/smp.h> 50#include <asm/smp.h>
51#include <asm/pcr.h>
50 52
51#include "kstack.h" 53#include "kstack.h"
52 54
@@ -204,18 +206,22 @@ void show_regs(struct pt_regs *regs)
204 show_stack(current, (unsigned long *) regs->u_regs[UREG_FP]); 206 show_stack(current, (unsigned long *) regs->u_regs[UREG_FP]);
205} 207}
206 208
207struct global_reg_snapshot global_reg_snapshot[NR_CPUS]; 209union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
208static DEFINE_SPINLOCK(global_reg_snapshot_lock); 210static DEFINE_SPINLOCK(global_cpu_snapshot_lock);
209 211
210static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs, 212static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
211 int this_cpu) 213 int this_cpu)
212{ 214{
215 struct global_reg_snapshot *rp;
216
213 flushw_all(); 217 flushw_all();
214 218
215 global_reg_snapshot[this_cpu].tstate = regs->tstate; 219 rp = &global_cpu_snapshot[this_cpu].reg;
216 global_reg_snapshot[this_cpu].tpc = regs->tpc; 220
217 global_reg_snapshot[this_cpu].tnpc = regs->tnpc; 221 rp->tstate = regs->tstate;
218 global_reg_snapshot[this_cpu].o7 = regs->u_regs[UREG_I7]; 222 rp->tpc = regs->tpc;
223 rp->tnpc = regs->tnpc;
224 rp->o7 = regs->u_regs[UREG_I7];
219 225
220 if (regs->tstate & TSTATE_PRIV) { 226 if (regs->tstate & TSTATE_PRIV) {
221 struct reg_window *rw; 227 struct reg_window *rw;
@@ -223,17 +229,17 @@ static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
223 rw = (struct reg_window *) 229 rw = (struct reg_window *)
224 (regs->u_regs[UREG_FP] + STACK_BIAS); 230 (regs->u_regs[UREG_FP] + STACK_BIAS);
225 if (kstack_valid(tp, (unsigned long) rw)) { 231 if (kstack_valid(tp, (unsigned long) rw)) {
226 global_reg_snapshot[this_cpu].i7 = rw->ins[7]; 232 rp->i7 = rw->ins[7];
227 rw = (struct reg_window *) 233 rw = (struct reg_window *)
228 (rw->ins[6] + STACK_BIAS); 234 (rw->ins[6] + STACK_BIAS);
229 if (kstack_valid(tp, (unsigned long) rw)) 235 if (kstack_valid(tp, (unsigned long) rw))
230 global_reg_snapshot[this_cpu].rpc = rw->ins[7]; 236 rp->rpc = rw->ins[7];
231 } 237 }
232 } else { 238 } else {
233 global_reg_snapshot[this_cpu].i7 = 0; 239 rp->i7 = 0;
234 global_reg_snapshot[this_cpu].rpc = 0; 240 rp->rpc = 0;
235 } 241 }
236 global_reg_snapshot[this_cpu].thread = tp; 242 rp->thread = tp;
237} 243}
238 244
239/* In order to avoid hangs we do not try to synchronize with the 245/* In order to avoid hangs we do not try to synchronize with the
@@ -261,9 +267,9 @@ void arch_trigger_all_cpu_backtrace(void)
261 if (!regs) 267 if (!regs)
262 regs = tp->kregs; 268 regs = tp->kregs;
263 269
264 spin_lock_irqsave(&global_reg_snapshot_lock, flags); 270 spin_lock_irqsave(&global_cpu_snapshot_lock, flags);
265 271
266 memset(global_reg_snapshot, 0, sizeof(global_reg_snapshot)); 272 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
267 273
268 this_cpu = raw_smp_processor_id(); 274 this_cpu = raw_smp_processor_id();
269 275
@@ -272,7 +278,7 @@ void arch_trigger_all_cpu_backtrace(void)
272 smp_fetch_global_regs(); 278 smp_fetch_global_regs();
273 279
274 for_each_online_cpu(cpu) { 280 for_each_online_cpu(cpu) {
275 struct global_reg_snapshot *gp = &global_reg_snapshot[cpu]; 281 struct global_reg_snapshot *gp = &global_cpu_snapshot[cpu].reg;
276 282
277 __global_reg_poll(gp); 283 __global_reg_poll(gp);
278 284
@@ -295,9 +301,9 @@ void arch_trigger_all_cpu_backtrace(void)
295 } 301 }
296 } 302 }
297 303
298 memset(global_reg_snapshot, 0, sizeof(global_reg_snapshot)); 304 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
299 305
300 spin_unlock_irqrestore(&global_reg_snapshot_lock, flags); 306 spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags);
301} 307}
302 308
303#ifdef CONFIG_MAGIC_SYSRQ 309#ifdef CONFIG_MAGIC_SYSRQ
@@ -309,16 +315,90 @@ static void sysrq_handle_globreg(int key)
309 315
310static struct sysrq_key_op sparc_globalreg_op = { 316static struct sysrq_key_op sparc_globalreg_op = {
311 .handler = sysrq_handle_globreg, 317 .handler = sysrq_handle_globreg,
312 .help_msg = "Globalregs", 318 .help_msg = "global-regs(Y)",
313 .action_msg = "Show Global CPU Regs", 319 .action_msg = "Show Global CPU Regs",
314}; 320};
315 321
316static int __init sparc_globreg_init(void) 322static void __global_pmu_self(int this_cpu)
323{
324 struct global_pmu_snapshot *pp;
325 int i, num;
326
327 pp = &global_cpu_snapshot[this_cpu].pmu;
328
329 num = 1;
330 if (tlb_type == hypervisor &&
331 sun4v_chip_type >= SUN4V_CHIP_NIAGARA4)
332 num = 4;
333
334 for (i = 0; i < num; i++) {
335 pp->pcr[i] = pcr_ops->read_pcr(i);
336 pp->pic[i] = pcr_ops->read_pic(i);
337 }
338}
339
340static void __global_pmu_poll(struct global_pmu_snapshot *pp)
341{
342 int limit = 0;
343
344 while (!pp->pcr[0] && ++limit < 100) {
345 barrier();
346 udelay(1);
347 }
348}
349
350static void pmu_snapshot_all_cpus(void)
317{ 351{
318 return register_sysrq_key('y', &sparc_globalreg_op); 352 unsigned long flags;
353 int this_cpu, cpu;
354
355 spin_lock_irqsave(&global_cpu_snapshot_lock, flags);
356
357 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
358
359 this_cpu = raw_smp_processor_id();
360
361 __global_pmu_self(this_cpu);
362
363 smp_fetch_global_pmu();
364
365 for_each_online_cpu(cpu) {
366 struct global_pmu_snapshot *pp = &global_cpu_snapshot[cpu].pmu;
367
368 __global_pmu_poll(pp);
369
370 printk("%c CPU[%3d]: PCR[%08lx:%08lx:%08lx:%08lx] PIC[%08lx:%08lx:%08lx:%08lx]\n",
371 (cpu == this_cpu ? '*' : ' '), cpu,
372 pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3],
373 pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]);
374 }
375
376 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
377
378 spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags);
379}
380
381static void sysrq_handle_globpmu(int key)
382{
383 pmu_snapshot_all_cpus();
384}
385
386static struct sysrq_key_op sparc_globalpmu_op = {
387 .handler = sysrq_handle_globpmu,
388 .help_msg = "global-pmu(X)",
389 .action_msg = "Show Global PMU Regs",
390};
391
392static int __init sparc_sysrq_init(void)
393{
394 int ret = register_sysrq_key('y', &sparc_globalreg_op);
395
396 if (!ret)
397 ret = register_sysrq_key('x', &sparc_globalpmu_op);
398 return ret;
319} 399}
320 400
321core_initcall(sparc_globreg_init); 401core_initcall(sparc_sysrq_init);
322 402
323#endif 403#endif
324 404
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 781bcb10b8bd..d94b878577b7 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -852,6 +852,8 @@ extern unsigned long xcall_flush_tlb_mm;
852extern unsigned long xcall_flush_tlb_pending; 852extern unsigned long xcall_flush_tlb_pending;
853extern unsigned long xcall_flush_tlb_kernel_range; 853extern unsigned long xcall_flush_tlb_kernel_range;
854extern unsigned long xcall_fetch_glob_regs; 854extern unsigned long xcall_fetch_glob_regs;
855extern unsigned long xcall_fetch_glob_pmu;
856extern unsigned long xcall_fetch_glob_pmu_n4;
855extern unsigned long xcall_receive_signal; 857extern unsigned long xcall_receive_signal;
856extern unsigned long xcall_new_mmu_context_version; 858extern unsigned long xcall_new_mmu_context_version;
857#ifdef CONFIG_KGDB 859#ifdef CONFIG_KGDB
@@ -1000,6 +1002,15 @@ void smp_fetch_global_regs(void)
1000 smp_cross_call(&xcall_fetch_glob_regs, 0, 0, 0); 1002 smp_cross_call(&xcall_fetch_glob_regs, 0, 0, 0);
1001} 1003}
1002 1004
1005void smp_fetch_global_pmu(void)
1006{
1007 if (tlb_type == hypervisor &&
1008 sun4v_chip_type >= SUN4V_CHIP_NIAGARA4)
1009 smp_cross_call(&xcall_fetch_glob_pmu_n4, 0, 0, 0);
1010 else
1011 smp_cross_call(&xcall_fetch_glob_pmu, 0, 0, 0);
1012}
1013
1003/* We know that the window frames of the user have been flushed 1014/* We know that the window frames of the user have been flushed
1004 * to the stack before we get here because all callers of us 1015 * to the stack before we get here because all callers of us
1005 * are flush_tlb_*() routines, and these run after flush_cache_*() 1016 * are flush_tlb_*() routines, and these run after flush_cache_*()
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
index 874162a11ceb..f8e13d421fcb 100644
--- a/arch/sparc/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -481,8 +481,8 @@ xcall_sync_tick:
481 481
482 .globl xcall_fetch_glob_regs 482 .globl xcall_fetch_glob_regs
483xcall_fetch_glob_regs: 483xcall_fetch_glob_regs:
484 sethi %hi(global_reg_snapshot), %g1 484 sethi %hi(global_cpu_snapshot), %g1
485 or %g1, %lo(global_reg_snapshot), %g1 485 or %g1, %lo(global_cpu_snapshot), %g1
486 __GET_CPUID(%g2) 486 __GET_CPUID(%g2)
487 sllx %g2, 6, %g3 487 sllx %g2, 6, %g3
488 add %g1, %g3, %g1 488 add %g1, %g3, %g1
@@ -509,6 +509,66 @@ xcall_fetch_glob_regs:
509 stx %g3, [%g1 + GR_SNAP_THREAD] 509 stx %g3, [%g1 + GR_SNAP_THREAD]
510 retry 510 retry
511 511
512 .globl xcall_fetch_glob_pmu
513xcall_fetch_glob_pmu:
514 sethi %hi(global_cpu_snapshot), %g1
515 or %g1, %lo(global_cpu_snapshot), %g1
516 __GET_CPUID(%g2)
517 sllx %g2, 6, %g3
518 add %g1, %g3, %g1
519 rd %pic, %g7
520 stx %g7, [%g1 + (4 * 8)]
521 rd %pcr, %g7
522 stx %g7, [%g1 + (0 * 8)]
523 retry
524
525 .globl xcall_fetch_glob_pmu_n4
526xcall_fetch_glob_pmu_n4:
527 sethi %hi(global_cpu_snapshot), %g1
528 or %g1, %lo(global_cpu_snapshot), %g1
529 __GET_CPUID(%g2)
530 sllx %g2, 6, %g3
531 add %g1, %g3, %g1
532
533 ldxa [%g0] ASI_PIC, %g7
534 stx %g7, [%g1 + (4 * 8)]
535 mov 0x08, %g3
536 ldxa [%g3] ASI_PIC, %g7
537 stx %g7, [%g1 + (5 * 8)]
538 mov 0x10, %g3
539 ldxa [%g3] ASI_PIC, %g7
540 stx %g7, [%g1 + (6 * 8)]
541 mov 0x18, %g3
542 ldxa [%g3] ASI_PIC, %g7
543 stx %g7, [%g1 + (7 * 8)]
544
545 mov %o0, %g2
546 mov %o1, %g3
547 mov %o5, %g7
548
549 mov HV_FAST_VT_GET_PERFREG, %o5
550 mov 3, %o0
551 ta HV_FAST_TRAP
552 stx %o1, [%g1 + (3 * 8)]
553 mov HV_FAST_VT_GET_PERFREG, %o5
554 mov 2, %o0
555 ta HV_FAST_TRAP
556 stx %o1, [%g1 + (2 * 8)]
557 mov HV_FAST_VT_GET_PERFREG, %o5
558 mov 1, %o0
559 ta HV_FAST_TRAP
560 stx %o1, [%g1 + (1 * 8)]
561 mov HV_FAST_VT_GET_PERFREG, %o5
562 mov 0, %o0
563 ta HV_FAST_TRAP
564 stx %o1, [%g1 + (0 * 8)]
565
566 mov %g2, %o0
567 mov %g3, %o1
568 mov %g7, %o5
569
570 retry
571
512#ifdef DCACHE_ALIASING_POSSIBLE 572#ifdef DCACHE_ALIASING_POSSIBLE
513 .align 32 573 .align 32
514 .globl xcall_flush_dcache_page_cheetah 574 .globl xcall_flush_dcache_page_cheetah
diff --git a/arch/tile/include/arch/Kbuild b/arch/tile/include/arch/Kbuild
index e69de29bb2d1..3751c9fabcf2 100644
--- a/arch/tile/include/arch/Kbuild
+++ b/arch/tile/include/arch/Kbuild
@@ -0,0 +1 @@
# Tile arch headers
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index c68808a09da7..6948015e08a2 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -1,8 +1,6 @@
1 1
2header-y += ../arch/ 2header-y += ../arch/
3 3
4header-y += ucontext.h
5
6generic-y += bug.h 4generic-y += bug.h
7generic-y += bugs.h 5generic-y += bugs.h
8generic-y += clkdev.h 6generic-y += clkdev.h
@@ -37,5 +35,4 @@ generic-y += statfs.h
37generic-y += termbits.h 35generic-y += termbits.h
38generic-y += termios.h 36generic-y += termios.h
39generic-y += types.h 37generic-y += types.h
40generic-y += ucontext.h
41generic-y += xor.h 38generic-y += xor.h
diff --git a/arch/tile/include/uapi/asm/Kbuild b/arch/tile/include/uapi/asm/Kbuild
index 5c6915fd30b5..c20db8e428bf 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -15,4 +15,7 @@ header-y += siginfo.h
15header-y += signal.h 15header-y += signal.h
16header-y += stat.h 16header-y += stat.h
17header-y += swab.h 17header-y += swab.h
18header-y += ucontext.h
18header-y += unistd.h 19header-y += unistd.h
20
21generic-y += ucontext.h
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 58790bd85c1d..05afcca66de6 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
142KBUILD_CFLAGS += $(mflags-y) 142KBUILD_CFLAGS += $(mflags-y)
143KBUILD_AFLAGS += $(mflags-y) 143KBUILD_AFLAGS += $(mflags-y)
144 144
145archscripts: 145archscripts: scripts_basic
146 $(Q)$(MAKE) $(build)=arch/x86/tools relocs 146 $(Q)$(MAKE) $(build)=arch/x86/tools relocs
147 147
148### 148###
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 7c04d0da709b..1b9c22bea8a7 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -515,6 +515,11 @@ static int xts_aesni_setkey(struct crypto_tfm *tfm, const u8 *key,
515} 515}
516 516
517 517
518static void aesni_xts_tweak(void *ctx, u8 *out, const u8 *in)
519{
520 aesni_enc(ctx, out, in);
521}
522
518static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 523static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
519 struct scatterlist *src, unsigned int nbytes) 524 struct scatterlist *src, unsigned int nbytes)
520{ 525{
@@ -525,7 +530,7 @@ static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
525 .tbuflen = sizeof(buf), 530 .tbuflen = sizeof(buf),
526 531
527 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), 532 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx),
528 .tweak_fn = XTS_TWEAK_CAST(aesni_enc), 533 .tweak_fn = aesni_xts_tweak,
529 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), 534 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx),
530 .crypt_fn = lrw_xts_encrypt_callback, 535 .crypt_fn = lrw_xts_encrypt_callback,
531 }; 536 };
@@ -550,7 +555,7 @@ static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
550 .tbuflen = sizeof(buf), 555 .tbuflen = sizeof(buf),
551 556
552 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), 557 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx),
553 .tweak_fn = XTS_TWEAK_CAST(aesni_enc), 558 .tweak_fn = aesni_xts_tweak,
554 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), 559 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx),
555 .crypt_fn = lrw_xts_decrypt_callback, 560 .crypt_fn = lrw_xts_decrypt_callback,
556 }; 561 };
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 9a7c90d80bc4..93c5451bdd52 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -991,7 +991,7 @@ static struct attribute ** __cpuinit amd_l3_attrs(void)
991 if (attrs) 991 if (attrs)
992 return attrs; 992 return attrs;
993 993
994 n = sizeof (default_attrs) / sizeof (struct attribute *); 994 n = ARRAY_SIZE(default_attrs);
995 995
996 if (amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE)) 996 if (amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
997 n += 2; 997 n += 2;
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 29e87d3b2843..46cbf8689692 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2209,11 +2209,6 @@ static struct dev_ext_attribute dev_attr_cmci_disabled = {
2209 &mce_cmci_disabled 2209 &mce_cmci_disabled
2210}; 2210};
2211 2211
2212static struct dev_ext_attribute dev_attr_bios_cmci_threshold = {
2213 __ATTR(bios_cmci_threshold, 0444, device_show_int, NULL),
2214 &mce_bios_cmci_threshold
2215};
2216
2217static struct device_attribute *mce_device_attrs[] = { 2212static struct device_attribute *mce_device_attrs[] = {
2218 &dev_attr_tolerant.attr, 2213 &dev_attr_tolerant.attr,
2219 &dev_attr_check_interval.attr, 2214 &dev_attr_check_interval.attr,
@@ -2222,7 +2217,6 @@ static struct device_attribute *mce_device_attrs[] = {
2222 &dev_attr_dont_log_ce.attr, 2217 &dev_attr_dont_log_ce.attr,
2223 &dev_attr_ignore_ce.attr, 2218 &dev_attr_ignore_ce.attr,
2224 &dev_attr_cmci_disabled.attr, 2219 &dev_attr_cmci_disabled.attr,
2225 &dev_attr_bios_cmci_threshold.attr,
2226 NULL 2220 NULL
2227}; 2221};
2228 2222
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index c4e916d77378..698b6ec12e0f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -576,12 +576,10 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
576 int err = 0; 576 int err = 0;
577 577
578 if (shared_bank[bank]) { 578 if (shared_bank[bank]) {
579
580 nb = node_to_amd_nb(amd_get_nb_id(cpu)); 579 nb = node_to_amd_nb(amd_get_nb_id(cpu));
581 WARN_ON(!nb);
582 580
583 /* threshold descriptor already initialized on this node? */ 581 /* threshold descriptor already initialized on this node? */
584 if (nb->bank4) { 582 if (nb && nb->bank4) {
585 /* yes, use it */ 583 /* yes, use it */
586 b = nb->bank4; 584 b = nb->bank4;
587 err = kobject_add(b->kobj, &dev->kobj, name); 585 err = kobject_add(b->kobj, &dev->kobj, name);
@@ -615,8 +613,10 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
615 atomic_set(&b->cpus, 1); 613 atomic_set(&b->cpus, 1);
616 614
617 /* nb is already initialized, see above */ 615 /* nb is already initialized, see above */
618 WARN_ON(nb->bank4); 616 if (nb) {
619 nb->bank4 = b; 617 WARN_ON(nb->bank4);
618 nb->bank4 = b;
619 }
620 } 620 }
621 621
622 err = allocate_threshold_blocks(cpu, bank, 0, 622 err = allocate_threshold_blocks(cpu, bank, 0,
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 915b876edd1e..3373f84d1397 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -338,6 +338,9 @@ int x86_setup_perfctr(struct perf_event *event)
338 /* BTS is currently only allowed for user-mode. */ 338 /* BTS is currently only allowed for user-mode. */
339 if (!attr->exclude_kernel) 339 if (!attr->exclude_kernel)
340 return -EOPNOTSUPP; 340 return -EOPNOTSUPP;
341
342 if (!attr->exclude_guest)
343 return -EOPNOTSUPP;
341 } 344 }
342 345
343 hwc->config |= config; 346 hwc->config |= config;
@@ -380,6 +383,9 @@ int x86_pmu_hw_config(struct perf_event *event)
380 if (event->attr.precise_ip) { 383 if (event->attr.precise_ip) {
381 int precise = 0; 384 int precise = 0;
382 385
386 if (!event->attr.exclude_guest)
387 return -EOPNOTSUPP;
388
383 /* Support for constant skid */ 389 /* Support for constant skid */
384 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) { 390 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
385 precise++; 391 precise++;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 52190a938b4a..4e8ba39eaf0f 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -358,14 +358,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
358 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"), 358 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"),
359 }, 359 },
360 }, 360 },
361 { /* Handle problems with rebooting on CompuLab SBC-FITPC2 */
362 .callback = set_bios_reboot,
363 .ident = "CompuLab SBC-FITPC2",
364 .matches = {
365 DMI_MATCH(DMI_SYS_VENDOR, "CompuLab"),
366 DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"),
367 },
368 },
369 { /* Handle problems with rebooting on ASUS P4S800 */ 361 { /* Handle problems with rebooting on ASUS P4S800 */
370 .callback = set_bios_reboot, 362 .callback = set_bios_reboot,
371 .ident = "ASUS P4S800", 363 .ident = "ASUS P4S800",
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a2bb18e02839..468e98dfd44e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -920,8 +920,21 @@ void __init setup_arch(char **cmdline_p)
920 920
921#ifdef CONFIG_X86_64 921#ifdef CONFIG_X86_64
922 if (max_pfn > max_low_pfn) { 922 if (max_pfn > max_low_pfn) {
923 max_pfn_mapped = init_memory_mapping(1UL<<32, 923 int i;
924 max_pfn<<PAGE_SHIFT); 924 for (i = 0; i < e820.nr_map; i++) {
925 struct e820entry *ei = &e820.map[i];
926
927 if (ei->addr + ei->size <= 1UL << 32)
928 continue;
929
930 if (ei->type == E820_RESERVED)
931 continue;
932
933 max_pfn_mapped = init_memory_mapping(
934 ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
935 ei->addr + ei->size);
936 }
937
925 /* can we preseve max_low_pfn ?*/ 938 /* can we preseve max_low_pfn ?*/
926 max_low_pfn = max_pfn; 939 max_low_pfn = max_pfn;
927 } 940 }
diff --git a/arch/x86/realmode/rm/wakeup_asm.S b/arch/x86/realmode/rm/wakeup_asm.S
index e56479e58053..9e7e14797a72 100644
--- a/arch/x86/realmode/rm/wakeup_asm.S
+++ b/arch/x86/realmode/rm/wakeup_asm.S
@@ -74,18 +74,9 @@ ENTRY(wakeup_start)
74 74
75 lidtl wakeup_idt 75 lidtl wakeup_idt
76 76
77 /* Clear the EFLAGS but remember if we have EFLAGS.ID */ 77 /* Clear the EFLAGS */
78 movl $X86_EFLAGS_ID, %ecx
79 pushl %ecx
80 popfl
81 pushfl
82 popl %edi
83 pushl $0 78 pushl $0
84 popfl 79 popfl
85 pushfl
86 popl %edx
87 xorl %edx, %edi
88 andl %ecx, %edi /* %edi is zero iff CPUID & %cr4 are missing */
89 80
90 /* Check header signature... */ 81 /* Check header signature... */
91 movl signature, %eax 82 movl signature, %eax
@@ -120,12 +111,12 @@ ENTRY(wakeup_start)
120 movl %eax, %cr3 111 movl %eax, %cr3
121 112
122 btl $WAKEUP_BEHAVIOR_RESTORE_CR4, %edi 113 btl $WAKEUP_BEHAVIOR_RESTORE_CR4, %edi
123 jz 1f 114 jnc 1f
124 movl pmode_cr4, %eax 115 movl pmode_cr4, %eax
125 movl %eax, %cr4 116 movl %eax, %cr4
1261: 1171:
127 btl $WAKEUP_BEHAVIOR_RESTORE_EFER, %edi 118 btl $WAKEUP_BEHAVIOR_RESTORE_EFER, %edi
128 jz 1f 119 jnc 1f
129 movl pmode_efer, %eax 120 movl pmode_efer, %eax
130 movl pmode_efer + 4, %edx 121 movl pmode_efer + 4, %edx
131 movl $MSR_EFER, %ecx 122 movl $MSR_EFER, %ecx
diff --git a/arch/xtensa/boot/boot-redboot/bootstrap.S b/arch/xtensa/boot/boot-redboot/bootstrap.S
index 4c316cd28a54..86c34dbc9cd0 100644
--- a/arch/xtensa/boot/boot-redboot/bootstrap.S
+++ b/arch/xtensa/boot/boot-redboot/bootstrap.S
@@ -51,17 +51,17 @@ _start:
51 /* 'reset' window registers */ 51 /* 'reset' window registers */
52 52
53 movi a4, 1 53 movi a4, 1
54 wsr a4, PS 54 wsr a4, ps
55 rsync 55 rsync
56 56
57 rsr a5, WINDOWBASE 57 rsr a5, windowbase
58 ssl a5 58 ssl a5
59 sll a4, a4 59 sll a4, a4
60 wsr a4, WINDOWSTART 60 wsr a4, windowstart
61 rsync 61 rsync
62 62
63 movi a4, 0x00040000 63 movi a4, 0x00040000
64 wsr a4, PS 64 wsr a4, ps
65 rsync 65 rsync
66 66
67 /* copy the loader to its address 67 /* copy the loader to its address
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index fccd81eddff1..6d1302789995 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,4 +1,28 @@
1include include/asm-generic/Kbuild.asm 1generic-y += bitsperlong.h
2 2generic-y += bug.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += cputime.h
5generic-y += device.h
6generic-y += div64.h
7generic-y += emergency-restart.h
8generic-y += errno.h
4generic-y += exec.h 9generic-y += exec.h
10generic-y += fcntl.h
11generic-y += futex.h
12generic-y += hardirq.h
13generic-y += ioctl.h
14generic-y += irq_regs.h
15generic-y += kdebug.h
16generic-y += kmap_types.h
17generic-y += kvm_para.h
18generic-y += local.h
19generic-y += local64.h
20generic-y += percpu.h
21generic-y += resource.h
22generic-y += scatterlist.h
23generic-y += sections.h
24generic-y += siginfo.h
25generic-y += statfs.h
26generic-y += termios.h
27generic-y += topology.h
28generic-y += xor.h
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h
index b40989308775..24f50cada70c 100644
--- a/arch/xtensa/include/asm/atomic.h
+++ b/arch/xtensa/include/asm/atomic.h
@@ -73,7 +73,7 @@ static inline void atomic_add(int i, atomic_t * v)
73 "l32i %0, %2, 0 \n\t" 73 "l32i %0, %2, 0 \n\t"
74 "add %0, %0, %1 \n\t" 74 "add %0, %0, %1 \n\t"
75 "s32i %0, %2, 0 \n\t" 75 "s32i %0, %2, 0 \n\t"
76 "wsr a15, "__stringify(PS)" \n\t" 76 "wsr a15, ps \n\t"
77 "rsync \n" 77 "rsync \n"
78 : "=&a" (vval) 78 : "=&a" (vval)
79 : "a" (i), "a" (v) 79 : "a" (i), "a" (v)
@@ -97,7 +97,7 @@ static inline void atomic_sub(int i, atomic_t *v)
97 "l32i %0, %2, 0 \n\t" 97 "l32i %0, %2, 0 \n\t"
98 "sub %0, %0, %1 \n\t" 98 "sub %0, %0, %1 \n\t"
99 "s32i %0, %2, 0 \n\t" 99 "s32i %0, %2, 0 \n\t"
100 "wsr a15, "__stringify(PS)" \n\t" 100 "wsr a15, ps \n\t"
101 "rsync \n" 101 "rsync \n"
102 : "=&a" (vval) 102 : "=&a" (vval)
103 : "a" (i), "a" (v) 103 : "a" (i), "a" (v)
@@ -118,7 +118,7 @@ static inline int atomic_add_return(int i, atomic_t * v)
118 "l32i %0, %2, 0 \n\t" 118 "l32i %0, %2, 0 \n\t"
119 "add %0, %0, %1 \n\t" 119 "add %0, %0, %1 \n\t"
120 "s32i %0, %2, 0 \n\t" 120 "s32i %0, %2, 0 \n\t"
121 "wsr a15, "__stringify(PS)" \n\t" 121 "wsr a15, ps \n\t"
122 "rsync \n" 122 "rsync \n"
123 : "=&a" (vval) 123 : "=&a" (vval)
124 : "a" (i), "a" (v) 124 : "a" (i), "a" (v)
@@ -137,7 +137,7 @@ static inline int atomic_sub_return(int i, atomic_t * v)
137 "l32i %0, %2, 0 \n\t" 137 "l32i %0, %2, 0 \n\t"
138 "sub %0, %0, %1 \n\t" 138 "sub %0, %0, %1 \n\t"
139 "s32i %0, %2, 0 \n\t" 139 "s32i %0, %2, 0 \n\t"
140 "wsr a15, "__stringify(PS)" \n\t" 140 "wsr a15, ps \n\t"
141 "rsync \n" 141 "rsync \n"
142 : "=&a" (vval) 142 : "=&a" (vval)
143 : "a" (i), "a" (v) 143 : "a" (i), "a" (v)
@@ -260,7 +260,7 @@ static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
260 "xor %1, %4, %3 \n\t" 260 "xor %1, %4, %3 \n\t"
261 "and %0, %0, %4 \n\t" 261 "and %0, %0, %4 \n\t"
262 "s32i %0, %2, 0 \n\t" 262 "s32i %0, %2, 0 \n\t"
263 "wsr a15, "__stringify(PS)" \n\t" 263 "wsr a15, ps \n\t"
264 "rsync \n" 264 "rsync \n"
265 : "=&a" (vval), "=a" (mask) 265 : "=&a" (vval), "=a" (mask)
266 : "a" (v), "a" (all_f), "1" (mask) 266 : "a" (v), "a" (all_f), "1" (mask)
@@ -277,7 +277,7 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
277 "l32i %0, %2, 0 \n\t" 277 "l32i %0, %2, 0 \n\t"
278 "or %0, %0, %1 \n\t" 278 "or %0, %0, %1 \n\t"
279 "s32i %0, %2, 0 \n\t" 279 "s32i %0, %2, 0 \n\t"
280 "wsr a15, "__stringify(PS)" \n\t" 280 "wsr a15, ps \n\t"
281 "rsync \n" 281 "rsync \n"
282 : "=&a" (vval) 282 : "=&a" (vval)
283 : "a" (mask), "a" (v) 283 : "a" (mask), "a" (v)
diff --git a/arch/xtensa/include/asm/bitsperlong.h b/arch/xtensa/include/asm/bitsperlong.h
deleted file mode 100644
index 6dc0bb0c13b2..000000000000
--- a/arch/xtensa/include/asm/bitsperlong.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bitsperlong.h>
diff --git a/arch/xtensa/include/asm/bug.h b/arch/xtensa/include/asm/bug.h
deleted file mode 100644
index 3e52d72712f1..000000000000
--- a/arch/xtensa/include/asm/bug.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-xtensa/bug.h
3 *
4 * Macros to cause a 'bug' message.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_BUG_H
14#define _XTENSA_BUG_H
15
16#include <asm-generic/bug.h>
17
18#endif /* _XTENSA_BUG_H */
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 376cd9d5f455..569fec4f9a20 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -165,7 +165,7 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
165static inline u32 xtensa_get_cacheattr(void) 165static inline u32 xtensa_get_cacheattr(void)
166{ 166{
167 u32 r; 167 u32 r;
168 asm volatile(" rsr %0, CACHEATTR" : "=a"(r)); 168 asm volatile(" rsr %0, cacheattr" : "=a"(r));
169 return r; 169 return r;
170} 170}
171 171
diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h
index e32149063d83..64dad04a9d27 100644
--- a/arch/xtensa/include/asm/cmpxchg.h
+++ b/arch/xtensa/include/asm/cmpxchg.h
@@ -27,7 +27,7 @@ __cmpxchg_u32(volatile int *p, int old, int new)
27 "bne %0, %2, 1f \n\t" 27 "bne %0, %2, 1f \n\t"
28 "s32i %3, %1, 0 \n\t" 28 "s32i %3, %1, 0 \n\t"
29 "1: \n\t" 29 "1: \n\t"
30 "wsr a15, "__stringify(PS)" \n\t" 30 "wsr a15, ps \n\t"
31 "rsync \n\t" 31 "rsync \n\t"
32 : "=&a" (old) 32 : "=&a" (old)
33 : "a" (p), "a" (old), "r" (new) 33 : "a" (p), "a" (old), "r" (new)
@@ -97,7 +97,7 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
97 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t" 97 __asm__ __volatile__("rsil a15, "__stringify(LOCKLEVEL)"\n\t"
98 "l32i %0, %1, 0 \n\t" 98 "l32i %0, %1, 0 \n\t"
99 "s32i %2, %1, 0 \n\t" 99 "s32i %2, %1, 0 \n\t"
100 "wsr a15, "__stringify(PS)" \n\t" 100 "wsr a15, ps \n\t"
101 "rsync \n\t" 101 "rsync \n\t"
102 : "=&a" (tmp) 102 : "=&a" (tmp)
103 : "a" (m), "a" (val) 103 : "a" (m), "a" (val)
diff --git a/arch/xtensa/include/asm/coprocessor.h b/arch/xtensa/include/asm/coprocessor.h
index 75c94a1658b0..677501b32dfc 100644
--- a/arch/xtensa/include/asm/coprocessor.h
+++ b/arch/xtensa/include/asm/coprocessor.h
@@ -94,11 +94,10 @@
94#if XCHAL_HAVE_CP 94#if XCHAL_HAVE_CP
95 95
96#define RSR_CPENABLE(x) do { \ 96#define RSR_CPENABLE(x) do { \
97 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \ 97 __asm__ __volatile__("rsr %0, cpenable" : "=a" (x)); \
98 } while(0); 98 } while(0);
99#define WSR_CPENABLE(x) do { \ 99#define WSR_CPENABLE(x) do { \
100 __asm__ __volatile__("wsr %0," __stringify(CPENABLE) "; rsync" \ 100 __asm__ __volatile__("wsr %0, cpenable; rsync" :: "a" (x)); \
101 :: "a" (x)); \
102 } while(0); 101 } while(0);
103 102
104#endif /* XCHAL_HAVE_CP */ 103#endif /* XCHAL_HAVE_CP */
diff --git a/arch/xtensa/include/asm/cputime.h b/arch/xtensa/include/asm/cputime.h
deleted file mode 100644
index a7fb864a50ae..000000000000
--- a/arch/xtensa/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _XTENSA_CPUTIME_H
2#define _XTENSA_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* _XTENSA_CPUTIME_H */
diff --git a/arch/xtensa/include/asm/delay.h b/arch/xtensa/include/asm/delay.h
index e1d8c9e010c1..58c0a4fd4003 100644
--- a/arch/xtensa/include/asm/delay.h
+++ b/arch/xtensa/include/asm/delay.h
@@ -27,7 +27,7 @@ static inline void __delay(unsigned long loops)
27static __inline__ u32 xtensa_get_ccount(void) 27static __inline__ u32 xtensa_get_ccount(void)
28{ 28{
29 u32 ccount; 29 u32 ccount;
30 asm volatile ("rsr %0, 234; # CCOUNT\n" : "=r" (ccount)); 30 asm volatile ("rsr %0, ccount\n" : "=r" (ccount));
31 return ccount; 31 return ccount;
32} 32}
33 33
diff --git a/arch/xtensa/include/asm/device.h b/arch/xtensa/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/xtensa/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/xtensa/include/asm/div64.h b/arch/xtensa/include/asm/div64.h
deleted file mode 100644
index f35678cb0a9b..000000000000
--- a/arch/xtensa/include/asm/div64.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/div64.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_DIV64_H
12#define _XTENSA_DIV64_H
13
14#include <asm-generic/div64.h>
15
16#endif /* _XTENSA_DIV64_H */
diff --git a/arch/xtensa/include/asm/emergency-restart.h b/arch/xtensa/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/xtensa/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/xtensa/include/asm/errno.h b/arch/xtensa/include/asm/errno.h
deleted file mode 100644
index a0f3b96b79b4..000000000000
--- a/arch/xtensa/include/asm/errno.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/errno.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2002 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_ERRNO_H
12#define _XTENSA_ERRNO_H
13
14#include <asm-generic/errno.h>
15
16#endif /* _XTENSA_ERRNO_H */
diff --git a/arch/xtensa/include/asm/fcntl.h b/arch/xtensa/include/asm/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/arch/xtensa/include/asm/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/arch/xtensa/include/asm/futex.h b/arch/xtensa/include/asm/futex.h
deleted file mode 100644
index 0b745828f42b..000000000000
--- a/arch/xtensa/include/asm/futex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/futex.h>
diff --git a/arch/xtensa/include/asm/hardirq.h b/arch/xtensa/include/asm/hardirq.h
deleted file mode 100644
index 91695a135498..000000000000
--- a/arch/xtensa/include/asm/hardirq.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/hardirq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
7 *
8 * Copyright (C) 2002 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_HARDIRQ_H
12#define _XTENSA_HARDIRQ_H
13
14#include <asm-generic/hardirq.h>
15
16#endif /* _XTENSA_HARDIRQ_H */
diff --git a/arch/xtensa/include/asm/ioctl.h b/arch/xtensa/include/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/arch/xtensa/include/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/xtensa/include/asm/irq_regs.h b/arch/xtensa/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/xtensa/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/xtensa/include/asm/irqflags.h b/arch/xtensa/include/asm/irqflags.h
index dae9a8bdcb17..f865b1c1eae4 100644
--- a/arch/xtensa/include/asm/irqflags.h
+++ b/arch/xtensa/include/asm/irqflags.h
@@ -16,7 +16,7 @@
16static inline unsigned long arch_local_save_flags(void) 16static inline unsigned long arch_local_save_flags(void)
17{ 17{
18 unsigned long flags; 18 unsigned long flags;
19 asm volatile("rsr %0,"__stringify(PS) : "=a" (flags)); 19 asm volatile("rsr %0, ps" : "=a" (flags));
20 return flags; 20 return flags;
21} 21}
22 22
@@ -41,7 +41,7 @@ static inline void arch_local_irq_enable(void)
41 41
42static inline void arch_local_irq_restore(unsigned long flags) 42static inline void arch_local_irq_restore(unsigned long flags)
43{ 43{
44 asm volatile("wsr %0, "__stringify(PS)" ; rsync" 44 asm volatile("wsr %0, ps; rsync"
45 :: "a" (flags) : "memory"); 45 :: "a" (flags) : "memory");
46} 46}
47 47
diff --git a/arch/xtensa/include/asm/kdebug.h b/arch/xtensa/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/xtensa/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/xtensa/include/asm/kmap_types.h b/arch/xtensa/include/asm/kmap_types.h
deleted file mode 100644
index 11c687e527f1..000000000000
--- a/arch/xtensa/include/asm/kmap_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _XTENSA_KMAP_TYPES_H
2#define _XTENSA_KMAP_TYPES_H
3
4#include <asm-generic/kmap_types.h>
5
6#endif /* _XTENSA_KMAP_TYPES_H */
diff --git a/arch/xtensa/include/asm/kvm_para.h b/arch/xtensa/include/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b957..000000000000
--- a/arch/xtensa/include/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/xtensa/include/asm/local.h b/arch/xtensa/include/asm/local.h
deleted file mode 100644
index 48723e550d14..000000000000
--- a/arch/xtensa/include/asm/local.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/local.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_LOCAL_H
12#define _XTENSA_LOCAL_H
13
14#include <asm-generic/local.h>
15
16#endif /* _XTENSA_LOCAL_H */
diff --git a/arch/xtensa/include/asm/local64.h b/arch/xtensa/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/xtensa/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/xtensa/include/asm/mmu_context.h b/arch/xtensa/include/asm/mmu_context.h
index dbd8731a876a..feb10af96519 100644
--- a/arch/xtensa/include/asm/mmu_context.h
+++ b/arch/xtensa/include/asm/mmu_context.h
@@ -51,14 +51,14 @@ extern unsigned long asid_cache;
51 51
52static inline void set_rasid_register (unsigned long val) 52static inline void set_rasid_register (unsigned long val)
53{ 53{
54 __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t" 54 __asm__ __volatile__ (" wsr %0, rasid\n\t"
55 " isync\n" : : "a" (val)); 55 " isync\n" : : "a" (val));
56} 56}
57 57
58static inline unsigned long get_rasid_register (void) 58static inline unsigned long get_rasid_register (void)
59{ 59{
60 unsigned long tmp; 60 unsigned long tmp;
61 __asm__ __volatile__ (" rsr %0,"__stringify(RASID)"\n\t" : "=a" (tmp)); 61 __asm__ __volatile__ (" rsr %0, rasid\n\t" : "=a" (tmp));
62 return tmp; 62 return tmp;
63} 63}
64 64
diff --git a/arch/xtensa/include/asm/param.h b/arch/xtensa/include/asm/param.h
index ba03d5aeab6b..0a70e780ef2a 100644
--- a/arch/xtensa/include/asm/param.h
+++ b/arch/xtensa/include/asm/param.h
@@ -7,28 +7,12 @@
7 * 7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */ 9 */
10
11#ifndef _XTENSA_PARAM_H 10#ifndef _XTENSA_PARAM_H
12#define _XTENSA_PARAM_H 11#define _XTENSA_PARAM_H
13 12
14#ifdef __KERNEL__ 13#include <uapi/asm/param.h>
14
15# define HZ CONFIG_HZ /* internal timer frequency */ 15# define HZ CONFIG_HZ /* internal timer frequency */
16# define USER_HZ 100 /* for user interfaces in "ticks" */ 16# define USER_HZ 100 /* for user interfaces in "ticks" */
17# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */ 17# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
18#else
19# define HZ 100
20#endif
21
22#define EXEC_PAGESIZE 4096
23
24#ifndef NGROUPS
25#define NGROUPS 32
26#endif
27
28#ifndef NOGROUP
29#define NOGROUP (-1)
30#endif
31
32#define MAXHOSTNAMELEN 64 /* max length of hostname */
33
34#endif /* _XTENSA_PARAM_H */ 18#endif /* _XTENSA_PARAM_H */
diff --git a/arch/xtensa/include/asm/percpu.h b/arch/xtensa/include/asm/percpu.h
deleted file mode 100644
index 6d2bc2ada9d1..000000000000
--- a/arch/xtensa/include/asm/percpu.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * linux/include/asm-xtensa/percpu.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_PERCPU__
12#define _XTENSA_PERCPU__
13
14#include <asm-generic/percpu.h>
15
16#endif /* _XTENSA_PERCPU__ */
diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index d85d38da8eec..da21c17f23aa 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -7,73 +7,11 @@
7 * 7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */ 9 */
10
11#ifndef _XTENSA_PTRACE_H 10#ifndef _XTENSA_PTRACE_H
12#define _XTENSA_PTRACE_H 11#define _XTENSA_PTRACE_H
13 12
14/* 13#include <uapi/asm/ptrace.h>
15 * Kernel stack
16 *
17 * +-----------------------+ -------- STACK_SIZE
18 * | register file | |
19 * +-----------------------+ |
20 * | struct pt_regs | |
21 * +-----------------------+ | ------ PT_REGS_OFFSET
22 * double : 16 bytes spill area : | ^
23 * excetion :- - - - - - - - - - - -: | |
24 * frame : struct pt_regs : | |
25 * :- - - - - - - - - - - -: | |
26 * | | | |
27 * | memory stack | | |
28 * | | | |
29 * ~ ~ ~ ~
30 * ~ ~ ~ ~
31 * | | | |
32 * | | | |
33 * +-----------------------+ | | --- STACK_BIAS
34 * | struct task_struct | | | ^
35 * current --> +-----------------------+ | | |
36 * | struct thread_info | | | |
37 * +-----------------------+ --------
38 */
39
40#define KERNEL_STACK_SIZE (2 * PAGE_SIZE)
41
42/* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */
43
44#define EXC_TABLE_KSTK 0x004 /* Kernel Stack */
45#define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */
46#define EXC_TABLE_FIXUP 0x00c /* Fixup handler */
47#define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */
48#define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */
49#define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */
50#define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */
51#define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */
52#define EXC_TABLE_SIZE 0x400
53 14
54/* Registers used by strace */
55
56#define REG_A_BASE 0x0000
57#define REG_AR_BASE 0x0100
58#define REG_PC 0x0020
59#define REG_PS 0x02e6
60#define REG_WB 0x0248
61#define REG_WS 0x0249
62#define REG_LBEG 0x0200
63#define REG_LEND 0x0201
64#define REG_LCOUNT 0x0202
65#define REG_SAR 0x0203
66
67#define SYSCALL_NR 0x00ff
68
69/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
70
71#define PTRACE_GETREGS 12
72#define PTRACE_SETREGS 13
73#define PTRACE_GETXTREGS 18
74#define PTRACE_SETXTREGS 19
75
76#ifdef __KERNEL__
77 15
78#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
79 17
@@ -132,6 +70,4 @@ struct pt_regs {
132 70
133#endif /* !__ASSEMBLY__ */ 71#endif /* !__ASSEMBLY__ */
134 72
135#endif /* __KERNEL__ */
136
137#endif /* _XTENSA_PTRACE_H */ 73#endif /* _XTENSA_PTRACE_H */
diff --git a/arch/xtensa/include/asm/regs.h b/arch/xtensa/include/asm/regs.h
index a3075b12aff1..8a8aa61ccc8d 100644
--- a/arch/xtensa/include/asm/regs.h
+++ b/arch/xtensa/include/asm/regs.h
@@ -27,52 +27,15 @@
27 27
28/* Special registers. */ 28/* Special registers. */
29 29
30#define LBEG 0 30#define SREG_MR 32
31#define LEND 1 31#define SREG_IBREAKA 128
32#define LCOUNT 2 32#define SREG_DBREAKA 144
33#define SAR 3 33#define SREG_DBREAKC 160
34#define BR 4 34#define SREG_EPC 176
35#define SCOMPARE1 12 35#define SREG_EPS 192
36#define ACCHI 16 36#define SREG_EXCSAVE 208
37#define ACCLO 17 37#define SREG_CCOMPARE 240
38#define MR 32 38#define SREG_MISC 244
39#define WINDOWBASE 72
40#define WINDOWSTART 73
41#define PTEVADDR 83
42#define RASID 90
43#define ITLBCFG 91
44#define DTLBCFG 92
45#define IBREAKENABLE 96
46#define DDR 104
47#define IBREAKA 128
48#define DBREAKA 144
49#define DBREAKC 160
50#define EPC 176
51#define EPC_1 177
52#define DEPC 192
53#define EPS 192
54#define EPS_1 193
55#define EXCSAVE 208
56#define EXCSAVE_1 209
57#define INTERRUPT 226
58#define INTENABLE 228
59#define PS 230
60#define THREADPTR 231
61#define EXCCAUSE 232
62#define DEBUGCAUSE 233
63#define CCOUNT 234
64#define PRID 235
65#define ICOUNT 236
66#define ICOUNTLEVEL 237
67#define EXCVADDR 238
68#define CCOMPARE 240
69#define MISC_SR 244
70
71/* Special names for read-only and write-only interrupt registers. */
72
73#define INTREAD 226
74#define INTSET 226
75#define INTCLEAR 227
76 39
77/* EXCCAUSE register fields */ 40/* EXCCAUSE register fields */
78 41
diff --git a/arch/xtensa/include/asm/resource.h b/arch/xtensa/include/asm/resource.h
deleted file mode 100644
index 17b5ab311771..000000000000
--- a/arch/xtensa/include/asm/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/resource.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_RESOURCE_H
12#define _XTENSA_RESOURCE_H
13
14#include <asm-generic/resource.h>
15
16#endif /* _XTENSA_RESOURCE_H */
diff --git a/arch/xtensa/include/asm/scatterlist.h b/arch/xtensa/include/asm/scatterlist.h
deleted file mode 100644
index a0421a61d9e1..000000000000
--- a/arch/xtensa/include/asm/scatterlist.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/scatterlist.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SCATTERLIST_H
12#define _XTENSA_SCATTERLIST_H
13
14#include <asm-generic/scatterlist.h>
15
16#endif /* _XTENSA_SCATTERLIST_H */
diff --git a/arch/xtensa/include/asm/sections.h b/arch/xtensa/include/asm/sections.h
deleted file mode 100644
index 40b5191b55a2..000000000000
--- a/arch/xtensa/include/asm/sections.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/sections.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SECTIONS_H
12#define _XTENSA_SECTIONS_H
13
14#include <asm-generic/sections.h>
15
16#endif /* _XTENSA_SECTIONS_H */
diff --git a/arch/xtensa/include/asm/siginfo.h b/arch/xtensa/include/asm/siginfo.h
deleted file mode 100644
index 6916248295df..000000000000
--- a/arch/xtensa/include/asm/siginfo.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/siginfo.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_SIGINFO_H
12#define _XTENSA_SIGINFO_H
13
14#include <asm-generic/siginfo.h>
15
16#endif /* _XTENSA_SIGINFO_H */
diff --git a/arch/xtensa/include/asm/signal.h b/arch/xtensa/include/asm/signal.h
index 7f201b9d4195..72fd44c85b70 100644
--- a/arch/xtensa/include/asm/signal.h
+++ b/arch/xtensa/include/asm/signal.h
@@ -9,117 +9,12 @@
9 * 9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc. 10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */ 11 */
12
13#ifndef _XTENSA_SIGNAL_H 12#ifndef _XTENSA_SIGNAL_H
14#define _XTENSA_SIGNAL_H 13#define _XTENSA_SIGNAL_H
15 14
16 15#include <uapi/asm/signal.h>
17#define _NSIG 64
18#define _NSIG_BPW 32
19#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20
21#ifndef __ASSEMBLY__
22
23#include <linux/types.h>
24
25/* Avoid too many header ordering problems. */
26struct siginfo;
27typedef unsigned long old_sigset_t; /* at least 32 bits */
28typedef struct {
29 unsigned long sig[_NSIG_WORDS];
30} sigset_t;
31
32#endif
33
34#define SIGHUP 1
35#define SIGINT 2
36#define SIGQUIT 3
37#define SIGILL 4
38#define SIGTRAP 5
39#define SIGABRT 6
40#define SIGIOT 6
41#define SIGBUS 7
42#define SIGFPE 8
43#define SIGKILL 9
44#define SIGUSR1 10
45#define SIGSEGV 11
46#define SIGUSR2 12
47#define SIGPIPE 13
48#define SIGALRM 14
49#define SIGTERM 15
50#define SIGSTKFLT 16
51#define SIGCHLD 17
52#define SIGCONT 18
53#define SIGSTOP 19
54#define SIGTSTP 20
55#define SIGTTIN 21
56#define SIGTTOU 22
57#define SIGURG 23
58#define SIGXCPU 24
59#define SIGXFSZ 25
60#define SIGVTALRM 26
61#define SIGPROF 27
62#define SIGWINCH 28
63#define SIGIO 29
64#define SIGPOLL SIGIO
65/* #define SIGLOST 29 */
66#define SIGPWR 30
67#define SIGSYS 31
68#define SIGUNUSED 31
69
70/* These should not be considered constants from userland. */
71#define SIGRTMIN 32
72#define SIGRTMAX (_NSIG-1)
73
74/*
75 * SA_FLAGS values:
76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered.
81 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
82 * SA_NODEFER prevents the current signal from being masked in the handler.
83 *
84 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
85 * Unix names RESETHAND and NODEFER respectively.
86 */
87#define SA_NOCLDSTOP 0x00000001
88#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
89#define SA_SIGINFO 0x00000004
90#define SA_ONSTACK 0x08000000
91#define SA_RESTART 0x10000000
92#define SA_NODEFER 0x40000000
93#define SA_RESETHAND 0x80000000
94
95#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND
97
98#define SA_RESTORER 0x04000000
99
100/*
101 * sigaltstack controls
102 */
103#define SS_ONSTACK 1
104#define SS_DISABLE 2
105
106#define MINSIGSTKSZ 2048
107#define SIGSTKSZ 8192
108 16
109#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
110
111#define SIG_BLOCK 0 /* for blocking signals */
112#define SIG_UNBLOCK 1 /* for unblocking signals */
113#define SIG_SETMASK 2 /* for setting the signal mask */
114
115/* Type of a signal handler. */
116typedef void (*__sighandler_t)(int);
117
118#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
119#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
120#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
121
122#ifdef __KERNEL__
123struct sigaction { 18struct sigaction {
124 __sighandler_t sa_handler; 19 __sighandler_t sa_handler;
125 unsigned long sa_flags; 20 unsigned long sa_flags;
@@ -131,35 +26,8 @@ struct k_sigaction {
131 struct sigaction sa; 26 struct sigaction sa;
132}; 27};
133 28
134#else
135
136/* Here we must cater to libcs that poke about in kernel headers. */
137
138struct sigaction {
139 union {
140 __sighandler_t _sa_handler;
141 void (*_sa_sigaction)(int, struct siginfo *, void *);
142 } _u;
143 sigset_t sa_mask;
144 unsigned long sa_flags;
145 void (*sa_restorer)(void);
146};
147
148#define sa_handler _u._sa_handler
149#define sa_sigaction _u._sa_sigaction
150
151#endif /* __KERNEL__ */
152
153typedef struct sigaltstack {
154 void *ss_sp;
155 int ss_flags;
156 size_t ss_size;
157} stack_t;
158
159#ifdef __KERNEL__
160#include <asm/sigcontext.h> 29#include <asm/sigcontext.h>
161#define ptrace_signal_deliver(regs, cookie) do { } while (0) 30#define ptrace_signal_deliver(regs, cookie) do { } while (0)
162 31
163#endif /* __KERNEL__ */
164#endif /* __ASSEMBLY__ */ 32#endif /* __ASSEMBLY__ */
165#endif /* _XTENSA_SIGNAL_H */ 33#endif /* _XTENSA_SIGNAL_H */
diff --git a/arch/xtensa/include/asm/statfs.h b/arch/xtensa/include/asm/statfs.h
deleted file mode 100644
index 9c3d1a213136..000000000000
--- a/arch/xtensa/include/asm/statfs.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * include/asm-xtensa/statfs.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_STATFS_H
12#define _XTENSA_STATFS_H
13
14#include <asm-generic/statfs.h>
15
16#endif /* _XTENSA_STATFS_H */
17
diff --git a/arch/xtensa/include/asm/termios.h b/arch/xtensa/include/asm/termios.h
deleted file mode 100644
index 4673f42f88a7..000000000000
--- a/arch/xtensa/include/asm/termios.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * include/asm-xtensa/termios.h
3 *
4 * Copied from SH.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_TERMIOS_H
14#define _XTENSA_TERMIOS_H
15
16#include <asm/termbits.h>
17#include <asm/ioctls.h>
18
19struct winsize {
20 unsigned short ws_row;
21 unsigned short ws_col;
22 unsigned short ws_xpixel;
23 unsigned short ws_ypixel;
24};
25
26#define NCC 8
27struct termio {
28 unsigned short c_iflag; /* input mode flags */
29 unsigned short c_oflag; /* output mode flags */
30 unsigned short c_cflag; /* control mode flags */
31 unsigned short c_lflag; /* local mode flags */
32 unsigned char c_line; /* line discipline */
33 unsigned char c_cc[NCC]; /* control characters */
34};
35
36/* Modem lines */
37
38#define TIOCM_LE 0x001
39#define TIOCM_DTR 0x002
40#define TIOCM_RTS 0x004
41#define TIOCM_ST 0x008
42#define TIOCM_SR 0x010
43#define TIOCM_CTS 0x020
44#define TIOCM_CAR 0x040
45#define TIOCM_RNG 0x080
46#define TIOCM_DSR 0x100
47#define TIOCM_CD TIOCM_CAR
48#define TIOCM_RI TIOCM_RNG
49#define TIOCM_OUT1 0x2000
50#define TIOCM_OUT2 0x4000
51#define TIOCM_LOOP 0x8000
52
53/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
54
55#ifdef __KERNEL__
56
57/* intr=^C quit=^\ erase=del kill=^U
58 eof=^D vtime=\0 vmin=\1 sxtc=\0
59 start=^Q stop=^S susp=^Z eol=\0
60 reprint=^R discard=^U werase=^W lnext=^V
61 eol2=\0
62*/
63#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
64
65/*
66 * Translate a "termio" structure into a "termios". Ugh.
67 */
68
69#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
70 unsigned short __tmp; \
71 get_user(__tmp,&(termio)->x); \
72 *(unsigned short *) &(termios)->x = __tmp; \
73}
74
75#define user_termio_to_kernel_termios(termios, termio) \
76({ \
77 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
78 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
79 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
80 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
81 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
82})
83
84/*
85 * Translate a "termios" structure into a "termio". Ugh.
86 */
87
88#define kernel_termios_to_user_termio(termio, termios) \
89({ \
90 put_user((termios)->c_iflag, &(termio)->c_iflag); \
91 put_user((termios)->c_oflag, &(termio)->c_oflag); \
92 put_user((termios)->c_cflag, &(termio)->c_cflag); \
93 put_user((termios)->c_lflag, &(termio)->c_lflag); \
94 put_user((termios)->c_line, &(termio)->c_line); \
95 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
96})
97
98#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
99#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
100#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
101#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
102
103#endif /* __KERNEL__ */
104
105#endif /* _XTENSA_TERMIOS_H */
diff --git a/arch/xtensa/include/asm/timex.h b/arch/xtensa/include/asm/timex.h
index 053bc4272106..175b3d5e1b01 100644
--- a/arch/xtensa/include/asm/timex.h
+++ b/arch/xtensa/include/asm/timex.h
@@ -63,10 +63,10 @@ extern cycles_t cacheflush_time;
63 * Register access. 63 * Register access.
64 */ 64 */
65 65
66#define WSR_CCOUNT(r) asm volatile ("wsr %0,"__stringify(CCOUNT) :: "a" (r)) 66#define WSR_CCOUNT(r) asm volatile ("wsr %0, ccount" :: "a" (r))
67#define RSR_CCOUNT(r) asm volatile ("rsr %0,"__stringify(CCOUNT) : "=a" (r)) 67#define RSR_CCOUNT(r) asm volatile ("rsr %0, ccount" : "=a" (r))
68#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r)) 68#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) :: "a"(r))
69#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r)) 69#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(SREG_CCOMPARE)"+"__stringify(x) : "=a"(r))
70 70
71static inline unsigned long get_ccount (void) 71static inline unsigned long get_ccount (void)
72{ 72{
diff --git a/arch/xtensa/include/asm/tlbflush.h b/arch/xtensa/include/asm/tlbflush.h
index 46d240074f74..43dd348a5a47 100644
--- a/arch/xtensa/include/asm/tlbflush.h
+++ b/arch/xtensa/include/asm/tlbflush.h
@@ -86,26 +86,26 @@ static inline void invalidate_dtlb_entry_no_isync (unsigned entry)
86 86
87static inline void set_itlbcfg_register (unsigned long val) 87static inline void set_itlbcfg_register (unsigned long val)
88{ 88{
89 __asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t" 89 __asm__ __volatile__("wsr %0, itlbcfg\n\t" "isync\n\t"
90 : : "a" (val)); 90 : : "a" (val));
91} 91}
92 92
93static inline void set_dtlbcfg_register (unsigned long val) 93static inline void set_dtlbcfg_register (unsigned long val)
94{ 94{
95 __asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t" 95 __asm__ __volatile__("wsr %0, dtlbcfg; dsync\n\t"
96 : : "a" (val)); 96 : : "a" (val));
97} 97}
98 98
99static inline void set_ptevaddr_register (unsigned long val) 99static inline void set_ptevaddr_register (unsigned long val)
100{ 100{
101 __asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n" 101 __asm__ __volatile__(" wsr %0, ptevaddr; isync\n"
102 : : "a" (val)); 102 : : "a" (val));
103} 103}
104 104
105static inline unsigned long read_ptevaddr_register (void) 105static inline unsigned long read_ptevaddr_register (void)
106{ 106{
107 unsigned long tmp; 107 unsigned long tmp;
108 __asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp)); 108 __asm__ __volatile__("rsr %0, ptevaddr\n\t" : "=a" (tmp));
109 return tmp; 109 return tmp;
110} 110}
111 111
diff --git a/arch/xtensa/include/asm/topology.h b/arch/xtensa/include/asm/topology.h
deleted file mode 100644
index 7309e38a0ccb..000000000000
--- a/arch/xtensa/include/asm/topology.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/topology.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_TOPOLOGY_H
12#define _XTENSA_TOPOLOGY_H
13
14#include <asm-generic/topology.h>
15
16#endif /* _XTENSA_TOPOLOGY_H */
diff --git a/arch/xtensa/include/asm/types.h b/arch/xtensa/include/asm/types.h
index 6d4db7e8ffac..2b410b8c7f79 100644
--- a/arch/xtensa/include/asm/types.h
+++ b/arch/xtensa/include/asm/types.h
@@ -7,30 +7,17 @@
7 * 7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */ 9 */
10
11#ifndef _XTENSA_TYPES_H 10#ifndef _XTENSA_TYPES_H
12#define _XTENSA_TYPES_H 11#define _XTENSA_TYPES_H
13 12
14#include <asm-generic/int-ll64.h> 13#include <uapi/asm/types.h>
15
16#ifdef __ASSEMBLY__
17# define __XTENSA_UL(x) (x)
18# define __XTENSA_UL_CONST(x) x
19#else
20# define __XTENSA_UL(x) ((unsigned long)(x))
21# define __XTENSA_UL_CONST(x) x##UL
22#endif
23 14
24#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
25
26/* 16/*
27 * These aren't exported outside the kernel to avoid name space clashes 17 * These aren't exported outside the kernel to avoid name space clashes
28 */ 18 */
29#ifdef __KERNEL__
30 19
31#define BITS_PER_LONG 32 20#define BITS_PER_LONG 32
32 21
33#endif /* __KERNEL__ */
34#endif 22#endif
35
36#endif /* _XTENSA_TYPES_H */ 23#endif /* _XTENSA_TYPES_H */
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index bc7e005faa60..9ef1c31d2c83 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -8,705 +8,8 @@
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */ 9 */
10 10
11#ifndef _XTENSA_UNISTD_H 11#include <uapi/asm/unistd.h>
12#define _XTENSA_UNISTD_H
13 12
14#ifndef __SYSCALL
15# define __SYSCALL(nr,func,nargs)
16#endif
17
18#define __NR_spill 0
19__SYSCALL( 0, sys_ni_syscall, 0)
20#define __NR_xtensa 1
21__SYSCALL( 1, sys_ni_syscall, 0)
22#define __NR_available4 2
23__SYSCALL( 2, sys_ni_syscall, 0)
24#define __NR_available5 3
25__SYSCALL( 3, sys_ni_syscall, 0)
26#define __NR_available6 4
27__SYSCALL( 4, sys_ni_syscall, 0)
28#define __NR_available7 5
29__SYSCALL( 5, sys_ni_syscall, 0)
30#define __NR_available8 6
31__SYSCALL( 6, sys_ni_syscall, 0)
32#define __NR_available9 7
33__SYSCALL( 7, sys_ni_syscall, 0)
34
35/* File Operations */
36
37#define __NR_open 8
38__SYSCALL( 8, sys_open, 3)
39#define __NR_close 9
40__SYSCALL( 9, sys_close, 1)
41#define __NR_dup 10
42__SYSCALL( 10, sys_dup, 1)
43#define __NR_dup2 11
44__SYSCALL( 11, sys_dup2, 2)
45#define __NR_read 12
46__SYSCALL( 12, sys_read, 3)
47#define __NR_write 13
48__SYSCALL( 13, sys_write, 3)
49#define __NR_select 14
50__SYSCALL( 14, sys_select, 5)
51#define __NR_lseek 15
52__SYSCALL( 15, sys_lseek, 3)
53#define __NR_poll 16
54__SYSCALL( 16, sys_poll, 3)
55#define __NR__llseek 17
56__SYSCALL( 17, sys_llseek, 5)
57#define __NR_epoll_wait 18
58__SYSCALL( 18, sys_epoll_wait, 4)
59#define __NR_epoll_ctl 19
60__SYSCALL( 19, sys_epoll_ctl, 4)
61#define __NR_epoll_create 20
62__SYSCALL( 20, sys_epoll_create, 1)
63#define __NR_creat 21
64__SYSCALL( 21, sys_creat, 2)
65#define __NR_truncate 22
66__SYSCALL( 22, sys_truncate, 2)
67#define __NR_ftruncate 23
68__SYSCALL( 23, sys_ftruncate, 2)
69#define __NR_readv 24
70__SYSCALL( 24, sys_readv, 3)
71#define __NR_writev 25
72__SYSCALL( 25, sys_writev, 3)
73#define __NR_fsync 26
74__SYSCALL( 26, sys_fsync, 1)
75#define __NR_fdatasync 27
76__SYSCALL( 27, sys_fdatasync, 1)
77#define __NR_truncate64 28
78__SYSCALL( 28, sys_truncate64, 2)
79#define __NR_ftruncate64 29
80__SYSCALL( 29, sys_ftruncate64, 2)
81#define __NR_pread64 30
82__SYSCALL( 30, sys_pread64, 6)
83#define __NR_pwrite64 31
84__SYSCALL( 31, sys_pwrite64, 6)
85
86#define __NR_link 32
87__SYSCALL( 32, sys_link, 2)
88#define __NR_rename 33
89__SYSCALL( 33, sys_rename, 2)
90#define __NR_symlink 34
91__SYSCALL( 34, sys_symlink, 2)
92#define __NR_readlink 35
93__SYSCALL( 35, sys_readlink, 3)
94#define __NR_mknod 36
95__SYSCALL( 36, sys_mknod, 3)
96#define __NR_pipe 37
97__SYSCALL( 37, sys_pipe, 1)
98#define __NR_unlink 38
99__SYSCALL( 38, sys_unlink, 1)
100#define __NR_rmdir 39
101__SYSCALL( 39, sys_rmdir, 1)
102
103#define __NR_mkdir 40
104__SYSCALL( 40, sys_mkdir, 2)
105#define __NR_chdir 41
106__SYSCALL( 41, sys_chdir, 1)
107#define __NR_fchdir 42
108__SYSCALL( 42, sys_fchdir, 1)
109#define __NR_getcwd 43
110__SYSCALL( 43, sys_getcwd, 2)
111
112#define __NR_chmod 44
113__SYSCALL( 44, sys_chmod, 2)
114#define __NR_chown 45
115__SYSCALL( 45, sys_chown, 3)
116#define __NR_stat 46
117__SYSCALL( 46, sys_newstat, 2)
118#define __NR_stat64 47
119__SYSCALL( 47, sys_stat64, 2)
120
121#define __NR_lchown 48
122__SYSCALL( 48, sys_lchown, 3)
123#define __NR_lstat 49
124__SYSCALL( 49, sys_newlstat, 2)
125#define __NR_lstat64 50
126__SYSCALL( 50, sys_lstat64, 2)
127#define __NR_available51 51
128__SYSCALL( 51, sys_ni_syscall, 0)
129
130#define __NR_fchmod 52
131__SYSCALL( 52, sys_fchmod, 2)
132#define __NR_fchown 53
133__SYSCALL( 53, sys_fchown, 3)
134#define __NR_fstat 54
135__SYSCALL( 54, sys_newfstat, 2)
136#define __NR_fstat64 55
137__SYSCALL( 55, sys_fstat64, 2)
138
139#define __NR_flock 56
140__SYSCALL( 56, sys_flock, 2)
141#define __NR_access 57
142__SYSCALL( 57, sys_access, 2)
143#define __NR_umask 58
144__SYSCALL( 58, sys_umask, 1)
145#define __NR_getdents 59
146__SYSCALL( 59, sys_getdents, 3)
147#define __NR_getdents64 60
148__SYSCALL( 60, sys_getdents64, 3)
149#define __NR_fcntl64 61
150__SYSCALL( 61, sys_fcntl64, 3)
151#define __NR_available62 62
152__SYSCALL( 62, sys_ni_syscall, 0)
153#define __NR_fadvise64_64 63
154__SYSCALL( 63, xtensa_fadvise64_64, 6)
155#define __NR_utime 64 /* glibc 2.3.3 ?? */
156__SYSCALL( 64, sys_utime, 2)
157#define __NR_utimes 65
158__SYSCALL( 65, sys_utimes, 2)
159#define __NR_ioctl 66
160__SYSCALL( 66, sys_ioctl, 3)
161#define __NR_fcntl 67
162__SYSCALL( 67, sys_fcntl, 3)
163
164#define __NR_setxattr 68
165__SYSCALL( 68, sys_setxattr, 5)
166#define __NR_getxattr 69
167__SYSCALL( 69, sys_getxattr, 4)
168#define __NR_listxattr 70
169__SYSCALL( 70, sys_listxattr, 3)
170#define __NR_removexattr 71
171__SYSCALL( 71, sys_removexattr, 2)
172#define __NR_lsetxattr 72
173__SYSCALL( 72, sys_lsetxattr, 5)
174#define __NR_lgetxattr 73
175__SYSCALL( 73, sys_lgetxattr, 4)
176#define __NR_llistxattr 74
177__SYSCALL( 74, sys_llistxattr, 3)
178#define __NR_lremovexattr 75
179__SYSCALL( 75, sys_lremovexattr, 2)
180#define __NR_fsetxattr 76
181__SYSCALL( 76, sys_fsetxattr, 5)
182#define __NR_fgetxattr 77
183__SYSCALL( 77, sys_fgetxattr, 4)
184#define __NR_flistxattr 78
185__SYSCALL( 78, sys_flistxattr, 3)
186#define __NR_fremovexattr 79
187__SYSCALL( 79, sys_fremovexattr, 2)
188
189/* File Map / Shared Memory Operations */
190
191#define __NR_mmap2 80
192__SYSCALL( 80, sys_mmap_pgoff, 6)
193#define __NR_munmap 81
194__SYSCALL( 81, sys_munmap, 2)
195#define __NR_mprotect 82
196__SYSCALL( 82, sys_mprotect, 3)
197#define __NR_brk 83
198__SYSCALL( 83, sys_brk, 1)
199#define __NR_mlock 84
200__SYSCALL( 84, sys_mlock, 2)
201#define __NR_munlock 85
202__SYSCALL( 85, sys_munlock, 2)
203#define __NR_mlockall 86
204__SYSCALL( 86, sys_mlockall, 1)
205#define __NR_munlockall 87
206__SYSCALL( 87, sys_munlockall, 0)
207#define __NR_mremap 88
208__SYSCALL( 88, sys_mremap, 4)
209#define __NR_msync 89
210__SYSCALL( 89, sys_msync, 3)
211#define __NR_mincore 90
212__SYSCALL( 90, sys_mincore, 3)
213#define __NR_madvise 91
214__SYSCALL( 91, sys_madvise, 3)
215#define __NR_shmget 92
216__SYSCALL( 92, sys_shmget, 4)
217#define __NR_shmat 93
218__SYSCALL( 93, xtensa_shmat, 4)
219#define __NR_shmctl 94
220__SYSCALL( 94, sys_shmctl, 4)
221#define __NR_shmdt 95
222__SYSCALL( 95, sys_shmdt, 4)
223
224/* Socket Operations */
225
226#define __NR_socket 96
227__SYSCALL( 96, sys_socket, 3)
228#define __NR_setsockopt 97
229__SYSCALL( 97, sys_setsockopt, 5)
230#define __NR_getsockopt 98
231__SYSCALL( 98, sys_getsockopt, 5)
232#define __NR_shutdown 99
233__SYSCALL( 99, sys_shutdown, 2)
234
235#define __NR_bind 100
236__SYSCALL(100, sys_bind, 3)
237#define __NR_connect 101
238__SYSCALL(101, sys_connect, 3)
239#define __NR_listen 102
240__SYSCALL(102, sys_listen, 2)
241#define __NR_accept 103
242__SYSCALL(103, sys_accept, 3)
243
244#define __NR_getsockname 104
245__SYSCALL(104, sys_getsockname, 3)
246#define __NR_getpeername 105
247__SYSCALL(105, sys_getpeername, 3)
248#define __NR_sendmsg 106
249__SYSCALL(106, sys_sendmsg, 3)
250#define __NR_recvmsg 107
251__SYSCALL(107, sys_recvmsg, 3)
252#define __NR_send 108
253__SYSCALL(108, sys_send, 4)
254#define __NR_recv 109
255__SYSCALL(109, sys_recv, 4)
256#define __NR_sendto 110
257__SYSCALL(110, sys_sendto, 6)
258#define __NR_recvfrom 111
259__SYSCALL(111, sys_recvfrom, 6)
260
261#define __NR_socketpair 112
262__SYSCALL(112, sys_socketpair, 4)
263#define __NR_sendfile 113
264__SYSCALL(113, sys_sendfile, 4)
265#define __NR_sendfile64 114
266__SYSCALL(114, sys_sendfile64, 4)
267#define __NR_available115 115
268__SYSCALL(115, sys_ni_syscall, 0)
269
270/* Process Operations */
271
272#define __NR_clone 116
273__SYSCALL(116, xtensa_clone, 5)
274#define __NR_execve 117
275__SYSCALL(117, xtensa_execve, 3)
276#define __NR_exit 118
277__SYSCALL(118, sys_exit, 1)
278#define __NR_exit_group 119
279__SYSCALL(119, sys_exit_group, 1)
280#define __NR_getpid 120
281__SYSCALL(120, sys_getpid, 0)
282#define __NR_wait4 121
283__SYSCALL(121, sys_wait4, 4)
284#define __NR_waitid 122
285__SYSCALL(122, sys_waitid, 5)
286#define __NR_kill 123
287__SYSCALL(123, sys_kill, 2)
288#define __NR_tkill 124
289__SYSCALL(124, sys_tkill, 2)
290#define __NR_tgkill 125
291__SYSCALL(125, sys_tgkill, 3)
292#define __NR_set_tid_address 126
293__SYSCALL(126, sys_set_tid_address, 1)
294#define __NR_gettid 127
295__SYSCALL(127, sys_gettid, 0)
296#define __NR_setsid 128
297__SYSCALL(128, sys_setsid, 0)
298#define __NR_getsid 129
299__SYSCALL(129, sys_getsid, 1)
300#define __NR_prctl 130
301__SYSCALL(130, sys_prctl, 5)
302#define __NR_personality 131
303__SYSCALL(131, sys_personality, 1)
304#define __NR_getpriority 132
305__SYSCALL(132, sys_getpriority, 2)
306#define __NR_setpriority 133
307__SYSCALL(133, sys_setpriority, 3)
308#define __NR_setitimer 134
309__SYSCALL(134, sys_setitimer, 3)
310#define __NR_getitimer 135
311__SYSCALL(135, sys_getitimer, 2)
312#define __NR_setuid 136
313__SYSCALL(136, sys_setuid, 1)
314#define __NR_getuid 137
315__SYSCALL(137, sys_getuid, 0)
316#define __NR_setgid 138
317__SYSCALL(138, sys_setgid, 1)
318#define __NR_getgid 139
319__SYSCALL(139, sys_getgid, 0)
320#define __NR_geteuid 140
321__SYSCALL(140, sys_geteuid, 0)
322#define __NR_getegid 141
323__SYSCALL(141, sys_getegid, 0)
324#define __NR_setreuid 142
325__SYSCALL(142, sys_setreuid, 2)
326#define __NR_setregid 143
327__SYSCALL(143, sys_setregid, 2)
328#define __NR_setresuid 144
329__SYSCALL(144, sys_setresuid, 3)
330#define __NR_getresuid 145
331__SYSCALL(145, sys_getresuid, 3)
332#define __NR_setresgid 146
333__SYSCALL(146, sys_setresgid, 3)
334#define __NR_getresgid 147
335__SYSCALL(147, sys_getresgid, 3)
336#define __NR_setpgid 148
337__SYSCALL(148, sys_setpgid, 2)
338#define __NR_getpgid 149
339__SYSCALL(149, sys_getpgid, 1)
340#define __NR_getppid 150
341__SYSCALL(150, sys_getppid, 0)
342#define __NR_getpgrp 151
343__SYSCALL(151, sys_getpgrp, 0)
344
345#define __NR_reserved152 152 /* set_thread_area */
346__SYSCALL(152, sys_ni_syscall, 0)
347#define __NR_reserved153 153 /* get_thread_area */
348__SYSCALL(153, sys_ni_syscall, 0)
349#define __NR_times 154
350__SYSCALL(154, sys_times, 1)
351#define __NR_acct 155
352__SYSCALL(155, sys_acct, 1)
353#define __NR_sched_setaffinity 156
354__SYSCALL(156, sys_sched_setaffinity, 3)
355#define __NR_sched_getaffinity 157
356__SYSCALL(157, sys_sched_getaffinity, 3)
357#define __NR_capget 158
358__SYSCALL(158, sys_capget, 2)
359#define __NR_capset 159
360__SYSCALL(159, sys_capset, 2)
361#define __NR_ptrace 160
362__SYSCALL(160, sys_ptrace, 4)
363#define __NR_semtimedop 161
364__SYSCALL(161, sys_semtimedop, 5)
365#define __NR_semget 162
366__SYSCALL(162, sys_semget, 4)
367#define __NR_semop 163
368__SYSCALL(163, sys_semop, 4)
369#define __NR_semctl 164
370__SYSCALL(164, sys_semctl, 4)
371#define __NR_available165 165
372__SYSCALL(165, sys_ni_syscall, 0)
373#define __NR_msgget 166
374__SYSCALL(166, sys_msgget, 4)
375#define __NR_msgsnd 167
376__SYSCALL(167, sys_msgsnd, 4)
377#define __NR_msgrcv 168
378__SYSCALL(168, sys_msgrcv, 4)
379#define __NR_msgctl 169
380__SYSCALL(169, sys_msgctl, 4)
381#define __NR_available170 170
382__SYSCALL(170, sys_ni_syscall, 0)
383#define __NR_available171 171
384__SYSCALL(171, sys_ni_syscall, 0)
385
386/* File System */
387
388#define __NR_mount 172
389__SYSCALL(172, sys_mount, 5)
390#define __NR_swapon 173
391__SYSCALL(173, sys_swapon, 2)
392#define __NR_chroot 174
393__SYSCALL(174, sys_chroot, 1)
394#define __NR_pivot_root 175
395__SYSCALL(175, sys_pivot_root, 2)
396#define __NR_umount 176
397__SYSCALL(176, sys_umount, 2)
398#define __NR_swapoff 177
399__SYSCALL(177, sys_swapoff, 1)
400#define __NR_sync 178
401__SYSCALL(178, sys_sync, 0)
402#define __NR_available179 179
403__SYSCALL(179, sys_ni_syscall, 0)
404#define __NR_setfsuid 180
405__SYSCALL(180, sys_setfsuid, 1)
406#define __NR_setfsgid 181
407__SYSCALL(181, sys_setfsgid, 1)
408#define __NR_sysfs 182
409__SYSCALL(182, sys_sysfs, 3)
410#define __NR_ustat 183
411__SYSCALL(183, sys_ustat, 2)
412#define __NR_statfs 184
413__SYSCALL(184, sys_statfs, 2)
414#define __NR_fstatfs 185
415__SYSCALL(185, sys_fstatfs, 2)
416#define __NR_statfs64 186
417__SYSCALL(186, sys_statfs64, 3)
418#define __NR_fstatfs64 187
419__SYSCALL(187, sys_fstatfs64, 3)
420
421/* System */
422
423#define __NR_setrlimit 188
424__SYSCALL(188, sys_setrlimit, 2)
425#define __NR_getrlimit 189
426__SYSCALL(189, sys_getrlimit, 2)
427#define __NR_getrusage 190
428__SYSCALL(190, sys_getrusage, 2)
429#define __NR_futex 191
430__SYSCALL(191, sys_futex, 5)
431#define __NR_gettimeofday 192
432__SYSCALL(192, sys_gettimeofday, 2)
433#define __NR_settimeofday 193
434__SYSCALL(193, sys_settimeofday, 2)
435#define __NR_adjtimex 194
436__SYSCALL(194, sys_adjtimex, 1)
437#define __NR_nanosleep 195
438__SYSCALL(195, sys_nanosleep, 2)
439#define __NR_getgroups 196
440__SYSCALL(196, sys_getgroups, 2)
441#define __NR_setgroups 197
442__SYSCALL(197, sys_setgroups, 2)
443#define __NR_sethostname 198
444__SYSCALL(198, sys_sethostname, 2)
445#define __NR_setdomainname 199
446__SYSCALL(199, sys_setdomainname, 2)
447#define __NR_syslog 200
448__SYSCALL(200, sys_syslog, 3)
449#define __NR_vhangup 201
450__SYSCALL(201, sys_vhangup, 0)
451#define __NR_uselib 202
452__SYSCALL(202, sys_uselib, 1)
453#define __NR_reboot 203
454__SYSCALL(203, sys_reboot, 3)
455#define __NR_quotactl 204
456__SYSCALL(204, sys_quotactl, 4)
457#define __NR_nfsservctl 205
458__SYSCALL(205, sys_ni_syscall, 0)
459#define __NR__sysctl 206
460__SYSCALL(206, sys_sysctl, 1)
461#define __NR_bdflush 207
462__SYSCALL(207, sys_bdflush, 2)
463#define __NR_uname 208
464__SYSCALL(208, sys_newuname, 1)
465#define __NR_sysinfo 209
466__SYSCALL(209, sys_sysinfo, 1)
467#define __NR_init_module 210
468__SYSCALL(210, sys_init_module, 2)
469#define __NR_delete_module 211
470__SYSCALL(211, sys_delete_module, 1)
471
472#define __NR_sched_setparam 212
473__SYSCALL(212, sys_sched_setparam, 2)
474#define __NR_sched_getparam 213
475__SYSCALL(213, sys_sched_getparam, 2)
476#define __NR_sched_setscheduler 214
477__SYSCALL(214, sys_sched_setscheduler, 3)
478#define __NR_sched_getscheduler 215
479__SYSCALL(215, sys_sched_getscheduler, 1)
480#define __NR_sched_get_priority_max 216
481__SYSCALL(216, sys_sched_get_priority_max, 1)
482#define __NR_sched_get_priority_min 217
483__SYSCALL(217, sys_sched_get_priority_min, 1)
484#define __NR_sched_rr_get_interval 218
485__SYSCALL(218, sys_sched_rr_get_interval, 2)
486#define __NR_sched_yield 219
487__SYSCALL(219, sys_sched_yield, 0)
488#define __NR_available222 222
489__SYSCALL(222, sys_ni_syscall, 0)
490
491/* Signal Handling */
492
493#define __NR_restart_syscall 223
494__SYSCALL(223, sys_restart_syscall, 0)
495#define __NR_sigaltstack 224
496__SYSCALL(224, xtensa_sigaltstack, 2)
497#define __NR_rt_sigreturn 225
498__SYSCALL(225, xtensa_rt_sigreturn, 1)
499#define __NR_rt_sigaction 226
500__SYSCALL(226, sys_rt_sigaction, 4)
501#define __NR_rt_sigprocmask 227
502__SYSCALL(227, sys_rt_sigprocmask, 4)
503#define __NR_rt_sigpending 228
504__SYSCALL(228, sys_rt_sigpending, 2)
505#define __NR_rt_sigtimedwait 229
506__SYSCALL(229, sys_rt_sigtimedwait, 4)
507#define __NR_rt_sigqueueinfo 230
508__SYSCALL(230, sys_rt_sigqueueinfo, 3)
509#define __NR_rt_sigsuspend 231
510__SYSCALL(231, sys_rt_sigsuspend, 2)
511
512/* Message */
513
514#define __NR_mq_open 232
515__SYSCALL(232, sys_mq_open, 4)
516#define __NR_mq_unlink 233
517__SYSCALL(233, sys_mq_unlink, 1)
518#define __NR_mq_timedsend 234
519__SYSCALL(234, sys_mq_timedsend, 5)
520#define __NR_mq_timedreceive 235
521__SYSCALL(235, sys_mq_timedreceive, 5)
522#define __NR_mq_notify 236
523__SYSCALL(236, sys_mq_notify, 2)
524#define __NR_mq_getsetattr 237
525__SYSCALL(237, sys_mq_getsetattr, 3)
526#define __NR_available238 238
527__SYSCALL(238, sys_ni_syscall, 0)
528
529/* IO */
530
531#define __NR_io_setup 239
532__SYSCALL(239, sys_io_setup, 2)
533#define __NR_io_destroy 240
534__SYSCALL(240, sys_io_destroy, 1)
535#define __NR_io_submit 241
536__SYSCALL(241, sys_io_submit, 3)
537#define __NR_io_getevents 242
538__SYSCALL(242, sys_io_getevents, 5)
539#define __NR_io_cancel 243
540__SYSCALL(243, sys_io_cancel, 3)
541#define __NR_clock_settime 244
542__SYSCALL(244, sys_clock_settime, 2)
543#define __NR_clock_gettime 245
544__SYSCALL(245, sys_clock_gettime, 2)
545#define __NR_clock_getres 246
546__SYSCALL(246, sys_clock_getres, 2)
547#define __NR_clock_nanosleep 247
548__SYSCALL(247, sys_clock_nanosleep, 4)
549
550/* Timer */
551
552#define __NR_timer_create 248
553__SYSCALL(248, sys_timer_create, 3)
554#define __NR_timer_delete 249
555__SYSCALL(249, sys_timer_delete, 1)
556#define __NR_timer_settime 250
557__SYSCALL(250, sys_timer_settime, 4)
558#define __NR_timer_gettime 251
559__SYSCALL(251, sys_timer_gettime, 2)
560#define __NR_timer_getoverrun 252
561__SYSCALL(252, sys_timer_getoverrun, 1)
562
563/* System */
564
565#define __NR_reserved244 253
566__SYSCALL(253, sys_ni_syscall, 0)
567#define __NR_lookup_dcookie 254
568__SYSCALL(254, sys_lookup_dcookie, 4)
569#define __NR_available255 255
570__SYSCALL(255, sys_ni_syscall, 0)
571#define __NR_add_key 256
572__SYSCALL(256, sys_add_key, 5)
573#define __NR_request_key 257
574__SYSCALL(257, sys_request_key, 5)
575#define __NR_keyctl 258
576__SYSCALL(258, sys_keyctl, 5)
577#define __NR_available259 259
578__SYSCALL(259, sys_ni_syscall, 0)
579
580
581#define __NR_readahead 260
582__SYSCALL(260, sys_readahead, 5)
583#define __NR_remap_file_pages 261
584__SYSCALL(261, sys_remap_file_pages, 5)
585#define __NR_migrate_pages 262
586__SYSCALL(262, sys_migrate_pages, 0)
587#define __NR_mbind 263
588__SYSCALL(263, sys_mbind, 6)
589#define __NR_get_mempolicy 264
590__SYSCALL(264, sys_get_mempolicy, 5)
591#define __NR_set_mempolicy 265
592__SYSCALL(265, sys_set_mempolicy, 3)
593#define __NR_unshare 266
594__SYSCALL(266, sys_unshare, 1)
595#define __NR_move_pages 267
596__SYSCALL(267, sys_move_pages, 0)
597#define __NR_splice 268
598__SYSCALL(268, sys_splice, 0)
599#define __NR_tee 269
600__SYSCALL(269, sys_tee, 0)
601#define __NR_vmsplice 270
602__SYSCALL(270, sys_vmsplice, 0)
603#define __NR_available271 271
604__SYSCALL(271, sys_ni_syscall, 0)
605
606#define __NR_pselect6 272
607__SYSCALL(272, sys_pselect6, 0)
608#define __NR_ppoll 273
609__SYSCALL(273, sys_ppoll, 0)
610#define __NR_epoll_pwait 274
611__SYSCALL(274, sys_epoll_pwait, 0)
612#define __NR_available275 275
613__SYSCALL(275, sys_ni_syscall, 0)
614
615#define __NR_inotify_init 276
616__SYSCALL(276, sys_inotify_init, 0)
617#define __NR_inotify_add_watch 277
618__SYSCALL(277, sys_inotify_add_watch, 3)
619#define __NR_inotify_rm_watch 278
620__SYSCALL(278, sys_inotify_rm_watch, 2)
621#define __NR_available279 279
622__SYSCALL(279, sys_ni_syscall, 0)
623
624#define __NR_getcpu 280
625__SYSCALL(280, sys_getcpu, 0)
626#define __NR_kexec_load 281
627__SYSCALL(281, sys_ni_syscall, 0)
628
629#define __NR_ioprio_set 282
630__SYSCALL(282, sys_ioprio_set, 2)
631#define __NR_ioprio_get 283
632__SYSCALL(283, sys_ioprio_get, 3)
633
634#define __NR_set_robust_list 284
635__SYSCALL(284, sys_set_robust_list, 3)
636#define __NR_get_robust_list 285
637__SYSCALL(285, sys_get_robust_list, 3)
638#define __NR_reserved286 286 /* sync_file_rangeX */
639__SYSCALL(286, sys_ni_syscall, 3)
640#define __NR_available287 287
641__SYSCALL(287, sys_faccessat, 0)
642
643/* Relative File Operations */
644
645#define __NR_openat 288
646__SYSCALL(288, sys_openat, 4)
647#define __NR_mkdirat 289
648__SYSCALL(289, sys_mkdirat, 3)
649#define __NR_mknodat 290
650__SYSCALL(290, sys_mknodat, 4)
651#define __NR_unlinkat 291
652__SYSCALL(291, sys_unlinkat, 3)
653#define __NR_renameat 292
654__SYSCALL(292, sys_renameat, 4)
655#define __NR_linkat 293
656__SYSCALL(293, sys_linkat, 5)
657#define __NR_symlinkat 294
658__SYSCALL(294, sys_symlinkat, 3)
659#define __NR_readlinkat 295
660__SYSCALL(295, sys_readlinkat, 4)
661#define __NR_utimensat 296
662__SYSCALL(296, sys_utimensat, 0)
663#define __NR_fchownat 297
664__SYSCALL(297, sys_fchownat, 5)
665#define __NR_futimesat 298
666__SYSCALL(298, sys_futimesat, 4)
667#define __NR_fstatat64 299
668__SYSCALL(299, sys_fstatat64, 0)
669#define __NR_fchmodat 300
670__SYSCALL(300, sys_fchmodat, 4)
671#define __NR_faccessat 301
672__SYSCALL(301, sys_faccessat, 4)
673#define __NR_available302 302
674__SYSCALL(302, sys_ni_syscall, 0)
675#define __NR_available303 303
676__SYSCALL(303, sys_ni_syscall, 0)
677
678#define __NR_signalfd 304
679__SYSCALL(304, sys_signalfd, 3)
680/* 305 was __NR_timerfd */
681__SYSCALL(305, sys_ni_syscall, 0)
682#define __NR_eventfd 306
683__SYSCALL(306, sys_eventfd, 1)
684#define __NR_recvmmsg 307
685__SYSCALL(307, sys_recvmmsg, 5)
686#define __NR_setns 308
687__SYSCALL(308, sys_setns, 2)
688
689#define __NR_syscall_count 309
690
691/*
692 * sysxtensa syscall handler
693 *
694 * int sysxtensa (SYS_XTENSA_ATOMIC_SET, ptr, val, unused);
695 * int sysxtensa (SYS_XTENSA_ATOMIC_ADD, ptr, val, unused);
696 * int sysxtensa (SYS_XTENSA_ATOMIC_EXG_ADD, ptr, val, unused);
697 * int sysxtensa (SYS_XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval);
698 * a2 a6 a3 a4 a5
699 */
700
701#define SYS_XTENSA_RESERVED 0 /* don't use this */
702#define SYS_XTENSA_ATOMIC_SET 1 /* set variable */
703#define SYS_XTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */
704#define SYS_XTENSA_ATOMIC_ADD 3 /* add to memory */
705#define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */
706
707#define SYS_XTENSA_COUNT 5 /* count */
708
709#ifdef __KERNEL__
710 13
711/* 14/*
712 * "Conditional" syscalls 15 * "Conditional" syscalls
@@ -734,6 +37,3 @@ __SYSCALL(308, sys_setns, 2)
734#define __IGNORE_mmap /* use mmap2 */ 37#define __IGNORE_mmap /* use mmap2 */
735#define __IGNORE_vfork /* use clone */ 38#define __IGNORE_vfork /* use clone */
736#define __IGNORE_fadvise64 /* use fadvise64_64 */ 39#define __IGNORE_fadvise64 /* use fadvise64_64 */
737
738#endif /* __KERNEL__ */
739#endif /* _XTENSA_UNISTD_H */
diff --git a/arch/xtensa/include/asm/xor.h b/arch/xtensa/include/asm/xor.h
deleted file mode 100644
index e7b1f083991d..000000000000
--- a/arch/xtensa/include/asm/xor.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * include/asm-xtensa/xor.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_XOR_H
12#define _XTENSA_XOR_H
13
14#include <asm-generic/xor.h>
15
16#endif
diff --git a/arch/xtensa/include/uapi/asm/Kbuild b/arch/xtensa/include/uapi/asm/Kbuild
index baebb3da1d44..56aad54e7fb7 100644
--- a/arch/xtensa/include/uapi/asm/Kbuild
+++ b/arch/xtensa/include/uapi/asm/Kbuild
@@ -1,3 +1,25 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h
5header-y += byteorder.h
6header-y += ioctls.h
7header-y += ipcbuf.h
8header-y += mman.h
9header-y += msgbuf.h
10header-y += param.h
11header-y += poll.h
12header-y += posix_types.h
13header-y += ptrace.h
14header-y += sembuf.h
15header-y += setup.h
16header-y += shmbuf.h
17header-y += sigcontext.h
18header-y += signal.h
19header-y += socket.h
20header-y += sockios.h
21header-y += stat.h
22header-y += swab.h
23header-y += termbits.h
24header-y += types.h
25header-y += unistd.h
diff --git a/arch/xtensa/include/asm/auxvec.h b/arch/xtensa/include/uapi/asm/auxvec.h
index 257dec75c5af..257dec75c5af 100644
--- a/arch/xtensa/include/asm/auxvec.h
+++ b/arch/xtensa/include/uapi/asm/auxvec.h
diff --git a/arch/xtensa/include/asm/byteorder.h b/arch/xtensa/include/uapi/asm/byteorder.h
index 54eb6315349c..54eb6315349c 100644
--- a/arch/xtensa/include/asm/byteorder.h
+++ b/arch/xtensa/include/uapi/asm/byteorder.h
diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h
index 2aa4cd9f0cec..2aa4cd9f0cec 100644
--- a/arch/xtensa/include/asm/ioctls.h
+++ b/arch/xtensa/include/uapi/asm/ioctls.h
diff --git a/arch/xtensa/include/asm/ipcbuf.h b/arch/xtensa/include/uapi/asm/ipcbuf.h
index c33aa6a42145..c33aa6a42145 100644
--- a/arch/xtensa/include/asm/ipcbuf.h
+++ b/arch/xtensa/include/uapi/asm/ipcbuf.h
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
index 25bc6c1309c3..25bc6c1309c3 100644
--- a/arch/xtensa/include/asm/mman.h
+++ b/arch/xtensa/include/uapi/asm/mman.h
diff --git a/arch/xtensa/include/asm/msgbuf.h b/arch/xtensa/include/uapi/asm/msgbuf.h
index 693c96755280..693c96755280 100644
--- a/arch/xtensa/include/asm/msgbuf.h
+++ b/arch/xtensa/include/uapi/asm/msgbuf.h
diff --git a/arch/xtensa/include/uapi/asm/param.h b/arch/xtensa/include/uapi/asm/param.h
new file mode 100644
index 000000000000..87bc2eae630e
--- /dev/null
+++ b/arch/xtensa/include/uapi/asm/param.h
@@ -0,0 +1,30 @@
1/*
2 * include/asm-xtensa/param.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _UAPI_XTENSA_PARAM_H
12#define _UAPI_XTENSA_PARAM_H
13
14#ifndef __KERNEL__
15# define HZ 100
16#endif
17
18#define EXEC_PAGESIZE 4096
19
20#ifndef NGROUPS
21#define NGROUPS 32
22#endif
23
24#ifndef NOGROUP
25#define NOGROUP (-1)
26#endif
27
28#define MAXHOSTNAMELEN 64 /* max length of hostname */
29
30#endif /* _UAPI_XTENSA_PARAM_H */
diff --git a/arch/xtensa/include/asm/poll.h b/arch/xtensa/include/uapi/asm/poll.h
index 9d2d5993f068..9d2d5993f068 100644
--- a/arch/xtensa/include/asm/poll.h
+++ b/arch/xtensa/include/uapi/asm/poll.h
diff --git a/arch/xtensa/include/asm/posix_types.h b/arch/xtensa/include/uapi/asm/posix_types.h
index 6e96be0d02d3..6e96be0d02d3 100644
--- a/arch/xtensa/include/asm/posix_types.h
+++ b/arch/xtensa/include/uapi/asm/posix_types.h
diff --git a/arch/xtensa/include/uapi/asm/ptrace.h b/arch/xtensa/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..ee17aa842fdf
--- /dev/null
+++ b/arch/xtensa/include/uapi/asm/ptrace.h
@@ -0,0 +1,77 @@
1/*
2 * include/asm-xtensa/ptrace.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _UAPI_XTENSA_PTRACE_H
12#define _UAPI_XTENSA_PTRACE_H
13
14/*
15 * Kernel stack
16 *
17 * +-----------------------+ -------- STACK_SIZE
18 * | register file | |
19 * +-----------------------+ |
20 * | struct pt_regs | |
21 * +-----------------------+ | ------ PT_REGS_OFFSET
22 * double : 16 bytes spill area : | ^
23 * excetion :- - - - - - - - - - - -: | |
24 * frame : struct pt_regs : | |
25 * :- - - - - - - - - - - -: | |
26 * | | | |
27 * | memory stack | | |
28 * | | | |
29 * ~ ~ ~ ~
30 * ~ ~ ~ ~
31 * | | | |
32 * | | | |
33 * +-----------------------+ | | --- STACK_BIAS
34 * | struct task_struct | | | ^
35 * current --> +-----------------------+ | | |
36 * | struct thread_info | | | |
37 * +-----------------------+ --------
38 */
39
40#define KERNEL_STACK_SIZE (2 * PAGE_SIZE)
41
42/* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */
43
44#define EXC_TABLE_KSTK 0x004 /* Kernel Stack */
45#define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */
46#define EXC_TABLE_FIXUP 0x00c /* Fixup handler */
47#define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */
48#define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */
49#define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */
50#define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */
51#define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */
52#define EXC_TABLE_SIZE 0x400
53
54/* Registers used by strace */
55
56#define REG_A_BASE 0x0000
57#define REG_AR_BASE 0x0100
58#define REG_PC 0x0020
59#define REG_PS 0x02e6
60#define REG_WB 0x0248
61#define REG_WS 0x0249
62#define REG_LBEG 0x0200
63#define REG_LEND 0x0201
64#define REG_LCOUNT 0x0202
65#define REG_SAR 0x0203
66
67#define SYSCALL_NR 0x00ff
68
69/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
70
71#define PTRACE_GETREGS 12
72#define PTRACE_SETREGS 13
73#define PTRACE_GETXTREGS 18
74#define PTRACE_SETXTREGS 19
75
76
77#endif /* _UAPI_XTENSA_PTRACE_H */
diff --git a/arch/xtensa/include/asm/sembuf.h b/arch/xtensa/include/uapi/asm/sembuf.h
index c15870493b33..c15870493b33 100644
--- a/arch/xtensa/include/asm/sembuf.h
+++ b/arch/xtensa/include/uapi/asm/sembuf.h
diff --git a/arch/xtensa/include/asm/setup.h b/arch/xtensa/include/uapi/asm/setup.h
index 9fa8ad979361..9fa8ad979361 100644
--- a/arch/xtensa/include/asm/setup.h
+++ b/arch/xtensa/include/uapi/asm/setup.h
diff --git a/arch/xtensa/include/asm/shmbuf.h b/arch/xtensa/include/uapi/asm/shmbuf.h
index ad4b0121782c..ad4b0121782c 100644
--- a/arch/xtensa/include/asm/shmbuf.h
+++ b/arch/xtensa/include/uapi/asm/shmbuf.h
diff --git a/arch/xtensa/include/asm/sigcontext.h b/arch/xtensa/include/uapi/asm/sigcontext.h
index 03383af8c3b7..03383af8c3b7 100644
--- a/arch/xtensa/include/asm/sigcontext.h
+++ b/arch/xtensa/include/uapi/asm/sigcontext.h
diff --git a/arch/xtensa/include/uapi/asm/signal.h b/arch/xtensa/include/uapi/asm/signal.h
new file mode 100644
index 000000000000..b88ce96f2af9
--- /dev/null
+++ b/arch/xtensa/include/uapi/asm/signal.h
@@ -0,0 +1,148 @@
1/*
2 * include/asm-xtensa/signal.h
3 *
4 * Swiped from SH.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _UAPI_XTENSA_SIGNAL_H
14#define _UAPI_XTENSA_SIGNAL_H
15
16
17#define _NSIG 64
18#define _NSIG_BPW 32
19#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20
21#ifndef __ASSEMBLY__
22
23#include <linux/types.h>
24
25/* Avoid too many header ordering problems. */
26struct siginfo;
27typedef unsigned long old_sigset_t; /* at least 32 bits */
28typedef struct {
29 unsigned long sig[_NSIG_WORDS];
30} sigset_t;
31
32#endif
33
34#define SIGHUP 1
35#define SIGINT 2
36#define SIGQUIT 3
37#define SIGILL 4
38#define SIGTRAP 5
39#define SIGABRT 6
40#define SIGIOT 6
41#define SIGBUS 7
42#define SIGFPE 8
43#define SIGKILL 9
44#define SIGUSR1 10
45#define SIGSEGV 11
46#define SIGUSR2 12
47#define SIGPIPE 13
48#define SIGALRM 14
49#define SIGTERM 15
50#define SIGSTKFLT 16
51#define SIGCHLD 17
52#define SIGCONT 18
53#define SIGSTOP 19
54#define SIGTSTP 20
55#define SIGTTIN 21
56#define SIGTTOU 22
57#define SIGURG 23
58#define SIGXCPU 24
59#define SIGXFSZ 25
60#define SIGVTALRM 26
61#define SIGPROF 27
62#define SIGWINCH 28
63#define SIGIO 29
64#define SIGPOLL SIGIO
65/* #define SIGLOST 29 */
66#define SIGPWR 30
67#define SIGSYS 31
68#define SIGUNUSED 31
69
70/* These should not be considered constants from userland. */
71#define SIGRTMIN 32
72#define SIGRTMAX (_NSIG-1)
73
74/*
75 * SA_FLAGS values:
76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered.
81 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
82 * SA_NODEFER prevents the current signal from being masked in the handler.
83 *
84 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
85 * Unix names RESETHAND and NODEFER respectively.
86 */
87#define SA_NOCLDSTOP 0x00000001
88#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
89#define SA_SIGINFO 0x00000004
90#define SA_ONSTACK 0x08000000
91#define SA_RESTART 0x10000000
92#define SA_NODEFER 0x40000000
93#define SA_RESETHAND 0x80000000
94
95#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND
97
98#define SA_RESTORER 0x04000000
99
100/*
101 * sigaltstack controls
102 */
103#define SS_ONSTACK 1
104#define SS_DISABLE 2
105
106#define MINSIGSTKSZ 2048
107#define SIGSTKSZ 8192
108
109#ifndef __ASSEMBLY__
110
111#define SIG_BLOCK 0 /* for blocking signals */
112#define SIG_UNBLOCK 1 /* for unblocking signals */
113#define SIG_SETMASK 2 /* for setting the signal mask */
114
115/* Type of a signal handler. */
116typedef void (*__sighandler_t)(int);
117
118#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
119#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
120#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
121
122#ifndef __KERNEL__
123
124/* Here we must cater to libcs that poke about in kernel headers. */
125
126struct sigaction {
127 union {
128 __sighandler_t _sa_handler;
129 void (*_sa_sigaction)(int, struct siginfo *, void *);
130 } _u;
131 sigset_t sa_mask;
132 unsigned long sa_flags;
133 void (*sa_restorer)(void);
134};
135
136#define sa_handler _u._sa_handler
137#define sa_sigaction _u._sa_sigaction
138
139#endif /* __KERNEL__ */
140
141typedef struct sigaltstack {
142 void *ss_sp;
143 int ss_flags;
144 size_t ss_size;
145} stack_t;
146
147#endif /* __ASSEMBLY__ */
148#endif /* _UAPI_XTENSA_SIGNAL_H */
diff --git a/arch/xtensa/include/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index e36c68184920..e36c68184920 100644
--- a/arch/xtensa/include/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
diff --git a/arch/xtensa/include/asm/sockios.h b/arch/xtensa/include/uapi/asm/sockios.h
index efe0af379f01..efe0af379f01 100644
--- a/arch/xtensa/include/asm/sockios.h
+++ b/arch/xtensa/include/uapi/asm/sockios.h
diff --git a/arch/xtensa/include/asm/stat.h b/arch/xtensa/include/uapi/asm/stat.h
index c4992038cee0..c4992038cee0 100644
--- a/arch/xtensa/include/asm/stat.h
+++ b/arch/xtensa/include/uapi/asm/stat.h
diff --git a/arch/xtensa/include/asm/swab.h b/arch/xtensa/include/uapi/asm/swab.h
index 226a39162310..226a39162310 100644
--- a/arch/xtensa/include/asm/swab.h
+++ b/arch/xtensa/include/uapi/asm/swab.h
diff --git a/arch/xtensa/include/asm/termbits.h b/arch/xtensa/include/uapi/asm/termbits.h
index 0d6c8715b24f..0d6c8715b24f 100644
--- a/arch/xtensa/include/asm/termbits.h
+++ b/arch/xtensa/include/uapi/asm/termbits.h
diff --git a/arch/xtensa/include/uapi/asm/types.h b/arch/xtensa/include/uapi/asm/types.h
new file mode 100644
index 000000000000..87ec7ae73cb1
--- /dev/null
+++ b/arch/xtensa/include/uapi/asm/types.h
@@ -0,0 +1,28 @@
1/*
2 * include/asm-xtensa/types.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _UAPI_XTENSA_TYPES_H
12#define _UAPI_XTENSA_TYPES_H
13
14#include <asm-generic/int-ll64.h>
15
16#ifdef __ASSEMBLY__
17# define __XTENSA_UL(x) (x)
18# define __XTENSA_UL_CONST(x) x
19#else
20# define __XTENSA_UL(x) ((unsigned long)(x))
21# define __XTENSA_UL_CONST(x) x##UL
22#endif
23
24#ifndef __ASSEMBLY__
25
26#endif
27
28#endif /* _UAPI_XTENSA_TYPES_H */
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..479abaea5aae
--- /dev/null
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -0,0 +1,762 @@
1/*
2 * include/asm-xtensa/unistd.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2012 Tensilica Inc.
9 */
10
11#ifndef _UAPI_XTENSA_UNISTD_H
12#define _UAPI_XTENSA_UNISTD_H
13
14#ifndef __SYSCALL
15# define __SYSCALL(nr,func,nargs)
16#endif
17
18#define __NR_spill 0
19__SYSCALL( 0, sys_ni_syscall, 0)
20#define __NR_xtensa 1
21__SYSCALL( 1, sys_ni_syscall, 0)
22#define __NR_available4 2
23__SYSCALL( 2, sys_ni_syscall, 0)
24#define __NR_available5 3
25__SYSCALL( 3, sys_ni_syscall, 0)
26#define __NR_available6 4
27__SYSCALL( 4, sys_ni_syscall, 0)
28#define __NR_available7 5
29__SYSCALL( 5, sys_ni_syscall, 0)
30#define __NR_available8 6
31__SYSCALL( 6, sys_ni_syscall, 0)
32#define __NR_available9 7
33__SYSCALL( 7, sys_ni_syscall, 0)
34
35/* File Operations */
36
37#define __NR_open 8
38__SYSCALL( 8, sys_open, 3)
39#define __NR_close 9
40__SYSCALL( 9, sys_close, 1)
41#define __NR_dup 10
42__SYSCALL( 10, sys_dup, 1)
43#define __NR_dup2 11
44__SYSCALL( 11, sys_dup2, 2)
45#define __NR_read 12
46__SYSCALL( 12, sys_read, 3)
47#define __NR_write 13
48__SYSCALL( 13, sys_write, 3)
49#define __NR_select 14
50__SYSCALL( 14, sys_select, 5)
51#define __NR_lseek 15
52__SYSCALL( 15, sys_lseek, 3)
53#define __NR_poll 16
54__SYSCALL( 16, sys_poll, 3)
55#define __NR__llseek 17
56__SYSCALL( 17, sys_llseek, 5)
57#define __NR_epoll_wait 18
58__SYSCALL( 18, sys_epoll_wait, 4)
59#define __NR_epoll_ctl 19
60__SYSCALL( 19, sys_epoll_ctl, 4)
61#define __NR_epoll_create 20
62__SYSCALL( 20, sys_epoll_create, 1)
63#define __NR_creat 21
64__SYSCALL( 21, sys_creat, 2)
65#define __NR_truncate 22
66__SYSCALL( 22, sys_truncate, 2)
67#define __NR_ftruncate 23
68__SYSCALL( 23, sys_ftruncate, 2)
69#define __NR_readv 24
70__SYSCALL( 24, sys_readv, 3)
71#define __NR_writev 25
72__SYSCALL( 25, sys_writev, 3)
73#define __NR_fsync 26
74__SYSCALL( 26, sys_fsync, 1)
75#define __NR_fdatasync 27
76__SYSCALL( 27, sys_fdatasync, 1)
77#define __NR_truncate64 28
78__SYSCALL( 28, sys_truncate64, 2)
79#define __NR_ftruncate64 29
80__SYSCALL( 29, sys_ftruncate64, 2)
81#define __NR_pread64 30
82__SYSCALL( 30, sys_pread64, 6)
83#define __NR_pwrite64 31
84__SYSCALL( 31, sys_pwrite64, 6)
85
86#define __NR_link 32
87__SYSCALL( 32, sys_link, 2)
88#define __NR_rename 33
89__SYSCALL( 33, sys_rename, 2)
90#define __NR_symlink 34
91__SYSCALL( 34, sys_symlink, 2)
92#define __NR_readlink 35
93__SYSCALL( 35, sys_readlink, 3)
94#define __NR_mknod 36
95__SYSCALL( 36, sys_mknod, 3)
96#define __NR_pipe 37
97__SYSCALL( 37, sys_pipe, 1)
98#define __NR_unlink 38
99__SYSCALL( 38, sys_unlink, 1)
100#define __NR_rmdir 39
101__SYSCALL( 39, sys_rmdir, 1)
102
103#define __NR_mkdir 40
104__SYSCALL( 40, sys_mkdir, 2)
105#define __NR_chdir 41
106__SYSCALL( 41, sys_chdir, 1)
107#define __NR_fchdir 42
108__SYSCALL( 42, sys_fchdir, 1)
109#define __NR_getcwd 43
110__SYSCALL( 43, sys_getcwd, 2)
111
112#define __NR_chmod 44
113__SYSCALL( 44, sys_chmod, 2)
114#define __NR_chown 45
115__SYSCALL( 45, sys_chown, 3)
116#define __NR_stat 46
117__SYSCALL( 46, sys_newstat, 2)
118#define __NR_stat64 47
119__SYSCALL( 47, sys_stat64, 2)
120
121#define __NR_lchown 48
122__SYSCALL( 48, sys_lchown, 3)
123#define __NR_lstat 49
124__SYSCALL( 49, sys_newlstat, 2)
125#define __NR_lstat64 50
126__SYSCALL( 50, sys_lstat64, 2)
127#define __NR_available51 51
128__SYSCALL( 51, sys_ni_syscall, 0)
129
130#define __NR_fchmod 52
131__SYSCALL( 52, sys_fchmod, 2)
132#define __NR_fchown 53
133__SYSCALL( 53, sys_fchown, 3)
134#define __NR_fstat 54
135__SYSCALL( 54, sys_newfstat, 2)
136#define __NR_fstat64 55
137__SYSCALL( 55, sys_fstat64, 2)
138
139#define __NR_flock 56
140__SYSCALL( 56, sys_flock, 2)
141#define __NR_access 57
142__SYSCALL( 57, sys_access, 2)
143#define __NR_umask 58
144__SYSCALL( 58, sys_umask, 1)
145#define __NR_getdents 59
146__SYSCALL( 59, sys_getdents, 3)
147#define __NR_getdents64 60
148__SYSCALL( 60, sys_getdents64, 3)
149#define __NR_fcntl64 61
150__SYSCALL( 61, sys_fcntl64, 3)
151#define __NR_fallocate 62
152__SYSCALL( 62, sys_fallocate, 6)
153#define __NR_fadvise64_64 63
154__SYSCALL( 63, xtensa_fadvise64_64, 6)
155#define __NR_utime 64 /* glibc 2.3.3 ?? */
156__SYSCALL( 64, sys_utime, 2)
157#define __NR_utimes 65
158__SYSCALL( 65, sys_utimes, 2)
159#define __NR_ioctl 66
160__SYSCALL( 66, sys_ioctl, 3)
161#define __NR_fcntl 67
162__SYSCALL( 67, sys_fcntl, 3)
163
164#define __NR_setxattr 68
165__SYSCALL( 68, sys_setxattr, 5)
166#define __NR_getxattr 69
167__SYSCALL( 69, sys_getxattr, 4)
168#define __NR_listxattr 70
169__SYSCALL( 70, sys_listxattr, 3)
170#define __NR_removexattr 71
171__SYSCALL( 71, sys_removexattr, 2)
172#define __NR_lsetxattr 72
173__SYSCALL( 72, sys_lsetxattr, 5)
174#define __NR_lgetxattr 73
175__SYSCALL( 73, sys_lgetxattr, 4)
176#define __NR_llistxattr 74
177__SYSCALL( 74, sys_llistxattr, 3)
178#define __NR_lremovexattr 75
179__SYSCALL( 75, sys_lremovexattr, 2)
180#define __NR_fsetxattr 76
181__SYSCALL( 76, sys_fsetxattr, 5)
182#define __NR_fgetxattr 77
183__SYSCALL( 77, sys_fgetxattr, 4)
184#define __NR_flistxattr 78
185__SYSCALL( 78, sys_flistxattr, 3)
186#define __NR_fremovexattr 79
187__SYSCALL( 79, sys_fremovexattr, 2)
188
189/* File Map / Shared Memory Operations */
190
191#define __NR_mmap2 80
192__SYSCALL( 80, sys_mmap_pgoff, 6)
193#define __NR_munmap 81
194__SYSCALL( 81, sys_munmap, 2)
195#define __NR_mprotect 82
196__SYSCALL( 82, sys_mprotect, 3)
197#define __NR_brk 83
198__SYSCALL( 83, sys_brk, 1)
199#define __NR_mlock 84
200__SYSCALL( 84, sys_mlock, 2)
201#define __NR_munlock 85
202__SYSCALL( 85, sys_munlock, 2)
203#define __NR_mlockall 86
204__SYSCALL( 86, sys_mlockall, 1)
205#define __NR_munlockall 87
206__SYSCALL( 87, sys_munlockall, 0)
207#define __NR_mremap 88
208__SYSCALL( 88, sys_mremap, 4)
209#define __NR_msync 89
210__SYSCALL( 89, sys_msync, 3)
211#define __NR_mincore 90
212__SYSCALL( 90, sys_mincore, 3)
213#define __NR_madvise 91
214__SYSCALL( 91, sys_madvise, 3)
215#define __NR_shmget 92
216__SYSCALL( 92, sys_shmget, 4)
217#define __NR_shmat 93
218__SYSCALL( 93, xtensa_shmat, 4)
219#define __NR_shmctl 94
220__SYSCALL( 94, sys_shmctl, 4)
221#define __NR_shmdt 95
222__SYSCALL( 95, sys_shmdt, 4)
223
224/* Socket Operations */
225
226#define __NR_socket 96
227__SYSCALL( 96, sys_socket, 3)
228#define __NR_setsockopt 97
229__SYSCALL( 97, sys_setsockopt, 5)
230#define __NR_getsockopt 98
231__SYSCALL( 98, sys_getsockopt, 5)
232#define __NR_shutdown 99
233__SYSCALL( 99, sys_shutdown, 2)
234
235#define __NR_bind 100
236__SYSCALL(100, sys_bind, 3)
237#define __NR_connect 101
238__SYSCALL(101, sys_connect, 3)
239#define __NR_listen 102
240__SYSCALL(102, sys_listen, 2)
241#define __NR_accept 103
242__SYSCALL(103, sys_accept, 3)
243
244#define __NR_getsockname 104
245__SYSCALL(104, sys_getsockname, 3)
246#define __NR_getpeername 105
247__SYSCALL(105, sys_getpeername, 3)
248#define __NR_sendmsg 106
249__SYSCALL(106, sys_sendmsg, 3)
250#define __NR_recvmsg 107
251__SYSCALL(107, sys_recvmsg, 3)
252#define __NR_send 108
253__SYSCALL(108, sys_send, 4)
254#define __NR_recv 109
255__SYSCALL(109, sys_recv, 4)
256#define __NR_sendto 110
257__SYSCALL(110, sys_sendto, 6)
258#define __NR_recvfrom 111
259__SYSCALL(111, sys_recvfrom, 6)
260
261#define __NR_socketpair 112
262__SYSCALL(112, sys_socketpair, 4)
263#define __NR_sendfile 113
264__SYSCALL(113, sys_sendfile, 4)
265#define __NR_sendfile64 114
266__SYSCALL(114, sys_sendfile64, 4)
267#define __NR_sendmmsg 115
268__SYSCALL(115, sys_sendmmsg, 4)
269
270/* Process Operations */
271
272#define __NR_clone 116
273__SYSCALL(116, xtensa_clone, 5)
274#define __NR_execve 117
275__SYSCALL(117, xtensa_execve, 3)
276#define __NR_exit 118
277__SYSCALL(118, sys_exit, 1)
278#define __NR_exit_group 119
279__SYSCALL(119, sys_exit_group, 1)
280#define __NR_getpid 120
281__SYSCALL(120, sys_getpid, 0)
282#define __NR_wait4 121
283__SYSCALL(121, sys_wait4, 4)
284#define __NR_waitid 122
285__SYSCALL(122, sys_waitid, 5)
286#define __NR_kill 123
287__SYSCALL(123, sys_kill, 2)
288#define __NR_tkill 124
289__SYSCALL(124, sys_tkill, 2)
290#define __NR_tgkill 125
291__SYSCALL(125, sys_tgkill, 3)
292#define __NR_set_tid_address 126
293__SYSCALL(126, sys_set_tid_address, 1)
294#define __NR_gettid 127
295__SYSCALL(127, sys_gettid, 0)
296#define __NR_setsid 128
297__SYSCALL(128, sys_setsid, 0)
298#define __NR_getsid 129
299__SYSCALL(129, sys_getsid, 1)
300#define __NR_prctl 130
301__SYSCALL(130, sys_prctl, 5)
302#define __NR_personality 131
303__SYSCALL(131, sys_personality, 1)
304#define __NR_getpriority 132
305__SYSCALL(132, sys_getpriority, 2)
306#define __NR_setpriority 133
307__SYSCALL(133, sys_setpriority, 3)
308#define __NR_setitimer 134
309__SYSCALL(134, sys_setitimer, 3)
310#define __NR_getitimer 135
311__SYSCALL(135, sys_getitimer, 2)
312#define __NR_setuid 136
313__SYSCALL(136, sys_setuid, 1)
314#define __NR_getuid 137
315__SYSCALL(137, sys_getuid, 0)
316#define __NR_setgid 138
317__SYSCALL(138, sys_setgid, 1)
318#define __NR_getgid 139
319__SYSCALL(139, sys_getgid, 0)
320#define __NR_geteuid 140
321__SYSCALL(140, sys_geteuid, 0)
322#define __NR_getegid 141
323__SYSCALL(141, sys_getegid, 0)
324#define __NR_setreuid 142
325__SYSCALL(142, sys_setreuid, 2)
326#define __NR_setregid 143
327__SYSCALL(143, sys_setregid, 2)
328#define __NR_setresuid 144
329__SYSCALL(144, sys_setresuid, 3)
330#define __NR_getresuid 145
331__SYSCALL(145, sys_getresuid, 3)
332#define __NR_setresgid 146
333__SYSCALL(146, sys_setresgid, 3)
334#define __NR_getresgid 147
335__SYSCALL(147, sys_getresgid, 3)
336#define __NR_setpgid 148
337__SYSCALL(148, sys_setpgid, 2)
338#define __NR_getpgid 149
339__SYSCALL(149, sys_getpgid, 1)
340#define __NR_getppid 150
341__SYSCALL(150, sys_getppid, 0)
342#define __NR_getpgrp 151
343__SYSCALL(151, sys_getpgrp, 0)
344
345#define __NR_reserved152 152 /* set_thread_area */
346__SYSCALL(152, sys_ni_syscall, 0)
347#define __NR_reserved153 153 /* get_thread_area */
348__SYSCALL(153, sys_ni_syscall, 0)
349#define __NR_times 154
350__SYSCALL(154, sys_times, 1)
351#define __NR_acct 155
352__SYSCALL(155, sys_acct, 1)
353#define __NR_sched_setaffinity 156
354__SYSCALL(156, sys_sched_setaffinity, 3)
355#define __NR_sched_getaffinity 157
356__SYSCALL(157, sys_sched_getaffinity, 3)
357#define __NR_capget 158
358__SYSCALL(158, sys_capget, 2)
359#define __NR_capset 159
360__SYSCALL(159, sys_capset, 2)
361#define __NR_ptrace 160
362__SYSCALL(160, sys_ptrace, 4)
363#define __NR_semtimedop 161
364__SYSCALL(161, sys_semtimedop, 5)
365#define __NR_semget 162
366__SYSCALL(162, sys_semget, 4)
367#define __NR_semop 163
368__SYSCALL(163, sys_semop, 4)
369#define __NR_semctl 164
370__SYSCALL(164, sys_semctl, 4)
371#define __NR_available165 165
372__SYSCALL(165, sys_ni_syscall, 0)
373#define __NR_msgget 166
374__SYSCALL(166, sys_msgget, 4)
375#define __NR_msgsnd 167
376__SYSCALL(167, sys_msgsnd, 4)
377#define __NR_msgrcv 168
378__SYSCALL(168, sys_msgrcv, 4)
379#define __NR_msgctl 169
380__SYSCALL(169, sys_msgctl, 4)
381#define __NR_available170 170
382__SYSCALL(170, sys_ni_syscall, 0)
383
384/* File System */
385
386#define __NR_umount2 171
387__SYSCALL(171, sys_umount, 2)
388#define __NR_mount 172
389__SYSCALL(172, sys_mount, 5)
390#define __NR_swapon 173
391__SYSCALL(173, sys_swapon, 2)
392#define __NR_chroot 174
393__SYSCALL(174, sys_chroot, 1)
394#define __NR_pivot_root 175
395__SYSCALL(175, sys_pivot_root, 2)
396#define __NR_umount 176
397__SYSCALL(176, sys_umount, 2)
398#define __NR_swapoff 177
399__SYSCALL(177, sys_swapoff, 1)
400#define __NR_sync 178
401__SYSCALL(178, sys_sync, 0)
402#define __NR_syncfs 179
403__SYSCALL(179, sys_syncfs, 1)
404#define __NR_setfsuid 180
405__SYSCALL(180, sys_setfsuid, 1)
406#define __NR_setfsgid 181
407__SYSCALL(181, sys_setfsgid, 1)
408#define __NR_sysfs 182
409__SYSCALL(182, sys_sysfs, 3)
410#define __NR_ustat 183
411__SYSCALL(183, sys_ustat, 2)
412#define __NR_statfs 184
413__SYSCALL(184, sys_statfs, 2)
414#define __NR_fstatfs 185
415__SYSCALL(185, sys_fstatfs, 2)
416#define __NR_statfs64 186
417__SYSCALL(186, sys_statfs64, 3)
418#define __NR_fstatfs64 187
419__SYSCALL(187, sys_fstatfs64, 3)
420
421/* System */
422
423#define __NR_setrlimit 188
424__SYSCALL(188, sys_setrlimit, 2)
425#define __NR_getrlimit 189
426__SYSCALL(189, sys_getrlimit, 2)
427#define __NR_getrusage 190
428__SYSCALL(190, sys_getrusage, 2)
429#define __NR_futex 191
430__SYSCALL(191, sys_futex, 5)
431#define __NR_gettimeofday 192
432__SYSCALL(192, sys_gettimeofday, 2)
433#define __NR_settimeofday 193
434__SYSCALL(193, sys_settimeofday, 2)
435#define __NR_adjtimex 194
436__SYSCALL(194, sys_adjtimex, 1)
437#define __NR_nanosleep 195
438__SYSCALL(195, sys_nanosleep, 2)
439#define __NR_getgroups 196
440__SYSCALL(196, sys_getgroups, 2)
441#define __NR_setgroups 197
442__SYSCALL(197, sys_setgroups, 2)
443#define __NR_sethostname 198
444__SYSCALL(198, sys_sethostname, 2)
445#define __NR_setdomainname 199
446__SYSCALL(199, sys_setdomainname, 2)
447#define __NR_syslog 200
448__SYSCALL(200, sys_syslog, 3)
449#define __NR_vhangup 201
450__SYSCALL(201, sys_vhangup, 0)
451#define __NR_uselib 202
452__SYSCALL(202, sys_uselib, 1)
453#define __NR_reboot 203
454__SYSCALL(203, sys_reboot, 3)
455#define __NR_quotactl 204
456__SYSCALL(204, sys_quotactl, 4)
457#define __NR_nfsservctl 205
458__SYSCALL(205, sys_ni_syscall, 0) /* old nfsservctl */
459#define __NR__sysctl 206
460__SYSCALL(206, sys_sysctl, 1)
461#define __NR_bdflush 207
462__SYSCALL(207, sys_bdflush, 2)
463#define __NR_uname 208
464__SYSCALL(208, sys_newuname, 1)
465#define __NR_sysinfo 209
466__SYSCALL(209, sys_sysinfo, 1)
467#define __NR_init_module 210
468__SYSCALL(210, sys_init_module, 2)
469#define __NR_delete_module 211
470__SYSCALL(211, sys_delete_module, 1)
471
472#define __NR_sched_setparam 212
473__SYSCALL(212, sys_sched_setparam, 2)
474#define __NR_sched_getparam 213
475__SYSCALL(213, sys_sched_getparam, 2)
476#define __NR_sched_setscheduler 214
477__SYSCALL(214, sys_sched_setscheduler, 3)
478#define __NR_sched_getscheduler 215
479__SYSCALL(215, sys_sched_getscheduler, 1)
480#define __NR_sched_get_priority_max 216
481__SYSCALL(216, sys_sched_get_priority_max, 1)
482#define __NR_sched_get_priority_min 217
483__SYSCALL(217, sys_sched_get_priority_min, 1)
484#define __NR_sched_rr_get_interval 218
485__SYSCALL(218, sys_sched_rr_get_interval, 2)
486#define __NR_sched_yield 219
487__SYSCALL(219, sys_sched_yield, 0)
488#define __NR_available222 222
489__SYSCALL(222, sys_ni_syscall, 0)
490
491/* Signal Handling */
492
493#define __NR_restart_syscall 223
494__SYSCALL(223, sys_restart_syscall, 0)
495#define __NR_sigaltstack 224
496__SYSCALL(224, xtensa_sigaltstack, 2)
497#define __NR_rt_sigreturn 225
498__SYSCALL(225, xtensa_rt_sigreturn, 1)
499#define __NR_rt_sigaction 226
500__SYSCALL(226, sys_rt_sigaction, 4)
501#define __NR_rt_sigprocmask 227
502__SYSCALL(227, sys_rt_sigprocmask, 4)
503#define __NR_rt_sigpending 228
504__SYSCALL(228, sys_rt_sigpending, 2)
505#define __NR_rt_sigtimedwait 229
506__SYSCALL(229, sys_rt_sigtimedwait, 4)
507#define __NR_rt_sigqueueinfo 230
508__SYSCALL(230, sys_rt_sigqueueinfo, 3)
509#define __NR_rt_sigsuspend 231
510__SYSCALL(231, sys_rt_sigsuspend, 2)
511
512/* Message */
513
514#define __NR_mq_open 232
515__SYSCALL(232, sys_mq_open, 4)
516#define __NR_mq_unlink 233
517__SYSCALL(233, sys_mq_unlink, 1)
518#define __NR_mq_timedsend 234
519__SYSCALL(234, sys_mq_timedsend, 5)
520#define __NR_mq_timedreceive 235
521__SYSCALL(235, sys_mq_timedreceive, 5)
522#define __NR_mq_notify 236
523__SYSCALL(236, sys_mq_notify, 2)
524#define __NR_mq_getsetattr 237
525__SYSCALL(237, sys_mq_getsetattr, 3)
526#define __NR_available238 238
527__SYSCALL(238, sys_ni_syscall, 0)
528
529/* IO */
530
531#define __NR_io_setup 239
532__SYSCALL(239, sys_io_setup, 2)
533#define __NR_io_destroy 240
534__SYSCALL(240, sys_io_destroy, 1)
535#define __NR_io_submit 241
536__SYSCALL(241, sys_io_submit, 3)
537#define __NR_io_getevents 242
538__SYSCALL(242, sys_io_getevents, 5)
539#define __NR_io_cancel 243
540__SYSCALL(243, sys_io_cancel, 3)
541#define __NR_clock_settime 244
542__SYSCALL(244, sys_clock_settime, 2)
543#define __NR_clock_gettime 245
544__SYSCALL(245, sys_clock_gettime, 2)
545#define __NR_clock_getres 246
546__SYSCALL(246, sys_clock_getres, 2)
547#define __NR_clock_nanosleep 247
548__SYSCALL(247, sys_clock_nanosleep, 4)
549
550/* Timer */
551
552#define __NR_timer_create 248
553__SYSCALL(248, sys_timer_create, 3)
554#define __NR_timer_delete 249
555__SYSCALL(249, sys_timer_delete, 1)
556#define __NR_timer_settime 250
557__SYSCALL(250, sys_timer_settime, 4)
558#define __NR_timer_gettime 251
559__SYSCALL(251, sys_timer_gettime, 2)
560#define __NR_timer_getoverrun 252
561__SYSCALL(252, sys_timer_getoverrun, 1)
562
563/* System */
564
565#define __NR_reserved253 253
566__SYSCALL(253, sys_ni_syscall, 0)
567#define __NR_lookup_dcookie 254
568__SYSCALL(254, sys_lookup_dcookie, 4)
569#define __NR_available255 255
570__SYSCALL(255, sys_ni_syscall, 0)
571#define __NR_add_key 256
572__SYSCALL(256, sys_add_key, 5)
573#define __NR_request_key 257
574__SYSCALL(257, sys_request_key, 5)
575#define __NR_keyctl 258
576__SYSCALL(258, sys_keyctl, 5)
577#define __NR_available259 259
578__SYSCALL(259, sys_ni_syscall, 0)
579
580
581#define __NR_readahead 260
582__SYSCALL(260, sys_readahead, 5)
583#define __NR_remap_file_pages 261
584__SYSCALL(261, sys_remap_file_pages, 5)
585#define __NR_migrate_pages 262
586__SYSCALL(262, sys_migrate_pages, 0)
587#define __NR_mbind 263
588__SYSCALL(263, sys_mbind, 6)
589#define __NR_get_mempolicy 264
590__SYSCALL(264, sys_get_mempolicy, 5)
591#define __NR_set_mempolicy 265
592__SYSCALL(265, sys_set_mempolicy, 3)
593#define __NR_unshare 266
594__SYSCALL(266, sys_unshare, 1)
595#define __NR_move_pages 267
596__SYSCALL(267, sys_move_pages, 0)
597#define __NR_splice 268
598__SYSCALL(268, sys_splice, 0)
599#define __NR_tee 269
600__SYSCALL(269, sys_tee, 0)
601#define __NR_vmsplice 270
602__SYSCALL(270, sys_vmsplice, 0)
603#define __NR_available271 271
604__SYSCALL(271, sys_ni_syscall, 0)
605
606#define __NR_pselect6 272
607__SYSCALL(272, sys_pselect6, 0)
608#define __NR_ppoll 273
609__SYSCALL(273, sys_ppoll, 0)
610#define __NR_epoll_pwait 274
611__SYSCALL(274, sys_epoll_pwait, 0)
612#define __NR_epoll_create1 275
613__SYSCALL(275, sys_epoll_create1, 1)
614
615#define __NR_inotify_init 276
616__SYSCALL(276, sys_inotify_init, 0)
617#define __NR_inotify_add_watch 277
618__SYSCALL(277, sys_inotify_add_watch, 3)
619#define __NR_inotify_rm_watch 278
620__SYSCALL(278, sys_inotify_rm_watch, 2)
621#define __NR_inotify_init1 279
622__SYSCALL(279, sys_inotify_init1, 1)
623
624#define __NR_getcpu 280
625__SYSCALL(280, sys_getcpu, 0)
626#define __NR_kexec_load 281
627__SYSCALL(281, sys_ni_syscall, 0)
628
629#define __NR_ioprio_set 282
630__SYSCALL(282, sys_ioprio_set, 2)
631#define __NR_ioprio_get 283
632__SYSCALL(283, sys_ioprio_get, 3)
633
634#define __NR_set_robust_list 284
635__SYSCALL(284, sys_set_robust_list, 3)
636#define __NR_get_robust_list 285
637__SYSCALL(285, sys_get_robust_list, 3)
638#define __NR_available286 286
639__SYSCALL(286, sys_ni_syscall, 0)
640#define __NR_available287 287
641__SYSCALL(287, sys_ni_syscall, 0)
642
643/* Relative File Operations */
644
645#define __NR_openat 288
646__SYSCALL(288, sys_openat, 4)
647#define __NR_mkdirat 289
648__SYSCALL(289, sys_mkdirat, 3)
649#define __NR_mknodat 290
650__SYSCALL(290, sys_mknodat, 4)
651#define __NR_unlinkat 291
652__SYSCALL(291, sys_unlinkat, 3)
653#define __NR_renameat 292
654__SYSCALL(292, sys_renameat, 4)
655#define __NR_linkat 293
656__SYSCALL(293, sys_linkat, 5)
657#define __NR_symlinkat 294
658__SYSCALL(294, sys_symlinkat, 3)
659#define __NR_readlinkat 295
660__SYSCALL(295, sys_readlinkat, 4)
661#define __NR_utimensat 296
662__SYSCALL(296, sys_utimensat, 0)
663#define __NR_fchownat 297
664__SYSCALL(297, sys_fchownat, 5)
665#define __NR_futimesat 298
666__SYSCALL(298, sys_futimesat, 4)
667#define __NR_fstatat64 299
668__SYSCALL(299, sys_fstatat64, 0)
669#define __NR_fchmodat 300
670__SYSCALL(300, sys_fchmodat, 4)
671#define __NR_faccessat 301
672__SYSCALL(301, sys_faccessat, 4)
673#define __NR_available302 302
674__SYSCALL(302, sys_ni_syscall, 0)
675#define __NR_available303 303
676__SYSCALL(303, sys_ni_syscall, 0)
677
678#define __NR_signalfd 304
679__SYSCALL(304, sys_signalfd, 3)
680/* 305 was __NR_timerfd */
681__SYSCALL(305, sys_ni_syscall, 0)
682#define __NR_eventfd 306
683__SYSCALL(306, sys_eventfd, 1)
684#define __NR_recvmmsg 307
685__SYSCALL(307, sys_recvmmsg, 5)
686
687#define __NR_setns 308
688__SYSCALL(308, sys_setns, 2)
689#define __NR_signalfd4 309
690__SYSCALL(309, sys_signalfd4, 4)
691#define __NR_dup3 310
692__SYSCALL(310, sys_dup3, 3)
693#define __NR_pipe2 311
694__SYSCALL(311, sys_pipe2, 2)
695
696#define __NR_timerfd_create 312
697__SYSCALL(312, sys_timerfd_create, 2)
698#define __NR_timerfd_settime 313
699__SYSCALL(313, sys_timerfd_settime, 4)
700#define __NR_timerfd_gettime 314
701__SYSCALL(314, sys_timerfd_gettime, 2)
702#define __NR_available315 315
703__SYSCALL(315, sys_ni_syscall, 0)
704
705#define __NR_eventfd2 316
706__SYSCALL(316, sys_eventfd2, 2)
707#define __NR_preadv 317
708__SYSCALL(317, sys_preadv, 5)
709#define __NR_pwritev 318
710__SYSCALL(318, sys_pwritev, 5)
711#define __NR_available319 319
712__SYSCALL(319, sys_ni_syscall, 0)
713
714#define __NR_fanotify_init 320
715__SYSCALL(320, sys_fanotify_init, 2)
716#define __NR_fanotify_mark 321
717__SYSCALL(321, sys_fanotify_mark, 6)
718#define __NR_process_vm_readv 322
719__SYSCALL(322, sys_process_vm_readv, 6)
720#define __NR_process_vm_writev 323
721__SYSCALL(323, sys_process_vm_writev, 6)
722
723#define __NR_name_to_handle_at 324
724__SYSCALL(324, sys_name_to_handle_at, 5)
725#define __NR_open_by_handle_at 325
726__SYSCALL(325, sys_open_by_handle_at, 3)
727#define __NR_sync_file_range 326
728__SYSCALL(326, sys_sync_file_range2, 6)
729#define __NR_perf_event_open 327
730__SYSCALL(327, sys_perf_event_open, 5)
731
732#define __NR_rt_tgsigqueueinfo 328
733__SYSCALL(328, sys_rt_tgsigqueueinfo, 4)
734#define __NR_clock_adjtime 329
735__SYSCALL(329, sys_clock_adjtime, 2)
736#define __NR_prlimit64 330
737__SYSCALL(330, sys_prlimit64, 4)
738#define __NR_kcmp 331
739__SYSCALL(331, sys_kcmp, 5)
740
741
742#define __NR_syscall_count 332
743
744/*
745 * sysxtensa syscall handler
746 *
747 * int sysxtensa (SYS_XTENSA_ATOMIC_SET, ptr, val, unused);
748 * int sysxtensa (SYS_XTENSA_ATOMIC_ADD, ptr, val, unused);
749 * int sysxtensa (SYS_XTENSA_ATOMIC_EXG_ADD, ptr, val, unused);
750 * int sysxtensa (SYS_XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval);
751 * a2 a6 a3 a4 a5
752 */
753
754#define SYS_XTENSA_RESERVED 0 /* don't use this */
755#define SYS_XTENSA_ATOMIC_SET 1 /* set variable */
756#define SYS_XTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */
757#define SYS_XTENSA_ATOMIC_ADD 3 /* add to memory */
758#define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */
759
760#define SYS_XTENSA_COUNT 5 /* count */
761
762#endif /* _UAPI_XTENSA_UNISTD_H */
diff --git a/arch/xtensa/kernel/align.S b/arch/xtensa/kernel/align.S
index 33d6e9d2e83c..934ae58e2c79 100644
--- a/arch/xtensa/kernel/align.S
+++ b/arch/xtensa/kernel/align.S
@@ -170,15 +170,15 @@ ENTRY(fast_unaligned)
170 s32i a7, a2, PT_AREG7 170 s32i a7, a2, PT_AREG7
171 s32i a8, a2, PT_AREG8 171 s32i a8, a2, PT_AREG8
172 172
173 rsr a0, DEPC 173 rsr a0, depc
174 xsr a3, EXCSAVE_1 174 xsr a3, excsave1
175 s32i a0, a2, PT_AREG2 175 s32i a0, a2, PT_AREG2
176 s32i a3, a2, PT_AREG3 176 s32i a3, a2, PT_AREG3
177 177
178 /* Keep value of SAR in a0 */ 178 /* Keep value of SAR in a0 */
179 179
180 rsr a0, SAR 180 rsr a0, sar
181 rsr a8, EXCVADDR # load unaligned memory address 181 rsr a8, excvaddr # load unaligned memory address
182 182
183 /* Now, identify one of the following load/store instructions. 183 /* Now, identify one of the following load/store instructions.
184 * 184 *
@@ -197,7 +197,7 @@ ENTRY(fast_unaligned)
197 197
198 /* Extract the instruction that caused the unaligned access. */ 198 /* Extract the instruction that caused the unaligned access. */
199 199
200 rsr a7, EPC_1 # load exception address 200 rsr a7, epc1 # load exception address
201 movi a3, ~3 201 movi a3, ~3
202 and a3, a3, a7 # mask lower bits 202 and a3, a3, a7 # mask lower bits
203 203
@@ -275,16 +275,16 @@ ENTRY(fast_unaligned)
2751: 2751:
276 276
277#if XCHAL_HAVE_LOOPS 277#if XCHAL_HAVE_LOOPS
278 rsr a5, LEND # check if we reached LEND 278 rsr a5, lend # check if we reached LEND
279 bne a7, a5, 1f 279 bne a7, a5, 1f
280 rsr a5, LCOUNT # and LCOUNT != 0 280 rsr a5, lcount # and LCOUNT != 0
281 beqz a5, 1f 281 beqz a5, 1f
282 addi a5, a5, -1 # decrement LCOUNT and set 282 addi a5, a5, -1 # decrement LCOUNT and set
283 rsr a7, LBEG # set PC to LBEGIN 283 rsr a7, lbeg # set PC to LBEGIN
284 wsr a5, LCOUNT 284 wsr a5, lcount
285#endif 285#endif
286 286
2871: wsr a7, EPC_1 # skip load instruction 2871: wsr a7, epc1 # skip load instruction
288 extui a4, a4, INSN_T, 4 # extract target register 288 extui a4, a4, INSN_T, 4 # extract target register
289 movi a5, .Lload_table 289 movi a5, .Lload_table
290 addx8 a4, a4, a5 290 addx8 a4, a4, a5
@@ -355,16 +355,16 @@ ENTRY(fast_unaligned)
355 355
3561: 3561:
357#if XCHAL_HAVE_LOOPS 357#if XCHAL_HAVE_LOOPS
358 rsr a4, LEND # check if we reached LEND 358 rsr a4, lend # check if we reached LEND
359 bne a7, a4, 1f 359 bne a7, a4, 1f
360 rsr a4, LCOUNT # and LCOUNT != 0 360 rsr a4, lcount # and LCOUNT != 0
361 beqz a4, 1f 361 beqz a4, 1f
362 addi a4, a4, -1 # decrement LCOUNT and set 362 addi a4, a4, -1 # decrement LCOUNT and set
363 rsr a7, LBEG # set PC to LBEGIN 363 rsr a7, lbeg # set PC to LBEGIN
364 wsr a4, LCOUNT 364 wsr a4, lcount
365#endif 365#endif
366 366
3671: wsr a7, EPC_1 # skip store instruction 3671: wsr a7, epc1 # skip store instruction
368 movi a4, ~3 368 movi a4, ~3
369 and a4, a4, a8 # align memory address 369 and a4, a4, a8 # align memory address
370 370
@@ -406,7 +406,7 @@ ENTRY(fast_unaligned)
406 406
407.Lexit: 407.Lexit:
408 movi a4, 0 408 movi a4, 0
409 rsr a3, EXCSAVE_1 409 rsr a3, excsave1
410 s32i a4, a3, EXC_TABLE_FIXUP 410 s32i a4, a3, EXC_TABLE_FIXUP
411 411
412 /* Restore working register */ 412 /* Restore working register */
@@ -420,7 +420,7 @@ ENTRY(fast_unaligned)
420 420
421 /* restore SAR and return */ 421 /* restore SAR and return */
422 422
423 wsr a0, SAR 423 wsr a0, sar
424 l32i a0, a2, PT_AREG0 424 l32i a0, a2, PT_AREG0
425 l32i a2, a2, PT_AREG2 425 l32i a2, a2, PT_AREG2
426 rfe 426 rfe
@@ -438,10 +438,10 @@ ENTRY(fast_unaligned)
438 l32i a6, a2, PT_AREG6 438 l32i a6, a2, PT_AREG6
439 l32i a5, a2, PT_AREG5 439 l32i a5, a2, PT_AREG5
440 l32i a4, a2, PT_AREG4 440 l32i a4, a2, PT_AREG4
441 wsr a0, SAR 441 wsr a0, sar
442 mov a1, a2 442 mov a1, a2
443 443
444 rsr a0, PS 444 rsr a0, ps
445 bbsi.l a2, PS_UM_BIT, 1f # jump if user mode 445 bbsi.l a2, PS_UM_BIT, 1f # jump if user mode
446 446
447 movi a0, _kernel_exception 447 movi a0, _kernel_exception
diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S
index 2bc1e145c0a4..54c3be313bfa 100644
--- a/arch/xtensa/kernel/coprocessor.S
+++ b/arch/xtensa/kernel/coprocessor.S
@@ -43,7 +43,7 @@
43/* IO protection is currently unsupported. */ 43/* IO protection is currently unsupported. */
44 44
45ENTRY(fast_io_protect) 45ENTRY(fast_io_protect)
46 wsr a0, EXCSAVE_1 46 wsr a0, excsave1
47 movi a0, unrecoverable_exception 47 movi a0, unrecoverable_exception
48 callx0 a0 48 callx0 a0
49 49
@@ -220,7 +220,7 @@ ENTRY(coprocessor_restore)
220 */ 220 */
221 221
222ENTRY(fast_coprocessor_double) 222ENTRY(fast_coprocessor_double)
223 wsr a0, EXCSAVE_1 223 wsr a0, excsave1
224 movi a0, unrecoverable_exception 224 movi a0, unrecoverable_exception
225 callx0 a0 225 callx0 a0
226 226
@@ -229,13 +229,13 @@ ENTRY(fast_coprocessor)
229 229
230 /* Save remaining registers a1-a3 and SAR */ 230 /* Save remaining registers a1-a3 and SAR */
231 231
232 xsr a3, EXCSAVE_1 232 xsr a3, excsave1
233 s32i a3, a2, PT_AREG3 233 s32i a3, a2, PT_AREG3
234 rsr a3, SAR 234 rsr a3, sar
235 s32i a1, a2, PT_AREG1 235 s32i a1, a2, PT_AREG1
236 s32i a3, a2, PT_SAR 236 s32i a3, a2, PT_SAR
237 mov a1, a2 237 mov a1, a2
238 rsr a2, DEPC 238 rsr a2, depc
239 s32i a2, a1, PT_AREG2 239 s32i a2, a1, PT_AREG2
240 240
241 /* 241 /*
@@ -248,17 +248,17 @@ ENTRY(fast_coprocessor)
248 248
249 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */ 249 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */
250 250
251 rsr a3, EXCCAUSE 251 rsr a3, exccause
252 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED 252 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
253 253
254 /* Set corresponding CPENABLE bit -> (sar:cp-index, a3: 1<<cp-index)*/ 254 /* Set corresponding CPENABLE bit -> (sar:cp-index, a3: 1<<cp-index)*/
255 255
256 ssl a3 # SAR: 32 - coprocessor_number 256 ssl a3 # SAR: 32 - coprocessor_number
257 movi a2, 1 257 movi a2, 1
258 rsr a0, CPENABLE 258 rsr a0, cpenable
259 sll a2, a2 259 sll a2, a2
260 or a0, a0, a2 260 or a0, a0, a2
261 wsr a0, CPENABLE 261 wsr a0, cpenable
262 rsync 262 rsync
263 263
264 /* Retrieve previous owner. (a3 still holds CP number) */ 264 /* Retrieve previous owner. (a3 still holds CP number) */
@@ -291,7 +291,7 @@ ENTRY(fast_coprocessor)
291 291
292 /* Note that only a0 and a1 were preserved. */ 292 /* Note that only a0 and a1 were preserved. */
293 293
2942: rsr a3, EXCCAUSE 2942: rsr a3, exccause
295 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED 295 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
296 movi a0, coprocessor_owner 296 movi a0, coprocessor_owner
297 addx4 a0, a3, a0 297 addx4 a0, a3, a0
@@ -321,7 +321,7 @@ ENTRY(fast_coprocessor)
321 l32i a0, a1, PT_SAR 321 l32i a0, a1, PT_SAR
322 l32i a3, a1, PT_AREG3 322 l32i a3, a1, PT_AREG3
323 l32i a2, a1, PT_AREG2 323 l32i a2, a1, PT_AREG2
324 wsr a0, SAR 324 wsr a0, sar
325 l32i a0, a1, PT_AREG0 325 l32i a0, a1, PT_AREG0
326 l32i a1, a1, PT_AREG1 326 l32i a1, a1, PT_AREG1
327 327
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 7e6236073397..18453067c258 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -112,8 +112,8 @@ ENTRY(user_exception)
112 112
113 /* Save a2, a3, and depc, restore excsave_1 and set SP. */ 113 /* Save a2, a3, and depc, restore excsave_1 and set SP. */
114 114
115 xsr a3, EXCSAVE_1 115 xsr a3, excsave1
116 rsr a0, DEPC 116 rsr a0, depc
117 s32i a1, a2, PT_AREG1 117 s32i a1, a2, PT_AREG1
118 s32i a0, a2, PT_AREG2 118 s32i a0, a2, PT_AREG2
119 s32i a3, a2, PT_AREG3 119 s32i a3, a2, PT_AREG3
@@ -125,16 +125,16 @@ _user_exception:
125 /* Save SAR and turn off single stepping */ 125 /* Save SAR and turn off single stepping */
126 126
127 movi a2, 0 127 movi a2, 0
128 rsr a3, SAR 128 rsr a3, sar
129 xsr a2, ICOUNTLEVEL 129 xsr a2, icountlevel
130 s32i a3, a1, PT_SAR 130 s32i a3, a1, PT_SAR
131 s32i a2, a1, PT_ICOUNTLEVEL 131 s32i a2, a1, PT_ICOUNTLEVEL
132 132
133 /* Rotate ws so that the current windowbase is at bit0. */ 133 /* Rotate ws so that the current windowbase is at bit0. */
134 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */ 134 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */
135 135
136 rsr a2, WINDOWBASE 136 rsr a2, windowbase
137 rsr a3, WINDOWSTART 137 rsr a3, windowstart
138 ssr a2 138 ssr a2
139 s32i a2, a1, PT_WINDOWBASE 139 s32i a2, a1, PT_WINDOWBASE
140 s32i a3, a1, PT_WINDOWSTART 140 s32i a3, a1, PT_WINDOWSTART
@@ -205,12 +205,12 @@ _user_exception:
205 205
206 /* WINDOWBASE still in SAR! */ 206 /* WINDOWBASE still in SAR! */
207 207
208 rsr a2, SAR # original WINDOWBASE 208 rsr a2, sar # original WINDOWBASE
209 movi a3, 1 209 movi a3, 1
210 ssl a2 210 ssl a2
211 sll a3, a3 211 sll a3, a3
212 wsr a3, WINDOWSTART # set corresponding WINDOWSTART bit 212 wsr a3, windowstart # set corresponding WINDOWSTART bit
213 wsr a2, WINDOWBASE # and WINDOWSTART 213 wsr a2, windowbase # and WINDOWSTART
214 rsync 214 rsync
215 215
216 /* We are back to the original stack pointer (a1) */ 216 /* We are back to the original stack pointer (a1) */
@@ -252,8 +252,8 @@ ENTRY(kernel_exception)
252 252
253 /* Save a0, a2, a3, DEPC and set SP. */ 253 /* Save a0, a2, a3, DEPC and set SP. */
254 254
255 xsr a3, EXCSAVE_1 # restore a3, excsave_1 255 xsr a3, excsave1 # restore a3, excsave_1
256 rsr a0, DEPC # get a2 256 rsr a0, depc # get a2
257 s32i a1, a2, PT_AREG1 257 s32i a1, a2, PT_AREG1
258 s32i a0, a2, PT_AREG2 258 s32i a0, a2, PT_AREG2
259 s32i a3, a2, PT_AREG3 259 s32i a3, a2, PT_AREG3
@@ -265,16 +265,16 @@ _kernel_exception:
265 /* Save SAR and turn off single stepping */ 265 /* Save SAR and turn off single stepping */
266 266
267 movi a2, 0 267 movi a2, 0
268 rsr a3, SAR 268 rsr a3, sar
269 xsr a2, ICOUNTLEVEL 269 xsr a2, icountlevel
270 s32i a3, a1, PT_SAR 270 s32i a3, a1, PT_SAR
271 s32i a2, a1, PT_ICOUNTLEVEL 271 s32i a2, a1, PT_ICOUNTLEVEL
272 272
273 /* Rotate ws so that the current windowbase is at bit0. */ 273 /* Rotate ws so that the current windowbase is at bit0. */
274 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */ 274 /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */
275 275
276 rsr a2, WINDOWBASE # don't need to save these, we only 276 rsr a2, windowbase # don't need to save these, we only
277 rsr a3, WINDOWSTART # need shifted windowstart: windowmask 277 rsr a3, windowstart # need shifted windowstart: windowmask
278 ssr a2 278 ssr a2
279 slli a2, a3, 32-WSBITS 279 slli a2, a3, 32-WSBITS
280 src a2, a3, a2 280 src a2, a3, a2
@@ -323,24 +323,24 @@ common_exception:
323 323
324 /* Save some registers, disable loops and clear the syscall flag. */ 324 /* Save some registers, disable loops and clear the syscall flag. */
325 325
326 rsr a2, DEBUGCAUSE 326 rsr a2, debugcause
327 rsr a3, EPC_1 327 rsr a3, epc1
328 s32i a2, a1, PT_DEBUGCAUSE 328 s32i a2, a1, PT_DEBUGCAUSE
329 s32i a3, a1, PT_PC 329 s32i a3, a1, PT_PC
330 330
331 movi a2, -1 331 movi a2, -1
332 rsr a3, EXCVADDR 332 rsr a3, excvaddr
333 s32i a2, a1, PT_SYSCALL 333 s32i a2, a1, PT_SYSCALL
334 movi a2, 0 334 movi a2, 0
335 s32i a3, a1, PT_EXCVADDR 335 s32i a3, a1, PT_EXCVADDR
336 xsr a2, LCOUNT 336 xsr a2, lcount
337 s32i a2, a1, PT_LCOUNT 337 s32i a2, a1, PT_LCOUNT
338 338
339 /* It is now save to restore the EXC_TABLE_FIXUP variable. */ 339 /* It is now save to restore the EXC_TABLE_FIXUP variable. */
340 340
341 rsr a0, EXCCAUSE 341 rsr a0, exccause
342 movi a3, 0 342 movi a3, 0
343 rsr a2, EXCSAVE_1 343 rsr a2, excsave1
344 s32i a0, a1, PT_EXCCAUSE 344 s32i a0, a1, PT_EXCCAUSE
345 s32i a3, a2, EXC_TABLE_FIXUP 345 s32i a3, a2, EXC_TABLE_FIXUP
346 346
@@ -352,22 +352,22 @@ common_exception:
352 * (interrupts disabled) and if this exception is not an interrupt. 352 * (interrupts disabled) and if this exception is not an interrupt.
353 */ 353 */
354 354
355 rsr a3, PS 355 rsr a3, ps
356 addi a0, a0, -4 356 addi a0, a0, -4
357 movi a2, 1 357 movi a2, 1
358 extui a3, a3, 0, 1 # a3 = PS.INTLEVEL[0] 358 extui a3, a3, 0, 1 # a3 = PS.INTLEVEL[0]
359 moveqz a3, a2, a0 # a3 = 1 iff interrupt exception 359 moveqz a3, a2, a0 # a3 = 1 iff interrupt exception
360 movi a2, 1 << PS_WOE_BIT 360 movi a2, 1 << PS_WOE_BIT
361 or a3, a3, a2 361 or a3, a3, a2
362 rsr a0, EXCCAUSE 362 rsr a0, exccause
363 xsr a3, PS 363 xsr a3, ps
364 364
365 s32i a3, a1, PT_PS # save ps 365 s32i a3, a1, PT_PS # save ps
366 366
367 /* Save LBEG, LEND */ 367 /* Save lbeg, lend */
368 368
369 rsr a2, LBEG 369 rsr a2, lbeg
370 rsr a3, LEND 370 rsr a3, lend
371 s32i a2, a1, PT_LBEG 371 s32i a2, a1, PT_LBEG
372 s32i a3, a1, PT_LEND 372 s32i a3, a1, PT_LEND
373 373
@@ -432,7 +432,7 @@ common_exception_return:
432 432
433 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT 433 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
434 434
435 wsr a3, PS /* disable interrupts */ 435 wsr a3, ps /* disable interrupts */
436 436
437 _bbci.l a3, PS_UM_BIT, kernel_exception_exit 437 _bbci.l a3, PS_UM_BIT, kernel_exception_exit
438 438
@@ -444,12 +444,12 @@ user_exception_exit:
444 444
445 l32i a2, a1, PT_WINDOWBASE 445 l32i a2, a1, PT_WINDOWBASE
446 l32i a3, a1, PT_WINDOWSTART 446 l32i a3, a1, PT_WINDOWSTART
447 wsr a1, DEPC # use DEPC as temp storage 447 wsr a1, depc # use DEPC as temp storage
448 wsr a3, WINDOWSTART # restore WINDOWSTART 448 wsr a3, windowstart # restore WINDOWSTART
449 ssr a2 # preserve user's WB in the SAR 449 ssr a2 # preserve user's WB in the SAR
450 wsr a2, WINDOWBASE # switch to user's saved WB 450 wsr a2, windowbase # switch to user's saved WB
451 rsync 451 rsync
452 rsr a1, DEPC # restore stack pointer 452 rsr a1, depc # restore stack pointer
453 l32i a2, a1, PT_WMASK # register frames saved (in bits 4...9) 453 l32i a2, a1, PT_WMASK # register frames saved (in bits 4...9)
454 rotw -1 # we restore a4..a7 454 rotw -1 # we restore a4..a7
455 _bltui a6, 16, 1f # only have to restore current window? 455 _bltui a6, 16, 1f # only have to restore current window?
@@ -475,8 +475,8 @@ user_exception_exit:
475 475
476 /* Clear unrestored registers (don't leak anything to user-land */ 476 /* Clear unrestored registers (don't leak anything to user-land */
477 477
4781: rsr a0, WINDOWBASE 4781: rsr a0, windowbase
479 rsr a3, SAR 479 rsr a3, sar
480 sub a3, a0, a3 480 sub a3, a0, a3
481 beqz a3, 2f 481 beqz a3, 2f
482 extui a3, a3, 0, WBBITS 482 extui a3, a3, 0, WBBITS
@@ -556,7 +556,7 @@ kernel_exception_exit:
556 556
557 /* Test WINDOWSTART now. If spilled, do the movsp */ 557 /* Test WINDOWSTART now. If spilled, do the movsp */
558 558
559 rsr a3, WINDOWSTART 559 rsr a3, windowstart
560 addi a0, a3, -1 560 addi a0, a3, -1
561 and a3, a3, a0 561 and a3, a3, a0
562 _bnez a3, common_exception_exit 562 _bnez a3, common_exception_exit
@@ -604,24 +604,24 @@ common_exception_exit:
604 604
6051: l32i a2, a1, PT_PC 6051: l32i a2, a1, PT_PC
606 l32i a3, a1, PT_SAR 606 l32i a3, a1, PT_SAR
607 wsr a2, EPC_1 607 wsr a2, epc1
608 wsr a3, SAR 608 wsr a3, sar
609 609
610 /* Restore LBEG, LEND, LCOUNT */ 610 /* Restore LBEG, LEND, LCOUNT */
611 611
612 l32i a2, a1, PT_LBEG 612 l32i a2, a1, PT_LBEG
613 l32i a3, a1, PT_LEND 613 l32i a3, a1, PT_LEND
614 wsr a2, LBEG 614 wsr a2, lbeg
615 l32i a2, a1, PT_LCOUNT 615 l32i a2, a1, PT_LCOUNT
616 wsr a3, LEND 616 wsr a3, lend
617 wsr a2, LCOUNT 617 wsr a2, lcount
618 618
619 /* We control single stepping through the ICOUNTLEVEL register. */ 619 /* We control single stepping through the ICOUNTLEVEL register. */
620 620
621 l32i a2, a1, PT_ICOUNTLEVEL 621 l32i a2, a1, PT_ICOUNTLEVEL
622 movi a3, -2 622 movi a3, -2
623 wsr a2, ICOUNTLEVEL 623 wsr a2, icountlevel
624 wsr a3, ICOUNT 624 wsr a3, icount
625 625
626 /* Check if it was double exception. */ 626 /* Check if it was double exception. */
627 627
@@ -636,7 +636,7 @@ common_exception_exit:
636 l32i a1, a1, PT_AREG1 636 l32i a1, a1, PT_AREG1
637 rfe 637 rfe
638 638
6391: wsr a0, DEPC 6391: wsr a0, depc
640 l32i a0, a1, PT_AREG0 640 l32i a0, a1, PT_AREG0
641 l32i a1, a1, PT_AREG1 641 l32i a1, a1, PT_AREG1
642 rfde 642 rfde
@@ -651,25 +651,25 @@ common_exception_exit:
651 651
652ENTRY(debug_exception) 652ENTRY(debug_exception)
653 653
654 rsr a0, EPS + XCHAL_DEBUGLEVEL 654 rsr a0, SREG_EPS + XCHAL_DEBUGLEVEL
655 bbsi.l a0, PS_EXCM_BIT, 1f # exception mode 655 bbsi.l a0, PS_EXCM_BIT, 1f # exception mode
656 656
657 /* Set EPC_1 and EXCCAUSE */ 657 /* Set EPC1 and EXCCAUSE */
658 658
659 wsr a2, DEPC # save a2 temporarily 659 wsr a2, depc # save a2 temporarily
660 rsr a2, EPC + XCHAL_DEBUGLEVEL 660 rsr a2, SREG_EPC + XCHAL_DEBUGLEVEL
661 wsr a2, EPC_1 661 wsr a2, epc1
662 662
663 movi a2, EXCCAUSE_MAPPED_DEBUG 663 movi a2, EXCCAUSE_MAPPED_DEBUG
664 wsr a2, EXCCAUSE 664 wsr a2, exccause
665 665
666 /* Restore PS to the value before the debug exc but with PS.EXCM set.*/ 666 /* Restore PS to the value before the debug exc but with PS.EXCM set.*/
667 667
668 movi a2, 1 << PS_EXCM_BIT 668 movi a2, 1 << PS_EXCM_BIT
669 or a2, a0, a2 669 or a2, a0, a2
670 movi a0, debug_exception # restore a3, debug jump vector 670 movi a0, debug_exception # restore a3, debug jump vector
671 wsr a2, PS 671 wsr a2, ps
672 xsr a0, EXCSAVE + XCHAL_DEBUGLEVEL 672 xsr a0, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
673 673
674 /* Switch to kernel/user stack, restore jump vector, and save a0 */ 674 /* Switch to kernel/user stack, restore jump vector, and save a0 */
675 675
@@ -680,19 +680,19 @@ ENTRY(debug_exception)
680 movi a0, 0 680 movi a0, 0
681 s32i a1, a2, PT_AREG1 681 s32i a1, a2, PT_AREG1
682 s32i a0, a2, PT_DEPC # mark it as a regular exception 682 s32i a0, a2, PT_DEPC # mark it as a regular exception
683 xsr a0, DEPC 683 xsr a0, depc
684 s32i a3, a2, PT_AREG3 684 s32i a3, a2, PT_AREG3
685 s32i a0, a2, PT_AREG2 685 s32i a0, a2, PT_AREG2
686 mov a1, a2 686 mov a1, a2
687 j _kernel_exception 687 j _kernel_exception
688 688
6892: rsr a2, EXCSAVE_1 6892: rsr a2, excsave1
690 l32i a2, a2, EXC_TABLE_KSTK # load kernel stack pointer 690 l32i a2, a2, EXC_TABLE_KSTK # load kernel stack pointer
691 s32i a0, a2, PT_AREG0 691 s32i a0, a2, PT_AREG0
692 movi a0, 0 692 movi a0, 0
693 s32i a1, a2, PT_AREG1 693 s32i a1, a2, PT_AREG1
694 s32i a0, a2, PT_DEPC 694 s32i a0, a2, PT_DEPC
695 xsr a0, DEPC 695 xsr a0, depc
696 s32i a3, a2, PT_AREG3 696 s32i a3, a2, PT_AREG3
697 s32i a0, a2, PT_AREG2 697 s32i a0, a2, PT_AREG2
698 mov a1, a2 698 mov a1, a2
@@ -732,12 +732,12 @@ ENTRY(unrecoverable_exception)
732 movi a0, 1 732 movi a0, 1
733 movi a1, 0 733 movi a1, 0
734 734
735 wsr a0, WINDOWSTART 735 wsr a0, windowstart
736 wsr a1, WINDOWBASE 736 wsr a1, windowbase
737 rsync 737 rsync
738 738
739 movi a1, (1 << PS_WOE_BIT) | 1 739 movi a1, (1 << PS_WOE_BIT) | 1
740 wsr a1, PS 740 wsr a1, ps
741 rsync 741 rsync
742 742
743 movi a1, init_task 743 movi a1, init_task
@@ -793,7 +793,7 @@ ENTRY(fast_alloca)
793 l32i a0, a2, PT_DEPC 793 l32i a0, a2, PT_DEPC
794 _bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, .Lunhandled_double 794 _bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, .Lunhandled_double
795 795
796 rsr a0, DEPC # get a2 796 rsr a0, depc # get a2
797 s32i a4, a2, PT_AREG4 # save a4 and 797 s32i a4, a2, PT_AREG4 # save a4 and
798 s32i a0, a2, PT_AREG2 # a2 to stack 798 s32i a0, a2, PT_AREG2 # a2 to stack
799 799
@@ -804,8 +804,8 @@ ENTRY(fast_alloca)
804 804
805 /* Restore a3, excsave_1 */ 805 /* Restore a3, excsave_1 */
806 806
807 xsr a3, EXCSAVE_1 # make sure excsave_1 is valid for dbl. 807 xsr a3, excsave1 # make sure excsave_1 is valid for dbl.
808 rsr a4, EPC_1 # get exception address 808 rsr a4, epc1 # get exception address
809 s32i a3, a2, PT_AREG3 # save a3 to stack 809 s32i a3, a2, PT_AREG3 # save a3 to stack
810 810
811#ifdef ALLOCA_EXCEPTION_IN_IRAM 811#ifdef ALLOCA_EXCEPTION_IN_IRAM
@@ -820,7 +820,7 @@ ENTRY(fast_alloca)
820 jx a3 820 jx a3
821 821
822.Lunhandled_double: 822.Lunhandled_double:
823 wsr a0, EXCSAVE_1 823 wsr a0, excsave1
824 movi a0, unrecoverable_exception 824 movi a0, unrecoverable_exception
825 callx0 a0 825 callx0 a0
826 826
@@ -852,7 +852,7 @@ ENTRY(fast_alloca)
852#endif 852#endif
853 addi a4, a4, 3 # step over movsp 853 addi a4, a4, 3 # step over movsp
854 _EXTUI_MOVSP_DST(a0) # extract destination register 854 _EXTUI_MOVSP_DST(a0) # extract destination register
855 wsr a4, EPC_1 # save new epc_1 855 wsr a4, epc1 # save new epc_1
856 856
857 _bnei a0, 1, 1f # no 'movsp a1, ax': jump 857 _bnei a0, 1, 1f # no 'movsp a1, ax': jump
858 858
@@ -953,14 +953,14 @@ ENTRY(fast_syscall_kernel)
953 953
954 /* Skip syscall. */ 954 /* Skip syscall. */
955 955
956 rsr a0, EPC_1 956 rsr a0, epc1
957 addi a0, a0, 3 957 addi a0, a0, 3
958 wsr a0, EPC_1 958 wsr a0, epc1
959 959
960 l32i a0, a2, PT_DEPC 960 l32i a0, a2, PT_DEPC
961 bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_syscall_unrecoverable 961 bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_syscall_unrecoverable
962 962
963 rsr a0, DEPC # get syscall-nr 963 rsr a0, depc # get syscall-nr
964 _beqz a0, fast_syscall_spill_registers 964 _beqz a0, fast_syscall_spill_registers
965 _beqi a0, __NR_xtensa, fast_syscall_xtensa 965 _beqi a0, __NR_xtensa, fast_syscall_xtensa
966 966
@@ -970,14 +970,14 @@ ENTRY(fast_syscall_user)
970 970
971 /* Skip syscall. */ 971 /* Skip syscall. */
972 972
973 rsr a0, EPC_1 973 rsr a0, epc1
974 addi a0, a0, 3 974 addi a0, a0, 3
975 wsr a0, EPC_1 975 wsr a0, epc1
976 976
977 l32i a0, a2, PT_DEPC 977 l32i a0, a2, PT_DEPC
978 bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_syscall_unrecoverable 978 bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_syscall_unrecoverable
979 979
980 rsr a0, DEPC # get syscall-nr 980 rsr a0, depc # get syscall-nr
981 _beqz a0, fast_syscall_spill_registers 981 _beqz a0, fast_syscall_spill_registers
982 _beqi a0, __NR_xtensa, fast_syscall_xtensa 982 _beqi a0, __NR_xtensa, fast_syscall_xtensa
983 983
@@ -988,10 +988,10 @@ ENTRY(fast_syscall_unrecoverable)
988 /* Restore all states. */ 988 /* Restore all states. */
989 989
990 l32i a0, a2, PT_AREG0 # restore a0 990 l32i a0, a2, PT_AREG0 # restore a0
991 xsr a2, DEPC # restore a2, depc 991 xsr a2, depc # restore a2, depc
992 rsr a3, EXCSAVE_1 992 rsr a3, excsave1
993 993
994 wsr a0, EXCSAVE_1 994 wsr a0, excsave1
995 movi a0, unrecoverable_exception 995 movi a0, unrecoverable_exception
996 callx0 a0 996 callx0 a0
997 997
@@ -1047,7 +1047,7 @@ ENTRY(fast_syscall_unrecoverable)
1047 1047
1048ENTRY(fast_syscall_xtensa) 1048ENTRY(fast_syscall_xtensa)
1049 1049
1050 xsr a3, EXCSAVE_1 # restore a3, excsave1 1050 xsr a3, excsave1 # restore a3, excsave1
1051 1051
1052 s32i a7, a2, PT_AREG7 # we need an additional register 1052 s32i a7, a2, PT_AREG7 # we need an additional register
1053 movi a7, 4 # sizeof(unsigned int) 1053 movi a7, 4 # sizeof(unsigned int)
@@ -1124,13 +1124,13 @@ ENTRY(fast_syscall_spill_registers)
1124 1124
1125 movi a0, fast_syscall_spill_registers_fixup 1125 movi a0, fast_syscall_spill_registers_fixup
1126 s32i a0, a3, EXC_TABLE_FIXUP 1126 s32i a0, a3, EXC_TABLE_FIXUP
1127 rsr a0, WINDOWBASE 1127 rsr a0, windowbase
1128 s32i a0, a3, EXC_TABLE_PARAM 1128 s32i a0, a3, EXC_TABLE_PARAM
1129 1129
1130 /* Save a3 and SAR on stack. */ 1130 /* Save a3 and SAR on stack. */
1131 1131
1132 rsr a0, SAR 1132 rsr a0, sar
1133 xsr a3, EXCSAVE_1 # restore a3 and excsave_1 1133 xsr a3, excsave1 # restore a3 and excsave_1
1134 s32i a3, a2, PT_AREG3 1134 s32i a3, a2, PT_AREG3
1135 s32i a4, a2, PT_AREG4 1135 s32i a4, a2, PT_AREG4
1136 s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5 1136 s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5
@@ -1148,7 +1148,7 @@ ENTRY(fast_syscall_spill_registers)
1148 l32i a3, a2, PT_AREG5 1148 l32i a3, a2, PT_AREG5
1149 l32i a4, a2, PT_AREG4 1149 l32i a4, a2, PT_AREG4
1150 l32i a0, a2, PT_AREG0 1150 l32i a0, a2, PT_AREG0
1151 wsr a3, SAR 1151 wsr a3, sar
1152 l32i a3, a2, PT_AREG3 1152 l32i a3, a2, PT_AREG3
1153 1153
1154 /* Restore clobbered registers. */ 1154 /* Restore clobbered registers. */
@@ -1173,8 +1173,8 @@ ENTRY(fast_syscall_spill_registers)
1173 1173
1174fast_syscall_spill_registers_fixup: 1174fast_syscall_spill_registers_fixup:
1175 1175
1176 rsr a2, WINDOWBASE # get current windowbase (a2 is saved) 1176 rsr a2, windowbase # get current windowbase (a2 is saved)
1177 xsr a0, DEPC # restore depc and a0 1177 xsr a0, depc # restore depc and a0
1178 ssl a2 # set shift (32 - WB) 1178 ssl a2 # set shift (32 - WB)
1179 1179
1180 /* We need to make sure the current registers (a0-a3) are preserved. 1180 /* We need to make sure the current registers (a0-a3) are preserved.
@@ -1182,12 +1182,12 @@ fast_syscall_spill_registers_fixup:
1182 * in WS, so that the exception handlers save them to the task stack. 1182 * in WS, so that the exception handlers save them to the task stack.
1183 */ 1183 */
1184 1184
1185 rsr a3, EXCSAVE_1 # get spill-mask 1185 rsr a3, excsave1 # get spill-mask
1186 slli a2, a3, 1 # shift left by one 1186 slli a2, a3, 1 # shift left by one
1187 1187
1188 slli a3, a2, 32-WSBITS 1188 slli a3, a2, 32-WSBITS
1189 src a2, a2, a3 # a1 = xxwww1yyxxxwww1yy...... 1189 src a2, a2, a3 # a1 = xxwww1yyxxxwww1yy......
1190 wsr a2, WINDOWSTART # set corrected windowstart 1190 wsr a2, windowstart # set corrected windowstart
1191 1191
1192 movi a3, exc_table 1192 movi a3, exc_table
1193 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE # restore a2 1193 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE # restore a2
@@ -1201,7 +1201,7 @@ fast_syscall_spill_registers_fixup:
1201 * excsave_1: a3 1201 * excsave_1: a3
1202 */ 1202 */
1203 1203
1204 wsr a3, WINDOWBASE 1204 wsr a3, windowbase
1205 rsync 1205 rsync
1206 1206
1207 /* We are now in the original frame when we entered _spill_registers: 1207 /* We are now in the original frame when we entered _spill_registers:
@@ -1227,7 +1227,7 @@ fast_syscall_spill_registers_fixup:
1227 /* Jump to the exception handler. */ 1227 /* Jump to the exception handler. */
1228 1228
1229 movi a3, exc_table 1229 movi a3, exc_table
1230 rsr a0, EXCCAUSE 1230 rsr a0, exccause
1231 addx4 a0, a0, a3 # find entry in table 1231 addx4 a0, a0, a3 # find entry in table
1232 l32i a0, a0, EXC_TABLE_FAST_USER # load handler 1232 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
1233 jx a0 1233 jx a0
@@ -1236,28 +1236,28 @@ fast_syscall_spill_registers_fixup_return:
1236 1236
1237 /* When we return here, all registers have been restored (a2: DEPC) */ 1237 /* When we return here, all registers have been restored (a2: DEPC) */
1238 1238
1239 wsr a2, DEPC # exception address 1239 wsr a2, depc # exception address
1240 1240
1241 /* Restore fixup handler. */ 1241 /* Restore fixup handler. */
1242 1242
1243 xsr a3, EXCSAVE_1 1243 xsr a3, excsave1
1244 movi a2, fast_syscall_spill_registers_fixup 1244 movi a2, fast_syscall_spill_registers_fixup
1245 s32i a2, a3, EXC_TABLE_FIXUP 1245 s32i a2, a3, EXC_TABLE_FIXUP
1246 rsr a2, WINDOWBASE 1246 rsr a2, windowbase
1247 s32i a2, a3, EXC_TABLE_PARAM 1247 s32i a2, a3, EXC_TABLE_PARAM
1248 l32i a2, a3, EXC_TABLE_KSTK 1248 l32i a2, a3, EXC_TABLE_KSTK
1249 1249
1250 /* Load WB at the time the exception occurred. */ 1250 /* Load WB at the time the exception occurred. */
1251 1251
1252 rsr a3, SAR # WB is still in SAR 1252 rsr a3, sar # WB is still in SAR
1253 neg a3, a3 1253 neg a3, a3
1254 wsr a3, WINDOWBASE 1254 wsr a3, windowbase
1255 rsync 1255 rsync
1256 1256
1257 /* Restore a3 and return. */ 1257 /* Restore a3 and return. */
1258 1258
1259 movi a3, exc_table 1259 movi a3, exc_table
1260 xsr a3, EXCSAVE_1 1260 xsr a3, excsave1
1261 1261
1262 rfde 1262 rfde
1263 1263
@@ -1283,8 +1283,8 @@ ENTRY(_spill_registers)
1283 * Rotate ws right so that a4 = yyxxxwww1. 1283 * Rotate ws right so that a4 = yyxxxwww1.
1284 */ 1284 */
1285 1285
1286 rsr a4, WINDOWBASE 1286 rsr a4, windowbase
1287 rsr a3, WINDOWSTART # a3 = xxxwww1yy 1287 rsr a3, windowstart # a3 = xxxwww1yy
1288 ssr a4 # holds WB 1288 ssr a4 # holds WB
1289 slli a4, a3, WSBITS 1289 slli a4, a3, WSBITS
1290 or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy 1290 or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy
@@ -1302,7 +1302,7 @@ ENTRY(_spill_registers)
1302 1302
1303 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ 1303 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */
1304 1304
1305 wsr a3, WINDOWSTART # save shifted windowstart 1305 wsr a3, windowstart # save shifted windowstart
1306 neg a4, a3 1306 neg a4, a3
1307 and a3, a4, a3 # first bit set from right: 000010000 1307 and a3, a4, a3 # first bit set from right: 000010000
1308 1308
@@ -1311,12 +1311,12 @@ ENTRY(_spill_registers)
1311 sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right 1311 sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right
1312 ssr a4 # save in SAR for later. 1312 ssr a4 # save in SAR for later.
1313 1313
1314 rsr a3, WINDOWBASE 1314 rsr a3, windowbase
1315 add a3, a3, a4 1315 add a3, a3, a4
1316 wsr a3, WINDOWBASE 1316 wsr a3, windowbase
1317 rsync 1317 rsync
1318 1318
1319 rsr a3, WINDOWSTART 1319 rsr a3, windowstart
1320 srl a3, a3 # shift windowstart 1320 srl a3, a3 # shift windowstart
1321 1321
1322 /* WB is now just one frame below the oldest frame in the register 1322 /* WB is now just one frame below the oldest frame in the register
@@ -1364,11 +1364,11 @@ ENTRY(_spill_registers)
1364.Lexit: /* Done. Do the final rotation, set WS, and return. */ 1364.Lexit: /* Done. Do the final rotation, set WS, and return. */
1365 1365
1366 rotw 1 1366 rotw 1
1367 rsr a3, WINDOWBASE 1367 rsr a3, windowbase
1368 ssl a3 1368 ssl a3
1369 movi a3, 1 1369 movi a3, 1
1370 sll a3, a3 1370 sll a3, a3
1371 wsr a3, WINDOWSTART 1371 wsr a3, windowstart
1372 ret 1372 ret
1373 1373
1374.Lc4: s32e a4, a9, -16 1374.Lc4: s32e a4, a9, -16
@@ -1429,7 +1429,7 @@ ENTRY(_spill_registers)
1429 * however, this condition is unrecoverable in kernel space. 1429 * however, this condition is unrecoverable in kernel space.
1430 */ 1430 */
1431 1431
1432 rsr a0, PS 1432 rsr a0, ps
1433 _bbci.l a0, PS_UM_BIT, 1f 1433 _bbci.l a0, PS_UM_BIT, 1f
1434 1434
1435 /* User space: Setup a dummy frame and kill application. 1435 /* User space: Setup a dummy frame and kill application.
@@ -1439,18 +1439,18 @@ ENTRY(_spill_registers)
1439 movi a0, 1 1439 movi a0, 1
1440 movi a1, 0 1440 movi a1, 0
1441 1441
1442 wsr a0, WINDOWSTART 1442 wsr a0, windowstart
1443 wsr a1, WINDOWBASE 1443 wsr a1, windowbase
1444 rsync 1444 rsync
1445 1445
1446 movi a0, 0 1446 movi a0, 0
1447 1447
1448 movi a3, exc_table 1448 movi a3, exc_table
1449 l32i a1, a3, EXC_TABLE_KSTK 1449 l32i a1, a3, EXC_TABLE_KSTK
1450 wsr a3, EXCSAVE_1 1450 wsr a3, excsave1
1451 1451
1452 movi a4, (1 << PS_WOE_BIT) | 1 1452 movi a4, (1 << PS_WOE_BIT) | 1
1453 wsr a4, PS 1453 wsr a4, ps
1454 rsync 1454 rsync
1455 1455
1456 movi a6, SIGSEGV 1456 movi a6, SIGSEGV
@@ -1459,7 +1459,7 @@ ENTRY(_spill_registers)
1459 1459
14601: /* Kernel space: PANIC! */ 14601: /* Kernel space: PANIC! */
1461 1461
1462 wsr a0, EXCSAVE_1 1462 wsr a0, excsave1
1463 movi a0, unrecoverable_exception 1463 movi a0, unrecoverable_exception
1464 callx0 a0 # should not return 1464 callx0 a0 # should not return
14651: j 1b 14651: j 1b
@@ -1524,7 +1524,7 @@ ENTRY(fast_second_level_miss)
1524 1524
1525 /* We deliberately destroy a3 that holds the exception table. */ 1525 /* We deliberately destroy a3 that holds the exception table. */
1526 1526
15278: rsr a3, EXCVADDR # fault address 15278: rsr a3, excvaddr # fault address
1528 _PGD_OFFSET(a0, a3, a1) 1528 _PGD_OFFSET(a0, a3, a1)
1529 l32i a0, a0, 0 # read pmdval 1529 l32i a0, a0, 0 # read pmdval
1530 beqz a0, 2f 1530 beqz a0, 2f
@@ -1542,7 +1542,7 @@ ENTRY(fast_second_level_miss)
1542 * pteval = ((pmdval - PAGE_OFFSET) & PAGE_MASK) | PAGE_DIRECTORY 1542 * pteval = ((pmdval - PAGE_OFFSET) & PAGE_MASK) | PAGE_DIRECTORY
1543 */ 1543 */
1544 1544
1545 movi a1, -PAGE_OFFSET 1545 movi a1, (-PAGE_OFFSET) & 0xffffffff
1546 add a0, a0, a1 # pmdval - PAGE_OFFSET 1546 add a0, a0, a1 # pmdval - PAGE_OFFSET
1547 extui a1, a0, 0, PAGE_SHIFT # ... & PAGE_MASK 1547 extui a1, a0, 0, PAGE_SHIFT # ... & PAGE_MASK
1548 xor a0, a0, a1 1548 xor a0, a0, a1
@@ -1561,7 +1561,7 @@ ENTRY(fast_second_level_miss)
1561 */ 1561 */
1562 1562
1563 extui a3, a3, 28, 2 # addr. bit 28 and 29 0,1,2,3 1563 extui a3, a3, 28, 2 # addr. bit 28 and 29 0,1,2,3
1564 rsr a1, PTEVADDR 1564 rsr a1, ptevaddr
1565 addx2 a3, a3, a3 # -> 0,3,6,9 1565 addx2 a3, a3, a3 # -> 0,3,6,9
1566 srli a1, a1, PAGE_SHIFT 1566 srli a1, a1, PAGE_SHIFT
1567 extui a3, a3, 2, 2 # -> 0,0,1,2 1567 extui a3, a3, 2, 2 # -> 0,0,1,2
@@ -1583,18 +1583,18 @@ ENTRY(fast_second_level_miss)
1583 l32i a0, a2, PT_AREG0 1583 l32i a0, a2, PT_AREG0
1584 l32i a1, a2, PT_AREG1 1584 l32i a1, a2, PT_AREG1
1585 l32i a2, a2, PT_DEPC 1585 l32i a2, a2, PT_DEPC
1586 xsr a3, EXCSAVE_1 1586 xsr a3, excsave1
1587 1587
1588 bgeui a2, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f 1588 bgeui a2, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f
1589 1589
1590 /* Restore excsave1 and return. */ 1590 /* Restore excsave1 and return. */
1591 1591
1592 rsr a2, DEPC 1592 rsr a2, depc
1593 rfe 1593 rfe
1594 1594
1595 /* Return from double exception. */ 1595 /* Return from double exception. */
1596 1596
15971: xsr a2, DEPC 15971: xsr a2, depc
1598 esync 1598 esync
1599 rfde 1599 rfde
1600 1600
@@ -1618,7 +1618,7 @@ ENTRY(fast_second_level_miss)
1618 /* Make sure the exception originated in the special functions */ 1618 /* Make sure the exception originated in the special functions */
1619 1619
1620 movi a0, __tlbtemp_mapping_start 1620 movi a0, __tlbtemp_mapping_start
1621 rsr a3, EPC_1 1621 rsr a3, epc1
1622 bltu a3, a0, 2f 1622 bltu a3, a0, 2f
1623 movi a0, __tlbtemp_mapping_end 1623 movi a0, __tlbtemp_mapping_end
1624 bgeu a3, a0, 2f 1624 bgeu a3, a0, 2f
@@ -1626,7 +1626,7 @@ ENTRY(fast_second_level_miss)
1626 /* Check if excvaddr was in one of the TLBTEMP_BASE areas. */ 1626 /* Check if excvaddr was in one of the TLBTEMP_BASE areas. */
1627 1627
1628 movi a3, TLBTEMP_BASE_1 1628 movi a3, TLBTEMP_BASE_1
1629 rsr a0, EXCVADDR 1629 rsr a0, excvaddr
1630 bltu a0, a3, 2f 1630 bltu a0, a3, 2f
1631 1631
1632 addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT)) 1632 addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT))
@@ -1635,7 +1635,7 @@ ENTRY(fast_second_level_miss)
1635 /* Check if we have to restore an ITLB mapping. */ 1635 /* Check if we have to restore an ITLB mapping. */
1636 1636
1637 movi a1, __tlbtemp_mapping_itlb 1637 movi a1, __tlbtemp_mapping_itlb
1638 rsr a3, EPC_1 1638 rsr a3, epc1
1639 sub a3, a3, a1 1639 sub a3, a3, a1
1640 1640
1641 /* Calculate VPN */ 1641 /* Calculate VPN */
@@ -1671,13 +1671,13 @@ ENTRY(fast_second_level_miss)
16712: /* Invalid PGD, default exception handling */ 16712: /* Invalid PGD, default exception handling */
1672 1672
1673 movi a3, exc_table 1673 movi a3, exc_table
1674 rsr a1, DEPC 1674 rsr a1, depc
1675 xsr a3, EXCSAVE_1 1675 xsr a3, excsave1
1676 s32i a1, a2, PT_AREG2 1676 s32i a1, a2, PT_AREG2
1677 s32i a3, a2, PT_AREG3 1677 s32i a3, a2, PT_AREG3
1678 mov a1, a2 1678 mov a1, a2
1679 1679
1680 rsr a2, PS 1680 rsr a2, ps
1681 bbsi.l a2, PS_UM_BIT, 1f 1681 bbsi.l a2, PS_UM_BIT, 1f
1682 j _kernel_exception 1682 j _kernel_exception
16831: j _user_exception 16831: j _user_exception
@@ -1712,7 +1712,7 @@ ENTRY(fast_store_prohibited)
1712 l32i a0, a1, TASK_MM # tsk->mm 1712 l32i a0, a1, TASK_MM # tsk->mm
1713 beqz a0, 9f 1713 beqz a0, 9f
1714 1714
17158: rsr a1, EXCVADDR # fault address 17158: rsr a1, excvaddr # fault address
1716 _PGD_OFFSET(a0, a1, a4) 1716 _PGD_OFFSET(a0, a1, a4)
1717 l32i a0, a0, 0 1717 l32i a0, a0, 0
1718 beqz a0, 2f 1718 beqz a0, 2f
@@ -1725,7 +1725,7 @@ ENTRY(fast_store_prohibited)
1725 1725
1726 movi a1, _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HW_WRITE 1726 movi a1, _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HW_WRITE
1727 or a4, a4, a1 1727 or a4, a4, a1
1728 rsr a1, EXCVADDR 1728 rsr a1, excvaddr
1729 s32i a4, a0, 0 1729 s32i a4, a0, 0
1730 1730
1731 /* We need to flush the cache if we have page coloring. */ 1731 /* We need to flush the cache if we have page coloring. */
@@ -1749,15 +1749,15 @@ ENTRY(fast_store_prohibited)
1749 1749
1750 /* Restore excsave1 and a3. */ 1750 /* Restore excsave1 and a3. */
1751 1751
1752 xsr a3, EXCSAVE_1 1752 xsr a3, excsave1
1753 bgeui a2, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f 1753 bgeui a2, VALID_DOUBLE_EXCEPTION_ADDRESS, 1f
1754 1754
1755 rsr a2, DEPC 1755 rsr a2, depc
1756 rfe 1756 rfe
1757 1757
1758 /* Double exception. Restore FIXUP handler and return. */ 1758 /* Double exception. Restore FIXUP handler and return. */
1759 1759
17601: xsr a2, DEPC 17601: xsr a2, depc
1761 esync 1761 esync
1762 rfde 1762 rfde
1763 1763
@@ -1766,14 +1766,14 @@ ENTRY(fast_store_prohibited)
1766 1766
17672: /* If there was a problem, handle fault in C */ 17672: /* If there was a problem, handle fault in C */
1768 1768
1769 rsr a4, DEPC # still holds a2 1769 rsr a4, depc # still holds a2
1770 xsr a3, EXCSAVE_1 1770 xsr a3, excsave1
1771 s32i a4, a2, PT_AREG2 1771 s32i a4, a2, PT_AREG2
1772 s32i a3, a2, PT_AREG3 1772 s32i a3, a2, PT_AREG3
1773 l32i a4, a2, PT_AREG4 1773 l32i a4, a2, PT_AREG4
1774 mov a1, a2 1774 mov a1, a2
1775 1775
1776 rsr a2, PS 1776 rsr a2, ps
1777 bbsi.l a2, PS_UM_BIT, 1f 1777 bbsi.l a2, PS_UM_BIT, 1f
1778 j _kernel_exception 1778 j _kernel_exception
17791: j _user_exception 17791: j _user_exception
@@ -1901,8 +1901,8 @@ ENTRY(_switch_to)
1901 /* Disable ints while we manipulate the stack pointer. */ 1901 /* Disable ints while we manipulate the stack pointer. */
1902 1902
1903 movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL 1903 movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL
1904 xsr a14, PS 1904 xsr a14, ps
1905 rsr a3, EXCSAVE_1 1905 rsr a3, excsave1
1906 rsync 1906 rsync
1907 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ 1907 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */
1908 1908
@@ -1910,7 +1910,7 @@ ENTRY(_switch_to)
1910 1910
1911#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) 1911#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
1912 l32i a3, a5, THREAD_CPENABLE 1912 l32i a3, a5, THREAD_CPENABLE
1913 xsr a3, CPENABLE 1913 xsr a3, cpenable
1914 s32i a3, a4, THREAD_CPENABLE 1914 s32i a3, a4, THREAD_CPENABLE
1915#endif 1915#endif
1916 1916
@@ -1924,7 +1924,7 @@ ENTRY(_switch_to)
1924 * we return from kernel space. 1924 * we return from kernel space.
1925 */ 1925 */
1926 1926
1927 rsr a3, EXCSAVE_1 # exc_table 1927 rsr a3, excsave1 # exc_table
1928 movi a6, 0 1928 movi a6, 0
1929 addi a7, a5, PT_REGS_OFFSET 1929 addi a7, a5, PT_REGS_OFFSET
1930 s32i a6, a3, EXC_TABLE_FIXUP 1930 s32i a6, a3, EXC_TABLE_FIXUP
@@ -1937,7 +1937,7 @@ ENTRY(_switch_to)
1937 1937
1938 load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER 1938 load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
1939 1939
1940 wsr a14, PS 1940 wsr a14, ps
1941 mov a2, a12 # return 'prev' 1941 mov a2, a12 # return 'prev'
1942 rsync 1942 rsync
1943 1943
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 3ef91a73652d..bdc50788f35e 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -61,18 +61,18 @@ _startup:
61 /* Disable interrupts and exceptions. */ 61 /* Disable interrupts and exceptions. */
62 62
63 movi a0, LOCKLEVEL 63 movi a0, LOCKLEVEL
64 wsr a0, PS 64 wsr a0, ps
65 65
66 /* Preserve the pointer to the boot parameter list in EXCSAVE_1 */ 66 /* Preserve the pointer to the boot parameter list in EXCSAVE_1 */
67 67
68 wsr a2, EXCSAVE_1 68 wsr a2, excsave1
69 69
70 /* Start with a fresh windowbase and windowstart. */ 70 /* Start with a fresh windowbase and windowstart. */
71 71
72 movi a1, 1 72 movi a1, 1
73 movi a0, 0 73 movi a0, 0
74 wsr a1, WINDOWSTART 74 wsr a1, windowstart
75 wsr a0, WINDOWBASE 75 wsr a0, windowbase
76 rsync 76 rsync
77 77
78 /* Set a0 to 0 for the remaining initialization. */ 78 /* Set a0 to 0 for the remaining initialization. */
@@ -82,46 +82,46 @@ _startup:
82 /* Clear debugging registers. */ 82 /* Clear debugging registers. */
83 83
84#if XCHAL_HAVE_DEBUG 84#if XCHAL_HAVE_DEBUG
85 wsr a0, IBREAKENABLE 85 wsr a0, ibreakenable
86 wsr a0, ICOUNT 86 wsr a0, icount
87 movi a1, 15 87 movi a1, 15
88 wsr a0, ICOUNTLEVEL 88 wsr a0, icountlevel
89 89
90 .set _index, 0 90 .set _index, 0
91 .rept XCHAL_NUM_DBREAK - 1 91 .rept XCHAL_NUM_DBREAK - 1
92 wsr a0, DBREAKC + _index 92 wsr a0, SREG_DBREAKC + _index
93 .set _index, _index + 1 93 .set _index, _index + 1
94 .endr 94 .endr
95#endif 95#endif
96 96
97 /* Clear CCOUNT (not really necessary, but nice) */ 97 /* Clear CCOUNT (not really necessary, but nice) */
98 98
99 wsr a0, CCOUNT # not really necessary, but nice 99 wsr a0, ccount # not really necessary, but nice
100 100
101 /* Disable zero-loops. */ 101 /* Disable zero-loops. */
102 102
103#if XCHAL_HAVE_LOOPS 103#if XCHAL_HAVE_LOOPS
104 wsr a0, LCOUNT 104 wsr a0, lcount
105#endif 105#endif
106 106
107 /* Disable all timers. */ 107 /* Disable all timers. */
108 108
109 .set _index, 0 109 .set _index, 0
110 .rept XCHAL_NUM_TIMERS - 1 110 .rept XCHAL_NUM_TIMERS - 1
111 wsr a0, CCOMPARE + _index 111 wsr a0, SREG_CCOMPARE + _index
112 .set _index, _index + 1 112 .set _index, _index + 1
113 .endr 113 .endr
114 114
115 /* Interrupt initialization. */ 115 /* Interrupt initialization. */
116 116
117 movi a2, XCHAL_INTTYPE_MASK_SOFTWARE | XCHAL_INTTYPE_MASK_EXTERN_EDGE 117 movi a2, XCHAL_INTTYPE_MASK_SOFTWARE | XCHAL_INTTYPE_MASK_EXTERN_EDGE
118 wsr a0, INTENABLE 118 wsr a0, intenable
119 wsr a2, INTCLEAR 119 wsr a2, intclear
120 120
121 /* Disable coprocessors. */ 121 /* Disable coprocessors. */
122 122
123#if XCHAL_CP_NUM > 0 123#if XCHAL_CP_NUM > 0
124 wsr a0, CPENABLE 124 wsr a0, cpenable
125#endif 125#endif
126 126
127 /* Set PS.INTLEVEL=1, PS.WOE=0, kernel stack, PS.EXCM=0 127 /* Set PS.INTLEVEL=1, PS.WOE=0, kernel stack, PS.EXCM=0
@@ -132,7 +132,7 @@ _startup:
132 */ 132 */
133 133
134 movi a1, 1 134 movi a1, 1
135 wsr a1, PS 135 wsr a1, ps
136 rsync 136 rsync
137 137
138 /* Initialize the caches. 138 /* Initialize the caches.
@@ -206,18 +206,18 @@ _startup:
206 addi a1, a1, KERNEL_STACK_SIZE 206 addi a1, a1, KERNEL_STACK_SIZE
207 207
208 movi a2, 0x00040001 # WOE=1, INTLEVEL=1, UM=0 208 movi a2, 0x00040001 # WOE=1, INTLEVEL=1, UM=0
209 wsr a2, PS # (enable reg-windows; progmode stack) 209 wsr a2, ps # (enable reg-windows; progmode stack)
210 rsync 210 rsync
211 211
212 /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/ 212 /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/
213 213
214 movi a2, debug_exception 214 movi a2, debug_exception
215 wsr a2, EXCSAVE + XCHAL_DEBUGLEVEL 215 wsr a2, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
216 216
217 /* Set up EXCSAVE[1] to point to the exc_table. */ 217 /* Set up EXCSAVE[1] to point to the exc_table. */
218 218
219 movi a6, exc_table 219 movi a6, exc_table
220 xsr a6, EXCSAVE_1 220 xsr a6, excsave1
221 221
222 /* init_arch kick-starts the linux kernel */ 222 /* init_arch kick-starts the linux kernel */
223 223
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 98e77c3ef1c3..a6ce3e563739 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -72,13 +72,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
72static void xtensa_irq_mask(struct irq_data *d) 72static void xtensa_irq_mask(struct irq_data *d)
73{ 73{
74 cached_irq_mask &= ~(1 << d->irq); 74 cached_irq_mask &= ~(1 << d->irq);
75 set_sr (cached_irq_mask, INTENABLE); 75 set_sr (cached_irq_mask, intenable);
76} 76}
77 77
78static void xtensa_irq_unmask(struct irq_data *d) 78static void xtensa_irq_unmask(struct irq_data *d)
79{ 79{
80 cached_irq_mask |= 1 << d->irq; 80 cached_irq_mask |= 1 << d->irq;
81 set_sr (cached_irq_mask, INTENABLE); 81 set_sr (cached_irq_mask, intenable);
82} 82}
83 83
84static void xtensa_irq_enable(struct irq_data *d) 84static void xtensa_irq_enable(struct irq_data *d)
@@ -95,7 +95,7 @@ static void xtensa_irq_disable(struct irq_data *d)
95 95
96static void xtensa_irq_ack(struct irq_data *d) 96static void xtensa_irq_ack(struct irq_data *d)
97{ 97{
98 set_sr(1 << d->irq, INTCLEAR); 98 set_sr(1 << d->irq, intclear);
99} 99}
100 100
101static int xtensa_irq_retrigger(struct irq_data *d) 101static int xtensa_irq_retrigger(struct irq_data *d)
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index bc020825cce5..1908f6642d31 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -173,6 +173,16 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
173 * 173 *
174 * Note: This is a pristine frame, so we don't need any spill region on top of 174 * Note: This is a pristine frame, so we don't need any spill region on top of
175 * childregs. 175 * childregs.
176 *
177 * The fun part: if we're keeping the same VM (i.e. cloning a thread,
178 * not an entire process), we're normally given a new usp, and we CANNOT share
179 * any live address register windows. If we just copy those live frames over,
180 * the two threads (parent and child) will overflow the same frames onto the
181 * parent stack at different times, likely corrupting the parent stack (esp.
182 * if the parent returns from functions that called clone() and calls new
183 * ones, before the child overflows its now old copies of its parent windows).
184 * One solution is to spill windows to the parent stack, but that's fairly
185 * involved. Much simpler to just not copy those live frames across.
176 */ 186 */
177 187
178int copy_thread(unsigned long clone_flags, unsigned long usp, 188int copy_thread(unsigned long clone_flags, unsigned long usp,
@@ -180,10 +190,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
180 struct task_struct * p, struct pt_regs * regs) 190 struct task_struct * p, struct pt_regs * regs)
181{ 191{
182 struct pt_regs *childregs; 192 struct pt_regs *childregs;
183 struct thread_info *ti;
184 unsigned long tos; 193 unsigned long tos;
185 int user_mode = user_mode(regs); 194 int user_mode = user_mode(regs);
186 195
196#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
197 struct thread_info *ti;
198#endif
199
187 /* Set up new TSS. */ 200 /* Set up new TSS. */
188 tos = (unsigned long)task_stack_page(p) + THREAD_SIZE; 201 tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
189 if (user_mode) 202 if (user_mode)
@@ -191,13 +204,14 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
191 else 204 else
192 childregs = (struct pt_regs*)tos - 1; 205 childregs = (struct pt_regs*)tos - 1;
193 206
207 /* This does not copy all the regs. In a bout of brilliance or madness,
208 ARs beyond a0-a15 exist past the end of the struct. */
194 *childregs = *regs; 209 *childregs = *regs;
195 210
196 /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */ 211 /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */
197 *((int*)childregs - 3) = (unsigned long)childregs; 212 *((int*)childregs - 3) = (unsigned long)childregs;
198 *((int*)childregs - 4) = 0; 213 *((int*)childregs - 4) = 0;
199 214
200 childregs->areg[1] = tos;
201 childregs->areg[2] = 0; 215 childregs->areg[2] = 0;
202 p->set_child_tid = p->clear_child_tid = NULL; 216 p->set_child_tid = p->clear_child_tid = NULL;
203 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1); 217 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);
@@ -205,10 +219,14 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
205 219
206 if (user_mode(regs)) { 220 if (user_mode(regs)) {
207 221
208 int len = childregs->wmask & ~0xf;
209 childregs->areg[1] = usp; 222 childregs->areg[1] = usp;
210 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], 223 if (clone_flags & CLONE_VM) {
211 &regs->areg[XCHAL_NUM_AREGS - len/4], len); 224 childregs->wmask = 1; /* can't share live windows */
225 } else {
226 int len = childregs->wmask & ~0xf;
227 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
228 &regs->areg[XCHAL_NUM_AREGS - len/4], len);
229 }
212// FIXME: we need to set THREADPTR in thread_info... 230// FIXME: we need to set THREADPTR in thread_info...
213 if (clone_flags & CLONE_SETTLS) 231 if (clone_flags & CLONE_SETTLS)
214 childregs->areg[2] = childregs->areg[6]; 232 childregs->areg[2] = childregs->areg[6];
@@ -216,6 +234,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
216 } else { 234 } else {
217 /* In kernel space, we start a new thread with a new stack. */ 235 /* In kernel space, we start a new thread with a new stack. */
218 childregs->wmask = 1; 236 childregs->wmask = 1;
237 childregs->areg[1] = tos;
219 } 238 }
220 239
221#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) 240#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 270360d9806c..b237988ba6d7 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -100,7 +100,7 @@ typedef struct tagtable {
100} tagtable_t; 100} tagtable_t;
101 101
102#define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \ 102#define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \
103 __attribute__((unused, __section__(".taglist"))) = { tag, fn } 103 __attribute__((used, section(".taglist"))) = { tag, fn }
104 104
105/* parse current tag */ 105/* parse current tag */
106 106
@@ -120,7 +120,7 @@ static int __init parse_tag_mem(const bp_tag_t *tag)
120 } 120 }
121 sysmem.bank[sysmem.nr_banks].type = mi->type; 121 sysmem.bank[sysmem.nr_banks].type = mi->type;
122 sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(mi->start); 122 sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(mi->start);
123 sysmem.bank[sysmem.nr_banks].end = mi->end & PAGE_SIZE; 123 sysmem.bank[sysmem.nr_banks].end = mi->end & PAGE_MASK;
124 sysmem.nr_banks++; 124 sysmem.nr_banks++;
125 125
126 return 0; 126 return 0;
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
index 05b3f093d5d7..a5c01e74d5d5 100644
--- a/arch/xtensa/kernel/syscall.c
+++ b/arch/xtensa/kernel/syscall.c
@@ -34,7 +34,6 @@ syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
34 34
35#undef __SYSCALL 35#undef __SYSCALL
36#define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, 36#define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
37#undef _XTENSA_UNISTD_H
38#undef __KERNEL_SYSCALLS__ 37#undef __KERNEL_SYSCALLS__
39#include <asm/unistd.h> 38#include <asm/unistd.h>
40}; 39};
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index bc1e14cf9369..5caf2b64d43a 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -97,7 +97,7 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
97/* EXCCAUSE_INTEGER_DIVIDE_BY_ZERO unhandled */ 97/* EXCCAUSE_INTEGER_DIVIDE_BY_ZERO unhandled */
98/* EXCCAUSE_PRIVILEGED unhandled */ 98/* EXCCAUSE_PRIVILEGED unhandled */
99#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION 99#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
100#ifdef CONFIG_UNALIGNED_USER 100#ifdef CONFIG_XTENSA_UNALIGNED_USER
101{ EXCCAUSE_UNALIGNED, USER, fast_unaligned }, 101{ EXCCAUSE_UNALIGNED, USER, fast_unaligned },
102#else 102#else
103{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user }, 103{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user },
@@ -202,8 +202,8 @@ extern void do_IRQ(int, struct pt_regs *);
202 202
203void do_interrupt (struct pt_regs *regs) 203void do_interrupt (struct pt_regs *regs)
204{ 204{
205 unsigned long intread = get_sr (INTREAD); 205 unsigned long intread = get_sr (interrupt);
206 unsigned long intenable = get_sr (INTENABLE); 206 unsigned long intenable = get_sr (intenable);
207 int i, mask; 207 int i, mask;
208 208
209 /* Handle all interrupts (no priorities). 209 /* Handle all interrupts (no priorities).
@@ -213,7 +213,7 @@ void do_interrupt (struct pt_regs *regs)
213 213
214 for (i=0, mask = 1; i < XCHAL_NUM_INTERRUPTS; i++, mask <<= 1) { 214 for (i=0, mask = 1; i < XCHAL_NUM_INTERRUPTS; i++, mask <<= 1) {
215 if (mask & (intread & intenable)) { 215 if (mask & (intread & intenable)) {
216 set_sr (mask, INTCLEAR); 216 set_sr (mask, intclear);
217 do_IRQ (i,regs); 217 do_IRQ (i,regs);
218 } 218 }
219 } 219 }
@@ -244,7 +244,7 @@ do_illegal_instruction(struct pt_regs *regs)
244 */ 244 */
245 245
246#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION 246#if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION
247#ifndef CONFIG_UNALIGNED_USER 247#ifndef CONFIG_XTENSA_UNALIGNED_USER
248void 248void
249do_unaligned_user (struct pt_regs *regs) 249do_unaligned_user (struct pt_regs *regs)
250{ 250{
@@ -339,7 +339,7 @@ void __init trap_init(void)
339 /* Initialize EXCSAVE_1 to hold the address of the exception table. */ 339 /* Initialize EXCSAVE_1 to hold the address of the exception table. */
340 340
341 i = (unsigned long)exc_table; 341 i = (unsigned long)exc_table;
342 __asm__ __volatile__("wsr %0, "__stringify(EXCSAVE_1)"\n" : : "a" (i)); 342 __asm__ __volatile__("wsr %0, excsave1\n" : : "a" (i));
343} 343}
344 344
345/* 345/*
@@ -386,16 +386,16 @@ static inline void spill_registers(void)
386 unsigned int a0, ps; 386 unsigned int a0, ps;
387 387
388 __asm__ __volatile__ ( 388 __asm__ __volatile__ (
389 "movi a14," __stringify (PS_EXCM_BIT) " | 1\n\t" 389 "movi a14, " __stringify(PS_EXCM_BIT | 1) "\n\t"
390 "mov a12, a0\n\t" 390 "mov a12, a0\n\t"
391 "rsr a13," __stringify(SAR) "\n\t" 391 "rsr a13, sar\n\t"
392 "xsr a14," __stringify(PS) "\n\t" 392 "xsr a14, ps\n\t"
393 "movi a0, _spill_registers\n\t" 393 "movi a0, _spill_registers\n\t"
394 "rsync\n\t" 394 "rsync\n\t"
395 "callx0 a0\n\t" 395 "callx0 a0\n\t"
396 "mov a0, a12\n\t" 396 "mov a0, a12\n\t"
397 "wsr a13," __stringify(SAR) "\n\t" 397 "wsr a13, sar\n\t"
398 "wsr a14," __stringify(PS) "\n\t" 398 "wsr a14, ps\n\t"
399 :: "a" (&a0), "a" (&ps) 399 :: "a" (&a0), "a" (&ps)
400 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", "memory"); 400 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", "memory");
401} 401}
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index 70066e3582d0..4462c1e595c2 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -69,11 +69,11 @@
69 69
70ENTRY(_UserExceptionVector) 70ENTRY(_UserExceptionVector)
71 71
72 xsr a3, EXCSAVE_1 # save a3 and get dispatch table 72 xsr a3, excsave1 # save a3 and get dispatch table
73 wsr a2, DEPC # save a2 73 wsr a2, depc # save a2
74 l32i a2, a3, EXC_TABLE_KSTK # load kernel stack to a2 74 l32i a2, a3, EXC_TABLE_KSTK # load kernel stack to a2
75 s32i a0, a2, PT_AREG0 # save a0 to ESF 75 s32i a0, a2, PT_AREG0 # save a0 to ESF
76 rsr a0, EXCCAUSE # retrieve exception cause 76 rsr a0, exccause # retrieve exception cause
77 s32i a0, a2, PT_DEPC # mark it as a regular exception 77 s32i a0, a2, PT_DEPC # mark it as a regular exception
78 addx4 a0, a0, a3 # find entry in table 78 addx4 a0, a0, a3 # find entry in table
79 l32i a0, a0, EXC_TABLE_FAST_USER # load handler 79 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
@@ -93,11 +93,11 @@ ENTRY(_UserExceptionVector)
93 93
94ENTRY(_KernelExceptionVector) 94ENTRY(_KernelExceptionVector)
95 95
96 xsr a3, EXCSAVE_1 # save a3, and get dispatch table 96 xsr a3, excsave1 # save a3, and get dispatch table
97 wsr a2, DEPC # save a2 97 wsr a2, depc # save a2
98 addi a2, a1, -16-PT_SIZE # adjust stack pointer 98 addi a2, a1, -16-PT_SIZE # adjust stack pointer
99 s32i a0, a2, PT_AREG0 # save a0 to ESF 99 s32i a0, a2, PT_AREG0 # save a0 to ESF
100 rsr a0, EXCCAUSE # retrieve exception cause 100 rsr a0, exccause # retrieve exception cause
101 s32i a0, a2, PT_DEPC # mark it as a regular exception 101 s32i a0, a2, PT_DEPC # mark it as a regular exception
102 addx4 a0, a0, a3 # find entry in table 102 addx4 a0, a0, a3 # find entry in table
103 l32i a0, a0, EXC_TABLE_FAST_KERNEL # load handler address 103 l32i a0, a0, EXC_TABLE_FAST_KERNEL # load handler address
@@ -205,17 +205,17 @@ ENTRY(_DoubleExceptionVector)
205 205
206 /* Deliberately destroy excsave (don't assume it's value was valid). */ 206 /* Deliberately destroy excsave (don't assume it's value was valid). */
207 207
208 wsr a3, EXCSAVE_1 # save a3 208 wsr a3, excsave1 # save a3
209 209
210 /* Check for kernel double exception (usually fatal). */ 210 /* Check for kernel double exception (usually fatal). */
211 211
212 rsr a3, PS 212 rsr a3, ps
213 _bbci.l a3, PS_UM_BIT, .Lksp 213 _bbci.l a3, PS_UM_BIT, .Lksp
214 214
215 /* Check if we are currently handling a window exception. */ 215 /* Check if we are currently handling a window exception. */
216 /* Note: We don't need to indicate that we enter a critical section. */ 216 /* Note: We don't need to indicate that we enter a critical section. */
217 217
218 xsr a0, DEPC # get DEPC, save a0 218 xsr a0, depc # get DEPC, save a0
219 219
220 movi a3, XCHAL_WINDOW_VECTORS_VADDR 220 movi a3, XCHAL_WINDOW_VECTORS_VADDR
221 _bltu a0, a3, .Lfixup 221 _bltu a0, a3, .Lfixup
@@ -243,21 +243,21 @@ ENTRY(_DoubleExceptionVector)
243 * Note: We can trash the current window frame (a0...a3) and depc! 243 * Note: We can trash the current window frame (a0...a3) and depc!
244 */ 244 */
245 245
246 wsr a2, DEPC # save stack pointer temporarily 246 wsr a2, depc # save stack pointer temporarily
247 rsr a0, PS 247 rsr a0, ps
248 extui a0, a0, PS_OWB_SHIFT, 4 248 extui a0, a0, PS_OWB_SHIFT, 4
249 wsr a0, WINDOWBASE 249 wsr a0, windowbase
250 rsync 250 rsync
251 251
252 /* We are now in the previous window frame. Save registers again. */ 252 /* We are now in the previous window frame. Save registers again. */
253 253
254 xsr a2, DEPC # save a2 and get stack pointer 254 xsr a2, depc # save a2 and get stack pointer
255 s32i a0, a2, PT_AREG0 255 s32i a0, a2, PT_AREG0
256 256
257 wsr a3, EXCSAVE_1 # save a3 257 wsr a3, excsave1 # save a3
258 movi a3, exc_table 258 movi a3, exc_table
259 259
260 rsr a0, EXCCAUSE 260 rsr a0, exccause
261 s32i a0, a2, PT_DEPC # mark it as a regular exception 261 s32i a0, a2, PT_DEPC # mark it as a regular exception
262 addx4 a0, a0, a3 262 addx4 a0, a0, a3
263 l32i a0, a0, EXC_TABLE_FAST_USER 263 l32i a0, a0, EXC_TABLE_FAST_USER
@@ -290,14 +290,14 @@ ENTRY(_DoubleExceptionVector)
290 290
291 /* a0: depc, a1: a1, a2: kstk, a3: a2, depc: a0, excsave: a3 */ 291 /* a0: depc, a1: a1, a2: kstk, a3: a2, depc: a0, excsave: a3 */
292 292
293 xsr a3, DEPC 293 xsr a3, depc
294 s32i a0, a2, PT_DEPC 294 s32i a0, a2, PT_DEPC
295 s32i a3, a2, PT_AREG0 295 s32i a3, a2, PT_AREG0
296 296
297 /* a0: avail, a1: a1, a2: kstk, a3: avail, depc: a2, excsave: a3 */ 297 /* a0: avail, a1: a1, a2: kstk, a3: avail, depc: a2, excsave: a3 */
298 298
299 movi a3, exc_table 299 movi a3, exc_table
300 rsr a0, EXCCAUSE 300 rsr a0, exccause
301 addx4 a0, a0, a3 301 addx4 a0, a0, a3
302 l32i a0, a0, EXC_TABLE_FAST_USER 302 l32i a0, a0, EXC_TABLE_FAST_USER
303 jx a0 303 jx a0
@@ -312,7 +312,7 @@ ENTRY(_DoubleExceptionVector)
312 312
313.Lksp: /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */ 313.Lksp: /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */
314 314
315 rsr a3, EXCCAUSE 315 rsr a3, exccause
316 beqi a3, EXCCAUSE_ITLB_MISS, 1f 316 beqi a3, EXCCAUSE_ITLB_MISS, 1f
317 addi a3, a3, -EXCCAUSE_DTLB_MISS 317 addi a3, a3, -EXCCAUSE_DTLB_MISS
318 bnez a3, .Lunrecoverable 318 bnez a3, .Lunrecoverable
@@ -328,11 +328,11 @@ ENTRY(_DoubleExceptionVector)
328 328
329.Lunrecoverable_fixup: 329.Lunrecoverable_fixup:
330 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE 330 l32i a2, a3, EXC_TABLE_DOUBLE_SAVE
331 xsr a0, DEPC 331 xsr a0, depc
332 332
333.Lunrecoverable: 333.Lunrecoverable:
334 rsr a3, EXCSAVE_1 334 rsr a3, excsave1
335 wsr a0, EXCSAVE_1 335 wsr a0, excsave1
336 movi a0, unrecoverable_exception 336 movi a0, unrecoverable_exception
337 callx0 a0 337 callx0 a0
338 338
@@ -349,7 +349,7 @@ ENTRY(_DoubleExceptionVector)
349 .section .DebugInterruptVector.text, "ax" 349 .section .DebugInterruptVector.text, "ax"
350 350
351ENTRY(_DebugInterruptVector) 351ENTRY(_DebugInterruptVector)
352 xsr a0, EXCSAVE + XCHAL_DEBUGLEVEL 352 xsr a0, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
353 jx a0 353 jx a0
354 354
355 355
diff --git a/arch/xtensa/lib/memcopy.S b/arch/xtensa/lib/memcopy.S
index ea59dcd03866..c48b80acb5f0 100644
--- a/arch/xtensa/lib/memcopy.S
+++ b/arch/xtensa/lib/memcopy.S
@@ -6,7 +6,7 @@
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details. 7 * for more details.
8 * 8 *
9 * Copyright (C) 2002 - 2005 Tensilica Inc. 9 * Copyright (C) 2002 - 2012 Tensilica Inc.
10 */ 10 */
11 11
12#include <variant/core.h> 12#include <variant/core.h>
@@ -27,14 +27,11 @@
27#endif 27#endif
28 .endm 28 .endm
29 29
30
31/* 30/*
32 * void *memcpy(void *dst, const void *src, size_t len); 31 * void *memcpy(void *dst, const void *src, size_t len);
33 * void *memmove(void *dst, const void *src, size_t len);
34 * void *bcopy(const void *src, void *dst, size_t len);
35 * 32 *
36 * This function is intended to do the same thing as the standard 33 * This function is intended to do the same thing as the standard
37 * library function memcpy() (or bcopy()) for most cases. 34 * library function memcpy() for most cases.
38 * However, where the source and/or destination references 35 * However, where the source and/or destination references
39 * an instruction RAM or ROM or a data RAM or ROM, that 36 * an instruction RAM or ROM or a data RAM or ROM, that
40 * source and/or destination will always be accessed with 37 * source and/or destination will always be accessed with
@@ -45,9 +42,6 @@
45 * !!!!!!! Handling of IRAM/IROM has not yet 42 * !!!!!!! Handling of IRAM/IROM has not yet
46 * !!!!!!! been implemented. 43 * !!!!!!! been implemented.
47 * 44 *
48 * The bcopy version is provided here to avoid the overhead
49 * of an extra call, for callers that require this convention.
50 *
51 * The (general case) algorithm is as follows: 45 * The (general case) algorithm is as follows:
52 * If destination is unaligned, align it by conditionally 46 * If destination is unaligned, align it by conditionally
53 * copying 1 and 2 bytes. 47 * copying 1 and 2 bytes.
@@ -76,17 +70,6 @@
76 */ 70 */
77 71
78 .text 72 .text
79 .align 4
80 .global bcopy
81 .type bcopy,@function
82bcopy:
83 entry sp, 16 # minimal stack frame
84 # a2=src, a3=dst, a4=len
85 mov a5, a3 # copy dst so that a2 is return value
86 mov a3, a2
87 mov a2, a5
88 j .Lcommon # go to common code for memcpy+bcopy
89
90 73
91/* 74/*
92 * Byte by byte copy 75 * Byte by byte copy
@@ -107,7 +90,7 @@ bcopy:
107 s8i a6, a5, 0 90 s8i a6, a5, 0
108 addi a5, a5, 1 91 addi a5, a5, 1
109#if !XCHAL_HAVE_LOOPS 92#if !XCHAL_HAVE_LOOPS
110 blt a3, a7, .Lnextbyte 93 bne a3, a7, .Lnextbyte # continue loop if $a3:src != $a7:src_end
111#endif /* !XCHAL_HAVE_LOOPS */ 94#endif /* !XCHAL_HAVE_LOOPS */
112.Lbytecopydone: 95.Lbytecopydone:
113 retw 96 retw
@@ -144,9 +127,6 @@ bcopy:
144 .global memcpy 127 .global memcpy
145 .type memcpy,@function 128 .type memcpy,@function
146memcpy: 129memcpy:
147 .global memmove
148 .type memmove,@function
149memmove:
150 130
151 entry sp, 16 # minimal stack frame 131 entry sp, 16 # minimal stack frame
152 # a2/ dst, a3/ src, a4/ len 132 # a2/ dst, a3/ src, a4/ len
@@ -182,7 +162,7 @@ memmove:
182 s32i a7, a5, 12 162 s32i a7, a5, 12
183 addi a5, a5, 16 163 addi a5, a5, 16
184#if !XCHAL_HAVE_LOOPS 164#if !XCHAL_HAVE_LOOPS
185 blt a3, a8, .Loop1 165 bne a3, a8, .Loop1 # continue loop if a3:src != a8:src_end
186#endif /* !XCHAL_HAVE_LOOPS */ 166#endif /* !XCHAL_HAVE_LOOPS */
187.Loop1done: 167.Loop1done:
188 bbci.l a4, 3, .L2 168 bbci.l a4, 3, .L2
@@ -260,7 +240,7 @@ memmove:
260 s32i a9, a5, 12 240 s32i a9, a5, 12
261 addi a5, a5, 16 241 addi a5, a5, 16
262#if !XCHAL_HAVE_LOOPS 242#if !XCHAL_HAVE_LOOPS
263 blt a3, a10, .Loop2 243 bne a3, a10, .Loop2 # continue loop if a3:src != a10:src_end
264#endif /* !XCHAL_HAVE_LOOPS */ 244#endif /* !XCHAL_HAVE_LOOPS */
265.Loop2done: 245.Loop2done:
266 bbci.l a4, 3, .L12 246 bbci.l a4, 3, .L12
@@ -305,6 +285,285 @@ memmove:
305 l8ui a6, a3, 0 285 l8ui a6, a3, 0
306 s8i a6, a5, 0 286 s8i a6, a5, 0
307 retw 287 retw
288
289
290/*
291 * void bcopy(const void *src, void *dest, size_t n);
292 */
293 .align 4
294 .global bcopy
295 .type bcopy,@function
296bcopy:
297 entry sp, 16 # minimal stack frame
298 # a2=src, a3=dst, a4=len
299 mov a5, a3
300 mov a3, a2
301 mov a2, a5
302 j .Lmovecommon # go to common code for memmove+bcopy
303
304/*
305 * void *memmove(void *dst, const void *src, size_t len);
306 *
307 * This function is intended to do the same thing as the standard
308 * library function memmove() for most cases.
309 * However, where the source and/or destination references
310 * an instruction RAM or ROM or a data RAM or ROM, that
311 * source and/or destination will always be accessed with
312 * 32-bit load and store instructions (as required for these
313 * types of devices).
314 *
315 * !!!!!!! XTFIXME:
316 * !!!!!!! Handling of IRAM/IROM has not yet
317 * !!!!!!! been implemented.
318 *
319 * The (general case) algorithm is as follows:
320 * If end of source doesn't overlap destination then use memcpy.
321 * Otherwise do memcpy backwards.
322 *
323 * Register use:
324 * a0/ return address
325 * a1/ stack pointer
326 * a2/ return value
327 * a3/ src
328 * a4/ length
329 * a5/ dst
330 * a6/ tmp
331 * a7/ tmp
332 * a8/ tmp
333 * a9/ tmp
334 * a10/ tmp
335 * a11/ tmp
336 */
337
338/*
339 * Byte by byte copy
340 */
341 .align 4
342 .byte 0 # 1 mod 4 alignment for LOOPNEZ
343 # (0 mod 4 alignment for LBEG)
344.Lbackbytecopy:
345#if XCHAL_HAVE_LOOPS
346 loopnez a4, .Lbackbytecopydone
347#else /* !XCHAL_HAVE_LOOPS */
348 beqz a4, .Lbackbytecopydone
349 sub a7, a3, a4 # a7 = start address for source
350#endif /* !XCHAL_HAVE_LOOPS */
351.Lbacknextbyte:
352 addi a3, a3, -1
353 l8ui a6, a3, 0
354 addi a5, a5, -1
355 s8i a6, a5, 0
356#if !XCHAL_HAVE_LOOPS
357 bne a3, a7, .Lbacknextbyte # continue loop if
358 # $a3:src != $a7:src_start
359#endif /* !XCHAL_HAVE_LOOPS */
360.Lbackbytecopydone:
361 retw
362
363/*
364 * Destination is unaligned
365 */
366
367 .align 4
368.Lbackdst1mod2: # dst is only byte aligned
369 _bltui a4, 7, .Lbackbytecopy # do short copies byte by byte
370
371 # copy 1 byte
372 addi a3, a3, -1
373 l8ui a6, a3, 0
374 addi a5, a5, -1
375 s8i a6, a5, 0
376 addi a4, a4, -1
377 _bbci.l a5, 1, .Lbackdstaligned # if dst is now aligned, then
378 # return to main algorithm
379.Lbackdst2mod4: # dst 16-bit aligned
380 # copy 2 bytes
381 _bltui a4, 6, .Lbackbytecopy # do short copies byte by byte
382 addi a3, a3, -2
383 l8ui a6, a3, 0
384 l8ui a7, a3, 1
385 addi a5, a5, -2
386 s8i a6, a5, 0
387 s8i a7, a5, 1
388 addi a4, a4, -2
389 j .Lbackdstaligned # dst is now aligned,
390 # return to main algorithm
391
392 .align 4
393 .global memmove
394 .type memmove,@function
395memmove:
396
397 entry sp, 16 # minimal stack frame
398 # a2/ dst, a3/ src, a4/ len
399 mov a5, a2 # copy dst so that a2 is return value
400.Lmovecommon:
401 sub a6, a5, a3
402 bgeu a6, a4, .Lcommon
403
404 add a5, a5, a4
405 add a3, a3, a4
406
407 _bbsi.l a5, 0, .Lbackdst1mod2 # if dst is 1 mod 2
408 _bbsi.l a5, 1, .Lbackdst2mod4 # if dst is 2 mod 4
409.Lbackdstaligned: # return here from .Lbackdst?mod? once dst is aligned
410 srli a7, a4, 4 # number of loop iterations with 16B
411 # per iteration
412 movi a8, 3 # if source is not aligned,
413 _bany a3, a8, .Lbacksrcunaligned # then use shifting copy
414 /*
415 * Destination and source are word-aligned, use word copy.
416 */
417 # copy 16 bytes per iteration for word-aligned dst and word-aligned src
418#if XCHAL_HAVE_LOOPS
419 loopnez a7, .backLoop1done
420#else /* !XCHAL_HAVE_LOOPS */
421 beqz a7, .backLoop1done
422 slli a8, a7, 4
423 sub a8, a3, a8 # a8 = start of first 16B source chunk
424#endif /* !XCHAL_HAVE_LOOPS */
425.backLoop1:
426 addi a3, a3, -16
427 l32i a7, a3, 12
428 l32i a6, a3, 8
429 addi a5, a5, -16
430 s32i a7, a5, 12
431 l32i a7, a3, 4
432 s32i a6, a5, 8
433 l32i a6, a3, 0
434 s32i a7, a5, 4
435 s32i a6, a5, 0
436#if !XCHAL_HAVE_LOOPS
437 bne a3, a8, .backLoop1 # continue loop if a3:src != a8:src_start
438#endif /* !XCHAL_HAVE_LOOPS */
439.backLoop1done:
440 bbci.l a4, 3, .Lback2
441 # copy 8 bytes
442 addi a3, a3, -8
443 l32i a6, a3, 0
444 l32i a7, a3, 4
445 addi a5, a5, -8
446 s32i a6, a5, 0
447 s32i a7, a5, 4
448.Lback2:
449 bbsi.l a4, 2, .Lback3
450 bbsi.l a4, 1, .Lback4
451 bbsi.l a4, 0, .Lback5
452 retw
453.Lback3:
454 # copy 4 bytes
455 addi a3, a3, -4
456 l32i a6, a3, 0
457 addi a5, a5, -4
458 s32i a6, a5, 0
459 bbsi.l a4, 1, .Lback4
460 bbsi.l a4, 0, .Lback5
461 retw
462.Lback4:
463 # copy 2 bytes
464 addi a3, a3, -2
465 l16ui a6, a3, 0
466 addi a5, a5, -2
467 s16i a6, a5, 0
468 bbsi.l a4, 0, .Lback5
469 retw
470.Lback5:
471 # copy 1 byte
472 addi a3, a3, -1
473 l8ui a6, a3, 0
474 addi a5, a5, -1
475 s8i a6, a5, 0
476 retw
477
478/*
479 * Destination is aligned, Source is unaligned
480 */
481
482 .align 4
483.Lbacksrcunaligned:
484 _beqz a4, .Lbackdone # avoid loading anything for zero-length copies
485 # copy 16 bytes per iteration for word-aligned dst and unaligned src
486 ssa8 a3 # set shift amount from byte offset
487#define SIM_CHECKS_ALIGNMENT 1 /* set to 1 when running on ISS with
488 * the lint or ferret client, or 0
489 * to save a few cycles */
490#if XCHAL_UNALIGNED_LOAD_EXCEPTION || SIM_CHECKS_ALIGNMENT
491 and a11, a3, a8 # save unalignment offset for below
492 sub a3, a3, a11 # align a3
493#endif
494 l32i a6, a3, 0 # load first word
495#if XCHAL_HAVE_LOOPS
496 loopnez a7, .backLoop2done
497#else /* !XCHAL_HAVE_LOOPS */
498 beqz a7, .backLoop2done
499 slli a10, a7, 4
500 sub a10, a3, a10 # a10 = start of first 16B source chunk
501#endif /* !XCHAL_HAVE_LOOPS */
502.backLoop2:
503 addi a3, a3, -16
504 l32i a7, a3, 12
505 l32i a8, a3, 8
506 addi a5, a5, -16
507 src_b a6, a7, a6
508 s32i a6, a5, 12
509 l32i a9, a3, 4
510 src_b a7, a8, a7
511 s32i a7, a5, 8
512 l32i a6, a3, 0
513 src_b a8, a9, a8
514 s32i a8, a5, 4
515 src_b a9, a6, a9
516 s32i a9, a5, 0
517#if !XCHAL_HAVE_LOOPS
518 bne a3, a10, .backLoop2 # continue loop if a3:src != a10:src_start
519#endif /* !XCHAL_HAVE_LOOPS */
520.backLoop2done:
521 bbci.l a4, 3, .Lback12
522 # copy 8 bytes
523 addi a3, a3, -8
524 l32i a7, a3, 4
525 l32i a8, a3, 0
526 addi a5, a5, -8
527 src_b a6, a7, a6
528 s32i a6, a5, 4
529 src_b a7, a8, a7
530 s32i a7, a5, 0
531 mov a6, a8
532.Lback12:
533 bbci.l a4, 2, .Lback13
534 # copy 4 bytes
535 addi a3, a3, -4
536 l32i a7, a3, 0
537 addi a5, a5, -4
538 src_b a6, a7, a6
539 s32i a6, a5, 0
540 mov a6, a7
541.Lback13:
542#if XCHAL_UNALIGNED_LOAD_EXCEPTION || SIM_CHECKS_ALIGNMENT
543 add a3, a3, a11 # readjust a3 with correct misalignment
544#endif
545 bbsi.l a4, 1, .Lback14
546 bbsi.l a4, 0, .Lback15
547.Lbackdone:
548 retw
549.Lback14:
550 # copy 2 bytes
551 addi a3, a3, -2
552 l8ui a6, a3, 0
553 l8ui a7, a3, 1
554 addi a5, a5, -2
555 s8i a6, a5, 0
556 s8i a7, a5, 1
557 bbsi.l a4, 0, .Lback15
558 retw
559.Lback15:
560 # copy 1 byte
561 addi a3, a3, -1
562 addi a5, a5, -1
563 l8ui a6, a3, 0
564 s8i a6, a5, 0
565 retw
566
308 567
309/* 568/*
310 * Local Variables: 569 * Local Variables:
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 2c2f710ed1dc..245b08f7eaf4 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -6,7 +6,7 @@
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details. 7 * for more details.
8 * 8 *
9 * Copyright (C) 2001 - 2005 Tensilica Inc. 9 * Copyright (C) 2001 - 2010 Tensilica Inc.
10 * 10 *
11 * Chris Zankel <chris@zankel.net> 11 * Chris Zankel <chris@zankel.net>
12 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> 12 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
@@ -186,6 +186,7 @@ do_sigbus:
186 /* Kernel mode? Handle exceptions or die */ 186 /* Kernel mode? Handle exceptions or die */
187 if (!user_mode(regs)) 187 if (!user_mode(regs))
188 bad_page_fault(regs, address, SIGBUS); 188 bad_page_fault(regs, address, SIGBUS);
189 return;
189 190
190vmalloc_fault: 191vmalloc_fault:
191 { 192 {
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 8ab47edd7c82..7e74895eee04 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -91,7 +91,7 @@ static int rs_write(struct tty_struct * tty,
91{ 91{
92 /* see drivers/char/serialX.c to reference original version */ 92 /* see drivers/char/serialX.c to reference original version */
93 93
94 __simc (SYS_write, 1, (unsigned long)buf, count, 0, 0); 94 simc_write(1, buf, count);
95 return count; 95 return count;
96} 96}
97 97
@@ -122,12 +122,7 @@ static void rs_poll(unsigned long priv)
122 122
123static int rs_put_char(struct tty_struct *tty, unsigned char ch) 123static int rs_put_char(struct tty_struct *tty, unsigned char ch)
124{ 124{
125 char buf[2]; 125 return rs_write(tty, &ch, 1);
126
127 buf[0] = ch;
128 buf[1] = '\0'; /* Is this NULL necessary? */
129 __simc (SYS_write, 1, (unsigned long) buf, 1, 0, 0);
130 return 1;
131} 126}
132 127
133static void rs_flush_chars(struct tty_struct *tty) 128static void rs_flush_chars(struct tty_struct *tty)
diff --git a/arch/xtensa/platforms/iss/include/platform/simcall.h b/arch/xtensa/platforms/iss/include/platform/simcall.h
index 8c43bfea05e1..bd78192e2fc9 100644
--- a/arch/xtensa/platforms/iss/include/platform/simcall.h
+++ b/arch/xtensa/platforms/iss/include/platform/simcall.h
@@ -78,8 +78,9 @@ static inline int __simc(int a, int b, int c, int d, int e, int f)
78 return ret; 78 return ret;
79} 79}
80 80
81static inline int simc_open(char *file, int flags, int mode) 81static inline int simc_open(const char *file, int flags, int mode)
82{ 82{
83 wmb();
83 return __simc(SYS_open, (int) file, flags, mode, 0, 0); 84 return __simc(SYS_open, (int) file, flags, mode, 0, 0);
84} 85}
85 86
@@ -90,16 +91,19 @@ static inline int simc_close(int fd)
90 91
91static inline int simc_ioctl(int fd, int request, void *arg) 92static inline int simc_ioctl(int fd, int request, void *arg)
92{ 93{
94 wmb();
93 return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0); 95 return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
94} 96}
95 97
96static inline int simc_read(int fd, void *buf, size_t count) 98static inline int simc_read(int fd, void *buf, size_t count)
97{ 99{
100 rmb();
98 return __simc(SYS_read, fd, (int) buf, count, 0, 0); 101 return __simc(SYS_read, fd, (int) buf, count, 0, 0);
99} 102}
100 103
101static inline int simc_write(int fd, void *buf, size_t count) 104static inline int simc_write(int fd, const void *buf, size_t count)
102{ 105{
106 wmb();
103 return __simc(SYS_write, fd, (int) buf, count, 0, 0); 107 return __simc(SYS_write, fd, (int) buf, count, 0, 0);
104} 108}
105 109
@@ -107,6 +111,7 @@ static inline int simc_poll(int fd)
107{ 111{
108 struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; 112 struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
109 113
114 wmb();
110 return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv, 115 return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,
111 0, 0); 116 0, 0);
112} 117}
diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index 927acf378ea3..e1700102f35e 100644
--- a/arch/xtensa/platforms/iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
@@ -61,13 +61,13 @@ void platform_restart(void)
61 * jump to the reset vector. */ 61 * jump to the reset vector. */
62 62
63 __asm__ __volatile__("movi a2, 15\n\t" 63 __asm__ __volatile__("movi a2, 15\n\t"
64 "wsr a2, " __stringify(ICOUNTLEVEL) "\n\t" 64 "wsr a2, icountlevel\n\t"
65 "movi a2, 0\n\t" 65 "movi a2, 0\n\t"
66 "wsr a2, " __stringify(ICOUNT) "\n\t" 66 "wsr a2, icount\n\t"
67 "wsr a2, " __stringify(IBREAKENABLE) "\n\t" 67 "wsr a2, ibreakenable\n\t"
68 "wsr a2, " __stringify(LCOUNT) "\n\t" 68 "wsr a2, lcount\n\t"
69 "movi a2, 0x1f\n\t" 69 "movi a2, 0x1f\n\t"
70 "wsr a2, " __stringify(PS) "\n\t" 70 "wsr a2, ps\n\t"
71 "isync\n\t" 71 "isync\n\t"
72 "jx %0\n\t" 72 "jx %0\n\t"
73 : 73 :
diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
index 9e83940ac265..c7d90f17886e 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -66,13 +66,13 @@ void platform_restart(void)
66 * jump to the reset vector. */ 66 * jump to the reset vector. */
67 67
68 __asm__ __volatile__ ("movi a2, 15\n\t" 68 __asm__ __volatile__ ("movi a2, 15\n\t"
69 "wsr a2, " __stringify(ICOUNTLEVEL) "\n\t" 69 "wsr a2, icountlevel\n\t"
70 "movi a2, 0\n\t" 70 "movi a2, 0\n\t"
71 "wsr a2, " __stringify(ICOUNT) "\n\t" 71 "wsr a2, icount\n\t"
72 "wsr a2, " __stringify(IBREAKENABLE) "\n\t" 72 "wsr a2, ibreakenable\n\t"
73 "wsr a2, " __stringify(LCOUNT) "\n\t" 73 "wsr a2, lcount\n\t"
74 "movi a2, 0x1f\n\t" 74 "movi a2, 0x1f\n\t"
75 "wsr a2, " __stringify(PS) "\n\t" 75 "wsr a2, ps\n\t"
76 "isync\n\t" 76 "isync\n\t"
77 "jx %0\n\t" 77 "jx %0\n\t"
78 : 78 :
diff --git a/drivers/Makefile b/drivers/Makefile
index 03da5b663aef..a16a8d001ae0 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -17,6 +17,10 @@ obj-$(CONFIG_PARISC) += parisc/
17obj-$(CONFIG_RAPIDIO) += rapidio/ 17obj-$(CONFIG_RAPIDIO) += rapidio/
18obj-y += video/ 18obj-y += video/
19obj-y += idle/ 19obj-y += idle/
20
21# IPMI must come before ACPI in order to provide IPMI opregion support
22obj-$(CONFIG_IPMI_HANDLER) += char/ipmi/
23
20obj-$(CONFIG_ACPI) += acpi/ 24obj-$(CONFIG_ACPI) += acpi/
21obj-$(CONFIG_SFI) += sfi/ 25obj-$(CONFIG_SFI) += sfi/
22# PnP must come after ACPI since it will eventually need to check if acpi 26# PnP must come after ACPI since it will eventually need to check if acpi
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 47199e2a9130..82422fe90f81 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -47,6 +47,10 @@ acpi-y += video_detect.o
47endif 47endif
48 48
49# These are (potentially) separate modules 49# These are (potentially) separate modules
50
51# IPMI may be used by other drivers, so it has to initialise before them
52obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o
53
50obj-$(CONFIG_ACPI_AC) += ac.o 54obj-$(CONFIG_ACPI_AC) += ac.o
51obj-$(CONFIG_ACPI_BUTTON) += button.o 55obj-$(CONFIG_ACPI_BUTTON) += button.o
52obj-$(CONFIG_ACPI_FAN) += fan.o 56obj-$(CONFIG_ACPI_FAN) += fan.o
@@ -70,6 +74,5 @@ processor-y += processor_idle.o processor_thermal.o
70processor-$(CONFIG_CPU_FREQ) += processor_perflib.o 74processor-$(CONFIG_CPU_FREQ) += processor_perflib.o
71 75
72obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o 76obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
73obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o
74 77
75obj-$(CONFIG_ACPI_APEI) += apei/ 78obj-$(CONFIG_ACPI_APEI) += apei/
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index c8abce3d2d9c..ed0fade46aed 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -270,15 +270,10 @@ static int hci_uart_send_frame(struct sk_buff *skb)
270 */ 270 */
271static int hci_uart_tty_open(struct tty_struct *tty) 271static int hci_uart_tty_open(struct tty_struct *tty)
272{ 272{
273 struct hci_uart *hu = (void *) tty->disc_data; 273 struct hci_uart *hu;
274 274
275 BT_DBG("tty %p", tty); 275 BT_DBG("tty %p", tty);
276 276
277 /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
278 the pointer */
279 if (hu)
280 return -EEXIST;
281
282 /* Error if the tty has no write op instead of leaving an exploitable 277 /* Error if the tty has no write op instead of leaving an exploitable
283 hole */ 278 hole */
284 if (tty->ops->write == NULL) 279 if (tty->ops->write == NULL)
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index d0b27a39f1d4..7ff1d0d208a7 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -52,7 +52,6 @@ obj-$(CONFIG_TELCLOCK) += tlclk.o
52obj-$(CONFIG_MWAVE) += mwave/ 52obj-$(CONFIG_MWAVE) += mwave/
53obj-$(CONFIG_AGP) += agp/ 53obj-$(CONFIG_AGP) += agp/
54obj-$(CONFIG_PCMCIA) += pcmcia/ 54obj-$(CONFIG_PCMCIA) += pcmcia/
55obj-$(CONFIG_IPMI_HANDLER) += ipmi/
56 55
57obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o 56obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
58obj-$(CONFIG_TCG_TPM) += tpm/ 57obj-$(CONFIG_TCG_TPM) += tpm/
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index e01f5eaaec82..38390f7c6ab6 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -667,7 +667,7 @@ static int intel_gtt_init(void)
667 gtt_map_size = intel_private.base.gtt_total_entries * 4; 667 gtt_map_size = intel_private.base.gtt_total_entries * 4;
668 668
669 intel_private.gtt = NULL; 669 intel_private.gtt = NULL;
670 if (INTEL_GTT_GEN < 6) 670 if (INTEL_GTT_GEN < 6 && INTEL_GTT_GEN > 2)
671 intel_private.gtt = ioremap_wc(intel_private.gtt_bus_addr, 671 intel_private.gtt = ioremap_wc(intel_private.gtt_bus_addr,
672 gtt_map_size); 672 gtt_map_size);
673 if (intel_private.gtt == NULL) 673 if (intel_private.gtt == NULL)
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 2c29942b1326..a0c84bb30856 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1880,7 +1880,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
1880 struct ipmi_recv_msg *supplied_recv, 1880 struct ipmi_recv_msg *supplied_recv,
1881 int priority) 1881 int priority)
1882{ 1882{
1883 unsigned char saddr, lun; 1883 unsigned char saddr = 0, lun = 0;
1884 int rv; 1884 int rv;
1885 1885
1886 if (!user) 1886 if (!user)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 83f85cf7fb1b..32a6c7e256bd 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2424,6 +2424,38 @@ static void ipmi_pci_cleanup(struct smi_info *info)
2424 pci_disable_device(pdev); 2424 pci_disable_device(pdev);
2425} 2425}
2426 2426
2427static int __devinit ipmi_pci_probe_regspacing(struct smi_info *info)
2428{
2429 if (info->si_type == SI_KCS) {
2430 unsigned char status;
2431 int regspacing;
2432
2433 info->io.regsize = DEFAULT_REGSIZE;
2434 info->io.regshift = 0;
2435 info->io_size = 2;
2436 info->handlers = &kcs_smi_handlers;
2437
2438 /* detect 1, 4, 16byte spacing */
2439 for (regspacing = DEFAULT_REGSPACING; regspacing <= 16;) {
2440 info->io.regspacing = regspacing;
2441 if (info->io_setup(info)) {
2442 dev_err(info->dev,
2443 "Could not setup I/O space\n");
2444 return DEFAULT_REGSPACING;
2445 }
2446 /* write invalid cmd */
2447 info->io.outputb(&info->io, 1, 0x10);
2448 /* read status back */
2449 status = info->io.inputb(&info->io, 1);
2450 info->io_cleanup(info);
2451 if (status)
2452 return regspacing;
2453 regspacing *= 4;
2454 }
2455 }
2456 return DEFAULT_REGSPACING;
2457}
2458
2427static int __devinit ipmi_pci_probe(struct pci_dev *pdev, 2459static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
2428 const struct pci_device_id *ent) 2460 const struct pci_device_id *ent)
2429{ 2461{
@@ -2476,8 +2508,8 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
2476 } 2508 }
2477 info->io.addr_data = pci_resource_start(pdev, 0); 2509 info->io.addr_data = pci_resource_start(pdev, 0);
2478 2510
2479 info->io.regspacing = DEFAULT_REGSPACING; 2511 info->io.regspacing = ipmi_pci_probe_regspacing(info);
2480 info->io.regsize = DEFAULT_REGSPACING; 2512 info->io.regsize = DEFAULT_REGSIZE;
2481 info->io.regshift = 0; 2513 info->io.regshift = 0;
2482 2514
2483 info->irq = pdev->irq; 2515 info->irq = pdev->irq;
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index c1cdc9236666..90723e65b081 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -237,7 +237,7 @@ static ssize_t memmap_attr_show(struct kobject *kobj,
237 * firmware_map_add() or firmware_map_add_early() afterwards, the entries 237 * firmware_map_add() or firmware_map_add_early() afterwards, the entries
238 * are not added to sysfs. 238 * are not added to sysfs.
239 */ 239 */
240static int __init memmap_init(void) 240static int __init firmware_memmap_init(void)
241{ 241{
242 struct firmware_map_entry *entry; 242 struct firmware_map_entry *entry;
243 243
@@ -246,5 +246,5 @@ static int __init memmap_init(void)
246 246
247 return 0; 247 return 0;
248} 248}
249late_initcall(memmap_init); 249late_initcall(firmware_memmap_init);
250 250
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 902af437eaf2..7a874129e5d8 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -381,11 +381,13 @@ static int mvebu_gpio_irq_set_type(struct irq_data *d, unsigned int type)
381 u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); 381 u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip));
382 u &= ~(1 << pin); 382 u &= ~(1 << pin);
383 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); 383 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip));
384 break;
384 case IRQ_TYPE_EDGE_FALLING: 385 case IRQ_TYPE_EDGE_FALLING:
385 case IRQ_TYPE_LEVEL_LOW: 386 case IRQ_TYPE_LEVEL_LOW:
386 u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); 387 u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip));
387 u |= 1 << pin; 388 u |= 1 << pin;
388 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); 389 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip));
390 break;
389 case IRQ_TYPE_EDGE_BOTH: { 391 case IRQ_TYPE_EDGE_BOTH: {
390 u32 v; 392 u32 v;
391 393
@@ -401,6 +403,7 @@ static int mvebu_gpio_irq_set_type(struct irq_data *d, unsigned int type)
401 else 403 else
402 u &= ~(1 << pin); /* rising */ 404 u &= ~(1 << pin); /* rising */
403 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); 405 writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip));
406 break;
404 } 407 }
405 } 408 }
406 return 0; 409 return 0;
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
index cdf8b1e7602d..441ebc1bdbef 100644
--- a/drivers/gpu/drm/drm_info.c
+++ b/drivers/gpu/drm/drm_info.c
@@ -239,7 +239,7 @@ int drm_vma_info(struct seq_file *m, void *data)
239 mutex_lock(&dev->struct_mutex); 239 mutex_lock(&dev->struct_mutex);
240 seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", 240 seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n",
241 atomic_read(&dev->vma_count), 241 atomic_read(&dev->vma_count),
242 high_memory, (void *)virt_to_phys(high_memory)); 242 high_memory, (void *)(unsigned long)virt_to_phys(high_memory));
243 243
244 list_for_each_entry(pt, &dev->vmalist, head) { 244 list_for_each_entry(pt, &dev->vmalist, head) {
245 vma = pt->vma; 245 vma = pt->vma;
diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c
index 38f3a6cb8c7d..3edd981e0770 100644
--- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
+++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
@@ -303,10 +303,10 @@ static bool ch7xxx_get_hw_state(struct intel_dvo_device *dvo)
303 303
304 ch7xxx_readb(dvo, CH7xxx_PM, &val); 304 ch7xxx_readb(dvo, CH7xxx_PM, &val);
305 305
306 if (val & CH7xxx_PM_FPD) 306 if (val & (CH7xxx_PM_DVIL | CH7xxx_PM_DVIP))
307 return false;
308 else
309 return true; 307 return true;
308 else
309 return false;
310} 310}
311 311
312static void ch7xxx_dump_regs(struct intel_dvo_device *dvo) 312static void ch7xxx_dump_regs(struct intel_dvo_device *dvo)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4f2831aa5fed..b84f7861e438 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1341,9 +1341,14 @@ int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
1341static inline struct page *i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) 1341static inline struct page *i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n)
1342{ 1342{
1343 struct scatterlist *sg = obj->pages->sgl; 1343 struct scatterlist *sg = obj->pages->sgl;
1344 while (n >= SG_MAX_SINGLE_ALLOC) { 1344 int nents = obj->pages->nents;
1345 while (nents > SG_MAX_SINGLE_ALLOC) {
1346 if (n < SG_MAX_SINGLE_ALLOC - 1)
1347 break;
1348
1345 sg = sg_chain_ptr(sg + SG_MAX_SINGLE_ALLOC - 1); 1349 sg = sg_chain_ptr(sg + SG_MAX_SINGLE_ALLOC - 1);
1346 n -= SG_MAX_SINGLE_ALLOC - 1; 1350 n -= SG_MAX_SINGLE_ALLOC - 1;
1351 nents -= SG_MAX_SINGLE_ALLOC - 1;
1347 } 1352 }
1348 return sg_page(sg+n); 1353 return sg_page(sg+n);
1349} 1354}
@@ -1427,7 +1432,7 @@ int __must_check i915_gpu_idle(struct drm_device *dev);
1427int __must_check i915_gem_idle(struct drm_device *dev); 1432int __must_check i915_gem_idle(struct drm_device *dev);
1428int i915_add_request(struct intel_ring_buffer *ring, 1433int i915_add_request(struct intel_ring_buffer *ring,
1429 struct drm_file *file, 1434 struct drm_file *file,
1430 struct drm_i915_gem_request *request); 1435 u32 *seqno);
1431int __must_check i915_wait_seqno(struct intel_ring_buffer *ring, 1436int __must_check i915_wait_seqno(struct intel_ring_buffer *ring,
1432 uint32_t seqno); 1437 uint32_t seqno);
1433int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); 1438int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 19dbdd7dd564..d33d02d13c96 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1955,11 +1955,12 @@ i915_gem_next_request_seqno(struct intel_ring_buffer *ring)
1955int 1955int
1956i915_add_request(struct intel_ring_buffer *ring, 1956i915_add_request(struct intel_ring_buffer *ring,
1957 struct drm_file *file, 1957 struct drm_file *file,
1958 struct drm_i915_gem_request *request) 1958 u32 *out_seqno)
1959{ 1959{
1960 drm_i915_private_t *dev_priv = ring->dev->dev_private; 1960 drm_i915_private_t *dev_priv = ring->dev->dev_private;
1961 uint32_t seqno; 1961 struct drm_i915_gem_request *request;
1962 u32 request_ring_position; 1962 u32 request_ring_position;
1963 u32 seqno;
1963 int was_empty; 1964 int was_empty;
1964 int ret; 1965 int ret;
1965 1966
@@ -1974,11 +1975,9 @@ i915_add_request(struct intel_ring_buffer *ring,
1974 if (ret) 1975 if (ret)
1975 return ret; 1976 return ret;
1976 1977
1977 if (request == NULL) { 1978 request = kmalloc(sizeof(*request), GFP_KERNEL);
1978 request = kmalloc(sizeof(*request), GFP_KERNEL); 1979 if (request == NULL)
1979 if (request == NULL) 1980 return -ENOMEM;
1980 return -ENOMEM;
1981 }
1982 1981
1983 seqno = i915_gem_next_request_seqno(ring); 1982 seqno = i915_gem_next_request_seqno(ring);
1984 1983
@@ -2030,6 +2029,8 @@ i915_add_request(struct intel_ring_buffer *ring,
2030 } 2029 }
2031 } 2030 }
2032 2031
2032 if (out_seqno)
2033 *out_seqno = seqno;
2033 return 0; 2034 return 0;
2034} 2035}
2035 2036
@@ -3959,6 +3960,9 @@ i915_gem_init_hw(struct drm_device *dev)
3959 if (!intel_enable_gtt()) 3960 if (!intel_enable_gtt())
3960 return -EIO; 3961 return -EIO;
3961 3962
3963 if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
3964 I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
3965
3962 i915_gem_l3_remap(dev); 3966 i915_gem_l3_remap(dev);
3963 3967
3964 i915_gem_init_swizzling(dev); 3968 i915_gem_init_swizzling(dev);
@@ -4098,7 +4102,6 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
4098 } 4102 }
4099 4103
4100 BUG_ON(!list_empty(&dev_priv->mm.active_list)); 4104 BUG_ON(!list_empty(&dev_priv->mm.active_list));
4101 BUG_ON(!list_empty(&dev_priv->mm.inactive_list));
4102 mutex_unlock(&dev->struct_mutex); 4105 mutex_unlock(&dev->struct_mutex);
4103 4106
4104 ret = drm_irq_install(dev); 4107 ret = drm_irq_install(dev);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 64c1be0a9cfd..a4162ddff6c5 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -521,7 +521,7 @@
521 */ 521 */
522# define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14) 522# define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14)
523#define _3D_CHICKEN3 0x02090 523#define _3D_CHICKEN3 0x02090
524#define _3D_CHICKEN_SF_DISABLE_FASTCLIP_CULL (1 << 5) 524#define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
525 525
526#define MI_MODE 0x0209c 526#define MI_MODE 0x0209c
527# define VS_TIMER_DISPATCH (1 << 6) 527# define VS_TIMER_DISPATCH (1 << 6)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2b6ce9b2674a..682bd3729baf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3253,6 +3253,16 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
3253 3253
3254 if (HAS_PCH_CPT(dev)) 3254 if (HAS_PCH_CPT(dev))
3255 intel_cpt_verify_modeset(dev, intel_crtc->pipe); 3255 intel_cpt_verify_modeset(dev, intel_crtc->pipe);
3256
3257 /*
3258 * There seems to be a race in PCH platform hw (at least on some
3259 * outputs) where an enabled pipe still completes any pageflip right
3260 * away (as if the pipe is off) instead of waiting for vblank. As soon
3261 * as the first vblank happend, everything works as expected. Hence just
3262 * wait for one vblank before returning to avoid strange things
3263 * happening.
3264 */
3265 intel_wait_for_vblank(dev, intel_crtc->pipe);
3256} 3266}
3257 3267
3258static void ironlake_crtc_disable(struct drm_crtc *crtc) 3268static void ironlake_crtc_disable(struct drm_crtc *crtc)
@@ -7892,8 +7902,7 @@ static struct intel_quirk intel_quirks[] = {
7892 /* ThinkPad T60 needs pipe A force quirk (bug #16494) */ 7902 /* ThinkPad T60 needs pipe A force quirk (bug #16494) */
7893 { 0x2782, 0x17aa, 0x201a, quirk_pipea_force }, 7903 { 0x2782, 0x17aa, 0x201a, quirk_pipea_force },
7894 7904
7895 /* 855 & before need to leave pipe A & dpll A up */ 7905 /* 830/845 need to leave pipe A & dpll A up */
7896 { 0x3582, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
7897 { 0x2562, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force }, 7906 { 0x2562, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
7898 { 0x3577, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force }, 7907 { 0x3577, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
7899 7908
@@ -8049,29 +8058,42 @@ static void intel_enable_pipe_a(struct drm_device *dev)
8049 8058
8050} 8059}
8051 8060
8061static bool
8062intel_check_plane_mapping(struct intel_crtc *crtc)
8063{
8064 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
8065 u32 reg, val;
8066
8067 if (dev_priv->num_pipe == 1)
8068 return true;
8069
8070 reg = DSPCNTR(!crtc->plane);
8071 val = I915_READ(reg);
8072
8073 if ((val & DISPLAY_PLANE_ENABLE) &&
8074 (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
8075 return false;
8076
8077 return true;
8078}
8079
8052static void intel_sanitize_crtc(struct intel_crtc *crtc) 8080static void intel_sanitize_crtc(struct intel_crtc *crtc)
8053{ 8081{
8054 struct drm_device *dev = crtc->base.dev; 8082 struct drm_device *dev = crtc->base.dev;
8055 struct drm_i915_private *dev_priv = dev->dev_private; 8083 struct drm_i915_private *dev_priv = dev->dev_private;
8056 u32 reg, val; 8084 u32 reg;
8057 8085
8058 /* Clear any frame start delays used for debugging left by the BIOS */ 8086 /* Clear any frame start delays used for debugging left by the BIOS */
8059 reg = PIPECONF(crtc->pipe); 8087 reg = PIPECONF(crtc->pipe);
8060 I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); 8088 I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
8061 8089
8062 /* We need to sanitize the plane -> pipe mapping first because this will 8090 /* We need to sanitize the plane -> pipe mapping first because this will
8063 * disable the crtc (and hence change the state) if it is wrong. */ 8091 * disable the crtc (and hence change the state) if it is wrong. Note
8064 if (!HAS_PCH_SPLIT(dev)) { 8092 * that gen4+ has a fixed plane -> pipe mapping. */
8093 if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) {
8065 struct intel_connector *connector; 8094 struct intel_connector *connector;
8066 bool plane; 8095 bool plane;
8067 8096
8068 reg = DSPCNTR(crtc->plane);
8069 val = I915_READ(reg);
8070
8071 if ((val & DISPLAY_PLANE_ENABLE) == 0 &&
8072 (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
8073 goto ok;
8074
8075 DRM_DEBUG_KMS("[CRTC:%d] wrong plane connection detected!\n", 8097 DRM_DEBUG_KMS("[CRTC:%d] wrong plane connection detected!\n",
8076 crtc->base.base.id); 8098 crtc->base.base.id);
8077 8099
@@ -8095,7 +8117,6 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
8095 WARN_ON(crtc->active); 8117 WARN_ON(crtc->active);
8096 crtc->base.enabled = false; 8118 crtc->base.enabled = false;
8097 } 8119 }
8098ok:
8099 8120
8100 if (dev_priv->quirks & QUIRK_PIPEA_FORCE && 8121 if (dev_priv->quirks & QUIRK_PIPEA_FORCE &&
8101 crtc->pipe == PIPE_A && !crtc->active) { 8122 crtc->pipe == PIPE_A && !crtc->active) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d1e8ddb2d6c0..1b727a5c9ee5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2369,8 +2369,9 @@ static void
2369intel_dp_destroy(struct drm_connector *connector) 2369intel_dp_destroy(struct drm_connector *connector)
2370{ 2370{
2371 struct drm_device *dev = connector->dev; 2371 struct drm_device *dev = connector->dev;
2372 struct intel_dp *intel_dp = intel_attached_dp(connector);
2372 2373
2373 if (intel_dpd_is_edp(dev)) 2374 if (is_edp(intel_dp))
2374 intel_panel_destroy_backlight(dev); 2375 intel_panel_destroy_backlight(dev);
2375 2376
2376 drm_sysfs_connector_remove(connector); 2377 drm_sysfs_connector_remove(connector);
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index ebff850a9ab6..495625914e4a 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -209,7 +209,6 @@ static void intel_overlay_unmap_regs(struct intel_overlay *overlay,
209} 209}
210 210
211static int intel_overlay_do_wait_request(struct intel_overlay *overlay, 211static int intel_overlay_do_wait_request(struct intel_overlay *overlay,
212 struct drm_i915_gem_request *request,
213 void (*tail)(struct intel_overlay *)) 212 void (*tail)(struct intel_overlay *))
214{ 213{
215 struct drm_device *dev = overlay->dev; 214 struct drm_device *dev = overlay->dev;
@@ -218,12 +217,10 @@ static int intel_overlay_do_wait_request(struct intel_overlay *overlay,
218 int ret; 217 int ret;
219 218
220 BUG_ON(overlay->last_flip_req); 219 BUG_ON(overlay->last_flip_req);
221 ret = i915_add_request(ring, NULL, request); 220 ret = i915_add_request(ring, NULL, &overlay->last_flip_req);
222 if (ret) { 221 if (ret)
223 kfree(request); 222 return ret;
224 return ret; 223
225 }
226 overlay->last_flip_req = request->seqno;
227 overlay->flip_tail = tail; 224 overlay->flip_tail = tail;
228 ret = i915_wait_seqno(ring, overlay->last_flip_req); 225 ret = i915_wait_seqno(ring, overlay->last_flip_req);
229 if (ret) 226 if (ret)
@@ -240,7 +237,6 @@ static int intel_overlay_on(struct intel_overlay *overlay)
240 struct drm_device *dev = overlay->dev; 237 struct drm_device *dev = overlay->dev;
241 struct drm_i915_private *dev_priv = dev->dev_private; 238 struct drm_i915_private *dev_priv = dev->dev_private;
242 struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; 239 struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
243 struct drm_i915_gem_request *request;
244 int ret; 240 int ret;
245 241
246 BUG_ON(overlay->active); 242 BUG_ON(overlay->active);
@@ -248,17 +244,9 @@ static int intel_overlay_on(struct intel_overlay *overlay)
248 244
249 WARN_ON(IS_I830(dev) && !(dev_priv->quirks & QUIRK_PIPEA_FORCE)); 245 WARN_ON(IS_I830(dev) && !(dev_priv->quirks & QUIRK_PIPEA_FORCE));
250 246
251 request = kzalloc(sizeof(*request), GFP_KERNEL);
252 if (request == NULL) {
253 ret = -ENOMEM;
254 goto out;
255 }
256
257 ret = intel_ring_begin(ring, 4); 247 ret = intel_ring_begin(ring, 4);
258 if (ret) { 248 if (ret)
259 kfree(request); 249 return ret;
260 goto out;
261 }
262 250
263 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_ON); 251 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_ON);
264 intel_ring_emit(ring, overlay->flip_addr | OFC_UPDATE); 252 intel_ring_emit(ring, overlay->flip_addr | OFC_UPDATE);
@@ -266,9 +254,7 @@ static int intel_overlay_on(struct intel_overlay *overlay)
266 intel_ring_emit(ring, MI_NOOP); 254 intel_ring_emit(ring, MI_NOOP);
267 intel_ring_advance(ring); 255 intel_ring_advance(ring);
268 256
269 ret = intel_overlay_do_wait_request(overlay, request, NULL); 257 return intel_overlay_do_wait_request(overlay, NULL);
270out:
271 return ret;
272} 258}
273 259
274/* overlay needs to be enabled in OCMD reg */ 260/* overlay needs to be enabled in OCMD reg */
@@ -278,17 +264,12 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
278 struct drm_device *dev = overlay->dev; 264 struct drm_device *dev = overlay->dev;
279 drm_i915_private_t *dev_priv = dev->dev_private; 265 drm_i915_private_t *dev_priv = dev->dev_private;
280 struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; 266 struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
281 struct drm_i915_gem_request *request;
282 u32 flip_addr = overlay->flip_addr; 267 u32 flip_addr = overlay->flip_addr;
283 u32 tmp; 268 u32 tmp;
284 int ret; 269 int ret;
285 270
286 BUG_ON(!overlay->active); 271 BUG_ON(!overlay->active);
287 272
288 request = kzalloc(sizeof(*request), GFP_KERNEL);
289 if (request == NULL)
290 return -ENOMEM;
291
292 if (load_polyphase_filter) 273 if (load_polyphase_filter)
293 flip_addr |= OFC_UPDATE; 274 flip_addr |= OFC_UPDATE;
294 275
@@ -298,22 +279,14 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
298 DRM_DEBUG("overlay underrun, DOVSTA: %x\n", tmp); 279 DRM_DEBUG("overlay underrun, DOVSTA: %x\n", tmp);
299 280
300 ret = intel_ring_begin(ring, 2); 281 ret = intel_ring_begin(ring, 2);
301 if (ret) { 282 if (ret)
302 kfree(request);
303 return ret; 283 return ret;
304 } 284
305 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE); 285 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE);
306 intel_ring_emit(ring, flip_addr); 286 intel_ring_emit(ring, flip_addr);
307 intel_ring_advance(ring); 287 intel_ring_advance(ring);
308 288
309 ret = i915_add_request(ring, NULL, request); 289 return i915_add_request(ring, NULL, &overlay->last_flip_req);
310 if (ret) {
311 kfree(request);
312 return ret;
313 }
314
315 overlay->last_flip_req = request->seqno;
316 return 0;
317} 290}
318 291
319static void intel_overlay_release_old_vid_tail(struct intel_overlay *overlay) 292static void intel_overlay_release_old_vid_tail(struct intel_overlay *overlay)
@@ -349,15 +322,10 @@ static int intel_overlay_off(struct intel_overlay *overlay)
349 struct drm_i915_private *dev_priv = dev->dev_private; 322 struct drm_i915_private *dev_priv = dev->dev_private;
350 struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; 323 struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
351 u32 flip_addr = overlay->flip_addr; 324 u32 flip_addr = overlay->flip_addr;
352 struct drm_i915_gem_request *request;
353 int ret; 325 int ret;
354 326
355 BUG_ON(!overlay->active); 327 BUG_ON(!overlay->active);
356 328
357 request = kzalloc(sizeof(*request), GFP_KERNEL);
358 if (request == NULL)
359 return -ENOMEM;
360
361 /* According to intel docs the overlay hw may hang (when switching 329 /* According to intel docs the overlay hw may hang (when switching
362 * off) without loading the filter coeffs. It is however unclear whether 330 * off) without loading the filter coeffs. It is however unclear whether
363 * this applies to the disabling of the overlay or to the switching off 331 * this applies to the disabling of the overlay or to the switching off
@@ -365,10 +333,9 @@ static int intel_overlay_off(struct intel_overlay *overlay)
365 flip_addr |= OFC_UPDATE; 333 flip_addr |= OFC_UPDATE;
366 334
367 ret = intel_ring_begin(ring, 6); 335 ret = intel_ring_begin(ring, 6);
368 if (ret) { 336 if (ret)
369 kfree(request);
370 return ret; 337 return ret;
371 } 338
372 /* wait for overlay to go idle */ 339 /* wait for overlay to go idle */
373 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE); 340 intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE);
374 intel_ring_emit(ring, flip_addr); 341 intel_ring_emit(ring, flip_addr);
@@ -379,8 +346,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
379 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); 346 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
380 intel_ring_advance(ring); 347 intel_ring_advance(ring);
381 348
382 return intel_overlay_do_wait_request(overlay, request, 349 return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail);
383 intel_overlay_off_tail);
384} 350}
385 351
386/* recover from an interruption due to a signal 352/* recover from an interruption due to a signal
@@ -425,24 +391,16 @@ static int intel_overlay_release_old_vid(struct intel_overlay *overlay)
425 return 0; 391 return 0;
426 392
427 if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) { 393 if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) {
428 struct drm_i915_gem_request *request;
429
430 /* synchronous slowpath */ 394 /* synchronous slowpath */
431 request = kzalloc(sizeof(*request), GFP_KERNEL);
432 if (request == NULL)
433 return -ENOMEM;
434
435 ret = intel_ring_begin(ring, 2); 395 ret = intel_ring_begin(ring, 2);
436 if (ret) { 396 if (ret)
437 kfree(request);
438 return ret; 397 return ret;
439 }
440 398
441 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); 399 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
442 intel_ring_emit(ring, MI_NOOP); 400 intel_ring_emit(ring, MI_NOOP);
443 intel_ring_advance(ring); 401 intel_ring_advance(ring);
444 402
445 ret = intel_overlay_do_wait_request(overlay, request, 403 ret = intel_overlay_do_wait_request(overlay,
446 intel_overlay_release_old_vid_tail); 404 intel_overlay_release_old_vid_tail);
447 if (ret) 405 if (ret)
448 return ret; 406 return ret;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index b3b4b6cea8b0..72f41aaa71ff 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3442,8 +3442,8 @@ static void gen6_init_clock_gating(struct drm_device *dev)
3442 GEN6_RCCUNIT_CLOCK_GATE_DISABLE); 3442 GEN6_RCCUNIT_CLOCK_GATE_DISABLE);
3443 3443
3444 /* Bspec says we need to always set all mask bits. */ 3444 /* Bspec says we need to always set all mask bits. */
3445 I915_WRITE(_3D_CHICKEN, (0xFFFF << 16) | 3445 I915_WRITE(_3D_CHICKEN3, (0xFFFF << 16) |
3446 _3D_CHICKEN_SF_DISABLE_FASTCLIP_CULL); 3446 _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL);
3447 3447
3448 /* 3448 /*
3449 * According to the spec the following bits should be 3449 * According to the spec the following bits should be
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
index 9ed6e728a94c..7d750382a833 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
@@ -43,7 +43,7 @@ dcb_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
43 *ver = nv_ro08(bios, dcb); 43 *ver = nv_ro08(bios, dcb);
44 44
45 if (*ver >= 0x41) { 45 if (*ver >= 0x41) {
46 nv_warn(bios, "DCB *ver 0x%02x unknown\n", *ver); 46 nv_warn(bios, "DCB version 0x%02x unknown\n", *ver);
47 return 0x0000; 47 return 0x0000;
48 } else 48 } else
49 if (*ver >= 0x30) { 49 if (*ver >= 0x30) {
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
index 436e9efe7ef5..42d7539e6525 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
@@ -277,7 +277,6 @@ nv50_fb_dtor(struct nouveau_object *object)
277 __free_page(priv->r100c08_page); 277 __free_page(priv->r100c08_page);
278 } 278 }
279 279
280 nouveau_mm_fini(&priv->base.vram);
281 nouveau_fb_destroy(&priv->base); 280 nouveau_fb_destroy(&priv->base);
282} 281}
283 282
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
index b29237970fa0..523178685180 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
@@ -134,7 +134,7 @@ nouveau_therm_fan_sense(struct nouveau_therm *therm)
134 end = ptimer->read(ptimer); 134 end = ptimer->read(ptimer);
135 135
136 if (cycles == 5) { 136 if (cycles == 5) {
137 tach = (u64)60000000000; 137 tach = (u64)60000000000ULL;
138 do_div(tach, (end - start)); 138 do_div(tach, (end - start));
139 return tach; 139 return tach;
140 } else 140 } else
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 259e5f1adf47..35ac57f0aab6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -456,6 +456,7 @@ static struct ttm_tt *
456nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, 456nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
457 uint32_t page_flags, struct page *dummy_read) 457 uint32_t page_flags, struct page *dummy_read)
458{ 458{
459#if __OS_HAS_AGP
459 struct nouveau_drm *drm = nouveau_bdev(bdev); 460 struct nouveau_drm *drm = nouveau_bdev(bdev);
460 struct drm_device *dev = drm->dev; 461 struct drm_device *dev = drm->dev;
461 462
@@ -463,6 +464,7 @@ nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
463 return ttm_agp_tt_create(bdev, dev->agp->bridge, size, 464 return ttm_agp_tt_create(bdev, dev->agp->bridge, size,
464 page_flags, dummy_read); 465 page_flags, dummy_read);
465 } 466 }
467#endif
466 468
467 return nouveau_sgdma_create_ttm(bdev, size, page_flags, dummy_read); 469 return nouveau_sgdma_create_ttm(bdev, size, page_flags, dummy_read);
468} 470}
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 0bf64c90aa20..5566172774df 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -52,7 +52,7 @@ nouveau_pm_perflvl_aux(struct drm_device *dev, struct nouveau_pm_level *perflvl,
52{ 52{
53 struct nouveau_drm *drm = nouveau_drm(dev); 53 struct nouveau_drm *drm = nouveau_drm(dev);
54 struct nouveau_pm *pm = nouveau_pm(dev); 54 struct nouveau_pm *pm = nouveau_pm(dev);
55 struct nouveau_therm *therm = nouveau_therm(drm); 55 struct nouveau_therm *therm = nouveau_therm(drm->device);
56 int ret; 56 int ret;
57 57
58 /*XXX: not on all boards, we should control based on temperature 58 /*XXX: not on all boards, we should control based on temperature
@@ -64,7 +64,6 @@ nouveau_pm_perflvl_aux(struct drm_device *dev, struct nouveau_pm_level *perflvl,
64 ret = therm->fan_set(therm, perflvl->fanspeed); 64 ret = therm->fan_set(therm, perflvl->fanspeed);
65 if (ret && ret != -ENODEV) { 65 if (ret && ret != -ENODEV) {
66 NV_ERROR(drm, "fanspeed set failed: %d\n", ret); 66 NV_ERROR(drm, "fanspeed set failed: %d\n", ret);
67 return ret;
68 } 67 }
69 } 68 }
70 69
@@ -706,8 +705,7 @@ nouveau_hwmon_init(struct drm_device *dev)
706 struct device *hwmon_dev; 705 struct device *hwmon_dev;
707 int ret = 0; 706 int ret = 0;
708 707
709 if (!therm || !therm->temp_get || !therm->attr_get || 708 if (!therm || !therm->temp_get || !therm->attr_get || !therm->attr_set)
710 !therm->attr_set || therm->temp_get(therm) < 0)
711 return -ENODEV; 709 return -ENODEV;
712 710
713 hwmon_dev = hwmon_device_register(&dev->pdev->dev); 711 hwmon_dev = hwmon_device_register(&dev->pdev->dev);
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 96184d02c8d9..2e566e123e9e 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1690,10 +1690,10 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1690 } 1690 }
1691 /* all other cases */ 1691 /* all other cases */
1692 pll_in_use = radeon_get_pll_use_mask(crtc); 1692 pll_in_use = radeon_get_pll_use_mask(crtc);
1693 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1694 return ATOM_PPLL2;
1695 if (!(pll_in_use & (1 << ATOM_PPLL1))) 1693 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1696 return ATOM_PPLL1; 1694 return ATOM_PPLL1;
1695 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1696 return ATOM_PPLL2;
1697 DRM_ERROR("unable to allocate a PPLL\n"); 1697 DRM_ERROR("unable to allocate a PPLL\n");
1698 return ATOM_PPLL_INVALID; 1698 return ATOM_PPLL_INVALID;
1699 } else { 1699 } else {
@@ -1715,10 +1715,10 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1715 } 1715 }
1716 /* all other cases */ 1716 /* all other cases */
1717 pll_in_use = radeon_get_pll_use_mask(crtc); 1717 pll_in_use = radeon_get_pll_use_mask(crtc);
1718 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1719 return ATOM_PPLL2;
1720 if (!(pll_in_use & (1 << ATOM_PPLL1))) 1718 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1721 return ATOM_PPLL1; 1719 return ATOM_PPLL1;
1720 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1721 return ATOM_PPLL2;
1722 DRM_ERROR("unable to allocate a PPLL\n"); 1722 DRM_ERROR("unable to allocate a PPLL\n");
1723 return ATOM_PPLL_INVALID; 1723 return ATOM_PPLL_INVALID;
1724 } else { 1724 } else {
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index a1f49c5fd74b..14313ad43b76 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -3431,9 +3431,14 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
3431 if (!(mask & DRM_PCIE_SPEED_50)) 3431 if (!(mask & DRM_PCIE_SPEED_50))
3432 return; 3432 return;
3433 3433
3434 speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
3435 if (speed_cntl & LC_CURRENT_DATA_RATE) {
3436 DRM_INFO("PCIE gen 2 link speeds already enabled\n");
3437 return;
3438 }
3439
3434 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); 3440 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n");
3435 3441
3436 speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
3437 if ((speed_cntl & LC_OTHER_SIDE_EVER_SENT_GEN2) || 3442 if ((speed_cntl & LC_OTHER_SIDE_EVER_SENT_GEN2) ||
3438 (speed_cntl & LC_OTHER_SIDE_SUPPORTS_GEN2)) { 3443 (speed_cntl & LC_OTHER_SIDE_SUPPORTS_GEN2)) {
3439 3444
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 8bcb554ea0c5..8c74c729586d 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -770,9 +770,13 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev)
770 WREG32(0x15DC, 0); 770 WREG32(0x15DC, 0);
771 771
772 /* empty context1-7 */ 772 /* empty context1-7 */
773 /* Assign the pt base to something valid for now; the pts used for
774 * the VMs are determined by the application and setup and assigned
775 * on the fly in the vm part of radeon_gart.c
776 */
773 for (i = 1; i < 8; i++) { 777 for (i = 1; i < 8; i++) {
774 WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); 778 WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0);
775 WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), 0); 779 WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn);
776 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), 780 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
777 rdev->gart.table_addr >> 12); 781 rdev->gart.table_addr >> 12);
778 } 782 }
@@ -1572,12 +1576,6 @@ void cayman_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm)
1572 if (vm == NULL) 1576 if (vm == NULL)
1573 return; 1577 return;
1574 1578
1575 radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (vm->id << 2), 0));
1576 radeon_ring_write(ring, 0);
1577
1578 radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (vm->id << 2), 0));
1579 radeon_ring_write(ring, vm->last_pfn);
1580
1581 radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2), 0)); 1579 radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2), 0));
1582 radeon_ring_write(ring, vm->pd_gpu_addr >> 12); 1580 radeon_ring_write(ring, vm->pd_gpu_addr >> 12);
1583 1581
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 70c800ff6190..cda280d157da 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3703,6 +3703,12 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev)
3703 if (!(mask & DRM_PCIE_SPEED_50)) 3703 if (!(mask & DRM_PCIE_SPEED_50))
3704 return; 3704 return;
3705 3705
3706 speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL);
3707 if (speed_cntl & LC_CURRENT_DATA_RATE) {
3708 DRM_INFO("PCIE gen 2 link speeds already enabled\n");
3709 return;
3710 }
3711
3706 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); 3712 DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n");
3707 3713
3708 /* 55 nm r6xx asics */ 3714 /* 55 nm r6xx asics */
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index b04c06444d8b..8c42d54c2e26 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -663,9 +663,14 @@ struct radeon_vm {
663 struct list_head list; 663 struct list_head list;
664 struct list_head va; 664 struct list_head va;
665 unsigned id; 665 unsigned id;
666 unsigned last_pfn; 666
667 u64 pd_gpu_addr; 667 /* contains the page directory */
668 struct radeon_sa_bo *sa_bo; 668 struct radeon_sa_bo *page_directory;
669 uint64_t pd_gpu_addr;
670
671 /* array of page tables, one for each page directory entry */
672 struct radeon_sa_bo **page_tables;
673
669 struct mutex mutex; 674 struct mutex mutex;
670 /* last fence for cs using this vm */ 675 /* last fence for cs using this vm */
671 struct radeon_fence *fence; 676 struct radeon_fence *fence;
@@ -1843,9 +1848,10 @@ extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size
1843 */ 1848 */
1844int radeon_vm_manager_init(struct radeon_device *rdev); 1849int radeon_vm_manager_init(struct radeon_device *rdev);
1845void radeon_vm_manager_fini(struct radeon_device *rdev); 1850void radeon_vm_manager_fini(struct radeon_device *rdev);
1846int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm); 1851void radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm);
1847void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm); 1852void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm);
1848int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm); 1853int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm);
1854void radeon_vm_add_to_lru(struct radeon_device *rdev, struct radeon_vm *vm);
1849struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev, 1855struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
1850 struct radeon_vm *vm, int ring); 1856 struct radeon_vm *vm, int ring);
1851void radeon_vm_fence(struct radeon_device *rdev, 1857void radeon_vm_fence(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
index b0a5688c67f8..196d28d99570 100644
--- a/drivers/gpu/drm/radeon/radeon_acpi.c
+++ b/drivers/gpu/drm/radeon/radeon_acpi.c
@@ -201,7 +201,7 @@ static int radeon_atif_verify_interface(acpi_handle handle,
201 201
202 size = *(u16 *) info->buffer.pointer; 202 size = *(u16 *) info->buffer.pointer;
203 if (size < 12) { 203 if (size < 12) {
204 DRM_INFO("ATIF buffer is too small: %lu\n", size); 204 DRM_INFO("ATIF buffer is too small: %zu\n", size);
205 err = -EINVAL; 205 err = -EINVAL;
206 goto out; 206 goto out;
207 } 207 }
@@ -370,6 +370,7 @@ int radeon_atif_handler(struct radeon_device *rdev,
370 370
371 radeon_set_backlight_level(rdev, enc, req.backlight_level); 371 radeon_set_backlight_level(rdev, enc, req.backlight_level);
372 372
373#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
373 if (rdev->is_atom_bios) { 374 if (rdev->is_atom_bios) {
374 struct radeon_encoder_atom_dig *dig = enc->enc_priv; 375 struct radeon_encoder_atom_dig *dig = enc->enc_priv;
375 backlight_force_update(dig->bl_dev, 376 backlight_force_update(dig->bl_dev,
@@ -379,6 +380,7 @@ int radeon_atif_handler(struct radeon_device *rdev,
379 backlight_force_update(dig->bl_dev, 380 backlight_force_update(dig->bl_dev,
380 BACKLIGHT_UPDATE_HOTKEY); 381 BACKLIGHT_UPDATE_HOTKEY);
381 } 382 }
383#endif
382 } 384 }
383 } 385 }
384 /* TODO: check other events */ 386 /* TODO: check other events */
@@ -485,7 +487,7 @@ static int radeon_atcs_verify_interface(acpi_handle handle,
485 487
486 size = *(u16 *) info->buffer.pointer; 488 size = *(u16 *) info->buffer.pointer;
487 if (size < 8) { 489 if (size < 8) {
488 DRM_INFO("ATCS buffer is too small: %lu\n", size); 490 DRM_INFO("ATCS buffer is too small: %zu\n", size);
489 err = -EINVAL; 491 err = -EINVAL;
490 goto out; 492 goto out;
491 } 493 }
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index 582e99449c12..1aa3f910b993 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -148,7 +148,7 @@ static int radeon_atpx_verify_interface(struct radeon_atpx *atpx)
148 148
149 size = *(u16 *) info->buffer.pointer; 149 size = *(u16 *) info->buffer.pointer;
150 if (size < 8) { 150 if (size < 8) {
151 printk("ATPX buffer is too small: %lu\n", size); 151 printk("ATPX buffer is too small: %zu\n", size);
152 err = -EINVAL; 152 err = -EINVAL;
153 goto out; 153 goto out;
154 } 154 }
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index cb7b7c062fef..41672cc563fb 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -478,6 +478,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
478 } 478 }
479 479
480out: 480out:
481 radeon_vm_add_to_lru(rdev, vm);
481 mutex_unlock(&vm->mutex); 482 mutex_unlock(&vm->mutex);
482 mutex_unlock(&rdev->vm_manager.lock); 483 mutex_unlock(&rdev->vm_manager.lock);
483 return r; 484 return r;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 64a42647f08a..bd13ca09eb62 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1018,6 +1018,10 @@ int radeon_device_init(struct radeon_device *rdev,
1018 return r; 1018 return r;
1019 /* initialize vm here */ 1019 /* initialize vm here */
1020 mutex_init(&rdev->vm_manager.lock); 1020 mutex_init(&rdev->vm_manager.lock);
1021 /* Adjust VM size here.
1022 * Currently set to 4GB ((1 << 20) 4k pages).
1023 * Max GPUVM size for cayman and SI is 40 bits.
1024 */
1021 rdev->vm_manager.max_pfn = 1 << 20; 1025 rdev->vm_manager.max_pfn = 1 << 20;
1022 INIT_LIST_HEAD(&rdev->vm_manager.lru_vm); 1026 INIT_LIST_HEAD(&rdev->vm_manager.lru_vm);
1023 1027
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index f0c06d196b75..a7677dd1ce98 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -423,6 +423,18 @@ void radeon_gart_fini(struct radeon_device *rdev)
423 */ 423 */
424 424
425/** 425/**
426 * radeon_vm_num_pde - return the number of page directory entries
427 *
428 * @rdev: radeon_device pointer
429 *
430 * Calculate the number of page directory entries (cayman+).
431 */
432static unsigned radeon_vm_num_pdes(struct radeon_device *rdev)
433{
434 return rdev->vm_manager.max_pfn >> RADEON_VM_BLOCK_SIZE;
435}
436
437/**
426 * radeon_vm_directory_size - returns the size of the page directory in bytes 438 * radeon_vm_directory_size - returns the size of the page directory in bytes
427 * 439 *
428 * @rdev: radeon_device pointer 440 * @rdev: radeon_device pointer
@@ -431,7 +443,7 @@ void radeon_gart_fini(struct radeon_device *rdev)
431 */ 443 */
432static unsigned radeon_vm_directory_size(struct radeon_device *rdev) 444static unsigned radeon_vm_directory_size(struct radeon_device *rdev)
433{ 445{
434 return (rdev->vm_manager.max_pfn >> RADEON_VM_BLOCK_SIZE) * 8; 446 return RADEON_GPU_PAGE_ALIGN(radeon_vm_num_pdes(rdev) * 8);
435} 447}
436 448
437/** 449/**
@@ -451,11 +463,11 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
451 463
452 if (!rdev->vm_manager.enabled) { 464 if (!rdev->vm_manager.enabled) {
453 /* allocate enough for 2 full VM pts */ 465 /* allocate enough for 2 full VM pts */
454 size = RADEON_GPU_PAGE_ALIGN(radeon_vm_directory_size(rdev)); 466 size = radeon_vm_directory_size(rdev);
455 size += RADEON_GPU_PAGE_ALIGN(rdev->vm_manager.max_pfn * 8); 467 size += rdev->vm_manager.max_pfn * 8;
456 size *= 2; 468 size *= 2;
457 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, 469 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
458 size, 470 RADEON_GPU_PAGE_ALIGN(size),
459 RADEON_GEM_DOMAIN_VRAM); 471 RADEON_GEM_DOMAIN_VRAM);
460 if (r) { 472 if (r) {
461 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", 473 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
@@ -476,7 +488,7 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
476 488
477 /* restore page table */ 489 /* restore page table */
478 list_for_each_entry(vm, &rdev->vm_manager.lru_vm, list) { 490 list_for_each_entry(vm, &rdev->vm_manager.lru_vm, list) {
479 if (vm->sa_bo == NULL) 491 if (vm->page_directory == NULL)
480 continue; 492 continue;
481 493
482 list_for_each_entry(bo_va, &vm->va, vm_list) { 494 list_for_each_entry(bo_va, &vm->va, vm_list) {
@@ -500,16 +512,25 @@ static void radeon_vm_free_pt(struct radeon_device *rdev,
500 struct radeon_vm *vm) 512 struct radeon_vm *vm)
501{ 513{
502 struct radeon_bo_va *bo_va; 514 struct radeon_bo_va *bo_va;
515 int i;
503 516
504 if (!vm->sa_bo) 517 if (!vm->page_directory)
505 return; 518 return;
506 519
507 list_del_init(&vm->list); 520 list_del_init(&vm->list);
508 radeon_sa_bo_free(rdev, &vm->sa_bo, vm->fence); 521 radeon_sa_bo_free(rdev, &vm->page_directory, vm->fence);
509 522
510 list_for_each_entry(bo_va, &vm->va, vm_list) { 523 list_for_each_entry(bo_va, &vm->va, vm_list) {
511 bo_va->valid = false; 524 bo_va->valid = false;
512 } 525 }
526
527 if (vm->page_tables == NULL)
528 return;
529
530 for (i = 0; i < radeon_vm_num_pdes(rdev); i++)
531 radeon_sa_bo_free(rdev, &vm->page_tables[i], vm->fence);
532
533 kfree(vm->page_tables);
513} 534}
514 535
515/** 536/**
@@ -546,63 +567,106 @@ void radeon_vm_manager_fini(struct radeon_device *rdev)
546} 567}
547 568
548/** 569/**
570 * radeon_vm_evict - evict page table to make room for new one
571 *
572 * @rdev: radeon_device pointer
573 * @vm: VM we want to allocate something for
574 *
575 * Evict a VM from the lru, making sure that it isn't @vm. (cayman+).
576 * Returns 0 for success, -ENOMEM for failure.
577 *
578 * Global and local mutex must be locked!
579 */
580int radeon_vm_evict(struct radeon_device *rdev, struct radeon_vm *vm)
581{
582 struct radeon_vm *vm_evict;
583
584 if (list_empty(&rdev->vm_manager.lru_vm))
585 return -ENOMEM;
586
587 vm_evict = list_first_entry(&rdev->vm_manager.lru_vm,
588 struct radeon_vm, list);
589 if (vm_evict == vm)
590 return -ENOMEM;
591
592 mutex_lock(&vm_evict->mutex);
593 radeon_vm_free_pt(rdev, vm_evict);
594 mutex_unlock(&vm_evict->mutex);
595 return 0;
596}
597
598/**
549 * radeon_vm_alloc_pt - allocates a page table for a VM 599 * radeon_vm_alloc_pt - allocates a page table for a VM
550 * 600 *
551 * @rdev: radeon_device pointer 601 * @rdev: radeon_device pointer
552 * @vm: vm to bind 602 * @vm: vm to bind
553 * 603 *
554 * Allocate a page table for the requested vm (cayman+). 604 * Allocate a page table for the requested vm (cayman+).
555 * Also starts to populate the page table.
556 * Returns 0 for success, error for failure. 605 * Returns 0 for success, error for failure.
557 * 606 *
558 * Global and local mutex must be locked! 607 * Global and local mutex must be locked!
559 */ 608 */
560int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm) 609int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm)
561{ 610{
562 struct radeon_vm *vm_evict; 611 unsigned pd_size, pts_size;
563 int r;
564 u64 *pd_addr; 612 u64 *pd_addr;
565 int tables_size; 613 int r;
566 614
567 if (vm == NULL) { 615 if (vm == NULL) {
568 return -EINVAL; 616 return -EINVAL;
569 } 617 }
570 618
571 /* allocate enough to cover the current VM size */ 619 if (vm->page_directory != NULL) {
572 tables_size = RADEON_GPU_PAGE_ALIGN(radeon_vm_directory_size(rdev));
573 tables_size += RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8);
574
575 if (vm->sa_bo != NULL) {
576 /* update lru */
577 list_del_init(&vm->list);
578 list_add_tail(&vm->list, &rdev->vm_manager.lru_vm);
579 return 0; 620 return 0;
580 } 621 }
581 622
582retry: 623retry:
583 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, &vm->sa_bo, 624 pd_size = RADEON_GPU_PAGE_ALIGN(radeon_vm_directory_size(rdev));
584 tables_size, RADEON_GPU_PAGE_SIZE, false); 625 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager,
626 &vm->page_directory, pd_size,
627 RADEON_GPU_PAGE_SIZE, false);
585 if (r == -ENOMEM) { 628 if (r == -ENOMEM) {
586 if (list_empty(&rdev->vm_manager.lru_vm)) { 629 r = radeon_vm_evict(rdev, vm);
630 if (r)
587 return r; 631 return r;
588 }
589 vm_evict = list_first_entry(&rdev->vm_manager.lru_vm, struct radeon_vm, list);
590 mutex_lock(&vm_evict->mutex);
591 radeon_vm_free_pt(rdev, vm_evict);
592 mutex_unlock(&vm_evict->mutex);
593 goto retry; 632 goto retry;
594 633
595 } else if (r) { 634 } else if (r) {
596 return r; 635 return r;
597 } 636 }
598 637
599 pd_addr = radeon_sa_bo_cpu_addr(vm->sa_bo); 638 vm->pd_gpu_addr = radeon_sa_bo_gpu_addr(vm->page_directory);
600 vm->pd_gpu_addr = radeon_sa_bo_gpu_addr(vm->sa_bo); 639
601 memset(pd_addr, 0, tables_size); 640 /* Initially clear the page directory */
641 pd_addr = radeon_sa_bo_cpu_addr(vm->page_directory);
642 memset(pd_addr, 0, pd_size);
643
644 pts_size = radeon_vm_num_pdes(rdev) * sizeof(struct radeon_sa_bo *);
645 vm->page_tables = kzalloc(pts_size, GFP_KERNEL);
646
647 if (vm->page_tables == NULL) {
648 DRM_ERROR("Cannot allocate memory for page table array\n");
649 radeon_sa_bo_free(rdev, &vm->page_directory, vm->fence);
650 return -ENOMEM;
651 }
652
653 return 0;
654}
602 655
656/**
657 * radeon_vm_add_to_lru - add VMs page table to LRU list
658 *
659 * @rdev: radeon_device pointer
660 * @vm: vm to add to LRU
661 *
662 * Add the allocated page table to the LRU list (cayman+).
663 *
664 * Global mutex must be locked!
665 */
666void radeon_vm_add_to_lru(struct radeon_device *rdev, struct radeon_vm *vm)
667{
668 list_del_init(&vm->list);
603 list_add_tail(&vm->list, &rdev->vm_manager.lru_vm); 669 list_add_tail(&vm->list, &rdev->vm_manager.lru_vm);
604 return radeon_vm_bo_update_pte(rdev, vm, rdev->ring_tmp_bo.bo,
605 &rdev->ring_tmp_bo.bo->tbo.mem);
606} 670}
607 671
608/** 672/**
@@ -793,20 +857,6 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev,
793 } 857 }
794 858
795 mutex_lock(&vm->mutex); 859 mutex_lock(&vm->mutex);
796 if (last_pfn > vm->last_pfn) {
797 /* release mutex and lock in right order */
798 mutex_unlock(&vm->mutex);
799 mutex_lock(&rdev->vm_manager.lock);
800 mutex_lock(&vm->mutex);
801 /* and check again */
802 if (last_pfn > vm->last_pfn) {
803 /* grow va space 32M by 32M */
804 unsigned align = ((32 << 20) >> 12) - 1;
805 radeon_vm_free_pt(rdev, vm);
806 vm->last_pfn = (last_pfn + align) & ~align;
807 }
808 mutex_unlock(&rdev->vm_manager.lock);
809 }
810 head = &vm->va; 860 head = &vm->va;
811 last_offset = 0; 861 last_offset = 0;
812 list_for_each_entry(tmp, &vm->va, vm_list) { 862 list_for_each_entry(tmp, &vm->va, vm_list) {
@@ -865,6 +915,155 @@ uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr)
865} 915}
866 916
867/** 917/**
918 * radeon_vm_update_pdes - make sure that page directory is valid
919 *
920 * @rdev: radeon_device pointer
921 * @vm: requested vm
922 * @start: start of GPU address range
923 * @end: end of GPU address range
924 *
925 * Allocates new page tables if necessary
926 * and updates the page directory (cayman+).
927 * Returns 0 for success, error for failure.
928 *
929 * Global and local mutex must be locked!
930 */
931static int radeon_vm_update_pdes(struct radeon_device *rdev,
932 struct radeon_vm *vm,
933 uint64_t start, uint64_t end)
934{
935 static const uint32_t incr = RADEON_VM_PTE_COUNT * 8;
936
937 uint64_t last_pde = ~0, last_pt = ~0;
938 unsigned count = 0;
939 uint64_t pt_idx;
940 int r;
941
942 start = (start / RADEON_GPU_PAGE_SIZE) >> RADEON_VM_BLOCK_SIZE;
943 end = (end / RADEON_GPU_PAGE_SIZE) >> RADEON_VM_BLOCK_SIZE;
944
945 /* walk over the address space and update the page directory */
946 for (pt_idx = start; pt_idx <= end; ++pt_idx) {
947 uint64_t pde, pt;
948
949 if (vm->page_tables[pt_idx])
950 continue;
951
952retry:
953 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager,
954 &vm->page_tables[pt_idx],
955 RADEON_VM_PTE_COUNT * 8,
956 RADEON_GPU_PAGE_SIZE, false);
957
958 if (r == -ENOMEM) {
959 r = radeon_vm_evict(rdev, vm);
960 if (r)
961 return r;
962 goto retry;
963 } else if (r) {
964 return r;
965 }
966
967 pde = vm->pd_gpu_addr + pt_idx * 8;
968
969 pt = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]);
970
971 if (((last_pde + 8 * count) != pde) ||
972 ((last_pt + incr * count) != pt)) {
973
974 if (count) {
975 radeon_asic_vm_set_page(rdev, last_pde,
976 last_pt, count, incr,
977 RADEON_VM_PAGE_VALID);
978 }
979
980 count = 1;
981 last_pde = pde;
982 last_pt = pt;
983 } else {
984 ++count;
985 }
986 }
987
988 if (count) {
989 radeon_asic_vm_set_page(rdev, last_pde, last_pt, count,
990 incr, RADEON_VM_PAGE_VALID);
991
992 }
993
994 return 0;
995}
996
997/**
998 * radeon_vm_update_ptes - make sure that page tables are valid
999 *
1000 * @rdev: radeon_device pointer
1001 * @vm: requested vm
1002 * @start: start of GPU address range
1003 * @end: end of GPU address range
1004 * @dst: destination address to map to
1005 * @flags: mapping flags
1006 *
1007 * Update the page tables in the range @start - @end (cayman+).
1008 *
1009 * Global and local mutex must be locked!
1010 */
1011static void radeon_vm_update_ptes(struct radeon_device *rdev,
1012 struct radeon_vm *vm,
1013 uint64_t start, uint64_t end,
1014 uint64_t dst, uint32_t flags)
1015{
1016 static const uint64_t mask = RADEON_VM_PTE_COUNT - 1;
1017
1018 uint64_t last_pte = ~0, last_dst = ~0;
1019 unsigned count = 0;
1020 uint64_t addr;
1021
1022 start = start / RADEON_GPU_PAGE_SIZE;
1023 end = end / RADEON_GPU_PAGE_SIZE;
1024
1025 /* walk over the address space and update the page tables */
1026 for (addr = start; addr < end; ) {
1027 uint64_t pt_idx = addr >> RADEON_VM_BLOCK_SIZE;
1028 unsigned nptes;
1029 uint64_t pte;
1030
1031 if ((addr & ~mask) == (end & ~mask))
1032 nptes = end - addr;
1033 else
1034 nptes = RADEON_VM_PTE_COUNT - (addr & mask);
1035
1036 pte = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]);
1037 pte += (addr & mask) * 8;
1038
1039 if (((last_pte + 8 * count) != pte) ||
1040 ((count + nptes) > 1 << 11)) {
1041
1042 if (count) {
1043 radeon_asic_vm_set_page(rdev, last_pte,
1044 last_dst, count,
1045 RADEON_GPU_PAGE_SIZE,
1046 flags);
1047 }
1048
1049 count = nptes;
1050 last_pte = pte;
1051 last_dst = dst;
1052 } else {
1053 count += nptes;
1054 }
1055
1056 addr += nptes;
1057 dst += nptes * RADEON_GPU_PAGE_SIZE;
1058 }
1059
1060 if (count) {
1061 radeon_asic_vm_set_page(rdev, last_pte, last_dst, count,
1062 RADEON_GPU_PAGE_SIZE, flags);
1063 }
1064}
1065
1066/**
868 * radeon_vm_bo_update_pte - map a bo into the vm page table 1067 * radeon_vm_bo_update_pte - map a bo into the vm page table
869 * 1068 *
870 * @rdev: radeon_device pointer 1069 * @rdev: radeon_device pointer
@@ -887,12 +1086,11 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
887 struct radeon_semaphore *sem = NULL; 1086 struct radeon_semaphore *sem = NULL;
888 struct radeon_bo_va *bo_va; 1087 struct radeon_bo_va *bo_va;
889 unsigned nptes, npdes, ndw; 1088 unsigned nptes, npdes, ndw;
890 uint64_t pe, addr; 1089 uint64_t addr;
891 uint64_t pfn;
892 int r; 1090 int r;
893 1091
894 /* nothing to do if vm isn't bound */ 1092 /* nothing to do if vm isn't bound */
895 if (vm->sa_bo == NULL) 1093 if (vm->page_directory == NULL)
896 return 0; 1094 return 0;
897 1095
898 bo_va = radeon_vm_bo_find(vm, bo); 1096 bo_va = radeon_vm_bo_find(vm, bo);
@@ -939,25 +1137,29 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
939 } 1137 }
940 } 1138 }
941 1139
942 /* estimate number of dw needed */
943 /* reserve space for 32-bit padding */
944 ndw = 32;
945
946 nptes = radeon_bo_ngpu_pages(bo); 1140 nptes = radeon_bo_ngpu_pages(bo);
947 1141
948 pfn = (bo_va->soffset / RADEON_GPU_PAGE_SIZE); 1142 /* assume two extra pdes in case the mapping overlaps the borders */
1143 npdes = (nptes >> RADEON_VM_BLOCK_SIZE) + 2;
949 1144
950 /* handle cases where a bo spans several pdes */ 1145 /* estimate number of dw needed */
951 npdes = (ALIGN(pfn + nptes, RADEON_VM_PTE_COUNT) - 1146 /* semaphore, fence and padding */
952 (pfn & ~(RADEON_VM_PTE_COUNT - 1))) >> RADEON_VM_BLOCK_SIZE; 1147 ndw = 32;
1148
1149 if (RADEON_VM_BLOCK_SIZE > 11)
1150 /* reserve space for one header for every 2k dwords */
1151 ndw += (nptes >> 11) * 3;
1152 else
1153 /* reserve space for one header for
1154 every (1 << BLOCK_SIZE) entries */
1155 ndw += (nptes >> RADEON_VM_BLOCK_SIZE) * 3;
953 1156
954 /* reserve space for one header for every 2k dwords */
955 ndw += (nptes >> 11) * 3;
956 /* reserve space for pte addresses */ 1157 /* reserve space for pte addresses */
957 ndw += nptes * 2; 1158 ndw += nptes * 2;
958 1159
959 /* reserve space for one header for every 2k dwords */ 1160 /* reserve space for one header for every 2k dwords */
960 ndw += (npdes >> 11) * 3; 1161 ndw += (npdes >> 11) * 3;
1162
961 /* reserve space for pde addresses */ 1163 /* reserve space for pde addresses */
962 ndw += npdes * 2; 1164 ndw += npdes * 2;
963 1165
@@ -971,22 +1173,14 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
971 radeon_fence_note_sync(vm->fence, ridx); 1173 radeon_fence_note_sync(vm->fence, ridx);
972 } 1174 }
973 1175
974 /* update page table entries */ 1176 r = radeon_vm_update_pdes(rdev, vm, bo_va->soffset, bo_va->eoffset);
975 pe = vm->pd_gpu_addr; 1177 if (r) {
976 pe += radeon_vm_directory_size(rdev); 1178 radeon_ring_unlock_undo(rdev, ring);
977 pe += (bo_va->soffset / RADEON_GPU_PAGE_SIZE) * 8; 1179 return r;
978 1180 }
979 radeon_asic_vm_set_page(rdev, pe, addr, nptes,
980 RADEON_GPU_PAGE_SIZE, bo_va->flags);
981
982 /* update page directory entries */
983 addr = pe;
984
985 pe = vm->pd_gpu_addr;
986 pe += ((bo_va->soffset / RADEON_GPU_PAGE_SIZE) >> RADEON_VM_BLOCK_SIZE) * 8;
987 1181
988 radeon_asic_vm_set_page(rdev, pe, addr, npdes, 1182 radeon_vm_update_ptes(rdev, vm, bo_va->soffset, bo_va->eoffset,
989 RADEON_VM_PTE_COUNT * 8, RADEON_VM_PAGE_VALID); 1183 addr, bo_va->flags);
990 1184
991 radeon_fence_unref(&vm->fence); 1185 radeon_fence_unref(&vm->fence);
992 r = radeon_fence_emit(rdev, &vm->fence, ridx); 1186 r = radeon_fence_emit(rdev, &vm->fence, ridx);
@@ -997,6 +1191,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
997 radeon_ring_unlock_commit(rdev, ring); 1191 radeon_ring_unlock_commit(rdev, ring);
998 radeon_semaphore_free(rdev, &sem, vm->fence); 1192 radeon_semaphore_free(rdev, &sem, vm->fence);
999 radeon_fence_unref(&vm->last_flush); 1193 radeon_fence_unref(&vm->last_flush);
1194
1000 return 0; 1195 return 0;
1001} 1196}
1002 1197
@@ -1056,31 +1251,15 @@ void radeon_vm_bo_invalidate(struct radeon_device *rdev,
1056 * @rdev: radeon_device pointer 1251 * @rdev: radeon_device pointer
1057 * @vm: requested vm 1252 * @vm: requested vm
1058 * 1253 *
1059 * Init @vm (cayman+). 1254 * Init @vm fields (cayman+).
1060 * Map the IB pool and any other shared objects into the VM
1061 * by default as it's used by all VMs.
1062 * Returns 0 for success, error for failure.
1063 */ 1255 */
1064int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) 1256void radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
1065{ 1257{
1066 struct radeon_bo_va *bo_va;
1067 int r;
1068
1069 vm->id = 0; 1258 vm->id = 0;
1070 vm->fence = NULL; 1259 vm->fence = NULL;
1071 vm->last_pfn = 0;
1072 mutex_init(&vm->mutex); 1260 mutex_init(&vm->mutex);
1073 INIT_LIST_HEAD(&vm->list); 1261 INIT_LIST_HEAD(&vm->list);
1074 INIT_LIST_HEAD(&vm->va); 1262 INIT_LIST_HEAD(&vm->va);
1075
1076 /* map the ib pool buffer at 0 in virtual address space, set
1077 * read only
1078 */
1079 bo_va = radeon_vm_bo_add(rdev, vm, rdev->ring_tmp_bo.bo);
1080 r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET,
1081 RADEON_VM_PAGE_READABLE |
1082 RADEON_VM_PAGE_SNOOPED);
1083 return r;
1084} 1263}
1085 1264
1086/** 1265/**
@@ -1102,17 +1281,6 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
1102 radeon_vm_free_pt(rdev, vm); 1281 radeon_vm_free_pt(rdev, vm);
1103 mutex_unlock(&rdev->vm_manager.lock); 1282 mutex_unlock(&rdev->vm_manager.lock);
1104 1283
1105 /* remove all bo at this point non are busy any more because unbind
1106 * waited for the last vm fence to signal
1107 */
1108 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
1109 if (!r) {
1110 bo_va = radeon_vm_bo_find(vm, rdev->ring_tmp_bo.bo);
1111 list_del_init(&bo_va->bo_list);
1112 list_del_init(&bo_va->vm_list);
1113 radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
1114 kfree(bo_va);
1115 }
1116 if (!list_empty(&vm->va)) { 1284 if (!list_empty(&vm->va)) {
1117 dev_err(rdev->dev, "still active bo inside vm\n"); 1285 dev_err(rdev->dev, "still active bo inside vm\n");
1118 } 1286 }
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 83b8d8aa71c0..dc781c49b96b 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -419,6 +419,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
419 /* new gpu have virtual address space support */ 419 /* new gpu have virtual address space support */
420 if (rdev->family >= CHIP_CAYMAN) { 420 if (rdev->family >= CHIP_CAYMAN) {
421 struct radeon_fpriv *fpriv; 421 struct radeon_fpriv *fpriv;
422 struct radeon_bo_va *bo_va;
422 int r; 423 int r;
423 424
424 fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); 425 fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
@@ -426,7 +427,15 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
426 return -ENOMEM; 427 return -ENOMEM;
427 } 428 }
428 429
429 r = radeon_vm_init(rdev, &fpriv->vm); 430 radeon_vm_init(rdev, &fpriv->vm);
431
432 /* map the ib pool buffer read only into
433 * virtual address space */
434 bo_va = radeon_vm_bo_add(rdev, &fpriv->vm,
435 rdev->ring_tmp_bo.bo);
436 r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET,
437 RADEON_VM_PAGE_READABLE |
438 RADEON_VM_PAGE_SNOOPED);
430 if (r) { 439 if (r) {
431 radeon_vm_fini(rdev, &fpriv->vm); 440 radeon_vm_fini(rdev, &fpriv->vm);
432 kfree(fpriv); 441 kfree(fpriv);
@@ -454,6 +463,17 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
454 /* new gpu have virtual address space support */ 463 /* new gpu have virtual address space support */
455 if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { 464 if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) {
456 struct radeon_fpriv *fpriv = file_priv->driver_priv; 465 struct radeon_fpriv *fpriv = file_priv->driver_priv;
466 struct radeon_bo_va *bo_va;
467 int r;
468
469 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
470 if (!r) {
471 bo_va = radeon_vm_bo_find(&fpriv->vm,
472 rdev->ring_tmp_bo.bo);
473 if (bo_va)
474 radeon_vm_bo_rmv(rdev, bo_va);
475 radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
476 }
457 477
458 radeon_vm_fini(rdev, &fpriv->vm); 478 radeon_vm_fini(rdev, &fpriv->vm);
459 kfree(fpriv); 479 kfree(fpriv);
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 92487e614778..a13ad9d707cf 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -269,27 +269,6 @@ static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = {
269 .disable = radeon_legacy_encoder_disable, 269 .disable = radeon_legacy_encoder_disable,
270}; 270};
271 271
272#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
273
274static uint8_t radeon_legacy_lvds_level(struct backlight_device *bd)
275{
276 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
277 uint8_t level;
278
279 /* Convert brightness to hardware level */
280 if (bd->props.brightness < 0)
281 level = 0;
282 else if (bd->props.brightness > RADEON_MAX_BL_LEVEL)
283 level = RADEON_MAX_BL_LEVEL;
284 else
285 level = bd->props.brightness;
286
287 if (pdata->negative)
288 level = RADEON_MAX_BL_LEVEL - level;
289
290 return level;
291}
292
293u8 272u8
294radeon_legacy_get_backlight_level(struct radeon_encoder *radeon_encoder) 273radeon_legacy_get_backlight_level(struct radeon_encoder *radeon_encoder)
295{ 274{
@@ -331,6 +310,27 @@ radeon_legacy_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 leve
331 radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode); 310 radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode);
332} 311}
333 312
313#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
314
315static uint8_t radeon_legacy_lvds_level(struct backlight_device *bd)
316{
317 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
318 uint8_t level;
319
320 /* Convert brightness to hardware level */
321 if (bd->props.brightness < 0)
322 level = 0;
323 else if (bd->props.brightness > RADEON_MAX_BL_LEVEL)
324 level = RADEON_MAX_BL_LEVEL;
325 else
326 level = bd->props.brightness;
327
328 if (pdata->negative)
329 level = RADEON_MAX_BL_LEVEL - level;
330
331 return level;
332}
333
334static int radeon_legacy_backlight_update_status(struct backlight_device *bd) 334static int radeon_legacy_backlight_update_status(struct backlight_device *bd)
335{ 335{
336 struct radeon_backlight_privdata *pdata = bl_get_data(bd); 336 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
@@ -991,11 +991,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder,
991static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder) 991static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
992{ 992{
993 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 993 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
994 struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv; 994 /* don't destroy the i2c bus record here, this will be done in radeon_i2c_fini */
995 if (tmds) {
996 if (tmds->i2c_bus)
997 radeon_i2c_destroy(tmds->i2c_bus);
998 }
999 kfree(radeon_encoder->enc_priv); 995 kfree(radeon_encoder->enc_priv);
1000 drm_encoder_cleanup(encoder); 996 drm_encoder_cleanup(encoder);
1001 kfree(radeon_encoder); 997 kfree(radeon_encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index bba66902c83b..47634f27f2e5 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -305,7 +305,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v)
305{ 305{
306#if DRM_DEBUG_CODE 306#if DRM_DEBUG_CODE
307 if (ring->count_dw <= 0) { 307 if (ring->count_dw <= 0) {
308 DRM_ERROR("radeon: writting more dword to ring than expected !\n"); 308 DRM_ERROR("radeon: writing more dwords to the ring than expected!\n");
309 } 309 }
310#endif 310#endif
311 ring->ring[ring->wptr++] = v; 311 ring->ring[ring->wptr++] = v;
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index f79633a036c3..df8dd7701643 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2407,12 +2407,13 @@ static int si_pcie_gart_enable(struct radeon_device *rdev)
2407 WREG32(0x15DC, 0); 2407 WREG32(0x15DC, 0);
2408 2408
2409 /* empty context1-15 */ 2409 /* empty context1-15 */
2410 /* FIXME start with 4G, once using 2 level pt switch to full
2411 * vm size space
2412 */
2413 /* set vm size, must be a multiple of 4 */ 2410 /* set vm size, must be a multiple of 4 */
2414 WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); 2411 WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0);
2415 WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); 2412 WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn);
2413 /* Assign the pt base to something valid for now; the pts used for
2414 * the VMs are determined by the application and setup and assigned
2415 * on the fly in the vm part of radeon_gart.c
2416 */
2416 for (i = 1; i < 16; i++) { 2417 for (i = 1; i < 16; i++) {
2417 if (i < 8) 2418 if (i < 8)
2418 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), 2419 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 984a3f13923b..47b8d84b489d 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -205,8 +205,11 @@ static const struct tjmax __cpuinitconst tjmax_table[] = {
205 { "CPU N455", 100000 }, 205 { "CPU N455", 100000 },
206 { "CPU N470", 100000 }, 206 { "CPU N470", 100000 },
207 { "CPU N475", 100000 }, 207 { "CPU N475", 100000 },
208 { "CPU 230", 100000 }, 208 { "CPU 230", 100000 }, /* Model 0x1c, stepping 2 */
209 { "CPU 330", 125000 }, 209 { "CPU 330", 125000 }, /* Model 0x1c, stepping 2 */
210 { "CPU CE4110", 110000 }, /* Model 0x1c, stepping 10 */
211 { "CPU CE4150", 110000 }, /* Model 0x1c, stepping 10 */
212 { "CPU CE4170", 110000 }, /* Model 0x1c, stepping 10 */
210}; 213};
211 214
212static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, 215static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 2ca6a5a4f5a7..60745a535821 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -4,7 +4,7 @@
4 4
5menuconfig PMBUS 5menuconfig PMBUS
6 tristate "PMBus support" 6 tristate "PMBus support"
7 depends on I2C && EXPERIMENTAL 7 depends on I2C
8 default n 8 default n
9 help 9 help
10 Say yes here if you want to enable PMBus support. 10 Say yes here if you want to enable PMBus support.
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index dd13e3a4c272..4ef0d80b57f4 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -163,19 +163,21 @@ source "drivers/media/common/Kconfig"
163# 163#
164 164
165config MEDIA_SUBDRV_AUTOSELECT 165config MEDIA_SUBDRV_AUTOSELECT
166 bool "Autoselect analog and hybrid tuner modules to build" 166 bool "Autoselect tuners and i2c modules to build"
167 depends on MEDIA_TUNER 167 depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_CAMERA_SUPPORT
168 default y 168 default y
169 help 169 help
170 By default, a TV driver auto-selects all possible tuners 170 By default, a media driver auto-selects all possible i2c
171 thar could be used by the driver. 171 devices that are used by any of the supported devices.
172 172
173 This is generally the right thing to do, except when there 173 This is generally the right thing to do, except when there
174 are strict constraints with regards to the kernel size. 174 are strict constraints with regards to the kernel size,
175 like on embedded systems.
175 176
176 Use this option with care, as deselecting tuner drivers which 177 Use this option with care, as deselecting ancillary drivers which
177 are in fact necessary will result in TV devices which cannot 178 are, in fact, necessary will result in the lack of the needed
178 be tuned due to lack of the tuning driver. 179 functionality for your device (it may not tune or may not have
180 the need demodulers).
179 181
180 If unsure say Y. 182 If unsure say Y.
181 183
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b721902bb6b4..b2530b002125 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1519,7 +1519,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1519 /* no need to lock since we're protected by rtnl_lock */ 1519 /* no need to lock since we're protected by rtnl_lock */
1520 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { 1520 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
1521 pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); 1521 pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
1522 if (bond_vlan_used(bond)) { 1522 if (vlan_uses_dev(bond_dev)) {
1523 pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", 1523 pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
1524 bond_dev->name, slave_dev->name, bond_dev->name); 1524 bond_dev->name, slave_dev->name, bond_dev->name);
1525 return -EPERM; 1525 return -EPERM;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 24220992413f..4833b6a9031c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2957,9 +2957,13 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
2957 skb_shinfo(skb)->nr_frags + 2957 skb_shinfo(skb)->nr_frags +
2958 BDS_PER_TX_PKT + 2958 BDS_PER_TX_PKT +
2959 NEXT_CNT_PER_TX_PKT(MAX_BDS_PER_TX_PKT))) { 2959 NEXT_CNT_PER_TX_PKT(MAX_BDS_PER_TX_PKT))) {
2960 bnx2x_fp_qstats(bp, txdata->parent_fp)->driver_xoff++; 2960 /* Handle special storage cases separately */
2961 netif_tx_stop_queue(txq); 2961 if (txdata->tx_ring_size != 0) {
2962 BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); 2962 BNX2X_ERR("BUG! Tx ring full when queue awake!\n");
2963 bnx2x_fp_qstats(bp, txdata->parent_fp)->driver_xoff++;
2964 netif_tx_stop_queue(txq);
2965 }
2966
2963 return NETDEV_TX_BUSY; 2967 return NETDEV_TX_BUSY;
2964 } 2968 }
2965 2969
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 71971a161bd1..614981c02264 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -126,7 +126,7 @@ static inline int bnx2x_exe_queue_add(struct bnx2x *bp,
126 /* Check if this request is ok */ 126 /* Check if this request is ok */
127 rc = o->validate(bp, o->owner, elem); 127 rc = o->validate(bp, o->owner, elem);
128 if (rc) { 128 if (rc) {
129 BNX2X_ERR("Preamble failed: %d\n", rc); 129 DP(BNX2X_MSG_SP, "Preamble failed: %d\n", rc);
130 goto free_and_exit; 130 goto free_and_exit;
131 } 131 }
132 } 132 }
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 72e496f1e9b0..0125524c08c4 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -37,9 +37,9 @@ struct of_bus {
37 int (*match)(struct device_node *parent); 37 int (*match)(struct device_node *parent);
38 void (*count_cells)(struct device_node *child, 38 void (*count_cells)(struct device_node *child,
39 int *addrc, int *sizec); 39 int *addrc, int *sizec);
40 u64 (*map)(u32 *addr, const __be32 *range, 40 u64 (*map)(__be32 *addr, const __be32 *range,
41 int na, int ns, int pna); 41 int na, int ns, int pna);
42 int (*translate)(u32 *addr, u64 offset, int na); 42 int (*translate)(__be32 *addr, u64 offset, int na);
43 unsigned int (*get_flags)(const __be32 *addr); 43 unsigned int (*get_flags)(const __be32 *addr);
44}; 44};
45 45
@@ -56,7 +56,7 @@ static void of_bus_default_count_cells(struct device_node *dev,
56 *sizec = of_n_size_cells(dev); 56 *sizec = of_n_size_cells(dev);
57} 57}
58 58
59static u64 of_bus_default_map(u32 *addr, const __be32 *range, 59static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
60 int na, int ns, int pna) 60 int na, int ns, int pna)
61{ 61{
62 u64 cp, s, da; 62 u64 cp, s, da;
@@ -82,7 +82,7 @@ static u64 of_bus_default_map(u32 *addr, const __be32 *range,
82 return da - cp; 82 return da - cp;
83} 83}
84 84
85static int of_bus_default_translate(u32 *addr, u64 offset, int na) 85static int of_bus_default_translate(__be32 *addr, u64 offset, int na)
86{ 86{
87 u64 a = of_read_number(addr, na); 87 u64 a = of_read_number(addr, na);
88 memset(addr, 0, na * 4); 88 memset(addr, 0, na * 4);
@@ -138,7 +138,7 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
138 return flags; 138 return flags;
139} 139}
140 140
141static u64 of_bus_pci_map(u32 *addr, const __be32 *range, int na, int ns, 141static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
142 int pna) 142 int pna)
143{ 143{
144 u64 cp, s, da; 144 u64 cp, s, da;
@@ -165,7 +165,7 @@ static u64 of_bus_pci_map(u32 *addr, const __be32 *range, int na, int ns,
165 return da - cp; 165 return da - cp;
166} 166}
167 167
168static int of_bus_pci_translate(u32 *addr, u64 offset, int na) 168static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
169{ 169{
170 return of_bus_default_translate(addr + 1, offset, na - 1); 170 return of_bus_default_translate(addr + 1, offset, na - 1);
171} 171}
@@ -247,7 +247,7 @@ static void of_bus_isa_count_cells(struct device_node *child,
247 *sizec = 1; 247 *sizec = 1;
248} 248}
249 249
250static u64 of_bus_isa_map(u32 *addr, const __be32 *range, int na, int ns, 250static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
251 int pna) 251 int pna)
252{ 252{
253 u64 cp, s, da; 253 u64 cp, s, da;
@@ -270,7 +270,7 @@ static u64 of_bus_isa_map(u32 *addr, const __be32 *range, int na, int ns,
270 return da - cp; 270 return da - cp;
271} 271}
272 272
273static int of_bus_isa_translate(u32 *addr, u64 offset, int na) 273static int of_bus_isa_translate(__be32 *addr, u64 offset, int na)
274{ 274{
275 return of_bus_default_translate(addr + 1, offset, na - 1); 275 return of_bus_default_translate(addr + 1, offset, na - 1);
276} 276}
@@ -338,7 +338,7 @@ static struct of_bus *of_match_bus(struct device_node *np)
338} 338}
339 339
340static int of_translate_one(struct device_node *parent, struct of_bus *bus, 340static int of_translate_one(struct device_node *parent, struct of_bus *bus,
341 struct of_bus *pbus, u32 *addr, 341 struct of_bus *pbus, __be32 *addr,
342 int na, int ns, int pna, const char *rprop) 342 int na, int ns, int pna, const char *rprop)
343{ 343{
344 const __be32 *ranges; 344 const __be32 *ranges;
@@ -409,12 +409,12 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
409 * that can be mapped to a cpu physical address). This is not really specified 409 * that can be mapped to a cpu physical address). This is not really specified
410 * that way, but this is traditionally the way IBM at least do things 410 * that way, but this is traditionally the way IBM at least do things
411 */ 411 */
412u64 __of_translate_address(struct device_node *dev, const __be32 *in_addr, 412static u64 __of_translate_address(struct device_node *dev,
413 const char *rprop) 413 const __be32 *in_addr, const char *rprop)
414{ 414{
415 struct device_node *parent = NULL; 415 struct device_node *parent = NULL;
416 struct of_bus *bus, *pbus; 416 struct of_bus *bus, *pbus;
417 u32 addr[OF_MAX_ADDR_CELLS]; 417 __be32 addr[OF_MAX_ADDR_CELLS];
418 int na, ns, pna, pns; 418 int na, ns, pna, pns;
419 u64 result = OF_BAD_ADDR; 419 u64 result = OF_BAD_ADDR;
420 420
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index a23ec7779997..a3c1c5aae6a9 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -192,11 +192,13 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
192 /* Compare specifiers */ 192 /* Compare specifiers */
193 match = 1; 193 match = 1;
194 for (i = 0; i < addrsize && match; ++i) { 194 for (i = 0; i < addrsize && match; ++i) {
195 u32 mask = imask ? imask[i] : 0xffffffffu; 195 __be32 mask = imask ? imask[i]
196 : cpu_to_be32(0xffffffffu);
196 match = ((addr[i] ^ imap[i]) & mask) == 0; 197 match = ((addr[i] ^ imap[i]) & mask) == 0;
197 } 198 }
198 for (; i < (addrsize + intsize) && match; ++i) { 199 for (; i < (addrsize + intsize) && match; ++i) {
199 u32 mask = imask ? imask[i] : 0xffffffffu; 200 __be32 mask = imask ? imask[i]
201 : cpu_to_be32(0xffffffffu);
200 match = 202 match =
201 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0; 203 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
202 } 204 }
@@ -465,7 +467,7 @@ void __init of_irq_init(const struct of_device_id *matches)
465 pr_debug("of_irq_init: init %s @ %p, parent %p\n", 467 pr_debug("of_irq_init: init %s @ %p, parent %p\n",
466 match->compatible, 468 match->compatible,
467 desc->dev, desc->interrupt_parent); 469 desc->dev, desc->interrupt_parent);
468 irq_init_cb = match->data; 470 irq_init_cb = (of_irq_init_cb_t)match->data;
469 ret = irq_init_cb(desc->dev, desc->interrupt_parent); 471 ret = irq_init_cb(desc->dev, desc->interrupt_parent);
470 if (ret) { 472 if (ret) {
471 kfree(desc); 473 kfree(desc);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9bdeaf30b17d..b80891b43816 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -76,7 +76,7 @@ void of_device_make_bus_id(struct device *dev)
76{ 76{
77 static atomic_t bus_no_reg_magic; 77 static atomic_t bus_no_reg_magic;
78 struct device_node *node = dev->of_node; 78 struct device_node *node = dev->of_node;
79 const u32 *reg; 79 const __be32 *reg;
80 u64 addr; 80 u64 addr;
81 const __be32 *addrp; 81 const __be32 *addrp;
82 int magic; 82 int magic;
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index b066273b6b4f..7dd879ce514d 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -194,7 +194,7 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
194 sharpsl_pcmcia_init_reset(skt); 194 sharpsl_pcmcia_init_reset(skt);
195} 195}
196 196
197static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = { 197static struct pcmcia_low_level sharpsl_pcmcia_ops = {
198 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .hw_init = sharpsl_pcmcia_hw_init, 199 .hw_init = sharpsl_pcmcia_hw_init,
200 .socket_state = sharpsl_pcmcia_socket_state, 200 .socket_state = sharpsl_pcmcia_socket_state,
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index a4adee633fa9..7e9be18ec2d2 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -29,7 +29,6 @@
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/irqdesc.h> 30#include <linux/irqdesc.h>
31#include <linux/irqdomain.h> 31#include <linux/irqdomain.h>
32#include <linux/irq.h>
33#include <linux/module.h> 32#include <linux/module.h>
34#include <linux/of_address.h> 33#include <linux/of_address.h>
35#include <linux/of.h> 34#include <linux/of.h>
@@ -960,7 +959,7 @@ static int __devinit bcm2835_pinctrl_probe(struct platform_device *pdev)
960 return err; 959 return err;
961 } 960 }
962 961
963 pc->base = devm_request_and_ioremap(&pdev->dev, &iomem); 962 pc->base = devm_request_and_ioremap(dev, &iomem);
964 if (!pc->base) 963 if (!pc->base)
965 return -EADDRNOTAVAIL; 964 return -EADDRNOTAVAIL;
966 965
@@ -1032,7 +1031,7 @@ static int __devinit bcm2835_pinctrl_probe(struct platform_device *pdev)
1032 pc->pctl_dev = pinctrl_register(&bcm2835_pinctrl_desc, dev, pc); 1031 pc->pctl_dev = pinctrl_register(&bcm2835_pinctrl_desc, dev, pc);
1033 if (!pc->pctl_dev) { 1032 if (!pc->pctl_dev) {
1034 gpiochip_remove(&pc->gpio_chip); 1033 gpiochip_remove(&pc->gpio_chip);
1035 return PTR_ERR(pc->pctl_dev); 1034 return -EINVAL;
1036 } 1035 }
1037 1036
1038 pc->gpio_range = bcm2835_pinctrl_gpio_range; 1037 pc->gpio_range = bcm2835_pinctrl_gpio_range;
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index fec9c30133d4..01aea1c3b5fa 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -30,7 +30,20 @@
30#include <linux/pinctrl/pinconf.h> 30#include <linux/pinctrl/pinconf.h>
31/* Since we request GPIOs from ourself */ 31/* Since we request GPIOs from ourself */
32#include <linux/pinctrl/consumer.h> 32#include <linux/pinctrl/consumer.h>
33/*
34 * For the U8500 archs, use the PRCMU register interface, for the older
35 * Nomadik, provide some stubs. The functions using these will only be
36 * called on the U8500 series.
37 */
38#ifdef CONFIG_ARCH_U8500
33#include <linux/mfd/dbx500-prcmu.h> 39#include <linux/mfd/dbx500-prcmu.h>
40#else
41static inline u32 prcmu_read(unsigned int reg) {
42 return 0;
43}
44static inline void prcmu_write(unsigned int reg, u32 value) {}
45static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
46#endif
34 47
35#include <asm/mach/irq.h> 48#include <asm/mach/irq.h>
36 49
@@ -1268,6 +1281,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
1268 struct clk *clk; 1281 struct clk *clk;
1269 int secondary_irq; 1282 int secondary_irq;
1270 void __iomem *base; 1283 void __iomem *base;
1284 int irq_start = -1;
1271 int irq; 1285 int irq;
1272 int ret; 1286 int ret;
1273 1287
@@ -1371,19 +1385,11 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
1371 1385
1372 platform_set_drvdata(dev, nmk_chip); 1386 platform_set_drvdata(dev, nmk_chip);
1373 1387
1374 if (np) { 1388 if (!np)
1375 /* The DT case will just grab a set of IRQ numbers */
1376 nmk_chip->domain = irq_domain_add_linear(np, NMK_GPIO_PER_CHIP,
1377 &nmk_gpio_irq_simple_ops, nmk_chip);
1378 } else {
1379 /* Non-DT legacy mode, use hardwired IRQ numbers */
1380 int irq_start;
1381
1382 irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); 1389 irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio);
1383 nmk_chip->domain = irq_domain_add_simple(NULL, 1390 nmk_chip->domain = irq_domain_add_simple(NULL,
1384 NMK_GPIO_PER_CHIP, irq_start, 1391 NMK_GPIO_PER_CHIP, irq_start,
1385 &nmk_gpio_irq_simple_ops, nmk_chip); 1392 &nmk_gpio_irq_simple_ops, nmk_chip);
1386 }
1387 if (!nmk_chip->domain) { 1393 if (!nmk_chip->domain) {
1388 dev_err(&dev->dev, "failed to create irqdomain\n"); 1394 dev_err(&dev->dev, "failed to create irqdomain\n");
1389 ret = -ENOSYS; 1395 ret = -ENOSYS;
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index dd108a94acf9..861cd5f04d5e 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -513,7 +513,7 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
513 * Parse the pin names listed in the 'samsung,pins' property and convert it 513 * Parse the pin names listed in the 'samsung,pins' property and convert it
514 * into a list of gpio numbers are create a pin group from it. 514 * into a list of gpio numbers are create a pin group from it.
515 */ 515 */
516static int __init samsung_pinctrl_parse_dt_pins(struct platform_device *pdev, 516static int __devinit samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
517 struct device_node *cfg_np, struct pinctrl_desc *pctl, 517 struct device_node *cfg_np, struct pinctrl_desc *pctl,
518 unsigned int **pin_list, unsigned int *npins) 518 unsigned int **pin_list, unsigned int *npins)
519{ 519{
@@ -560,7 +560,7 @@ static int __init samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
560 * from device node of the pin-controller. A pin group is formed with all 560 * from device node of the pin-controller. A pin group is formed with all
561 * the pins listed in the "samsung,pins" property. 561 * the pins listed in the "samsung,pins" property.
562 */ 562 */
563static int __init samsung_pinctrl_parse_dt(struct platform_device *pdev, 563static int __devinit samsung_pinctrl_parse_dt(struct platform_device *pdev,
564 struct samsung_pinctrl_drv_data *drvdata) 564 struct samsung_pinctrl_drv_data *drvdata)
565{ 565{
566 struct device *dev = &pdev->dev; 566 struct device *dev = &pdev->dev;
@@ -655,7 +655,7 @@ static int __init samsung_pinctrl_parse_dt(struct platform_device *pdev,
655} 655}
656 656
657/* register the pinctrl interface with the pinctrl subsystem */ 657/* register the pinctrl interface with the pinctrl subsystem */
658static int __init samsung_pinctrl_register(struct platform_device *pdev, 658static int __devinit samsung_pinctrl_register(struct platform_device *pdev,
659 struct samsung_pinctrl_drv_data *drvdata) 659 struct samsung_pinctrl_drv_data *drvdata)
660{ 660{
661 struct pinctrl_desc *ctrldesc = &drvdata->pctl; 661 struct pinctrl_desc *ctrldesc = &drvdata->pctl;
@@ -729,7 +729,7 @@ static int __init samsung_pinctrl_register(struct platform_device *pdev,
729} 729}
730 730
731/* register the gpiolib interface with the gpiolib subsystem */ 731/* register the gpiolib interface with the gpiolib subsystem */
732static int __init samsung_gpiolib_register(struct platform_device *pdev, 732static int __devinit samsung_gpiolib_register(struct platform_device *pdev,
733 struct samsung_pinctrl_drv_data *drvdata) 733 struct samsung_pinctrl_drv_data *drvdata)
734{ 734{
735 struct gpio_chip *gc; 735 struct gpio_chip *gc;
@@ -762,7 +762,7 @@ static int __init samsung_gpiolib_register(struct platform_device *pdev,
762} 762}
763 763
764/* unregister the gpiolib interface with the gpiolib subsystem */ 764/* unregister the gpiolib interface with the gpiolib subsystem */
765static int __init samsung_gpiolib_unregister(struct platform_device *pdev, 765static int __devinit samsung_gpiolib_unregister(struct platform_device *pdev,
766 struct samsung_pinctrl_drv_data *drvdata) 766 struct samsung_pinctrl_drv_data *drvdata)
767{ 767{
768 int ret = gpiochip_remove(drvdata->gc); 768 int ret = gpiochip_remove(drvdata->gc);
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index 675497c15149..9ecacf3d0a75 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -1323,41 +1323,6 @@ static inline struct sirfsoc_gpio_bank *sirfsoc_gpio_to_bank(unsigned int gpio)
1323 return &sgpio_bank[gpio / SIRFSOC_GPIO_BANK_SIZE]; 1323 return &sgpio_bank[gpio / SIRFSOC_GPIO_BANK_SIZE];
1324} 1324}
1325 1325
1326void sirfsoc_gpio_set_pull(unsigned gpio, unsigned mode)
1327{
1328 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(gpio);
1329 int idx = sirfsoc_gpio_to_offset(gpio);
1330 u32 val, offset;
1331 unsigned long flags;
1332
1333 offset = SIRFSOC_GPIO_CTRL(bank->id, idx);
1334
1335 spin_lock_irqsave(&sgpio_lock, flags);
1336
1337 val = readl(bank->chip.regs + offset);
1338
1339 switch (mode) {
1340 case SIRFSOC_GPIO_PULL_NONE:
1341 val &= ~SIRFSOC_GPIO_CTL_PULL_MASK;
1342 break;
1343 case SIRFSOC_GPIO_PULL_UP:
1344 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1345 val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
1346 break;
1347 case SIRFSOC_GPIO_PULL_DOWN:
1348 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1349 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
1350 break;
1351 default:
1352 break;
1353 }
1354
1355 writel(val, bank->chip.regs + offset);
1356
1357 spin_unlock_irqrestore(&sgpio_lock, flags);
1358}
1359EXPORT_SYMBOL(sirfsoc_gpio_set_pull);
1360
1361static inline struct sirfsoc_gpio_bank *sirfsoc_irqchip_to_bank(struct gpio_chip *chip) 1326static inline struct sirfsoc_gpio_bank *sirfsoc_irqchip_to_bank(struct gpio_chip *chip)
1362{ 1327{
1363 return container_of(to_of_mm_gpio_chip(chip), struct sirfsoc_gpio_bank, chip); 1328 return container_of(to_of_mm_gpio_chip(chip), struct sirfsoc_gpio_bank, chip);
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index f8d917d40c92..b9bcaec66223 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -17,8 +17,6 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/module.h>
21#include <linux/io.h>
22#include <linux/platform_device.h> 20#include <linux/platform_device.h>
23 21
24#include "pinctrl-lantiq.h" 22#include "pinctrl-lantiq.h"
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 2db409330c21..e67e0258aec5 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1141,11 +1141,12 @@ static int qeth_l2_recover(void *ptr)
1141 dev_info(&card->gdev->dev, 1141 dev_info(&card->gdev->dev,
1142 "Device successfully recovered!\n"); 1142 "Device successfully recovered!\n");
1143 else { 1143 else {
1144 rtnl_lock(); 1144 if (rtnl_trylock()) {
1145 dev_close(card->dev); 1145 dev_close(card->dev);
1146 rtnl_unlock(); 1146 rtnl_unlock();
1147 dev_warn(&card->gdev->dev, "The qeth device driver " 1147 dev_warn(&card->gdev->dev, "The qeth device driver "
1148 "failed to recover an error on the device\n"); 1148 "failed to recover an error on the device\n");
1149 }
1149 } 1150 }
1150 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); 1151 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD);
1151 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); 1152 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 4cd310cb5bdf..5ba390658498 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -3510,11 +3510,12 @@ static int qeth_l3_recover(void *ptr)
3510 dev_info(&card->gdev->dev, 3510 dev_info(&card->gdev->dev,
3511 "Device successfully recovered!\n"); 3511 "Device successfully recovered!\n");
3512 else { 3512 else {
3513 rtnl_lock(); 3513 if (rtnl_trylock()) {
3514 dev_close(card->dev); 3514 dev_close(card->dev);
3515 rtnl_unlock(); 3515 rtnl_unlock();
3516 dev_warn(&card->gdev->dev, "The qeth device driver " 3516 dev_warn(&card->gdev->dev, "The qeth device driver "
3517 "failed to recover an error on the device\n"); 3517 "failed to recover an error on the device\n");
3518 }
3518 } 3519 }
3519 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); 3520 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD);
3520 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); 3521 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD);
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 207b7d742443..d8f990b6b332 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -157,7 +157,7 @@ static int smsg_pm_restore_thaw(struct device *dev)
157#ifdef CONFIG_PM_DEBUG 157#ifdef CONFIG_PM_DEBUG
158 printk(KERN_WARNING "smsg_pm_restore_thaw\n"); 158 printk(KERN_WARNING "smsg_pm_restore_thaw\n");
159#endif 159#endif
160 if (smsg_path && iucv_path_connected) { 160 if (smsg_path && !iucv_path_connected) {
161 memset(smsg_path, 0, sizeof(*smsg_path)); 161 memset(smsg_path, 0, sizeof(*smsg_path));
162 smsg_path->msglim = 255; 162 smsg_path->msglim = 255;
163 smsg_path->flags = 0; 163 smsg_path->flags = 0;
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 6206a666a8ec..737554c37d9e 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -179,6 +179,7 @@ static void print_SCp(struct scsi_pointer *SCp, const char *prefix, const char *
179 SCp->buffers_residual, suffix); 179 SCp->buffers_residual, suffix);
180} 180}
181 181
182#ifdef CHECK_STRUCTURE
182static void fas216_dumpinfo(FAS216_Info *info) 183static void fas216_dumpinfo(FAS216_Info *info)
183{ 184{
184 static int used = 0; 185 static int used = 0;
@@ -223,7 +224,6 @@ static void fas216_dumpinfo(FAS216_Info *info)
223 info->internal_done, info->magic_end); 224 info->internal_done, info->magic_end);
224} 225}
225 226
226#ifdef CHECK_STRUCTURE
227static void __fas216_checkmagic(FAS216_Info *info, const char *func) 227static void __fas216_checkmagic(FAS216_Info *info, const char *func)
228{ 228{
229 int corruption = 0; 229 int corruption = 0;
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c
index d25f944b59c2..fc6a5aabf66e 100644
--- a/drivers/scsi/arm/oak.c
+++ b/drivers/scsi/arm/oak.c
@@ -21,6 +21,7 @@
21/*#define PSEUDO_DMA*/ 21/*#define PSEUDO_DMA*/
22 22
23#define OAKSCSI_PUBLIC_RELEASE 1 23#define OAKSCSI_PUBLIC_RELEASE 1
24#define DONT_USE_INTR
24 25
25#define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) 26#define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata)
26#define NCR5380_local_declare() void __iomem *_base 27#define NCR5380_local_declare() void __iomem *_base
diff --git a/drivers/sh/intc/access.c b/drivers/sh/intc/access.c
index f892ae1d212a..114390f967d2 100644
--- a/drivers/sh/intc/access.c
+++ b/drivers/sh/intc/access.c
@@ -75,54 +75,61 @@ unsigned long intc_get_field_from_handle(unsigned int value, unsigned int handle
75static unsigned long test_8(unsigned long addr, unsigned long h, 75static unsigned long test_8(unsigned long addr, unsigned long h,
76 unsigned long ignore) 76 unsigned long ignore)
77{ 77{
78 return intc_get_field_from_handle(__raw_readb(addr), h); 78 void __iomem *ptr = (void __iomem *)addr;
79 return intc_get_field_from_handle(__raw_readb(ptr), h);
79} 80}
80 81
81static unsigned long test_16(unsigned long addr, unsigned long h, 82static unsigned long test_16(unsigned long addr, unsigned long h,
82 unsigned long ignore) 83 unsigned long ignore)
83{ 84{
84 return intc_get_field_from_handle(__raw_readw(addr), h); 85 void __iomem *ptr = (void __iomem *)addr;
86 return intc_get_field_from_handle(__raw_readw(ptr), h);
85} 87}
86 88
87static unsigned long test_32(unsigned long addr, unsigned long h, 89static unsigned long test_32(unsigned long addr, unsigned long h,
88 unsigned long ignore) 90 unsigned long ignore)
89{ 91{
90 return intc_get_field_from_handle(__raw_readl(addr), h); 92 void __iomem *ptr = (void __iomem *)addr;
93 return intc_get_field_from_handle(__raw_readl(ptr), h);
91} 94}
92 95
93static unsigned long write_8(unsigned long addr, unsigned long h, 96static unsigned long write_8(unsigned long addr, unsigned long h,
94 unsigned long data) 97 unsigned long data)
95{ 98{
96 __raw_writeb(intc_set_field_from_handle(0, data, h), addr); 99 void __iomem *ptr = (void __iomem *)addr;
97 (void)__raw_readb(addr); /* Defeat write posting */ 100 __raw_writeb(intc_set_field_from_handle(0, data, h), ptr);
101 (void)__raw_readb(ptr); /* Defeat write posting */
98 return 0; 102 return 0;
99} 103}
100 104
101static unsigned long write_16(unsigned long addr, unsigned long h, 105static unsigned long write_16(unsigned long addr, unsigned long h,
102 unsigned long data) 106 unsigned long data)
103{ 107{
104 __raw_writew(intc_set_field_from_handle(0, data, h), addr); 108 void __iomem *ptr = (void __iomem *)addr;
105 (void)__raw_readw(addr); /* Defeat write posting */ 109 __raw_writew(intc_set_field_from_handle(0, data, h), ptr);
110 (void)__raw_readw(ptr); /* Defeat write posting */
106 return 0; 111 return 0;
107} 112}
108 113
109static unsigned long write_32(unsigned long addr, unsigned long h, 114static unsigned long write_32(unsigned long addr, unsigned long h,
110 unsigned long data) 115 unsigned long data)
111{ 116{
112 __raw_writel(intc_set_field_from_handle(0, data, h), addr); 117 void __iomem *ptr = (void __iomem *)addr;
113 (void)__raw_readl(addr); /* Defeat write posting */ 118 __raw_writel(intc_set_field_from_handle(0, data, h), ptr);
119 (void)__raw_readl(ptr); /* Defeat write posting */
114 return 0; 120 return 0;
115} 121}
116 122
117static unsigned long modify_8(unsigned long addr, unsigned long h, 123static unsigned long modify_8(unsigned long addr, unsigned long h,
118 unsigned long data) 124 unsigned long data)
119{ 125{
126 void __iomem *ptr = (void __iomem *)addr;
120 unsigned long flags; 127 unsigned long flags;
121 unsigned int value; 128 unsigned int value;
122 local_irq_save(flags); 129 local_irq_save(flags);
123 value = intc_set_field_from_handle(__raw_readb(addr), data, h); 130 value = intc_set_field_from_handle(__raw_readb(ptr), data, h);
124 __raw_writeb(value, addr); 131 __raw_writeb(value, ptr);
125 (void)__raw_readb(addr); /* Defeat write posting */ 132 (void)__raw_readb(ptr); /* Defeat write posting */
126 local_irq_restore(flags); 133 local_irq_restore(flags);
127 return 0; 134 return 0;
128} 135}
@@ -130,12 +137,13 @@ static unsigned long modify_8(unsigned long addr, unsigned long h,
130static unsigned long modify_16(unsigned long addr, unsigned long h, 137static unsigned long modify_16(unsigned long addr, unsigned long h,
131 unsigned long data) 138 unsigned long data)
132{ 139{
140 void __iomem *ptr = (void __iomem *)addr;
133 unsigned long flags; 141 unsigned long flags;
134 unsigned int value; 142 unsigned int value;
135 local_irq_save(flags); 143 local_irq_save(flags);
136 value = intc_set_field_from_handle(__raw_readw(addr), data, h); 144 value = intc_set_field_from_handle(__raw_readw(ptr), data, h);
137 __raw_writew(value, addr); 145 __raw_writew(value, ptr);
138 (void)__raw_readw(addr); /* Defeat write posting */ 146 (void)__raw_readw(ptr); /* Defeat write posting */
139 local_irq_restore(flags); 147 local_irq_restore(flags);
140 return 0; 148 return 0;
141} 149}
@@ -143,12 +151,13 @@ static unsigned long modify_16(unsigned long addr, unsigned long h,
143static unsigned long modify_32(unsigned long addr, unsigned long h, 151static unsigned long modify_32(unsigned long addr, unsigned long h,
144 unsigned long data) 152 unsigned long data)
145{ 153{
154 void __iomem *ptr = (void __iomem *)addr;
146 unsigned long flags; 155 unsigned long flags;
147 unsigned int value; 156 unsigned int value;
148 local_irq_save(flags); 157 local_irq_save(flags);
149 value = intc_set_field_from_handle(__raw_readl(addr), data, h); 158 value = intc_set_field_from_handle(__raw_readl(ptr), data, h);
150 __raw_writel(value, addr); 159 __raw_writel(value, ptr);
151 (void)__raw_readl(addr); /* Defeat write posting */ 160 (void)__raw_readl(ptr); /* Defeat write posting */
152 local_irq_restore(flags); 161 local_irq_restore(flags);
153 return 0; 162 return 0;
154} 163}
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
index 012df2676a26..46427b48e2f1 100644
--- a/drivers/sh/intc/chip.c
+++ b/drivers/sh/intc/chip.c
@@ -83,7 +83,7 @@ static void intc_mask_ack(struct irq_data *data)
83 unsigned int irq = data->irq; 83 unsigned int irq = data->irq;
84 struct intc_desc_int *d = get_intc_desc(irq); 84 struct intc_desc_int *d = get_intc_desc(irq);
85 unsigned long handle = intc_get_ack_handle(irq); 85 unsigned long handle = intc_get_ack_handle(irq);
86 unsigned long addr; 86 void __iomem *addr;
87 87
88 intc_disable(data); 88 intc_disable(data);
89 89
@@ -91,7 +91,7 @@ static void intc_mask_ack(struct irq_data *data)
91 if (handle) { 91 if (handle) {
92 unsigned int value; 92 unsigned int value;
93 93
94 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0); 94 addr = (void __iomem *)INTC_REG(d, _INTC_ADDR_D(handle), 0);
95 value = intc_set_field_from_handle(0, 1, handle); 95 value = intc_set_field_from_handle(0, 1, handle);
96 96
97 switch (_INTC_FN(handle)) { 97 switch (_INTC_FN(handle)) {
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 1a81c90a4a71..6e7a805d324d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -132,7 +132,7 @@
132 132
133struct s3c64xx_spi_dma_data { 133struct s3c64xx_spi_dma_data {
134 unsigned ch; 134 unsigned ch;
135 enum dma_data_direction direction; 135 enum dma_transfer_direction direction;
136 enum dma_ch dmach; 136 enum dma_ch dmach;
137 struct property *dma_prop; 137 struct property *dma_prop;
138}; 138};
@@ -1067,11 +1067,11 @@ static int __devinit s3c64xx_spi_get_dmares(
1067 1067
1068 if (tx) { 1068 if (tx) {
1069 dma_data = &sdd->tx_dma; 1069 dma_data = &sdd->tx_dma;
1070 dma_data->direction = DMA_TO_DEVICE; 1070 dma_data->direction = DMA_MEM_TO_DEV;
1071 chan_str = "tx"; 1071 chan_str = "tx";
1072 } else { 1072 } else {
1073 dma_data = &sdd->rx_dma; 1073 dma_data = &sdd->rx_dma;
1074 dma_data->direction = DMA_FROM_DEVICE; 1074 dma_data->direction = DMA_DEV_TO_MEM;
1075 chan_str = "rx"; 1075 chan_str = "rx";
1076 } 1076 }
1077 1077
diff --git a/drivers/staging/dgrp/dgrp_mon_ops.c b/drivers/staging/dgrp/dgrp_mon_ops.c
index 268dcb95204b..4792d056a365 100644
--- a/drivers/staging/dgrp/dgrp_mon_ops.c
+++ b/drivers/staging/dgrp/dgrp_mon_ops.c
@@ -38,6 +38,7 @@
38#include <linux/sched.h> 38#include <linux/sched.h>
39#include <asm/unaligned.h> 39#include <asm/unaligned.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/uaccess.h>
41 42
42#include "dgrp_common.h" 43#include "dgrp_common.h"
43 44
diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c
index 28f5c9ab6b43..24327c3bad83 100644
--- a/drivers/staging/dgrp/dgrp_specproc.c
+++ b/drivers/staging/dgrp/dgrp_specproc.c
@@ -39,6 +39,7 @@
39#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
40#include <linux/ctype.h> 40#include <linux/ctype.h>
41#include <linux/seq_file.h> 41#include <linux/seq_file.h>
42#include <linux/uaccess.h>
42#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
43 44
44#include "dgrp_common.h" 45#include "dgrp_common.h"
@@ -228,6 +229,9 @@ static void register_proc_table(struct dgrp_proc_entry *table,
228 int len; 229 int len;
229 mode_t mode; 230 mode_t mode;
230 231
232 if (table == NULL)
233 return;
234
231 for (; table->id; table++) { 235 for (; table->id; table++) {
232 /* Can't do anything without a proc name. */ 236 /* Can't do anything without a proc name. */
233 if (!table->name) 237 if (!table->name)
@@ -296,6 +300,9 @@ static void unregister_proc_table(struct dgrp_proc_entry *table,
296 struct proc_dir_entry *de; 300 struct proc_dir_entry *de;
297 struct nd_struct *tmp; 301 struct nd_struct *tmp;
298 302
303 if (table == NULL)
304 return;
305
299 list_for_each_entry(tmp, &nd_struct_list, list) { 306 list_for_each_entry(tmp, &nd_struct_list, list) {
300 if ((table == dgrp_net_table) && (tmp->nd_net_de)) { 307 if ((table == dgrp_net_table) && (tmp->nd_net_de)) {
301 unregister_dgrp_device(tmp->nd_net_de); 308 unregister_dgrp_device(tmp->nd_net_de);
diff --git a/drivers/staging/dgrp/dgrp_tty.c b/drivers/staging/dgrp/dgrp_tty.c
index 7d7de873870c..e125b03598d7 100644
--- a/drivers/staging/dgrp/dgrp_tty.c
+++ b/drivers/staging/dgrp/dgrp_tty.c
@@ -40,6 +40,7 @@
40#include <linux/tty.h> 40#include <linux/tty.h>
41#include <linux/tty_flip.h> 41#include <linux/tty_flip.h>
42#include <linux/sched.h> 42#include <linux/sched.h>
43#include <linux/uaccess.h>
43 44
44#include "dgrp_common.h" 45#include "dgrp_common.h"
45 46
@@ -3172,6 +3173,9 @@ dgrp_tty_init(struct nd_struct *nd)
3172 */ 3173 */
3173 3174
3174 nd->nd_serial_ttdriver = alloc_tty_driver(CHAN_MAX); 3175 nd->nd_serial_ttdriver = alloc_tty_driver(CHAN_MAX);
3176 if (!nd->nd_serial_ttdriver)
3177 return -ENOMEM;
3178
3175 sprintf(nd->nd_serial_name, "tty_dgrp_%s_", id); 3179 sprintf(nd->nd_serial_name, "tty_dgrp_%s_", id);
3176 3180
3177 nd->nd_serial_ttdriver->owner = THIS_MODULE; 3181 nd->nd_serial_ttdriver->owner = THIS_MODULE;
@@ -3231,6 +3235,9 @@ dgrp_tty_init(struct nd_struct *nd)
3231 } 3235 }
3232 3236
3233 nd->nd_callout_ttdriver = alloc_tty_driver(CHAN_MAX); 3237 nd->nd_callout_ttdriver = alloc_tty_driver(CHAN_MAX);
3238 if (!nd->nd_callout_ttdriver)
3239 return -ENOMEM;
3240
3234 sprintf(nd->nd_callout_name, "cu_dgrp_%s_", id); 3241 sprintf(nd->nd_callout_name, "cu_dgrp_%s_", id);
3235 3242
3236 nd->nd_callout_ttdriver->owner = THIS_MODULE; 3243 nd->nd_callout_ttdriver->owner = THIS_MODULE;
@@ -3268,6 +3275,9 @@ dgrp_tty_init(struct nd_struct *nd)
3268 3275
3269 3276
3270 nd->nd_xprint_ttdriver = alloc_tty_driver(CHAN_MAX); 3277 nd->nd_xprint_ttdriver = alloc_tty_driver(CHAN_MAX);
3278 if (!nd->nd_xprint_ttdriver)
3279 return -ENOMEM;
3280
3271 sprintf(nd->nd_xprint_name, "pr_dgrp_%s_", id); 3281 sprintf(nd->nd_xprint_name, "pr_dgrp_%s_", id);
3272 3282
3273 nd->nd_xprint_ttdriver->owner = THIS_MODULE; 3283 nd->nd_xprint_ttdriver->owner = THIS_MODULE;
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index edfd67d25013..e1cb6bd75f60 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -22,6 +22,7 @@ config THERMAL_HWMON
22config CPU_THERMAL 22config CPU_THERMAL
23 bool "generic cpu cooling support" 23 bool "generic cpu cooling support"
24 depends on THERMAL && CPU_FREQ 24 depends on THERMAL && CPU_FREQ
25 select CPU_FREQ_TABLE
25 help 26 help
26 This implements the generic cpu cooling mechanism through frequency 27 This implements the generic cpu cooling mechanism through frequency
27 reduction, cpu hotplug and any other ways of reducing temperature. An 28 reduction, cpu hotplug and any other ways of reducing temperature. An
@@ -50,6 +51,7 @@ config RCAR_THERMAL
50config EXYNOS_THERMAL 51config EXYNOS_THERMAL
51 tristate "Temperature sensor on Samsung EXYNOS" 52 tristate "Temperature sensor on Samsung EXYNOS"
52 depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5) && THERMAL 53 depends on (ARCH_EXYNOS4 || ARCH_EXYNOS5) && THERMAL
54 select CPU_FREQ_TABLE
53 help 55 help
54 If you say yes here you get support for TMU (Thermal Managment 56 If you say yes here you get support for TMU (Thermal Managment
55 Unit) on SAMSUNG EXYNOS series of SoC. 57 Unit) on SAMSUNG EXYNOS series of SoC.
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 8c0b7b42319c..60b076cc4e20 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -73,10 +73,42 @@
73#define ECHO_OP_SET_CANON_COL 0x81 73#define ECHO_OP_SET_CANON_COL 0x81
74#define ECHO_OP_ERASE_TAB 0x82 74#define ECHO_OP_ERASE_TAB 0x82
75 75
76struct n_tty_data {
77 unsigned int column;
78 unsigned long overrun_time;
79 int num_overrun;
80
81 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
82 unsigned char echo_overrun:1;
83
84 DECLARE_BITMAP(process_char_map, 256);
85 DECLARE_BITMAP(read_flags, N_TTY_BUF_SIZE);
86
87 char *read_buf;
88 int read_head;
89 int read_tail;
90 int read_cnt;
91
92 unsigned char *echo_buf;
93 unsigned int echo_pos;
94 unsigned int echo_cnt;
95
96 int canon_data;
97 unsigned long canon_head;
98 unsigned int canon_column;
99
100 struct mutex atomic_read_lock;
101 struct mutex output_lock;
102 struct mutex echo_lock;
103 spinlock_t read_lock;
104};
105
76static inline int tty_put_user(struct tty_struct *tty, unsigned char x, 106static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
77 unsigned char __user *ptr) 107 unsigned char __user *ptr)
78{ 108{
79 tty_audit_add_data(tty, &x, 1); 109 struct n_tty_data *ldata = tty->disc_data;
110
111 tty_audit_add_data(tty, &x, 1, ldata->icanon);
80 return put_user(x, ptr); 112 return put_user(x, ptr);
81} 113}
82 114
@@ -92,17 +124,18 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
92 124
93static void n_tty_set_room(struct tty_struct *tty) 125static void n_tty_set_room(struct tty_struct *tty)
94{ 126{
127 struct n_tty_data *ldata = tty->disc_data;
95 int left; 128 int left;
96 int old_left; 129 int old_left;
97 130
98 /* tty->read_cnt is not read locked ? */ 131 /* ldata->read_cnt is not read locked ? */
99 if (I_PARMRK(tty)) { 132 if (I_PARMRK(tty)) {
100 /* Multiply read_cnt by 3, since each byte might take up to 133 /* Multiply read_cnt by 3, since each byte might take up to
101 * three times as many spaces when PARMRK is set (depending on 134 * three times as many spaces when PARMRK is set (depending on
102 * its flags, e.g. parity error). */ 135 * its flags, e.g. parity error). */
103 left = N_TTY_BUF_SIZE - tty->read_cnt * 3 - 1; 136 left = N_TTY_BUF_SIZE - ldata->read_cnt * 3 - 1;
104 } else 137 } else
105 left = N_TTY_BUF_SIZE - tty->read_cnt - 1; 138 left = N_TTY_BUF_SIZE - ldata->read_cnt - 1;
106 139
107 /* 140 /*
108 * If we are doing input canonicalization, and there are no 141 * If we are doing input canonicalization, and there are no
@@ -111,44 +144,47 @@ static void n_tty_set_room(struct tty_struct *tty)
111 * characters will be beeped. 144 * characters will be beeped.
112 */ 145 */
113 if (left <= 0) 146 if (left <= 0)
114 left = tty->icanon && !tty->canon_data; 147 left = ldata->icanon && !ldata->canon_data;
115 old_left = tty->receive_room; 148 old_left = tty->receive_room;
116 tty->receive_room = left; 149 tty->receive_room = left;
117 150
118 /* Did this open up the receive buffer? We may need to flip */ 151 /* Did this open up the receive buffer? We may need to flip */
119 if (left && !old_left) 152 if (left && !old_left) {
120 schedule_work(&tty->buf.work); 153 WARN_RATELIMIT(tty->port->itty == NULL,
154 "scheduling with invalid itty");
155 schedule_work(&tty->port->buf.work);
156 }
121} 157}
122 158
123static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) 159static void put_tty_queue_nolock(unsigned char c, struct n_tty_data *ldata)
124{ 160{
125 if (tty->read_cnt < N_TTY_BUF_SIZE) { 161 if (ldata->read_cnt < N_TTY_BUF_SIZE) {
126 tty->read_buf[tty->read_head] = c; 162 ldata->read_buf[ldata->read_head] = c;
127 tty->read_head = (tty->read_head + 1) & (N_TTY_BUF_SIZE-1); 163 ldata->read_head = (ldata->read_head + 1) & (N_TTY_BUF_SIZE-1);
128 tty->read_cnt++; 164 ldata->read_cnt++;
129 } 165 }
130} 166}
131 167
132/** 168/**
133 * put_tty_queue - add character to tty 169 * put_tty_queue - add character to tty
134 * @c: character 170 * @c: character
135 * @tty: tty device 171 * @ldata: n_tty data
136 * 172 *
137 * Add a character to the tty read_buf queue. This is done under the 173 * Add a character to the tty read_buf queue. This is done under the
138 * read_lock to serialize character addition and also to protect us 174 * read_lock to serialize character addition and also to protect us
139 * against parallel reads or flushes 175 * against parallel reads or flushes
140 */ 176 */
141 177
142static void put_tty_queue(unsigned char c, struct tty_struct *tty) 178static void put_tty_queue(unsigned char c, struct n_tty_data *ldata)
143{ 179{
144 unsigned long flags; 180 unsigned long flags;
145 /* 181 /*
146 * The problem of stomping on the buffers ends here. 182 * The problem of stomping on the buffers ends here.
147 * Why didn't anyone see this one coming? --AJK 183 * Why didn't anyone see this one coming? --AJK
148 */ 184 */
149 spin_lock_irqsave(&tty->read_lock, flags); 185 spin_lock_irqsave(&ldata->read_lock, flags);
150 put_tty_queue_nolock(c, tty); 186 put_tty_queue_nolock(c, ldata);
151 spin_unlock_irqrestore(&tty->read_lock, flags); 187 spin_unlock_irqrestore(&ldata->read_lock, flags);
152} 188}
153 189
154/** 190/**
@@ -179,18 +215,19 @@ static void check_unthrottle(struct tty_struct *tty)
179 215
180static void reset_buffer_flags(struct tty_struct *tty) 216static void reset_buffer_flags(struct tty_struct *tty)
181{ 217{
218 struct n_tty_data *ldata = tty->disc_data;
182 unsigned long flags; 219 unsigned long flags;
183 220
184 spin_lock_irqsave(&tty->read_lock, flags); 221 spin_lock_irqsave(&ldata->read_lock, flags);
185 tty->read_head = tty->read_tail = tty->read_cnt = 0; 222 ldata->read_head = ldata->read_tail = ldata->read_cnt = 0;
186 spin_unlock_irqrestore(&tty->read_lock, flags); 223 spin_unlock_irqrestore(&ldata->read_lock, flags);
187 224
188 mutex_lock(&tty->echo_lock); 225 mutex_lock(&ldata->echo_lock);
189 tty->echo_pos = tty->echo_cnt = tty->echo_overrun = 0; 226 ldata->echo_pos = ldata->echo_cnt = ldata->echo_overrun = 0;
190 mutex_unlock(&tty->echo_lock); 227 mutex_unlock(&ldata->echo_lock);
191 228
192 tty->canon_head = tty->canon_data = tty->erasing = 0; 229 ldata->canon_head = ldata->canon_data = ldata->erasing = 0;
193 memset(&tty->read_flags, 0, sizeof tty->read_flags); 230 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
194 n_tty_set_room(tty); 231 n_tty_set_room(tty);
195} 232}
196 233
@@ -235,18 +272,19 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
235 272
236static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty) 273static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
237{ 274{
275 struct n_tty_data *ldata = tty->disc_data;
238 unsigned long flags; 276 unsigned long flags;
239 ssize_t n = 0; 277 ssize_t n = 0;
240 278
241 spin_lock_irqsave(&tty->read_lock, flags); 279 spin_lock_irqsave(&ldata->read_lock, flags);
242 if (!tty->icanon) { 280 if (!ldata->icanon) {
243 n = tty->read_cnt; 281 n = ldata->read_cnt;
244 } else if (tty->canon_data) { 282 } else if (ldata->canon_data) {
245 n = (tty->canon_head > tty->read_tail) ? 283 n = (ldata->canon_head > ldata->read_tail) ?
246 tty->canon_head - tty->read_tail : 284 ldata->canon_head - ldata->read_tail :
247 tty->canon_head + (N_TTY_BUF_SIZE - tty->read_tail); 285 ldata->canon_head + (N_TTY_BUF_SIZE - ldata->read_tail);
248 } 286 }
249 spin_unlock_irqrestore(&tty->read_lock, flags); 287 spin_unlock_irqrestore(&ldata->read_lock, flags);
250 return n; 288 return n;
251} 289}
252 290
@@ -301,6 +339,7 @@ static inline int is_continuation(unsigned char c, struct tty_struct *tty)
301 339
302static int do_output_char(unsigned char c, struct tty_struct *tty, int space) 340static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
303{ 341{
342 struct n_tty_data *ldata = tty->disc_data;
304 int spaces; 343 int spaces;
305 344
306 if (!space) 345 if (!space)
@@ -309,48 +348,48 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
309 switch (c) { 348 switch (c) {
310 case '\n': 349 case '\n':
311 if (O_ONLRET(tty)) 350 if (O_ONLRET(tty))
312 tty->column = 0; 351 ldata->column = 0;
313 if (O_ONLCR(tty)) { 352 if (O_ONLCR(tty)) {
314 if (space < 2) 353 if (space < 2)
315 return -1; 354 return -1;
316 tty->canon_column = tty->column = 0; 355 ldata->canon_column = ldata->column = 0;
317 tty->ops->write(tty, "\r\n", 2); 356 tty->ops->write(tty, "\r\n", 2);
318 return 2; 357 return 2;
319 } 358 }
320 tty->canon_column = tty->column; 359 ldata->canon_column = ldata->column;
321 break; 360 break;
322 case '\r': 361 case '\r':
323 if (O_ONOCR(tty) && tty->column == 0) 362 if (O_ONOCR(tty) && ldata->column == 0)
324 return 0; 363 return 0;
325 if (O_OCRNL(tty)) { 364 if (O_OCRNL(tty)) {
326 c = '\n'; 365 c = '\n';
327 if (O_ONLRET(tty)) 366 if (O_ONLRET(tty))
328 tty->canon_column = tty->column = 0; 367 ldata->canon_column = ldata->column = 0;
329 break; 368 break;
330 } 369 }
331 tty->canon_column = tty->column = 0; 370 ldata->canon_column = ldata->column = 0;
332 break; 371 break;
333 case '\t': 372 case '\t':
334 spaces = 8 - (tty->column & 7); 373 spaces = 8 - (ldata->column & 7);
335 if (O_TABDLY(tty) == XTABS) { 374 if (O_TABDLY(tty) == XTABS) {
336 if (space < spaces) 375 if (space < spaces)
337 return -1; 376 return -1;
338 tty->column += spaces; 377 ldata->column += spaces;
339 tty->ops->write(tty, " ", spaces); 378 tty->ops->write(tty, " ", spaces);
340 return spaces; 379 return spaces;
341 } 380 }
342 tty->column += spaces; 381 ldata->column += spaces;
343 break; 382 break;
344 case '\b': 383 case '\b':
345 if (tty->column > 0) 384 if (ldata->column > 0)
346 tty->column--; 385 ldata->column--;
347 break; 386 break;
348 default: 387 default:
349 if (!iscntrl(c)) { 388 if (!iscntrl(c)) {
350 if (O_OLCUC(tty)) 389 if (O_OLCUC(tty))
351 c = toupper(c); 390 c = toupper(c);
352 if (!is_continuation(c, tty)) 391 if (!is_continuation(c, tty))
353 tty->column++; 392 ldata->column++;
354 } 393 }
355 break; 394 break;
356 } 395 }
@@ -375,14 +414,15 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
375 414
376static int process_output(unsigned char c, struct tty_struct *tty) 415static int process_output(unsigned char c, struct tty_struct *tty)
377{ 416{
417 struct n_tty_data *ldata = tty->disc_data;
378 int space, retval; 418 int space, retval;
379 419
380 mutex_lock(&tty->output_lock); 420 mutex_lock(&ldata->output_lock);
381 421
382 space = tty_write_room(tty); 422 space = tty_write_room(tty);
383 retval = do_output_char(c, tty, space); 423 retval = do_output_char(c, tty, space);
384 424
385 mutex_unlock(&tty->output_lock); 425 mutex_unlock(&ldata->output_lock);
386 if (retval < 0) 426 if (retval < 0)
387 return -1; 427 return -1;
388 else 428 else
@@ -411,15 +451,16 @@ static int process_output(unsigned char c, struct tty_struct *tty)
411static ssize_t process_output_block(struct tty_struct *tty, 451static ssize_t process_output_block(struct tty_struct *tty,
412 const unsigned char *buf, unsigned int nr) 452 const unsigned char *buf, unsigned int nr)
413{ 453{
454 struct n_tty_data *ldata = tty->disc_data;
414 int space; 455 int space;
415 int i; 456 int i;
416 const unsigned char *cp; 457 const unsigned char *cp;
417 458
418 mutex_lock(&tty->output_lock); 459 mutex_lock(&ldata->output_lock);
419 460
420 space = tty_write_room(tty); 461 space = tty_write_room(tty);
421 if (!space) { 462 if (!space) {
422 mutex_unlock(&tty->output_lock); 463 mutex_unlock(&ldata->output_lock);
423 return 0; 464 return 0;
424 } 465 }
425 if (nr > space) 466 if (nr > space)
@@ -431,30 +472,30 @@ static ssize_t process_output_block(struct tty_struct *tty,
431 switch (c) { 472 switch (c) {
432 case '\n': 473 case '\n':
433 if (O_ONLRET(tty)) 474 if (O_ONLRET(tty))
434 tty->column = 0; 475 ldata->column = 0;
435 if (O_ONLCR(tty)) 476 if (O_ONLCR(tty))
436 goto break_out; 477 goto break_out;
437 tty->canon_column = tty->column; 478 ldata->canon_column = ldata->column;
438 break; 479 break;
439 case '\r': 480 case '\r':
440 if (O_ONOCR(tty) && tty->column == 0) 481 if (O_ONOCR(tty) && ldata->column == 0)
441 goto break_out; 482 goto break_out;
442 if (O_OCRNL(tty)) 483 if (O_OCRNL(tty))
443 goto break_out; 484 goto break_out;
444 tty->canon_column = tty->column = 0; 485 ldata->canon_column = ldata->column = 0;
445 break; 486 break;
446 case '\t': 487 case '\t':
447 goto break_out; 488 goto break_out;
448 case '\b': 489 case '\b':
449 if (tty->column > 0) 490 if (ldata->column > 0)
450 tty->column--; 491 ldata->column--;
451 break; 492 break;
452 default: 493 default:
453 if (!iscntrl(c)) { 494 if (!iscntrl(c)) {
454 if (O_OLCUC(tty)) 495 if (O_OLCUC(tty))
455 goto break_out; 496 goto break_out;
456 if (!is_continuation(c, tty)) 497 if (!is_continuation(c, tty))
457 tty->column++; 498 ldata->column++;
458 } 499 }
459 break; 500 break;
460 } 501 }
@@ -462,7 +503,7 @@ static ssize_t process_output_block(struct tty_struct *tty,
462break_out: 503break_out:
463 i = tty->ops->write(tty, buf, i); 504 i = tty->ops->write(tty, buf, i);
464 505
465 mutex_unlock(&tty->output_lock); 506 mutex_unlock(&ldata->output_lock);
466 return i; 507 return i;
467} 508}
468 509
@@ -494,21 +535,22 @@ break_out:
494 535
495static void process_echoes(struct tty_struct *tty) 536static void process_echoes(struct tty_struct *tty)
496{ 537{
538 struct n_tty_data *ldata = tty->disc_data;
497 int space, nr; 539 int space, nr;
498 unsigned char c; 540 unsigned char c;
499 unsigned char *cp, *buf_end; 541 unsigned char *cp, *buf_end;
500 542
501 if (!tty->echo_cnt) 543 if (!ldata->echo_cnt)
502 return; 544 return;
503 545
504 mutex_lock(&tty->output_lock); 546 mutex_lock(&ldata->output_lock);
505 mutex_lock(&tty->echo_lock); 547 mutex_lock(&ldata->echo_lock);
506 548
507 space = tty_write_room(tty); 549 space = tty_write_room(tty);
508 550
509 buf_end = tty->echo_buf + N_TTY_BUF_SIZE; 551 buf_end = ldata->echo_buf + N_TTY_BUF_SIZE;
510 cp = tty->echo_buf + tty->echo_pos; 552 cp = ldata->echo_buf + ldata->echo_pos;
511 nr = tty->echo_cnt; 553 nr = ldata->echo_cnt;
512 while (nr > 0) { 554 while (nr > 0) {
513 c = *cp; 555 c = *cp;
514 if (c == ECHO_OP_START) { 556 if (c == ECHO_OP_START) {
@@ -545,7 +587,7 @@ static void process_echoes(struct tty_struct *tty)
545 * Otherwise, tab spacing is normal. 587 * Otherwise, tab spacing is normal.
546 */ 588 */
547 if (!(num_chars & 0x80)) 589 if (!(num_chars & 0x80))
548 num_chars += tty->canon_column; 590 num_chars += ldata->canon_column;
549 num_bs = 8 - (num_chars & 7); 591 num_bs = 8 - (num_chars & 7);
550 592
551 if (num_bs > space) { 593 if (num_bs > space) {
@@ -555,22 +597,22 @@ static void process_echoes(struct tty_struct *tty)
555 space -= num_bs; 597 space -= num_bs;
556 while (num_bs--) { 598 while (num_bs--) {
557 tty_put_char(tty, '\b'); 599 tty_put_char(tty, '\b');
558 if (tty->column > 0) 600 if (ldata->column > 0)
559 tty->column--; 601 ldata->column--;
560 } 602 }
561 cp += 3; 603 cp += 3;
562 nr -= 3; 604 nr -= 3;
563 break; 605 break;
564 606
565 case ECHO_OP_SET_CANON_COL: 607 case ECHO_OP_SET_CANON_COL:
566 tty->canon_column = tty->column; 608 ldata->canon_column = ldata->column;
567 cp += 2; 609 cp += 2;
568 nr -= 2; 610 nr -= 2;
569 break; 611 break;
570 612
571 case ECHO_OP_MOVE_BACK_COL: 613 case ECHO_OP_MOVE_BACK_COL:
572 if (tty->column > 0) 614 if (ldata->column > 0)
573 tty->column--; 615 ldata->column--;
574 cp += 2; 616 cp += 2;
575 nr -= 2; 617 nr -= 2;
576 break; 618 break;
@@ -582,7 +624,7 @@ static void process_echoes(struct tty_struct *tty)
582 break; 624 break;
583 } 625 }
584 tty_put_char(tty, ECHO_OP_START); 626 tty_put_char(tty, ECHO_OP_START);
585 tty->column++; 627 ldata->column++;
586 space--; 628 space--;
587 cp += 2; 629 cp += 2;
588 nr -= 2; 630 nr -= 2;
@@ -604,7 +646,7 @@ static void process_echoes(struct tty_struct *tty)
604 } 646 }
605 tty_put_char(tty, '^'); 647 tty_put_char(tty, '^');
606 tty_put_char(tty, op ^ 0100); 648 tty_put_char(tty, op ^ 0100);
607 tty->column += 2; 649 ldata->column += 2;
608 space -= 2; 650 space -= 2;
609 cp += 2; 651 cp += 2;
610 nr -= 2; 652 nr -= 2;
@@ -635,20 +677,20 @@ static void process_echoes(struct tty_struct *tty)
635 } 677 }
636 678
637 if (nr == 0) { 679 if (nr == 0) {
638 tty->echo_pos = 0; 680 ldata->echo_pos = 0;
639 tty->echo_cnt = 0; 681 ldata->echo_cnt = 0;
640 tty->echo_overrun = 0; 682 ldata->echo_overrun = 0;
641 } else { 683 } else {
642 int num_processed = tty->echo_cnt - nr; 684 int num_processed = ldata->echo_cnt - nr;
643 tty->echo_pos += num_processed; 685 ldata->echo_pos += num_processed;
644 tty->echo_pos &= N_TTY_BUF_SIZE - 1; 686 ldata->echo_pos &= N_TTY_BUF_SIZE - 1;
645 tty->echo_cnt = nr; 687 ldata->echo_cnt = nr;
646 if (num_processed > 0) 688 if (num_processed > 0)
647 tty->echo_overrun = 0; 689 ldata->echo_overrun = 0;
648 } 690 }
649 691
650 mutex_unlock(&tty->echo_lock); 692 mutex_unlock(&ldata->echo_lock);
651 mutex_unlock(&tty->output_lock); 693 mutex_unlock(&ldata->output_lock);
652 694
653 if (tty->ops->flush_chars) 695 if (tty->ops->flush_chars)
654 tty->ops->flush_chars(tty); 696 tty->ops->flush_chars(tty);
@@ -657,72 +699,70 @@ static void process_echoes(struct tty_struct *tty)
657/** 699/**
658 * add_echo_byte - add a byte to the echo buffer 700 * add_echo_byte - add a byte to the echo buffer
659 * @c: unicode byte to echo 701 * @c: unicode byte to echo
660 * @tty: terminal device 702 * @ldata: n_tty data
661 * 703 *
662 * Add a character or operation byte to the echo buffer. 704 * Add a character or operation byte to the echo buffer.
663 * 705 *
664 * Should be called under the echo lock to protect the echo buffer. 706 * Should be called under the echo lock to protect the echo buffer.
665 */ 707 */
666 708
667static void add_echo_byte(unsigned char c, struct tty_struct *tty) 709static void add_echo_byte(unsigned char c, struct n_tty_data *ldata)
668{ 710{
669 int new_byte_pos; 711 int new_byte_pos;
670 712
671 if (tty->echo_cnt == N_TTY_BUF_SIZE) { 713 if (ldata->echo_cnt == N_TTY_BUF_SIZE) {
672 /* Circular buffer is already at capacity */ 714 /* Circular buffer is already at capacity */
673 new_byte_pos = tty->echo_pos; 715 new_byte_pos = ldata->echo_pos;
674 716
675 /* 717 /*
676 * Since the buffer start position needs to be advanced, 718 * Since the buffer start position needs to be advanced,
677 * be sure to step by a whole operation byte group. 719 * be sure to step by a whole operation byte group.
678 */ 720 */
679 if (tty->echo_buf[tty->echo_pos] == ECHO_OP_START) { 721 if (ldata->echo_buf[ldata->echo_pos] == ECHO_OP_START) {
680 if (tty->echo_buf[(tty->echo_pos + 1) & 722 if (ldata->echo_buf[(ldata->echo_pos + 1) &
681 (N_TTY_BUF_SIZE - 1)] == 723 (N_TTY_BUF_SIZE - 1)] ==
682 ECHO_OP_ERASE_TAB) { 724 ECHO_OP_ERASE_TAB) {
683 tty->echo_pos += 3; 725 ldata->echo_pos += 3;
684 tty->echo_cnt -= 2; 726 ldata->echo_cnt -= 2;
685 } else { 727 } else {
686 tty->echo_pos += 2; 728 ldata->echo_pos += 2;
687 tty->echo_cnt -= 1; 729 ldata->echo_cnt -= 1;
688 } 730 }
689 } else { 731 } else {
690 tty->echo_pos++; 732 ldata->echo_pos++;
691 } 733 }
692 tty->echo_pos &= N_TTY_BUF_SIZE - 1; 734 ldata->echo_pos &= N_TTY_BUF_SIZE - 1;
693 735
694 tty->echo_overrun = 1; 736 ldata->echo_overrun = 1;
695 } else { 737 } else {
696 new_byte_pos = tty->echo_pos + tty->echo_cnt; 738 new_byte_pos = ldata->echo_pos + ldata->echo_cnt;
697 new_byte_pos &= N_TTY_BUF_SIZE - 1; 739 new_byte_pos &= N_TTY_BUF_SIZE - 1;
698 tty->echo_cnt++; 740 ldata->echo_cnt++;
699 } 741 }
700 742
701 tty->echo_buf[new_byte_pos] = c; 743 ldata->echo_buf[new_byte_pos] = c;
702} 744}
703 745
704/** 746/**
705 * echo_move_back_col - add operation to move back a column 747 * echo_move_back_col - add operation to move back a column
706 * @tty: terminal device 748 * @ldata: n_tty data
707 * 749 *
708 * Add an operation to the echo buffer to move back one column. 750 * Add an operation to the echo buffer to move back one column.
709 * 751 *
710 * Locking: echo_lock to protect the echo buffer 752 * Locking: echo_lock to protect the echo buffer
711 */ 753 */
712 754
713static void echo_move_back_col(struct tty_struct *tty) 755static void echo_move_back_col(struct n_tty_data *ldata)
714{ 756{
715 mutex_lock(&tty->echo_lock); 757 mutex_lock(&ldata->echo_lock);
716 758 add_echo_byte(ECHO_OP_START, ldata);
717 add_echo_byte(ECHO_OP_START, tty); 759 add_echo_byte(ECHO_OP_MOVE_BACK_COL, ldata);
718 add_echo_byte(ECHO_OP_MOVE_BACK_COL, tty); 760 mutex_unlock(&ldata->echo_lock);
719
720 mutex_unlock(&tty->echo_lock);
721} 761}
722 762
723/** 763/**
724 * echo_set_canon_col - add operation to set the canon column 764 * echo_set_canon_col - add operation to set the canon column
725 * @tty: terminal device 765 * @ldata: n_tty data
726 * 766 *
727 * Add an operation to the echo buffer to set the canon column 767 * Add an operation to the echo buffer to set the canon column
728 * to the current column. 768 * to the current column.
@@ -730,21 +770,19 @@ static void echo_move_back_col(struct tty_struct *tty)
730 * Locking: echo_lock to protect the echo buffer 770 * Locking: echo_lock to protect the echo buffer
731 */ 771 */
732 772
733static void echo_set_canon_col(struct tty_struct *tty) 773static void echo_set_canon_col(struct n_tty_data *ldata)
734{ 774{
735 mutex_lock(&tty->echo_lock); 775 mutex_lock(&ldata->echo_lock);
736 776 add_echo_byte(ECHO_OP_START, ldata);
737 add_echo_byte(ECHO_OP_START, tty); 777 add_echo_byte(ECHO_OP_SET_CANON_COL, ldata);
738 add_echo_byte(ECHO_OP_SET_CANON_COL, tty); 778 mutex_unlock(&ldata->echo_lock);
739
740 mutex_unlock(&tty->echo_lock);
741} 779}
742 780
743/** 781/**
744 * echo_erase_tab - add operation to erase a tab 782 * echo_erase_tab - add operation to erase a tab
745 * @num_chars: number of character columns already used 783 * @num_chars: number of character columns already used
746 * @after_tab: true if num_chars starts after a previous tab 784 * @after_tab: true if num_chars starts after a previous tab
747 * @tty: terminal device 785 * @ldata: n_tty data
748 * 786 *
749 * Add an operation to the echo buffer to erase a tab. 787 * Add an operation to the echo buffer to erase a tab.
750 * 788 *
@@ -758,12 +796,12 @@ static void echo_set_canon_col(struct tty_struct *tty)
758 */ 796 */
759 797
760static void echo_erase_tab(unsigned int num_chars, int after_tab, 798static void echo_erase_tab(unsigned int num_chars, int after_tab,
761 struct tty_struct *tty) 799 struct n_tty_data *ldata)
762{ 800{
763 mutex_lock(&tty->echo_lock); 801 mutex_lock(&ldata->echo_lock);
764 802
765 add_echo_byte(ECHO_OP_START, tty); 803 add_echo_byte(ECHO_OP_START, ldata);
766 add_echo_byte(ECHO_OP_ERASE_TAB, tty); 804 add_echo_byte(ECHO_OP_ERASE_TAB, ldata);
767 805
768 /* We only need to know this modulo 8 (tab spacing) */ 806 /* We only need to know this modulo 8 (tab spacing) */
769 num_chars &= 7; 807 num_chars &= 7;
@@ -772,9 +810,9 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
772 if (after_tab) 810 if (after_tab)
773 num_chars |= 0x80; 811 num_chars |= 0x80;
774 812
775 add_echo_byte(num_chars, tty); 813 add_echo_byte(num_chars, ldata);
776 814
777 mutex_unlock(&tty->echo_lock); 815 mutex_unlock(&ldata->echo_lock);
778} 816}
779 817
780/** 818/**
@@ -790,18 +828,16 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
790 * Locking: echo_lock to protect the echo buffer 828 * Locking: echo_lock to protect the echo buffer
791 */ 829 */
792 830
793static void echo_char_raw(unsigned char c, struct tty_struct *tty) 831static void echo_char_raw(unsigned char c, struct n_tty_data *ldata)
794{ 832{
795 mutex_lock(&tty->echo_lock); 833 mutex_lock(&ldata->echo_lock);
796
797 if (c == ECHO_OP_START) { 834 if (c == ECHO_OP_START) {
798 add_echo_byte(ECHO_OP_START, tty); 835 add_echo_byte(ECHO_OP_START, ldata);
799 add_echo_byte(ECHO_OP_START, tty); 836 add_echo_byte(ECHO_OP_START, ldata);
800 } else { 837 } else {
801 add_echo_byte(c, tty); 838 add_echo_byte(c, ldata);
802 } 839 }
803 840 mutex_unlock(&ldata->echo_lock);
804 mutex_unlock(&tty->echo_lock);
805} 841}
806 842
807/** 843/**
@@ -820,30 +856,32 @@ static void echo_char_raw(unsigned char c, struct tty_struct *tty)
820 856
821static void echo_char(unsigned char c, struct tty_struct *tty) 857static void echo_char(unsigned char c, struct tty_struct *tty)
822{ 858{
823 mutex_lock(&tty->echo_lock); 859 struct n_tty_data *ldata = tty->disc_data;
860
861 mutex_lock(&ldata->echo_lock);
824 862
825 if (c == ECHO_OP_START) { 863 if (c == ECHO_OP_START) {
826 add_echo_byte(ECHO_OP_START, tty); 864 add_echo_byte(ECHO_OP_START, ldata);
827 add_echo_byte(ECHO_OP_START, tty); 865 add_echo_byte(ECHO_OP_START, ldata);
828 } else { 866 } else {
829 if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t') 867 if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t')
830 add_echo_byte(ECHO_OP_START, tty); 868 add_echo_byte(ECHO_OP_START, ldata);
831 add_echo_byte(c, tty); 869 add_echo_byte(c, ldata);
832 } 870 }
833 871
834 mutex_unlock(&tty->echo_lock); 872 mutex_unlock(&ldata->echo_lock);
835} 873}
836 874
837/** 875/**
838 * finish_erasing - complete erase 876 * finish_erasing - complete erase
839 * @tty: tty doing the erase 877 * @ldata: n_tty data
840 */ 878 */
841 879
842static inline void finish_erasing(struct tty_struct *tty) 880static inline void finish_erasing(struct n_tty_data *ldata)
843{ 881{
844 if (tty->erasing) { 882 if (ldata->erasing) {
845 echo_char_raw('/', tty); 883 echo_char_raw('/', ldata);
846 tty->erasing = 0; 884 ldata->erasing = 0;
847 } 885 }
848} 886}
849 887
@@ -861,12 +899,13 @@ static inline void finish_erasing(struct tty_struct *tty)
861 899
862static void eraser(unsigned char c, struct tty_struct *tty) 900static void eraser(unsigned char c, struct tty_struct *tty)
863{ 901{
902 struct n_tty_data *ldata = tty->disc_data;
864 enum { ERASE, WERASE, KILL } kill_type; 903 enum { ERASE, WERASE, KILL } kill_type;
865 int head, seen_alnums, cnt; 904 int head, seen_alnums, cnt;
866 unsigned long flags; 905 unsigned long flags;
867 906
868 /* FIXME: locking needed ? */ 907 /* FIXME: locking needed ? */
869 if (tty->read_head == tty->canon_head) { 908 if (ldata->read_head == ldata->canon_head) {
870 /* process_output('\a', tty); */ /* what do you think? */ 909 /* process_output('\a', tty); */ /* what do you think? */
871 return; 910 return;
872 } 911 }
@@ -876,24 +915,24 @@ static void eraser(unsigned char c, struct tty_struct *tty)
876 kill_type = WERASE; 915 kill_type = WERASE;
877 else { 916 else {
878 if (!L_ECHO(tty)) { 917 if (!L_ECHO(tty)) {
879 spin_lock_irqsave(&tty->read_lock, flags); 918 spin_lock_irqsave(&ldata->read_lock, flags);
880 tty->read_cnt -= ((tty->read_head - tty->canon_head) & 919 ldata->read_cnt -= ((ldata->read_head - ldata->canon_head) &
881 (N_TTY_BUF_SIZE - 1)); 920 (N_TTY_BUF_SIZE - 1));
882 tty->read_head = tty->canon_head; 921 ldata->read_head = ldata->canon_head;
883 spin_unlock_irqrestore(&tty->read_lock, flags); 922 spin_unlock_irqrestore(&ldata->read_lock, flags);
884 return; 923 return;
885 } 924 }
886 if (!L_ECHOK(tty) || !L_ECHOKE(tty) || !L_ECHOE(tty)) { 925 if (!L_ECHOK(tty) || !L_ECHOKE(tty) || !L_ECHOE(tty)) {
887 spin_lock_irqsave(&tty->read_lock, flags); 926 spin_lock_irqsave(&ldata->read_lock, flags);
888 tty->read_cnt -= ((tty->read_head - tty->canon_head) & 927 ldata->read_cnt -= ((ldata->read_head - ldata->canon_head) &
889 (N_TTY_BUF_SIZE - 1)); 928 (N_TTY_BUF_SIZE - 1));
890 tty->read_head = tty->canon_head; 929 ldata->read_head = ldata->canon_head;
891 spin_unlock_irqrestore(&tty->read_lock, flags); 930 spin_unlock_irqrestore(&ldata->read_lock, flags);
892 finish_erasing(tty); 931 finish_erasing(ldata);
893 echo_char(KILL_CHAR(tty), tty); 932 echo_char(KILL_CHAR(tty), tty);
894 /* Add a newline if ECHOK is on and ECHOKE is off. */ 933 /* Add a newline if ECHOK is on and ECHOKE is off. */
895 if (L_ECHOK(tty)) 934 if (L_ECHOK(tty))
896 echo_char_raw('\n', tty); 935 echo_char_raw('\n', ldata);
897 return; 936 return;
898 } 937 }
899 kill_type = KILL; 938 kill_type = KILL;
@@ -901,14 +940,14 @@ static void eraser(unsigned char c, struct tty_struct *tty)
901 940
902 seen_alnums = 0; 941 seen_alnums = 0;
903 /* FIXME: Locking ?? */ 942 /* FIXME: Locking ?? */
904 while (tty->read_head != tty->canon_head) { 943 while (ldata->read_head != ldata->canon_head) {
905 head = tty->read_head; 944 head = ldata->read_head;
906 945
907 /* erase a single possibly multibyte character */ 946 /* erase a single possibly multibyte character */
908 do { 947 do {
909 head = (head - 1) & (N_TTY_BUF_SIZE-1); 948 head = (head - 1) & (N_TTY_BUF_SIZE-1);
910 c = tty->read_buf[head]; 949 c = ldata->read_buf[head];
911 } while (is_continuation(c, tty) && head != tty->canon_head); 950 } while (is_continuation(c, tty) && head != ldata->canon_head);
912 951
913 /* do not partially erase */ 952 /* do not partially erase */
914 if (is_continuation(c, tty)) 953 if (is_continuation(c, tty))
@@ -921,30 +960,31 @@ static void eraser(unsigned char c, struct tty_struct *tty)
921 else if (seen_alnums) 960 else if (seen_alnums)
922 break; 961 break;
923 } 962 }
924 cnt = (tty->read_head - head) & (N_TTY_BUF_SIZE-1); 963 cnt = (ldata->read_head - head) & (N_TTY_BUF_SIZE-1);
925 spin_lock_irqsave(&tty->read_lock, flags); 964 spin_lock_irqsave(&ldata->read_lock, flags);
926 tty->read_head = head; 965 ldata->read_head = head;
927 tty->read_cnt -= cnt; 966 ldata->read_cnt -= cnt;
928 spin_unlock_irqrestore(&tty->read_lock, flags); 967 spin_unlock_irqrestore(&ldata->read_lock, flags);
929 if (L_ECHO(tty)) { 968 if (L_ECHO(tty)) {
930 if (L_ECHOPRT(tty)) { 969 if (L_ECHOPRT(tty)) {
931 if (!tty->erasing) { 970 if (!ldata->erasing) {
932 echo_char_raw('\\', tty); 971 echo_char_raw('\\', ldata);
933 tty->erasing = 1; 972 ldata->erasing = 1;
934 } 973 }
935 /* if cnt > 1, output a multi-byte character */ 974 /* if cnt > 1, output a multi-byte character */
936 echo_char(c, tty); 975 echo_char(c, tty);
937 while (--cnt > 0) { 976 while (--cnt > 0) {
938 head = (head+1) & (N_TTY_BUF_SIZE-1); 977 head = (head+1) & (N_TTY_BUF_SIZE-1);
939 echo_char_raw(tty->read_buf[head], tty); 978 echo_char_raw(ldata->read_buf[head],
940 echo_move_back_col(tty); 979 ldata);
980 echo_move_back_col(ldata);
941 } 981 }
942 } else if (kill_type == ERASE && !L_ECHOE(tty)) { 982 } else if (kill_type == ERASE && !L_ECHOE(tty)) {
943 echo_char(ERASE_CHAR(tty), tty); 983 echo_char(ERASE_CHAR(tty), tty);
944 } else if (c == '\t') { 984 } else if (c == '\t') {
945 unsigned int num_chars = 0; 985 unsigned int num_chars = 0;
946 int after_tab = 0; 986 int after_tab = 0;
947 unsigned long tail = tty->read_head; 987 unsigned long tail = ldata->read_head;
948 988
949 /* 989 /*
950 * Count the columns used for characters 990 * Count the columns used for characters
@@ -953,9 +993,9 @@ static void eraser(unsigned char c, struct tty_struct *tty)
953 * This info is used to go back the correct 993 * This info is used to go back the correct
954 * number of columns. 994 * number of columns.
955 */ 995 */
956 while (tail != tty->canon_head) { 996 while (tail != ldata->canon_head) {
957 tail = (tail-1) & (N_TTY_BUF_SIZE-1); 997 tail = (tail-1) & (N_TTY_BUF_SIZE-1);
958 c = tty->read_buf[tail]; 998 c = ldata->read_buf[tail];
959 if (c == '\t') { 999 if (c == '\t') {
960 after_tab = 1; 1000 after_tab = 1;
961 break; 1001 break;
@@ -966,25 +1006,25 @@ static void eraser(unsigned char c, struct tty_struct *tty)
966 num_chars++; 1006 num_chars++;
967 } 1007 }
968 } 1008 }
969 echo_erase_tab(num_chars, after_tab, tty); 1009 echo_erase_tab(num_chars, after_tab, ldata);
970 } else { 1010 } else {
971 if (iscntrl(c) && L_ECHOCTL(tty)) { 1011 if (iscntrl(c) && L_ECHOCTL(tty)) {
972 echo_char_raw('\b', tty); 1012 echo_char_raw('\b', ldata);
973 echo_char_raw(' ', tty); 1013 echo_char_raw(' ', ldata);
974 echo_char_raw('\b', tty); 1014 echo_char_raw('\b', ldata);
975 } 1015 }
976 if (!iscntrl(c) || L_ECHOCTL(tty)) { 1016 if (!iscntrl(c) || L_ECHOCTL(tty)) {
977 echo_char_raw('\b', tty); 1017 echo_char_raw('\b', ldata);
978 echo_char_raw(' ', tty); 1018 echo_char_raw(' ', ldata);
979 echo_char_raw('\b', tty); 1019 echo_char_raw('\b', ldata);
980 } 1020 }
981 } 1021 }
982 } 1022 }
983 if (kill_type == ERASE) 1023 if (kill_type == ERASE)
984 break; 1024 break;
985 } 1025 }
986 if (tty->read_head == tty->canon_head && L_ECHO(tty)) 1026 if (ldata->read_head == ldata->canon_head && L_ECHO(tty))
987 finish_erasing(tty); 1027 finish_erasing(ldata);
988} 1028}
989 1029
990/** 1030/**
@@ -1023,6 +1063,8 @@ static inline void isig(int sig, struct tty_struct *tty, int flush)
1023 1063
1024static inline void n_tty_receive_break(struct tty_struct *tty) 1064static inline void n_tty_receive_break(struct tty_struct *tty)
1025{ 1065{
1066 struct n_tty_data *ldata = tty->disc_data;
1067
1026 if (I_IGNBRK(tty)) 1068 if (I_IGNBRK(tty))
1027 return; 1069 return;
1028 if (I_BRKINT(tty)) { 1070 if (I_BRKINT(tty)) {
@@ -1030,10 +1072,10 @@ static inline void n_tty_receive_break(struct tty_struct *tty)
1030 return; 1072 return;
1031 } 1073 }
1032 if (I_PARMRK(tty)) { 1074 if (I_PARMRK(tty)) {
1033 put_tty_queue('\377', tty); 1075 put_tty_queue('\377', ldata);
1034 put_tty_queue('\0', tty); 1076 put_tty_queue('\0', ldata);
1035 } 1077 }
1036 put_tty_queue('\0', tty); 1078 put_tty_queue('\0', ldata);
1037 wake_up_interruptible(&tty->read_wait); 1079 wake_up_interruptible(&tty->read_wait);
1038} 1080}
1039 1081
@@ -1052,16 +1094,17 @@ static inline void n_tty_receive_break(struct tty_struct *tty)
1052 1094
1053static inline void n_tty_receive_overrun(struct tty_struct *tty) 1095static inline void n_tty_receive_overrun(struct tty_struct *tty)
1054{ 1096{
1097 struct n_tty_data *ldata = tty->disc_data;
1055 char buf[64]; 1098 char buf[64];
1056 1099
1057 tty->num_overrun++; 1100 ldata->num_overrun++;
1058 if (time_before(tty->overrun_time, jiffies - HZ) || 1101 if (time_after(jiffies, ldata->overrun_time + HZ) ||
1059 time_after(tty->overrun_time, jiffies)) { 1102 time_after(ldata->overrun_time, jiffies)) {
1060 printk(KERN_WARNING "%s: %d input overrun(s)\n", 1103 printk(KERN_WARNING "%s: %d input overrun(s)\n",
1061 tty_name(tty, buf), 1104 tty_name(tty, buf),
1062 tty->num_overrun); 1105 ldata->num_overrun);
1063 tty->overrun_time = jiffies; 1106 ldata->overrun_time = jiffies;
1064 tty->num_overrun = 0; 1107 ldata->num_overrun = 0;
1065 } 1108 }
1066} 1109}
1067 1110
@@ -1076,16 +1119,18 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty)
1076static inline void n_tty_receive_parity_error(struct tty_struct *tty, 1119static inline void n_tty_receive_parity_error(struct tty_struct *tty,
1077 unsigned char c) 1120 unsigned char c)
1078{ 1121{
1122 struct n_tty_data *ldata = tty->disc_data;
1123
1079 if (I_IGNPAR(tty)) 1124 if (I_IGNPAR(tty))
1080 return; 1125 return;
1081 if (I_PARMRK(tty)) { 1126 if (I_PARMRK(tty)) {
1082 put_tty_queue('\377', tty); 1127 put_tty_queue('\377', ldata);
1083 put_tty_queue('\0', tty); 1128 put_tty_queue('\0', ldata);
1084 put_tty_queue(c, tty); 1129 put_tty_queue(c, ldata);
1085 } else if (I_INPCK(tty)) 1130 } else if (I_INPCK(tty))
1086 put_tty_queue('\0', tty); 1131 put_tty_queue('\0', ldata);
1087 else 1132 else
1088 put_tty_queue(c, tty); 1133 put_tty_queue(c, ldata);
1089 wake_up_interruptible(&tty->read_wait); 1134 wake_up_interruptible(&tty->read_wait);
1090} 1135}
1091 1136
@@ -1101,11 +1146,12 @@ static inline void n_tty_receive_parity_error(struct tty_struct *tty,
1101 1146
1102static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) 1147static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1103{ 1148{
1149 struct n_tty_data *ldata = tty->disc_data;
1104 unsigned long flags; 1150 unsigned long flags;
1105 int parmrk; 1151 int parmrk;
1106 1152
1107 if (tty->raw) { 1153 if (ldata->raw) {
1108 put_tty_queue(c, tty); 1154 put_tty_queue(c, ldata);
1109 return; 1155 return;
1110 } 1156 }
1111 1157
@@ -1115,7 +1161,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1115 c = tolower(c); 1161 c = tolower(c);
1116 1162
1117 if (L_EXTPROC(tty)) { 1163 if (L_EXTPROC(tty)) {
1118 put_tty_queue(c, tty); 1164 put_tty_queue(c, ldata);
1119 return; 1165 return;
1120 } 1166 }
1121 1167
@@ -1143,26 +1189,26 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1143 * handle specially, do shortcut processing to speed things 1189 * handle specially, do shortcut processing to speed things
1144 * up. 1190 * up.
1145 */ 1191 */
1146 if (!test_bit(c, tty->process_char_map) || tty->lnext) { 1192 if (!test_bit(c, ldata->process_char_map) || ldata->lnext) {
1147 tty->lnext = 0; 1193 ldata->lnext = 0;
1148 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0; 1194 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
1149 if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) { 1195 if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
1150 /* beep if no space */ 1196 /* beep if no space */
1151 if (L_ECHO(tty)) 1197 if (L_ECHO(tty))
1152 process_output('\a', tty); 1198 process_output('\a', tty);
1153 return; 1199 return;
1154 } 1200 }
1155 if (L_ECHO(tty)) { 1201 if (L_ECHO(tty)) {
1156 finish_erasing(tty); 1202 finish_erasing(ldata);
1157 /* Record the column of first canon char. */ 1203 /* Record the column of first canon char. */
1158 if (tty->canon_head == tty->read_head) 1204 if (ldata->canon_head == ldata->read_head)
1159 echo_set_canon_col(tty); 1205 echo_set_canon_col(ldata);
1160 echo_char(c, tty); 1206 echo_char(c, tty);
1161 process_echoes(tty); 1207 process_echoes(tty);
1162 } 1208 }
1163 if (parmrk) 1209 if (parmrk)
1164 put_tty_queue(c, tty); 1210 put_tty_queue(c, ldata);
1165 put_tty_queue(c, tty); 1211 put_tty_queue(c, ldata);
1166 return; 1212 return;
1167 } 1213 }
1168 1214
@@ -1218,7 +1264,7 @@ send_signal:
1218 } else if (c == '\n' && I_INLCR(tty)) 1264 } else if (c == '\n' && I_INLCR(tty))
1219 c = '\r'; 1265 c = '\r';
1220 1266
1221 if (tty->icanon) { 1267 if (ldata->icanon) {
1222 if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) || 1268 if (c == ERASE_CHAR(tty) || c == KILL_CHAR(tty) ||
1223 (c == WERASE_CHAR(tty) && L_IEXTEN(tty))) { 1269 (c == WERASE_CHAR(tty) && L_IEXTEN(tty))) {
1224 eraser(c, tty); 1270 eraser(c, tty);
@@ -1226,12 +1272,12 @@ send_signal:
1226 return; 1272 return;
1227 } 1273 }
1228 if (c == LNEXT_CHAR(tty) && L_IEXTEN(tty)) { 1274 if (c == LNEXT_CHAR(tty) && L_IEXTEN(tty)) {
1229 tty->lnext = 1; 1275 ldata->lnext = 1;
1230 if (L_ECHO(tty)) { 1276 if (L_ECHO(tty)) {
1231 finish_erasing(tty); 1277 finish_erasing(ldata);
1232 if (L_ECHOCTL(tty)) { 1278 if (L_ECHOCTL(tty)) {
1233 echo_char_raw('^', tty); 1279 echo_char_raw('^', ldata);
1234 echo_char_raw('\b', tty); 1280 echo_char_raw('\b', ldata);
1235 process_echoes(tty); 1281 process_echoes(tty);
1236 } 1282 }
1237 } 1283 }
@@ -1239,34 +1285,34 @@ send_signal:
1239 } 1285 }
1240 if (c == REPRINT_CHAR(tty) && L_ECHO(tty) && 1286 if (c == REPRINT_CHAR(tty) && L_ECHO(tty) &&
1241 L_IEXTEN(tty)) { 1287 L_IEXTEN(tty)) {
1242 unsigned long tail = tty->canon_head; 1288 unsigned long tail = ldata->canon_head;
1243 1289
1244 finish_erasing(tty); 1290 finish_erasing(ldata);
1245 echo_char(c, tty); 1291 echo_char(c, tty);
1246 echo_char_raw('\n', tty); 1292 echo_char_raw('\n', ldata);
1247 while (tail != tty->read_head) { 1293 while (tail != ldata->read_head) {
1248 echo_char(tty->read_buf[tail], tty); 1294 echo_char(ldata->read_buf[tail], tty);
1249 tail = (tail+1) & (N_TTY_BUF_SIZE-1); 1295 tail = (tail+1) & (N_TTY_BUF_SIZE-1);
1250 } 1296 }
1251 process_echoes(tty); 1297 process_echoes(tty);
1252 return; 1298 return;
1253 } 1299 }
1254 if (c == '\n') { 1300 if (c == '\n') {
1255 if (tty->read_cnt >= N_TTY_BUF_SIZE) { 1301 if (ldata->read_cnt >= N_TTY_BUF_SIZE) {
1256 if (L_ECHO(tty)) 1302 if (L_ECHO(tty))
1257 process_output('\a', tty); 1303 process_output('\a', tty);
1258 return; 1304 return;
1259 } 1305 }
1260 if (L_ECHO(tty) || L_ECHONL(tty)) { 1306 if (L_ECHO(tty) || L_ECHONL(tty)) {
1261 echo_char_raw('\n', tty); 1307 echo_char_raw('\n', ldata);
1262 process_echoes(tty); 1308 process_echoes(tty);
1263 } 1309 }
1264 goto handle_newline; 1310 goto handle_newline;
1265 } 1311 }
1266 if (c == EOF_CHAR(tty)) { 1312 if (c == EOF_CHAR(tty)) {
1267 if (tty->read_cnt >= N_TTY_BUF_SIZE) 1313 if (ldata->read_cnt >= N_TTY_BUF_SIZE)
1268 return; 1314 return;
1269 if (tty->canon_head != tty->read_head) 1315 if (ldata->canon_head != ldata->read_head)
1270 set_bit(TTY_PUSH, &tty->flags); 1316 set_bit(TTY_PUSH, &tty->flags);
1271 c = __DISABLED_CHAR; 1317 c = __DISABLED_CHAR;
1272 goto handle_newline; 1318 goto handle_newline;
@@ -1275,7 +1321,7 @@ send_signal:
1275 (c == EOL2_CHAR(tty) && L_IEXTEN(tty))) { 1321 (c == EOL2_CHAR(tty) && L_IEXTEN(tty))) {
1276 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) 1322 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty))
1277 ? 1 : 0; 1323 ? 1 : 0;
1278 if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk)) { 1324 if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk)) {
1279 if (L_ECHO(tty)) 1325 if (L_ECHO(tty))
1280 process_output('\a', tty); 1326 process_output('\a', tty);
1281 return; 1327 return;
@@ -1285,8 +1331,8 @@ send_signal:
1285 */ 1331 */
1286 if (L_ECHO(tty)) { 1332 if (L_ECHO(tty)) {
1287 /* Record the column of first canon char. */ 1333 /* Record the column of first canon char. */
1288 if (tty->canon_head == tty->read_head) 1334 if (ldata->canon_head == ldata->read_head)
1289 echo_set_canon_col(tty); 1335 echo_set_canon_col(ldata);
1290 echo_char(c, tty); 1336 echo_char(c, tty);
1291 process_echoes(tty); 1337 process_echoes(tty);
1292 } 1338 }
@@ -1295,15 +1341,15 @@ send_signal:
1295 * EOL_CHAR and EOL2_CHAR? 1341 * EOL_CHAR and EOL2_CHAR?
1296 */ 1342 */
1297 if (parmrk) 1343 if (parmrk)
1298 put_tty_queue(c, tty); 1344 put_tty_queue(c, ldata);
1299 1345
1300handle_newline: 1346handle_newline:
1301 spin_lock_irqsave(&tty->read_lock, flags); 1347 spin_lock_irqsave(&ldata->read_lock, flags);
1302 set_bit(tty->read_head, tty->read_flags); 1348 set_bit(ldata->read_head, ldata->read_flags);
1303 put_tty_queue_nolock(c, tty); 1349 put_tty_queue_nolock(c, ldata);
1304 tty->canon_head = tty->read_head; 1350 ldata->canon_head = ldata->read_head;
1305 tty->canon_data++; 1351 ldata->canon_data++;
1306 spin_unlock_irqrestore(&tty->read_lock, flags); 1352 spin_unlock_irqrestore(&ldata->read_lock, flags);
1307 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1353 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1308 if (waitqueue_active(&tty->read_wait)) 1354 if (waitqueue_active(&tty->read_wait))
1309 wake_up_interruptible(&tty->read_wait); 1355 wake_up_interruptible(&tty->read_wait);
@@ -1312,29 +1358,29 @@ handle_newline:
1312 } 1358 }
1313 1359
1314 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0; 1360 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
1315 if (tty->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) { 1361 if (ldata->read_cnt >= (N_TTY_BUF_SIZE - parmrk - 1)) {
1316 /* beep if no space */ 1362 /* beep if no space */
1317 if (L_ECHO(tty)) 1363 if (L_ECHO(tty))
1318 process_output('\a', tty); 1364 process_output('\a', tty);
1319 return; 1365 return;
1320 } 1366 }
1321 if (L_ECHO(tty)) { 1367 if (L_ECHO(tty)) {
1322 finish_erasing(tty); 1368 finish_erasing(ldata);
1323 if (c == '\n') 1369 if (c == '\n')
1324 echo_char_raw('\n', tty); 1370 echo_char_raw('\n', ldata);
1325 else { 1371 else {
1326 /* Record the column of first canon char. */ 1372 /* Record the column of first canon char. */
1327 if (tty->canon_head == tty->read_head) 1373 if (ldata->canon_head == ldata->read_head)
1328 echo_set_canon_col(tty); 1374 echo_set_canon_col(ldata);
1329 echo_char(c, tty); 1375 echo_char(c, tty);
1330 } 1376 }
1331 process_echoes(tty); 1377 process_echoes(tty);
1332 } 1378 }
1333 1379
1334 if (parmrk) 1380 if (parmrk)
1335 put_tty_queue(c, tty); 1381 put_tty_queue(c, ldata);
1336 1382
1337 put_tty_queue(c, tty); 1383 put_tty_queue(c, ldata);
1338} 1384}
1339 1385
1340 1386
@@ -1369,33 +1415,31 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
1369static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, 1415static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
1370 char *fp, int count) 1416 char *fp, int count)
1371{ 1417{
1418 struct n_tty_data *ldata = tty->disc_data;
1372 const unsigned char *p; 1419 const unsigned char *p;
1373 char *f, flags = TTY_NORMAL; 1420 char *f, flags = TTY_NORMAL;
1374 int i; 1421 int i;
1375 char buf[64]; 1422 char buf[64];
1376 unsigned long cpuflags; 1423 unsigned long cpuflags;
1377 1424
1378 if (!tty->read_buf) 1425 if (ldata->real_raw) {
1379 return; 1426 spin_lock_irqsave(&ldata->read_lock, cpuflags);
1380 1427 i = min(N_TTY_BUF_SIZE - ldata->read_cnt,
1381 if (tty->real_raw) { 1428 N_TTY_BUF_SIZE - ldata->read_head);
1382 spin_lock_irqsave(&tty->read_lock, cpuflags);
1383 i = min(N_TTY_BUF_SIZE - tty->read_cnt,
1384 N_TTY_BUF_SIZE - tty->read_head);
1385 i = min(count, i); 1429 i = min(count, i);
1386 memcpy(tty->read_buf + tty->read_head, cp, i); 1430 memcpy(ldata->read_buf + ldata->read_head, cp, i);
1387 tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); 1431 ldata->read_head = (ldata->read_head + i) & (N_TTY_BUF_SIZE-1);
1388 tty->read_cnt += i; 1432 ldata->read_cnt += i;
1389 cp += i; 1433 cp += i;
1390 count -= i; 1434 count -= i;
1391 1435
1392 i = min(N_TTY_BUF_SIZE - tty->read_cnt, 1436 i = min(N_TTY_BUF_SIZE - ldata->read_cnt,
1393 N_TTY_BUF_SIZE - tty->read_head); 1437 N_TTY_BUF_SIZE - ldata->read_head);
1394 i = min(count, i); 1438 i = min(count, i);
1395 memcpy(tty->read_buf + tty->read_head, cp, i); 1439 memcpy(ldata->read_buf + ldata->read_head, cp, i);
1396 tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); 1440 ldata->read_head = (ldata->read_head + i) & (N_TTY_BUF_SIZE-1);
1397 tty->read_cnt += i; 1441 ldata->read_cnt += i;
1398 spin_unlock_irqrestore(&tty->read_lock, cpuflags); 1442 spin_unlock_irqrestore(&ldata->read_lock, cpuflags);
1399 } else { 1443 } else {
1400 for (i = count, p = cp, f = fp; i; i--, p++) { 1444 for (i = count, p = cp, f = fp; i; i--, p++) {
1401 if (f) 1445 if (f)
@@ -1426,7 +1470,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
1426 1470
1427 n_tty_set_room(tty); 1471 n_tty_set_room(tty);
1428 1472
1429 if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) || 1473 if ((!ldata->icanon && (ldata->read_cnt >= tty->minimum_to_wake)) ||
1430 L_EXTPROC(tty)) { 1474 L_EXTPROC(tty)) {
1431 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1475 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1432 if (waitqueue_active(&tty->read_wait)) 1476 if (waitqueue_active(&tty->read_wait))
@@ -1470,25 +1514,25 @@ int is_ignored(int sig)
1470 1514
1471static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) 1515static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1472{ 1516{
1517 struct n_tty_data *ldata = tty->disc_data;
1473 int canon_change = 1; 1518 int canon_change = 1;
1474 BUG_ON(!tty);
1475 1519
1476 if (old) 1520 if (old)
1477 canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON; 1521 canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
1478 if (canon_change) { 1522 if (canon_change) {
1479 memset(&tty->read_flags, 0, sizeof tty->read_flags); 1523 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
1480 tty->canon_head = tty->read_tail; 1524 ldata->canon_head = ldata->read_tail;
1481 tty->canon_data = 0; 1525 ldata->canon_data = 0;
1482 tty->erasing = 0; 1526 ldata->erasing = 0;
1483 } 1527 }
1484 1528
1485 if (canon_change && !L_ICANON(tty) && tty->read_cnt) 1529 if (canon_change && !L_ICANON(tty) && ldata->read_cnt)
1486 wake_up_interruptible(&tty->read_wait); 1530 wake_up_interruptible(&tty->read_wait);
1487 1531
1488 tty->icanon = (L_ICANON(tty) != 0); 1532 ldata->icanon = (L_ICANON(tty) != 0);
1489 if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { 1533 if (test_bit(TTY_HW_COOK_IN, &tty->flags)) {
1490 tty->raw = 1; 1534 ldata->raw = 1;
1491 tty->real_raw = 1; 1535 ldata->real_raw = 1;
1492 n_tty_set_room(tty); 1536 n_tty_set_room(tty);
1493 return; 1537 return;
1494 } 1538 }
@@ -1496,51 +1540,51 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1496 I_ICRNL(tty) || I_INLCR(tty) || L_ICANON(tty) || 1540 I_ICRNL(tty) || I_INLCR(tty) || L_ICANON(tty) ||
1497 I_IXON(tty) || L_ISIG(tty) || L_ECHO(tty) || 1541 I_IXON(tty) || L_ISIG(tty) || L_ECHO(tty) ||
1498 I_PARMRK(tty)) { 1542 I_PARMRK(tty)) {
1499 memset(tty->process_char_map, 0, 256/8); 1543 bitmap_zero(ldata->process_char_map, 256);
1500 1544
1501 if (I_IGNCR(tty) || I_ICRNL(tty)) 1545 if (I_IGNCR(tty) || I_ICRNL(tty))
1502 set_bit('\r', tty->process_char_map); 1546 set_bit('\r', ldata->process_char_map);
1503 if (I_INLCR(tty)) 1547 if (I_INLCR(tty))
1504 set_bit('\n', tty->process_char_map); 1548 set_bit('\n', ldata->process_char_map);
1505 1549
1506 if (L_ICANON(tty)) { 1550 if (L_ICANON(tty)) {
1507 set_bit(ERASE_CHAR(tty), tty->process_char_map); 1551 set_bit(ERASE_CHAR(tty), ldata->process_char_map);
1508 set_bit(KILL_CHAR(tty), tty->process_char_map); 1552 set_bit(KILL_CHAR(tty), ldata->process_char_map);
1509 set_bit(EOF_CHAR(tty), tty->process_char_map); 1553 set_bit(EOF_CHAR(tty), ldata->process_char_map);
1510 set_bit('\n', tty->process_char_map); 1554 set_bit('\n', ldata->process_char_map);
1511 set_bit(EOL_CHAR(tty), tty->process_char_map); 1555 set_bit(EOL_CHAR(tty), ldata->process_char_map);
1512 if (L_IEXTEN(tty)) { 1556 if (L_IEXTEN(tty)) {
1513 set_bit(WERASE_CHAR(tty), 1557 set_bit(WERASE_CHAR(tty),
1514 tty->process_char_map); 1558 ldata->process_char_map);
1515 set_bit(LNEXT_CHAR(tty), 1559 set_bit(LNEXT_CHAR(tty),
1516 tty->process_char_map); 1560 ldata->process_char_map);
1517 set_bit(EOL2_CHAR(tty), 1561 set_bit(EOL2_CHAR(tty),
1518 tty->process_char_map); 1562 ldata->process_char_map);
1519 if (L_ECHO(tty)) 1563 if (L_ECHO(tty))
1520 set_bit(REPRINT_CHAR(tty), 1564 set_bit(REPRINT_CHAR(tty),
1521 tty->process_char_map); 1565 ldata->process_char_map);
1522 } 1566 }
1523 } 1567 }
1524 if (I_IXON(tty)) { 1568 if (I_IXON(tty)) {
1525 set_bit(START_CHAR(tty), tty->process_char_map); 1569 set_bit(START_CHAR(tty), ldata->process_char_map);
1526 set_bit(STOP_CHAR(tty), tty->process_char_map); 1570 set_bit(STOP_CHAR(tty), ldata->process_char_map);
1527 } 1571 }
1528 if (L_ISIG(tty)) { 1572 if (L_ISIG(tty)) {
1529 set_bit(INTR_CHAR(tty), tty->process_char_map); 1573 set_bit(INTR_CHAR(tty), ldata->process_char_map);
1530 set_bit(QUIT_CHAR(tty), tty->process_char_map); 1574 set_bit(QUIT_CHAR(tty), ldata->process_char_map);
1531 set_bit(SUSP_CHAR(tty), tty->process_char_map); 1575 set_bit(SUSP_CHAR(tty), ldata->process_char_map);
1532 } 1576 }
1533 clear_bit(__DISABLED_CHAR, tty->process_char_map); 1577 clear_bit(__DISABLED_CHAR, ldata->process_char_map);
1534 tty->raw = 0; 1578 ldata->raw = 0;
1535 tty->real_raw = 0; 1579 ldata->real_raw = 0;
1536 } else { 1580 } else {
1537 tty->raw = 1; 1581 ldata->raw = 1;
1538 if ((I_IGNBRK(tty) || (!I_BRKINT(tty) && !I_PARMRK(tty))) && 1582 if ((I_IGNBRK(tty) || (!I_BRKINT(tty) && !I_PARMRK(tty))) &&
1539 (I_IGNPAR(tty) || !I_INPCK(tty)) && 1583 (I_IGNPAR(tty) || !I_INPCK(tty)) &&
1540 (tty->driver->flags & TTY_DRIVER_REAL_RAW)) 1584 (tty->driver->flags & TTY_DRIVER_REAL_RAW))
1541 tty->real_raw = 1; 1585 ldata->real_raw = 1;
1542 else 1586 else
1543 tty->real_raw = 0; 1587 ldata->real_raw = 0;
1544 } 1588 }
1545 n_tty_set_room(tty); 1589 n_tty_set_room(tty);
1546 /* The termios change make the tty ready for I/O */ 1590 /* The termios change make the tty ready for I/O */
@@ -1560,15 +1604,13 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1560 1604
1561static void n_tty_close(struct tty_struct *tty) 1605static void n_tty_close(struct tty_struct *tty)
1562{ 1606{
1607 struct n_tty_data *ldata = tty->disc_data;
1608
1563 n_tty_flush_buffer(tty); 1609 n_tty_flush_buffer(tty);
1564 if (tty->read_buf) { 1610 kfree(ldata->read_buf);
1565 kfree(tty->read_buf); 1611 kfree(ldata->echo_buf);
1566 tty->read_buf = NULL; 1612 kfree(ldata);
1567 } 1613 tty->disc_data = NULL;
1568 if (tty->echo_buf) {
1569 kfree(tty->echo_buf);
1570 tty->echo_buf = NULL;
1571 }
1572} 1614}
1573 1615
1574/** 1616/**
@@ -1583,37 +1625,50 @@ static void n_tty_close(struct tty_struct *tty)
1583 1625
1584static int n_tty_open(struct tty_struct *tty) 1626static int n_tty_open(struct tty_struct *tty)
1585{ 1627{
1586 if (!tty) 1628 struct n_tty_data *ldata;
1587 return -EINVAL; 1629
1630 ldata = kzalloc(sizeof(*ldata), GFP_KERNEL);
1631 if (!ldata)
1632 goto err;
1633
1634 ldata->overrun_time = jiffies;
1635 mutex_init(&ldata->atomic_read_lock);
1636 mutex_init(&ldata->output_lock);
1637 mutex_init(&ldata->echo_lock);
1638 spin_lock_init(&ldata->read_lock);
1588 1639
1589 /* These are ugly. Currently a malloc failure here can panic */ 1640 /* These are ugly. Currently a malloc failure here can panic */
1590 if (!tty->read_buf) { 1641 ldata->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
1591 tty->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL); 1642 ldata->echo_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
1592 if (!tty->read_buf) 1643 if (!ldata->read_buf || !ldata->echo_buf)
1593 return -ENOMEM; 1644 goto err_free_bufs;
1594 }
1595 if (!tty->echo_buf) {
1596 tty->echo_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
1597 1645
1598 if (!tty->echo_buf) 1646 tty->disc_data = ldata;
1599 return -ENOMEM;
1600 }
1601 reset_buffer_flags(tty); 1647 reset_buffer_flags(tty);
1602 tty_unthrottle(tty); 1648 tty_unthrottle(tty);
1603 tty->column = 0; 1649 ldata->column = 0;
1604 n_tty_set_termios(tty, NULL); 1650 n_tty_set_termios(tty, NULL);
1605 tty->minimum_to_wake = 1; 1651 tty->minimum_to_wake = 1;
1606 tty->closing = 0; 1652 tty->closing = 0;
1653
1607 return 0; 1654 return 0;
1655err_free_bufs:
1656 kfree(ldata->read_buf);
1657 kfree(ldata->echo_buf);
1658 kfree(ldata);
1659err:
1660 return -ENOMEM;
1608} 1661}
1609 1662
1610static inline int input_available_p(struct tty_struct *tty, int amt) 1663static inline int input_available_p(struct tty_struct *tty, int amt)
1611{ 1664{
1665 struct n_tty_data *ldata = tty->disc_data;
1666
1612 tty_flush_to_ldisc(tty); 1667 tty_flush_to_ldisc(tty);
1613 if (tty->icanon && !L_EXTPROC(tty)) { 1668 if (ldata->icanon && !L_EXTPROC(tty)) {
1614 if (tty->canon_data) 1669 if (ldata->canon_data)
1615 return 1; 1670 return 1;
1616 } else if (tty->read_cnt >= (amt ? amt : 1)) 1671 } else if (ldata->read_cnt >= (amt ? amt : 1))
1617 return 1; 1672 return 1;
1618 1673
1619 return 0; 1674 return 0;
@@ -1632,7 +1687,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt)
1632 * buffer, and once to drain the space from the (physical) beginning of 1687 * buffer, and once to drain the space from the (physical) beginning of
1633 * the buffer to head pointer. 1688 * the buffer to head pointer.
1634 * 1689 *
1635 * Called under the tty->atomic_read_lock sem 1690 * Called under the ldata->atomic_read_lock sem
1636 * 1691 *
1637 */ 1692 */
1638 1693
@@ -1641,29 +1696,31 @@ static int copy_from_read_buf(struct tty_struct *tty,
1641 size_t *nr) 1696 size_t *nr)
1642 1697
1643{ 1698{
1699 struct n_tty_data *ldata = tty->disc_data;
1644 int retval; 1700 int retval;
1645 size_t n; 1701 size_t n;
1646 unsigned long flags; 1702 unsigned long flags;
1647 bool is_eof; 1703 bool is_eof;
1648 1704
1649 retval = 0; 1705 retval = 0;
1650 spin_lock_irqsave(&tty->read_lock, flags); 1706 spin_lock_irqsave(&ldata->read_lock, flags);
1651 n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail); 1707 n = min(ldata->read_cnt, N_TTY_BUF_SIZE - ldata->read_tail);
1652 n = min(*nr, n); 1708 n = min(*nr, n);
1653 spin_unlock_irqrestore(&tty->read_lock, flags); 1709 spin_unlock_irqrestore(&ldata->read_lock, flags);
1654 if (n) { 1710 if (n) {
1655 retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n); 1711 retval = copy_to_user(*b, &ldata->read_buf[ldata->read_tail], n);
1656 n -= retval; 1712 n -= retval;
1657 is_eof = n == 1 && 1713 is_eof = n == 1 &&
1658 tty->read_buf[tty->read_tail] == EOF_CHAR(tty); 1714 ldata->read_buf[ldata->read_tail] == EOF_CHAR(tty);
1659 tty_audit_add_data(tty, &tty->read_buf[tty->read_tail], n); 1715 tty_audit_add_data(tty, &ldata->read_buf[ldata->read_tail], n,
1660 spin_lock_irqsave(&tty->read_lock, flags); 1716 ldata->icanon);
1661 tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1); 1717 spin_lock_irqsave(&ldata->read_lock, flags);
1662 tty->read_cnt -= n; 1718 ldata->read_tail = (ldata->read_tail + n) & (N_TTY_BUF_SIZE-1);
1719 ldata->read_cnt -= n;
1663 /* Turn single EOF into zero-length read */ 1720 /* Turn single EOF into zero-length read */
1664 if (L_EXTPROC(tty) && tty->icanon && is_eof && !tty->read_cnt) 1721 if (L_EXTPROC(tty) && ldata->icanon && is_eof && !ldata->read_cnt)
1665 n = 0; 1722 n = 0;
1666 spin_unlock_irqrestore(&tty->read_lock, flags); 1723 spin_unlock_irqrestore(&ldata->read_lock, flags);
1667 *b += n; 1724 *b += n;
1668 *nr -= n; 1725 *nr -= n;
1669 } 1726 }
@@ -1730,6 +1787,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
1730static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, 1787static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
1731 unsigned char __user *buf, size_t nr) 1788 unsigned char __user *buf, size_t nr)
1732{ 1789{
1790 struct n_tty_data *ldata = tty->disc_data;
1733 unsigned char __user *b = buf; 1791 unsigned char __user *b = buf;
1734 DECLARE_WAITQUEUE(wait, current); 1792 DECLARE_WAITQUEUE(wait, current);
1735 int c; 1793 int c;
@@ -1741,17 +1799,13 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
1741 int packet; 1799 int packet;
1742 1800
1743do_it_again: 1801do_it_again:
1744
1745 if (WARN_ON(!tty->read_buf))
1746 return -EAGAIN;
1747
1748 c = job_control(tty, file); 1802 c = job_control(tty, file);
1749 if (c < 0) 1803 if (c < 0)
1750 return c; 1804 return c;
1751 1805
1752 minimum = time = 0; 1806 minimum = time = 0;
1753 timeout = MAX_SCHEDULE_TIMEOUT; 1807 timeout = MAX_SCHEDULE_TIMEOUT;
1754 if (!tty->icanon) { 1808 if (!ldata->icanon) {
1755 time = (HZ / 10) * TIME_CHAR(tty); 1809 time = (HZ / 10) * TIME_CHAR(tty);
1756 minimum = MIN_CHAR(tty); 1810 minimum = MIN_CHAR(tty);
1757 if (minimum) { 1811 if (minimum) {
@@ -1774,10 +1828,10 @@ do_it_again:
1774 * Internal serialization of reads. 1828 * Internal serialization of reads.
1775 */ 1829 */
1776 if (file->f_flags & O_NONBLOCK) { 1830 if (file->f_flags & O_NONBLOCK) {
1777 if (!mutex_trylock(&tty->atomic_read_lock)) 1831 if (!mutex_trylock(&ldata->atomic_read_lock))
1778 return -EAGAIN; 1832 return -EAGAIN;
1779 } else { 1833 } else {
1780 if (mutex_lock_interruptible(&tty->atomic_read_lock)) 1834 if (mutex_lock_interruptible(&ldata->atomic_read_lock))
1781 return -ERESTARTSYS; 1835 return -ERESTARTSYS;
1782 } 1836 }
1783 packet = tty->packet; 1837 packet = tty->packet;
@@ -1830,7 +1884,6 @@ do_it_again:
1830 /* FIXME: does n_tty_set_room need locking ? */ 1884 /* FIXME: does n_tty_set_room need locking ? */
1831 n_tty_set_room(tty); 1885 n_tty_set_room(tty);
1832 timeout = schedule_timeout(timeout); 1886 timeout = schedule_timeout(timeout);
1833 BUG_ON(!tty->read_buf);
1834 continue; 1887 continue;
1835 } 1888 }
1836 __set_current_state(TASK_RUNNING); 1889 __set_current_state(TASK_RUNNING);
@@ -1845,45 +1898,45 @@ do_it_again:
1845 nr--; 1898 nr--;
1846 } 1899 }
1847 1900
1848 if (tty->icanon && !L_EXTPROC(tty)) { 1901 if (ldata->icanon && !L_EXTPROC(tty)) {
1849 /* N.B. avoid overrun if nr == 0 */ 1902 /* N.B. avoid overrun if nr == 0 */
1850 spin_lock_irqsave(&tty->read_lock, flags); 1903 spin_lock_irqsave(&ldata->read_lock, flags);
1851 while (nr && tty->read_cnt) { 1904 while (nr && ldata->read_cnt) {
1852 int eol; 1905 int eol;
1853 1906
1854 eol = test_and_clear_bit(tty->read_tail, 1907 eol = test_and_clear_bit(ldata->read_tail,
1855 tty->read_flags); 1908 ldata->read_flags);
1856 c = tty->read_buf[tty->read_tail]; 1909 c = ldata->read_buf[ldata->read_tail];
1857 tty->read_tail = ((tty->read_tail+1) & 1910 ldata->read_tail = ((ldata->read_tail+1) &
1858 (N_TTY_BUF_SIZE-1)); 1911 (N_TTY_BUF_SIZE-1));
1859 tty->read_cnt--; 1912 ldata->read_cnt--;
1860 if (eol) { 1913 if (eol) {
1861 /* this test should be redundant: 1914 /* this test should be redundant:
1862 * we shouldn't be reading data if 1915 * we shouldn't be reading data if
1863 * canon_data is 0 1916 * canon_data is 0
1864 */ 1917 */
1865 if (--tty->canon_data < 0) 1918 if (--ldata->canon_data < 0)
1866 tty->canon_data = 0; 1919 ldata->canon_data = 0;
1867 } 1920 }
1868 spin_unlock_irqrestore(&tty->read_lock, flags); 1921 spin_unlock_irqrestore(&ldata->read_lock, flags);
1869 1922
1870 if (!eol || (c != __DISABLED_CHAR)) { 1923 if (!eol || (c != __DISABLED_CHAR)) {
1871 if (tty_put_user(tty, c, b++)) { 1924 if (tty_put_user(tty, c, b++)) {
1872 retval = -EFAULT; 1925 retval = -EFAULT;
1873 b--; 1926 b--;
1874 spin_lock_irqsave(&tty->read_lock, flags); 1927 spin_lock_irqsave(&ldata->read_lock, flags);
1875 break; 1928 break;
1876 } 1929 }
1877 nr--; 1930 nr--;
1878 } 1931 }
1879 if (eol) { 1932 if (eol) {
1880 tty_audit_push(tty); 1933 tty_audit_push(tty);
1881 spin_lock_irqsave(&tty->read_lock, flags); 1934 spin_lock_irqsave(&ldata->read_lock, flags);
1882 break; 1935 break;
1883 } 1936 }
1884 spin_lock_irqsave(&tty->read_lock, flags); 1937 spin_lock_irqsave(&ldata->read_lock, flags);
1885 } 1938 }
1886 spin_unlock_irqrestore(&tty->read_lock, flags); 1939 spin_unlock_irqrestore(&ldata->read_lock, flags);
1887 if (retval) 1940 if (retval)
1888 break; 1941 break;
1889 } else { 1942 } else {
@@ -1915,7 +1968,7 @@ do_it_again:
1915 if (time) 1968 if (time)
1916 timeout = time; 1969 timeout = time;
1917 } 1970 }
1918 mutex_unlock(&tty->atomic_read_lock); 1971 mutex_unlock(&ldata->atomic_read_lock);
1919 remove_wait_queue(&tty->read_wait, &wait); 1972 remove_wait_queue(&tty->read_wait, &wait);
1920 1973
1921 if (!waitqueue_active(&tty->read_wait)) 1974 if (!waitqueue_active(&tty->read_wait))
@@ -2076,19 +2129,19 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
2076 return mask; 2129 return mask;
2077} 2130}
2078 2131
2079static unsigned long inq_canon(struct tty_struct *tty) 2132static unsigned long inq_canon(struct n_tty_data *ldata)
2080{ 2133{
2081 int nr, head, tail; 2134 int nr, head, tail;
2082 2135
2083 if (!tty->canon_data) 2136 if (!ldata->canon_data)
2084 return 0; 2137 return 0;
2085 head = tty->canon_head; 2138 head = ldata->canon_head;
2086 tail = tty->read_tail; 2139 tail = ldata->read_tail;
2087 nr = (head - tail) & (N_TTY_BUF_SIZE-1); 2140 nr = (head - tail) & (N_TTY_BUF_SIZE-1);
2088 /* Skip EOF-chars.. */ 2141 /* Skip EOF-chars.. */
2089 while (head != tail) { 2142 while (head != tail) {
2090 if (test_bit(tail, tty->read_flags) && 2143 if (test_bit(tail, ldata->read_flags) &&
2091 tty->read_buf[tail] == __DISABLED_CHAR) 2144 ldata->read_buf[tail] == __DISABLED_CHAR)
2092 nr--; 2145 nr--;
2093 tail = (tail+1) & (N_TTY_BUF_SIZE-1); 2146 tail = (tail+1) & (N_TTY_BUF_SIZE-1);
2094 } 2147 }
@@ -2098,6 +2151,7 @@ static unsigned long inq_canon(struct tty_struct *tty)
2098static int n_tty_ioctl(struct tty_struct *tty, struct file *file, 2151static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
2099 unsigned int cmd, unsigned long arg) 2152 unsigned int cmd, unsigned long arg)
2100{ 2153{
2154 struct n_tty_data *ldata = tty->disc_data;
2101 int retval; 2155 int retval;
2102 2156
2103 switch (cmd) { 2157 switch (cmd) {
@@ -2105,9 +2159,9 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
2105 return put_user(tty_chars_in_buffer(tty), (int __user *) arg); 2159 return put_user(tty_chars_in_buffer(tty), (int __user *) arg);
2106 case TIOCINQ: 2160 case TIOCINQ:
2107 /* FIXME: Locking */ 2161 /* FIXME: Locking */
2108 retval = tty->read_cnt; 2162 retval = ldata->read_cnt;
2109 if (L_ICANON(tty)) 2163 if (L_ICANON(tty))
2110 retval = inq_canon(tty); 2164 retval = inq_canon(ldata);
2111 return put_user(retval, (unsigned int __user *) arg); 2165 return put_user(retval, (unsigned int __user *) arg);
2112 default: 2166 default:
2113 return n_tty_ioctl_helper(tty, file, cmd, arg); 2167 return n_tty_ioctl_helper(tty, file, cmd, arg);
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index a82b39939a9c..4219f040adb8 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -4,9 +4,6 @@
4 * Added support for a Unix98-style ptmx device. 4 * Added support for a Unix98-style ptmx device.
5 * -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998 5 * -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998
6 * 6 *
7 * When reading this code see also fs/devpts. In particular note that the
8 * driver_data field is used by the devpts side as a binding to the devpts
9 * inode.
10 */ 7 */
11 8
12#include <linux/module.h> 9#include <linux/module.h>
@@ -59,7 +56,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
59#ifdef CONFIG_UNIX98_PTYS 56#ifdef CONFIG_UNIX98_PTYS
60 if (tty->driver == ptm_driver) { 57 if (tty->driver == ptm_driver) {
61 mutex_lock(&devpts_mutex); 58 mutex_lock(&devpts_mutex);
62 devpts_pty_kill(tty->link); 59 devpts_pty_kill(tty->link->driver_data);
63 mutex_unlock(&devpts_mutex); 60 mutex_unlock(&devpts_mutex);
64 } 61 }
65#endif 62#endif
@@ -96,7 +93,7 @@ static void pty_unthrottle(struct tty_struct *tty)
96 93
97static int pty_space(struct tty_struct *to) 94static int pty_space(struct tty_struct *to)
98{ 95{
99 int n = 8192 - to->buf.memory_used; 96 int n = 8192 - to->port->buf.memory_used;
100 if (n < 0) 97 if (n < 0)
101 return 0; 98 return 0;
102 return n; 99 return n;
@@ -348,6 +345,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
348 tty_port_init(ports[1]); 345 tty_port_init(ports[1]);
349 o_tty->port = ports[0]; 346 o_tty->port = ports[0];
350 tty->port = ports[1]; 347 tty->port = ports[1];
348 o_tty->port->itty = o_tty;
351 349
352 tty_driver_kref_get(driver); 350 tty_driver_kref_get(driver);
353 tty->count++; 351 tty->count++;
@@ -366,8 +364,15 @@ err:
366 return retval; 364 return retval;
367} 365}
368 366
367/* this is called once with whichever end is closed last */
368static void pty_unix98_shutdown(struct tty_struct *tty)
369{
370 devpts_kill_index(tty->driver_data, tty->index);
371}
372
369static void pty_cleanup(struct tty_struct *tty) 373static void pty_cleanup(struct tty_struct *tty)
370{ 374{
375 tty->port->itty = NULL;
371 kfree(tty->port); 376 kfree(tty->port);
372} 377}
373 378
@@ -547,7 +552,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
547 struct tty_struct *tty; 552 struct tty_struct *tty;
548 553
549 mutex_lock(&devpts_mutex); 554 mutex_lock(&devpts_mutex);
550 tty = devpts_get_tty(pts_inode, idx); 555 tty = devpts_get_priv(pts_inode);
551 mutex_unlock(&devpts_mutex); 556 mutex_unlock(&devpts_mutex);
552 /* Master must be open before slave */ 557 /* Master must be open before slave */
553 if (!tty) 558 if (!tty)
@@ -581,6 +586,7 @@ static const struct tty_operations ptm_unix98_ops = {
581 .set_termios = pty_set_termios, 586 .set_termios = pty_set_termios,
582 .ioctl = pty_unix98_ioctl, 587 .ioctl = pty_unix98_ioctl,
583 .resize = pty_resize, 588 .resize = pty_resize,
589 .shutdown = pty_unix98_shutdown,
584 .cleanup = pty_cleanup 590 .cleanup = pty_cleanup
585}; 591};
586 592
@@ -596,6 +602,7 @@ static const struct tty_operations pty_unix98_ops = {
596 .chars_in_buffer = pty_chars_in_buffer, 602 .chars_in_buffer = pty_chars_in_buffer,
597 .unthrottle = pty_unthrottle, 603 .unthrottle = pty_unthrottle,
598 .set_termios = pty_set_termios, 604 .set_termios = pty_set_termios,
605 .shutdown = pty_unix98_shutdown,
599 .cleanup = pty_cleanup, 606 .cleanup = pty_cleanup,
600}; 607};
601 608
@@ -614,6 +621,7 @@ static const struct tty_operations pty_unix98_ops = {
614static int ptmx_open(struct inode *inode, struct file *filp) 621static int ptmx_open(struct inode *inode, struct file *filp)
615{ 622{
616 struct tty_struct *tty; 623 struct tty_struct *tty;
624 struct inode *slave_inode;
617 int retval; 625 int retval;
618 int index; 626 int index;
619 627
@@ -650,15 +658,21 @@ static int ptmx_open(struct inode *inode, struct file *filp)
650 658
651 tty_add_file(tty, filp); 659 tty_add_file(tty, filp);
652 660
653 retval = devpts_pty_new(inode, tty->link); 661 slave_inode = devpts_pty_new(inode,
654 if (retval) 662 MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index,
663 tty->link);
664 if (IS_ERR(slave_inode)) {
665 retval = PTR_ERR(slave_inode);
655 goto err_release; 666 goto err_release;
667 }
656 668
657 retval = ptm_driver->ops->open(tty, filp); 669 retval = ptm_driver->ops->open(tty, filp);
658 if (retval) 670 if (retval)
659 goto err_release; 671 goto err_release;
660 672
661 tty_unlock(tty); 673 tty_unlock(tty);
674 tty->driver_data = inode;
675 tty->link->driver_data = slave_inode;
662 return 0; 676 return 0;
663err_release: 677err_release:
664 tty_unlock(tty); 678 tty_unlock(tty);
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 3ba4234592bc..5ccbd90540cf 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -2349,16 +2349,14 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
2349 serial_port_out(port, UART_EFR, efr); 2349 serial_port_out(port, UART_EFR, efr);
2350 } 2350 }
2351 2351
2352#ifdef CONFIG_ARCH_OMAP1
2353 /* Workaround to enable 115200 baud on OMAP1510 internal ports */ 2352 /* Workaround to enable 115200 baud on OMAP1510 internal ports */
2354 if (cpu_is_omap1510() && is_omap_port(up)) { 2353 if (is_omap1510_8250(up)) {
2355 if (baud == 115200) { 2354 if (baud == 115200) {
2356 quot = 1; 2355 quot = 1;
2357 serial_port_out(port, UART_OMAP_OSC_12M_SEL, 1); 2356 serial_port_out(port, UART_OMAP_OSC_12M_SEL, 1);
2358 } else 2357 } else
2359 serial_port_out(port, UART_OMAP_OSC_12M_SEL, 0); 2358 serial_port_out(port, UART_OMAP_OSC_12M_SEL, 0);
2360 } 2359 }
2361#endif
2362 2360
2363 /* 2361 /*
2364 * For NatSemi, switch to bank 2 not bank 1, to avoid resetting EXCR2, 2362 * For NatSemi, switch to bank 2 not bank 1, to avoid resetting EXCR2,
@@ -2439,10 +2437,9 @@ static unsigned int serial8250_port_size(struct uart_8250_port *pt)
2439{ 2437{
2440 if (pt->port.iotype == UPIO_AU) 2438 if (pt->port.iotype == UPIO_AU)
2441 return 0x1000; 2439 return 0x1000;
2442#ifdef CONFIG_ARCH_OMAP1 2440 if (is_omap1_8250(pt))
2443 if (is_omap_port(pt))
2444 return 0x16 << pt->port.regshift; 2441 return 0x16 << pt->port.regshift;
2445#endif 2442
2446 return 8 << pt->port.regshift; 2443 return 8 << pt->port.regshift;
2447} 2444}
2448 2445
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 5a76f9c8d36b..3b4ea84898c2 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -106,3 +106,39 @@ static inline int serial8250_pnp_init(void) { return 0; }
106static inline void serial8250_pnp_exit(void) { } 106static inline void serial8250_pnp_exit(void) { }
107#endif 107#endif
108 108
109#ifdef CONFIG_ARCH_OMAP1
110static inline int is_omap1_8250(struct uart_8250_port *pt)
111{
112 int res;
113
114 switch (pt->port.mapbase) {
115 case OMAP1_UART1_BASE:
116 case OMAP1_UART2_BASE:
117 case OMAP1_UART3_BASE:
118 res = 1;
119 break;
120 default:
121 res = 0;
122 break;
123 }
124
125 return res;
126}
127
128static inline int is_omap1510_8250(struct uart_8250_port *pt)
129{
130 if (!cpu_is_omap1510())
131 return 0;
132
133 return is_omap1_8250(pt);
134}
135#else
136static inline int is_omap1_8250(struct uart_8250_port *pt)
137{
138 return 0;
139}
140static inline int is_omap1510_8250(struct uart_8250_port *pt)
141{
142 return 0;
143}
144#endif
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index eaafb98debed..843a150ba105 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
140 serial_out(port, UART_FCR, 0); /* no fifo */ 140 serial_out(port, UART_FCR, 0); /* no fifo */
141 serial_out(port, UART_MCR, 0x3); /* DTR + RTS */ 141 serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
142 142
143 divisor = port->uartclk / (16 * device->baud); 143 divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
144 c = serial_in(port, UART_LCR); 144 c = serial_in(port, UART_LCR);
145 serial_out(port, UART_LCR, c | UART_LCR_DLAB); 145 serial_out(port, UART_LCR, c | UART_LCR_DLAB);
146 serial_out(port, UART_DLL, divisor & 0xff); 146 serial_out(port, UART_DLL, divisor & 0xff);
diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index 8f1dd2cc00a8..f3d0edf46644 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -162,7 +162,7 @@ int __init hp300_setup_serial_console(void)
162static int __devinit hpdca_init_one(struct dio_dev *d, 162static int __devinit hpdca_init_one(struct dio_dev *d,
163 const struct dio_device_id *ent) 163 const struct dio_device_id *ent)
164{ 164{
165 struct uart_port port; 165 struct uart_8250_port uart;
166 int line; 166 int line;
167 167
168#ifdef CONFIG_SERIAL_8250_CONSOLE 168#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -174,19 +174,19 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
174 memset(&uart, 0, sizeof(uart)); 174 memset(&uart, 0, sizeof(uart));
175 175
176 /* Memory mapped I/O */ 176 /* Memory mapped I/O */
177 port.iotype = UPIO_MEM; 177 uart.port.iotype = UPIO_MEM;
178 port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; 178 uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
179 port.irq = d->ipl; 179 uart.port.irq = d->ipl;
180 port.uartclk = HPDCA_BAUD_BASE * 16; 180 uart.port.uartclk = HPDCA_BAUD_BASE * 16;
181 port.mapbase = (d->resource.start + UART_OFFSET); 181 uart.port.mapbase = (d->resource.start + UART_OFFSET);
182 port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE); 182 uart.port.membase = (char *)(uart.port.mapbase + DIO_VIRADDRBASE);
183 port.regshift = 1; 183 uart.port.regshift = 1;
184 port.dev = &d->dev; 184 uart.port.dev = &d->dev;
185 line = serial8250_register_8250_port(&uart); 185 line = serial8250_register_8250_port(&uart);
186 186
187 if (line < 0) { 187 if (line < 0) {
188 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d" 188 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d"
189 " irq %d failed\n", d->scode, port.irq); 189 " irq %d failed\n", d->scode, uart.port.irq);
190 return -ENOMEM; 190 return -ENOMEM;
191 } 191 }
192 192
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 233fbaaf2559..2a53be5f010d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1150,7 +1150,7 @@ config SERIAL_SC26XX_CONSOLE
1150 Support for Console on SC2681/SC2692 serial ports. 1150 Support for Console on SC2681/SC2692 serial ports.
1151 1151
1152config SERIAL_SCCNXP 1152config SERIAL_SCCNXP
1153 bool "SCCNXP serial port support" 1153 tristate "SCCNXP serial port support"
1154 depends on !SERIAL_SC26XX 1154 depends on !SERIAL_SC26XX
1155 select SERIAL_CORE 1155 select SERIAL_CORE
1156 default n 1156 default n
@@ -1162,7 +1162,7 @@ config SERIAL_SCCNXP
1162 1162
1163config SERIAL_SCCNXP_CONSOLE 1163config SERIAL_SCCNXP_CONSOLE
1164 bool "Console on SCCNXP serial port" 1164 bool "Console on SCCNXP serial port"
1165 depends on SERIAL_SCCNXP 1165 depends on SERIAL_SCCNXP=y
1166 select SERIAL_CORE_CONSOLE 1166 select SERIAL_CORE_CONSOLE
1167 help 1167 help
1168 Support for console on SCCNXP serial ports. 1168 Support for console on SCCNXP serial ports.
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 7f04717176aa..740458ca62cc 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -530,16 +530,16 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
530 switch (level) { 530 switch (level) {
531 case 3: 531 case 3:
532 if (!IS_ERR(ourport->baudclk)) 532 if (!IS_ERR(ourport->baudclk))
533 clk_disable(ourport->baudclk); 533 clk_disable_unprepare(ourport->baudclk);
534 534
535 clk_disable(ourport->clk); 535 clk_disable_unprepare(ourport->clk);
536 break; 536 break;
537 537
538 case 0: 538 case 0:
539 clk_enable(ourport->clk); 539 clk_prepare_enable(ourport->clk);
540 540
541 if (!IS_ERR(ourport->baudclk)) 541 if (!IS_ERR(ourport->baudclk))
542 clk_enable(ourport->baudclk); 542 clk_prepare_enable(ourport->baudclk);
543 543
544 break; 544 break;
545 default: 545 default:
@@ -713,11 +713,11 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
713 s3c24xx_serial_setsource(port, clk_sel); 713 s3c24xx_serial_setsource(port, clk_sel);
714 714
715 if (!IS_ERR(ourport->baudclk)) { 715 if (!IS_ERR(ourport->baudclk)) {
716 clk_disable(ourport->baudclk); 716 clk_disable_unprepare(ourport->baudclk);
717 ourport->baudclk = ERR_PTR(-EINVAL); 717 ourport->baudclk = ERR_PTR(-EINVAL);
718 } 718 }
719 719
720 clk_enable(clk); 720 clk_prepare_enable(clk);
721 721
722 ourport->baudclk = clk; 722 ourport->baudclk = clk;
723 ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; 723 ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
@@ -1287,9 +1287,9 @@ static int s3c24xx_serial_resume(struct device *dev)
1287 struct s3c24xx_uart_port *ourport = to_ourport(port); 1287 struct s3c24xx_uart_port *ourport = to_ourport(port);
1288 1288
1289 if (port) { 1289 if (port) {
1290 clk_enable(ourport->clk); 1290 clk_prepare_enable(ourport->clk);
1291 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port)); 1291 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
1292 clk_disable(ourport->clk); 1292 clk_disable_unprepare(ourport->clk);
1293 1293
1294 uart_resume_port(&s3c24xx_uart_drv, port); 1294 uart_resume_port(&s3c24xx_uart_drv, port);
1295 } 1295 }
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index b7086d004f5f..e821068cd95b 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -971,6 +971,7 @@ static const struct platform_device_id sccnxp_id_table[] = {
971 { "sc28202", SCCNXP_TYPE_SC28202 }, 971 { "sc28202", SCCNXP_TYPE_SC28202 },
972 { "sc68681", SCCNXP_TYPE_SC68681 }, 972 { "sc68681", SCCNXP_TYPE_SC68681 },
973 { "sc68692", SCCNXP_TYPE_SC68692 }, 973 { "sc68692", SCCNXP_TYPE_SC68692 },
974 { },
974}; 975};
975MODULE_DEVICE_TABLE(platform, sccnxp_id_table); 976MODULE_DEVICE_TABLE(platform, sccnxp_id_table);
976 977
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 9be296cf7295..6ee59001d61d 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -530,7 +530,8 @@ static inline int sci_rxd_in(struct uart_port *port)
530 if (s->cfg->port_reg <= 0) 530 if (s->cfg->port_reg <= 0)
531 return 1; 531 return 1;
532 532
533 return !!__raw_readb(s->cfg->port_reg); 533 /* Cast for ARM damage */
534 return !!__raw_readb((void __iomem *)s->cfg->port_reg);
534} 535}
535 536
536/* ********************************************************************** * 537/* ********************************************************************** *
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 05728894a88c..16ee6cee07da 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -452,6 +452,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
452 NULL, /* v */ 452 NULL, /* v */
453 &sysrq_showstate_blocked_op, /* w */ 453 &sysrq_showstate_blocked_op, /* w */
454 /* x: May be registered on ppc/powerpc for xmon */ 454 /* x: May be registered on ppc/powerpc for xmon */
455 /* x: May be registered on sparc64 for global PMU dump */
455 NULL, /* x */ 456 NULL, /* x */
456 /* y: May be registered on sparc64 for global register dump */ 457 /* y: May be registered on sparc64 for global register dump */
457 NULL, /* y */ 458 NULL, /* y */
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index b0b39b823ccf..6953dc82850c 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -23,7 +23,7 @@ struct tty_audit_buf {
23}; 23};
24 24
25static struct tty_audit_buf *tty_audit_buf_alloc(int major, int minor, 25static struct tty_audit_buf *tty_audit_buf_alloc(int major, int minor,
26 int icanon) 26 unsigned icanon)
27{ 27{
28 struct tty_audit_buf *buf; 28 struct tty_audit_buf *buf;
29 29
@@ -239,7 +239,8 @@ int tty_audit_push_task(struct task_struct *tsk, kuid_t loginuid, u32 sessionid)
239 * if TTY auditing is disabled or out of memory. Otherwise, return a new 239 * if TTY auditing is disabled or out of memory. Otherwise, return a new
240 * reference to the buffer. 240 * reference to the buffer.
241 */ 241 */
242static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty) 242static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
243 unsigned icanon)
243{ 244{
244 struct tty_audit_buf *buf, *buf2; 245 struct tty_audit_buf *buf, *buf2;
245 246
@@ -257,7 +258,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty)
257 258
258 buf2 = tty_audit_buf_alloc(tty->driver->major, 259 buf2 = tty_audit_buf_alloc(tty->driver->major,
259 tty->driver->minor_start + tty->index, 260 tty->driver->minor_start + tty->index,
260 tty->icanon); 261 icanon);
261 if (buf2 == NULL) { 262 if (buf2 == NULL) {
262 audit_log_lost("out of memory in TTY auditing"); 263 audit_log_lost("out of memory in TTY auditing");
263 return NULL; 264 return NULL;
@@ -287,7 +288,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty)
287 * Audit @data of @size from @tty, if necessary. 288 * Audit @data of @size from @tty, if necessary.
288 */ 289 */
289void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 290void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
290 size_t size) 291 size_t size, unsigned icanon)
291{ 292{
292 struct tty_audit_buf *buf; 293 struct tty_audit_buf *buf;
293 int major, minor; 294 int major, minor;
@@ -299,7 +300,7 @@ void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
299 && tty->driver->subtype == PTY_TYPE_MASTER) 300 && tty->driver->subtype == PTY_TYPE_MASTER)
300 return; 301 return;
301 302
302 buf = tty_audit_buf_get(tty); 303 buf = tty_audit_buf_get(tty, icanon);
303 if (!buf) 304 if (!buf)
304 return; 305 return;
305 306
@@ -307,11 +308,11 @@ void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
307 major = tty->driver->major; 308 major = tty->driver->major;
308 minor = tty->driver->minor_start + tty->index; 309 minor = tty->driver->minor_start + tty->index;
309 if (buf->major != major || buf->minor != minor 310 if (buf->major != major || buf->minor != minor
310 || buf->icanon != tty->icanon) { 311 || buf->icanon != icanon) {
311 tty_audit_buf_push_current(buf); 312 tty_audit_buf_push_current(buf);
312 buf->major = major; 313 buf->major = major;
313 buf->minor = minor; 314 buf->minor = minor;
314 buf->icanon = tty->icanon; 315 buf->icanon = icanon;
315 } 316 }
316 do { 317 do {
317 size_t run; 318 size_t run;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 91e326ffe7db..6cf87d7afb7e 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -27,19 +27,21 @@
27 * Locking: none 27 * Locking: none
28 */ 28 */
29 29
30void tty_buffer_free_all(struct tty_struct *tty) 30void tty_buffer_free_all(struct tty_port *port)
31{ 31{
32 struct tty_bufhead *buf = &port->buf;
32 struct tty_buffer *thead; 33 struct tty_buffer *thead;
33 while ((thead = tty->buf.head) != NULL) { 34
34 tty->buf.head = thead->next; 35 while ((thead = buf->head) != NULL) {
36 buf->head = thead->next;
35 kfree(thead); 37 kfree(thead);
36 } 38 }
37 while ((thead = tty->buf.free) != NULL) { 39 while ((thead = buf->free) != NULL) {
38 tty->buf.free = thead->next; 40 buf->free = thead->next;
39 kfree(thead); 41 kfree(thead);
40 } 42 }
41 tty->buf.tail = NULL; 43 buf->tail = NULL;
42 tty->buf.memory_used = 0; 44 buf->memory_used = 0;
43} 45}
44 46
45/** 47/**
@@ -54,11 +56,11 @@ void tty_buffer_free_all(struct tty_struct *tty)
54 * Locking: Caller must hold tty->buf.lock 56 * Locking: Caller must hold tty->buf.lock
55 */ 57 */
56 58
57static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size) 59static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
58{ 60{
59 struct tty_buffer *p; 61 struct tty_buffer *p;
60 62
61 if (tty->buf.memory_used + size > 65536) 63 if (port->buf.memory_used + size > 65536)
62 return NULL; 64 return NULL;
63 p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); 65 p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
64 if (p == NULL) 66 if (p == NULL)
@@ -70,7 +72,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size)
70 p->read = 0; 72 p->read = 0;
71 p->char_buf_ptr = (char *)(p->data); 73 p->char_buf_ptr = (char *)(p->data);
72 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; 74 p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size;
73 tty->buf.memory_used += size; 75 port->buf.memory_used += size;
74 return p; 76 return p;
75} 77}
76 78
@@ -85,17 +87,19 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size)
85 * Locking: Caller must hold tty->buf.lock 87 * Locking: Caller must hold tty->buf.lock
86 */ 88 */
87 89
88static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) 90static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
89{ 91{
92 struct tty_bufhead *buf = &port->buf;
93
90 /* Dumb strategy for now - should keep some stats */ 94 /* Dumb strategy for now - should keep some stats */
91 tty->buf.memory_used -= b->size; 95 buf->memory_used -= b->size;
92 WARN_ON(tty->buf.memory_used < 0); 96 WARN_ON(buf->memory_used < 0);
93 97
94 if (b->size >= 512) 98 if (b->size >= 512)
95 kfree(b); 99 kfree(b);
96 else { 100 else {
97 b->next = tty->buf.free; 101 b->next = buf->free;
98 tty->buf.free = b; 102 buf->free = b;
99 } 103 }
100} 104}
101 105
@@ -110,15 +114,16 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
110 * Locking: Caller must hold tty->buf.lock 114 * Locking: Caller must hold tty->buf.lock
111 */ 115 */
112 116
113static void __tty_buffer_flush(struct tty_struct *tty) 117static void __tty_buffer_flush(struct tty_port *port)
114{ 118{
119 struct tty_bufhead *buf = &port->buf;
115 struct tty_buffer *thead; 120 struct tty_buffer *thead;
116 121
117 while ((thead = tty->buf.head) != NULL) { 122 while ((thead = buf->head) != NULL) {
118 tty->buf.head = thead->next; 123 buf->head = thead->next;
119 tty_buffer_free(tty, thead); 124 tty_buffer_free(port, thead);
120 } 125 }
121 tty->buf.tail = NULL; 126 buf->tail = NULL;
122} 127}
123 128
124/** 129/**
@@ -134,21 +139,24 @@ static void __tty_buffer_flush(struct tty_struct *tty)
134 139
135void tty_buffer_flush(struct tty_struct *tty) 140void tty_buffer_flush(struct tty_struct *tty)
136{ 141{
142 struct tty_port *port = tty->port;
143 struct tty_bufhead *buf = &port->buf;
137 unsigned long flags; 144 unsigned long flags;
138 spin_lock_irqsave(&tty->buf.lock, flags); 145
146 spin_lock_irqsave(&buf->lock, flags);
139 147
140 /* If the data is being pushed to the tty layer then we can't 148 /* If the data is being pushed to the tty layer then we can't
141 process it here. Instead set a flag and the flush_to_ldisc 149 process it here. Instead set a flag and the flush_to_ldisc
142 path will process the flush request before it exits */ 150 path will process the flush request before it exits */
143 if (test_bit(TTY_FLUSHING, &tty->flags)) { 151 if (test_bit(TTYP_FLUSHING, &port->iflags)) {
144 set_bit(TTY_FLUSHPENDING, &tty->flags); 152 set_bit(TTYP_FLUSHPENDING, &port->iflags);
145 spin_unlock_irqrestore(&tty->buf.lock, flags); 153 spin_unlock_irqrestore(&buf->lock, flags);
146 wait_event(tty->read_wait, 154 wait_event(tty->read_wait,
147 test_bit(TTY_FLUSHPENDING, &tty->flags) == 0); 155 test_bit(TTYP_FLUSHPENDING, &port->iflags) == 0);
148 return; 156 return;
149 } else 157 } else
150 __tty_buffer_flush(tty); 158 __tty_buffer_flush(port);
151 spin_unlock_irqrestore(&tty->buf.lock, flags); 159 spin_unlock_irqrestore(&buf->lock, flags);
152} 160}
153 161
154/** 162/**
@@ -163,9 +171,9 @@ void tty_buffer_flush(struct tty_struct *tty)
163 * Locking: Caller must hold tty->buf.lock 171 * Locking: Caller must hold tty->buf.lock
164 */ 172 */
165 173
166static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) 174static struct tty_buffer *tty_buffer_find(struct tty_port *port, size_t size)
167{ 175{
168 struct tty_buffer **tbh = &tty->buf.free; 176 struct tty_buffer **tbh = &port->buf.free;
169 while ((*tbh) != NULL) { 177 while ((*tbh) != NULL) {
170 struct tty_buffer *t = *tbh; 178 struct tty_buffer *t = *tbh;
171 if (t->size >= size) { 179 if (t->size >= size) {
@@ -174,14 +182,14 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
174 t->used = 0; 182 t->used = 0;
175 t->commit = 0; 183 t->commit = 0;
176 t->read = 0; 184 t->read = 0;
177 tty->buf.memory_used += t->size; 185 port->buf.memory_used += t->size;
178 return t; 186 return t;
179 } 187 }
180 tbh = &((*tbh)->next); 188 tbh = &((*tbh)->next);
181 } 189 }
182 /* Round the buffer size out */ 190 /* Round the buffer size out */
183 size = (size + 0xFF) & ~0xFF; 191 size = (size + 0xFF) & ~0xFF;
184 return tty_buffer_alloc(tty, size); 192 return tty_buffer_alloc(port, size);
185 /* Should possibly check if this fails for the largest buffer we 193 /* Should possibly check if this fails for the largest buffer we
186 have queued and recycle that ? */ 194 have queued and recycle that ? */
187} 195}
@@ -192,29 +200,31 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
192 * 200 *
193 * Make at least size bytes of linear space available for the tty 201 * Make at least size bytes of linear space available for the tty
194 * buffer. If we fail return the size we managed to find. 202 * buffer. If we fail return the size we managed to find.
195 * Locking: Caller must hold tty->buf.lock 203 * Locking: Caller must hold port->buf.lock
196 */ 204 */
197static int __tty_buffer_request_room(struct tty_struct *tty, size_t size) 205static int __tty_buffer_request_room(struct tty_port *port, size_t size)
198{ 206{
207 struct tty_bufhead *buf = &port->buf;
199 struct tty_buffer *b, *n; 208 struct tty_buffer *b, *n;
200 int left; 209 int left;
201 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 210 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to
202 remove this conditional if its worth it. This would be invisible 211 remove this conditional if its worth it. This would be invisible
203 to the callers */ 212 to the callers */
204 if ((b = tty->buf.tail) != NULL) 213 b = buf->tail;
214 if (b != NULL)
205 left = b->size - b->used; 215 left = b->size - b->used;
206 else 216 else
207 left = 0; 217 left = 0;
208 218
209 if (left < size) { 219 if (left < size) {
210 /* This is the slow path - looking for new buffers to use */ 220 /* This is the slow path - looking for new buffers to use */
211 if ((n = tty_buffer_find(tty, size)) != NULL) { 221 if ((n = tty_buffer_find(port, size)) != NULL) {
212 if (b != NULL) { 222 if (b != NULL) {
213 b->next = n; 223 b->next = n;
214 b->commit = b->used; 224 b->commit = b->used;
215 } else 225 } else
216 tty->buf.head = n; 226 buf->head = n;
217 tty->buf.tail = n; 227 buf->tail = n;
218 } else 228 } else
219 size = left; 229 size = left;
220 } 230 }
@@ -231,16 +241,17 @@ static int __tty_buffer_request_room(struct tty_struct *tty, size_t size)
231 * Make at least size bytes of linear space available for the tty 241 * Make at least size bytes of linear space available for the tty
232 * buffer. If we fail return the size we managed to find. 242 * buffer. If we fail return the size we managed to find.
233 * 243 *
234 * Locking: Takes tty->buf.lock 244 * Locking: Takes port->buf.lock
235 */ 245 */
236int tty_buffer_request_room(struct tty_struct *tty, size_t size) 246int tty_buffer_request_room(struct tty_struct *tty, size_t size)
237{ 247{
248 struct tty_port *port = tty->port;
238 unsigned long flags; 249 unsigned long flags;
239 int length; 250 int length;
240 251
241 spin_lock_irqsave(&tty->buf.lock, flags); 252 spin_lock_irqsave(&port->buf.lock, flags);
242 length = __tty_buffer_request_room(tty, size); 253 length = __tty_buffer_request_room(port, size);
243 spin_unlock_irqrestore(&tty->buf.lock, flags); 254 spin_unlock_irqrestore(&port->buf.lock, flags);
244 return length; 255 return length;
245} 256}
246EXPORT_SYMBOL_GPL(tty_buffer_request_room); 257EXPORT_SYMBOL_GPL(tty_buffer_request_room);
@@ -255,12 +266,13 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room);
255 * Queue a series of bytes to the tty buffering. All the characters 266 * Queue a series of bytes to the tty buffering. All the characters
256 * passed are marked with the supplied flag. Returns the number added. 267 * passed are marked with the supplied flag. Returns the number added.
257 * 268 *
258 * Locking: Called functions may take tty->buf.lock 269 * Locking: Called functions may take port->buf.lock
259 */ 270 */
260 271
261int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, 272int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
262 const unsigned char *chars, char flag, size_t size) 273 const unsigned char *chars, char flag, size_t size)
263{ 274{
275 struct tty_bufhead *buf = &tty->port->buf;
264 int copied = 0; 276 int copied = 0;
265 do { 277 do {
266 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); 278 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
@@ -268,18 +280,18 @@ int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
268 unsigned long flags; 280 unsigned long flags;
269 struct tty_buffer *tb; 281 struct tty_buffer *tb;
270 282
271 spin_lock_irqsave(&tty->buf.lock, flags); 283 spin_lock_irqsave(&buf->lock, flags);
272 space = __tty_buffer_request_room(tty, goal); 284 space = __tty_buffer_request_room(tty->port, goal);
273 tb = tty->buf.tail; 285 tb = buf->tail;
274 /* If there is no space then tb may be NULL */ 286 /* If there is no space then tb may be NULL */
275 if (unlikely(space == 0)) { 287 if (unlikely(space == 0)) {
276 spin_unlock_irqrestore(&tty->buf.lock, flags); 288 spin_unlock_irqrestore(&buf->lock, flags);
277 break; 289 break;
278 } 290 }
279 memcpy(tb->char_buf_ptr + tb->used, chars, space); 291 memcpy(tb->char_buf_ptr + tb->used, chars, space);
280 memset(tb->flag_buf_ptr + tb->used, flag, space); 292 memset(tb->flag_buf_ptr + tb->used, flag, space);
281 tb->used += space; 293 tb->used += space;
282 spin_unlock_irqrestore(&tty->buf.lock, flags); 294 spin_unlock_irqrestore(&buf->lock, flags);
283 copied += space; 295 copied += space;
284 chars += space; 296 chars += space;
285 /* There is a small chance that we need to split the data over 297 /* There is a small chance that we need to split the data over
@@ -300,12 +312,13 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag);
300 * the flags array indicates the status of the character. Returns the 312 * the flags array indicates the status of the character. Returns the
301 * number added. 313 * number added.
302 * 314 *
303 * Locking: Called functions may take tty->buf.lock 315 * Locking: Called functions may take port->buf.lock
304 */ 316 */
305 317
306int tty_insert_flip_string_flags(struct tty_struct *tty, 318int tty_insert_flip_string_flags(struct tty_struct *tty,
307 const unsigned char *chars, const char *flags, size_t size) 319 const unsigned char *chars, const char *flags, size_t size)
308{ 320{
321 struct tty_bufhead *buf = &tty->port->buf;
309 int copied = 0; 322 int copied = 0;
310 do { 323 do {
311 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); 324 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
@@ -313,18 +326,18 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
313 unsigned long __flags; 326 unsigned long __flags;
314 struct tty_buffer *tb; 327 struct tty_buffer *tb;
315 328
316 spin_lock_irqsave(&tty->buf.lock, __flags); 329 spin_lock_irqsave(&buf->lock, __flags);
317 space = __tty_buffer_request_room(tty, goal); 330 space = __tty_buffer_request_room(tty->port, goal);
318 tb = tty->buf.tail; 331 tb = buf->tail;
319 /* If there is no space then tb may be NULL */ 332 /* If there is no space then tb may be NULL */
320 if (unlikely(space == 0)) { 333 if (unlikely(space == 0)) {
321 spin_unlock_irqrestore(&tty->buf.lock, __flags); 334 spin_unlock_irqrestore(&buf->lock, __flags);
322 break; 335 break;
323 } 336 }
324 memcpy(tb->char_buf_ptr + tb->used, chars, space); 337 memcpy(tb->char_buf_ptr + tb->used, chars, space);
325 memcpy(tb->flag_buf_ptr + tb->used, flags, space); 338 memcpy(tb->flag_buf_ptr + tb->used, flags, space);
326 tb->used += space; 339 tb->used += space;
327 spin_unlock_irqrestore(&tty->buf.lock, __flags); 340 spin_unlock_irqrestore(&buf->lock, __flags);
328 copied += space; 341 copied += space;
329 chars += space; 342 chars += space;
330 flags += space; 343 flags += space;
@@ -342,18 +355,23 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);
342 * Takes any pending buffers and transfers their ownership to the 355 * Takes any pending buffers and transfers their ownership to the
343 * ldisc side of the queue. It then schedules those characters for 356 * ldisc side of the queue. It then schedules those characters for
344 * processing by the line discipline. 357 * processing by the line discipline.
358 * Note that this function can only be used when the low_latency flag
359 * is unset. Otherwise the workqueue won't be flushed.
345 * 360 *
346 * Locking: Takes tty->buf.lock 361 * Locking: Takes port->buf.lock
347 */ 362 */
348 363
349void tty_schedule_flip(struct tty_struct *tty) 364void tty_schedule_flip(struct tty_struct *tty)
350{ 365{
366 struct tty_bufhead *buf = &tty->port->buf;
351 unsigned long flags; 367 unsigned long flags;
352 spin_lock_irqsave(&tty->buf.lock, flags); 368 WARN_ON(tty->low_latency);
353 if (tty->buf.tail != NULL) 369
354 tty->buf.tail->commit = tty->buf.tail->used; 370 spin_lock_irqsave(&buf->lock, flags);
355 spin_unlock_irqrestore(&tty->buf.lock, flags); 371 if (buf->tail != NULL)
356 schedule_work(&tty->buf.work); 372 buf->tail->commit = buf->tail->used;
373 spin_unlock_irqrestore(&buf->lock, flags);
374 schedule_work(&buf->work);
357} 375}
358EXPORT_SYMBOL(tty_schedule_flip); 376EXPORT_SYMBOL(tty_schedule_flip);
359 377
@@ -369,26 +387,27 @@ EXPORT_SYMBOL(tty_schedule_flip);
369 * that need their own block copy routines into the buffer. There is no 387 * that need their own block copy routines into the buffer. There is no
370 * guarantee the buffer is a DMA target! 388 * guarantee the buffer is a DMA target!
371 * 389 *
372 * Locking: May call functions taking tty->buf.lock 390 * Locking: May call functions taking port->buf.lock
373 */ 391 */
374 392
375int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, 393int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars,
376 size_t size) 394 size_t size)
377{ 395{
396 struct tty_bufhead *buf = &tty->port->buf;
378 int space; 397 int space;
379 unsigned long flags; 398 unsigned long flags;
380 struct tty_buffer *tb; 399 struct tty_buffer *tb;
381 400
382 spin_lock_irqsave(&tty->buf.lock, flags); 401 spin_lock_irqsave(&buf->lock, flags);
383 space = __tty_buffer_request_room(tty, size); 402 space = __tty_buffer_request_room(tty->port, size);
384 403
385 tb = tty->buf.tail; 404 tb = buf->tail;
386 if (likely(space)) { 405 if (likely(space)) {
387 *chars = tb->char_buf_ptr + tb->used; 406 *chars = tb->char_buf_ptr + tb->used;
388 memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); 407 memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space);
389 tb->used += space; 408 tb->used += space;
390 } 409 }
391 spin_unlock_irqrestore(&tty->buf.lock, flags); 410 spin_unlock_irqrestore(&buf->lock, flags);
392 return space; 411 return space;
393} 412}
394EXPORT_SYMBOL_GPL(tty_prepare_flip_string); 413EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
@@ -406,26 +425,27 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
406 * that need their own block copy routines into the buffer. There is no 425 * that need their own block copy routines into the buffer. There is no
407 * guarantee the buffer is a DMA target! 426 * guarantee the buffer is a DMA target!
408 * 427 *
409 * Locking: May call functions taking tty->buf.lock 428 * Locking: May call functions taking port->buf.lock
410 */ 429 */
411 430
412int tty_prepare_flip_string_flags(struct tty_struct *tty, 431int tty_prepare_flip_string_flags(struct tty_struct *tty,
413 unsigned char **chars, char **flags, size_t size) 432 unsigned char **chars, char **flags, size_t size)
414{ 433{
434 struct tty_bufhead *buf = &tty->port->buf;
415 int space; 435 int space;
416 unsigned long __flags; 436 unsigned long __flags;
417 struct tty_buffer *tb; 437 struct tty_buffer *tb;
418 438
419 spin_lock_irqsave(&tty->buf.lock, __flags); 439 spin_lock_irqsave(&buf->lock, __flags);
420 space = __tty_buffer_request_room(tty, size); 440 space = __tty_buffer_request_room(tty->port, size);
421 441
422 tb = tty->buf.tail; 442 tb = buf->tail;
423 if (likely(space)) { 443 if (likely(space)) {
424 *chars = tb->char_buf_ptr + tb->used; 444 *chars = tb->char_buf_ptr + tb->used;
425 *flags = tb->flag_buf_ptr + tb->used; 445 *flags = tb->flag_buf_ptr + tb->used;
426 tb->used += space; 446 tb->used += space;
427 } 447 }
428 spin_unlock_irqrestore(&tty->buf.lock, __flags); 448 spin_unlock_irqrestore(&buf->lock, __flags);
429 return space; 449 return space;
430} 450}
431EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags); 451EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
@@ -446,20 +466,25 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags);
446 466
447static void flush_to_ldisc(struct work_struct *work) 467static void flush_to_ldisc(struct work_struct *work)
448{ 468{
449 struct tty_struct *tty = 469 struct tty_port *port = container_of(work, struct tty_port, buf.work);
450 container_of(work, struct tty_struct, buf.work); 470 struct tty_bufhead *buf = &port->buf;
471 struct tty_struct *tty;
451 unsigned long flags; 472 unsigned long flags;
452 struct tty_ldisc *disc; 473 struct tty_ldisc *disc;
453 474
475 tty = port->itty;
476 if (WARN_RATELIMIT(tty == NULL, "tty is NULL"))
477 return;
478
454 disc = tty_ldisc_ref(tty); 479 disc = tty_ldisc_ref(tty);
455 if (disc == NULL) /* !TTY_LDISC */ 480 if (disc == NULL) /* !TTY_LDISC */
456 return; 481 return;
457 482
458 spin_lock_irqsave(&tty->buf.lock, flags); 483 spin_lock_irqsave(&buf->lock, flags);
459 484
460 if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { 485 if (!test_and_set_bit(TTYP_FLUSHING, &port->iflags)) {
461 struct tty_buffer *head; 486 struct tty_buffer *head;
462 while ((head = tty->buf.head) != NULL) { 487 while ((head = buf->head) != NULL) {
463 int count; 488 int count;
464 char *char_buf; 489 char *char_buf;
465 unsigned char *flag_buf; 490 unsigned char *flag_buf;
@@ -468,14 +493,14 @@ static void flush_to_ldisc(struct work_struct *work)
468 if (!count) { 493 if (!count) {
469 if (head->next == NULL) 494 if (head->next == NULL)
470 break; 495 break;
471 tty->buf.head = head->next; 496 buf->head = head->next;
472 tty_buffer_free(tty, head); 497 tty_buffer_free(port, head);
473 continue; 498 continue;
474 } 499 }
475 /* Ldisc or user is trying to flush the buffers 500 /* Ldisc or user is trying to flush the buffers
476 we are feeding to the ldisc, stop feeding the 501 we are feeding to the ldisc, stop feeding the
477 line discipline as we want to empty the queue */ 502 line discipline as we want to empty the queue */
478 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) 503 if (test_bit(TTYP_FLUSHPENDING, &port->iflags))
479 break; 504 break;
480 if (!tty->receive_room) 505 if (!tty->receive_room)
481 break; 506 break;
@@ -484,22 +509,22 @@ static void flush_to_ldisc(struct work_struct *work)
484 char_buf = head->char_buf_ptr + head->read; 509 char_buf = head->char_buf_ptr + head->read;
485 flag_buf = head->flag_buf_ptr + head->read; 510 flag_buf = head->flag_buf_ptr + head->read;
486 head->read += count; 511 head->read += count;
487 spin_unlock_irqrestore(&tty->buf.lock, flags); 512 spin_unlock_irqrestore(&buf->lock, flags);
488 disc->ops->receive_buf(tty, char_buf, 513 disc->ops->receive_buf(tty, char_buf,
489 flag_buf, count); 514 flag_buf, count);
490 spin_lock_irqsave(&tty->buf.lock, flags); 515 spin_lock_irqsave(&buf->lock, flags);
491 } 516 }
492 clear_bit(TTY_FLUSHING, &tty->flags); 517 clear_bit(TTYP_FLUSHING, &port->iflags);
493 } 518 }
494 519
495 /* We may have a deferred request to flush the input buffer, 520 /* We may have a deferred request to flush the input buffer,
496 if so pull the chain under the lock and empty the queue */ 521 if so pull the chain under the lock and empty the queue */
497 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { 522 if (test_bit(TTYP_FLUSHPENDING, &port->iflags)) {
498 __tty_buffer_flush(tty); 523 __tty_buffer_flush(port);
499 clear_bit(TTY_FLUSHPENDING, &tty->flags); 524 clear_bit(TTYP_FLUSHPENDING, &port->iflags);
500 wake_up(&tty->read_wait); 525 wake_up(&tty->read_wait);
501 } 526 }
502 spin_unlock_irqrestore(&tty->buf.lock, flags); 527 spin_unlock_irqrestore(&buf->lock, flags);
503 528
504 tty_ldisc_deref(disc); 529 tty_ldisc_deref(disc);
505} 530}
@@ -514,7 +539,8 @@ static void flush_to_ldisc(struct work_struct *work)
514 */ 539 */
515void tty_flush_to_ldisc(struct tty_struct *tty) 540void tty_flush_to_ldisc(struct tty_struct *tty)
516{ 541{
517 flush_work(&tty->buf.work); 542 if (!tty->low_latency)
543 flush_work(&tty->port->buf.work);
518} 544}
519 545
520/** 546/**
@@ -532,16 +558,18 @@ void tty_flush_to_ldisc(struct tty_struct *tty)
532 558
533void tty_flip_buffer_push(struct tty_struct *tty) 559void tty_flip_buffer_push(struct tty_struct *tty)
534{ 560{
561 struct tty_bufhead *buf = &tty->port->buf;
535 unsigned long flags; 562 unsigned long flags;
536 spin_lock_irqsave(&tty->buf.lock, flags); 563
537 if (tty->buf.tail != NULL) 564 spin_lock_irqsave(&buf->lock, flags);
538 tty->buf.tail->commit = tty->buf.tail->used; 565 if (buf->tail != NULL)
539 spin_unlock_irqrestore(&tty->buf.lock, flags); 566 buf->tail->commit = buf->tail->used;
567 spin_unlock_irqrestore(&buf->lock, flags);
540 568
541 if (tty->low_latency) 569 if (tty->low_latency)
542 flush_to_ldisc(&tty->buf.work); 570 flush_to_ldisc(&buf->work);
543 else 571 else
544 schedule_work(&tty->buf.work); 572 schedule_work(&buf->work);
545} 573}
546EXPORT_SYMBOL(tty_flip_buffer_push); 574EXPORT_SYMBOL(tty_flip_buffer_push);
547 575
@@ -555,13 +583,15 @@ EXPORT_SYMBOL(tty_flip_buffer_push);
555 * Locking: none 583 * Locking: none
556 */ 584 */
557 585
558void tty_buffer_init(struct tty_struct *tty) 586void tty_buffer_init(struct tty_port *port)
559{ 587{
560 spin_lock_init(&tty->buf.lock); 588 struct tty_bufhead *buf = &port->buf;
561 tty->buf.head = NULL; 589
562 tty->buf.tail = NULL; 590 spin_lock_init(&buf->lock);
563 tty->buf.free = NULL; 591 buf->head = NULL;
564 tty->buf.memory_used = 0; 592 buf->tail = NULL;
565 INIT_WORK(&tty->buf.work, flush_to_ldisc); 593 buf->free = NULL;
594 buf->memory_used = 0;
595 INIT_WORK(&buf->work, flush_to_ldisc);
566} 596}
567 597
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 2ea176b2280e..a3eba7f359ed 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -186,7 +186,6 @@ void free_tty_struct(struct tty_struct *tty)
186 if (tty->dev) 186 if (tty->dev)
187 put_device(tty->dev); 187 put_device(tty->dev);
188 kfree(tty->write_buf); 188 kfree(tty->write_buf);
189 tty_buffer_free_all(tty);
190 tty->magic = 0xDEADDEAD; 189 tty->magic = 0xDEADDEAD;
191 kfree(tty); 190 kfree(tty);
192} 191}
@@ -1417,6 +1416,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
1417 "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n", 1416 "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
1418 __func__, tty->driver->name); 1417 __func__, tty->driver->name);
1419 1418
1419 tty->port->itty = tty;
1420
1420 /* 1421 /*
1421 * Structures all installed ... call the ldisc open routines. 1422 * Structures all installed ... call the ldisc open routines.
1422 * If we fail here just call release_tty to clean up. No need 1423 * If we fail here just call release_tty to clean up. No need
@@ -1552,6 +1553,7 @@ static void release_tty(struct tty_struct *tty, int idx)
1552 tty->ops->shutdown(tty); 1553 tty->ops->shutdown(tty);
1553 tty_free_termios(tty); 1554 tty_free_termios(tty);
1554 tty_driver_remove_tty(tty->driver, tty); 1555 tty_driver_remove_tty(tty->driver, tty);
1556 tty->port->itty = NULL;
1555 1557
1556 if (tty->link) 1558 if (tty->link)
1557 tty_kref_put(tty->link); 1559 tty_kref_put(tty->link);
@@ -1625,7 +1627,6 @@ int tty_release(struct inode *inode, struct file *filp)
1625 struct tty_struct *tty = file_tty(filp); 1627 struct tty_struct *tty = file_tty(filp);
1626 struct tty_struct *o_tty; 1628 struct tty_struct *o_tty;
1627 int pty_master, tty_closing, o_tty_closing, do_sleep; 1629 int pty_master, tty_closing, o_tty_closing, do_sleep;
1628 int devpts;
1629 int idx; 1630 int idx;
1630 char buf[64]; 1631 char buf[64];
1631 1632
@@ -1640,7 +1641,6 @@ int tty_release(struct inode *inode, struct file *filp)
1640 idx = tty->index; 1641 idx = tty->index;
1641 pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && 1642 pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
1642 tty->driver->subtype == PTY_TYPE_MASTER); 1643 tty->driver->subtype == PTY_TYPE_MASTER);
1643 devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
1644 /* Review: parallel close */ 1644 /* Review: parallel close */
1645 o_tty = tty->link; 1645 o_tty = tty->link;
1646 1646
@@ -1799,9 +1799,6 @@ int tty_release(struct inode *inode, struct file *filp)
1799 release_tty(tty, idx); 1799 release_tty(tty, idx);
1800 mutex_unlock(&tty_mutex); 1800 mutex_unlock(&tty_mutex);
1801 1801
1802 /* Make this pty number available for reallocation */
1803 if (devpts)
1804 devpts_kill_index(inode, idx);
1805 return 0; 1802 return 0;
1806} 1803}
1807 1804
@@ -2937,19 +2934,13 @@ void initialize_tty_struct(struct tty_struct *tty,
2937 tty_ldisc_init(tty); 2934 tty_ldisc_init(tty);
2938 tty->session = NULL; 2935 tty->session = NULL;
2939 tty->pgrp = NULL; 2936 tty->pgrp = NULL;
2940 tty->overrun_time = jiffies;
2941 tty_buffer_init(tty);
2942 mutex_init(&tty->legacy_mutex); 2937 mutex_init(&tty->legacy_mutex);
2943 mutex_init(&tty->termios_mutex); 2938 mutex_init(&tty->termios_mutex);
2944 mutex_init(&tty->ldisc_mutex); 2939 mutex_init(&tty->ldisc_mutex);
2945 init_waitqueue_head(&tty->write_wait); 2940 init_waitqueue_head(&tty->write_wait);
2946 init_waitqueue_head(&tty->read_wait); 2941 init_waitqueue_head(&tty->read_wait);
2947 INIT_WORK(&tty->hangup_work, do_tty_hangup); 2942 INIT_WORK(&tty->hangup_work, do_tty_hangup);
2948 mutex_init(&tty->atomic_read_lock);
2949 mutex_init(&tty->atomic_write_lock); 2943 mutex_init(&tty->atomic_write_lock);
2950 mutex_init(&tty->output_lock);
2951 mutex_init(&tty->echo_lock);
2952 spin_lock_init(&tty->read_lock);
2953 spin_lock_init(&tty->ctrl_lock); 2944 spin_lock_init(&tty->ctrl_lock);
2954 INIT_LIST_HEAD(&tty->tty_files); 2945 INIT_LIST_HEAD(&tty->tty_files);
2955 INIT_WORK(&tty->SAK_work, do_SAK_work); 2946 INIT_WORK(&tty->SAK_work, do_SAK_work);
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 0f2a2c5e704c..f4e6754525dc 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -512,7 +512,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
512static int tty_ldisc_halt(struct tty_struct *tty) 512static int tty_ldisc_halt(struct tty_struct *tty)
513{ 513{
514 clear_bit(TTY_LDISC, &tty->flags); 514 clear_bit(TTY_LDISC, &tty->flags);
515 return cancel_work_sync(&tty->buf.work); 515 return cancel_work_sync(&tty->port->buf.work);
516} 516}
517 517
518/** 518/**
@@ -525,7 +525,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
525{ 525{
526 flush_work(&tty->hangup_work); 526 flush_work(&tty->hangup_work);
527 flush_work(&tty->SAK_work); 527 flush_work(&tty->SAK_work);
528 flush_work(&tty->buf.work); 528 flush_work(&tty->port->buf.work);
529} 529}
530 530
531/** 531/**
@@ -704,9 +704,9 @@ enable:
704 /* Restart the work queue in case no characters kick it off. Safe if 704 /* Restart the work queue in case no characters kick it off. Safe if
705 already running */ 705 already running */
706 if (work) 706 if (work)
707 schedule_work(&tty->buf.work); 707 schedule_work(&tty->port->buf.work);
708 if (o_work) 708 if (o_work)
709 schedule_work(&o_tty->buf.work); 709 schedule_work(&o_tty->port->buf.work);
710 mutex_unlock(&tty->ldisc_mutex); 710 mutex_unlock(&tty->ldisc_mutex);
711 tty_unlock(tty); 711 tty_unlock(tty);
712 return retval; 712 return retval;
@@ -817,7 +817,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
817 */ 817 */
818 clear_bit(TTY_LDISC, &tty->flags); 818 clear_bit(TTY_LDISC, &tty->flags);
819 tty_unlock(tty); 819 tty_unlock(tty);
820 cancel_work_sync(&tty->buf.work); 820 cancel_work_sync(&tty->port->buf.work);
821 mutex_unlock(&tty->ldisc_mutex); 821 mutex_unlock(&tty->ldisc_mutex);
822retry: 822retry:
823 tty_lock(tty); 823 tty_lock(tty);
@@ -897,6 +897,11 @@ int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty)
897 897
898static void tty_ldisc_kill(struct tty_struct *tty) 898static void tty_ldisc_kill(struct tty_struct *tty)
899{ 899{
900 /* There cannot be users from userspace now. But there still might be
901 * drivers holding a reference via tty_ldisc_ref. Do not steal them the
902 * ldisc until they are done. */
903 tty_ldisc_wait_idle(tty, MAX_SCHEDULE_TIMEOUT);
904
900 mutex_lock(&tty->ldisc_mutex); 905 mutex_lock(&tty->ldisc_mutex);
901 /* 906 /*
902 * Now kill off the ldisc 907 * Now kill off the ldisc
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index d7bdd8d0c23f..416b42f7c346 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -21,6 +21,7 @@
21void tty_port_init(struct tty_port *port) 21void tty_port_init(struct tty_port *port)
22{ 22{
23 memset(port, 0, sizeof(*port)); 23 memset(port, 0, sizeof(*port));
24 tty_buffer_init(port);
24 init_waitqueue_head(&port->open_wait); 25 init_waitqueue_head(&port->open_wait);
25 init_waitqueue_head(&port->close_wait); 26 init_waitqueue_head(&port->close_wait);
26 init_waitqueue_head(&port->delta_msr_wait); 27 init_waitqueue_head(&port->delta_msr_wait);
@@ -126,6 +127,7 @@ static void tty_port_destructor(struct kref *kref)
126 struct tty_port *port = container_of(kref, struct tty_port, kref); 127 struct tty_port *port = container_of(kref, struct tty_port, kref);
127 if (port->xmit_buf) 128 if (port->xmit_buf)
128 free_page((unsigned long)port->xmit_buf); 129 free_page((unsigned long)port->xmit_buf);
130 tty_buffer_free_all(port);
129 if (port->ops->destruct) 131 if (port->ops->destruct)
130 port->ops->destruct(port); 132 port->ops->destruct(port);
131 else 133 else
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 8e9b4be97a2d..60b7b6926059 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -341,15 +341,11 @@ int paste_selection(struct tty_struct *tty)
341 struct tty_ldisc *ld; 341 struct tty_ldisc *ld;
342 DECLARE_WAITQUEUE(wait, current); 342 DECLARE_WAITQUEUE(wait, current);
343 343
344
345 console_lock(); 344 console_lock();
346 poke_blanked_console(); 345 poke_blanked_console();
347 console_unlock(); 346 console_unlock();
348 347
349 /* FIXME: wtf is this supposed to achieve ? */ 348 ld = tty_ldisc_ref_wait(tty);
350 ld = tty_ldisc_ref(tty);
351 if (!ld)
352 ld = tty_ldisc_ref_wait(tty);
353 349
354 /* FIXME: this is completely unsafe */ 350 /* FIXME: this is completely unsafe */
355 add_wait_queue(&vc->paste_wait, &wait); 351 add_wait_queue(&vc->paste_wait, &wait);
@@ -361,8 +357,7 @@ int paste_selection(struct tty_struct *tty)
361 } 357 }
362 count = sel_buffer_lth - pasted; 358 count = sel_buffer_lth - pasted;
363 count = min(count, tty->receive_room); 359 count = min(count, tty->receive_room);
364 tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, 360 ld->ops->receive_buf(tty, sel_buffer + pasted, NULL, count);
365 NULL, count);
366 pasted += count; 361 pasted += count;
367 } 362 }
368 remove_wait_queue(&vc->paste_wait, &wait); 363 remove_wait_queue(&vc->paste_wait, &wait);
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 981f2132d128..6e49ec6f3adc 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -817,10 +817,6 @@ static const __u32 acm_tty_speed[] = {
817 2500000, 3000000, 3500000, 4000000 817 2500000, 3000000, 3500000, 4000000
818}; 818};
819 819
820static const __u8 acm_tty_size[] = {
821 5, 6, 7, 8
822};
823
824static void acm_tty_set_termios(struct tty_struct *tty, 820static void acm_tty_set_termios(struct tty_struct *tty,
825 struct ktermios *termios_old) 821 struct ktermios *termios_old)
826{ 822{
@@ -834,7 +830,21 @@ static void acm_tty_set_termios(struct tty_struct *tty,
834 newline.bParityType = termios->c_cflag & PARENB ? 830 newline.bParityType = termios->c_cflag & PARENB ?
835 (termios->c_cflag & PARODD ? 1 : 2) + 831 (termios->c_cflag & PARODD ? 1 : 2) +
836 (termios->c_cflag & CMSPAR ? 2 : 0) : 0; 832 (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
837 newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4]; 833 switch (termios->c_cflag & CSIZE) {
834 case CS5:
835 newline.bDataBits = 5;
836 break;
837 case CS6:
838 newline.bDataBits = 6;
839 break;
840 case CS7:
841 newline.bDataBits = 7;
842 break;
843 case CS8:
844 default:
845 newline.bDataBits = 8;
846 break;
847 }
838 /* FIXME: Needs to clear unsupported bits in the termios */ 848 /* FIXME: Needs to clear unsupported bits in the termios */
839 acm->clocal = ((termios->c_cflag & CLOCAL) != 0); 849 acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
840 850
@@ -1233,7 +1243,7 @@ made_compressed_probe:
1233 1243
1234 if (usb_endpoint_xfer_int(epwrite)) 1244 if (usb_endpoint_xfer_int(epwrite))
1235 usb_fill_int_urb(snd->urb, usb_dev, 1245 usb_fill_int_urb(snd->urb, usb_dev,
1236 usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), 1246 usb_sndintpipe(usb_dev, epwrite->bEndpointAddress),
1237 NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval); 1247 NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval);
1238 else 1248 else
1239 usb_fill_bulk_urb(snd->urb, usb_dev, 1249 usb_fill_bulk_urb(snd->urb, usb_dev,
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e0356cb859b5..b78fbe222b72 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1348,6 +1348,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1348 ret = -EFAULT; 1348 ret = -EFAULT;
1349 goto error; 1349 goto error;
1350 } 1350 }
1351 uurb->buffer += u;
1351 } 1352 }
1352 totlen -= u; 1353 totlen -= u;
1353 } 1354 }
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index ddd820d25288..6056db7af410 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -367,6 +367,10 @@ static int usb_probe_interface(struct device *dev)
367 intf->condition = USB_INTERFACE_UNBOUND; 367 intf->condition = USB_INTERFACE_UNBOUND;
368 usb_cancel_queued_reset(intf); 368 usb_cancel_queued_reset(intf);
369 369
370 /* If the LPM disable succeeded, balance the ref counts. */
371 if (!lpm_disable_error)
372 usb_unlocked_enable_lpm(udev);
373
370 /* Unbound interfaces are always runtime-PM-disabled and -suspended */ 374 /* Unbound interfaces are always runtime-PM-disabled and -suspended */
371 if (driver->supports_autosuspend) 375 if (driver->supports_autosuspend)
372 pm_runtime_disable(dev); 376 pm_runtime_disable(dev);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 673ee4696262..64854d76f529 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3241,8 +3241,7 @@ static int usb_req_set_sel(struct usb_device *udev, enum usb3_link_state state)
3241 (state == USB3_LPM_U2 && 3241 (state == USB3_LPM_U2 &&
3242 (u2_sel > USB3_LPM_MAX_U2_SEL_PEL || 3242 (u2_sel > USB3_LPM_MAX_U2_SEL_PEL ||
3243 u2_pel > USB3_LPM_MAX_U2_SEL_PEL))) { 3243 u2_pel > USB3_LPM_MAX_U2_SEL_PEL))) {
3244 dev_dbg(&udev->dev, "Device-initiated %s disabled due " 3244 dev_dbg(&udev->dev, "Device-initiated %s disabled due to long SEL %llu us or PEL %llu us\n",
3245 "to long SEL %llu ms or PEL %llu ms\n",
3246 usb3_lpm_names[state], u1_sel, u1_pel); 3245 usb3_lpm_names[state], u1_sel, u1_pel);
3247 return -EINVAL; 3246 return -EINVAL;
3248 } 3247 }
@@ -3320,16 +3319,6 @@ static int usb_set_device_initiated_lpm(struct usb_device *udev,
3320 3319
3321 if (enable) { 3320 if (enable) {
3322 /* 3321 /*
3323 * First, let the device know about the exit latencies
3324 * associated with the link state we're about to enable.
3325 */
3326 ret = usb_req_set_sel(udev, state);
3327 if (ret < 0) {
3328 dev_warn(&udev->dev, "Set SEL for device-initiated "
3329 "%s failed.\n", usb3_lpm_names[state]);
3330 return -EBUSY;
3331 }
3332 /*
3333 * Now send the control transfer to enable device-initiated LPM 3322 * Now send the control transfer to enable device-initiated LPM
3334 * for either U1 or U2. 3323 * for either U1 or U2.
3335 */ 3324 */
@@ -3414,7 +3403,28 @@ static int usb_set_lpm_timeout(struct usb_device *udev,
3414static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, 3403static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
3415 enum usb3_link_state state) 3404 enum usb3_link_state state)
3416{ 3405{
3417 int timeout; 3406 int timeout, ret;
3407 __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat;
3408 __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat;
3409
3410 /* If the device says it doesn't have *any* exit latency to come out of
3411 * U1 or U2, it's probably lying. Assume it doesn't implement that link
3412 * state.
3413 */
3414 if ((state == USB3_LPM_U1 && u1_mel == 0) ||
3415 (state == USB3_LPM_U2 && u2_mel == 0))
3416 return;
3417
3418 /*
3419 * First, let the device know about the exit latencies
3420 * associated with the link state we're about to enable.
3421 */
3422 ret = usb_req_set_sel(udev, state);
3423 if (ret < 0) {
3424 dev_warn(&udev->dev, "Set SEL for device-initiated %s failed.\n",
3425 usb3_lpm_names[state]);
3426 return;
3427 }
3418 3428
3419 /* We allow the host controller to set the U1/U2 timeout internally 3429 /* We allow the host controller to set the U1/U2 timeout internally
3420 * first, so that it can change its schedule to account for the 3430 * first, so that it can change its schedule to account for the
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b415c0c859d3..c14ebc975ba4 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -409,6 +409,10 @@ static void dwc3_core_exit(struct dwc3 *dwc)
409{ 409{
410 dwc3_event_buffers_cleanup(dwc); 410 dwc3_event_buffers_cleanup(dwc);
411 dwc3_free_event_buffers(dwc); 411 dwc3_free_event_buffers(dwc);
412
413 usb_phy_shutdown(dwc->usb2_phy);
414 usb_phy_shutdown(dwc->usb3_phy);
415
412} 416}
413 417
414#define DWC3_ALIGN_MASK (16 - 1) 418#define DWC3_ALIGN_MASK (16 - 1)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c9e729a4bf65..7b7deddf6a52 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1904,7 +1904,7 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum)
1904 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params); 1904 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params);
1905 WARN_ON_ONCE(ret); 1905 WARN_ON_ONCE(ret);
1906 dep->resource_index = 0; 1906 dep->resource_index = 0;
1907 1907 dep->flags &= ~DWC3_EP_BUSY;
1908 udelay(100); 1908 udelay(100);
1909} 1909}
1910 1910
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index dfb51a45496c..e0ff51b89529 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -952,6 +952,7 @@ endif
952config USB_G_WEBCAM 952config USB_G_WEBCAM
953 tristate "USB Webcam Gadget" 953 tristate "USB Webcam Gadget"
954 depends on VIDEO_DEV 954 depends on VIDEO_DEV
955 select USB_LIBCOMPOSITE
955 help 956 help
956 The Webcam Gadget acts as a composite USB Audio and Video Class 957 The Webcam Gadget acts as a composite USB Audio and Video Class
957 device. It provides a userspace API to process UVC control requests 958 device. It provides a userspace API to process UVC control requests
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f696fb9b136d..21a9861dabf0 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
2930 2930
2931 /* Get the VBUS status from the transceiver */ 2931 /* Get the VBUS status from the transceiver */
2932 value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client, 2932 value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
2933 ISP1301_I2C_OTG_CONTROL_2); 2933 ISP1301_I2C_INTERRUPT_SOURCE);
2934 2934
2935 /* VBUS on or off? */ 2935 /* VBUS on or off? */
2936 if (value & OTG_B_SESS_VLD) 2936 if (value & INT_SESS_VLD)
2937 udc->vbus = 1; 2937 udc->vbus = 1;
2938 else 2938 else
2939 udc->vbus = 0; 2939 udc->vbus = 0;
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 9bfde82078ec..0d2f35ca93f1 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -222,7 +222,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
222 222
223 if (pdata->controller_ver < 0) { 223 if (pdata->controller_ver < 0) {
224 dev_warn(hcd->self.controller, "Could not get controller version\n"); 224 dev_warn(hcd->self.controller, "Could not get controller version\n");
225 return; 225 return -ENODEV;
226 } 226 }
227 227
228 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); 228 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 8e7eca62f169..9c2717d66730 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -160,7 +160,7 @@ static const struct hc_driver ehci_orion_hc_driver = {
160 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 160 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
161}; 161};
162 162
163static void __init 163static void __devinit
164ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, 164ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
165 const struct mbus_dram_target_info *dram) 165 const struct mbus_dram_target_info *dram)
166{ 166{
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c
index 96722bfebc84..d3c9a3e397b9 100644
--- a/drivers/usb/host/ehci-vt8500.c
+++ b/drivers/usb/host/ehci-vt8500.c
@@ -85,6 +85,8 @@ static const struct hc_driver vt8500_ehci_hc_driver = {
85 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 85 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
86}; 86};
87 87
88static u64 vt8500_ehci_dma_mask = DMA_BIT_MASK(32);
89
88static int vt8500_ehci_drv_probe(struct platform_device *pdev) 90static int vt8500_ehci_drv_probe(struct platform_device *pdev)
89{ 91{
90 struct usb_hcd *hcd; 92 struct usb_hcd *hcd;
@@ -95,6 +97,14 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev)
95 if (usb_disabled()) 97 if (usb_disabled())
96 return -ENODEV; 98 return -ENODEV;
97 99
100 /*
101 * Right now device-tree probed devices don't get dma_mask set.
102 * Since shared usb code relies on it, set it here for now.
103 * Once we have dma capability bindings this can go away.
104 */
105 if (!pdev->dev.dma_mask)
106 pdev->dev.dma_mask = &vt8500_ehci_dma_mask;
107
98 if (pdev->resource[1].flags != IORESOURCE_IRQ) { 108 if (pdev->resource[1].flags != IORESOURCE_IRQ) {
99 pr_debug("resource[1] is not IORESOURCE_IRQ"); 109 pr_debug("resource[1] is not IORESOURCE_IRQ");
100 return -ENOMEM; 110 return -ENOMEM;
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index e4780491df4a..68ebf20e1519 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -60,6 +60,7 @@ static const struct hc_driver uhci_platform_hc_driver = {
60 .hub_control = uhci_hub_control, 60 .hub_control = uhci_hub_control,
61}; 61};
62 62
63static u64 platform_uhci_dma_mask = DMA_BIT_MASK(32);
63 64
64static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev) 65static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev)
65{ 66{
@@ -71,6 +72,14 @@ static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev)
71 if (usb_disabled()) 72 if (usb_disabled())
72 return -ENODEV; 73 return -ENODEV;
73 74
75 /*
76 * Right now device-tree probed devices don't get dma_mask set.
77 * Since shared usb code relies on it, set it here for now.
78 * Once we have dma capability bindings this can go away.
79 */
80 if (!pdev->dev.dma_mask)
81 pdev->dev.dma_mask = &platform_uhci_dma_mask;
82
74 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, 83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev,
75 pdev->name); 84 pdev->name);
76 if (!hcd) 85 if (!hcd)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 8d7fcbbe6ade..7d462bf20092 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -479,7 +479,8 @@ static bool compliance_mode_recovery_timer_quirk_check(void)
479 479
480 if (strstr(dmi_product_name, "Z420") || 480 if (strstr(dmi_product_name, "Z420") ||
481 strstr(dmi_product_name, "Z620") || 481 strstr(dmi_product_name, "Z620") ||
482 strstr(dmi_product_name, "Z820")) 482 strstr(dmi_product_name, "Z820") ||
483 strstr(dmi_product_name, "Z1"))
483 return true; 484 return true;
484 485
485 return false; 486 return false;
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 457f25e62c51..c964d6af178b 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -305,6 +305,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
305 ret = IRQ_HANDLED; 305 ret = IRQ_HANDLED;
306 } 306 }
307 307
308 /* Drop spurious RX and TX if device is disconnected */
309 if (musb->int_usb & MUSB_INTR_DISCONNECT) {
310 musb->int_tx = 0;
311 musb->int_rx = 0;
312 }
313
308 if (musb->int_tx || musb->int_rx || musb->int_usb) 314 if (musb->int_tx || musb->int_rx || musb->int_usb)
309 ret |= musb_interrupt(musb); 315 ret |= musb_interrupt(musb);
310 316
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index 35c5208f3249..61933a90e5bf 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -273,9 +273,9 @@ static irqreturn_t usbhs_interrupt(int irq, void *data)
273 usbhs_write(priv, INTSTS0, ~irq_state.intsts0 & INTSTS0_MAGIC); 273 usbhs_write(priv, INTSTS0, ~irq_state.intsts0 & INTSTS0_MAGIC);
274 usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); 274 usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC);
275 275
276 usbhs_write(priv, BRDYSTS, 0); 276 usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
277 usbhs_write(priv, NRDYSTS, 0); 277 usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts);
278 usbhs_write(priv, BEMPSTS, 0); 278 usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
279 279
280 /* 280 /*
281 * call irq callback functions 281 * call irq callback functions
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index 08786c06dcf1..3d80c7b1fd1b 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -54,7 +54,7 @@ struct usbhs_pipe_info {
54 * pipe list 54 * pipe list
55 */ 55 */
56#define __usbhs_for_each_pipe(start, pos, info, i) \ 56#define __usbhs_for_each_pipe(start, pos, info, i) \
57 for (i = start, pos = (info)->pipe; \ 57 for (i = start, pos = (info)->pipe + i; \
58 i < (info)->size; \ 58 i < (info)->size; \
59 i++, pos = (info)->pipe + i) 59 i++, pos = (info)->pipe + i)
60 60
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index cf2522c397d3..bd50a8a41a0f 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -125,9 +125,6 @@ static inline int calc_divisor(int bps)
125 125
126static int ark3116_attach(struct usb_serial *serial) 126static int ark3116_attach(struct usb_serial *serial)
127{ 127{
128 struct usb_serial_port *port = serial->port[0];
129 struct ark3116_private *priv;
130
131 /* make sure we have our end-points */ 128 /* make sure we have our end-points */
132 if ((serial->num_bulk_in == 0) || 129 if ((serial->num_bulk_in == 0) ||
133 (serial->num_bulk_out == 0) || 130 (serial->num_bulk_out == 0) ||
@@ -142,8 +139,15 @@ static int ark3116_attach(struct usb_serial *serial)
142 return -EINVAL; 139 return -EINVAL;
143 } 140 }
144 141
145 priv = kzalloc(sizeof(struct ark3116_private), 142 return 0;
146 GFP_KERNEL); 143}
144
145static int ark3116_port_probe(struct usb_serial_port *port)
146{
147 struct usb_serial *serial = port->serial;
148 struct ark3116_private *priv;
149
150 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
147 if (!priv) 151 if (!priv)
148 return -ENOMEM; 152 return -ENOMEM;
149 153
@@ -198,18 +202,15 @@ static int ark3116_attach(struct usb_serial *serial)
198 return 0; 202 return 0;
199} 203}
200 204
201static void ark3116_release(struct usb_serial *serial) 205static int ark3116_port_remove(struct usb_serial_port *port)
202{ 206{
203 struct usb_serial_port *port = serial->port[0];
204 struct ark3116_private *priv = usb_get_serial_port_data(port); 207 struct ark3116_private *priv = usb_get_serial_port_data(port);
205 208
206 /* device is closed, so URBs and DMA should be down */ 209 /* device is closed, so URBs and DMA should be down */
207
208 usb_set_serial_port_data(port, NULL);
209
210 mutex_destroy(&priv->hw_lock); 210 mutex_destroy(&priv->hw_lock);
211
212 kfree(priv); 211 kfree(priv);
212
213 return 0;
213} 214}
214 215
215static void ark3116_init_termios(struct tty_struct *tty) 216static void ark3116_init_termios(struct tty_struct *tty)
@@ -723,7 +724,8 @@ static struct usb_serial_driver ark3116_device = {
723 .id_table = id_table, 724 .id_table = id_table,
724 .num_ports = 1, 725 .num_ports = 1,
725 .attach = ark3116_attach, 726 .attach = ark3116_attach,
726 .release = ark3116_release, 727 .port_probe = ark3116_port_probe,
728 .port_remove = ark3116_port_remove,
727 .set_termios = ark3116_set_termios, 729 .set_termios = ark3116_set_termios,
728 .init_termios = ark3116_init_termios, 730 .init_termios = ark3116_init_termios,
729 .ioctl = ark3116_ioctl, 731 .ioctl = ark3116_ioctl,
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 99449424193f..ea29556f0d72 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -45,8 +45,8 @@
45#define DRIVER_DESC "USB Belkin Serial converter driver" 45#define DRIVER_DESC "USB Belkin Serial converter driver"
46 46
47/* function prototypes for a Belkin USB Serial Adapter F5U103 */ 47/* function prototypes for a Belkin USB Serial Adapter F5U103 */
48static int belkin_sa_startup(struct usb_serial *serial); 48static int belkin_sa_port_probe(struct usb_serial_port *port);
49static void belkin_sa_release(struct usb_serial *serial); 49static int belkin_sa_port_remove(struct usb_serial_port *port);
50static int belkin_sa_open(struct tty_struct *tty, 50static int belkin_sa_open(struct tty_struct *tty,
51 struct usb_serial_port *port); 51 struct usb_serial_port *port);
52static void belkin_sa_close(struct usb_serial_port *port); 52static void belkin_sa_close(struct usb_serial_port *port);
@@ -88,8 +88,8 @@ static struct usb_serial_driver belkin_device = {
88 .break_ctl = belkin_sa_break_ctl, 88 .break_ctl = belkin_sa_break_ctl,
89 .tiocmget = belkin_sa_tiocmget, 89 .tiocmget = belkin_sa_tiocmget,
90 .tiocmset = belkin_sa_tiocmset, 90 .tiocmset = belkin_sa_tiocmset,
91 .attach = belkin_sa_startup, 91 .port_probe = belkin_sa_port_probe,
92 .release = belkin_sa_release, 92 .port_remove = belkin_sa_port_remove,
93}; 93};
94 94
95static struct usb_serial_driver * const serial_drivers[] = { 95static struct usb_serial_driver * const serial_drivers[] = {
@@ -118,17 +118,15 @@ struct belkin_sa_private {
118 (c), BELKIN_SA_SET_REQUEST_TYPE, \ 118 (c), BELKIN_SA_SET_REQUEST_TYPE, \
119 (v), 0, NULL, 0, WDR_TIMEOUT) 119 (v), 0, NULL, 0, WDR_TIMEOUT)
120 120
121/* do some startup allocations not currently performed by usb_serial_probe() */ 121static int belkin_sa_port_probe(struct usb_serial_port *port)
122static int belkin_sa_startup(struct usb_serial *serial)
123{ 122{
124 struct usb_device *dev = serial->dev; 123 struct usb_device *dev = port->serial->dev;
125 struct belkin_sa_private *priv; 124 struct belkin_sa_private *priv;
126 125
127 /* allocate the private data structure */
128 priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); 126 priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL);
129 if (!priv) 127 if (!priv)
130 return -1; /* error */ 128 return -ENOMEM;
131 /* set initial values for control structures */ 129
132 spin_lock_init(&priv->lock); 130 spin_lock_init(&priv->lock);
133 priv->control_state = 0; 131 priv->control_state = 0;
134 priv->last_lsr = 0; 132 priv->last_lsr = 0;
@@ -140,18 +138,19 @@ static int belkin_sa_startup(struct usb_serial *serial)
140 le16_to_cpu(dev->descriptor.bcdDevice), 138 le16_to_cpu(dev->descriptor.bcdDevice),
141 priv->bad_flow_control); 139 priv->bad_flow_control);
142 140
143 init_waitqueue_head(&serial->port[0]->write_wait); 141 usb_set_serial_port_data(port, priv);
144 usb_set_serial_port_data(serial->port[0], priv);
145 142
146 return 0; 143 return 0;
147} 144}
148 145
149static void belkin_sa_release(struct usb_serial *serial) 146static int belkin_sa_port_remove(struct usb_serial_port *port)
150{ 147{
151 int i; 148 struct belkin_sa_private *priv;
152 149
153 for (i = 0; i < serial->num_ports; ++i) 150 priv = usb_get_serial_port_data(port);
154 kfree(usb_get_serial_port_data(serial->port[i])); 151 kfree(priv);
152
153 return 0;
155} 154}
156 155
157static int belkin_sa_open(struct tty_struct *tty, 156static int belkin_sa_open(struct tty_struct *tty,
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 28af5acc3360..eb033fc92a15 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -162,7 +162,7 @@ static const struct usb_device_id id_table[] = {
162 162
163MODULE_DEVICE_TABLE(usb, id_table); 163MODULE_DEVICE_TABLE(usb, id_table);
164 164
165struct cp210x_port_private { 165struct cp210x_serial_private {
166 __u8 bInterfaceNumber; 166 __u8 bInterfaceNumber;
167}; 167};
168 168
@@ -276,7 +276,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
276 unsigned int *data, int size) 276 unsigned int *data, int size)
277{ 277{
278 struct usb_serial *serial = port->serial; 278 struct usb_serial *serial = port->serial;
279 struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); 279 struct cp210x_serial_private *spriv = usb_get_serial_data(serial);
280 __le32 *buf; 280 __le32 *buf;
281 int result, i, length; 281 int result, i, length;
282 282
@@ -292,7 +292,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
292 /* Issue the request, attempting to read 'size' bytes */ 292 /* Issue the request, attempting to read 'size' bytes */
293 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 293 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
294 request, REQTYPE_INTERFACE_TO_HOST, 0x0000, 294 request, REQTYPE_INTERFACE_TO_HOST, 0x0000,
295 port_priv->bInterfaceNumber, buf, size, 295 spriv->bInterfaceNumber, buf, size,
296 USB_CTRL_GET_TIMEOUT); 296 USB_CTRL_GET_TIMEOUT);
297 297
298 /* Convert data into an array of integers */ 298 /* Convert data into an array of integers */
@@ -323,7 +323,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
323 unsigned int *data, int size) 323 unsigned int *data, int size)
324{ 324{
325 struct usb_serial *serial = port->serial; 325 struct usb_serial *serial = port->serial;
326 struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); 326 struct cp210x_serial_private *spriv = usb_get_serial_data(serial);
327 __le32 *buf; 327 __le32 *buf;
328 int result, i, length; 328 int result, i, length;
329 329
@@ -345,13 +345,13 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
345 result = usb_control_msg(serial->dev, 345 result = usb_control_msg(serial->dev,
346 usb_sndctrlpipe(serial->dev, 0), 346 usb_sndctrlpipe(serial->dev, 0),
347 request, REQTYPE_HOST_TO_INTERFACE, 0x0000, 347 request, REQTYPE_HOST_TO_INTERFACE, 0x0000,
348 port_priv->bInterfaceNumber, buf, size, 348 spriv->bInterfaceNumber, buf, size,
349 USB_CTRL_SET_TIMEOUT); 349 USB_CTRL_SET_TIMEOUT);
350 } else { 350 } else {
351 result = usb_control_msg(serial->dev, 351 result = usb_control_msg(serial->dev,
352 usb_sndctrlpipe(serial->dev, 0), 352 usb_sndctrlpipe(serial->dev, 0),
353 request, REQTYPE_HOST_TO_INTERFACE, data[0], 353 request, REQTYPE_HOST_TO_INTERFACE, data[0],
354 port_priv->bInterfaceNumber, NULL, 0, 354 spriv->bInterfaceNumber, NULL, 0,
355 USB_CTRL_SET_TIMEOUT); 355 USB_CTRL_SET_TIMEOUT);
356 } 356 }
357 357
@@ -845,36 +845,30 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
845 845
846static int cp210x_startup(struct usb_serial *serial) 846static int cp210x_startup(struct usb_serial *serial)
847{ 847{
848 struct cp210x_port_private *port_priv; 848 struct usb_host_interface *cur_altsetting;
849 int i; 849 struct cp210x_serial_private *spriv;
850 850
851 /* cp210x buffers behave strangely unless device is reset */ 851 /* cp210x buffers behave strangely unless device is reset */
852 usb_reset_device(serial->dev); 852 usb_reset_device(serial->dev);
853 853
854 for (i = 0; i < serial->num_ports; i++) { 854 spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
855 port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); 855 if (!spriv)
856 if (!port_priv) 856 return -ENOMEM;
857 return -ENOMEM;
858 857
859 port_priv->bInterfaceNumber = 858 cur_altsetting = serial->interface->cur_altsetting;
860 serial->interface->cur_altsetting->desc.bInterfaceNumber; 859 spriv->bInterfaceNumber = cur_altsetting->desc.bInterfaceNumber;
861 860
862 usb_set_serial_port_data(serial->port[i], port_priv); 861 usb_set_serial_data(serial, spriv);
863 }
864 862
865 return 0; 863 return 0;
866} 864}
867 865
868static void cp210x_release(struct usb_serial *serial) 866static void cp210x_release(struct usb_serial *serial)
869{ 867{
870 struct cp210x_port_private *port_priv; 868 struct cp210x_serial_private *spriv;
871 int i;
872 869
873 for (i = 0; i < serial->num_ports; i++) { 870 spriv = usb_get_serial_data(serial);
874 port_priv = usb_get_serial_port_data(serial->port[i]); 871 kfree(spriv);
875 kfree(port_priv);
876 usb_set_serial_port_data(serial->port[i], NULL);
877 }
878} 872}
879 873
880module_usb_serial_driver(serial_drivers, id_table); 874module_usb_serial_driver(serial_drivers, id_table);
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 2a7aecc72237..4ee77dcbe690 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -55,9 +55,9 @@
55#define CYBERJACK_PRODUCT_ID 0x0100 55#define CYBERJACK_PRODUCT_ID 0x0100
56 56
57/* Function prototypes */ 57/* Function prototypes */
58static int cyberjack_startup(struct usb_serial *serial);
59static void cyberjack_disconnect(struct usb_serial *serial); 58static void cyberjack_disconnect(struct usb_serial *serial);
60static void cyberjack_release(struct usb_serial *serial); 59static int cyberjack_port_probe(struct usb_serial_port *port);
60static int cyberjack_port_remove(struct usb_serial_port *port);
61static int cyberjack_open(struct tty_struct *tty, 61static int cyberjack_open(struct tty_struct *tty,
62 struct usb_serial_port *port); 62 struct usb_serial_port *port);
63static void cyberjack_close(struct usb_serial_port *port); 63static void cyberjack_close(struct usb_serial_port *port);
@@ -83,9 +83,9 @@ static struct usb_serial_driver cyberjack_device = {
83 .description = "Reiner SCT Cyberjack USB card reader", 83 .description = "Reiner SCT Cyberjack USB card reader",
84 .id_table = id_table, 84 .id_table = id_table,
85 .num_ports = 1, 85 .num_ports = 1,
86 .attach = cyberjack_startup,
87 .disconnect = cyberjack_disconnect, 86 .disconnect = cyberjack_disconnect,
88 .release = cyberjack_release, 87 .port_probe = cyberjack_port_probe,
88 .port_remove = cyberjack_port_remove,
89 .open = cyberjack_open, 89 .open = cyberjack_open,
90 .close = cyberjack_close, 90 .close = cyberjack_close,
91 .write = cyberjack_write, 91 .write = cyberjack_write,
@@ -107,56 +107,45 @@ struct cyberjack_private {
107 short wrsent; /* Data already sent */ 107 short wrsent; /* Data already sent */
108}; 108};
109 109
110/* do some startup allocations not currently performed by usb_serial_probe() */ 110static int cyberjack_port_probe(struct usb_serial_port *port)
111static int cyberjack_startup(struct usb_serial *serial)
112{ 111{
113 struct cyberjack_private *priv; 112 struct cyberjack_private *priv;
114 int i; 113 int result;
115 114
116 /* allocate the private data structure */
117 priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); 115 priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL);
118 if (!priv) 116 if (!priv)
119 return -ENOMEM; 117 return -ENOMEM;
120 118
121 /* set initial values */
122 spin_lock_init(&priv->lock); 119 spin_lock_init(&priv->lock);
123 priv->rdtodo = 0; 120 priv->rdtodo = 0;
124 priv->wrfilled = 0; 121 priv->wrfilled = 0;
125 priv->wrsent = 0; 122 priv->wrsent = 0;
126 usb_set_serial_port_data(serial->port[0], priv);
127 123
128 init_waitqueue_head(&serial->port[0]->write_wait); 124 usb_set_serial_port_data(port, priv);
129 125
130 for (i = 0; i < serial->num_ports; ++i) { 126 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
131 int result; 127 if (result)
132 result = usb_submit_urb(serial->port[i]->interrupt_in_urb, 128 dev_err(&port->dev, "usb_submit_urb(read int) failed\n");
133 GFP_KERNEL);
134 if (result)
135 dev_err(&serial->dev->dev,
136 "usb_submit_urb(read int) failed\n");
137 dev_dbg(&serial->dev->dev, "%s - usb_submit_urb(int urb)\n",
138 __func__);
139 }
140 129
141 return 0; 130 return 0;
142} 131}
143 132
144static void cyberjack_disconnect(struct usb_serial *serial) 133static int cyberjack_port_remove(struct usb_serial_port *port)
145{ 134{
146 int i; 135 struct cyberjack_private *priv;
147 136
148 for (i = 0; i < serial->num_ports; ++i) 137 priv = usb_get_serial_port_data(port);
149 usb_kill_urb(serial->port[i]->interrupt_in_urb); 138 kfree(priv);
139
140 return 0;
150} 141}
151 142
152static void cyberjack_release(struct usb_serial *serial) 143static void cyberjack_disconnect(struct usb_serial *serial)
153{ 144{
154 int i; 145 int i;
155 146
156 for (i = 0; i < serial->num_ports; ++i) { 147 for (i = 0; i < serial->num_ports; ++i)
157 /* My special items, the standard routines free my urbs */ 148 usb_kill_urb(serial->port[i]->interrupt_in_urb);
158 kfree(usb_get_serial_port_data(serial->port[i]));
159 }
160} 149}
161 150
162static int cyberjack_open(struct tty_struct *tty, 151static int cyberjack_open(struct tty_struct *tty,
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 1befce21e173..f0da1279c114 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -123,10 +123,10 @@ struct cypress_private {
123}; 123};
124 124
125/* function prototypes for the Cypress USB to serial device */ 125/* function prototypes for the Cypress USB to serial device */
126static int cypress_earthmate_startup(struct usb_serial *serial); 126static int cypress_earthmate_port_probe(struct usb_serial_port *port);
127static int cypress_hidcom_startup(struct usb_serial *serial); 127static int cypress_hidcom_port_probe(struct usb_serial_port *port);
128static int cypress_ca42v2_startup(struct usb_serial *serial); 128static int cypress_ca42v2_port_probe(struct usb_serial_port *port);
129static void cypress_release(struct usb_serial *serial); 129static int cypress_port_remove(struct usb_serial_port *port);
130static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port); 130static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port);
131static void cypress_close(struct usb_serial_port *port); 131static void cypress_close(struct usb_serial_port *port);
132static void cypress_dtr_rts(struct usb_serial_port *port, int on); 132static void cypress_dtr_rts(struct usb_serial_port *port, int on);
@@ -156,8 +156,8 @@ static struct usb_serial_driver cypress_earthmate_device = {
156 .description = "DeLorme Earthmate USB", 156 .description = "DeLorme Earthmate USB",
157 .id_table = id_table_earthmate, 157 .id_table = id_table_earthmate,
158 .num_ports = 1, 158 .num_ports = 1,
159 .attach = cypress_earthmate_startup, 159 .port_probe = cypress_earthmate_port_probe,
160 .release = cypress_release, 160 .port_remove = cypress_port_remove,
161 .open = cypress_open, 161 .open = cypress_open,
162 .close = cypress_close, 162 .close = cypress_close,
163 .dtr_rts = cypress_dtr_rts, 163 .dtr_rts = cypress_dtr_rts,
@@ -182,8 +182,8 @@ static struct usb_serial_driver cypress_hidcom_device = {
182 .description = "HID->COM RS232 Adapter", 182 .description = "HID->COM RS232 Adapter",
183 .id_table = id_table_cyphidcomrs232, 183 .id_table = id_table_cyphidcomrs232,
184 .num_ports = 1, 184 .num_ports = 1,
185 .attach = cypress_hidcom_startup, 185 .port_probe = cypress_hidcom_port_probe,
186 .release = cypress_release, 186 .port_remove = cypress_port_remove,
187 .open = cypress_open, 187 .open = cypress_open,
188 .close = cypress_close, 188 .close = cypress_close,
189 .dtr_rts = cypress_dtr_rts, 189 .dtr_rts = cypress_dtr_rts,
@@ -208,8 +208,8 @@ static struct usb_serial_driver cypress_ca42v2_device = {
208 .description = "Nokia CA-42 V2 Adapter", 208 .description = "Nokia CA-42 V2 Adapter",
209 .id_table = id_table_nokiaca42v2, 209 .id_table = id_table_nokiaca42v2,
210 .num_ports = 1, 210 .num_ports = 1,
211 .attach = cypress_ca42v2_startup, 211 .port_probe = cypress_ca42v2_port_probe,
212 .release = cypress_release, 212 .port_remove = cypress_port_remove,
213 .open = cypress_open, 213 .open = cypress_open,
214 .close = cypress_close, 214 .close = cypress_close,
215 .dtr_rts = cypress_dtr_rts, 215 .dtr_rts = cypress_dtr_rts,
@@ -438,10 +438,10 @@ static void cypress_set_dead(struct usb_serial_port *port)
438 *****************************************************************************/ 438 *****************************************************************************/
439 439
440 440
441static int generic_startup(struct usb_serial *serial) 441static int cypress_generic_port_probe(struct usb_serial_port *port)
442{ 442{
443 struct usb_serial *serial = port->serial;
443 struct cypress_private *priv; 444 struct cypress_private *priv;
444 struct usb_serial_port *port = serial->port[0];
445 445
446 priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL); 446 priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL);
447 if (!priv) 447 if (!priv)
@@ -490,14 +490,16 @@ static int generic_startup(struct usb_serial *serial)
490} 490}
491 491
492 492
493static int cypress_earthmate_startup(struct usb_serial *serial) 493static int cypress_earthmate_port_probe(struct usb_serial_port *port)
494{ 494{
495 struct usb_serial *serial = port->serial;
495 struct cypress_private *priv; 496 struct cypress_private *priv;
496 struct usb_serial_port *port = serial->port[0]; 497 int ret;
497 498
498 if (generic_startup(serial)) { 499 ret = cypress_generic_port_probe(port);
500 if (ret) {
499 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); 501 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
500 return 1; 502 return ret;
501 } 503 }
502 504
503 priv = usb_get_serial_port_data(port); 505 priv = usb_get_serial_port_data(port);
@@ -518,56 +520,53 @@ static int cypress_earthmate_startup(struct usb_serial *serial)
518 } 520 }
519 521
520 return 0; 522 return 0;
521} /* cypress_earthmate_startup */ 523}
522
523 524
524static int cypress_hidcom_startup(struct usb_serial *serial) 525static int cypress_hidcom_port_probe(struct usb_serial_port *port)
525{ 526{
526 struct cypress_private *priv; 527 struct cypress_private *priv;
527 struct usb_serial_port *port = serial->port[0]; 528 int ret;
528 529
529 if (generic_startup(serial)) { 530 ret = cypress_generic_port_probe(port);
531 if (ret) {
530 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); 532 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
531 return 1; 533 return ret;
532 } 534 }
533 535
534 priv = usb_get_serial_port_data(port); 536 priv = usb_get_serial_port_data(port);
535 priv->chiptype = CT_CYPHIDCOM; 537 priv->chiptype = CT_CYPHIDCOM;
536 538
537 return 0; 539 return 0;
538} /* cypress_hidcom_startup */ 540}
539
540 541
541static int cypress_ca42v2_startup(struct usb_serial *serial) 542static int cypress_ca42v2_port_probe(struct usb_serial_port *port)
542{ 543{
543 struct cypress_private *priv; 544 struct cypress_private *priv;
544 struct usb_serial_port *port = serial->port[0]; 545 int ret;
545 546
546 if (generic_startup(serial)) { 547 ret = cypress_generic_port_probe(port);
548 if (ret) {
547 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); 549 dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
548 return 1; 550 return ret;
549 } 551 }
550 552
551 priv = usb_get_serial_port_data(port); 553 priv = usb_get_serial_port_data(port);
552 priv->chiptype = CT_CA42V2; 554 priv->chiptype = CT_CA42V2;
553 555
554 return 0; 556 return 0;
555} /* cypress_ca42v2_startup */ 557}
556
557 558
558static void cypress_release(struct usb_serial *serial) 559static int cypress_port_remove(struct usb_serial_port *port)
559{ 560{
560 struct cypress_private *priv; 561 struct cypress_private *priv;
561 562
562 /* all open ports are closed at this point */ 563 priv = usb_get_serial_port_data(port);
563 priv = usb_get_serial_port_data(serial->port[0]);
564 564
565 if (priv) { 565 kfifo_free(&priv->write_fifo);
566 kfifo_free(&priv->write_fifo); 566 kfree(priv);
567 kfree(priv);
568 }
569}
570 567
568 return 0;
569}
571 570
572static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port) 571static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)
573{ 572{
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 244477107e2f..6e4eb57d0177 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -318,39 +318,30 @@ static int f81232_ioctl(struct tty_struct *tty,
318 return -ENOIOCTLCMD; 318 return -ENOIOCTLCMD;
319} 319}
320 320
321static int f81232_startup(struct usb_serial *serial) 321static int f81232_port_probe(struct usb_serial_port *port)
322{ 322{
323 struct f81232_private *priv; 323 struct f81232_private *priv;
324 int i;
325 324
326 for (i = 0; i < serial->num_ports; ++i) { 325 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
327 priv = kzalloc(sizeof(struct f81232_private), GFP_KERNEL); 326 if (!priv)
328 if (!priv) 327 return -ENOMEM;
329 goto cleanup;
330 spin_lock_init(&priv->lock);
331 init_waitqueue_head(&priv->delta_msr_wait);
332 usb_set_serial_port_data(serial->port[i], priv);
333 }
334 return 0;
335 328
336cleanup: 329 spin_lock_init(&priv->lock);
337 for (--i; i >= 0; --i) { 330 init_waitqueue_head(&priv->delta_msr_wait);
338 priv = usb_get_serial_port_data(serial->port[i]); 331
339 kfree(priv); 332 usb_set_serial_port_data(port, priv);
340 usb_set_serial_port_data(serial->port[i], NULL); 333
341 } 334 return 0;
342 return -ENOMEM;
343} 335}
344 336
345static void f81232_release(struct usb_serial *serial) 337static int f81232_port_remove(struct usb_serial_port *port)
346{ 338{
347 int i;
348 struct f81232_private *priv; 339 struct f81232_private *priv;
349 340
350 for (i = 0; i < serial->num_ports; ++i) { 341 priv = usb_get_serial_port_data(port);
351 priv = usb_get_serial_port_data(serial->port[i]); 342 kfree(priv);
352 kfree(priv); 343
353 } 344 return 0;
354} 345}
355 346
356static struct usb_serial_driver f81232_device = { 347static struct usb_serial_driver f81232_device = {
@@ -373,8 +364,8 @@ static struct usb_serial_driver f81232_device = {
373 .tiocmset = f81232_tiocmset, 364 .tiocmset = f81232_tiocmset,
374 .process_read_urb = f81232_process_read_urb, 365 .process_read_urb = f81232_process_read_urb,
375 .read_int_callback = f81232_read_int_callback, 366 .read_int_callback = f81232_read_int_callback,
376 .attach = f81232_startup, 367 .port_probe = f81232_port_probe,
377 .release = f81232_release, 368 .port_remove = f81232_port_remove,
378}; 369};
379 370
380static struct usb_serial_driver * const serial_drivers[] = { 371static struct usb_serial_driver * const serial_drivers[] = {
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 3ee92648c02d..203358d7e7bc 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1405,11 +1405,10 @@ static void timeout_handler(unsigned long data)
1405 1405
1406 1406
1407 1407
1408static int garmin_attach(struct usb_serial *serial) 1408static int garmin_port_probe(struct usb_serial_port *port)
1409{ 1409{
1410 int status = 0; 1410 int status;
1411 struct usb_serial_port *port = serial->port[0]; 1411 struct garmin_data *garmin_data_p;
1412 struct garmin_data *garmin_data_p = NULL;
1413 1412
1414 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); 1413 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
1415 if (garmin_data_p == NULL) { 1414 if (garmin_data_p == NULL) {
@@ -1434,22 +1433,14 @@ static int garmin_attach(struct usb_serial *serial)
1434} 1433}
1435 1434
1436 1435
1437static void garmin_disconnect(struct usb_serial *serial) 1436static int garmin_port_remove(struct usb_serial_port *port)
1438{ 1437{
1439 struct usb_serial_port *port = serial->port[0];
1440 struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); 1438 struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
1441 1439
1442 usb_kill_urb(port->interrupt_in_urb); 1440 usb_kill_urb(port->interrupt_in_urb);
1443 del_timer_sync(&garmin_data_p->timer); 1441 del_timer_sync(&garmin_data_p->timer);
1444}
1445
1446
1447static void garmin_release(struct usb_serial *serial)
1448{
1449 struct usb_serial_port *port = serial->port[0];
1450 struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
1451
1452 kfree(garmin_data_p); 1442 kfree(garmin_data_p);
1443 return 0;
1453} 1444}
1454 1445
1455 1446
@@ -1466,9 +1457,8 @@ static struct usb_serial_driver garmin_device = {
1466 .close = garmin_close, 1457 .close = garmin_close,
1467 .throttle = garmin_throttle, 1458 .throttle = garmin_throttle,
1468 .unthrottle = garmin_unthrottle, 1459 .unthrottle = garmin_unthrottle,
1469 .attach = garmin_attach, 1460 .port_probe = garmin_port_probe,
1470 .disconnect = garmin_disconnect, 1461 .port_remove = garmin_port_remove,
1471 .release = garmin_release,
1472 .write = garmin_write, 1462 .write = garmin_write,
1473 .write_room = garmin_write_room, 1463 .write_room = garmin_write_room,
1474 .write_bulk_callback = garmin_write_bulk_callback, 1464 .write_bulk_callback = garmin_write_bulk_callback,
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 8e6faaf3580c..5acc0d13864a 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -225,6 +225,8 @@ static int edge_get_icount(struct tty_struct *tty,
225static int edge_startup(struct usb_serial *serial); 225static int edge_startup(struct usb_serial *serial);
226static void edge_disconnect(struct usb_serial *serial); 226static void edge_disconnect(struct usb_serial *serial);
227static void edge_release(struct usb_serial *serial); 227static void edge_release(struct usb_serial *serial);
228static int edge_port_probe(struct usb_serial_port *port);
229static int edge_port_remove(struct usb_serial_port *port);
228 230
229#include "io_tables.h" /* all of the devices that this driver supports */ 231#include "io_tables.h" /* all of the devices that this driver supports */
230 232
@@ -2875,10 +2877,9 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2875static int edge_startup(struct usb_serial *serial) 2877static int edge_startup(struct usb_serial *serial)
2876{ 2878{
2877 struct edgeport_serial *edge_serial; 2879 struct edgeport_serial *edge_serial;
2878 struct edgeport_port *edge_port;
2879 struct usb_device *dev; 2880 struct usb_device *dev;
2880 struct device *ddev = &serial->dev->dev; 2881 struct device *ddev = &serial->dev->dev;
2881 int i, j; 2882 int i;
2882 int response; 2883 int response;
2883 bool interrupt_in_found; 2884 bool interrupt_in_found;
2884 bool bulk_in_found; 2885 bool bulk_in_found;
@@ -2961,25 +2962,6 @@ static int edge_startup(struct usb_serial *serial)
2961 /* we set up the pointers to the endpoints in the edge_open function, 2962 /* we set up the pointers to the endpoints in the edge_open function,
2962 * as the structures aren't created yet. */ 2963 * as the structures aren't created yet. */
2963 2964
2964 /* set up our port private structures */
2965 for (i = 0; i < serial->num_ports; ++i) {
2966 edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL);
2967 if (edge_port == NULL) {
2968 dev_err(ddev, "%s - Out of memory\n", __func__);
2969 for (j = 0; j < i; ++j) {
2970 kfree(usb_get_serial_port_data(serial->port[j]));
2971 usb_set_serial_port_data(serial->port[j],
2972 NULL);
2973 }
2974 usb_set_serial_data(serial, NULL);
2975 kfree(edge_serial);
2976 return -ENOMEM;
2977 }
2978 spin_lock_init(&edge_port->ep_lock);
2979 edge_port->port = serial->port[i];
2980 usb_set_serial_port_data(serial->port[i], edge_port);
2981 }
2982
2983 response = 0; 2965 response = 0;
2984 2966
2985 if (edge_serial->is_epic) { 2967 if (edge_serial->is_epic) {
@@ -3120,14 +3102,36 @@ static void edge_disconnect(struct usb_serial *serial)
3120static void edge_release(struct usb_serial *serial) 3102static void edge_release(struct usb_serial *serial)
3121{ 3103{
3122 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); 3104 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
3123 int i;
3124
3125 for (i = 0; i < serial->num_ports; ++i)
3126 kfree(usb_get_serial_port_data(serial->port[i]));
3127 3105
3128 kfree(edge_serial); 3106 kfree(edge_serial);
3129} 3107}
3130 3108
3109static int edge_port_probe(struct usb_serial_port *port)
3110{
3111 struct edgeport_port *edge_port;
3112
3113 edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL);
3114 if (!edge_port)
3115 return -ENOMEM;
3116
3117 spin_lock_init(&edge_port->ep_lock);
3118 edge_port->port = port;
3119
3120 usb_set_serial_port_data(port, edge_port);
3121
3122 return 0;
3123}
3124
3125static int edge_port_remove(struct usb_serial_port *port)
3126{
3127 struct edgeport_port *edge_port;
3128
3129 edge_port = usb_get_serial_port_data(port);
3130 kfree(edge_port);
3131
3132 return 0;
3133}
3134
3131module_usb_serial_driver(serial_drivers, id_table_combined); 3135module_usb_serial_driver(serial_drivers, id_table_combined);
3132 3136
3133MODULE_AUTHOR(DRIVER_AUTHOR); 3137MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index 350afddb55ba..1511dd0ad324 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -110,6 +110,8 @@ static struct usb_serial_driver edgeport_2port_device = {
110 .attach = edge_startup, 110 .attach = edge_startup,
111 .disconnect = edge_disconnect, 111 .disconnect = edge_disconnect,
112 .release = edge_release, 112 .release = edge_release,
113 .port_probe = edge_port_probe,
114 .port_remove = edge_port_remove,
113 .ioctl = edge_ioctl, 115 .ioctl = edge_ioctl,
114 .set_termios = edge_set_termios, 116 .set_termios = edge_set_termios,
115 .tiocmget = edge_tiocmget, 117 .tiocmget = edge_tiocmget,
@@ -139,6 +141,8 @@ static struct usb_serial_driver edgeport_4port_device = {
139 .attach = edge_startup, 141 .attach = edge_startup,
140 .disconnect = edge_disconnect, 142 .disconnect = edge_disconnect,
141 .release = edge_release, 143 .release = edge_release,
144 .port_probe = edge_port_probe,
145 .port_remove = edge_port_remove,
142 .ioctl = edge_ioctl, 146 .ioctl = edge_ioctl,
143 .set_termios = edge_set_termios, 147 .set_termios = edge_set_termios,
144 .tiocmget = edge_tiocmget, 148 .tiocmget = edge_tiocmget,
@@ -168,6 +172,8 @@ static struct usb_serial_driver edgeport_8port_device = {
168 .attach = edge_startup, 172 .attach = edge_startup,
169 .disconnect = edge_disconnect, 173 .disconnect = edge_disconnect,
170 .release = edge_release, 174 .release = edge_release,
175 .port_probe = edge_port_probe,
176 .port_remove = edge_port_remove,
171 .ioctl = edge_ioctl, 177 .ioctl = edge_ioctl,
172 .set_termios = edge_set_termios, 178 .set_termios = edge_set_termios,
173 .tiocmget = edge_tiocmget, 179 .tiocmget = edge_tiocmget,
@@ -197,6 +203,8 @@ static struct usb_serial_driver epic_device = {
197 .attach = edge_startup, 203 .attach = edge_startup,
198 .disconnect = edge_disconnect, 204 .disconnect = edge_disconnect,
199 .release = edge_release, 205 .release = edge_release,
206 .port_probe = edge_port_probe,
207 .port_remove = edge_port_remove,
200 .ioctl = edge_ioctl, 208 .ioctl = edge_ioctl,
201 .set_termios = edge_set_termios, 209 .set_termios = edge_set_termios,
202 .tiocmget = edge_tiocmget, 210 .tiocmget = edge_tiocmget,
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index a2209cd45093..60023c2d2a31 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2532,12 +2532,7 @@ static void edge_break(struct tty_struct *tty, int break_state)
2532static int edge_startup(struct usb_serial *serial) 2532static int edge_startup(struct usb_serial *serial)
2533{ 2533{
2534 struct edgeport_serial *edge_serial; 2534 struct edgeport_serial *edge_serial;
2535 struct edgeport_port *edge_port;
2536 struct usb_device *dev;
2537 int status; 2535 int status;
2538 int i;
2539
2540 dev = serial->dev;
2541 2536
2542 /* create our private serial structure */ 2537 /* create our private serial structure */
2543 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); 2538 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
@@ -2555,40 +2550,7 @@ static int edge_startup(struct usb_serial *serial)
2555 return status; 2550 return status;
2556 } 2551 }
2557 2552
2558 /* set up our port private structures */
2559 for (i = 0; i < serial->num_ports; ++i) {
2560 edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL);
2561 if (edge_port == NULL) {
2562 dev_err(&serial->dev->dev, "%s - Out of memory\n",
2563 __func__);
2564 goto cleanup;
2565 }
2566 spin_lock_init(&edge_port->ep_lock);
2567 if (kfifo_alloc(&edge_port->write_fifo, EDGE_OUT_BUF_SIZE,
2568 GFP_KERNEL)) {
2569 dev_err(&serial->dev->dev, "%s - Out of memory\n",
2570 __func__);
2571 kfree(edge_port);
2572 goto cleanup;
2573 }
2574 edge_port->port = serial->port[i];
2575 edge_port->edge_serial = edge_serial;
2576 usb_set_serial_port_data(serial->port[i], edge_port);
2577 edge_port->bUartMode = default_uart_mode;
2578 }
2579
2580 return 0; 2553 return 0;
2581
2582cleanup:
2583 for (--i; i >= 0; --i) {
2584 edge_port = usb_get_serial_port_data(serial->port[i]);
2585 kfifo_free(&edge_port->write_fifo);
2586 kfree(edge_port);
2587 usb_set_serial_port_data(serial->port[i], NULL);
2588 }
2589 kfree(edge_serial);
2590 usb_set_serial_data(serial, NULL);
2591 return -ENOMEM;
2592} 2554}
2593 2555
2594static void edge_disconnect(struct usb_serial *serial) 2556static void edge_disconnect(struct usb_serial *serial)
@@ -2597,17 +2559,54 @@ static void edge_disconnect(struct usb_serial *serial)
2597 2559
2598static void edge_release(struct usb_serial *serial) 2560static void edge_release(struct usb_serial *serial)
2599{ 2561{
2600 int i; 2562 kfree(usb_get_serial_data(serial));
2563}
2564
2565static int edge_port_probe(struct usb_serial_port *port)
2566{
2601 struct edgeport_port *edge_port; 2567 struct edgeport_port *edge_port;
2568 int ret;
2602 2569
2603 for (i = 0; i < serial->num_ports; ++i) { 2570 edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL);
2604 edge_port = usb_get_serial_port_data(serial->port[i]); 2571 if (!edge_port)
2572 return -ENOMEM;
2573
2574 ret = kfifo_alloc(&edge_port->write_fifo, EDGE_OUT_BUF_SIZE,
2575 GFP_KERNEL);
2576 if (ret) {
2577 kfree(edge_port);
2578 return -ENOMEM;
2579 }
2580
2581 spin_lock_init(&edge_port->ep_lock);
2582 edge_port->port = port;
2583 edge_port->edge_serial = usb_get_serial_data(port->serial);
2584 edge_port->bUartMode = default_uart_mode;
2585
2586 usb_set_serial_port_data(port, edge_port);
2587
2588 ret = edge_create_sysfs_attrs(port);
2589 if (ret) {
2605 kfifo_free(&edge_port->write_fifo); 2590 kfifo_free(&edge_port->write_fifo);
2606 kfree(edge_port); 2591 kfree(edge_port);
2592 return ret;
2607 } 2593 }
2608 kfree(usb_get_serial_data(serial)); 2594
2595 return 0;
2609} 2596}
2610 2597
2598static int edge_port_remove(struct usb_serial_port *port)
2599{
2600 struct edgeport_port *edge_port;
2601
2602 edge_port = usb_get_serial_port_data(port);
2603
2604 edge_remove_sysfs_attrs(port);
2605 kfifo_free(&edge_port->write_fifo);
2606 kfree(edge_port);
2607
2608 return 0;
2609}
2611 2610
2612/* Sysfs Attributes */ 2611/* Sysfs Attributes */
2613 2612
@@ -2667,8 +2666,8 @@ static struct usb_serial_driver edgeport_1port_device = {
2667 .attach = edge_startup, 2666 .attach = edge_startup,
2668 .disconnect = edge_disconnect, 2667 .disconnect = edge_disconnect,
2669 .release = edge_release, 2668 .release = edge_release,
2670 .port_probe = edge_create_sysfs_attrs, 2669 .port_probe = edge_port_probe,
2671 .port_remove = edge_remove_sysfs_attrs, 2670 .port_remove = edge_port_remove,
2672 .ioctl = edge_ioctl, 2671 .ioctl = edge_ioctl,
2673 .set_termios = edge_set_termios, 2672 .set_termios = edge_set_termios,
2674 .tiocmget = edge_tiocmget, 2673 .tiocmget = edge_tiocmget,
@@ -2698,8 +2697,8 @@ static struct usb_serial_driver edgeport_2port_device = {
2698 .attach = edge_startup, 2697 .attach = edge_startup,
2699 .disconnect = edge_disconnect, 2698 .disconnect = edge_disconnect,
2700 .release = edge_release, 2699 .release = edge_release,
2701 .port_probe = edge_create_sysfs_attrs, 2700 .port_probe = edge_port_probe,
2702 .port_remove = edge_remove_sysfs_attrs, 2701 .port_remove = edge_port_remove,
2703 .ioctl = edge_ioctl, 2702 .ioctl = edge_ioctl,
2704 .set_termios = edge_set_termios, 2703 .set_termios = edge_set_termios,
2705 .tiocmget = edge_tiocmget, 2704 .tiocmget = edge_tiocmget,
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 01da3ea36e89..cd5533e81de7 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -53,6 +53,8 @@ static int iuu_cardout;
53static bool xmas; 53static bool xmas;
54static int vcc_default = 5; 54static int vcc_default = 5;
55 55
56static int iuu_create_sysfs_attrs(struct usb_serial_port *port);
57static int iuu_remove_sysfs_attrs(struct usb_serial_port *port);
56static void read_rxcmd_callback(struct urb *urb); 58static void read_rxcmd_callback(struct urb *urb);
57 59
58struct iuu_private { 60struct iuu_private {
@@ -72,63 +74,55 @@ struct iuu_private {
72 u32 clk; 74 u32 clk;
73}; 75};
74 76
75 77static int iuu_port_probe(struct usb_serial_port *port)
76static void iuu_free_buf(struct iuu_private *priv)
77{
78 kfree(priv->buf);
79 kfree(priv->writebuf);
80}
81
82static int iuu_alloc_buf(struct usb_serial *serial, struct iuu_private *priv)
83{
84 priv->buf = kzalloc(256, GFP_KERNEL);
85 priv->writebuf = kzalloc(256, GFP_KERNEL);
86 if (!priv->buf || !priv->writebuf) {
87 iuu_free_buf(priv);
88 dev_dbg(&serial->dev->dev, "%s problem allocation buffer\n", __func__);
89 return -ENOMEM;
90 }
91 dev_dbg(&serial->dev->dev, "%s - Privates buffers allocation success\n", __func__);
92 return 0;
93}
94
95static int iuu_startup(struct usb_serial *serial)
96{ 78{
97 struct iuu_private *priv; 79 struct iuu_private *priv;
80 int ret;
98 81
99 priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); 82 priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
100 dev_dbg(&serial->dev->dev, "%s- priv allocation success\n", __func__);
101 if (!priv) 83 if (!priv)
102 return -ENOMEM; 84 return -ENOMEM;
103 if (iuu_alloc_buf(serial, priv)) { 85
86 priv->buf = kzalloc(256, GFP_KERNEL);
87 if (!priv->buf) {
88 kfree(priv);
89 return -ENOMEM;
90 }
91
92 priv->writebuf = kzalloc(256, GFP_KERNEL);
93 if (!priv->writebuf) {
94 kfree(priv->buf);
104 kfree(priv); 95 kfree(priv);
105 return -ENOMEM; 96 return -ENOMEM;
106 } 97 }
98
107 priv->vcc = vcc_default; 99 priv->vcc = vcc_default;
108 spin_lock_init(&priv->lock); 100 spin_lock_init(&priv->lock);
109 init_waitqueue_head(&priv->delta_msr_wait); 101 init_waitqueue_head(&priv->delta_msr_wait);
110 usb_set_serial_port_data(serial->port[0], priv); 102
103 usb_set_serial_port_data(port, priv);
104
105 ret = iuu_create_sysfs_attrs(port);
106 if (ret) {
107 kfree(priv->writebuf);
108 kfree(priv->buf);
109 kfree(priv);
110 return ret;
111 }
112
111 return 0; 113 return 0;
112} 114}
113 115
114/* Release function */ 116static int iuu_port_remove(struct usb_serial_port *port)
115static void iuu_release(struct usb_serial *serial)
116{ 117{
117 struct usb_serial_port *port = serial->port[0];
118 struct iuu_private *priv = usb_get_serial_port_data(port); 118 struct iuu_private *priv = usb_get_serial_port_data(port);
119 if (!port)
120 return;
121 119
122 if (priv) { 120 iuu_remove_sysfs_attrs(port);
123 iuu_free_buf(priv); 121 kfree(priv->writebuf);
124 dev_dbg(&port->dev, "%s - I will free all\n", __func__); 122 kfree(priv->buf);
125 usb_set_serial_port_data(port, NULL); 123 kfree(priv);
126
127 dev_dbg(&port->dev, "%s - priv is not anymore in port structure\n", __func__);
128 kfree(priv);
129 124
130 dev_dbg(&port->dev, "%s priv is now kfree\n", __func__); 125 return 0;
131 }
132} 126}
133 127
134static int iuu_tiocmset(struct tty_struct *tty, 128static int iuu_tiocmset(struct tty_struct *tty,
@@ -1215,8 +1209,6 @@ static struct usb_serial_driver iuu_device = {
1215 .num_ports = 1, 1209 .num_ports = 1,
1216 .bulk_in_size = 512, 1210 .bulk_in_size = 512,
1217 .bulk_out_size = 512, 1211 .bulk_out_size = 512,
1218 .port_probe = iuu_create_sysfs_attrs,
1219 .port_remove = iuu_remove_sysfs_attrs,
1220 .open = iuu_open, 1212 .open = iuu_open,
1221 .close = iuu_close, 1213 .close = iuu_close,
1222 .write = iuu_uart_write, 1214 .write = iuu_uart_write,
@@ -1225,8 +1217,8 @@ static struct usb_serial_driver iuu_device = {
1225 .tiocmset = iuu_tiocmset, 1217 .tiocmset = iuu_tiocmset,
1226 .set_termios = iuu_set_termios, 1218 .set_termios = iuu_set_termios,
1227 .init_termios = iuu_init_termios, 1219 .init_termios = iuu_init_termios,
1228 .attach = iuu_startup, 1220 .port_probe = iuu_port_probe,
1229 .release = iuu_release, 1221 .port_remove = iuu_port_remove,
1230}; 1222};
1231 1223
1232static struct usb_serial_driver * const serial_drivers[] = { 1224static struct usb_serial_driver * const serial_drivers[] = {
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index ca43ecb4a2bd..bb87e29c4ac2 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -713,29 +713,33 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw");
713MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); 713MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw");
714#endif 714#endif
715 715
716static int keyspan_pda_startup(struct usb_serial *serial) 716static int keyspan_pda_port_probe(struct usb_serial_port *port)
717{ 717{
718 718
719 struct keyspan_pda_private *priv; 719 struct keyspan_pda_private *priv;
720 720
721 /* allocate the private data structures for all ports. Well, for all
722 one ports. */
723
724 priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL); 721 priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
725 if (!priv) 722 if (!priv)
726 return 1; /* error */ 723 return -ENOMEM;
727 usb_set_serial_port_data(serial->port[0], priv); 724
728 init_waitqueue_head(&serial->port[0]->write_wait);
729 INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); 725 INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
730 INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); 726 INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
731 priv->serial = serial; 727 priv->serial = port->serial;
732 priv->port = serial->port[0]; 728 priv->port = port;
729
730 usb_set_serial_port_data(port, priv);
731
733 return 0; 732 return 0;
734} 733}
735 734
736static void keyspan_pda_release(struct usb_serial *serial) 735static int keyspan_pda_port_remove(struct usb_serial_port *port)
737{ 736{
738 kfree(usb_get_serial_port_data(serial->port[0])); 737 struct keyspan_pda_private *priv;
738
739 priv = usb_get_serial_port_data(port);
740 kfree(priv);
741
742 return 0;
739} 743}
740 744
741#ifdef KEYSPAN 745#ifdef KEYSPAN
@@ -786,8 +790,8 @@ static struct usb_serial_driver keyspan_pda_device = {
786 .break_ctl = keyspan_pda_break_ctl, 790 .break_ctl = keyspan_pda_break_ctl,
787 .tiocmget = keyspan_pda_tiocmget, 791 .tiocmget = keyspan_pda_tiocmget,
788 .tiocmset = keyspan_pda_tiocmset, 792 .tiocmset = keyspan_pda_tiocmset,
789 .attach = keyspan_pda_startup, 793 .port_probe = keyspan_pda_port_probe,
790 .release = keyspan_pda_release, 794 .port_remove = keyspan_pda_port_remove,
791}; 795};
792 796
793static struct usb_serial_driver * const serial_drivers[] = { 797static struct usb_serial_driver * const serial_drivers[] = {
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 3f6d7376c02d..1f4517864cd2 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -60,8 +60,8 @@
60/* 60/*
61 * Function prototypes 61 * Function prototypes
62 */ 62 */
63static int klsi_105_startup(struct usb_serial *serial); 63static int klsi_105_port_probe(struct usb_serial_port *port);
64static void klsi_105_release(struct usb_serial *serial); 64static int klsi_105_port_remove(struct usb_serial_port *port);
65static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port); 65static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port);
66static void klsi_105_close(struct usb_serial_port *port); 66static void klsi_105_close(struct usb_serial_port *port);
67static void klsi_105_set_termios(struct tty_struct *tty, 67static void klsi_105_set_termios(struct tty_struct *tty,
@@ -99,8 +99,8 @@ static struct usb_serial_driver kl5kusb105d_device = {
99 /*.break_ctl = klsi_105_break_ctl,*/ 99 /*.break_ctl = klsi_105_break_ctl,*/
100 .tiocmget = klsi_105_tiocmget, 100 .tiocmget = klsi_105_tiocmget,
101 .tiocmset = klsi_105_tiocmset, 101 .tiocmset = klsi_105_tiocmset,
102 .attach = klsi_105_startup, 102 .port_probe = klsi_105_port_probe,
103 .release = klsi_105_release, 103 .port_remove = klsi_105_port_remove,
104 .throttle = usb_serial_generic_throttle, 104 .throttle = usb_serial_generic_throttle,
105 .unthrottle = usb_serial_generic_unthrottle, 105 .unthrottle = usb_serial_generic_unthrottle,
106 .process_read_urb = klsi_105_process_read_urb, 106 .process_read_urb = klsi_105_process_read_urb,
@@ -223,60 +223,40 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
223 * Driver's tty interface functions 223 * Driver's tty interface functions
224 */ 224 */
225 225
226static int klsi_105_startup(struct usb_serial *serial) 226static int klsi_105_port_probe(struct usb_serial_port *port)
227{ 227{
228 struct klsi_105_private *priv; 228 struct klsi_105_private *priv;
229 int i;
230 229
231 /* check if we support the product id (see keyspan.c) 230 priv = kmalloc(sizeof(*priv), GFP_KERNEL);
232 * FIXME 231 if (!priv)
233 */ 232 return -ENOMEM;
234 233
235 /* allocate the private data structure */ 234 /* set initial values for control structures */
236 for (i = 0; i < serial->num_ports; i++) { 235 priv->cfg.pktlen = 5;
237 priv = kmalloc(sizeof(struct klsi_105_private), 236 priv->cfg.baudrate = kl5kusb105a_sio_b9600;
238 GFP_KERNEL); 237 priv->cfg.databits = kl5kusb105a_dtb_8;
239 if (!priv) { 238 priv->cfg.unknown1 = 0;
240 dev_dbg(&serial->interface->dev, 239 priv->cfg.unknown2 = 1;
241 "%s - kmalloc for klsi_105_private failed.\n",
242 __func__);
243 i--;
244 goto err_cleanup;
245 }
246 /* set initial values for control structures */
247 priv->cfg.pktlen = 5;
248 priv->cfg.baudrate = kl5kusb105a_sio_b9600;
249 priv->cfg.databits = kl5kusb105a_dtb_8;
250 priv->cfg.unknown1 = 0;
251 priv->cfg.unknown2 = 1;
252 240
253 priv->line_state = 0; 241 priv->line_state = 0;
254 242
255 usb_set_serial_port_data(serial->port[i], priv); 243 spin_lock_init(&priv->lock);
256 244
257 spin_lock_init(&priv->lock); 245 /* priv->termios is left uninitialized until port opening */
258 246
259 /* priv->termios is left uninitialized until port opening */ 247 usb_set_serial_port_data(port, priv);
260 init_waitqueue_head(&serial->port[i]->write_wait);
261 }
262 248
263 return 0; 249 return 0;
264
265err_cleanup:
266 for (; i >= 0; i--) {
267 priv = usb_get_serial_port_data(serial->port[i]);
268 kfree(priv);
269 usb_set_serial_port_data(serial->port[i], NULL);
270 }
271 return -ENOMEM;
272} 250}
273 251
274static void klsi_105_release(struct usb_serial *serial) 252static int klsi_105_port_remove(struct usb_serial_port *port)
275{ 253{
276 int i; 254 struct klsi_105_private *priv;
255
256 priv = usb_get_serial_port_data(port);
257 kfree(priv);
277 258
278 for (i = 0; i < serial->num_ports; ++i) 259 return 0;
279 kfree(usb_get_serial_port_data(serial->port[i]));
280} 260}
281 261
282static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) 262static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 5c4d2fbd4e11..c9ca7a5b12e0 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -54,8 +54,8 @@
54 54
55 55
56/* Function prototypes */ 56/* Function prototypes */
57static int kobil_startup(struct usb_serial *serial); 57static int kobil_port_probe(struct usb_serial_port *probe);
58static void kobil_release(struct usb_serial *serial); 58static int kobil_port_remove(struct usb_serial_port *probe);
59static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); 59static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port);
60static void kobil_close(struct usb_serial_port *port); 60static void kobil_close(struct usb_serial_port *port);
61static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, 61static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -89,8 +89,8 @@ static struct usb_serial_driver kobil_device = {
89 .description = "KOBIL USB smart card terminal", 89 .description = "KOBIL USB smart card terminal",
90 .id_table = id_table, 90 .id_table = id_table,
91 .num_ports = 1, 91 .num_ports = 1,
92 .attach = kobil_startup, 92 .port_probe = kobil_port_probe,
93 .release = kobil_release, 93 .port_remove = kobil_port_remove,
94 .ioctl = kobil_ioctl, 94 .ioctl = kobil_ioctl,
95 .set_termios = kobil_set_termios, 95 .set_termios = kobil_set_termios,
96 .init_termios = kobil_init_termios, 96 .init_termios = kobil_init_termios,
@@ -117,9 +117,10 @@ struct kobil_private {
117}; 117};
118 118
119 119
120static int kobil_startup(struct usb_serial *serial) 120static int kobil_port_probe(struct usb_serial_port *port)
121{ 121{
122 int i; 122 int i;
123 struct usb_serial *serial = port->serial;
123 struct kobil_private *priv; 124 struct kobil_private *priv;
124 struct usb_device *pdev; 125 struct usb_device *pdev;
125 struct usb_host_config *actconfig; 126 struct usb_host_config *actconfig;
@@ -149,7 +150,7 @@ static int kobil_startup(struct usb_serial *serial)
149 dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n"); 150 dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n");
150 break; 151 break;
151 } 152 }
152 usb_set_serial_port_data(serial->port[0], priv); 153 usb_set_serial_port_data(port, priv);
153 154
154 /* search for the necessary endpoints */ 155 /* search for the necessary endpoints */
155 pdev = serial->dev; 156 pdev = serial->dev;
@@ -179,12 +180,14 @@ static int kobil_startup(struct usb_serial *serial)
179} 180}
180 181
181 182
182static void kobil_release(struct usb_serial *serial) 183static int kobil_port_remove(struct usb_serial_port *port)
183{ 184{
184 int i; 185 struct kobil_private *priv;
185 186
186 for (i = 0; i < serial->num_ports; ++i) 187 priv = usb_get_serial_port_data(port);
187 kfree(usb_get_serial_port_data(serial->port[i])); 188 kfree(priv);
189
190 return 0;
188} 191}
189 192
190static void kobil_init_termios(struct tty_struct *tty) 193static void kobil_init_termios(struct tty_struct *tty)
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 30cff03e9f01..54d4148d01d1 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -503,11 +503,19 @@ static const struct option_blacklist_info net_intf5_blacklist = {
503 .reserved = BIT(5), 503 .reserved = BIT(5),
504}; 504};
505 505
506static const struct option_blacklist_info net_intf6_blacklist = {
507 .reserved = BIT(6),
508};
509
506static const struct option_blacklist_info zte_mf626_blacklist = { 510static const struct option_blacklist_info zte_mf626_blacklist = {
507 .sendsetup = BIT(0) | BIT(1), 511 .sendsetup = BIT(0) | BIT(1),
508 .reserved = BIT(4), 512 .reserved = BIT(4),
509}; 513};
510 514
515static const struct option_blacklist_info zte_1255_blacklist = {
516 .reserved = BIT(3) | BIT(4),
517};
518
511static const struct usb_device_id option_ids[] = { 519static const struct usb_device_id option_ids[] = {
512 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 520 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
513 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 521 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -853,13 +861,19 @@ static const struct usb_device_id option_ids[] = {
853 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff), 861 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff),
854 .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, 862 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
855 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) }, 863 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) },
856 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) }, 864 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff),
857 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) }, 865 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
866 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff),
867 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
858 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) }, 868 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) },
859 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff) }, 869 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff),
860 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff) }, 870 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
861 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff) }, 871 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff),
862 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff) }, 872 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
873 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff),
874 .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
875 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff),
876 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
863 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) }, 877 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) },
864 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) }, 878 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) },
865 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) }, 879 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
@@ -872,7 +886,8 @@ static const struct usb_device_id option_ids[] = {
872 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
873 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff), 887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff),
874 .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, 888 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
875 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, 889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff),
890 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
876 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
877 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, 892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
878 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, 893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
@@ -880,13 +895,22 @@ static const struct usb_device_id option_ids[] = {
880 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, 895 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), 896 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
882 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 897 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
898 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0191, 0xff, 0xff, 0xff), /* ZTE EuFi890 */
899 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
900 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0199, 0xff, 0xff, 0xff), /* ZTE MF820S */
901 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
902 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
903 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), 904 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
884 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 905 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), 906 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
886 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 907 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), 908 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
888 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 909 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 910 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff),
911 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
912 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1021, 0xff, 0xff, 0xff),
913 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, 914 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, 915 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, 916 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1002,18 +1026,24 @@ static const struct usb_device_id option_ids[] = {
1002 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) }, 1026 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) },
1003 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) }, 1027 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) },
1004 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) }, 1028 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) },
1005 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff) }, 1029 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff),
1030 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1006 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) }, 1031 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) },
1007 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff) }, 1032 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff),
1033 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1008 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) }, 1034 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) },
1009 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) }, 1035 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) },
1010 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) }, 1036 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) },
1011 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) }, 1037 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) },
1012 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff) }, 1038 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff),
1039 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1013 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) }, 1040 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) },
1014 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff) }, 1041 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff),
1015 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff) }, 1042 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1016 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff) }, 1043 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff),
1044 .driver_info = (kernel_ulong_t)&zte_1255_blacklist },
1045 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff),
1046 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1017 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) }, 1047 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) },
1018 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) }, 1048 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) },
1019 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) }, 1049 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) },
@@ -1058,8 +1088,16 @@ static const struct usb_device_id option_ids[] = {
1058 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, 1088 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1059 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, 1089 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1060 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, 1090 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1091 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff),
1092 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1061 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff), 1093 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff),
1062 .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, 1094 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1095 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff),
1096 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1097 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff),
1098 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1099 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */
1100 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1063 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 1101 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1064 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, 1102 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1065 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, 1103 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
@@ -1071,15 +1109,21 @@ static const struct usb_device_id option_ids[] = {
1071 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, 1109 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
1072 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 1110 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1073 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, 1111 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1074 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, 1112 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff),
1075 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff) }, 1113 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1076 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, 1114 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff),
1115 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1116 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff),
1117 .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1077 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) }, 1118 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
1078 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) }, 1119 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1079 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) }, 1120 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff),
1121 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1080 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) }, 1122 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1081 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) }, 1123 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff),
1082 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) }, 1124 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1125 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
1126 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1083 1127
1084 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1128 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1085 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 1129 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 933241f03fd8..cee9a52ca891 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -137,8 +137,8 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty);
137static int oti6858_tiocmget(struct tty_struct *tty); 137static int oti6858_tiocmget(struct tty_struct *tty);
138static int oti6858_tiocmset(struct tty_struct *tty, 138static int oti6858_tiocmset(struct tty_struct *tty,
139 unsigned int set, unsigned int clear); 139 unsigned int set, unsigned int clear);
140static int oti6858_startup(struct usb_serial *serial); 140static int oti6858_port_probe(struct usb_serial_port *port);
141static void oti6858_release(struct usb_serial *serial); 141static int oti6858_port_remove(struct usb_serial_port *port);
142 142
143/* device info */ 143/* device info */
144static struct usb_serial_driver oti6858_device = { 144static struct usb_serial_driver oti6858_device = {
@@ -161,8 +161,8 @@ static struct usb_serial_driver oti6858_device = {
161 .write_bulk_callback = oti6858_write_bulk_callback, 161 .write_bulk_callback = oti6858_write_bulk_callback,
162 .write_room = oti6858_write_room, 162 .write_room = oti6858_write_room,
163 .chars_in_buffer = oti6858_chars_in_buffer, 163 .chars_in_buffer = oti6858_chars_in_buffer,
164 .attach = oti6858_startup, 164 .port_probe = oti6858_port_probe,
165 .release = oti6858_release, 165 .port_remove = oti6858_port_remove,
166}; 166};
167 167
168static struct usb_serial_driver * const serial_drivers[] = { 168static struct usb_serial_driver * const serial_drivers[] = {
@@ -331,36 +331,33 @@ static void send_data(struct work_struct *work)
331 usb_serial_port_softint(port); 331 usb_serial_port_softint(port);
332} 332}
333 333
334static int oti6858_startup(struct usb_serial *serial) 334static int oti6858_port_probe(struct usb_serial_port *port)
335{ 335{
336 struct usb_serial_port *port = serial->port[0];
337 struct oti6858_private *priv; 336 struct oti6858_private *priv;
338 int i;
339
340 for (i = 0; i < serial->num_ports; ++i) {
341 priv = kzalloc(sizeof(struct oti6858_private), GFP_KERNEL);
342 if (!priv)
343 break;
344
345 spin_lock_init(&priv->lock);
346 init_waitqueue_head(&priv->intr_wait);
347/* INIT_WORK(&priv->setup_work, setup_line, serial->port[i]); */
348/* INIT_WORK(&priv->write_work, send_data, serial->port[i]); */
349 priv->port = port;
350 INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line);
351 INIT_DELAYED_WORK(&priv->delayed_write_work, send_data);
352
353 usb_set_serial_port_data(serial->port[i], priv);
354 }
355 if (i == serial->num_ports)
356 return 0;
357 337
358 for (--i; i >= 0; --i) { 338 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
359 priv = usb_get_serial_port_data(serial->port[i]); 339 if (!priv)
360 kfree(priv); 340 return -ENOMEM;
361 usb_set_serial_port_data(serial->port[i], NULL); 341
362 } 342 spin_lock_init(&priv->lock);
363 return -ENOMEM; 343 init_waitqueue_head(&priv->intr_wait);
344 priv->port = port;
345 INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line);
346 INIT_DELAYED_WORK(&priv->delayed_write_work, send_data);
347
348 usb_set_serial_port_data(port, priv);
349
350 return 0;
351}
352
353static int oti6858_port_remove(struct usb_serial_port *port)
354{
355 struct oti6858_private *priv;
356
357 priv = usb_get_serial_port_data(port);
358 kfree(priv);
359
360 return 0;
364} 361}
365 362
366static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, 363static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -709,15 +706,6 @@ static int oti6858_ioctl(struct tty_struct *tty,
709 return -ENOIOCTLCMD; 706 return -ENOIOCTLCMD;
710} 707}
711 708
712
713static void oti6858_release(struct usb_serial *serial)
714{
715 int i;
716
717 for (i = 0; i < serial->num_ports; ++i)
718 kfree(usb_get_serial_port_data(serial->port[i]));
719}
720
721static void oti6858_read_int_callback(struct urb *urb) 709static void oti6858_read_int_callback(struct urb *urb)
722{ 710{
723 struct usb_serial_port *port = urb->context; 711 struct usb_serial_port *port = urb->context;
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 892ebdc7a364..600241901361 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -133,12 +133,15 @@ enum pl2303_type {
133 HX, /* HX version of the pl2303 chip */ 133 HX, /* HX version of the pl2303 chip */
134}; 134};
135 135
136struct pl2303_serial_private {
137 enum pl2303_type type;
138};
139
136struct pl2303_private { 140struct pl2303_private {
137 spinlock_t lock; 141 spinlock_t lock;
138 wait_queue_head_t delta_msr_wait; 142 wait_queue_head_t delta_msr_wait;
139 u8 line_control; 143 u8 line_control;
140 u8 line_status; 144 u8 line_status;
141 enum pl2303_type type;
142}; 145};
143 146
144static int pl2303_vendor_read(__u16 value, __u16 index, 147static int pl2303_vendor_read(__u16 value, __u16 index,
@@ -167,14 +170,19 @@ static int pl2303_vendor_write(__u16 value, __u16 index,
167 170
168static int pl2303_startup(struct usb_serial *serial) 171static int pl2303_startup(struct usb_serial *serial)
169{ 172{
170 struct pl2303_private *priv; 173 struct pl2303_serial_private *spriv;
171 enum pl2303_type type = type_0; 174 enum pl2303_type type = type_0;
172 unsigned char *buf; 175 unsigned char *buf;
173 int i; 176
177 spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
178 if (!spriv)
179 return -ENOMEM;
174 180
175 buf = kmalloc(10, GFP_KERNEL); 181 buf = kmalloc(10, GFP_KERNEL);
176 if (buf == NULL) 182 if (!buf) {
183 kfree(spriv);
177 return -ENOMEM; 184 return -ENOMEM;
185 }
178 186
179 if (serial->dev->descriptor.bDeviceClass == 0x02) 187 if (serial->dev->descriptor.bDeviceClass == 0x02)
180 type = type_0; 188 type = type_0;
@@ -186,15 +194,8 @@ static int pl2303_startup(struct usb_serial *serial)
186 type = type_1; 194 type = type_1;
187 dev_dbg(&serial->interface->dev, "device type: %d\n", type); 195 dev_dbg(&serial->interface->dev, "device type: %d\n", type);
188 196
189 for (i = 0; i < serial->num_ports; ++i) { 197 spriv->type = type;
190 priv = kzalloc(sizeof(struct pl2303_private), GFP_KERNEL); 198 usb_set_serial_data(serial, spriv);
191 if (!priv)
192 goto cleanup;
193 spin_lock_init(&priv->lock);
194 init_waitqueue_head(&priv->delta_msr_wait);
195 priv->type = type;
196 usb_set_serial_port_data(serial->port[i], priv);
197 }
198 199
199 pl2303_vendor_read(0x8484, 0, serial, buf); 200 pl2303_vendor_read(0x8484, 0, serial, buf);
200 pl2303_vendor_write(0x0404, 0, serial); 201 pl2303_vendor_write(0x0404, 0, serial);
@@ -213,15 +214,40 @@ static int pl2303_startup(struct usb_serial *serial)
213 214
214 kfree(buf); 215 kfree(buf);
215 return 0; 216 return 0;
217}
216 218
217cleanup: 219static void pl2303_release(struct usb_serial *serial)
218 kfree(buf); 220{
219 for (--i; i >= 0; --i) { 221 struct pl2303_serial_private *spriv;
220 priv = usb_get_serial_port_data(serial->port[i]); 222
221 kfree(priv); 223 spriv = usb_get_serial_data(serial);
222 usb_set_serial_port_data(serial->port[i], NULL); 224 kfree(spriv);
223 } 225}
224 return -ENOMEM; 226
227static int pl2303_port_probe(struct usb_serial_port *port)
228{
229 struct pl2303_private *priv;
230
231 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
232 if (!priv)
233 return -ENOMEM;
234
235 spin_lock_init(&priv->lock);
236 init_waitqueue_head(&priv->delta_msr_wait);
237
238 usb_set_serial_port_data(port, priv);
239
240 return 0;
241}
242
243static int pl2303_port_remove(struct usb_serial_port *port)
244{
245 struct pl2303_private *priv;
246
247 priv = usb_get_serial_port_data(port);
248 kfree(priv);
249
250 return 0;
225} 251}
226 252
227static int set_control_lines(struct usb_device *dev, u8 value) 253static int set_control_lines(struct usb_device *dev, u8 value)
@@ -240,6 +266,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
240 struct usb_serial_port *port, struct ktermios *old_termios) 266 struct usb_serial_port *port, struct ktermios *old_termios)
241{ 267{
242 struct usb_serial *serial = port->serial; 268 struct usb_serial *serial = port->serial;
269 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
243 struct pl2303_private *priv = usb_get_serial_port_data(port); 270 struct pl2303_private *priv = usb_get_serial_port_data(port);
244 unsigned long flags; 271 unsigned long flags;
245 unsigned int cflag; 272 unsigned int cflag;
@@ -323,7 +350,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
323 } 350 }
324 if (baud > 1228800) { 351 if (baud > 1228800) {
325 /* type_0, type_1 only support up to 1228800 baud */ 352 /* type_0, type_1 only support up to 1228800 baud */
326 if (priv->type != HX) 353 if (spriv->type != HX)
327 baud = 1228800; 354 baud = 1228800;
328 else if (baud > 6000000) 355 else if (baud > 6000000)
329 baud = 6000000; 356 baud = 6000000;
@@ -426,7 +453,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
426 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]); 453 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
427 454
428 if (cflag & CRTSCTS) { 455 if (cflag & CRTSCTS) {
429 if (priv->type == HX) 456 if (spriv->type == HX)
430 pl2303_vendor_write(0x0, 0x61, serial); 457 pl2303_vendor_write(0x0, 0x61, serial);
431 else 458 else
432 pl2303_vendor_write(0x0, 0x41, serial); 459 pl2303_vendor_write(0x0, 0x41, serial);
@@ -468,10 +495,10 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
468{ 495{
469 struct ktermios tmp_termios; 496 struct ktermios tmp_termios;
470 struct usb_serial *serial = port->serial; 497 struct usb_serial *serial = port->serial;
471 struct pl2303_private *priv = usb_get_serial_port_data(port); 498 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
472 int result; 499 int result;
473 500
474 if (priv->type != HX) { 501 if (spriv->type != HX) {
475 usb_clear_halt(serial->dev, port->write_urb->pipe); 502 usb_clear_halt(serial->dev, port->write_urb->pipe);
476 usb_clear_halt(serial->dev, port->read_urb->pipe); 503 usb_clear_halt(serial->dev, port->read_urb->pipe);
477 } else { 504 } else {
@@ -655,17 +682,6 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state)
655 dev_err(&port->dev, "error sending break = %d\n", result); 682 dev_err(&port->dev, "error sending break = %d\n", result);
656} 683}
657 684
658static void pl2303_release(struct usb_serial *serial)
659{
660 int i;
661 struct pl2303_private *priv;
662
663 for (i = 0; i < serial->num_ports; ++i) {
664 priv = usb_get_serial_port_data(serial->port[i]);
665 kfree(priv);
666 }
667}
668
669static void pl2303_update_line_status(struct usb_serial_port *port, 685static void pl2303_update_line_status(struct usb_serial_port *port,
670 unsigned char *data, 686 unsigned char *data,
671 unsigned int actual_length) 687 unsigned int actual_length)
@@ -827,6 +843,8 @@ static struct usb_serial_driver pl2303_device = {
827 .read_int_callback = pl2303_read_int_callback, 843 .read_int_callback = pl2303_read_int_callback,
828 .attach = pl2303_startup, 844 .attach = pl2303_startup,
829 .release = pl2303_release, 845 .release = pl2303_release,
846 .port_probe = pl2303_port_probe,
847 .port_remove = pl2303_port_remove,
830}; 848};
831 849
832static struct usb_serial_driver * const serial_drivers[] = { 850static struct usb_serial_driver * const serial_drivers[] = {
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 9716efe92955..769c137f8975 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -157,13 +157,10 @@ struct spcp8x5_private {
157 u8 line_status; 157 u8 line_status;
158}; 158};
159 159
160/* desc : when device plug in,this function would be called. 160static int spcp8x5_port_probe(struct usb_serial_port *port)
161 * thanks to usb_serial subsystem,then do almost every things for us. And what
162 * we should do just alloc the buffer */
163static int spcp8x5_startup(struct usb_serial *serial)
164{ 161{
162 struct usb_serial *serial = port->serial;
165 struct spcp8x5_private *priv; 163 struct spcp8x5_private *priv;
166 int i;
167 enum spcp8x5_type type = SPCP825_007_TYPE; 164 enum spcp8x5_type type = SPCP825_007_TYPE;
168 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); 165 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
169 166
@@ -180,34 +177,27 @@ static int spcp8x5_startup(struct usb_serial *serial)
180 type = SPCP825_PHILIP_TYPE; 177 type = SPCP825_PHILIP_TYPE;
181 dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); 178 dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type);
182 179
183 for (i = 0; i < serial->num_ports; ++i) { 180 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
184 priv = kzalloc(sizeof(struct spcp8x5_private), GFP_KERNEL); 181 if (!priv)
185 if (!priv) 182 return -ENOMEM;
186 goto cleanup;
187 183
188 spin_lock_init(&priv->lock); 184 spin_lock_init(&priv->lock);
189 init_waitqueue_head(&priv->delta_msr_wait); 185 init_waitqueue_head(&priv->delta_msr_wait);
190 priv->type = type; 186 priv->type = type;
191 usb_set_serial_port_data(serial->port[i] , priv); 187
192 } 188 usb_set_serial_port_data(port , priv);
193 189
194 return 0; 190 return 0;
195cleanup:
196 for (--i; i >= 0; --i) {
197 priv = usb_get_serial_port_data(serial->port[i]);
198 kfree(priv);
199 usb_set_serial_port_data(serial->port[i] , NULL);
200 }
201 return -ENOMEM;
202} 191}
203 192
204/* call when the device plug out. free all the memory alloced by probe */ 193static int spcp8x5_port_remove(struct usb_serial_port *port)
205static void spcp8x5_release(struct usb_serial *serial)
206{ 194{
207 int i; 195 struct spcp8x5_private *priv;
208 196
209 for (i = 0; i < serial->num_ports; i++) 197 priv = usb_get_serial_port_data(port);
210 kfree(usb_get_serial_port_data(serial->port[i])); 198 kfree(priv);
199
200 return 0;
211} 201}
212 202
213/* set the modem control line of the device. 203/* set the modem control line of the device.
@@ -649,8 +639,8 @@ static struct usb_serial_driver spcp8x5_device = {
649 .ioctl = spcp8x5_ioctl, 639 .ioctl = spcp8x5_ioctl,
650 .tiocmget = spcp8x5_tiocmget, 640 .tiocmget = spcp8x5_tiocmget,
651 .tiocmset = spcp8x5_tiocmset, 641 .tiocmset = spcp8x5_tiocmset,
652 .attach = spcp8x5_startup, 642 .port_probe = spcp8x5_port_probe,
653 .release = spcp8x5_release, 643 .port_remove = spcp8x5_port_remove,
654 .process_read_urb = spcp8x5_process_read_urb, 644 .process_read_urb = spcp8x5_process_read_urb,
655}; 645};
656 646
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index 015810b3785b..868d1e6852e2 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -67,13 +67,6 @@ struct ssu100_port_private {
67 struct async_icount icount; 67 struct async_icount icount;
68}; 68};
69 69
70static void ssu100_release(struct usb_serial *serial)
71{
72 struct ssu100_port_private *priv = usb_get_serial_port_data(*serial->port);
73
74 kfree(priv);
75}
76
77static inline int ssu100_control_msg(struct usb_device *dev, 70static inline int ssu100_control_msg(struct usb_device *dev,
78 u8 request, u16 data, u16 index) 71 u8 request, u16 data, u16 index)
79{ 72{
@@ -442,21 +435,33 @@ static int ssu100_ioctl(struct tty_struct *tty,
442 435
443static int ssu100_attach(struct usb_serial *serial) 436static int ssu100_attach(struct usb_serial *serial)
444{ 437{
438 return ssu100_initdevice(serial->dev);
439}
440
441static int ssu100_port_probe(struct usb_serial_port *port)
442{
445 struct ssu100_port_private *priv; 443 struct ssu100_port_private *priv;
446 struct usb_serial_port *port = *serial->port;
447 444
448 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 445 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
449 if (!priv) { 446 if (!priv)
450 dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
451 sizeof(*priv));
452 return -ENOMEM; 447 return -ENOMEM;
453 }
454 448
455 spin_lock_init(&priv->status_lock); 449 spin_lock_init(&priv->status_lock);
456 init_waitqueue_head(&priv->delta_msr_wait); 450 init_waitqueue_head(&priv->delta_msr_wait);
451
457 usb_set_serial_port_data(port, priv); 452 usb_set_serial_port_data(port, priv);
458 453
459 return ssu100_initdevice(serial->dev); 454 return 0;
455}
456
457static int ssu100_port_remove(struct usb_serial_port *port)
458{
459 struct ssu100_port_private *priv;
460
461 priv = usb_get_serial_port_data(port);
462 kfree(priv);
463
464 return 0;
460} 465}
461 466
462static int ssu100_tiocmget(struct tty_struct *tty) 467static int ssu100_tiocmget(struct tty_struct *tty)
@@ -647,7 +652,8 @@ static struct usb_serial_driver ssu100_device = {
647 .open = ssu100_open, 652 .open = ssu100_open,
648 .close = ssu100_close, 653 .close = ssu100_close,
649 .attach = ssu100_attach, 654 .attach = ssu100_attach,
650 .release = ssu100_release, 655 .port_probe = ssu100_port_probe,
656 .port_remove = ssu100_port_remove,
651 .dtr_rts = ssu100_dtr_rts, 657 .dtr_rts = ssu100_dtr_rts,
652 .process_read_urb = ssu100_process_read_urb, 658 .process_read_urb = ssu100_process_read_urb,
653 .tiocmget = ssu100_tiocmget, 659 .tiocmget = ssu100_tiocmget,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 6f49392cda5b..f2530d2ef3c4 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -97,6 +97,8 @@ struct ti_device {
97 97
98static int ti_startup(struct usb_serial *serial); 98static int ti_startup(struct usb_serial *serial);
99static void ti_release(struct usb_serial *serial); 99static void ti_release(struct usb_serial *serial);
100static int ti_port_probe(struct usb_serial_port *port);
101static int ti_port_remove(struct usb_serial_port *port);
100static int ti_open(struct tty_struct *tty, struct usb_serial_port *port); 102static int ti_open(struct tty_struct *tty, struct usb_serial_port *port);
101static void ti_close(struct usb_serial_port *port); 103static void ti_close(struct usb_serial_port *port);
102static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, 104static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
@@ -221,6 +223,8 @@ static struct usb_serial_driver ti_1port_device = {
221 .num_ports = 1, 223 .num_ports = 1,
222 .attach = ti_startup, 224 .attach = ti_startup,
223 .release = ti_release, 225 .release = ti_release,
226 .port_probe = ti_port_probe,
227 .port_remove = ti_port_remove,
224 .open = ti_open, 228 .open = ti_open,
225 .close = ti_close, 229 .close = ti_close,
226 .write = ti_write, 230 .write = ti_write,
@@ -249,6 +253,8 @@ static struct usb_serial_driver ti_2port_device = {
249 .num_ports = 2, 253 .num_ports = 2,
250 .attach = ti_startup, 254 .attach = ti_startup,
251 .release = ti_release, 255 .release = ti_release,
256 .port_probe = ti_port_probe,
257 .port_remove = ti_port_remove,
252 .open = ti_open, 258 .open = ti_open,
253 .close = ti_close, 259 .close = ti_close,
254 .write = ti_write, 260 .write = ti_write,
@@ -347,11 +353,8 @@ module_exit(ti_exit);
347static int ti_startup(struct usb_serial *serial) 353static int ti_startup(struct usb_serial *serial)
348{ 354{
349 struct ti_device *tdev; 355 struct ti_device *tdev;
350 struct ti_port *tport;
351 struct usb_device *dev = serial->dev; 356 struct usb_device *dev = serial->dev;
352 int status; 357 int status;
353 int i;
354
355 358
356 dev_dbg(&dev->dev, 359 dev_dbg(&dev->dev,
357 "%s - product 0x%4X, num configurations %d, configuration value %d", 360 "%s - product 0x%4X, num configurations %d, configuration value %d",
@@ -399,42 +402,8 @@ static int ti_startup(struct usb_serial *serial)
399 goto free_tdev; 402 goto free_tdev;
400 } 403 }
401 404
402 /* set up port structures */
403 for (i = 0; i < serial->num_ports; ++i) {
404 tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL);
405 if (tport == NULL) {
406 dev_err(&dev->dev, "%s - out of memory\n", __func__);
407 status = -ENOMEM;
408 goto free_tports;
409 }
410 spin_lock_init(&tport->tp_lock);
411 tport->tp_uart_base_addr = (i == 0 ?
412 TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR);
413 tport->tp_closing_wait = closing_wait;
414 init_waitqueue_head(&tport->tp_msr_wait);
415 init_waitqueue_head(&tport->tp_write_wait);
416 if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE,
417 GFP_KERNEL)) {
418 dev_err(&dev->dev, "%s - out of memory\n", __func__);
419 kfree(tport);
420 status = -ENOMEM;
421 goto free_tports;
422 }
423 tport->tp_port = serial->port[i];
424 tport->tp_tdev = tdev;
425 usb_set_serial_port_data(serial->port[i], tport);
426 tport->tp_uart_mode = 0; /* default is RS232 */
427 }
428
429 return 0; 405 return 0;
430 406
431free_tports:
432 for (--i; i >= 0; --i) {
433 tport = usb_get_serial_port_data(serial->port[i]);
434 kfifo_free(&tport->write_fifo);
435 kfree(tport);
436 usb_set_serial_port_data(serial->port[i], NULL);
437 }
438free_tdev: 407free_tdev:
439 kfree(tdev); 408 kfree(tdev);
440 usb_set_serial_data(serial, NULL); 409 usb_set_serial_data(serial, NULL);
@@ -444,21 +413,50 @@ free_tdev:
444 413
445static void ti_release(struct usb_serial *serial) 414static void ti_release(struct usb_serial *serial)
446{ 415{
447 int i;
448 struct ti_device *tdev = usb_get_serial_data(serial); 416 struct ti_device *tdev = usb_get_serial_data(serial);
417
418 kfree(tdev);
419}
420
421static int ti_port_probe(struct usb_serial_port *port)
422{
449 struct ti_port *tport; 423 struct ti_port *tport;
450 424
451 for (i = 0; i < serial->num_ports; ++i) { 425 tport = kzalloc(sizeof(*tport), GFP_KERNEL);
452 tport = usb_get_serial_port_data(serial->port[i]); 426 if (!tport)
453 if (tport) { 427 return -ENOMEM;
454 kfifo_free(&tport->write_fifo); 428
455 kfree(tport); 429 spin_lock_init(&tport->tp_lock);
456 } 430 if (port == port->serial->port[0])
431 tport->tp_uart_base_addr = TI_UART1_BASE_ADDR;
432 else
433 tport->tp_uart_base_addr = TI_UART2_BASE_ADDR;
434 tport->tp_closing_wait = closing_wait;
435 init_waitqueue_head(&tport->tp_msr_wait);
436 init_waitqueue_head(&tport->tp_write_wait);
437 if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) {
438 kfree(tport);
439 return -ENOMEM;
457 } 440 }
441 tport->tp_port = port;
442 tport->tp_tdev = usb_get_serial_data(port->serial);
443 tport->tp_uart_mode = 0; /* default is RS232 */
458 444
459 kfree(tdev); 445 usb_set_serial_port_data(port, tport);
446
447 return 0;
460} 448}
461 449
450static int ti_port_remove(struct usb_serial_port *port)
451{
452 struct ti_port *tport;
453
454 tport = usb_get_serial_port_data(port);
455 kfifo_free(&tport->write_fifo);
456 kfree(tport);
457
458 return 0;
459}
462 460
463static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) 461static int ti_open(struct tty_struct *tty, struct usb_serial_port *port)
464{ 462{
diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
index c6915c6c3cd1..585949b57055 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -206,11 +206,11 @@ static ssize_t lm3639_bled_mode_store(struct device *dev,
206 206
207out: 207out:
208 dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__); 208 dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__);
209 return size; 209 return ret;
210 210
211out_input: 211out_input:
212 dev_err(pchip->dev, "%s:input conversion fail\n", __func__); 212 dev_err(pchip->dev, "%s:input conversion fail\n", __func__);
213 return size; 213 return ret;
214 214
215} 215}
216 216
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 48220e129f85..f5dda83ad7a5 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -625,7 +625,7 @@ static struct xenbus_watch *find_watch(const char *token)
625 * so if we are running on anything older than 4 do not attempt to read 625 * so if we are running on anything older than 4 do not attempt to read
626 * control/platform-feature-xs_reset_watches. 626 * control/platform-feature-xs_reset_watches.
627 */ 627 */
628static bool xen_strict_xenbus_quirk() 628static bool xen_strict_xenbus_quirk(void)
629{ 629{
630 uint32_t eax, ebx, ecx, edx, base; 630 uint32_t eax, ebx, ecx, edx, base;
631 631
diff --git a/fs/coredump.c b/fs/coredump.c
index fd37facac8dc..ce47379bfa61 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -450,11 +450,12 @@ static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
450 450
451 cp->file = files[1]; 451 cp->file = files[1];
452 452
453 replace_fd(0, files[0], 0); 453 err = replace_fd(0, files[0], 0);
454 fput(files[0]);
454 /* and disallow core files too */ 455 /* and disallow core files too */
455 current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1}; 456 current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
456 457
457 return 0; 458 return err;
458} 459}
459 460
460void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) 461void do_coredump(siginfo_t *siginfo, struct pt_regs *regs)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 14afbabe6546..472e6befc54d 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -545,37 +545,38 @@ void devpts_kill_index(struct inode *ptmx_inode, int idx)
545 mutex_unlock(&allocated_ptys_lock); 545 mutex_unlock(&allocated_ptys_lock);
546} 546}
547 547
548int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) 548/**
549 * devpts_pty_new -- create a new inode in /dev/pts/
550 * @ptmx_inode: inode of the master
551 * @device: major+minor of the node to be created
552 * @index: used as a name of the node
553 * @priv: what's given back by devpts_get_priv
554 *
555 * The created inode is returned. Remove it from /dev/pts/ by devpts_pty_kill.
556 */
557struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
558 void *priv)
549{ 559{
550 /* tty layer puts index from devpts_new_index() in here */
551 int number = tty->index;
552 struct tty_driver *driver = tty->driver;
553 dev_t device = MKDEV(driver->major, driver->minor_start+number);
554 struct dentry *dentry; 560 struct dentry *dentry;
555 struct super_block *sb = pts_sb_from_inode(ptmx_inode); 561 struct super_block *sb = pts_sb_from_inode(ptmx_inode);
556 struct inode *inode = new_inode(sb); 562 struct inode *inode;
557 struct dentry *root = sb->s_root; 563 struct dentry *root = sb->s_root;
558 struct pts_fs_info *fsi = DEVPTS_SB(sb); 564 struct pts_fs_info *fsi = DEVPTS_SB(sb);
559 struct pts_mount_opts *opts = &fsi->mount_opts; 565 struct pts_mount_opts *opts = &fsi->mount_opts;
560 int ret = 0;
561 char s[12]; 566 char s[12];
562 567
563 /* We're supposed to be given the slave end of a pty */ 568 inode = new_inode(sb);
564 BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY);
565 BUG_ON(driver->subtype != PTY_TYPE_SLAVE);
566
567 if (!inode) 569 if (!inode)
568 return -ENOMEM; 570 return ERR_PTR(-ENOMEM);
569 571
570 inode->i_ino = number + 3; 572 inode->i_ino = index + 3;
571 inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); 573 inode->i_uid = opts->setuid ? opts->uid : current_fsuid();
572 inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); 574 inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
573 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 575 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
574 init_special_inode(inode, S_IFCHR|opts->mode, device); 576 init_special_inode(inode, S_IFCHR|opts->mode, device);
575 inode->i_private = tty; 577 inode->i_private = priv;
576 tty->driver_data = inode;
577 578
578 sprintf(s, "%d", number); 579 sprintf(s, "%d", index);
579 580
580 mutex_lock(&root->d_inode->i_mutex); 581 mutex_lock(&root->d_inode->i_mutex);
581 582
@@ -585,18 +586,24 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
585 fsnotify_create(root->d_inode, dentry); 586 fsnotify_create(root->d_inode, dentry);
586 } else { 587 } else {
587 iput(inode); 588 iput(inode);
588 ret = -ENOMEM; 589 inode = ERR_PTR(-ENOMEM);
589 } 590 }
590 591
591 mutex_unlock(&root->d_inode->i_mutex); 592 mutex_unlock(&root->d_inode->i_mutex);
592 593
593 return ret; 594 return inode;
594} 595}
595 596
596struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) 597/**
598 * devpts_get_priv -- get private data for a slave
599 * @pts_inode: inode of the slave
600 *
601 * Returns whatever was passed as priv in devpts_pty_new for a given inode.
602 */
603void *devpts_get_priv(struct inode *pts_inode)
597{ 604{
598 struct dentry *dentry; 605 struct dentry *dentry;
599 struct tty_struct *tty; 606 void *priv = NULL;
600 607
601 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); 608 BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
602 609
@@ -605,18 +612,22 @@ struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
605 if (!dentry) 612 if (!dentry)
606 return NULL; 613 return NULL;
607 614
608 tty = NULL;
609 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) 615 if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
610 tty = (struct tty_struct *)pts_inode->i_private; 616 priv = pts_inode->i_private;
611 617
612 dput(dentry); 618 dput(dentry);
613 619
614 return tty; 620 return priv;
615} 621}
616 622
617void devpts_pty_kill(struct tty_struct *tty) 623/**
624 * devpts_pty_kill -- remove inode form /dev/pts/
625 * @inode: inode of the slave to be removed
626 *
627 * This is an inverse operation of devpts_pty_new.
628 */
629void devpts_pty_kill(struct inode *inode)
618{ 630{
619 struct inode *inode = tty->driver_data;
620 struct super_block *sb = pts_sb_from_inode(inode); 631 struct super_block *sb = pts_sb_from_inode(inode);
621 struct dentry *root = sb->s_root; 632 struct dentry *root = sb->s_root;
622 struct dentry *dentry; 633 struct dentry *dentry;
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 6c205d0c565b..fa04d023177e 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -469,7 +469,7 @@ static int parse_options(char *options, struct super_block *sb)
469 uid = make_kuid(current_user_ns(), option); 469 uid = make_kuid(current_user_ns(), option);
470 if (!uid_valid(uid)) { 470 if (!uid_valid(uid)) {
471 ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option); 471 ext2_msg(sb, KERN_ERR, "Invalid uid value %d", option);
472 return -1; 472 return 0;
473 473
474 } 474 }
475 sbi->s_resuid = uid; 475 sbi->s_resuid = uid;
@@ -480,7 +480,7 @@ static int parse_options(char *options, struct super_block *sb)
480 gid = make_kgid(current_user_ns(), option); 480 gid = make_kgid(current_user_ns(), option);
481 if (!gid_valid(gid)) { 481 if (!gid_valid(gid)) {
482 ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option); 482 ext2_msg(sb, KERN_ERR, "Invalid gid value %d", option);
483 return -1; 483 return 0;
484 } 484 }
485 sbi->s_resgid = gid; 485 sbi->s_resgid = gid;
486 break; 486 break;
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 8f4fddac01a6..890b8947c546 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -46,8 +46,7 @@ static struct buffer_head *ext3_append(handle_t *handle,
46 46
47 *block = inode->i_size >> inode->i_sb->s_blocksize_bits; 47 *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
48 48
49 bh = ext3_bread(handle, inode, *block, 1, err); 49 if ((bh = ext3_dir_bread(handle, inode, *block, 1, err))) {
50 if (bh) {
51 inode->i_size += inode->i_sb->s_blocksize; 50 inode->i_size += inode->i_sb->s_blocksize;
52 EXT3_I(inode)->i_disksize = inode->i_size; 51 EXT3_I(inode)->i_disksize = inode->i_size;
53 *err = ext3_journal_get_write_access(handle, bh); 52 *err = ext3_journal_get_write_access(handle, bh);
@@ -339,8 +338,10 @@ dx_probe(struct qstr *entry, struct inode *dir,
339 u32 hash; 338 u32 hash;
340 339
341 frame->bh = NULL; 340 frame->bh = NULL;
342 if (!(bh = ext3_bread (NULL,dir, 0, 0, err))) 341 if (!(bh = ext3_dir_bread(NULL, dir, 0, 0, err))) {
342 *err = ERR_BAD_DX_DIR;
343 goto fail; 343 goto fail;
344 }
344 root = (struct dx_root *) bh->b_data; 345 root = (struct dx_root *) bh->b_data;
345 if (root->info.hash_version != DX_HASH_TEA && 346 if (root->info.hash_version != DX_HASH_TEA &&
346 root->info.hash_version != DX_HASH_HALF_MD4 && 347 root->info.hash_version != DX_HASH_HALF_MD4 &&
@@ -436,8 +437,10 @@ dx_probe(struct qstr *entry, struct inode *dir,
436 frame->entries = entries; 437 frame->entries = entries;
437 frame->at = at; 438 frame->at = at;
438 if (!indirect--) return frame; 439 if (!indirect--) return frame;
439 if (!(bh = ext3_bread (NULL,dir, dx_get_block(at), 0, err))) 440 if (!(bh = ext3_dir_bread(NULL, dir, dx_get_block(at), 0, err))) {
441 *err = ERR_BAD_DX_DIR;
440 goto fail2; 442 goto fail2;
443 }
441 at = entries = ((struct dx_node *) bh->b_data)->entries; 444 at = entries = ((struct dx_node *) bh->b_data)->entries;
442 if (dx_get_limit(entries) != dx_node_limit (dir)) { 445 if (dx_get_limit(entries) != dx_node_limit (dir)) {
443 ext3_warning(dir->i_sb, __func__, 446 ext3_warning(dir->i_sb, __func__,
@@ -535,8 +538,8 @@ static int ext3_htree_next_block(struct inode *dir, __u32 hash,
535 * block so no check is necessary 538 * block so no check is necessary
536 */ 539 */
537 while (num_frames--) { 540 while (num_frames--) {
538 if (!(bh = ext3_bread(NULL, dir, dx_get_block(p->at), 541 if (!(bh = ext3_dir_bread(NULL, dir, dx_get_block(p->at),
539 0, &err))) 542 0, &err)))
540 return err; /* Failure */ 543 return err; /* Failure */
541 p++; 544 p++;
542 brelse (p->bh); 545 brelse (p->bh);
@@ -559,10 +562,11 @@ static int htree_dirblock_to_tree(struct file *dir_file,
559{ 562{
560 struct buffer_head *bh; 563 struct buffer_head *bh;
561 struct ext3_dir_entry_2 *de, *top; 564 struct ext3_dir_entry_2 *de, *top;
562 int err, count = 0; 565 int err = 0, count = 0;
563 566
564 dxtrace(printk("In htree dirblock_to_tree: block %d\n", block)); 567 dxtrace(printk("In htree dirblock_to_tree: block %d\n", block));
565 if (!(bh = ext3_bread (NULL, dir, block, 0, &err))) 568
569 if (!(bh = ext3_dir_bread(NULL, dir, block, 0, &err)))
566 return err; 570 return err;
567 571
568 de = (struct ext3_dir_entry_2 *) bh->b_data; 572 de = (struct ext3_dir_entry_2 *) bh->b_data;
@@ -976,7 +980,7 @@ static struct buffer_head * ext3_dx_find_entry(struct inode *dir,
976 return NULL; 980 return NULL;
977 do { 981 do {
978 block = dx_get_block(frame->at); 982 block = dx_get_block(frame->at);
979 if (!(bh = ext3_bread (NULL,dir, block, 0, err))) 983 if (!(bh = ext3_dir_bread (NULL, dir, block, 0, err)))
980 goto errout; 984 goto errout;
981 985
982 retval = search_dirblock(bh, dir, entry, 986 retval = search_dirblock(bh, dir, entry,
@@ -1458,9 +1462,9 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1458 } 1462 }
1459 blocks = dir->i_size >> sb->s_blocksize_bits; 1463 blocks = dir->i_size >> sb->s_blocksize_bits;
1460 for (block = 0; block < blocks; block++) { 1464 for (block = 0; block < blocks; block++) {
1461 bh = ext3_bread(handle, dir, block, 0, &retval); 1465 if (!(bh = ext3_dir_bread(handle, dir, block, 0, &retval)))
1462 if(!bh)
1463 return retval; 1466 return retval;
1467
1464 retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh); 1468 retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
1465 if (retval != -ENOSPC) 1469 if (retval != -ENOSPC)
1466 return retval; 1470 return retval;
@@ -1500,7 +1504,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
1500 entries = frame->entries; 1504 entries = frame->entries;
1501 at = frame->at; 1505 at = frame->at;
1502 1506
1503 if (!(bh = ext3_bread(handle,dir, dx_get_block(frame->at), 0, &err))) 1507 if (!(bh = ext3_dir_bread(handle, dir, dx_get_block(frame->at), 0, &err)))
1504 goto cleanup; 1508 goto cleanup;
1505 1509
1506 BUFFER_TRACE(bh, "get_write_access"); 1510 BUFFER_TRACE(bh, "get_write_access");
@@ -1790,8 +1794,7 @@ retry:
1790 inode->i_op = &ext3_dir_inode_operations; 1794 inode->i_op = &ext3_dir_inode_operations;
1791 inode->i_fop = &ext3_dir_operations; 1795 inode->i_fop = &ext3_dir_operations;
1792 inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; 1796 inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize;
1793 dir_block = ext3_bread (handle, inode, 0, 1, &err); 1797 if (!(dir_block = ext3_dir_bread(handle, inode, 0, 1, &err)))
1794 if (!dir_block)
1795 goto out_clear_inode; 1798 goto out_clear_inode;
1796 1799
1797 BUFFER_TRACE(dir_block, "get_write_access"); 1800 BUFFER_TRACE(dir_block, "get_write_access");
@@ -1859,7 +1862,7 @@ static int empty_dir (struct inode * inode)
1859 1862
1860 sb = inode->i_sb; 1863 sb = inode->i_sb;
1861 if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || 1864 if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) ||
1862 !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { 1865 !(bh = ext3_dir_bread(NULL, inode, 0, 0, &err))) {
1863 if (err) 1866 if (err)
1864 ext3_error(inode->i_sb, __func__, 1867 ext3_error(inode->i_sb, __func__,
1865 "error %d reading directory #%lu offset 0", 1868 "error %d reading directory #%lu offset 0",
@@ -1890,9 +1893,8 @@ static int empty_dir (struct inode * inode)
1890 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { 1893 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
1891 err = 0; 1894 err = 0;
1892 brelse (bh); 1895 brelse (bh);
1893 bh = ext3_bread (NULL, inode, 1896 if (!(bh = ext3_dir_bread (NULL, inode,
1894 offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); 1897 offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err))) {
1895 if (!bh) {
1896 if (err) 1898 if (err)
1897 ext3_error(sb, __func__, 1899 ext3_error(sb, __func__,
1898 "error %d reading directory" 1900 "error %d reading directory"
@@ -2388,7 +2390,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2388 goto end_rename; 2390 goto end_rename;
2389 } 2391 }
2390 retval = -EIO; 2392 retval = -EIO;
2391 dir_bh = ext3_bread (handle, old_inode, 0, 0, &retval); 2393 dir_bh = ext3_dir_bread(handle, old_inode, 0, 0, &retval);
2392 if (!dir_bh) 2394 if (!dir_bh)
2393 goto end_rename; 2395 goto end_rename;
2394 if (le32_to_cpu(PARENT_INO(dir_bh->b_data)) != old_dir->i_ino) 2396 if (le32_to_cpu(PARENT_INO(dir_bh->b_data)) != old_dir->i_ino)
diff --git a/fs/ext3/namei.h b/fs/ext3/namei.h
index f2ce2b0065c9..46304d8c9f0a 100644
--- a/fs/ext3/namei.h
+++ b/fs/ext3/namei.h
@@ -6,3 +6,22 @@
6*/ 6*/
7 7
8extern struct dentry *ext3_get_parent(struct dentry *child); 8extern struct dentry *ext3_get_parent(struct dentry *child);
9
10static inline struct buffer_head *ext3_dir_bread(handle_t *handle,
11 struct inode *inode,
12 int block, int create,
13 int *err)
14{
15 struct buffer_head *bh;
16
17 bh = ext3_bread(handle, inode, block, create, err);
18
19 if (!bh && !(*err)) {
20 *err = -EIO;
21 ext3_error(inode->i_sb, __func__,
22 "Directory hole detected on inode %lu\n",
23 inode->i_ino);
24 return NULL;
25 }
26 return bh;
27}
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 29e79713c7eb..5366393528df 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1001,7 +1001,7 @@ static int parse_options (char *options, struct super_block *sb,
1001 uid = make_kuid(current_user_ns(), option); 1001 uid = make_kuid(current_user_ns(), option);
1002 if (!uid_valid(uid)) { 1002 if (!uid_valid(uid)) {
1003 ext3_msg(sb, KERN_ERR, "Invalid uid value %d", option); 1003 ext3_msg(sb, KERN_ERR, "Invalid uid value %d", option);
1004 return -1; 1004 return 0;
1005 1005
1006 } 1006 }
1007 sbi->s_resuid = uid; 1007 sbi->s_resuid = uid;
@@ -1012,7 +1012,7 @@ static int parse_options (char *options, struct super_block *sb,
1012 gid = make_kgid(current_user_ns(), option); 1012 gid = make_kgid(current_user_ns(), option);
1013 if (!gid_valid(gid)) { 1013 if (!gid_valid(gid)) {
1014 ext3_msg(sb, KERN_ERR, "Invalid gid value %d", option); 1014 ext3_msg(sb, KERN_ERR, "Invalid gid value %d", option);
1015 return -1; 1015 return 0;
1016 } 1016 }
1017 sbi->s_resgid = gid; 1017 sbi->s_resgid = gid;
1018 break; 1018 break;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index d269ada7670e..982d2676e1f8 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -223,7 +223,7 @@ static void encode_nlm_stat(struct xdr_stream *xdr,
223{ 223{
224 __be32 *p; 224 __be32 *p;
225 225
226 BUG_ON(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD); 226 WARN_ON_ONCE(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD);
227 p = xdr_reserve_space(xdr, 4); 227 p = xdr_reserve_space(xdr, 4);
228 *p = stat; 228 *p = stat;
229} 229}
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 3009a365e082..21171f0c6477 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -68,7 +68,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
68 68
69 /* Obtain file pointer. Not used by FREE_ALL call. */ 69 /* Obtain file pointer. Not used by FREE_ALL call. */
70 if (filp != NULL) { 70 if (filp != NULL) {
71 if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0) 71 error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh));
72 if (error != 0)
72 goto no_locks; 73 goto no_locks;
73 *filp = file; 74 *filp = file;
74 75
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index cceaab07ad54..43973b084abf 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -12,6 +12,7 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14struct ctl_table_header; 14struct ctl_table_header;
15struct mempolicy;
15 16
16extern struct proc_dir_entry proc_root; 17extern struct proc_dir_entry proc_root;
17#ifdef CONFIG_PROC_SYSCTL 18#ifdef CONFIG_PROC_SYSCTL
@@ -74,6 +75,9 @@ struct proc_maps_private {
74#ifdef CONFIG_MMU 75#ifdef CONFIG_MMU
75 struct vm_area_struct *tail_vma; 76 struct vm_area_struct *tail_vma;
76#endif 77#endif
78#ifdef CONFIG_NUMA
79 struct mempolicy *task_mempolicy;
80#endif
77}; 81};
78 82
79void proc_init_inodecache(void); 83void proc_init_inodecache(void);
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 79827ce03e3b..90c63f9392a5 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -90,10 +90,55 @@ static void pad_len_spaces(struct seq_file *m, int len)
90 seq_printf(m, "%*c", len, ' '); 90 seq_printf(m, "%*c", len, ' ');
91} 91}
92 92
93#ifdef CONFIG_NUMA
94/*
95 * These functions are for numa_maps but called in generic **maps seq_file
96 * ->start(), ->stop() ops.
97 *
98 * numa_maps scans all vmas under mmap_sem and checks their mempolicy.
99 * Each mempolicy object is controlled by reference counting. The problem here
100 * is how to avoid accessing dead mempolicy object.
101 *
102 * Because we're holding mmap_sem while reading seq_file, it's safe to access
103 * each vma's mempolicy, no vma objects will never drop refs to mempolicy.
104 *
105 * A task's mempolicy (task->mempolicy) has different behavior. task->mempolicy
106 * is set and replaced under mmap_sem but unrefed and cleared under task_lock().
107 * So, without task_lock(), we cannot trust get_vma_policy() because we cannot
108 * gurantee the task never exits under us. But taking task_lock() around
109 * get_vma_plicy() causes lock order problem.
110 *
111 * To access task->mempolicy without lock, we hold a reference count of an
112 * object pointed by task->mempolicy and remember it. This will guarantee
113 * that task->mempolicy points to an alive object or NULL in numa_maps accesses.
114 */
115static void hold_task_mempolicy(struct proc_maps_private *priv)
116{
117 struct task_struct *task = priv->task;
118
119 task_lock(task);
120 priv->task_mempolicy = task->mempolicy;
121 mpol_get(priv->task_mempolicy);
122 task_unlock(task);
123}
124static void release_task_mempolicy(struct proc_maps_private *priv)
125{
126 mpol_put(priv->task_mempolicy);
127}
128#else
129static void hold_task_mempolicy(struct proc_maps_private *priv)
130{
131}
132static void release_task_mempolicy(struct proc_maps_private *priv)
133{
134}
135#endif
136
93static void vma_stop(struct proc_maps_private *priv, struct vm_area_struct *vma) 137static void vma_stop(struct proc_maps_private *priv, struct vm_area_struct *vma)
94{ 138{
95 if (vma && vma != priv->tail_vma) { 139 if (vma && vma != priv->tail_vma) {
96 struct mm_struct *mm = vma->vm_mm; 140 struct mm_struct *mm = vma->vm_mm;
141 release_task_mempolicy(priv);
97 up_read(&mm->mmap_sem); 142 up_read(&mm->mmap_sem);
98 mmput(mm); 143 mmput(mm);
99 } 144 }
@@ -132,7 +177,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
132 177
133 tail_vma = get_gate_vma(priv->task->mm); 178 tail_vma = get_gate_vma(priv->task->mm);
134 priv->tail_vma = tail_vma; 179 priv->tail_vma = tail_vma;
135 180 hold_task_mempolicy(priv);
136 /* Start with last addr hint */ 181 /* Start with last addr hint */
137 vma = find_vma(mm, last_addr); 182 vma = find_vma(mm, last_addr);
138 if (last_addr && vma) { 183 if (last_addr && vma) {
@@ -159,6 +204,7 @@ out:
159 if (vma) 204 if (vma)
160 return vma; 205 return vma;
161 206
207 release_task_mempolicy(priv);
162 /* End of vmas has been reached */ 208 /* End of vmas has been reached */
163 m->version = (tail_vma != NULL)? 0: -1UL; 209 m->version = (tail_vma != NULL)? 0: -1UL;
164 up_read(&mm->mmap_sem); 210 up_read(&mm->mmap_sem);
@@ -1158,6 +1204,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1158 struct vm_area_struct *vma = v; 1204 struct vm_area_struct *vma = v;
1159 struct numa_maps *md = &numa_priv->md; 1205 struct numa_maps *md = &numa_priv->md;
1160 struct file *file = vma->vm_file; 1206 struct file *file = vma->vm_file;
1207 struct task_struct *task = proc_priv->task;
1161 struct mm_struct *mm = vma->vm_mm; 1208 struct mm_struct *mm = vma->vm_mm;
1162 struct mm_walk walk = {}; 1209 struct mm_walk walk = {};
1163 struct mempolicy *pol; 1210 struct mempolicy *pol;
@@ -1177,7 +1224,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1177 walk.private = md; 1224 walk.private = md;
1178 walk.mm = mm; 1225 walk.mm = mm;
1179 1226
1180 pol = get_vma_policy(proc_priv->task, vma, vma->vm_start); 1227 pol = get_vma_policy(task, vma, vma->vm_start);
1181 mpol_to_str(buffer, sizeof(buffer), pol, 0); 1228 mpol_to_str(buffer, sizeof(buffer), pol, 0);
1182 mpol_cond_put(pol); 1229 mpol_cond_put(pol);
1183 1230
@@ -1189,7 +1236,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1189 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { 1236 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
1190 seq_printf(m, " heap"); 1237 seq_printf(m, " heap");
1191 } else { 1238 } else {
1192 pid_t tid = vm_is_stack(proc_priv->task, vma, is_pid); 1239 pid_t tid = vm_is_stack(task, vma, is_pid);
1193 if (tid != 0) { 1240 if (tid != 0) {
1194 /* 1241 /*
1195 * Thread stack in /proc/PID/task/TID/maps or 1242 * Thread stack in /proc/PID/task/TID/maps or
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 557a9c20a215..05ae3c97f7a5 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1160,6 +1160,8 @@ static int need_print_warning(struct dquot_warn *warn)
1160 return uid_eq(current_fsuid(), warn->w_dq_id.uid); 1160 return uid_eq(current_fsuid(), warn->w_dq_id.uid);
1161 case GRPQUOTA: 1161 case GRPQUOTA:
1162 return in_group_p(warn->w_dq_id.gid); 1162 return in_group_p(warn->w_dq_id.gid);
1163 case PRJQUOTA: /* Never taken... Just make gcc happy */
1164 return 0;
1163 } 1165 }
1164 return 0; 1166 return 0;
1165} 1167}
diff --git a/fs/xattr.c b/fs/xattr.c
index e164dddb8e96..e21c119f4f99 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -846,7 +846,7 @@ static int __simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
846 const void *value, size_t size, int flags) 846 const void *value, size_t size, int flags)
847{ 847{
848 struct simple_xattr *xattr; 848 struct simple_xattr *xattr;
849 struct simple_xattr *uninitialized_var(new_xattr); 849 struct simple_xattr *new_xattr = NULL;
850 int err = 0; 850 int err = 0;
851 851
852 /* value == NULL means remove */ 852 /* value == NULL means remove */
diff --git a/include/Kbuild b/include/Kbuild
index 8d226bfa2696..83256b64166a 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,12 +1,8 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3 3
4header-y += asm-generic/
5header-y += linux/ 4header-y += linux/
6header-y += sound/ 5header-y += sound/
7header-y += mtd/
8header-y += rdma/ 6header-y += rdma/
9header-y += video/ 7header-y += video/
10header-y += drm/
11header-y += xen/
12header-y += scsi/ 8header-y += scsi/
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/asm-generic/Kbuild
+++ /dev/null
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/drm/Kbuild
+++ /dev/null
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5b57367e28db..7fe2dae251e5 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,31 +1,5 @@
1header-y += byteorder/
2header-y += can/
3header-y += caif/
4header-y += dvb/ 1header-y += dvb/
5header-y += hdlc/ 2header-y += hdlc/
6header-y += hsi/ 3header-y += hsi/
7header-y += isdn/
8header-y += mmc/
9header-y += nfsd/
10header-y += raid/ 4header-y += raid/
11header-y += spi/
12header-y += sunrpc/
13header-y += tc_act/
14header-y += tc_ematch/
15header-y += netfilter/
16header-y += netfilter_arp/
17header-y += netfilter_bridge/
18header-y += netfilter_ipv4/
19header-y += netfilter_ipv6/
20header-y += usb/ 5header-y += usb/
21header-y += wimax/
22
23ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
24 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),)
25endif
26ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
27 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),)
28endif
29ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
30 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
31endif
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/byteorder/Kbuild
+++ /dev/null
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/caif/Kbuild
+++ /dev/null
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/can/Kbuild
+++ /dev/null
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 1775eb8acc03..1d7399314a89 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <asm/siginfo.h>
7 8
8/* 9/*
9 * These are the only things you should do on a core-file: use only these 10 * These are the only things you should do on a core-file: use only these
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index 5ce0e5fd712e..251a2090a554 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -20,28 +20,28 @@
20int devpts_new_index(struct inode *ptmx_inode); 20int devpts_new_index(struct inode *ptmx_inode);
21void devpts_kill_index(struct inode *ptmx_inode, int idx); 21void devpts_kill_index(struct inode *ptmx_inode, int idx);
22/* mknod in devpts */ 22/* mknod in devpts */
23int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty); 23struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
24/* get tty structure */ 24 void *priv);
25struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number); 25/* get private structure */
26void *devpts_get_priv(struct inode *pts_inode);
26/* unlink */ 27/* unlink */
27void devpts_pty_kill(struct tty_struct *tty); 28void devpts_pty_kill(struct inode *inode);
28 29
29#else 30#else
30 31
31/* Dummy stubs in the no-pty case */ 32/* Dummy stubs in the no-pty case */
32static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } 33static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
33static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } 34static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
34static inline int devpts_pty_new(struct inode *ptmx_inode, 35static inline struct inode *devpts_pty_new(struct inode *ptmx_inode,
35 struct tty_struct *tty) 36 dev_t device, int index, void *priv)
36{ 37{
37 return -EINVAL; 38 return ERR_PTR(-EINVAL);
38} 39}
39static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode, 40static inline void *devpts_get_priv(struct inode *pts_inode)
40 int number)
41{ 41{
42 return NULL; 42 return NULL;
43} 43}
44static inline void devpts_pty_kill(struct tty_struct *tty) { } 44static inline void devpts_pty_kill(struct inode *inode) { }
45 45
46#endif 46#endif
47 47
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
index f4dba8637f98..e69de29bb2d1 100644
--- a/include/linux/dvb/Kbuild
+++ b/include/linux/dvb/Kbuild
@@ -1,8 +0,0 @@
1header-y += audio.h
2header-y += ca.h
3header-y += dmx.h
4header-y += frontend.h
5header-y += net.h
6header-y += osd.h
7header-y += version.h
8header-y += video.h
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index f078f3ac82d4..0be6d8f2b52b 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -20,138 +20,10 @@
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * 21 *
22 */ 22 */
23
24#ifndef _DVBDMX_H_ 23#ifndef _DVBDMX_H_
25#define _DVBDMX_H_ 24#define _DVBDMX_H_
26 25
27#include <linux/types.h>
28#ifdef __KERNEL__
29#include <linux/time.h> 26#include <linux/time.h>
30#else 27#include <uapi/linux/dvb/dmx.h>
31#include <time.h>
32#endif
33
34
35#define DMX_FILTER_SIZE 16
36
37typedef enum
38{
39 DMX_OUT_DECODER, /* Streaming directly to decoder. */
40 DMX_OUT_TAP, /* Output going to a memory buffer */
41 /* (to be retrieved via the read command).*/
42 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
43 /* (to be retrieved by reading from the */
44 /* logical DVR device). */
45 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
46} dmx_output_t;
47
48
49typedef enum
50{
51 DMX_IN_FRONTEND, /* Input from a front-end device. */
52 DMX_IN_DVR /* Input from the logical DVR device. */
53} dmx_input_t;
54
55
56typedef enum
57{
58 DMX_PES_AUDIO0,
59 DMX_PES_VIDEO0,
60 DMX_PES_TELETEXT0,
61 DMX_PES_SUBTITLE0,
62 DMX_PES_PCR0,
63
64 DMX_PES_AUDIO1,
65 DMX_PES_VIDEO1,
66 DMX_PES_TELETEXT1,
67 DMX_PES_SUBTITLE1,
68 DMX_PES_PCR1,
69
70 DMX_PES_AUDIO2,
71 DMX_PES_VIDEO2,
72 DMX_PES_TELETEXT2,
73 DMX_PES_SUBTITLE2,
74 DMX_PES_PCR2,
75
76 DMX_PES_AUDIO3,
77 DMX_PES_VIDEO3,
78 DMX_PES_TELETEXT3,
79 DMX_PES_SUBTITLE3,
80 DMX_PES_PCR3,
81
82 DMX_PES_OTHER
83} dmx_pes_type_t;
84
85#define DMX_PES_AUDIO DMX_PES_AUDIO0
86#define DMX_PES_VIDEO DMX_PES_VIDEO0
87#define DMX_PES_TELETEXT DMX_PES_TELETEXT0
88#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
89#define DMX_PES_PCR DMX_PES_PCR0
90
91
92typedef struct dmx_filter
93{
94 __u8 filter[DMX_FILTER_SIZE];
95 __u8 mask[DMX_FILTER_SIZE];
96 __u8 mode[DMX_FILTER_SIZE];
97} dmx_filter_t;
98
99
100struct dmx_sct_filter_params
101{
102 __u16 pid;
103 dmx_filter_t filter;
104 __u32 timeout;
105 __u32 flags;
106#define DMX_CHECK_CRC 1
107#define DMX_ONESHOT 2
108#define DMX_IMMEDIATE_START 4
109#define DMX_KERNEL_CLIENT 0x8000
110};
111
112
113struct dmx_pes_filter_params
114{
115 __u16 pid;
116 dmx_input_t input;
117 dmx_output_t output;
118 dmx_pes_type_t pes_type;
119 __u32 flags;
120};
121
122typedef struct dmx_caps {
123 __u32 caps;
124 int num_decoders;
125} dmx_caps_t;
126
127typedef enum {
128 DMX_SOURCE_FRONT0 = 0,
129 DMX_SOURCE_FRONT1,
130 DMX_SOURCE_FRONT2,
131 DMX_SOURCE_FRONT3,
132 DMX_SOURCE_DVR0 = 16,
133 DMX_SOURCE_DVR1,
134 DMX_SOURCE_DVR2,
135 DMX_SOURCE_DVR3
136} dmx_source_t;
137
138struct dmx_stc {
139 unsigned int num; /* input : which STC? 0..N */
140 unsigned int base; /* output: divisor for stc to get 90 kHz clock */
141 __u64 stc; /* output: stc in 'base'*90 kHz units */
142};
143
144
145#define DMX_START _IO('o', 41)
146#define DMX_STOP _IO('o', 42)
147#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
148#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
149#define DMX_SET_BUFFER_SIZE _IO('o', 45)
150#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
154#define DMX_ADD_PID _IOW('o', 51, __u16)
155#define DMX_REMOVE_PID _IOW('o', 52, __u16)
156 28
157#endif /*_DVBDMX_H_*/ 29#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index 1d750c0fd86e..85c20d925696 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -20,257 +20,10 @@
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * 21 *
22 */ 22 */
23
24#ifndef _DVBVIDEO_H_ 23#ifndef _DVBVIDEO_H_
25#define _DVBVIDEO_H_ 24#define _DVBVIDEO_H_
26 25
27#include <linux/types.h>
28#ifdef __KERNEL__
29#include <linux/compiler.h> 26#include <linux/compiler.h>
30#else 27#include <uapi/linux/dvb/video.h>
31#include <stdint.h>
32#include <time.h>
33#endif
34
35typedef enum {
36 VIDEO_FORMAT_4_3, /* Select 4:3 format */
37 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
38 VIDEO_FORMAT_221_1 /* 2.21:1 */
39} video_format_t;
40
41
42typedef enum {
43 VIDEO_SYSTEM_PAL,
44 VIDEO_SYSTEM_NTSC,
45 VIDEO_SYSTEM_PALN,
46 VIDEO_SYSTEM_PALNc,
47 VIDEO_SYSTEM_PALM,
48 VIDEO_SYSTEM_NTSC60,
49 VIDEO_SYSTEM_PAL60,
50 VIDEO_SYSTEM_PALM60
51} video_system_t;
52
53
54typedef enum {
55 VIDEO_PAN_SCAN, /* use pan and scan format */
56 VIDEO_LETTER_BOX, /* use letterbox format */
57 VIDEO_CENTER_CUT_OUT /* use center cut out format */
58} video_displayformat_t;
59
60typedef struct {
61 int w;
62 int h;
63 video_format_t aspect_ratio;
64} video_size_t;
65
66typedef enum {
67 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
68 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
69 comes from the user through the write
70 system call */
71} video_stream_source_t;
72
73
74typedef enum {
75 VIDEO_STOPPED, /* Video is stopped */
76 VIDEO_PLAYING, /* Video is currently playing */
77 VIDEO_FREEZED /* Video is freezed */
78} video_play_state_t;
79
80
81/* Decoder commands */
82#define VIDEO_CMD_PLAY (0)
83#define VIDEO_CMD_STOP (1)
84#define VIDEO_CMD_FREEZE (2)
85#define VIDEO_CMD_CONTINUE (3)
86
87/* Flags for VIDEO_CMD_FREEZE */
88#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
89
90/* Flags for VIDEO_CMD_STOP */
91#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
92#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
93
94/* Play input formats: */
95/* The decoder has no special format requirements */
96#define VIDEO_PLAY_FMT_NONE (0)
97/* The decoder requires full GOPs */
98#define VIDEO_PLAY_FMT_GOP (1)
99
100/* The structure must be zeroed before use by the application
101 This ensures it can be extended safely in the future. */
102struct video_command {
103 __u32 cmd;
104 __u32 flags;
105 union {
106 struct {
107 __u64 pts;
108 } stop;
109
110 struct {
111 /* 0 or 1000 specifies normal speed,
112 1 specifies forward single stepping,
113 -1 specifies backward single stepping,
114 >1: playback at speed/1000 of the normal speed,
115 <-1: reverse playback at (-speed/1000) of the normal speed. */
116 __s32 speed;
117 __u32 format;
118 } play;
119
120 struct {
121 __u32 data[16];
122 } raw;
123 };
124};
125
126/* FIELD_UNKNOWN can be used if the hardware does not know whether
127 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
128 field. */
129#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
130#define VIDEO_VSYNC_FIELD_ODD (1)
131#define VIDEO_VSYNC_FIELD_EVEN (2)
132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
133
134struct video_event {
135 __s32 type;
136#define VIDEO_EVENT_SIZE_CHANGED 1
137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
138#define VIDEO_EVENT_DECODER_STOPPED 3
139#define VIDEO_EVENT_VSYNC 4
140 __kernel_time_t timestamp;
141 union {
142 video_size_t size;
143 unsigned int frame_rate; /* in frames per 1000sec */
144 unsigned char vsync_field; /* unknown/odd/even/progressive */
145 } u;
146};
147
148
149struct video_status {
150 int video_blank; /* blank video on freeze? */
151 video_play_state_t play_state; /* current state of playback */
152 video_stream_source_t stream_source; /* current source (demux/memory) */
153 video_format_t video_format; /* current aspect ratio of stream*/
154 video_displayformat_t display_format;/* selected cropping mode */
155};
156
157
158struct video_still_picture {
159 char __user *iFrame; /* pointer to a single iframe in memory */
160 __s32 size;
161};
162
163
164typedef
165struct video_highlight {
166 int active; /* 1=show highlight, 0=hide highlight */
167 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
168 /* 3- 0 Background pixel contrast */
169 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
170 /* 3- 0 Emphasis pixel-1 contrast */
171 __u8 color1; /* 7- 4 Pattern pixel color */
172 /* 3- 0 Background pixel color */
173 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
174 /* 3- 0 Emphasis pixel-1 color */
175 __u32 ypos; /* 23-22 auto action mode */
176 /* 21-12 start y */
177 /* 9- 0 end y */
178 __u32 xpos; /* 23-22 button color number */
179 /* 21-12 start x */
180 /* 9- 0 end x */
181} video_highlight_t;
182
183
184typedef struct video_spu {
185 int active;
186 int stream_id;
187} video_spu_t;
188
189
190typedef struct video_spu_palette { /* SPU Palette information */
191 int length;
192 __u8 __user *palette;
193} video_spu_palette_t;
194
195
196typedef struct video_navi_pack {
197 int length; /* 0 ... 1024 */
198 __u8 data[1024];
199} video_navi_pack_t;
200
201
202typedef __u16 video_attributes_t;
203/* bits: descr. */
204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
205/* 13-12 TV system (0=525/60, 1=625/50) */
206/* 11-10 Aspect ratio (0=4:3, 3=16:9) */
207/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
208/* 7 line 21-1 data present in GOP (1=yes, 0=no) */
209/* 6 line 21-2 data present in GOP (1=yes, 0=no) */
210/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
211/* 2 source letterboxed (1=yes, 0=no) */
212/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
213
214
215/* bit definitions for capabilities: */
216/* can the hardware decode MPEG1 and/or MPEG2? */
217#define VIDEO_CAP_MPEG1 1
218#define VIDEO_CAP_MPEG2 2
219/* can you send a system and/or program stream to video device?
220 (you still have to open the video and the audio device but only
221 send the stream to the video device) */
222#define VIDEO_CAP_SYS 4
223#define VIDEO_CAP_PROG 8
224/* can the driver also handle SPU, NAVI and CSS encoded data?
225 (CSS API is not present yet) */
226#define VIDEO_CAP_SPU 16
227#define VIDEO_CAP_NAVI 32
228#define VIDEO_CAP_CSS 64
229
230
231#define VIDEO_STOP _IO('o', 21)
232#define VIDEO_PLAY _IO('o', 22)
233#define VIDEO_FREEZE _IO('o', 23)
234#define VIDEO_CONTINUE _IO('o', 24)
235#define VIDEO_SELECT_SOURCE _IO('o', 25)
236#define VIDEO_SET_BLANK _IO('o', 26)
237#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
238#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
239#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
240#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
241#define VIDEO_FAST_FORWARD _IO('o', 31)
242#define VIDEO_SLOWMOTION _IO('o', 32)
243#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
244#define VIDEO_CLEAR_BUFFER _IO('o', 34)
245#define VIDEO_SET_ID _IO('o', 35)
246#define VIDEO_SET_STREAMTYPE _IO('o', 36)
247#define VIDEO_SET_FORMAT _IO('o', 37)
248#define VIDEO_SET_SYSTEM _IO('o', 38)
249#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
250#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
251#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
252#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
253#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
254#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
255#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
256
257/**
258 * VIDEO_GET_PTS
259 *
260 * Read the 33 bit presentation time stamp as defined
261 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
262 *
263 * The PTS should belong to the currently played
264 * frame if possible, but may also be a value close to it
265 * like the PTS of the last decoded frame or the last PTS
266 * extracted by the PES parser.
267 */
268#define VIDEO_GET_PTS _IOR('o', 57, __u64)
269
270/* Read the number of displayed frames since the decoder was started */
271#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
272
273#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
274#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
275 28
276#endif /*_DVBVIDEO_H_*/ 29#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/elf-fdpic.h b/include/linux/elf-fdpic.h
new file mode 100644
index 000000000000..386440317b0c
--- /dev/null
+++ b/include/linux/elf-fdpic.h
@@ -0,0 +1,51 @@
1/* FDPIC ELF load map
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_ELF_FDPIC_H
13#define _LINUX_ELF_FDPIC_H
14
15#include <uapi/linux/elf-fdpic.h>
16
17/*
18 * binfmt binary parameters structure
19 */
20struct elf_fdpic_params {
21 struct elfhdr hdr; /* ref copy of ELF header */
22 struct elf_phdr *phdrs; /* ref copy of PT_PHDR table */
23 struct elf32_fdpic_loadmap *loadmap; /* loadmap to be passed to userspace */
24 unsigned long elfhdr_addr; /* mapped ELF header user address */
25 unsigned long ph_addr; /* mapped PT_PHDR user address */
26 unsigned long map_addr; /* mapped loadmap user address */
27 unsigned long entry_addr; /* mapped entry user address */
28 unsigned long stack_size; /* stack size requested (PT_GNU_STACK) */
29 unsigned long dynamic_addr; /* mapped PT_DYNAMIC user address */
30 unsigned long load_addr; /* user address at which to map binary */
31 unsigned long flags;
32#define ELF_FDPIC_FLAG_ARRANGEMENT 0x0000000f /* PT_LOAD arrangement flags */
33#define ELF_FDPIC_FLAG_INDEPENDENT 0x00000000 /* PT_LOADs can be put anywhere */
34#define ELF_FDPIC_FLAG_HONOURVADDR 0x00000001 /* PT_LOAD.vaddr must be honoured */
35#define ELF_FDPIC_FLAG_CONSTDISP 0x00000002 /* PT_LOADs require constant
36 * displacement */
37#define ELF_FDPIC_FLAG_CONTIGUOUS 0x00000003 /* PT_LOADs should be contiguous */
38#define ELF_FDPIC_FLAG_EXEC_STACK 0x00000010 /* T if stack to be executable */
39#define ELF_FDPIC_FLAG_NOEXEC_STACK 0x00000020 /* T if stack not to be executable */
40#define ELF_FDPIC_FLAG_EXECUTABLE 0x00000040 /* T if this object is the executable */
41#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */
42};
43
44#ifdef CONFIG_MMU
45extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
46 struct elf_fdpic_params *interp_params,
47 unsigned long *start_stack,
48 unsigned long *start_brk);
49#endif
50
51#endif /* _LINUX_ELF_FDPIC_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 001c7cff2d48..b33cfc97b9ca 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -64,6 +64,73 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
64 ssize_t bytes, void *private, int ret, 64 ssize_t bytes, void *private, int ret,
65 bool is_async); 65 bool is_async);
66 66
67#define MAY_EXEC 0x00000001
68#define MAY_WRITE 0x00000002
69#define MAY_READ 0x00000004
70#define MAY_APPEND 0x00000008
71#define MAY_ACCESS 0x00000010
72#define MAY_OPEN 0x00000020
73#define MAY_CHDIR 0x00000040
74/* called from RCU mode, don't block */
75#define MAY_NOT_BLOCK 0x00000080
76
77/*
78 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
79 * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
80 */
81
82/* file is open for reading */
83#define FMODE_READ ((__force fmode_t)0x1)
84/* file is open for writing */
85#define FMODE_WRITE ((__force fmode_t)0x2)
86/* file is seekable */
87#define FMODE_LSEEK ((__force fmode_t)0x4)
88/* file can be accessed using pread */
89#define FMODE_PREAD ((__force fmode_t)0x8)
90/* file can be accessed using pwrite */
91#define FMODE_PWRITE ((__force fmode_t)0x10)
92/* File is opened for execution with sys_execve / sys_uselib */
93#define FMODE_EXEC ((__force fmode_t)0x20)
94/* File is opened with O_NDELAY (only set for block devices) */
95#define FMODE_NDELAY ((__force fmode_t)0x40)
96/* File is opened with O_EXCL (only set for block devices) */
97#define FMODE_EXCL ((__force fmode_t)0x80)
98/* File is opened using open(.., 3, ..) and is writeable only for ioctls
99 (specialy hack for floppy.c) */
100#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
101/* 32bit hashes as llseek() offset (for directories) */
102#define FMODE_32BITHASH ((__force fmode_t)0x200)
103/* 64bit hashes as llseek() offset (for directories) */
104#define FMODE_64BITHASH ((__force fmode_t)0x400)
105
106/*
107 * Don't update ctime and mtime.
108 *
109 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
110 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
111 */
112#define FMODE_NOCMTIME ((__force fmode_t)0x800)
113
114/* Expect random access pattern */
115#define FMODE_RANDOM ((__force fmode_t)0x1000)
116
117/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
118#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000)
119
120/* File is opened with O_PATH; almost nothing can be done with it */
121#define FMODE_PATH ((__force fmode_t)0x4000)
122
123/* File was opened by fanotify and shouldn't generate fanotify events */
124#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
125
126/*
127 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
128 * that indicates that they should check the contents of the iovec are
129 * valid, but not check the memory that the iovec elements
130 * points too.
131 */
132#define CHECK_IOVEC_ONLY -1
133
67/* 134/*
68 * The below are the various read and write types that we support. Some of 135 * The below are the various read and write types that we support. Some of
69 * them include behavioral modifiers that send information down to the 136 * them include behavioral modifiers that send information down to the
@@ -1557,6 +1624,60 @@ struct super_operations {
1557}; 1624};
1558 1625
1559/* 1626/*
1627 * Inode flags - they have no relation to superblock flags now
1628 */
1629#define S_SYNC 1 /* Writes are synced at once */
1630#define S_NOATIME 2 /* Do not update access times */
1631#define S_APPEND 4 /* Append-only file */
1632#define S_IMMUTABLE 8 /* Immutable file */
1633#define S_DEAD 16 /* removed, but still open directory */
1634#define S_NOQUOTA 32 /* Inode is not counted to quota */
1635#define S_DIRSYNC 64 /* Directory modifications are synchronous */
1636#define S_NOCMTIME 128 /* Do not update file c/mtime */
1637#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
1638#define S_PRIVATE 512 /* Inode is fs-internal */
1639#define S_IMA 1024 /* Inode has an associated IMA struct */
1640#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
1641#define S_NOSEC 4096 /* no suid or xattr security attributes */
1642
1643/*
1644 * Note that nosuid etc flags are inode-specific: setting some file-system
1645 * flags just means all the inodes inherit those flags by default. It might be
1646 * possible to override it selectively if you really wanted to with some
1647 * ioctl() that is not currently implemented.
1648 *
1649 * Exception: MS_RDONLY is always applied to the entire file system.
1650 *
1651 * Unfortunately, it is possible to change a filesystems flags with it mounted
1652 * with files in use. This means that all of the inodes will not have their
1653 * i_flags updated. Hence, i_flags no longer inherit the superblock mount
1654 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
1655 */
1656#define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg))
1657
1658#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
1659#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
1660 ((inode)->i_flags & S_SYNC))
1661#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
1662 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
1663#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
1664#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
1665#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
1666
1667#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
1668#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
1669#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
1670#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
1671
1672#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
1673#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
1674#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
1675#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
1676#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
1677#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1678#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1679
1680/*
1560 * Inode state bits. Protected by inode->i_lock 1681 * Inode state bits. Protected by inode->i_lock
1561 * 1682 *
1562 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1683 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
@@ -1688,6 +1809,11 @@ int sync_inode_metadata(struct inode *inode, int wait);
1688struct file_system_type { 1809struct file_system_type {
1689 const char *name; 1810 const char *name;
1690 int fs_flags; 1811 int fs_flags;
1812#define FS_REQUIRES_DEV 1
1813#define FS_BINARY_MOUNTDATA 2
1814#define FS_HAS_SUBTYPE 4
1815#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1816#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1691 struct dentry *(*mount) (struct file_system_type *, int, 1817 struct dentry *(*mount) (struct file_system_type *, int,
1692 const char *, void *); 1818 const char *, void *);
1693 void (*kill_sb) (struct super_block *); 1819 void (*kill_sb) (struct super_block *);
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
index 271a770b4784..e69de29bb2d1 100644
--- a/include/linux/hsi/Kbuild
+++ b/include/linux/hsi/Kbuild
@@ -1 +0,0 @@
1header-y += hsi_char.h
diff --git a/include/linux/isdn/Kbuild b/include/linux/isdn/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/isdn/Kbuild
+++ /dev/null
diff --git a/include/linux/mmc/Kbuild b/include/linux/mmc/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/mmc/Kbuild
+++ /dev/null
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
deleted file mode 100644
index b3322023e9a5..000000000000
--- a/include/linux/netfilter/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += ipset/
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/netfilter/ipset/Kbuild
+++ /dev/null
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/netfilter_arp/Kbuild
+++ /dev/null
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/netfilter_bridge/Kbuild
+++ /dev/null
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/netfilter_ipv4/Kbuild
+++ /dev/null
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/netfilter_ipv6/Kbuild
+++ /dev/null
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/nfsd/Kbuild
+++ /dev/null
diff --git a/include/linux/of.h b/include/linux/of.h
index 72843b72a2b2..b4e50d56fc74 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -331,6 +331,13 @@ static inline bool of_have_populated_dt(void)
331#define for_each_child_of_node(parent, child) \ 331#define for_each_child_of_node(parent, child) \
332 while (0) 332 while (0)
333 333
334static inline struct device_node *of_get_child_by_name(
335 const struct device_node *node,
336 const char *name)
337{
338 return NULL;
339}
340
334static inline int of_get_child_count(const struct device_node *np) 341static inline int of_get_child_count(const struct device_node *np)
335{ 342{
336 return 0; 343 return 0;
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index c3cdc1025c30..a1984dd037da 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -19,7 +19,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
19 * the address space flags too. The PCI version uses a BAR number 19 * the address space flags too. The PCI version uses a BAR number
20 * instead of an absolute index 20 * instead of an absolute index
21 */ 21 */
22extern const u32 *of_get_address(struct device_node *dev, int index, 22extern const __be32 *of_get_address(struct device_node *dev, int index,
23 u64 *size, unsigned int *flags); 23 u64 *size, unsigned int *flags);
24 24
25#ifndef pci_address_to_pio 25#ifndef pci_address_to_pio
@@ -44,7 +44,7 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
44{ 44{
45 return NULL; 45 return NULL;
46} 46}
47static inline const u32 *of_get_address(struct device_node *dev, int index, 47static inline const __be32 *of_get_address(struct device_node *dev, int index,
48 u64 *size, unsigned int *flags) 48 u64 *size, unsigned int *flags)
49{ 49{
50 return NULL; 50 return NULL;
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index b8e241125201..535cecf1e02f 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -58,8 +58,8 @@ static inline int of_irq_map_oldworld(struct device_node *device, int index,
58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
59 59
60 60
61extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, 61extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
62 u32 ointsize, const u32 *addr, 62 u32 ointsize, const __be32 *addr,
63 struct of_irq *out_irq); 63 struct of_irq *out_irq);
64extern int of_irq_map_one(struct device_node *device, int index, 64extern int of_irq_map_one(struct device_node *device, int index,
65 struct of_irq *out_irq); 65 struct of_irq *out_irq);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 00474b047145..65e3e87eacc5 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -47,15 +47,9 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
47} 47}
48 48
49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
50extern void free_pid_ns(struct kref *kref);
51extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); 50extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
52extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); 51extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
53 52extern void put_pid_ns(struct pid_namespace *ns);
54static inline void put_pid_ns(struct pid_namespace *ns)
55{
56 if (ns != &init_pid_ns)
57 kref_put(&ns->kref, free_pid_ns);
58}
59 53
60#else /* !CONFIG_PID_NS */ 54#else /* !CONFIG_PID_NS */
61#include <linux/err.h> 55#include <linux/err.h>
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index e11ccb4cf48d..0a260d8a18bf 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -46,20 +46,17 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
46#define WARN_ON_RATELIMIT(condition, state) \ 46#define WARN_ON_RATELIMIT(condition, state) \
47 WARN_ON((condition) && __ratelimit(state)) 47 WARN_ON((condition) && __ratelimit(state))
48 48
49#define __WARN_RATELIMIT(condition, state, format...) \ 49#define WARN_RATELIMIT(condition, format, ...) \
50({ \
51 int rtn = 0; \
52 if (unlikely(__ratelimit(state))) \
53 rtn = WARN(condition, format); \
54 rtn; \
55})
56
57#define WARN_RATELIMIT(condition, format...) \
58({ \ 50({ \
59 static DEFINE_RATELIMIT_STATE(_rs, \ 51 static DEFINE_RATELIMIT_STATE(_rs, \
60 DEFAULT_RATELIMIT_INTERVAL, \ 52 DEFAULT_RATELIMIT_INTERVAL, \
61 DEFAULT_RATELIMIT_BURST); \ 53 DEFAULT_RATELIMIT_BURST); \
62 __WARN_RATELIMIT(condition, &_rs, format); \ 54 int rtn = !!(condition); \
55 \
56 if (unlikely(rtn && __ratelimit(&_rs))) \
57 WARN(rtn, format, ##__VA_ARGS__); \
58 \
59 rtn; \
63}) 60})
64 61
65#else 62#else
@@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
67#define WARN_ON_RATELIMIT(condition, state) \ 64#define WARN_ON_RATELIMIT(condition, state) \
68 WARN_ON(condition) 65 WARN_ON(condition)
69 66
70#define __WARN_RATELIMIT(condition, state, format...) \ 67#define WARN_RATELIMIT(condition, format, ...) \
71({ \
72 int rtn = WARN(condition, format); \
73 rtn; \
74})
75
76#define WARN_RATELIMIT(condition, format...) \
77({ \ 68({ \
78 int rtn = WARN(condition, format); \ 69 int rtn = WARN(condition, format, ##__VA_ARGS__); \
79 rtn; \ 70 rtn; \
80}) 71})
81 72
diff --git a/include/linux/spi/Kbuild b/include/linux/spi/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/spi/Kbuild
+++ /dev/null
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/sunrpc/Kbuild
+++ /dev/null
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/tc_act/Kbuild
+++ /dev/null
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/tc_ematch/Kbuild
+++ /dev/null
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f0b4eb47297c..d7ff88fb8967 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -188,7 +188,9 @@ struct tty_port_operations {
188}; 188};
189 189
190struct tty_port { 190struct tty_port {
191 struct tty_bufhead buf; /* Locked internally */
191 struct tty_struct *tty; /* Back pointer */ 192 struct tty_struct *tty; /* Back pointer */
193 struct tty_struct *itty; /* internal back ptr */
192 const struct tty_port_operations *ops; /* Port operations */ 194 const struct tty_port_operations *ops; /* Port operations */
193 spinlock_t lock; /* Lock protecting tty field */ 195 spinlock_t lock; /* Lock protecting tty field */
194 int blocked_open; /* Waiting to open */ 196 int blocked_open; /* Waiting to open */
@@ -197,6 +199,9 @@ struct tty_port {
197 wait_queue_head_t close_wait; /* Close waiters */ 199 wait_queue_head_t close_wait; /* Close waiters */
198 wait_queue_head_t delta_msr_wait; /* Modem status change */ 200 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 201 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
200 unsigned char console:1; /* port is a console */ 205 unsigned char console:1; /* port is a console */
201 struct mutex mutex; /* Locking */ 206 struct mutex mutex; /* Locking */
202 struct mutex buf_mutex; /* Buffer alloc lock */ 207 struct mutex buf_mutex; /* Buffer alloc lock */
@@ -235,6 +240,7 @@ struct tty_struct {
235 struct mutex ldisc_mutex; 240 struct mutex ldisc_mutex;
236 struct tty_ldisc *ldisc; 241 struct tty_ldisc *ldisc;
237 242
243 struct mutex atomic_write_lock;
238 struct mutex legacy_mutex; 244 struct mutex legacy_mutex;
239 struct mutex termios_mutex; 245 struct mutex termios_mutex;
240 spinlock_t ctrl_lock; 246 spinlock_t ctrl_lock;
@@ -254,7 +260,6 @@ struct tty_struct {
254 260
255 struct tty_struct *link; 261 struct tty_struct *link;
256 struct fasync_struct *fasync; 262 struct fasync_struct *fasync;
257 struct tty_bufhead buf; /* Locked internally */
258 int alt_speed; /* For magic substitution of 38400 bps */ 263 int alt_speed; /* For magic substitution of 38400 bps */
259 wait_queue_head_t write_wait; 264 wait_queue_head_t write_wait;
260 wait_queue_head_t read_wait; 265 wait_queue_head_t read_wait;
@@ -265,37 +270,10 @@ struct tty_struct {
265 270
266#define N_TTY_BUF_SIZE 4096 271#define N_TTY_BUF_SIZE 4096
267 272
268 /*
269 * The following is data for the N_TTY line discipline. For
270 * historical reasons, this is included in the tty structure.
271 * Mostly locked by the BKL.
272 */
273 unsigned int column;
274 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
275 unsigned char closing:1; 273 unsigned char closing:1;
276 unsigned char echo_overrun:1;
277 unsigned short minimum_to_wake; 274 unsigned short minimum_to_wake;
278 unsigned long overrun_time;
279 int num_overrun;
280 unsigned long process_char_map[256/(8*sizeof(unsigned long))];
281 char *read_buf;
282 int read_head;
283 int read_tail;
284 int read_cnt;
285 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
286 unsigned char *echo_buf;
287 unsigned int echo_pos;
288 unsigned int echo_cnt;
289 int canon_data;
290 unsigned long canon_head;
291 unsigned int canon_column;
292 struct mutex atomic_read_lock;
293 struct mutex atomic_write_lock;
294 struct mutex output_lock;
295 struct mutex echo_lock;
296 unsigned char *write_buf; 275 unsigned char *write_buf;
297 int write_cnt; 276 int write_cnt;
298 spinlock_t read_lock;
299 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
300 struct work_struct SAK_work; 278 struct work_struct SAK_work;
301 struct tty_port *port; 279 struct tty_port *port;
@@ -335,8 +313,6 @@ struct tty_file_private {
335#define TTY_PTY_LOCK 16 /* pty private */ 313#define TTY_PTY_LOCK 16 /* pty private */
336#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 314#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
337#define TTY_HUPPED 18 /* Post driver->hangup() */ 315#define TTY_HUPPED 18 /* Post driver->hangup() */
338#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
339#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
340#define TTY_HUPPING 21 /* ->hangup() in progress */ 316#define TTY_HUPPING 21 /* ->hangup() in progress */
341 317
342#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -412,9 +388,9 @@ extern void disassociate_ctty(int priv);
412extern void no_tty(void); 388extern void no_tty(void);
413extern void tty_flip_buffer_push(struct tty_struct *tty); 389extern void tty_flip_buffer_push(struct tty_struct *tty);
414extern void tty_flush_to_ldisc(struct tty_struct *tty); 390extern void tty_flush_to_ldisc(struct tty_struct *tty);
415extern void tty_buffer_free_all(struct tty_struct *tty); 391extern void tty_buffer_free_all(struct tty_port *port);
416extern void tty_buffer_flush(struct tty_struct *tty); 392extern void tty_buffer_flush(struct tty_struct *tty);
417extern void tty_buffer_init(struct tty_struct *tty); 393extern void tty_buffer_init(struct tty_port *port);
418extern speed_t tty_get_baud_rate(struct tty_struct *tty); 394extern speed_t tty_get_baud_rate(struct tty_struct *tty);
419extern speed_t tty_termios_baud_rate(struct ktermios *termios); 395extern speed_t tty_termios_baud_rate(struct ktermios *termios);
420extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 396extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -535,7 +511,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
535/* tty_audit.c */ 511/* tty_audit.c */
536#ifdef CONFIG_AUDIT 512#ifdef CONFIG_AUDIT
537extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 513extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
538 size_t size); 514 size_t size, unsigned icanon);
539extern void tty_audit_exit(void); 515extern void tty_audit_exit(void);
540extern void tty_audit_fork(struct signal_struct *sig); 516extern void tty_audit_fork(struct signal_struct *sig);
541extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 517extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
@@ -544,7 +520,7 @@ extern int tty_audit_push_task(struct task_struct *tsk,
544 kuid_t loginuid, u32 sessionid); 520 kuid_t loginuid, u32 sessionid);
545#else 521#else
546static inline void tty_audit_add_data(struct tty_struct *tty, 522static inline void tty_audit_add_data(struct tty_struct *tty,
547 unsigned char *data, size_t size) 523 unsigned char *data, size_t size, unsigned icanon)
548{ 524{
549} 525}
550static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) 526static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 9239d033a0a3..2002344ed36a 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -11,7 +11,7 @@ void tty_schedule_flip(struct tty_struct *tty);
11static inline int tty_insert_flip_char(struct tty_struct *tty, 11static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->port->buf.tail;
15 if (tb && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 07915a32fb9d..10278d18709c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1778,17 +1778,6 @@ static inline int usb_translate_errors(int error_code)
1778extern void usb_register_notify(struct notifier_block *nb); 1778extern void usb_register_notify(struct notifier_block *nb);
1779extern void usb_unregister_notify(struct notifier_block *nb); 1779extern void usb_unregister_notify(struct notifier_block *nb);
1780 1780
1781#ifdef DEBUG
1782#define dbg(format, arg...) \
1783 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg)
1784#else
1785#define dbg(format, arg...) \
1786do { \
1787 if (0) \
1788 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
1789} while (0)
1790#endif
1791
1792/* debugfs stuff */ 1781/* debugfs stuff */
1793extern struct dentry *usb_debug_root; 1782extern struct dentry *usb_debug_root;
1794 1783
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index b607f3532e88..e69de29bb2d1 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,10 +0,0 @@
1header-y += audio.h
2header-y += cdc.h
3header-y += ch9.h
4header-y += ch11.h
5header-y += functionfs.h
6header-y += gadgetfs.h
7header-y += midi.h
8header-y += g_printer.h
9header-y += tmc.h
10header-y += video.h
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index a54b8255d75f..3d84619110a4 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -17,531 +17,11 @@
17 * Types and defines in this file are either specific to version 1.0 of 17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions. 18 * this standard or common for newer versions.
19 */ 19 */
20
21#ifndef __LINUX_USB_AUDIO_H 20#ifndef __LINUX_USB_AUDIO_H
22#define __LINUX_USB_AUDIO_H 21#define __LINUX_USB_AUDIO_H
23 22
24#include <linux/types.h> 23#include <uapi/linux/usb/audio.h>
25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
30/* A.2 Audio Interface Subclass Codes */
31#define USB_SUBCLASS_AUDIOCONTROL 0x01
32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
33#define USB_SUBCLASS_MIDISTREAMING 0x03
34
35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
36#define UAC_HEADER 0x01
37#define UAC_INPUT_TERMINAL 0x02
38#define UAC_OUTPUT_TERMINAL 0x03
39#define UAC_MIXER_UNIT 0x04
40#define UAC_SELECTOR_UNIT 0x05
41#define UAC_FEATURE_UNIT 0x06
42#define UAC1_PROCESSING_UNIT 0x07
43#define UAC1_EXTENSION_UNIT 0x08
44
45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
46#define UAC_AS_GENERAL 0x01
47#define UAC_FORMAT_TYPE 0x02
48#define UAC_FORMAT_SPECIFIC 0x03
49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
60#define UAC_EP_GENERAL 0x01
61
62/* A.9 Audio Class-Specific Request Codes */
63#define UAC_SET_ 0x00
64#define UAC_GET_ 0x80
65
66#define UAC__CUR 0x1
67#define UAC__MIN 0x2
68#define UAC__MAX 0x3
69#define UAC__RES 0x4
70#define UAC__MEM 0x5
71
72#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
73#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
74#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
75#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
76#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
77#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
78#define UAC_SET_RES (UAC_SET_ | UAC__RES)
79#define UAC_GET_RES (UAC_GET_ | UAC__RES)
80#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
81#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
82
83#define UAC_GET_STAT 0xff
84
85/* A.10 Control Selector Codes */
86
87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
138
139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
140#define UAC_MS_HEADER 0x01
141#define UAC_MIDI_IN_JACK 0x02
142#define UAC_MIDI_OUT_JACK 0x03
143
144/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
145#define UAC_MS_GENERAL 0x01
146
147/* Terminals - 2.1 USB Terminal Types */
148#define UAC_TERMINAL_UNDEFINED 0x100
149#define UAC_TERMINAL_STREAMING 0x101
150#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
151
152/* Terminal Control Selectors */
153/* 4.3.2 Class-Specific AC Interface Descriptor */
154struct uac1_ac_header_descriptor {
155 __u8 bLength; /* 8 + n */
156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
158 __le16 bcdADC; /* 0x0100 */
159 __le16 wTotalLength; /* includes Unit and Terminal desc. */
160 __u8 bInCollection; /* n */
161 __u8 baInterfaceNr[]; /* [n] */
162} __attribute__ ((packed));
163
164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
165
166/* As above, but more useful for defining your own descriptors: */
167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168struct uac1_ac_header_descriptor_##n { \
169 __u8 bLength; \
170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \
172 __le16 bcdADC; \
173 __le16 wTotalLength; \
174 __u8 bInCollection; \
175 __u8 baInterfaceNr[n]; \
176} __attribute__ ((packed))
177
178/* 4.3.2.1 Input Terminal Descriptor */
179struct uac_input_terminal_descriptor {
180 __u8 bLength; /* in bytes: 12 */
181 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
182 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
183 __u8 bTerminalID; /* Constant uniquely terminal ID */
184 __le16 wTerminalType; /* USB Audio Terminal Types */
185 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
186 __u8 bNrChannels; /* Number of logical output channels */
187 __le16 wChannelConfig;
188 __u8 iChannelNames;
189 __u8 iTerminal;
190} __attribute__ ((packed));
191
192#define UAC_DT_INPUT_TERMINAL_SIZE 12
193
194/* Terminals - 2.2 Input Terminal Types */
195#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
196#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
197#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
198#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
199#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
200#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
201#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
202
203/* Terminals - control selectors */
204
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206
207/* 4.3.2.2 Output Terminal Descriptor */
208struct uac1_output_terminal_descriptor {
209 __u8 bLength; /* in bytes: 9 */
210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
212 __u8 bTerminalID; /* Constant uniquely terminal ID */
213 __le16 wTerminalType; /* USB Audio Terminal Types */
214 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
215 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
216 __u8 iTerminal;
217} __attribute__ ((packed));
218
219#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
220
221/* Terminals - 2.3 Output Terminal Types */
222#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
223#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
224#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
225#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
226#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
227#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
228#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
229#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
230
231/* Set bControlSize = 2 as default setting */
232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
233
234/* As above, but more useful for defining your own descriptors: */
235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
236struct uac_feature_unit_descriptor_##ch { \
237 __u8 bLength; \
238 __u8 bDescriptorType; \
239 __u8 bDescriptorSubtype; \
240 __u8 bUnitID; \
241 __u8 bSourceID; \
242 __u8 bControlSize; \
243 __le16 bmaControls[ch + 1]; \
244 __u8 iFeature; \
245} __attribute__ ((packed))
246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256 24
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
397/* 4.5.2 Class-Specific AS Interface Descriptor */
398struct uac1_as_header_descriptor {
399 __u8 bLength; /* in bytes: 7 */
400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
401 __u8 bDescriptorSubtype; /* AS_GENERAL */
402 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
403 __u8 bDelay; /* Delay introduced by the data path */
404 __le16 wFormatTag; /* The Audio Data Format */
405} __attribute__ ((packed));
406
407#define UAC_DT_AS_HEADER_SIZE 7
408
409/* Formats - A.1.1 Audio Data Format Type I Codes */
410#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
411#define UAC_FORMAT_TYPE_I_PCM 0x1
412#define UAC_FORMAT_TYPE_I_PCM8 0x2
413#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
414#define UAC_FORMAT_TYPE_I_ALAW 0x4
415#define UAC_FORMAT_TYPE_I_MULAW 0x5
416
417struct uac_format_type_i_continuous_descriptor {
418 __u8 bLength; /* in bytes: 8 + (ns * 3) */
419 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
420 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
421 __u8 bFormatType; /* FORMAT_TYPE_1 */
422 __u8 bNrChannels; /* physical channels in the stream */
423 __u8 bSubframeSize; /* */
424 __u8 bBitResolution;
425 __u8 bSamFreqType;
426 __u8 tLowerSamFreq[3];
427 __u8 tUpperSamFreq[3];
428} __attribute__ ((packed));
429
430#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
431
432struct uac_format_type_i_discrete_descriptor {
433 __u8 bLength; /* in bytes: 8 + (ns * 3) */
434 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
435 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
436 __u8 bFormatType; /* FORMAT_TYPE_1 */
437 __u8 bNrChannels; /* physical channels in the stream */
438 __u8 bSubframeSize; /* */
439 __u8 bBitResolution;
440 __u8 bSamFreqType;
441 __u8 tSamFreq[][3];
442} __attribute__ ((packed));
443
444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
445struct uac_format_type_i_discrete_descriptor_##n { \
446 __u8 bLength; \
447 __u8 bDescriptorType; \
448 __u8 bDescriptorSubtype; \
449 __u8 bFormatType; \
450 __u8 bNrChannels; \
451 __u8 bSubframeSize; \
452 __u8 bBitResolution; \
453 __u8 bSamFreqType; \
454 __u8 tSamFreq[n][3]; \
455} __attribute__ ((packed))
456
457#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
458
459struct uac_format_type_i_ext_descriptor {
460 __u8 bLength;
461 __u8 bDescriptorType;
462 __u8 bDescriptorSubtype;
463 __u8 bFormatType;
464 __u8 bSubslotSize;
465 __u8 bBitResolution;
466 __u8 bHeaderLength;
467 __u8 bControlSize;
468 __u8 bSideBandProtocol;
469} __attribute__((packed));
470
471/* Formats - Audio Data Format Type I Codes */
472
473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
474#define UAC_FORMAT_TYPE_II_AC3 0x1002
475
476struct uac_format_type_ii_discrete_descriptor {
477 __u8 bLength;
478 __u8 bDescriptorType;
479 __u8 bDescriptorSubtype;
480 __u8 bFormatType;
481 __le16 wMaxBitRate;
482 __le16 wSamplesPerFrame;
483 __u8 bSamFreqType;
484 __u8 tSamFreq[][3];
485} __attribute__((packed));
486
487struct uac_format_type_ii_ext_descriptor {
488 __u8 bLength;
489 __u8 bDescriptorType;
490 __u8 bDescriptorSubtype;
491 __u8 bFormatType;
492 __u16 wMaxBitRate;
493 __u16 wSamplesPerFrame;
494 __u8 bHeaderLength;
495 __u8 bSideBandProtocol;
496} __attribute__((packed));
497
498/* type III */
499#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
505
506/* Formats - A.2 Format Type Codes */
507#define UAC_FORMAT_TYPE_UNDEFINED 0x0
508#define UAC_FORMAT_TYPE_I 0x1
509#define UAC_FORMAT_TYPE_II 0x2
510#define UAC_FORMAT_TYPE_III 0x3
511#define UAC_EXT_FORMAT_TYPE_I 0x81
512#define UAC_EXT_FORMAT_TYPE_II 0x82
513#define UAC_EXT_FORMAT_TYPE_III 0x83
514
515struct uac_iso_endpoint_descriptor {
516 __u8 bLength; /* in bytes: 7 */
517 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
518 __u8 bDescriptorSubtype; /* EP_GENERAL */
519 __u8 bmAttributes;
520 __u8 bLockDelayUnits;
521 __le16 wLockDelay;
522} __attribute__((packed));
523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
524
525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
528
529/* status word format (3.7.1.1) */
530
531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
535
536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
538
539struct uac1_status_word {
540 __u8 bStatusType;
541 __u8 bOriginator;
542} __attribute__((packed));
543
544#ifdef __KERNEL__
545 25
546struct usb_audio_control { 26struct usb_audio_control {
547 struct list_head list; 27 struct list_head list;
@@ -561,6 +41,4 @@ struct usb_audio_control_selector {
561 struct usb_descriptor_header *desc; 41 struct usb_descriptor_header *desc;
562}; 42};
563 43
564#endif /* __KERNEL__ */
565
566#endif /* __LINUX_USB_AUDIO_H */ 44#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d1d732c2838d..9c210f2283df 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -29,887 +29,11 @@
29 * someone that the two other points are non-issues for that 29 * someone that the two other points are non-issues for that
30 * particular descriptor type. 30 * particular descriptor type.
31 */ 31 */
32
33#ifndef __LINUX_USB_CH9_H 32#ifndef __LINUX_USB_CH9_H
34#define __LINUX_USB_CH9_H 33#define __LINUX_USB_CH9_H
35 34
36#include <linux/types.h> /* __u8 etc */ 35#include <uapi/linux/usb/ch9.h>
37#include <asm/byteorder.h> /* le16_to_cpu */
38
39/*-------------------------------------------------------------------------*/
40
41/* CONTROL REQUEST SUPPORT */
42
43/*
44 * USB directions
45 *
46 * This bit flag is used in endpoint descriptors' bEndpointAddress field.
47 * It's also one of three fields in control requests bRequestType.
48 */
49#define USB_DIR_OUT 0 /* to device */
50#define USB_DIR_IN 0x80 /* to host */
51
52/*
53 * USB types, the second of three bRequestType fields
54 */
55#define USB_TYPE_MASK (0x03 << 5)
56#define USB_TYPE_STANDARD (0x00 << 5)
57#define USB_TYPE_CLASS (0x01 << 5)
58#define USB_TYPE_VENDOR (0x02 << 5)
59#define USB_TYPE_RESERVED (0x03 << 5)
60
61/*
62 * USB recipients, the third of three bRequestType fields
63 */
64#define USB_RECIP_MASK 0x1f
65#define USB_RECIP_DEVICE 0x00
66#define USB_RECIP_INTERFACE 0x01
67#define USB_RECIP_ENDPOINT 0x02
68#define USB_RECIP_OTHER 0x03
69/* From Wireless USB 1.0 */
70#define USB_RECIP_PORT 0x04
71#define USB_RECIP_RPIPE 0x05
72
73/*
74 * Standard requests, for the bRequest field of a SETUP packet.
75 *
76 * These are qualified by the bRequestType field, so that for example
77 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
78 * by a GET_STATUS request.
79 */
80#define USB_REQ_GET_STATUS 0x00
81#define USB_REQ_CLEAR_FEATURE 0x01
82#define USB_REQ_SET_FEATURE 0x03
83#define USB_REQ_SET_ADDRESS 0x05
84#define USB_REQ_GET_DESCRIPTOR 0x06
85#define USB_REQ_SET_DESCRIPTOR 0x07
86#define USB_REQ_GET_CONFIGURATION 0x08
87#define USB_REQ_SET_CONFIGURATION 0x09
88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
93
94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
95#define USB_REQ_GET_ENCRYPTION 0x0E
96#define USB_REQ_RPIPE_ABORT 0x0E
97#define USB_REQ_SET_HANDSHAKE 0x0F
98#define USB_REQ_RPIPE_RESET 0x0F
99#define USB_REQ_GET_HANDSHAKE 0x10
100#define USB_REQ_SET_CONNECTION 0x11
101#define USB_REQ_SET_SECURITY_DATA 0x12
102#define USB_REQ_GET_SECURITY_DATA 0x13
103#define USB_REQ_SET_WUSB_DATA 0x14
104#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
105#define USB_REQ_LOOPBACK_DATA_READ 0x16
106#define USB_REQ_SET_INTERFACE_DS 0x17
107
108/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
109 * used by hubs to put ports into a new L1 suspend state, except that it
110 * forgot to define its number ...
111 */
112
113/*
114 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
115 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
116 * are at most sixteen features of each type.) Hubs may also support a
117 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
118 */
119#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
120#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
121#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
122#define USB_DEVICE_BATTERY 2 /* (wireless) */
123#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
124#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
125#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
126#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
127#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
128
129/*
130 * Test Mode Selectors
131 * See USB 2.0 spec Table 9-7
132 */
133#define TEST_J 1
134#define TEST_K 2
135#define TEST_SE0_NAK 3
136#define TEST_PACKET 4
137#define TEST_FORCE_EN 5
138
139/*
140 * New Feature Selectors as added by USB 3.0
141 * See USB 3.0 spec Table 9-6
142 */
143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
145#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
146#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
147
148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
149/*
150 * Suspend Options, Table 9-7 USB 3.0 spec
151 */
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
154
155#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
156
157/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
158#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
159#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
160#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
161
162/**
163 * struct usb_ctrlrequest - SETUP data for a USB device control request
164 * @bRequestType: matches the USB bmRequestType field
165 * @bRequest: matches the USB bRequest field
166 * @wValue: matches the USB wValue field (le16 byte order)
167 * @wIndex: matches the USB wIndex field (le16 byte order)
168 * @wLength: matches the USB wLength field (le16 byte order)
169 *
170 * This structure is used to send control requests to a USB device. It matches
171 * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
172 * USB spec for a fuller description of the different fields, and what they are
173 * used for.
174 *
175 * Note that the driver for any interface can issue control requests.
176 * For most devices, interfaces don't coordinate with each other, so
177 * such requests may be made at any time.
178 */
179struct usb_ctrlrequest {
180 __u8 bRequestType;
181 __u8 bRequest;
182 __le16 wValue;
183 __le16 wIndex;
184 __le16 wLength;
185} __attribute__ ((packed));
186
187/*-------------------------------------------------------------------------*/
188
189/*
190 * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
191 * (rarely) accepted by SET_DESCRIPTOR.
192 *
193 * Note that all multi-byte values here are encoded in little endian
194 * byte order "on the wire". Within the kernel and when exposed
195 * through the Linux-USB APIs, they are not converted to cpu byte
196 * order; it is the responsibility of the client code to do this.
197 * The single exception is when device and configuration descriptors (but
198 * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
199 * in this case the fields are converted to host endianness by the kernel.
200 */
201
202/*
203 * Descriptor types ... USB 2.0 spec table 9.5
204 */
205#define USB_DT_DEVICE 0x01
206#define USB_DT_CONFIG 0x02
207#define USB_DT_STRING 0x03
208#define USB_DT_INTERFACE 0x04
209#define USB_DT_ENDPOINT 0x05
210#define USB_DT_DEVICE_QUALIFIER 0x06
211#define USB_DT_OTHER_SPEED_CONFIG 0x07
212#define USB_DT_INTERFACE_POWER 0x08
213/* these are from a minor usb 2.0 revision (ECN) */
214#define USB_DT_OTG 0x09
215#define USB_DT_DEBUG 0x0a
216#define USB_DT_INTERFACE_ASSOCIATION 0x0b
217/* these are from the Wireless USB spec */
218#define USB_DT_SECURITY 0x0c
219#define USB_DT_KEY 0x0d
220#define USB_DT_ENCRYPTION_TYPE 0x0e
221#define USB_DT_BOS 0x0f
222#define USB_DT_DEVICE_CAPABILITY 0x10
223#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
224#define USB_DT_WIRE_ADAPTER 0x21
225#define USB_DT_RPIPE 0x22
226#define USB_DT_CS_RADIO_CONTROL 0x23
227/* From the T10 UAS specification */
228#define USB_DT_PIPE_USAGE 0x24
229/* From the USB 3.0 spec */
230#define USB_DT_SS_ENDPOINT_COMP 0x30
231
232/* Conventional codes for class-specific descriptors. The convention is
233 * defined in the USB "Common Class" Spec (3.11). Individual class specs
234 * are authoritative for their usage, not the "common class" writeup.
235 */
236#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
237#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
238#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
239#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
240#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
241
242/* All standard descriptors have these 2 fields at the beginning */
243struct usb_descriptor_header {
244 __u8 bLength;
245 __u8 bDescriptorType;
246} __attribute__ ((packed));
247
248
249/*-------------------------------------------------------------------------*/
250
251/* USB_DT_DEVICE: Device descriptor */
252struct usb_device_descriptor {
253 __u8 bLength;
254 __u8 bDescriptorType;
255
256 __le16 bcdUSB;
257 __u8 bDeviceClass;
258 __u8 bDeviceSubClass;
259 __u8 bDeviceProtocol;
260 __u8 bMaxPacketSize0;
261 __le16 idVendor;
262 __le16 idProduct;
263 __le16 bcdDevice;
264 __u8 iManufacturer;
265 __u8 iProduct;
266 __u8 iSerialNumber;
267 __u8 bNumConfigurations;
268} __attribute__ ((packed));
269
270#define USB_DT_DEVICE_SIZE 18
271
272
273/*
274 * Device and/or Interface Class codes
275 * as found in bDeviceClass or bInterfaceClass
276 * and defined by www.usb.org documents
277 */
278#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
279#define USB_CLASS_AUDIO 1
280#define USB_CLASS_COMM 2
281#define USB_CLASS_HID 3
282#define USB_CLASS_PHYSICAL 5
283#define USB_CLASS_STILL_IMAGE 6
284#define USB_CLASS_PRINTER 7
285#define USB_CLASS_MASS_STORAGE 8
286#define USB_CLASS_HUB 9
287#define USB_CLASS_CDC_DATA 0x0a
288#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
289#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
290#define USB_CLASS_VIDEO 0x0e
291#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
292#define USB_CLASS_MISC 0xef
293#define USB_CLASS_APP_SPEC 0xfe
294#define USB_CLASS_VENDOR_SPEC 0xff
295
296#define USB_SUBCLASS_VENDOR_SPEC 0xff
297
298/*-------------------------------------------------------------------------*/
299
300/* USB_DT_CONFIG: Configuration descriptor information.
301 *
302 * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
303 * descriptor type is different. Highspeed-capable devices can look
304 * different depending on what speed they're currently running. Only
305 * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
306 * descriptors.
307 */
308struct usb_config_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311
312 __le16 wTotalLength;
313 __u8 bNumInterfaces;
314 __u8 bConfigurationValue;
315 __u8 iConfiguration;
316 __u8 bmAttributes;
317 __u8 bMaxPower;
318} __attribute__ ((packed));
319
320#define USB_DT_CONFIG_SIZE 9
321
322/* from config descriptor bmAttributes */
323#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
324#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
325#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
326#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
327
328/*-------------------------------------------------------------------------*/
329
330/* USB_DT_STRING: String descriptor */
331struct usb_string_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334
335 __le16 wData[1]; /* UTF-16LE encoded */
336} __attribute__ ((packed));
337
338/* note that "string" zero is special, it holds language codes that
339 * the device supports, not Unicode characters.
340 */
341
342/*-------------------------------------------------------------------------*/
343
344/* USB_DT_INTERFACE: Interface descriptor */
345struct usb_interface_descriptor {
346 __u8 bLength;
347 __u8 bDescriptorType;
348
349 __u8 bInterfaceNumber;
350 __u8 bAlternateSetting;
351 __u8 bNumEndpoints;
352 __u8 bInterfaceClass;
353 __u8 bInterfaceSubClass;
354 __u8 bInterfaceProtocol;
355 __u8 iInterface;
356} __attribute__ ((packed));
357
358#define USB_DT_INTERFACE_SIZE 9
359
360/*-------------------------------------------------------------------------*/
361
362/* USB_DT_ENDPOINT: Endpoint descriptor */
363struct usb_endpoint_descriptor {
364 __u8 bLength;
365 __u8 bDescriptorType;
366
367 __u8 bEndpointAddress;
368 __u8 bmAttributes;
369 __le16 wMaxPacketSize;
370 __u8 bInterval;
371
372 /* NOTE: these two are _only_ in audio endpoints. */
373 /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
374 __u8 bRefresh;
375 __u8 bSynchAddress;
376} __attribute__ ((packed));
377
378#define USB_DT_ENDPOINT_SIZE 7
379#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
380
381
382/*
383 * Endpoints
384 */
385#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
386#define USB_ENDPOINT_DIR_MASK 0x80
387
388#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
389#define USB_ENDPOINT_XFER_CONTROL 0
390#define USB_ENDPOINT_XFER_ISOC 1
391#define USB_ENDPOINT_XFER_BULK 2
392#define USB_ENDPOINT_XFER_INT 3
393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
400#define USB_ENDPOINT_SYNCTYPE 0x0c
401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
403#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
404#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
405
406#define USB_ENDPOINT_USAGE_MASK 0x30
407#define USB_ENDPOINT_USAGE_DATA 0x00
408#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
409#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
410
411/*-------------------------------------------------------------------------*/
412
413/**
414 * usb_endpoint_num - get the endpoint's number
415 * @epd: endpoint to be checked
416 *
417 * Returns @epd's number: 0 to 15.
418 */
419static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
420{
421 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
422}
423
424/**
425 * usb_endpoint_type - get the endpoint's transfer type
426 * @epd: endpoint to be checked
427 *
428 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
429 * to @epd's transfer type.
430 */
431static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
432{
433 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
434}
435
436/**
437 * usb_endpoint_dir_in - check if the endpoint has IN direction
438 * @epd: endpoint to be checked
439 *
440 * Returns true if the endpoint is of type IN, otherwise it returns false.
441 */
442static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
443{
444 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
445}
446
447/**
448 * usb_endpoint_dir_out - check if the endpoint has OUT direction
449 * @epd: endpoint to be checked
450 *
451 * Returns true if the endpoint is of type OUT, otherwise it returns false.
452 */
453static inline int usb_endpoint_dir_out(
454 const struct usb_endpoint_descriptor *epd)
455{
456 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
457}
458
459/**
460 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
461 * @epd: endpoint to be checked
462 *
463 * Returns true if the endpoint is of type bulk, otherwise it returns false.
464 */
465static inline int usb_endpoint_xfer_bulk(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
469 USB_ENDPOINT_XFER_BULK);
470}
471
472/**
473 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
474 * @epd: endpoint to be checked
475 *
476 * Returns true if the endpoint is of type control, otherwise it returns false.
477 */
478static inline int usb_endpoint_xfer_control(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
482 USB_ENDPOINT_XFER_CONTROL);
483}
484
485/**
486 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
487 * @epd: endpoint to be checked
488 *
489 * Returns true if the endpoint is of type interrupt, otherwise it returns
490 * false.
491 */
492static inline int usb_endpoint_xfer_int(
493 const struct usb_endpoint_descriptor *epd)
494{
495 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
496 USB_ENDPOINT_XFER_INT);
497}
498
499/**
500 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
501 * @epd: endpoint to be checked
502 *
503 * Returns true if the endpoint is of type isochronous, otherwise it returns
504 * false.
505 */
506static inline int usb_endpoint_xfer_isoc(
507 const struct usb_endpoint_descriptor *epd)
508{
509 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
510 USB_ENDPOINT_XFER_ISOC);
511}
512
513/**
514 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
515 * @epd: endpoint to be checked
516 *
517 * Returns true if the endpoint has bulk transfer type and IN direction,
518 * otherwise it returns false.
519 */
520static inline int usb_endpoint_is_bulk_in(
521 const struct usb_endpoint_descriptor *epd)
522{
523 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
524}
525
526/**
527 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
528 * @epd: endpoint to be checked
529 *
530 * Returns true if the endpoint has bulk transfer type and OUT direction,
531 * otherwise it returns false.
532 */
533static inline int usb_endpoint_is_bulk_out(
534 const struct usb_endpoint_descriptor *epd)
535{
536 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
537}
538
539/**
540 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
541 * @epd: endpoint to be checked
542 *
543 * Returns true if the endpoint has interrupt transfer type and IN direction,
544 * otherwise it returns false.
545 */
546static inline int usb_endpoint_is_int_in(
547 const struct usb_endpoint_descriptor *epd)
548{
549 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
550}
551
552/**
553 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
554 * @epd: endpoint to be checked
555 *
556 * Returns true if the endpoint has interrupt transfer type and OUT direction,
557 * otherwise it returns false.
558 */
559static inline int usb_endpoint_is_int_out(
560 const struct usb_endpoint_descriptor *epd)
561{
562 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
563}
564
565/**
566 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
567 * @epd: endpoint to be checked
568 *
569 * Returns true if the endpoint has isochronous transfer type and IN direction,
570 * otherwise it returns false.
571 */
572static inline int usb_endpoint_is_isoc_in(
573 const struct usb_endpoint_descriptor *epd)
574{
575 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
576}
577
578/**
579 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
580 * @epd: endpoint to be checked
581 *
582 * Returns true if the endpoint has isochronous transfer type and OUT direction,
583 * otherwise it returns false.
584 */
585static inline int usb_endpoint_is_isoc_out(
586 const struct usb_endpoint_descriptor *epd)
587{
588 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
589}
590
591/**
592 * usb_endpoint_maxp - get endpoint's max packet size
593 * @epd: endpoint to be checked
594 *
595 * Returns @epd's max packet
596 */
597static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
598{
599 return __le16_to_cpu(epd->wMaxPacketSize);
600}
601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
608/*-------------------------------------------------------------------------*/
609
610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
611struct usb_ss_ep_comp_descriptor {
612 __u8 bLength;
613 __u8 bDescriptorType;
614
615 __u8 bMaxBurst;
616 __u8 bmAttributes;
617 __le16 wBytesPerInterval;
618} __attribute__ ((packed));
619
620#define USB_DT_SS_EP_COMP_SIZE 6
621
622/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
623static inline int
624usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
625{
626 int max_streams;
627
628 if (!comp)
629 return 0;
630
631 max_streams = comp->bmAttributes & 0x1f;
632
633 if (!max_streams)
634 return 0;
635
636 max_streams = 1 << max_streams;
637
638 return max_streams;
639}
640
641/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
642#define USB_SS_MULT(p) (1 + ((p) & 0x3))
643
644/*-------------------------------------------------------------------------*/
645
646/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
647struct usb_qualifier_descriptor {
648 __u8 bLength;
649 __u8 bDescriptorType;
650
651 __le16 bcdUSB;
652 __u8 bDeviceClass;
653 __u8 bDeviceSubClass;
654 __u8 bDeviceProtocol;
655 __u8 bMaxPacketSize0;
656 __u8 bNumConfigurations;
657 __u8 bRESERVED;
658} __attribute__ ((packed));
659
660
661/*-------------------------------------------------------------------------*/
662
663/* USB_DT_OTG (from OTG 1.0a supplement) */
664struct usb_otg_descriptor {
665 __u8 bLength;
666 __u8 bDescriptorType;
667
668 __u8 bmAttributes; /* support for HNP, SRP, etc */
669} __attribute__ ((packed));
670
671/* from usb_otg_descriptor.bmAttributes */
672#define USB_OTG_SRP (1 << 0)
673#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
674
675/*-------------------------------------------------------------------------*/
676
677/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
678struct usb_debug_descriptor {
679 __u8 bLength;
680 __u8 bDescriptorType;
681
682 /* bulk endpoints with 8 byte maxpacket */
683 __u8 bDebugInEndpoint;
684 __u8 bDebugOutEndpoint;
685} __attribute__((packed));
686
687/*-------------------------------------------------------------------------*/
688
689/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
690struct usb_interface_assoc_descriptor {
691 __u8 bLength;
692 __u8 bDescriptorType;
693
694 __u8 bFirstInterface;
695 __u8 bInterfaceCount;
696 __u8 bFunctionClass;
697 __u8 bFunctionSubClass;
698 __u8 bFunctionProtocol;
699 __u8 iFunction;
700} __attribute__ ((packed));
701
702
703/*-------------------------------------------------------------------------*/
704
705/* USB_DT_SECURITY: group of wireless security descriptors, including
706 * encryption types available for setting up a CC/association.
707 */
708struct usb_security_descriptor {
709 __u8 bLength;
710 __u8 bDescriptorType;
711
712 __le16 wTotalLength;
713 __u8 bNumEncryptionTypes;
714} __attribute__((packed));
715
716/*-------------------------------------------------------------------------*/
717
718/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
719 * may be retrieved.
720 */
721struct usb_key_descriptor {
722 __u8 bLength;
723 __u8 bDescriptorType;
724
725 __u8 tTKID[3];
726 __u8 bReserved;
727 __u8 bKeyData[0];
728} __attribute__((packed));
729
730/*-------------------------------------------------------------------------*/
731
732/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
733struct usb_encryption_descriptor {
734 __u8 bLength;
735 __u8 bDescriptorType;
736
737 __u8 bEncryptionType;
738#define USB_ENC_TYPE_UNSECURE 0
739#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
740#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
741#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
742 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
743 __u8 bAuthKeyIndex;
744} __attribute__((packed));
745
746
747/*-------------------------------------------------------------------------*/
748
749/* USB_DT_BOS: group of device-level capabilities */
750struct usb_bos_descriptor {
751 __u8 bLength;
752 __u8 bDescriptorType;
753
754 __le16 wTotalLength;
755 __u8 bNumDeviceCaps;
756} __attribute__((packed));
757
758#define USB_DT_BOS_SIZE 5
759/*-------------------------------------------------------------------------*/
760
761/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
762struct usb_dev_cap_header {
763 __u8 bLength;
764 __u8 bDescriptorType;
765 __u8 bDevCapabilityType;
766} __attribute__((packed));
767
768#define USB_CAP_TYPE_WIRELESS_USB 1
769
770struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
771 __u8 bLength;
772 __u8 bDescriptorType;
773 __u8 bDevCapabilityType;
774
775 __u8 bmAttributes;
776#define USB_WIRELESS_P2P_DRD (1 << 1)
777#define USB_WIRELESS_BEACON_MASK (3 << 2)
778#define USB_WIRELESS_BEACON_SELF (1 << 2)
779#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
780#define USB_WIRELESS_BEACON_NONE (3 << 2)
781 __le16 wPHYRates; /* bit rates, Mbps */
782#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
783#define USB_WIRELESS_PHY_80 (1 << 1)
784#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
785#define USB_WIRELESS_PHY_160 (1 << 3)
786#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
787#define USB_WIRELESS_PHY_320 (1 << 5)
788#define USB_WIRELESS_PHY_400 (1 << 6)
789#define USB_WIRELESS_PHY_480 (1 << 7)
790 __u8 bmTFITXPowerInfo; /* TFI power levels */
791 __u8 bmFFITXPowerInfo; /* FFI power levels */
792 __le16 bmBandGroup;
793 __u8 bReserved;
794} __attribute__((packed));
795
796/* USB 2.0 Extension descriptor */
797#define USB_CAP_TYPE_EXT 2
798
799struct usb_ext_cap_descriptor { /* Link Power Management */
800 __u8 bLength;
801 __u8 bDescriptorType;
802 __u8 bDevCapabilityType;
803 __le32 bmAttributes;
804#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
805#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
806#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
807#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
808#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
809#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
810} __attribute__((packed));
811
812#define USB_DT_USB_EXT_CAP_SIZE 7
813
814/*
815 * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
816 * specific device level capabilities
817 */
818#define USB_SS_CAP_TYPE 3
819struct usb_ss_cap_descriptor { /* Link Power Management */
820 __u8 bLength;
821 __u8 bDescriptorType;
822 __u8 bDevCapabilityType;
823 __u8 bmAttributes;
824#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
825 __le16 wSpeedSupported;
826#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
827#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
828#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
829#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
830 __u8 bFunctionalitySupport;
831 __u8 bU1devExitLat;
832 __le16 bU2DevExitLat;
833} __attribute__((packed));
834
835#define USB_DT_USB_SS_CAP_SIZE 10
836
837/*
838 * Container ID Capability descriptor: Defines the instance unique ID used to
839 * identify the instance across all operating modes
840 */
841#define CONTAINER_ID_TYPE 4
842struct usb_ss_container_id_descriptor {
843 __u8 bLength;
844 __u8 bDescriptorType;
845 __u8 bDevCapabilityType;
846 __u8 bReserved;
847 __u8 ContainerID[16]; /* 128-bit number */
848} __attribute__((packed));
849
850#define USB_DT_USB_SS_CONTN_ID_SIZE 20
851/*-------------------------------------------------------------------------*/
852
853/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
854 * each endpoint descriptor for a wireless device
855 */
856struct usb_wireless_ep_comp_descriptor {
857 __u8 bLength;
858 __u8 bDescriptorType;
859
860 __u8 bMaxBurst;
861 __u8 bMaxSequence;
862 __le16 wMaxStreamDelay;
863 __le16 wOverTheAirPacketSize;
864 __u8 bOverTheAirInterval;
865 __u8 bmCompAttributes;
866#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
867#define USB_ENDPOINT_SWITCH_NO 0
868#define USB_ENDPOINT_SWITCH_SWITCH 1
869#define USB_ENDPOINT_SWITCH_SCALE 2
870} __attribute__((packed));
871
872/*-------------------------------------------------------------------------*/
873
874/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
875 * host and a device for connection set up, mutual authentication, and
876 * exchanging short lived session keys. The handshake depends on a CC.
877 */
878struct usb_handshake {
879 __u8 bMessageNumber;
880 __u8 bStatus;
881 __u8 tTKID[3];
882 __u8 bReserved;
883 __u8 CDID[16];
884 __u8 nonce[16];
885 __u8 MIC[8];
886} __attribute__((packed));
887
888/*-------------------------------------------------------------------------*/
889
890/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
891 * A CC may also be set up using non-wireless secure channels (including
892 * wired USB!), and some devices may support CCs with multiple hosts.
893 */
894struct usb_connection_context {
895 __u8 CHID[16]; /* persistent host id */
896 __u8 CDID[16]; /* device id (unique w/in host context) */
897 __u8 CK[16]; /* connection key */
898} __attribute__((packed));
899
900/*-------------------------------------------------------------------------*/
901 36
902/* USB 2.0 defines three speeds, here's how Linux identifies them */
903
904enum usb_device_speed {
905 USB_SPEED_UNKNOWN = 0, /* enumerating */
906 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
907 USB_SPEED_HIGH, /* usb 2.0 */
908 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
909 USB_SPEED_SUPER, /* usb 3.0 */
910};
911
912#ifdef __KERNEL__
913 37
914/** 38/**
915 * usb_speed_string() - Returns human readable-name of the speed. 39 * usb_speed_string() - Returns human readable-name of the speed.
@@ -919,86 +43,4 @@ enum usb_device_speed {
919 */ 43 */
920extern const char *usb_speed_string(enum usb_device_speed speed); 44extern const char *usb_speed_string(enum usb_device_speed speed);
921 45
922#endif
923
924enum usb_device_state {
925 /* NOTATTACHED isn't in the USB spec, and this state acts
926 * the same as ATTACHED ... but it's clearer this way.
927 */
928 USB_STATE_NOTATTACHED = 0,
929
930 /* chapter 9 and authentication (wireless) device states */
931 USB_STATE_ATTACHED,
932 USB_STATE_POWERED, /* wired */
933 USB_STATE_RECONNECTING, /* auth */
934 USB_STATE_UNAUTHENTICATED, /* auth */
935 USB_STATE_DEFAULT, /* limited function */
936 USB_STATE_ADDRESS,
937 USB_STATE_CONFIGURED, /* most functions */
938
939 USB_STATE_SUSPENDED
940
941 /* NOTE: there are actually four different SUSPENDED
942 * states, returning to POWERED, DEFAULT, ADDRESS, or
943 * CONFIGURED respectively when SOF tokens flow again.
944 * At this level there's no difference between L1 and L2
945 * suspend states. (L2 being original USB 1.1 suspend.)
946 */
947};
948
949enum usb3_link_state {
950 USB3_LPM_U0 = 0,
951 USB3_LPM_U1,
952 USB3_LPM_U2,
953 USB3_LPM_U3
954};
955
956/*
957 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
958 * 0xff means the parent hub will accept transitions to U1, but will not
959 * initiate a transition.
960 *
961 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
962 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
963 * values.
964 *
965 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
966 * 0xff means the parent hub will accept transitions to U2, but will not
967 * initiate a transition.
968 *
969 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
970 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
971 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
972 * 65.024ms.
973 */
974#define USB3_LPM_DISABLED 0x0
975#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
976#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
977#define USB3_LPM_DEVICE_INITIATED 0xFF
978
979struct usb_set_sel_req {
980 __u8 u1_sel;
981 __u8 u1_pel;
982 __le16 u2_sel;
983 __le16 u2_pel;
984} __attribute__ ((packed));
985
986/*
987 * The Set System Exit Latency control transfer provides one byte each for
988 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
989 * are two bytes long.
990 */
991#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
992#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
993
994/*-------------------------------------------------------------------------*/
995
996/*
997 * As per USB compliance update, a device that is actively drawing
998 * more than 100mA from USB must report itself as bus-powered in
999 * the GetStatus(DEVICE) call.
1000 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
1001 */
1002#define USB_SELF_POWER_VBUS_MAX_DRAW 100
1003
1004#endif /* __LINUX_USB_CH9_H */ 46#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index a843d0851364..65d0a88dbc67 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -1,171 +1,8 @@
1#ifndef __LINUX_FUNCTIONFS_H__ 1#ifndef __LINUX_FUNCTIONFS_H__
2#define __LINUX_FUNCTIONFS_H__ 1 2#define __LINUX_FUNCTIONFS_H__ 1
3 3
4#include <uapi/linux/usb/functionfs.h>
4 5
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168#ifdef __KERNEL__
169 6
170struct ffs_data; 7struct ffs_data;
171struct usb_composite_dev; 8struct usb_composite_dev;
@@ -197,5 +34,3 @@ static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
197 34
198 35
199#endif 36#endif
200
201#endif
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/wimax/Kbuild
+++ /dev/null
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/mtd/Kbuild
+++ /dev/null
diff --git a/include/uapi/asm-generic/kvm_para.h b/include/uapi/asm-generic/kvm_para.h
index e69de29bb2d1..486f0af73c39 100644
--- a/include/uapi/asm-generic/kvm_para.h
+++ b/include/uapi/asm-generic/kvm_para.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/include/uapi/linux/dvb/Kbuild b/include/uapi/linux/dvb/Kbuild
index aafaa5aa54d4..d40942cfc627 100644
--- a/include/uapi/linux/dvb/Kbuild
+++ b/include/uapi/linux/dvb/Kbuild
@@ -1 +1,9 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += audio.h
3header-y += ca.h
4header-y += dmx.h
5header-y += frontend.h
6header-y += net.h
7header-y += osd.h
8header-y += version.h
9header-y += video.h
diff --git a/include/linux/dvb/audio.h b/include/uapi/linux/dvb/audio.h
index d47bccd604e4..d47bccd604e4 100644
--- a/include/linux/dvb/audio.h
+++ b/include/uapi/linux/dvb/audio.h
diff --git a/include/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h
index c18537f3e449..c18537f3e449 100644
--- a/include/linux/dvb/ca.h
+++ b/include/uapi/linux/dvb/ca.h
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
new file mode 100644
index 000000000000..b2a9ad8cafdc
--- /dev/null
+++ b/include/uapi/linux/dvb/dmx.h
@@ -0,0 +1,155 @@
1/*
2 * dmx.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23
24#ifndef _UAPI_DVBDMX_H_
25#define _UAPI_DVBDMX_H_
26
27#include <linux/types.h>
28#ifndef __KERNEL__
29#include <time.h>
30#endif
31
32
33#define DMX_FILTER_SIZE 16
34
35typedef enum
36{
37 DMX_OUT_DECODER, /* Streaming directly to decoder. */
38 DMX_OUT_TAP, /* Output going to a memory buffer */
39 /* (to be retrieved via the read command).*/
40 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
41 /* (to be retrieved by reading from the */
42 /* logical DVR device). */
43 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
44} dmx_output_t;
45
46
47typedef enum
48{
49 DMX_IN_FRONTEND, /* Input from a front-end device. */
50 DMX_IN_DVR /* Input from the logical DVR device. */
51} dmx_input_t;
52
53
54typedef enum
55{
56 DMX_PES_AUDIO0,
57 DMX_PES_VIDEO0,
58 DMX_PES_TELETEXT0,
59 DMX_PES_SUBTITLE0,
60 DMX_PES_PCR0,
61
62 DMX_PES_AUDIO1,
63 DMX_PES_VIDEO1,
64 DMX_PES_TELETEXT1,
65 DMX_PES_SUBTITLE1,
66 DMX_PES_PCR1,
67
68 DMX_PES_AUDIO2,
69 DMX_PES_VIDEO2,
70 DMX_PES_TELETEXT2,
71 DMX_PES_SUBTITLE2,
72 DMX_PES_PCR2,
73
74 DMX_PES_AUDIO3,
75 DMX_PES_VIDEO3,
76 DMX_PES_TELETEXT3,
77 DMX_PES_SUBTITLE3,
78 DMX_PES_PCR3,
79
80 DMX_PES_OTHER
81} dmx_pes_type_t;
82
83#define DMX_PES_AUDIO DMX_PES_AUDIO0
84#define DMX_PES_VIDEO DMX_PES_VIDEO0
85#define DMX_PES_TELETEXT DMX_PES_TELETEXT0
86#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
87#define DMX_PES_PCR DMX_PES_PCR0
88
89
90typedef struct dmx_filter
91{
92 __u8 filter[DMX_FILTER_SIZE];
93 __u8 mask[DMX_FILTER_SIZE];
94 __u8 mode[DMX_FILTER_SIZE];
95} dmx_filter_t;
96
97
98struct dmx_sct_filter_params
99{
100 __u16 pid;
101 dmx_filter_t filter;
102 __u32 timeout;
103 __u32 flags;
104#define DMX_CHECK_CRC 1
105#define DMX_ONESHOT 2
106#define DMX_IMMEDIATE_START 4
107#define DMX_KERNEL_CLIENT 0x8000
108};
109
110
111struct dmx_pes_filter_params
112{
113 __u16 pid;
114 dmx_input_t input;
115 dmx_output_t output;
116 dmx_pes_type_t pes_type;
117 __u32 flags;
118};
119
120typedef struct dmx_caps {
121 __u32 caps;
122 int num_decoders;
123} dmx_caps_t;
124
125typedef enum {
126 DMX_SOURCE_FRONT0 = 0,
127 DMX_SOURCE_FRONT1,
128 DMX_SOURCE_FRONT2,
129 DMX_SOURCE_FRONT3,
130 DMX_SOURCE_DVR0 = 16,
131 DMX_SOURCE_DVR1,
132 DMX_SOURCE_DVR2,
133 DMX_SOURCE_DVR3
134} dmx_source_t;
135
136struct dmx_stc {
137 unsigned int num; /* input : which STC? 0..N */
138 unsigned int base; /* output: divisor for stc to get 90 kHz clock */
139 __u64 stc; /* output: stc in 'base'*90 kHz units */
140};
141
142
143#define DMX_START _IO('o', 41)
144#define DMX_STOP _IO('o', 42)
145#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
146#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
147#define DMX_SET_BUFFER_SIZE _IO('o', 45)
148#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
149#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
150#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
151#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
152#define DMX_ADD_PID _IOW('o', 51, __u16)
153#define DMX_REMOVE_PID _IOW('o', 52, __u16)
154
155#endif /* _UAPI_DVBDMX_H_ */
diff --git a/include/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
index c12d452cb40d..c12d452cb40d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
diff --git a/include/linux/dvb/net.h b/include/uapi/linux/dvb/net.h
index f451e7eb0b0b..f451e7eb0b0b 100644
--- a/include/linux/dvb/net.h
+++ b/include/uapi/linux/dvb/net.h
diff --git a/include/linux/dvb/osd.h b/include/uapi/linux/dvb/osd.h
index 880e68435832..880e68435832 100644
--- a/include/linux/dvb/osd.h
+++ b/include/uapi/linux/dvb/osd.h
diff --git a/include/linux/dvb/version.h b/include/uapi/linux/dvb/version.h
index 827cce7e33e3..827cce7e33e3 100644
--- a/include/linux/dvb/version.h
+++ b/include/uapi/linux/dvb/version.h
diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h
new file mode 100644
index 000000000000..d3d14a59d2d5
--- /dev/null
+++ b/include/uapi/linux/dvb/video.h
@@ -0,0 +1,274 @@
1/*
2 * video.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23
24#ifndef _UAPI_DVBVIDEO_H_
25#define _UAPI_DVBVIDEO_H_
26
27#include <linux/types.h>
28#ifndef __KERNEL__
29#include <stdint.h>
30#include <time.h>
31#endif
32
33typedef enum {
34 VIDEO_FORMAT_4_3, /* Select 4:3 format */
35 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
36 VIDEO_FORMAT_221_1 /* 2.21:1 */
37} video_format_t;
38
39
40typedef enum {
41 VIDEO_SYSTEM_PAL,
42 VIDEO_SYSTEM_NTSC,
43 VIDEO_SYSTEM_PALN,
44 VIDEO_SYSTEM_PALNc,
45 VIDEO_SYSTEM_PALM,
46 VIDEO_SYSTEM_NTSC60,
47 VIDEO_SYSTEM_PAL60,
48 VIDEO_SYSTEM_PALM60
49} video_system_t;
50
51
52typedef enum {
53 VIDEO_PAN_SCAN, /* use pan and scan format */
54 VIDEO_LETTER_BOX, /* use letterbox format */
55 VIDEO_CENTER_CUT_OUT /* use center cut out format */
56} video_displayformat_t;
57
58typedef struct {
59 int w;
60 int h;
61 video_format_t aspect_ratio;
62} video_size_t;
63
64typedef enum {
65 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
66 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
67 comes from the user through the write
68 system call */
69} video_stream_source_t;
70
71
72typedef enum {
73 VIDEO_STOPPED, /* Video is stopped */
74 VIDEO_PLAYING, /* Video is currently playing */
75 VIDEO_FREEZED /* Video is freezed */
76} video_play_state_t;
77
78
79/* Decoder commands */
80#define VIDEO_CMD_PLAY (0)
81#define VIDEO_CMD_STOP (1)
82#define VIDEO_CMD_FREEZE (2)
83#define VIDEO_CMD_CONTINUE (3)
84
85/* Flags for VIDEO_CMD_FREEZE */
86#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
87
88/* Flags for VIDEO_CMD_STOP */
89#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
90#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
91
92/* Play input formats: */
93/* The decoder has no special format requirements */
94#define VIDEO_PLAY_FMT_NONE (0)
95/* The decoder requires full GOPs */
96#define VIDEO_PLAY_FMT_GOP (1)
97
98/* The structure must be zeroed before use by the application
99 This ensures it can be extended safely in the future. */
100struct video_command {
101 __u32 cmd;
102 __u32 flags;
103 union {
104 struct {
105 __u64 pts;
106 } stop;
107
108 struct {
109 /* 0 or 1000 specifies normal speed,
110 1 specifies forward single stepping,
111 -1 specifies backward single stepping,
112 >1: playback at speed/1000 of the normal speed,
113 <-1: reverse playback at (-speed/1000) of the normal speed. */
114 __s32 speed;
115 __u32 format;
116 } play;
117
118 struct {
119 __u32 data[16];
120 } raw;
121 };
122};
123
124/* FIELD_UNKNOWN can be used if the hardware does not know whether
125 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
126 field. */
127#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
128#define VIDEO_VSYNC_FIELD_ODD (1)
129#define VIDEO_VSYNC_FIELD_EVEN (2)
130#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
131
132struct video_event {
133 __s32 type;
134#define VIDEO_EVENT_SIZE_CHANGED 1
135#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
136#define VIDEO_EVENT_DECODER_STOPPED 3
137#define VIDEO_EVENT_VSYNC 4
138 __kernel_time_t timestamp;
139 union {
140 video_size_t size;
141 unsigned int frame_rate; /* in frames per 1000sec */
142 unsigned char vsync_field; /* unknown/odd/even/progressive */
143 } u;
144};
145
146
147struct video_status {
148 int video_blank; /* blank video on freeze? */
149 video_play_state_t play_state; /* current state of playback */
150 video_stream_source_t stream_source; /* current source (demux/memory) */
151 video_format_t video_format; /* current aspect ratio of stream*/
152 video_displayformat_t display_format;/* selected cropping mode */
153};
154
155
156struct video_still_picture {
157 char __user *iFrame; /* pointer to a single iframe in memory */
158 __s32 size;
159};
160
161
162typedef
163struct video_highlight {
164 int active; /* 1=show highlight, 0=hide highlight */
165 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
166 /* 3- 0 Background pixel contrast */
167 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
168 /* 3- 0 Emphasis pixel-1 contrast */
169 __u8 color1; /* 7- 4 Pattern pixel color */
170 /* 3- 0 Background pixel color */
171 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
172 /* 3- 0 Emphasis pixel-1 color */
173 __u32 ypos; /* 23-22 auto action mode */
174 /* 21-12 start y */
175 /* 9- 0 end y */
176 __u32 xpos; /* 23-22 button color number */
177 /* 21-12 start x */
178 /* 9- 0 end x */
179} video_highlight_t;
180
181
182typedef struct video_spu {
183 int active;
184 int stream_id;
185} video_spu_t;
186
187
188typedef struct video_spu_palette { /* SPU Palette information */
189 int length;
190 __u8 __user *palette;
191} video_spu_palette_t;
192
193
194typedef struct video_navi_pack {
195 int length; /* 0 ... 1024 */
196 __u8 data[1024];
197} video_navi_pack_t;
198
199
200typedef __u16 video_attributes_t;
201/* bits: descr. */
202/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
203/* 13-12 TV system (0=525/60, 1=625/50) */
204/* 11-10 Aspect ratio (0=4:3, 3=16:9) */
205/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
206/* 7 line 21-1 data present in GOP (1=yes, 0=no) */
207/* 6 line 21-2 data present in GOP (1=yes, 0=no) */
208/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
209/* 2 source letterboxed (1=yes, 0=no) */
210/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
211
212
213/* bit definitions for capabilities: */
214/* can the hardware decode MPEG1 and/or MPEG2? */
215#define VIDEO_CAP_MPEG1 1
216#define VIDEO_CAP_MPEG2 2
217/* can you send a system and/or program stream to video device?
218 (you still have to open the video and the audio device but only
219 send the stream to the video device) */
220#define VIDEO_CAP_SYS 4
221#define VIDEO_CAP_PROG 8
222/* can the driver also handle SPU, NAVI and CSS encoded data?
223 (CSS API is not present yet) */
224#define VIDEO_CAP_SPU 16
225#define VIDEO_CAP_NAVI 32
226#define VIDEO_CAP_CSS 64
227
228
229#define VIDEO_STOP _IO('o', 21)
230#define VIDEO_PLAY _IO('o', 22)
231#define VIDEO_FREEZE _IO('o', 23)
232#define VIDEO_CONTINUE _IO('o', 24)
233#define VIDEO_SELECT_SOURCE _IO('o', 25)
234#define VIDEO_SET_BLANK _IO('o', 26)
235#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
236#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
237#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
238#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
239#define VIDEO_FAST_FORWARD _IO('o', 31)
240#define VIDEO_SLOWMOTION _IO('o', 32)
241#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
242#define VIDEO_CLEAR_BUFFER _IO('o', 34)
243#define VIDEO_SET_ID _IO('o', 35)
244#define VIDEO_SET_STREAMTYPE _IO('o', 36)
245#define VIDEO_SET_FORMAT _IO('o', 37)
246#define VIDEO_SET_SYSTEM _IO('o', 38)
247#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
248#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
249#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
250#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
251#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
252#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
253#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
254
255/**
256 * VIDEO_GET_PTS
257 *
258 * Read the 33 bit presentation time stamp as defined
259 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
260 *
261 * The PTS should belong to the currently played
262 * frame if possible, but may also be a value close to it
263 * like the PTS of the last decoded frame or the last PTS
264 * extracted by the PES parser.
265 */
266#define VIDEO_GET_PTS _IOR('o', 57, __u64)
267
268/* Read the number of displayed frames since the decoder was started */
269#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
270
271#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
272#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
273
274#endif /* _UAPI_DVBVIDEO_H_ */
diff --git a/include/uapi/linux/elf-fdpic.h b/include/uapi/linux/elf-fdpic.h
index 1065078938f9..3921e33aec8e 100644
--- a/include/uapi/linux/elf-fdpic.h
+++ b/include/uapi/linux/elf-fdpic.h
@@ -9,8 +9,8 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#ifndef _LINUX_ELF_FDPIC_H 12#ifndef _UAPI_LINUX_ELF_FDPIC_H
13#define _LINUX_ELF_FDPIC_H 13#define _UAPI_LINUX_ELF_FDPIC_H
14 14
15#include <linux/elf.h> 15#include <linux/elf.h>
16 16
@@ -31,40 +31,4 @@ struct elf32_fdpic_loadmap {
31 31
32#define ELF32_FDPIC_LOADMAP_VERSION 0x0000 32#define ELF32_FDPIC_LOADMAP_VERSION 0x0000
33 33
34#ifndef __KERNEL__ 34#endif /* _UAPI_LINUX_ELF_FDPIC_H */
35/*
36 * binfmt binary parameters structure
37 */
38struct elf_fdpic_params {
39 struct elfhdr hdr; /* ref copy of ELF header */
40 struct elf_phdr *phdrs; /* ref copy of PT_PHDR table */
41 struct elf32_fdpic_loadmap *loadmap; /* loadmap to be passed to userspace */
42 unsigned long elfhdr_addr; /* mapped ELF header user address */
43 unsigned long ph_addr; /* mapped PT_PHDR user address */
44 unsigned long map_addr; /* mapped loadmap user address */
45 unsigned long entry_addr; /* mapped entry user address */
46 unsigned long stack_size; /* stack size requested (PT_GNU_STACK) */
47 unsigned long dynamic_addr; /* mapped PT_DYNAMIC user address */
48 unsigned long load_addr; /* user address at which to map binary */
49 unsigned long flags;
50#define ELF_FDPIC_FLAG_ARRANGEMENT 0x0000000f /* PT_LOAD arrangement flags */
51#define ELF_FDPIC_FLAG_INDEPENDENT 0x00000000 /* PT_LOADs can be put anywhere */
52#define ELF_FDPIC_FLAG_HONOURVADDR 0x00000001 /* PT_LOAD.vaddr must be honoured */
53#define ELF_FDPIC_FLAG_CONSTDISP 0x00000002 /* PT_LOADs require constant
54 * displacement */
55#define ELF_FDPIC_FLAG_CONTIGUOUS 0x00000003 /* PT_LOADs should be contiguous */
56#define ELF_FDPIC_FLAG_EXEC_STACK 0x00000010 /* T if stack to be executable */
57#define ELF_FDPIC_FLAG_NOEXEC_STACK 0x00000020 /* T if stack not to be executable */
58#define ELF_FDPIC_FLAG_EXECUTABLE 0x00000040 /* T if this object is the executable */
59#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */
60};
61
62#ifdef CONFIG_MMU
63extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
64 struct elf_fdpic_params *interp_params,
65 unsigned long *start_stack,
66 unsigned long *start_brk);
67#endif
68#endif /* __KERNEL__ */
69
70#endif /* _LINUX_ELF_FDPIC_H */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 9fcc880d4be2..780d4c6093eb 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -57,85 +57,6 @@ struct inodes_stat_t {
57 57
58#define NR_FILE 8192 /* this can well be larger on a larger system */ 58#define NR_FILE 8192 /* this can well be larger on a larger system */
59 59
60#define MAY_EXEC 0x00000001
61#define MAY_WRITE 0x00000002
62#define MAY_READ 0x00000004
63#define MAY_APPEND 0x00000008
64#define MAY_ACCESS 0x00000010
65#define MAY_OPEN 0x00000020
66#define MAY_CHDIR 0x00000040
67/* called from RCU mode, don't block */
68#define MAY_NOT_BLOCK 0x00000080
69
70/*
71 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
72 * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
73 */
74
75/* file is open for reading */
76#define FMODE_READ ((__force fmode_t)0x1)
77/* file is open for writing */
78#define FMODE_WRITE ((__force fmode_t)0x2)
79/* file is seekable */
80#define FMODE_LSEEK ((__force fmode_t)0x4)
81/* file can be accessed using pread */
82#define FMODE_PREAD ((__force fmode_t)0x8)
83/* file can be accessed using pwrite */
84#define FMODE_PWRITE ((__force fmode_t)0x10)
85/* File is opened for execution with sys_execve / sys_uselib */
86#define FMODE_EXEC ((__force fmode_t)0x20)
87/* File is opened with O_NDELAY (only set for block devices) */
88#define FMODE_NDELAY ((__force fmode_t)0x40)
89/* File is opened with O_EXCL (only set for block devices) */
90#define FMODE_EXCL ((__force fmode_t)0x80)
91/* File is opened using open(.., 3, ..) and is writeable only for ioctls
92 (specialy hack for floppy.c) */
93#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
94/* 32bit hashes as llseek() offset (for directories) */
95#define FMODE_32BITHASH ((__force fmode_t)0x200)
96/* 64bit hashes as llseek() offset (for directories) */
97#define FMODE_64BITHASH ((__force fmode_t)0x400)
98
99/*
100 * Don't update ctime and mtime.
101 *
102 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
103 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
104 */
105#define FMODE_NOCMTIME ((__force fmode_t)0x800)
106
107/* Expect random access pattern */
108#define FMODE_RANDOM ((__force fmode_t)0x1000)
109
110/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
111#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000)
112
113/* File is opened with O_PATH; almost nothing can be done with it */
114#define FMODE_PATH ((__force fmode_t)0x4000)
115
116/* File was opened by fanotify and shouldn't generate fanotify events */
117#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
118
119/*
120 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
121 * that indicates that they should check the contents of the iovec are
122 * valid, but not check the memory that the iovec elements
123 * points too.
124 */
125#define CHECK_IOVEC_ONLY -1
126
127#define SEL_IN 1
128#define SEL_OUT 2
129#define SEL_EX 4
130
131/* public flags for file_system_type */
132#define FS_REQUIRES_DEV 1
133#define FS_BINARY_MOUNTDATA 2
134#define FS_HAS_SUBTYPE 4
135#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
136#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
137 * during rename() internally.
138 */
139 60
140/* 61/*
141 * These are the fs-independent mount-flags: up to 32 flags are supported 62 * These are the fs-independent mount-flags: up to 32 flags are supported
@@ -181,59 +102,6 @@ struct inodes_stat_t {
181#define MS_MGC_VAL 0xC0ED0000 102#define MS_MGC_VAL 0xC0ED0000
182#define MS_MGC_MSK 0xffff0000 103#define MS_MGC_MSK 0xffff0000
183 104
184/* Inode flags - they have nothing to superblock flags now */
185
186#define S_SYNC 1 /* Writes are synced at once */
187#define S_NOATIME 2 /* Do not update access times */
188#define S_APPEND 4 /* Append-only file */
189#define S_IMMUTABLE 8 /* Immutable file */
190#define S_DEAD 16 /* removed, but still open directory */
191#define S_NOQUOTA 32 /* Inode is not counted to quota */
192#define S_DIRSYNC 64 /* Directory modifications are synchronous */
193#define S_NOCMTIME 128 /* Do not update file c/mtime */
194#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
195#define S_PRIVATE 512 /* Inode is fs-internal */
196#define S_IMA 1024 /* Inode has an associated IMA struct */
197#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
198#define S_NOSEC 4096 /* no suid or xattr security attributes */
199
200/*
201 * Note that nosuid etc flags are inode-specific: setting some file-system
202 * flags just means all the inodes inherit those flags by default. It might be
203 * possible to override it selectively if you really wanted to with some
204 * ioctl() that is not currently implemented.
205 *
206 * Exception: MS_RDONLY is always applied to the entire file system.
207 *
208 * Unfortunately, it is possible to change a filesystems flags with it mounted
209 * with files in use. This means that all of the inodes will not have their
210 * i_flags updated. Hence, i_flags no longer inherit the superblock mount
211 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
212 */
213#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
214
215#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
216#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
217 ((inode)->i_flags & S_SYNC))
218#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
219 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
220#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
221#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
222#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
223
224#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
225#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
226#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
227#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
228
229#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
230#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
231#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
232#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
233#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
234#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
235#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
236
237/* the read-only stuff doesn't really belong here, but any other place is 105/* the read-only stuff doesn't really belong here, but any other place is
238 probably as bad and I don't want to create yet another include file. */ 106 probably as bad and I don't want to create yet another include file. */
239 107
diff --git a/include/uapi/linux/hsi/Kbuild b/include/uapi/linux/hsi/Kbuild
index aafaa5aa54d4..30ab3cd3b8a5 100644
--- a/include/uapi/linux/hsi/Kbuild
+++ b/include/uapi/linux/hsi/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += hsi_char.h
diff --git a/include/linux/hsi/hsi_char.h b/include/uapi/linux/hsi/hsi_char.h
index 76160b4f455d..76160b4f455d 100644
--- a/include/linux/hsi/hsi_char.h
+++ b/include/uapi/linux/hsi/hsi_char.h
diff --git a/include/uapi/linux/irqnr.h b/include/uapi/linux/irqnr.h
index e69de29bb2d1..ae5704fa77ad 100644
--- a/include/uapi/linux/irqnr.h
+++ b/include/uapi/linux/irqnr.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here anymore, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild
index aafaa5aa54d4..6cb4ea826834 100644
--- a/include/uapi/linux/usb/Kbuild
+++ b/include/uapi/linux/usb/Kbuild
@@ -1 +1,11 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += audio.h
3header-y += cdc.h
4header-y += ch11.h
5header-y += ch9.h
6header-y += functionfs.h
7header-y += g_printer.h
8header-y += gadgetfs.h
9header-y += midi.h
10header-y += tmc.h
11header-y += video.h
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
new file mode 100644
index 000000000000..ac90037894d9
--- /dev/null
+++ b/include/uapi/linux/usb/audio.h
@@ -0,0 +1,545 @@
1/*
2 * <linux/usb/audio.h> -- USB Audio definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for Audio Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
19 */
20
21#ifndef _UAPI__LINUX_USB_AUDIO_H
22#define _UAPI__LINUX_USB_AUDIO_H
23
24#include <linux/types.h>
25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
30/* A.2 Audio Interface Subclass Codes */
31#define USB_SUBCLASS_AUDIOCONTROL 0x01
32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
33#define USB_SUBCLASS_MIDISTREAMING 0x03
34
35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
36#define UAC_HEADER 0x01
37#define UAC_INPUT_TERMINAL 0x02
38#define UAC_OUTPUT_TERMINAL 0x03
39#define UAC_MIXER_UNIT 0x04
40#define UAC_SELECTOR_UNIT 0x05
41#define UAC_FEATURE_UNIT 0x06
42#define UAC1_PROCESSING_UNIT 0x07
43#define UAC1_EXTENSION_UNIT 0x08
44
45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
46#define UAC_AS_GENERAL 0x01
47#define UAC_FORMAT_TYPE 0x02
48#define UAC_FORMAT_SPECIFIC 0x03
49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
60#define UAC_EP_GENERAL 0x01
61
62/* A.9 Audio Class-Specific Request Codes */
63#define UAC_SET_ 0x00
64#define UAC_GET_ 0x80
65
66#define UAC__CUR 0x1
67#define UAC__MIN 0x2
68#define UAC__MAX 0x3
69#define UAC__RES 0x4
70#define UAC__MEM 0x5
71
72#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
73#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
74#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
75#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
76#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
77#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
78#define UAC_SET_RES (UAC_SET_ | UAC__RES)
79#define UAC_GET_RES (UAC_GET_ | UAC__RES)
80#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
81#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
82
83#define UAC_GET_STAT 0xff
84
85/* A.10 Control Selector Codes */
86
87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
138
139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
140#define UAC_MS_HEADER 0x01
141#define UAC_MIDI_IN_JACK 0x02
142#define UAC_MIDI_OUT_JACK 0x03
143
144/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
145#define UAC_MS_GENERAL 0x01
146
147/* Terminals - 2.1 USB Terminal Types */
148#define UAC_TERMINAL_UNDEFINED 0x100
149#define UAC_TERMINAL_STREAMING 0x101
150#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
151
152/* Terminal Control Selectors */
153/* 4.3.2 Class-Specific AC Interface Descriptor */
154struct uac1_ac_header_descriptor {
155 __u8 bLength; /* 8 + n */
156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
158 __le16 bcdADC; /* 0x0100 */
159 __le16 wTotalLength; /* includes Unit and Terminal desc. */
160 __u8 bInCollection; /* n */
161 __u8 baInterfaceNr[]; /* [n] */
162} __attribute__ ((packed));
163
164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
165
166/* As above, but more useful for defining your own descriptors: */
167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168struct uac1_ac_header_descriptor_##n { \
169 __u8 bLength; \
170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \
172 __le16 bcdADC; \
173 __le16 wTotalLength; \
174 __u8 bInCollection; \
175 __u8 baInterfaceNr[n]; \
176} __attribute__ ((packed))
177
178/* 4.3.2.1 Input Terminal Descriptor */
179struct uac_input_terminal_descriptor {
180 __u8 bLength; /* in bytes: 12 */
181 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
182 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
183 __u8 bTerminalID; /* Constant uniquely terminal ID */
184 __le16 wTerminalType; /* USB Audio Terminal Types */
185 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
186 __u8 bNrChannels; /* Number of logical output channels */
187 __le16 wChannelConfig;
188 __u8 iChannelNames;
189 __u8 iTerminal;
190} __attribute__ ((packed));
191
192#define UAC_DT_INPUT_TERMINAL_SIZE 12
193
194/* Terminals - 2.2 Input Terminal Types */
195#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
196#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
197#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
198#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
199#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
200#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
201#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
202
203/* Terminals - control selectors */
204
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206
207/* 4.3.2.2 Output Terminal Descriptor */
208struct uac1_output_terminal_descriptor {
209 __u8 bLength; /* in bytes: 9 */
210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
212 __u8 bTerminalID; /* Constant uniquely terminal ID */
213 __le16 wTerminalType; /* USB Audio Terminal Types */
214 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
215 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
216 __u8 iTerminal;
217} __attribute__ ((packed));
218
219#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
220
221/* Terminals - 2.3 Output Terminal Types */
222#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
223#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
224#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
225#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
226#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
227#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
228#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
229#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
230
231/* Set bControlSize = 2 as default setting */
232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
233
234/* As above, but more useful for defining your own descriptors: */
235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
236struct uac_feature_unit_descriptor_##ch { \
237 __u8 bLength; \
238 __u8 bDescriptorType; \
239 __u8 bDescriptorSubtype; \
240 __u8 bUnitID; \
241 __u8 bSourceID; \
242 __u8 bControlSize; \
243 __le16 bmaControls[ch + 1]; \
244 __u8 iFeature; \
245} __attribute__ ((packed))
246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
397/* 4.5.2 Class-Specific AS Interface Descriptor */
398struct uac1_as_header_descriptor {
399 __u8 bLength; /* in bytes: 7 */
400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
401 __u8 bDescriptorSubtype; /* AS_GENERAL */
402 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
403 __u8 bDelay; /* Delay introduced by the data path */
404 __le16 wFormatTag; /* The Audio Data Format */
405} __attribute__ ((packed));
406
407#define UAC_DT_AS_HEADER_SIZE 7
408
409/* Formats - A.1.1 Audio Data Format Type I Codes */
410#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
411#define UAC_FORMAT_TYPE_I_PCM 0x1
412#define UAC_FORMAT_TYPE_I_PCM8 0x2
413#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
414#define UAC_FORMAT_TYPE_I_ALAW 0x4
415#define UAC_FORMAT_TYPE_I_MULAW 0x5
416
417struct uac_format_type_i_continuous_descriptor {
418 __u8 bLength; /* in bytes: 8 + (ns * 3) */
419 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
420 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
421 __u8 bFormatType; /* FORMAT_TYPE_1 */
422 __u8 bNrChannels; /* physical channels in the stream */
423 __u8 bSubframeSize; /* */
424 __u8 bBitResolution;
425 __u8 bSamFreqType;
426 __u8 tLowerSamFreq[3];
427 __u8 tUpperSamFreq[3];
428} __attribute__ ((packed));
429
430#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
431
432struct uac_format_type_i_discrete_descriptor {
433 __u8 bLength; /* in bytes: 8 + (ns * 3) */
434 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
435 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
436 __u8 bFormatType; /* FORMAT_TYPE_1 */
437 __u8 bNrChannels; /* physical channels in the stream */
438 __u8 bSubframeSize; /* */
439 __u8 bBitResolution;
440 __u8 bSamFreqType;
441 __u8 tSamFreq[][3];
442} __attribute__ ((packed));
443
444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
445struct uac_format_type_i_discrete_descriptor_##n { \
446 __u8 bLength; \
447 __u8 bDescriptorType; \
448 __u8 bDescriptorSubtype; \
449 __u8 bFormatType; \
450 __u8 bNrChannels; \
451 __u8 bSubframeSize; \
452 __u8 bBitResolution; \
453 __u8 bSamFreqType; \
454 __u8 tSamFreq[n][3]; \
455} __attribute__ ((packed))
456
457#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
458
459struct uac_format_type_i_ext_descriptor {
460 __u8 bLength;
461 __u8 bDescriptorType;
462 __u8 bDescriptorSubtype;
463 __u8 bFormatType;
464 __u8 bSubslotSize;
465 __u8 bBitResolution;
466 __u8 bHeaderLength;
467 __u8 bControlSize;
468 __u8 bSideBandProtocol;
469} __attribute__((packed));
470
471/* Formats - Audio Data Format Type I Codes */
472
473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
474#define UAC_FORMAT_TYPE_II_AC3 0x1002
475
476struct uac_format_type_ii_discrete_descriptor {
477 __u8 bLength;
478 __u8 bDescriptorType;
479 __u8 bDescriptorSubtype;
480 __u8 bFormatType;
481 __le16 wMaxBitRate;
482 __le16 wSamplesPerFrame;
483 __u8 bSamFreqType;
484 __u8 tSamFreq[][3];
485} __attribute__((packed));
486
487struct uac_format_type_ii_ext_descriptor {
488 __u8 bLength;
489 __u8 bDescriptorType;
490 __u8 bDescriptorSubtype;
491 __u8 bFormatType;
492 __u16 wMaxBitRate;
493 __u16 wSamplesPerFrame;
494 __u8 bHeaderLength;
495 __u8 bSideBandProtocol;
496} __attribute__((packed));
497
498/* type III */
499#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
505
506/* Formats - A.2 Format Type Codes */
507#define UAC_FORMAT_TYPE_UNDEFINED 0x0
508#define UAC_FORMAT_TYPE_I 0x1
509#define UAC_FORMAT_TYPE_II 0x2
510#define UAC_FORMAT_TYPE_III 0x3
511#define UAC_EXT_FORMAT_TYPE_I 0x81
512#define UAC_EXT_FORMAT_TYPE_II 0x82
513#define UAC_EXT_FORMAT_TYPE_III 0x83
514
515struct uac_iso_endpoint_descriptor {
516 __u8 bLength; /* in bytes: 7 */
517 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
518 __u8 bDescriptorSubtype; /* EP_GENERAL */
519 __u8 bmAttributes;
520 __u8 bLockDelayUnits;
521 __le16 wLockDelay;
522} __attribute__((packed));
523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
524
525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
528
529/* status word format (3.7.1.1) */
530
531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
535
536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
538
539struct uac1_status_word {
540 __u8 bStatusType;
541 __u8 bOriginator;
542} __attribute__((packed));
543
544
545#endif /* _UAPI__LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index 81a927930bfd..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
diff --git a/include/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h
index 7692dc69ccf7..7692dc69ccf7 100644
--- a/include/linux/usb/ch11.h
+++ b/include/uapi/linux/usb/ch11.h
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
new file mode 100644
index 000000000000..50598472dc41
--- /dev/null
+++ b/include/uapi/linux/usb/ch9.h
@@ -0,0 +1,993 @@
1/*
2 * This file holds USB constants and structures that are needed for
3 * USB device APIs. These are used by the USB device model, which is
4 * defined in chapter 9 of the USB 2.0 specification and in the
5 * Wireless USB 1.0 (spread around). Linux has several APIs in C that
6 * need these:
7 *
8 * - the master/host side Linux-USB kernel driver API;
9 * - the "usbfs" user space API; and
10 * - the Linux "gadget" slave/device/peripheral side driver API.
11 *
12 * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
13 * act either as a USB master/host or as a USB slave/device. That means
14 * the master and slave side APIs benefit from working well together.
15 *
16 * There's also "Wireless USB", using low power short range radios for
17 * peripheral interconnection but otherwise building on the USB framework.
18 *
19 * Note all descriptors are declared '__attribute__((packed))' so that:
20 *
21 * [a] they never get padded, either internally (USB spec writers
22 * probably handled that) or externally;
23 *
24 * [b] so that accessing bigger-than-a-bytes fields will never
25 * generate bus errors on any platform, even when the location of
26 * its descriptor inside a bundle isn't "naturally aligned", and
27 *
28 * [c] for consistency, removing all doubt even when it appears to
29 * someone that the two other points are non-issues for that
30 * particular descriptor type.
31 */
32
33#ifndef _UAPI__LINUX_USB_CH9_H
34#define _UAPI__LINUX_USB_CH9_H
35
36#include <linux/types.h> /* __u8 etc */
37#include <asm/byteorder.h> /* le16_to_cpu */
38
39/*-------------------------------------------------------------------------*/
40
41/* CONTROL REQUEST SUPPORT */
42
43/*
44 * USB directions
45 *
46 * This bit flag is used in endpoint descriptors' bEndpointAddress field.
47 * It's also one of three fields in control requests bRequestType.
48 */
49#define USB_DIR_OUT 0 /* to device */
50#define USB_DIR_IN 0x80 /* to host */
51
52/*
53 * USB types, the second of three bRequestType fields
54 */
55#define USB_TYPE_MASK (0x03 << 5)
56#define USB_TYPE_STANDARD (0x00 << 5)
57#define USB_TYPE_CLASS (0x01 << 5)
58#define USB_TYPE_VENDOR (0x02 << 5)
59#define USB_TYPE_RESERVED (0x03 << 5)
60
61/*
62 * USB recipients, the third of three bRequestType fields
63 */
64#define USB_RECIP_MASK 0x1f
65#define USB_RECIP_DEVICE 0x00
66#define USB_RECIP_INTERFACE 0x01
67#define USB_RECIP_ENDPOINT 0x02
68#define USB_RECIP_OTHER 0x03
69/* From Wireless USB 1.0 */
70#define USB_RECIP_PORT 0x04
71#define USB_RECIP_RPIPE 0x05
72
73/*
74 * Standard requests, for the bRequest field of a SETUP packet.
75 *
76 * These are qualified by the bRequestType field, so that for example
77 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
78 * by a GET_STATUS request.
79 */
80#define USB_REQ_GET_STATUS 0x00
81#define USB_REQ_CLEAR_FEATURE 0x01
82#define USB_REQ_SET_FEATURE 0x03
83#define USB_REQ_SET_ADDRESS 0x05
84#define USB_REQ_GET_DESCRIPTOR 0x06
85#define USB_REQ_SET_DESCRIPTOR 0x07
86#define USB_REQ_GET_CONFIGURATION 0x08
87#define USB_REQ_SET_CONFIGURATION 0x09
88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
93
94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
95#define USB_REQ_GET_ENCRYPTION 0x0E
96#define USB_REQ_RPIPE_ABORT 0x0E
97#define USB_REQ_SET_HANDSHAKE 0x0F
98#define USB_REQ_RPIPE_RESET 0x0F
99#define USB_REQ_GET_HANDSHAKE 0x10
100#define USB_REQ_SET_CONNECTION 0x11
101#define USB_REQ_SET_SECURITY_DATA 0x12
102#define USB_REQ_GET_SECURITY_DATA 0x13
103#define USB_REQ_SET_WUSB_DATA 0x14
104#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
105#define USB_REQ_LOOPBACK_DATA_READ 0x16
106#define USB_REQ_SET_INTERFACE_DS 0x17
107
108/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
109 * used by hubs to put ports into a new L1 suspend state, except that it
110 * forgot to define its number ...
111 */
112
113/*
114 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
115 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
116 * are at most sixteen features of each type.) Hubs may also support a
117 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
118 */
119#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
120#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
121#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
122#define USB_DEVICE_BATTERY 2 /* (wireless) */
123#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
124#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
125#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
126#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
127#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
128
129/*
130 * Test Mode Selectors
131 * See USB 2.0 spec Table 9-7
132 */
133#define TEST_J 1
134#define TEST_K 2
135#define TEST_SE0_NAK 3
136#define TEST_PACKET 4
137#define TEST_FORCE_EN 5
138
139/*
140 * New Feature Selectors as added by USB 3.0
141 * See USB 3.0 spec Table 9-6
142 */
143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
145#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
146#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
147
148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
149/*
150 * Suspend Options, Table 9-7 USB 3.0 spec
151 */
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
154
155#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
156
157/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
158#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
159#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
160#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
161
162/**
163 * struct usb_ctrlrequest - SETUP data for a USB device control request
164 * @bRequestType: matches the USB bmRequestType field
165 * @bRequest: matches the USB bRequest field
166 * @wValue: matches the USB wValue field (le16 byte order)
167 * @wIndex: matches the USB wIndex field (le16 byte order)
168 * @wLength: matches the USB wLength field (le16 byte order)
169 *
170 * This structure is used to send control requests to a USB device. It matches
171 * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
172 * USB spec for a fuller description of the different fields, and what they are
173 * used for.
174 *
175 * Note that the driver for any interface can issue control requests.
176 * For most devices, interfaces don't coordinate with each other, so
177 * such requests may be made at any time.
178 */
179struct usb_ctrlrequest {
180 __u8 bRequestType;
181 __u8 bRequest;
182 __le16 wValue;
183 __le16 wIndex;
184 __le16 wLength;
185} __attribute__ ((packed));
186
187/*-------------------------------------------------------------------------*/
188
189/*
190 * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
191 * (rarely) accepted by SET_DESCRIPTOR.
192 *
193 * Note that all multi-byte values here are encoded in little endian
194 * byte order "on the wire". Within the kernel and when exposed
195 * through the Linux-USB APIs, they are not converted to cpu byte
196 * order; it is the responsibility of the client code to do this.
197 * The single exception is when device and configuration descriptors (but
198 * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
199 * in this case the fields are converted to host endianness by the kernel.
200 */
201
202/*
203 * Descriptor types ... USB 2.0 spec table 9.5
204 */
205#define USB_DT_DEVICE 0x01
206#define USB_DT_CONFIG 0x02
207#define USB_DT_STRING 0x03
208#define USB_DT_INTERFACE 0x04
209#define USB_DT_ENDPOINT 0x05
210#define USB_DT_DEVICE_QUALIFIER 0x06
211#define USB_DT_OTHER_SPEED_CONFIG 0x07
212#define USB_DT_INTERFACE_POWER 0x08
213/* these are from a minor usb 2.0 revision (ECN) */
214#define USB_DT_OTG 0x09
215#define USB_DT_DEBUG 0x0a
216#define USB_DT_INTERFACE_ASSOCIATION 0x0b
217/* these are from the Wireless USB spec */
218#define USB_DT_SECURITY 0x0c
219#define USB_DT_KEY 0x0d
220#define USB_DT_ENCRYPTION_TYPE 0x0e
221#define USB_DT_BOS 0x0f
222#define USB_DT_DEVICE_CAPABILITY 0x10
223#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
224#define USB_DT_WIRE_ADAPTER 0x21
225#define USB_DT_RPIPE 0x22
226#define USB_DT_CS_RADIO_CONTROL 0x23
227/* From the T10 UAS specification */
228#define USB_DT_PIPE_USAGE 0x24
229/* From the USB 3.0 spec */
230#define USB_DT_SS_ENDPOINT_COMP 0x30
231
232/* Conventional codes for class-specific descriptors. The convention is
233 * defined in the USB "Common Class" Spec (3.11). Individual class specs
234 * are authoritative for their usage, not the "common class" writeup.
235 */
236#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
237#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
238#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
239#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
240#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
241
242/* All standard descriptors have these 2 fields at the beginning */
243struct usb_descriptor_header {
244 __u8 bLength;
245 __u8 bDescriptorType;
246} __attribute__ ((packed));
247
248
249/*-------------------------------------------------------------------------*/
250
251/* USB_DT_DEVICE: Device descriptor */
252struct usb_device_descriptor {
253 __u8 bLength;
254 __u8 bDescriptorType;
255
256 __le16 bcdUSB;
257 __u8 bDeviceClass;
258 __u8 bDeviceSubClass;
259 __u8 bDeviceProtocol;
260 __u8 bMaxPacketSize0;
261 __le16 idVendor;
262 __le16 idProduct;
263 __le16 bcdDevice;
264 __u8 iManufacturer;
265 __u8 iProduct;
266 __u8 iSerialNumber;
267 __u8 bNumConfigurations;
268} __attribute__ ((packed));
269
270#define USB_DT_DEVICE_SIZE 18
271
272
273/*
274 * Device and/or Interface Class codes
275 * as found in bDeviceClass or bInterfaceClass
276 * and defined by www.usb.org documents
277 */
278#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
279#define USB_CLASS_AUDIO 1
280#define USB_CLASS_COMM 2
281#define USB_CLASS_HID 3
282#define USB_CLASS_PHYSICAL 5
283#define USB_CLASS_STILL_IMAGE 6
284#define USB_CLASS_PRINTER 7
285#define USB_CLASS_MASS_STORAGE 8
286#define USB_CLASS_HUB 9
287#define USB_CLASS_CDC_DATA 0x0a
288#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
289#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
290#define USB_CLASS_VIDEO 0x0e
291#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
292#define USB_CLASS_MISC 0xef
293#define USB_CLASS_APP_SPEC 0xfe
294#define USB_CLASS_VENDOR_SPEC 0xff
295
296#define USB_SUBCLASS_VENDOR_SPEC 0xff
297
298/*-------------------------------------------------------------------------*/
299
300/* USB_DT_CONFIG: Configuration descriptor information.
301 *
302 * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
303 * descriptor type is different. Highspeed-capable devices can look
304 * different depending on what speed they're currently running. Only
305 * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
306 * descriptors.
307 */
308struct usb_config_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311
312 __le16 wTotalLength;
313 __u8 bNumInterfaces;
314 __u8 bConfigurationValue;
315 __u8 iConfiguration;
316 __u8 bmAttributes;
317 __u8 bMaxPower;
318} __attribute__ ((packed));
319
320#define USB_DT_CONFIG_SIZE 9
321
322/* from config descriptor bmAttributes */
323#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
324#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
325#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
326#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
327
328/*-------------------------------------------------------------------------*/
329
330/* USB_DT_STRING: String descriptor */
331struct usb_string_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334
335 __le16 wData[1]; /* UTF-16LE encoded */
336} __attribute__ ((packed));
337
338/* note that "string" zero is special, it holds language codes that
339 * the device supports, not Unicode characters.
340 */
341
342/*-------------------------------------------------------------------------*/
343
344/* USB_DT_INTERFACE: Interface descriptor */
345struct usb_interface_descriptor {
346 __u8 bLength;
347 __u8 bDescriptorType;
348
349 __u8 bInterfaceNumber;
350 __u8 bAlternateSetting;
351 __u8 bNumEndpoints;
352 __u8 bInterfaceClass;
353 __u8 bInterfaceSubClass;
354 __u8 bInterfaceProtocol;
355 __u8 iInterface;
356} __attribute__ ((packed));
357
358#define USB_DT_INTERFACE_SIZE 9
359
360/*-------------------------------------------------------------------------*/
361
362/* USB_DT_ENDPOINT: Endpoint descriptor */
363struct usb_endpoint_descriptor {
364 __u8 bLength;
365 __u8 bDescriptorType;
366
367 __u8 bEndpointAddress;
368 __u8 bmAttributes;
369 __le16 wMaxPacketSize;
370 __u8 bInterval;
371
372 /* NOTE: these two are _only_ in audio endpoints. */
373 /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
374 __u8 bRefresh;
375 __u8 bSynchAddress;
376} __attribute__ ((packed));
377
378#define USB_DT_ENDPOINT_SIZE 7
379#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
380
381
382/*
383 * Endpoints
384 */
385#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
386#define USB_ENDPOINT_DIR_MASK 0x80
387
388#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
389#define USB_ENDPOINT_XFER_CONTROL 0
390#define USB_ENDPOINT_XFER_ISOC 1
391#define USB_ENDPOINT_XFER_BULK 2
392#define USB_ENDPOINT_XFER_INT 3
393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
400#define USB_ENDPOINT_SYNCTYPE 0x0c
401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
403#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
404#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
405
406#define USB_ENDPOINT_USAGE_MASK 0x30
407#define USB_ENDPOINT_USAGE_DATA 0x00
408#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
409#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
410
411/*-------------------------------------------------------------------------*/
412
413/**
414 * usb_endpoint_num - get the endpoint's number
415 * @epd: endpoint to be checked
416 *
417 * Returns @epd's number: 0 to 15.
418 */
419static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
420{
421 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
422}
423
424/**
425 * usb_endpoint_type - get the endpoint's transfer type
426 * @epd: endpoint to be checked
427 *
428 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
429 * to @epd's transfer type.
430 */
431static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
432{
433 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
434}
435
436/**
437 * usb_endpoint_dir_in - check if the endpoint has IN direction
438 * @epd: endpoint to be checked
439 *
440 * Returns true if the endpoint is of type IN, otherwise it returns false.
441 */
442static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
443{
444 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
445}
446
447/**
448 * usb_endpoint_dir_out - check if the endpoint has OUT direction
449 * @epd: endpoint to be checked
450 *
451 * Returns true if the endpoint is of type OUT, otherwise it returns false.
452 */
453static inline int usb_endpoint_dir_out(
454 const struct usb_endpoint_descriptor *epd)
455{
456 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
457}
458
459/**
460 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
461 * @epd: endpoint to be checked
462 *
463 * Returns true if the endpoint is of type bulk, otherwise it returns false.
464 */
465static inline int usb_endpoint_xfer_bulk(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
469 USB_ENDPOINT_XFER_BULK);
470}
471
472/**
473 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
474 * @epd: endpoint to be checked
475 *
476 * Returns true if the endpoint is of type control, otherwise it returns false.
477 */
478static inline int usb_endpoint_xfer_control(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
482 USB_ENDPOINT_XFER_CONTROL);
483}
484
485/**
486 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
487 * @epd: endpoint to be checked
488 *
489 * Returns true if the endpoint is of type interrupt, otherwise it returns
490 * false.
491 */
492static inline int usb_endpoint_xfer_int(
493 const struct usb_endpoint_descriptor *epd)
494{
495 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
496 USB_ENDPOINT_XFER_INT);
497}
498
499/**
500 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
501 * @epd: endpoint to be checked
502 *
503 * Returns true if the endpoint is of type isochronous, otherwise it returns
504 * false.
505 */
506static inline int usb_endpoint_xfer_isoc(
507 const struct usb_endpoint_descriptor *epd)
508{
509 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
510 USB_ENDPOINT_XFER_ISOC);
511}
512
513/**
514 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
515 * @epd: endpoint to be checked
516 *
517 * Returns true if the endpoint has bulk transfer type and IN direction,
518 * otherwise it returns false.
519 */
520static inline int usb_endpoint_is_bulk_in(
521 const struct usb_endpoint_descriptor *epd)
522{
523 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
524}
525
526/**
527 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
528 * @epd: endpoint to be checked
529 *
530 * Returns true if the endpoint has bulk transfer type and OUT direction,
531 * otherwise it returns false.
532 */
533static inline int usb_endpoint_is_bulk_out(
534 const struct usb_endpoint_descriptor *epd)
535{
536 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
537}
538
539/**
540 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
541 * @epd: endpoint to be checked
542 *
543 * Returns true if the endpoint has interrupt transfer type and IN direction,
544 * otherwise it returns false.
545 */
546static inline int usb_endpoint_is_int_in(
547 const struct usb_endpoint_descriptor *epd)
548{
549 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
550}
551
552/**
553 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
554 * @epd: endpoint to be checked
555 *
556 * Returns true if the endpoint has interrupt transfer type and OUT direction,
557 * otherwise it returns false.
558 */
559static inline int usb_endpoint_is_int_out(
560 const struct usb_endpoint_descriptor *epd)
561{
562 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
563}
564
565/**
566 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
567 * @epd: endpoint to be checked
568 *
569 * Returns true if the endpoint has isochronous transfer type and IN direction,
570 * otherwise it returns false.
571 */
572static inline int usb_endpoint_is_isoc_in(
573 const struct usb_endpoint_descriptor *epd)
574{
575 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
576}
577
578/**
579 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
580 * @epd: endpoint to be checked
581 *
582 * Returns true if the endpoint has isochronous transfer type and OUT direction,
583 * otherwise it returns false.
584 */
585static inline int usb_endpoint_is_isoc_out(
586 const struct usb_endpoint_descriptor *epd)
587{
588 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
589}
590
591/**
592 * usb_endpoint_maxp - get endpoint's max packet size
593 * @epd: endpoint to be checked
594 *
595 * Returns @epd's max packet
596 */
597static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
598{
599 return __le16_to_cpu(epd->wMaxPacketSize);
600}
601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
608/*-------------------------------------------------------------------------*/
609
610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
611struct usb_ss_ep_comp_descriptor {
612 __u8 bLength;
613 __u8 bDescriptorType;
614
615 __u8 bMaxBurst;
616 __u8 bmAttributes;
617 __le16 wBytesPerInterval;
618} __attribute__ ((packed));
619
620#define USB_DT_SS_EP_COMP_SIZE 6
621
622/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
623static inline int
624usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
625{
626 int max_streams;
627
628 if (!comp)
629 return 0;
630
631 max_streams = comp->bmAttributes & 0x1f;
632
633 if (!max_streams)
634 return 0;
635
636 max_streams = 1 << max_streams;
637
638 return max_streams;
639}
640
641/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
642#define USB_SS_MULT(p) (1 + ((p) & 0x3))
643
644/*-------------------------------------------------------------------------*/
645
646/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
647struct usb_qualifier_descriptor {
648 __u8 bLength;
649 __u8 bDescriptorType;
650
651 __le16 bcdUSB;
652 __u8 bDeviceClass;
653 __u8 bDeviceSubClass;
654 __u8 bDeviceProtocol;
655 __u8 bMaxPacketSize0;
656 __u8 bNumConfigurations;
657 __u8 bRESERVED;
658} __attribute__ ((packed));
659
660
661/*-------------------------------------------------------------------------*/
662
663/* USB_DT_OTG (from OTG 1.0a supplement) */
664struct usb_otg_descriptor {
665 __u8 bLength;
666 __u8 bDescriptorType;
667
668 __u8 bmAttributes; /* support for HNP, SRP, etc */
669} __attribute__ ((packed));
670
671/* from usb_otg_descriptor.bmAttributes */
672#define USB_OTG_SRP (1 << 0)
673#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
674
675/*-------------------------------------------------------------------------*/
676
677/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
678struct usb_debug_descriptor {
679 __u8 bLength;
680 __u8 bDescriptorType;
681
682 /* bulk endpoints with 8 byte maxpacket */
683 __u8 bDebugInEndpoint;
684 __u8 bDebugOutEndpoint;
685} __attribute__((packed));
686
687/*-------------------------------------------------------------------------*/
688
689/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
690struct usb_interface_assoc_descriptor {
691 __u8 bLength;
692 __u8 bDescriptorType;
693
694 __u8 bFirstInterface;
695 __u8 bInterfaceCount;
696 __u8 bFunctionClass;
697 __u8 bFunctionSubClass;
698 __u8 bFunctionProtocol;
699 __u8 iFunction;
700} __attribute__ ((packed));
701
702
703/*-------------------------------------------------------------------------*/
704
705/* USB_DT_SECURITY: group of wireless security descriptors, including
706 * encryption types available for setting up a CC/association.
707 */
708struct usb_security_descriptor {
709 __u8 bLength;
710 __u8 bDescriptorType;
711
712 __le16 wTotalLength;
713 __u8 bNumEncryptionTypes;
714} __attribute__((packed));
715
716/*-------------------------------------------------------------------------*/
717
718/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
719 * may be retrieved.
720 */
721struct usb_key_descriptor {
722 __u8 bLength;
723 __u8 bDescriptorType;
724
725 __u8 tTKID[3];
726 __u8 bReserved;
727 __u8 bKeyData[0];
728} __attribute__((packed));
729
730/*-------------------------------------------------------------------------*/
731
732/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
733struct usb_encryption_descriptor {
734 __u8 bLength;
735 __u8 bDescriptorType;
736
737 __u8 bEncryptionType;
738#define USB_ENC_TYPE_UNSECURE 0
739#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
740#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
741#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
742 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
743 __u8 bAuthKeyIndex;
744} __attribute__((packed));
745
746
747/*-------------------------------------------------------------------------*/
748
749/* USB_DT_BOS: group of device-level capabilities */
750struct usb_bos_descriptor {
751 __u8 bLength;
752 __u8 bDescriptorType;
753
754 __le16 wTotalLength;
755 __u8 bNumDeviceCaps;
756} __attribute__((packed));
757
758#define USB_DT_BOS_SIZE 5
759/*-------------------------------------------------------------------------*/
760
761/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
762struct usb_dev_cap_header {
763 __u8 bLength;
764 __u8 bDescriptorType;
765 __u8 bDevCapabilityType;
766} __attribute__((packed));
767
768#define USB_CAP_TYPE_WIRELESS_USB 1
769
770struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
771 __u8 bLength;
772 __u8 bDescriptorType;
773 __u8 bDevCapabilityType;
774
775 __u8 bmAttributes;
776#define USB_WIRELESS_P2P_DRD (1 << 1)
777#define USB_WIRELESS_BEACON_MASK (3 << 2)
778#define USB_WIRELESS_BEACON_SELF (1 << 2)
779#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
780#define USB_WIRELESS_BEACON_NONE (3 << 2)
781 __le16 wPHYRates; /* bit rates, Mbps */
782#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
783#define USB_WIRELESS_PHY_80 (1 << 1)
784#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
785#define USB_WIRELESS_PHY_160 (1 << 3)
786#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
787#define USB_WIRELESS_PHY_320 (1 << 5)
788#define USB_WIRELESS_PHY_400 (1 << 6)
789#define USB_WIRELESS_PHY_480 (1 << 7)
790 __u8 bmTFITXPowerInfo; /* TFI power levels */
791 __u8 bmFFITXPowerInfo; /* FFI power levels */
792 __le16 bmBandGroup;
793 __u8 bReserved;
794} __attribute__((packed));
795
796/* USB 2.0 Extension descriptor */
797#define USB_CAP_TYPE_EXT 2
798
799struct usb_ext_cap_descriptor { /* Link Power Management */
800 __u8 bLength;
801 __u8 bDescriptorType;
802 __u8 bDevCapabilityType;
803 __le32 bmAttributes;
804#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
805#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
806#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
807#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
808#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
809#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
810} __attribute__((packed));
811
812#define USB_DT_USB_EXT_CAP_SIZE 7
813
814/*
815 * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
816 * specific device level capabilities
817 */
818#define USB_SS_CAP_TYPE 3
819struct usb_ss_cap_descriptor { /* Link Power Management */
820 __u8 bLength;
821 __u8 bDescriptorType;
822 __u8 bDevCapabilityType;
823 __u8 bmAttributes;
824#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
825 __le16 wSpeedSupported;
826#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
827#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
828#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
829#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
830 __u8 bFunctionalitySupport;
831 __u8 bU1devExitLat;
832 __le16 bU2DevExitLat;
833} __attribute__((packed));
834
835#define USB_DT_USB_SS_CAP_SIZE 10
836
837/*
838 * Container ID Capability descriptor: Defines the instance unique ID used to
839 * identify the instance across all operating modes
840 */
841#define CONTAINER_ID_TYPE 4
842struct usb_ss_container_id_descriptor {
843 __u8 bLength;
844 __u8 bDescriptorType;
845 __u8 bDevCapabilityType;
846 __u8 bReserved;
847 __u8 ContainerID[16]; /* 128-bit number */
848} __attribute__((packed));
849
850#define USB_DT_USB_SS_CONTN_ID_SIZE 20
851/*-------------------------------------------------------------------------*/
852
853/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
854 * each endpoint descriptor for a wireless device
855 */
856struct usb_wireless_ep_comp_descriptor {
857 __u8 bLength;
858 __u8 bDescriptorType;
859
860 __u8 bMaxBurst;
861 __u8 bMaxSequence;
862 __le16 wMaxStreamDelay;
863 __le16 wOverTheAirPacketSize;
864 __u8 bOverTheAirInterval;
865 __u8 bmCompAttributes;
866#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
867#define USB_ENDPOINT_SWITCH_NO 0
868#define USB_ENDPOINT_SWITCH_SWITCH 1
869#define USB_ENDPOINT_SWITCH_SCALE 2
870} __attribute__((packed));
871
872/*-------------------------------------------------------------------------*/
873
874/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
875 * host and a device for connection set up, mutual authentication, and
876 * exchanging short lived session keys. The handshake depends on a CC.
877 */
878struct usb_handshake {
879 __u8 bMessageNumber;
880 __u8 bStatus;
881 __u8 tTKID[3];
882 __u8 bReserved;
883 __u8 CDID[16];
884 __u8 nonce[16];
885 __u8 MIC[8];
886} __attribute__((packed));
887
888/*-------------------------------------------------------------------------*/
889
890/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
891 * A CC may also be set up using non-wireless secure channels (including
892 * wired USB!), and some devices may support CCs with multiple hosts.
893 */
894struct usb_connection_context {
895 __u8 CHID[16]; /* persistent host id */
896 __u8 CDID[16]; /* device id (unique w/in host context) */
897 __u8 CK[16]; /* connection key */
898} __attribute__((packed));
899
900/*-------------------------------------------------------------------------*/
901
902/* USB 2.0 defines three speeds, here's how Linux identifies them */
903
904enum usb_device_speed {
905 USB_SPEED_UNKNOWN = 0, /* enumerating */
906 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
907 USB_SPEED_HIGH, /* usb 2.0 */
908 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
909 USB_SPEED_SUPER, /* usb 3.0 */
910};
911
912
913enum usb_device_state {
914 /* NOTATTACHED isn't in the USB spec, and this state acts
915 * the same as ATTACHED ... but it's clearer this way.
916 */
917 USB_STATE_NOTATTACHED = 0,
918
919 /* chapter 9 and authentication (wireless) device states */
920 USB_STATE_ATTACHED,
921 USB_STATE_POWERED, /* wired */
922 USB_STATE_RECONNECTING, /* auth */
923 USB_STATE_UNAUTHENTICATED, /* auth */
924 USB_STATE_DEFAULT, /* limited function */
925 USB_STATE_ADDRESS,
926 USB_STATE_CONFIGURED, /* most functions */
927
928 USB_STATE_SUSPENDED
929
930 /* NOTE: there are actually four different SUSPENDED
931 * states, returning to POWERED, DEFAULT, ADDRESS, or
932 * CONFIGURED respectively when SOF tokens flow again.
933 * At this level there's no difference between L1 and L2
934 * suspend states. (L2 being original USB 1.1 suspend.)
935 */
936};
937
938enum usb3_link_state {
939 USB3_LPM_U0 = 0,
940 USB3_LPM_U1,
941 USB3_LPM_U2,
942 USB3_LPM_U3
943};
944
945/*
946 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
947 * 0xff means the parent hub will accept transitions to U1, but will not
948 * initiate a transition.
949 *
950 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
951 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
952 * values.
953 *
954 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
955 * 0xff means the parent hub will accept transitions to U2, but will not
956 * initiate a transition.
957 *
958 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
959 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
960 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
961 * 65.024ms.
962 */
963#define USB3_LPM_DISABLED 0x0
964#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
965#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
966#define USB3_LPM_DEVICE_INITIATED 0xFF
967
968struct usb_set_sel_req {
969 __u8 u1_sel;
970 __u8 u1_pel;
971 __le16 u2_sel;
972 __le16 u2_pel;
973} __attribute__ ((packed));
974
975/*
976 * The Set System Exit Latency control transfer provides one byte each for
977 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
978 * are two bytes long.
979 */
980#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
981#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
982
983/*-------------------------------------------------------------------------*/
984
985/*
986 * As per USB compliance update, a device that is actively drawing
987 * more than 100mA from USB must report itself as bus-powered in
988 * the GetStatus(DEVICE) call.
989 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
990 */
991#define USB_SELF_POWER_VBUS_MAX_DRAW 100
992
993#endif /* _UAPI__LINUX_USB_CH9_H */
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
new file mode 100644
index 000000000000..d6b01283f85c
--- /dev/null
+++ b/include/uapi/linux/usb/functionfs.h
@@ -0,0 +1,169 @@
1#ifndef _UAPI__LINUX_FUNCTIONFS_H__
2#define _UAPI__LINUX_FUNCTIONFS_H__
3
4
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168
169#endif /* _UAPI__LINUX_FUNCTIONFS_H__ */
diff --git a/include/linux/usb/g_printer.h b/include/uapi/linux/usb/g_printer.h
index 6178fde50f74..6178fde50f74 100644
--- a/include/linux/usb/g_printer.h
+++ b/include/uapi/linux/usb/g_printer.h
diff --git a/include/linux/usb/gadgetfs.h b/include/uapi/linux/usb/gadgetfs.h
index 0bb12e0d4f8f..0bb12e0d4f8f 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/uapi/linux/usb/gadgetfs.h
diff --git a/include/linux/usb/midi.h b/include/uapi/linux/usb/midi.h
index c8c52e3c91de..c8c52e3c91de 100644
--- a/include/linux/usb/midi.h
+++ b/include/uapi/linux/usb/midi.h
diff --git a/include/linux/usb/tmc.h b/include/uapi/linux/usb/tmc.h
index c045ae12556c..c045ae12556c 100644
--- a/include/linux/usb/tmc.h
+++ b/include/uapi/linux/usb/tmc.h
diff --git a/include/linux/usb/video.h b/include/uapi/linux/usb/video.h
index 3b3b95e01f71..3b3b95e01f71 100644
--- a/include/linux/usb/video.h
+++ b/include/uapi/linux/usb/video.h
diff --git a/include/xen/Kbuild b/include/xen/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/xen/Kbuild
+++ /dev/null
diff --git a/kernel/module-internal.h b/kernel/module-internal.h
index 6114a13419bd..24f9247b7d02 100644
--- a/kernel/module-internal.h
+++ b/kernel/module-internal.h
@@ -11,5 +11,4 @@
11 11
12extern struct key *modsign_keyring; 12extern struct key *modsign_keyring;
13 13
14extern int mod_verify_sig(const void *mod, unsigned long modlen, 14extern int mod_verify_sig(const void *mod, unsigned long *_modlen);
15 const void *sig, unsigned long siglen);
diff --git a/kernel/module.c b/kernel/module.c
index 0e2da8695f8e..6085f5ef88ea 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2421,25 +2421,17 @@ static inline void kmemleak_load_module(const struct module *mod,
2421 2421
2422#ifdef CONFIG_MODULE_SIG 2422#ifdef CONFIG_MODULE_SIG
2423static int module_sig_check(struct load_info *info, 2423static int module_sig_check(struct load_info *info,
2424 const void *mod, unsigned long *len) 2424 const void *mod, unsigned long *_len)
2425{ 2425{
2426 int err = -ENOKEY; 2426 int err = -ENOKEY;
2427 const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1; 2427 unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
2428 const void *p = mod, *end = mod + *len; 2428 unsigned long len = *_len;
2429 2429
2430 /* Poor man's memmem. */ 2430 if (len > markerlen &&
2431 while ((p = memchr(p, MODULE_SIG_STRING[0], end - p))) { 2431 memcmp(mod + len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
2432 if (p + markerlen > end) 2432 /* We truncate the module to discard the signature */
2433 break; 2433 *_len -= markerlen;
2434 2434 err = mod_verify_sig(mod, _len);
2435 if (memcmp(p, MODULE_SIG_STRING, markerlen) == 0) {
2436 const void *sig = p + markerlen;
2437 /* Truncate module up to signature. */
2438 *len = p - mod;
2439 err = mod_verify_sig(mod, *len, sig, end - sig);
2440 break;
2441 }
2442 p++;
2443 } 2435 }
2444 2436
2445 if (!err) { 2437 if (!err) {
diff --git a/kernel/module_signing.c b/kernel/module_signing.c
index 6b09f6983ac0..d492a23df99c 100644
--- a/kernel/module_signing.c
+++ b/kernel/module_signing.c
@@ -183,27 +183,33 @@ static struct key *request_asymmetric_key(const char *signer, size_t signer_len,
183/* 183/*
184 * Verify the signature on a module. 184 * Verify the signature on a module.
185 */ 185 */
186int mod_verify_sig(const void *mod, unsigned long modlen, 186int mod_verify_sig(const void *mod, unsigned long *_modlen)
187 const void *sig, unsigned long siglen)
188{ 187{
189 struct public_key_signature *pks; 188 struct public_key_signature *pks;
190 struct module_signature ms; 189 struct module_signature ms;
191 struct key *key; 190 struct key *key;
192 size_t sig_len; 191 const void *sig;
192 size_t modlen = *_modlen, sig_len;
193 int ret; 193 int ret;
194 194
195 pr_devel("==>%s(,%lu,,%lu,)\n", __func__, modlen, siglen); 195 pr_devel("==>%s(,%lu)\n", __func__, modlen);
196 196
197 if (siglen <= sizeof(ms)) 197 if (modlen <= sizeof(ms))
198 return -EBADMSG; 198 return -EBADMSG;
199 199
200 memcpy(&ms, sig + (siglen - sizeof(ms)), sizeof(ms)); 200 memcpy(&ms, mod + (modlen - sizeof(ms)), sizeof(ms));
201 siglen -= sizeof(ms); 201 modlen -= sizeof(ms);
202 202
203 sig_len = be32_to_cpu(ms.sig_len); 203 sig_len = be32_to_cpu(ms.sig_len);
204 if (sig_len >= siglen || 204 if (sig_len >= modlen)
205 siglen - sig_len != (size_t)ms.signer_len + ms.key_id_len)
206 return -EBADMSG; 205 return -EBADMSG;
206 modlen -= sig_len;
207 if ((size_t)ms.signer_len + ms.key_id_len >= modlen)
208 return -EBADMSG;
209 modlen -= (size_t)ms.signer_len + ms.key_id_len;
210
211 *_modlen = modlen;
212 sig = mod + modlen;
207 213
208 /* For the moment, only support RSA and X.509 identifiers */ 214 /* For the moment, only support RSA and X.509 identifiers */
209 if (ms.algo != PKEY_ALGO_RSA || 215 if (ms.algo != PKEY_ALGO_RSA ||
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 478bad2745e3..eb00be205811 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -133,19 +133,26 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old
133 return create_pid_namespace(old_ns); 133 return create_pid_namespace(old_ns);
134} 134}
135 135
136void free_pid_ns(struct kref *kref) 136static void free_pid_ns(struct kref *kref)
137{ 137{
138 struct pid_namespace *ns, *parent; 138 struct pid_namespace *ns;
139 139
140 ns = container_of(kref, struct pid_namespace, kref); 140 ns = container_of(kref, struct pid_namespace, kref);
141
142 parent = ns->parent;
143 destroy_pid_namespace(ns); 141 destroy_pid_namespace(ns);
142}
144 143
145 if (parent != NULL) 144void put_pid_ns(struct pid_namespace *ns)
146 put_pid_ns(parent); 145{
146 struct pid_namespace *parent;
147
148 while (ns != &init_pid_ns) {
149 parent = ns->parent;
150 if (!kref_put(&ns->kref, free_pid_ns))
151 break;
152 ns = parent;
153 }
147} 154}
148EXPORT_SYMBOL_GPL(free_pid_ns); 155EXPORT_SYMBOL_GPL(put_pid_ns);
149 156
150void zap_pid_ns_processes(struct pid_namespace *pid_ns) 157void zap_pid_ns_processes(struct pid_namespace *pid_ns)
151{ 158{
diff --git a/kernel/printk.c b/kernel/printk.c
index 66a2ea37b576..22e070f3470a 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -87,6 +87,12 @@ static DEFINE_SEMAPHORE(console_sem);
87struct console *console_drivers; 87struct console *console_drivers;
88EXPORT_SYMBOL_GPL(console_drivers); 88EXPORT_SYMBOL_GPL(console_drivers);
89 89
90#ifdef CONFIG_LOCKDEP
91static struct lockdep_map console_lock_dep_map = {
92 .name = "console_lock"
93};
94#endif
95
90/* 96/*
91 * This is used for debugging the mess that is the VT code by 97 * This is used for debugging the mess that is the VT code by
92 * keeping track if we have the console semaphore held. It's 98 * keeping track if we have the console semaphore held. It's
@@ -1890,7 +1896,6 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
1890 switch (action) { 1896 switch (action) {
1891 case CPU_ONLINE: 1897 case CPU_ONLINE:
1892 case CPU_DEAD: 1898 case CPU_DEAD:
1893 case CPU_DYING:
1894 case CPU_DOWN_FAILED: 1899 case CPU_DOWN_FAILED:
1895 case CPU_UP_CANCELED: 1900 case CPU_UP_CANCELED:
1896 console_lock(); 1901 console_lock();
@@ -1909,12 +1914,14 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
1909 */ 1914 */
1910void console_lock(void) 1915void console_lock(void)
1911{ 1916{
1912 BUG_ON(in_interrupt()); 1917 might_sleep();
1918
1913 down(&console_sem); 1919 down(&console_sem);
1914 if (console_suspended) 1920 if (console_suspended)
1915 return; 1921 return;
1916 console_locked = 1; 1922 console_locked = 1;
1917 console_may_schedule = 1; 1923 console_may_schedule = 1;
1924 mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_);
1918} 1925}
1919EXPORT_SYMBOL(console_lock); 1926EXPORT_SYMBOL(console_lock);
1920 1927
@@ -1936,6 +1943,7 @@ int console_trylock(void)
1936 } 1943 }
1937 console_locked = 1; 1944 console_locked = 1;
1938 console_may_schedule = 0; 1945 console_may_schedule = 0;
1946 mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_);
1939 return 1; 1947 return 1;
1940} 1948}
1941EXPORT_SYMBOL(console_trylock); 1949EXPORT_SYMBOL(console_trylock);
@@ -2096,6 +2104,7 @@ skip:
2096 local_irq_restore(flags); 2104 local_irq_restore(flags);
2097 } 2105 }
2098 console_locked = 0; 2106 console_locked = 0;
2107 mutex_release(&console_lock_dep_map, 1, _RET_IP_);
2099 2108
2100 /* Release the exclusive_console once it is used */ 2109 /* Release the exclusive_console once it is used */
2101 if (unlikely(exclusive_console)) 2110 if (unlikely(exclusive_console))
diff --git a/kernel/sys.c b/kernel/sys.c
index c5cb5b99cb81..e6e0ece5f6a0 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem);
1265 * Work around broken programs that cannot handle "Linux 3.0". 1265 * Work around broken programs that cannot handle "Linux 3.0".
1266 * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 1266 * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
1267 */ 1267 */
1268static int override_release(char __user *release, int len) 1268static int override_release(char __user *release, size_t len)
1269{ 1269{
1270 int ret = 0; 1270 int ret = 0;
1271 char buf[65];
1272 1271
1273 if (current->personality & UNAME26) { 1272 if (current->personality & UNAME26) {
1274 char *rest = UTS_RELEASE; 1273 const char *rest = UTS_RELEASE;
1274 char buf[65] = { 0 };
1275 int ndots = 0; 1275 int ndots = 0;
1276 unsigned v; 1276 unsigned v;
1277 size_t copy;
1277 1278
1278 while (*rest) { 1279 while (*rest) {
1279 if (*rest == '.' && ++ndots >= 3) 1280 if (*rest == '.' && ++ndots >= 3)
@@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len)
1283 rest++; 1284 rest++;
1284 } 1285 }
1285 v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; 1286 v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
1286 snprintf(buf, len, "2.6.%u%s", v, rest); 1287 copy = clamp_t(size_t, len, 1, sizeof(buf));
1287 ret = copy_to_user(release, buf, len); 1288 copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
1289 ret = copy_to_user(release, buf, copy + 1);
1288 } 1290 }
1289 return ret; 1291 return ret;
1290} 1292}
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b9087bff008b..d84beb994f36 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -264,7 +264,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
264 match_fn match) 264 match_fn match)
265{ 265{
266 struct dma_debug_entry *entry, *ret = NULL; 266 struct dma_debug_entry *entry, *ret = NULL;
267 int matches = 0, match_lvl, last_lvl = 0; 267 int matches = 0, match_lvl, last_lvl = -1;
268 268
269 list_for_each_entry(entry, &bucket->list, list) { 269 list_for_each_entry(entry, &bucket->list, list) {
270 if (!match(ref, entry)) 270 if (!match(ref, entry))
@@ -293,7 +293,7 @@ static struct dma_debug_entry *__hash_bucket_find(struct hash_bucket *bucket,
293 } else if (match_lvl > last_lvl) { 293 } else if (match_lvl > last_lvl) {
294 /* 294 /*
295 * We found an entry that fits better then the 295 * We found an entry that fits better then the
296 * previous one 296 * previous one or it is the 1st match.
297 */ 297 */
298 last_lvl = match_lvl; 298 last_lvl = match_lvl;
299 ret = entry; 299 ret = entry;
diff --git a/mm/compaction.c b/mm/compaction.c
index 2c4ce17651d8..9eef55838fca 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -346,7 +346,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
346 * pages requested were isolated. If there were any failures, 0 is 346 * pages requested were isolated. If there were any failures, 0 is
347 * returned and CMA will fail. 347 * returned and CMA will fail.
348 */ 348 */
349 if (strict && nr_strict_required != total_isolated) 349 if (strict && nr_strict_required > total_isolated)
350 total_isolated = 0; 350 total_isolated = 0;
351 351
352 if (locked) 352 if (locked)
diff --git a/mm/fremap.c b/mm/fremap.c
index 3899a86851ce..a0aaf0e56800 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -169,7 +169,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
169 if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR)) 169 if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
170 goto out; 170 goto out;
171 171
172 if (!vma->vm_ops->remap_pages) 172 if (!vma->vm_ops || !vma->vm_ops->remap_pages)
173 goto out; 173 goto out;
174 174
175 if (start < vma->vm_start || start + size > vma->vm_end) 175 if (start < vma->vm_start || start + size > vma->vm_end)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a863af26c79c..40f17c34b415 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -17,6 +17,7 @@
17#include <linux/khugepaged.h> 17#include <linux/khugepaged.h>
18#include <linux/freezer.h> 18#include <linux/freezer.h>
19#include <linux/mman.h> 19#include <linux/mman.h>
20#include <linux/pagemap.h>
20#include <asm/tlb.h> 21#include <asm/tlb.h>
21#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
22#include "internal.h" 23#include "internal.h"
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0b78fb9ea65b..d04a8a54c294 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1536,9 +1536,8 @@ asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
1536 * 1536 *
1537 * Returns effective policy for a VMA at specified address. 1537 * Returns effective policy for a VMA at specified address.
1538 * Falls back to @task or system default policy, as necessary. 1538 * Falls back to @task or system default policy, as necessary.
1539 * Current or other task's task mempolicy and non-shared vma policies 1539 * Current or other task's task mempolicy and non-shared vma policies must be
1540 * are protected by the task's mmap_sem, which must be held for read by 1540 * protected by task_lock(task) by the caller.
1541 * the caller.
1542 * Shared policies [those marked as MPOL_F_SHARED] require an extra reference 1541 * Shared policies [those marked as MPOL_F_SHARED] require an extra reference
1543 * count--added by the get_policy() vm_op, as appropriate--to protect against 1542 * count--added by the get_policy() vm_op, as appropriate--to protect against
1544 * freeing by another task. It is the caller's responsibility to free the 1543 * freeing by another task. It is the caller's responsibility to free the
diff --git a/mm/slob.c b/mm/slob.c
index a08e4681fd0d..1e921c5e9576 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -429,7 +429,7 @@ static __always_inline void *
429__do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller) 429__do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller)
430{ 430{
431 unsigned int *m; 431 unsigned int *m;
432 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); 432 int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
433 void *ret; 433 void *ret;
434 434
435 gfp &= gfp_allowed_mask; 435 gfp &= gfp_allowed_mask;
@@ -502,7 +502,7 @@ void kfree(const void *block)
502 502
503 sp = virt_to_page(block); 503 sp = virt_to_page(block);
504 if (PageSlab(sp)) { 504 if (PageSlab(sp)) {
505 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); 505 int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
506 unsigned int *m = (unsigned int *)(block - align); 506 unsigned int *m = (unsigned int *)(block - align);
507 slob_free(m, *m + align); 507 slob_free(m, *m + align);
508 } else 508 } else
@@ -521,7 +521,7 @@ size_t ksize(const void *block)
521 521
522 sp = virt_to_page(block); 522 sp = virt_to_page(block);
523 if (PageSlab(sp)) { 523 if (PageSlab(sp)) {
524 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); 524 int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
525 unsigned int *m = (unsigned int *)(block - align); 525 unsigned int *m = (unsigned int *)(block - align);
526 return SLOB_UNITS(*m) * SLOB_UNIT; 526 return SLOB_UNITS(*m) * SLOB_UNIT;
527 } else 527 } else
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index fbbf1fa00940..65e06abe023f 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -366,6 +366,13 @@ EXPORT_SYMBOL(vlan_vids_del_by_dev);
366 366
367bool vlan_uses_dev(const struct net_device *dev) 367bool vlan_uses_dev(const struct net_device *dev)
368{ 368{
369 return rtnl_dereference(dev->vlan_info) ? true : false; 369 struct vlan_info *vlan_info;
370
371 ASSERT_RTNL();
372
373 vlan_info = rtnl_dereference(dev->vlan_info);
374 if (!vlan_info)
375 return false;
376 return vlan_info->grp.nr_vlan_devs ? true : false;
370} 377}
371EXPORT_SYMBOL(vlan_uses_dev); 378EXPORT_SYMBOL(vlan_uses_dev);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d7c56f8a5b4e..0424e4e27414 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3064,14 +3064,15 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos)
3064 struct hlist_node *n; 3064 struct hlist_node *n;
3065 hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], 3065 hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket],
3066 addr_lst) { 3066 addr_lst) {
3067 if (!net_eq(dev_net(ifa->idev->dev), net))
3068 continue;
3067 /* sync with offset */ 3069 /* sync with offset */
3068 if (p < state->offset) { 3070 if (p < state->offset) {
3069 p++; 3071 p++;
3070 continue; 3072 continue;
3071 } 3073 }
3072 state->offset++; 3074 state->offset++;
3073 if (net_eq(dev_net(ifa->idev->dev), net)) 3075 return ifa;
3074 return ifa;
3075 } 3076 }
3076 3077
3077 /* prepare for next bucket */ 3078 /* prepare for next bucket */
@@ -3089,18 +3090,20 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq,
3089 struct hlist_node *n = &ifa->addr_lst; 3090 struct hlist_node *n = &ifa->addr_lst;
3090 3091
3091 hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) { 3092 hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) {
3093 if (!net_eq(dev_net(ifa->idev->dev), net))
3094 continue;
3092 state->offset++; 3095 state->offset++;
3093 if (net_eq(dev_net(ifa->idev->dev), net)) 3096 return ifa;
3094 return ifa;
3095 } 3097 }
3096 3098
3097 while (++state->bucket < IN6_ADDR_HSIZE) { 3099 while (++state->bucket < IN6_ADDR_HSIZE) {
3098 state->offset = 0; 3100 state->offset = 0;
3099 hlist_for_each_entry_rcu_bh(ifa, n, 3101 hlist_for_each_entry_rcu_bh(ifa, n,
3100 &inet6_addr_lst[state->bucket], addr_lst) { 3102 &inet6_addr_lst[state->bucket], addr_lst) {
3103 if (!net_eq(dev_net(ifa->idev->dev), net))
3104 continue;
3101 state->offset++; 3105 state->offset++;
3102 if (net_eq(dev_net(ifa->idev->dev), net)) 3106 return ifa;
3103 return ifa;
3104 } 3107 }
3105 } 3108 }
3106 3109
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 95a3a7a336ba..496ce2cebcd7 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -421,6 +421,8 @@ static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
421 hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL); 421 hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL);
422 } 422 }
423 423
424 tty->driver_data = self;
425
424 return tty_port_install(&self->port, driver, tty); 426 return tty_port_install(&self->port, driver, tty);
425} 427}
426 428
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 57f7de839b03..6773d7803627 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1642,8 +1642,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1642 asoc->outqueue.outstanding_bytes; 1642 asoc->outqueue.outstanding_bytes;
1643 sackh.num_gap_ack_blocks = 0; 1643 sackh.num_gap_ack_blocks = 0;
1644 sackh.num_dup_tsns = 0; 1644 sackh.num_dup_tsns = 0;
1645 chunk->subh.sack_hdr = &sackh;
1645 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, 1646 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK,
1646 SCTP_SACKH(&sackh)); 1647 SCTP_CHUNK(chunk));
1647 break; 1648 break;
1648 1649
1649 case SCTP_CMD_DISCARD_PACKET: 1650 case SCTP_CMD_DISCARD_PACKET:
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 2a68bb3db772..fc2f7aa4dca7 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1409,11 +1409,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
1409 size_t count, loff_t *ppos, 1409 size_t count, loff_t *ppos,
1410 struct cache_detail *cd) 1410 struct cache_detail *cd)
1411{ 1411{
1412 char tbuf[20]; 1412 char tbuf[22];
1413 unsigned long p = *ppos; 1413 unsigned long p = *ppos;
1414 size_t len; 1414 size_t len;
1415 1415
1416 sprintf(tbuf, "%lu\n", convert_to_wallclock(cd->flush_time)); 1416 snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
1417 len = strlen(tbuf); 1417 len = strlen(tbuf);
1418 if (p >= len) 1418 if (p >= len)
1419 return 0; 1419 return 0;
diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic
index 40caf3c26cd5..d17e0ea911ed 100644
--- a/scripts/Makefile.asm-generic
+++ b/scripts/Makefile.asm-generic
@@ -5,7 +5,7 @@
5# and for each file listed in this file with generic-y creates 5# and for each file listed in this file with generic-y creates
6# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm) 6# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm)
7 7
8kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild 8kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
9-include $(kbuild-file) 9-include $(kbuild-file)
10 10
11include scripts/Kbuild.include 11include scripts/Kbuild.include
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index c3f69ae275d1..4d908d16c035 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -27,7 +27,7 @@ endif
27installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) 27installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
28 28
29installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) 29installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
30installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. 30installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
31 31
32# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. 32# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
33PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs 33PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
@@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
42$(installed-fw-dirs): 42$(installed-fw-dirs):
43 $(call cmd,mkdir) 43 $(call cmd,mkdir)
44 44
45$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%) 45$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
46 $(call cmd,install) 46 $(call cmd,install)
47 47
48PHONY += __fw_install __fw_modinst FORCE 48PHONY += __fw_install __fw_modinst FORCE
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 3d13d3a3edfe..dda4b2b61927 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -17,7 +17,7 @@ __modinst: $(modules)
17 @: 17 @:
18 18
19quiet_cmd_modules_install = INSTALL $@ 19quiet_cmd_modules_install = INSTALL $@
20 cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) 20 cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@)
21 21
22# Modules built outside the kernel source tree go into extra by default 22# Modules built outside the kernel source tree go into extra by default
23INSTALL_MOD_DIR ?= extra 23INSTALL_MOD_DIR ?= extra
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 002089141df4..a1cb0222ebe6 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -14,8 +14,7 @@
14# 3) create one <module>.mod.c file pr. module 14# 3) create one <module>.mod.c file pr. module
15# 4) create one Module.symvers file with CRC for all exported symbols 15# 4) create one Module.symvers file with CRC for all exported symbols
16# 5) compile all <module>.mod.c files 16# 5) compile all <module>.mod.c files
17# 6) final link of the module to a <module.ko> (or <module.unsigned>) file 17# 6) final link of the module to a <module.ko> file
18# 7) signs the modules to a <module.ko> file
19 18
20# Step 3 is used to place certain information in the module's ELF 19# Step 3 is used to place certain information in the module's ELF
21# section, including information such as: 20# section, including information such as:
@@ -33,8 +32,6 @@
33# Step 4 is solely used to allow module versioning in external modules, 32# Step 4 is solely used to allow module versioning in external modules,
34# where the CRC of each module is retrieved from the Module.symvers file. 33# where the CRC of each module is retrieved from the Module.symvers file.
35 34
36# Step 7 is dependent on CONFIG_MODULE_SIG being enabled.
37
38# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined 35# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
39# symbols in the final module linking stage 36# symbols in the final module linking stage
40# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. 37# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
@@ -119,7 +116,6 @@ $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
119targets += $(modules:.ko=.mod.o) 116targets += $(modules:.ko=.mod.o)
120 117
121# Step 6), final link of the modules 118# Step 6), final link of the modules
122ifneq ($(CONFIG_MODULE_SIG),y)
123quiet_cmd_ld_ko_o = LD [M] $@ 119quiet_cmd_ld_ko_o = LD [M] $@
124 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \ 120 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \
125 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ 121 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
@@ -129,78 +125,7 @@ $(modules): %.ko :%.o %.mod.o FORCE
129 $(call if_changed,ld_ko_o) 125 $(call if_changed,ld_ko_o)
130 126
131targets += $(modules) 127targets += $(modules)
132else
133quiet_cmd_ld_ko_unsigned_o = LD [M] $@
134 cmd_ld_ko_unsigned_o = \
135 $(LD) -r $(LDFLAGS) \
136 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
137 -o $@ $(filter-out FORCE,$^) \
138 $(if $(AFTER_LINK),; $(AFTER_LINK))
139
140$(modules:.ko=.ko.unsigned): %.ko.unsigned :%.o %.mod.o FORCE
141 $(call if_changed,ld_ko_unsigned_o)
142
143targets += $(modules:.ko=.ko.unsigned)
144
145# Step 7), sign the modules
146MODSECKEY = ./signing_key.priv
147MODPUBKEY = ./signing_key.x509
148
149ifeq ($(wildcard $(MODSECKEY))+$(wildcard $(MODPUBKEY)),$(MODSECKEY)+$(MODPUBKEY))
150ifeq ($(KBUILD_SRC),)
151 # no O= is being used
152 SCRIPTS_DIR := scripts
153else
154 SCRIPTS_DIR := $(KBUILD_SRC)/scripts
155endif
156SIGN_MODULES := 1
157else
158SIGN_MODULES := 0
159endif
160
161# only sign if it's an in-tree module
162ifneq ($(KBUILD_EXTMOD),)
163SIGN_MODULES := 0
164endif
165 128
166# We strip the module as best we can - note that using both strip and eu-strip
167# results in a smaller module than using either alone.
168EU_STRIP = $(shell which eu-strip || echo true)
169
170quiet_cmd_sign_ko_stripped_ko_unsigned = STRIP [M] $@
171 cmd_sign_ko_stripped_ko_unsigned = \
172 cp $< $@ && \
173 strip -x -g $@ && \
174 $(EU_STRIP) $@
175
176ifeq ($(SIGN_MODULES),1)
177
178quiet_cmd_genkeyid = GENKEYID $@
179 cmd_genkeyid = \
180 perl $(SCRIPTS_DIR)/x509keyid $< $<.signer $<.keyid
181
182%.signer %.keyid: %
183 $(call if_changed,genkeyid)
184
185KEYRING_DEP := $(MODSECKEY) $(MODPUBKEY) $(MODPUBKEY).signer $(MODPUBKEY).keyid
186quiet_cmd_sign_ko_ko_stripped = SIGN [M] $@
187 cmd_sign_ko_ko_stripped = \
188 sh $(SCRIPTS_DIR)/sign-file $(MODSECKEY) $(MODPUBKEY) $< $@
189else
190KEYRING_DEP :=
191quiet_cmd_sign_ko_ko_unsigned = NO SIGN [M] $@
192 cmd_sign_ko_ko_unsigned = \
193 cp $< $@
194endif
195
196$(modules): %.ko :%.ko.stripped $(KEYRING_DEP) FORCE
197 $(call if_changed,sign_ko_ko_stripped)
198
199$(patsubst %.ko,%.ko.stripped,$(modules)): %.ko.stripped :%.ko.unsigned FORCE
200 $(call if_changed,sign_ko_stripped_ko_unsigned)
201
202targets += $(modules)
203endif
204 129
205# Add FORCE to the prequisites of a target to force it to be always rebuilt. 130# Add FORCE to the prequisites of a target to force it to be always rebuilt.
206# --------------------------------------------------------------------------- 131# ---------------------------------------------------------------------------
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
index d501c8605f26..3e42a071070e 100644
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -161,51 +161,27 @@ struct node {
161 struct label *labels; 161 struct label *labels;
162}; 162};
163 163
164static inline struct label *for_each_label_next(struct label *l)
165{
166 do {
167 l = l->next;
168 } while (l && l->deleted);
169
170 return l;
171}
172
173#define for_each_label(l0, l) \
174 for ((l) = (l0); (l); (l) = for_each_label_next(l))
175
176#define for_each_label_withdel(l0, l) \ 164#define for_each_label_withdel(l0, l) \
177 for ((l) = (l0); (l); (l) = (l)->next) 165 for ((l) = (l0); (l); (l) = (l)->next)
178 166
179static inline struct property *for_each_property_next(struct property *p) 167#define for_each_label(l0, l) \
180{ 168 for_each_label_withdel(l0, l) \
181 do { 169 if (!(l)->deleted)
182 p = p->next;
183 } while (p && p->deleted);
184
185 return p;
186}
187
188#define for_each_property(n, p) \
189 for ((p) = (n)->proplist; (p); (p) = for_each_property_next(p))
190 170
191#define for_each_property_withdel(n, p) \ 171#define for_each_property_withdel(n, p) \
192 for ((p) = (n)->proplist; (p); (p) = (p)->next) 172 for ((p) = (n)->proplist; (p); (p) = (p)->next)
193 173
194static inline struct node *for_each_child_next(struct node *c) 174#define for_each_property(n, p) \
195{ 175 for_each_property_withdel(n, p) \
196 do { 176 if (!(p)->deleted)
197 c = c->next_sibling;
198 } while (c && c->deleted);
199
200 return c;
201}
202
203#define for_each_child(n, c) \
204 for ((c) = (n)->children; (c); (c) = for_each_child_next(c))
205 177
206#define for_each_child_withdel(n, c) \ 178#define for_each_child_withdel(n, c) \
207 for ((c) = (n)->children; (c); (c) = (c)->next_sibling) 179 for ((c) = (n)->children; (c); (c) = (c)->next_sibling)
208 180
181#define for_each_child(n, c) \
182 for_each_child_withdel(n, c) \
183 if (!(c)->deleted)
184
209void add_label(struct label **labels, char *label); 185void add_label(struct label **labels, char *label);
210void delete_labels(struct label **labels); 186void delete_labels(struct label **labels);
211 187
diff --git a/scripts/sign-file b/scripts/sign-file
index e58e34e50ac5..87ca59d36e7e 100644..100755
--- a/scripts/sign-file
+++ b/scripts/sign-file
@@ -1,115 +1,429 @@
1#!/bin/sh 1#!/usr/bin/perl -w
2# 2#
3# Sign a module file using the given key. 3# Sign a module file using the given key.
4# 4#
5# Format: sign-file <key> <x509> <src-file> <dst-file> 5# Format:
6# 6#
7 7# ./scripts/sign-file [-v] <key> <x509> <module> [<dest>]
8scripts=`dirname $0` 8#
9 9#
10CONFIG_MODULE_SIG_SHA512=y 10use strict;
11if [ -r .config ] 11use FileHandle;
12then 12use IPC::Open2;
13 . ./.config 13
14fi 14my $verbose = 0;
15 15if ($#ARGV >= 0 && $ARGV[0] eq "-v") {
16key="$1" 16 $verbose = 1;
17x509="$2" 17 shift;
18src="$3" 18}
19dst="$4" 19
20 20die "Format: ./scripts/sign-file [-v] <key> <x509> <module> [<dest>]\n"
21if [ ! -r "$key" ] 21 if ($#ARGV != 2 && $#ARGV != 3);
22then 22
23 echo "Can't read private key" >&2 23my $private_key = $ARGV[0];
24 exit 2 24my $x509 = $ARGV[1];
25fi 25my $module = $ARGV[2];
26 26my $dest = ($#ARGV == 3) ? $ARGV[3] : $ARGV[2] . "~";
27if [ ! -r "$x509" ] 27
28then 28die "Can't read private key\n" unless (-r $private_key);
29 echo "Can't read X.509 certificate" >&2 29die "Can't read X.509 certificate\n" unless (-r $x509);
30 exit 2 30die "Can't read module\n" unless (-r $module);
31fi 31
32if [ ! -r "$x509.signer" ] 32#
33then 33# Read the kernel configuration
34 echo "Can't read Signer name" >&2 34#
35 exit 2; 35my %config = (
36fi 36 CONFIG_MODULE_SIG_SHA512 => 1
37if [ ! -r "$x509.keyid" ] 37 );
38then 38
39 echo "Can't read Key identifier" >&2 39if (-r ".config") {
40 exit 2; 40 open(FD, "<.config") || die ".config";
41fi 41 while (<FD>) {
42 if ($_ =~ /^(CONFIG_.*)=[ym]/) {
43 $config{$1} = 1;
44 }
45 }
46 close(FD);
47}
48
49#
50# Function to read the contents of a file into a variable.
51#
52sub read_file($)
53{
54 my ($file) = @_;
55 my $contents;
56 my $len;
57
58 open(FD, "<$file") || die $file;
59 binmode FD;
60 my @st = stat(FD);
61 die $file if (!@st);
62 $len = read(FD, $contents, $st[7]) || die $file;
63 close(FD) || die $file;
64 die "$file: Wanted length ", $st[7], ", got ", $len, "\n"
65 if ($len != $st[7]);
66 return $contents;
67}
68
69###############################################################################
70#
71# First of all, we have to parse the X.509 certificate to find certain details
72# about it.
73#
74# We read the DER-encoded X509 certificate and parse it to extract the Subject
75# name and Subject Key Identifier. Theis provides the data we need to build
76# the certificate identifier.
77#
78# The signer's name part of the identifier is fabricated from the commonName,
79# the organizationName or the emailAddress components of the X.509 subject
80# name.
81#
82# The subject key ID is used to select which of that signer's certificates
83# we're intending to use to sign the module.
84#
85###############################################################################
86my $x509_certificate = read_file($x509);
87
88my $UNIV = 0 << 6;
89my $APPL = 1 << 6;
90my $CONT = 2 << 6;
91my $PRIV = 3 << 6;
92
93my $CONS = 0x20;
94
95my $BOOLEAN = 0x01;
96my $INTEGER = 0x02;
97my $BIT_STRING = 0x03;
98my $OCTET_STRING = 0x04;
99my $NULL = 0x05;
100my $OBJ_ID = 0x06;
101my $UTF8String = 0x0c;
102my $SEQUENCE = 0x10;
103my $SET = 0x11;
104my $UTCTime = 0x17;
105my $GeneralizedTime = 0x18;
106
107my %OIDs = (
108 pack("CCC", 85, 4, 3) => "commonName",
109 pack("CCC", 85, 4, 6) => "countryName",
110 pack("CCC", 85, 4, 10) => "organizationName",
111 pack("CCC", 85, 4, 11) => "organizationUnitName",
112 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 1, 1) => "rsaEncryption",
113 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 1, 5) => "sha1WithRSAEncryption",
114 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 9, 1) => "emailAddress",
115 pack("CCC", 85, 29, 35) => "authorityKeyIdentifier",
116 pack("CCC", 85, 29, 14) => "subjectKeyIdentifier",
117 pack("CCC", 85, 29, 19) => "basicConstraints"
118);
119
120###############################################################################
121#
122# Extract an ASN.1 element from a string and return information about it.
123#
124###############################################################################
125sub asn1_extract($$@)
126{
127 my ($cursor, $expected_tag, $optional) = @_;
128
129 return [ -1 ]
130 if ($cursor->[1] == 0 && $optional);
131
132 die $x509, ": ", $cursor->[0], ": ASN.1 data underrun (elem ", $cursor->[1], ")\n"
133 if ($cursor->[1] < 2);
134
135 my ($tag, $len) = unpack("CC", substr(${$cursor->[2]}, $cursor->[0], 2));
136
137 if ($expected_tag != -1 && $tag != $expected_tag) {
138 return [ -1 ]
139 if ($optional);
140 die $x509, ": ", $cursor->[0], ": ASN.1 unexpected tag (", $tag,
141 " not ", $expected_tag, ")\n";
142 }
143
144 $cursor->[0] += 2;
145 $cursor->[1] -= 2;
146
147 die $x509, ": ", $cursor->[0], ": ASN.1 long tag\n"
148 if (($tag & 0x1f) == 0x1f);
149 die $x509, ": ", $cursor->[0], ": ASN.1 indefinite length\n"
150 if ($len == 0x80);
151
152 if ($len > 0x80) {
153 my $l = $len - 0x80;
154 die $x509, ": ", $cursor->[0], ": ASN.1 data underrun (len len $l)\n"
155 if ($cursor->[1] < $l);
156
157 if ($l == 0x1) {
158 $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1));
159 } elsif ($l = 0x2) {
160 $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0], 2));
161 } elsif ($l = 0x3) {
162 $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)) << 16;
163 $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0] + 1, 2));
164 } elsif ($l = 0x4) {
165 $len = unpack("N", substr(${$cursor->[2]}, $cursor->[0], 4));
166 } else {
167 die $x509, ": ", $cursor->[0], ": ASN.1 element too long (", $l, ")\n";
168 }
169
170 $cursor->[0] += $l;
171 $cursor->[1] -= $l;
172 }
173
174 die $x509, ": ", $cursor->[0], ": ASN.1 data underrun (", $len, ")\n"
175 if ($cursor->[1] < $len);
176
177 my $ret = [ $tag, [ $cursor->[0], $len, $cursor->[2] ] ];
178 $cursor->[0] += $len;
179 $cursor->[1] -= $len;
180
181 return $ret;
182}
183
184###############################################################################
185#
186# Retrieve the data referred to by a cursor
187#
188###############################################################################
189sub asn1_retrieve($)
190{
191 my ($cursor) = @_;
192 my ($offset, $len, $data) = @$cursor;
193 return substr($$data, $offset, $len);
194}
195
196###############################################################################
197#
198# Roughly parse the X.509 certificate
199#
200###############################################################################
201my $cursor = [ 0, length($x509_certificate), \$x509_certificate ];
202
203my $cert = asn1_extract($cursor, $UNIV | $CONS | $SEQUENCE);
204my $tbs = asn1_extract($cert->[1], $UNIV | $CONS | $SEQUENCE);
205my $version = asn1_extract($tbs->[1], $CONT | $CONS | 0, 1);
206my $serial_number = asn1_extract($tbs->[1], $UNIV | $INTEGER);
207my $sig_type = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
208my $issuer = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
209my $validity = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
210my $subject = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
211my $key = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
212my $issuer_uid = asn1_extract($tbs->[1], $CONT | $CONS | 1, 1);
213my $subject_uid = asn1_extract($tbs->[1], $CONT | $CONS | 2, 1);
214my $extension_list = asn1_extract($tbs->[1], $CONT | $CONS | 3, 1);
215
216my $subject_key_id = ();
217my $authority_key_id = ();
218
219#
220# Parse the extension list
221#
222if ($extension_list->[0] != -1) {
223 my $extensions = asn1_extract($extension_list->[1], $UNIV | $CONS | $SEQUENCE);
224
225 while ($extensions->[1]->[1] > 0) {
226 my $ext = asn1_extract($extensions->[1], $UNIV | $CONS | $SEQUENCE);
227 my $x_oid = asn1_extract($ext->[1], $UNIV | $OBJ_ID);
228 my $x_crit = asn1_extract($ext->[1], $UNIV | $BOOLEAN, 1);
229 my $x_val = asn1_extract($ext->[1], $UNIV | $OCTET_STRING);
230
231 my $raw_oid = asn1_retrieve($x_oid->[1]);
232 next if (!exists($OIDs{$raw_oid}));
233 my $x_type = $OIDs{$raw_oid};
234
235 my $raw_value = asn1_retrieve($x_val->[1]);
236
237 if ($x_type eq "subjectKeyIdentifier") {
238 my $vcursor = [ 0, length($raw_value), \$raw_value ];
239
240 $subject_key_id = asn1_extract($vcursor, $UNIV | $OCTET_STRING);
241 }
242 }
243}
244
245###############################################################################
246#
247# Determine what we're going to use as the signer's name. In order of
248# preference, take one of: commonName, organizationName or emailAddress.
249#
250###############################################################################
251my $org = "";
252my $cn = "";
253my $email = "";
254
255while ($subject->[1]->[1] > 0) {
256 my $rdn = asn1_extract($subject->[1], $UNIV | $CONS | $SET);
257 my $attr = asn1_extract($rdn->[1], $UNIV | $CONS | $SEQUENCE);
258 my $n_oid = asn1_extract($attr->[1], $UNIV | $OBJ_ID);
259 my $n_val = asn1_extract($attr->[1], -1);
260
261 my $raw_oid = asn1_retrieve($n_oid->[1]);
262 next if (!exists($OIDs{$raw_oid}));
263 my $n_type = $OIDs{$raw_oid};
264
265 my $raw_value = asn1_retrieve($n_val->[1]);
266
267 if ($n_type eq "organizationName") {
268 $org = $raw_value;
269 } elsif ($n_type eq "commonName") {
270 $cn = $raw_value;
271 } elsif ($n_type eq "emailAddress") {
272 $email = $raw_value;
273 }
274}
275
276my $signers_name = $email;
277
278if ($org && $cn) {
279 # Don't use the organizationName if the commonName repeats it
280 if (length($org) <= length($cn) &&
281 substr($cn, 0, length($org)) eq $org) {
282 $signers_name = $cn;
283 goto got_id_name;
284 }
285
286 # Or a signifcant chunk of it
287 if (length($org) >= 7 &&
288 length($cn) >= 7 &&
289 substr($cn, 0, 7) eq substr($org, 0, 7)) {
290 $signers_name = $cn;
291 goto got_id_name;
292 }
293
294 $signers_name = $org . ": " . $cn;
295} elsif ($org) {
296 $signers_name = $org;
297} elsif ($cn) {
298 $signers_name = $cn;
299}
300
301got_id_name:
302
303die $x509, ": ", "X.509: Couldn't find the Subject Key Identifier extension\n"
304 if (!$subject_key_id);
305
306my $key_identifier = asn1_retrieve($subject_key_id->[1]);
307
308###############################################################################
309#
310# Create and attach the module signature
311#
312###############################################################################
42 313
43# 314#
44# Signature parameters 315# Signature parameters
45# 316#
46algo=1 # Public-key crypto algorithm: RSA 317my $algo = 1; # Public-key crypto algorithm: RSA
47hash= # Digest algorithm 318my $hash = 0; # Digest algorithm
48id_type=1 # Identifier type: X.509 319my $id_type = 1; # Identifier type: X.509
49 320
50# 321#
51# Digest the data 322# Digest the data
52# 323#
53dgst= 324my ($dgst, $prologue) = ();
54if [ "$CONFIG_MODULE_SIG_SHA1" = "y" ] 325if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) {
55then 326 $prologue = pack("C*",
56 prologue="0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14" 327 0x30, 0x21, 0x30, 0x09, 0x06, 0x05,
57 dgst=-sha1 328 0x2B, 0x0E, 0x03, 0x02, 0x1A,
58 hash=2 329 0x05, 0x00, 0x04, 0x14);
59elif [ "$CONFIG_MODULE_SIG_SHA224" = "y" ] 330 $dgst = "-sha1";
60then 331 $hash = 2;
61 prologue="0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 0x00, 0x04, 0x1C" 332} elsif (exists $config{"CONFIG_MODULE_SIG_SHA224"}) {
62 dgst=-sha224 333 $prologue = pack("C*",
63 hash=7 334 0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09,
64elif [ "$CONFIG_MODULE_SIG_SHA256" = "y" ] 335 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04,
65then 336 0x05, 0x00, 0x04, 0x1C);
66 prologue="0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20" 337 $dgst = "-sha224";
67 dgst=-sha256 338 $hash = 7;
68 hash=4 339} elsif (exists $config{"CONFIG_MODULE_SIG_SHA256"}) {
69elif [ "$CONFIG_MODULE_SIG_SHA384" = "y" ] 340 $prologue = pack("C*",
70then 341 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09,
71 prologue="0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30" 342 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01,
72 dgst=-sha384 343 0x05, 0x00, 0x04, 0x20);
73 hash=5 344 $dgst = "-sha256";
74elif [ "$CONFIG_MODULE_SIG_SHA512" = "y" ] 345 $hash = 4;
75then 346} elsif (exists $config{"CONFIG_MODULE_SIG_SHA384"}) {
76 prologue="0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40" 347 $prologue = pack("C*",
77 dgst=-sha512 348 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09,
78 hash=6 349 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02,
79else 350 0x05, 0x00, 0x04, 0x30);
80 echo "$0: Can't determine hash algorithm" >&2 351 $dgst = "-sha384";
81 exit 2 352 $hash = 5;
82fi 353} elsif (exists $config{"CONFIG_MODULE_SIG_SHA512"}) {
83 354 $prologue = pack("C*",
84( 355 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09,
85perl -e "binmode STDOUT; print pack(\"C*\", $prologue)" || exit $? 356 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03,
86openssl dgst $dgst -binary $src || exit $? 357 0x05, 0x00, 0x04, 0x40);
87) >$src.dig || exit $? 358 $dgst = "-sha512";
359 $hash = 6;
360} else {
361 die "Can't determine hash algorithm";
362}
363
364#
365# Generate the digest and read from openssl's stdout
366#
367my $digest;
368$digest = readpipe("openssl dgst $dgst -binary $module") || die "openssl dgst";
88 369
89# 370#
90# Generate the binary signature, which will be just the integer that comprises 371# Generate the binary signature, which will be just the integer that comprises
91# the signature with no metadata attached. 372# the signature with no metadata attached.
92# 373#
93openssl rsautl -sign -inkey $key -keyform PEM -in $src.dig -out $src.sig || exit $? 374my $pid;
94signerlen=`stat -c %s $x509.signer` 375$pid = open2(*read_from, *write_to,
95keyidlen=`stat -c %s $x509.keyid` 376 "openssl rsautl -sign -inkey $private_key -keyform PEM") ||
96siglen=`stat -c %s $src.sig` 377 die "openssl rsautl";
378binmode write_to;
379print write_to $prologue . $digest || die "pipe to openssl rsautl";
380close(write_to) || die "pipe to openssl rsautl";
381
382binmode read_from;
383my $signature;
384read(read_from, $signature, 4096) || die "pipe from openssl rsautl";
385close(read_from) || die "pipe from openssl rsautl";
386$signature = pack("n", length($signature)) . $signature,
387
388waitpid($pid, 0) || die;
389die "openssl rsautl died: $?" if ($? >> 8);
97 390
98# 391#
99# Build the signed binary 392# Build the signed binary
100# 393#
101( 394my $unsigned_module = read_file($module);
102 cat $src || exit $? 395
103 echo '~Module signature appended~' || exit $? 396my $magic_number = "~Module signature appended~\n";
104 cat $x509.signer $x509.keyid || exit $? 397
398my $info = pack("CCCCCxxxN",
399 $algo, $hash, $id_type,
400 length($signers_name),
401 length($key_identifier),
402 length($signature));
105 403
106 # Preface each signature integer with a 2-byte BE length 404if ($verbose) {
107 perl -e "binmode STDOUT; print pack(\"n\", $siglen)" || exit $? 405 print "Size of unsigned module: ", length($unsigned_module), "\n";
108 cat $src.sig || exit $? 406 print "Size of signer's name : ", length($signers_name), "\n";
407 print "Size of key identifier : ", length($key_identifier), "\n";
408 print "Size of signature : ", length($signature), "\n";
409 print "Size of informaton : ", length($info), "\n";
410 print "Size of magic number : ", length($magic_number), "\n";
411 print "Signer's name : '", $signers_name, "'\n";
412 print "Digest : $dgst\n";
413}
109 414
110 # Generate the information block 415open(FD, ">$dest") || die $dest;
111 perl -e "binmode STDOUT; print pack(\"CCCCCxxxN\", $algo, $hash, $id_type, $signerlen, $keyidlen, $siglen + 2)" || exit $? 416binmode FD;
112) >$dst~ || exit $? 417print FD
418 $unsigned_module,
419 $signers_name,
420 $key_identifier,
421 $signature,
422 $info,
423 $magic_number
424 ;
425close FD || die $dest;
113 426
114# Permit in-place signing 427if ($#ARGV != 3) {
115mv $dst~ $dst || exit $? 428 rename($dest, $module) || die $module;
429}
diff --git a/scripts/x509keyid b/scripts/x509keyid
deleted file mode 100755
index c8e91a4af385..000000000000
--- a/scripts/x509keyid
+++ /dev/null
@@ -1,268 +0,0 @@
1#!/usr/bin/perl -w
2#
3# Generate an identifier from an X.509 certificate that can be placed in a
4# module signature to indentify the key to use.
5#
6# Format:
7#
8# ./scripts/x509keyid <x509-cert> <signer's-name> <key-id>
9#
10# We read the DER-encoded X509 certificate and parse it to extract the Subject
11# name and Subject Key Identifier. The provide the data we need to build the
12# certificate identifier.
13#
14# The signer's name part of the identifier is fabricated from the commonName,
15# the organizationName or the emailAddress components of the X.509 subject
16# name and written to the second named file.
17#
18# The subject key ID to select which of that signer's certificates we're
19# intending to use to sign the module is written to the third named file.
20#
21use strict;
22
23my $raw_data;
24
25die "Need three filenames\n" if ($#ARGV != 2);
26
27my $src = $ARGV[0];
28
29open(FD, "<$src") || die $src;
30binmode FD;
31my @st = stat(FD);
32die $src if (!@st);
33read(FD, $raw_data, $st[7]) || die $src;
34close(FD);
35
36my $UNIV = 0 << 6;
37my $APPL = 1 << 6;
38my $CONT = 2 << 6;
39my $PRIV = 3 << 6;
40
41my $CONS = 0x20;
42
43my $BOOLEAN = 0x01;
44my $INTEGER = 0x02;
45my $BIT_STRING = 0x03;
46my $OCTET_STRING = 0x04;
47my $NULL = 0x05;
48my $OBJ_ID = 0x06;
49my $UTF8String = 0x0c;
50my $SEQUENCE = 0x10;
51my $SET = 0x11;
52my $UTCTime = 0x17;
53my $GeneralizedTime = 0x18;
54
55my %OIDs = (
56 pack("CCC", 85, 4, 3) => "commonName",
57 pack("CCC", 85, 4, 6) => "countryName",
58 pack("CCC", 85, 4, 10) => "organizationName",
59 pack("CCC", 85, 4, 11) => "organizationUnitName",
60 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 1, 1) => "rsaEncryption",
61 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 1, 5) => "sha1WithRSAEncryption",
62 pack("CCCCCCCCC", 42, 134, 72, 134, 247, 13, 1, 9, 1) => "emailAddress",
63 pack("CCC", 85, 29, 35) => "authorityKeyIdentifier",
64 pack("CCC", 85, 29, 14) => "subjectKeyIdentifier",
65 pack("CCC", 85, 29, 19) => "basicConstraints"
66);
67
68###############################################################################
69#
70# Extract an ASN.1 element from a string and return information about it.
71#
72###############################################################################
73sub asn1_extract($$@)
74{
75 my ($cursor, $expected_tag, $optional) = @_;
76
77 return [ -1 ]
78 if ($cursor->[1] == 0 && $optional);
79
80 die $src, ": ", $cursor->[0], ": ASN.1 data underrun (elem ", $cursor->[1], ")\n"
81 if ($cursor->[1] < 2);
82
83 my ($tag, $len) = unpack("CC", substr(${$cursor->[2]}, $cursor->[0], 2));
84
85 if ($expected_tag != -1 && $tag != $expected_tag) {
86 return [ -1 ]
87 if ($optional);
88 die $src, ": ", $cursor->[0], ": ASN.1 unexpected tag (", $tag,
89 " not ", $expected_tag, ")\n";
90 }
91
92 $cursor->[0] += 2;
93 $cursor->[1] -= 2;
94
95 die $src, ": ", $cursor->[0], ": ASN.1 long tag\n"
96 if (($tag & 0x1f) == 0x1f);
97 die $src, ": ", $cursor->[0], ": ASN.1 indefinite length\n"
98 if ($len == 0x80);
99
100 if ($len > 0x80) {
101 my $l = $len - 0x80;
102 die $src, ": ", $cursor->[0], ": ASN.1 data underrun (len len $l)\n"
103 if ($cursor->[1] < $l);
104
105 if ($l == 0x1) {
106 $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1));
107 } elsif ($l = 0x2) {
108 $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0], 2));
109 } elsif ($l = 0x3) {
110 $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)) << 16;
111 $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0] + 1, 2));
112 } elsif ($l = 0x4) {
113 $len = unpack("N", substr(${$cursor->[2]}, $cursor->[0], 4));
114 } else {
115 die $src, ": ", $cursor->[0], ": ASN.1 element too long (", $l, ")\n";
116 }
117
118 $cursor->[0] += $l;
119 $cursor->[1] -= $l;
120 }
121
122 die $src, ": ", $cursor->[0], ": ASN.1 data underrun (", $len, ")\n"
123 if ($cursor->[1] < $len);
124
125 my $ret = [ $tag, [ $cursor->[0], $len, $cursor->[2] ] ];
126 $cursor->[0] += $len;
127 $cursor->[1] -= $len;
128
129 return $ret;
130}
131
132###############################################################################
133#
134# Retrieve the data referred to by a cursor
135#
136###############################################################################
137sub asn1_retrieve($)
138{
139 my ($cursor) = @_;
140 my ($offset, $len, $data) = @$cursor;
141 return substr($$data, $offset, $len);
142}
143
144###############################################################################
145#
146# Roughly parse the X.509 certificate
147#
148###############################################################################
149my $cursor = [ 0, length($raw_data), \$raw_data ];
150
151my $cert = asn1_extract($cursor, $UNIV | $CONS | $SEQUENCE);
152my $tbs = asn1_extract($cert->[1], $UNIV | $CONS | $SEQUENCE);
153my $version = asn1_extract($tbs->[1], $CONT | $CONS | 0, 1);
154my $serial_number = asn1_extract($tbs->[1], $UNIV | $INTEGER);
155my $sig_type = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
156my $issuer = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
157my $validity = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
158my $subject = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
159my $key = asn1_extract($tbs->[1], $UNIV | $CONS | $SEQUENCE);
160my $issuer_uid = asn1_extract($tbs->[1], $CONT | $CONS | 1, 1);
161my $subject_uid = asn1_extract($tbs->[1], $CONT | $CONS | 2, 1);
162my $extension_list = asn1_extract($tbs->[1], $CONT | $CONS | 3, 1);
163
164my $subject_key_id = ();
165my $authority_key_id = ();
166
167#
168# Parse the extension list
169#
170if ($extension_list->[0] != -1) {
171 my $extensions = asn1_extract($extension_list->[1], $UNIV | $CONS | $SEQUENCE);
172
173 while ($extensions->[1]->[1] > 0) {
174 my $ext = asn1_extract($extensions->[1], $UNIV | $CONS | $SEQUENCE);
175 my $x_oid = asn1_extract($ext->[1], $UNIV | $OBJ_ID);
176 my $x_crit = asn1_extract($ext->[1], $UNIV | $BOOLEAN, 1);
177 my $x_val = asn1_extract($ext->[1], $UNIV | $OCTET_STRING);
178
179 my $raw_oid = asn1_retrieve($x_oid->[1]);
180 next if (!exists($OIDs{$raw_oid}));
181 my $x_type = $OIDs{$raw_oid};
182
183 my $raw_value = asn1_retrieve($x_val->[1]);
184
185 if ($x_type eq "subjectKeyIdentifier") {
186 my $vcursor = [ 0, length($raw_value), \$raw_value ];
187
188 $subject_key_id = asn1_extract($vcursor, $UNIV | $OCTET_STRING);
189 }
190 }
191}
192
193###############################################################################
194#
195# Determine what we're going to use as the signer's name. In order of
196# preference, take one of: commonName, organizationName or emailAddress.
197#
198###############################################################################
199my $org = "";
200my $cn = "";
201my $email = "";
202
203while ($subject->[1]->[1] > 0) {
204 my $rdn = asn1_extract($subject->[1], $UNIV | $CONS | $SET);
205 my $attr = asn1_extract($rdn->[1], $UNIV | $CONS | $SEQUENCE);
206 my $n_oid = asn1_extract($attr->[1], $UNIV | $OBJ_ID);
207 my $n_val = asn1_extract($attr->[1], -1);
208
209 my $raw_oid = asn1_retrieve($n_oid->[1]);
210 next if (!exists($OIDs{$raw_oid}));
211 my $n_type = $OIDs{$raw_oid};
212
213 my $raw_value = asn1_retrieve($n_val->[1]);
214
215 if ($n_type eq "organizationName") {
216 $org = $raw_value;
217 } elsif ($n_type eq "commonName") {
218 $cn = $raw_value;
219 } elsif ($n_type eq "emailAddress") {
220 $email = $raw_value;
221 }
222}
223
224my $id_name = $email;
225
226if ($org && $cn) {
227 # Don't use the organizationName if the commonName repeats it
228 if (length($org) <= length($cn) &&
229 substr($cn, 0, length($org)) eq $org) {
230 $id_name = $cn;
231 goto got_id_name;
232 }
233
234 # Or a signifcant chunk of it
235 if (length($org) >= 7 &&
236 length($cn) >= 7 &&
237 substr($cn, 0, 7) eq substr($org, 0, 7)) {
238 $id_name = $cn;
239 goto got_id_name;
240 }
241
242 $id_name = $org . ": " . $cn;
243} elsif ($org) {
244 $id_name = $org;
245} elsif ($cn) {
246 $id_name = $cn;
247}
248
249got_id_name:
250
251###############################################################################
252#
253# Output the signer's name and the key identifier that we're going to include
254# in module signatures.
255#
256###############################################################################
257die $src, ": ", "X.509: Couldn't find the Subject Key Identifier extension\n"
258 if (!$subject_key_id);
259
260my $id_key_id = asn1_retrieve($subject_key_id->[1]);
261
262open(OUTFD, ">$ARGV[1]") || die $ARGV[1];
263print OUTFD $id_name;
264close OUTFD || die $ARGV[1];
265
266open(OUTFD, ">$ARGV[2]") || die $ARGV[2];
267print OUTFD $id_key_id;
268close OUTFD || die $ARGV[2];
diff --git a/security/apparmor/Makefile b/security/apparmor/Makefile
index 7b3021cebbea..5706b74c857f 100644
--- a/security/apparmor/Makefile
+++ b/security/apparmor/Makefile
@@ -57,7 +57,7 @@ cmd_make-rlim = echo "static const char *const rlim_names[RLIM_NLIMITS] = {" \
57 57
58$(obj)/capability.o : $(obj)/capability_names.h 58$(obj)/capability.o : $(obj)/capability_names.h
59$(obj)/resource.o : $(obj)/rlim_names.h 59$(obj)/resource.o : $(obj)/rlim_names.h
60$(obj)/capability_names.h : $(srctree)/include/linux/capability.h \ 60$(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \
61 $(src)/Makefile 61 $(src)/Makefile
62 $(call cmd,make-caps) 62 $(call cmd,make-caps)
63$(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h \ 63$(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h \
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 24ab4148547c..61a53367d029 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2132,18 +2132,14 @@ static inline void flush_unauthorized_files(const struct cred *cred,
2132 return; 2132 return;
2133 2133
2134 devnull = dentry_open(&selinux_null, O_RDWR, cred); 2134 devnull = dentry_open(&selinux_null, O_RDWR, cred);
2135 if (!IS_ERR(devnull)) { 2135 if (IS_ERR(devnull))
2136 /* replace all the matching ones with this */ 2136 devnull = NULL;
2137 do { 2137 /* replace all the matching ones with this */
2138 replace_fd(n - 1, get_file(devnull), 0); 2138 do {
2139 } while ((n = iterate_fd(files, n, match_file, cred)) != 0); 2139 replace_fd(n - 1, devnull, 0);
2140 } while ((n = iterate_fd(files, n, match_file, cred)) != 0);
2141 if (devnull)
2140 fput(devnull); 2142 fput(devnull);
2141 } else {
2142 /* just close all the matching ones */
2143 do {
2144 replace_fd(n - 1, NULL, 0);
2145 } while ((n = iterate_fd(files, n, match_file, cred)) != 0);
2146 }
2147} 2143}
2148 2144
2149/* 2145/*
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 9473fca9681d..8b0f99688303 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
1271 tmp.index = ac97->num; 1271 tmp.index = ac97->num;
1272 kctl = snd_ctl_new1(&tmp, ac97); 1272 kctl = snd_ctl_new1(&tmp, ac97);
1273 } 1273 }
1274 if (!kctl)
1275 return -ENOMEM;
1274 if (reg >= AC97_PHONE && reg <= AC97_PCM) 1276 if (reg >= AC97_PHONE && reg <= AC97_PCM)
1275 set_tlv_db_scale(kctl, db_scale_5bit_12db_max); 1277 set_tlv_db_scale(kctl, db_scale_5bit_12db_max);
1276 else 1278 else
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index bed4485f34f6..c21adb6ef1d5 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1416,6 +1416,15 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1416 .ca0108_chip = 1, 1416 .ca0108_chip = 1,
1417 .spk71 = 1, 1417 .spk71 = 1,
1418 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */ 1418 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
1419 /* Tested by Maxim Kachur <mcdebugger@duganet.ru> 17th Oct 2012. */
1420 /* This is MAEM8986, 0202 is MAEM8980 */
1421 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102,
1422 .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]",
1423 .id = "EMU1010",
1424 .emu10k2_chip = 1,
1425 .ca0108_chip = 1,
1426 .spk71 = 1,
1427 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 PCIe */
1419 /* Tested by James@superbug.co.uk 8th July 2005. */ 1428 /* Tested by James@superbug.co.uk 8th July 2005. */
1420 /* This is MAEM8810, 0202 is MAEM8820 */ 1429 /* This is MAEM8810, 0202 is MAEM8820 */
1421 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, 1430 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6833835a218b..72b085ae7d46 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -501,6 +501,7 @@ struct azx {
501 501
502 /* VGA-switcheroo setup */ 502 /* VGA-switcheroo setup */
503 unsigned int use_vga_switcheroo:1; 503 unsigned int use_vga_switcheroo:1;
504 unsigned int vga_switcheroo_registered:1;
504 unsigned int init_failed:1; /* delayed init failed */ 505 unsigned int init_failed:1; /* delayed init failed */
505 unsigned int disabled:1; /* disabled by VGA-switcher */ 506 unsigned int disabled:1; /* disabled by VGA-switcher */
506 507
@@ -2157,9 +2158,12 @@ static unsigned int azx_get_position(struct azx *chip,
2157 if (delay < 0) 2158 if (delay < 0)
2158 delay += azx_dev->bufsize; 2159 delay += azx_dev->bufsize;
2159 if (delay >= azx_dev->period_bytes) { 2160 if (delay >= azx_dev->period_bytes) {
2160 snd_printdd("delay %d > period_bytes %d\n", 2161 snd_printk(KERN_WARNING SFX
2161 delay, azx_dev->period_bytes); 2162 "Unstable LPIB (%d >= %d); "
2162 delay = 0; /* something is wrong */ 2163 "disabling LPIB delay counting\n",
2164 delay, azx_dev->period_bytes);
2165 delay = 0;
2166 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY;
2163 } 2167 }
2164 azx_dev->substream->runtime->delay = 2168 azx_dev->substream->runtime->delay =
2165 bytes_to_frames(azx_dev->substream->runtime, delay); 2169 bytes_to_frames(azx_dev->substream->runtime, delay);
@@ -2640,7 +2644,9 @@ static void azx_vs_set_state(struct pci_dev *pci,
2640 if (disabled) { 2644 if (disabled) {
2641 azx_suspend(&pci->dev); 2645 azx_suspend(&pci->dev);
2642 chip->disabled = true; 2646 chip->disabled = true;
2643 snd_hda_lock_devices(chip->bus); 2647 if (snd_hda_lock_devices(chip->bus))
2648 snd_printk(KERN_WARNING SFX
2649 "Cannot lock devices!\n");
2644 } else { 2650 } else {
2645 snd_hda_unlock_devices(chip->bus); 2651 snd_hda_unlock_devices(chip->bus);
2646 chip->disabled = false; 2652 chip->disabled = false;
@@ -2683,14 +2689,20 @@ static const struct vga_switcheroo_client_ops azx_vs_ops = {
2683 2689
2684static int __devinit register_vga_switcheroo(struct azx *chip) 2690static int __devinit register_vga_switcheroo(struct azx *chip)
2685{ 2691{
2692 int err;
2693
2686 if (!chip->use_vga_switcheroo) 2694 if (!chip->use_vga_switcheroo)
2687 return 0; 2695 return 0;
2688 /* FIXME: currently only handling DIS controller 2696 /* FIXME: currently only handling DIS controller
2689 * is there any machine with two switchable HDMI audio controllers? 2697 * is there any machine with two switchable HDMI audio controllers?
2690 */ 2698 */
2691 return vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, 2699 err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
2692 VGA_SWITCHEROO_DIS, 2700 VGA_SWITCHEROO_DIS,
2693 chip->bus != NULL); 2701 chip->bus != NULL);
2702 if (err < 0)
2703 return err;
2704 chip->vga_switcheroo_registered = 1;
2705 return 0;
2694} 2706}
2695#else 2707#else
2696#define init_vga_switcheroo(chip) /* NOP */ 2708#define init_vga_switcheroo(chip) /* NOP */
@@ -2712,7 +2724,8 @@ static int azx_free(struct azx *chip)
2712 if (use_vga_switcheroo(chip)) { 2724 if (use_vga_switcheroo(chip)) {
2713 if (chip->disabled && chip->bus) 2725 if (chip->disabled && chip->bus)
2714 snd_hda_unlock_devices(chip->bus); 2726 snd_hda_unlock_devices(chip->bus);
2715 vga_switcheroo_unregister_client(chip->pci); 2727 if (chip->vga_switcheroo_registered)
2728 vga_switcheroo_unregister_client(chip->pci);
2716 } 2729 }
2717 2730
2718 if (chip->initialized) { 2731 if (chip->initialized) {
@@ -2813,8 +2826,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2813 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2826 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2814 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2827 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2815 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2828 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2816 SND_PCI_QUIRK(0x1043, 0x1ac3, "ASUS X53S", POS_FIX_POSBUF),
2817 SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF),
2818 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2829 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2819 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), 2830 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB),
2820 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2831 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
@@ -3062,14 +3073,6 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3062 } 3073 }
3063 3074
3064 ok: 3075 ok:
3065 err = register_vga_switcheroo(chip);
3066 if (err < 0) {
3067 snd_printk(KERN_ERR SFX
3068 "Error registering VGA-switcheroo client\n");
3069 azx_free(chip);
3070 return err;
3071 }
3072
3073 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 3076 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
3074 if (err < 0) { 3077 if (err < 0) {
3075 snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); 3078 snd_printk(KERN_ERR SFX "Error creating device [card]!\n");
@@ -3340,6 +3343,13 @@ static int __devinit azx_probe(struct pci_dev *pci,
3340 if (pci_dev_run_wake(pci)) 3343 if (pci_dev_run_wake(pci))
3341 pm_runtime_put_noidle(&pci->dev); 3344 pm_runtime_put_noidle(&pci->dev);
3342 3345
3346 err = register_vga_switcheroo(chip);
3347 if (err < 0) {
3348 snd_printk(KERN_ERR SFX
3349 "Error registering VGA-switcheroo client\n");
3350 goto out_free;
3351 }
3352
3343 dev++; 3353 dev++;
3344 return 0; 3354 return 0;
3345 3355
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8253b4eeb6a1..48d9d609f89b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
2598 return "PCM"; 2598 return "PCM";
2599 break; 2599 break;
2600 } 2600 }
2601 if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) 2601 if (ch >= ARRAY_SIZE(channel_name)) {
2602 snd_BUG();
2602 return "PCM"; 2603 return "PCM";
2604 }
2603 2605
2604 return channel_name[ch]; 2606 return channel_name[ch];
2605} 2607}
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
index bcbf1d00aa85..99f32f7c0692 100644
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -1,8 +1,9 @@
1snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o 1snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o
2snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o 2snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o
3 3
4snd-soc-dmaengine-pcm-objs := soc-dmaengine-pcm.o 4ifneq ($(CONFIG_SND_SOC_DMAENGINE_PCM),)
5obj-$(CONFIG_SND_SOC_DMAENGINE_PCM) += snd-soc-dmaengine-pcm.o 5snd-soc-core-objs += soc-dmaengine-pcm.o
6endif
6 7
7obj-$(CONFIG_SND_SOC) += snd-soc-core.o 8obj-$(CONFIG_SND_SOC) += snd-soc-core.o
8obj-$(CONFIG_SND_SOC) += codecs/ 9obj-$(CONFIG_SND_SOC) += codecs/
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 185d8dd36399..f379b085c392 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -178,6 +178,12 @@
178#define DA9055_AIF_WORD_S24_LE (2 << 2) 178#define DA9055_AIF_WORD_S24_LE (2 << 2)
179#define DA9055_AIF_WORD_S32_LE (3 << 2) 179#define DA9055_AIF_WORD_S32_LE (3 << 2)
180 180
181/* MIC_L_CTRL bit fields */
182#define DA9055_MIC_L_MUTE_EN (1 << 6)
183
184/* MIC_R_CTRL bit fields */
185#define DA9055_MIC_R_MUTE_EN (1 << 6)
186
181/* MIXIN_L_CTRL bit fields */ 187/* MIXIN_L_CTRL bit fields */
182#define DA9055_MIXIN_L_MIX_EN (1 << 3) 188#define DA9055_MIXIN_L_MIX_EN (1 << 3)
183 189
@@ -476,7 +482,7 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol) 482 struct snd_ctl_elem_value *ucontrol)
477{ 483{
478 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 484 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
479 u8 reg_val, adc_left, adc_right; 485 u8 reg_val, adc_left, adc_right, mic_left, mic_right;
480 int avg_left_data, avg_right_data, offset_l, offset_r; 486 int avg_left_data, avg_right_data, offset_l, offset_r;
481 487
482 if (ucontrol->value.integer.value[0]) { 488 if (ucontrol->value.integer.value[0]) {
@@ -485,6 +491,16 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
485 * offsets must be done first 491 * offsets must be done first
486 */ 492 */
487 493
494 /* Save current values from Mic control registers */
495 mic_left = snd_soc_read(codec, DA9055_MIC_L_CTRL);
496 mic_right = snd_soc_read(codec, DA9055_MIC_R_CTRL);
497
498 /* Mute Mic PGA Left and Right */
499 snd_soc_update_bits(codec, DA9055_MIC_L_CTRL,
500 DA9055_MIC_L_MUTE_EN, DA9055_MIC_L_MUTE_EN);
501 snd_soc_update_bits(codec, DA9055_MIC_R_CTRL,
502 DA9055_MIC_R_MUTE_EN, DA9055_MIC_R_MUTE_EN);
503
488 /* Save current values from ADC control registers */ 504 /* Save current values from ADC control registers */
489 adc_left = snd_soc_read(codec, DA9055_ADC_L_CTRL); 505 adc_left = snd_soc_read(codec, DA9055_ADC_L_CTRL);
490 adc_right = snd_soc_read(codec, DA9055_ADC_R_CTRL); 506 adc_right = snd_soc_read(codec, DA9055_ADC_R_CTRL);
@@ -520,6 +536,10 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
520 /* Restore original values of ADC control registers */ 536 /* Restore original values of ADC control registers */
521 snd_soc_write(codec, DA9055_ADC_L_CTRL, adc_left); 537 snd_soc_write(codec, DA9055_ADC_L_CTRL, adc_left);
522 snd_soc_write(codec, DA9055_ADC_R_CTRL, adc_right); 538 snd_soc_write(codec, DA9055_ADC_R_CTRL, adc_right);
539
540 /* Restore original values of Mic control registers */
541 snd_soc_write(codec, DA9055_MIC_L_CTRL, mic_left);
542 snd_soc_write(codec, DA9055_MIC_R_CTRL, mic_right);
523 } 543 }
524 544
525 return snd_soc_put_volsw(kcontrol, ucontrol); 545 return snd_soc_put_volsw(kcontrol, ucontrol);
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index e8f97af75928..00b85cc1b9a3 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -820,10 +820,10 @@ static const struct snd_soc_dapm_route intercon[] = {
820 {"VIBRA DAC", NULL, "Vibra Playback"}, 820 {"VIBRA DAC", NULL, "Vibra Playback"},
821 821
822 /* ADC -> Stream mapping */ 822 /* ADC -> Stream mapping */
823 {"ADC Left", NULL, "Legacy Capture"}, 823 {"Legacy Capture" , NULL, "ADC Left"},
824 {"ADC Left", NULL, "Capture"}, 824 {"Capture", NULL, "ADC Left"},
825 {"ADC Right", NULL, "Legacy Capture"}, 825 {"Legacy Capture", NULL, "ADC Right"},
826 {"ADC Right", NULL, "Capture"}, 826 {"Capture" , NULL, "ADC Right"},
827 827
828 /* Capture path */ 828 /* Capture path */
829 {"Analog Left Capture Route", "Headset Mic", "HSMIC"}, 829 {"Analog Left Capture Route", "Headset Mic", "HSMIC"},
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index efa93dbb0191..eab64a193989 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1028,7 +1028,7 @@ SOC_DOUBLE_R_TLV("OUT2 Digital Volume", WM2200_DAC_DIGITAL_VOLUME_2L,
1028 WM2200_DAC_DIGITAL_VOLUME_2R, WM2200_OUT2L_VOL_SHIFT, 0x9f, 0, 1028 WM2200_DAC_DIGITAL_VOLUME_2R, WM2200_OUT2L_VOL_SHIFT, 0x9f, 0,
1029 digital_tlv), 1029 digital_tlv),
1030SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT, 1030SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT,
1031 WM2200_SPK1R_MUTE_SHIFT, 1, 0), 1031 WM2200_SPK1R_MUTE_SHIFT, 1, 1),
1032}; 1032};
1033 1033
1034WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE); 1034WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE);
@@ -2091,6 +2091,7 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2091 2091
2092 switch (wm2200->rev) { 2092 switch (wm2200->rev) {
2093 case 0: 2093 case 0:
2094 case 1:
2094 ret = regmap_register_patch(wm2200->regmap, wm2200_reva_patch, 2095 ret = regmap_register_patch(wm2200->regmap, wm2200_reva_patch,
2095 ARRAY_SIZE(wm2200_reva_patch)); 2096 ARRAY_SIZE(wm2200_reva_patch));
2096 if (ret != 0) { 2097 if (ret != 0) {
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index dc0ee7626626..d8e96b2cd03e 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -575,56 +575,53 @@ static struct snd_soc_card ams_delta_audio_card = {
575}; 575};
576 576
577/* Module init/exit */ 577/* Module init/exit */
578static struct platform_device *ams_delta_audio_platform_device; 578static __devinit int ams_delta_probe(struct platform_device *pdev)
579static struct platform_device *cx20442_platform_device;
580
581static int __init ams_delta_module_init(void)
582{ 579{
580 struct snd_soc_card *card = &ams_delta_audio_card;
583 int ret; 581 int ret;
584 582
585 if (!(machine_is_ams_delta())) 583 card->dev = &pdev->dev;
586 return -ENODEV;
587
588 ams_delta_audio_platform_device =
589 platform_device_alloc("soc-audio", -1);
590 if (!ams_delta_audio_platform_device)
591 return -ENOMEM;
592 584
593 platform_set_drvdata(ams_delta_audio_platform_device, 585 ret = snd_soc_register_card(card);
594 &ams_delta_audio_card); 586 if (ret) {
595 587 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
596 ret = platform_device_add(ams_delta_audio_platform_device); 588 card->dev = NULL;
597 if (ret) 589 return ret;
598 goto err; 590 }
599
600 /*
601 * Codec platform device could be registered from elsewhere (board?),
602 * but I do it here as it makes sense only if used with the card.
603 */
604 cx20442_platform_device =
605 platform_device_register_simple("cx20442-codec", -1, NULL, 0);
606 return 0; 591 return 0;
607err:
608 platform_device_put(ams_delta_audio_platform_device);
609 return ret;
610} 592}
611late_initcall(ams_delta_module_init);
612 593
613static void __exit ams_delta_module_exit(void) 594static int __devexit ams_delta_remove(struct platform_device *pdev)
614{ 595{
596 struct snd_soc_card *card = platform_get_drvdata(pdev);
597
615 if (tty_unregister_ldisc(N_V253) != 0) 598 if (tty_unregister_ldisc(N_V253) != 0)
616 dev_warn(&ams_delta_audio_platform_device->dev, 599 dev_warn(&pdev->dev,
617 "failed to unregister V253 line discipline\n"); 600 "failed to unregister V253 line discipline\n");
618 601
619 snd_soc_jack_free_gpios(&ams_delta_hook_switch, 602 snd_soc_jack_free_gpios(&ams_delta_hook_switch,
620 ARRAY_SIZE(ams_delta_hook_switch_gpios), 603 ARRAY_SIZE(ams_delta_hook_switch_gpios),
621 ams_delta_hook_switch_gpios); 604 ams_delta_hook_switch_gpios);
622 605
623 platform_device_unregister(cx20442_platform_device); 606 snd_soc_unregister_card(card);
624 platform_device_unregister(ams_delta_audio_platform_device); 607 card->dev = NULL;
608 return 0;
625} 609}
626module_exit(ams_delta_module_exit); 610
611#define DRV_NAME "ams-delta-audio"
612
613static struct platform_driver ams_delta_driver = {
614 .driver = {
615 .name = DRV_NAME,
616 .owner = THIS_MODULE,
617 },
618 .probe = ams_delta_probe,
619 .remove = __devexit_p(ams_delta_remove),
620};
621
622module_platform_driver(ams_delta_driver);
627 623
628MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>"); 624MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
629MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone"); 625MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone");
630MODULE_LICENSE("GPL"); 626MODULE_LICENSE("GPL");
627MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
index 73ac5463c9e4..e834faf859fd 100644
--- a/sound/soc/pxa/mmp-pcm.c
+++ b/sound/soc/pxa/mmp-pcm.c
@@ -15,13 +15,13 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/dmaengine.h> 17#include <linux/dmaengine.h>
18#include <linux/platform_data/dma-mmp_tdma.h>
18#include <linux/platform_data/mmp_audio.h> 19#include <linux/platform_data/mmp_audio.h>
19#include <sound/pxa2xx-lib.h> 20#include <sound/pxa2xx-lib.h>
20#include <sound/core.h> 21#include <sound/core.h>
21#include <sound/pcm.h> 22#include <sound/pcm.h>
22#include <sound/pcm_params.h> 23#include <sound/pcm_params.h>
23#include <sound/soc.h> 24#include <sound/soc.h>
24#include <mach/sram.h>
25#include <sound/dmaengine_pcm.h> 25#include <sound/dmaengine_pcm.h>
26 26
27struct mmp_dma_data { 27struct mmp_dma_data {
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c
index 5dc10dfc0d42..b0d46d63d55e 100644
--- a/sound/soc/samsung/bells.c
+++ b/sound/soc/samsung/bells.c
@@ -212,7 +212,7 @@ static struct snd_soc_dai_link bells_dai_wm5102[] = {
212 { 212 {
213 .name = "Sub", 213 .name = "Sub",
214 .stream_name = "Sub", 214 .stream_name = "Sub",
215 .cpu_dai_name = "wm5102-aif3", 215 .cpu_dai_name = "wm5110-aif3",
216 .codec_dai_name = "wm9081-hifi", 216 .codec_dai_name = "wm9081-hifi",
217 .codec_name = "wm9081.1-006c", 217 .codec_name = "wm9081.1-006c",
218 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 218 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
@@ -247,7 +247,7 @@ static struct snd_soc_dai_link bells_dai_wm5110[] = {
247 { 247 {
248 .name = "Sub", 248 .name = "Sub",
249 .stream_name = "Sub", 249 .stream_name = "Sub",
250 .cpu_dai_name = "wm5102-aif3", 250 .cpu_dai_name = "wm5110-aif3",
251 .codec_dai_name = "wm9081-hifi", 251 .codec_dai_name = "wm9081-hifi",
252 .codec_name = "wm9081.1-006c", 252 .codec_name = "wm9081.1-006c",
253 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 253 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 5328ae5539f1..9d7f30774a44 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -20,6 +20,7 @@
20#include <linux/sh_dma.h> 20#include <linux/sh_dma.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/workqueue.h>
23#include <sound/soc.h> 24#include <sound/soc.h>
24#include <sound/sh_fsi.h> 25#include <sound/sh_fsi.h>
25 26
@@ -223,7 +224,7 @@ struct fsi_stream {
223 */ 224 */
224 struct dma_chan *chan; 225 struct dma_chan *chan;
225 struct sh_dmae_slave slave; /* see fsi_handler_init() */ 226 struct sh_dmae_slave slave; /* see fsi_handler_init() */
226 struct tasklet_struct tasklet; 227 struct work_struct work;
227 dma_addr_t dma; 228 dma_addr_t dma;
228}; 229};
229 230
@@ -1085,9 +1086,9 @@ static void fsi_dma_complete(void *data)
1085 snd_pcm_period_elapsed(io->substream); 1086 snd_pcm_period_elapsed(io->substream);
1086} 1087}
1087 1088
1088static void fsi_dma_do_tasklet(unsigned long data) 1089static void fsi_dma_do_work(struct work_struct *work)
1089{ 1090{
1090 struct fsi_stream *io = (struct fsi_stream *)data; 1091 struct fsi_stream *io = container_of(work, struct fsi_stream, work);
1091 struct fsi_priv *fsi = fsi_stream_to_priv(io); 1092 struct fsi_priv *fsi = fsi_stream_to_priv(io);
1092 struct snd_soc_dai *dai; 1093 struct snd_soc_dai *dai;
1093 struct dma_async_tx_descriptor *desc; 1094 struct dma_async_tx_descriptor *desc;
@@ -1129,7 +1130,7 @@ static void fsi_dma_do_tasklet(unsigned long data)
1129 * FIXME 1130 * FIXME
1130 * 1131 *
1131 * In DMAEngine case, codec and FSI cannot be started simultaneously 1132 * In DMAEngine case, codec and FSI cannot be started simultaneously
1132 * since FSI is using tasklet. 1133 * since FSI is using the scheduler work queue.
1133 * Therefore, in capture case, probably FSI FIFO will have got 1134 * Therefore, in capture case, probably FSI FIFO will have got
1134 * overflow error in this point. 1135 * overflow error in this point.
1135 * in that case, DMA cannot start transfer until error was cleared. 1136 * in that case, DMA cannot start transfer until error was cleared.
@@ -1153,7 +1154,7 @@ static bool fsi_dma_filter(struct dma_chan *chan, void *param)
1153 1154
1154static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) 1155static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
1155{ 1156{
1156 tasklet_schedule(&io->tasklet); 1157 schedule_work(&io->work);
1157 1158
1158 return 0; 1159 return 0;
1159} 1160}
@@ -1195,14 +1196,14 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
1195 return fsi_stream_probe(fsi, dev); 1196 return fsi_stream_probe(fsi, dev);
1196 } 1197 }
1197 1198
1198 tasklet_init(&io->tasklet, fsi_dma_do_tasklet, (unsigned long)io); 1199 INIT_WORK(&io->work, fsi_dma_do_work);
1199 1200
1200 return 0; 1201 return 0;
1201} 1202}
1202 1203
1203static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) 1204static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
1204{ 1205{
1205 tasklet_kill(&io->tasklet); 1206 cancel_work_sync(&io->work);
1206 1207
1207 fsi_stream_stop(fsi, io); 1208 fsi_stream_stop(fsi, io);
1208 1209
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index fa0fd8ddae90..1ab5fe04bfcc 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -22,7 +22,7 @@
22 22
23/** 23/**
24 * snd_soc_jack_new - Create a new jack 24 * snd_soc_jack_new - Create a new jack
25 * @card: ASoC card 25 * @codec: ASoC codec
26 * @id: an identifying string for this jack 26 * @id: an identifying string for this jack
27 * @type: a bitmask of enum snd_jack_type values that can be detected by 27 * @type: a bitmask of enum snd_jack_type values that can be detected by
28 * this jack 28 * this jack
@@ -133,12 +133,13 @@ EXPORT_SYMBOL_GPL(snd_soc_jack_add_zones);
133 133
134/** 134/**
135 * snd_soc_jack_get_type - Based on the mic bias value, this function returns 135 * snd_soc_jack_get_type - Based on the mic bias value, this function returns
136 * the type of jack from the zones delcared in the jack type 136 * the type of jack from the zones declared in the jack type
137 * 137 *
138 * @jack: ASoC jack
138 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in 139 * @micbias_voltage: mic bias voltage at adc channel when jack is plugged in
139 * 140 *
140 * Based on the mic bias value passed, this function helps identify 141 * Based on the mic bias value passed, this function helps identify
141 * the type of jack from the already delcared jack zones 142 * the type of jack from the already declared jack zones
142 */ 143 */
143int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage) 144int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage)
144{ 145{
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 47264b4652b9..f2989c525e48 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2602,6 +2602,9 @@ find_func_handler(struct pevent *pevent, char *func_name)
2602{ 2602{
2603 struct pevent_function_handler *func; 2603 struct pevent_function_handler *func;
2604 2604
2605 if (!pevent)
2606 return NULL;
2607
2605 for (func = pevent->func_handlers; func; func = func->next) { 2608 for (func = pevent->func_handlers; func; func = func->next) {
2606 if (strcmp(func->name, func_name) == 0) 2609 if (strcmp(func->name, func_name) == 0)
2607 break; 2610 break;
@@ -4938,6 +4941,9 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
4938 goto event_alloc_failed; 4941 goto event_alloc_failed;
4939 } 4942 }
4940 4943
4944 /* Add pevent to event so that it can be referenced */
4945 event->pevent = pevent;
4946
4941 ret = event_read_format(event); 4947 ret = event_read_format(event);
4942 if (ret < 0) { 4948 if (ret < 0) {
4943 ret = PEVENT_ERRNO__READ_FORMAT_FAILED; 4949 ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
@@ -5041,9 +5047,6 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf,
5041 if (event == NULL) 5047 if (event == NULL)
5042 return ret; 5048 return ret;
5043 5049
5044 /* Add pevent to event so that it can be referenced */
5045 event->pevent = pevent;
5046
5047 if (add_event(pevent, event)) { 5050 if (add_event(pevent, event)) {
5048 ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 5051 ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
5049 goto event_add_failed; 5052 goto event_add_failed;
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index ad17855528f9..5ea4326ad11f 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -209,7 +209,16 @@ static void free_arg(struct filter_arg *arg)
209 switch (arg->type) { 209 switch (arg->type) {
210 case FILTER_ARG_NONE: 210 case FILTER_ARG_NONE:
211 case FILTER_ARG_BOOLEAN: 211 case FILTER_ARG_BOOLEAN:
212 break;
213
212 case FILTER_ARG_NUM: 214 case FILTER_ARG_NUM:
215 free_arg(arg->num.left);
216 free_arg(arg->num.right);
217 break;
218
219 case FILTER_ARG_EXP:
220 free_arg(arg->exp.left);
221 free_arg(arg->exp.right);
213 break; 222 break;
214 223
215 case FILTER_ARG_STR: 224 case FILTER_ARG_STR:
@@ -218,6 +227,12 @@ static void free_arg(struct filter_arg *arg)
218 free(arg->str.buffer); 227 free(arg->str.buffer);
219 break; 228 break;
220 229
230 case FILTER_ARG_VALUE:
231 if (arg->value.type == FILTER_STRING ||
232 arg->value.type == FILTER_CHAR)
233 free(arg->value.str);
234 break;
235
221 case FILTER_ARG_OP: 236 case FILTER_ARG_OP:
222 free_arg(arg->op.left); 237 free_arg(arg->op.left);
223 free_arg(arg->op.right); 238 free_arg(arg->op.right);
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f7c968ad5178..00deed4d6159 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -184,9 +184,22 @@ SCRIPT_SH += perf-archive.sh
184grep-libs = $(filter -l%,$(1)) 184grep-libs = $(filter -l%,$(1))
185strip-libs = $(filter-out -l%,$(1)) 185strip-libs = $(filter-out -l%,$(1))
186 186
187TRACE_EVENT_DIR = ../lib/traceevent/
188
189ifneq ($(OUTPUT),)
190 TE_PATH=$(OUTPUT)
191else
192 TE_PATH=$(TRACE_EVENT_DIR)
193endif
194
195LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
196TE_LIB := -L$(TE_PATH) -ltraceevent
197
187PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) 198PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
188PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py 199PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py
189 200
201export LIBTRACEEVENT
202
190$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) 203$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
191 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ 204 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
192 --quiet build_ext; \ 205 --quiet build_ext; \
@@ -198,17 +211,6 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
198 211
199SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) 212SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
200 213
201TRACE_EVENT_DIR = ../lib/traceevent/
202
203ifneq ($(OUTPUT),)
204 TE_PATH=$(OUTPUT)
205else
206 TE_PATH=$(TRACE_EVENT_DIR)
207endif
208
209LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
210TE_LIB := -L$(TE_PATH) -ltraceevent
211
212# 214#
213# Single 'perf' binary right now: 215# Single 'perf' binary right now:
214# 216#
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 276287783a03..c50985eaec41 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -57,7 +57,7 @@ void get_term_dimensions(struct winsize *ws);
57#endif 57#endif
58 58
59#ifdef __sparc__ 59#ifdef __sparc__
60#include "../../arch/sparc/include/asm/unistd.h" 60#include "../../arch/sparc/include/uapi/asm/unistd.h"
61#define rmb() asm volatile("":::"memory") 61#define rmb() asm volatile("":::"memory")
62#define cpu_relax() asm volatile("":::"memory") 62#define cpu_relax() asm volatile("":::"memory")
63#define CPUINFO_PROC "cpu" 63#define CPUINFO_PROC "cpu"
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 0568536ecf67..ef2f93ca7496 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -610,6 +610,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
610 char folded_sign = ' '; 610 char folded_sign = ' ';
611 bool current_entry = ui_browser__is_current_entry(&browser->b, row); 611 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
612 off_t row_offset = entry->row_offset; 612 off_t row_offset = entry->row_offset;
613 bool first = true;
613 614
614 if (current_entry) { 615 if (current_entry) {
615 browser->he_selection = entry; 616 browser->he_selection = entry;
@@ -633,10 +634,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
633 if (!perf_hpp__format[i].cond) 634 if (!perf_hpp__format[i].cond)
634 continue; 635 continue;
635 636
636 if (i) { 637 if (!first) {
637 slsmg_printf(" "); 638 slsmg_printf(" ");
638 width -= 2; 639 width -= 2;
639 } 640 }
641 first = false;
640 642
641 if (perf_hpp__format[i].color) { 643 if (perf_hpp__format[i].color) {
642 hpp.ptr = &percent; 644 hpp.ptr = &percent;
@@ -645,7 +647,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
645 647
646 ui_browser__set_percent_color(&browser->b, percent, current_entry); 648 ui_browser__set_percent_color(&browser->b, percent, current_entry);
647 649
648 if (i == 0 && symbol_conf.use_callchain) { 650 if (i == PERF_HPP__OVERHEAD && symbol_conf.use_callchain) {
649 slsmg_printf("%c ", folded_sign); 651 slsmg_printf("%c ", folded_sign);
650 width -= 2; 652 width -= 2;
651 } 653 }
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index aed38e4b9dfa..75c7b0fca6d9 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -690,6 +690,9 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
690 eH = 0; 690 eH = 0;
691 } else if (*str == 'p') { 691 } else if (*str == 'p') {
692 precise++; 692 precise++;
693 /* use of precise requires exclude_guest */
694 if (!exclude_GH)
695 eG = 1;
693 } else 696 } else
694 break; 697 break;
695 698
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index d0f9f29cf181..73d510269784 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -23,6 +23,7 @@ cflags += getenv('CFLAGS', '').split()
23 23
24build_lib = getenv('PYTHON_EXTBUILD_LIB') 24build_lib = getenv('PYTHON_EXTBUILD_LIB')
25build_tmp = getenv('PYTHON_EXTBUILD_TMP') 25build_tmp = getenv('PYTHON_EXTBUILD_TMP')
26libtraceevent = getenv('LIBTRACEEVENT')
26 27
27ext_sources = [f.strip() for f in file('util/python-ext-sources') 28ext_sources = [f.strip() for f in file('util/python-ext-sources')
28 if len(f.strip()) > 0 and f[0] != '#'] 29 if len(f.strip()) > 0 and f[0] != '#']
@@ -31,6 +32,7 @@ perf = Extension('perf',
31 sources = ext_sources, 32 sources = ext_sources,
32 include_dirs = ['util/include'], 33 include_dirs = ['util/include'],
33 extra_compile_args = cflags, 34 extra_compile_args = cflags,
35 extra_objects = [libtraceevent],
34 ) 36 )
35 37
36setup(name='perf', 38setup(name='perf',
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b5b1b9211960..cfd1c0feb32d 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -260,6 +260,12 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
260 if (path != NULL) 260 if (path != NULL)
261 goto out_path; 261 goto out_path;
262 262
263 if (!self->ms.map)
264 goto out_ip;
265
266 if (!strncmp(self->ms.map->dso->long_name, "/tmp/perf-", 10))
267 goto out_ip;
268
263 snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64, 269 snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
264 self->ms.map->dso->long_name, self->ip); 270 self->ms.map->dso->long_name, self->ip);
265 fp = popen(cmd, "r"); 271 fp = popen(cmd, "r");